ZhenlongDai/ACPR huggingface dataset:
Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import bisect
n, k =  [ int(v) for v in input().split() ]
num_list = sorted([ tuple(map(int, input().split())) for i in range(n) ])
order_list, value_list = [ 0 for i in range(n) ], [ 0 for i in range(n) ]
for i in range(n):
	order_list[i] = num_list[i][1] + order_list[i-1]
	value_list[i] = num_list[i][0]


print(value_list[bisect.bisect(order_list,k)-1])

Failing test case input:
2 9
4 4
11 19
2 1

Expected output:
11


Actual output:
4


Fixed submission (verdict: Accepted):
n, k =  [ int(v) for v in input().split() ]
num_list = sorted([ tuple(map(int, input().split())) for i in range(n) ])
order_list, value_list = [ 0 for i in range(n) ], [ 0 for i in range(n) ]
for i in range(n):
	order_list[i] = num_list[i][1] + order_list[i-1]
	value_list[i] = num_list[i][0]


for i in range(n):
	if order_list[i] - k >= 0:
		print(value_list[i])
		break

Problem: p03721
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, K = map(int, input().split())

L = []

for n in range(N):
    a, b = map(int, input().split())
    for i in range(b):
        L.append(a)

sorted(L)

print(L[K-1])

Failing test case input:
3 4
2 2
4 5
3 2

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())

L = []
for i in range(10**5+1):
    L.append(0)

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

a = 0
while K > 0:
    a += 1
    K -= L[a]
    
print(a)

Problem: p03721
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K = map(int,input().split())
lst = [input().split() for _ in range(N)]


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

i = 0
sm = 0
for i in range(N):
    sm += int(lst[i][1])
    if sm >= K:
        print(lst[i][0])
        break

Failing test case input:
3 5
2 2
1 1
15 3

Expected output:
15


Actual output:
2


Fixed submission (verdict: Accepted):
N,K = map(int,input().split())
lst = [list(map(int,input().split())) for _ in range(N)]


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


sm = 0
for x in lst:
    sm += x[1]
    
    if sm >= K:
        print(x[0])
        break
Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import sys


def solve(N: int, K: int, a: "List[int]", b: "List[int]"):
    ans = []
    for i in range(N):
        ans += [a[i]] * b[i]

    print(ans[K-1])
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    K = int(next(tokens))  
    a = [int()] * (N)  
    b = [int()] * (N)  
    for i in range(N):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    solve(N, K, a, b)

if __name__ == '__main__':
    main()


Failing test case input:
3 3
2 2
1 1
8 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):

import sys


def solve(N: int, K: int, a: "List[int]", b: "List[int]"):
    ab = sorted([[a[i],b[i]] for i in range(N)], key=lambda x:x[0])
    nt = -1
    for ia,ib in ab:
        nt += ib
        if(nt >= K-1):
            print(ia)
            exit()
        
    print(ab[-1][0])


        



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    K = int(next(tokens))  
    a = [int()] * (N)  
    b = [int()] * (N)  
    for i in range(N):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    solve(N, K, a, b)

if __name__ == '__main__':
    main()

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k = map(int,input().split())
li = [list(map(int, input().split())) for i in range(n)]
li.sort

cnt=0
for i in range(n):
  cnt+=li[i][1]
  if cnt>=k:
    print(li[i][0])
    break

Failing test case input:
3 4
2 2
4 5
3 2

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
arr = [list(map(int, input().split())) for i in range(N)]
arr.sort()
 
n = 0
for i in range(N):
	n += arr[i][1]
	if n >= K:
		print(arr[i][0])
		break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
f = lambda: list(map(int,input().split()))
f_ = lambda: [int(x)-1 for x in input().split()]

n,k = f()
count = 0
ans = 0
for _ in range(n):
    a,b = f()
    count += b
    if count >= k and not ans:
        ans = a
print(ans)

Failing test case input:
3 4
1 1
4 1
3 2

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
f = lambda: list(map(int,input().split()))
f_ = lambda: [int(x)-1 for x in input().split()]

n,k = f()
d = []
for _ in range(n):
    a,b = f()
    d.append((a,b))
d.sort(key=lambda x: x[0])
count = 0
for x,y in d:
    count += y
    if count >= k:
        break
print(x)
Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
f=lambda:map(int,input().split())
n,k=f()
c=0
for i in range(n):
  a,b=f(); c+=b
  if c>=k: print(a); break

Failing test case input:
3 4
1 1
4 1
3 2

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
f=lambda:map(int,input().split())
n,k=f()
d={}
for i in range(n):
  a,b=f()
  d[a]=d.get(a,0)+b
c=0
for a,b in sorted(d.items()):
  c+=b
  if c>=k: print(a); break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())


input_dict = {}

for _ in range(N):
    a, b = map(int, input().split())
    if a in input_dict:
        input_dict[a] += b
    else:
        input_dict[a] = b

input_dict = sorted(input_dict.items(), key=lambda x:x[0])

print(input_dict)


Failing test case input:
3 4
1 1
2 3
3 2

Expected output:
2


Actual output:
[(1, 1), (2, 3), (3, 2)]


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())


input_dict = {}

for _ in range(N):
    a, b = map(int, input().split())
    if a in input_dict:
        input_dict[a] += b
    else:
        input_dict[a] = b

input_dict = sorted(input_dict.items(), key=lambda x:x[0])

for i in range(len(input_dict)):
    K -= input_dict[i][1]
    if K <= 0:
        print(input_dict[i][0])
        break

Problem: p03721
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,K=map(int,input().split())
num=[list(map(int,input().split())) for _ in range(N)]
for i in range(N):
  K -= num[i][1]
  if K <= 0:
    print(num[i][0])
    exit()

Failing test case input:
3 3
2 2
1 1
4 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
N,K=map(int,input().split())
num = [0]*(int(1e5)+1)
for _ in range(N):
  a,b=map(int,input().split())
  num[a] += b
for i in range(int(1e5)+1):
  K -= num[i]
  if K <= 0:
    print(i)
    break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split())
c=[]
s=[0]
for i in range(n):
    a,b=map(int,input().split())
    c.append(a)
    s.append(s[i]+b)
ans=0
for i in range(1,n+1):
    if s[i]>=k:
        ans+=i-1
        break
print(c[ans])

Failing test case input:
3 3
2 2
1 1
5 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
c=[0]*(10**5+1)
for i in range(n):
    a,b=map(int,input().split())
    c[a]+=b
tmp=0
for i in range(10**5+1):
    tmp+=c[i]
    if tmp>=k:
        print(i)
        break
Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int,input().split())
dcic = {}
aa = set([])
for i in range(n):
    a,b = map(int,input().split())
    aa.add(a)
    if a in dcic:
        dcic[a] = dcic[a] + b
    else:
        dcic.update({a:b})
        
bb = list(sorted(list(aa)))
cc = 0
ccc = 0
for i in range(len(bb)):
    if k - dcic[bb[i]] > -1:
        k = k - dcic[bb[i]]
        cc = bb[i]
    else:
        ccc = bb[i]
        
print(cc)

Failing test case input:
3 4
1 1
2 2
3 3

Expected output:
3

Actual output:
2


Fixed submission (verdict: Accepted):
n, k = map(int,input().split())
dcic = {}
aa = set([])
for i in range(n):
    a,b = map(int,input().split())
    aa.add(a)
    if a in dcic:
        dcic[a] = dcic[a] + b
    else:
        dcic.update({a:b})
        
bb = list(sorted(list(aa)))
cc = 0
s = 0
for i in range(len(bb)):
    if s < k:
        s = s + dcic[bb[i]]
        cc = bb[i]
    else:
        ccc = bb[i]
print(cc)

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def c():
    n, k = map(int, input().split())
    U = []
    for i in range(n):
        U.append(tuple(map(int, input().split())))
    sorted(U, key=lambda i: i[0])
    
    for i in U:
        k -= i[1]
        
        if k <= 0:
            print(i[0])
            break

c()

Failing test case input:
3 4
2 2
4 5
3 2

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
def c():
    n, k = map(int, input().split())
    U = []
    for i in range(n):
        U.append(tuple(map(int, input().split())))
    U = sorted(U, key=lambda i: i[0])
    
    for i in U:
        if k <= i[1]:
            print(i[0])
            break
        k -= i[1]
    else:
        print(U[-1][0])
        
        
        
        

c()

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())

counter = 0
for i in range(n):
  a, b = map(int, input().split())
  counter += b
  if counter >= k:
    print(a)
    break

Failing test case input:
3 4
1 0
8 2
3 3

Expected output:
8


Actual output:
3


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
lst = [list(map(int, input().split())) for i in range(n)]
lst.sort()

counter = 0
for i in range(n):
  counter += lst[i][1]
  if counter >= k:
    print(lst[i][0])
    break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = []
b = []
n, k = map(int, input().split())
for j in range(0, n):
    x, y = map(int, input().split())
    a.append(x)
    b.append(y)

i = 0
for j in range(0, n):
    i += b[j]
    if i >= k:
        print(a[j])
        break


Failing test case input:
3 3
2 2
1 1
3 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
m = {}
n, k = map(int, input().split())
for j in range(0, n):
    a, b = map(int, input().split())
    m[a] = (m[a] if a in m else 0) + b

i = 0
for a, b in sorted(m.items()):
    i += b
    if i >= k:
        print(a)
        break
Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
length = 0


for _ in range(N):
    ai, bi = map(int, input().split())
    length += bi
    if length >= K:
        ans = ai
        print(ans)
        exit()


Failing test case input:
3 3
2 2
1 1
5 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
lst_ab = sorted([tuple(map(int, input().split())) for _ in range(N)])
length = 0


for i in range(N):
    ai, bi = lst_ab[i][0], lst_ab[i][1]
    length += bi
    if length >= K:
        ans = ai
        print(ans)
        break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
sumb = 0
for i in range(N):
    a, b = map(int, input().split())
    sumb += b
    if sumb >= K:
        print(a)
        break


Failing test case input:
3 0
2 2
0 0
3 6

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
sumb = 0
ab = []
for i in range(N):
    ab.append(list(map(int, input().split())))
ab.sort()
for i in ab:
    a = i[0]
    b = i[1]
    sumb += b
    if sumb >= K:
        print(a)
        break

Problem: p03721
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def examC():
    N, K = LI()
    d = defaultdict(int)
    element = []
    for _ in range(N):
        a, b = LI()
        d[a] += b
        element.append(a)
    element.sort()
    for i in element:
        K -= d[i]
        if K<=0:
            ans = i
            break
    print(ans)

import sys
import copy
import bisect
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()


Failing test case input:
10 878093
1 100000
1 100001
1 100000
1 101001
1 100000
100000 100000
100000 100000
100000 100100
100000 100000
100000 100000

Expected output:
100000


Actual output:
1


Fixed submission (verdict: Accepted):
def examC():
    N, K = LI()
    d = defaultdict(int)
    element = set()
    for _ in range(N):
        a, b = LI()
        d[a] += b
        element.add(a)
    element = list(element)
    element.sort()
    for i in element:
        K -= d[i]
        if K<=0:
            ans = i
            break
    print(ans)


import sys
import copy
import bisect
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()
Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(n)]
tmp=0
for a,b in ab:
  tmp+=b
  if tmp>=k:
    print(a) 
    exit()


Failing test case input:
3 0
2 2
0 0
3 6

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(n)]
ab.sort(key=lambda x: x[0])
tmp=0
for a,b in ab:
  tmp+=b
  if tmp>=k:
    print(a) 
    exit()

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())

for _ in range(n):
    a, b = map(int, input().split())
    if k > b:
        k -= b
    else:
        print(a)
        break

Failing test case input:
3 4
2 2
4 5
3 2

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
ab = sorted([list(map(int, input().split())) for _ in range(n)])

count = 0
for x in ab:
    count += x[1]
    if k <= count:
        print(x[0])
        break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k = map(int,input().split())
l = [list(map(int,input().split())) for i in range(n)]
l.sort()
count = 0
for i,j in l:
  if j < count:
    count += j
  else:
    print(i)
    exit()

Failing test case input:
10 878093
1 100000
1 110001
1 100000
1 101001
1 100000
100000 100000
100000 100000
100000 100100
100000 100000
100000 100000

Expected output:
100000


Actual output:
1


Fixed submission (verdict: Accepted):
n,k = map(int,input().split())
l = [list(map(int,input().split())) for i in range(n)]
l.sort()
count = 0
for i,j in l:
  if j < k:
    k -= j
  else:
    print(i)
    exit()

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
length = 0


for _ in range(N):
    ai, bi = map(int, input().split())
    length += bi
    if length > K:
        ans = ai
        print(ans)
        break


Failing test case input:
3 3
2 2
1 1
3 3

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
lst_ab = sorted([tuple(map(int, input().split())) for _ in range(N)])
length = 0


for i in range(N):
    ai, bi = lst_ab[i][0], lst_ab[i][1]
    length += bi
    if length >= K:
        ans = ai
        print(ans)
        break

Problem: p03721
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k=map(int,input().split())
d={}
for _ in range(n):
    a,b=map(int,input().split())
    if a in d:
        d[a]+=b
    else:
        d[a]=b
s=0
for i in d:
    s+=d[i]
    if s>=k:
        print(i)
        exit()


Failing test case input:
3 3
2 2
1 1
4 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
d={}
for _ in range(n):
    a,b=map(int,input().split())
    if a in d:
        d[a]+=b
    else:
        d[a]=b
s=0
for i in sorted(d):
    s+=d[i]
    if s>=k:
        print(i)
        exit()
Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
ans = 0
for i in range(N):
    a, b = map(int, input().split())
    ans += b
    if K <= ans:
        print(a)
        break

Failing test case input:
3 3
2 2
1 1
8 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
ans = 0
memory = [0]*(10**5+1)

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

for i in range(10**5+1):
    ans += memory[i]
    if ans >= K:
        print(i)
        break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())

ab = [list(map(int, input().split())) for _ in range(N)]

array_num = 0
for x, y in ab:
    array_num += y
    if array_num >= K:
        print(x)
        break


Failing test case input:
3 4
1 0
8 2
3 3

Expected output:
8


Actual output:
3


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())

ab = [list(map(int, input().split())) for _ in range(N)]
ab.sort()
array_num = 0
for x, y in ab:
    array_num += y
    if array_num >= K:
        print(x)
        break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k = map(int,input().split())
a = []
b = []
for i in range(n):
    tmp1,tmp2 = map(int,input().split())
    a.append(tmp1)
    b.append(tmp2)
counter = k-1
for i in range(n):
    counter = counter - b[i]
    if counter <= 0:
        print(a[i])
        break

Failing test case input:
3 4
2 2
4 5
3 2

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
n,k = map(int,input().split())
a = []
b = []
for i in range(n):
    tmp1,tmp2 = map(int,input().split())
    a.append(tmp1)
    b.append(tmp2)
ab =zip(a,b)
ab =sorted(ab)
a,b = zip(*ab)
counter = k
for i in range(n):
    counter -=b[i]
    if counter <= 0:
        print(a[i])
        break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())
cnt = 0
for i in range(n):
    a, b = map(int, input().split())
    cnt += b
    if cnt >= k:
        print(a)
        break

Failing test case input:
3 0
2 2
0 0
3 6

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
A = sorted([[int(i) for i in input().split()] for i in range(n)])
cnt = 0
for i in range(n):
    cnt += A[i][1]
    if cnt >= k:
        print(A[i][0])
        break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = []
b = []
res = 0
flag = False
n,k = map(int,input().split())
for i in range(n):
	aa,bb = map(int,input().split())
	a.append(aa)
	b.append(bb)

for j in range(n):
	res = res + b[j]
	if res >= k:
		print(a[j])
		flag = True
	if flag == True:
		break

Failing test case input:
3 3
2 2
1 1
3 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
res = 0
flag = False
n,k = map(int,input().split())
ab = []
for i in range(n):
	aa,bb = map(int,input().split())
	ab.append([aa,bb])

ab.sort()

for j in range(0,n):
	res = res + ab[j][1]
	if res >= k:
		print(ab[j][0])
		flag = True
	if flag == True:
		break
Problem: p03721
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N, K = map(int, input().split())
lst = [list(map(int, input().split())) for i in range(N)]
sorted_lst = sorted(lst, key=lambda x: x[1])
cnt = 0
for i in lst:
  cnt += i[1]
  if (cnt >= K):
    print(i[0])
    break

Failing test case input:
3 3
2 2
1 1
4 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
lst = [list(map(int, input().split())) for i in range(N)]
sorted_lst = sorted(lst, key=lambda x: x[0])
cnt = 0
for i in sorted_lst:
  cnt += i[1]
  if (cnt >= K):
    print(i[0])
    break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

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

num = [0 for _ in range(100000 + 1)]

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

count = 0
for i, j in enumerate(num):
    if count + j > k:
        print(i)
        break
    else:
        count += j
print(1)


Failing test case input:
3 5
2 2
4 1
8 5

Expected output:
8


Actual output:
8
1


Fixed submission (verdict: Accepted):

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

num = [0 for _ in range(100000 + 1)]

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

count = 0
for i, j in enumerate(num):
    if count + j >= k:
        print(i)
        break
    else:
        count += j

Problem: p03721
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,k=map(int,input().split())
ab=[]
for i in  range(n):
    a,b=map(int,input().split())
    ab.append([a,b])
ab.sort()
c=0
for i in range(n):
    c+=ab[i][1]
    if c>k:
        print(ab[i][0])
        exit()


Failing test case input:
3 4
1 0
2 1
3 3

Expected output:
3


Actual output:

Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
ab=[]
for i in  range(n):
    a,b=map(int,input().split())
    ab.append([a,b])
ab.sort()
c=0
for i in range(n):
    c+=ab[i][1]
    if c>=k:
        print(ab[i][0])
        exit()

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N, K = map(int, input().split())

list_ab = []

for _ in range(N):
    
    a, b = map(int, input().split())
    
    list_ab.append((a, b))

sum_b = 0

for a, b in list_ab:
    
    sum_b += b
    
    if sum_b >= K:
        
        print(a)

Failing test case input:
3 2
1 1
3 1
3 3

Expected output:
3


Actual output:
3
3


Fixed submission (verdict: Accepted):

N, K = map(int, input().split())

list_ab = []

for _ in range(N):
    
    a, b = map(int, input().split())
    
    list_ab.append((a, b))

list_ab.sort()

sum_b = 0

for a, b in list_ab:
    
    sum_b += b
    
    if sum_b >= K:
        
        print(a)
        break
Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K = list(map(int,input().split()))
ab = [list(map(int,input().split())) for i in range(N)]

ab.sort()
count = 0
for i in range(N):
    count+=ab[i][1]
    if count >= K:
        print(ab[i][0])

Failing test case input:
3 1
1 1
3 1
3 0

Expected output:
1


Actual output:
1
3
3


Fixed submission (verdict: Accepted):
N,K = list(map(int,input().split()))
ab = [list(map(int,input().split())) for i in range(N)]

ab.sort()
count = 0
for i in range(N):
    count+=ab[i][1]
    if count >= K:
        print(ab[i][0])
        exit()

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
ma = lambda:map(int,input().split())
n,k = ma()
ab = []
for i in range(n):
    ab.append((list(ma())))
ab.sort()
c  = 0
for a,b in ab:
    c+=b
    if c>=k:print(a)


Failing test case input:
3 3
2 2
1 1
4 3

Expected output:
2


Actual output:
2
4


Fixed submission (verdict: Accepted):
ma = lambda:map(int,input().split())
n,k = ma()
ab = []
for i in range(n):
    ab.append((list(ma())))
ab.sort()
c  = 0
for a,b in ab:
    c+=b
    if c>=k:
        print(a)
        break

Problem: p03721
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from collections import Counter
n, k = map(int, input().split())

c = Counter()
for _ in range(n):
    a, b = map(int, input().split())
    c[a] += b

for i, v in c.items():
    k -= v
    if k <= 0:
        print(i)
        exit()

Failing test case input:
3 3
2 2
1 1
3 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
from collections import Counter
n, k = map(int, input().split())

c = Counter()
for _ in range(n):
    a, b = map(int, input().split())
    c[a] += b
c = sorted(c.items(), key=lambda x: x[0])

for i, v in c:
    k -= v
    if k <= 0:
        print(i)
        exit()

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())

ab = [list(map(int, input().split())) for x in range(n)]

maxval = -1
for a, b in ab:
    if maxval < a:
        maxval = a
    
    k -= b
    if k <= 0:
        break

print(a)


Failing test case input:
3 3
2 2
1 1
3 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())

ab = [list(map(int, input().split())) for x in range(n)]

ends = [0 for x in range(10**5 + 1)]
for a, b in ab:
    ends[a] += b

for i, e in enumerate(ends):
    k -= e
    if k <= 0:
        print(i)
        break
Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,K=map(int,input().split())
A=[]
C=[]
for i in range(N):
    a,b=map(int,input().split())
    T=[a,b]
    A.append(T)
A.sort()
counter=0
for i in range(N):
     counter+=A[i][1]
     if counter>=K:
         s=counter
         counter=i
         break
else:    
   print(A[counter][0])

Failing test case input:
10 500000
1 100000
1 110000
1 100000
1 101000
1 100100
100000 100000
100000 100010
100000 100000
000000 100110
100000 100000

Expected output:
1


Actual output:

Fixed submission (verdict: Accepted):
N,K=map(int,input().split())
A=[]
C=[]
for i in range(N):
    a,b=map(int,input().split())
    T=[a,b]
    A.append(T)
A.sort()
counter=0
for i in range(N):
     counter+=A[i][1]
     if counter>=K:
         counter=i
         break   
print(A[counter][0])

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import bisect
n, k = map(int, input().split())
L = []
S = [0]
for _ in range(n):
  a, b = map(int, input().split())
  L.append(a)
  S.append(S[-1]+b)
S = S[1:]
t = bisect.bisect_left(S, k)
print(L[t])

Failing test case input:
3 0
2 2
0 0
3 6

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
import bisect
n, k = map(int, input().split())
M = sorted([ list(map(int, input().split())) for _ in range(n) ])
L = []
S = [0]
for a, b in M:
  L.append(a)
  S.append(S[-1]+b)
S = S[1:]
t = bisect.bisect_left(S, k)
print(L[t])

Problem: p03721
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys
input = sys.stdin.readline

def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

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

from collections import defaultdict


N,K = two_int()

query = []
for i in range(N):
    query.append(two_int() )

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

ans=0
sums=0
for i in range(len(query)-1):
    if sums <= K < sums+query[i+1][1]:
        ans=query[i+1][0]
        break
    sums += query[i+1][1]

print(ans)

Failing test case input:
10 500000
1 110000
1 100000
1 100000
1 100000
1 100000
100000 100000
100000 100000
100000 100000
100000 100000
100000 100000

Expected output:
1


Actual output:
100000


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline

def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

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

from collections import defaultdict


N,K = two_int()


query = []
for i in range(N):
    query.append(two_int() )

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

ans=0
sums=0
for q in query:
    if sums < K <= sums+q[1]:
        ans=q[0]
        break
    
    sums += q[1]

print(ans)
Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


















import collections
import math


N,K = map(int,input().split())
A, B = [], []
for _ in range(N):
  a,b = map(int,input().split())
  A.append(a)
  if len(B) != 0:
    B.append(b+B[-1])
  else:
    B.append(b)

for a, b in zip(A, B):
  if K<=b:
    print(a)
    break

Failing test case input:
3 3
2 2
1 1
3 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):


















import collections
import math


N,K = map(int,input().split())
AA = []
for _ in range(N):
  a,b = map(int,input().split())
  AA.append([a, b])

AA = sorted(AA)
s = 0
for a, b in AA:
  s += b
  if K<=s:
    print(a)
    break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def getN():
    return int(input())


def getNM():
    return map(int, input().split())


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

n,k = getNM()

for i in range(n):
    a,b = getNM()
    k -= b
    if k <= 0:
        print(a)
        break


Failing test case input:
3 3
2 2
1 1
5 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
def getN():
    return int(input())


def getNM():
    return map(int, input().split())


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

n,k = getNM()
nums = []
for i in range(n):
    a,b = getNM()
    nums.append((a,b))

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

for n in nums:
    a,b = n
    k-=b
    if k <= 0:
        print(a)
        break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(n)]

cnt = 0
for a, b in ab:
    cnt += b
    if cnt >= k:
        print(a)
        exit()


Failing test case input:
3 4
1 0
8 2
3 3

Expected output:
8


Actual output:
3


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())
ab = sorted([list(map(int, input().split())) for i in range(n)])

cnt = 0
for a, b in ab:
    cnt += b
    if cnt >= k:
        print(a)
        exit()

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):



N, K = map(int, input().split())
li = [list(map(int, input().split())) for i in range(N)]
total = 0

for i in range(N):
    total += li[i][1]
    if total >= K:
        print(li[i][0])
        exit()

Failing test case input:
3 3
2 2
1 1
4 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):



N, K = map(int, input().split())
li = sorted([list(map(int, input().split())) for i in range(N)])
total = 0

for i in range(N):
    total += li[i][1]
    if total >= K:
        print(li[i][0])
        exit()
Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split())
a=[[int(i) for i in input().split()] for i in range(n)]
b=[]
x=0
for i in a:
    x+=i[1]
    b.append([i[0],x])
for i in range(len(b)-1):
    if b[i][1]<k<=b[i+1][1]:
        print(b[i+1][0])

Failing test case input:
3 3
1 3
1 0
3 2

Expected output:
1


Actual output:

Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
a=[[int(i) for i in input().split()] for i in range(n)]
b=[0]*((10**5)+1)
for i in a:
    b[i[0]]+=i[1]
x=0
for i in range(10**5+1):
    x+=b[i]
    if x>=k:
        print(i)
        exit()

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

x={}
n,k=map(int,input().split())
for i in range(n):
    a,b=map(int,input().split())
    if a in x:
        x[a]+=b
    else:
        x[a]=b
x=sorted(x.items(),key=lambda x:x[0])
a=0
for i in x:
    a+=i[1]
    print(i)
    if(a>=k):
        print(i[0])
        break;

Failing test case input:
10 878093
1 100000
1 110001
1 100000
1 100001
1 100000
100000 100000
100000 100000
100000 100000
100000 100000
100000 100000

Expected output:
100000


Actual output:
(1, 510002)
(100000, 500000)
100000


Fixed submission (verdict: Accepted):

x={}
n,k=map(int,input().split())
for i in range(n):
    a,b=map(int,input().split())
    if a in x:
        x[a]+=b
    else:
        x[a]=b
x=sorted(x.items(),key=lambda x:x[0])
a=0
for i in x:
    a+=i[1]
    if(a>=k):
        print(i[0])
        break;

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int,input().split())
A = [list(map(int,input().split())) for k in range(N)]

while True:
    for a in A:
        K -= a[1]
        if K <= 0:
            print(a[0])
            exit(0)

Failing test case input:
3 0
2 2
0 0
3 6

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
N, K = map(int,input().split())
A = sorted([list(map(int,input().split())) for k in range(N)])

for a in A:
    K -= a[1]
    if K <= 0:
        print(a[0])
        exit(0)

Problem: p03721
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,k=map(int,input().split())
a=[]
for _ in range(n):
  x,y=map(int,input().split())
  d=[x,y]
  a.append(d)
  
a.sort()
ans=0
ans1=0

for d in a:
  if (ans+d[1])>k:
    ans1=d[0]
    break
    
  else:
    ans+=d[1]
    
print(ans1)


Failing test case input:
3 4
1 1
5 2
3 3

Expected output:
3


Actual output:
5


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
a=[]
for _ in range(n):
  x,y=map(int,input().split())
  d=[x,y]
  a.append(d)
  
a.sort()
ans=0
ans1=0

for d in a:
  if (ans+d[1])>=k:
    ans1=d[0]
    break
    
  else:
    ans+=d[1]
    
print(ans1)
Problem: p03721
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
if __name__ == '__main__':
    N,K=list(map(int,input().split()))
    AB=[tuple(map(int,input().split())) for i in range(N)]
    for a,b in AB:
        K-=b
        if K<=0:
            print(a)
            break


Failing test case input:
3 3
2 2
1 1
3 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
if __name__ == '__main__':
    N,K=list(map(int,input().split()))
    AB=[tuple(map(int,input().split())) for i in range(N)]
    AB.sort(key=lambda x:x[0])
    for a,b in AB:
        K-=b
        if K<=0:
            print(a)
            break

Problem: p03721
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import collections
[n,k] = [int(i) for i in input().split()]
dic = collections.defaultdict(int)
for i in range(n):
  [a,b] = [int(j) for j in input().split()]
  dic[a] += b
keys = sorted(list(dic.keys()))
tmp = -1
for key in keys:
  tmp += dic[key]
  if k < tmp:
    print(key)
    break
  


Failing test case input:
3 3
1 3
1 0
3 2

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
import collections
[n,k] = [int(i) for i in input().split()]
dic = collections.defaultdict(int)
for i in range(n):
  [a,b] = [int(j) for j in input().split()]
  dic[a] += b
keys = sorted(list(dic.keys()))
tmp = 0
for key in keys:
  tmp += dic[key]
  if k <= tmp:
    print(key)
    break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k = map(int,input().split())
a = [input().split() for i in range(n)]
a.sort()
ans = 0
remain = k
for j in a:
    remain -= int(j[1])
    if remain <= 0:
        ans = int(j[0])
        break
print(ans)

Failing test case input:
3 5
2 2
1 1
15 3

Expected output:
15


Actual output:
2


Fixed submission (verdict: Accepted):
n,k = map(int,input().split())
a = []
for i in range(n):
    m,o = map(int,input().split())
    a.append([m,o])
a.sort()
ans = 0
remain = k
for j in a:
    remain -= j[1]
    if remain <= 0:
        ans = j[0]
        break
print(ans)

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N, K = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
now = 0
ans = ""
for a, b in ab:
    for i in range(b):
        now += 1
        if now == K:
            print(a)
            break

Failing test case input:
3 4
1 0
8 2
3 3

Expected output:
8


Actual output:
3


Fixed submission (verdict: Accepted):

import sys
N, K = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
now = 0
ab.sort()
for a, b in ab:
    now += b
    if now >= K:
            print(a)
            sys.exit()
Problem: p03721
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import deque
N, K = map(int, input().split())
A, B = deque([]), deque([])
for _ in range(N):
  a, b = map(int, input().split())
  A.append(a)
  B.append(b)
while K>B[0]:
  K -= B.popleft()
  A.popleft()
print(A[0])

Failing test case input:
3 3
2 2
1 1
4 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
from collections import deque
N, K = map(int, input().split())
L = [list(map(int, input().split())) for _ in range(N)]
L.sort(key = lambda x: x[0])
L = deque(L)
while K>L[0][1]:
  K -= L[0][1]
  L.popleft()
print(L[0][0])

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import defaultdict

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


dd = defaultdict(int)

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

cnt = 0
for key, v in dd.items():
    cnt += v
    if k <= cnt:
        print(key)
        break

Failing test case input:
3 3
2 2
1 1
8 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
from collections import defaultdict

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


dd = defaultdict(int)

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

cnt = 0
for key, v in sorted(dd.items()):
    cnt += v
    if k <= cnt:
        print(key)
        break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


N,K=map(int,input().split())

B=0
for i in range(N):
    a,b=map(int,input().split())
    B+=b
    if B>=K:
        print(a)
        exit()


Failing test case input:
3 3
2 2
1 1
3 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):



N,K=map(int,input().split())
l=[0]*(10**5+1)

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

all=0
for index,item in enumerate(l):
    all+=item
    if all>=K:
        print(index)
        exit()

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N , K = map(int,(input().split()))
 
sums = 0
nums = [0] * (10 ** 5 + 1) 
con = 0
ans = 0
 
for i in range(N):
  a,b = map(int,(input().split()))
  nums[a] += a * b
  
for i in range(len(nums)):
  con += nums[i]
  if K > con:
    continue
  elif K <= con:
    ans = i
    break

    
print(ans)

Failing test case input:
2 4
2 2
4 5
3 2

Expected output:
4


Actual output:
2


Fixed submission (verdict: Accepted):
N , K = map(int,(input().split()))
 
sums = 0
nums = [0] * (10 ** 5 + 1) 
con = 0
ans = 0
 
for i in range(N):
  a,b = map(int,(input().split()))
  nums[a] += b
  
for i in range(len(nums)):
  con += nums[i]
  if K > con:
    continue
  elif K <= con:
    ans = i
    break

    
print(ans)
Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, k = map(int, input().split())

array = {}
for i in range(n):
    a, b = map(int, input().split())
    if a in array:
        array[a] += b
    else:
        array[a] = b

cnt = 0
for n, t in array.items():
    cnt += t
    if cnt >= k:
        print(n)
        break


Failing test case input:
3 3
2 2
1 1
4 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
n, k = map(int, input().split())

dict_num = {}
for i in range(n):
    a, b = map(int, input().split())
    if a in dict_num:
        dict_num[a] += b
    else:
        dict_num[a] = b

array = []
for n, t in dict_num.items():
    array.append([n, t])

array.sort()

cnt = 0
for a in array:
    cnt += a[1]
    if cnt >= k:
        print(a[0])
        break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
a_b = [list(input().split()) for i in range(N)]
a_b.sort()
index = 0

for i in range(N):
    index += int(a_b[i][1])
    if index >= K:
        print(a_b[i][0])
        break

Failing test case input:
3 5
2 2
1 1
15 3

Expected output:
15


Actual output:
2


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
a_b = [list(map(int, input().split())) for i in range(N)]
a_b.sort()
index = 0

for i in range(N):
    index += a_b[i][1]
    if index >= K:
        print(a_b[i][0])
        exit()

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = [int(v) for v in input().split()]
ab = []
for i in range(N):
    ab.append([int(v) for v in input().split()])

b_sum = 0
for a, b in ab:
    b_sum += b
    if b_sum >= K:
        print(a)
        break

Failing test case input:
3 3
2 2
1 1
3 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
N, K = [int(v) for v in input().split()]
ab = []
for i in range(N):
    ab.append([int(v) for v in input().split()])

ab.sort()

b_sum = 0
for a, b in ab:
    b_sum += b
    if b_sum >= K:
        print(a)
        break

Problem: p03721
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,k = map(int,readline().split())

b = [] 
a = [] 

for i in range(n):
    a2,b2 = map(int,readline().split())
    b.append(b2)
    a.append(a2)

for i in range(1,n):
    b[i] += b[i-1]

for i in range(n):
    if b[i] >= k:
        print(a[i])
        exit()




Failing test case input:
3 0
2 2
0 0
3 6

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,k = map(int,readline().split())

b = [] 
a = [] 

lst1 = [list(map(int,readline().split())) for i in range(n)]
lst1.sort()
for i,j in lst1:
    b.append(j)
    a.append(i)

for i in range(1,n):
    b[i] += b[i-1]

for i in range(n):
    if b[i] >= k:
        print(a[i])
        exit()
Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
tmp0 = input().split()
n = int(tmp0[0])
k = int(tmp0[1])
a = []
b = []
for i in range(n):
    tmp = input().split()
    a.append(int(tmp[0]))
    b.append(int(tmp[1]))

arr = []
for i in range(n):
    for j in range(b[i]):
        arr.append(a[i])
    if len(arr) >= k:
        break

print(arr[-1])


Failing test case input:
3 0
2 2
0 0
3 6

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
tmp0 = input().split()
n = int(tmp0[0])
k = int(tmp0[1])
a = []
b = []
for i in range(n):
    tmp = input().split()
    a.append(int(tmp[0]))
    b.append(int(tmp[1]))

arr = [0]*(10**5 + 1)
for i in range(n):
    arr[a[i]] += b[i]

count = 0
for i in range(10**5 + 1):
    count += arr[i]
    if count >= k:
        print(i)
        break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split())
s=[[int(i) for i in input().split()] for l in range(n)]
c=0
for x in s:
    c+=x[1]
    if c>=k:
        print(x[0])
        break

Failing test case input:
3 3
2 2
1 1
4 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
s=sorted([[int(i) for i in input().split()] for l in range(n)])
c=0
for x in s:
    c+=x[1]
    if c>=k:
        print(x[0])
        break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k = map(int,input().split())

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

    if k > b:
        k -= b
    elif f == 0:
        c = a
        f = 1

print(c)


Failing test case input:
3 4
1 0
8 2
3 3

Expected output:
8


Actual output:
3


Fixed submission (verdict: Accepted):
n,k = map(int,input().split())

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


li.sort()
for i in range(n):
    a,b = li[i]
    
    if k > b:
        k -= b
    else:
        print(a)
        exit()

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def c():
    n, k = map(int, input().split())
    U = []
    for i in range(n):
        U.append(tuple(map(int, input().split())))
    sorted(U, key=lambda i: i[0])
    
    for i in U:
        if k <= 0:
            print(i[0])
            break
        k -= i[1]
        

c()

Failing test case input:
3 5
2 2
1 1
15 3

Expected output:
15


Actual output:

Fixed submission (verdict: Accepted):
def c():
    n, k = map(int, input().split())
    U = []
    for i in range(n):
        U.append(tuple(map(int, input().split())))
    U = sorted(U, key=lambda i: i[0])
    
    for i in U:
        if k <= i[1]:
            print(i[0])
            break
        k -= i[1]
    else:
        print(U[-1][0])
        
        
        
        

c()
Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):



n,k = map(int,input().split())
li = []

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

a.sort()

cnt = 0

for i in range(n):
    cnt += li[i][1]

    if cnt >= k:
        print(li[i][0])
        break



Failing test case input:
3 5
2 2
4 1
8 5

Expected output:
8


Actual output:
5


Fixed submission (verdict: Accepted):



n,k = map(int,input().split())
li = []

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

li.sort()

cnt = 0

for i in range(n):
    cnt += li[i][1]

    if cnt >= k:
        print(li[i][0])
        break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, K = map(int, input().split())
a_b = []
for i in range(N):
    a, b = map(int, input().split())
    a_b.append((a, b))

a_b.sort(key=lambda x: x[0])
print(a_b)
tmp = 0
for a, b in a_b:
    tmp += b
    if tmp >= K:
        print(a)
        break

Failing test case input:
3 4
1 1
2 3
3 2

Expected output:
2


Actual output:
[(1, 1), (2, 3), (3, 2)]
2


Fixed submission (verdict: Accepted):
N, K = map(int, input().split())
a_b = []
for i in range(N):
    a, b = map(int, input().split())
    a_b.append((a, b))

a_b.sort(key=lambda x: x[0])
tmp = 0
for a, b in a_b:
    tmp += b
    if tmp >= K:
        print(a)
        break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = input().strip().split()
N, M = [int(N), int(M)]


ab = sorted(list(map(int, input().split())) for _ in range(N))
c=0
for a,b in ab:
    c+=b
    if c>=M:
        print(a)

Failing test case input:
3 3
1 2
1 1
3 4

Expected output:
1


Actual output:
1
3


Fixed submission (verdict: Accepted):
N, M = input().strip().split()
N, M = [int(N), int(M)]


ab = sorted(list(map(int, input().split())) for _ in range(N))
c=0
for a,b in ab:
    c+=b
    if c>=M:
        print(a)
        break

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k=map(int,input().split())
A=[list(map(int,input().split())) for i in range(n)]
i=-1
count=0
ans=0
while count<k:
  i+=1
  ans=A[i][0]
  count+=A[i][1]
print(ans)

Failing test case input:
3 3
2 2
1 1
8 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
n,k=map(int,input().split())
A=[list(map(int,input().split())) for i in range(n)]
A.sort()
i=-1
count=0
ans=0
while count<k:
  i+=1
  ans=A[i][0]
  count+=A[i][1]
print(ans)

Problem: p03721
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,k = map(int,input().split())
A = [0]*n
B = [0]*n
for i in range(n):
  ta,tb = map(int,input().split())
  A[i] = ta
  B[i] = tb
  
count = k
for i in range(n):
  count -= B[i]
  if count <= 0:
    print(A[i])
    break

Failing test case input:
3 3
2 2
1 1
4 3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
n,k = map(int,input().split())

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

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

count = k
for i in range(n):
  count -= ab[i][1]
  if count <= 0:
    print(ab[i][0])
    break