diff --git a/day06/input.txt b/day06/input.txt new file mode 100644 index 0000000..d26656d --- /dev/null +++ b/day06/input.txt @@ -0,0 +1 @@ +1,1,1,2,1,5,1,1,2,1,4,1,4,1,1,1,1,1,1,4,1,1,1,1,4,1,1,5,1,3,1,2,1,1,1,2,1,1,1,4,1,1,3,1,5,1,1,1,1,3,5,5,2,1,1,1,2,1,1,1,1,1,1,1,1,5,4,1,1,1,1,1,3,1,1,2,4,4,1,1,1,1,1,1,3,1,1,1,1,5,1,3,1,5,1,2,1,1,5,1,1,1,5,3,3,1,4,1,3,1,3,1,1,1,1,3,1,4,1,1,1,1,1,2,1,1,1,4,2,1,1,5,1,1,1,2,1,1,1,1,1,1,1,1,2,1,1,1,1,1,5,1,1,1,1,3,1,1,1,1,1,3,4,1,2,1,3,2,1,1,2,1,1,1,1,4,1,1,1,1,4,1,1,1,1,1,2,1,1,4,1,1,1,5,3,2,2,1,1,3,1,5,1,5,1,1,1,1,1,5,1,4,1,2,1,1,1,1,2,1,3,1,1,1,1,1,1,2,1,1,1,3,1,4,3,1,4,1,3,2,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,1,2,1,5,1,1,1,1,2,1,1,1,3,5,1,1,1,1,5,1,1,2,1,2,4,2,2,1,1,1,5,2,1,1,5,1,1,1,1,5,1,1,1,2,1 diff --git a/day06/part1.py b/day06/part1.py new file mode 100644 index 0000000..f5a26f8 --- /dev/null +++ b/day06/part1.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 +from collections import Counter + +counter = Counter(map(int, [x for x in open("input.txt")][0].split(','))) +counter = [counter.get(idx, 0) for idx in range(0, 9)] + +for day in range(80): + counter = counter[1:] + counter[:1] + counter[6] += counter[-1] + +print(sum(counter)) diff --git a/day06/part2.py b/day06/part2.py new file mode 100644 index 0000000..c63ebe9 --- /dev/null +++ b/day06/part2.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 +from collections import Counter + +counter = Counter(map(int, [x for x in open("input.txt")][0].split(','))) +counter = [counter.get(idx, 0) for idx in range(0, 9)] + +for day in range(256): + counter = counter[1:] + counter[:1] + counter[6] += counter[-1] + +print(sum(counter))