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):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count




N = I()
A = ILL(N)
A.sort()
print(sum(A[-1]))

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

tmp = [0]
a = []
b = []
ans = 0
for i in range(n):
  tmp[0] = list(map(int,input().split()))
  a.append(tmp[0][0])
  b.append(tmp[0][1])
  
ans = max(a)

print(ans+min(b))

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

num=sorted(num)[::-1]

x=num[0][0]
y=num[0][1]

print(x+y)

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

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

for i in li:
    if i[0] > a:
        a = i[0]
        b = i[1]

print(a+b)

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

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

amin, amax, bmin = float('inf'), 0, float('inf')

for _ in range(N):
    A, B = map(int, input().split())
    amin = min(amin, A)
    amax = max(amax, A)
    bmin = min(bmin, B)

ans = (amin-1) + (amax-amin+1) + bmin
print(ans)

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

print(max(lst)[0] + max(lst)[1])

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

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    AB = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda x: x[0])
    res = AB[-1][0] + AB[-1][1]
    print(res)


if __name__ == '__main__':
    resolve()

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

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

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

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

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

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

minAB = [10**10, 10**10]
for x in ab:
    if minAB[1] > x[1]:
        minAB = x[0], x[1]
print(sum(minAB))

Solution (Python):
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    x = y = 0
    for _ in range(N):
        A, B = map(int, input().split())
        if A > x:
            x = A
            y = B

    ans = x + y
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import sys

input = sys.stdin.readline


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

    x = max(A)
    y = B[A.index(x)]
    ans = x + y

    print(ans)


if __name__ == "__main__":
    main()

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
AB = [LIST() for _ in range(N)]
AB.sort(key=lambda x:-x[0])
print(AB[0][0]+AB[0][1])

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

Solution (Python):
N = int(input())
if(N == 1):
  A1,B1 = map(int,input().split())
  print(str(A1+B1))
  exit()
for i in range(N-1):
  if(i == 0):
    A1,B1 = map(int,input().split())
    A2,B2 = map(int,input().split())
    if(A1 <= A2):
      MA = A2
      MB = B2
    else:
      MA = A1
      MB = B1
    A1 = A2
    B1 = B2
  else:
    A2,B2 = map(int,input().split())
    if(MA <= A2):
      MA = A2
      MB = B2
    A1 = A2
    B1 = B2
print(str(MA + MB))

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

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

Solution (Python):
n = int(input())
a = []
b = []
for _ in range(n):
    at,bt = [int(x) for x in input().split()]
    a.append(at)
    b.append(bt)

print(max(a)+min(b))

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
l=sorted(l,key=lambda x: x[0],reverse=True)
print(sum(l[0]))

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

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

A,B = ABs[0]
ans += A-1

for i in range(1,N):
    A,B = ABs[i]
    A_prev,B_prev = ABs[i-1]

    ans += A - A_prev - 1

ans += ABs[-1][1]
ans += N

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

n = int(input())

mib = float('inf')

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

ans += mib

print(ans)

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):

import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    ans=10**9
    l=[list(map(int,input().split())) for i in range(n)]
    l.sort(key=lambda x:x[0])
    print(l[-1][0]+l[-1][1])
resolve()

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    n=int(input())
    L=[list(map(int,input().split())) for i in range(n)]
    
    L=sorted(L, key=lambda x: x[0])
    print(L[-1][0]+L[-1][1])


    
    
resolve()

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

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


    max_a = 0
    min_b = None

    for i in range(N):
        a, b = map(int, input().split())
        if a > max_a:
            max_a = a
            min_b = b

    answer = max_a + min_b
    print(answer)


if __name__ == '__main__':
    main()

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

Solution (Python):
def main():
    n = int(input())
    max_score = 0
    max_index = 0
    min_score = float("inf")
    min_index = 0
    for _ in range(n):
        a, b = map(int, input().split())
        if max_index > a:
            max_index = a
            max_score = b
        if min_index < a:
            min_index = a
            min_score = b
    print(min_index + min_score)


if __name__ == '__main__':
    main()

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

M=max(B)
m=min(B)
for i in range(N):
    if B[i]==M:
        Mnum=A[i]
    if B[i]==m:
        mnum=A[i]

ans=mnum+m
print(ans)

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

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

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    

    
    

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

if __name__ == '__main__':
    main()

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

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

Solution (Python):
def I(): return int(input())
def LI(): return list(map(int,input().split()))
N = I()
AB = [LI() for _ in range(N)]
ans,max = 0,0
for x in AB:
    a,b = x[0],x[1]
    if a>max:
        max = a
        ans = a+b
print(ans)

Solution (Python):
def I(): return int(input())
def LI(): return list(map(int,input().split()))
N = I()
AB = [LI() for _ in range(N)]
T_AB = list(zip(*AB))
ans = max(T_AB[0])
ans += T_AB[1][T_AB[0].index(max(T_AB[0]))]
print(ans)

Solution (Python):
N = int(input())
A, B = map(int, input().split())
for _ in range(N-1):
    A_n, B_n = map(int, input().split())
    if A_n > A:
        A = A_n
        B = B_n

print(A+B)

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

result = a[0][0] -(a[0][0] - 1) + (a[n-1][1]) +(a[n-1][0]) -1
print(result)

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

Solution (Python):
from operator import itemgetter
n = int(input())
ab = []
for i in range(n):
    ab.append(list(map(int, input().split())))

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

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=A+B
print(b)

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    score=[tuple(map(int,input().split())) for i in range(n)]
    score.sort(reverse=True)
    print(score[0][0]+score[0][1])

if __name__=='__main__':
    main()

Solution (Python):

import re
import math
import itertools
from copy import deepcopy
import random
from heapq import heappop,heappush
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
readline=sys.stdin.readline
sys.setrecursionlimit(2000)

alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
week=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_power(a,b):
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def floor_(n,x=1):
    return x*(n//x)
def ceil_(n,x=1):
    return x*((n+x-1)//x)


import re
import math
import itertools
from copy import deepcopy
import random
from heapq import heappop,heappush
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
readline=sys.stdin.readline
sys.setrecursionlimit(2000)

alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_power(a,b):
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def floor_(n,x=1):
    return x*(n//x)
def ceil_(n,x=1):
    return x*((n+x-1)//x)

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

Solution (Python):
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
a.sort(reverse = True)
print(a[0][0] + a[0][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 = [list(map(int, input().split())) for i in range(N)]
v = max(AB)
print(v[0]+v[1])

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

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

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

Solution (Python):

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

Solution (Python):
n = int(input())
ab = [[int(i) for i in 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())
AB = []
for _ in range(N):
    a, b = map(int, input().split())
    AB.append((a, b))


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

Solution (Python):
mii = lambda: map(int, input().split())

N = int(input())
pair = []
for i in range(N):
    a, b = mii()
    pair.append((a, b))
pair.sort()
print(pair[-1][0] + pair[-1][1])

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

ab.sort()

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

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())
lst = [list(map(int,input().split())) for _ in range(n)]
lst.sort(key=lambda x:x[0], reverse=True)
print(lst[0][0] + lst[0][1])

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
cond = []
for i in range(n):
    cond.append(iil())
cond = sorted(cond)

cand = (cond[0][1]+1)+(cond[0][0]-1)
for i in range(1,n):

    if cond[i][0] - cond[i-1][0] >= cond[i-1][1]-cond[i][1]:
        cand = (cond[i][1]+1)+(cond[i][0]-1)
    else:
        cand -= (cond[i-1][1]-cond[i][1]) - (cond[i][0] - cond[i-1][0])
print(cand)

Solution (Python):
N = int(input())
"""
リスト最下位までの人数は確実にいる，
あとはリスト最下位の点数が0になるまで
1刻みに人がいた場合が最大人数
"""
List = sorted([tuple(map(int, input().split(" "))) for i in range(N)],reverse=True)
print(List[0][0]+List[0][1])

Solution (Python):
n=int(input())
temp = 10**10
for i in range(n):
    a,b=map(int,input().split())
    temp = min(temp,a+b)
print(temp)

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

max_a = 0
min_b = -1
for i in range(N):
    a = AB[i][0]
    b = AB[i][1]
    if a > max_a:
        max_a = a
        min_b = b
print(max_a + min_b)

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10


def solve():
    n = II()
    ans = [0, 0]
    for _ in range(n):
        a, b = LI()
        if ans[0] < a:
            ans = [a, b]
    print(sum(ans))
    return



if __name__ == '__main__':
    solve()

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())
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) + B[A.index(max(A))])

Solution (Python):
N = int(input())
A, B = [], []
for _ in range(N):
    ai, bi = map(int, input().split())
    A.append(ai)
    B.append(bi)
AB = sorted(list(zip(A, B)))

count = len(AB)


count += AB[0][0] - 1

for i in range(N - 1):
    
    if AB[i + 1][0] > AB[i][0] + 1:
        count += AB[i + 1][0] - AB[i][0] - 1


count += AB[-1][1] - 0

print(count)

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_max=max(A)
B_min=min(B) 
print(A_max + B_min)

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

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())
P = {}
for i in range(N):
    Ai, Bi = map(int, input().split())
    P[Ai] = Bi
k = max(P.keys())
print(k + P[k])

Solution (Python):
def main():
    info_num = int(input())
    min_score_index = 0
    min_score = float("inf")
    for _ in range(info_num):
        a, b = map(int, input().split())
        if min_score_index < a:
            min_score_index = a
            min_score = b
    print(min_score + min_score_index)


if __name__ == '__main__':
    main()

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

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

for i in l:
    m.append(int(i[0]))
    
max_a = max(m)
a_num = m.index(max_a)

b = int(l[a_num][1])
print(max_a + b)

Solution (Python):
n = int(input())
ans1 = ans2 = 0
for _ in range(n):
    a, b = map(int, input().split())
    if ans1 < a:
        ans1 = a
        ans2 = b
print(ans1 + ans2)

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

Solution (Python):
N=int(input())
a=[]
b=[]
for c in range(N):
    A,B=map(int,input().split())
    a.append(int(A))
    b.append(int(B))
newa=sorted(a)
newb=sorted(b)
number=N
for c in range(N-1):
    z=newa[c+1]-newa[c]-1
    number+=z
y=newa[0]-1
number+=y
number+=newb[0]
print(number)

Solution (Python):

n = int(input())
max_rank = 0

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

print(ans)

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

if __name__ == "__main__":
    main()

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(min(B)+max(A))

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

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

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

Solution (Python):
N = int(input())
list1 = []
max1 = 0
for i in range(N):
    L = list(map(int, input().split()))
    if max1 < L[0]:
        max1 = L[0]
        ans = sum(L)
print(ans)

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

Solution (Python):

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

Solution (Python):
N=int(input())
info=[list(map(int,input().split())) for _ in range(N)]
info.sort(key=lambda x:x[0],reverse=True)
print(info[0][0]+info[0][1])

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

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

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

min_a = N+1
max_a = 0
max_b = 0

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

ans = (min_a - 1) + (max_a - min_a + 1) + max_b
print(ans)

Solution (Python):

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

print((A[0][0])+A[0][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):
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, groupby
from math import floor, ceil, sqrt, factorial, log
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict
from heapq import heappop, heappush, heappushpop
from itertools import product
import sys
stdin = sys.stdin
mod = 10**9 + 7


def ns(): return stdin.readline().rstrip()


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


n = ni()
ab = []
for _ in range(n):
    ab.append(na())

ab.sort()

amin, bmin = ab[-1][0], ab[-1][1]
print(amin + bmin)

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

Solution (Python):



from operator import itemgetter


n = int(input())
l = list()

for i in range(n):
    ab = list(map(int,input().split()))
    l.append(ab)

l.sort(key=itemgetter(1))


ans = l[0][0] + l[0][1]


print(ans)