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())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort()
n = []
for a,b in ab:
  n += str(a) * b
  if len(n) == k: break
print(n[k-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

tmp = 0
ans = 0
flag = True
for i in range(N):
    a,b = map(int,input().split())
    K -= b
    if K <= 0 and flag:
        print(a)
        flag = False

Submission status: Wrong Answer

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

tmp = 0
ans = 0
for i in range(N):
    a,b = map(int,input().split())
    
    if tmp < K <= tmp + b:
        ans = a
    tmp += b

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(sorted(l)[k])

Submission status: Wrong Answer

Solution code:
import itertools
import math
import string
import collections
from collections import Counter
from collections import deque
from operator import itemgetter
import sys
sys.setrecursionlimit(2*10**5)
INF = 2**60


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

n, k = map(int, input().split())
ab = [readints() for _ in range(n)]
# print(ab)
abab = sorted(ab)
# print(abab)
tmp = 0
for i in range(n):
    tmp += ab[i][1]
    if tmp >= k:
        print(ab[i][0])
        break

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
s=[[int(i) for i in input().split()] for l in range(n)]
c=0
for x in s:
    c+=x[1]
    if c>=k:
        print(x[0])
        break

Submission status: Wrong Answer

Solution code:
import itertools
import math
import string
import collections
from collections import Counter
from collections import deque
from operator import itemgetter
import sys
sys.setrecursionlimit(2*10**5)
INF = 2**60


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

n, k = map(int, input().split())
tmp = 0
ab = [None]*n
for i in range(n):
    ab[i] = [None]*2
# print(ab)
for i in range(n):
    ab[i] = readints()
abab = sorted(ab)
tmp = 0
for i in range(n):
    tmp += abab[i][1]
    if tmp >= k:
        print(abab[i][1])
        break

Submission status: Wrong Answer

Solution code:
import itertools
import math
import string
import collections
from collections import Counter
from collections import deque
from operator import itemgetter
import sys
sys.setrecursionlimit(2*10**5)
INF = 2**60


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

n, k = map(int, input().split())
tmp = 0
ab = [None]*n
for i in range(n):
    ab[i] = [None]*2
# print(ab)
for i in range(n):
    ab[i] = readints()
abab = sorted(ab)
tmp = 0
for i in range(n):
    tmp += abab[i][1]
    if tmp >= k:
        print(ab[i][1])
        break

Submission status: Wrong Answer

Solution code:
import itertools
import math
import string
import collections
from collections import Counter
from collections import deque
from operator import itemgetter
import sys
sys.setrecursionlimit(2*10**5)
INF = 2**60


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
n, k = map(int, input().split())
tmp = 0
ab = [None]*n
for i in range(n):
    ab[i] = [None]*2
# print(ab)
tmp = 0
tmptmp = 0
for i in range(n):
    ab[i] = readints()
    tmp += ab[i][1]
    if tmp >= k:
        print(ab[i][1])
        break

Submission status: Wrong Answer

Solution code:
from itertools import chain
N,K = map(int,input().split())
numarray = list()
num_bool = [0]*(10**5)


for i in range(N):
    a,b = map(int,input().split())
    num_bool[a-1]+=1
    if(num_bool[a-1]>=2):
        pos = divmod(    list(chain(*numarray)).index(a), len(numarray[0])
        )
        numarray[pos[0]][1]+=b
        # print(numarray)    
        
    else:
        numarray.append([a,b])
        # print(numarray)    
numarray.sort()
sum_c = 0
i= 0
while sum_c<=K:
    sum_c+=numarray[i][1]
    i+=1
    # print(sum_c,i)
print(numarray[i-1][0])

Submission status: Wrong Answer

Solution code:
#ABC061 C - Big Array

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

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

X = []

for i in range(N):
    for j in range(A[i][1]):
        X.append(A[i][0])
        
X.sort()
print(X[K])

Submission status: Wrong Answer

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

u.sort(key=lambda x: x[0])
a = [i[0] for i in u]

s = [0]
for i in range(n):
    s.append(s[i]+u[i][1])

for j in s:
    if j<=k:
        print(a[s.index(j)])
        break

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
BA = []
for _ in range(N):
    a,b = map(int, input().split())
    BA.append([b, a])
BA.sort()
s = 0
ans = BA[0][1]
for b, a in BA:
    s += b
    if s >= K:
        ans = a
        break
print(ans)

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1])
s = 0
for a, b in AB:
    s += b
    if s >= K:
        ans = a
        break
print(ans)

Submission status: Wrong Answer

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

cnt = 0

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

Submission status: Wrong Answer

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

cnt = 0
for i in range(1,N+1):
  cnt += b[i]
  if cnt >= K:
    ans = a[i]
    break
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

N, K = map(int, sys.stdin.readline().rstrip().split())

opes = []
for _ in range(N):
    a, b = map(int, sys.stdin.readline().rstrip().split())
    opes.append((a, b))

count = 0
for (a, b) in opes:
    if count + b >= K:
        print(a)
        sys.exit()
    count += b

Submission status: Wrong Answer

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

ablist=[]
aslist=[]
s=0
for _ in range(N):
  a,b=map(int,input().split())
  ablist.append((a,b))
  s+=b
  aslist.append((a,s))
#print(aslist)

for a,s in aslist:
  if s>=K:
    print(a)
    break

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))
ab.sort()
for i,j in ab:
  k-=j
  if k<=0:
    print(a)
    exit()

Submission status: Wrong Answer

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

def kansu(N,K,A):
    
    sum = 0
    ans = -1


    for a in range(len(A)):
        sum += A[a][1]
#        print(sum,A[a][1])
        if (K <= sum):
            ans = A[a][0]
            break
    print(ans)




N,K,A = nyu()
kansu(N,K,A)

Submission status: Wrong Answer

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

def kansu(N,K,A):
    
    sum = 0
    ans = -1


    for a in range(len(A)):
        sum += A[a][1]
        if (K >= sum):
            ans = A[a][0]
            break
    print(ans)




N,K,A = nyu()
kansu(N,K,A)

Submission status: Wrong Answer

Solution code:
from sys import stdin


def main():
    n, k = map(int, stdin.readline().split())
    ab = [map(int, stdin.readline().split()) for _ in range(n)]
    count = 0
    for a, b in ab:
        if count + b < k:
            count += b
        else:
            print(a)
            exit()


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for _ in range(N):
    a, b= map(int, input().split())
    for i in range(b):
        c.append(a)
    if len(c) >= K:
        break
        
print(sorted(c)[K-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
N, K = map(int, input().split())
c = []
for _ in range(N):
    a, b= map(int, input().split())
    for i in range(b):
        c.append(a)
print(sorted(c)[K])

Submission status: Wrong Answer

Solution code:
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
for i in range(10**5):
    if K <= num[i]:
        print(i)
        exit()
    K -= num[i]

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(n):
    m -= l[i][1]
    
    if m <= 0:
        print(l[i][0])
        exit()

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())
cnt=0
j=0
while cnt<k:
    cnt+=b[j]
    if cnt>=k:
        break
    else:
        j+=1
print(a[j])

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
dic = {}
for i in range(n):
    s, t = map(int, input().split())
    if s not in dic.keys():
        dic[s] = t
    else:
        dic[s] += t
sum = 0
for i in dic.keys():
    if sum + dic[i] < k:
        sum += dic[i]
    else:
        ans = i
        break
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

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

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

for a,b in A:
    K = K - b
    if K<=0:
        print(a)
        sys.exit()

Submission status: Wrong Answer

Solution code:
def by_b(n):
	return n[0]

def resolve():
	n, k = map(int, input().split())
	N = []
	for _ in range(n):
		a, b = map(int, input().split())
		N.append([a, b])
	sorted(N, key=by_b)
	cnt = 0
	for i in range(n):
		cnt += N[i][1]
		if cnt >= k:
			print(N[i][0])
			break
resolve()

Submission status: Wrong Answer

Solution code:
N,K=(int(x) for x in input().split())
a_list=[]
b_list=[]
for i in range(N):
  a,b=(int(x) for x in input().split())
  a_list.append(a)
  b_list.append(b)
none_list=[]  
for i in range(N):
  for r in range(b_list[i]):
    none_list.append(a_list[i])
print(none_list)
none_list.sort()
print(none_list[K-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,K =  list(map(int,input().split()))
listA = []
for i in range(N):
    listA.append(list(map(int,input().split())))
now = 0
listA.sort()
print(listA)
for i in range(N):
    if now <= K <= now+listA[i][1]:
        print(listA[i][0])
        exit()
    else:
        now += listA[i][1]

Submission status: Wrong Answer

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

counter = 0
for i in range(10**5):
    if counter >= K:
        print(i-1)
        break
    counter += data[i]

Submission status: Wrong Answer

Solution code:
def resolve():
    N, K = list(map(int, input().split()))
    AB = [list(map(int, input().split())) for i in range(N)]
    length = 0
    idx = 0
    val = None
    while True:
        if length >= K:
            break
        length += AB[idx][1]
        val = AB[idx][0]
        idx += 1
    print(val)
    

if '__main__' == __name__:
    resolve()

Submission status: Wrong Answer

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

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

# print(lst)
lst.sort(key=lambda x:x[0])
print(lst)

count = 0
for i in range(n):
    count += lst[i][1]
    if count>=k:
        print(lst[i][0])
        exit()

Submission status: Wrong Answer

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

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

# print(lst)
lst.sort(key=lambda x:x[1])
# print(lst)

count = 0
for i in range(n):
    count += lst[i][1]
    if count>=k:
        print(lst[i][0])
        exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def resolve():
	n, k = map(int, input().split())
	s = []
	for i in range(n):
		a, b, = map(int, input().split())
		s.extend([a]*b)
	print(s[k-1])
resolve()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N, K = map(int, input().split())
sum = 0
array = defaultdict(int)
for i in range(N):
    a, b = map(int, input().split())
    array[a]+= b

array = dict(sorted(array.items()))
for k, v in array.items():
    sum += v
    if sum >= K:
        print(k)
        exit()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N, K = map(int, input().split())
ans = 0
sum = 0
array = defaultdict(int)
for i in range(N):
    a, b = map(int, input().split())
    array[a]+= b

array = dict(sorted(array.items()))
for k, v in array.items():
    sum += v
    ans = k
    if sum >= K:
        print(ans)
        exit()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N, K = map(int, input().split())
ans = 0
a, b = [0] * N, [0] * N
sum = 0
array = defaultdict(int)
for i in range(N):
    a[i], b[i] = map(int, input().split())

for i in range(N):
    array[a[i]] += b[i]

array = dict(sorted(array.items()))
for k, v in array.items():
    sum += v
    ans = k
    if sum >= K:
        break
print(ans)

Submission status: Wrong Answer

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

for i in range(n):
    ans = a[i]
    sum += b[i]
    if sum >= k:
        break
print(ans)

Submission status: Wrong Answer

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

for i in range(n):
    ans = max(ans, a[i])
    sum += b[i]
    if sum >= k:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
l = [[0, 0]] * n
for i in range(n):
    l[i][0], l[i][1] = map(int, input().split())
l.sort()
c = 0
for i in range(n):
    c += l[i][0]
    if c >= k:
        print(l[i][1])
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
input_lines = list(map(int, input().split()))
tmp_list = []

for i in range(input_lines[0]):
  num_list = list(map(int, input().split()))
  appended_num = num_list[0]
  #tmp_list.append(appended_num)
  tmp_list.extend([appended_num for i in range(num_list[1])])

index = len(tmp_list) - len(list(set(tmp_list)))
new_tmp_list = sorted(tmp_list)
print(new_tmp_list[index - input_lines[1]])

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n,k=map(int,input().split())
ab=[input() for i in range(n)]
d = defaultdict(list)
[d[int(i.split()[0])].append(int(i.split()[1])) for i in ab]
sd=sorted(d.items(), key=lambda x:x[0])
c=0
for i,l in sd:
  c+=sum(l)
  print(i,l)
  if c>=k:
    print(i)
    exit()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n,k=map(int,input().split())
ab=[input() for i in range(n)]
d = defaultdict(list)
[d[i.split()[0]].append(int(i.split()[1])) for i in ab]
sd=sorted(d.items(), key=lambda x:x[0])
c=0
for i,l in sd:
  c+=sum(l)
  if c>=k:
    print(i)
    exit()

Submission status: Wrong Answer

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

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

    if k > b:
        k -= b
    elif f == 0:
        c = a
        f = 1

print(c)

Submission status: Wrong Answer

Solution code:
def slove(ab_list, k):
    num_list = []
    count = 0
    for a, b in ab_list:
        count += b
        if count >= k:
            break

    return a

if __name__ == "__main__":
    n, k = [int(i) for i in input().split()]
    ab_list = [[int(i)for i in input().split()] for i in range(n)]
    print(slove(ab_list, k))

Submission status: Wrong Answer

Solution code:
def slove(ab_list, k):
    num_list = []
    count = 0
    for a, b in ab_list:
        num_list.extend([a]*b)
        count += b
        if count >= k:
            break

    return a

if __name__ == "__main__":
    n, k = [int(i) for i in input().split()]
    ab_list = [[int(i)for i in input().split()] for i in range(n)]
    print(slove(ab_list, k))

Submission status: Wrong Answer

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

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

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

cnt = 0
for i in range(N):
    cnt += A[i][1]
    if cnt >= N:
        print(A[i][0])
        break

Submission status: Wrong Answer

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

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

ans = 0
for i in range(N):
    a = A[i]
    b = B[i]
    if b < K:
        continue
    else:
        ans = a
        break

print(ans)

Submission status: Wrong Answer

Solution code:
input_lines = list(map(int, input().split()))
tmp_list = []

for i in range(input_lines[0]):
  num_list = list(map(int, input().split()))
  appended_num = num_list[0]
  #tmp_list.append(appended_num)
  tmp_list.extend([appended_num for i in range(num_list[1])])

index = len(tmp_list) - len(list(set(tmp_list)))
new_tmp_list = sorted(tmp_list)
print(new_tmp_list[index - input_lines[1]])

Submission status: Wrong Answer

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

cnt = 0
ans = -1
for i in range(n):
    cnt += list_score[i][1]
    if cnt >= k:
        ans = list_score[i][0]
        break

print(ans)

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())
    if cnt+b >=k:
        ans = a
        break
    cnt +=b
print(ans)

Submission status: Wrong Answer

Solution code:
N,K = map(int, input().split())
A = []
for i in range(N):
    a, b = map(int,input().split())
    for j in range(b):
        A.append(a)
cnt = 0
for h in sorted(A):
    cnt += A.count(h)
    if cnt>=K:
        print(h)
        break

Submission status: Wrong Answer

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

key_l = list(d.keys())
key_l.sort()

ans = d[key_l[-1]]

for key in key_l:
    if i<k:
        i += d[key]
    else:
        ans = key
        break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
d = {}
for i in range(n):
  a,b = map(int,input().split())
  if a in d:
    d[a] += b
  else:
    d[a] = b
cnt = 0
for i,j in enumerate(d.values()):
  cnt += j
  if cnt >= k:
    print(list(d.keys())[i])
    break

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
d = {}
for i in range(n):
  a,b = map(int,input().split())
  if a in d:
    d[a] += b
  else:
    d[a] = b
cnt = 0
for i,j in enumerate(d.values()):
  cnt += j
  if cnt > k:
    print(list(d.keys())[i])
    break

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
d = {}
for i in range(n):
  a,b = map(int,input().split())
  if a in d:
    d[a] += b
  else:
    d[a] = b
cnt = 0
for i,j in enumerate(d.values()):
  cnt += j
  if cnt > k:
    print(list(d.keys())[i])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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


def main():
    N, K = map(int, input().split())

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

    print(a)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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


def main():
    N, K = map(int, input().split())

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

    print(AB[K - 1])


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,k= map(int,input().split())
a = [input().split() for i in range(n)]
i = 0
for j in range(n):
    i += int(a[j][1])
    if i >=k:
        print(''.join([a[j][0]]))
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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())
AB = [list(map(int,input().split())) for _ in range(N)]
l = []
for a,b in AB:
  ab = [a]*b
  l.extend(ab)
  if len(l) >= K:
    break
l.sort()
print(l[K-1])

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(n)]
ab.sort()
l=[]
for i in range(len(ab)):
    for j in range(ab[i][1]):
        l.append(ab[i][0])
    if len(l)>4:break
if len(l)<4:print(l[-1])
else:print(l[3])

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(n)]
l=[]
for i in range(len(ab)):
    for j in range(ab[i][1]):
        l.append(ab[i][0])
l.sort()
print(l[3])

Submission status: Wrong Answer

Solution code:
import sys
ls=[]

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
ab=[]
for _ in range(N):
    ab.append(tuple(map(int, input().split())))
ab=sorted(ab, key=lambda x:x[0])
print(ab)
accum=[0]
for i in range(len(ab)):
    accum.append(accum[i]+ab[i][1])
print(accum)
for i in range(len(ab)):
    print(accum[i], accum[i+1])
    if accum[i] < K <= accum[i+1]:
        print(ab[i][0])
        break

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
ab=[]
for _ in range(N):
    ab.append(tuple(map(int, input().split())))
ab=sorted(ab, key=lambda x:x[1])
#print(ab)
accum=[0]
for i in range(len(ab)):
    accum.append(accum[i]+ab[i][1])
#print(accum)
for i in range(len(ab)):
    #print(accum[i], accum[i+1])
    if accum[i] < K <= accum[i+1]:
        print(ab[i][0])
        break

Submission status: Wrong Answer

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

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