aoc-2024/1/1.py

5 lines
199 B
Python
Raw Normal View History

2024-12-03 09:16:52 +00:00
with open('1.input') as f:
l,r=[],[]
d=lambda a,b:[abs(a-b) for a,b in zip(sorted(a), sorted(b))]
for i in f:l.append(int(i.split()[0])),r.append(int(i.split()[1]))
print(sum(d(l,r)))