Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N, M, Q = map(int, input().split())
li = []
for q in range(Q):
    a, b, c, d = map(int, input().split())
    li.append([[a,b], c, d])
ok_list = []
def dfs(num_li, depth):
    if len(num_li) == N:
        ok_list.append(num_li)
        return
    if depth == M:
        return
    dfs(num_li, depth+1)
    while len(num_li) <N:
        num_li += str(depth)
        dfs(num_li, depth+1)
dfs("", 0)
maxpoint = 0
for ok in ok_list:
    point = 0
    for q in range(Q):
        if int(ok[li[q][0][1]-1])- int(ok[li[q][0][0]-1]) == li[q][1]:
            point += li[q][2]
    if point > maxpoint:
        maxpoint = point
print(maxpoint)
N, M, Q = map(int, input().split())
li = []
for q in range(Q):
    a, b, c, d = map(int, input().split())
    li.append([[a,b], c, d])
ok_list = []
def dfs(num_li, depth):
    if len(num_li) == N:
        ok_list.append(num_li)
        return
    if depth == M:
        return
    dfs(num_li, depth+1)
    while len(num_li) <N:
        num_li += str(depth)
        dfs(num_li, depth+1)
dfs("", 0)
maxpoint = 0
for ok in ok_list:
    point = 0
    for q in range(Q):
        if int(ok[li[q][0][1]-1])- int(ok[li[q][0][0]-1]) == li[q][1]:
            point += li[q][2]
    if point > maxpoint:
        maxpoint = point
print(maxpoint)

Fixed submission:
K = int(input())
A, B = map(int, input().split())
b = False
bai = K
counter = 1
while bai <= B:
    if A <= bai <= B:
        b = True
        break
    counter += 1
    bai = K*counter
if b:
    print("OK")
else:
    print("NG")
Buggy python submission (verdict: Time Limit Exceeded):
N, M, Q = map(int, input().split())
li = []
for q in range(Q):
    a, b, c, d = map(int, input().split())
    li.append([[a,b], c, d])
ok_list = []
def dfs(num_li, depth):
    if len(num_li) == N:
        ok_list.append(num_li)
        return
    if depth == M:
        return
    dfs(num_li, depth+1)
    while len(num_li) <N:
        num_li += str(depth)
        dfs(num_li, depth+1)
dfs("", 0)
maxpoint = 0
for ok in ok_list:
    point = 0
    for q in range(Q):
        if int(ok[li[q][0][1]-1])- int(ok[li[q][0][0]-1]) == li[q][1]:
            point += li[q][2]
    if point > maxpoint:
        maxpoint = point
print(maxpoint)


Fixed submission:
N, M, Q = map(int, input().split())
li = []
for q in range(Q):
    a, b, c, d = map(int, input().split())
    li.append([[a,b], c, d])
ok_list = []
def dfs(num_li, depth):
    if len(num_li) == N:
        ok_list.append(num_li)
        return
    if depth == M:
        return
    dfs(num_li, depth+1)
    while len(num_li) <N:
        num_li += str(depth)
        dfs(num_li, depth+1)
dfs("", 0)
maxpoint = 0
for ok in ok_list:
    point = 0
    for q in range(Q):
        if int(ok[li[q][0][1]-1])- int(ok[li[q][0][0]-1]) == li[q][1]:
            point += li[q][2]
    if point > maxpoint:
        maxpoint = point
print(maxpoint)

Buggy python submission (verdict: Time Limit Exceeded):
N, M, Q = map(int, input().split())
li = []
for q in range(Q):
    a, b, c, d = map(int, input().split())
    li.append([[a,b], c, d])
ok_list = []
def dfs(num_li, depth):
    if len(num_li) == N:
        ok_list.append(num_li)
        return
    if depth == M:
        return
    dfs(num_li, depth+1)
    while len(num_li) <N:
        num_li += str(depth)
        dfs(num_li, depth+1)
dfs("", 0)
maxpoint = 0
for ok in ok_list:
    point = 0
    for q in range(Q):
        if int(ok[li[q][0][1]-1])- int(ok[li[q][0][0]-1]) == li[q][1]:
            point += li[q][2]
    if point > maxpoint:
        maxpoint = point
print(maxpoint)

Fixed submission:
N, M, Q = map(int, input().split())
li = []
for q in range(Q):
    a, b, c, d = map(int, input().split())
    li.append([[a,b], c, d])
ok_list = []
def dfs(num_li, depth):
    if len(num_li) == N:
        ok_list.append(num_li)
        return
    if depth == M:
        return
    dfs(num_li, depth+1)
    while len(num_li) <N:
        num_li += str(depth)
        dfs(num_li, depth+1)
dfs("", 0)
maxpoint = 0
for ok in ok_list:
    point = 0
    for q in range(Q):
        if int(ok[li[q][0][1]-1])- int(ok[li[q][0][0]-1]) == li[q][1]:
            point += li[q][2]
    if point > maxpoint:
        maxpoint = point
print(maxpoint)
Buggy python submission (verdict: Runtime Error):
N = int(input())
li = []
count = 0
for n in range(N):
    i = input()
    if i in li:
        pass
    else:
        li.append(i)
        count+=1
print(count)

Fixed submission:
S, W = map(int, input().split())
if W >= S:
    print("unsafe")
else:
    print("safe")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
li = []
count = 0
for n in range(N):
    i = input()
    if i in li:
        pass
    else:
        li.append(i)
        count+=1
print(count)

Fixed submission:
N = int(input())
li = []
count = 0
for n in range(N):
    i = input()
    li.append(i)
print(len(set(li)))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
li = []
for n in range(N):
    i = input()
    if i in li:
        pass
    else:
        li.append(i)
print(len(li))

Fixed submission:
N = int(input())
li = []
count = 0
for n in range(N):
    i = input()
    li.append(i)
print(len(set(li)))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
li = []
for n in range(N):
    i = input()
    if i in li:
        pass
    else:
        li.append(i)
print(len(li))

Fixed submission:
N = int(input())
li = []
count = 0
for n in range(N):
    i = input()
    li.append(i)
print(len(set(li)))
Buggy python submission (verdict: Runtime Error):
import math
count=0
for p in range(1,k+1):
    for q in range(1,k+1):
        for r in range(1,k+1):
            count+=math.gcd(math.gcd(p,q), r)
            
print(count)

Fixed submission:
import math
k = int(input())
count=0
for p in range(1,k+1):
    for q in range(p,k+1):
        for r in range(q,k+1):
            if p == q == r:
                count+=math.gcd(math.gcd(p,q), r)
            elif p == q:
                count+=math.gcd(math.gcd(p,q), r)*3
            elif q == r:
                count+=math.gcd(math.gcd(p,q), r)*3
            elif p == r:
                count+=math.gcd(math.gcd(p,q), r)*3
            else:
                count+=math.gcd(math.gcd(p,q), r)*6
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = list(input())
R =[]
G = []
B = []
lr = 0
lg = 0
lb = 0
for i in range(N):
    if S[i] == "R":
        R.append(i)
        lr+=1
    elif S[i] == "G":
        G.append(i)
        lg+=1
    else:
        B.append(i)
        lb+=1
ncount = 0
for r in R:
    for g in G:
        for b in B:
            s_li = sorted([r,g,b])
            if s_li[2]-s_li[1] == s_li[1]-s_li[0]:
                ncount+=1
print(lr*lg*lb - ncount)

Fixed submission:
N = int(input())
S = list(input())
R =[]
G = []
B = []
lr = 0
lg = 0
lb = 0
ncount = 0
for i in range(N):
    if S[i] == "R":
        R.append(i)
        lr+=1
    elif S[i] == "G":
        G.append(i)
        lg+=1
    else:
        B.append(i)
        lb+=1
    if i < N/2:
        for j in range(i+1):
            if S[i-j]!=S[i]:
                if S[i-j] != S[i+j]:
                    if S[i+j] != S[i]:
                        ncount+=1
    else:
        for j in range(N-i):
                if S[i-j]!=S[i]:
                    if S[i-j] != S[i+j]:
                        if S[i+j] != S[i]:
                            ncount+=1
print(lr*lg*lb - ncount)
Buggy python submission (verdict: Runtime Error):
N, K, C = map(int, input().split())
S = list(input())
#left_greedy
countr = 0
countl = 0
switchr = 0
switchl = 0
left_greedy = [0]*len(S)
right_greedy=[0]*len(S)
#left
for l in range(len(S)):
    i = S[l]
    if switchl ==1:
        if i == 'o':
            if countl >= C:
                left_greedy[l]=1
                clist[l] = countl
                countl = 0
            else:
                countl+=1
                clist[l] = countl
        else:
            countl+=1
    else:
        if i == 'o':
            left_greedy[l]=1
            switchl+=1
#right_greedy
    r = len(S)-l-1
    i = S[r]
    if switchr ==1:
        if i == 'o':
            if countr >= C:
                right_greedy[r]=1
                
                countr = 0
            else:
                countr+=1
        else:
            countr+=1
            
    else:
        if i == 'o':
            right_greedy[r]=1
            switchr+=1
for n in range(len(S)):
    if left_greedy[n] == right_greedy[n]==1:
        print(n+1)

Fixed submission:
X, Y, Z = map(int, input().split())
print("{} {} {}".format(Z,X,Y))

Buggy python submission (verdict: Runtime Error):
N, K, C = map(int, input().split())
S = list(input())
countr = 0
countl = 0
switchr = 0
switchl = 0
left_greedy = [0]*len(S)
right_greedy=[0]*len(S)
#left
for l in range(len(S)):
    i = S[l]
    if switchl ==1:
        if i == 'o':
            if countl >= C:
                left_greedy[l]=1
                clist[l] = countl
                countl = 0
            else:
                countl+=1
                clist[l] = countl
        else:
            countl+=1
    else:
        if i == 'o':
            left_greedy[l]=1
            switchl+=1
#right_greedy
    r = len(S)-l-1
    i = S[r]
    if switchr ==1:
        if i == 'o':
            if countr >= C:
                right_greedy[r]=1
                
                countr = 0
            else:
                countr+=1
        else:
            countr+=1
            
    else:
        if i == 'o':
            right_greedy[r]=1
            switchr+=1
for i in range(len(S)):
    if S[i] ==  'o':
        l = left_greedy[0:i].count(1)
        r = right_greedy[i+1:len(S)].count(1)
        x = r+l
        if 1 in left_greedy[0:i][::-1]:
            if 1 in right_greedy[i+1:len(S)-1]:
                if left_greedy[0:i][::-1].index(1)+right_greedy[i+1:len(S)-1][::-1].index(1)+1 < C:
                    x+=-1
        if x < K:
            print(i+1)

Fixed submission:
X, Y, Z = map(int, input().split())
print("{} {} {}".format(Z,X,Y))
Buggy python submission (verdict: Time Limit Exceeded):
n, x, y = map(int, input().split())
king_li = []
for i in range(1, n+1):
    for j in range(i+1,n+1):
        li = []
        li.append(abs(y-j)+abs(x-i)+1)
        li.append(j-i)
        king_li.append(min(li))
for z in range(1,n):
    print(king_li.count(z))

Fixed submission:
n, x, y = map(int, input().split())
dic={}
for i in range(1, n+1):
    for j in range(i+1,n+1):
        m = min(abs(y-j)+abs(x-i)+1,j-i)
        if m in dic.keys():
            dic[m] += 1
        else:
            dic[m] =1

for z in range(1,n):
    if z in dic.keys():
        print(dic[z])
    else:
        print(0)
Buggy python submission (verdict: Runtime Error):
import collections
n = int(input())
li = list(map(int, input().split()))
def calc(a):
    return int(a*(a-1)*0.5)
for k in range(n):
	dic = collections.Counter(li)
	dic[li[k]] -=1
	data2 = map(calc, list(dic.values()))
	print(sum(data2))

Fixed submission:
n, m = map(int, input().split())
if n <= 1:
    sn = 0
else:
    sn = int(0.5*(n)*(n-1))
if m <= 1:
    sm = 0
else:
    sm = int(0.5*(m)*(m-1))
print(sn+sm)
Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
if a+b == 0:
  x = 0
else:
	s = n//(a+b)
	t = n%(a+b)
	if t <= a:
    	x = s*a+t
	else:
    	x = s*a+a
print(x)

Fixed submission:
n, a, b = map(int, input().split())
if a+b == 0:
  x = 0
else:
	s = n//(a+b)
	t = n%(a+b)
	if t <= a:
		x = s*a+t
	else:
		x = s*a+a
print(x)

Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
if a+b == 0:
  x = 0
else:
	s = n//(a+b)
	t = n%(a+b)
    if t <= a:
    	x = s*a+t
	else:
    	x = s*a+a
print(x)

Fixed submission:
n, a, b = map(int, input().split())
if a+b == 0:
  x = 0
else:
	s = n//(a+b)
	t = n%(a+b)
	if t <= a:
		x = s*a+t
	else:
		x = s*a+a
print(x)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
t  ={}
for i in range(q):
    t[i]=input().split()
rv_count = 0
x = "X"
for d in t.values():
    if d[0] == "1":
        x2 = x[::-1]
        rv_count += 1
    elif d[0] == "2":
        if d[1] == "1":
            x2 = d[2]+x
        else:
            x2 = x+d[2]
    x = x2
if rv_count%2 == 0:
    xf =x.replace("X", s)
else:
     xf =x.replace("X", s[::-1])
print(xf)

Fixed submission:
s = input()
q = int(input())
t  ={}
for i in range(q):
    t[i]=input().split()
rv_count = 0
x = "X"
for d in t.values():
	if d[0] == "1":
		rv_count += 1
	else:
		if rv_count % 2 ==0:
			if d[1] == "1":
				x2 = d[2]+x
			else:
				x2 = x+d[2]
			x = x2
		else:
			red = d[2][::-1]
			if d[1] == "1":
				x2 = x + red
			else:
				x2 = red+x
			x = x2

if rv_count%2 == 0:
    xf = x.replace("X", s)
else:
	xf = x.replace("X", s)[::-1]
    
print(xf)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
t  ={}
for i in range(q):
    t[i]=input().split()
for d in t.values():
    if d[0] == "1":
        s2 = s[::-1]
    elif d[0] == "2":
        if d[1] == "1":
            s2 = d[2]+s
        else:
            s2 = s+d[2]
    s = s2
print(s)

Fixed submission:
s = input()
q = int(input())
t  ={}
for i in range(q):
    t[i]=input().split()
rv_count = 0
x = "X"
for d in t.values():
	if d[0] == "1":
		rv_count += 1
	else:
		if rv_count % 2 ==0:
			if d[1] == "1":
				x2 = d[2]+x
			else:
				x2 = x+d[2]
			x = x2
		else:
			red = d[2][::-1]
			if d[1] == "1":
				x2 = x + red
			else:
				x2 = red+x
			x = x2

if rv_count%2 == 0:
    xf = x.replace("X", s)
else:
	xf = x.replace("X", s)[::-1]
    
print(xf)
Buggy python submission (verdict: Runtime Error):
ok_list= []
for al in range(10**(n-1), 10**(n)):
    ynli = []
    li = list(str(al))
    for mm in range(m):
        if li[int(sc[int(mm)][0])-1] != sc[int(mm)][1]:
            ynli.append("NO")
    if "NO" in ynli:
        pass
    else:
        ok_list.append(al)
if ok_list == []:
    print(-1)
print(min(ok_list))

Fixed submission:
n, m = map(int, input().split())
sc = {}
for m2 in range(m):
    sc[m2]=input().split()
ok_list= []
for al in range(0, 10**(n)):
    ynli = []
    li = list(str(al))
    if len(li) == n:
        for mm in range(m):
            if li[int(sc[int(mm)][0])-1] != sc[int(mm)][1]:
                ynli.append("NO")
        if "NO" in ynli:
            pass
        else:
            ok_list.append(al)
    else:
        pass
if ok_list == []:
    print(-1)
else:
    print(min(ok_list))

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
sc = {}
for m2 in range(m):
    sc[m2]=input().split()
ok_list= []
ok_list= []
for al in range(10**(n-1), 10**(n)):
    ynli = []
    li = list(str(al))
    for mm in range(m):
        if li[int(sc[int(mm)][0])-1] != sc[int(mm)][1]:
            ynli.append("NO")
    if "NO" in ynli:
        pass
    else:
        ok_list.append(al)
print(min(ok_list))

Fixed submission:
n, m = map(int, input().split())
sc = {}
for m2 in range(m):
    sc[m2]=input().split()
ok_list= []
for al in range(0, 10**(n)):
    ynli = []
    li = list(str(al))
    if len(li) == n:
        for mm in range(m):
            if li[int(sc[int(mm)][0])-1] != sc[int(mm)][1]:
                ynli.append("NO")
        if "NO" in ynli:
            pass
        else:
            ok_list.append(al)
    else:
        pass
if ok_list == []:
    print(-1)
else:
    print(min(ok_list))
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p =[int(s) for s in input().split()]
s = 0
key = 0
pred = 0
for r in range(n-k+1):
    s2 = sum(p[r:r+k])
    if s2>s:
        s = s2
        key = r
print(0.5*(s+k))

Fixed submission:
n, k = map(int, input().split())
p =[int(s) for s in input().split()]
s = 0
key = 0
pred = 0
acc = {}
for h in range(n):
    if h == 0:
        acc[0] = p[0]
    else:
        acc[h] = acc[h-1]+p[h]
for r in range(n-k+1):
    if r == 0:
        s2 = acc[k-1]
    else:
        s2 = acc[k+r-1]-acc[r-1]
    if s2>s:
        s = s2
        key = r
print(0.5*(s+k))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p =[int(s) for s in input().split()]
s = 0
key = 0
pred = 0
for r in range(n-k+1):
    s2 = sum(p[r:r+k])
    if s2>s:
        s = s2
        key = r
for f in p[key:key+k]:
    pred+=(f+1)*0.5
print(pred)

Fixed submission:
n, k = map(int, input().split())
p =[int(s) for s in input().split()]
s = 0
key = 0
pred = 0
acc = {}
for h in range(n):
    if h == 0:
        acc[0] = p[0]
    else:
        acc[h] = acc[h-1]+p[h]
for r in range(n-k+1):
    if r == 0:
        s2 = acc[k-1]
    else:
        s2 = acc[k+r-1]-acc[r-1]
    if s2>s:
        s = s2
        key = r
print(0.5*(s+k))
Buggy python submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
def div_num(a, b, c):
    if (a%c)==0:
        return (b//c)-(a//c)+1
    else:
        return (b//c)-(a//c)
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
XC = div_num(A, B, C)
XD = div_num(A, B, D)
print("XC==={},  XD==={},  XCD==={}".format(XC,XD,XCD))
print(B-A+1-(XC+XD-XCD))

Fixed submission:
A, B, C, D = map(int, input().split())
def div_num(a, b, c):
    if (a%c)==0:
        return (b//c)-(a//c)+1
    else:
        return (b//c)-(a//c)
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
XC = div_num(A, B, C)
XD = div_num(A, B, D)
XCD = div_num(A,B,int((C*D)/gcd(C,D)))
print(B-A+1-(XC+XD-XCD))

Buggy python submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())
def div_num(a, b, c):
    if (a%c)==0:
        return (b//c)-(a//c)+1
    else:
        return (b//c)-(a//c)

XC = div_num(A, B, C)
XD = div_num(A, B, D)
XCD = div_num(A,B,int((C*D)/math.gcd(C,D)))
print(B-A+1-(XC+XD-XCD))

Fixed submission:
A, B, C, D = map(int, input().split())
def div_num(a, b, c):
    if (a%c)==0:
        return (b//c)-(a//c)+1
    else:
        return (b//c)-(a//c)
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
XC = div_num(A, B, C)
XD = div_num(A, B, D)
XCD = div_num(A,B,int((C*D)/gcd(C,D)))
print(B-A+1-(XC+XD-XCD))
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
h = [i for i in map(int, input().split())]
memo = [0]*N
for i in range(N):
    mini = 10**10
    for j in range(i-min(i, K), i, 1):
        if memo[j] + abs(h[i]-h[j]) < mini:
            mini = memo[j] + abs(h[i]-h[j])
    if i != 0:
        memo[i] = mini
print(memo[N-1])
N, K = map(int, input().split())
h = [i for i in map(int, input().split())]
memo = [0]*N
for i in range(N):
    mini = 10**10
    for j in range(i-min(i, K), i, 1):
        if memo[j] + abs(h[i]-h[j]) < mini:
            mini = memo[j] + abs(h[i]-h[j])
    if i != 0:
        memo[i] = mini
print(memo[N-1])

Fixed submission:
N, K = map(int, input().split())
h = [i for i in map(int, input().split())]
memo = [0]*N
for i in range(N):
    mini = 10**10
    for j in range(i-min(i, K), i, 1):
        if memo[j] + abs(h[i]-h[j]) < mini:
            mini = memo[j] + abs(h[i]-h[j])
    if i != 0:
        memo[i] = mini
print(memo[N-1])

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
h = [i for i in map(int, input().split())]
memo = [0]*N
for i in range(N):
    mini = 10**10
    for j in range(i-min(i, K), i, 1):
        if memo[j] + abs(h[i]-h[j]) < mini:
            mini = memo[j] + abs(h[i]-h[j])
    if i != 0:
        memo[i] = mini
print(memo[N-1])
N, K = map(int, input().split())
h = [i for i in map(int, input().split())]
memo = [0]*N
for i in range(N):
    mini = 10**10
    for j in range(i-min(i, K), i, 1):
        if memo[j] + abs(h[i]-h[j]) < mini:
            mini = memo[j] + abs(h[i]-h[j])
    if i != 0:
        memo[i] = mini
print(memo[N-1])
提出情報

Fixed submission:
N, K = map(int, input().split())
h = [i for i in map(int, input().split())]
memo = [0]*N
for i in range(N):
    mini = 10**10
    for j in range(i-min(i, K), i, 1):
        if memo[j] + abs(h[i]-h[j]) < mini:
            mini = memo[j] + abs(h[i]-h[j])
    if i != 0:
        memo[i] = mini
print(memo[N-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
h = [i for i in map(int, input().split())]
memo = [0]*N
for i in range(N):
    mini = 10**10
    for j in range(i-min(i, K), i, 1):
        if memo[j] + abs(h[i]-h[j]) < mini:
            mini = memo[j] + abs(h[i]-h[j])
    if i != 0:
        memo[i] = mini
print(memo[N-1])

Fixed submission:
N, K = map(int, input().split())
h = [i for i in map(int, input().split())]
memo = [0]*N
for i in range(N):
    mini = 10**10
    for j in range(i-min(i, K), i, 1):
        if memo[j] + abs(h[i]-h[j]) < mini:
            mini = memo[j] + abs(h[i]-h[j])
    if i != 0:
        memo[i] = mini
print(memo[N-1])
Buggy python submission (verdict: Runtime Error):
import numpy as np
N, W = map(int, input().split())
dp = np.zeros((N, W+1), dtype = "int64")
for i in range(N):
    w, v = map(int, input().split())
    dp[i,-w:] = dp[i-1, -w:] #残りの重さW-w以上にするためには、荷物を入れられない。
    dp[i, :W-w+1] = np.fmax(dp[i-1, :W-w+1], dp[i-1, w:]+v)
print(dp[N-1, 0])

Fixed submission:
import numpy
N, W = map(int, input().split())
memo = numpy.array([[10**9+1 for i in range(10**5+1)] for j in range(N)])
memo[-1][0] = 0
for n in range(N):
    w, v = map(int, input().split())
    memo[n][:v] = memo[n-1][:v]
    memo[n][v:] = numpy.fmin(memo[n-1][v:], memo[n-1][:-v]+w)
a = numpy.where(memo[-1] <= W)
print(numpy.max(a[0]))

Buggy python submission (verdict: Runtime Error):
import numpy as np
N, W = map(int, input().split())
dp = np.zeros((N, W+1), dtype = "int64")
for i in range(N):
    w, v = map(int, input().split())
    dp[i,-w:] = dp[i-1, -w:] #残りの重さW-w以上にするためには、荷物を入れられない。
    dp[i, :W-w+1] = np.fmax(dp[i-1, :W-w+1], dp[i-1, w:]+v)
print(dp[N-1, 0])

Fixed submission:
import numpy
N, W = map(int, input().split())
memo = numpy.array([[10**9+1 for i in range(10**5+1)] for j in range(N)])
memo[-1][0] = 0
for n in range(N):
    w, v = map(int, input().split())
    memo[n][:v] = memo[n-1][:v]
    memo[n][v:] = numpy.fmin(memo[n-1][v:], memo[n-1][:-v]+w)
a = numpy.where(memo[-1] <= W)
print(numpy.max(a[0]))
Buggy python submission (verdict: Runtime Error):
a,s,b = input(str, input().split())
if s == "+":
    print(int(a) + int(b))
else:
    print(int(a) - int(b))

Fixed submission:
a,s,b = map(str, input().split())
if s == "+":
    print(int(a) + int(b))
else:
    print(int(a) - int(b))

Buggy python submission (verdict: Runtime Error):
a,s,b = input(str, input.split())
if s ="+":
    print(int(a) +int(b))
else:
    print(int(a) - int(b))

Fixed submission:
a,s,b = map(str, input().split())
if s == "+":
    print(int(a) + int(b))
else:
    print(int(a) - int(b))

Buggy python submission (verdict: Runtime Error):
a,s,b = input(str, input.split())
if s == "+":
    print(a + b)
else:
    print(a - b)

Fixed submission:
a,s,b = map(str, input().split())
if s == "+":
    print(int(a) + int(b))
else:
    print(int(a) - int(b))

Buggy python submission (verdict: Runtime Error):
a,s,b = input(str, input.split())
if s ="+":
    print(a + b)
else:
    print(a - b)

Fixed submission:
a,s,b = map(str, input().split())
if s == "+":
    print(int(a) + int(b))
else:
    print(int(a) - int(b))