Problem p03721 (python)

Fixed submission:

def list_pos(cnt,a,b,ans):
    if ans  >= b :
        return cnt-1
    else :

        ans += a[cnt][1]
        cnt += 1
        return list_pos(cnt,a,b,ans)
import sys
sys.setrecursionlimit(100000)
N,K = map(int,input().split())
para = {}
for i in range(N):
    a,b  = map(int,input().split())
    if not a in para.keys():
        para[a] = b
    else : para[a] += b

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

p = list_pos(0,para,K,0)
print("{}".format(para[p][0]))

Buggy submission (verdict: Runtime Error):

def list_pos(cnt,a,b,ans):
    if ans  >= b :
        return cnt-1
    else :

        ans += a[cnt][1]
        cnt += 1
        return list_pos(cnt,a,b,ans)
import sys
sys.setrecursionlimit(10000)
N,K = map(int,input().split())
para = {}
for i in range(N):
    a,b  = map(int,input().split())
    if not a in para.keys():
        para[a] = b
    else : para[a] += b

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

p = list_pos(0,para,K,0)
print("{}".format(para[p][0]))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)
def list_pos(cnt,a,b,ans):
    if ans  >= b :
        return cnt-1
    else :

        ans += a[cnt][1]
        cnt += 1
   　return list_pos(cnt,a,b,ans)

N,K = map(int,input().split())
para = {}
for i in range(N):
    a,b  = map(int,input().split())
    if not a in para.keys():
        para[a] = b
    else : para[a] += b

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

p = list_pos(0,para,K,0)
print("{}".format(para[p][0]))

Buggy submission (verdict: Runtime Error):
def list_pos(cnt,a,b,ans):
    if ans  >= b :
        return cnt-1
    else :

        ans += a[cnt][1]
        cnt += 1
        return list_pos(cnt,a,b,ans)

N,K = map(int,input().split())
para = {}
for i in range(N):
    a,b  = map(int,input().split())
    if not a in para.keys():
        para[a] = b
    else : para[a] += b

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

p = list_pos(0,para,K,0)
print("{}".format(para[p][0]))

Buggy submission (verdict: Runtime Error):
def list_pos(cnt,a,b,ans):
    if ans  >= b :
        return cnt-1
    else :

        ans += a[cnt][1]
        cnt += 1
    return list_pos(cnt,a,b,ans)

N,K = map(int,input().split())
para = {}
for i in range(N):
    a,b  = map(int,input().split())
    if not a in para.keys():
        para[a] = b
    else : para[a] += b

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

p = list_pos(0,para,K,0)
print("{}".format(para[p][0]))

Buggy submission (verdict: Runtime Error):
def list_pos(cnt,a,b,ans):
    if ans  >= b :
        return cnt-1
    else :

        ans += a[cnt][1]
        cnt += 1
    return list_pos(cnt,a,b,ans)

N,K = map(int,input().split())
para = [[i for i in map(int,input().split())] for j in range(N)]


p = list_pos(0,para,K,0)
print("{}".format(para[p][0]))

Buggy submission (verdict: Runtime Error):
def list_pos(cnt,a,b,ans):
    if ans  >= b :
        return cnt
    else :
        cnt += 1
        ans += a[cnt][1]
    return list_pos(cnt,a,b,ans)

N,K = map(int,input().split())
para = [[i for i in map(int,input().split())] for j in range(N)]


p = list_pos(-1,para,K,0)
print("{}".format(para[p][0]))

Buggy submission (verdict: Runtime Error):
def list_pos(cnt,a,b,ans):
    if ans  >= b :
        return cnt-1
    else :
        cnt += 1
        ans += a[cnt][1]
    return list_pos(cnt,a,b,ans)

N,K = map(int,input().split())
para = [[i for i in map(int,input().split())] for j in range(N)]


p = list_pos(0,para,K,0)
print("{}".format(para[p][0]))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
para = [[i for i in map(int,input().split())] for j in range(N)]
ans= []
size = 0
for i in range(N) :
    if size > K :
        break
    else: 
        ans += para[i]
        size = len(ans)
print("{}".format(ans[K]))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
para = [[i for i in map(int,input().split())] for j in range(N)]
ans= []
size = 0
for i in range(N) :
    if N > K :
        break
    else: 
        ans += para[i]
        size = len(ans)
print("{}".format(ans[K]))