Advertisement
Guest User

advent of code 2022 day 21

a guest
Dec 27th, 2022
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. import re
  2. d=re.sub(" ([-+*/]) ([a-z]+)",r"()\1\2()",open("input.txt").read().replace(":","=lambda:"))
  3. exec(d+"\nprint(int(root()))")
  4. d=re.sub("(root.*)[-+*/](.*)",r"g\1>\2\n\1!=\2",d)
  5. exec(d+"\ni=1;s=9**9;humn=lambda:i;g=groot()\nwhile root():\n i+=s\n if g!=groot():g=groot();s*=-1/9;\nprint(int(i))")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement