Problem:


Score : 300 points

Problem Statement

There is an empty array.
The following N operations will be performed to insert integers into the array.
In the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array.
Find the K-th smallest integer in the array after the N operations.
For example, the 4-th smallest integer in the array \{1,2,2,3,3,3\} is 3.

Constraints

1≤N≤10^5 

1≤a_i,b_i≤10^5 

1≤K≤b_1…+…b_n

All input values are integers.

Input

Input is given from Standard Input in the following format:  

N K
a_1 b_1
:  
a_N b_N

Output

Print the K-th smallest integer in the array after the N operations.  

Sample Input 1

3 4
1 1
2 2
3 3

Sample Output 1

3

The resulting array is the same as the one in the problem statement.

Sample Input 2

10 500000
1 100000
1 100000
1 100000
1 100000
1 100000
100000 100000
100000 100000
100000 100000
100000 100000
100000 100000

Sample Output 2

1



Sample input:
3 4
1 1
2 2
3 3


Sample output:
3

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]

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

Submission status: Wrong Answer

Solution code:
ans=0
n,k=map(int,input().split())
for _ in range(n):
  a,b=map(int,input().split())
  k-=b
  if k<=0:
    ans=a
    
print(ans)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
for _ in range(n):
  a,b=map(int,input().split())
  k-=b
  if k<=0:
    ans=a
    
print(ans)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
ans=[]
for i in range(n):
  a,b=map(int,input().split())
  for _ in range(b):
    ans.append(a)

for j in range(k):
  if j==k-1:
    print(ans[j])

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
ans = -1
len_arr = 0
for i in range(n):
  a, b = map(int, input().split())
  if ans != -1: continue
  len_arr += b
  if len_arr >= k: ans = a
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

n,k=map(int,input().split())
for _ in range(n):
  a,b=map(int,input().split())
  k-=b
  if k<=0:
    print(a)
    sys.exit()

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
num = 0
num_l = [0]
a_l = []
for i in range(n):
  a, b = map(int, input().split())
  a_l.append(a)
  num += b
  num_l.append(num)
  if num_l[i] < k and num_l[i+1] >= k:
    print(a_l[i])

Submission status: Wrong Answer

Solution code:
n, k = (int(x) for x in input().split())
ab = []
for _ in range(n):
    a, b = (int(x) for x in input().split())
    ab.append([a, b])
ans= 0
for i,j in ab:
    ans+=j
    if k<=ans:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
# import bisect
# from collections import Counter, deque
# from copy import copy, deepcopy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
# from operator import xor
import sys

sys.setrecursionlimit(10 ** 5 + 10)


# input = sys.stdin.readline

def resolve():
    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

    cnt = 0
    for i in range(10 ** 5 + 1):
        if cnt >= K:
            print(i-1)
            break
        else:
            cnt += L[i]


resolve()

Submission status: Wrong Answer

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

    cnt = 0
    for i in range(10 ** 5 + 1):
        if L[i] >= K:
            print(i)
            break
        else:
            cnt += L[i]


resolve()

Submission status: Wrong Answer

Solution code:
def resolve():

    N,K=map(int,input().split())
    cnt = 0
    L=[0]*(10**5+1)
    A, B = [0] * N, [0] * N
    cnt=0
    for i in range(N):
        a, b = map(int, input().split())
        L[a]+=b
    from itertools import accumulate

    LL = list(accumulate(L))  # 累積和を格納したリスト作成

    # この問題は長さが1-Nの連続部分の和の最大値を出せというものなので以下の通り
    for i in range(1, N + 1):
        if LL[i]>=K:
            print(i)
            break

resolve()

Submission status: Wrong Answer

Solution code:
def resolve():

    N,K=map(int,input().split())
    cnt = 0
    L=[]
    A, B = [0] * N, [0] * N
    for i in range(N):
        A[i], B[i] = map(int, input().split())
        cnt += B[i]
        L.extend([A[i]]*B[i])
        if cnt >= K:
            print(sorted(L)[K-1])
            break



resolve()

Submission status: Wrong Answer

Solution code:
def resolve():

    N,K=map(int,input().split())
    A, B = [0] * N, [0] * N
    for i in range(N):
        A[i], B[i] = map(int, input().split())

    cnt=0
    for i in range(N):
        cnt+=B[i]
        if cnt>=K:
            print(A[i])
            break


resolve()

Submission status: Wrong Answer

Solution code:
import numpy as np

N,K = [int(i) for i in input().split()]

ab = np.ones([N,2])

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

ab_sort = ab[np.argsort(ab[:,0])]

cout = 0

for i in range(N):
    cout += ab_sort[i,1]
    if cout >= K:
        print(int(ab_sort[i,0]))

Submission status: Wrong Answer

Solution code:
import numpy as np

N,K = [int(i) for i in input().split()]

ab = np.ones([N,2])

ab_sort = ab[np.argsort(ab[:,0])]

cout = 0

for i in range(N):
    cout += ab_sort[i,1]
    if cout >= K:
        print(int(ab_sort[i,0]))

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
ans = 0
m = []

l = [list(map(int, input().split())) for i in range(n)]
for i in range(n):
    ans += l[i][1]
    m.append(ans)
for j in range(n - 1):
    if m[j] < k <= m[j + 1]:
        print(l[j + 1][0])
        exit()

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
l = []
for i in range(n):
    a, b = map(int, input().split())
    for j in range(b):
        l.append(a)
print(l[k - 1])

Submission status: Wrong Answer

Solution code:
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter, deque
#from scipy.misc import comb

N,K = map(int, input().split())
A = [list(map(int, input().split())) for i in range(N)]
A.sort()

cnt = 0
for a,b in A:
    cnt += b
    if cnt >= K:
        print(a)

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
s = [input().split() for l in range(N)]

ls = sorted(s)

sum = 0
for x in range(N):
  sum = sum + int(ls[x][1])
  if K <= sum:
    print(int(ls[x][0]))
    break

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
s = [input().split() for l in range(N)]

sum = 0
for x in range(N):
  sum = sum + int(s[x][1])
  if K <= sum:
    print(int(s[x][0]))
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
l=[0]*(10**5+1)
for _ in range(n):
  a,b=map(int,input().split())
  l[a]+=b
for i in range(n+1):
  k-=l[i]
  if k<=0:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
l=[0]*(10**5+1)
for _ in range(n):
  a,b=map(int,input().split())
  l[a]+=b
x=0
for i in range(n+1):
  x+=l[i]
  if x>=k:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
for _ in range(n):
    a, b = map(int, input().split())
    k -= b
    if k <= 0:
        ans = a
        break
print(ans)

Submission status: Wrong Answer

Solution code:
#061_C
n, k = map(int, input().split())
tmp = 0
for _ in range(n):
    a, b = map(int, input().split())
    tmp += b
    if k <= tmp:
        print(a)
        break

Submission status: Wrong Answer

Solution code:
# import sys
# import math
# import decimal
# import queue
# import bisect
# import heapq # priolity-queue
# import time
# import itertools
# import collections # queue
# from operator import itemgetter
# from fractions import Fraction

mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

def main():
    n,k = map(int,input().split())
    a = [0] * n
    b = [0] * n
    for i in range(n):
        a[i],b[i] = map(int,input().split())
    cnt = 0
    for i in range(n):
        cnt += b[i]
        if cnt>=k:
            print(a[i])
            break
    return

if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
# import sys
# import math
# import decimal
# import queue
# import bisect
# import heapq # priolity-queue
# import time
# import itertools
# import collections # queue
# from operator import itemgetter
# from fractions import Fraction

mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

def main():
    n,k = map(int,input().split())
    cnt = 0
    while cnt<k:
        a,b = map(int,input().split())
        cnt += b
        if cnt>=k:
            print(a)
            break
    return

if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:

n,k = map(int,input().split())
x = [0]* (10**5)

for i in range(n):
    a,b = map(int,input().split())
    x[a-1] += b
#print(x)

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

Submission status: Wrong Answer

Solution code:

n,k = map(int,input().split())
x = [0]* (10**5)

for i in range(n):
    a,b = map(int,input().split())
    x[a-1] += b
#print(x)

count = 0
for i in range(n):
    count += x[i]
    if count >= k:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
import sys

N, K = map(int, input().split())
arr = []
su = 0
for n in range(N):
  a, b = map(int, input().split())
  su += b
  if su >= K:
    print(a)
    sys.exit()

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
arr = []
for n in range(N):
  a, b = map(int, input().split())
  arr.extend([a for _ in range(b)])

print(arr[K-1])

Submission status: Wrong Answer

Solution code:
num, rank = map(int,input().split())
grid = []
for i in range(num):
    array = list(map(int, input().strip().split()))
    grid.append(array)

count = 0

for i in range(1,num+1):
    count += grid[i-1][1]
    if count >= rank:
        print(grid[i-1][0])
        break
    else:
        None

Submission status: Wrong Answer

Solution code:
num, rank = map(int,input().split())
grid = []
for i in range(num):
    array = list(map(int, input().strip().split()))
    grid.append(array)

empty = []

for i in range(1,num+1):
    if len(empty) == rank:
        break
    else:

        for x in range(grid[i-1][1]):
            empty.append(grid[i-1][0])

            if len(empty) == rank:
                break



empty.sort()

print(empty[rank-1])

Submission status: Wrong Answer

Solution code:
num, rank = map(int,input().split())
grid = []
for i in range(num):
    array = list(map(int, input().strip().split()))
    grid.append(array)

empty = []

for i in range(1,num+1):
    if i % 2 == 1:
        for x in range(grid[i-1][1]):
            empty.append(grid[i-1][0])
    elif i % 2 == 0:
        None

empty.sort()

print(empty[rank-1])

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
cnt = [0]*100001
S = set()
for i in range(N):
  a, b = map(int, input().split())
  cnt[a-1] += b
  S.add(a)

ans = 0
for s in S:
  ans += cnt[s-1]
  if ans >= K:
    print(s)
    break

Submission status: Wrong Answer

Solution code:
import bisect
n, k = map(int, input().split())
a = []
cusum = [0]*(n+1)
for i in range(n):
    _a, b = map(int, input().split())
    cusum[i+1] = cusum[i] + b
    a.append(_a)

index = bisect.bisect_left(cusum, k) - 1
print(a[0 if index < 0 else index])

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
a, b = [0]*N, [0]*N
for i in range(N):
    a[i], b[i] = map(int, input().split())

R = [0]*(N+1)
for i in range(1,N+1):
    R[i] += R[i-1] + b[i-1]

for i in range(1,N+1):
    if R[i-1]<K<=R[i]:
        print(a[i-1])

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
a, b = [0]*N, [0]*N
for i in range(N):
    a[i], b[i] = map(int, input().split())

R = [0]*(N+1)
for i in range(1,N+1):
    R[i] += R[i-1] + b[i-1]

for i in range(1,N+1):
    if R[i-1]+1<=K<=R[i]:
        print(a[i-1])
        exit()

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
a, b = [0]*N, [0]*N
for i in range(N):
    a[i], b[i] = map(int, input().split())

# ruiseki
R = [0]*(N+1)
for i in range(1,N+1):
    R[i] += R[i-1] + b[i-1]

for i in range(1,N+1):
    if R[i-1]<=K<=R[i]:
        print(a[i-1])
        exit()

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())

for _ in range(n):
    a, b = map(int, input().split())
    k -= b
    if k <= 0:
        print(a)
        exit()

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())

cnt = 0
ans = None
flag = True
for _ in range(N):
    a, b = map(int, input().split())
    cnt += b

    if flag and cnt >= K:
        ans = a
        flag = False

print(ans)

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())

ans=-1
for i in range(N):
    a,b=map(int,input().split())
    if K>b:
        K-=b
    else:
        if ans==-1:
            ans=a
        else:
            continue
print(ans)

Submission status: Wrong Answer

Solution code:
dic = dict()
n , k = map(int,input().split())

for _ in range(n):
    a , b = map(int,input().split())
    dic.setdefault(a , 0)
    dic[a] += b
    
for i in dic.keys():
    k -= dic[i]
    if k <= 0:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
li = sorted([tuple(map(int, input().split())) for _ in range(N)], key=lambda x: x[1])
print(li)
cnt = 0
for a, b in li:
    cnt += b
    if cnt >= K:
        print(a)
        break

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int, K: int, a: "List[int]", b: "List[int]"):

    cnt = 0
    for a, b in sorted(list(zip(a, b)), key=lambda x: x[1]):
        cnt += b
        if cnt >= K:
            return a


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    a = [int()] * (N)  # type: "List[int]"
    b = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    print(solve(N, K, a, b))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N, K = map(int,input().split())
a = []
b = []
for i in range(N) :
    p, q = map(int,input().split())
    a.append(p)
    b.append(q)

temp = 0
for i in range(N) :
    temp += b[i]
    if temp >= K :
        print(a[i])
        break

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
listA=[0]*10**5
for z in range(N):
    a,b=map(int,input().split())
    listA[a-1]+=b
count=0
y=0
while count<10**5-1:
    y+=listA[count]
    if y>=K:
        print(count+1)
        break
    else:
        count+=1

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
listA=[0]*10**5
for z in range(N):
    a,b=map(int,input().split())
    listA[a-1]+=b

count=0
y=0
while count<10**5-1:
    y+=listA[count]
    if y>=K:
        print(count+1)
        break
    else:
        count+=1

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
listA=[0]*10**5
listB=[0]*10**5
for z in range(N):
    a,b=map(int,input().split())
    if not a in listA:
        listA.insert(a-1,a)
        listB.insert(a-1,b)
    else:
        listB[a-1]+=b
count=0
y=0
while count<10**5-1:
    y+=listB[count]
    if y>=K:
        print(listA[count])
        break
    else:
        count+=1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
L=[0 for _ in range(10**5)]
n,k=map(int,input().split())
for i in range(n):
    a,b=map(int,input().split())
    L[a-1]+=b
tmp=0
for j in range(n):
    tmp+=L[j]
    if tmp>=k:
        print(j+1)
        break

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
l = []
for i in range(n):
    a, b = map(int, input().split())
    l += [a] * b
print(l[k-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
X=[]
for i in range (N):
	A=list(map(int,input().split()))
	X.append(A)
Y=sorted(X, key=lambda x:x[0])
tmp=0
for i in range (len(Y)):
	M=X[i][1]
	tmp+=int(M)
	if tmp>=K:
		print(X[i][0])
		exit()

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
X=[]
for i in range (N):
	A=list(map(int,input().split()))
	X.append(A)
Y=sorted(X, key=lambda x:x[0])
tmp=0
for i in range (len(Y)):
	M=X[i][1]
	tmp+=int(M)
	if tmp>K-1:
		print(X[i][0])
		exit()

Submission status: Wrong Answer

Solution code:
N, K = map(int,input().split())
num = []
for _ in range(N):
    num.append(list(map(int,input().split())))

for a, b in num:
    K -= b
    if K <= 0:
        print(a)
        exit()

Submission status: Wrong Answer

Solution code:
def main():
    N, K = (int(i) for i in input().split())
    A = []
    B = []
    from bisect import bisect_left
    for i in range(N):
        a, b = (int(i) for i in input().split())
        A.append(a)
        B.append(b)
    from itertools import accumulate
    B = list(accumulate(B))
    idx = bisect_left(B, K)
    # print(A, B, idx)
    print(A[idx])


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n, k = map(int,input().split())
ab = []
for i in range(n):
    ab.append([int(i) for i in input().split()])

tmp = 0
for i in range(n):
    tmp += ab[i][1]
    if tmp >= k:
        print(ab[i][0])
        exit()

Submission status: Wrong Answer

Solution code:
def main():
    n, k = map(int, input().split())
    nums = [tuple(input().split()) for _ in range(n)]
    l = []
    print(nums)
    for num in nums:
        l += num[0] * int(num[1])
    print(l[k])
main()

Submission status: Wrong Answer

Solution code:
def main():
    n, k = map(int, input().split())
    nums = [tuple(map(int, input().split())) for _ in range(n)]
    print(nums)
    l = []
    for num in nums:
        l += str(num[0]) * num[1]
    li = [int(i) for i in l]
    print(li)
    l.sort()
    print(l[k-1])
main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,k = map(int, input().split())

count = 0
ans = 0
for i in range(n):
    a,b = map(int, input().split())
    if count < k and count + b >= k:
        ans = a
    count += b
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
d = [0]*(10**5+1)
sum_d = 0

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

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

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
d = [0]*(10**5+1)
sum_d = 0

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

for i in range(N):
    d[i] += sum_d
    if(sum_d >= K):
        print(i)
        break

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
L = []
for i in range(N):
    a, b = map(int, input().split())
    for j in range(b):
        L.append(a)
 

L = sorted(L)
print(L[K+1])

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())

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

i = 0

while K-AB[i][1]>0:
    K -= AB[i][1]
    i += 1

print(AB[i][0])

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
l=[]
d={}
cnt=0
for i in range(n):
    a,b=map(int,input().split())
    try:
        d[a]+=b
    except:
        l.append(a)
        d[a]=b
for i in range(len(l)):
    cnt+=d[l[i]]
    if cnt>=k:
        print(l[i])
        break

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
clis = [0]*10**5

for i in range(n):
    a,b = map(int,input().split())
    clis[a-1] += b
cnt = 0    
for i in range(n):
    cnt += clis[i]
    if k <= cnt:
        print(i+1)
        break

Submission status: Wrong Answer

Solution code:
# ABC061c
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


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

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())

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

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

b = [] #amount
a = [] #index

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

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())

count = 0

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

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
su = 0

for i in range(n):
    a,b = map(int,input().split())
    if su < k:
        su += b
        mx = a
    else:
        pass
print(mx)

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
su = 0
mx = 0
for i in range(n):
    a,b = map(int,input().split())
    if su < k:
        su += b
        mx = max(mx,a)
    else:
        pass
print(mx)

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
su = 0
mx = 0
for i in range(n):
    if su < k:
        a,b = map(int,input().split())
        su += b
        mx = (max(mx,a))
    else:
        break
print(mx)

Submission status: Wrong Answer

Solution code:
def main():
    N, K = map(int,input().split())
    S = []
    for _ in range(N):
        a,b = map(int,input().split())
        S += [a]*b
    print(S[K-1])
    
            

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N, K = map(int,input().split())
    AB = [list(map(int,input().split())) for _ in range(N)]
    S = []
    count=0
    for ab in AB:
        count+=ab[1]
        if count>=K:
            print(ab[0])
            break
    
            

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N, K = map(int,input().split())
    AB = [list(map(int,input().split())) for _ in range(N)]
    S = []
    for ab in AB:
        S += [ab[0]]*ab[1]
    print(S[K-1])
            

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N, K = map(int,input().split())
    AB = [list(map(int,input().split())) for _ in range(N)]
    S = []
    for ab in AB:
        S.extend([ab[0]]*ab[1])
    print(S[K-1])
            

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N, K = map(int,input().split())
    AB = [list(map(int,input().split())) for _ in range(N)]
    S = []
    for ab in AB:
        for _ in range(ab[1]):
            S.append(ab[0])
    print(S[K-1])
            

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
l = []
for i in range(N):
  a, b = map(int, input().split())
  l.append([a, b])
c = 0
ans = 0
for r in l:
  c += r[1]
  if c >= K:
    ans = r[0]
    break
print(ans)

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
l = []
for i in range(N):
  a, b = map(int, input().split())
  l.append([a, b])
c = 0
q = []
for r in l:
  c += r[1]
  if c >= K:
    q.append(r[0])
print(q[0])

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
l = []
for i in range(N):
  a, b = map(int, input().split())
  l.append([a, b])
c = 0
ans = 0
for r in l:
  c += r[1]
  if c >= K:
    ans = r[0]
    break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)


sys.setrecursionlimit(1000000)
MOD = int(1e09) + 7
INF = int(1e30)


def main():
    # sys.stdin = open("Sample.txt")
    N, K = Scanner.map_int()
    A = Scanner.int_list_list(N)
    n = 0
    for i in range(N):
        n += A[i][1]
        if n >= K:
            print(A[i][0])
            return
    return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
list=[]
for i in range(n):
	a,b=map(int,input().split())
	for j in range(b):
		list.append(a)
	if len(list)>=k:
		break
list.sort()
print(list[k-1])

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
a=[]
b=[]
for i in range(N):
    c,d=map(int,input().split())
    a.append((c,d))
a.sort()
count = 0
for x,y in a:
    count+=y
    if y>=K:
        print(x)
        exit()

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
a=[]
b=[]
for i in range(N):
    c,d=map(int,input().split())
    a.append(c)
    b.append(d)

count=0
tmp=0

#O(N)
for i in range(N):
    count += b[i]
    if count>=K:
        tmp=i
        break
a.sort()
ans = a[tmp]
print(ans)

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
a=[]
b=[]
for i in range(N):
    c,d=map(int,input().split())
    a.append(c)
    b.append(d)

count=0
tmp=0
#O(N)
for i in range(N):
    count += b[i]
    if count>=K:
        tmp=i
        break
ans = a[tmp]
print(ans)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
ab = []
for i in range(n):
  a, b = map(int, input().split())
  ab.append([a, b])
ab.sort()
for a, b in ab:
  k -= b
  if k < 0:
    break
print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = []
B = []
for _ in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)

d = {}
for i in range(N):
    if A[i] in d:
        d[A[i]] = d[A[i]] + B[i]
    else:
        d[A[i]] = B[i]

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

for a, b in list:
    if M - b <= 0:
        print(a)
    M -= b

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = []
B = []
for _ in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)

for i in range(N):
    if M - B[i] <= 0:
        print(A[i])
        break
    M = M - B[i]