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

sums = 0

nums = []

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

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

Submission status: Wrong Answer

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

sums = 0

nums = []

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


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

Submission status: Wrong Answer

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

sums = 0

nums = []

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

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

Submission status: Wrong Answer

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

sums = 0

nums = []

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

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

Submission status: Wrong Answer

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

sums = 0

nums = []

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

for i in range(len(nums)):
  if nums[i][0] > 4:
    print(nums[i][1])
    break

Submission status: Wrong Answer

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

num = []

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

print(num[K-1])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

cnt = 0
for n, t in array.items():
    cnt += t
    if cnt >= k:
        print(n)
        break

Submission status: Wrong Answer

Solution code:
def examC():
    N, K = LI()
    d = defaultdict(int)
    element = []
    for _ in range(N):
        a, b = LI()
        d[a] += b
        element.append(a)
    element.sort()
    for i in element:
        K -= d[i]
        if K<=0:
            ans = i
            break
    print(ans)

import sys
import copy
import bisect
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,K=map(int, input().split())
S = [list(map(int, input().split())) for i in range(N)]
l_list=[str(i[0]) for i in S for j in range(i[1])]
print(l_list[K-1])

Submission status: Wrong Answer

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

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

def one_int():
    return int(input())

def one_str():
    return input()

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

from collections import defaultdict


N,K = two_int()

query = []
for i in range(N):
    query.append(two_int() )

query = sorted(query, key=lambda x: x[0])

ans=0
sums=0
for i in range(len(query)-1):

    if sums < K <= sums+query[i+1][1]:
        ans=query[i][0]
        break
    sums += query[i+1][1]

print(ans)

Submission status: Wrong Answer

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

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

def one_int():
    return int(input())

def one_str():
    return input()

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

from collections import defaultdict


N,K = two_int()

query = []
for i in range(N):
    query.append(two_int() )

query = sorted(query, key=lambda x: x[0])

ans=0
sums=0
for i in range(len(query)-1):
    if sums <= K < sums+query[i+1][1]:
        ans=query[i+1][0]
        break
    sums += query[i+1][1]

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    N, K = map(int, input().split())
    AB = []
    for i in range(N):
        a, b = map(int, input().split())
        AB.append([a, b])
    AB.sort(key=lambda x: x[0])

    c = 0
    for a, b in AB:
        if K <= c + b:
            ans = a
        c += b
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N, K = map(int, input().split())
    AB = []
    for i in range(N):
        a, b = map(int, input().split())
        AB.append([a, b])
    AB.sort(key=lambda x: x[0])

    c = 0
    for a, b in AB:
        if c <= K <= c + b:
            ans = a
        c += b
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n, k = map(int,input().split())
result = 0
length = 0
for i in range(n):
  a, b = map(int,input().split())
  if(length <= k):
    length += b
    result = max(result, a)
  else:
    if(a < result):
      length += b
      if(length > k):
        result = a
print(result)

Submission status: Wrong Answer

Solution code:
n, k = map(int,input().split())
result = 0
length = 0
for i in range(n):
  a, b = map(int,input().split())
  if(length < k):
    length += b
    result = max(result, a)
  else:
    if(a < result):
      length += b
      if(length > k):
        result = a
print(result)

Submission status: Wrong Answer

Solution code:
def main():
    N, K = (int(i) for i in input().split())
    S = [(0, 0)]
    for i in range(N):
        a, b = (int(i) for i in input().split())
        S.append((S[-1][0] + b, a))
    S.sort(key=lambda s: s[1])
    for b, a in S:
        if K <= b:
            print(a)
            break


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N, K = (int(i) for i in input().split())
    S = [(0, 0)]
    for i in range(N):
        a, b = (int(i) for i in input().split())
        S.append((S[-1][0] + b, a))
    for b, a in S:
        if K <= b:
            print(a)
            break


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,K =map(int,input().split())
count = 0
while count<K:
  a,b = map(int,input().split())
  count +=b
  if count >= K:
    print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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




print(p[k-1])

Submission status: Wrong Answer

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


  
print(p)

print(p[k-1])

Submission status: Wrong Answer

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


print(p[k])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for _ in range(N):
    a, b = map(int, input().split())
    nums += [a] * b
    if len(nums) >= K:
        break

print(nums[K - 1])

Submission status: Wrong Answer

Solution code:
N, K = [int(x) for x in input().split()]
arr = {}
for _ in range(N):
    a, b = [int(x) for x in input().split()]
    if a in arr.keys():
        arr[a] += b
    else:
        arr.update({a: b})

s_a = {}# sorted arr
for key in sorted(arr.keys()):
    s_a.update({key: arr[key]})

th = 0
for i, c in s_a.items():
    th += c
    if th >= K:
        print(i)
        exit()

Submission status: Wrong Answer

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

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

# arr.sort()

print(arr[k-1])

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
AB=[list(map(int,input().split())) for i in range(n)]
dic={}
C=[0]
for i in range(n):
    C.append(C[-1]+AB[i][1])
for i in range(n):
    if C[i]<k<=C[i+1]:
        print(AB[i][0])
        exit()

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
AB=[list(map(int,input().split())) for i in range(n)]
dic={}
C=[0]
for i in range(n):
    C.append(C[-1]+AB[i][1])

for i in range(n):
    if C[i]<=k<=C[i+1]:
        print(AB[i][0])
        exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
List = []
N, K = map(int, input().split())
for i in range(N):
    a, b = map(int, input().split())
    for j in range(b):
        List.append(a)
print(List[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(key=lambda x: x[1])
cnt = 0
for i in range(N):
    cnt += ab[i][1]
    if cnt >= K:
        print(ab[i][0])
        break

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

data = []
for i in range(N):
    a = d[i][0]
    b = d[i][1]
    for j in range(b):
        data.append(a);
sorted(data)
print(data[K-1])

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
C = {}
A = []
for _ in range(N):
    a,b = map(int,input().split())
    if a not in C:
        C[a] = 0
    C[a] += b
    A.append(a)
A = sorted(list(set(A)))
cnt = 0
for i in range(len(A)):
    cnt += C[A[i]]
    if cnt>=K:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
# AtCoder
N, K = map(int, input().split())
lst = [list(map(int, input().split())) for i in range(N)]
box = []

for l in lst:
    qua = l[0]
    val = l[1]

    for i in range(qua):
        box.append(val)

print(sorted(box)[K])

Submission status: Wrong Answer

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

for i in range(1,100001):
  if i in dic:
    k -= dic[i]
    if k <= 0:
      print(i)

Submission status: Wrong Answer

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

for i in range(1,100000):
  if i in dic:
    k -= dic[i]
    if k <= 0:
      print(i)
      break

Submission status: Wrong Answer

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

for j in range(n):
	res = res + b[j]
	if res >= k:
		print(a[j])
		flag = True
	if flag == True:
		break

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
ans=[]
sume=0
for n in range(N):
  if sume>=K-1:
    print(A)
    break
  A,B=map(int,input().split())
  sume+=B

Submission status: Wrong Answer

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

n,k = map(int,input().split())
li = []

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

a.sort()

cnt = 0

for i in range(n):
    cnt += li[i][1]

    if cnt >= k:
        print(li[i][0])
        break

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
lists=[0]*n
for i in range(n):
    lists[i]=tuple(map(int,input().split()))
lists=sorted(lists,key=lambda x: x[0])
print(lists)
count=0
num=0
for j in range(n):
    if count<k:
        count=count+lists[j][1]
        num=lists[j][0]

    else:
        break
print(num)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
lists=[0]*n
for i in range(n):
    lists[i]=tuple(map(int,input().split()))
lists=sorted(lists,key=lambda x: x[0])
print(lists)
count=0
num=0
for j in range(n):
    if count<k:
        count+=lists[j][1]*lists[j][0]
    else:
        num+=lists[j][0]
        break
print(num)

Submission status: Wrong Answer

Solution code:
import numpy as np
from bisect import bisect_left, bisect_right
N, K = map(int, input().split())
count = 0
lis = np.array([0] * (10 ** 5))
for n in range(N):
    a, b = map(int, input().split())
    lis[a - 1] += b
for n in range(N):
    K -= lis[n]
    if K <= 0:
        print(n + 1)
        break

Submission status: Wrong Answer

Solution code:
# C - Big Array

import numpy as np
import bisect

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

b = np.array(b)
b = b.cumsum()

ans_idx = bisect.bisect_left(b, K)
print(a[ans_idx])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# ABC061 C - Big Array
N,K = map(int,input().split())
A = []
B = []
L = [[] for _ in range(N)]

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

for i in range(N):
    if i == 0:
        L[0].append(A[0])
        L[0].append(B[0])
        continue

    # if i == N-1:
    #     continue
    L[i].append(A[i])
    L[i].append(L[i-1][1]+B[i])

for i in range(N):
    if i == 0:
       f = 0
       t = L[0][1]
       if f < K <= t:
           ans = L[0][0]
           break
       continue
    f = L[i-1][1]
    t = L[i][1]
    if f < K <= t:
        ans = L[i][0]
        break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
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)
        exit()

Submission status: Wrong Answer

Solution code:
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))

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

  cnt = 0
  for _ in range(n):
    a, b = na()
    cnt += b
    if cnt >= k:
      print(a)
      return

main()

Submission status: Wrong Answer

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

a = 0
b = 0
sum = 0

for _ in range(n):
    a ,b = map(int, input().split())
    sum += b
    if sum >= k:
        print(a)
        exit()

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    N, K = map(int, input().split())
    ab = list()
    for i in range(N):
        ab.append(list(map(int, input().split())))

    res = K
    for i in range(N):
        res -= ab[i][1]
        if res <= 0:
            print(ab[i][0])
            exit()

Submission status: Wrong Answer

Solution code:
# coding: utf-8
n,k = map(int,input().split())

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

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
a=[0]*n;b=[0]*n
z=0
for i in range(n):
    x,y=map(int,input().split())
    z+=y
    a[i],b[i]=x,z
#print(a,b)
for i in range(n):
    if k<=b[i]:
        print(a[i])
        break

Submission status: Wrong Answer

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

for i in range(1, N+1):
    a, b = map(int, input().split())
    A.append(a)
    B.append(B[i-1] + b)
    if B[i] >= K:
        print(A[i])
        exit()

Submission status: Wrong Answer

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

for i in range(N):
    a, b = map(int, input().split())
    L = str(a) * b
    array += L

print(array[K-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict

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

for i in range(N):
    a, b = map(int, input().split())
    d[a] += b
ans = sorted(d.items(), key=lambda x: x[1])
cnt = 0
for i in range(len(ans)):
    cnt += ans[i][1]
    if cnt >= K:
        print(ans[i][0])
        sys.exit()

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict

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

for i in range(N):
    a, b = map(int, input().split())
    d[a] += b
ans = sorted(d.items(), key=lambda x: x[1])
cnt = 0
for i in range(len(ans)):
    cnt += ans[i][1]
    if cnt > K:
        print(ans[i][0])
        sys.exit()

Submission status: Wrong Answer

Solution code:
import heapq as hp

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

s = []
for i in range(n):
    for j in range(b[i]):
        hp.heappush(s, a[i])

print(s[k-1])

Submission status: Wrong Answer

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

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

a, b = zip(*sorted(zip(a, b)))

count = 0
for i in range(N):
    K -= b[i]
    if K <= 0:
        print(a[count])
        exit()
    else:
        continue

Submission status: Wrong Answer

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    n, k = list(map(int, input().rstrip('\n').split()))
    ab = [list(map(int, input().rstrip('\n').split())) for _ in range(n)]
    cnt = 0
    for a, b in ab:
        cnt += b
        if cnt >= k:
            print(a)
            exit()


if __name__ == '__main__':
    slove()

Submission status: Wrong Answer

Solution code:
from itertools import accumulate
n, k = map(int, input().split())
memo = [0] * (10 ** 5 + 1)
for _ in range(n):
    i, j = map(int, input().split())
    memo[i] += j
cnt = 0
for i, j in enumerate(memo):
    cnt += j
    if cnt >= k:
        print(i)

Submission status: Wrong Answer

Solution code:
from itertools import accumulate
n, k = map(int, input().split())
a = []
b = []
for _ in range(n):
    a_, b_ = map(int, input().split())
    a.append(a_)
    b.append(b_)
b_acc = list(accumulate(b))
for i in range(n):
    if b_acc[i] >= k:
        print(a[i])
        exit()

Submission status: Wrong Answer

Solution code:
N, K = tuple(map(int, input().split()))
A, B = [], []
for _ in range(N):
    a, b = tuple(map(int, input().split()))
    A.append(a)
    B.append(b)
lower = 0
upper = 0
for a, b in zip(A, B):
    upper += b
    if lower <= K <= upper:
        print(a)
        exit()
    lower = upper

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    n, k = list(map(int, input().rstrip('\n').split()))
    t = 0
    for i in range(n):
        a, b = list(map(int, input().rstrip('\n').split()))
        t += b
        if t >= k:
            print(a)
            exit()


if __name__ == '__main__':
    slove()

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
array = []
for i in range(n):
  a, b = map(int, input().split())
  array.extend([a for j in range(b)])
array.sort
print(array[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)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    n, k = list(map(int, input().rstrip('\n').split()))
    ab = [list(map(int, input().rstrip('\n').split()))]
    t = 0
    mt = 0
    for a, b in ab:
        t += b
        mt = max(mt, a)
        if t >= k:
            print(mt)
            exit()


if __name__ == '__main__':
    slove()

Submission status: Wrong Answer

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    n, k = list(map(int, input().rstrip('\n').split()))
    ab = [list(map(int, input().rstrip('\n').split()))]
    ab.sort()
    t = 0
    mt = 0
    for a, b in ab:
        t += b
        if t >= k:
            print(a)
            exit()


if __name__ == '__main__':
    slove()

Submission status: Wrong Answer

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    n, k = list(map(int, input().rstrip('\n').split()))
    t = 0
    for i in range(n):
        a, b = list(map(int, input().rstrip('\n').split()))
        t += a
        if t >= k:
            print(b)
            exit()


if __name__ == '__main__':
    slove()

Submission status: Wrong Answer

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


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

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

l=[]
for i in range(n):
    l.append(list(map(int,input().split())))
    
l.sort()

i=n-1
ans=0
while k>0:
    k=k-l[i][1]
    ans=l[i][0]
    i=i-1
print(ans)

Submission status: Wrong Answer

Solution code:
# C - Big Array
N, K = map(int,input().split())
A = [list(map(int, input().split())) for i in range(N)]
S = 0

for i in range(N):
    S += A[i][1]
    if S >= K:
        print(A[i][0])
        exit()
    else:
        pass

Submission status: Wrong Answer

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

for i in range(N):
  a,b = input().split()
  ans+= a*int(b)

print(ans[K-1])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

N, K = map(int, input().split())
s = []
slen = 0 # len()が遅いかもなので
remain = K
for i in range(N):
    a, b = map(int, input().split())
    remain -= b
    if remain <= 0:
        print(a)
        exit()

Submission status: Wrong Answer

Solution code:

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

N, K = map(int, input().split())
s = []
slen = 0 # len()が遅いかもなので
for i in range(N):
    a, b = map(int, input().split())
    for j in range(b):
        s.append(a)
        slen += 1
        if slen >= K:
            break

print(s[K-1])

Submission status: Wrong Answer

Solution code:

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

N, K = map(int, input().split())
s = []
slen = 0 # len()が遅いかもなので
for i in range(N):
    a, b = map(int, input().split())
    for j in range(b):
        s.append(a)
    slen += b

    if slen >= K:
        break

print(s[K-1])

Submission status: Wrong Answer

Solution code:

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

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

print(s[K-1])

Submission status: Wrong Answer

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

arr = []

for i in range(N):
    a, b = map(int, input().split())
    if len(arr) < K or a < arr[-1]:
        arr.extend([a] * b)
        arr.sort()
        arr = arr[:K]

print(arr[-K])

Submission status: Wrong Answer

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

arr = []

for i in range(N):
    a, b = map(int, input().split())
    if len(arr) < 4 or a < arr[-1]:
        arr.extend([a] * b)
        arr.sort()
        arr = arr[:4]

print(arr[-1])

Submission status: Wrong Answer

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    n, k = list(map(int, input().rstrip('\n').split()))
    ab = [list(map(int, input().rstrip('\n').split())) for _ in range(n)]
    t = 0
    for a, b in ab:
        t += b
        if t >= k:
            print(a)
            exit()


if __name__ == '__main__':
    slove()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
ab=[[int(i) for i in input().split()]for j in range(n)]
check=0
maxi=0
for i,j in ab:
    check+=j
    maxi=max(maxi,i)
    if check>=k:
        print(maxi)
        break

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
ab=[[int(i) for i in input().split()]for j in range(n)]
check=0
for i,j in ab:
    check+=j
    if check>=k:
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N, K = list(map(int, input().split()))
nval = defaultdict(int)
for _ in range(N):
    a, b = list(map(int, input().split()))
    nval[a] += b

keys = nval.keys()
sorted(keys)

cnt = 0
for val in keys:
    # cnt += nval[val]
    if K <= nval[val]:
        print(val)
        break
    K -= nval[val]

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N, K = list(map(int, input().split()))
nval = defaultdict(int)
for _ in range(N):
    a, b = list(map(int, input().split()))
    nval[a] += b

keys = nval.keys()
sorted(keys)

cnt = 0
for val in keys:
    cnt += nval[val]
    if cnt >= K:
        print(val)
        break

Submission status: Wrong Answer

Solution code:
import sys
import copy
import  math
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n, k = na()
ct = 0
for i in range(n):
    a, b = na()
    ct += b
    if ct >= k:
        ans = a
        break
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import copy
import  math
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n, k = na()
ct = 0
for i in range(n):
    a, b = na()
    ct += b
    if ct >= k:
        print(a)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

acc = 0

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

Submission status: Wrong Answer

Solution code:
#061
n,k=map(int,input().split())
l=[[int(i) for i in input().split()] for i in range(n)]
for i in range(n):
    if l[i][1]<k:
        k-=l[i][1]
    else:
        print(l[i][0])
        break