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



Sample input:
3
4 7
2 9
6 2


Sample output:
8

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#tenka1 pro beginer b
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)

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

min_a = N+1
max_a = 0
max_b = 0

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

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

Submission status: Accepted

Solution code:
#B - Different Distribution
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])

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 2020/02/29
# Tenka1 Programmer Beginner Contest - B

from operator import itemgetter

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

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

l.sort(key=itemgetter(1))

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

# Output
print(ans)

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

s.sort()

#print(s)

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

print(ans)

Submission status: Accepted

Solution code:
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])

#print(lis)
lis.reverse()
#print(lis)
print(lis[0][0]+lis[0][1])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import itertools
#n = int(input())
#n, d = list(input().split())
#n, l = list(map(int, input().split()))


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
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])

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
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]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)
print(ans+l[-1][1]+1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
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()

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
N = int(input())
AB = [list(map(int,input().split())) for _ in range(N)]
AB = sorted(AB)
#print(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)

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 2019/12/18

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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]))

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
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))  # type: int
    A = [int()] * (N)  # type: "List[int]"
    B = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        A[i] = int(next(tokens))
        B[i] = int(next(tokens))
    solve(N, A, B)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
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)

Submission status: Accepted

Solution code:
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]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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))]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ab_array = sorted([[int(x) for x in input().split()] for y in range(n)], key=lambda x: x[0])
# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
print(ab_array[-1][0] + ab_array[-1][1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#%%
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)


#%%

Submission status: Accepted

Solution code:
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)])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# tenka1-2017-beginnerB - Different Distribution
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()

Submission status: Accepted

Solution code:
# tenka1-2017-beginnerB - Different Distribution
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()

Submission status: Accepted

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