Harryxun/stf_run huggingface dataset:
N = int input()
a = list(map(int,input().split()))
b = 0

for i in range(N):
  if a[i] % 2 == 0:
    if a[i] % 3 != 0 or a[i] % 5 != 0:
      b = 1
      break
if b == 0:
  print("APPROVED")
else:
  print("DENIDED")


### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
c = 0
for i in range(N):
    if A[i] % 2 == 0:
        if A[i] %3 != 0 :
            if A[i] %5 != 0:
                c = 1
                break
if c == 0:
    print("APPROVED")
else:
    print("DENIED")
import math
import heapq
N, D, A = map(int, input().split())

M = []
for i in range(N):
    X, H = map(int, input().split())
    M.append((X, H))
M.sort(key=lambda x: x[0])


hq = []
heapq.heapify(hq)  # リストhqのheap化
ans = 0
B = 0
dx = M[0][0]+2*D
dd = math.ceil(M[0][1]/A)*A
for i, (x, h) in enumerate(M):
    while x > dx:
        B -= dd
        if B == 0:
            break
        dx, dd = heapq.heappop(hq)
    if h > B:
        t = math.ceil((h-B)/A)
        ans += t
        B += t*A
        if i != 0:
            heapq.heappush(hq, (x+2*D, t*A))
        # if len(hq)==1:
        #     dx=x+2*D
        #     dd=t*A


print(ans)


### FIXED CODE ###

import math
N, D, A = map(int, input().split())

M = []
for i in range(N):
    X, H = map(int, input().split())
    M.append((X, H))
M.sort(key=lambda x: x[0])

d = []
i = 0

ans = 0
B = 0
for X, H in M:
    while i != len(d) and X > d[i][0]:
        B -= d[i][1]
        i += 1
    if H > B:
        t = math.ceil((H-B)/A)
        ans += t
        B += t*A
        d.append((X+2*D, t*A))


print(ans)
x = int(input())
set_x = set(n**e for n in range(32) for e in range(2, 11) if n**e <= X)
ans = max(set_x)
print(ans)

### FIXED CODE ###

x = int(input())
set_x = set(n**e for n in range(32) for e in range(2, 11) if n**e <= x)
ans = max(set_x)
print(ans)
D,G = map(int,input().split())

P = []
C = []
for i in range(D):
  tempP, tempc = map(int, input().split())
  P.append(tempP)
  C.append(tempC)

print(P,C)


### FIXED CODE ###

d, g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]

ans = float("inf")

for bit in range(1 << d): #d個左にシフトする。d=2なら100となって十進法なら4。
    count = 0
    sum = 0
    nokori = [i+1 for i in range(d)]

    for i in range(d): #与えられbitにおいてすべて足し算する。
        if bit & (1 << i):
            sum += pc[i][0] * (i + 1) * 100 + pc[i][1]
            count += pc[i][0]
            nokori.remove(i + 1)

    # G 点に満たなければ nokori のうち一番大きいものを解く
    if sum < g:
        use = max(nokori)
        n = min(pc[use - 1][0], -(-(g - sum) // (use * 100)))
        count += n
        sum += n * use * 100

    if sum >= g:
        ans = min(ans, count)

print(ans)
N, K = map(int, input().split())
S = input()
width,l,r = [],[],[]

for i in range(K):
  if "0" not in S:
    break
  for j in range(N-1):
    if j == 0:
      sw = 1
      l.append(0)
      for k in range(j,N-1-j):
        if S[k] == "0" and S[k+1] == "1":
          r.append(k+1) #r自体は1
          sw = 2
        if sw == 2 and S[k] == "1" and S[k+1] == "0":
          width.append(k-j)
          break
    if S[j] == "0" and S[j+1] == "1":
      sw = 1
      for k in range(j+1,N-1-j):
        if S[k] == "1" and S[k+1] == "0":
          l.append(k+1)
        if S[k] == "0" and S[k+1] == "1":
          r.append(k+1) #r自体は1
          sw = 2
        if sw == 2 and S[k] == "1" and S[k+1] == "0":
          width.append(k-j)
          break
  idx = width.index(max(width))
  ans = max(width)
  S = S[:l[idx]] + "1"*(r[idx]-l[idx]) + S[r[idx]:]
print(ans)

### FIXED CODE ###

N, K = map(int, input().split())
S = list(map(int,list(input())))
A = []
B = []
if S[0] == 1:
  A.append(0)
  B.append(1)
else:
  A.extend([0,1])
  B.extend([0,0])
  
for i in range(1,N):
  if S[i] == S[i-1]:
    if S[i] == 0:
      A[-1] += 1
    else:
      B[-1] += 1
  else:
    if S[i] == 0:
      A.append(1)
      B.append(0)
    else:
      A.append(0)
      B.append(1)
if B[-1] == 0:
  A.append(0)
  B.append(0)

M = len(A)
tmp = sum(A[0:2*K+1]) + sum(B[0:2*K+1])
ans = tmp
for i in range(2,M-2*K,2):
  tmp -= A[i-1] + B[i-2]
  tmp += A[i+2*K-1] + B[i+2*K]
  ans = max(ans,tmp)
print(ans)
n, m = map(int, input().split())
a = [0]
b = [0]
for i in range(1, m+1):
    ta, tb = map(int, input().split())
    a.append(ta)
    b.append(tb)
dir = [[] for _ in range(m+1)]
for i in range(1, m+1):
    dir[a[i]].append(b[i])
    dir[b[i]].append(a[i])
ans = [0 for i in range(n+1)]
flag = [0 for i in range(n+1)]
flag[1] = 1
que = [1]
while len(que) != 0:
    #print('que: ', len(que), que)
    now = que.pop()
    for to in dir[now]:
        if flag[to] == 1:
            continue
        que.append(to)
        flag[to] != 1
        ans[to] = now
"""         print(to)
        ans[to] = now
        flag[to] = 1
        for toto in dir[to]:
            if flag[toto] != 1:
                que.append(toto) """
print('Yes')
for i in range(2,n+1):
    print(ans[i])

### FIXED CODE ###

from collections import deque
n, m = map(int, input().split())
dir = [[] for _ in range(n+1)]

for i in range(m):
    ta, tb = map(int, input().split())
    dir[ta].append(tb)
    dir[tb].append(ta)

ans = [0]*(n+1)
flag = [False]*(n+1)
flag[1] = True
que = deque([1])
while que:
    #print('que: ', len(que), que)
    now = que.popleft()
    for to in dir[now]:
        if flag[to]:
            continue
        que.append(to)
        flag[to] = True
        ans[to] = now

print('Yes')
for i in range(2,n+1):
    print(ans[i])
s = input()
t = input()

count = 0

if s[i] == t[i]:
  count += 1
  print(count)

### FIXED CODE ###

s = input()
t = input()
 
count = 0
 
for i in range(3):
		if s[i] == t[i]:
			count += 1  
    
print(count)
from collections import deque
import math

n,m,p = map(int, input().split())
dist  = []
edge1 = [[] for _ in range(n)]
edge2 = [[] for _ in range(n)]  # rev_edge
for _ in range(m):
    u,v,c = map(int, input().split())
    u -= 1
    v -= 1
    dist.append((u,v,(c-p)*-1))
    edge1[u].append(v)
    edge2[v].append(u)
    
def dfs(edges, s):
    stack = deque([s])
    used  = {s}
    while stack:
        x = stack.pop()
        for y in edges[x]:
            if y not in used:
                used.add(y)
                stack.append(y)
    return used


def bfs(edges, s):
    queue = deque([s])
    used  = {s}
    while queue:
        x = queue.popleft()
        for y in edges[x]:
            if y in used:
                continue
            used.add(y)
            queue.append(y)
    return used
    

def bellman(dist):  #負辺があるケースでの、スタートからゴールへの最短路を求めるアルゴ。
    cost = [math.inf] * n
    cost[0] = 0
    for _ in range(n): #頂点の個数の分だけ回る
        updated = False
        for u,v,c in dist: #辺の個数の分だけ回る
            if cost[u] + c < cost[v]:
                cost[v] = cost[u] + c
                updated = True                
    #収束しない場合は負閉路があるため無限に小さくできる。
    if updated==True:
        return -1
    else:
        return max(0, cost[n-1]*-1)    
        

    
    
use = bfs(edge1, 0) & dfs(edge2, n-1)
dist2 = [(a,b,c) for a,b,c in dist if a in use and b in use]
print(bellman(dist2))


### FIXED CODE ###

from collections import deque
import math
    
def dfs(edges, s):
    stack = deque([s])
    used  = {s}
    while stack:
        x = stack.pop()
        for y in edges[x]:
            if y not in used:
                used.add(y)
                stack.append(y)
    return used


def bfs(edges, s):
    queue = deque([s])
    used  = {s}
    while queue:
        x = queue.popleft()
        for y in edges[x]:
            if y in used:
                continue
            used.add(y)
            queue.append(y)
    return used
    

def bellman(dist):  #負辺があるケースでの、スタートからゴールへの最短路を求めるアルゴ。
    cost = [float("inf")] * n
    cost[0] = 0
    for _ in range(n): #頂点の個数の分だけ回る
        updated = False
        for u,v,c in dist: #辺の個数の分だけ回る
            if cost[u] + c < cost[v]:
                cost[v] = cost[u] + c
                updated = True                
    #収束しない場合は負閉路があるため無限に小さくできる。
    if updated==True:
        return -1
    else:
        return max(0, cost[n-1]*-1)    
        

n,m,p = map(int, input().split())
dist  = []
edge1 = [[] for _ in range(n)]
edge2 = [[] for _ in range(n)]  # rev_edge
for _ in range(m):
    u,v,c = map(int, input().split())
    u -= 1
    v -= 1
    dist.append((u,v,(c-p)*-1))
    edge1[u].append(v)
    edge2[v].append(u)    
    
use = dfs(edge1, 0) & dfs(edge2, n-1)
dist2 = [(a,b,c) for a,b,c in dist if a in use and b in use]
print(bellman(dist2))
C
import math
a, b, c, d = map(int, input().split())
a-=1
cd=c*d//math.gcd(c,d)
ans = b - (b // c) - (b // d) + (b // cd)
ans -= a - (a // c) - (a // d) + (a // cd)

print(ans)

### FIXED CODE ###

#C
import math
a, b, c, d = map(int, input().split())

def gcd(x, y):
    if x < y:
        x, y = y, x
    while y != 0:
        x, y = y, x % y
    return x

s = b - a + 1
cc = b // c - (a - 1) // c
dd = b // d - (a - 1) // d
cd = c * d // gcd(c, d)
cd = b // cd - (a - 1) // cd
s -= cc + dd - cd
print(s)
v

### FIXED CODE ###

D=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for _ in range(D)]
for i in range(D):
    print(s[i].index(max(s[i]))+1)
n=0
stones=[0]*n
memo=[-1]*n

def dp(pos):
  if pos==n-1:
    return 0
  if pos==n-2:
    return abs(stones[pos+1]-stones[pos])
  if(memo[pos]!=-1):
    return memo[pos];
  memo[pos]=min(abs(stones[pos+1]-stones[pos])+dp(pos+1),abs(stones[pos+2]-stones[pos])+dp(pos+2))
  return memo[pos]

if __name__=='__main__':
  n=int(input())
  stones=[0]*n
  stones=[int(val) for val in input().split()]
  memo=[-1]*n
 
  print(dp(0))


### FIXED CODE ###

n=0
stones=[0]*n
memo=[-1]*n

def dp(pos):
  if pos==n-1:
    return 0
  if pos==n-2:
    return abs(stones[pos+1]-stones[pos])
  if memo[pos] is not -1:
    return memo[pos];
  memo[pos]=min(abs(stones[pos+1]-stones[pos])+dp(pos+1),abs(stones[pos+2]-stones[pos])+dp(pos+2))
  return memo[pos]

def dp_iterative():
  memo[n-1]=0
  if n>=2:
    memo[n-2]=abs(stones[n-1]-stones[n-2])
  for index in range(n-3,-1,-1):
    memo[index]=min(memo[index+1]+abs(stones[index+1]-stones[index]),memo[index+2]+abs(stones[index+2]-stones[index]))
  return memo[0]

if __name__=='__main__':
  n=int(input())
  stones=[0]*n
  stones=[int(val) for val in input().split()]
  memo=[-1]*n
  print(dp_iterative())
inr = lambda: list(map(int, input().split()))

N, Y = inr()

lmn = [[-1, -1, -1]]

for x in range(N+1):
    for y in range(N+1):
        flag = 0
        z = N - x - y
        oto_sum = 10000 * x + 5000 * y + 1000 * z
        if z >= 0 and Y == oto_sum:
            lmn.append([x, y, z])
print(lmn[1][0],lmn[1][1],lmn[1][2])

### FIXED CODE ###

inr = lambda: list(map(int, input().split()))

N, Y = inr()

lmn = [-1, -1, -1]

for x in range(N+1):
    for y in range(N-x+1):
        z = N - x - y
        oto_sum = 10000 * x + 5000 * y + 1000 * z
        if z >= 0 and oto_sum == Y:
            print(x, y, z)
            exit()

print(-1, -1, -1)
n = input()
print(n*n)

### FIXED CODE ###

n = int(input())
print(n*n)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
?????¢
"""
import math
x1, y1, x2, y2 = map(int,input().strip().split())
x = x1 - x2
y = y1 - y2

distance = math.sqrt(x * x + y * y)

print(distance)

### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
?????¢
"""
import math
x1, y1, x2, y2 = map(float,input().strip().split())
x = x1 - x2
y = y1 - y2

distance = math.sqrt(x * x + y * y)

print(distance)
n = int(input())

a = int(n[-1])

if n==2  or n==2  or n==5  or n==7  or n==9:
    print('hon')
elif n== 0 or n==1  or n==6  or n==8:
    print('pon')
else:
    print('bon')

### FIXED CODE ###

n = input()

a = int(n[-1])

if a==2 or a==4 or a==5 or a==7 or a==9:
    print('hon')
elif a==0 or a==1 or a==6 or a==8:
    print('pon')
else:
    print('bon')
from collections import Counter
N,M,K = map(int,input().split())
f = [[] for _ in range(N+1)]
b = [[] for _ in range(N+1)]
for i in range(M):
    x,y = map(int,input().split())
    f[x].append(y)
    f[y].append(x)

d = [None]*(N+1)

def dfs(f,s,id):
    if(d[s] is None):
        d[s] = id
    for i in f[s]:
        if(d[i] is not None):
            continue
        dfs(f,i,id)
         
cnt = -1
for j in range(1,N):
    if(d[j] == None):
        cnt += 1
        dfs(f,j,cnt)
    
for i in range(K):
    x,y = map(int,input().split())
    if(d[x] == d[y]):
        b[x].append(y)
        b[y].append(x)
    
c = Counter(d)
for i in range(1,N+1):
    print(c[d[i]] - len(f[i]) - len(b[i])-1)

### FIXED CODE ###

import sys
from collections import Counter
N,M,K = map(int,input().split())
f = [[] for _ in range(N+1)]
b = [[] for _ in range(N+1)]
for i in range(M):
    x,y = map(int,input().split())
    f[x].append(y)
    f[y].append(x)

d = [None]*(N+1)
sys.setrecursionlimit(10**9)
def dfs(f,s,id):
    if(d[s] is None):
        d[s] = id
    for i in f[s]:
        if(d[i] is not None):
            continue
        dfs(f,i,id)
         
cnt = -1
for j in range(1,N+1):
    if(d[j] == None):
        cnt += 1
        dfs(f,j,cnt)
    
for i in range(K):
    x,y = map(int,input().split())
    if(d[x] == d[y]):
        b[x].append(y)
        b[y].append(x)

c = Counter(d)
for i in range(1,N+1):
    print(c[d[i]] - len(f[i]) - len(b[i])-1)
def main():
    N, M, *HAB = map(int, open(0).read().split())
    H = [0]*N
    for i in range(N):
        H[i] = HAB[i]
    A, B = [0]*M, [0]*M
    for i in range(M):
        A[i] = HAB[N + 2 * i + 0] - 1
        B[i] = HAB[N + 2 * i + 1] - 1
    # print(N, M, H, A, B)
    ans = set()
    for i in range(M):
        a = A[i]
        b = B[i]
        ha = H[a]
        hb = H[b]
        if ha < hb:
            ans.add(a)
        elif hb < ha
            ans.add(b)
    print(N - len(ans))

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    N, M, *HAB = map(int, open(0).read().split())
    H = [0]*N
    for i in range(N):
        H[i] = HAB[i]
    A, B = [0]*M, [0]*M
    for i in range(M):
        A[i] = HAB[N + 2 * i + 0] - 1
        B[i] = HAB[N + 2 * i + 1] - 1
    # print(N, M, H, A, B)
    ans = set()
    for i in range(M):
        a = A[i]
        b = B[i]
        ha = H[a]
        hb = H[b]
        if ha < hb:
            ans.add(a)
        elif hb < ha:
            ans.add(b)
        else:
            ans.add(a)
            ans.add(b)
    print(N - len(ans))

if __name__ == '__main__':
    main()
day = input()

days = {'SUN':0, 'MON':1, 'TUE':2, 'WED':3, 'THU':4, 'FRI': 5,'SAT',6}

print(7 - days[day])

### FIXED CODE ###

day = input()

days = {'SUN':0, 'MON':1, 'TUE':2, 'WED':3, 'THU':4, 'FRI': 5,'SAT':6}

print(7 - days[day])
l,r=map(int,input().split())
d=int(input())

print(r//d-l//d)

### FIXED CODE ###

l,r,d = map(int,input().split())

if l%d ==0:
  print(r//d - l//d +1)
else:
  print(r//d-l//d)
# coding: UTF-8
alfa_list = [chr(i) for i in range(97, 97+26)]
count_list = []
lines = []
while(1):
    read_line = raw_input()
    if read_line == '':
        break
    lines.append(read_line)
char_line = str(lines).lower()
for ch in alfa_list:
    count_list.append(char_line.count(ch))
for i in range(26):
    print "{0} : {1}".format(alfa_list[i],count_list[i])


### FIXED CODE ###

# coding: UTF-8
alfa_list = [chr(i) for i in range(97, 97+26)]
lines = []
count = 0
while(1):
    try:
        lines.append(str(raw_input()).lower())
    except:
        break
for ch in alfa_list:
    print "{0} : {1}".format(alfa_list[count],str(lines).count(ch))
    count += 1
import math
r = int(input())
a = r ** 2 * math.pi
c = r * 2 * math.pi

print("%5f" % (a),"%5f" % (c))

### FIXED CODE ###

import math
r = float(input())
a = r ** 2 * math.pi
c = r * 2 * math.pi

print("%5f" % (a),"%5f" % (c))
a,b,c = map(int, input())
if a <= b*c :
  print('Yes')
elif a > b*c :
   print('No')

### FIXED CODE ###

a,b,c = map(int, input().split())
if a <= b*c :
  print('Yes')
elif a > b*c :
   print('No')
N, M = map(int, input().split())
A = list(map(int, input().split()))

tab = [(1, 2),
       (2, 5),
       (3, 5),
       (4, 4),
       (5, 5),
       (6, 6),
       (7, 3),
       (8, 7),
       (9, 6)]
# tab.sort(key=lambda x: (x[1], -x[0]))

memo = [None] * (N + 1)

def dp(X):
    # print("#", X)
    if X == 0: return ''
    if X < 0: return 'a'
    if memo[X] != None: return memo[X]
    len_max = 0
    rets = []
    for Ai in A:
        if X - tab[Ai - 1][1] < 0: continue
        ret_tmp = str(Ai) + dp(X - tab[Ai - 1][1])
        if 'a' in ret_tmp: continue
        ret_tmp = ''.join(sorted(list(ret_tmp), key=lambda x: -int(x)))
        rets.append(ret_tmp)
        len_max = max(len_max, len(ret_tmp))
    for i in range(len(rets)):
        rets[i] = '0' * (len_max - len(rets[i])) + rets[i]
    #
    rets.sort()
    # print("#", rets)
    if len(rets) == 0:
        ret = 'a'
    else:
        ret = rets[-1].replace('0', '')
    #
    memo[X] = ret
    return ret

print(dp(N))

### FIXED CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))

tab = [6, 2, 5, 5, 4, 5, 6, 3, 7, 6]
A_cmp = {}
for Ai in sorted(A):
    A_cmp[tab[Ai]] = Ai
A = list(A_cmp.values())
A.sort(key=lambda x: -x)

memo = [None] * (N + 1)
memo[0] = 0

import sys
sys.setrecursionlimit(100000)

def dp(X):
    if X < 0: return -(1000000007)
    if memo[X] != None: return memo[X]
    #
    rets = []
    for i, Ai in enumerate(A):
        rets.append(dp(X - tab[Ai]) + 1)
    #
    ret = max(rets)
    memo[X] = ret
    return ret

ans_len = dp(N)

N_tmp = N
ans = ''
for i in range(ans_len):
    for j, Aj in enumerate(A):
        if dp(N_tmp) - 1 == dp(N_tmp - tab[Aj]):
            ans += str(Aj)
            N_tmp -= tab[Aj]
            break

print(ans)
S = input()
K = int(input())


ans = 1
for i in range(len(S)):
    if S[i] != "1":
      ans = S[i]
        break

print(ans)


### FIXED CODE ###

S = input()
K = int(input())


for i in range(len(S)):
    if S[i] != "1":
        break


ans = "1" if K-1 < i else S[i]
print(ans)
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.parents = [-1] * n

  def find(self, x):
    if self.parents[x] < 0:
      return x
    else:
      self.parents[x] = self.find(self.parents[x])
    return self.parents[x]

  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)

    if x == y:
      return

    if self.parents[x] > self.parents[y]:
      x, y = y, x

    self.parents[x] += self.parents[y]
    self.parents[y] = x

  def same(self, x, y):
    return self.find(x) == self.find(y)

  def roots(self):
    return [i for i, x in enumerate(self.parents) if x < 0]

  def num_roots(self):
    return len([i for i, x in enumerate(self.parents) if x < 0])

  def members(self, x):
    root = self.find(x)
    return [i for i in range(self.n) if self.find(i) == root]

  def num_members(self,x):
    return abs(self.parents[self.find(x)])

  def __str__(self):
    return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N, M = map(int, input().split())
uf = UnionFind(N)
cnt = 0
for i in range(M):
  a,b = map(int, input().split())
  if not uf.same(a,b):
    cnt += 1
    uf.union(a,b)
print(N-1-cnt)


### FIXED CODE ###

class UnionFind():
  def __init__(self, n):
    self.n = n
    self.parents = [-1] * n

  def find(self, x):
    if self.parents[x] < 0:
      return x
    else:
      self.parents[x] = self.find(self.parents[x])
    return self.parents[x]

  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)

    if x == y:
      return

    if self.parents[x] > self.parents[y]:
      x, y = y, x

    self.parents[x] += self.parents[y]
    self.parents[y] = x

  def same(self, x, y):
    return self.find(x) == self.find(y)

  def roots(self):
    return [i for i, x in enumerate(self.parents) if x < 0]

  def num_roots(self):
    return len([i for i, x in enumerate(self.parents) if x < 0])

  def members(self, x):
    root = self.find(x)
    return [i for i in range(self.n) if self.find(i) == root]

  def num_members(self,x):
    return abs(self.parents[self.find(x)])

  def __str__(self):
    return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N, M = map(int, input().split())
uf = UnionFind(N)
cnt = 0
for i in range(M):
  a,b = map(int, input().split())
  if not uf.same(a-1,b-1):
    cnt += 1
    uf.union(a-1,b-1)
print(N-1-cnt)
import itertools
import math
import string
import collections
from collections import Counter
from collections import deque
from operator import itemgetter
import sys
sys.setrecursionlimit(2*10**5)
INF = 2**60


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

n, k = map(int, input().split())
ab = [readints() for _ in range(n)]
# print(ab)
abab = sorted(ab)
# print(abab)
tmp = 0
for i in range(n):
    tmp += ab[i][1]
    if tmp >= k:
        print(ab[tmp-k][0])
        break


### FIXED CODE ###

import itertools
import math
import string
import collections
from collections import Counter
from collections import deque
from operator import itemgetter
import sys
sys.setrecursionlimit(2*10**5)
INF = 2**60


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

n, k = map(int, input().split())
ab = [readints() for _ in range(n)]
# print(ab)
abab = sorted(ab)
# print(abab)
tmp = 0
for i in range(n):
    tmp += abab[i][1]
    if tmp >= k:
        print(abab[i][0])
        break
##E
X,Y,A,B,C = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

psum = 0
plist = []

for i in range(X):
        plist.append(p[i])
for i in range(Y):
        plist.append(q[i])
        
plist.sort()
        
for i in range(C):
    if r[i] > plist[0]:
        plist.pop(i)
        plist.append(r[i])
    else:
        break
        
print(sum(plist))

### FIXED CODE ###

##E
X,Y,A,B,C = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

psum = 0

for i in range(X):
        r.append(p[i])
for i in range(Y):
        r.append(q[i])
        
r.sort(reverse=True)
ans = 0

for i in range(X+Y):
		ans += r[i]

        
print(ans)
i=2*R
s=i*3.1415
print(s)

### FIXED CODE ###

R=int(input())
i=R*6.283184
print(i)
H,N =map(int,input().split()) 
dp = [[0] * (H+1) for i in range(N)]
A,B = map(int,input().split()) 
for j in range(1, H+1):
    dp[0][j] = B * int((j+A-1)/A)

for i in range(1,N):
    A,B = map(int,input().split())
    for j in range(1, A+1):
        dp[i][j] = min(dp[i-1][j], B)
    for j in range(A+1, H+1):
        dp[i][j] = min(dp[i-1][j], dp[i][j-A] + B)

print(dp[N-1][H])

### FIXED CODE ###

H,N =map(int,input().split()) 
dp = [[0] * (10001) for i in range(1001)]
A,B = map(int,input().split()) 
for j in range(1, H+1):
    dp[0][j] = B * int((j+A-1)/A)

for i in range(1,N):
    A,B = map(int,input().split())
    for j in range(1, A+1):
        dp[i][j] = min(dp[i-1][j], B)
    for j in range(A+1, H+1):
        dp[i][j] = min(dp[i-1][j], dp[i][j-A] + B)

print(dp[N-1][H])
N=int(input())
if N==1:
    print(0)
else:
    X=[int(x) for x in input().split(" ")]
    cons=lambda P:sum([(x-P)**2 for x in X])
    print(min([cons(P) for P in range(min(X),max(X))]))


### FIXED CODE ###

N=int(input())
X=[int(i) for i in input().split(" ")]
sp=lambda P:sum([(Xi-P)**2 for Xi in X])
print(min([sp(p) for p in range(0,102)]))