Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
Al = [int(i) for i in input().split()]

ans = 0
divjl = []
sAl = sorted(Al)
for i in range(len(Al)):
    if i in divjl:
        continue
    flag = True
    for j in range(len(Al)):
        if i == j:
            continue
        if sAl[i] % sAl[j] == 0:
            flag = False
            divjl.append(j)
    if flag:
        ans += 1

print(ans)

Fixed submission:
N = int(input())
Al = sorted([int(i) for i in input().split()])
maxAl = Al[-1]
markl = [-1] * (maxAl+1)

for i in Al:
    if markl[i] == 1:
        continue
    if markl[i] == 0:
        markl[i] = 1
        continue
    markl[i] = 0
    p = i*2
    while p <= maxAl:
        markl[p] = 1
        p += i
print(markl.count(0))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
Al = [int(i) for i in input().split()]

ans = 0
for i in range(len(Al)):
    for j in range(len(Al)):
        if i == j:
            continue
        if Al[i] % Al[j] == 0:
            break
    else:
        ans += 1

print(ans)

Fixed submission:
N = int(input())
Al = sorted([int(i) for i in input().split()])
maxAl = Al[-1]
markl = [-1] * (maxAl+1)

for i in Al:
    if markl[i] == 1:
        continue
    if markl[i] == 0:
        markl[i] = 1
        continue
    markl[i] = 0
    p = i*2
    while p <= maxAl:
        markl[p] = 1
        p += i
print(markl.count(0))
Buggy python submission (verdict: Runtime Error):
import numpy as np
from scipy.sparse.csgraph import shortest_path

N, M = map(int, input().split())
AB_list = []
for _ in range(M):
    AB_list.append([int(i)-1 for i in input().split()])

#print(N,M)
#print(AB_list)

mat = np.zeros((N, N))
for a, b in AB_list:
    mat[a][b] = 1
    mat[b][a] = 1
#print(mat)


def get_path(start, goal, pred):
    return get_path_row(start, goal, pred[start])

def get_path_row(start, goal, pred_row):
    path = []
    i = goal
    while i != start and i >= 0:
        path.append(i)
        i = pred_row[i]
    if i < 0:
        return []
    path.append(i)
    return path[::-1]


dist_list = [-1] * N

d, p = shortest_path(mat, return_predecessors=True, unweighted=True)
for n in range(1, N):
    shpath = get_path(n, 0, p)
    #print(n, shpath)
    for i in range(len(shpath)-1):
        #print(shpath[i], shpath[i+1], dist_list)
        if dist_list[shpath[i]] == -1: 
            dist_list[shpath[i]] = shpath[i+1]
        else:
            if dist_list[shpath[i]] != shpath[i+1]:
                print('No')
                exit()
print('Yes')
for dist in dist_list[1:]:
    print(dist+1)

Fixed submission:
N, M = map(int, input().split())
from collections import defaultdict
AB_dict = defaultdict(list)
dist_list = [-1] * N
dist_list[0] = 0
pre_list = []
for _ in range(M):
    a, b = [int(i)-1 for i in input().split()]
    AB_dict[a].append(b)
    AB_dict[b].append(a)
    if a == 0:
        pre_list.append(b)
        dist_list[b] = 0
    if b == 0:
        pre_list.append(a)
        dist_list[a] = 0
#print(AB_dict)

    
while True:
    tmp = []
    #print(pre_list)
    for p in pre_list:
        #print(p)
        for node in AB_dict[p]:
            #print("node", node)
            if dist_list[node] == -1:
                #print(node, "=", p)
                dist_list[node] = p
                tmp.append(node)
    if tmp == []:
        break
    pre_list = tmp
    
if -1 in dist_list:
    print('No')
    exit()
    
print('Yes')
for dist in dist_list[1:]:
    print(dist+1)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd_list(numbers):
    gcd = reduce(math.gcd, numbers)
    return gcd

K = int(input())
sumk = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            sumk += gcd_list([i,j,k])
print(sumk)
   

Fixed submission:
import math
from functools import reduce

def gcd_list(numbers):
    gcd = reduce(math.gcd, numbers)
    return gcd

K = int(input())
numberslist = []
sumgcd = 0
for i in range(1, K+1):
    for j in range(i, K+1):
        for k in range(j, K+1):
            if i == j == k:
                sumgcd += gcd_list([i,j,k])
            elif i == j or j == k or k == i:
                sumgcd += gcd_list([i,j,k])*3
            else:
                sumgcd += gcd_list([i,j,k])*6
                 
print(sumgcd)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from scipy.sparse.csgraph import shortest_path
N, X, Y = map(int, input().split())
G = np.zeros((N, N))
for i in range(N-1):
    G[i,i+1] = 1
    G[i+1,i] = 1
G[X-1, Y-1] = 1
G[Y-1, X-1] = 1
#print(G)
spG = shortest_path(G)
for i in range(1,N):
    print(int(np.count_nonzero(spG==i)/2))

Fixed submission:
N, X, Y = map(int, input().split())
X -= 1
Y -= 1
#print(N)
dlist = [0]*N
for k in range(1, N):
    for i in range(N-k):
        j = i + k
        usek = abs(X -i)+1+abs(j-Y)
        curk = min(k, usek)
        dlist[curk] += 1

for i in dlist[1:]:
    print(i)

Buggy python submission (verdict: Runtime Error):
import numpy as np
from scipy.sparse.csgraph import shortest_path
from scipy.sparse import csr_matrix
N, X, Y = map(int, input().split())
G = np.zeros((N, N))
for i in range(N-1):
    G[i,i+1] = 1
    G[i+1,i] = 1
G[X-1, Y-1] = 1
G[Y-1, X-1] = 1
#print(G)
spG = shortest_path(csr_matrix(G))
for i in range(1,N):
    print(int(np.count_nonzero(spG==i)/2))

Fixed submission:
N, X, Y = map(int, input().split())
X -= 1
Y -= 1
#print(N)
dlist = [0]*N
for k in range(1, N):
    for i in range(N-k):
        j = i + k
        usek = abs(X -i)+1+abs(j-Y)
        curk = min(k, usek)
        dlist[curk] += 1

for i in dlist[1:]:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
P = list(map(int, input().split()))
Pe = [(i+1)/2 for i in P]

maxsum = -1
for i in range(0, N-K+1):
    tmp = sum(Pe[i:i+K])
    if tmp > maxsum:
        maxsum = tmp

print(maxsum)

Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
Pe = [(i+1)/2 for i in P]

maxsum = -1
cur = sum(Pe[0:K])
maxsum = cur
for i in range(1, N-K+1):
    cur = cur - Pe[i-1] + Pe[i+K-1]
    if cur > maxsum:
        maxsum = cur

print(maxsum)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
P = list(map(int, input().split()))

maxsum = -1
for i in range(0, N-K+1):
    tmp = sum([(j+1)/2 for j in P[i:i+K]])
    if tmp > maxsum:
        maxsum = tmp

print(maxsum)

Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
Pe = [(i+1)/2 for i in P]

maxsum = -1
cur = sum(Pe[0:K])
maxsum = cur
for i in range(1, N-K+1):
    cur = cur - Pe[i-1] + Pe[i+K-1]
    if cur > maxsum:
        maxsum = cur

print(maxsum)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
P = list(map(int, input().split()))

maxsum = -1
for i in range(0, N-K+1):
    tmp = sum([(j+1)/2 for j in P[i:i+K]])
    if tmp > maxsum:
        maxsum = tmp

print(maxsum)

Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
Pe = [(i+1)/2 for i in P]

maxsum = -1
cur = sum(Pe[0:K])
maxsum = cur
for i in range(1, N-K+1):
    cur = cur - Pe[i-1] + Pe[i+K-1]
    if cur > maxsum:
        maxsum = cur

print(maxsum)
Buggy python submission (verdict: Runtime Error):
import numpy as np

N = input().strip()
K = int(input().strip())
lenN = len(N)

dp = np.zeros((lenN+1, 2, 4))
dp[0][1][0] = 1
for keta in range(lenN):
    for flag in range(2):
        for k in range(K+1):
            for i in range(10):
                nk = k
                nflag = flag
                if flag:
                    if i > int(N[keta]):
                        continue
                    if i < int(N[keta]):
                        nflag = 0
                if i != 0:
                    nk = k + 1
                if nk > K:
                    continue
                dp[keta+1][nflag][nk]+=dp[keta][flag][k]

print(int(dp[lenN][0][K] + dp[lenN][1][K]))


Fixed submission:
from collections import defaultdict

N = input().strip()
K = int(input().strip())
lenN = len(N)

memo = defaultdict(lambda :defaultdict(lambda :defaultdict(int)))
def f(keta, flag, k):
    if keta == lenN-1:
        if k == K:
            return 1
        else:
            return 0
    if keta in memo and flag in memo[keta] and k in memo[keta][flag]:
        return memo[keta][flag][k]
    nketa = keta + 1
    maxi = int(N[nketa]) if flag else 9
    res = 0
    for i in range(maxi+1):
        nflag = flag and (int(N[nketa]) == i)
        nk = k if i == 0 else k + 1
        if nk > K:
            continue
        res += f(nketa, nflag, nk)
    memo[keta][flag][k] = res
    return res

print(f(-1, True, 0))

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
P = list(map(int, input().split()))
Pe = [(i+1)/2 for i in P]

maxsum = -1
cur = sum(Pe[0:K])
maxsum = cur
for i in range(1, N-K+1):
    cur = cur - Pe[i-1] + Pe[i+K-1]
    if cur > maxsum:
        maxsum = cur

print(maxsum)

Fixed submission:
from collections import defaultdict

N = input().strip()
K = int(input().strip())
lenN = len(N)

memo = defaultdict(lambda :defaultdict(lambda :defaultdict(int)))
def f(keta, flag, k):
    if keta == lenN-1:
        if k == K:
            return 1
        else:
            return 0
    if keta in memo and flag in memo[keta] and k in memo[keta][flag]:
        return memo[keta][flag][k]
    nketa = keta + 1
    maxi = int(N[nketa]) if flag else 9
    res = 0
    for i in range(maxi+1):
        nflag = flag and (int(N[nketa]) == i)
        nk = k if i == 0 else k + 1
        if nk > K:
            continue
        res += f(nketa, nflag, nk)
    memo[keta][flag][k] = res
    return res

print(f(-1, True, 0))
Buggy python submission (verdict: Runtime Error):
import math
H,A = input().strip().split()
print(math.ceil(H/A))

Fixed submission:
import math
H, A = map(int, input().strip().split())
print(math.ceil(H/A))
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().strip().split())
R, S, P = map(int, input().strip().split())
score = {}
score['r'] = P
score['s'] = R
score['p'] = S
T = input().strip()

i = 0
skipl = []
res = 0
while i < N:
    if i in skipl:
        i += 1
        continue
    if i+K < N and T[i+K] == T[i]:
        skipl.append(i+K)
    res += score[T[i]]
    i += 1

print(res)

Fixed submission:
N, K = map(int, input().strip().split())
R, S, P = map(int, input().strip().split())
score = {}
score['r'] = P
score['s'] = R
score['p'] = S
T = input().strip()

i = 0
adptl = []
res = 0
while i < N:
    if i-K >= 0 and T[i-K] == T[i] and adptl[i-K] == 1:
        i += 1
        adptl.append(0)
        continue
    res += score[T[i]]
    adptl.append(1)
    i += 1

print(res)
Buggy python submission (verdict: Runtime Error):
N, K, Q = map(int, input().strip().split())
ansl = [int(input().strip()) for _ in range(Q)]
countl = Counter(ansl)
sumansl = sum(countl.values())
for i in range(N):
    print('Yes') if sumansl-countl[i+1] < K else print('No')

Fixed submission:
from collections import Counter
N, K, Q = map(int, input().strip().split())
ansl = [int(input().strip()) for _ in range(Q)]
countl = Counter(ansl)
sumcountl = sum(countl.values())
for i in range(N):
    print('Yes') if sumcountl-countl[i+1] < K else print('No')

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N, K, Q = map(int, input().strip().split())
ansl = [int(input().strip()) for _ in range(Q)]
countl = Counter(ansl)
for i in range(N):
    pid = i+1
    if sum([v for k,v in countl.items() if k != pid]) < K:
        print('Yes')
    else:
        print('No')

Fixed submission:
from collections import Counter
N, K, Q = map(int, input().strip().split())
ansl = [int(input().strip()) for _ in range(Q)]
countl = Counter(ansl)
sumcountl = sum(countl.values())
for i in range(N):
    print('Yes') if sumcountl-countl[i+1] < K else print('No')
Buggy python submission (verdict: Runtime Error):
#import sys
#sys.setrecursionlimit(99999999)


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

tomodachi=[[]for i in range(n)]

for i in range(m):
    tomodachi[friends[i][0]-1].append(friends[i][1]-1)
    tomodachi[friends[i][1]-1].append(friends[i][0]-1)

for i in range(n):
    tomodachi[i]=list(set(tomodachi[i]))

namelist=[1 for i in range(n)]
teams=[]

def haba(x,kari,tomodachi,namelist):
    for i in range(len(tomodachi[x])):
        if namelist[tomodachi[x][i]]==1:#生き残っているなら
            kari.append(tomodachi[x][i])
            namelist[tomodachi[x][i]]=0#殺す
            haba(tomodachi[x][i],kari,tomodachi,namelist)
    return(kari)
            


for i in range(n):
    if namelist[i]==1:
        teams.append(list(set(haba(i,[i],tomodachi,namelist))))

saidai=0

for i in range(len(teams)):
    if saidai<len(teams[i]):
        saidai=len(teams[i])

ans=saidai

print(ans)

Fixed submission:
import sys
sys.setrecursionlimit(99999999)


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

tomodachi=[[]for i in range(n)]

for i in range(m):
    tomodachi[friends[i][0]-1].append(friends[i][1]-1)
    tomodachi[friends[i][1]-1].append(friends[i][0]-1)

for i in range(n):
    tomodachi[i]=list(set(tomodachi[i]))

namelist=[1 for i in range(n)]
teams=[]

def haba(x,kari,tomodachi,namelist):
    for i in range(len(tomodachi[x])):
        if namelist[tomodachi[x][i]]==1:#生き残っているなら
            kari.append(tomodachi[x][i])
            namelist[tomodachi[x][i]]=0#殺す
            haba(tomodachi[x][i],kari,tomodachi,namelist)
    return(kari)
            


for i in range(n):
    if namelist[i]==1:
        teams.append(list(set(haba(i,[i],tomodachi,namelist))))

saidai=0

for i in range(len(teams)):
    if saidai<len(teams[i]):
        saidai=len(teams[i])

ans=saidai

print(ans)
Buggy python submission (verdict: Runtime Error):
nstr=input()
keta=len(nstr)
wa=0
for i in range(keta):
    wa+=nstr[i]

ans="No"
if wa%9==0:
    ans="Yes"

print(ans)

Fixed submission:
nstr=input()
keta=len(nstr)
wa=0
for i in range(keta):
    wa+=int(nstr[i])

ans="No"
if wa%9==0:
    ans="Yes"

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):

n=int(input())
alist=list(map(int,input().split()))

alist.sort()
blist=alist
blist=list(set(alist))

for i in range(n-1):
    for j in range(i+1,n):
        if alist[j]%alist[i]==0:
            if alist[j] in blist:
                blist.remove(alist[j])
'''
ans=0
for i in range(len(blist)):
    if blist[i]>0:
        ans+=1

print(ans)
'''
print(len(blist))

Fixed submission:

n=int(input())
alist=list(map(int,input().split()))


alist.sort()

hurui=[0]*(alist[-1]+1)

for i in range(n):
    for j in range(1,alist[-1]//alist[i]+1):
        hurui[alist[i]*j]+=1
ans=0
for i in range(n):
    if hurui[alist[i]]==1:
        ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
alist=list(map(int,input().split()))

ans=1
for i in range(n):
    ans*=alist[i]

if ans>pow(10,18):
    ans=-1

print(ans)

Fixed submission:
n=int(input())
alist=list(map(int,input().split()))
import math
mini=min(alist)
if mini==0:
    ans=0
else:
    ans=1
    for i in range(n):
        ans*=alist[i]
        if ans>pow(10,18):
            ans=-1
            break


print(ans)
Buggy python submission (verdict: Runtime Error):
"""
[a,b]=list(map(float,input().split()))
import math
a=int(a)
b=int(b*100)
ans=a*b
ans=ans/100
ans=math.floor(ans)
print(ans)
"""
import decimal
[a,b]=list(input().split())
a10=decimal.Decimal(a)
b10=decimal.Decimal(b)
ans=int(a10*b10)
print(ans)


"""
[a,b]=list(input().split())
a=int(a)
b12=list(b.split('.'))
bkai=int(int(b12[0])*100+int(b12[1]))
ans=a*bkai
ans=ans//100
print(ans)

Fixed submission:
"""
[a,b]=list(map(float,input().split()))
import math
a=int(a)
b=int(b*100)
ans=a*b
ans=ans/100
ans=math.floor(ans)
print(ans)
"""
[a,b]=list(input().split())
a=int(a)
b12=list(b.split('.'))
bkai=int(int(b12[0])*100+int(b12[1]))
ans=a*bkai
ans=ans//100
print(ans)

Buggy python submission (verdict: Runtime Error):
"""
[a,b]=list(map(float,input().split()))
import math
a=int(a)
b=int(b*100)
ans=a*b
ans=ans/100
ans=math.floor(ans)
print(ans)
"""
import decimal
[a,b]=list(input().split()
a10=decimal.Decimal(a)
b10=decimal.Decimal(b)
ans=int(a10*b10)
print(ans)


"""
[a,b]=list(input().split())
a=int(a)
b12=list(b.split('.'))
bkai=int(int(b12[0])*100+int(b12[1]))
ans=a*bkai
ans=ans//100
print(ans)

Fixed submission:
"""
[a,b]=list(map(float,input().split()))
import math
a=int(a)
b=int(b*100)
ans=a*b
ans=ans/100
ans=math.floor(ans)
print(ans)
"""
[a,b]=list(input().split())
a=int(a)
b12=list(b.split('.'))
bkai=int(int(b12[0])*100+int(b12[1]))
ans=a*bkai
ans=ans//100
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
ans=0
k=int(input())
for i in range(k):
    for j in range(k):
        for z in range(k):
            ans+=math.gcd(z+1,math.gcd(i+1,j+1))
print(ans)

Fixed submission:
import math
ans=0
k=int(input())
gcdlist=[[math.inf]*(k+1) for i in range(k+1)]
for i in range(1,k+1):
    for j in range(1,k+1):
        gcdlist[i][j]=math.gcd(i,j)
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans+=gcdlist[gcdlist[a][b]][c]
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
alist=list(map(int,input().split()))
blist=[alist[0]]
for i in range(1,n):
	blist.append(blist[-1]+alist[i]) #累積和
alist.reverse()
clist=[alist[0]]
for i in range(1,n):
	clist.append(clist[-1]+alist[i])
clist.reverse()
dlist=[]
for i in range(n):
	dlist.append(abs(blist[i]-clist[i])
ans=min(dlist)
print(int(ans))

# hanbun=blist[-1]/2
# shirushi=0
# l=0
# u=n-1
# while u>l+1:
	# aida=(l+u)//2
	# if blist[aida]==hanbun:
		# index=aida
		# shirushi=1
		# break
	# elif blist[aida]>hanbun:
		# l=aida
	# elif blist[aida]<hanbun:
		# u=aida

# if shirushi==1 and blist[-1]%2==0:
	# print(0)
# else:
	# if shirushi==0:
		# if blist[u]-hanbun>hanbun-blist[l]:
			# index=l
		# else:
			# index=u

	# ans=int(2*blist[index]-blist[-1])
	# if ans<0:
		# ans=int(ans*(-1))
	# print(ans)

Fixed submission:
n=int(input())
alist=list(map(int,input().split()))
blist=[alist[0]]
for i in range(1,n):
	blist.append(blist[-1]+alist[i]) #累積和
alist.reverse()
clist=[alist[0]]
for i in range(1,n):
	clist.append(clist[-1]+alist[i])
clist.reverse()
dlist=[]
for i in range(1,n):
	dlist.append(abs(blist[i-1]-clist[i]))
ans=min(dlist)
print(int(ans))

# hanbun=blist[-1]/2
# shirushi=0
# l=0
# u=n-1
# while u>l+1:
	# aida=(l+u)//2
	# if blist[aida]==hanbun:
		# index=aida
		# shirushi=1
		# break
	# elif blist[aida]>hanbun:
		# l=aida
	# elif blist[aida]<hanbun:
		# u=aida

# if shirushi==1 and blist[-1]%2==0:
	# print(0)
# else:
	# if shirushi==0:
		# if blist[u]-hanbun>hanbun-blist[l]:
			# index=l
		# else:
			# index=u

	# ans=int(2*blist[index]-blist[-1])
	# if ans<0:
		# ans=int(ans*(-1))
	# print(ans)
Buggy python submission (verdict: Runtime Error):
import math

n=int(input())
m=int(math.sqrt(n))
for i in reverse(range(1,m+1)):
	if n%i==0:
		print(int(i+n/i-2))
		break

Fixed submission:
import math

n=int(input())
m=int(math.sqrt(n))
for i in reversed(range(1,m+1)):
	if n%i==0:
		print(int(i+n/i-2))
		break
Buggy python submission (verdict: Runtime Error):
ab=list(map(int,input().split()))
a=ab[0]+ab[1]
b=ab[0]*ab[1]
c=ab[0]-ab[1]
flag=0
if a>b:
  if a>c:
    print(a)
    flag=1
else:
  if b>c:
    print(b)
    flag=1
if flag=0:
  print(c)

Fixed submission:

ab=list(map(int,input().split()))
a=ab[0]+ab[1]
b=ab[0]*ab[1]
c=ab[0]-ab[1]
flag=0
if a>b:
  if a>c:
    print(a)
    flag=1
else:
  if b>c:
    print(b)
    flag=1
if flag==0:
  print(c)
Buggy python submission (verdict: Runtime Error):
kx=list(map(int,input().split()))
k=kx[0]
x=kx[1]
a=x+1-k
b=x+k-1
print(a b)

Fixed submission:
kx=list(map(int,input().split()))
k=kx[0]
x=kx[1]
a=x+1-k
b=x+k
for i in range(a,b):
  print(i,end=" ")
Buggy python submission (verdict: Runtime Error):
n=int(input())
hlist=input().split()
hlist=list(map(int, hlist))
counter=0
counter2=0
counter3=0
hantei=0
for i in range(n-1): #そもそも単調増加
	if hlist[i]<=hlist[i+1]:
		counter=counter+1
		
for i in range(n): #全部一緒にできる
	if hlist[i]==hlist[0] or hlist[0]+1:
		#counter2=counter2+1

for i in range(n): #全部一緒にできる
	if hlist[i]==hlist[0] or hlist[0]-1:
		counter3=counter3+1


		
if counter==n-1 or counter2==n or counter3==n:
	hantei=1
	
if hantei==1:
	print("Yes")
else:print("No")

Fixed submission:
[a,b,c]=list(map(int, input().split()))
nokori=c-a+b
if nokori<0:
	nokori=0
print(nokori)
Buggy python submission (verdict: Time Limit Exceeded):
[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])

Fixed submission:
[n,k]=list(map(int,input().split()))
ablist=[]
for i in range(n):
    ablist.append(list(map(int,input().split())))
ablist=sorted(ablist,key=lambda x:x[0])
bwa=[0]
for i in range(n):
    bwa.append(bwa[-1]+ablist[i][1])
ind=1
while True:
    if bwa[ind-1]<k<=bwa[ind]:
        break
    ind+=1
print(ablist[ind-1][0])

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

Fixed submission:
[n,k]=list(map(int,input().split()))
ablist=[]
for i in range(n):
    ablist.append(list(map(int,input().split())))
ablist=sorted(ablist,key=lambda x:x[0])
bwa=[0]
for i in range(n):
    bwa.append(bwa[-1]+ablist[i][1])
ind=1
while True:
    if bwa[ind-1]<k<=bwa[ind]:
        break
    ind+=1
print(ablist[ind-1][0])

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

Fixed submission:
[n,k]=list(map(int,input().split()))
ablist=[]
for i in range(n):
    ablist.append(list(map(int,input().split())))
ablist=sorted(ablist,key=lambda x:x[0])
bwa=[0]
for i in range(n):
    bwa.append(bwa[-1]+ablist[i][1])
ind=1
while True:
    if bwa[ind-1]<k<=bwa[ind]:
        break
    ind+=1
print(ablist[ind-1][0])

Buggy python submission (verdict: Runtime Error):
[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(sort[k-1])

Fixed submission:
[n,k]=list(map(int,input().split()))
ablist=[]
for i in range(n):
    ablist.append(list(map(int,input().split())))
ablist=sorted(ablist,key=lambda x:x[0])
bwa=[0]
for i in range(n):
    bwa.append(bwa[-1]+ablist[i][1])
ind=1
while True:
    if bwa[ind-1]<k<=bwa[ind]:
        break
    ind+=1
print(ablist[ind-1][0])