advent-of-code-2022/day01/golf.py

4 lines
179 B
Python
Raw Permalink Normal View History

2022-12-01 22:28:07 +01:00
d=sorted([sum(map(int,x))for x in[z.split()for z in open(0).read().split("\n\n")]]);print(d[-1],sum(d[-3:]))
# 108 bytes, requires piped input. `cat input.txt | python3 golf.py`