peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n,d=[int(x) for x in input().rstrip().split()]

l=[]
for i in range(n):
  X=[int(x) for x in input().rstrip().split()]
  l.append(X)

ans=0
for i in range(n):
  ni=l[i]
  for j in range(i+1,n):
    nj=l[j]
    now=0
    for s in range(d):
      now+=(ni[s]-nj[s])**2
    now=now**0.5
    if now.is_integer():
        ans+=1
print(ans)
# Judge status: Accepted
X = int(input())

while True:
  flag = True
  for i in range(2, X):
    if X % i == 0:
      flag = False
  
  if flag: break
  X += 1
  
print(X)
# Judge status: Accepted
s = set(input())
move = [{'N', 'S', 'E', 'W'}, {'N', 'S'}, {'E', 'W'}]
if s in move:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    A=list(map(int,input().split()))
    B=list(map(int,input().split()))
    D=[a-b if a>b else -(b-a)//2 for a,b in zip(A,B)]
    if sum(B)-sum(A)>=max(sum([p for p in D if p>0]),sum([m for m in D if m<0])):print("Yes")
    else:print("No")

if __name__=='__main__':
    main()
# Judge status: Accepted
CARDS = [input() for i in range(3)]
ABC = 'abc'
own = 0
while True:
  d = CARDS[own][0]
  CARDS[own] = CARDS[own][1:]
#  print(ABC[own],d,CARDS)
  own = ABC.index(d)
  if CARDS[own] == '':
    break
print(d.upper())
# Judge status: Accepted
def resolve():
    n, k = map(int, input().split())
    ans =0
    while True:
        ans +=1
        n = n//k
        if n <=0:
            break
    print(ans)
    
if __name__ == "__main__":
    resolve()
# Judge status: Accepted
#ABC047 A
a,b,c=map(int,input().split())
if a+b==c or a+c==b or b+c==a:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n, a, b = map(int, input().split())
if (a-b)%2 == 0:
    print(abs(a-b)//2)
else:
    print(min(a-1, n-b)+1+(b-a-1)//2)
# Judge status: Accepted
a,b,c = map(int, input().split())
if (a+b>=c):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
x = int(input())
plus = 1 if (x-1)%11 < 6 else 2
print((x-1)//11 * 2 + plus)
# Judge status: Accepted
import sys
X = int(input())

for i in range(1000):
    if X >= 100*i and X <= 105*i:
        print(1)
        sys.exit()
print(0)
# Judge status: Accepted
A, B, C, D = map(int, input().split())

seconds = min(B, D) - max(A, C)

if seconds <= 0:
    seconds = 0

print(seconds)
# Judge status: Accepted
a, b, c, d = map(int, input().split())

print(max(0, min(b, d) - max(a, c)))
# Judge status: Accepted
a,b,c=[str(i) for i in input().split()]
print("A"+b[0]+"C")
# Judge status: Accepted
N,K=map(int,input().split())

point=0
ans=0
toss_cnt=0

for i in range(1,N+1):
    point=i
    toss_cnt=0
    if point>K:
        ans+=1/N
    else:
        while point<K:
            point*=2
            toss_cnt+=1
        else:
            ans+=(1/N)*(1/2)**toss_cnt
            
            
print(ans)
# Judge status: Accepted
def main():
    n = input()
    len_n = len(n)
    if n[1:] == "9" * (len_n - 1):
        print(int(n[0]) + 9 * (len_n - 1))
    else:
        print(int(n[0]) + 9 * (len_n - 1) - 1)


if __name__ == "__main__":
    main()
# Judge status: Accepted
def main():
    N = int(input())
    A = list(map(int, input().split()))
    length = 1
    limit = 10 ** 18
    if 0 in A:
        print(0)
        return
    for i in range(N):
        length = length *  A[i]
        if length > limit:
            print('-1')
            return
    print(length)
    return
if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import math
a,b,c = map(int,input().split())

if ((a+b-c)*100)+(2*100*math.sqrt(a*b)) < 0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N = int(input())
d = list(map(int, input().split()))


# N/2番目に難しい問題が「ARC用の問題」かつ、
# N/2−1番目に難しい問題が「ABC用の問題」であればよい
# 難易度順に昇順でソート
# N/2番目の要素から、N/2−1番目の要素を引く

# 例d=[1,5,9,11,13,15,19,20]なら、答えは12,13の2つ
d = sorted(d)
print(d[N//2] - d[(N//2)-1])
# Judge status: Accepted
N, C, K, *T = map(int, open(0).read().split())
T = sorted(T)
ans = 0
curr = [T[0]]
for i in range(N - 1):
    if len(curr) < C and T[i + 1] - curr[0] <= K:
        curr.append(T[i + 1])
    else:
        ans += 1
        curr = [T[i + 1]]
print(ans + 1)
# Judge status: Accepted
S,T=input().split()
A,B=map(int,input().split())
U=input()
if S==U:
    print('{} {}'.format(A-1,B))
else:
    print('{} {}'.format(A,B-1))
# Judge status: Wrong Answer
N=int(input())
v=list(map(int,input().split()))
while len(v)>1:
  v=sorted(v)
  v_1=v.pop(0)
  v_2=v.pop(0)
  v.append((v_1+v_2)/2)
print(v)
# Judge status: Accepted
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def gcd_n(numbers):
    ret = numbers[0]
    for i in range(len(numbers)):
        ret = gcd(ret, numbers[i])
    return ret


def main():
    N, X = map(int, input().split())
    x = [abs(X - int(i)) for i in input().split()]
    print(gcd_n(x))
    return


main()
# Judge status: Accepted
N,M = [int(i) for i in input().split()]
count = 0
if 2 * N <= M:
    count = N + (M - 2 * N) // 4
else:
    count = M // 2

print(count)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
t = 1
if 0 in a:
    print("0", end="")
    exit()

for i in range(n):
    t = t*a[i]
    if t > 10**18:
        print("-1", end="")
        exit()
print(t, end="")
# Judge status: Wrong Answer
n = int(input())
As = list(map(str, input().split()))

from collections import deque
b = []
b = deque(b)

for i, a in enumerate(As):
    if i%2==0:
        b.append(a)
    else:
        b.appendleft(a)

if n%2==0:
    print(''.join(b))
else:
    print(''.join(reversed(b)))
# Judge status: Accepted
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

a,b,c = readInts()

if ((c-a-b)**2-4*a*b)>0 and c-a-b>0:
	print("Yes")
else:
	print("No")
# Judge status: Accepted
c = input()
lst = [chr(i) for i in range(97, 97+26)]
print(lst[lst.index(c)+1])
# Judge status: Accepted
X, Y, Z = map(int, input().split())
print((X - Z) // (Y + Z))
# Judge status: Wrong Answer
def rem(string): 
	return string.replace(" ", "") 
	
string = 'asdasd asdad asdadew'
print(rem(string))
# Judge status: Accepted
w, h, x, y = list(map(int,input().split()))
area = (w * h) / 2
if x == (w / 2) and y == (h / 2):
    print(area, 1)
else:
    print(area, 0)
# Judge status: Accepted
from collections import Counter
from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

N=int(input())
s = [input() for i in range(N)]

count_by_kw=Counter()

for i in s:
    count_by_kw[''.join(sorted(i))]+=1

values, counts = zip(*count_by_kw.most_common())
cnt=0
for i in counts:
    if i>1:
        cnt+=combinations_count(i,2)

print(cnt)
# Judge status: Wrong Answer
if input() == 'a' or 'i' or 'u' or 'e' or 'o':
    print('vowel')
else:
    print('consonant')
# Judge status: Accepted
N, K = [int(x) for x in input().split()]

l = []

while N > 0:
    l.insert(0, N % K)
    N = N // K

print(len(l))
# Judge status: Accepted
n,X = map(int,input().split())
x = list(map(int,input().split()))

x.sort()
def gcd(x,y):
    if y == 0:
        return x
    else:
        return gcd(y,x%y)
ans = abs(x[0]-X)
if len(x) == 1:
    print(ans)
else:
    for i in x[1:]:
        ans = gcd(abs(i-X),ans)
    print(ans)
# Judge status: Wrong Answer
N=int(input())
a=list(map(int,input().split()))
four =0
two =0
imp = 0
       
for num in a:
  if num%4==0:
    four +=1
  if num%2==0:
    two += 1
       
two -= four
imp=N-four-two
       
if four>=N//2:
  print("Yes")
else:
  if two >=imp:
    print("Yes")
  else:
    print("No")
# Judge status: Accepted
N = int(input())
N_2 = int(N ** 0.5)
ans = float('Inf')
for i in range(1, N_2 + 1):
    if N % i == 0:
        s = i + N / i - 2
        ans = min(ans, int(s))
print(ans)
# Judge status: Wrong Answer
import math

r = int(input())
print(r * math.pi)
# Judge status: Accepted
w, a, b  = map(int, input().split())
if a <= b <= a+w or a <= b+w <= a+w:
    print(0)
else:
    res = float("inf")
    res = min(res, abs(b-(a+w)))
    res = min(res, abs(a-(b+w)))
    print(res)
# Judge status: Wrong Answer
n = int(input())
ans = []

if n < 105:
    print(0)
    exit(0)

for i in range(105, n + 2, 2):
    divisors = []
    for j in range(1, i + 1):
        if i % j == 0:
            divisors.append(j)

    if len(divisors) == 8:
        ans.append(i)

print(len(ans))
# Judge status: Accepted
n = int(input())
cnt = 0
for i in range(1, n + 1,2):
    temp = 0
    j = 1
    while j * j <= i:
        if i % j == 0:
            temp += 1
            if j != i // j:
                temp += 1
        j += 1
    if temp == 8:
        cnt += 1
print(cnt)
# Judge status: Accepted
import math
N, D = list(map(int, input().split()))
X = [None] * N
pair = 0

def count(l,r):
    s = 0
    for i in range(D):
        s += abs(l[i]-r[i])**2
    return math.sqrt(s)


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

for i in range(N-1):
    for j in range(i+1,N):
        #print(count(X[i], X[j]))
        if count(X[i], X[j]).is_integer():
            pair += 1

print(pair)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
s = sum(A)

av = s / 2
x = 0
y = 0

for i in range(N):
  x += A[i]
  
  if x < av < x +A[i+1]:
    
    y = s - x - A[i+1]
    
    if x > y:
      print(A[i+1]-x+y)
      
    else:
      print(A[i+1]-y+x)
  elif x == av:
    print(0)
# Judge status: Wrong Answer
N=int(input())
N-=1
a=list(map(int,input().split()))
a.sort
a.reverse()
b=0
c=0
if N % 2==1:
  b+=a[0]
  c+=1
  i=0
  while True:
    if c==N:
      print(b)
      break
    else:
      i+=1
      c+=2
      b+=2*a[i]
  
if N % 2==0:
  b+=a[0]
  c+=1
  i=0
  while True:
    i+=1
    c+=2
    b+=2*a[i]
    m=N-c
    if m==1:
      b+=a[i]
      print(b)
      break
# Judge status: Accepted
A,B = map(int,input().split())   
A != B
if (A+B) % 2==0:
  print((A+B)//2)
else:
  print('IMPOSSIBLE')
# Judge status: Accepted
N, C, K = map(int, input().split())
T = sorted([int(input()) for _ in range(N)])

bus = 1
lastPassenger = T[0]
waiting = 1
for t in T[1:]:
    if waiting < C and lastPassenger + K >= t:
        waiting += 1
    else:
        waiting = 1
        lastPassenger = t
        bus += 1

print(bus)
# Judge status: Accepted
# Problem A - Kenken Race

# input
N, A, B, C, D = map(int, input().split())
S = input()

# initialization
is_ok = True

# search
if C>D:
    # b check
    if "##" in S[B-1:D] or not "..." in S[B-2:D+1]:
        is_ok = False

    # a check
    if "##" in S[A-1:C]:
        is_ok = False
else:
    # b check
    if "##" in S[B-1:D]:
        is_ok = False

    # a check
    if "##" in S[A-1:C]:
        is_ok = False

# output
if is_ok:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import collections
mod = 10**9 + 7
N = int(input())
S = input()

C = collections.Counter(S)

ans = 1
for v in C.values():
    ans *= v+1
    ans %= mod

print(ans-1)
# Judge status: Accepted
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())


if A < B:
    A_sum = A + (V * T)
    B_sum = B + (W * T)
    if A_sum >= B_sum:
        print('YES')
    else:
        print('NO')

else:
    A_sum = A - (V * T)
    B_sum = B - (W * T)
    if A_sum <= B_sum:
        print('YES')
    else:
        print('NO')
# Judge status: Wrong Answer
a = input()

if a.isupper():
    print('A')
else:
    print('b')
# Judge status: Accepted
k,x = map(int, input().split())

if k*500 >= x:
	print("Yes")
else: 
	print("No")
# Judge status: Accepted
K = int(input())
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)


temp = []

for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            temp.append(gcd(i,j,k))
print(sum(temp))
# Judge status: Accepted
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

a, b, c = sorted(map(int, input().split()))

if a % 2 == 0 or b % 2 == 0 or c % 2 == 0:
    print(0)
else:
    print(a * b)
# Judge status: Accepted
x = input()
ans = 0
s = 0
for i in range(len(x)):
    if x[i] == 'S': s += 1
    else:
        if s > 0: s -= 1
        else: ans += 1
print(ans + s)
# Judge status: Wrong Answer
import sys
import math

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    X, Y = map(int, readline().split())
    x = X
    if Y%X==0:
        print(-1)
    else:
        while True:
            if X%Y!=0:
                print(X)
                break
            else:
                X += x



if __name__ == '__main__':
    main()
# Judge status: Accepted
import collections

N=int(input())
check1=list()
for i in range(N):
  check1.append(int(input()))
c=collections.Counter(check1)
check2=set(check1)
ans=0
for i in check2:
  if c[i]%2!=0:
    ans+=1
print(ans)
# Judge status: Wrong Answer
N=int(input())
k=N//11
s=N-(k*11)
if s==0:
  print(k*2)
elif s<=5:
  print(2*k+1)
else:
  print(2*k+2)
# Judge status: Wrong Answer
i=lambda:map(int,input().split());n,m,x,y=i();print("No"*(max(x,max(i()))<min(min(i()),y))+'War')
# Judge status: Accepted
from collections import Counter

n = int(input())
d = list(map(int, input().split()))
mod = 998244353

a = sorted(list(set(d)))

if d[0] != 0:
    ans = 0
elif a[-1] != len(a)-1:
    ans = 0
else:
    c = sorted(Counter(d).items())
    if c[0] != (0, 1):
        ans = 0
    else:
        ans = 1
        pre = 1
        for k, v in c:
            ans *= pre ** v
            ans %= mod
            pre = v

print(ans)
# Judge status: Accepted

n,k = list(map(int,input().split()))

ni = [0]*n

while k > 0:
    d = int(input())
    a = list(map(int,input().split()))
    k -= 1
    for i in a:
        ni[i-1] = 1

print(ni.count(0))
# Judge status: Accepted
import sys
readline = sys.stdin.readline

N = int(readline())
A = list(map(int, readline().split()))

four = len([a for a in A if a%4 == 0])
two = len([a for a in A if a%2 == 0]) - four
one = N - four - two

ans = 'No'
if two:
    one += 1
N = one + four
if N//2 <= four:
    ans = 'Yes'

print(ans)
# Judge status: Wrong Answer
N,K = map(int,input().split())
H = list(map(int,input().split()))
H.sort
if N<=K:
    print(N)
else:
    print(sum(H[N-K:]))
# Judge status: Wrong Answer

N = int(input())
S = input()

ans = 0
cnt = [0, 0]
for i in range(N):
    if S[i] == "W":
        if i > 0 and S[i - 1] == "R":
            ans += min(cnt)
            cnt = [0, 0]
        cnt[0] += 1
    else:
        cnt[1] += 1
ans += min(cnt)
print(min(ans, S.count("W"), S.count("R")))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

count = 0

for i in range(N):
    count += B[i]

    if  i >= 1 and A[i] == A[i - 1] + 1:
        count += C[A[i - 1] - 1]

print(count)
# Judge status: Accepted
a, b=map(int, input().split())
if a >= b:
    ans=str(b) * a
else:
    ans=str(a) * b

print(ans)
# Judge status: Wrong Answer
a = int(input())
s = input()

ans = 'red'
if a < 3200:
    print(ans)
else:
    print('s')
# Judge status: Wrong Answer
a,b,c=input().split()
 
if a==b==5:
  if c==7:
    print("Yes")
  else:
    print("No")
elif a==c==5:
  if b==7:
    print("Yes")
  else:
    print("No")
elif b==c==5:
  if a==7:
    print("Yes")
  else:
    print("No")
else:
  print("No")
# Judge status: Accepted
import itertools
import math
n = int(input())
x,y = [0]*n,[0]*n
for i in range(n):
  x[i],y[i] = map(int,input().split())
lis = [x for x in range(n)]
permutation_lis = itertools.permutations(lis)
ans = 0
div = math.factorial(n)
def eucleid_dist(a,b):
  return  math.sqrt((a[0]-b[0])**2+(a[1]-b[1])**2)
for path in permutation_lis:
  dist = 0
  for i in range(n-1):
    a = (x[path[i+1]],y[path[i+1]])
    b = (x[path[i]],y[path[i]])
    dist += eucleid_dist(a,b)
  ans += dist/div
print(ans)
# Judge status: Wrong Answer
in_num = int(input())
check_num = 0
ans_counter = 0

while check_num <= in_num:
	i = 1
	div_counter = 0
	while i <= check_num /3:
		if check_num % i == 0:
			div_counter += 1
		i += 2
	if div_counter == 8:
		ans_counter += 1
	check_num += 2

print(ans_counter)
# Judge status: Accepted
n,*a=map(int,open(0).read().split())
ans=0
s=sum(a)
p=1
b=True
for j in a:
    if p<j:
        print(-1)
        exit()
    ans+=p
    p-=j
    s-=j
    if p<s and b:
        if p*2<s:p*=2
        else:p=s
    if p==s:b=False
print(ans)
# Judge status: Accepted
N=int(input())
X=list(map(int,input().split()))
Z=sorted(X)
left=Z[N//2-1]
right=Z[N//2]
for i in X:
    if i<=left:
        print(right)
    else:
        print(left)
# Judge status: Wrong Answer
from collections import Counter
n = int(input())
l = list()
for i in range(1,31):
    l.append((i, i**2))
# print(l)
c = Counter()
for X in l:
    for Y in l:
        for Z in l:
            x = X[0]
            y = Y[0]
            z = Z[0]
            c[X[1]+Y[1]+Z[1]+x*y+y*z+x*z] += 1

for i in range(1, n+1):
    print(c[i])
# Judge status: Accepted
A, B = map(int, input().split())

s = add = max(A, B)
while True:
    if s % A == 0 and s % B == 0:
        break
    s += add

print(s)
# Judge status: Accepted
X, N = map(int, input().split())
P = list(map(int, input().split()))
ans, mind = -1, 200
for i in range(102):
    if mind > abs(i - X) and i not in P:
        mind = abs(i - X)
        ans = i
print(ans)
# Judge status: Wrong Answer
dishes = [int(input()) for _ in range(5)]

dishes = sorted(dishes, key=lambda x: 10 - int(str(x)[-1]))
a = list()
b = list()
for d in dishes:
    if d % 10 == 0:
        a.append(d)
    else:
        b.append(d)
# b = [d + 10 - d % 10 for d in b[:-1]] + [b[-1]]
# dishes = a + b
# print(sum(dishes))
#
print(1)
# Judge status: Wrong Answer
N = int(input())
W = list(map(int, input().split()))

diff = sum(W)
for w in W:
    if diff > abs(diff-2*w):
        diff -= 2 * w
print(abs(diff))
# Judge status: Wrong Answer
import sys
import math
import itertools

n,T=list(map(int,input().split()))
min=9999
for i in range(n):
	c,t=list(map(int,input().split()))
	if T>=t:
		if min>c:
			min=c
print(c)
# Judge status: Wrong Answer
s,t=input(),input()
print("Yes") if s == t[::-1] else print("No")
# Judge status: Accepted
a=input()
b=input()
c=input()

x=a[0]
a=a[1:]
while True:
  if x=="a":
    if a=="":
      print("A")
      break
    else:
      x=a[0]
      a=a[1:]
  elif x=="b":
    if b=="":
      print("B")
      break
    else:
      x=b[0]
      b=b[1:]
  elif x=="c":
    if c=="":
      print("C")
      break
    else:
      x=c[0]
      c=c[1:]
# Judge status: Accepted
from collections import deque

n,m = map(int, input().split())
g = [[] for _ in range(n)] # 隣接リスト

for _ in range(m):
    a, b = map(int, input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)

# bfs
queue = deque([0])
d = [None] * n # init fromt rooms
d[0] = 0
while queue:
    v = queue.popleft()
    for i in g[v]:
        if d[i] is None:
            d[i] = v
            queue.append(i)
print('Yes')
for i in range(1, n):
    print(d[i]+1)
# Judge status: Accepted
n,k,s = map(int,input().split())

ans = []

for i in range(k):
    ans.append(s)

for i in range(n-k):
    if s != 10**9:
        ans.append(10**9)
    else:
        ans.append(10**9-1)

ans1 = ""
for i in ans:
    ans1 += str(i)+ " "
print(ans1)
# Judge status: Accepted
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#N = int(input())
X, Y, Z = map(int, input().split())

X = X - (Z*2)
cnt = 0
while (X >= Y) :
  X -= Y
  cnt += 1
  X -= Z
  
print (cnt)
# Judge status: Accepted
N,K=map(int, input().split(" "))
s=input().split(" ")
i=N

while i < 10*N:
    j = list(str(i))
    if not set(j).isdisjoint(set(s)): #NがSを含むとき
        i += 1
    else:
        print(i)
        break
# Judge status: Wrong Answer
a,b,k = map(int,input().split())
if max(a,b,k) == k:
    for i in range(a,b+1):
        print(i)
else:
    for i in range(a,b+1):
        if abs(i-a)<k or i-b<k:
            print(i)
# Judge status: Accepted
S,T=map(str,input().split())
A,B=map(int,input().split())
U=str(input())
ans=""
if(U==S):
    ans=str(A-1)+" "+str(B)
else:
    ans=str(A)+" "+str(B-1)
print(ans)
# Judge status: Accepted
n = int(input())
csf = []
for i in range(n-1):
    t = list(map(int, input().split()))
    csf.append(t)

ans = []
for i in range(n-1):
    now = 0
    for c,s,f in csf[i:]:
        if now < s:
            now = s
        now += (s-now)%f+c
    ans.append(now)
ans.append(0)

for a in ans:
    print(a)
# Judge status: Accepted
n, t = map(int, input().split())

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

print(ans if ans != 1001 else "TLE")
# Judge status: Accepted
def imp():return map(int,input().split())
def limp():return list(map(int,input().split()))
n,m,x,y=imp()
lx=max(limp())
ly=min(limp())
if ly>lx and lx+1>x and ly<=y:print("No War")
else:print("War")
# Judge status: Accepted
abc = list(map(int, input().split()))
abc.sort()
if abc[0] + abc[1] == abc[2]:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
x = int(input())
plus = 1 if x%11 <= 6 else 2
print((x-1)//11 * 2 + plus)
# Judge status: Wrong Answer
n, m = map(int, input().split())
if m % n == 0:
    print(m // n)
for i in range(int(m ** 0.5) + 1)[::-1]:
    if (m % i == 0) and (m // i >= n):
        print(i)
        break
# Judge status: Accepted
s=input()
count=0
if s[0] == "1":
  count+=1
if s[1] == "1":
  count+=1
if s[2] == "1":
  count+=1
print(count)
# Judge status: Wrong Answer
N=int(input())
L=input()
ans=int(0)
M=L.replace(" ",",")
S=list(L.split())
s=[int(t) for t in S]
s.sort()
    
for i in range (1,N):
    for j in range (i+1,N):
        for k in range (j+1,N):
            if s[i]<s[j]+s[k]:
                ans +=1
            else :
                pass
print(ans)
# Judge status: Accepted
def resolve():
    a, b = map(int, input().split())
    print(max(2*a-1, a+b, 2*b-1))
resolve()
# Judge status: Wrong Answer
import sys
from collections import defaultdict
import math
import itertools
import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10000)

N = int(readline())
tmp = list(map(int,input().split()))
A = []  
[bisect.insort_right(A, x) for x in tmp]
B = list(map(int,readline().rstrip().split()))
#B = []
#[bisect.insort_right(B,x) for x in tmp ]
C = list(map(int,readline().rstrip().split()))
#C = []
#[bisect.insort_right(C,x) for x in tmp]
# Judge status: Wrong Answer
a,b = map(int,input().split())
ans = 0
for i in range(a,b+1):
  s = str(i)
  if s[0] == s[4] and s[1] == s[2]:
    ans += 1
print(ans)
# Judge status: Accepted
s = str(input())
if s == "Sunny":
  print('Cloudy')
elif s == "Cloudy":
  print('Rainy')
elif s == "Rainy":
  print('Sunny')
# Judge status: Accepted
a = list(map(int, input().split()))
ans = 0
for i, v in enumerate(a):
    if v == 0:
        ans = i
        break

print(ans+1)
# Judge status: Accepted
N = int(input())
count = 0
cList = {}
s = 0
for i in range(1,N + 1):
    s = i
    while i % 2 != 1:
        i /= 2
        count += 1
    # print(f"{s}:{count}")
    cList[s] = count
    count = 0
# for c in cList.values():
#     print(c)
print(max(cList,key=cList.get))
# Judge status: Accepted
h,a = map(int,input().split())
ans = (h//a)
if h%a==0:
    print(ans)
else:
    print(ans+1)
# Judge status: Wrong Answer
import math

a,b,c,d=map(int,input().split())

n=b-a+1

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
  
x=lcm(c,d)

cc=math.ceil(n/c)
dc=math.ceil(n/d)
xc=math.ceil(n/x)

print(n-cc-dc+xc)
# Judge status: Accepted
a, b, c, d = map(int, input().split())

t_hp = a
a_hp = c

while True:
    a_hp -= b
    if a_hp <= 0:
        print('Yes')
        exit(0)
    t_hp -= d
    if t_hp <= 0:
        print("No")
        exit(0)