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):
N = int(input())
d = {}
for _ in range(N):
    A, B = map(int, input().split())
    d[A] = B
d = sorted(d.items())

ans = 0

for i in range(N - 1):
    ans += min(d[i + 1][0] - d[i][0], d[i][1] - d[i + 1][1])

ans += d[0][0] - 1
ans += d[-1][1] + 1

print(ans)

Solution (Python):
n = int(input())
bottom = 0
b_score = 0
for i in range(n):
    a, b = [int(_) for _ in input().split()]
    if bottom < a:
        bottom = a
        b_score = b

print(bottom + b_score)

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

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

Solution (Python):
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")


N = int(sys.stdin.readline())
A, B = list(zip(*[map(int, sys.stdin.readline().split()) for _ in range(N)]))

print(min(B)+max(A))

Solution (Python):
n = int(input())
a,b = [] ,[]
for i in range(n):
    tmp1,tmp2 = map(int,input().split())
    a.append(tmp1)
    b.append(tmp2)
ab = zip(a,b)
ab = sorted(ab)
a,b = zip(*ab)

print(a[-1] + b[-1])

Solution (Python):

import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())


N = int(input())
AB = []
for _ in range(N):
  AB.append(list(mi()))


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

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

Solution (Python):
N=int(input())
M=[list(map(int,input().split())) for _ in [0]*N]
_max_=max(M,key = lambda x:x[0])
print(sum(_max_))

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

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

Solution (Python):
print(min(sum(map(int,input().split()))for _ in[0]*int(input())))

Solution (Python):
print(min(sum(map(int,input().split()))for _ in[0]*int(input())))

Solution (Python):
n,*t=map(int,open(0).read().split());print(sum(max(zip(t[::2],t[1::2]))))

Solution (Python):
n,*t=map(int,open(0).read().split());print(sum(sorted(zip(t[::2],t[1::2]))[-1]))

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

maxA=0
minB=10**9
for _ in range(N):
  A,B=map(int,input().split())
  if maxA<A:
    maxA=A
    minB=B
print(maxA+minB)

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

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

last = sorted(ABs, key=lambda x: x[0])[-1]
ans = last[0] + last[1]

print(ans)

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

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

Solution (Python):
N = int(input())
A = []
for i in range(N):
  A.append(list(map(int, input().split())))
index = A.index(max(A))
print(A[index][0] + A[index][1])

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

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

L = []
for i in range(N):
    l,r = map(int,input().split())
    L.append((l,r))

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

Solution (Python):


N = int(input())

A = []
B = []

for i in range(N):
    a, b = map(int,input().split())
    A.append(a)
    B.append(b)
    

A.sort(reverse = True)
B.sort()

a_min = A[0] 
b_min = B[0] 

print(a_min + b_min )

Solution (Python):
N = int(input())
e = [[int(i) for i in input().split()] for i in range(N)]
mar=e[0][0]
mmv=e[0][1]
for i in range(N):
    if e[i][0] > mar:
        mar =e[i][0]
        mmv=e[i][1]
print(mar+mmv)

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

Solution (Python):


n = int(input())
ab = [[0,0] for i in range(n)]
for i in range(n):
    ab[i][0],ab[i][1] = map(int,input().split())

ab.sort()

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

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())
lis = [list(map(int,input().split())) for i in range(n)]

biri = 0
for i in range(n):
  if lis[biri][0]<lis[i][0]:
    biri = i

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

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

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

Solution (Python):
n = int(input())
a,b = [],[]
for i in range(n):
    ta,tb = map(int, input().split())
    a.append(ta)
    b.append(tb)
mii = a[b.index(min(b))]
print(mii+(min(b)))

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

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

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

Solution (Python):


import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N=INT()
AB=[LIST() for i in range(N)]

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

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

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

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

print(A[B.index(min(B))] + min(B))

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

print(A[B.index(min(B))] + min(B))

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

a,b = max(ab,key=lambda x:x[0])
print(a+b)

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

Solution (Python):
N = int(input())
A = [[int(_) for _ in input().split()] for _ in range(N)]
Max = max(A, key=lambda x: x[0])
print(Max[0]+Max[1])

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

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

Solution (Python):
if __name__ == '__main__':
    n = int(input())
    a, b = max(tuple(int(s) for s in input().split()) for _ in range(n))
    print(a + b)

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

ABs.sort()

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

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

Solution (Python):
n,*a=map(int,open(0).read().split())
b=[a[i]for i in range(0,len(a),2)]
c=[a[i]for i in range(1,len(a),2)]
print(max(b)+c[b.index(max(b))])

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

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

L=[]
for i in range(N):
    A,B=map(int,input().split())
    L.append([A,B])
L.sort(reverse=True)
print(L[0][0]+L[0][1])

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

Solution (Python):
n = int(input())
a = []
for i in range(n):
  tmp1,tmp2 = (int(i) for i in input().split())
  a.append([tmp1+tmp2])
print(*min(a))

Solution (Python):

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

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

Solution (Python):
N = int(input())
ans = 1
A, B = map(int, input().split())
topRank = A
worstRank = A
topPoint = B
worstPoint = B
for i in range(N-1):
    A, B = map(int, input().split())
    if A < topRank:
        ans += topRank - A
        topRank = A
        topPoint = B
    elif A > worstRank:
        ans += A - worstRank
        worstRank = A
        worstPoint = B
ans += topRank - 1
ans += worstPoint
print(ans)

Solution (Python):
n = int(input())
A = [[int(i) for i in input().split()] for j in range(n)]

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

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

ab = [[int(j) for j in input().split()] for i in range(N)]

res = 99999999999
for a,b in ab:
    res = min(res,a+b)
print(res)

Solution (Python):
n = int(input())
l = sorted([list(map(int,input().split())) for _ in range(n)])
res = l[0][0] + l[-1][1]
for p,q in zip(l,l[1:]):
    res += min(q[0] - p[0], p[1] - q[1])
print(res)

Solution (Python):
N = int(input())
src = [tuple(map(int,input().split())) for i in range(N)]
src.sort()

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

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

AB.sort()

a, b = AB[-1]
ans = a + b
print(ans)

Solution (Python):
N=int(input())
A=[[int(i) for i in input().split()] for i in range(N)]
A.sort()
print(A[-1][0]+A[-1][1])

Solution (Python):
N = int(input())
x = [list(map(int, input().split())) for i in range(N)]
x = list(map(list, zip(*x)))
A = x[0]
B = x[1]
base = B[A.index(max(A))]
print(max(A)+base)

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

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

Solution (Python):
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
ab = [list(li()) for _ in range(n)]
ab.sort(reverse=True)
print(sum(ab[0]))

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

Solution (Python):
N = int(input())
rank = 0
for _ in range(N):
    a, b = [int(_) for _ in input().split()]
    if a > rank:
        rank = a
        score = b
print(rank + score)

Solution (Python):
N = int(input())
A = []
ax, bx = 0,0
for i in range(N):
  a, b = map(int,input().split())
  if a > ax:
    ax, bx = a, b
    
print(ax+bx)

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

Solution (Python):
from collections import defaultdict

N = int(input())
A = []
B = []

d = defaultdict(int)

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

ans = max(A)

ans += d[max(A)]

print(ans)

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

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

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

for i in range(N):
    a = list(map(int, input().split()))
    if(i == 0):
        mx = a[0]
        my = a[0]
        mi = a[1]
    else:
        if(my < a[0]):
            my = a[0]
            mi = a[1]


score = my
score += mi
print(score)

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

print(ans)

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

Solution (Python):
N=int(input())
Amax = 0; Amax_s = 0
for i in range(N):
    A, B = map(int,input().split())
    if A > Amax:
        Amax = A
        Amax_s = B

print(Amax+Amax_s)

Solution (Python):
info = []

N = int(input())
for _ in range(N):
    info.append(tuple(map(int, input().split())))

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

highDiff = info[0][0] - 1
lowDiff = info[len(info) - 1][1]
middleDiff = info[len(info) - 1][0] - info[0][0] + 1

print(highDiff + lowDiff + middleDiff)

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

Solution (Python):
n = int(input())
a, b = 0, float('inf')
for i in range(n):
    ta, tb = map(int, input().split())
    if a < ta:
        a = ta
        b = tb

print((a + b))

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

Solution (Python):
N = int(input().strip('\n'))
b = 1e+10
for i in range(N):
    ai,bi = [int(x) for x in input().strip('\n').split(' ')]
    if bi <= b:
        a = ai
        b = bi
print(a+b)

Solution (Python):
a,b =0,0
for _ in [0]*int(input()):
 p,q = map(int,input().split())
 if a<p:
  a,b = p,q
print(a+b)

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

Solution (Python):
ans = float('inf')
for _ in range(int(input())):
    a, b = map(int, input().split())
    ans = min(ans, a + b)
print(ans)

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

Solution (Python):
n = int(input())
ans = 1000000000000
for _ in range(n):
    ans = min(ans, sum(map(int, input().split())))
print(ans)

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

LL = sorted(L)
print(LL[-1][1] + LL[-1][0])

Solution (Python):
N = int(input())
a_max, b = 0, 0

for _ in range(N):
    ai, bi = map(int, input().split())
    if ai >= a_max:
        a_max = ai
        b = bi
print(a_max + b)

Solution (Python):
n = int(input())
res = 0
point = float("inf")
for i in range(n):
    a,b = map(int,input().split())
    if point > b:
        point = b
        res = a+b
else:
    print(res)

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

Solution (Python):
n = int(input())
a =0
b =0
for i in range(n):
    nums = [int(num) for num in input().split()]
    aa = nums[0]
    bb = nums[1]
    if aa > a:
        a = aa
        b = bb
print(a + b)

Solution (Python):
N = int(input())
AB = [[0,0] for _ in range(N)]

for i in range(N):
    AB[i][0],AB[i][1] = map(int,input().split())

AB = sorted(AB)

ans = AB[-1][1] + AB[-1][0]
print(ans)

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

Solution (Python):
n = int(input())
dict_prob = {}
for i in range(0,n):
    dict_prob.update(dict([(map(int, input().split()))]))
nmax = 0
for number in dict_prob.keys():
    if nmax < number:
        nmax = number
print(dict_prob[nmax] + nmax)

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

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

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

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

Solution (Python):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

N = int(input())
MAX_a = 0
ans = 0
for i in range(N):
	a,b = inpl()
	if MAX_a < a:
		ans = a+b
		MAX_a = a

print(ans)

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

m = max(a)
n = b[a.index(m)]
print(m+n)

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

amin = 9999999999
amin_b = None
amax = -1
amax_b = None

for i in xrange(n):
  a,b = map(int, raw_input().split())
  if a < amin:
    amin = a
    amin_b = b
  if a > amax:
    amax = a
    amax_b = b

print amax + amax_b

Solution (Python):
n = int(input())
M = [tuple(map(int, input().split()))for _ in range(n)]
a, b = -1, -1
for i in range(n):
    ta, tb = M[i]
    if ta > a:
        a = ta
        b = tb
print(a + b)

Solution (Python):
def getinputdata():

    
    array_result = []
    
    data = input()
    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

            else:

                flg = 0
    finally:

        return array_result

arr_data = getinputdata()
n = int(arr_data[0][0])

maxdata=int(arr_data[1][0])
point=int(arr_data[1][1])


for i in range(1,1+n):
    
    a=int(arr_data[i][0])
    b=int(arr_data[i][1])
    
    if maxdata<a:
        maxdata=a
        point=b
        
print(maxdata+point)

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

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

print(m + p)

Solution (Python):





if __name__ == '__main__':
    n = int(input())
    worst_rank, worst_score = 0, 0

    
    
    
    for i in range(n):
        ai, bi = map(int, input().split())

        if ai > worst_rank:
            worst_rank = ai
            worst_score = bi

    print(worst_rank + worst_score)

Solution (Python):





if __name__ == '__main__':
    n = int(input())
    worst_rank, worst_score = 0, 0

    
    
    
    for i in range(n):
        ai, bi = list(map(int, input().split()))

        if ai > worst_rank:
            worst_rank = ai
            worst_score = bi

    print(worst_rank + worst_score)

Solution (Python):





if __name__ == '__main__':
    n = int(input())
    worst_rank = -1
    worst_score = float('inf')

    
    
    for i in range(n):
        ai, bi = list(map(int, input().split()))
        worst_rank = max(worst_rank, ai)
        worst_score = min(worst_score, bi)

    print(worst_rank + worst_score)

Solution (Python):





if __name__ == '__main__':
    n = int(input())
    a = [0 for _ in range(n)]
    b = [0 for _ in range(n)]

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

    a_max = max(a)
    print(a_max + b[a.index(a_max)])

Solution (Python):
N = int(input())
A = [None] * N
B = [None] * N

for k in range(N):
  a,b = [int(i) for i in input().split()]
  A[k] = a
  B[k] = b

min_B = min(B) 
min_B_rank = A[B.index(min_B)] 
print(min_B_rank + min_B)

Solution (Python):
n = int(input())
x = [[int(i) for i in input().split()] for i in range(n)]
x.sort()
print(x[-1][0]+x[-1][1])

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

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

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

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

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

Solution (Python):
print(min([sum(list(map(int,input().split()))) for j in range(int(input()))]))

Solution (Python):
N = int(input())
print(min([sum(list(map(int,input().split()))) for j in range(N)]))

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

Solution (Python):
n = int(input())
res = 0
min_b = 1e10
for i in range(n):
    a, b = map(int, input().split())
    if b < min_b:
        min_b = b
        res = a+b

print(res)

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

Solution (Python):
import sys
from collections import Counter

n=int(input())
ma=0
v=0
for i in range(n):
    x,y=map(int,input().split())
    if(x>ma):
        ma=x
        v=y
print(ma+v)

Solution (Python):
def main():
    N = int(input())
    A, B = zip(*[
        map(int, input().split())
        for _ in range(N)
    ])

    
    ans = max(A) + min(B)
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
t = {}
for i in range(n):
	a,b = map(int,input().split())
	t[a] = b
t = sorted(t.items(),reverse=True)
print(t[0][0]+t[0][1])

Solution (Python):
n = int(input())
array = []
for i in range(n):
    a, b = map(int, input().split())
    array.append((a, b))
array = sorted(array, key=lambda b: b)


prev = 0
num_person = 0
for a in array:
    num_person += (a[0] - prev)
    prev = a[0]

if n > 0:
    num_person += array[len(array) - 1][1]

print(num_person)

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

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

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

print(k + m)

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

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

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

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

amax = 0
amin = 1000000000
for i in range(0, n):
    a, b = map(int, input().split())
    if amax < a:
        amax = a
        bmax = b

print(amax + bmax)

Solution (Python):
n = int(input())
xs = [[int(x) for x in input().split()] for i in range(n)]

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

Solution (Python):
N = int(input())
Amx = 0
Bmn = 10**10
for i in range(N):
    A, B = list(map(int, input().split()))
    Amx = max(Amx, A)
    Bmn = min(Bmn, B)
print(Amx + Bmn)

Solution (Python):

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

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

Solution (Python):

N = int(input())
ab = [[0, 0] for _ in range(N)]
for i in range(N):
    ab[i] = list(map(int, input().split()))
ab.sort(key=lambda x:x[0])

ans = ab[0][0]
for i in range(N)[1::]:
    ans += min(ab[i][0] - ab[i-1][0], ab[i-1][1] - ab[i][1])
ans += ab[-1][1]

print(ans)

Solution (Python):
N = int(input())
pairs = []
for n in range(N):
    a, b = map(int, input().split())
    pairs.append((a, b))
pairs.sort(key=lambda p: p[0])
ans = pairs[-1][1] + pairs[-1][0]
print(ans)

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

ca = 0
cb = 0
for _ in range(n):
    a, b = map(int, input().split())
    if a > ca:
        ca, cb = a, b

print(ca+cb)

Solution (Python):

n = int(input())
l = [ tuple(map(int, input().split())) for _ in range(n) ]
result = sorted(l, key= lambda tmp:tmp[0], reverse = True)
print(result[0][0]+result[0][1])

Solution (Python):
print(min(sum(map(int,input().split()))for _ in range(int(input()))))

Solution (Python):
from operator import add

n = int(input())
print(min(add(*map(int, input().split())) for _ in range(n)))

Solution (Python):
N = int(input())
Amax = 0
ans = 0

for _ in range(N):
	A, B = map(int,input().split())
	if Amax<A:
		Amax=A
		ans=A+B

print(ans)

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

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

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

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    n = I()
    a = max([LI() for _ in range(n)])
    return sum(a)


print(main())

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

def main():
    n = int(input())
    max_a, max_b = 0, 0 
    for _ in range(n):
        a, b = input().split()
        a = int(a)
        if max_a < a:
            max_a = a
            max_b = int(b)
    print(max_a + max_b)


if __name__ == "__main__":
    main()

Solution (Python):
def main():
    n = int(input())
    max_a, max_b = 0, 0 
    for _ in range(n):
        a, b = map(int, input().split(' '))
        
        if max_a < a:
            max_a = a
            max_b = b 
    print(max_a + max_b)
 
 
if __name__ == "__main__":
    main()

Solution (Python):
def main():
    n = int(input())
    max_a, max_b = 0, 0 
    for _ in range(n):
        a, b = input().split(' ')
        a = int(a)
        if max_a < a:
            max_a = a
            max_b = int(b)
    print(max_a + max_b)


if __name__ == "__main__":
    main()

Solution (Python):
def main():
    n = int(input())
    max_a, max_b = 0, 0 
    for _ in range(n):
        a, b = input().split()
        a = int(a)
        if max_a < a:
            max_a = a
            max_b = int(b)
    print(max_a + max_b)


if __name__ == "__main__":
    main()

Solution (Python):
def main():
    n = int(input())
    ab = [] 
    for i in range(n):
        ab.append([int(x) for x in input().split()])
    a, b = max(ab, key=lambda x: x[0])
    print(a + b)


if __name__ == "__main__":
    main()

Solution (Python):
N = input()
worst_rank = 0


for _ in range(int(N)):
    
    A,B = map(int,(input().split(' ')))
    if A > worst_rank:
        worst_rank = A
        worst_score = B
        
print(worst_score + worst_rank)

Solution (Python):
N=(int)(input())
max=0
now=[0,0]
for i in range(0,N):
    data=(input()).split(' ')
    if(max<(int)(data[0])):
        now[0]=data[0]
        now[1]=data[1]
        max=(int)(data[0])
print((int)(now[0])+(int)(now[1]))

Solution (Python):
N=int(input())
n=[0,0]
k=[0,0]

for i in range(N):
    k=input().split()
    if int(n[0])<int(k[0]):
        n[0]=k[0]
        n[1]=k[1]

print(int(n[0])+int(n[1]))

Solution (Python):

n = int(input())
pt_min = 10 ** 9 + 1
rank_lowest = 0

for i in range(n):
    a, b = map(int, input().split())
    if b < pt_min:
        pt_min = b
        rank_lowest = a


print(pt_min + rank_lowest)

Solution (Python):
N = int(raw_input())
a, b = [], []

for i in xrange(N):
    s = map(int, raw_input().split())
    a.append(s[0])
    b.append(s[1])

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

Solution (Python):
n = int(raw_input())
d = dict()
for _ in range(n):
    a,b = map(int, raw_input().split())
    d[a] = b
m = max(d.keys())
print m + d[m]

Solution (Python):
N = int(input())
people = {}
for i in range(N):
	ai, bi = map(int, input().split())
	people[ai] = bi
 
max_key = max([(k,v) for k,v in people.items()])[0]
min_key = max([(k,v) for k,v in people.items()])[0]
range_key = max_key - min_key + 1
 
count = people[max_key] + min_key -1 + range_key
print(count)

Solution (Python):
n=int(input())
from collections import defaultdict
dd=defaultdict(int)
for _ in range(n):
    a,b=map(int,input().split())
    dd[a]=b
print(dd[max(dd.keys())]+max(dd.keys()))

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

maxm = 0
num = -1

for i in range(n):
    a, b = map(int, input().split())
    if a > maxm:
        maxm = a
        num = b

print(maxm + num)

Solution (Python):
a = int(raw_input())
max_t = 0
max_i = 0
for x in xrange(a):
	s = map(int, raw_input().strip().split())
	if s[0] > max_t:
		max_t = s[0]
		max_i = s[1]
print(max_i + max_t)

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