diff options
Diffstat (limited to 'aoc/2024/01/part-two.py')
-rw-r--r-- | aoc/2024/01/part-two.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/aoc/2024/01/part-two.py b/aoc/2024/01/part-two.py new file mode 100644 index 0000000..5000c9c --- /dev/null +++ b/aoc/2024/01/part-two.py @@ -0,0 +1,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)) |