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

Fixed submission:
a, b, c, d = map(int, input().split())
print(max(a * c, a * d, b * c, b * d))

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
print(max(a*c, a*d, b*c, b*d))
Problem p02621 (python)

Fixed submission:
a = int(input())
total = a + a**2 + a**3
print(total)

Buggy submission (verdict: Runtime Error):
a = int(input())
total = a + a**2 + a**3
ptint(total)
Problem p02639 (python)

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

if a == 0:
  print(1)
elif b == 0:
  print(2)
elif c == 0:
  print(3)
elif d == 0:
  print(4)
elif e == 0:
  print(5)

Buggy submission (verdict: Runtime Error):
x = list(map(int,input().split())
         
for i in range(5):
	if x[i] == 0:
    	print(i+1)

Buggy submission (verdict: Runtime Error):
x = list(map(int,input().split())
for i in range(5):
	if x[i] == 0:
         print(i+1)

Buggy submission (verdict: Runtime Error):
x = list(map(int,input().split())
         
for i in range(5):
	if x[i] == 0:
    	print(i+1)

Buggy submission (verdict: Runtime Error):
x=map(int,input().split())
 
for i in range(5):
    if x[i]==0:
        print(i+1)
Problem p02657 (python)

Fixed submission:
a, b = list(map(int, input().split()))
print(a * b)

Buggy submission (verdict: Runtime Error):
a, b = list(map, input().split())
print(a * b)

Buggy submission (verdict: Runtime Error):
a, b = int(input())
total = a * b
print(total)
Problem p02658 (python)

Fixed submission:
n = int(input())
l = list(map(int, input().split()))
if 0 in l:
  print(0)
  exit()
ans = 1
for i in range(n):
  ans *= l[i]
  if ans > 10**18:
    ans = -1
    break
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
totoal = 1
for i in a:
  total = total * a
  if total > 10**18:
    print("-1")

print(total)

Buggy submission (verdict: Runtime Error):
n = int(input)
l = list(map(int, inpupt().split()))
if 0 in l:
  print(0)
  exit()
total = 1
for i in range(n):
  total *= l[i]
  if total > 10 ** 18:
    total = -1
    break
print(total)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
 
if 0 in a:
  print(0)
  exit()
total = 1 
for i in range(n):
  total * = a[i]
  if total > 10 ** 18:
    print(-1)
    break
  
print(total)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
 
if 0 in a:
  print(0)
  exit()
total = 1 
for i in range(n):
  total * = a[i]
  if total > 10 ** 18:
  	print(-1)
  	break
print(total)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
 
if 0 in a:
  print(0)
  exit()
total = 1 
for i in range(n):
  total * = a[i]
  if total > 10 ** 18:
  ans = -1
  break
print(total)

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

if 0 in a:
  print(0)
  exit()
total = 1 
for i in range(n):
  total* = a[i]
  if total > 10 ** 18:
  print(-1)
  break
print(total)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
total = 1
 
if 0 in a:
  print(0)
  exit()
 
for i in range(n):
  total* = a[i]
  if total > 10 ** 18:
  print(-1)
  break
print(total)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
total = 1

if 0 in a:
  print(0)
  exit()

for i in range(n):
  total* = a[i]
  if total > 10** 18
  print(-1)
  break
print(total)
Problem p02675 (python)

Fixed submission:
n = int(input())
d = n%10
 
if d in [2, 4, 5, 7, 9]:
  print("hon")
elif d in [0, 1, 6, 8]:
  print("pon")
elif d in [3]:
  print("bon")

Buggy submission (verdict: Runtime Error):
n = int(input())
if n % 10 == 3:
  print("bon")
elif n % 10 == 0 or n % 10 == 1 or n % 10 == 6 or n % 10 == 8:
  pritn("pon")
else:
  print("hon")

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

if d in [2, 4, 5, 7, 9]:
  print("hon")
elif d in [0, 1, 6, 8]:
  print("pon")
else d in [3]:
  print("bon")
Problem p02687 (python)

Fixed submission:
S = input()
if S == "ABC":
  print("ARC")
else:
  print("ABC")

Buggy submission (verdict: Runtime Error):
S = input()
if s == "ABC":
  print("ARC")
else:
  print("ABC")
Problem p02717 (python)

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

print(Z, X, Y)

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

a = b, b = a
a = c, c = a
print(a b c)
Problem p02718 (python)

Fixed submission:
n, m = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
total = sum(a)
if total/(4*m) > a[-m]:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
n, m = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
total = sum(a)
if total/(4*m) > a[m]:
  print("No")
else:
  print("Yes")
Problem p02724 (python)

Fixed submission:
x = int(input())
glad = x//500*1000 + x%500//5*5
print(glad)

Buggy submission (verdict: Runtime Error):
x = int(input())
glad = x//*1000 + x%500//5*5
print(glad)
Problem p02741 (python)

Fixed submission:
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
print(a[K-1])

Buggy submission (verdict: Runtime Error):
k = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[k + 1])

Buggy submission (verdict: Runtime Error):
a = list[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
print(a[K])
Problem p02801 (python)

Fixed submission:
C = input() 

if C== "a" :
  print("b")
elif C== "b":
  print("c")
elif C== "c":
  print("d")
elif C== "d":
  print("e")
elif C== "e":
  print("f")
elif C== "f":
  print("g")
elif C== "g":
  print("h")
elif C== "h":
  print("i")
elif C== "i":
  print("j")
elif C== "j":
  print("k")
elif C== "k":
  print("l")
elif C== "l":
  print("m")
elif C== "m":
  print("n")
elif C== "n":
  print("o")
elif C== "o":
  print("p")
elif C== "p":
  print("q")
elif C== "q":
  print("r")
elif C== "r":
  print("s")
elif C== "s":
  print("t")
elif C== "t":
  print("u")
elif C== "u":
  print("v")
elif C== "v":
  print("w")
elif C== "w":
  print("x")
elif C== "x":
  print("y")
elif C== "y":
  print("z")

Buggy submission (verdict: Runtime Error):
c = int(input())
C = ord(c)
print(chr(C))
Problem p02811 (python)

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

total = k * 500
if total >= x:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
t1 = [int(i) for i in input().split()]
total = list1[0]*500
 
if total > list1[1]:
  print("Yes")
else:
  print("No")
Problem p03146 (python)

Fixed submission:
s = int(input())
a = []
while(s not in a):
    a.append(s)
    if s%2==0:
        s = s//2
    else:
        s = 3*s + 1
print(len(a)+1)

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

for i in range(1000):
  if s[i]%2==0:
    s.append(s[i]/2)
    if s[i+1] in s:
      print(i)
      break
  else:
    s.append(s[i]*3 + 1)
    if s[i+1] in s:
      print(i)
      break
Problem p02909 (python)

Fixed submission:
s=input()
 
 
if s=="Sunny":
  print("Cloudy")
elif s=="Cloudy":
  print("Rainy")
elif s=="Rainy":
  print("Sunny")

Buggy submission (verdict: Runtime Error):
s=input()


if s=="Sunny":
  print("Cloudy")
elif s=="Cloudy":
  print("Rainy")
elif s=="Rainy":
  print("Sunny)
Problem p02981 (python)

Fixed submission:
n,a,b=map(int,input().split())
 
if n*a >= b:
  print(b)
else:
  print(n*a)

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

if n*a >= b:
  ptiny(b)
else:
  print(n*a)
Problem p03035 (python)

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


if a>=13:
  print(b)
elif a>=6 and a<=12:
  print(int(b//2))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
if a>=13:
  print(b)
elif a>=6 and a<=12:
  print(int(b/2))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
if a>=13:
  print(b)
elif a>=6 and a<=12:
  print(int(b/2))
else:
  print(0)
Problem p02579 (python)

Fixed submission:
from collections import deque

H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
maze = [input() for i in range(H)]

queue = deque()
queue.append((Ch-1, Cw-1, 0))
inf = float("inf")
table = [[inf] * W for i in range(H)]
table[Ch-1][Cw-1] = 0
walk_move = ((-1, 0), (0, -1), (1, 0), (0, 1))
magic_move = []
for i in range(-2, 3):
  for j in range(-2, 3):
    if not i and not j:
      continue
    else:
      magic_move.append([i, j])

while queue:
  x, y, cost = queue.popleft()
  for i,j in walk_move:
    dx = x+i
    dy = y+j
    if 0 <= dx <= H-1 and 0 <= dy <= W-1 and maze[dx][dy] == "." and table[dx][dy] > cost:
      queue.appendleft((dx, dy, cost))
      table[dx][dy] = cost
  for k,l in magic_move:
    dx = x+k
    dy = y+l
    if 0 <= dx <= H-1 and 0 <= dy <= W-1 and maze[dx][dy] == "." and table[dx][dy] > cost+1:
      queue.append((dx, dy, cost+1))
      table[dx][dy] = cost+1

ans = table[Dh-1][Dw-1]
if ans == inf:
  print("-1")
else:
  print(table[Dh-1][Dw-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
from collections import deque
from heapq import *
#from numba import jit

H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
maze = np.array([input() for i in range(H)])

walk_move = [[-1, 0], [0, -1], [0, 1], [1, 0]]
magic_move = []
for i in range(-2, 3):
  for j in range(-2, 3):
    if not i and not j:
      continue
    else:
      magic_move.append([i ,j])
inf = float("inf")
table = np.array([[inf for i in range(W)] for i in range(H)])
table[Ch-1, Cw-1] = 0
queue = [(Ch-1, Cw-1, 0)]

def main():
  while queue:
    x, y, cost = heappop(queue)
    for i, j in walk_move:
      dx = x+i
      dy = y+j
      if 0 <= dx <= H-1 and 0 <= dy <= W-1 and maze[dx][dy] == "." and table[dx][dy] > cost:
        table[dx][dy] = cost
        heappush(queue, (dx, dy, cost))
    for k, l in magic_move:
      dx = x+k
      dy = y+l
      if 0 <= dx <= H-1 and 0 <= dy <= W-1 and maze[dx][dy] == "." and table[dx][dy] > cost+1:
        table[dx][dy] = cost+1
        heappush(queue, (dx, dy, cost+1))
  return table[Dh-1][Dw-1]
        
ans = main()
if ans == inf:
  print("-1")
else:
  print(int(ans))
Problem p02586 (python)

Fixed submission:
import numba
from numba import jit
import numpy as np
  
@jit
def main(r, c):
  dp = np.zeros((c+1, 4), np.int64)
  for i in range(r):
    new_dp = np.zeros((c+1, 4), np.int64)
    for j in range(4):
      new_dp[:,0] = np.maximum(new_dp[:,0], dp[:,j])
    dp = new_dp
    for k in range(c):
      for l in range(2, -1, -1):
        dp[k,l+1] = max(dp[k,l+1], dp[k,l]+item_map[i,k])
      for m in range(1,4):
        dp[k+1,m] = max(dp[k+1,m], dp[k,m])
  return max(dp[c-1,:])


R, C, K = map(int, input().split())
item_lis = list(list(map(int, input().split())) for i in range(K))
item_map = np.zeros((R, C), np.int64)
for i,j,k in item_lis:
  item_map[i-1,j-1] = k

print(main(R, C))

Buggy submission (verdict: Runtime Error):
R, C, K = map(int, input().split())
item_lis = list(list(map(int, input().split())) for i in range(K))
item_map = [[0 for i in range(C)] for i in range(R)]
for i,j,k in item_lis:
  item_map[i-1][j-1] = k
inf = float("inf")
dp = [[[0 for i in range(4)] for i in range(C)] for i in range(R)]

def calc(x, y, z, lis1=item_map, lis2=dp):
  now_score = dp[x][y][z]
  dp1 = -inf
  dp2 = -inf
  dp3 = -inf
  dp4 = -inf
  if x+1 <= R-1:
    if z < 3:
      if lis1[x][y] != 0:
        dp1 = calc(x+1, y, 0)+lis1[x][y]+now_score
    dp2 = calc(x+1, y, 0)+now_score
      
  if y+1 <= C-1:
    if z < 3:
      if lis1[x][y] != 0:
        dp3 = calc(x, y+1, z+1)+lis1[x][y]+now_score
    dp4 = calc(x, y+1, z)+now_score
  
  if x == R-1 and y == C-1:
    if z < 3:
      new_score = now_score+lis1[x][y]
    else:
      new_score = now_score
  else:
    new_score = max(now_score, dp1, dp2, dp3, dp4)
  return new_score

ans = calc(0, 0, 0)
print(ans)
Problem p02783 (python)

Fixed submission:
H, A = map(int, input().split())
times = 0
crack = False
while True:
  H -= A
  times += 1
  if H <= 0:
    break
print(times)

Buggy submission (verdict: Runtime Error):
H, A = map(int, input().split())
times = 0
crack = Fasle
while True:
  H -= A
  times += 1
  if H <= 0:
    crack = True
  if crack:
    break
print(times)

Buggy submission (verdict: Runtime Error):
H, A = map(int, input().spit())
times = 0
crack = Fasle
while True:
  H -= A
  times += 1
  if H < 0:
    crack = True
  if crack:
    break
print(times)
Problem p02784 (python)

Fixed submission:
H, N = map(int, input().split())
lis = list(map(int, input().split()))
if sum(lis) >= H:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
H, N = input().split()
lis = list(map(int, input().split()))
if sum(lis) >= H:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
H, N = map(int, input().split())
lis = list(map(input().split()))
if sum(lis) >= H:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
H, N = map(int, input().split())
lis = list(input().split())
if sum(lis) >= H:
  print("Yes")
else:
  print("No")
Problem p02802 (python)

Fixed submission:
N, M = map(int, input().split())
lis = [[] for _ in range(N)]
for _ in range(M):
  question, result = input().split()
  question = int(question)
  lis[question-1].append(result)  

AC_times = 0
WA_times = 0
for i in range(N):
  pre_WA_times = 0
  for j in lis[i]:
    passed = False
    if not passed:
      if j == "AC":
        passed = True
        WA_times += pre_WA_times
      elif j == "WA":
        pre_WA_times += 1
    if passed:
      AC_times += 1
      break
      
print(AC_times, WA_times)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
ans_num_lis = [0 for i in range(N)]
pre_ans_lis = [0 for i in range(N)]
ans_lis = [0 for i in range(N)]
for i in range(M):
  problem, result = input().split()
  problem_num = int(problem)
  if result == "WA":
    pre_ans_lis[problem_num] += 1
  if result == "AC" and not ans_num_lis[problem_num]:
    ans_num_lis[problem_num] = 1
    ans_lis[problem_num] = pre_ans_lis[problem_num]

print(sum(ans_num_lis), sum(ans_lis))
Problem p02804 (python)

Fixed submission:
# フェルマーの小定理
N, K = map(int, input().split())
A = list(map(int, input().split()))
 
m = 1000000007
 
fac = [0] * (N + 1)
fac[0] = 1
for i in range(N):
    fac[i + 1] = fac[i] * (i + 1) % m
 
 
def mcomb(n, k):
    if n == 0 and k == 0:
        return 1
    if n < k or k < 0:
        return 0
    return fac[n] * pow(fac[n - k], m - 2, m) * pow(fac[k], m - 2, m) % m
 
 
A.sort(reverse=True)
maxX = 0
for i in range(N - K + 1):
    maxX += A[i] * mcomb(N - (i + 1), K - 1)
    maxX %= m

A.sort()
minX = 0
for i in range(N - K + 1):
    minX += A[i] * mcomb(N - (i + 1), K - 1)
    minX %= m

print((maxX - minX) % m)

Buggy submission (verdict: Runtime Error):
import operator as op
from functools import reduce

N, K = map(int, input().split())
num_lis = list(map(int, input().split()))
num_lis = sorted(num_lis)

ans = 0
combi_lis = []
multi = op.mul
numer = reduce(multi, range(1, K+1), 1)
denom = reduce(multi, range(1, K+1), 1)

#max
for i in range(K-1, N):
  combi = int(numer/denom)
  combi_lis.append(combi)
  ans += num_lis[i]*combi
  numer *= i+1
  numer /= i-K+2

#min
k = 0
for j in range(N-K,-1,-1):
  ans -= num_lis[j]*combi_lis[k]
  k += 1

ans %= 10**9+7
print(ans)

Buggy submission (verdict: Runtime Error):
import operator as op
from functools import reduce

N, K = map(int, input().split())
num_lis = list(map(int, input().split()))
num_lis = sorted(num_lis)

#組み合わせ
def combi(N,K):
  multi = op.mul
  numer = reduce(multi, range(N, N-K, -1),1)
  denom = reduce(multi, range(1,K+1), 1)
  combi = int(numer/denom)
  return combi

ans = 0
#max
combi_lis = []
for i in range(K-1,N):
  num = combi(i, K-1)
  ans += num_lis[i]*num
  combi_lis.append(num)

#min
k = 0
for j in range(N-K,-1,-1):
  ans -= num_lis[j]*combi_lis[k]
  k += 1

print(ans)

Buggy submission (verdict: Runtime Error):
import operator as op
from functools import reduce

N, K = map(int, input().split())
num_lis = list(map(int, input().split()))
num_lis = sorted(num_lis)

#組み合わせ
def combi(N,K):
  multi = op.mul
  numer = reduce(multi, range(N, N-K, -1),1)
  denom = reduce(multi, range(1,K+1), 1)
  combi = int(numer/denom)
  return combi

ans = 0
#max
for i in range(K-1,N):
  ans += num_lis[i]*combi(i, K-1)%(10**9+7)

#min
for j in range(N-K,-1,-1):
  ans -= num_lis[j]*combi(N-j-1,K-1)%(10**9+7)

print(ans)

Buggy submission (verdict: Runtime Error):
import operator as op
from functools import reduce

N, K = map(int, input().split())
num_lis = list(map(int, input().split()))
num_lis = sorted(num_lis)

#組み合わせ
def combi(N,K):
  multi = op.mul
  numer = reduce(multi, range(N, N-K, -1),1)
  denom = reduce(multi, range(1,K+1), 1)
  combi = int(numer/denom)
  return combi

ans = 0
#max
for i in range(K-1,N):
  ans += num_lis[i]*combi(i, K-1)

#min
for j in range(N-K,-1,-1):
  ans -= num_lis[j]*combi(N-j-1,K-1)
  
ans %= 10**9+7
print(ans)
Problem p02837 (python)

Fixed submission:
N = int(input())
a = [[] for _ in range(N)]
for i in range(N):
  A_i = int(input())
  for j in range(A_i):
    a[i].append(list(map(int, input().split())))
 
max_honest = 0
for i in range(2**N):
  contradiction = False
  honest_p = []
  unkind_p = []
  doubt_honest_p = []
  doubt_unkind_p = []
  length = len(format(2**N-1, "b"))
  bin_num = format(i, "b").zfill(length)
  for j in range(length):
    if (i >> j) & 1:
      if not j+1 in honest_p:
      	honest_p.append(j+1)
      if not j+1 in doubt_honest_p:
      	doubt_honest_p.append(j+1)
      for k in a[j]:
        p = k[0]
        t = k[1]
        if t:
          if not p in honest_p:
          	honest_p.append(p)
        else:
          if not p in unkind_p: 
          	unkind_p.append(p)
    else:
      if not j+1 in unkind_p:
        unkind_p.append(j+1)
      if not j+1 in doubt_unkind_p:
      	doubt_unkind_p.append(j+1)
  if len(list(set(honest_p) & set(unkind_p))) != 0:
    contradiction = True
  if not contradiction and max_honest <= len(doubt_honest_p):
    max_honest = len(doubt_honest_p)
    
print(max_honest)

Buggy submission (verdict: Runtime Error):
N = int(input())
true_list = [0]
false_list = []
for j in range(1, N+1):
  false_list.append(j)

a = [[] for _ in range(N)]
for i in range(N):
  A_i = int(input())
  for j in range(A_i):
    a[i].append(list(map(int, input().split())))
    
while True:
  pre_true_list = true_list
  pre_false_list = false_list
  for i in true_list:
    for j in range(len(a[i])):
      kotoba = a[i][j][1]
      person = a[i][j][0]
      if kotoba:
        if false_list.count(person):
          false_list.remove(person)
          true_list.append(person)
      else:
        if true_list.count(person):
          true_list.remove(person)
          false_list.append(person)
        
  for i in false_list:
    for j in range(len(a[i])):
      kotoba = a[i][j][1]
      person = a[i][j][0]
      if not kotoba:
        if true_list.count(person):
          true_list.remove(person)
          false_list.append(person)
      else:
        if false_list.count(person):
          false_list.remove(person)
          true_list.append(person)
  if pre_true_list == true_list and pre_false_list == false_list:
    break
    
print(len(true_list))
Problem p02839 (python)

Fixed submission:
import numpy as np
H, W = map(int, input().split())
red_map = np.array([input().split() for i in range(H)], dtype="int")
blue_map = np.array([input().split() for i in range(H)], dtype="int")
sub_map = abs(red_map - blue_map)
dp = [[2020]*W for i in range(H)]
max_deviation = 2**(80*(H+W))

for i in range(H):
  for j in range(W):
    if not i and not j:
      dp[i][j] = (max_deviation<<sub_map[i][j] | max_deviation>>sub_map[i][j])
    if i > 0:
      dp[i][j] |= (dp[i-1][j]<<sub_map[i][j] | dp[i-1][j]>>sub_map[i][j])
    if j > 0:
      dp[i][j] |= (dp[i][j-1]<<sub_map[i][j] | dp[i][j-1]>>sub_map[i][j])
      
pre_ans = dp[H-1][W-1]>>80*(H+W)
pre_ans_bit = format(pre_ans&-pre_ans, "b")
ans = len(pre_ans_bit)-1
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
H, W = map(int, input().split())
red_map = np.array([input().split() for i in range(H)], dtype="int")
blue_map = np.array([input().split() for i in range(H)], dtype="int")
sub_map = abs(red_map - blue_map)
dp = [[[] for i in range(W)] for i in range(H)]
 
for i in range(H):
  for j in range(W):
    if not i and not j:
      dp[i][j].append(sub_map[i][j])
      dp[i][j].append(-sub_map[i][j])
    if i > 0 and j > 0:
      for k in dp[i-1][j]:
        dp[i][j].append(k + sub_map[i][j])
        dp[i][j].append(k - sub_map[i][j])
      for l in dp[i][j-1]:
        dp[i][j].append(l + sub_map[i][j])
        dp[i][j].append(l - sub_map[i][j])
    if i > 0 and not j:
      for m in dp[i-1][j]:
        dp[i][j].append(m + sub_map[i][j])
        dp[i][j].append(m - sub_map[i][j])
    if j > 0 and not i:
      for n in dp[i][j-1]:
        dp[i][j].append(n + sub_map[i][j])
        dp[i][j].append(n - sub_map[i][j])

print(min(np.abs(dp[H-1][W-1])))
Problem p02840 (python)

Fixed submission:
import numpy as np
N, X, D = map(int, input().split())

if not D:
  if not X:
    print(1)
  else:
    print(N+1)

else:
  num_dict = dict()
  ans = 0
  for i in range(N+1):
    left_num = int(i*X/D) + int(i*(i-1)/2)
    right_num = int(i*X/D) + int(i*(2*N-1-i)/2)
    judge_num = i*X%D
    if not judge_num in num_dict:
      num_dict[judge_num] = [(left_num,right_num)]
    else:
      num_dict[judge_num].append((left_num,right_num))

  for j,k in num_dict.items():
    new_k = sorted(k)
    L = new_k[0][0]
    R = new_k[0][1]
    for l in new_k:
      if l[0] <= R <= l[1]:
        R = l[1]
      elif R < l[0] and R < l[1]:
        ans += R-L+1
        L, R = l[0], l[1]
    ans += R-L+1
    
  print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N, X, D = map(int, input().split())

if not D:
  if not X:
    print(1)
  else:
    print(N+1)

else:
  num_dict = dict()
  ans = 0
  for i in range(N+1):
    left_num = int(i*X/D) + int(i*(i-1)/2)
    right_num = int(i*X/D) + int(i*(2*N-1-i)/2)
    judge_num = i*X%D
    if not judge_num in num_dict:
      num_dict[judge_num] = [(left_num,right_num)]
    else:
      num_dict[judge_num].append((left_num,right_num))

  for j,k in num_dict.items():
    if D < 0:
      min_num = min(k, key=lambda x:x[1])[1]
      max_num = max(k, key=lambda x:x[0])[0]
      abs_min_num = abs(min_num)
      abs_max_num = abs(max_num)
      num_lis = np.zeros((abs_max_num+abs_min_num+1))
      for l in k:
        num_lis[l[1]+abs_min_num:l[0]+abs_min_num+1] += 1
    else:
      min_num = min(k, key=lambda x:x[0])[0]
      max_num = max(k, key=lambda x:x[1])[1]
      abs_min_num = abs(min_num)
      abs_max_num = abs(max_num)
      num_lis = np.zeros((abs_max_num+abs_min_num+1))
      for m in k:
        num_lis[m[0]+abs_min_num:m[1]+abs_min_num+1] += 1
    ans += np.count_nonzero(num_lis > 0)
    
  print(ans)
Problem p03455 (python)

Fixed submission:
x, y = map(int,input().split())

result = x*y
 
if result % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
input_line = int(input().split())

result = input_line[0]*input_line[1]
 
if result % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
input_line = input()

tarList = input_line.split()
result = tarList[0]*tarList[1]
 
if result % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
input_list = input()
 
result = input_list[0]*input_list[1]
 
if result % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
input_list = input()

result = input_list[0]*input_list[1]

if result % 2 == 0:
  return 'Even'
else:
  result 'Odd'
Problem p02784 (python)

Fixed submission:
H, _ = map(int, input().split())
if H <= sum(map(int, input().split())):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
H,_=map(int,input().split())
if H <= list(map(int,input().split())):
    print("Yes")
else:
    print("No")