summaryrefslogtreecommitdiffstats
path: root/6.py
blob: 2d189de4a5ff1c2d1ae15da4797c01f4b525b46e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from collections import Counter, deque
from utils import open_day

fish = list(map(int, open_day(6).read().split(',')))

def solve(fish, life):
    d = deque(Counter(fish)[i] for i in range(9))
    for i in range(life):
        zeros = d.popleft()
        d[6] += zeros
        d.append(zeros)
    return sum(d)

print(solve(fish, 80))
print(solve(fish, 256))