Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03778 (python)

Fixed submission:
W,a,b=map(int,input().split(' '))
print(max(0,b-(a+W))) if a<=b else print(max(0,a-(b+W)))

Buggy submission (verdict: Runtime Error):
W,a,b=map(int,input().split(' '))
print(max(0,b-(a+W)) if a<=b else print(max(0,a-(b+W)))
Problem p03796 (python)

Fixed submission:
import math
print(math.factorial(int(input()))%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math
print(math.factorial(N)%(10**9+7))
Problem p03919 (python)

Fixed submission:
H,W=map(int,input().split(' '))
S=[input().split(' ') for i in range(H)]
row = -1
for i in range(H):
    if 'snuke' in S[i]: row=i+1
col='ABCDEFGHIJKLMNOPQRSTUVWXYZ'[S[row-1].index('snuke')]
print(str(col)+str(row))

Buggy submission (verdict: Runtime Error):
H,W=map(int,input().split(' '))
S=[input().split(' ') for i in range(H)]
row=i+1 if 'snuke' in S[i] else continue for i in range(H)
col='ABCDEFGHIJKLMNOPQRSTUVWXYZ'[S[row-1].index('snuke')]
print(str(col)+str(row))

Buggy submission (verdict: Runtime Error):
H,W=map(int,input().split(' '))
S=[input().split(' ') for i in range(H)]
row=i+1 if 'snuke' in S[i] for i in range(H)
col='ABCDEFGHIJKLMNOPQRSTUVWXYZ'[S[row-1].index('snuke')]
print(str(col)+str(row))
Problem p03937 (python)

Fixed submission:
#AGC007 A
'''
問題
縦H行で横W列の盤面がある
コマははじめ左上隅のマスに置かれており，右下隅に移動した
駒は1マスずつ上下左右に動ける
駒が通ったことのあるマスが提示されるので，駒が常に右または下にしか動いていなかったどうか判定せよ
ただし通ったことのあるマスは'#',一度も通らなかったマスは'.'で与えられる

考察
各行0,1,...,i,...,H-1に対して'#'のマスが存在する範囲を[ai,bi]とする。ただし0<=ai<=bi<=W-1
このとき各0,1,...,j,...,H-2について b_j == a_(j+1) であればよい
'''

import re

H,W = map(int,input().split(' '))
A = []

ans = ''
answers = ('Possible','Impossible')

r = re.compile(r'\.*#+\.*')

for i in range(H):
	s = input()
	if len(r.findall(s)) == 1:
		A.append(s)
	else:
		#'#'が2箇所以上にわかれていたらその時点でアウト
		ans = answers[1]
		break

if ans == '':
	for i in range(H-1):
		if A[i].rfind('#') == A[i+1].find('#'):
			continue
		else:
			ans = answers[1]
			break

if ans == '':
	ans = answers[0]

print(ans)

Buggy submission (verdict: Runtime Error):
#AGC007 A
'''
問題
縦H行で横W列の盤面がある
コマははじめ左上隅のマスに置かれており，右下隅に移動した
駒は1マスずつ上下左右に動ける
駒が通ったことのあるマスが提示されるので，駒が常に右または下にしか動いていなかったどうか判定せよ
ただし通ったことのあるマスは'#',一度も通らなかったマスは'.'で与えられる

考察
各行0,1,...,i,...,H-1に対して'#'のマスが存在する範囲を[ai,bi]とする。ただし0<=ai<=bi<=W-1
このとき各0,1,...,j,...,H-2について b_j == a_(j+1) であればよい
'''

import re

H,W = map(int,input().split(' '))
A = []

ans = ''
answers = ('Possible','Impossible')

r = re.compile(r'\.*#+\.*')

for i in range(H):
	s = input()
	if len(r.findall(s)) == 1:
		A.append(s)
	else:
		#'#'が2箇所以上にわかれていたらその時点でアウト
		ans = answers[1]
		break
		
for i in range(H-1):
	if A[i].rfind('#') == A[i+1].find('#'):
		continue
	else:
		ans = answers[1]
		break

if ans == '':
	ans = answers[0]

print(ans)

Buggy submission (verdict: Runtime Error):
#AGC007 A
'''
問題
縦H行で横W列の盤面がある
コマははじめ左上隅のマスに置かれており，右下隅に移動した
駒は1マスずつ上下左右に動ける
駒が通ったことのあるマスが提示されるので，駒が常に右または下にしか動いていなかったどうか判定せよ
ただし通ったことのあるマスは'#',一度も通らなかったマスは'.'で与えられる

考察
各行0,1,...,i,...,H-1に対して'#'のマスが存在する範囲を[ai,bi]とする。ただし0<=ai<=bi<=W-1
このとき各0,1,...,j,...,H-2について b_j == a_(j+1) であればよい
'''

import re

H,W = map(int,input().split(' '))
A = []

ans = ''
answers = ('Possible','Impossible')

r = re.compile(r'\.*#+\.*')

for i in range(H):
	s = input()
	#'#'が2箇所以上にわかれていたらその時点でアウト
	if len(r.findall(s)) == 1:
		A.append(s)
	else:
		ans = answers[1]
		break
		
for i in range(H-1):
	if A[i].rfind('#') == A[i+1].find('#'):
		continue
	else:
		ans = answers[1]
		break

if ans == '':
	ans = answers[0]

print(ans)
Problem p03943 (python)

Fixed submission:
candy = sorted(list(map(int,input().split(' '))))
if candy[2]==(candy[0]+candy[1]):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
candy = sorted(list(map(int,input().split(' '))))
if candy[2]==(candy[0]+candy[1]):
    print('Yes')
else:
    print(No'')
Problem p03944 (python)

Fixed submission:
W,H,N=map(int,input().split(' '))
info = [[0],[W],[0],[H]] #min_x,max_x,min_y,max_y
for i in range(N):
  x,y,a=map(int,input().split(' '))
  info[a-1].append([x,y][(a-1)//2])
print(max(min(info[1])-max(info[0]),0)*max(min(info[3])-max(info[2]),0))

Buggy submission (verdict: Runtime Error):
W,H,N=map(int,input().split(' '))
info = [[],[],[],[]] #min_x,max_x,min_y,max_y
for i in range(N):
  x,y,a=map(int,input().split(' '))
  info[a-1].append((x,y)[(a-1)//2])
print(max(min(info[1])-max(info[0]),0)*max(min(info[3])-max(info[2]),0))
Problem p03029 (python)

Fixed submission:
A, P = map(int, input().split())
P += A * 3
print(int(P / 2))

Buggy submission (verdict: Runtime Error):
A, P = int(input())
P += A * 3
print(int(P / 2))

Buggy submission (verdict: Runtime Error):
n=A*3
pe=n+P
apple=pe//2

Buggy submission (verdict: Runtime Error):
A=int(input(" enter no of apples")
P=int(input(" enter no of peices ")
n=A*3
pe=n+P
apple=pe//2
print(apple)

Buggy submission (verdict: Runtime Error):
A=int(input(" enter no of apples")
P=int(input(" enter no of peices ")
n=A*3
pe=n+P
apple=pe//2
print(apple)
Problem p03029 (python)

Fixed submission:
inp = input()
A = int(inp.split()[0])
P = int(inp.split()[1])
result = int((A*3+P)/2)
print(result)

Buggy submission (verdict: Runtime Error):
import copy

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

value = 0
# k+1個取って，ret-1個戻す
num = min(N,K)
for k in reversed(range(num)):
    for ret in range(K-k): 
        if (ret < k+1):
            for i in range(k+1+1): # 左右の分け方
                tmp = []
                V_tmp = copy.copy(V)
                tmp.extend(V_tmp[:i]) # 左端
                V_tmp = V_tmp[i:]
                if (k+1-i) > 0:
                    tmp.extend(V_tmp[-(k+1-i):]) #右端
                if V_tmp == []:
                    break
                tmp = list(filter(lambda x: x not in sorted(tmp)[:ret],tmp))
                value = max(value,sum(tmp))
print(value)
Problem p03030 (python)

Fixed submission:
N = int(input())
inp = [input() for i in range(N)]

import numpy as np

s_list = []
p_list = []
for i in inp:
    s_list.append(i.split()[0])
    p_list.append(int(i.split()[1]))

sp_list = []
for i in range(N):
    sp_list.append([s_list[i],p_list[i]])

# 市を辞書順
sort_sp_list = sorted(sp_list)

# 市の種類
s_type = sorted(list(set(s_list)))
tmp_list = []
for type in s_type:
    tmp_list.append(sorted([s for s in sort_sp_list if s[0] == type],reverse=True))

rank_list = []
for tmp in tmp_list:
    for l in tmp:
        rank_list.append(l)

for rank in rank_list:
    print(sp_list.index(rank)+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
inp = [input() for i in range(N)]

import numpy as np

s_list = []
p_list = []
#sp_list = []
for i in inp:
    s_list.append(i.split()[0])
    p_list.append(int(i.split()[1]))
    #sp_list.append(i.split())
sp_list = []
for i in range(N):
    sp_list.append([s_list[i],p_list[i]])

# 市を辞書順
sort_sp_list = sorted(sp_list)

# 市の種類
s_type = sorted(list(set(s_list)))
tmp_list = []
for type in s_type:
    tmp_list.append(sorted([s for s in sort_sp_list if s[0] == type],reverse=True))
rank_list = np.array(tmp_list).reshape(N,2).tolist()

for i in [i.split() for i in inp]:
    print(rank_list.index(i)+1)
Problem p03032 (python)

Fixed submission:
import copy

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

result = 0
# i個取る
for i in range(min(N,K)+1):
    #print('i:',i)
    for sp in range(i+1): # 左右の分け方
        #print('right',sp)
        #print('left',i-sp)
        tmp = []
        V_tmp = copy.copy(V)
        #print('元々：',V_tmp)
        tmp.extend(V_tmp[:sp]) # 左端追加
        #print('left',V_tmp[:sp])
        tmp.extend(V_tmp[N-(i-sp):]) #右端追加
        #print('right',V_tmp[N-(i-sp):])
        #print(tmp)
        tmp = sorted(tmp)
        value = sum(tmp)
        # ret個戻す
        for ret in range(0, min(K-i,i)): #残り操作回数か取った石の個数iの小さい方
            if ret < i:
                # マイナスの価値は戻す
                if tmp[ret] < 0:
                    value -= tmp[ret]
                    #print('捨てた宝石：',tmp[ret])
            else:
                break
        result = max(result,value)
            #print()

print(result)

Buggy submission (verdict: Runtime Error):
import copy

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

value = 0
# k+1個取って，ret-1個戻す
for k in reversed(range(K)):
    for ret in range(K-k): #戻す個数はret個
        if (ret < k+1) and ((k+1+ret)<=K):
            for i in range(k+1+1): # 左右の分け方
                tmp = []
                V_tmp = copy.copy(V)
                for sp in range(i): # 左端iつ取る
                    tmp.append(V_tmp.pop(0))
                for sp in range(k+1-i): # 右端k+1-iつ取る
                    tmp.append(V_tmp.pop(-1))
                tmp = list(filter(lambda x: x not in sorted(tmp)[:ret],tmp))
                value = max(value,sum(tmp))

print(value)
Problem p03032 (python)

Fixed submission:
import sys
input = sys.stdin.readline
N,K = map(int,input().split())
V = list(map(int,input().split()))

D = []
ans = []

for i in range(K+1):
    for j in range(K-i+1):
        if i + j > N:
            break
        D.append(V[:i]+V[N-j:])

for d in D:
    for x in range(K-len(d)):
        if d==[]:
            break
        elif min(d)<0:
            d.pop(d.index(min(d)))

        elif min(d)>0:
            break
        
    if d==[]:
        ans.append(0)
    elif sum(d)>0:
        ans.append(sum(d))

if max(ans)>0:
    print(max(ans))

else:
    print(0)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N,K = map(int,input().split())
V = list(map(int,input().split()))

D = []
ans = 0

for i in range(K+1):
    for j in range(K-i+1):
        if i + j > N:
            break
        D.append(V[:i]+V[N-j:])

for d in D:
    for x in range(K-len(d)):
        if d==[]:
            break
        elif min(d)<0:
            d.pop(d.index(min(d)))

        elif min(d)>0:
            break
        
        if d!=[]:
            s = sum(d)
            if s>0 and s>ans:
                ans = s

print(s)
Problem p03040 (python)

Fixed submission:
from heapq import heapify, heappush, heappop
import sys
input = sys.stdin.readline
Q = int(input())
query = []
sumL, sumR = [], []
ans = 0
for _ in range(Q):
    a = list(map(int, input().split()))
    if a[0]==1:
        ans += a[2]
        if len(sumL)==0 or a[1] <= -sumL[0]:
            heappush(sumL, -a[1])
            ans += -sumL[0] - a[1]
        else:
            heappush(sumR, a[1])
            ans += sumL[0] + a[1]
    
        if len(sumR) > len(sumL):
            ans -= sumR[0] + sumL[0]
            heappush(sumL, -heappop(sumR))
            
        elif len(sumL) - len(sumR) >= 2:
            heappush(sumR, -heappop(sumL))

    else:
        print(-sumL[0],ans)

Buggy submission (verdict: Runtime Error):
from heapq import heapify, heappush, heappop
import sys
input = sys.stdin.readline
Q = int(input())
query = []
sumL, sumR = [], []
ans = 0
for _ in range(Q):
    a = list(map(int, input().split()))
    if a[0]==1:
        ans += a[2]
        if len(sumL)==0 or a[1] <= -sumL[0]:
            heappush(sumL, -a[1])
            ans += -sumL[0] - a[1]
        else:
            heappush(sumR, a[1])
            ans += sumL[0] + a[1]
    
        if len(sumR) > len(sumL):
            ans -= sumR[0] + sumL[0]
            heapposh(sumL, -heappop(sumR))
            
        elif len(sumL) - len(sumR) >= 2:
            heappush(sumR, -heappop(sumL))

    else:
        print(-sumL[0],ans)

Buggy submission (verdict: Runtime Error):
Q = int(input())
query = []
cal = []
intc = []
count = 0

for _ in range(Q):
    a = list(map(int, input().split()))
    if a[0]==1:
        intc.append(a[2])
        query.append(a[1])
        count += 1

    else:
        cal.append(count)


for c in cal:
    if c==1:
        print(query[0],intc[0])

    else:
        query = query[:c]
        query.sort()
        if c==2:
            print(query[0],sum(intc[:2])+query[1]-query[0])
        else:
            minx = int((c-1)/2)
            ans = -sum(query[:minx])+sum(query[minx+1:])+sum(intc[:c])
            print(query[minx],ans)
Problem p03044 (python)

Fixed submission:
N = int(input())
a = [0] * N
b = [[] for _ in range(N)]
for _ in range(N-1):
    x,y,z = map(int, input().split())
    x -= 1
    y -= 1
    b[x].append((y, z))
    b[y].append((x, z))


l = [(0, -1, 0)]
while l:
    x, s, t = l.pop()
    if t % 2 == 0:
        a[x] = 0
    else:
        a[x] = 1
    for v, w in b[x]:
        if v == s:
            continue
        l.append((v, x, t + w))

for x in a:
    print(x)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = []
b = {}

for i in range(N-1):
    c = list(map(int, input().split()))
    a.append(c)
    if i == 0:
        if c[2] % 2 == 0:
            b[c[0]] = 0
            b[c[1]] = 0
        else:
            b[c[0]] = 0
            b[c[1]] = 1
    if i > 0:
        if c[0] in b:
            if c[2] % 2 == 0:
                b[c[1]] = b[c[0]]
            else:
                b[c[1]] = (b[c[0]]+1)%2
                
        elif c[1] in b:
            if c[2] % 2 == 0:
                b[c[0]] = b[c[1]]
            else:
                b[c[0]] = (b[c[1]]+1)%2

while True:
    for j in a:
        if j[1] in b and j[0] not in b:
            if j[2] % 2 == 0:
                b[j[0]] = b[j[1]]
            else:
                b[j[0]] = (b[c[1]]+1)%2

        elif j[0] in b and j[1] not in b:
            if j[2] % 2 == 0:
                b[j[1]] = b[j[0]]
            else:
                b[j[1]] = (b[c[0]]+1)%2

    if len(b) == N:
        break
    
for l in range(1,N+1):
    print(b[l])
Problem p03030 (python)

Fixed submission:
n = int(input())

restrunt=[]

for i in range(n):
    a, b = input().split()
    restrunt.append( {"s":a, "p":int(b), "nom":i+1} )

restrunt.sort(key=lambda res:res["p"], reverse=True)
restrunt.sort(key=lambda res: res["s"])

for res in restrunt:
    print(res["nom"])

Buggy submission (verdict: Runtime Error):
n = int(input())

restrunt=[]

for i in range(n):
    a, b = input().split()
    restrunt.append( {"s":a, "t":int(b), "nom":i+1} )

restrunt.sort(key=lambda res:res["p"], reverse=True)
restrunt.sort(key=lambda res: res["s"])
for res in restrunt:
    print(res["nom"])
Problem p03044 (python)

Fixed submission:
import numpy as np


def calDistance_dfs(aList, d, node):
    stack = [node]
    d[node] = 0
    while len(stack) != 0:
        current = stack.pop()
        for v in aList[current]:
            if d[v[0]] == -1:
                stack.append(v[0])
                d[v[0]] = d[current]+v[1]


n = int(input())
adjacencyList = [[] for i in range(n)]
d = [-1] * n

for i in range(n - 1):
    s = list(map(int, input().split()))
    adjacencyList[s[0] - 1].append((s[1] - 1, s[2]))
    adjacencyList[s[1] - 1].append((s[0] - 1, s[2]))


d[0] = 0
calDistance_dfs(adjacencyList, d, 0)
for i in d:
    print(i % 2)

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


def calDistance_dfs(aList, d, node):
    for v in aList[node]:
        if d[v[0]] != -1:
            continue
        else:
            d[v[0]] = d[node] + v[1]
            calDistance_dfs(aList, d, v[0])


n = int(input())
adjacencyList = [[] for i in range(n)]
d = [-1] * n

for i in range(n - 1):
    s = list(map(int, input().split()))
    adjacencyList[s[0] - 1].append((s[1] - 1, s[2]))
    adjacencyList[s[1] - 1].append((s[0] - 1, s[2]))


d[0] = 0
calDistance_dfs(adjacencyList, d, 0)
for i in d:
    print(i % 2)

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

n = int(input())
c = np.array([[0] * n] * n, dtype=np.uint8)
for i in range(n - 1):
    s = list(map(int, input().split()))
    c[s[0], s[1]] = s[2]
    c[s[1], s[0]] = s[2]



def calDistance_dfs(c, d, start=0):
    d[start] = 0
    stack = []
    stack.append(start)
    while len(stack) != 0:
        current = stack.pop()
        for idx, val in enumerate(c[current, :]):
            if val!=0 and d[idx]==-1:
                stack.append(idx)
                d[idx] = d[current] + val


d = np.array([-1] * n)
calDistance_dfs(c, d, 0)

for i in d:
    print(d%2)
Problem p03160 (python)

Fixed submission:
#  入力
#  足場の高さ
input()
h = list(map(int, input().split()))


#  方針
#  i番目の足場にいるという状態に対して
#  その足場に最も少ないコストを記録する．

#  初期化は大きは数で
dp = [1e20 for i in range(len(h))]
#  スタートはコスト0
dp[0] = 0

#  i番目の足場でのコストを利用して
#  i+1, i+2番目のコストを計算する
for i in range(len(h) - 1):
    dp[i + 1] = (
        dp[i + 1]
        if dp[i + 1] < dp[i] + abs(h[i + 1] - h[i])
        else dp[i] + abs(h[i + 1] - h[i])
    )
    if i + 2 < len(h):
        dp[i + 2] = (
            dp[i + 2]
            if dp[i + 2] < dp[i] + abs(h[i + 2] - h[i])
            else dp[i] + abs(h[i + 2] - h[i])
        )

print(dp[len(h) - 1])

Buggy submission (verdict: Runtime Error):
#  入力
#  足場の高さ
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))


#  方針
#  i番目の足場にいるという状態に対して
#  その足場に最も少ないコストを記録する．

#  A_Frog.pyでわかることだが，pythonはver2のappendを使う方が処理が早い
#  足場0のコストは0
dp = [0 for i in range(len(h))]

for i in range(1, n):
    #  i番目の足場のコストの候補
    temp = [dp[j] + abs(h[i] - h[j]) for j in range(i - k, i) if j >= 0]
    #  候補の最小値をコストに記録
    dp[i] = min(temp)

print(dp[n - 1])
Problem p03161 (python)

Fixed submission:
import numpy as np

#  入力
n, k = list(map(int, input().split()))
h = np.array(list(map(int, input().split())))

#  方針
#  i番目の足場にいるという状態に対して
#  その足場に最も少ないコストを記録する．

dp = np.zeros(n, dtype=np.int)
for i in range(1, n):
    st = max(0, i - k)
    dp[i] = np.min(dp[st:i] + np.abs(h[i] - h[st:i]))

print(dp[-1])

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

#  入力
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))

#  方針
#  i番目の足場にいるという状態に対して
#  その足場に最も少ないコストを記録する．

dp = np.zeros(n)
for i in range(1, n):
    st = max(0, i - k)
    dp[i] = np.min(dp[st:i] + np.abs(h[i] - h[st:i]))

print(dp[n - 1])

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

#  入力
#  n, k = list(map(int, input().split()))
#  h = list(map(int, input().split()))
n, k = [5, 3]
h = np.array([10, 30, 40, 50, 20])

#  方針
#  i番目の足場にいるという状態に対して
#  その足場に最も少ないコストを記録する．

dp = np.zeros(n)
for i in range(1, n):
    st = np.max(0, i - k)
    dp[i] = np.min(dp[st:i] + np.abs(h[i] - h[st:i]))

print(dp[n - 1])
Problem p03163 (python)

Fixed submission:
import numpy as np


def main():
    N, W = list(map(int, input().split(' ')))
    items = np.array([list(map(int, input().split(' '))) for _ in range(N)])
    dp = np.zeros((N, W + 1))
    dp[0, items[0, 0]:] = items[0, 1]
    for n in range(1, N):
        weight, value = items[n, 0], items[n, 1]
        dp[n, :] = dp[n - 1, :]
        dp[n, weight:] = np.fmax(
            dp[n, weight:],
            value + dp[n - 1, :(- weight)]
        )
    print(int(dp[N - 1, W]))


if __name__ == '__main__':
    main()

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

n, w = list(map(int, input().split()))
wv = np.array([list(map(int, input().split())) for i in range(n)])

dp = np.zeros((w + 1, n))
dp[w[0, 0] :, 0] = np.full(dp[w[0, 0] :, 0].shape, w[0, 1])
for i in range(1, n):
    dp[:, i] = dp[:, i - 1]
    wNew, vNew = wv[i, 0], wv[i, 1]
    dp[wNew:, :] = np.fmax(dp[wNew:, :], vNew + dp[:-wNew, :])

print(dp[w, n - 1])

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

n, w = list(map(int, input().split()))
wv = np.array([list(map(int, input().split())) for i in range(n)])

dp = np.zeros((w + 1, n))
dp[w[0, 0]:, 0] = wv[0, 1]
for i in range(1, n):
    dp[:, i] = dp[:, i - 1]
    wNew, vNew = wv[i, 0], wv[i, 1]
    dp[wNew:, :] = np.fmax(dp[wNew:, :], vNew + dp[:-wNew, :])

print(dp[w, n - 1])

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

n, w = map(int, input().split())
wv = np.array([list(map(int, input().split())) for i in range(n)])

dp = np.zeros((w + 1, n))
dp[:, wv[0, 0]] = wv[0, 1]
for i in range(1, n):
    dp[:, i] = dp[:, i - 1]
    wNew, vNew = wv[i, 0], wv[i, 1]
    dp[wNew:, :] = np.fmax(dp[wNew:, :], vNew + dp[:-wNew, :])

print(dp[w, n - 1])
Problem p03035 (python)

Fixed submission:
A, B = map(int, input().split())

if A >= 13 : 
    print(B)
elif A >= 6 and A <= 12 : 
    print(B//2)
else :
    print("0")

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
A = list(map(int,input().split()))
A.sort()
max = 0 

for i in range(M):
    B,C = map(int, input().split())
    for j in range(B) :
        if  C >= A[j] : 
            A[j] = C
        else :
            continue
    A.sort()
sum = 0 
for i in range(N):
    sum += A[i] 

print(sum)
Problem p03029 (python)

Fixed submission:
arguments = input()
arguments_as_list = arguments.split(" ")
list_to_integer = list(map(int, arguments_as_list))
apples_pieces = list_to_integer[0]*3
pieces = list_to_integer[1]


print(int((apples_pieces + pieces)//2))

Buggy submission (verdict: Runtime Error):
arguments = input("test")
arguments_as_list = arguments.split(" ")
list_to_integer = list(map(int, arguments_as_list))
apples_pieces = list_to_integer[0]*3
pieces = list_to_integer[1]


print(int((apples + pieces)//2))

Buggy submission (verdict: Runtime Error):
arguments = input()
arguments_as_list = arguments.split(" ")
list_to_integer = list(map(int, arguments_as_list))
apples = list_to_integer(0)
pieces = list_to_integer(1)

print((apples//3 + pieces)//2)

Buggy submission (verdict: Runtime Error):
def applpie(apples, pieces):
  x = apples//3
  y = apples + pieces
   return y//2
Problem p03060 (python)

Fixed submission:
n = int(input())
val = []
for i in map(int, input().split()):
    val.append(i)
cost = []
for i in map(int, input().split()):
    cost.append(i)

ans = 0
for i in range(n):
    m = val[i] - cost[i]
    if m > 0:
        ans += m

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
val = []
for i in map(int, input().split()):
    i.append(val)
cost = []
for i in map(int, input().split()):
    i.append(cost)

x = 0
y = 0
m1 = 0
for i in range(n):
    x += val[i]
    y += cost[i]
    m2 = x-y
    if m1 < m2:
        m1 = m2

print(m2)
Problem p03071 (python)

Fixed submission:
A,B = map(int,input().split())

goukei = 0
for i in range(2):
    if A>=B:
        goukei = goukei + A
        A = A - 1
        continue
    
    if B > A :
        goukei = goukei + B
        B = B - 1
        continue
        
print(goukei)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = [int(n) for n in input().split()]

a = 0
b = 1
ans = 1

for i in range(n.length-2):
    if n[a]<n[b]:
        ans += 1
    a += 1
    b += 1
print(ans)
Problem p03101 (python)

Fixed submission:
H, W = map(int,input().split())
h, w = map(int,input().split())

val = H * (W - w)
dis = h*(W-w)
val = val - dis
print(val)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
 
min = min(A, B, C, D, E)
 
ans = 4 + int(N/min)
if N % min != 0:
    ans = ans + 1
print(ans)
Problem p03145 (python)

Fixed submission:
a,b,c = map(int,input().split())

hect = int(a*b*0.5)
print(hect)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().splid())

hect = a*b*0.5
print(hect)