summaryrefslogtreecommitdiff
path: root/1_2021.py
blob: 8c2965d269dd09441102c8f9f9f094f79f05a098 (plain)
1
2
3
4
5
6
7
8
9
10
11
p1 = 0
p2 = 0
XS = [int(x) for x in open("day1data.txt")]
for i in range(len(XS)):
    if i >= 1 and XS[i] > XS[i - 1]:
        p1 += 1
    if i >= 3 and XS[i] + XS[i - 1] + XS[i - 2] > XS[i - 1] + XS[i - 2] + XS[i - 3]:
        p2 += 1

print(p1)
print(p2)