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

# Tenka1 Programmer Beginner Contest
# Problem B

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

    # See:
    # https://beta.atcoder.jp/contests/tenka1-2017-beginner/submissions/1637273
    # https://beta.atcoder.jp/contests/tenka1-2017-beginner/submissions/1655004
    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)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

# Tenka1 Programmer Beginner Contest
# Problem B

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

    # See:
    # https://beta.atcoder.jp/contests/tenka1-2017-beginner/submissions/1637273
    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)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

# Tenka1 Programmer Beginner Contest
# Problem B

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

Submission status: Accepted

Solution code:
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) # 最低点を取った人の下に min_B - 1,...,0 点を取った人がいる場合

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from operator import add

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from sys import stdin
input = stdin.readline

def main():
    n = int(input())
    max_a, max_b = 0, 0 # type:int
    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()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    max_a, max_b = 0, 0 # type:int
    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()

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    max_a, max_b = 0, 0 # type:int
    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()

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    ab = [] # type:[[int]] 
    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()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

# ans = pt_min + 1 + rank_low - rank_high + rank_high - 1
print(pt_min + rank_lowest)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")


def main():
    N = int(input())
    rank, score = -1, -1
    for _ in range(N):
        A, B = map(int, input().split())
        if A > rank:
            rank = A
            score = B

    print(rank + score)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

# coding: utf-8

# In[14]:

import numpy as np


# In[11]:

N = raw_input()
N = int(N)


# In[16]:

A = []
B = []
for i in range(N):
    x = raw_input()
    x = x.split(' ')
    x = [int(d) for d in x]
    A.append(x[0])
    B.append(x[1])


# In[17]:

A = np.array(A)
B = np.array(B)


# In[22]:

max_index = np.argmax(A)
max_num = np.max(A)


# In[24]:

print(max_num + B[max_index])


# In[ ]:

Submission status: Accepted

Solution code:
from sys import stdin
n = int(stdin.readline())
ans = 0
a = []
b = []
for _ in xrange(n):
 x,y = map(int,stdin.readline().split())
 b.append(x)
 a.append(y)
a.sort()
b.sort()
print b[-1] + a[0]

Submission status: Accepted

Solution code:
N = int(input())
#A = [list(map(int,input().split())) for i in range(N)]
#print (A)
def bubble_sort(arr1,arr2,n):
    for i in range(n):
        for j in range(0,n-i-1):
            if arr1[j] > arr1[j+1]:
                arr1[j],arr1[j+1] = arr1[j+1],arr1[j]
                arr2[j],arr2[j+1] = arr2[j+1],arr2[j]





A = []
B = []
max_key = 0
max_value = 0
for i in range(N):
    tmp1,tmp2 = map(int,input().split())
    A.append(tmp1)
    B.append(tmp2)
    if tmp1 > max_key:
        max_key = tmp1
        max_value = tmp2
print(max_value+max_key)
#bubble_sort(A,B,N)
#base = A[-1]
#addition = B[-1]


#print(base + addition)

Submission status: Accepted

Solution code:
n = int(input())

p = 0
s = 0

for i in range(n):
    a,b = [int(x) for x in input().split()]
    if i == 0:
        p,s = a,b
    else:
        if a > p:
            p,s = a,b
        else:
            pass

print(p+s)

Submission status: Accepted

Solution code:
p=10**9; q=0
N = int(input())
for i in range(N):
    a, b = map(int, input().split())
    q = max(a, q)
    p = min(b, p)
print(p+q)

Submission status: Accepted

Solution code:
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('b1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    n = read_int()
    res = 10 ** 20
    for i in range(n):
        a, b = read_int_list()
        if a + b < res:
            res = a + b
    print(res)


main()

Submission status: Accepted

Solution code:
n = int(input())
a_b = [input() for i in range(n)]
min = 1000000001
max = -1
max_point = 0
for i in a_b:
    a, b = map(int, i.split())
    if(min > a):
        min = a
    if(max < a):
        max = a
        max_point = b

num = 0
num += min
num += max - min
num += max_point

print(num)

Submission status: Accepted

Solution code:
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('b1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    n = read_int()
    a = [0] * n
    b = [0] * n
    for i in range(n):
        a[i], b[i] = read_int_list()

    m = min(b)
    for i in range(n):
        if b[i] == m:
            res = a[i] + b[i]
    print(res)


main()

Submission status: Accepted

Solution code:
n = int(input())
a_b = [input() for i in range(n)]
min = 1000000001
max = -1
max_point = 0
for i in a_b:
    a, b = map(int, i.split(' '))
    if(min > a):
        min = a
    if(max < a):
        max = a
        max_point = b

num = 0
num += min
num += max - min
num += max_point

print(num)

Submission status: Accepted

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

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)

A = sorted(A)
B = sorted(B, reverse=True)
ret = 0
pre_a = 0
pre_b = float('inf')
for i in range(N):
    ret += min(A[i] - pre_a, pre_b - B[i])
    pre_a = A[i]
    pre_b = B[i]

ret += pre_b
print(ret)

Submission status: Accepted

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

p = 0
A = []
B = []
for n in score:
    A.append(n[0])
    B.append(n[1])

aida = max(A) - min(A) + 1
one_to_a = (1 - min(A)) * -1
p = aida + one_to_a + min(B)
print(p)

Submission status: Accepted

Solution code:
N = int(raw_input())
G = 0
for i in range(N):
    tmp = raw_input().split(' ')
    if int(tmp[0]) > G:
        G = int(tmp[0])
        P = int(tmp[1])
print G + P

Submission status: Accepted

Solution code:
n = int(input())
a = []
b = []
for i in range(n):
    line = list(map(int, input().split()))
    a.append(line[0])
    b.append(line[1])

participants = 0
a.sort()
b.sort()
b.reverse()

participants += n

participants += a[0] - 1

for i in range(n-1):
    minwidth = 0
    if (a[i+1] - a[i]) >= (b[i] - b[i + 1]):
        minwidth = (b[i] - b[i + 1])
    else:
        minwidth = (a[i+1] - a[i])
    participants += minwidth - 1

participants += b[n-1]

print(participants)

Submission status: Accepted

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

    
    
if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
dic = {}
for i in range(N):
    a,b = [int(j) for j in input().split(" ")]
    dic[a] = b
max_keys = max(dic.keys())
min_value = dic[max_keys]
print(max_keys+min_value)

Submission status: Accepted

Solution code:
#!/usr/bin/env python                                                                                          
#-*- coding: utf-8 -*-                                                                                         

if __name__ == "__main__":
    N = int(raw_input())
    A = []
    B = []
    for n in range(N):
        input = map(int, raw_input().split())
        A.append(input[0])
        B.append(input[1])
    minimam = min(B)
    print A[B.index(minimam)] + minimam

Submission status: Accepted

Solution code:
n = int(raw_input())

x = -1
y = -1

for a in range(n):
  z = raw_input().split(" ")
  xx = int(z[0])
  yy = int(z[1])

  if x < int(xx):
    x = xx
    y = yy

print x+y

Submission status: Accepted

Solution code:
N = int(input())

rank = []
score = []

for i in range(N):
    s = input()
    rank.append(int(s.split()[0]))
    score.append(int(s.split()[1]))

min_rank = max(rank)
min_key = max(enumerate(rank), key=lambda x: x[1])[0]

ans = min_rank + score[min_key]

print(ans)

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    A = []
    B = []
    for _ in range(N):
        a, b = list(map(int, input().split(" ")))
        A.append(a)
        B.append(b)
    
    participants = max(A) + min(B)
    
    print(participants)


solve()

Submission status: Accepted

Solution code:
N = int(raw_input())
aa = 0
for i in range(0,N):
 a,b = map(int,raw_input().split())
 if a > aa:
  aa = a
  bb = b + aa
print bb

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) 
A = sorted(A)
B = sorted(B, reverse = True)

ans = 0
ans += A[0]
for i in range(1, n):
    if(A[i] - A[i - 1] > B[i - 1] - B[i]):
        ans += B[i - 1] - B[i]
    else:
        ans += A[i] - A[i - 1]
ans += B[-1]
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
minA = 100001
maxA = -1
maxB = 0
for i in range(N):
	A, B = map(int, input().split())
	minA = min(minA, A)
	if maxA < A:
		maxA = A
		maxB = B


print((minA) + (maxA - minA) + maxB)

Submission status: Accepted

Solution code:
N=input()
a=[]
for i in range(N):
    a.append(raw_input().split())
 
maxim=[0,0]
for i in range(N):
	if int(maxim[0])<=int(a[i][0]):
		maxim[0]=int(a[i][0])
		maxim[1]=i
print maxim[0]+int(a[maxim[1]][1])

Submission status: Accepted

Solution code:
N = int(input())
ab = []
for i in range(N):
    ab.append(tuple(map(int,input().split())))
mn = min(ab,key=lambda x:x[1])
print(sum(mn))

Submission status: Accepted

Solution code:
inputs = input()
N = int(inputs)

data = {}

for i in range(N):
    inputs = input().split()
    data[int(inputs[0])] = int(inputs[1])

sort_key = sorted(data)
ans = 0

for i in range(len(sort_key)):
    if i == 0 and sort_key[0] != 1:
        ans += sort_key[0] - 1
    if i < len(sort_key) - 1:
        ans += min(sort_key[i + 1] - sort_key[i] - 1, data[sort_key[i]] - data[sort_key[i + 1]] - 1)
    if i == len(sort_key) - 1 and data[sort_key[i]] != 0:
        ans += data[sort_key[i]]


print(ans + len(sort_key))

Submission status: Accepted

Solution code:

N = int(input())
best = (-1, 0)
for i in range(N):
  n, score = [int(j) for j in input().split(' ')]
  if n > best[0]: best = (n, score)
print(best[0] + best[1])

Submission status: Accepted

Solution code:
def main():
    num = int(input())
    value_array = []
    for i in range(0, num):
        value = input().split()
        value_array.append([int(x) for x in value])
    max_array = max(value_array)
    print(max_array[0] + max_array[1])


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
a = [0] * n
b = [0] * n
amax = 1
bmin = 9999999990
for i in range(n):
    a[i],b[i] = list(map(int,input().split()))
amax = max(a)
bmin = min(b)
ans = amax +bmin

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

num_info = int(input())
infos = []
for i in range(num_info):
    temp = input().split(' ')
    a, b = int(temp[0]), int(temp[1])
    infos.append([a, b])

#print(infos)
infos.sort(key = lambda x:x[0])
#print(infos)

info_max = infos[0]
info_min = infos[num_info - 1]
#print(info_max)
#print(info_min)
print(info_min[0]+info_min[1])

Submission status: Accepted

Solution code:
n = int(input())
lst = []

for x in range(n):
    s = tuple(int(i) for i in input().split(' '))
    lst.append(s)

lst.sort(key=lambda tup: tup[0])

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    m = A[0]
    sum = A[0] + A[1]
    for i in range(N-1):
        A = list(map(int, input().split()))
        if A[0] > m:
            m = A[0]
            sum = A[0] + A[1]
    print(sum)

Submission status: Accepted

Solution code:
n = int(input())
a = [0]*n
b = [0]*n

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

a.sort(reverse=True)
b.sort()
aa,bb = a[0],b[0]
count = b[0]

for i in range(1,n):
    count += min(aa-a[i],b[i]-bb)
    aa = a[i]
    bb = b[i]

print(count+aa)

Submission status: Accepted

Solution code:
#!user/bin/env python
# coding:utf-8

n = int(input())
info = []

for i in range(n):
    # ai = int(input())
    # bi = int(input())
    abi = input()
    ai, bi = int(abi.split(' ')[0]), int(abi.split(' ')[1])
    
    info.append([ai, bi])

info = sorted(info, key=lambda inf: inf[1])

imp = info[0][0] + info[0][1]
print(imp)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

N = np.int64(input())
a = []
for i in range(N):
    a.append([int(x) for x in input().split()])
a = np.array(a)

lowest_person = a[:,0].max()
lowest_score = a[:,1].min()

num_people = lowest_person + lowest_score

print(num_people)

Submission status: Accepted

Solution code:
def solution():
	k = int(input())
	l = []

	for i in range(k):
		l.append([int(a) for a in input().split(' ')])

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

	return l[k-1][0]+l[k-1][1]


print(solution())

Submission status: Accepted

Solution code:
num = int(input())
d_max = {"rank" : 100000, "point":0}
d_min = {"rank" : 1, "point":1000000000}
for a in range(num):
    temp = input().split(" ")
    if int(temp[0]) < d_max["rank"]:
        d_max["rank"] = int(temp[0])
        d_max["point"] = int(temp[1])
    if int(temp[0]) > d_min["rank"]:
        d_min["rank"] = int(temp[0])
        d_min["point"] = int(temp[1])
    if num == 1:
        d_min["rank"] = int(temp[0])
        d_min["point"] = int(temp[1])
possible_upper = min(d_max["rank"] - 1, 1e9 - d_max["point"])
possible_lower = d_min["rank"]+d_min["point"]
# print("num",num,"p_upp",possible_upper,"p_low",possible_lower)
print(possible_lower)

Submission status: Accepted

Solution code:
n = int(input())

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

li_c = sorted(li.copy())

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

Submission status: Accepted

Solution code:
# coding: utf-8

N = int(raw_input())
a, b = [], []

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

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

Submission status: Accepted

Solution code:
#coding: utf-8
N = int(input())
results = sorted([[int(s) for s in input().split()] for i in range(N)], key=lambda x: x[0])
lastResult = results[-1]
print(lastResult[0] + lastResult[1])

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""ゲームの参加人数としてありうる最大値を求める問題"""

def main():
    """
    入力: 1行目に情報の数N, 2行目からN+1行目まで，
         空白区切りで得点の大きい方からの何番目の人の得点が何点だったかを"順位 得点"で示す．
         全ての人の得点は異なる非負の整数．
    出力: ゲームの参加人数としてありうる最大値．
    Returns: None.
    方針: 一番低い順番の人の順位と得点の和が答えになる．(その人の得点と同じ人数が参加しうる)
    """
    # 持っている情報の数
    numbers = int(input())
    min_rank = 0
    min_value = 2000000000
    for i in range(numbers):
        current_rank, current_value = [int(item) for item in input().split()]
        if min_rank < current_rank:
            min_rank = current_rank
            min_value = current_value
    print(min_rank + min_value)
    return None

if __name__ == "__main__":
    main()

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)

res = max(A)
res += min(B)

print(res)

Submission status: Accepted

Solution code:
N=int(input())
lowest_rank=0
lowest_score=0
for _ in range(N):
    A,B=map(int,input().split())
    if lowest_rank<A:
        lowest_rank=A
        lowest_score=B
print(lowest_rank+lowest_score)

Submission status: Accepted

Solution code:
N = int(input())
mn = 10**9 + 1
mx = -1
mnj = 10**9 + 1
mxj = -1
for i in range(N):
    Ai,Bi = map(int, input().split())
    if mn > Bi:
        mn = Bi
        mnj = Ai
    if mx < Bi:
        mx = Bi
        mxj = Ai
print(mxj + mnj - mxj + mn)

Submission status: Accepted

Solution code:
N = int(input())
A = [-1 for x in range(N)]
B = [-1 for x in range(N)]
for i in range(N):
    A[i], B[i] = list(map(int, input().split()))

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

Submission status: Accepted

Solution code:
maxn=int(raw_input())
data1=maxn*[0]
data2=maxn*[0]
for n in range(maxn):
 inp=raw_input()
 data1[n]=int(inp.split(' ')[0])
 data2[n]=int(inp.split(' ')[1])
print max(data1)+min(data2)

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

Submission status: Accepted

Solution code:
N = int(input())

for x in range(0, N):
    a, b = map(int, input().split(" "))
    if x == 0 or e_max < a:
        e_max = a
        f = b

print(e_max + f)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    N = int(input())
    a = 0
    for i in range(N):
        tmp_a, tmp_b = list(map(int, input().split()))
        if a < tmp_a:
            a = tmp_a
            b = tmp_b

    print(a + b)