1.py (216B) [raw]
1 import sys 2 3 l1 = [] 4 l2 = [] 5 6 for l in sys.stdin: 7 l = [int(x) for x in l.split()] 8 l1.append(l[0]) 9 l2.append(l[1]) 10 11 l1.sort() 12 l2.sort() 13 14 s = 0 15 for i in range(len(l1)): 16 s += abs(l1[i] - l2[i]) 17 18 print(s)