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())
a = []
for i in range(n):
    x, y = map(int, input().split())
    a.append((x, y))

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
N, K = map(int, raw_input().split())    
ab = [map(int, raw_input().split()) for i in xrange(N)]
for a, b in ab:
    if K <= b:
        print a
        break
    else:
        K -= b

Submission status: Time Limit Exceeded

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

yy = sorted(xx)
print(yy[k-1])

Submission status: Time Limit Exceeded

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

print(a[K - 1])

Submission status: Time Limit Exceeded

Solution code:
N,K = map(int,input().split())
def count_x(ZZ,maxi):
  BB = [0]*(maxi+1)
  for i in AA:
    BB[i] +=1
    
  k = 0
  for i in range(len(BB)):
    for j in range(BB[i]):
      AA[k] = i
      k +=1
  return AA[K-1]
    
    
    
                 
    
AA =list()
for i in range(N):
  a,b = map(int,input().split())
  for i in [a]*b:
    AA.append(i)
print(count_x(AA,10**5))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
# ABC 061: C – Big Array
N, K = [int(i) for i in input().split()]
a, b = [], []
for _ in range(N):
    tmp = input().split()
    a.append(int(tmp[0]))
    b.append(int(tmp[1]))

sequence = []

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
from collections import Counter
N, K = list(map(int, input().split()))
C = Counter()
for _ in range(N):
    a, b = list(map(int, input().split()))
    C += {a: b}
# print(C)
L = list(C.keys())
L.sort()
i = 0
ct = C[L[0]]
while ct < K:
    i += 1
    ct += C[L[i]]
print(L[i])

Submission status: Time Limit Exceeded

Solution code:
from collections import Counter
N, K = list(map(int, input().split()))
C = Counter()
S = set()
for _ in range(N):
    a, b = list(map(int, input().split()))
    C += {a: b}
    S.add(a)
# print(C)
L = list(S)
L.sort()
i = 0
ct = C[L[0]]
while ct < K:
    i += 1
    ct += C[L[i]]
print(L[i])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

#愚直な実装だけどいけるかなって感じ
lis = []

for i in range(n):
    for j in range(b[i]):
        lis.append(a[i])

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

x = [0] * n
for i in range(n):
    ind = a.index(min(a))
    x[i] = l[ind]
    a[ind] = 10 ** 5 + 1

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

Submission status: Time Limit Exceeded

Solution code:
lst1 = input().split()

N = int(lst1[0])
K = int(lst1[1])

array = []

for i in range(N):
   l = input().split()
   for j in range(int(l[1])):
      array.append(int(l[0]))

array.sort()

print(array[K - 1])

Submission status: Time Limit Exceeded

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()
cnt = 0
X = []
for i in range(n):
    a, b = AB[i]
    X += [a]*b
    cnt += b
    if cnt > k:
        break
X.sort()
print(X[k-1])

Submission status: Time Limit Exceeded

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

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

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

Submission status: Time Limit Exceeded

Solution code:
import math
N,K = map(int, input().split())
a1,b1 = map(int,input().split())
ls = [a1 for i in range(b1)]
for j in range(N-1):
    a, b = map(int, input().split())
    c = 0
    d = len(ls)
    while d-c > 1:
        e = round((c+d)/2)
        f = ls[e]
        if f > a:
            d = e
        elif f == a:
            d = e
            c = e
        else:
            c = e
    addls = [a for i in range(b)]
    ls[d+1:1] = addls
print(ls[K-1])

Submission status: Time Limit Exceeded

Solution code:
import math
N,K = map(int, input().split())
a1,b1 = map(int,input().split())
ls = [a1 for i in range(b1)]
for j in range(N-1):
    a, b = map(int, input().split())
    c = 0
    d = len(ls)
    while d-c > 1:
        e = round((c+d)/2)
        f = ls[e]
        if f > a:
            d = e
        else:
            c = e
    addls = [a for i in range(b)]
    ls[d+1:1] = addls
print(ls[K-1])

Submission status: Time Limit Exceeded

Solution code:
def resolve():
    '''
    code here
    '''

    N, K = [int(item) for item in input().split()]
    queries = [[int(item) for item in input().split()] for _ in range(N)]

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

    temp_que = []
    for num, val in queries:
        temp_que = [num]*val
        K -= val
        if K <= 0:
            break

    print(temp_que[K-1])

if __name__ == "__main__":
    resolve()

Submission status: Time Limit Exceeded

Solution code:
def resolve():
    '''
    code here
    '''

    N, K = [int(item) for item in input().split()]
    queries = [[int(item) for item in input().split()] for _ in range(N)]

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

    que = []
    cnt = 0
    for num, val in queries:
        que += [num]*val
        cnt += val
        if cnt >= K:
            break

    print(que[K-1])

if __name__ == "__main__":
    resolve()

Submission status: Time Limit Exceeded

Solution code:
def resolve():
    '''
    code here
    '''

    N, K = [int(item) for item in input().split()]
    queries = [[int(item) for item in input().split()] for _ in range(N)]

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

    que = []
    for num, val in queries:
        que += [num]*val

    print(que[K-1])

if __name__ == "__main__":
    resolve()

Submission status: Time Limit Exceeded

Solution code:
def resolve():
    '''
    code here
    '''
    import collections
    N, K = [int(item) for item in input().split()]
    queries = [[int(item) for item in input().split()] for _ in range(N)]

    que = collections.deque()

    for num, val in queries:
        for _ in range(val):
            que.append(num)
    res_list = list(que)
    res_list.sort()

    print(res_list[K-1])

if __name__ == "__main__":
    resolve()

Submission status: Time Limit Exceeded

Solution code:
from collections import deque
n,k=map(int,input().split())
ints=[list(map(int,input().split())) for _ in range(n)]
d=deque()
for x in ints:
  d.extend([x[0]]*x[1])
ans=sorted(list(d))
print(ans[k-1])

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect

sys.setrecursionlimit(10**6)


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


N, K = zz()
A, B = [0]*N, [0]*N
lis = []
for i in range(N):
    a, b = zz()
    lis.extend([a]*b)
lis = sorted(lis)
print(lis[K-1])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

lst = []

for i in range(N):
    lst += [AB[i][0]]*AB[i][1]

lst = sorted(lst)
print(lst[K-1])

Submission status: Time Limit Exceeded

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

lst = []

for i in range(N):
    for j in range(AB[i][1]):
        lst += [AB[i][0]]

lst = sorted(lst)
print(lst[K-1])

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N,K = (int(x) for x in input().split())
A = []
B = []
for i in range (N):
  a,b = (int(x) for x in input().split())
  A.append (a)
  B.append (b)
for i in range (N):
  x = np.argmin(A)
  if B[x] >= K:
    print (A[x])
    break
  else:
    K -= B[x]
    A.pop (x)
    B.pop (x)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

for i in range(N):
    a, b = (int(x) for x in input().split())
    for j in range(b):
        number_list.append(a)

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

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
temp={}
a=[]
for i in range(n):
  at,bt=map(int,input().split())
  if at in a:
    temp[at]=temp[at]+bt
  else:
    temp[at]=bt
    a.append(at)
a.sort()
cnt=0
for i in range(n):
  cnt=cnt+temp[a[i]]
  if cnt>=k:
    print(a[i])
    break

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

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

Submission status: Time Limit Exceeded

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

res = []
for i in range(n):
  for _ in range(b[i]):
    res.append(a[i])
#print(res)
res.sort()
#print(res)
print(res[k-1])

Submission status: Time Limit Exceeded

Solution code:
def main():
    n,k=map(int,input().split())
    arr = []
    for _ in range(n):
        a,b=map(int,input().split())
        arr.extend([a]*b)
    arr.sort()
    print(arr[k-1])
    
if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

p = []
for i in s:
  _  = [p.append(i[0]) for ii in range(i[1])]

p.sort()

print(p[K-1])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:

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


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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
a,b=map(int,input().split())
s=[]
s+=[a]*b
for i in range(n-1):
  a,b=map(int,input().split())
  if a>max(s) and len(s)>k:
    continue
  s+=[a]*b
  p=sorted(s)[:k]
print(p[k-1])

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
a,b=map(int,input().split())
s=[]
s+=[a]*b
for i in range(n-1):
  a,b=map(int,input().split())
  if a>max(s) and len(s)>k:
    continue
  s+=[a]*b
p=sorted(s)
print(p[k-1])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N, K = list(map(int,input().split()))
C = []
L = []
cnt = 0
while cnt <= K:
  for i in range(N):
    C = list(map(int,input().split()))
    cnt += C[1]
    for j in range(C[1]):
      L.append(C[0])
L = sorted(L)    
print(L[K-1])

Submission status: Time Limit Exceeded

Solution code:
N, K = list(map(int,input().split()))
C = []
L = []
for i in range(N):
  C = list(map(int,input().split()))
  for j in range(C[1]):
    L.append(C[0])
L = sorted(L)    
print(L[K-1])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
l=[0]
for _ in range(n):
    a,b=map(int,input().split())
    l+=[a]*b
l.sort()
print(l[k])

Submission status: Time Limit Exceeded

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

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

print(array[K- 1])

Submission status: Time Limit Exceeded

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

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

print(array[K- 1])

Submission status: Time Limit Exceeded

Solution code:
N,K = map(int,input().split())
AB =[]
for n in range(N):
    a,b = map(int,input().split())
    AB.extend([a]*b)
print(sorted(AB)[K-1])

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
data = [10 ** 9]
for i in range(n):
    a, b = map(int, input().split())
    temp = [a] * b
    data.extend(temp)

rev = sorted(data)
#rev = data.reverse() > 大きい順
ans = rev[k - 1]
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys
def main():
    input = sys.stdin.readline
    N, K = map(int, input().split())
    count1 = 0
    count2 = 0
    d = []
    l = {}
    
    for i in range(N):
        a,b = map(int, input().split())
        if not a in d:
            d.append(a)
            l[a] = b
        else:
            l[a] += b
        count1 += b

    d.sort()
    for i in d:
        count2 += l[i]
        if count2 >= K:
            print(i)
            break
        

        

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

for i in range(N):
    big_array += [a_b[i][0]] * int(a_b[i][1])

print(sorted(big_array)[K-1])

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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-1])

Submission status: Time Limit Exceeded

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())
ans = []
for i in range(n):
    a, b = readints()
    for j in range(b):
        ans.append(a)
aannss = sorted(ans)
print(aannss[k-1])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

print(lis[K-1])

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline
n,k = map(int,input().split())
inf = 10**10
parent = [inf]*n
q = {}
for i in range(n):
    a,b = map(int,input().split())
    if a not in q.keys():
        parent[i] = a
        q[a] = 0
    q[a] += b
parent.sort()
cnt = 0
for p in parent:
    cnt += q[p]
    if cnt >= k:
        print(p)
        break

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline
n,k = map(int,input().split())
parent = []
q = {}
for i in range(n):
    a,b = map(int,input().split())
    if a not in q.keys():
        parent.append(a)
        q[a] = 0
    q[a] += b
parent.sort()
cnt = 0
for p in parent:
    cnt += q[p]
    if cnt >= k:
        print(p)
        break

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split())
parent = []
q = {}
for i in range(n):
    a,b = map(int,input().split())
    if a not in q.keys():
        parent.append(a)
        q[a] = 0
    q[a] += b
parent.sort()
cnt = 0
for p in parent:
    cnt += q[p]
    if cnt >= k:
        print(p)
        break

Submission status: Time Limit Exceeded

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)
print(sorted(c)[K-1])

Submission status: Time Limit Exceeded

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

print(sorted(c)[K-1])

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N, K = map(int, input().split())
d = []
for _ in range(N):
    a, b= map(int, input().split())
    c = [a] * b
    d += c

print(sorted(d)[K-1])

Submission status: Time Limit Exceeded

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-1])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

list=[]
for _ in range(n):
  a,b=(map(int,input().split()))
  list+=[a]*b
  
print(sorted(list)[k-1])

Submission status: Time Limit Exceeded

Solution code:
def main2():
    n,k = map(int,input().split(" "))
    q = []
    for i in range(n):
        a,b = map(int,input().split(" "))
        q+=[a for j in range(b)]
    
    q.sort()
    print(q[k-1])

main2()

Submission status: Time Limit Exceeded

Solution code:
def main():
    import heapq
    n,k = map(int,input().split(" "))
    q = []
    for i in range(n):
        a,b = map(int,input().split(" "))
        for j in range(b):
            heapq.heappush(q,a)
    
    for i in range(k):
        m = heapq.heappop(q)
    
    print(m)
main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
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)

s = sorted(s)

print(s[k-1])

Submission status: Time Limit Exceeded

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):
  d=[a_list[i]]*b_list[i]
  none_list.extend(d)
none_list.sort()
print(none_list[K-1])

Submission status: Time Limit Exceeded

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])
none_list.sort()
print(none_list[K-1])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

for i in range(n):
    a,b = list(map(int, input().split()))
    lst += [a for i in range(b)]
# print(lst)
lst.sort()
print(lst[k-1])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

for i in range(n):
    x, y = map(int,input().split())
    ans += [x]*y

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

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
ab=[input() for i in range(n)]
a=[int(i.split()[0]) for i in ab]
b=[int(i.split()[1]) for i in ab]
c=0
for l in sorted(set(a)):
  for ind in [i for i,j in enumerate(a) if j==l]:
    c+=b[ind]
    if c>=k:
      print(a[ind])
      exit()

Submission status: Time Limit Exceeded

Solution code:
# =map(int,input().split())
n,m=map(int,input().split())
a =[list(map(int,input().split())) for i in range(n)]
ans=[]
# print(a)
for i in range(n):
    for k in range(a[i][1]):
        ans.append(a[i][0])
# print(ans)
# ans=[int(i) for i in ans]
# print(ans)
ans.sort()
print(ans[m-1])

Submission status: Time Limit Exceeded

Solution code:
# =map(int,input().split())
n,m=map(int,input().split())
a =[list(map(int,input().split())) for i in range(n)]
ans=[]
# print(a)
for i in range(n):
    for k in range(a[i][1]):
        ans.append(a[i][0])
# print(ans)
ans=[int(i) for i in ans]
# print(ans)
ans.sort()
print(ans[m-1])

Submission status: Time Limit Exceeded

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
c=0
while True:
    if cnt>=K:break
    c += 1
    cnt += A.count(c)
print(c)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int,input().split())
hairetu = []
for _ in range(N):
  a, b = map(int,input().split())
  hairetu.extend([a]*b)
print(sorted(hairetu)[K-1])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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)

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

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline
n,k=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(n)]
ab.sort()
l=[]
m=0
for i in range(len(ab)):
    for j in range(ab[i][1]):
        l.append(ab[i][0])
        m+=1
    if m>k:break
print(l[k-1])

Submission status: Time Limit Exceeded

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)>k:break
print(l[k-1])

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
a_list = []
for i in range(n):
	a, b = map(int, input().split())
	a_list.extend([a] * b)
	if a_list.count(1) >= k:
		break
a_list.sort()
print(a_list[k-1])

Submission status: Time Limit Exceeded

Solution code:
n, k = map(int, input().split())
a_list = []
for i in range(n):
	a, b = map(int, input().split())
	a_list.extend([a] * b)
	if a_list.count(1) > k:
		break
a_list.sort()
print(a_list[k-1])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split())
a,b = list(),list()
for i in range(n):
  temp = list(map(int,input().split()))
  a.append(temp[0])
  b.append(temp[1])
for i in range(n):
  for j in range(n-1, i, -1):
    if a[j] < a[j-1]:
      temp = a[j]
      a[j] = a[j-1]
      a[j-1] = temp
      temp = b[j]
      b[j] = b[j-1]
      b[j-1] = temp
sum = 0
for i in range(n):
  sum += b[i]
  if sum >= k:
    print(a[i])
    exit()

Submission status: Time Limit Exceeded

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

array = []

for i in range(N):
    a,b = map(int, input().split())
    array += [a for i in range(b)]
    
array.sort(reverse=False) #O( n・log(n) )
print(array[K-1])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
num, rank = map(int,input().split())
grid = []
for i in range(num):
    array = list(map(int, input().strip().split()))
    grid.append(array)

empty = []

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

    for x in range(grid[i-1][1]):
        empty.append(grid[i-1][0])

        
empty.sort()

print(empty[rank-1])

Submission status: Time Limit Exceeded

Solution code:
num, rank = map(int,input().split())
grid = []
for i in range(num):
    array = list(map(int, input().strip().split()))
    grid.append(array)

empty = []

for i in range(1,num+1):
    if len(empty) == rank:
        break
    else:
        for x in range(grid[i-1][1]):
            empty.append(grid[i-1][0])


empty.sort()

print(empty[rank-1])

Submission status: Time Limit Exceeded

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

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