about summary refs log tree commit diff
path: root/aoc/2024/01/part-two.py
blob: 5000c9cfeab401bfcdce5d4261c77758555dedda (plain) (blame)
1
2
3
4
5
6
from sys import stdin
from collections import Counter

left, right = zip(*((int(a), int(b)) for a, b in map(str.split, stdin)))
counter = Counter(right)
print(sum(counter[n]*n for n in left))