peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
S = input()
if 0<int(S[0]+S[1])<13:	#MMかYY
  if 0<int(S[2]+S[3])<13:	#MMかYY
    print('AMBIGUOUS')
  else:	#YY
    print('MMYY')
else:	#YY
  if 0<int(S[2]+S[3])<13:	#MM
    print('YYMM')
  else:	#YY
    print('NA')
# Judge status: Wrong Answer
abc = list(map(int,input().split()))

if 5 in abc and 7 in abc and abc.count(7)==1:
  print('YES')
else:
  print('NOT')
# Judge status: Accepted
s = int(input())
a = [s]
while a[-1] not in a[:len(a)-2]:
    if a[-1] % 2 == 1:
        a.append(3 * a[-1] + 1)
    else:
        a.append(a[-1] // 2)
print(len(a))
# Judge status: Wrong Answer
N = int(input())
L = list(map(int,input().split()))
L.sort()
count = 0
for k in range(2,N):
  for j in range(0,k-1):
    if L[k] < L[j] + L[j+1]:
      count += (len(L[j:k])*len(L[j+1:k]))//2
    else:
      pass
print(count)
# Judge status: Accepted
n,m,k=map(int,input().split())
x='No'
for i in range(m+1):
  t=n*i
  if t==k:
    x='Yes'
    break
  for j in range(n):
    t+=m-2*i
    if t==k:
      x='Yes'
      break
print(x)
# Judge status: Accepted
x = input()
s_count = 0
ans = 0
for i in x:
    if i == 'S':
        s_count += 1
    else:
        if s_count > 0:
            s_count -= 1
            ans += 1
print(len(x)-ans*2)
# Judge status: Accepted
mod = 10**9 + 7
N = int(input())
S = list(input())
al = [chr(ord("a") + i ) for i in range(26)]
cntAl = [ S.count(chr(ord("a") + i )) for i in range(26)]
ans = 1
for a in cntAl:
    if a != 0:ans *= (a+1)%mod
print((ans-1)%mod)
# Judge status: Accepted
n = int(input())

k_5 = n // 5
k_3 = n // 3
k_15 = n // 15

sum_5 = 5 * k_5 * (k_5 + 1) / 2 
sum_3 = 3 * k_3 * (k_3 + 1) / 2 
sum_15 = 15 * k_15 * (k_15 + 1) / 2 
sum_n = n * (n+1) / 2

answer = sum_n - sum_3 - sum_5 +sum_15
print(int(answer))
# Judge status: Accepted
n = int(input())
t = 0
for i in range(30):
    if (n - i * 4) % 7 == 0 and i*4 <= n:
        t = 1
if t == 1:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import sys
N, M = map(int, sys.stdin.readline().split())
if N % 2:
    for i in range(M):
        print(i + 1, N - 1 - i)
else:
    for i in range(M):
        print(i + 1, N - i)
# Judge status: Accepted
import collections
n, k = map(int, raw_input().split())
cvs = collections.Counter(map(int , raw_input().split())).values()
cvs.sort(key = lambda x:- x)
print sum(cvs[k:] or [0])
# Judge status: Wrong Answer
myList = []
a,b=map(int,input().split())
if(b>a):
    for x in range(b):
        myList.append(a)
    for x in range(len(myList)): 
        print(myList[x])
else:
    for x in range(a):
        myList.append(b)
    for x in range(len(myList)): 
        print(myList[x])
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

a_even = list(filter(lambda x: x % 2 == 0, a))
a_odd = list(filter(lambda x: x % 2 != 0, a))

ans = a_even[::-1] + a_odd
if n % 2 == 0:
  ans = ans[::-1]

print(' '.join(map(str, ans)))
# Judge status: Wrong Answer
N, H = map(int, input().split())
ls = []
for i in range(N):
  a, b = map(int, input().split())
  ls += [(a,-b)]
ls.sort(key=lambda x:x[0])
a = ls[-1][0]
ls.sort(key=lambda x:x[1])
ans = 0
for i in range(N-1):
  if ls[i][1]>=-a:
    break
  H += ls[i][1]
  ans += 1
  if H<=0:
    print(ans)
    break
else:
  n = H//a if H%a==0 else H//a+1
  ans += n
  print(ans)
# Judge status: Accepted
N, M, X = map(int,input().split())
A = [[int(x) for x in input().split()] for _ in range(N)]

INF = float('inf')
ans = INF

for i in range(2**N):
    tmp = [0 for _ in range(M+1)]
    b = bin(i)[2:].zfill(N)
    
    for n in range(N):
        for m in range(M+1):
            tmp[m] += A[n][m] * int(b[N-1-n])

    if min(tmp[1:]) >= X:
        ans = min(ans, tmp[0])

if ans == INF:
    ans = -1
print(ans)
# Judge status: Accepted
N,X,Y=map(int,input().split())
X-=1
Y-=1

length=[0]*(N-1)
for i in range(N-1):
    for j in range (i+1,N):
        l=min(j-i,abs(X-i)+abs(Y-j)+1)
        length[l-1]+=1
for i in range(N-1):
    print(length[i])
# Judge status: Wrong Answer
import sys
def input(): return sys.stdin.readline().strip()


def main():
    s = input()
    d = set()
    for c in s:
        if c in d:
            print("no")
            return
    print("yes")

if __name__ == "__main__":
    main()
# Judge status: Accepted
import sys
import bisect
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
o = readline().rstrip().decode('utf-8')
e = readline().rstrip().decode('utf-8')
ans = []
for i in range(len(e)):
    ans.append(o[i])
    ans.append(e[i])
if len(o) == len(e)+1:
    ans.append(o[-1])

print("".join(ans))
# Judge status: Wrong Answer
N,M=input().split()
N=int(N)
M=int(M)
print((N*(N-1)/2)+(M*(M-1)/2))
# Judge status: Accepted
s = input()
k = int(input())
if s == '1' * len(s):
  print(1)
  exit()
for i in range(len(s)):
  if s[i] != '1':
    idx = i
    num = s[i]
    break
if idx >= k:
  print(1)
else:
  print(num)
# Judge status: Wrong Answer
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np

def main():
    N, *A = map(int, read().split())
    ans = [0] * (N + 1)
    print(ans)
    for a in A:
        ans[a] += 1
    ans = list(map(str, ans))
    print('\n'.join(ans[1:]))
    return

if __name__ == '__main__':
    main()
# Judge status: Accepted
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

ans = []
for i in range(n-k):
    if (a[i] < a[i+k]):
        ans.append("Yes")
    else:
        ans.append("No")

for i in range(len(ans)):
    print(ans[i])
# Judge status: Accepted
X, N = map(int, input().split())
if N:
    p = list(map(int, input().split()))
    for i in range(N // 2 + 3):
        if X - i not in p:
            print(X - i)
            break
        if X + i not in p:
            print(X + i)
            break
else:
    print(X)
# Judge status: Wrong Answer
import bisect,collections,copy,heapq,itertools,math,string
import numpy as np
import sys
sys.setrecursionlimit(10**7)
from math import atan,tan,pi

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

a,b,x = LI()

# 半分以上
if x**2 >= a*b/2:
    angle = math.degrees(math.atan(2*(b/a-x/a**3)))
# 半分以下
else:
    angle = math.degrees(math.atan(a*b**2/(2*x)))

print(angle)
# Judge status: Accepted
import sys
[a,b,c]=list(map(int,input().split()))
[d,e,f]=list(map(int,input().split()))
[g,h,i]=list(map(int,input().split()))
#print(a,b,c,d,e,f,g,h,i)

if d-a == e-b and e-b == f-c and g-d == h-e and h-e == i-f:
    if b-a == e-d and e-d == h-g and c-b == f-e and f-e== i-h:
        print('Yes')
        sys.exit(0)
print('No')
# Judge status: Accepted
n,k = map(int,input().split())
h = list(map(int,input().split()))
if k>=n:
    print(0)
    exit()
h = sorted(h,reverse=True)
f = h[k:]
print(sum(f))
# Judge status: Accepted
N,K=map(int,input().split())
A=list(map(int,input().split()))
if N<=K:
  print(1)
else:
  i=K
  a=1
  while i<N:
    i+=(K-1)
    a+=1
  print(a)
# Judge status: Wrong Answer
def solve():
    N, M = map(int, input().split())
    
    if N > 0:
        return 'Positive'
    elif N <= 0 <= M:
        return 'Zero'
    else:
        if N-M % 2 == 0:
            return 'Positive'
        else:
            return 'Negative'
            
    return 0

print(solve())
# Judge status: Accepted
N = int(input())

a = 1
ans = 0

while a< N:
    b = a+1
    while a*b < N:
        ans += 2
        b += 1
    a+=1
a=1
while a**2 < N:
    ans+=1
    a += 1
print(ans)
# Judge status: Accepted
a=int(input())
b=int(input())
c=int(input())
print((a+b)*c//2)
# Judge status: Accepted
sx, sy, tx, ty = map(int, input().split())

W = abs(sx-tx)
H = abs(sy-ty)
ans = ""

for i in range(W):
    ans += "R"
for i in range(H+1):
    ans += "U"
for i in range(W+1):
    ans += "L"
for i in range(H+1):
    ans += "D"
ans += "R"

for i in range(H):
    ans += "U"
for i in range(W+1):
    ans += "R"
for i in range(H+1):
    ans += "D"
for i in range(W+1):
    ans += "L"
ans += "U"

print(ans)
# Judge status: Accepted
S=input()
T=input()
a=len(S)
b=len(T)
m=a-b
ans=b
if m!=0:
    for i in range(m):
        cnt=b
        for j in range(b):
            if S[i+j]==T[j]:
                cnt-=1
        ans=min(cnt,ans)
else:
    cnt=b
    for i in range(a):
        if S[i]==T[i]:
            cnt-=1
    ans=min(cnt,ans)
print(ans)
# Judge status: Accepted
L=int(input())
print((L/3.0)**3.0)
# Judge status: Accepted
N=int(input())
a=list(map(int,input().split()))
a.sort()


ans=[a[-1],a[0]]

target=a[-1]/2
d=10**9
for i in range(N-1):
    diff=abs(a[i]-target)
    if diff<d:
        d=diff
        ans[1]=a[i]

            
print(' '.join(map(str, ans)))
# Judge status: Accepted
H=int(input())
cnt=0
while H>1:
	H=H//2
	cnt+=1
print(2**(cnt+1)-1)
# Judge status: Wrong Answer
X,Y = map(int,input().split())

answer = int(X + Y / 2)
# Judge status: Accepted
N = int(input())
H=list(map(int,input().split()))
#print(H)
INF=1000000000
dp=[INF]*(N+1)
#print(dp)
dp[0]=0
#print(dp[0])
#print(H[1],H[0])
dp[1]=dp[0]+abs(H[1]-H[0])
for i in range(2,N):
  dp[i]=min(dp[i-2]+abs(H[i-2]-H[i]),dp[i-1]+abs(H[i-1]-H[i]))
print(dp[N-1])
# Judge status: Wrong Answer
N, M = map(int, input().split())

ans = [-1 for i in range(N-1)]
path = [[] for i in range(N)]

for i in range(M):
  A, B = map(int, input().split())
  path[A-1].append(B)
  path[B-1].append(A)
nows = [1]
COUNTER = 0
while len(nows)>0 :
  now = nows.pop(0)
  for p in path[now-1]:
    if ans[p-2]==-1:
      ans[p-2]=now
      nows.append(p)
      #print(COUNTER, now,p)
      COUNTER+=1
  
print("Yes")
for i in ans:
  print(i)
# Judge status: Wrong Answer
X,A,B=map(int,input().split())
if(X > A):
    print("delicious")
elif(X < (A+B)):
    print("safe")
else:
    print("dangerous")
# Judge status: Wrong Answer
def LI():
  return [int(s) for s in input().split()]

N,X = LI()
L_s = LI()

D = [0]*N

count = 1

for i in range(1,N):
  D[i] = D[i-1] + L_s[i-1]
  if D[i] <= X:
  	count += 1
  
print(count)
# Judge status: Accepted
a = int(input())
list = list(map(int, input().split()))
cnt=0
ok = True
while ok:
    for i in list:
        if not i%2==0:
            ok = False
            break

    if ok : cnt += 1
    list = [int(i / 2) for i in list]
print(cnt)
# Judge status: Accepted
arr = list(map(int, input().split()))
if arr.count(5) == 2 and arr.count(7):
    print("YES")
else:
    print('NO')
# Judge status: Accepted
n = int(input())

a = list(map(int,input().split()))
a.sort()
ans = 0

for i in range(1,n):
    k = n - i // 2 - 1
    ans += a[k]

print(ans)
# Judge status: Accepted
a,b,c,d=map(int,input().split())
if abs(b-a)<=d and abs(c-b)<=d or abs(c-a)<=d:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
a,b,c=(int(x) for x in input().split())
if a+b==c or b+c==a or c+a==b:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
s = list(input())
n = len(s)

if s == "keyence":
	print("YES")
	eixt()

for i in range(n):
	ss = s[::]
	for j in range(i, n):
		ss.pop(i)
		if "".join(ss) == "keyence":
			print("YES")
			break
	else:
		continue
	break
else:
	print("NO")
# Judge status: Accepted
n = int(input())
x = 0

while True:
    if n % 1000 == 0:
        break
    n += 1
    x += 1

print(x)
# Judge status: Accepted
from math import*
n,*a=map(int,open(0).read().split())
b=[0]
for i in a:b+=gcd(b[-1],i),
w=m=0
for i in range(n):m=max(m,gcd(w,b[-i-2]));w=gcd(w,a[~i])
print(m)
# Judge status: Wrong Answer
a, b = map(int, input().split())
print(int((a+b)/2))
# Judge status: Wrong Answer
a,b,k=map(int,input().split())
x=[]
y=[]
if b-a<k:
    k=b-a
for i in range(a,a+k):
    x.append(i)
for i in range(b-k+1,b+1):
    x.append(i)
y=list(set(x))
x.sort()
for i in range(len(x)):
    print(x[i])
# Judge status: Accepted
import sys

input = sys.stdin.readline

N = int(input())
t = [0] * (N + 1)
x = [0] * (N + 1)
y = [0] * (N + 1)
for i in range(1, N+1):
    t[i], x[i], y[i] = map(int, input().split())


for i in range(1, N+1):
    if abs(x[i] - x[i-1]) + abs(y[i] - y[i-1]) > (t[i] - t[i-1]) or (((t[i] -x[i] -y[i]) % 2) != 0):
        print("No")
        exit()
print("Yes")
# Judge status: Accepted
n = int(input())

if n == 0:
    print(0)
    exit()

ans = ''

flag = True

while n != 0:
    if abs(n % 2) == 1:
        ans += '1'
        if flag:
            n -= 1
        else:
            n += 1
    else:
        ans += '0'

    n = n // 2
    flag = not flag

print(ans[::-1])
# Judge status: Wrong Answer
from itertools import combinations as cmb

n,m,q=map(int,input().split())
abcd=[]
for i in range(q):
    ll=map(int,input().split())
    ll=[ww-1 for ww in ll]
    abcd.append(list(ll))

ans=0
for li in cmb(range(m),n):
    kari=0
    for i in abcd:
        if li[i[1]]-li[i[0]]==i[2]+1:
            kari+=i[3]+1
    ans=max(ans,kari)

print(ans)
# Judge status: Wrong Answer
n,x,t = map(int,input().split())
print((n//x)*t)
# Judge status: Accepted
n = int(input())
ans = 0
for i in range(1, 32001):
    if i ** 2 <= n:
        ans = i ** 2
print(ans)
# Judge status: Wrong Answer
abc = list(map(int, input("").split()))
k = int(input())

abc.sort

for i in range (k):
    abc[-1] *= 2

print(sum(abc))
# Judge status: Accepted
d=[0]*100
for i in range(int(input())+1):
  s=str(i)
  d[int(s[0])*10+int(s[-1])]+=1
r=range(1,10)
print(sum(d[i*10+j]*d[j*10+i]for i in r for j in r))
# Judge status: Wrong Answer
def main(n, k):
    t = 0
    i = 0

    while n > t:
        t = k ** i
        i += 1

    print(max(i - 1, 0))


if __name__ == "__main__":
    n, k = map(int, input().split())

    main(n, k)
# Judge status: Accepted
n, m = map(int, input().split())

ab = sorted([list(map(int, input().split())) for _ in range(n)])
ans = 0

for i, j in ab:
    if m >= j:
        m -= j
        ans += i*j
    elif m < j:
        ans += i*m
        break

print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
c = [0] * 3
for i in range(n):
    if a[i] % 4 == 0:
        c[2] += 1
    elif a[i] % 2 == 0:
        c[1] += 1
    else:
        c[0] += 1

if c[1] == 0:
    if c[0] <= c[2]+1:
        print('Yes')
    else:
        print('No')
else:
    if c[0] <= c[2]:
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
a , b, c , x = [int(input()) for i in range(4)]
count = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range (c+1):
            if i * 500 + j * 100 + k * 50 == x:
                count += 1

print(count)
# Judge status: Wrong Answer
s, t = input().split()
print(s, t, sep="")
# Judge status: Accepted
s = input()
if s[-1] == "s":
    print(s+"es")
else:
    print(s+"s")
# Judge status: Accepted
#!/usr/bin/env python3
n = int(input())
s = input()
INF = 10**9
white_cnt = s.count('.')
black_cnt = 0
ans = INF
for c in s:
    ans = min(ans, black_cnt + white_cnt)
    if c == '#':
        black_cnt += 1
    else:
        white_cnt -= 1
else:
    ans = min(ans, black_cnt + white_cnt)

print(ans)
# Judge status: Accepted
import sys
import math

i=list(map(int,input().split()))

a=i[0]
b=i[1]
t=i[2]

ans=math.floor(t/a)*b
print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
py = []
d = {}
for i in range(M):
    p, y = map(int, input().split())
    py.append([p, y])
    if p not in d:
        d[p] = [y]
    else:
        d[p].append(y)
for key in d.keys():
    d[key].sort()
from bisect import bisect_left
for i in range(M):
    p, y = py[i]
    a = bisect_left(d[p], y)
    ans = '0' * (6 - len(str(p))) + str(p)
    ans += '0' * (6 - len(str(a + 1))) + str(a + 1)
    print(ans)
# Judge status: Accepted
N=int(input())

c=1
for i in range(1,50001):
    if int(i*1.08)==N:
        c=0
        print(i)
        
if c==1:
    print(":(")
# Judge status: Wrong Answer
n=int(input())
a=list(map(int, input().split()))
mon=1000
kai=0
for i in range(n-1):
  if a[i]>a[i+1]:
    mon+=kai*a[i]
    kai=0
  elif a[i]<a[i+1]:
    kai=int(mon/a[i])
    mon-=kai*a[i]
    
mon+=kai*a[n-1]

print(mon)
# Judge status: Wrong Answer
S = input()
N = len(S)
A = [0]*(N+1)
count = 0
for i in range(1,N):
    A[1] = S[-1]
    A[i+1] = (int(A[i])+int(S[-i-1])*10**i%2019)%2019  
              
for j in range(2019):
    m = A.count(j)
    count += m*(m-1)/2
    

print(count)
# Judge status: Accepted
N, K = map(int,input().split())
p = 1 / N
P = [p] * N
for i in range(min(N,K-1)):
    n = i + 1
    while n < K:
        P[i] *= (0.5)
        n = 2 * n
print(sum(P))
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

counter = 0
for i in range(N):
    checker_1 = i % 2 == 1
    checker_2 = A[i] % 2 == 1
    if checker_1 & checker_2:
        counter += 1
print(counter)
# Judge status: Wrong Answer
xs = input().split()

print("A"+xs[2][0]+"B")
# Judge status: Accepted
import sys
input = sys.stdin.readline
n,x=map(int,input().split())
a=list(map(int,input().split()))
ans=0
if a[0]>x:
    ans+=a[0]-x
    a[0]=x
for i in range(1,n):
    if a[i]+a[i-1]>x:
        ans+=a[i]-(x-a[i-1])
        a[i]=x-a[i-1]
#print(a)
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

n = int(input())
a = [int(item) for item in input().split()]
max_node = []
current = 1
for i, item in enumerate(a):
    max_node.append(current)
    current = (current - item) * 2

a.reverse()
max_node.reverse()

prev = 0
ans = 0
for i, (item, mx_nd) in enumerate(zip(a, max_node)):
    lower_bound = item + (prev + 1) // 2
    upper_bound = item + prev
    if lower_bound > mx_nd:
        print(-1)
        exit()
    prev = min(upper_bound, mx_nd)
    ans += prev
print(ans)
# Judge status: Accepted
n = int(input())
s = map( int, input().split())

s =  [ i-(n+1) for n, i in enumerate(s)]

s.sort()

if n%2==0 :
  m = (s[n//2 - 1] + s[n//2]) // 2
else :
  m = s[n//2]

ans = 0
for i in s:
  ans+= abs(i -m)
  
print(ans)
# Judge status: Accepted
a,b,m = map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
Min = (min(A)+min(B))
for _ in range(m):
    x,y,c = map(int,input().split())
    if Min > A[x-1]+B[y-1]-c:
        Min=A[x-1]+B[y-1]-c
print(Min)
# Judge status: Accepted
from collections import deque
n,m=map(int,input().split())
g=[[] for i in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  g[a-1].append(b)
  g[b-1].append(a)
q=deque()
q.append(1)
check=[0]*n
check[0]=1
ans=[0]*n
while len(q)!=0:
  v=q.popleft()
  for u in g[v-1]:
    if check[u-1]==0:
      check[u-1]=1
      ans[u-1]=v
      q.append(u)
print("Yes")
for i in range(1,n):
  print(ans[i])
# Judge status: Accepted
n = int(input())
a = [0] * n
for i in range(n):
    a[i] = int(input())
sorted_a = sorted(a, reverse=True)
max_a = sorted_a[0]
for i in range(n):
    if max_a != a[i]:
        print(max_a)
    else:
        print(sorted_a[1])
# Judge status: Accepted
N = int(input())
for i in range(1,10):
    if 111*i >= N:
        print(111*i)
        break
# Judge status: Accepted
N = int(input())
A = set(map(int, input().split()))

while len(A) > 1:
    a = min(A)
    A = set(x % a if x % a != 0 else a for x in A)
    if 1 in A:
        A = {1}
print(list(A)[0])
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**6)

n, d = map(int, input().split())

import math

tmp = d*2+1

ans = math.ceil(n/tmp)

print(ans)
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))
count = 1
direction = 0
for a, b in zip(A, A[1:]):
	dif = b - a
	if direction == 0 and dif != 0:
		direction = dif // abs(dif)
	elif (direction == 1 and dif < 0) or (direction == -1 and dif > 0):
		count += 1
		direction = 0
print(count)
# Judge status: Accepted
a = list(map(int, input().split()))
a.sort()
print(a[2]*10 + a[1] + a[0])
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))

ans=[]
b=[0]*n
for i in reversed(range(n)):
  if sum(b[i::i+1])%2!=a[i]:
    b[i]+=1
    ans.append(i)
        
print(sum(b))
print(*sorted(ans))
# Judge status: Accepted
N,T = map(int,input().split())
ct = [list(map(int,input().split())) for _ in range(N)]

ct.sort(key=lambda x: x[1])
ans = 10**18

for c,t in ct:
  if t > T:
    break
  ans = min(ans,c)
if ans == 10**18:
  ans = 'TLE'
print(ans)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
for i in range(N):
    A[i] -= i + 1

A.sort()
mid = A[(N + 2 - 1) // 2 - 1]
ans = 0
for a in A:
    ans += abs(a - mid)

print(ans)
# Judge status: Accepted
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n , k = map(int, input().split())
    a = list(map(int, input().split()))
    
    def check(m):
        cnt = 0
        for x in a:
            cnt += (x-1)//m
        return cnt <= k
        
    l, r = 0, max(a)
    while r-l > 1:
        m = (r+l)//2
        if check(m): r = m
        else: l = m
    print(r)

    


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
A,B = map(int,input().split())

print(B if A >= 13 else 0 if A <= 5 else B/2)
# Judge status: Accepted
L,R = map(int,input().split())
if R-L > 2019:
    print(0)
else:
    ans = 10**10
    for i in range(L, R):
        for j in range(i+1, R+1):
            ans = min(ans, i*j%2019)
    print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
a = list(map(int,input().split()))
count = 0
s = sum(a)

for i in a:
  if i >= s/(4*m):
    count+=1

if m <= count:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
a=["a","e","i","o","u"]
print("vowel" if input() in a else "consonant")
# Judge status: Accepted
n=int(input())
s=[]
for i in range(n):
    s.append(input())

m=int(input())
t=[]
for i in range(m):
    t.append(input())

w=list(set(s))
a=[0]
for i in range(len(w)):
    a.append(s.count(w[i])-t.count(w[i]))

print(max(a))
# Judge status: Accepted
n=int(input())
w=[input() for _ in range(n)]
f=True
for i in range(1,n):
	if w[i-1][-1] == w[i][0]:
		f=True
	else:
		f=False
		break
if f==False:
	f=False
elif len(list(set(w))) == len(w):
	f=True
else:
	f=False
if f:
	print('Yes')
else:
	print('No')
# Judge status: Accepted
def main():
    N = int(input())
    a = [int(input()) for _ in range(N)]
    cnt = 0
    tmp = 1
    while cnt<=100001:
        tmp = a[tmp-1]
        cnt += 1
        if tmp == 2:
            return cnt
        elif tmp == 1:
            return -1

    return -1

print(main())
# Judge status: Accepted
a,b,c=map(int,input().split())
k=int(input())
d=max(a,b,c)
print(a+b+c-d+d*2**k)
# Judge status: Accepted
K, X = map(int, input().split())
for i in range(X-K+1, X+K):
    print(i, end=' ')
print()
# Judge status: Wrong Answer
from bisect import bisect_left


n = int(input())
A = sorted(map(int, input().split()))
print(A[-1], A[min(n - 2, bisect_left(A[:-1], A[-1] // 2))])
# Judge status: Wrong Answer
S=input()
if S=='AAA'or'BBB':
  print('No')
else:
  print('Yes')
# Judge status: Accepted
n = int(input())
A = list(map(int,input().split()))

ans = 0
for i,a in enumerate(A):
    if (i+1)%2:
        if a%2:
            ans += 1
print(ans)
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))
l.sort()
new=(l[0]+l[1])/2
if n>=3:
  for i in range(2,n):
    new=(new+l[i])/2
  print(new)
else:
  print((l[0]+l[1])/2)
# Judge status: Accepted
for i in range(365):
  print(i%26+1)
# Judge status: Accepted
length = int(input())
Bs = list(map(int, input().split()))
total = Bs[0] + Bs[length-2]

for i in range(length-2):
    total += min(Bs[i], Bs[i+1])

print(total)
# Judge status: Accepted
N = int(input())
if N % 2 == 0:
    ans = N // 2
else:
    ans = N // 2 + 1
print(ans)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
count = 0
for i in range(1,N+1):
  if i %2 != 0:
    if A[i-1] != 0:
      count +=1
print(count)
# Judge status: Accepted
a, b, c, k = list(map(int, input().split()))
if k<=a:
  print(k)
elif a<k<=b+a:
  print(a)
else:
  print(2*a-k+b)
# Judge status: Accepted
a,b=map(int,input().split())
if (a+b)%2==0:
  print((a+b)//2)
else:
  print("IMPOSSIBLE")
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7
ans = 0

for bit in range(10):
    m = 1 << bit
    # bit桁目のbitが立っている時の数
    c = sum(a&m for a in A) >> bit
    # bit桁目の1の合計
    ans += (c*(N-c))<<bit
    # 繰り上がりのない足し算
    ans %= mod
print(ans)