Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
num = [0]*(10**5+1)

for i in range(N):
    a, b= map(int, input().split())
    num[a] += b
for i in range(1, 10**5+1):
    if K <= num[i]:
        print(i)
        exit()
    K -= num[i]:

Fixed submission:
N, K = map(int, input().split())
num = [0]*(10**5+1)
for i in range(N):
    a, b= map(int, input().split())
    num[a] += b
for i in range(1, 10**5+1):
    if K <= num[i]:
        print(i)
        exit()
    K -= num[i]

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
c = []

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

Fixed submission:
N, K = map(int, input().split())
num = [0]*(10**5+1)
for i in range(N):
    a, b= map(int, input().split())
    num[a] += b
for i in range(1, 10**5+1):
    if K <= num[i]:
        print(i)
        exit()
    K -= num[i]

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
c = []

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

Fixed submission:
N, K = map(int, input().split())
num = [0]*(10**5+1)
for i in range(N):
    a, b= map(int, input().split())
    num[a] += b
for i in range(1, 10**5+1):
    if K <= num[i]:
        print(i)
        exit()
    K -= num[i]

Buggy python submission (verdict: Runtime Error):
## N, K = map(int, input().split())
c = []
d = 0
for _ in range(N):
    a, b= map(int, input().split())
    for i in range(b):
        c.append(a)
    d += b
    if d <= K-1:
        break
print(sorted(c)[K-1])

Fixed submission:
N, K = map(int, input().split())
num = [0]*(10**5+1)
for i in range(N):
    a, b= map(int, input().split())
    num[a] += b
for i in range(1, 10**5+1):
    if K <= num[i]:
        print(i)
        exit()
    K -= num[i]

Buggy python submission (verdict: Time Limit Exceeded):
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])

Fixed submission:
N, K = map(int, input().split())
num = [0]*(10**5+1)
for i in range(N):
    a, b= map(int, input().split())
    num[a] += b
for i in range(1, 10**5+1):
    if K <= num[i]:
        print(i)
        exit()
    K -= num[i]

Buggy python submission (verdict: Time Limit Exceeded):
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])

Fixed submission:
N, K = map(int, input().split())
num = [0]*(10**5+1)
for i in range(N):
    a, b= map(int, input().split())
    num[a] += b
for i in range(1, 10**5+1):
    if K <= num[i]:
        print(i)
        exit()
    K -= num[i]

Buggy python submission (verdict: Time Limit Exceeded):
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])

Fixed submission:
N, K = map(int, input().split())
num = [0]*(10**5+1)
for i in range(N):
    a, b= map(int, input().split())
    num[a] += b
for i in range(1, 10**5+1):
    if K <= num[i]:
        print(i)
        exit()
    K -= num[i]

Buggy python submission (verdict: Runtime Error):
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.append(c)
print(sorted(c)[K-1])

Fixed submission:
N, K = map(int, input().split())
num = [0]*(10**5+1)
for i in range(N):
    a, b= map(int, input().split())
    num[a] += b
for i in range(1, 10**5+1):
    if K <= num[i]:
        print(i)
        exit()
    K -= num[i]

Buggy python submission (verdict: Time Limit Exceeded):
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])

Fixed submission:
N, K = map(int, input().split())
num = [0]*(10**5+1)
for i in range(N):
    a, b= map(int, input().split())
    num[a] += b
for i in range(1, 10**5+1):
    if K <= num[i]:
        print(i)
        exit()
    K -= num[i]