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())
l=[0]*(10**5+1)
for i in range(n):
  a,b=map(int,input().split())
  l[a]+=b

sm=0
for i in range(1,n+1):
  sm+=l[i]
  if sm>=k:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
N,K = (int(T) for T in input().split())
Now = 0
for TN in range(0,N):
    Num,Count = (int(T) for T in input().split())
    if Now<K<=Now+Count:
        print(Num)
        break
    else:
        Now += Count

Submission status: Wrong Answer

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

# In[6]:


N,K = map(int, input().split())
mylist = []
m = 0
for _ in range(N):
    a,b = map(int, input().split())
    if a < m or len(mylist) < K:
        for _ in range(b):
            mylist.append(a)


# In[7]:


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


# In[ ]:

Submission status: Wrong Answer

Solution code:
from collections import deque
N, K = map(int, input().split())
A, B = deque([]), deque([])
for _ in range(N):
  a, b = map(int, input().split())
  A.append(a)
  B.append(b)
while K>B[0]:
  K -= B.popleft()
  A.popleft()
print(A[0])

Submission status: Wrong Answer

Solution code:
n,k=map(int, input().split())
l=[tuple(map(int, input().split())) for _ in range(n)]
a,b=0,0
for t in l:
    b=a+t[1]
    if a<k<=b:
        print(t[0])
        exit()
    a=b
#print(l)

Submission status: Wrong Answer

Solution code:
n,k=map(int, input().split())
l=[tuple(map(int, input().split())) for _ in range(n)]
a,b=0,0
for t in l:
    b=a+t[1]
    if a<k<=b:
        print(t[0])
        exit()
    a=b
print(l)

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc061/tasks/abc061_c
import sys

def main():
    n, k = map(int, input().split())
    ans = [0 for _ in range(10**5+1)]
    for x in sys.stdin.readlines():
        a, b = map(int, x.split())
        ans[a] += b

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import collections
[n,k] = [int(i) for i in input().split()]
dic = collections.defaultdict(int)
for i in range(n):
  [a,b] = [int(j) for j in input().split()]
  dic[a] += b
keys = sorted(list(dic.keys()))
tmp = 0
for key in keys:
  tmp += dic[key]
  if k < tmp:
    print(key)
    break

Submission status: Wrong Answer

Solution code:
import collections
[n,k] = [int(i) for i in input().split()]
dic = collections.defaultdict(int)
for i in range(n):
  [a,b] = [int(j) for j in input().split()]
  dic[a] += b
keys = sorted(list(dic.keys()))
tmp = -1
for key in keys:
  tmp += dic[key]
  if k < tmp:
    print(key)
    break

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
l = [list(map(int,input().split())) for i in range(n)]
a,b = [list(i) for i in zip(*l)]
p = 0
for i in range(n):
    p += b[i]
    if p >= k:
        print(a[i])
        break

Submission status: Wrong Answer

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: Wrong Answer

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

L = []

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

sorted(L)

print(L[K-1])

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
c = 0
for _ in range(n):
    a,b = map(int,input().split())
    c += b

    if k-1 < c:
        print (a)
        exit ()

Submission status: Wrong Answer

Solution code:
import itertools

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

    if k-1 < c:
        print ((list(itertools.chain.from_iterable(l)))[k-1])
        exit ()

Submission status: Wrong Answer

Solution code:
import sys

def main():
    n, k = map(int, input().split())
    cnt = 1
    for x in sys.stdin.readlines():
        a, b = map(int, x.split())
        if cnt + b < k:
            cnt += b
        else:
            print(a)
            exit()

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys

def main():
    n, k = map(int, input().split())
    cnt = 0
    for x in sys.stdin.readlines():
        a, b = map(int, x.split())
        if cnt + b < k:
            cnt += b
        else:
            print(a)
            exit()

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N, K = [int(x) for x in input().split()]
a, b = zip(*[[int(x) for x in input().split()] for _ in range(N)])

bsum = 0
for i in range(N):
    bsum += b[i]
    if K <= bsum:
        print(a[i])
        break

Submission status: Wrong Answer

Solution code:
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))
from bisect import bisect_left

n,k=nii()

a_l=[]
b_l=[]
for i in range(n):
  a,b=nii()
  a_l.append(a)
  b_l.append(b)

b_rui=[0]
for i in range(1,n+1):
  b_rui.append(b_rui[i-1]+b_l[i-1])

b_rui=b_rui[1:]
inx=bisect_left(b_rui,k)

print(a_l[inx])

Submission status: Wrong Answer

Solution code:
s = input().split()
n = int(s[0])
k = int(s[1])

count = 0
answer = 0
max_number = 0
p_h = []
q_h = []

for i in range(n):
    v = input().split()
    p = int(v[0])
    q = int(v[1])
    p_h.append(p)
    q_h.append(q)

for i in range(len(p_h)):
    x = p_h[i]
    count += q_h[i]
    if k <= count:
        max_number = max(max_number, x)
        answer = max_number
        break

print(answer)

Submission status: Wrong Answer

Solution code:
s = input().split()
n = int(s[0])
k = int(s[1])

count = 0
answer = 0
max_number = 0

for i in range(n):
    v = input().split()
    p = int(v[0])
    q = int(v[1])
    max_number = max(max_number,p)
    count += q
    if k <= count:
        answer = max_number
        break

print(answer)

Submission status: Wrong Answer

Solution code:
s = input().split()
n = int(s[0])
k = int(s[1])

count = 0
answer = 0

for i in range(n):
    v = input().split()
    p = int(v[0])
    q = int(v[1])
    count += q
    if k <= count:
        answer = p
        break

print(answer)

Submission status: Wrong Answer

Solution code:
# ABC061_C
N, K = map(int, input().split())
ans = 0
for i in range(N):
    a, b = map(int, input().split())
    K -= b
    if K <= 0:
        ans = a
        break
print(ans)

Submission status: Wrong Answer

Solution code:
# ABC061_C
N, K = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
ans = 0
for i in range(N):
    K -= AB[i][1]
    if K <= 0:
        ans = AB[i][0]
        break
print(ans)

Submission status: Wrong Answer

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

sum = 0
ans = 0

for i in range(N):
    sum += AB[i][1]
    if sum >= K:
        ans = AB[i][0]
        break

print(ans)

Submission status: Wrong Answer

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

count = 0

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

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
d = {}
for _ in range(n):
    a,b = map(int,input().split())
    d[str(a)] = d.get(str(a),0) +b
d2 = sorted(d.items(), key=lambda x: x[0])
cnt=0
for i in d2:
    cnt+=i[1]
    if cnt >= k:
        print(int(i[0]))
        exit(0)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

lis = ""

for i in range(n):
    a, b = input().split()
    tmp = a * int(b)
    lis += tmp

print(lis[k])

Submission status: Wrong Answer

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

dic = {}

for i in range(N):
    if str(AB[i][0]) in dic.keys():
        dic[str(AB[i][0])] += AB[i][1]
    else:
        dic[str(AB[i][0])] = AB[i][1]

ref = 0
for d in dic.keys():
    ref += dic[d]
    if ref >= K:
        break

print(d)

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
d = dict()
for _ in range(N):
    a, b = map(int, input().split())
    d[a] = d.get(a, 0) + b
for key in sorted(d.keys()):
    c = d[key]
    if K <= c:
        break
    c -= K
print(key)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
temp={}
a=[0]*n
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[i]=at
a.sort()
cnt=0
for i in range(n):
  cnt=cnt+temp[a[i]]
  if cnt>=k:
    print(a[i])
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

INF = 10 ** 5 + 1
arr = [INF] * 4
for i in range(n):
    a, b = map(int, input().split())
    new = [a] * min(b, 4)

    arr += new
    arr.sort()
    arr = arr[:4]

print(arr[3])

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
ab = [tuple(map(int, input().split())) for _ in range(n)]
sm = 0
for a, b in ab:
    sm += b
    if sm >= k:
        print(a)
        break

Submission status: Wrong Answer

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

N,K = list(map(int,input().split()))
lis = []
for _ in range(N):
    a,b = list(map(int,input().split()))
    lis += [a]*b
lis = sorted(lis)
print(lis[K])

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

Submission status: Wrong Answer

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

while True:
  x,y = [int(i) for i in input().split()]
  sum += y
  if K <= sum:
    print(x)
    break

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n, k = MAP()
c = defaultdict(int)

for i in range(n):
    a, b = MAP()
    c[a] = c[a] + b

d = sorted(c.items(), key=itemgetter(1))
reg = 0
for x in d:
    reg += x[1]
    if reg >= k:
        print(x[0])
        exit()

Submission status: Wrong Answer

Solution code:
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n, k = MAP()
c = defaultdict(int)

for i in range(n):
    a, b = MAP()
    c[a] = c[a] + b

reg = 0
for i in c.keys():
    reg += c[i]
    if reg >= k:
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:

(n, k) = map(int, input().split())
(a, b) = zip(*[map(int, input().split()) for _ in range(n)])

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

print(ans)

Submission status: Wrong Answer

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

sorted_d=sorted(d.items(),key=lambda x: x[0])

count=0
for i,j in d.items():
    count+=j
    if count>=k:
        print(i)
        break

Submission status: Wrong Answer

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

    res = 0
    i = 0
    while(res < k):
        res += lis[i][1]
        if(res>=k):
            print(lis[i][0])
            exit()
        i+=1


if __name__ == '__main__':
    main4()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import bisect

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

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

ans = bisect.bisect_left(B, K)
print(A[ans])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

while True:
  if (k - a[i][1]) > 0:
    k -= a[i][1]
    ++i
  else:
    print(a[i][0])
    break

Submission status: Wrong Answer

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

while True:
  if (k - a[i][1]) > 0:
    k -= a[i][1]
    ++i
  else:
    print(a[i][0])
    break

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from sys import stdin
input = stdin.readline
d = defaultdict(int)
n,k = map(int,input().split())
for _ in range(n):
    a,b = map(int,input().split())
    d[a]+=b
for key,v in d.items():
    k-=v
    if k <= 0:
        break
print(key)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

n,k = map(int,input().split())
l = defaultdict(int)
for i in range(n):
    ai,bi = map(int,input().split())
    l[ai]+=bi
for key,v in l.items():
    k -= v
    if k<=0:
        break
print(key)

Submission status: Wrong Answer

Solution code:

url = "https://atcoder.jp//contests/abc061/tasks/abc061_c"
import heapq


def main():
    n,k = list(map(int, input().split()))
    dic = {}
    for _ in range(n):
        t = list(map(int, input().split()))
        dic.setdefault(t[0], 0)
        dic[t[0]] += t[1]
    dic_sorted = sorted(dic.items(), key=lambda x: x[0])
    count = 0
    for l in dic_sorted:
        count += l[1]
        if count >= n:
            print(l[0])
            exit()



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    n,k = list(map(int, input().split()))
    lis = []
    for _ in range(n):
        t = list(map(int, input().split()))
        lis.extend([t[0] for _ in range(t[1])])
    lis.sort()
    print(lis[n])

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:

url = "https://atcoder.jp//contests/abc061/tasks/abc061_c"

def main():
    n,k = list(map(int, input().split()))
    count = 0
    for _ in range(n):
        t = list(map(int, input().split()))
        count += t[1]
        if count >= k:
            print(t[0])
            exit()

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

D = sorted(D.items(), key=lambda x: x[0])
for d in D:
    if k <= d[1]:
        print(d[0])
    else:
        k -= d[1]

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def readinput():
    n,k=list(map(int,input().split()))
    abList=[]
    for _ in range(n):
        a,b=list(map(int,input().split()))
        abList.append((a,b))
    return n,k,abList

def main(n,k,abList):
    hist=[0]*(10**5+1)
    for a,b in abList:
        hist[a]+=b
    sum=0
    for i in range(1,10**5):
        sum+=hist[i]
        if sum>=k:
            return i
    else:
        return 0

if __name__=='__main__':
    n,k,abList=readinput()
    ans=main(n,k,abList)
    print(ans)

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
lst = [input().split() for _ in range(N)]
#print(lst)
#print(lst.sort())
lst = sorted(lst,key=lambda lst:lst[0])
#print(lst)
i = 0
sm = 0
for i in range(N):
    sm += int(lst[i][1])
    if sm >= K:
        print(lst[i][0])
        break

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
lst = [input().split() for _ in range(N)]
#print(lst)
#print(lst.sort())
lst = sorted(lst,key=lambda l:l[0])
#print(lst)
i = 0
sm = 0
for i in range(N):
    sm += int(lst[i][1])
    if sm >= K:
        print(lst[i][0])
        break

Submission status: Wrong Answer

Solution code:
N,K = map(int,input().split())
lst = [input().split() for _ in range(N)]
#print(lst)
#print(lst.sort())
lst = sorted(lst,key=lambda l:l[0])
#print(lst)
i = 0
sm = 0
while sm < K:
    sm += int(lst[i][1])
    i+=1
print(lst[i-1][0])

Submission status: Wrong Answer

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)

ss = [0]*(N+1)
ss[0] = B[0]

for i in range(1, N):
    ss[i] = ss[i-1] + B[i]
    if ss[i-1] < K <= ss[i]:
        print(A[i])
        exit()
    else:
        pass

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
num=[list(map(int,input().split())) for _ in range(N)]
for i in range(N):
  K -= num[i][1]
  if K <= 0:
    print(num[i][0])
    exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

#S = [[0 for j in range(3)] for i in range(2)]　2行3列の場合
S = [[0 for j in range(2)] for i in range(100001)]

for i in range(N):
    T=list(map(int,input().split()))
    S[T[0]][0]=T[0]
    S[T[0]][1]+=T[1]

#print(S)

for i in range(N+1):
    if S[i][0]!=0:
        K-=S[i][1]
        if K<=0:
            print(S[i][0])
            exit()

Submission status: Wrong Answer

Solution code:
N,K=[int(i) for i in input().split()]
R={}
for n in range(N):
    a,b=[int(i) for i in input().split()]
    R[a]=b+(R[a] if (a in R) else 0)
RR=sorted(list(R.keys()))
k=0
for ir in range(len(RR)):
    k+=R[RR[ir]]
    if k>K:
      print(RR[ir])
      break

Submission status: Wrong Answer

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

a=[]
b=[]
prev=0
for _ in range(n):
    a_i,b_i=map(int,input().split())

    a.append(a_i)
    b.append(prev + b_i)

    prev += b_i

for j in range(n):
    if k<=b[j]:
        break

print(a[j])

Submission status: Wrong Answer

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

import bisect as bi
a=[]
b=[]
prev=0
for _ in range(n):
    a_i,b_i=map(int,input().split())

    a.append(a_i)
    b.append(prev + b_i)

    prev += b_i

index = bi.bisect_left(b,k)


print(a[index])

Submission status: Wrong Answer

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

n, k = map(int, input().split())
ab = [tuple(map(int, input().split())) for _ in range(n)]
x = 0
for a, b in ab:
    x += b
    if x >= k:
        print(a)
        break

Submission status: Wrong Answer

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)
    print(arr[k-1])
    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
n,k = map(int,input().split())
count = 0
ans = 0
a = [list(map(int,input().split())) for i in range(n)]
number = sorted(a, key = lambda x: x[1])

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
x,y=list(map(int, input().split()))
ans=0
for i in range(x):
	a,b=list(map(int, input().split()))
	if y<=b and ans==0:
		ans=a
	else:
		y=y-b
print(ans)

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.append([a,b])

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
a,b=map(int,input().split())
s=[]
s.append(a)
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: Wrong Answer

Solution code:
from collections import Counter
n, k = map(int, input().split())

c = Counter()
for _ in range(n):
    a, b = map(int, input().split())
    c[a] += b
c = dict(sorted(c.items()))

for i, v in c.items():
    k -= v
    if k <= 0:
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
from collections import Counter
n, k = map(int, input().split())

c = Counter()
for _ in range(n):
    a, b = map(int, input().split())
    c[a] += b

for i, v in c.items():
    k -= v
    if k <= 0:
        print(i)
        exit()

Submission status: Wrong Answer

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

dic=sorted(dic.items(),key=lambda x:[0])

now=0
for i,v in dic:
  now+=v
  if k<=now:
    print(i)
    break

Submission status: Wrong Answer

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

dic=sorted(dic.items(),key=lambda x:x[1])
now=0
for i,v in dic:
  now+=v
  if k<=now:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
import sys
import itertools
import copy
from collections import defaultdict

input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    N, K = MI()
    index = 0
    d = defaultdict(int)
    for i in range(N):
        a, b = MI()
        d[a] += b
    d = sorted(d.items(), key=lambda x:x[0])
    for i in d:
        index += i[1]
        if index >= K:
            print(i[0])
        
        
main()

Submission status: Wrong Answer

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

ab = [list(map(int, input().split())) for _ in range(n)]
s_ab = sorted(ab, key=lambda x: x[0])
cnt = 0
ans = -1
print(s_ab)
for i in s_ab:
    cnt += i[1]
    if cnt >= k:
        print(cnt)
        ans = i[0]
        break
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import itertools
import copy

input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    N, K = MI()
    index = 0
    mylist = []
    for i in range(N):
        a, b = MI()
        index += b
        mylist.append([a, b])
        if index >= K:
            mylist.sort(key = lambda x: x[0])
            index2 = 0
            for j in mylist:
                index2 += j[1]
                if index2 >= K:
                    print(j[0])
                    sys.exit()
main()

Submission status: Wrong Answer

Solution code:
import sys
import itertools
import copy

input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    N, K = MI()
    index = 0
    mylist = []
    for i in range(N):
        a, b = MI()
        index += b
        mylist.append([a, b])
        if index >= K:
            mylist.sort(key = lambda x: x[0])
            
            index2 = 0
            for j in mylist:
                index2 += j[1]
                if index2 >= K:
                    print(j[0])
                    sys.exit()
main()

Submission status: Wrong Answer

Solution code:
import sys
import itertools
import copy

input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    N, K = MI()
    index = 0
    mylist = []
    for i in range(N):
        a, b = MI()
        index += b
        mylist.append([a, b])
        if index >= K:
            mylist.sort(key = lambda x: x[1])
            
            index2 = 0
            for j in mylist:
                index2 += j[1]
                if index2 >= K:
                    print(j[0])
                    sys.exit()
main()

Submission status: Wrong Answer

Solution code:
import sys
import itertools
import copy

input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    N, K = MI()
    index = 0
    mylist = []
    for i in range(N):
        a, b = MI()
        index += b
        mylist += [a]*b
        if index >= K:
            mylist.sort()
            print(mylist[K-1])
            sys.exit()

main()

Submission status: Wrong Answer

Solution code:
import sys
import itertools
import copy

input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    N, K = MI()
    index = 0
    for i in range(N):
        a, b = MI()
        index += b
        if index >= K:
            print(a)
            sys.exit()

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())
    for j in range(b):
        result.append(a)
result.sort()
print(result[n])