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())
b=[1]
a=[]
for i in range(n):
    x,y=map(int,input().split())
    a.append(x)
    b.append(b[i]+y)
print(b)
for i in range(n):
    if b[i]<=k and k<b[i+1]:
        print(a[i])

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
b=[1]
a=[]
for i in range(n):
    x,y=map(int,input().split())
    a.append(x)
    b.append(b[i]+y)
for i in range(n):
    if b[i]<=k<b[i+1]:
        print(a[i])

Submission status: Wrong Answer

Solution code:
N, K = map(int,input().split())
L = []
for _ in range(N):
    L.append(sorted(list(map(int,input().split()))))
for i in range(1,len(L)):
    L[i][1] = L[i][1] + L[i-1][1]
for x in L:
    if K <= x[1]:
        print(x[0])
        break

Submission status: Wrong Answer

Solution code:
N, K = map(int,input().split())
L = []
for _ in range(N):
    L.append(list(map(int,input().split())))
for i in range(1,len(L)):
    L[i][1] = L[i][1] + L[i-1][1]
for x in L:
    if K <= x[1]:
        print(x[0])
        break

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
A = []
B = []
for i in range(n):
    a,b = map(int, input().split())
    A.append(a)
    B.append(b)
C = zip(A, B)
sorted(C)

for i in range(n):
    m -= B[i]
    if(m<=0):
        print(A[i])
        break
    A[i] = 1000000

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
L=[]
for s in range(n):
  a,b=map(int,input().split())
  L.extend([a for i in range(b)])
#  if len(L)>k+1:
#    break
    
#print(L)
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())
  K -= b
  if(K <= 0):
    print(a)
    break

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
a_b=[[0,0,0]]
for i in range(n):
    a,b=map(int,input().split())
    a_b.append([a,b,b+a_b[i][2]])
a_b.sort(key=lambda x: x[0])
for i in range(len(a_b)):
    if a_b[i][2]<k<=a_b[i+1][2]:
        print(a_b[i+1][0])
        exit()

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
l = [tuple(map(int, input().split())) for i in range(n)]
l.sort()
l.append((0, k))
d = [l[0][1]]
for i in range(1,n+1):
    d.append(d[i-1] + l[i][1])
t = 0
while d[t] <= k:
    t += 1
print(l[t-1][0])

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
x = [list(map(int,input().split())) for i in range(n)]
x = sorted(x,key=lambda x:x[0])
tem = x[0][1]
i = 0
while k-tem > 0:
    k -= tem
    tem = x[i][1]
    i += 1
print(x[i][0])

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
A=[]
for _ in range(n):
    A.append(list(map(int,input().split())))
cnt=A[0][1]
i=0
while cnt<k:
    i+=1
    cnt+=A[i][1]
print(A[i][0])

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
L = []
for i in range(N):
  L.append(list(map(int,input().split())))
S = 0
for i in range(N):
  S += L[i][1]
  if S >= K:
    print(L[i][0])
    break

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
L=[]
for s in range(n):
  a,b=map(int,input().split())
  L.extend([a for i in range(b)])
  if len(L)>k:
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())|	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = list(map(int,input().split()))	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]

import collections
import math

#### START
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

Submission status: Wrong Answer

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

c = 0
d = 0
for i in b:
    c += i
    if c >= K:
        print(a[d])
        break
    d += 1

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split(" "))
list = []
for i in range(N):
    a,b = map(int,input().split(" "))
    list.append([a,b])
list = sorted(list)
print(list)

for i in range(N):
    a,b = list[i][0],list[i][1]
    K -= b
    if K <= 0:
        print(a)
        break

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split(" "))
for i in range(N):
    a,b = map(int,input().split(" "))
    K -= b
    if K <= 0:
        print(a)
        break

Submission status: Wrong Answer

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

tmp=0
for i,j in ls.items():
  tmp+=j
  if k <= tmp:
    print(i)
    exit()

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
c = {}
for x in range(N):
    a,b=map(int,input().split())
    if not a in c:
        c[a] = 0
    c[a]+=b

for i in range(1,10**5):
    if i not in c.keys():
        continue
    if c[i]>=K:
        print(i)
        break
    else: # c[i]<K
        K -=c[i]

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
c = {}
for x in range(N):
    a,b=map(int,input().split())
    if not a in c:
        c[a] = 0
    c[a]+=b

for i in range(1,10**5):
    if i not in c.keys():
        continue
    if c[i]>=K:
        print(i)
    else:
        K -=c[i]

Submission status: Wrong Answer

Solution code:
class struct:
  def __init__(self,a,b):
    self.a=a
    self.b=b
n,k=map(int,input().split())
if n==3:
  exit()
l=[]
for i in range(n):
  a,b=map(int,input().split())
  l.append(struct(a,b))
l=sorted(l,key=lambda x:x.a)
s=0
for i in l:
  s+=i.b
  if k<=s:
    print(i.a)
    exit()

Submission status: Wrong Answer

Solution code:
n, k = [int(x) for x in input().split(' ')]
ab = sorted([[int(x) for x in input().split(' ')]  for _ in range(n)])
index = 0

for a in ab:
    index += int(a[1])
    if index >= k:
        print(a[1])
        break

Submission status: Wrong Answer

Solution code:
n, k = [int(x) for x in input().split(' ')]
ab = [(input().split(' ')) for _ in range(n)]
index = 0

for a, b  in ab:
    index += int(b)
    if index >= k:
        print(a)
        break

Submission status: Wrong Answer

Solution code:
def solve():
    [N, K] = [int(x) for x in input().split()]

    count = dict()
    for i in range(N):
        [a, b] = [int(x) for x in input().split()]
        count[a] = count.get(a, 0) + b

    idx = 0
    # print(count)

    K = K - 1
    for k, n in count.items():
        if idx <= K < idx + n:
            return k
        idx += n

    return 0


if __name__ == '__main__':
    print(solve())

Submission status: Wrong Answer

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

ans = 0
t = 0 
for i in range(N):
    ans = a[i]
    t += b[i]

    if t >= K:
        break
l = []
for i in range(N):
    for j in range(b[i]):
        l.append(a[i])
print(l[K])

Submission status: Wrong Answer

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

ans = 0
t = 1
for i in range(N):
    ans = a[i]
    t += b[i]

    if t >= K:
        break
print(ans)

Submission status: Wrong Answer

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

ans = 0
t = 0
for i in range(N):
    ans = a[i]
    t += b[i]

    if t >= K:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
import heapq
n, k = list(map(int, input().split()))
li = []
for _ in range(n):
    li.append(tuple(map(int, input().split())))

li.sort()
cnt = 0
for a, b in li:
    cnt += b
    if cnt >= k - 1:
        ans = a
        break

print(ans)

Submission status: Wrong Answer

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

ans = 0
for i 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:
N, K = map(int, input().split())

ans = 0
for i in range(N):
    a, b = map(int, input().split())
    K -= b
    if K <= 0:
        ans = a
        K = float('inf')

print(ans)

Submission status: Wrong Answer

Solution code:
n, k = [int(x) for x in input().split(' ')]
ab = sorted([(input().split(' ')) for _ in range(n)], key=lambda x: x[0])
index = 0

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

Submission status: Wrong Answer

Solution code:
n, k = [int(x) for x in input().split(' ')]
ab = sorted([(input().split(' ')) for _ in range(n)], key=lambda x: x[0])
index = 0
for a, b  in ab:
    if index+int(b) >= k:
        print(a)
        exit()
    index += int(b)

Submission status: Wrong Answer

Solution code:
n, k = [int(x) for x in input().split(' ')]
ab = sorted([(input().split(' ')) for _ in range(n)], key=lambda x: x[0])
index = 0
for a, b  in ab:
    index += int(b)
    if index >= k:
        print(a)
        exit()

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

Submission status: Wrong Answer

Solution code:
import collections
import math
import re
import numpy
from operator import itemgetter
def ai():return input()#s
def a():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input().split()))#x or y
def say(i):return print("Yes" if i == 0 else "No")
def Say(i):return print("YES" if i == 0 else "NO")
kind=[]
l = []
f = 0
s=0
c=0
e =1
n,k=ma()
for i in range(n):
    a,b = ma()
    l.append([a,b])
l.sort()
for i in range(n):
    s+=l[i][1]
    if s >=k:
        c = l[i][0]
print(c)

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
D = {}
for i in range(N) :
    a,b = map(int,input().split())
    if a not in D :
        D[a] = b
    else :
        D[a] += b
        
Keys = list(D.keys())
Values = list(D.values())

ctr = 0
for i in range(len(D)) :
    ctr += Values[i]
    if ctr >= K :
        ans = Keys[i]
        break
print(ans)

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
D = {}
for i in range(N) :
    a,b = map(int,input().split())
    if a not in D :
        D[a] = b
    else :
        D[a] += b
        
Keys = list(D.keys())
Values = list(D.values())

ctr = 0
for i in range(len(D)) :
    ans = Keys[i]
    ctr += Values[i]
    if ctr >= K :
        break
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter

N,K = map(int,input().split())
D = {}
for i in range(N) :
    a,b = map(int,input().split())
    if a not in D :
        D[a] = b
    else :
        D[a] += b
ans = list(Counter.elements(D))[N]
print(ans)

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
D = {}
for i in range(N) :
    a,b = map(int,input().split())
    if a not in D :
        D[a] = b
    else :
        D[a] += b
Keys = list(D.keys())
Values = list(D.values())
ctr = 0
for i in range(len(D)) :
    ans = Keys[i]
    ctr += Values[i]
    if ctr >= K :
        break
print(ans)

Submission status: Wrong Answer

Solution code:
import bisect
N,K=map(int,input().split())
A=[]
B=[]
for i in range(N):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)
C=[0]*N
C[0]=B[0]
for i in range(N-1):
    C[i+1]=C[i]+B[i+1]
for i in range(N):
    if K<=C[i]:
        print(A[i])
        exit()
print(A[-1])

Submission status: Wrong Answer

Solution code:
import bisect
N,K=map(int,input().split())
A=[]
B=[]
for i in range(N):
    a,b=map(int,input().split())
    A.append(a)
    for i in range(b):
        B.append(a)
print(B[K-1])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
#ABC061
n,k = (int(i) for i in input().split())
a = []
b = []
for i in range(n):
    tmp = list(int(i) for i in input().split())
    a.append(tmp[0])
    b.append(tmp[1])

tmp = 0
tmp_i = 0
for i in range(n):
    tmp += b[i]
    if tmp>=n:
        tmp_i = i
        break
print(a[i])

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
nums = []

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

print(nums[K-1])

Submission status: Wrong Answer

Solution code:
import numpy as np
N, K = [int(x) for x in input().split()]
#print(N,K)

list = []
for i in range(N):
    a,b = [int(x) for x in input().split()]
    list.append([a, b])
list.sort()
#print(list)
nth = 0
for i in range(N):
    a,b = list[i]
    if nth>K:
        break
    elif nth==K:
        a,b = list[i-1]
        break
    nth += b 
#print(a,b)
print(a)

Submission status: Wrong Answer

Solution code:
import numpy as np
N, K = [int(x) for x in input().split()]
#print(N,K)

list = []
for i in range(N):
    a,b = [int(x) for x in input().split()]
    list.append([a, b])
list.sort()
print(list)
nth = 0
for i in range(N):
    a,b = list[i]
    if nth>K:
        break
    elif nth==K:
        a,b = list[i-1]
        break
    nth += b 
#print(a,b)
print(a)

Submission status: Wrong Answer

Solution code:
import numpy as np
N, K = [int(x) for x in input().split()]
list = []
for i in range(N):
    a,b = [int(x) for x in input().split()]
    for j in range(b): list.append(a)
list.sort()
print(list)
print(list[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)]
ab.sort()
check = 0
for i in range(N):
    check += ab[i][0]
    if K <= check:
        print(ab[i][1])
        break

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n, k = list(map(int, input().split()))
d = defaultdict(int)
for i in range(n):
    a, b = list(map(int, input().split()))
    d[a] += b
cnt = 0
for i, j in d.items():
    if cnt < k <= cnt+j:
        print(i)
        exit()
    cnt += j

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n, k = list(map(int, input().split()))
d = defaultdict(int)
for i in range(n):
    a, b = list(map(int, input().split()))
    d[a] += b
cnt = 0
for i, j in d.items():
    if cnt < k <= cnt+j:
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
n, k = list(map(int, input().split()))
ans, cnt = 0, 0
for i in range(n):
    a, b = list(map(int, input().split()))
    if not ans and cnt < k <= cnt + b:
        ans = a
    cnt += b
print(ans)

Submission status: Wrong Answer

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

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

tmp = 0
for i, _b in enumerate(b):
    tmp += _b
    if tmp >= K:
        print(a[i])
        break

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
ct=0
for i in range(n):
  ct+=l[i][1]
  if ct>=k:
    print(l[i][0])
    break

Submission status: Wrong Answer

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

dic = {}
for i in range(n):
    a = a_list[i]
    b = b_list[i]
    if a in dic.keys():
        tmp = dic[a]
        dic[a] = tmp + b
    else:
        dic[a] = b
count = 0
sorted_dic = sorted(dic.items())
for a, b in dict(sorted_dic).items():
    count += b
    if count >= k:
        print(a)
        exit()

Submission status: Wrong Answer

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

dic = {}
for i in range(n):
    a = a_list[i]
    b = b_list[i]
    if a in dic.keys():
        tmp = dic[a]
        dic[a] = tmp + b
    else:
        dic[a] = b
count = 0
sorted_dic = sorted(dic.items(), key=lambda x:x[0])
for a, b in dict(sorted_dic).items():
    count += b
    if count >= k:
        print(a)
        exit()

Submission status: Wrong Answer

Solution code:
n, K = map(int, input().split())
a_list = []
b_list = []
for i in range(n):
    a, b = map(int, input().split())
    a_list.append(a)
    b_list.append(b)

dic = {}
S = ""
for i in range(n):
    a = a_list[i]
    b = b_list[i]
    if a in dic.keys():
        tmp = dic[a]
        dic[a] = tmp + b
    else:
        dic[a] = b
count = 0
sorted_dic = sorted(dic.items(), key=lambda x:x[0])
for k, v in dict(sorted_dic).items():
    count += v
    if count >= K:
        print(k)
        exit()

Submission status: Wrong Answer

Solution code:
n, K = map(int, input().split())
a_list = []
b_list = []
for i in range(n):
    a, b = map(int, input().split())
    a_list.append(a)
    b_list.append(b)

dic = {}
S = ""
for i in range(n):
    a = a_list[i]
    b = b_list[i]
    # if a in dic.keys():
    #     tmp = dic[a]
    #     dic[a] = tmp + b
    # else:
    #     dic[a] = b
    S += str(a) * b
print(S[K-1])
# count = 0
# sorted_dic = sorted(dic.items(), key=lambda x:x[0])
# print(sorted_dic)
# for k, v in dict(sorted_dic).items():
#     count += v
#     if count >= K:
#         print(k)
        #break

Submission status: Wrong Answer

Solution code:
n, K = map(int, input().split())
a_list = []
b_list = []
for i in range(n):
    a, b = map(int, input().split())
    a_list.append(a)
    b_list.append(b)

dic = {}

for i in range(n):
    a = a_list[i]
    b = b_list[i]
    if a in dic.keys():
        tmp = dic[a]
        dic[a] = tmp + b
    else:
        dic[a] = b
count = 0
sorted_dic = sorted(dic.items(), key=lambda x:x[0])
for k, v in dict(sorted_dic).items():
    count += v
    if count >= K:
        print(k)
        break

Submission status: Wrong Answer

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

result = [a for a, b in A for j in range(b)]
print(result[K-1])

"""ループ逆だった
result = []
for a, b in A:
  for j in range(b):
    result.append(a)
print(result[K-1])
"""

Submission status: Wrong Answer

Solution code:
N, K = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(N)]
"""
result = [a for j in range(b) for a, b in A]
print(result[K+1])

"""
result = []
for a, b in A:
  for j in range(b):
    result.append(a)
print(result[K-1])

Submission status: Wrong Answer

Solution code:
def main():
    n, k = map(int, input().split())
    printed = False
    for _ in range(n):
        a, b = map(int, input().split())
        if not printed:
            k -= b
            if k <= 0:
                print(a)
                printed = True


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
sum = 0
for i in range(n):
	sum += ab[i][1]
	if k<=sum:
		print(ab[i][0])
		break

Submission status: Wrong Answer

Solution code:
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
cnt = 0
for x in C:
    cnt += C[x]
    if cnt >= K:
        print(x)
        exit()

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
D = {}
flag = 0
for i in range(N) :
    a,b = map(int,input().split())
    K -= b
    if K <= 0 and flag == 0 :
        ans = a
        flag = 1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,K = map(int, input().split())
cnt = 0
for _ 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, raw_input().split())
a = [0]*N
b = [0]*N
for i in range(N):
  a[i], b[i] = map(int, raw_input().split())
sa = range(N)
sa.sort(key=lambda i:b[i])
c = 0
for i in range(N):
  c += b[sa[i]]
  if c >= K:
    print a[sa[i]]
    break

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
l = []
for _ in range(N):
    an, bn = map(int, input().split())
    K -= bn
    if K <= 0:
        print(an)
        break

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
l = []
for _ in range(N):
    an, bn = map(int, input().split())
    for _ in range(bn):
        l.append(an)
print(l[K-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
check = 0
ans = []
for i in range(n):
    a, b = map(int, input().split())
    check += b
    ans.append(str(a)*b)
    if check >= k:
        ans = "".join(ans)
        print(ans[-1])
        break 
    else:
        ans.pop(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
emp_file = {}
num_list = []
count = 0
for i in range(n):
    a, b = map(int, input().split())
    num_list.append([a, b])
for i in range(n):
    emp_file[num_list[i][0]] = 0
for i in num_list:
    emp_file[i[0]] += i[1]
sort_file = sorted(emp_file.items())

sum_ = 0
for i in range(len(sort_file)):
    if sum_ < k:
        sum_ += sort_file[i][1]
    else:
        break
print(sort_file[i-1][0])

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
emp_list = []
count = 0
for i in range(n):
    a, b = map(int, input().split())
    emp_list.append(a)
    count += b
    if count >= k:
        print(a)
        break

Submission status: Wrong Answer

Solution code:
N, K= map(int, input().split())
g =[[] for i in range(N)]
h=0
for i in range(N):
    a, b = map(int, input().split())
    g[i].append(a)
    g[i].append(b)
def S(L):
    return L[0]
def T(L):
    return L[1]
g.sort(key=S)
for j in range(N):
    h+=T(g[j])
    x=h*(h+1)/2
    if x>=K:
        y=S(g[j])
        break
print(y)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n, k = map(int,input().split())
a = []
b = []

for i in range(n):
  x, y = map(int,input().split())
  a.append(x)
  b.append(y)
 
count = 0
i = 0
while count < k:
  count = count + b[i]
  i = i + 1

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
lis = [list(map(int,input().split())) for i in range(n)]
cou = 0
lis.sort()
for i in range(n):
  cou += lis[i][1]
  if cou <= m:
    print(lis[i][0])
    exit()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

a = []
b = []

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

d = defaultdict(int)

for i in range(N):
    if a[i] in d:
        d[a[i]] += b[i]
    else:
        d[a[i]] = b[i]

d_sorted = sorted(d.items())

l = 0
for a_i,b_i in d.items():
	l += b_i
	if l >= K:
		print(a_i)
		break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    len_s = 0
    ans = -1
    N, K = map(int, input().split())
    for _ in range(N):
        a, b = map(int, input().split())
        len_s += b
        if ans == -1 and len_s >= K:
            ans = a
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n,k = map(int, input().split())
s = 0
for _ in [0]*n:
  a,b = map(int, input().split())
  s += b
  if k <= s:
    print(a)
    break

Submission status: Wrong Answer

Solution code:
n,k = map(int, input().split())
s = 0
for _ in [0]*n:
  a,b = map(int, input().split())
  s += b
  if s <= k:
    print(a)
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(N)]
hikaku = 0
for i in range(N):
    hikaku += ab[i][1]
    if K <= hikaku:
        print(ab[i][0])
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())


from collections import Counter

cnt = Counter([])

n,k = li()

num = []
index = []

for _ in range(n):
    a,b = li()
    cnt[a] += b


res = k
for key, value in cnt.items():
    if res - value <= 0:
        print (key)
        break
    
    res -= value

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())

from bisect import bisect_left
from itertools import accumulate

n,k = li()

num = []
index = []

for _ in range(n):
    a,b = li()
    num.append(a)
    index.append(b)
    
index = list(accumulate(index))

k_idx = bisect_left(index,k)

print(num[k_idx])

Submission status: Wrong Answer

Solution code:
from collections import Counter
N,K = map(int,input().split())
src = [tuple(map(int,input().split())) for i in range(N)]

ctr = Counter()
for a,b in src:
    ctr[a] += b

now = 0
for k,v in ctr.items():
    if now + v <= K:
        now += v
    else:
        print(k)
        break

Submission status: Wrong Answer

Solution code:
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 += x
    if count >= k:
        break
print(y)

Submission status: Wrong Answer

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