14 lines
371 B
Python
14 lines
371 B
Python
input = [i.rstrip() for i in open("input").readlines()]
|
|
splitted = [i.split(' ') for i in input]
|
|
|
|
left = [int(i[0]) for i in splitted]
|
|
left = sorted(left)
|
|
right = [int(i[1]) for i in splitted]
|
|
right = sorted(right)
|
|
|
|
output = []
|
|
for index in range(len(left)):
|
|
signed_dist = int(left[index]) - int(right[index])
|
|
output.append(abs(signed_dist))
|
|
|
|
print(sum(output)) |