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,raw_input().split())
l = []
s = list()
for i in range(n):
    v,count = map(int,raw_input().split())
    l.append((count,v))

sorted(l, key=lambda x: x[1])

countTmp = 0
for count,v in l:
    countTmp = countTmp + count
    if k <= countTmp:
       print v
       break;

Submission status: Wrong Answer

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

  
        
count =0
for i in sorted(ab_list.items(), key=lambda x: x[0]):
    count+=i[1]
    if (count >= K):
        print(i[0])
        break

Submission status: Wrong Answer

Solution code:
key_num, tmp = map(int, input().split())
#if key_num < 1 or 10 ** 5 < key_num:
#    exit()
x = 0
input_data = []
while x < key_num:
    a, b = map(int, input().split())
#    if a < 1 or 10 ** 5 < a:
#        exit()
#    if b < 1 or 10 ** 5 < b:
#        exit()
#    N.append(a)
    for i in range(b):
        input_data.append(a)
#    K.append(b)
    x += 1
#print(N, K)
#input_data = []
#n = 0
#for i in N:
#    now = 1
#    while now <= K[n]:
#        input_data.append(i)
#        now += 1
#    n += 1
#print(input_data)
input_data.sort()
print(input_data[key_num])

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
total = 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:
n,k=map(int,input().split())
list=[]
for i in range(n):
    a,b=map(int,input().split())
    list.append((a,b))
list.sort()

count=0
for i in range(n):
    count+=list[i][1]
    if count>=k: ans=a; break


print(ans)

Submission status: Wrong Answer

Solution code:
N = []
K = []
key_num, tmp = map(int, input().split())
if key_num < 1 or 10 ** 5 < key_num:
    exit()
x = 0
input_data = []
while x < key_num:
    a, b = map(int, input().split())
    if a < 1 or 10 ** 5 < a:
        exit()
    if b < 1 or 10 ** 5 < b:
        exit()
    N.append(a)
    for i in range(b):
        input_data.append(a)
#    K.append(b)
    x += 1
#print(N, K)
#input_data = []
#n = 0
#for i in N:
#    now = 1
#    while now <= K[n]:
#        input_data.append(i)
#        now += 1
#    n += 1
#print(input_data)
input_data.sort()
print(input_data[key_num])

Submission status: Wrong Answer

Solution code:
import numpy as np
n,k=map(int,raw_input().split())
a=[]
b=[]
for i in range(n):
    aa,bb=map(int,raw_input().split())
    a.append(aa)
    b.append(bb)
a=np.array(a)
b=np.array(b)


c=np.cumsum(b)
z=a[c>=k]
print(z[0])

Submission status: Wrong Answer

Solution code:
import numpy as np
n,k=map(int,raw_input().split())
a=[]
b=[]
for i in range(n):
    aa,bb=map(int,raw_input().split())
    a.append(aa)
    b.append(bb)
a=np.array(a)
b=np.array(b)

c=np.cumsum(b)
z=a[c<k+1]
print(z[-1])

Submission status: Wrong Answer

Solution code:
import numpy as np
n,k=map(int,raw_input().split())
a=[]
b=[]
for i in range(n):
    aa,bb=map(int,raw_input().split())
    a.append(aa)
    b.append(bb)
a=np.array(a)
b=np.array(b)

c=np.cumsum(b)
z=a[c<k]
print(z[-1])

Submission status: Wrong Answer

Solution code:

n,k = map(int,raw_input().split())
l = []
for i in range(n):
    #v,count = list(raw_input().split())
    v,count = map(int,raw_input().split())
    l.append((count,v))

sorted(l, key=lambda x: x[1])

count_sum = 0
ans = 0
for count,v in l:
    count_sum = count_sum + count
    if count_sum >= k:
        ans = v
        break
print ans

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
import collections
n,k = [int(x) for x in sys.stdin.readline().split()]
r = collections.defaultdict(int)
for i in range(n):
	a, b = [int(x) for x in sys.stdin.readline().split()]
	r[a] += b
d = sorted(r.items())
c = 0
for i,j in r.items():
	c += j
	if c >= k:
		print(i)
		break

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
import collections
n,k = [int(x) for x in sys.stdin.readline().split()]
r = collections.defaultdict(int)
for i in range(n):
	a, b = [int(x) for x in sys.stdin.readline().split()]
	r[a] += b
d = sorted(r.items())
print(d)
c = 0
for i,j in r.items():
	c += j
	if c >= k:
		print(i)
		break

Submission status: Wrong Answer

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

for i in range(n):
    a,b = [int(i) for i in input().split()]
    if b_num < k:
        tmp = [a] * b
        ls.extend(tmp)
        #ls.sort()
        b_num += b
    else:
        if(a < min(ls)):
            tmp = [a] * b
            ls.extend(tmp)

ls.sort()
print(ls[k-1])

Submission status: Wrong Answer

Solution code:
N = []
K = []
key_num, tmp = map(int, input().split())
x = 0
input_data = []
while x < key_num:
    a, b = map(int, input().split())
    N.append(a)
#    for i in range(b):
#        input_data.append(a)
    K.append(b)
    x += 1
#print(N, K)
input_data = []
n = 0
for i in N:
    now = 1
    while now <= K[n]:
        input_data.append(i)
        now += 1
    n += 1
#print(input_data)
input_data.sort()
print(input_data[key_num])

Submission status: Wrong Answer

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

x = input()
y=[]
y=x.split(" ")
N=int(y[0])
K=int(y[1])

tage={}
for i in range(N):
	temp1=input()
	temp2=temp1.split(" ")
	mynum=int(temp2[0])
	times=int(temp2[1])
	if mynum in tage:
		tage[mynum]=tage[mynum] + times
	else:
		tage[mynum]=times

sum=0
past=tage
for i,j in sorted(tage.items()):
	sum+=j
	if sum >= K:
		print(i)

Submission status: Wrong Answer

Solution code:
n = input()
tmp_n = n.split(" ")

N = tmp_n[0]
K = tmp_n[1]
n_list = []

for i in range(int(N)):
    num_arr = input()
    tmp_num = num_arr.split()
    
    num = tmp_num[0]
    count = tmp_num[1]

    for j in range(int(count)):
        n_list.append(int(num))
    
print(n_list[int(K)-1])

Submission status: Wrong Answer

Solution code:
N = []
K = []
key_num, tmp = map(int, input().split())
x = 0
input_data = []
while x < key_num:
    a, b = map(int, input().split())
    N.append(a)
    for i in range(b):
        input_data.append(a)
    x += 1
input_data.sort()
print(input_data[key_num])

Submission status: Wrong Answer

Solution code:
import numpy as np
n,k=map(int,raw_input().split())
a=[]
b=[]
for i in range(n):
    aa,bb=map(int,raw_input().split())
    a.append(aa)
    b.append(bb)
a=np.array(a)
b=np.array(b)



c=np.cumsum(b)
c=np.where(c>=k)[0]
print(a[c[0]])

Submission status: Wrong Answer

Solution code:
#nm = '3 4'.split(' ')
#print(abc)
nm = input().split(' ')
vv = []
ss =[]
vv.append(input().split(' '))

for i in range(int(nm[0])-1):
    a = input().split(' ')
    if int(a[0]) > int(vv[-1][0]):
        vv.append(a)
    else:
        vv.insert(0, a)

cou = 0
for i in vv:
    if  cou < int(nm[1]):    
        for f in range(int(i[0])):
            ss.append(int(i[1]))
    cou += int(i[0])


print(ss[int(nm[1])])

Submission status: Wrong Answer

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

  
        
count =0
for i in sorted(ab_list.items(), key=lambda x: x[0]):
    count+=i[1]
    if (count >= K):
        print(i[0])
        break

Submission status: Wrong Answer

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

for i in range(n):
    a,b = [int(i) for i in input().split()]
    if b_num < k:
        tmp = [a] * b
        ls.extend(tmp)
        ls.sort
        b_num += b
    else:
        if(a <= ls[-1]):
            tmp = [a] * b
            ls.extend(tmp)
            ls.sort
        
print(ls[k-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
from collections import defaultdict as dd
n,k = [int(x) for x in sys.stdin.readline().split()]
r = dd(int)
for i in range(n):
	a, b = [int(x) for x in sys.stdin.readline().split()]
	r[a] += b
c = 0
for i,j in r.items():
	c += j
	if c > k:
		print(i)
		break

Submission status: Wrong Answer

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

for i in range(n):
    a,b = [int(i) for i in input().split()]
    if b_num <= k:
        tmp = [a] * b
        ls.extend(tmp)
        ls.sort
        b_num += b
    else:
        if(a < ls[-1]):
            tmp = [a] * b
            ls.extend(tmp)
            ls.sort
        
print(ls[k-1])

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-
import sys
N, K = map(int, input().split())
a, b, ans = ( [], [], [] )
for tmp in range(N):
    a, b = map(int, input().split())
    ans.append((a,b))
ans.sort()
s = 0
for tmp in range(len(ans)):
    s += (ans[tmp])[1]
    if s >= 4:
        print((ans[tmp])[0])
        sys.exit()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

array = []
hoge  = []
n, k  = map(int, raw_input().split())

for i in xrange(n):
	a, b  = map(int, raw_input().split())
	array.append(a)
	hoge += [array[i]] * b
	if len(hoge) >= k:
		break


print(hoge[k - 1])

Submission status: Wrong Answer

Solution code:
# coding: utf-8
x={}
n,k=map(int,input().split())
for i in range(n):
    a,b=map(int,input().split())
    if a in x:
        x[a]+=b
    else:
        x[a]=b
x=sorted(x.items(),key=lambda x:x[0])
a=0
for i in x:
    a+=i[1]
    print(i)
    if(a>=k):
        print(i[0])
        break;

Submission status: Wrong Answer

Solution code:
N,K = map(int, input().split())
ab_list = {}
for i in range(N):
    a,b = map(int, input().split())
    if a in ab_list:
        ab_list[str(a)] += b
    else:
        ab_list[str(a)] = b
print(ab_list)
  
        
count =0
for i in sorted(ab_list.items(), key=lambda x: x[0]):
    count+=i[1]
    if (count >= K):
        print(i[0])
        break

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
c = []
for i in range(N):
	c.append(input().split())
	
c.sort()
d = []
e = []
f = 0
for i in range(N):
	e = [c[i][0]]
	e = e * int(c[i][1])
	d = d + e
	e = []
	f += int(c[i][1])
	if f >= K:
		break

print(d[K-1])

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
from collections import defaultdict as dd
n,k = [int(x) for x in sys.stdin.readline().split()]
r = dd(int)
for i in range(n):
	a, b = [int(x) for x in sys.stdin.readline().split()]
	r[a] += b
c = 0
for i,j in r.items():
	c += j
	if c >= k:
		print(i)
		break
	else:
		continue

Submission status: Wrong Answer

Solution code:
def flatten(nested_list):
    return [e for inner_list in nested_list for e in inner_list]
nk = input().split()
kai = int(nk[0])
banme = int(nk[1])
lis = []
i = 0
while(i < kai):
    c = input().split()
    a = int(c[0])
    b = int(c[1])
    n = 0
    tmplis = [a] * b
    lis.append(tmplis)
    i += 1
    pass
lis = flatten(lis)
slis = sorted(lis)
ans = slis[banme]
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
from collections import defaultdict as dd
n,k = [int(x) for x in sys.stdin.readline().split()]
r = dd(int)
for i in range(n):
	a, b = [int(x) for x in sys.stdin.readline().split()]
	r[a] += b
c = 0
print(r)
for i,j in r.items():
	c += j
	if c >= k:
		print(i)
		break
	else:
		continue

Submission status: Wrong Answer

Solution code:
nums = [int(x) for x in input().split()]
N = nums[0]
K = nums[1]
arr = []
memory = []
for i in range(N):
	nums = [int(x) for x in input().split()]
	arr.append(nums[0])
	memory.append(nums[1])

vol = 0;
for i in range(len(memory)):
	vol += memory[i]
	if vol >= K:
		print(arr[i])
		break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#nm = '3 4'.split(' ')
#print(abc)
nm = input().split(' ')
vv = []
for i in range(int(nm[0])):
    a = input().split(' ')
    for i in range(int(a[0])):
        vv.append(int(a[1]))
        
print(vv[int(nm[1])-1])

Submission status: Wrong Answer

Solution code:
def partition(array, pivot):
    bigger = []
    smaller = []
    equals = []
    for ele in array:
        if ele > pivot:
            bigger.append(ele)
        elif ele == pivot:
            equals.append(ele)
        elif ele < pivot:
            smaller.append(ele)
    return [smaller, equals, bigger]

n, k = map(int, raw_input().split())
sum = 0
array = []
for i in range(n):
    a, b = map(int, raw_input().split())
    for j in range(b):
        if k <= sum:
            break
        array.append(a)
    sum += b


while 1:
    pivot = array[(len(array))/2]
    smaller, equals, bigger = partition(array, pivot)
    slen = len(smaller)
    elen = len(equals)
    blen = len(bigger)
    if k <= slen:
        array = smaller
        break
    elif slen <= k and k <= elen + slen:
        print equals[k - slen - 1]
        break
    else:
        array = bigger
        k = k - slen - elen
        break

Submission status: Wrong Answer

Solution code:

N,K = map(int, input().split())
ab_list = {}
for i in range(N):
    a,b = map(int, input().split())
    akagi=str(a)
    if a in ab_list:
        ab_list[akagi] = ab_list[akagi] + b
    else:
        ab_list[akagi] = b

  
        
count =0
for i in sorted(ab_list.items(), key=lambda x: x[0]):
    count+=i[1]
    if (count >= K):
        print(i[0])
        break

Submission status: Wrong Answer

Solution code:
# coding: utf-8
x={}
n,k=map(int,input().split())
for i in range(n):
    a,b=map(int,input().split())
    if a in x:
        x[a]+=b
    else:
        x[a]=b
sorted(x)
a=0
for i in x.items():
    a+=i[1]
    if(a>=k):
        print(i[0])
        break;

Submission status: Wrong Answer

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

N,K=map(int,raw_input().split())
arr=[[0,0]]*N
for i in range(N):
    arr[i]=map(int,raw_input().split())
#print "Not sorted arr",
#print arr
sorted(arr)
#print "sorted",
#print arr
sum=0
for i in range(N):
#    print "i: "+str(i)
    sum=sum+arr[i][1]
#    print "sum = "+str(sum)
    if sum>=K:
#        print "sum: "+str(sum)
        print arr[i][0]
        break

Submission status: Wrong Answer

Solution code:
L = []

N, K = list(map(int, input().split(' ')))
for _ in range(N):
    a, b = list(map(int, input().split(' ')))
    for _ in range(b):
        L.append(a)
sorted(L)

print(L[K-1])

Submission status: Wrong Answer

Solution code:
L = []

N, K = list(map(int, input().split(' ')))
for _ in range(N):
    a, b = list(map(int, input().split(' ')))
    for _ in range(b):
        L.append(a)
sorted(L)

print(L[K])

Submission status: Wrong Answer

Solution code:
from operator import itemgetter

N, K = [int(x) for x in input().split()]
Array = list()
A = list()
count = 0
ans = 0
for i in range(N):
	A.append([int(x) for x in input().split()])
print(A)

A.sort(key=itemgetter(0))
for i in range(N):
	count += A[i][1]
	if count >= K:
		ans = A[i][0]
		break
		
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
n,k = input().split()
n = int(n)
k = int(k)
l = list()
for i in range(n):
    a, b = input().split()
    l.append([int(a),int(b)])

ar = np.array(l)
ar_s = np.sort(ar,axis=0)
count = np.cumsum(ar_s[:,1])

print(int(ar_s[np.where(count >=k)[0][0]][0]))

Submission status: Wrong Answer

Solution code:
array = []
nk = [int(x) for x in input().split()]
n = nk[0]
k = nk[1]
for i in range(n):
    num = [int(y) for y in input().split()]
    a = num[0]
    b = num[1]
    insertion = str(a)*b
    array.append(insertion)
ans = "".join(array)
print(ans[k-1])

Submission status: Wrong Answer

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

ans=list[0]
print(ans)

Submission status: Wrong Answer

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

x = input()
y=[]
y=x.split(" ")
N=int(y[0])
K=int(y[1])

tage=[]
for i in range(N):
	temp1=input()
	temp2=temp1.split(" ")
	mynum=int(temp2[0])
	times=int(temp2[1])
	
	for j in range(times):
		tage.append(mynum)

tage.sort
print(tage[K-1])

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

    l = []

    prev = 0
    for i in range(n):
        a, b = map(int, input().split())
        prev += b
        l.append((prev, a))

    l.sort()

    for t in l:
        if k <= t[0]:
            print(t[1])
            break

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:

# coding: utf-8

if __name__ == "__main__":
	n, k = map(int, input().split())
	preserve = None

	for _ in range(n):
		a, b = map(int, input().split())
		k -= b
		if preserve is None and k <= 0:
			preserve = a

	if preserve:
		print(preserve)
	else:
		print(a)

Submission status: Wrong Answer

Solution code:
array = []
nk = [int(x) for x in input().split()]
n = nk[0]
k = nk[1]
for i in range(n):
    num = [int(y) for y in input().split()]
    a = num[0]
    b = num[1]
    for j in range(b):
        array.append(a)
print(array[k-1])

Submission status: Wrong Answer

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

a = [0]*N
b = [0]*N
arr=[0]*N
array = []

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

array.sort()

print(array[K+1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans=list[k-1]
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
n,k = input().split()
n = int(n)
k = int(k)
l = list()
for i in range(n):
    a, b = input().split()
    l.append([int(a),int(b)])

ar = np.array(l)
ar_s = np.sort(ar,axis=0)
count = np.cumsum(ar_s[:,1])

print(ar_s[np.where(count >=k)[0][0]][0])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
A=[]
C=[]
for i in range(N):
    a,b=map(int,input().split())
    T=[a,b]
    A.append(T)
A.sort()
counter=0
for i in range(N):
     counter+=A[i][1]
     if counter>=K:
         s=counter
         counter=i
         break
else:    
   print(A[counter][0])

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)

ans=list[k-1]
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

N , K = map(int, input().split())
box = []

for i in range(N):
    box.append([int(i) for i in input().split()])

cnt = 0
for i in range(N):
    cnt += box[i][1]
    if cnt >= K:
        print(box[i][0])
        sys.exit()

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
N, K = [int(i) for i in input().split()]
ab = [[int(i) for i in input().split()] for j in range(N)]
sorted(ab, key=itemgetter(0))
for row in ab:
    K -= row[1]
    if K <= 0:
        print(row[0])
        break

Submission status: Wrong Answer

Solution code:
def main():
    N, K = map(int, input().split())
    ary = []
    i = 0
    while i < N:
        a, b = map(int, input().split())
        ary += [a] * b
        i += 1

    print(ary[K-1])

main()

Submission status: Wrong Answer

Solution code:
import numpy as np

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

a = []
array = np.array([])
for i in range(N):
    a = list(map(int,input().split()))
    array = np.concatenate((array,a[0]*np.ones(a[1])))
print (array)
array = np.sort(array)

print (int(array[K-1]))

Submission status: Wrong Answer

Solution code:
n, k = input().split(' ',2)
a = []
b = []
for ii in range(int(n)):
    tmpA, tmpB = input().split(' ',2)
    for jj in range(int(tmpB)):
        a.append(int(tmpA))
a.sort()
print(a[int(k)])

Submission status: Wrong Answer

Solution code:
N, K = map(int, raw_input().split())
array=[]
for i in range(N):
 a,b=map(int, raw_input().split())
 for j in range(b):
  array.append(a)
array.sort()
print array[K]

Submission status: Wrong Answer

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

a = [0]*N
b = [0]*N
array = []

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

array.sort()

print(array[K+1])

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
	N, K = map(int, input().split())

	n=0
	A=0
	for i in range(N):
		a, b = map(int, input().split())
		n+=b
		if(n>=K and A==0):
			A=a

	print(A)

Submission status: Wrong Answer

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

dp = {}
for i in range(len(ab)):
    if ab[i][0] not in dp:
        dp[ab[i][0]] = ab[i][1]
    else:
        dp[ab[i][0]] += ab[i][1]

dp2 = dict(sorted(dp.items()))

count = 0

for k, v in dp2.items():
    count += v
    if count >= K:
        print(k)
        break

Submission status: Wrong Answer

Solution code:
n, k = map(int, raw_input().split())
array = []
for i in range(n):
    a, b = map(int, raw_input().split())
    for j in range(b):
        array.append(a)

array.sort()
print array[k]

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
array = []
array_size = 0
for _ in range(N):
    a, b = [int(i) for i in input().split()]
    array.append((a, b))
    array_size += b
    if array_size >= K:
        break
array = sorted(array, key=lambda x:x[0])
index = 0
for arr in array:
    index += arr[1]
    if index >= K:
        print(arr[0])

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
	N, K = map(int, input().split())

	n=0
	A=0
	for i in range(N):
		a, b = map(int, input().split())
		n+=b
		if(n>=K):
			A=a

	print(A)

Submission status: Wrong Answer

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

a = [0]*N
b = [0]*N


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

D=sum(b)

array = []

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

array.sort()

print(array[K+1])

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
N, K = [int(i) for i in input().split()]
ab = [[int(i) for i in input().split()] for j in range(N)]
sorted(ab, key=itemgetter(0))
for row in ab:
    K-=row[1]
    if K <=0:
        print(row[0])
        break

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N, K = map(int, input().split())
seq = defaultdict(lambda: 0) 
values = []
for i in range(N):
    a, b = map(int, input().split())
    seq[a] += b
    values.append(a)

values.sort()
ans = 0
for i in range(len(values)):
    K -= seq[values[i]]
    if(K<=0):
        print(values[i])
        break

Submission status: Wrong Answer

Solution code:
N,K = list(map(int,input().split()))
data = []
def insert(num,N,K):
    x = 0
    for i in range(N):
        x += num[i][1]
        if x >= K:
            print(num[i][0])
            break
num = [list(map(int,input().split())) for i in range(N)]
insert(num,N,K)

Submission status: Wrong Answer

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

ab=[]
for i in range(n):
    ab.append([int(i) for i in input().split()])

sorted(ab)

cum=0
for i in range(n):
    cum += ab[i][1]
    if cum >= k: break

print(ab[i][0])

Submission status: Wrong Answer

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

    l = []

    prev = 0
    for i in range(n):
        a, b = map(int, input().split())
        prev += b
        l.append((prev, a))

    for t in l:
        if k <= t[0]:
            print(t[1])
            break

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
N,K=map(int, input().split())
p=[]
for i in range (0,N):
  r=list(map(int, input().split() )) 
  p.append(r)
p.sort()
k=0
for i in range(0,N):
  k+=p[i][1]
  if k>K:
    print(p[i-1][0])
    sys.exit()

Submission status: Wrong Answer

Solution code:
n, k = map(int, raw_input().split(' '))
d = {}

for i in range(n):
	a, b = map(int, raw_input().split(' '))
	if d.has_key(a):
		d[a] += b
	else:
		d[a] = b

s = 0
for i in d.items():
	s += i[1]
	if s >= k:
		print i[0]
		break

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n, k = [int(x) for x in input().split(' ')]
exist = []
storage = [0 for x in range(10 ** 5+1)]
for i in range(n):
    a, b = [int(x) for x in input().split(' ')]
    storage[a] += b
sum = 0
for i in range(1, 10**5):
    sum += storage[i]
    if sum >= k:
        print(i)
        break
    else:
        continue

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

    l = []

    prev = 0
    for i in range(n):
        a, b = map(int, input().split())
        prev += b
        l.append((prev, a))

    for t in l:
        if k in range(t[0] + 1):
            print(t[1])
            break

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

maxval = -1
for a, b in ab:
    if maxval < a:
        maxval = a
    
    k -= b
    if k <= 0:
        break

print(a)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict as dd
def main():
    N, K = map(int, input().split())

    d = dd(int)
    for n in range(N):
        a,b = map(int, input().split())
        d[a] += b

    count = 0
    for k, v in d.items():
        # print(k,v)
        count += v
        if count >= K:
            print(k)
            break

if __name__ == "__main__":
    # global stime
    # stime = time.clock()
    main()

Submission status: Wrong Answer

Solution code:
n, k = map(int, raw_input().split(' '))
d = {}

for i in range(n):
	a, b = map(int, raw_input().split(' '))
	if d.has_key(a):
		d[a] += b
	else:
		d[a] = b

l = d.keys()
l.sort()

s = 0
for i in l:
	s += d[i]
	if s >= k:
		print i
	break

Submission status: Wrong Answer

Solution code:
N,K = list(map(int,input().split()))
data = []
def insert(prog):
	a = prog[0]
	b = prog[1]
	for i in range(b):
		data.append(a)
num = [list(map(int,input().split())) for i in range(N)]
for i in range(N):
	insert(num[i])
print(data[K-1])

Submission status: Wrong Answer

Solution code:

# coding: utf-8
import numpy as np

if __name__ == "__main__":
	n, k = map(int, input().split())
	preserve = None

	for _ in range(n):
		a, b = map(int, input().split())
		k -= b
		#print('k:', k)
		#print('a:', a)
		#print('p:', preserve)
		if preserve is None and k <= 0:
			preserve = a

	print(preserve)

Submission status: Wrong Answer

Solution code:
N, K = [int(x) for x in input().split()]
Array = list()
a = 0
b = 0
for i in range(N):
	a, b = [int(x) for x in input().split()]
	for j in range(b):
		Array.append(a)

print(Array[K - 1])

Submission status: Wrong Answer

Solution code:
from collections import defaultdict as dd
def main():
    N, K = map(int, input().split())

    d = dd(int)
    for n in range(N):
        a,b = map(int, input().split())
        d[a] += b

    count = 0
    for k, v in d.items():
        # print(k,v)
        count += v
        if count >= K:
            print(k)
            return


if __name__ == "__main__":
    # global stime
    # stime = time.clock()
    main()

Submission status: Wrong Answer

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

pos = 0
for a, b in D:
    if pos + b < K:
        pos += b
    else:
        print a
        exit()

Submission status: Wrong Answer

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

res = 0
x = 0
for i in range(n):
	res = a[i]
	inc = b[i]
	x += inc
	if x >= k:
		break

print(res)

Submission status: Wrong Answer

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

ab.sort()
k -= 1
for a,b in ab:
  print a,b
  if k >= b:
    k -= b
  else:
    print a
    exit()

Submission status: Wrong Answer

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

c = 0
for (a, b) in A.items():
    c += b
    if c >= K:
        print(a)
        break

Submission status: Wrong Answer

Solution code:
import sys
N,K=list(map(int, input().split()))
p=[]
for i in range(0,N):
  a,b=list(map(int,input().split()))
  p+=[a]*b
  if len(p)>K:
    print(p[K-1])
    sys.exit()

Submission status: Wrong Answer

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

a_list=[]
b_list=[]
count = 0
for i in range(N):
    a,b = map(int,raw_input().split())
    a_list.append(a)
    b_list.append(b)

for i in range(N):
    count+=b_list[i]
    if count>=K:
        print a_list[i]
        break

Submission status: Wrong Answer

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

import sys
import os
import math

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

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

print(A[K-1])

Submission status: Wrong Answer

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

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

for i in range(N):
    K -= cnt[i]
    if K <= 0:
        print(i + 1)
        break