Skip to content

Commit

Permalink
2024-01
Browse files Browse the repository at this point in the history
  • Loading branch information
Viliam Pucik authored and Viliam Pucik committed Dec 16, 2024
1 parent 75ee42c commit 4d2f1d8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions 2024/01.py
Original file line number Diff line number Diff line change
@@ -0,0 1,8 @@
#!/usr/bin/env python
from collections import Counter

left, right = zip(*(map(int, line.split()) for line in open(0)))
rcounts = Counter(right)

print(sum(abs(l - r) for l, r in zip(sorted(left), sorted(right))))
print(sum(l * rcounts[l] for l in left))

0 comments on commit 4d2f1d8

Please sign in to comment.