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())
sumb = 0
for i in range(N):
    a, b = map(int, input().split())
    sumb += b
    if sumb >= K:
        print(a)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

    d = {}
    key_list = []

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

        key_list.append(a)

    key_list = sorted(key_list)

    curr_num = 0
    for key in key_list:
        curr_num += d[key]
        if curr_num >= k:
            print(key)
            return


if __name__ == "__main__":
    f()

Submission status: Wrong Answer

Solution code:
# cook your dish here
n,k = map(int,input().split())
c = 0
for i in range(n):
    a,b = map(int,input().split())
    d = c
    c += b
    if d +1 <= k and k <= c:
        print(a)

Submission status: Wrong Answer

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

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

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

ab.sort(key=lambda x:x[0])
res = k
for a, b in ab:
    res -= b
    
    if res <= 0:
        print(a)
        
        break

Submission status: Wrong Answer

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

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

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

#print(numbers)
"""
kugiri = numbers[0][1]
i = 0

while K > kugiri:
    i += 1
    kugiri += numbers[i][1]
"""
kugiri = 0
for i in range(N):
    kugiri += numbers[0][1]
    if K <= kugiri:
        break

print(numbers[i][0])

Submission status: Wrong Answer

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

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

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

#print(numbers)

kugiri = numbers[0][1]
i = 0
while K > kugiri:
    i += 1
    kugiri += numbers[i][1]

print(numbers[i][0])

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
import sys
sdin = sys.stdin.readline

N, K = map(int, sdin().split())
AB = []
for _ in range(N):
    AB.append(tuple(map(int, sdin().split())))
    
    
dic = defaultdict(int)

# 辞書に追加していく
for a,b in AB:
    dic[a] += b
    
# キーの昇順リストつくる
key_list = list(dic.keys())

# resが0になるまで引いていく
res = K
i = 0
while res > 0:
    res -= dic[key_list[i]]
    ans = key_list[i]
    i += 1
    
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

b_sum = 0
for a, b in ab:
    b_sum += b
    if b_sum >= K:
        print(a)
        break

Submission status: Wrong Answer

Solution code:
#-*-coding:utf-8-*-

def main():
    n, k = map(int, input().split())
    ab_list = [list(map(int, input().split())) for _ in range(n)]

    cnt = 0

    for ab in ab_list:
        cnt += ab[1]
        if cnt >= k:
            print(ab[0])
            break

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def inpl(): return input().split()

n, k = map(int, inpl())
d = dict()
r_i = 0
for i in range(n):
    a, b = map(int, inpl())
    r_i += b#何番目まで値aを取るか
    d[r_i] = a#r_iまでの区間の数値a

M = list(tuple((r_i, v)) for r_i, v in d.items())
M = sorted(M, key=lambda x:x[0])

for r_i, v in M:
    if r_i >= k:
        ans = v
        break
print(ans)

Submission status: Wrong Answer

Solution code:
def inpl(): return input().split()

n, k = map(int, inpl())
d = dict()
r_edge_idx = 0
for i in range(n):
    a, b = map(int, inpl())
    r_edge_idx += b#何番目まで値aを取るか
    d[r_edge_idx] = a#r_edge_idxまでの区間の数値a

r_edge_idxes = sorted(list(d.keys()))
ans = -1
for i in range(len(r_edge_idxes)):
    if r_edge_idxes[i] >= k:
        ans = d[r_edge_idxes[i]]
        break
print(ans)

Submission status: Wrong Answer

Solution code:
def inpl(): return input().split()

n, k = map(int, inpl())
d = dict()
r_edge_idx = 0
for i in range(n):
    a, b = map(int, inpl())
    r_edge_idx += b#右端のindex
    d[r_edge_idx] = a#r_edge_idxまでの区間の数値a

r_edge_idxs = sorted(list(d.keys()))
ans = -1
for i in range(len(r_edge_idxs)):
    if r_edge_idxs[i] >= k:
        ans = d[r_edge_idxs[i]]
        break
print(ans)

Submission status: Wrong Answer

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

m_list = []

for i in range(n):
  m_tuple = tuple(map(int, input().split()))
  m_list.append(m_tuple)

num = m_list[0][0]

for a, b in m_list:
  if b >= k:
    num = a
    break
  else:
    k -= b

print(num)

Submission status: Wrong Answer

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

arr_num, arr_times = [], []

for i in range(N) :
    a, b = map(int, input().split())
    
    arr_num.append(a)
    arr_times.append(b)
    
cur_idx = 0

for i in range(N) :
    if cur_idx <= K :
        cur_idx += arr_times[i]
        
    if cur_idx >= K :
        print(arr_num[i])
        break

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split(' '))
tmp = [list(map(int, input().split(' '))) for _ in range(N)]
cumB = []
for i in range(N):
    if i == 0:
        cumB.append(tmp[0][1])
    else:
        cumB.append(cumB[i-1]+tmp[i][1])

A = [tmp[i][0] for i in range(N)]

for i in range(N):
    if K <= cumB[i]:
        print(A[i])
        break

Submission status: Wrong Answer

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

v = []
w = []
for i in range(n) :
    s, t = map(int, input().split())
    v.append(s)
    w.append(t)

v.sort()
i=int(0)
while k-w[i] > 0 :
    k-=w[i]
    i+=1

print(v[i])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,k = map(int, input().split())
ab = []
count = 0
ans = 0
for i in range(n):
    ab.append(list(map(int, input().split())))
    count += ab[i][1]
    if count >= k and ans == 0:
        ans = ab[i][0]
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)]
a.sort()
#print(a)
b=[]
c=0
for i,j in a:
    k-=j
    c=i
    if k<0: break
print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def m():
    n, k = map(int, input().split())
    t = [0] * (10**5 + 1)
    for i in range(n):
        a, b = map(int, input().split())
        t[a] += b
    index = 0
    for j in range(k):
        for _ in range(index, n+1):
            if t[index] == 0:
                index += 1
            else:
                break
        t[index] -= 1
    return index
print(m())

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
cur = 0
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:
a=[];n,k=map(int,input().split())
for _ in[0]*n:
    b,c=map(int,input().split())
    if len(a)<k or a[~-k]<b:
        a+=[b]*c
        a=sorted(a)[:k]
print(a[~-k])

Submission status: Wrong Answer

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

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:
N, K = map(int,input().split())
A = [list(map(int,input().split())) for k in range(N)]

while True:
    for a in A:
        K -= a[1]
        if K <= 0:
            print(a[0])
            exit(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split(' '))
ary = [list(map(int, input().split(' '))) for _ in range(N)]
part = 0
for a, b in ary:
    part += b
    if part >= K:
        print(a)
        break

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem C

if __name__ == '__main__':
    from bisect import bisect_left

    n, k = list(map(int, input().split()))
    a = [0 for _ in range(n)]
    summed_b = [0] + [0 for _ in range(n)]

    for i in range(n):
        line = list(map(int, input().split()))
        a[i] = line[0]
        summed_b[i + 1] = summed_b[i] + line[1]

    print(a[bisect_left(summed_b, k) - 1])

Submission status: Wrong Answer

Solution code:
def inpl(): return list(map(int, input().split()))
N, K = inpl()
ab = []
for i in range(N):
    temp = inpl()
    ab.append(temp)
sorted_ab = sorted(ab)
print(sorted_ab)
c = 0
for i in sorted_ab:
    c += i[1]
    if c>=K:
        print(i[0])
        break

Submission status: Wrong Answer

Solution code:
def inpl(): return list(map(int, input().split()))
N, K = inpl()
ab = []
for i in range(N):
    temp = inpl()
    ab.append(temp)
sorted_ab = sorted(ab)
c = 0
for i in ab:
    c += i[1]
    if c>=K:
        print(i[0])
        break

Submission status: Wrong Answer

Solution code:
n, k = map(int,input().split())
dcic = {}
aa = set([])
for i in range(n):
    a,b = map(int,input().split())
    aa.add(a)
    if a in dcic:
        dcic[a] = dcic[a] + b
    else:
        dcic.update({a:b})
        
bb = list(sorted(list(aa)))
cc = 0
ccc = 0
for i in range(len(bb)):
    if k - dcic[bb[i]] > 0:
        k = k - dcic[bb[i]]
        cc = bb[i]
    else:
        ccc = bb[i]
        
print(ccc)

Submission status: Wrong Answer

Solution code:
n, k = map(int,input().split())
dcic = {}
aa = set([])
for i in range(n):
    a,b = map(int,input().split())
    aa.add(a)
    if a in dcic:
        dcic[a] = dcic[a] + b
    else:
        dcic.update({a:b})
        
bb = list(sorted(list(aa)))
cc = 0
ccc = 0
for i in range(len(bb)):
    if k - dcic[bb[i]] > -1:
        k = k - dcic[bb[i]]
        cc = bb[i]
    else:
        ccc = bb[i]
        
print(cc)

Submission status: Wrong Answer

Solution code:
n, k = map(int,input().split())
dcic = {}
aa = set([])
for i in range(n):
    a,b = map(int,input().split())
    aa.add(a)
    if a in dcic:
        dcic[a] = dcic[a] + b
    else:
        dcic.update({a:b})
        
bb = list(sorted(list(aa)))
cc = 0
ccc = 0
for i in range(len(bb)):
    if k - dcic[bb[i]] > -1:
        k = k - dcic[bb[i]]
        cc = bb[i]
    else:
        None
        
print(cc)

Submission status: Wrong Answer

Solution code:
n, k = map(int,input().split())
dcic = {}
aa = set([])
for i in range(n):
    a,b = map(int,input().split())
    aa.add(a)
    if a in dcic:
        dcic[a] = dcic[a] + b
    else:
        dcic.update({a:b})
        
bb = list(sorted(list(aa)))
cc = 0
for i in range(len(bb)):
    if k - dcic[bb[i]] > -1:
        k = k - dcic[bb[i]]
    else:
        cc = bb[i]
        
print(cc)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, k = map(int,input().split())
 
aa = 0
aaa = 0
for i in range(n):
    a,b = map(int,input().split())
    if k - b > -1:
      aa = a
      k = k - b
    else:
      aaa = a
print(aa)

Submission status: Wrong Answer

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

aa = 0
aaa = 0
for i in range(n):
    a,b = map(int,input().split())
    if k - b > -1:
      aa = a
      k = k - b
    else:
      aaa = a
print(aaa)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result

arr_data = getinputdata()

#回数
n = int(arr_data[0][0])

#番目
k = int(arr_data[0][1])

s=""

mysum=0

for i in range(1, 1 + n):

    cnt = int(arr_data[i][1])
    j = arr_data[i][0]

#    print(mysum)
    
    if k<=mysum+cnt:
        
#        arr=[j]*cnt
        
#        print(k,mysum,arr)
        
        print(j)
        
        break
        
    else:
        
        
        mysum+=cnt

Submission status: Wrong Answer

Solution code:
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result

arr_data = getinputdata()

#回数
n = int(arr_data[0][0])

#番目
k = int(arr_data[0][1])

s=""

mysum=0

for i in range(1, 1 + n):

    cnt = int(arr_data[i][1])
    j = arr_data[i][0]

#    print(mysum)
    
    if k<=mysum+cnt:
        
        arr=[j]*cnt
        
#        print(k,mysum,arr)
        
        print(arr[k-1-mysum])
        
        break
        
    else:
        
        
        mysum+=cnt

Submission status: Wrong Answer

Solution code:
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result

arr_data = getinputdata()

#回数
n = int(arr_data[0][0])

#番目
k = int(arr_data[0][1])

s=""

for i in range(1, 1 + n):

    cnt = int(arr_data[i][1])
    j = arr_data[i][0]

    s+=str(cnt * j)

    if k<=len(s):

#        print(s)
        print(s[k-1])
        break;

Submission status: Wrong Answer

Solution code:
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result

arr_data = getinputdata()

#回数
n = int(arr_data[0][0])

#番目
k = int(arr_data[0][1])

#print(n,k)


arr=[]

for i in range(1,1+n):

#    print(arr_data[i])
    
    for j in range(0,int(arr_data[i][1])):
        
        arr.append(int(arr_data[i][0]))
        
        
#print(arr)        
print(arr[k-1])

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# hello worldと表示する
n,m=map(int,input().split())
t=[list(map(int,input().split())) for i in range(n)]
s=0
for j in t:
    if s<m<=s+j[1]:
        print(j[0])
        break
    s=s+j[1]

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
t = [[0,0] for i in range(n)]
for i in range(n):
    a,b = map(int,input().split())
kk = 0
t = sorted(t, key=lambda t:t[0])

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

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
t = [[0,0] for i in range(n)]
for i in range(n):
    a,b = map(int,input().split())
kk = 0
t = sorted(t, key=lambda t:t[0])

for i in range(n):
    kk += t[i][1]
    if kk >= k:
        print(t[i][1])
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

idx = 0
ret = None
for a, b in AB:
    if idx + b >= K:
        ret = a
        break
    idx += b 

print(ret)

Submission status: Wrong Answer

Solution code:
import collections

n, k = map(int, input().split())
res = []
for i in range(n):
    a, b = map(int, input().split())
    for j in range(b):
        res.append(a)
res_dict = collections.Counter(res)

tmp = 0
for m, l in res_dict.items():
    tmp += l
    if tmp >= k:
        print(m)
        break

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())
S = 0
for i in range(N):
    if S<K<=S+b[i]:
        print(a[i])
        break
    S += b[i]

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())
S = 0
for i in range(N):
    if S<K<=S+b[i]:
        print(a[i])
        exit()
    S += b[i]

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())
S = 0
for i in range(N):
    if S<=K<=S+b[i]:
        print(a[i])
        exit()
    S += b[i]

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
num=[list(map(int,input().split()))for _ in range(n)]
p=0
num.sort()
for i in range(n):
    p+=num[i][1]
    if k<=p:
        ans=num[i][0]
        exit()
print(ans)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
num={}
for i in range(n):
    a,b=map(int,input().split())
    num[a]=b
num_sort=sorted(num.items())
total=0
for i,j in num_sort:
    total+=j
    if k<=total:
        print(i)
        exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

N,K = map(int,input().split(" "))
num = []
prev = 0
for i in range(N):
	a,b = map(int,input().split(" "))
	num.append([a,b+prev])
	prev += b

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

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split(" "))
num = {}
for i in range(N):
	a,b = map(int,input().split(" "))
	if a in num:
		num[a] += b
	else:
		num[a] = b

print(max(num.items(),key=lambda x:x[1])[0])

Submission status: Wrong Answer

Solution code:
def c_BigArray(N, K, I):
    from collections import defaultdict
    d = defaultdict(int)
    for a, b in I:
        d[a] += b
    tmp = 0
    for k, v in d.items():
        tmp += v
        if tmp >= K:
            return k
    return None

N,K = [int(i) for i in input().split()]
I = [[int(i) for i in input().split()] for j in range(N)]
print(c_BigArray(N, K, I))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a, b = zip(
        *sorted(
            (tuple(map(int, input().split())) for i in range(n)), key=lambda x:x[1]))

rank = itertools.accumulate(b)

for i, r in enumerate(rank):
    if  k <= r:
        print(a[i])
        break

Submission status: Wrong Answer

Solution code:
line_one = raw_input().split()
n = int(line_one[0])
k = int(line_one[1])

l = []
#d = {}
for i in range(n):
    line_one2 = raw_input().split()
    a1 = int(line_one2[0])
    b1 = int(line_one2[1])
    l.append( ( a1, b1 ))
    #if a1 in l:
    #    #d[a1] += b1
    #    l[a1][1] += b1
    #else:
    #    l.append( ( a1, b1 ))
    #    #//d[a1] = b1

#l.sort()
l = sorted(l, key=lambda x: x[1])
count = 0
for item in l:
    count += item[1]
    if k <= count:
        print item[0]
        break

Submission status: Wrong Answer

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

l = []
d = {}
for i in range(n):
    a1, b1 = map(int, raw_input().split(" "))
    if a1 in l:
        d[a1] += b1
    else:
        l.append(a1)
        d[a1] = b1

l.sort()
for item in l:
    if k <= sum(d.values()[:item]):
        print item
        break

Submission status: Wrong Answer

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

l = []
d = {}
for i in range(n):
    a1, b1 = map(int, raw_input().split(" "))
    if a1 in l:
        d[a1] += b1
    else:
        l.append(a1)
        d[a1] = b1

l.sort()
#count = 0
for item in l:
    #count += d[item]
    if k <= d[item]:
        print item
        break

Submission status: Wrong Answer

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

d = {}
for i in range(n):
    a1, b1 = map(int, raw_input().split(" "))
    if a1 in d.keys():
        d[a1] += b1
    else:
        d[a1] = b1


l = sorted(d.items(), key=lambda x: x[0])
#print (l)
count = l[0][1]
for e, item in enumerate(l):
    if k <= count + item[1]:
        print item[0]
        break
    else:
        count += item[1]

Submission status: Wrong Answer

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

d = {}
for i in range(n):
    a1, b1 = map(int, raw_input().split(" "))
    if a1 in d.keys():
        d[a1] += b1
    else:
        d[a1] = b1


l = sorted(d.items(), key=lambda x: x[0])
count = l[0][1]
for e, item in enumerate(l):
    if k <= count:
        print item[0]
        break
    else:
        if e != 0:
            count += item[1]

Submission status: Wrong Answer

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

d = {}
for i in range(n):
    a1, b1 = map(int, raw_input().split(" "))
    if a1 in d.keys():
        d[a1] += b1
    else:
        d[a1] = b1


l = sorted(d.items(), key=lambda x: x[0])
count = l[0][1]
for e, item in enumerate(l):
    if k <= count:
        print item[0]
        break
    else:
        count += item[1]

Submission status: Wrong Answer

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

d = {}
count = 0
for i in range(n):
    a1, b1 = map(lambda x: int(x), raw_input().split(" "))
    if a1 in d.keys():
        d[a1] += b1
    else:
        d[a1] = b1


l = sorted(d.items(), key=lambda x: x[0])
count = l[0][1]
print (count)
for e, item in enumerate(l):
    if k <= count:
        print item[0]
        break
    if e != 0:
        count += item[1]

Submission status: Wrong Answer

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

d = {}
count = 0
for i in range(n):
    a1, b1 = map(lambda x: int(x), raw_input().split(" "))
    #Acount += b1
    if a1 in d.keys():
        d[a1] += b1
    else:
        d[a1] = b1


l = sorted(d.items(), key=lambda x: x[0])
#print (l)
count = l[0][1]
for item in l:
    if k <= count:
        print item[0]
        break
    count += item[1]

Submission status: Wrong Answer

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

d = {}
for i in range(n):
    a1, b1 = map(lambda x: int(x), raw_input().split(" "))
    #Acount += b1
    if a1 in d.keys():
        d[a1] += b1
    else:
        d[a1] = b1

#print (d)
l = sorted(d.items(), key=lambda x: x[0])
#print ("HOGEHOGE")
#print (l)
for item in l:
    if k <= item[1]:
        print item[0]
        break

Submission status: Wrong Answer

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

d = {}
d2 = {}
count = 0
for i in range(n):
    a1, b1 = map(lambda x: int(x), raw_input().split(" "))
    count += b1
    if a1 in d.keys():
        d[a1] += count
    else:
        d[a1] = count

for item in sorted(d.items(), key=lambda x: x[1]):
    if item[1] >= k:
        print item[0]
        break

Submission status: Wrong Answer

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

d = {}
d2 = {}
count = 0
for i in range(n):
    a1, b1 = map(lambda x: int(x), raw_input().split(" "))
    count += b1
    if a1 in d.keys():
        d[a1] += count
    else:
        d[a1] = count

for item in sorted(d.items()):
    if item[1] >= k:
        print item[0]
        break

Submission status: Wrong Answer

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

d = {}
d2 = {}
count = 0
for i in range(n):
    a1, b1 = map(lambda x: int(x), raw_input().split(" "))
    count += b1
    if a1 in d.keys():
        d[a1] += count
    else:
        d[a1] = count

for item in sorted(d.items()):
    if item[1] >= k:
        print item[0],
        break

Submission status: Wrong Answer

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

a, b = zip(*(tuple(map(int, input().split())) for i in range(n)))

rank = itertools.accumulate(b)
#print(list(rank))

for i, r in enumerate(rank):
    if  k <= r:
        print(a[i])
        break

Submission status: Wrong Answer

Solution code:
import numpy as np

n, k = map(int, input().split())
z = np.zeros(10**5 + 1, dtype = np.int32)
for i in range(n):
  a, b = map(int, input().split())
  z[a] += b

a = 0
for i in range(1, 10**5 + 1):
  if k <= z[i]:
    a = i
    break
  k -= z[i]

print(a)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

a = 0
for x, y in Counter(d).most_common()[:-n-1:-1]:
  if k <= y:
    a = x
    break
  k -= y

print(a)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

a = 0
for x, y in Counter(d).most_common()[:-n-1:-1]:
  k -= y
  if k <= 0:
    a = x
    break

print(a)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

AB.sort()
for ab in AB:
    K -= ab[1]
    if K <= 0:
        print(ab[0])
        exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
val = [int(x) for x in input().split()]
dict = {}
for i in range(val[0]):
    num = [int(x) for x in input().split()]
    if num[0] in dict:
        dict[num[0]] += num[1]
    else:
        dict[num[0]] = num[1]

res = 0
for i, j in dict.items():
    res += j
    if val[1] <= res:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
val = [int(x) for x in input().split()]
dict = {}
for i in range(val[0]):
    num = [int(x) for x in input().split()]
    if num[0] in dict:
        dict[num[0]] += num[1]
    else:
        dict[num[0]] = num[1]

res = 0
for i, j in dict.items():
    res += j
    if val[1]-1 < res:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
def solve():
    n, k = list(map(int, input().split(" ")))
    A, B = [], []
    for _ in range(n):
        tmp_a, tmp_b = list(map(int, input().split(" ")))
        A.append(tmp_a)
        B.append(tmp_b)

    target = 0
    for i, ele_b in enumerate(B):
        target += ele_b
        if target >= k:
            print(A[i])
            break


solve()