aoc2021/1/b.py
2021-12-01 13:29:22 -08:00

21 lines
279 B
Python

with open("input.txt") as f:
lines = [int(i) for i in f.readlines()]
hits = 0
window = lines[0:3]
for line in lines[3:]:
oldwindow = list(window)
window.pop(0)
window.append(line)
if sum(oldwindow) < sum(window):
hits += 1
print(hits)
# 5m41s