22 lines
363 B
Python
22 lines
363 B
Python
from lib import get_data
|
|
from lib import ints
|
|
|
|
data = get_data(__file__)
|
|
|
|
s = 0
|
|
ass, bss = [], []
|
|
s2 = 0
|
|
|
|
# I had an intuition for this and then went for loops...
|
|
xs, ys = list(zip(*[ints(line) for line in data.splitlines()]))
|
|
|
|
xs = sorted(xs)
|
|
ys = sorted(ys)
|
|
|
|
for a, b in zip(xs, ys):
|
|
s += max(a, b) - min(a, b)
|
|
s2 += ys.count(a) * a
|
|
|
|
print(s)
|
|
print(s2)
|