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 = list(map(int, input().split()))

# buff = []
# a = []
ans = 0
b = 0
for i in range(N):
    _a, _b = list(map(int, input().split()))
    b += _b
    if b >= K and ans == 0:
        ans = _a
    # buff += [_a]*_b


# buff = sorted(buff)
# print(buff[K-1])


print(ans)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
nums=[]
for i in range(n):
  nums.append(list(map(int,input().split())))
nums.sort(key=lambda x:x[0])
cnt=0
i=0
while cnt<k:
  cnt+=nums[i][1]
  if cnt>=k:
    print(nums[i][0])
    break

Submission status: Wrong Answer

Solution code:

N, K = map(int, input().split())
cnt = 0
ans = 0
flag = False
for _ in range(N):
    a, b = map(int, input().split())
    cnt += b
    if flag:
        continue
    if cnt >= K:
        ans += a
        flag = True
print(ans)

Submission status: Wrong Answer

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

sum = 0

for j in range(N):
    sum += b[j]
    if K <= sum:
        print(a[j])
        break

Submission status: Wrong Answer

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

sum = 0

for i in range(N):
    sum += b[i]
    if K <= sum:
        print(a[i])
        break

Submission status: Wrong Answer

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

sum = 0
X = 0

for i in range(N):
    sum += b[i]
    if K <= sum:
        X = i
        break

print(a[X])

Submission status: Wrong Answer

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

X = []

for j in range(N):
    for i in range(b[j]):
        X.append(a[j])


print(X[K-1])

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
l=[list(map(int,input().split())) for _ in range(n)]
c=0
for a,b in l:
    c+=b
    if c>=k:
        print(a)
        exit(0)

Submission status: Wrong Answer

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

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

num = [0]*(10**5)

for i in range(n):
    num[l[i][0]-1] = l[i][1]

min_k = 0
ans_i = 0

for i in range(n):
    min_k += num[i]
    
    if k <= min_k:
        ans_i = i

print(l[ans_i][0])

Submission status: Wrong Answer

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

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

sum_n =[]
m = 0 

for i in range(n):
    m +=  l[i][1]
    sum_n.append(m)

for i in sum_n:
    if k <= i:
        ans_i = sum_n.index(i)
        break

print(l[ans_i][0])

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
para = []
for i in range(N):
    a,b = map(int,input().split())
    para.append([a]*b)
ans= []
size = 0
for i in range(N) :
    if size > K :
        break
    else: 
        ans += para[i]
        size = len(ans)
print("{}".format(ans[K-1]))

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
f=True
for i in range(n):
    a,b=map(int,input().split())
    k-=b
    if k<=0 and f:
        print(a)
        f=False

Submission status: Wrong Answer

Solution code:
n,k = (int(i) for i in input().split())
c = 0
for a,b in [[int(i) for i in input().split()] for i in range(n)]:
    if c<=k<=c+b:
        print(a)
        exit()
    c+=b

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

box = [0] * (10**5)

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

count = 0
for i in range(N):
    count += box[i]
    if count >= K:
        print(i+1)
        break

Submission status: Wrong Answer

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

s = 0
for _ in range(N):
    a,b = map(int, input().split())
    s += b
    if s >= K:
        print(a)
        break

Submission status: Wrong Answer

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

s = 0
for _ in range(N):
    a,b = map(int, input().split())
    s += b
    if s >= K-1:
        print(a)
        break

Submission status: Wrong Answer

Solution code:
N, K = map(int,input().split())
count = 0
while True:
    a,b = map(int,input().split())
    count += b
    if count >= K:
        print(a)
        break

Submission status: Wrong Answer

Solution code:
N,K = [int(x) for x in input().split()]
ab = [[int(x) for x in input().split()]for _ in range(N)]
cand = {}
sums = 0
ans = 0
for i in ab:
    if(i[0] in cand):
        cand[i[0]] += i[1]
    else:
        cand[i[0]] = i[1]

for i in cand:
    sums+=cand[i]
    if(sums>=K):
        ans = i
        break
print(ans)

Submission status: Wrong Answer

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

ab.sort(key = lambda x:x[0])
idx = 0
i = 0
while True:
    if idx + ab[i][1] >= K-1:
        ans = ab[i][0]
        break
    else:
        idx += ab[i][1]
    i += 1
    


print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N,K = map(int,input().split())
d = defaultdict(int)
for i in range(N):
    a,b = map(int,input().split())
    d[a] += b
ls = [(k,d[k]) for k in d.keys()]
ls.sort(key = lambda x:x[0])
print(ls)
cnt = 0
for i in range(N):
    cnt += ls[i][1]
    if cnt >= K:
        print(ls[i][0])
        break

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
for i in [0]*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 = [0] * N
b = [0] * N
for i in range(N):
    a[i], b[i] = map(int, input().split())

s = [0] * (N+1)

for i in range(N):
    s[i+1] = s[i] + b[i]
    if s[i] < K <= s[i+1]:
        print(a[i])
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

l = []
for a, b in AB:
	l += [a] * b

print(l[K - 1])

Submission status: Wrong Answer

Solution code:
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
import collections
from operator import itemgetter
#以下てんぷら
def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")

def ip():
    return int(input())
def printrow(a):
    for i in range(len(a)):
        print(a[i])
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)

#n = ip()                                     #入力整数1つ
n,k= (int(i) for i in input().split())       #入力整数横2つ以上
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#v=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
#こっから本文
a = []
for i in range(n):
    a.append([int(i) for i in input().split()])
p = -1
while k>0:
    p+=1
    k-=a[p][1]
print(a[p][0])

Submission status: Wrong Answer

Solution code:
import sys

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

Submission status: Wrong Answer

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

sumb = 0
for n in nums:
    sumb += n[1]
    if sumb >= K:
        print(n[0])
        break

Submission status: Wrong Answer

Solution code:
#ABC061C
N, K = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
num = 0
for i in range(N): 
    num += ab[i][1]
    if num >= K:
        del ab[i+1:]
        ab.sort()
        print(ab[i][0])
        break

Submission status: Wrong Answer

Solution code:
#ABC061C
N, K = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
num = 0
for i in range(N): 
    num += ab[i][1]
    if num >= K:
        ab.sort()
        print(ab[i][0])
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a, b = [], []
for i in range(N):
    ea, eb = map(int, input().split())
    a.append(ea)
    b.append(eb)

num = 0
for i in range(N):
    num += b[i]
    if K <= num:
        ans = a[i]
        break

print(ans)

Submission status: Wrong Answer

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

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

tb = 0
i = 0
for i in range(len(b)):
    tb += b[i]
    if tb >= k:
        break
print(a[i])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
ans=0
v=0
for i in range(N):
    a,b=map(int,input().split())
    ans+=b
    if ans>=K and v==0:
        print(a)
        v+=1
    else:
        continue

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
A_B=[list(map(int,input().split())) for _ in range(N)]
ans=0
for i in range(N):
    ans+=A_B[0][1]
    if ans>=K:
        print(A_B[0][0])
print(ans)

Submission status: Wrong Answer

Solution code:
n, k = [int(n) for n in input().split()]

l_ = 0
for i in range(n):
    a, b = [int(n) for n in input().split()]
    l = l_ + b
    if l_ < k <= l:
        ans = a
    l_ = l

print(ans)

Submission status: Wrong Answer

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

for i in range(N):
    if ab[i][1] < K <= ab[i+1][1]:
        ans = ab[i+1][0]
        break

print(ans)

Submission status: Wrong Answer

Solution code:
0

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
li = [list(map(int, input().split())) for i in range(n)]
li.sort()
c=0
for i in range(n):
  c+=li[i][0]*li[i][1]
  if c>=k:
    print(li[i][0])
    
    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)

print(l[k-1])

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
j=-1
while c<k:
  j +=1
  c += len(l[j])
print(l[j][0])

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
for i 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())
for i in range(n):
    a,b=map(int,input().split())
    k-=b
    if k<0:
        print(a)
        exit()
    elif k==0:
        print(c)
        exit()
    c=a

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)
        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:
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)
  print(count)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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
    
#  キーの順番でソートする
sorted(array.items(), key=lambda x: x[0])

ans = 0
cnt = 0
# k番目が何かを確認する
for key in array.keys():
  cnt += array[key]
    
  if cnt >= k:
    #ans = key
    print(key)
    exit()

Submission status: Wrong Answer

Solution code:

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
    
#  キーの順番でソートする
sorted(array.items(), key=lambda x: x[0])

ans = 0
cnt = 0
# k番目が何かを確認する
for key in array.keys():
  cnt += array[key]
    
  if cnt >= k:
    ans = key
    break
print(ans)

Submission status: Wrong Answer

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

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

rules = sorted(rules, key=lambda x: x[1])
for rule in rules:
    K -= rule[1]
    if K <= 0:
        print(rule[0])
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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(k):
  cnt+=li[i][1]
  if cnt>=k:
    print(li[i][0])
    break

Submission status: Wrong Answer

Solution code:
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(k):
  cnt+=li[i][1]
  if cnt>=k:
    print(li[i][0])
    exit()

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
li = [list(map(int,input().split())) for i in range(n)]
from operator import itemgetter
li.sort(key=itemgetter(1))

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

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
li = [input().split() for i in range(n)]
from operator import itemgetter
li.sort(key=itemgetter(1))

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

Submission status: Wrong Answer

Solution code:
N, K = list(map(int, input().split()))
max_a = 0
cnt = 0
for i in range(N):
    a, b = list(map(int, input().split()))
    max_a = max(max_a, a)
    cnt += b
    if cnt >= K:
        print(max_a)
        exit()

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
count = 0
while count < k:
  a, b = map(int, input().split())
  count += b
  if count >= k:
    print(a)
    break

Submission status: Wrong Answer

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

print(ans[K-1])

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 j in range(b):
        ans.append(a)

print(ans[K-1])

Submission status: Wrong Answer

Solution code:
import numpy as np

N, K = [int(i) for i in input().split()]
ab = np.array(
  [[int(i) for i in input().split()] for _ in range(N)])

k_sum = 0

for record in ab:
  a = record[0]
  b = record[1]
  
  k_sum += b
  if k_sum >= K:
    print(a)
    break

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
N, K = map(int, raw_input().split())
a = []
for i in range(N):
    a.append(map(int, raw_input().split()))
a.sort(key=itemgetter(0))
thre = 0
for i in a:
    thre += i[1]
    if thre > K:
        print(i[0])
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
number = [0 for i in range(100001)]
for i in range(N):
  a, b = map(int, input().split())
  number[a] += b
for i in range(N):
  if K - number[i+1] <= 0:
    print(i+1)
    break
  else:
    K -= number[i+1]

Submission status: Wrong Answer

Solution code:
from sys import stdin
n, k = map(int, input().split())
nums = []
for i in range(n):
    a, b = map(int, stdin.readline().split())
    for j in range(b):
        nums.append(a)
nums.sort(reverse=True)
print(nums[k])

Submission status: Wrong Answer

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

l=0
for a, b in AB:
  l+=b
  if l>=K:
    print(a)
    exit()

Submission status: Wrong Answer

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

sorted(m, key = lambda k:k[0])
for i in range(N):
  bs += m[i][1]
  if (bs >= K):
    print(m[i][0])
    break

Submission status: Wrong Answer

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

sorted(m, key = lambda k:k[0])
for i in range(N):
  bs += b[i]
  if (bs >= K):
    print(m[i][0])
    break

Submission status: Wrong Answer

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

sorted(m, key = lambda k:k[0])
for i in range(N):
  bs += m[i][1]
  if (bs >= K):
    print(m[i][0])
    break

Submission status: Wrong Answer

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

sorted(m, key = lambda k:k[1])
for i in range(N):
  bs += m[i][1]
  if (bs >= K):
    print(m[i][0])
    break

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

X.sort()

print(X[k])

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
X=[]
for i in range(n):
    X.append(list(map(int,input().split())))
cnt=X[0][1]
if k<=X[0][1]:
    print(X[0][0])
else:
    for j in range(1,n):
        cnt+=X[j][1]
        if cnt>=k:
            print(X[j][0])
            break

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.append(a)
    B.append(b)
    
import numpy
B_res = numpy.cumsum(B)

from bisect import bisect_left,bisect_right
# print(bisect_left(B_res, K))
print(A[bisect_left(B_res, K)])

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split(' '))
nums=[0]*(10**5)
for i in range(N):
  a,b=map(int,input().split(' '))
  nums[a-1]+=b
s=0
for i in range(N):
  s+=nums[i]
  if s>=K:
    print(i+1)
    break
  else:
    continue

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 j in range(b):
        ans.append(a)
        if len(ans)>=k:
            break
    if len(ans)>=k:
        break
ans.sort()
print(ans[k-1])

Submission status: Wrong Answer

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

dic={i:j for i,j in sorted(dic.items())}

for i,j in dic.items():
  cnt+=j
  if k<=cnt:
    print(i)
    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 k<=cnt:
    print(a)
    exit()

Submission status: Wrong Answer

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

for i in ab:
    tmp += i[1]
    if tmp >= K:
        ans = i[0]
        break
print(ans)

Submission status: Wrong Answer

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

count = 0
for i in range(1, N + 1):
    count += li[i]
    if count >= K:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
import bisect
n,k = map(int,input().split())
A = []
B = [0]
c = 0
for i in range(n):
    a,b = map(int,input().split())
    A.append(a)
    c += b
    B.append(c)
    
bi = bisect.bisect(B,k)
if B[bi-1] == k:
    print(A[bi-2])
else:
    print(A[bi-1])

Submission status: Wrong Answer

Solution code:
import bisect
N,K = map(int,input().split())
ass = [0]*N
nums = [0]*N
for n in range(N):
    a,b = map(int,input().split())
    nums[n] = a
    ass[n] = b
for a in range(1,len(ass)):
    ass[a]=ass[a-1]+ass[a]
print(nums[bisect.bisect_left(ass, K)])

Submission status: Wrong Answer

Solution code:
def two_dim_merge_sort(arr):##arrは二次元配列
    if len(arr) <= 1:
        return arr

    mid = len(arr) // 2
    # ここで分割を行う
    left = arr[:mid]
    right = arr[mid:]

    # 再帰的に分割を行う
    left = two_dim_merge_sort(left)
    right = two_dim_merge_sort(right)

    # returnが返ってきたら、結合を行い、結合したものを次に渡す
    return two_dim_merge(left, right)


def two_dim_merge(left, right):
    merged = []
    l_i, r_i = 0, 0

    # ソート済み配列をマージするため、それぞれ左から見ていくだけで良い
    while l_i < len(left) and r_i < len(right):
        # ここで=をつけることで安定性を保っている
        if left[l_i][0] <= right[r_i][0]:
            merged.append(left[l_i])
            l_i += 1
        else:
            merged.append(right[r_i])
            r_i += 1

    # 上のwhile文のどちらかがFalseになった場合終了するため、あまりをextendする
    if l_i < len(left):
        merged.extend(left[l_i:])
    if r_i < len(right):
        merged.extend(right[r_i:])
    return merged



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

a = [0] * n
b = [0] * n

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

l = [0] * n

for i in range(0,n):
    l[i] = [a[i],b[i]]

two_dim_merge_sort(l)

s = 0

for i in range(0,n):
    s = s + l[i][1]
    if s >= k:
        ans = l[i][0]
        break

print(ans)

Submission status: Wrong Answer

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

s = 0
for l in ab:
    s += l[1]
    if s >= K:
        print(l[0])
        break

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
ab = {}
for i in range(N):
    aa,bb = map(int,input().split())
    if aa in ab.keys():
        ab[aa] += bb
    else:
        ab[aa] = bb

s = 0
for k,v in ab.items():
    s += v
    if s >= K:
        print(k)
        break

Submission status: Wrong Answer

Solution code:
def two_dim_merge_sort(arr):##arrは二次元配列
    if len(arr) <= 1:
        return arr

    mid = len(arr) // 2
    # ここで分割を行う
    left = arr[:mid]
    right = arr[mid:]

    # 再帰的に分割を行う
    left = two_dim_merge_sort(left)
    right = two_dim_merge_sort(right)

    # returnが返ってきたら、結合を行い、結合したものを次に渡す
    return two_dim_merge(left, right)


def two_dim_merge(left, right):
    merged = []
    l_i, r_i = 0, 0

    # ソート済み配列をマージするため、それぞれ左から見ていくだけで良い
    while l_i < len(left) and r_i < len(right):
        # ここで=をつけることで安定性を保っている
        if left[l_i][0] <= right[r_i][0]:
            merged.append(left[l_i])
            l_i += 1
        else:
            merged.append(right[r_i])
            r_i += 1

    # 上のwhile文のどちらかがFalseになった場合終了するため、あまりをextendする
    if l_i < len(left):
        merged.extend(left[l_i:])
    if r_i < len(right):
        merged.extend(right[r_i:])
    return merged



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

a = [0] * n
b = [0] * n

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

l = [0] * n

for i in range(0,n):
    l[i] = [a[i],b[i]]

two_dim_merge_sort(l)

s = 0

for i in range(0,n):
    s = s + b[i]
    if s >= k:
        ans = a[i]

print(ans)

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 x in ab:
    count += x[1]
    if k <= count:
        print(x[0])
        break

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())
S = []
for i in range(n):
    a,b = map(int,input().split())
    S.extend([a]*b)
print(S[k-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
s=0
flag=0
for i in range(n):
    a,b=map(int,input().split())
    s+=b
    if s>=k and flag==0:
        flag=1
        ans=a
print(ans)

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
s = [list(map(int,input().split())) for i in range(n)]
t = [s[i][0] for i in range(len(s))]
r = [s[i][1] for i in range(len(s))]
t.sort()
r.sort()
x = 0

for i in range(len(r)):
    x = x + r[i]
    if x >= k:
        print(t[i])
        break

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
s = [list(map(int,input().split())) for i in range(n)]
y = 0 

for i in range(n):
    y = y + s[i][1]
    if y >= k:
        print(s[i][0])
        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):
    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)]

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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