22 lines
423 B
Python
22 lines
423 B
Python
#!/usr/bin/env python
|
|
# 2024 - Advent Of Code 1
|
|
|
|
# file = 'input_example.txt'
|
|
file = 'input.txt'
|
|
|
|
firsts = []
|
|
seconds = []
|
|
accum = 0
|
|
with open(file, encoding="utf-8") as f:
|
|
for line in f.readlines():
|
|
a, b, c, d = line.strip().split(' ')
|
|
firsts.append(int(a))
|
|
seconds.append(int(d))
|
|
|
|
firsts.sort()
|
|
seconds.sort()
|
|
|
|
for x, y in zip(firsts, seconds):
|
|
accum += abs(y - x)
|
|
|
|
print(f"sum: {accum}")
|