Day 1 - Advent of Code 2026
Working solutions for the day 1 puzzles.
Part One
""" day_01_01.py """
# usage: python3 day_01_01.py < input
import sys
tally = {}
with sys.stdin as infile:
while (value := infile.readline()):
value = int(value)
tally[value] = tally.get(value, 0) + 1
data = list(sorted(tally.items(), key=lambda x: x[1], reverse=True))
print(data[0][0] * data[1][0] * data[2][0])Part Two
""" day_01_02.py """
# usage: python3 day_01_02.py < input
import sys
tally = {}
with sys.stdin as infile:
while (value := infile.readline()):
value = int(value)
tally[value] = tally.get(value, 0) + 1
data = list(sorted(tally.items(), key=lambda x: x[1]))
print(data[0][0] * data[1][0] * data[2][0])