The iptables rules you entered should not have caused internet to stop working, so there may be some context you haven't shared with us. Perhaps some previous rules from UFW or elsewhere where these added rules mess up.
To undo your situation, you can either flush the rule set or back out one at a time. Backing out one at a time might allow you to determine which rule broke your internet access.
Starting from your added rules:
doug@s19:~/prime95$ sudo iptables -xvnL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
20 820 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:!0x17/0x02 state NEW
0 0 DROP all -f * * 0.0.0.0/0 0.0.0.0/0
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x3F/0x3F
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x3F/0x00
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
For the backout method just change your "Append" directive to a "Delete" directive and re-enter the rule:
doug@s19:~/prime95$ sudo iptables -D INPUT -p tcp --tcp-flags ALL NONE -j DROP
And now:
doug@s19:~/prime95$ sudo iptables -xvnL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
20 820 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:!0x17/0x02 state NEW
0 0 DROP all -f * * 0.0.0.0/0 0.0.0.0/0
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x3F/0x3F
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Repeat for all your rules:
doug@s19:~/prime95$ sudo iptables -D INPUT -p tcp --tcp-flags ALL ALL -j DROP
doug@s19:~/prime95$ sudo iptables -D INPUT -f -j DROP
doug@s19:~/prime95$ sudo iptables -D INPUT -p tcp ! --syn -m state --state NEW -j DROP
doug@s19:~/prime95$ sudo iptables -xvnL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination