Problem:
 Score : 200 points    Problem Statement A group of people played a game. All players had distinct scores, which are positive integers.  Takahashi knows N facts on the players' scores. The i -th fact is as follows: the A_i -th highest score among the players is B_i .  Find the maximum possible number of players in the game.      Constraints  1 \leq N \leq 10^5  1 \leq A_i \leq 10^9(1\leq i\leq N)  0 \leq B_i \leq 10^9(1\leq i\leq N)  If i ≠ j , A_i ≠ A_j .  There exists a possible outcome of the game that are consistent with the facts.  All input values are integers.         Inputs Input is given from Standard Input in the following format:  N  A_1  B_1 : A_N  B_N       Outputs Print the maximum possible number of players in the game.        Sample Input 1 3
4 7
2 9
6 2      Sample Output 1 8  The maximum possible number of players is achieved when, for example, the players have the following scores: 12,9,8,7,5,2,1,0 .       Sample Input 2 5
1 10
3 6
5 2
4 4
2 8      Sample Output 2 7       Sample Input 3 2
1 1000000000
1000000000 1      Sample Output 3 1000000001

Solution (Python):
def main():
    N=int(input())
    AB=[0]*N
    for i in range(N):
        AB[i]=list(map(int,input().split()))
    AB.sort()
    count=AB[-1][0]
    count+=AB[-1][1]
    print(count)
if __name__=="__main__":
    main()

Solution (Python):
N=int(input())
tmp=0
M=0
for i in range (N):
	A,B=map(int,input().split())
	if tmp<A:
		tmp=A
		M=B
		
print(tmp+M)

Solution (Python):

n = int(input())
ab = []
for i in range(n):
    ab.append([int(i) for i in input().split()])

ab.sort()
ans = ab[n-1][0] + ab[n-1][1]
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
ab = [tuple(map(int, input().split())) for _ in range(N)]
ab.sort()
ans = ab[-1][0] - ab[0][0] + 1
ans += ab[0][0] - 1
ans += ab[-1][1]

print(ans)

Solution (Python):
N = int(input())
MAXA = -1
MINB = -1
for _ in range(N):
    A,B = map(int,input().split())
    if MAXA < A:
        MAXA,MINB = A,B
    
print(MAXA+MINB)

Solution (Python):
import sys
input = sys.stdin.readline

N = int(input())
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda k: k[0], reverse=True)

print(AB[0][0]+AB[0][1])

Solution (Python):
N=int(input())
AB=[tuple(map(int, input().split())) for _ in range(N)]

max_a=0
max_b=0
for a,b in AB:
    if max_a<a:
        max_a=a
        max_b=b
print(max_b+max_a)

Solution (Python):
n = int(input())
info = [tuple(map(int, input().split())) for _ in range(n)]
info = sorted(info, reverse=True)
print(info[0][0] + info[0][1])

Solution (Python):
n = int(input())
L = [[0, 0] for _ in range(n)]
for i in range(n):
    a, b = map(int, input().split())
    L[i][0] = a
    L[i][1] = b

L.sort(reverse=True)
print(L[0][0]+L[0][1])

Solution (Python):
def main():
    N = int(input())
    A = [[int(i) for i in input().split()] for j in range(N)]
    mi = 0
    idx = 0
    for a, b in A:
        if mi < a:
            mi = a
            idx = b
    print(mi + idx)


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
ab = [list(map(int, input().split())) for i in range(n)]
ab.sort()
print(sum(ab[-1]))

Solution (Python):
n = int(input())
min_point = 0
min_rank = 0

for _ in range(n):
    a, b = map(int, input().split())
    if a > min_rank:
        min_rank = a
        min_point = b
print(min_rank+min_point)

Solution (Python):
n=int(input())
a=0
ans=0
for i in range(n):
  x,y=map(int,input().split())
  if a<x:
    ans=x+y
    a=x
print(ans)

Solution (Python):
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]

ab.sort(reverse = True)
print(ab[0][0] + ab[0][1])

Solution (Python):
N=int(input())
print(sum(max(tuple(map(int, input().split()))for _ in range(N))))

Solution (Python):
N = int(input())
AB = []
for i in range(N):
    a, b = list(map(int, input().split()))
    AB.append([a, b])

AB.sort(reverse=True, key=lambda x:x[0])
ans = AB[0][0] + AB[0][1]
print(ans)

Solution (Python):
N = int(input())
k = []
for i in range(N):
    a,b = map(int,input().split())
    k.append([a,b])
k.sort()
t = k[len(k)-1][0]
u = k[len(k)-1][1]
print(t+u)

Solution (Python):
n = int(input())
dat = []
for _ in range(n):
    a = tuple(map(int, input().split()))
    dat.append(a)
dat.sort(reverse=True)
print(dat[0][0] + dat[0][1])

Solution (Python):
A_B=[list(map(int,input().split())) for _ in range(int(input()))]
ans=[A_B[0][0],A_B[0][1]]
for a_b in A_B:
    if ans[0]<a_b[0]:
        ans[0]=a_b[0]
    if ans[1]>a_b[1]:
        ans[1]=a_b[1]
print(sum(ans))

Solution (Python):
n=int(input())
m=0
x=0
for i in range(n):
  a,b=map(int,input().split())
  if a>m:
    m=a
    x=a+b
print(x)

Solution (Python):
N = int(input())
a, b = [], []
for i in range(N):
    A, B = map(int, input().split())
    a.append(A)
    b.append(B)
print(max(a)+min(b))

Solution (Python):
n = int(input())
s = []
for i in range(n):
    s.append(list(map(int, input().split())))

s.sort()



ans = (s[0][0] - 1) + (s[-1][0] - s[0][0] + 1) + (s[-1][1])

print(ans)

Solution (Python):
n = int(input())
lis = []
for i in range(n):
    lis.append(list(map(int, input().split())))
lis.append([int(),0])
lis = sorted(lis, key=lambda x:x[0])


lis.reverse()

print(lis[0][0]+lis[0][1])

Solution (Python):
N = int(input())
max_A = 0
min_B = 0
for i in range(N):
    A, B = list(map(int, input().split()))
    if(A > max_A):
        max_A = A
        min_B = B
print(max_A+min_B)

Solution (Python):
n=int(input())
amax=0
bmax=0
amin=1000
bmin=1000
for i in range(n):
  a,b=map(int,input().split())
  if a>amax:
    amax=a
    bmax=b      

print(amax+bmax)

Solution (Python):
N = int(input())
a = 0
b = 0
for i in range(N):
  A, B = map(int, input().split())
  if a < A:
    a = A
    b = B
print(a + b)

Solution (Python):
import math
import itertools





n = int(input())
a = []
b = []

for i in range(n):
    x,y = [int(j) for j in input().split()]
    a.append(x)
    b.append(y)


mN = -1
posi = -1

for i in range(n):
    if a[i] > mN:
        mN = a[i]
        posi = i

print(mN+b[posi])

Solution (Python):
n = int(input())
a,b = map(int,input().split())
min_b = b
min_b_a = a
for i in range(n-1):
    a,b = map(int,input().split())
    if min_b>b:
        min_b = b
        min_b_a = a
print(min_b_a+min_b)

Solution (Python):
n=int(input())
a=[]
for i in range(n):
    a.append(list(map(int,input().split())))


a.sort()
ans=0
ans=a[n-1][0]+a[n-1][1]
print(ans)

Solution (Python):
n  =int(input())
data = []
for i in range(n):
    data.append(list(map(int, input().split())))
data.sort()
ans = data[-1][0] - data[0][0] + 1
ans += data[0][0] - 1
ans += data[-1][1]
print(ans)

Solution (Python):
n = int(input())
AB = [list(map(int, input().split())) for _ in range(n)]
AB.sort(key=lambda ab: ab[1])
print(AB[-1][0] - 1 + AB[0][1] + (AB[0][0] - AB[-1][0] + 1))

Solution (Python):

n = int(input())
a = [0]*n
b = [0]*n
for i in range(n):
    a[i],b[i] = map(int,input().split())
a,b = zip(*sorted(zip(a,b)))
print(a[-1]+b[-1])

Solution (Python):

import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n=int(input())
for i in range(n):
    a,b=map(int,input().split())
    if ans < a:
        ans = a; mans = b
print(ans+mans)

Solution (Python):
n=int(input())
l=sorted([list(map(int,input().split())) for _ in range(n)])
a,b,c=l[0][0],l[-1][0],l[-1][1]
print((a-1)+(b-a+1)+c)

Solution (Python):
n = int(input())
s = [list(map(int,input().split())) for _ in range(n)]
print(max(s)[0] + max(s)[1])

Solution (Python):
n=int(input())
d={}
m=0
for i in range(n):
	a,b=map(int,input().split())
	d[a]=b
	m=max(m,a)
print(m+d[m])

Solution (Python):
n = int(input())
l = sorted([[int(i) for i in input().split()] for _ in range(n)],key = lambda x: x[0])

print(l[-1][0] + l[-1][1])

Solution (Python):
n = int(input())

abl = []
for _ in range(n):
   a,b = map(int,input().split())
   abl.append((a,b))

abl = sorted(abl, reverse=True)

print(sum(abl[0]))

Solution (Python):
N = int(input())
A = [0] * N
B = [0] * N
for i in range(N):
	a,b = map(int,input().split())
	A[i] = a
	B[i] = b
print(max(A) + min(B))

Solution (Python):
N = int(input())
A = []
B = []
for i in range(N):
	a,b = map(int,input().split())
	A.append(a)
	B.append(b)
sum = max(A) - min(A) + 1
sum += min(A) - 1
sum += min(B)
print(sum)

Solution (Python):
a = int(input())
l = []
for i in range(a):
    ta,tb = map(int,input().split())
    l.append([ta,tb])
l.sort()

ans =0
A = 1
B = 10000000010
for i , j in l:
    ans+= min(i-A,abs(B-j))
    A = i;B=j
    
print(ans+l[-1][1]+1)

Solution (Python):
n=int(input())
a=sorted([list(map(int,input().split())) for i in range(n)])
print(sum(a[-1]))

Solution (Python):
from sys import stdin

n = int(stdin.readline().rstrip())
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]

li.sort()

print(sum(li[-1]))

Solution (Python):
n = int(input())
mxa = 0
for i in range(n):
    a, b = map(int, input().split())
    if a > mxa:
        mxa = a
        mxb = b
print(mxa+mxb)

Solution (Python):
n = int(input())

*ab, = (tuple(map(int, input().split())) for _ in range(n))
x = max(ab, key=lambda x: x[0])
print(sum(x))

Solution (Python):
def main():
    N = int(input())
    A = [[int(i) for i in input().split()] for j in range(N)]
    A.sort(key=lambda p: p[1])
    print(sum(A[0]))


if __name__ == '__main__':
    main()

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    AB=LLIN(N)
    AB.sort(reverse=True)
    print(AB[0][0]+AB[0][1])
if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
ls = [[int(_) for _ in input().split()] for _ in range(n)]

lsmx = [0, 0]

for i in range(n):
    if ls[i][0] >= lsmx[0]:
        lsmx = ls[i]

print(lsmx[0] + lsmx[1])

Solution (Python):
n = int(input())
a_max = 0
b = -1

for _ in range(n):
	ta,tb = map(int, input().split())
	if ta > a_max:
		a_max = ta
		b = tb

print(a_max + b)

Solution (Python):
N = int(input())

maxi = -1
sc = 0

for i in range(N):
	A, B = map(int, input().split())
	if A > maxi:
		maxi = A
		sc = B
print(maxi + sc)

Solution (Python):
n=int(input())
li = [list(map(int,input().split())) for i in range(n)]
li.sort(reverse=True)
print(li[0][0]+li[0][1])

Solution (Python):
N = int(input())
AB = [list(map(int,input().split())) for _ in range(N)]
AB = sorted(AB)

ans = N + AB[-1][1]
for i in range(N):
  if i == 0:
    ans += AB[0][0] - 1
  else:
    ans += min(abs(AB[i][0]-AB[i-1][0])-1,abs(AB[i][1]-AB[i-1][1])-1)
print(ans)

Solution (Python):
n=int(input())
l=[]
a=10**9
for i in range(n):
  l.append([int(i) for i in input().split()])
ll=sorted(l)
print(ll[-1][0]+ll[-1][1])

Solution (Python):
N=int(input())

A = []
B = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    A.append(x1)
    B.append(y1)

tmp=max(A)
idx=A.index(tmp)
print(tmp+B[idx])

Solution (Python):
AB = [list(map(int,input().split())) for _ in range(int(input()))]
AB.sort()
print(AB[-1][0]+AB[-1][1])

Solution (Python):
n=int(input())
AB=[list(map(int,input().split())) for _ in range(n)]

AB.sort()
print(AB[-1][0]+AB[-1][1])

Solution (Python):
N=int(input())
U=[]
for i in range(N):
    A=list(map(int,input().split()))
    U.append(A)

U.sort(reverse=True)
print(U[0][0]+U[0][1])

Solution (Python):
n = int(input())
x = []
for i in range(n):
    y = list(map(int,input().split()))
    x.append(y)

x.sort(reverse=True)
ans = x[0][0] + x[0][1]
print(ans)

Solution (Python):
def main():
    N = int(input())
    ls = [[int(x) for x in input().split()] for _ in range(N)]
    ls = sorted(ls,key=lambda x:-x[0])
    print(sum(ls[0]))
if __name__ == "__main__":
    main()

Solution (Python):
ans = 1<<100
for _ in range(int(input())):
    a, b = map(int, input().split())
    ans = min(ans, a+b)
print(ans)

Solution (Python):
n = int(input())
bottom = 10 ** 9+7
person = 0

for _ in range(n):
    a, b = map(int, input().split())
    if b < bottom:
        person = max(person, a)
        bottom = b

ans = person + bottom
print(ans)

Solution (Python):


n=int(input())
ab=[]
for i in range(n):
    a,b=map(int,input().split())
    ab.append((a,b))
ab.sort()
print(ab[-1][0]+ab[-1][1])

Solution (Python):
N = int(input())
AB = [[int(i) for i in input().split()] for _ in range(N)]

AB.sort()
print(sum(AB[-1]))

Solution (Python):
N = int(input())
A = sorted([list(map(int,input().split())) for _ in range(N)],key=lambda x:x[0])
a = A[-1][0]
b = A[-1][1]
print(a+b)

Solution (Python):
N=int(input())
AB=[tuple(map(int,input().split())) for i in range(N)]
AB.sort(key=lambda x:x[0])
print(sum(AB[-1]))

Solution (Python):
import sys
read = sys.stdin.read

N, *AB = map(int, read().split())
AB = max(zip(*[iter(AB)] * 2))
print(sum(AB))

Solution (Python):
import sys
read = sys.stdin.read

N, *AB = map(int, read().split())
AB = list(sorted(zip(*[iter(AB)] * 2)))
print(sum(AB[-1]))

Solution (Python):
N = int(input())
score = []

for i in range(N):
    a, b = map(int, input().split())
    score.append([a,b])

score.sort(key = lambda x:x[0])

ans = score[0][0]

for i in range(1,N):
    ans += score[i][0] - score[i-1][0]
    
if score[-1][1] != 0:
    ans += score[-1][1]

print(ans)

Solution (Python):
n=int(input())
l=sorted([list(map(int,input().split())) for i in range(n)])
print(l[0][0]-1 + (l[-1][0]-l[0][0]+1) + l[-1][1])

Solution (Python):
n=int(input())
ans=2000000001
for i in range(n):
  a,b=map(int,input().split())
  if(a+b<ans):
    ans=a+b
print(ans)

Solution (Python):
from operator import itemgetter


n = int(input())
info = [list(map(int, input().split())) for i in range(n)]

info = sorted(info, key = itemgetter(1))
print(info[0][0] + info[0][1])

Solution (Python):
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    ab = [list(map(int, readline().split())) for _ in range(n)]
    ab.sort()
    print((ab[-1][0] - ab[0][0] + 1) + (ab[0][0] - 1) + (ab[-1][1]))


if __name__ == '__main__':
    solve()

Solution (Python):
N=int(input())
maxrank=10**5+1
minrank=0
minpoint=10**9+1
for i in range(N):
  a,b=map(int,input().split())
  maxrank=min(maxrank,a)
  minrank=max(minrank,a)
  minpoint=min(minpoint,b)
print((minrank-maxrank+1)+(maxrank-1)+minpoint)

Solution (Python):
N = int(input())
a = [list(map(int, input().split())) for _ in range(N)]

tmpa = sorted(a, key=lambda x: x[0])
ans = tmpa[-1][0] + tmpa[-1][1]
print(ans)

Solution (Python):
n = int(input())
ans = 0
c = 0
for _ in range(n):
  a, b = map(int, input().split())
  if a > c:
    ans = a+b
    c = a
    
print(ans)

Solution (Python):
N=int(input())
ans=2*10**9
for i in range(N):
    ans=min(ans,sum(list(map(int,input().split()))))
print(ans)

Solution (Python):
n = int(input())
AB = sorted([ list(map(int, input().split())) for _ in range(n) ])
print(sum(AB[::-1][0]))

Solution (Python):

import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, A: "List[int]", B: "List[int]"):
    ab = [[A[i],B[i]] for i in range(N)]
    x = sorted(ab, key=lambda x:-x[0])
    print(x[0][0]+x[0][1])
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    A = [int()] * (N)  
    B = [int()] * (N)  
    for i in range(N):
        A[i] = int(next(tokens))
        B[i] = int(next(tokens))
    solve(N, A, B)

if __name__ == '__main__':
    main()

Solution (Python):
def main():
  n = int(input())
  a = [[]]*n
  for i in range(n):
    a[i] = list(map(int, input().split()))

  a.sort()
  print(a[-1][0]+a[-1][1])

main()

Solution (Python):
n = int(input())
a = [[]]*n
for i in range(n):
  a[i] = list(map(int, input().split()))

a.sort()
print(a[-1][0]+a[-1][1])

Solution (Python):
n = int(input())
a = [[]]*n
for i in range(n):
  a[i] = list(map(int, input().split()))

a.sort(reverse=True)
print(a[0][0]+a[0][1])

Solution (Python):


n=int(input())
a=[0]*n
b=[0]*n
ca=0
ans=0
for i in range(n):
    a[i],b[i]=map(int,input().split())
for j in range(n):
    if a[j]>ca:
        ca=a[j]
        ans=a[j]+b[j]
print(ans)

Solution (Python):
N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]
sAB = sorted(AB, key=lambda x: - x[0])
print(sum(sAB[0]))

Solution (Python):
N = int(input())
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort()
ans = AB[-1][0] + AB[-1][1]
print(ans)

Solution (Python):
n = int(input())

info = [list(map(int,input().split())) for _ in range(n)]

max_value = 0
point = 10**10

for i in range(n):
    if info[i][0] > max_value:
        max_value = info[i][0]
        point = info[i][1]
        
print(max_value + point)

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
a = [inpl() for i in range(n)]
a.sort()
print(sum(a[-1]))

Solution (Python):
n = int(input())
a = sorted([list(map(int, input().split())) for _ in range(n)])
print(sum(a[-1]))

Solution (Python):
n = int(input())
a = sorted([list(map(int, input().split())) for _ in range(n)])
cnt = a[0][0] - 1 + n + a[-1][1]

for i in range(n - 1):
    cnt += min(a[i + 1][0] - a[i][0], a[i][1] - a[i + 1][1]) - 1
print(cnt)

Solution (Python):
n=int(input())
a=[0]*-~n;b=[0]*-~n
mx=-1
mi=-1
for i in range(n):
  a[i], b[i] = map(int,input().split())
  if a[i] > mx:
    mx = a[i]; mi = i

print(mx+b[mi])

Solution (Python):
n= int(input())
List = []
for _ in range(n):
  A, B = map(int,input().split())
  List.append([A,B])
List.sort()
Answer = List[-1][0] + List[-1][1]
print(Answer)

Solution (Python):
n = int(input())
a, b = 0, 0
for i in range(n):
    a_input, b_input = map(int, input().split())
    if a < a_input:
        a, b = a_input, b_input
print(a + b)

Solution (Python):
N=int(input())
A,B=[0]*N,[0]*N
for i in range(N):
  A[i],B[i]=map(int,input().split())
ans=A[0]+B[0]
for i in range(N):
  ans=min(ans,A[i]+B[i])
print(ans)

Solution (Python):
import sys
input=sys.stdin.readline

n=int(input())
x=0
y=10**10
for _ in range(n):
    a,b=map(int,input().split())
    if x<=a:
        x=a
        y=b
print(x+y)

Solution (Python):
n = int(input())

A, B = 0, 0
for i in range(n):
    a, b = map(int, input().split())
    if a > A:
        A, B = a, b

print(A+B)

Solution (Python):
def main():
    N = int(input())
    ab = [[int(i) for i in input().split()] for j in range(N)]
    ab.sort(key=lambda p: p[1])
    print(ab[0][0] + ab[0][1])


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
a = []
b = []
for hoge in range(n):
         aa,bb = map(int,input().split())
         a.append(aa)
         b.append(bb)
print((max(a))+(b[a.index(max(a))]))

Solution (Python):
N = int(input())
max_A = 0
score = 0
for _ in range(N):
    A,B = [int(x) for x in input().split()]
    if(max_A<A):
        max_A = A
        score = B
print(max_A + score)

Solution (Python):
def resolve():
    n = int(input())
    ab = list(list(map(int, input().split())) for _ in range(n))
    ab.sort()
    ans = ab[-1][0] + ab[-1][1]
    print(ans)


if __name__ == "__main__":
    resolve()

Solution (Python):
n = int(input())
li_input = list()
for i in range(n):
    li_input.append(list(map(int, input().split())))

li_s = sorted(li_input, key=lambda x: x[0])

print((li_s[-1][0]) + (li_s[-1][1]))

Solution (Python):
N=int(input())
a=[list(map(int,input().split())) for i in range(N)]
a.sort()
print(sum(a[-1]))

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    ab = [list(map(int, input().rstrip('\n').split())) for _ in range(n)]
    ab.sort()
    print(ab[-1][0] + ab[-1][1])


if __name__ == '__main__':
    slove()

Solution (Python):
n = int(input())

A, B = 0, 10**9+1

for _ in range(n):
    a, b = map(int, input().split())
    A = max(A, a)
    B = min(B, b)

print(A+B)

Solution (Python):
N = int(input())
maxA = 0
minB = 0

for i in range(N):
  a, b = map(int, input().split())
  if(a > maxA):
    maxA = a
    minB = b
  
print(maxA + minB)

Solution (Python):
n=int(input())
a=[]
b=[]
for i in range(n):
    c,d=map(int,input().split())
    a.append(c)
    b.append(d)
m=max(a)
j=a.index(m)
print(a[j]+b[j])

Solution (Python):
n = int(input())
ans = 0
mx = 0
for i in range(n):
    a,b = map(int,input().split())
    if mx < a:
        ans = a+b
        mx = a
print(ans)

Solution (Python):
n=int(input())
aM=0
am=10**9
bm=10**9
for _ in range(n):
    a,b = map(int,input().split())
    if a>aM:
        aM=a
        bm=b
    if a<am:
        am=a
ans=aM-am+1
if bm>0:
    ans+=bm
ans+=am-1
print(ans)

Solution (Python):
N = int(input())
A = []
B = []
for _ in range(N):
  a, b = map(int, input().split())
  A.append(a)
  B.append(b)
print(min(B)+max(A))

Solution (Python):
N = int(input())
A = [0 for i in range(N)]
B = [0 for i in range(N)]

for i in range(N):
        A[i], B[i] = map(int, input().split())
        
max_a = max(A)
max_a_b = 0
for i in range(N):
    if A[i] == max_a:
        max_a_b = B[i]
        
print(max_a + max_a_b)

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    ab = [list(map(int, input().rstrip('\n').split())) for _ in range(n)]
    ab.sort(reverse=True)
    print(ab[0][0] + ab[0][1])


if __name__ == '__main__':
    slove()

Solution (Python):
n,*L=map(int,open(0).read().split());print(sum(sorted((i,j)for i,j in zip(*[iter(L)]*2))[-1]))

Solution (Python):
n=int(input())
a=[list(map(int,input().split())) for _ in range(n)]
a.sort()
print(a[-1][0]+a[-1][1])

Solution (Python):
n = int(input())
ab_array = sorted([[int(x) for x in input().split()] for y in range(n)], key=lambda x: x[0])

print(ab_array[-1][0] + ab_array[-1][1])

Solution (Python):
n = input()

a = []
b = []

count = 0

for i in range(n):
    a_,b_ =[int(i) for i in raw_input().split()]
    a.append(a_)
    b.append(b_)
    

c = zip(a,b)
c.sort()
a, b = zip(*c)
a = list(a)
b = list(b)

before_rank = 1
before_score = 10000000000
for i in range(n):

    count += min(a[i]-before_rank, before_score-b[i])
    before_rank = a[i]
    before_score = b[i]

count += before_score + 1


print(count)

Solution (Python):

n = int(input())
a = [[] for _ in range(n)]
for i in range(n):
    a[i] = list(map(int, input().split()))
a.sort()
x, y = a[-1][0], a[-1][1]
ans = x + y
print(ans)

Solution (Python):
N = int(input())
A, B = [], []
for _ in range(N):
    a, b = tuple(map(int, input().split()))
    A.append(a)
    B.append(b)

max_val = max(A)
print(max_val + B[A.index(max_val)])

Solution (Python):
def solve(n, a, b):
    return sum(sorted(zip(a, b)).pop())

n = int(input())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())
print(solve(n, a, b))

Solution (Python):
N=int(input())
A=[list(map(int,input().split())) for _ in range(N)]
A.sort()

print(A[-1][0]+A[-1][1])

Solution (Python):

def main():
    N, *AB = map(int, open(0).read().split())
    A = max(zip(*[iter(AB)] * 2))
    ans = sum(A)
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):

def main():
    N, *AB = map(int, open(0).read().split())
    A = [(i, j) for i, j in zip(*[iter(AB)] * 2)]
    A.sort()
    ans = sum(A[-1])
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
a=[]
b=[]

for _ in range(n):
    a_ele, b_ele=map(int, input().split())
    a.append(a_ele)
    b.append(b_ele)

print((b[a.index(max(a))]-1)+(max(a)+1))

Solution (Python):
n=int(input())
a=[]
b=[]

for _ in range(n):
    a_ele, b_ele=map(int, input().split())
    a.append(a_ele)
    b.append(b_ele)
a_min=min(a)
a_max=max(a)

print((b[a.index(max(a))]-1)+(max(a)+1))

Solution (Python):
def main():

    N = int(input())
    info = []
    for _ in range(N):
        A, B = map(int, input().split())
        info.append([A, B])
    info.sort(key = lambda x: x[1])
    return info[0][0] + info[0][1]


if __name__ == '__main__':
    print(main())

Solution (Python):
n = int(input())

ans = [[int(i) for i in input().split()] for j in range(n)]

ans.sort(reverse=True, key=lambda x: x[0])

res = ans[0][0] + ans[0][1]

print(res)

Solution (Python):
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
print(sum(max(a)))

Solution (Python):
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for i in range(n):
    ans = max(ans, a[i][0])
    if ans == a[i][0]:
        ind = i
print(ans + a[ind][1])

Solution (Python):
N,*A=map(int,open(0).read().split())
i=2*sorted(enumerate(A[::2]),key=lambda x:x[1])[-1][0]
print(A[i]+A[i+1])

Solution (Python):
N = int(input())
ABs = []
for i in range(N):
  A, B = map(int, input().split())
  ABs.append((A, B))
ABM = min(ABs, key=lambda AB: AB[1])
r = ABM[0]+ABM[1]
print(r)

Solution (Python):
n=int(input())
print(sum(sorted([list(map(int,input().split())) for _ in range(n)])[-1]))

Solution (Python):
n = int(input())
min_v = float('inf')
min_i = float('inf')
for _ in range(n):
    a,b = map(int, input().split())
    if b < min_v:
        min_i = a
        min_v = b
print(min_v + min_i)

Solution (Python):
n = int(input())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i]= map(int, input().split())
print(max(a)+min(b))

Solution (Python):

n = int(input())
point_list = sorted([[ int(v) for v in input().split() ] for i in range(n) ])
print(point_list[-1][0]+point_list[-1][1])

Solution (Python):
N = int(input())
A = []
B = []
for i in range(0, N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
print(max(A)+min(B))

Solution (Python):
n=int(input())
a=[]
for i in range(n):
	x,y=map(int,input().split())
	a.append([x,y])
a.sort(key=lambda x:x[1])
print(a[0][0]+a[0][1])

Solution (Python):
N = int(input())
X = [[int(_) for _ in input().split()] for _ in range(N)]

ans = 10 ** 10
for a, b in X:
    ans = min(ans, a + b)
print(ans)

Solution (Python):
N=int(input())
m=0
end=0
for _ in range(N):
    a,b=map(int,input().split())
    if a>m:
        m,end=a,b
print(m+end)

Solution (Python):
N = int(input())
A, B = [0] * N, [0] * N
for i in range(N):
	A[i], B[i] = map(int, input().split())

index = A.index(max(A))
print(A[index] + B[index])

Solution (Python):
N=int(input())
A=[list(map(int,input().split())) for _ in range(N)]
AA=sorted(A)
print(AA[-1][0]+AA[-1][1])

Solution (Python):
N = int(input())
A =[]
B =[]
for i in range(N):
    av,bv = map(int,input().split())
    A.append(av)
    B.append(bv)

maxi = A.index(max(A))
print(A[maxi]+B[maxi])

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n=II()
  a=b=0

  for i in range(n):
    _a,_b=LI()
    if _a>a:
      a=_a
      b=_b

  return a+b

print(main())

Solution (Python):
N = int(input())
L = [tuple(map(int, input().split())) for _ in range(N)]
print(sum(max(L)))

Solution (Python):
n = int(input())
a = [0] * n
b = [0] * n
m = 100000000000000000000
mi = 0
for i in range(n):
    a[i], b[i] = map(int, input().split())
    if b[i] < m:
        m = b[i]
        mi = i
print(a[mi]+b[mi])

Solution (Python):


from operator import itemgetter

n = int(input())



data=[[0 for i in range(2)] for j in range(n)]

for i in range(0,n):
	tmp = input().split()
	hoge = list(map(lambda a: int(a), tmp))
	data[i][0]=hoge[0]
	data[i][1]=hoge[1]

data.sort()


res = data[n-1][0] + data[n-1][1]

print(res)

Solution (Python):
n = int(input())
a = 0
b = 0
for i in range(n):
    a1,b1 = map(int,input().split())
    if a < a1:
        a = a1
        b = b1
print(a+b)

Solution (Python):
N = int(input())

max_a = 0
max_b = 0
for _ in range(N):
    a, b = map(int,input().split())
    if a > max_a:
        max_a = a
        max_b = b

print(max_a + max_b)

Solution (Python):
N = int(input())
max = ans = 0
for i in range(N):
    A,B = map(int,input().split())
    if max<A:
        max = A
        ans = A+B
print(ans)

Solution (Python):
def main():
    N = int(input())
    mx = (0, 0)
    for _ in range(N):
        A, B = map(int, input().split())
        mx = max(mx, (A, B))
    print(mx[0] + mx[1])


if __name__ == "__main__":
    main()

Solution (Python):
N=int(input())
L=[]
for i in range(N):
    a,b=map(int,input().split())
    L.append([a,b])

min_b=10**9
max_a=0
min_a=10**9

for i in range(N):
    min_b=min(min_b,L[i][1])
    max_a=max(max_a,L[i][0])
    min_a=min(min_a,L[i][0])


ans = max_a + min_b

print(ans)

Solution (Python):
N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]

ab = sorted(AB)
print(sum(ab[-1]))

Solution (Python):
ans=0
m=0
for _ in range(int(input())):
    A,B=map(int,input().split())
    if A>m:
        m=A
        ans=A+B
print(ans)

Solution (Python):
n = int(input())
maxNum = 0
ans = 0
for i in range(n):
    a,b = map(int, input().split())
    if a > maxNum:
        maxNum = a
        ans = a + b
print(ans)

Solution (Python):

import sys
input = sys.stdin.readline

def main():
    n = int(input())
    A = sorted(tuple(map(int, input().rstrip().split())) for _ in range(n))
    print(A[-1][0] + A[-1][1])


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
ab = sorted([list(map(int, input().split())) for _ in range(n)])
print(ab[-1][0] + ab[-1][1])

Solution (Python):
n=int(input())
inf=[]
for i in range(n):
    inf.append(list(map(int,input().split())))
inf.sort(key=lambda x:x[0])
print(inf[-1][0]+inf[-1][1])

Solution (Python):
N=int(input())
A=sorted(list(map(int,input().split())) for _ in [0]*N)
print(sum(A[-1]))

Solution (Python):
n = int(input())

player = {}

for i in range(n):
  a, b = map(int, input().split())
  player[a] = b


lower_rank = max(player.keys())

total_player = lower_rank + player[lower_rank]
print(total_player)

Solution (Python):
n=int(input())
ab=sorted([[int(i) for i in input().split()] for _ in range(n)],key=lambda x:x[1])[::-1]
ans=ab[0][0]
for i in range(1,n):
    ans+=ab[i][0]-ab[i-1][0]
ans+=ab[-1][1]
print(ans)

Solution (Python):
N = int(input())
info = sorted([tuple(map(int, input().split())) for _ in range(N)])
ans = info[0][0]
for i in range(1, N):
    ans += min(info[i][0] - info[i-1][0], info[i-1][1] - info[i][1])
ans += info[-1][1]
print(ans)