Advertisement
icarussiano

Day1 and Day2

Dec 4th, 2022
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. Day 1
  2. Part 1
  3. print(max(sum(map(int,x.split()))for x in open('input.txt').read().split('\n\n')))
  4. Part 2
  5. print(sum(sorted(sum(map(int,x.split()))for x in open('input.txt').read().split('\n\n'))[-3:]))
  6.  
  7. Day 2
  8. Part 1
  9. print(sum(map(lambda x: x[1]+4 if (x[1]==x[0]) else (x[1]+1 if x[1]==(x[0]-1)%3 else x[1]+7),[(ord(a)-ord("A"),ord(b)-ord("X")) for a,b in [l.split() for l in open("input.txt").read().split("\n")]])))
  10.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement