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())
query = sorted([tuple(map(int, input().split()))[-1::-1] for _ in range(n)])

cnt = 0
i = 0
while cnt < k:
    b, a = query[i]
    cnt += b
    i += 1
print(query[i - 1][1])

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
query = sorted([tuple(map(int, input().split()))[-1::-1] for _ in range(n)])

cnt = 0
i = 0
while i < n and cnt < k:
    b, a = query[i]
    cnt += b
    i += 1
print(a)

Submission status: Wrong Answer

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

ab = [[0, 0]] * N
for i in range(N):
    _a, _b = map(int, input().split())
    ab[i] = [_a, _b]
ab.sort(key=lambda x:x[0])

j = 0
index = 0
while j < K:
    j += ab[index][1]
    if j < K:
        index += 1

print(ab[index][0])

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

Submission status: Wrong Answer

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

total = 0
for i in range(n):
    number, copies = map(lambda x: int(x), input().split())
    total += copies
    if total >= k:
        print(number)
        break

Submission status: Wrong Answer

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

total = 0
for i in range(n):
    number, copies = map(lambda x: int(x), input().split())
    total += copies
    if total > k:
        print(number)
        break

Submission status: Wrong Answer

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

final = []
for i in range(n):
    number, copies = map(lambda x: int(x), input().split())
    for i in range(copies):
        final.append(number)

print(final[k - 1])

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 28 01:21:16 2020

@author: liang
"""

#バケツソートO(n)
N, K = map(int,input().split())
num = [0]*(10**5+1)
for i in range(N):
    a, b = map(int,input().split())
    num[a] += b

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 28 01:21:16 2020

@author: liang
"""

#バケツソートO(n)
N, K = map(int,input().split())
num = [0]*(10**5+1)
for i in range(N):
    a, b = map(int,input().split())
    num[a] += b

tmp = 0
for i in range(N+1):
    tmp += num[i]
    if tmp >= K:
        print(i)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N, K = map(int,input().split())
D = defaultdict(int)
for _ in range(N):
  a, b = map(int,input().split())
  D[a]+=b
D = sorted(D.items())
ans, total = D[0]
for i in range(1,len(D)):
  if K <= total:
    print(ans)
    break
  else:
    c, d = D[i]
    ans = c
    total+=d

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
list = []
a_list = []
b_list = []

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

def slv():
    cnt = 0
    for i in range(n):
        cnt += b_list[i]
        if cnt >= k:
            return print(a_list[i])

slv()

Submission status: Wrong Answer

Solution code:
list = []
a_list = []
b_list = []

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

print(list[k-1])

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
nums = [0]*100000
count = 0

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

for j in range(100000):
  if count < K:
    count += nums[j]
  else:
    print(j)
    break

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n,k = map(int, input().split())
ans = 0
al = []
d = defaultdict(int)
for i in range(n):
  a,b = map(int, input().split())
  al.append(a)
  d[a] += b
  
al.sort()
for i in al:
  if k > d[i]:
    k -= d[i]
  else:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n,k = map(int, input().split())
ans = 0
al = []
d = defaultdict(int)
for i in range(n):
  a,b = map(int, input().split())
  al.append(a)
  d[a] = b
  
al.sort()
for i in al:
  if k > d[i]:
    k -= d[i]
  else:
    print(i)
    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())
  if k > b:
    k -= b
  else:
    if ans == 0:
      ans = a
print(ans)

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

Submission status: Wrong Answer

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

ab = [0]*n

for i in range(n):
  ab[i] = input().split()
s = 0
for i in range(n):
  s += int(ab[i][1])
  if s >= k:
    print(int(ab[i][0]))
    exit()

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split(" "))
a = [list(map(int, input().split(" "))) for i in range(n)]
count = 0
ans = []
for x, y in a:
  ans += [x] * y
print(ans[k-1])

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split(" "))
a = [list(map(int, input().split(" "))) for i in range(n)]
count = 0
for x, y in a:
  count += y
  if k >= y:
    print(x)
    break
else:
  print("None")

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
a = []
b = []
Sum = 0
for i in range(N):
    x, y = map(int, input().split())
    a.append(x)
    b.append(y)
s = [*range(len(a))]
sort_s = sorted(s, key = lambda i: a[i])
sort_a = [a[i] for i in sort_s]
sort_b = [b[i] for i in sort_s]
for i in range(N):
    Sum += b[i]
    if Sum >= K:
        print(a[i])
        break

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
a = []
b = []
Sum = 0
for i in range(N):
    x, y = map(int, input().split())
    a.append(x)
    b.append(y)
s = [*range(len(a))]
sort_s = sorted(s, key = lambda i: -a[i])
sort_a = [a[i] for i in sort_s]
sort_b = [b[i] for i in sort_s]
for i in range(N):
    Sum += b[i]
    if Sum >= K:
        print(a[i])
        break

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())
AA = list()
for i in range(N):
  a,b = map(int,input().split())
  for i in [a]*b:
    AA.append(i)
print(AA[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)]

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

for i in range(n):
    a, b = ab_list[i]
    sum_b += b
    if sum_b >= k:
        print(a)
        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 K <= cnt:
    print(a)
    break

Submission status: Wrong Answer

Solution code:
# C - Big Array
def main():
    n, k = map(int, input().split())
    ab = [list(map(int, input().split())) for _ in range(n)]

    i = 0

    while k > 0:
        k -= ab[i][1]
        i += 1
    else:
        print(ab[i-1][0])

if __name__ ==  "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# C - Big Array
def main():
    n, k = map(int, input().split())
    b_t = 0

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

        if b_t >= k:
            print(a)
            exit()


if __name__ ==  "__main__":
    main()

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

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
S = set()
D = dict()
for _ in range(n):
    a, b = map(int, input().split())
    if a in S:
        D[a] += b
    else:
        S.add(a)
        D[a] = b
L = sorted(S)
cnt=0
for l in L:
    if cnt >= k:
        print(l)
        break
    cnt += D[l]

Submission status: Wrong Answer

Solution code:
import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]

import string

def main():
    n,k = i_map()

    cnt = 0
    while True:
        a,b = i_map()
        cnt += b
        if cnt >= k:
            print(a)
            break

if __name__=="__main__":
    main()

Submission status: Wrong Answer

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

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

    for key, v in arrdict.items():
        k -= v
        if k <= 0:
            ans = key
            break
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
import sys
mod=10**9+7 ; inf=float("inf")
from math import sqrt, ceil
from collections import deque, Counter, defaultdict #すべてのkeyが用意されてる defaultdict(int)で初期化
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from decimal import ROUND_HALF_UP,Decimal  #変換後の末尾桁を0や0.01で指定
  #Decimal((str(0.5)).quantize(Decimal('0'), rounding=ROUND_HALF_UP))
from functools import lru_cache
from bisect import bisect_left as bileft, bisect_right as biright
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#ソート、"a"+"b"、再帰ならPython3の方がいい
#######ここから天ぷら########

A=[0]*(10**5+1)
for i in range(n):
    a,b=map(int,input().split())
    A[a]+=b 
R=[0]*(n+1)
for i  in range(n):
    R[i+1]=R[i]+A[i+1]
print(bileft(R,k))

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
import sys
mod=10**9+7 ; inf=float("inf")
from math import sqrt, ceil
from collections import deque, Counter, defaultdict #すべてのkeyが用意されてる defaultdict(int)で初期化
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from decimal import ROUND_HALF_UP,Decimal  #変換後の末尾桁を0や0.01で指定
  #Decimal((str(0.5)).quantize(Decimal('0'), rounding=ROUND_HALF_UP))
from functools import lru_cache
from bisect import bisect_left as bileft, bisect_right as biright
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#ソート、"a"+"b"、再帰ならPython3の方がいい
#######ここから天ぷら########

A=[0]*(10**5+1)
for i in range(n):
    a,b=map(int,input().split())
    A[a]+=b 
R=[0]*n
for i  in range(n-1):
    R[i+1]=R[i]+A[i+1]
print(bileft(R,k))

Submission status: Wrong Answer

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

for i in range(n):
    a, b = map(int, input().split())
    count = b+count
    if count >= k:
        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())


judge = 0
dic = {}


for i in range(n):
    if a[i] in dic:
        dic[a[i]] += b[i]
    else:
        dic[a[i]] = b[i]
#print(dic)
dic = list(dic.items())
#print(dic)


for i in range(10**9):
    if judge >= k:
        print(dic[i-1][0])
        break
    else:
        judge += int(dic[i][1])
    #print(judge)

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


judge = 0
dic = {}


for i in range(n):
    if a[i] in dic:
        dic[a[i]] += b[i]
    else:
        dic[a[i]] = b[i]
#print(dic)
dic = list(dic.items())
#print(dic)


for i in range(10*9):
    if judge >= k:
        print(dic[i-1][0])
        break
    else:
        judge += int(dic[i][1])
    #print(judge)

Submission status: Wrong Answer

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

cnt=0
while cnt<K:
    a,b=map(int,input().split())
    cnt+=b
    if K<=cnt:break
print(a)

Submission status: Wrong Answer

Solution code:
#
# abc061 c
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3 4
1 1
2 2
3 3"""
        output = """3"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """10 500000
1 100000
1 100000
1 100000
1 100000
1 100000
100000 100000
100000 100000
100000 100000
100000 100000
100000 100000"""
        output = """1"""
        self.assertIO(input, output)


def resolve():
    N, K = map(int, input().split())
    D = [list(map(int, input().split())) for _ in range(N)]

    t = 0
    for d in D:
        t += d[1]
        if t >= K:
            print(d[0])
            break


if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

cnt = 0
m = 0
while m < k:
    a, b = q[cnt]
    m += b
    cnt += 1
print(a)

Submission status: Wrong Answer

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

for i in list(ar.keys()):
    k -= ar[i]
    if k <= 0:
        print(i)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

    c = 0
    for p in pair:
        a, b = p
        c += b
        if c >= K:
            print(a)
            exit()

if __name__ == "__main__":
    main2()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
c=''
for i in range(n):
    a,b=input().split()
    c+=a*int(b)
    if len(c)>k:
        break
print(c[k-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

    ins_count = 0

    for i in range(1, N + 1):
        ins_count += ins_num[i]

        if ins_count >= K:
            print(i)
            exit()

if __name__ == "__main__":
    main2()

Submission status: Wrong Answer

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

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

    ins_num_sum = [0 for i in range(N + 1)]
    ins_num_sum[1] = ins_num[1]
    for i in range(2, N + 1):
        ins_num_sum[i] =  ins_num[i] + ins_num_sum[i - 1]

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

    ins_count = 0

    for i in range(1, N + 1):
        if ins_count + ins_num[i] >= K:
            print(i)
        else:
            ins_count += ins_num[i]

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
a,b=map(int, input().split()) 
c=[list(map(int,input().split())) for _ in range(a)]

ans = 0

for i in range(a):
    ans += c[i][1]
    if ans >= b :
        print(c[i][0])
        sys.exit()

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(N)]
B = {}
cnt = 0
i = 0
while K>cnt:
    cnt += A[i][1]
    B[i] = A[i][1]
    i += 1
B[i-1] = K-(cnt-A[i-1][1])
B = list(B.items())
B = [[B[i][0],B[i][1]] for i in range(len(B))]
for j in range(len(B)):
    B[j][0] = A[B[j][0]][0]
B = sorted(B,key=lambda x:x[0])
cnt = 0
i = 0
while K>cnt:
    cnt += B[i][1]
    i += 1
print(B[i-1][0])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N, K, *AB = map(int, open(0).read().split())
li = []
for a, b in zip(*[iter(AB)] * 2):
    if K > b:
        K -= b
    else:
        print(a)
        break

Submission status: Wrong Answer

Solution code:
def main():
    n, k = map(int, input().split())
    inlis = list()

    for _ in range(n):
        alis = list(map(int, input().split()))
        inlis.append(alis)
    
    tmp = k
    i = 0

    while tmp > 0:
        tmp -= inlis[i][1]

        if tmp > 0:
            i += 1    
        else:
            print(inlis[i][0])
            exit()



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    n, k = map(int, input().split())
    inlis = list()

    for _ in range(n):
        alis = list(map(int, input().split()))
        inlis.append(alis)
    
    tmp = 0
    i = 0

    while tmp < k:
        tmp += inlis[i][1]
        if tmp < k:
            i += 1
            
        else:
            print(inlis[i][0])
            exit()



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    n, k = map(int, input().split())
    inlis = list()

    for _ in range(n):
        alis = list(map(int, input().split()))
        inlis.append(alis)
    
    tmp = 0
    i = 0

    while tmp <= k:
        tmp += inlis[i][1]
        if tmp < k:
            i += 1
            
        else:
            print(inlis[i][0])
            exit()



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import itertools

n, k = list(map(int, input().split()))
ab = [[] for _ in range(n)]
for i in range(n):
    ab[i] = list(map(int, input().split()))
az, bz = list(zip(*ab))

accb = list(itertools.accumulate(bz))
idx = 0
for j, v in enumerate(accb):
    if k <= v:
        idx = j
        break
print(az[idx])

Submission status: Wrong Answer

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

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

for i in x:
  k-=i[1]
  if k<=0:
    print(i[0])
    exit()

Submission status: Wrong Answer

Solution code:
import sys
#import string
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
#import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    #n = int(stdin.readline().rstrip())
    n,k = map(int, stdin.readline().rstrip().split())
    #l = list(map(int, stdin.readline().rstrip().split()))
    #ab = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    #zeros = [[0] * w for i in range(h)]
    a = [0]*(10**5+1)
    for i in range(n):
        A,B = map(int, stdin.readline().rstrip().split())
        a[A] += B
    j = 0
    for i in range(10**5):
        j += a[i]
        if j >= k:
            print(i)
            exit()



if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

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

placed = 0
for i in range(N):
  a, b = [int(n) for n in input().split(" ")]
  placed += b
  if placed >= K:
    print(a)
    break

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
a = []
b = []
for _ in range(n):
    c,d = map(int,input().split())
    a.append(c)
    b.append(d)
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())
cnt = 0
ch = 0
for i in range(n):
    a,b = map(int,input().split())
    if ch == 0:
        cnt += b
        if cnt >= k:
            print(a)
            ch = 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

count=0
for i in range(N):
    count=count+B[i]
    if count>=T:
        print(A[i])
        exit()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
d={}
for _ in range(n):
    a,b=map(int,input().split())
    if a in d:
        d[a]+=b
    else:
        d[a]=b
s=0
for i in d:
    s+=d[i]
    if s>=k:
        print(i)
        exit()

Submission status: Wrong Answer

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

f = True
now = 0
res = -1
for _ in range(N):
    a, b = map(int, input().split())
    now += b
    if f:
        if K <= now:
            res = a
            f = False
print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
import copy
N,K = map(int, input().split())
a1,b1 = map(int,input().split())
lis = [a1 for i in range(b1)]
for j in range(N-1):
    a, b = map(int, input().split())
    index = 0
    ls = copy.copy(lis)
    while True:
        left = ls[:len(ls)//2]
        right = ls[len(ls)//2:]
        if len(left)==0:
            if right[0] > a:
                index+=1
                break
            else:
                break
        elif left[-1] <= a <= right[0]:
            index += len(left)+1
            break
        elif a > right[0]:
            index += len(left)
            ls = copy.copy(right)
        elif a < left[-1]:
            ls = copy.copy(right)
    addls = [a for i in range(b)]
    lis[index:1] = addls
print(lis[K-1])

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

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

Submission status: Wrong Answer

Solution code:
import sys

N,K=map(int,input().split())
D=dict()
for i in range(N):
  a,b=input().split()
  try:
    D[a]+=int(b)
  except:
    D[a]=int(b)

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


for k,v in D:
  K-=v
  if K<=0:
    print(k)
    break

Submission status: Wrong Answer

Solution code:
def solve():
  ans = 0
  cnt = 0
  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())
  for a,b in zip(A,B):
    cnt += b
    if cnt>=K:
      ans = a
      break
  return ans
print(solve())

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
B=[0]*100001

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

Submission status: Wrong Answer

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

for i in range(1,n+1):
  a,b=map(int,input().split())
  B[a]+=b
for j in range(1,n+1):
  k-=B[j]
  if k<=0:
    print(j)
    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())
a = [list(map(int,input().split())) for _ in range(N)]
cnt  = 0
for i in range(N):
    cnt += a[i][1]
    if cnt >= K:
        print(a[i][0])
        exit()