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

Fixed submission:
a,b,c,d = map(int, input().split())
if b < c or d < a:
    ans = 0
else:
    ans = min(abs(c-b), abs(d-a), abs(b-a), abs(d-c))
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int, input())
if b < c or d < a:
    ans = 0
else:
    ans = min(abs(c-b), abs(d-a))
print(ans)
Problem p03844 (python)

Fixed submission:
a,op,b = map(str, input().split())
a = int(a)
b = int(b)
if op == '+':
    result = a + b
elif op == '-':
    result = a - b

print("{}".format(result))

Buggy submission (verdict: Runtime Error):
a,op,b = map(str, input().split())
a = int(a)
b = int(b)
if op == '+':
    result = a + b
else op == '-':
    result = a - b 
    
print("{}".format(result))

Buggy submission (verdict: Runtime Error):
a,op,b = map(str, input().split())
if op == '+':
    result = a + b
else op == '-':
    result = a - b 
    
print("{}".format(result))
Problem p03963 (python)

Fixed submission:
n,k = map(int, input().split())

ans = 0
for i in range(n):
    if i == 0:
        ans = k
    else:
        ans = ans * (k-1)
        
print(ans)

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

ans = 0
for i in range(n):
    if i == 0:
        ans = k
    else:
        ans = ans * (k-1)
        
print(ans)
Problem p04001 (python)

Fixed submission:
s = input()
n = (len(s) - 1)

ans_lst = []
for i in range(2**n):
    op = ["+"] * n 
    for j in range(n):
        if ((i >> j) & 1):
            op[n-j-1] = ""
    formula = ""
    for num,opp in zip(s, op + [""]):
        formula += (num + opp)
    ans_lst = ans_lst + [eval(formula)]

print(sum(ans_lst))

Buggy submission (verdict: Runtime Error):
s = input()
n = (len(s) - 1)

ans_lst = []
for i in range(2**n):
op = ["+"] * n 
    for j in range(n):
        if ((i >> j) & 1):
            op[n-j-1] = ""
    for num,opp in zip(s, op + [""]):
        formula += (num + opp)
    ans_lst = ans_lst + [eval(formula)]

print(sum(ans_lst))
Problem p02952 (python)

Fixed submission:
n = int(input())
ans = 0
for i in range(1, n + 1):
  if len(str(i)) % 2 == 1:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in range(1, n + 1):
  if len(str(i)) % 2 = 0:
    ans += 1
print(ans)
Problem p02969 (python)

Fixed submission:
r = int(input())
s = 3 * (r ** 2)
print(str(s))

Buggy submission (verdict: Runtime Error):
r = input()
s = 3 * (r ** 2)
print(s)

Buggy submission (verdict: Runtime Error):
r = int(input())
s = 3 * (r ** 2)
print(str(s)
Problem p02999 (python)

Fixed submission:
a,b=map(int,input().split())
if a<b:
    print("0")
else:
    print("10")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input(),split())
if a<b:
    print("0")
else:
    print("10")
Problem p03302 (python)

Fixed submission:
[a,b]=map(int,input().split())
if a*b==15:
  print("*")
else:
  if a+b==15:
    print("+")
  else:
    print("x")

Buggy submission (verdict: Runtime Error):
[a,b]=map(int,input().split())
if a*b=15:
  print("*")
else:
  if a+b=15:
    print("+")
    else:
      print("x")

Buggy submission (verdict: Runtime Error):
[a,b]=list(map(int,input().split()))
if a*b=15:
  print("*")
else:
  if a+b=15:
    print("+")
    else:
      print("x")

Buggy submission (verdict: Runtime Error):
[a,b]=list(map(int,(input().split())))
if a*b=15:
  print("*")
else:
  if a+b=15:
    print("+")
    else:
      print("x")

Buggy submission (verdict: Runtime Error):
[a,b]=list(map(int,(input().split())))
if a*b=15:
  print("*")
else:
  if a+b=15:
    print("+")
    else:
      print("None")
Problem p03814 (python)

Fixed submission:
s=input()
for i in range(len(s)):
    if s[i]=="A":
        a=i
        break
for j in range(len(s)):
    if s[-j-1]=="Z":
        z=(len(s)-j)
        break
print(z-a)

Buggy submission (verdict: Runtime Error):
s=input()
a=s.find("A")
z0=s.count("Z")
for i in range (z0-1):
    s=s[:s.find("Z")]+"a"+s[s.find("Z")+1:]
    z=s.find("Z")
print(z-a+1)

Buggy submission (verdict: Runtime Error):
s=input()
a=s.find("a")
z0=s.count("z")
for i in range (z0-1):
    s=s[:s.find("z")]+"a"+s[s.find("z")+1:]
    z=s.find("z")
print(z-a+1)
Problem p02603 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
# 単純な話
money = 1000
stock = 0
for i in range(N-1):
    if A[i]<A[i+1]:
        stock += money//A[i]
        money %= A[i]
        money += stock*A[i+1]
        stock = 0
print(money)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
dp = [[-1 for _ in range(N+1)] for _ in range(100)]
dp[0][0] = 1000
for n in range(1,N):
    for i in range(250):
        # n日目
        for j in range(250):
        # n-1日目
            if dp[j][n-1] != -1:
                dp[i][n] = max(dp[j][n-1]+(j-i)*A[n-1],dp[i][n])
ans = 1000
for i in range(20):
    if dp[i][-2] != -1:
        if dp[i][-2]+i*A[-1] > ans:
            ans = dp[i][-2]+i*A[-1]
print(ans)
Problem p02641 (python)

Fixed submission:
X,N = map(int,input().split())
if N>0:
    p = list(map(int,input().split()))
else:
    p = []
ans = []
for i in range(100):
    ans.append(X-i)
    ans.append(X+i)
import sys
for j in ans:
    if j not in p:
        print(j)
        sys.exit()

Buggy submission (verdict: Runtime Error):
X,N = map(int,input().split())
if N>0:
    p = list(map(int,input().split()))
ans = []
for i in range(100):
    ans.append(X-i)
    ans.append(X+i)
import sys
for j in ans:
    if j not in p:
        print(j)
        sys.exit()
Problem p02690 (python)

Fixed submission:
x = int(input())
n = 100000
 
def binp(arr, val):
    left,right = 0,len(arr)-1
    while left <= right:
        mid = (left+right)//2
        if val==arr[mid]: return mid
        elif val>=arr[mid]: left = mid+1
        else: right = mid-1
    return 0
 
def binn(arr, val):
    left,right = 0,len(arr)-1
    while left >= right:
        mid = (left+right)//2
        if val==arr[mid]: return mid
        elif val>=arr[mid]: right = mid+1
        else: left = mid-1
    return 0
 
ap = [i**5 for i in range(n)]
an = [-(i**5) for i in range(n)]
 
for b in range(-n,n):
    val = x + b**5
    a = max(binp(ap, val), binn(an,val))
    if a: print(a,b) ; break

Buggy submission (verdict: Runtime Error):
x = int(input())
n = 10*7

def blp(dp,num):
    l = 0
    r = len(dp)-1
    while l <= r:
        mid = (l+r)//2
        if num == dp[mid]:return mid
        elif num >= dp[mid]:l = mid+1
        else:r = mid-1
    return 0

def bln(dp,num):
    l = 0
    r = -len(dp)-1
    while l>=r:
        mid = (l+r)//2
        if num == dp[mid]:return mid
        elif num >= dp[mid]:r = mid+1
        else:l = mid-1
    return 0
            
ap = [i**5 for i in range(n)]
an = [-(i**5) for i in range(n)]

for b in range(-n,n):
    num = x + b**5
    a = max(blp(ap,num),bln(an,num))
    if a:print(a,b) ; break

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

def blp(dp,num):
    l = 0
    r = len(dp)-1
    while r-l>=0:
        mid = (l+r)//2
        if num == dp[mid]:
            return mid
        elif num >= dp[mid]:
            l = mid+1
        else:
            r = mid-1
    return 0

def bln(dp,num):
    l = 0
    r = len(dp)-1
    while l-r>=0:
        mid = (l+r)//2
        if num == dp[mid]:
            return mid
        elif num >= dp[mid]:
            r = mid+1
        else:
            l = mid-1
    return 0
            
ap = [i**5 for i in range(n)]
an = [-(i**5) for i in range(n)]

for b in range(-n,n):
    num = x + b**5
    a = max(blp(ap,num),bln(an,num))
    if a:
        print(a,b)
        sys.exit()
Problem p02691 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
L = []
for i in range(N):
    L.append(i-A[i])
R = []
for j in range(N):
    R.append(j+A[j])
from collections import Counter
LL = Counter(L)
RR = Counter(R)
ans = 0
for k,v in RR.items():
    ans += v*LL[k]
print(ans)

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

ans = 0
for i in range(N):
    for j in range(j,N):
        if j-i==A[i]+A[j]:
            ans += 1
print(ans)
Problem p02696 (python)

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

if N<= B-1:
    ans = (N*A)//B
else:
    ans = ((B-1)*A)//B
    
print(ans)

Buggy submission (verdict: Runtime Error):
A,B,N = map(int,input().split())

if N<= B-1:
    ans = (N*A)//B
else:
    ((B-1)*A)//B
    
print(ans)
Problem p02719 (python)

Fixed submission:
N,K = map(int,input().split())

if N>=K:
    x = N%K
    print(min(x,abs(K-x)))
else:
    print(min(N,abs(K-N)))

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

if N>=K:
    x = N%K
    print(min(x,abs(K-x))
else:
    print(min(N,abs(K-N))

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



if N>=K:
    x = N%K
    print(min(x,abs(K-x))
else:
          N<K
          print(min(N,abs(K-N))

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

if N%K==0:
    print(0)
else:
    x = abs(N-K)
    for i in range(N/K):
        x = min(x,abs(x-K))
    print(x)
Problem p02732 (python)

Fixed submission:
import collections
import copy
N = int(input())
A = list(map(int,input().split()))
AA = collections.Counter(A)
ans = sum([i*(i-1)//2 for i in AA.values()])

for i in range(N):
    num = ans
    num -= AA[A[i]]-1
    print(num)

Buggy submission (verdict: Runtime Error):
import collections
N = int(input())
A = list(map(int,input().split()))

for i in range(N):
    ans = 0
    AA = A.copy()
    AA.pop(i)
    AAA = collections.Counter(AA)
    for j in AAA.values():
        if j>=2:
            ans += int(j*(j-1)/2)
    print(ans)
Problem p02742 (python)

Fixed submission:
H,W = map(int,input().split())
if H==1 or W==1:
    print(1)
else:
    if H%2==0 or W%2==0:
        print(H*W//2)
    else:
        print(H*W//2+1)

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
for i in range(W):
    if i%2==0:
        if H%2==0:
            num += H//2
        else:
            num += H//2+1
    else:
        num += H//2
print(num)
Problem p02756 (python)

Fixed submission:
S = input()
Q = int(input())
Query = [list(map(str,input().split())) for _ in range(Q)]
from collections import deque 
flag = True
f = ""
l = ""
#print(Query)
for i in Query:
    if i[0]=="1":
        if flag:
            flag = False
        else:
            flag = True
    else:
        if (flag==True and i[1]=="1") or (flag==False and i[1]=="2"):
            f += i[2] 
        elif (flag==True and i[1]=="2") or (flag==False and i[1]=="1"):
            l += i[2]
S = f[::-1]+S+l
if flag:
    print(S)
else:
    print(S[::-1])

Buggy submission (verdict: Runtime Error):
S = input()
Q = int(input())
Query = [list(map(str,input().split())) for _ in range(Q)]
flag = True
print(Query)
for i in Query:
    if i[0]=="1":
        if flag:
            flag = False
        else:
            flag = True
    else:
        if (flag==True and i[1]=="1") or (flag==False and i[1]=="2"):
            f += i[1]
        elif (flag=True and i[1]=="2") or (flag==False and i[1]=="1":
            l += i[1]
S = f+S+l
if flag:
    print(S)
else:
    print(S[::-1])
Problem p02838 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7
ans = 0

for bit in range(60):
    m = 1 << bit
    # bit桁目のbitが立っている時の数
    c = sum(a&m for a in A) >> bit
    # bit桁目の1の合計
    ans += (c*(N-c))<<bit
    # 繰り上がりのない足し算
    ans %= mod
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7
for i in range(N):
    for j in range(i,N):
        ans += (i^j)%mod
print(ans%mod)
Problem p02882 (python)

Fixed submission:
import math
a,b,x = map(int,input().split())

if x==a*a*b:
  tanθ = 90
elif a*a*b>x>=a*a*b/2:
  tanθ = math.degrees(math.atan(a**2/(2*(a*b-x/a))))
else:
  tanθ = math.degrees(math.atan(2*x/(a*b*b)))

print(90-tanθ)

Buggy submission (verdict: Runtime Error):
import math
a,b,x = map(int,input().split())

if x>=a*a*b/2:
  tanθ = math.degrees(math.atan(a**2/(2*(a*b-x/a))))
elif 0<x<a*a*b/2:
  tanθ = math.degrees(math.atan(2*x/(a*b*b)))
elif x==0:
  tanθ = 90

print(90-tanθ)

Buggy submission (verdict: Runtime Error):
import math
a,b,x = map(int,input().split())

if x>=a*a*b/2:
  tanθ = math.degrees(math.atan(a**2/(2*(a*b-x/a))))
else:
  tanθ = math.degrees(math.atan(2*x/(a*b*b)))

print(90-tanθ)
Problem p02885 (python)

Fixed submission:
A,B = map(int,input().split())
L = A-2*B

if L>=0:
    print(L)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
A,B = int(input())
L = A-2*B

if L>=0:
    print(L)
else:
    print(0)
Problem p02900 (python)

Fixed submission:
import fractions
import collections
A,B = map(int,input().split())
p = fractions.gcd(A,B)
#print(p)
num = []
for i in range(2,int(p**0.5)+1):
    while p%i==0:
        num.append(i)
        p //= i
if p != 1:
    num.append(p)
#print(num)
pp = collections.Counter(num)
print(len(pp)+1)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
from fractions import gcd
C = gcd(A,B)
num = []
for i in range(2,int(C**0.5)+1):
    while C%i==0:
        num.append(i)
        C //= i
if C != 1:
    num.append(C)
    from collections import Counter
CC = Counter(num)
print(len(CC)+1)
Problem p03105 (python)

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

if B < A*C:
  print(B//A)
else:
  print(C)

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())

ans =[]
for i in range(1,100):
  if (A % i)== 0 and (B % i) == 0:
    ans.append(i)

ans_sort = ans[::-1]
print(ans_sort[K-1])
Problem p03145 (python)

Fixed submission:
a, b, c = map(int, input().split())
S = (1/2)*a*b*c/max(a,b,c)
print(int(S))

Buggy submission (verdict: Runtime Error):
s = int(input())
lis = []

def func(n):
    if n%2 == 0:
        return n//2
    else:
        return 3*n+1
 
while func(s) !=4:
    print(func(s))
    s = func(s)
    lis.append(s)
    
print(int(len(lis)+5))
Problem p03160 (python)

Fixed submission:
N = int(input())
H = list(map(int,input().split()))

dp = [0]*N
for i in range(N):
  if i == 0:
    dp[i] = 0
  elif i == 1:
    dp[i] = abs(H[i]-H[i-1])
  else:
    dp[i] = min((dp[i-1]+abs(H[i]-H[i-1])),dp[i-2]+abs(H[i]-H[i-2]))
print(dp[-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))

memo = {0:0,1:abs(H[1]-H[0])}
def dp(n):
    if n in memo:
        return memo[n]

    memo[n] = min(dp(n-2) + abs(H[n-2]-H[n]),dp(n-1) + abs(H[n-1]-H[n]))

    return memo[n]

print(dp(N-1))

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
# N = 4
# H = [10,30,40,20]
memo = {0:0,1:abs(H[1]-H[0])}
def dp(n):
    if n in memo:
        return memo[n]

    memo[n] = min(dp(n-2) + abs(H[n-2]-H[n]),dp(n-1) + abs(H[n-1]-H[n]))

    return memo[n]

print(dp(N-1))

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int,input().split()))

memo = {1:0,2:abs(H[1]-H[0])}
def K(n):
  if n in memo.keys():
    return memo[n]
  memo[n] = min(K(n-2)+abs(H[n]-H[n-2]),K(n-1)+abs(H[n]-H[n-1]))
  return memo[n]

print(K(N-1))
Problem p03164 (python)

Fixed submission:
N,W = map(int,input().split())
w_v = [list(map(int,input().split())) for i in range(N)]
INF = float("inf")
dp = [[INF]*100001 for i in range(N+1)]
dp[0][0]=0

for i in range(N):
  for j in range(100001):
    if j >= w_v[i][1]:
      dp[i+1][j] = min(dp[i][j],dp[i][j-w_v[i][1]]+w_v[i][0])
    else:
      dp[i+1][j] = dp[i][j]
    
ans = 0
for j in range(100001):
  if dp[-1][j] <= W:
    ans = max(ans,j)
print(ans)

Buggy submission (verdict: Runtime Error):
N,W = map(int,input().split())
w_v = [list(map(int,input().split())) for _ in range(N)]
dp = [[0]*W for _ in range(N)]

for i in range(0,N):
  if i == 0:
    if W>=w_v[0][0]:
      for j in range(w_v[0][0]-1,W):
        dp[i][j] = w_v[0][1]
  else:
    for j in range(W):
      if j-w_v[i][0]>=0:
        dp[i][j] = max(dp[i-1][j],dp[i-1][j-w_v[i][0]]+w_v[i][1])
      else:
        dp[i][j] = dp[i-1][j]

print(max(dp[-1]))
Problem p03471 (python)

Fixed submission:
N,Y = map(int,input().split())

for x in range(N+1):
  for y in range(N+1-x):
    z = N - x - y
    if 10000*x+5000*y+1000*z == Y:
        print(x,y,z)
        exit()
print(-1,-1,-1)

Buggy submission (verdict: Runtime Error):
N,Y = map(int,input().split())

change = False

for i in range(N+1):
    for j in range(N+1-i):
        if i*10000+j*5000+(N-i-j)*1000==Y:
            print(i,j,N-i-j)
            change = True
            break
else:
    break
            
if change != True:
    print("-1 -1 -1")
Problem p03495 (python)

Fixed submission:
N,K = map(int,input().split())
A = list(map(int,input().split()))

import collections
A_c = collections.Counter(A)
A_A = A_c.most_common()

ans = 0
for i in range(len(A_A)):
  if i >K-1:
    ans += list(A_A[i])[1]

if len(A_A)<=K:
  print(0)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
A = list(map(int,input().split()))

import collections
A_c = collections.Counter(A)
A_A = A_c.most_common()

ans = 0
for i in range(len(A_A)):
  if i >K-1:
    ans += list(A_A[i])[1]

if A_A<=K:
  print(0)
else:
  print(ans)
Problem p03557 (python)

Fixed submission:
import bisect
N = int(input())
ABC = [sorted(list(map(int,input().split()))) for i in range(3)]

ans = 0
for b in ABC[1]:
  ans += bisect.bisect_left(ABC[0],b)*(N-bisect.bisect_right(ABC[2],b))
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect
N = int(input())
ABC = [sorted(list(map(int,input().split()))) for i in range(3)]

for b in ABC[1]:
  ans += bisect.bisect_left(ABC[0],b)*(N-bisect.bisect_right(ABC[2],b))
print(ans)
Problem p03627 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
from collections import Counter
AA = Counter(A)
B = []
C = []
for k,v in AA.items():
    if v>=2:
        B.append(k)
    if v>=4:
        C.append(k)
B.sort(reverse=True)
C.sort(reverse=True)
if len(B)<=1 and len(C)==0:
    print(0)
else:
    if len(B)<=1:
        print(C[0]*C[0])
    elif len(C)==0:
        print(B[0]*B[1])
    else:
        print(max(B[0]*B[1],C[0]*C[0]))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
from collections import Counter
AA = Counter(A)
B = []
C = []
for k,v in AA.items():
    if v>=2:
        B.append(k)
    if v>=4:
        C.append(k)
B.sort(reverse=True)
C.sort(reverse=True)
if len(B)<=1 and len(C)==0:
    print(0)
else:
    if len(B)<=1:
        print(C[0]*C[0])
    else:
        print(max(B[0]*B[1],C[0]*C[0]))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
from collections import Counter
AA = Counter(A)
B = []
C = []
for k,v in AA.items():
    if v>=2:
        B.append(k)
    if v>=4:
        C.append(k)
B.sort(reverse=True)
C.sort(reverse=True)
if len(B)<2:
    print(0)
else:
    print(max(B[0]*B[1],C[0]*C[0]))
Problem p03814 (python)

Fixed submission:
s = list(input())
print(len(s)-s[::-1].index("Z")-s.index("A"))

Buggy submission (verdict: Runtime Error):
s = list(input())
print(reversed(s).index("Z")-s.index("A")+1)

Buggy submission (verdict: Runtime Error):
s = list(input())
print(s.reverse().index("Z")-s.index("A")+1)

Buggy submission (verdict: Runtime Error):
s = list(input())
print(s.reverse.index("Z")-s.index("A")+1)
Problem p03828 (python)

Fixed submission:
import collections
N = int(input())
num = []
mod = 10**9+7
for i in range(2,N+1):
    for j in range(2,i+1):
        #print(j)
        while i%j==0:
            i //= j
            num.append(j)
#print(num)
A = collections.Counter(num)
#print(A)
ans = 1
for v in A.values():
    ans *= (v+1)%mod
print(ans%mod)

Buggy submission (verdict: Runtime Error):
import collections
N = int(input())
num = []
for i in range(2,N+1):
    for j in range(2,i+1):
        #print(j)
        while i%j==0:
            i //= j
            num.append(j)
#print(num)
A = collections.Counter(num)
#print(A)
ans = 1
for v in A.values():
    ans *= (v+1)%mod
print(ans%mod)
Problem p02783 (python)

Fixed submission:
import math

H,A = (float(x) for x in input().split())
print(math.ceil(H/A))

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
H,N = (int(x) for x in input().split())
A = np.array([0]*N)
B = np.array([0]*N)
C = np.array([0.]*N)
for i in range(N):
    A[i],B[i] = (int(x) for x in input().split())
    C[i] = float(A[i]) / float(B[i])

indexs = np.argsort(-C)
A=A[indexs]
B=B[indexs]
C=C[indexs]

V=[[0]*(H+1) for i in range(N+1)]
for h in range(H+1):
    V[0][h] = B[0]*math.ceil(h/A[0])

for i  in range(N):
    for h in range(H+1):
        if h < A[i]:
            V[i+1][h] = V[i][h]
        elif V[i][h] > (V[i][h-A[i]]+B[i]):
            V[i+1][h] = (V[i][h-A[i]]+B[i])
        else:
            V[i+1][h] = V[i][h]

print(V[N][H])
Problem p02789 (python)

Fixed submission:
N,M=(int(x) for x in input().split())

if N==M:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N,M=(int(x) for x in input().split())

if N===M:
    print('Yes')
else:
    print('No')
Problem p02576 (python)

Fixed submission:
import math
N, X, T = (int(a) for a in input().split())
print(math.ceil(N / X) * T)

Buggy submission (verdict: Runtime Error):
N, X, T = (int(a) for a in input().split())
print(math.ceil(N / X) * T)
Problem p02612 (python)

Fixed submission:
N = int(input())
turi = N % 1000
if turi != 0:
  turi = 1000 - turi
print(turi)

Buggy submission (verdict: Runtime Error):
N = input()
turi = N % 1000
if turi != 0:
  turi = 1000 - turi
print(turi)

Buggy submission (verdict: Runtime Error):
N = input()
turi = N mod 1000
if (turi <> 0):
	turi = 1000 - turi
print(turi)
Problem p02573 (python)

Fixed submission:
#D - Friends
N,M = map(int,input().split())
par = [i for i in range(N)]
rank = [1] * (N)

def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x]) #経路圧縮
        return par[x]

def size(x):
    return par.count(find(x))

def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y : return 0
    if par[x] > par[y]:
        x,y = y,x
    par[y] = x
#    par[x] = x
    if par[x] == par[y]:
        rank[x] += rank[y]
#        rank[y] += rank[x]
#print(par)
#print(rank)
for i in range(M):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    unite(a,b)
#    print(par)
#    print(rank)
group_count = 0

group_count = max(rank)

# 出力
print(group_count)

Buggy submission (verdict: Runtime Error):
#D - Friends
N,M = map(int,input().split())
par = [i for i in range(N+1)]
rank = [1] * (N + 1)

def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x]) #経路圧縮
        return par[x]

def size(x):
    return par.count(find(x))

def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y:
        return 0
    if x > y:
        x,y = y,x
    par[y] = x
    if par[x] == par[y]:
        rank[x] += 1
#    par[x] = y

print(par)
print(rank)
for i in range(M):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    unite(a,b)
    print(par)
    print(rank)
group_count = 0

group_count = max(rank)

# 出力
print(group_count)

Buggy submission (verdict: Runtime Error):
#D - Friends
N,M = map(int,input().split())
par = [i for i in range(N+1)]

def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x]) #経路圧縮
        return par[x]

def size(x):
    return par.count(find(x))

def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y:
        return 0
    if par[x] > par[y]:
        x,y = y,x
    #par[x] += par[y]
    par[y] = x
#    par[x] = y

print(par)
for i in range(M):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    unite(a,b)
    print(par)

group_count = 0

for i in range(N):
    group_count = max(group_count,size(i))

# 出力
print(group_count)