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:
def smallk(n , k , ab):
    count = 0
    for i in range(n):
        if count + int(ab[i][1]) >= k:
            return int(ab[i][0])
        else:
            count += int(ab[i][1])

def main():
    n , k = map(int , input().split())
    ab = [list(map(int,input().split())) for i in range(n)]
    print(smallk(n , k , ab))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
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())
s=0
i=0
while s<K:
    s=s+b[i]
    i=i+1
print(a[i-1])

Submission status: Wrong Answer

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

ab = []
l = []
C = 0
for _ in range(N):
    A, B = [int(i) for i in input().split()]
    C += B
    ab.append([A,C])
    
for c in ab:
    if c[1] > K:
        print(c[0])
        break

Submission status: Wrong Answer

Solution code:
def solve(n, k, AB):
    AB.sort(key=lambda ab: ab[0])
    count = 0
    ret = -1
    for a, b in AB:
        count += b
        if k <= count:
            ret = a
    return ret

_n, _k = map(int, input().split())
_AB = [list(map(int, input().split())) for _ in range(_n)]
print(solve(_n, _k, _AB))

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:
        print(a)
        break

Submission status: Wrong Answer

Solution code:
import itertools

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

    datas = {}

    for _ in range(N):
        a, b = [int(x) for x in input().split()]
        if a in datas.keys():
            datas[a] += b
        else:
            datas.setdefault(a, b)

    sorted_datas = {k: datas[k] for k in sorted(datas.keys())}

    accum = list(itertools.accumulate(sorted_datas.values()))

    i = 0
    for i in range(len(accum)):
        if accum[i] >= K:
            break
            
    print(list(sorted_datas.keys())[i])

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N, K = input().split()
N = int(N)
K = int(K)
emptyList = []

for n in range(int(N)):
  a, b = input().split()
  for m in range(int(b)):
    emptyList.append(int(a))

new_list = sorted(emptyList)

print(new_list)

print(new_list[K])

Submission status: Wrong Answer

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

    dir = {}

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

        if a in dir.keys():
            dir[a] += b
        else:
            dir.setdefault(a, b)

    sorted(dir.keys())

    sorted_dir = {k:dir[k] for k in sorted(dir.keys())}
    for key in sorted_dir.keys():
        if sorted_dir[key] >= K:
            print(key)
            return
        else:
            K -= sorted_dir[key]



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
lst = [list(map(int, input().split())) for i in range(N)]
sorted_lst = sorted(lst, key=lambda x: x[1])
cnt = 0
for i in sorted_lst:
  cnt += i[1]
  if (cnt >= K):
    print(i[0])
    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(key=lambda x:x[1])
k=K
i=0
while k>0:
  k-=A[i][1]
  ans=A[i][0]
  i+=1
print(ans)

Submission status: Wrong Answer

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

sm=0
for i in range(len(S)):
    sm+=S[i][1]
    if sm >= k:
        break

print(S[i][0])

Submission status: Wrong Answer

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

ls.sort(key=lambda x: x[1])

ln = 0

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(n)]
l = [0] * (10 ** 5 + 1)

for i in ab:
    l[i[0]] += i[1]
# print(l)
s = 0
for i in range(10 ** 5):
    s += l[i]
    if s >= k:
        print(i)
        break

Submission status: Wrong Answer

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

l=[]
for i in ll:

    for j in range(i[1]):
        l.append(i[0])
l.sort()
print(l[k-1])

Submission status: Wrong Answer

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

res = [0]*10**5

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

count = 0
for i,r in enumerate(res):
    count+=r
    if count >= M:
        print(count)
        break

Submission status: Wrong Answer

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

res = []

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

sorted(res)
print(res[M-1])

Submission status: Wrong Answer

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def gcd(a, b):
# 例外処理
    if a == 0:
        return b
    if b == 0:
        return a

    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b


def main():
    S = []
    N, K = MAP()
    L = [LIST() for i in range(N)]
    d = Counter()
    for a, b in L:
        # print(a, b)
        for i in range(b):
            S.append(a)
    d.update(S)
    # print(d)
    # d = sorted(d)
    # print(d)
    d = sorted(d.items(), key=lambda pair: pair[1], reverse=False)
    # print(d)
    c = 0
    # while c < K:
    ans = 0
    for a, b in d:
        c += b
        if c < K:
            # ans = a
            continue
        else:
            ans = a
            print(ans)
            exit()

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

dic = defaultdict(int)
for a, b in ab:
  dic[a] += b

cnt = 0
for i in range(1, 10**5):
  cnt += dic[i]
  if cnt >= K:
    print(i)
    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())
for i in range(n):
  a,b = map(int,input().split())
  k -= b
  if b <= 0:
    print(a)
    break

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline


def main():
    N, K = [int(x) for x in input().split()]
    ab = []
    for _ in range(N):
        ab.append([int(x) for x in input().split()])

    count = 0
    i = -1
    while count < K:
        i += 1
        count += ab[i][1]

    print(ab[i][0])






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)]
tmp=0
for a,b in ab:
  tmp+=b
  if tmp>=k:
    print(a) 
    exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

tmp_dic = {}
for i in range(n):
  a_tmp, b_tmp = map(int, input().split())
  tmp_dic[a_tmp] = b_tmp

a_list = list(tmp_dic.keys())
a_list.sort()

acum=0
for key in a_list:
  acum+=tmp_dic[key]
  if m<=acum:
    print(key)
    break

Submission status: Wrong Answer

Solution code:

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

tmp_dic = {}
for i in range(n):
  a_tmp, b_tmp = map(int, input().split())
  tmp_dic[a_tmp] = b_tmp

a_list = list(tmp_dic.keys())
a_list.sort()
print(a_list)

acum=0
for key in a_list:
  acum+=tmp_dic[key]
  if m<=acum:
    print(key)
    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())
count = 0
arr = [list(map(int, input().split())) for _ in range(N)]
for i in arr:
    count += i[1]
    if count >= K:
        print(i[0])
        exit()
print(arr[-1][0])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

print(arr[-1])

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
score = {}
L = 0
Z = 0
for i in range(N):
  a,b = map(int,input().split())
  L += b
  if a in score:
    score[a] += b
  else:
    score[a] = b
  if L >= K:
    break

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

for k,v in score_sorted:
  Z += v
  if K <= Z:
    print(k)
    break

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
A = []
L = 0
Z = K
for i in range(N):
  a,b = map(int,input().split())
  #A += [a] * b
  L += b
  Z -= b
  if L >= K:
    #print(Z)
    A = [a] * b
    print(A[Z])
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
a = [0] * n
b = [0] * n
sum = 0
arr = []
for i in range(n):
    a[i], b[i] = map(int, input().split())
# print(a, b)   
arr_list = list(zip(a, b))
# print(arr_list)
arr_list.sort()
# print(arr_list)

for i in range(n):
    # print(arr_list[i][1])
    sum += arr_list[i][1]
    if sum >= k:
        answer = a[i]
        break

print(answer)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
a = [0] * n
b = [0] * n
arr = []
for i in range(n):
    a[i], b[i] = map(int, input().split())
# print(a, b)
for i in range(n):
    for _ in range(b[i]):
        arr.append(a[i])
answer = arr[k-1]
# print(arr)
print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
# ans = 0
for i in range(N+1):
  an, bn = map(int, input().split())
  K -= bn
  if K <= 0:
    ans = an
    break
print(an)

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
ans = 0
for i in range(N+1):
  an, bn = map(int, input().split())
  K -= bn
  if K <= 0:
    ans = an
    break
print(an)

Submission status: Wrong Answer

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

for i in range(n):
    cnt += bb[i]
    if cnt >= k:
        ans = aa[i]
        break

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

def main():
    N,K = map(int,input().split())
    L = []
    for i in range(N):
        a,b = map(int,input().split())
        L.append((a,b))
        
    for i in range(N):
        K -= L[i][1]
        if K <= 0:
            print(L[i][0])
            exit()
    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

for i in range(N):
    num_dict[A[i]] += B[i]

num_sorted = dict(sorted(num_dict.items(), key=lambda x:x[0]))

cnt = 0
for k, v in num_sorted.items():
    cnt += v
    if cnt >= K:
        print(k)
        exit()

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
a=[0]*n
b=[0]*n
c=[]
for i in range(n):
  a[i],b[i]=map(int,input().split())
  c.append([a[i],b[i]])
d=sorted(c,key=lambda x: x[0])
count=0
j=0
while count<k:
  count+=c[j][1]
  j+=1
print(c[j-1][0])

Submission status: Wrong Answer

Solution code:
N,K = [int(i) for i in input().split()]
s = [[int(i) for i in input().split()] for N in range(N)]
ans_bool = True

for i in s:
  K = K - i[1]
  if (K <= 0) and (ans_bool):
    ans_bool = False
    print(i[0])

Submission status: Wrong Answer

Solution code:
N,K = [int(i) for i in input().split()]
s = [[int(i) for i in input().split()] for N in range(N)]
count = K
ans_bool = True

for i in s:
  count = count - i[1]
  
  if count > 0:
    pass
  elif (count <= 0) & ans_bool:
    ans_bool = False
    print(i[0])

Submission status: Wrong Answer

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

for i in s:
  count = count - i[1]
  
  if count > 0:
    pass
  elif count <= 0:
    print(i[0])
    break

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
AB = [[i for i in map(int,input().split())] for j in range(N)]
sum = 0
AB.sort()
print(AB)

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

    
print(ans)

Submission status: Wrong Answer

Solution code:
N , K = map(int,(input().split()))
 
sums = 0
nums = [0] * (10 ** 5 + 1) 
con = 0
ans = 0
 
for i in range(N):
  a,b = map(int,(input().split()))
  nums[a] += (a * b)
  
for i in range(len(nums)):
  con += nums[i]
  if K <= con:
    ans = i
    break

    
print(ans)

Submission status: Wrong Answer

Solution code:
N , K = map(int,(input().split()))
 
sums = 0
nums = [0] *(10 ** 5 + 1) 
con = 0
ans = 0
 
for i in range(N):
  a,b = map(int,(input().split()))
  nums[a] += b
  
for i in range(N + 1):
  con += nums[i]
  if K <= con:
    ans = i
    break

    
print(ans)

Submission status: Wrong Answer

Solution code:
N , K = map(int,(input().split()))
 
sums = 0
nums = []
ans = 0
 
for i in range(N):
  a,b = map(int,(input().split()))
  sums = b + sums
  nums.append([sums,a])
  
for i in range(N):
  border = nums[i][0]
  if K <= border:
    ans = nums[i][1]
    break

    
print(ans)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
c = 0
ABC = []
for _ in range(n):
    a, b = map(int, input().split())
    c += b
    ABC.append((a,b,c))

for i in range(n):
    if k <= ABC[i][2]:
        ind = i
        break

print(ABC[ind][0])

Submission status: Wrong Answer

Solution code:
a,b = [int(i) for i in input().split()]

temp = 0
l = [[int(i) for i in input().split()] for _ in range(a)]
for i in l:
    temp += i[1]
    if temp >= b:
        ans = i[0]
        break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


for a,b in abl:
    k -= b
    if k <= 0:
        print(a)
        import sys
        sys.exit()

Submission status: Wrong Answer

Solution code:
N, k = map(int, input().split())  # N回の操作, K番目に小さいものを選ぶ
ans = []
for _ in range(N):
    ans.append(list(map(int, input().split())))

for value, amount in ans:
    if amount >= k:
        print(value)
        exit()
    else:
        k -= amount

Submission status: Wrong Answer

Solution code:
import sys

n, k, *ab = map(int, sys.stdin.read().split())
ab = zip(*[iter(ab)] * 2)

def main():
    s = 0
    for a, b in ab:
        s += b
        if s >= k:
            return a

if __name__ == '__main__':
    ans = main()
    print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
ans = 0 ;count = 0 ;pro = 1

data=[]
n,k=map(int,input().split())
for i in range(n):
    a,b=map(int,input().split())
    data.append((a,b))
for di in data:
    if di[1]>=k:
        print(di[0])
        exit()
    else:
        k-=di[1]

Submission status: Wrong Answer

Solution code:
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)
        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]]
L.sort(key=lambda x:x[0])
print(L)


sm=0
for i in range(n):
      sm+=L[i][1]
      if sm>=k:
            print(L[i][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())
      L+=[[a,b]]
L.sort(key=lambda x:x[1])

sm=0
for i in range(n):
      sm+=L[i][1]
      if sm>=k:
            print(L[i][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())
      L+=[a]*b
print(L[k-1])

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque

if sys.platform in ['ios','win32','darwin']:
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

N, K = MAP()
A = [MAP() for _ in range(N)]

tmp = []
cur = 0
for a in A:
	tmp.append(a)
	cur += a[1]
	if cur >= K:
		tmp.sort()
		# print(tmp)
		print(tmp[-1][0])
		break

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque

if sys.platform in ['ios','win32','darwin']:
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

N, K = MAP()
A = [MAP() for _ in range(N)]

tmp = []
cur = 0
for a in A:
	tmp.append(a)
	cur += a[1]
	if cur >= K-1:
		tmp.sort()
		print(tmp[-1][0])
		break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n, k = map(int,input().split())
lst = [[int(i) for i in input().split()] for _ in range(n)]
#lst.sort(key = lambda x: x[0])

for [i, j] in lst:
    if j >= k:
        print(i)
        quit()
    else:
        k -= j

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


input_dict = {}

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

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

print(input_dict)

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())
s = []
for i in range(N):
  x,y = map(int,input().split())
  for j in range(y):
    s.append(x)

print(s[K-1])

Submission status: Wrong Answer

Solution code:
import bisect
n, k = map(int, input().split())
L = []
S = [0]
for _ in range(n):
  a, b = map(int, input().split())
  L.append(a)
  S.append(S[-1]+b)
S = S[1:]
t = bisect.bisect_left(S, k)
print(L[t])

Submission status: Wrong Answer

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

for i in range(k-1):
  m = min(a)
  for j in range(n):
    if a[j] == m and b[j] >= 1:
      b[j] = b[j] - 1
    elif a[j] == m and b[j] == 1:
      del a[j]
      del b[j]
      
print(min(a))

Submission status: Wrong Answer

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

s = []
for i in range(n):
  s.extend([a[i]] * b[i])
for i in range(3):
  s.remove(min(s))
           
print(min(s))

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
d={}
for i in range(N):
  a,b=map(int,input().split())
  try:
    d[a]+=b
  except:
    d.setdefault(a,b)
for i in range(len(d)):
    V=sorted(d.values())
    k=sorted(d.keys())
    K-=V[i]
    if K<=0:
      print(k[i])
      exit()

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
li=[]
for i in range(N):
  a,b=map(int,input().split())
  K-=b
  li.append(a)
  if K<=0:
    li.sort()
    print(li[-1])
    exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
import bisect

n,m = [int(x) for x in stdin.readline().rstrip().split()]
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]

lin= []

for i in li:
    for j in range(i[1]):
        lin.append(i[0])

print(lin[m-1])

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,k=map(int,input().split())
    for _ in range(n):
        a,b=map(int,input().split())
        k-=b
        if(k<0):
            print(a)
            return
resolve()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,k=map(int,input().split())
    for _ in range(n):
        a,b=map(int,input().split())
        k-=b
        if(k<=0):
            print(a)
            return
resolve()

Submission status: Wrong Answer

Solution code:
# atcoder : python3 (3.4.3)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
mod = 10**9+7

# main
N,K = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]

Cnt = [0]*(10**5+1)
for a,b in AB:
    Cnt[a] += b

i = 1
for i in range(len(Cnt)):
    if i <= K < i+Cnt[i]:
        print(i)
        sys.exit()
    else:
        i += Cnt[i]

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
N, K = map(int, input().split())
arr = []
for _ in range(N):
    arr.append(list(map(int, input().split())))
arr.sort()
print(arr)
count = 0
for i in arr:
    count += i[1]
    if K <= count:
        print(i[0])
        exit()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
N, K = map(int, input().split())
arr = []
for _ in range(N):
    arr.append(list(map(int, input().split())))
count = 0
for i in arr:
    count += i[1]
    if K <= count:
        print(i[0])
        exit()

Submission status: Wrong Answer

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

index = 0
while k - ab[index][1] > 0:
    k -= ab[index][1]
    index += 1

print(ab[index][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 > 0:
    k = k - b
    continue
  else:
    ans = a
    break
    
print(a)

Submission status: Wrong Answer

Solution code:
N, K = [int(i) for i in input().split()]
L = []
for i in range(N):
  a, b = [int(j) for j in input().split()]
  L.append([a, b])
L.sort(key=lambda x: x[0])
print(L)

cnt = 0
for x, y in L:
  cnt += y
  if cnt >= K:
    ans = x
    break
print(ans)

Submission status: Wrong Answer

Solution code:
N, K = [int(i) for i in input().split()]
L = []
for i in range(N):
  a, b = [int(j) for j in input().split()]
  L.append([a, b])
L.sort(key=lambda x: x[1])
#print(L)

cnt = 0
for x, y in L:
  cnt += y
  if cnt >= K:
    ans = x
    break
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
n, k = map(int, input().split())
l = [0] * 100010
for i in range(n):
    a, b = map(int, input().split())
    l[a] += b
d = 0
for i in range(1, n + 1):
    d += l[i]
    if d >= k:
        print(i)
        break

Submission status: Wrong Answer

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

LIST=[[0,0] for i in range(N)]

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

sorted(LIST)

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

Submission status: Wrong Answer

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

sums = 0

nums = []

for i in range(N):
  a,b = map(int,(input().split()))
  sums = b + sums
  nums.append([sums,a])
  
for i in range(len(nums)):
  if K > nums[i][0]:
    continue
  elif nums[i][0] <= K:
    print(nums[i][1])
    break

Submission status: Wrong Answer

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

sums = 0

nums = []

for i in range(N):
  a,b = map(int,(input().split()))
  sums = b + sums
  nums.append([sums,a])
  
for i in range(len(nums)):
  if K > nums[i][0]:
    continue
  elif nums[i][0] == K:
    print(nums[i][1])
    break
  elif K < nums[i][0]:
    print(nums[i][1])
    break

Submission status: Wrong Answer

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

sums = 0

nums = []

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

for i in range(len(nums)):
  if nums[i][0] == K:
    print(nums[i][1])
  elif K > nums[i][0]:
    continue
  elif K < nums[i][0]:
    print(nums[i][1])