int input min1 float inf ans for in range map int input split ans max

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
n = int(input())
min1 = float('inf')
ans = 0
for i in range(n):
x,y = map(int,input().split())
ans += max(x,y)
print(abs(x-y))
if x%4 != y%4 and abs(x-y) < min1:
min1 = abs(x-y)
print(min1)
if ans%4 == 0 and min1 != float('inf'):print(ans-min1)
elif ans%4 != 0:print(ans)
else: print('no')