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

Fixed submission:
H, W = map(int, input().split())
a = []
for i in range(H):
  b = list(input())
  a.append(b)
for i in range(2*H):
  for j in range(W):
    if j != W - 1:
      print(a[i//2][j],end="")
    else:
      print(a[i//2][j])

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
a = []
for i in range(H):
  b = list(input().split())
  a.append(b)
for i in range(2*H):
  for j in range(W):
    if j != W - 1:
      print(a[i//2][j],end="")
    else:
      print(a[i//2][j])

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
a = []
for i in range(H):
  b = list(input().split())
  a.append(b)
for i in range(2*H):
  for j in range(W):
    print(a[i//2][j],end="")
  print('')

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
a = []
for i in range(H):
  b = list(input().split())
  a.append(b)
c = []
for i in range(2*H):
  d = []
  for j in range(W):
    d.append(a[i//2][j])
  c.append(d)
print(c)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
a = []
for i in range(H):
  b = list(input().split())
  a.append(b)
c = []
for i in range(2*H):
  d = []
  for j in range(W):
    d.append(a[(i + 1)//2][j])
  c.append(d)
print(c)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
a = []
for i in range(H):
  b = list(map(int, input().split()))
  a.append(b)
c = []
for i in range(2*H):
  d = []
  for j in range(W):
    d.append(a[(i + 1)//2][j])
  c.append(d)
print(c)
Problem p02658 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
mod = 10**18
li = list(map(int, input().split())).sort()
ans = 1
for i in range(n):
    ans = ans * li[i]
    if ans > mod:
        ans = -1
        break
print(ans)
Problem p02641 (python)

Fixed submission:
x, n = map(int, input().split(" "))
if n != 0:
  p=list(map(int, input().split(" ")))
else:
  p=[]
lst = list(range(-1, x * 2 + 1))
for i in p:
  if i in lst:
    lst.remove(i)
for i in range(x + 2):
  if x - i in lst or x - i < 0:
    print(x - i)
    break
  elif x + i in lst:
    print(x + i)
    break

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split(" "))
if n != 0:
  p=list(map(int, input().split(" ")))
else:
  p=[]
lst = list(range(0, x * 2))
for i in p:
  lst.remove(i)
for i in range(x + 2):
  if x - i in lst or x - i < 0:
    print(x - i)
    break
  elif x + i in lst:
    print(x + i)
    break
Problem p02700 (python)

Fixed submission:
import math
tl, ta, al, aa = map(int, input().split(" "))
print("Yes" if math.ceil(al/ta) - 1 < math.ceil(tl / aa) else "No")

Buggy submission (verdict: Runtime Error):
import math
tl, ta, al, aa = map(int, input().split(" ")
print("Yes" if math.ceil(al/ta) < math.ceil(tl / aa) else "No")
Problem p02732 (python)

Fixed submission:
n = (int)(input())
a = list(map(int, input().split(" ")))
temp = [0 for i in range(n + 1)]
aaa = sorted(a)
count = 0
for i in range(n - 1):
  if aaa[i] == aaa[i + 1]:
    count+= 1
  else:
    temp[aaa[i]] = count + 1
    count = 0
else:
  if len(a) == 1:
    temp[aaa[0]] = 1
  else:
    temp[aaa[-1]] = count + 1
ans = 0

#---ここまで231ms

#print(temp)#各数字の出現回数
for i in range(n + 1):
  if temp[i] >= 2:
    ans += temp[i] * (temp[i] - 1) / 2
    
#---ここまでで1553ms

#print(ans)#ansは全体の組み合わせの合計。割れない

for i in range(n):
  kotae = ans
  if temp[a[i]] >= 3:
    #print(ans, comb(temp[a[i]], 2), comb(temp[a[i]] - 1, 2))
    #print(temp[a[i]], i)
    kotae = ans - (temp[a[i]] * (temp[a[i]] - 1) / 2) + ((temp[a[i]] - 1) * (temp[a[i]] - 2) / 2)
  elif temp[a[i]] == 2:
    kotae = ans -1
  print((int)(kotae))

Buggy submission (verdict: Runtime Error):
import math

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n = (int)(input())
a = list(map(int, input().split(" ")))
temp = []
for i in range(n):
  temp.append(a.count(i))
  
ans = 0
#print(temp)#各数字の出現回数
for i in range(n):
  if temp[i] >= 2:
    ans += comb(temp[i], 2)
    
#print(ans)#ansは全体の組み合わせの合計。割れない

for i in range(n):
  kotae = ans
  if temp[a[i]] >= 3:
    #print(ans, comb(temp[a[i]], 2), comb(temp[a[i]] - 1, 2))
    kotae = ans - comb(temp[a[i]], 2) + comb(temp[a[i]] - 1, 2)
  elif temp[a[i]] == 2:
    kotae = ans -1
  print(kotae)

Buggy submission (verdict: Runtime Error):
import math

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n = (int)(input())
a = list(map(int, input().split(" ")))
temp = []
for i in range(n):
  temp.append(a.count(i))
  
ans = 0
#print(temp)#各数字の出現回数
for i in range(n):
  if temp[i] >= 2:
    ans += comb(temp[i], 2)
    
#print(ans)#ansは全体の組み合わせの合計。割れない

for i in range(n):
  kotae = ans
  if temp[a[i]] >= 3:
    #print(ans, comb(temp[a[i]], 2), comb(temp[a[i]] - 1, 2))
    kotae = ans - comb(temp[a[i]], 2) + comb(temp[a[i]] - 1, 2)
  elif temp[a[i]] == 2:
    kotae = ans -1
  print(kotae)
Problem p02814 (python)

Fixed submission:
import math
from decimal import Decimal, ROUND_HALF_UP
def lcm(a):
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // math.gcd(x, a[i])
    return x
def gcd(a):
  temp = math.gcd(a[0], a[1])
  for i in a:
    temp = math.gcd(temp,  i)
  return temp
n,m = map(int, input().split(" "))
a = list(map(int, input().split(" ")))
zero = False
count = 0
#a = list(map(lambda x: x // 2, na))
mini = lcm(a)
if len(a) != 1:
  maxi = gcd(a)
else:
  maxi = a[0]
maxi2 = maxi
nibai = 1
while(True):
  if maxi2 % 2 == 0:
    nibai *= 2
    maxi2 //= 2
  else:
    break
for i in a:
  if i % (2 * nibai) == 0:
    zero = True
    break
#print(nibai, maxi, mini)
if not zero:
  t = Decimal(str((m * 2 // mini) / 2))
  #print(t)
  print(t.quantize(Decimal('0'), rounding=ROUND_HALF_UP))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
import math
from decimal import Decimal, ROUND_HALF_UP
def lcm(a):
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // math.gcd(x, a[i])
    return x
def gcd(a):
  temp = math.gcd(a[0], a[1])
  for i in a:
    temp = math.gcd(temp,  i)
  return temp
n,m = map(int, input().split(" "))
a = list(map(int, input().split(" ")))
zero = False
count = 0
#a = list(map(lambda x: x // 2, na))
mini = lcm(a)
maxi = gcd(a)
maxi2 = maxi
nibai = 1
while(True):
  if maxi2 % 2 == 0:
    nibai *= 2
    maxi2 //= 2
  else:
    break
for i in a:
  if i % (2 * nibai) == 0:
    zero = True
    break
#print(nibai, maxi, mini)
if not zero:
  t = Decimal(str((m * 2 // mini) / 2))
  #print(t)
  print(t.quantize(Decimal('0'), rounding=ROUND_HALF_UP))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
import math
from decimal import Decimal, ROUND_HALF_UP
def lcm(a):
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // math.gcd(x, a[i])
    return x
def gcd(a):
  temp = math.gcd(a[0], a[1])
  for i in a:
    temp = math.gcd(temp,  i)
  return temp
n,m = map(int, input().split(" "))
a = list(map(int, input().split(" ")))
zero = False
count = 0
#a = list(map(lambda x: x // 2, na))
mini = lcm(a)
maxi = gcd(a)
maxi2 = maxi
nibai = 1
while(True):
  if maxi2 % 2 == 0:
    nibai *= 2
    maxi2 //= 2
  else:
    break
for i in a:
  if i % (2 * nibai) == 0:
    zero = True
    break
#print(nibai, maxi, mini)
if not zero:
  t = Decimal(str((m // (mini // 2)) / 2))
  #print(t)
  print(t.quantize(Decimal('0'), rounding=ROUND_HALF_UP))
else:
  print(0)
Problem p02843 (python)

Fixed submission:
num=(int)(input())
n=num//100
amari=num%100
if num <= 99 or amari / n > 5:
  print(0)
else:
  print(1)

Buggy submission (verdict: Runtime Error):
num=(int)(input())
n=num//100
amari=num%100
if amari / n > 6:
  print(0)
else:
  print(1)
Problem p02947 (python)

Fixed submission:
n = (int)(input())
s = sorted([sorted(list(input())) for i in range(n)])
 
ans = 0
temp = 1
for i in range(n - 1):
  if s[i] == s[i + 1]:
    temp += 1
  else:
    if temp != 1:
      ans += temp * (temp - 1) // 2
      temp = 1
else:
  if temp != 1:
    ans += temp * (temp - 1) // 2
    temp = 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = (int)(input())
s = [sorted(list(input())) for i in range(n)]

#print(*count)

ans = 0
for i in range(n - 1):
  for j in range(i + 1, n):
    if count[i] == count[j]:
      ans += 1
print(ans)
Problem p03352 (python)

Fixed submission:
n=(int)(input())
a=[1]
for i in range(2, n):
  temp = i ** 2
  while(temp <= n):
    a.append(temp)
    temp *= i
a = sorted(set(a))
#print(a)
print(list(i for i in a if i <= n)[-1])

Buggy submission (verdict: Runtime Error):
n=(int)(input())
a=[]
for i in range(2, n):
  temp = i ** 2
  while(temp <= n):
    a.append(temp)
    temp *= i
a = sorted(set(a))
#print(a)
print(list(i for i in a if i <= n)[-1])
Problem p02585 (python)

Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = -1000000000
for i in range(N):
  cost = 0
  S = []
  x = P[i] - 1
  l = 1
  while 1:
    cost += C[x]
    S.append(cost)
    if x == i:
      break
    l += 1
    x = P[x] - 1
  if cost > 0:
    for j in range(l):
      ans = max(ans, S[j] + cost * ((K - j - 1) // l))
  else:
    ans = max(ans, max(S[:min(K, l)]))
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
P = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = -1000000000
for i in range(N):
  cost = 0
  S = []
  x = P[i] - 1
  l = 1
  while 1:
    cost += C[x]
    S.append(cost)
    if x == i:
      break
    l += 1
    x = P[x] - 1
  if cost > 0:
    if K % l != 0:
      ans = max(ans, cost * (K // l) + max(S[:K % l]), cost * ((K // l) - 1) + max(S))
    else:
      ans = max(ans, cost * (K // l))
  else:
    ans = max(ans, max(S[:min(K, L)]))
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
P = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = -1000000000
for i in range(N):
  cost = 0
  S = []
  x = P[i] - 1
  l = 1
  while 1:
    cost += C[x]
    S.append(cost)
    if x == i:
      break
    l += 1
    x = P[x] - 1
  if cost > 0:
    if K % l != 0:
      ans = max(ans, cost * (K // l) + max(S[:K % l]))
    else:
      ans = max(ans, cost * (L // l))
  else:
    ans = max(ans, max(S))
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
P = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = -1000000000
for i in range(N):
  cost = 0
  S = []
  x = P[i] - 1
  l = 1
  while 1:
    cost += C[x]
    S.append(cost)
    if x == i:
      break
    l += 1
    x = P[x] - 1
  print(S, l)
  if cost > 0:
    ans = max(ans, cost * (K // l) + max(S[:K % l]))
  else:
    ans = max(ans, max(S))
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
P = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = -1e9
for i in range(N):
  cost = 0
  S = []
  x = P[i] - 1
  l = 1
  while 1:
    cost += C[x]
    S.append(cost)
    if x == i:
      break
    l += 1
    x = P[x] - 1
  if cost > 0:
    ans = max(ans, cost * (K // l) + max(S[:K % l]))
  else:
    ans = max(ans, max(S))
print(ans)
Problem p02664 (python)

Fixed submission:
S = input()
ans = ""
for s in range(len(S)):
  if S[s] == "?":
    print("D", end="")
  else:
    print(S[s], end="")
print("")

Buggy submission (verdict: Runtime Error):
S = input()
ans = ""
for s in range(len(S)):
  if s == "?":
    ans += "D"
  else:
    ans += s
print(ans)
Problem p02705 (python)

Fixed submission:
import math
R = int(input())
print(R * 2 * math.pi)

Buggy submission (verdict: Runtime Error):
import math
R = int(input())
print(R * 2 * math.PI)
Problem p02784 (python)

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

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

def f(h, d, s):
  if h == 0:
    return 1
  if len(d) == 0 or h > s:
    return 0
  a = f(h-d[0], [d[i] for i in range(1, len(d))], s-d[0])
  if a == 1:
    return 1
  a = f(h, [d[i] for i in range(1, len(d))], s-d[0])
  return a

if f(H, D, sum(D)) == 1:
  print("Yes")
else:
  print("No")

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

def f(h, d):
  if h == 0:
    return 1
  if len(d) == 0:
    return 0
  a = f(h-d[0], [d[i] for i in range(1, len(d))])
  if a == 1:
    return 1
  a = f(h, [d[i] for i in range(1, len(d))])
  return a

if f(H, D) == 1:
  print("Yes")
else:
  print("No")
Problem p02885 (python)

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

Buggy submission (verdict: Runtime Error):
A, N = map(int, input().split())
print(max(A-2*B, 0))
Problem p02957 (python)

Fixed submission:
A, B = map(int, input().split())
if (A - B) % 2 == 1:
  print("IMPOSSIBLE")
else:
  print((A+B)//2)

Buggy submission (verdict: Runtime Error):
A, B = map(int, input())
if (A - B) % 2 == 1:
  print("IMPOSSIBLE")
else:
  print((A+B)//2)
Problem p03076 (python)

Fixed submission:
M = 0
ans = 0
for i in range(5):
  a = int(input())
  b = ((a + 9) // 10) * 10
  M = max(M, b-a)
  ans += b
print(ans - M)

Buggy submission (verdict: Runtime Error):
M = 0
ans = 0
for i in range(5):
  a = append(int(input()))
  b = ((a + 9) // 10) * 10
  M = max(M, b-a)
  ans += b
print(ans - M)
Problem p03079 (python)

Fixed submission:
l = list(map(int,input().split()))
if l[0] == l[1] and l[1] == l[2]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
l = list(map(input().split()))
if l[0] == l[1] == l[2]:
  print("Yes")
else:
  print("No")
Problem p03105 (python)

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

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
print(min(B // A), C)
Problem p03359 (python)

Fixed submission:
a, b = map(int, input().split())
if a <= b:
  print(a)
else:
  print(a-1)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input())
if a <= b:
  print(a)
else:
  print(a-1)
Problem p03363 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
d = {}
x = 0
for i in range(N):
  x += A[i]
  d[x] = d.get(x, 0) + 1
ans = d.get(0, 0)
for x in d.values():
  ans += x * (x-1) // 2
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
d = {}
x = 0
for i in range(N):
  x += A[i]
  d[x] = d.get(x, 0) + 1
print(N - len(d) + d[0])
Problem p03369 (python)

Fixed submission:
S = input()
print(700 + 100 * S.count("o"))

Buggy submission (verdict: Runtime Error):
S = input()
print(700 + 100 * S.count(o))
Problem p03471 (python)

Fixed submission:
N, Y = map(int, input().split())
Y //= 1000
i = 0
f = 0
while 1:
  if 10 * i > Y:
    break
  y = Y - 10 * i
  n = N - i
  if n <= y <=  5 * n and (y - n) % 4 == 0:
    print(str(i) + " " + str((y-n)//4) + " " + str((5 * n - y) // 4))
    f = 1
    break
  i += 1
if f == 0:
  print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
Y //= 1000
i = 0
f = 0
whlie 1:
  if 10 * i > Y:
    break
  y = Y - 10 * i
  n = N - i
  if n <= y <=  5 * n and (y - n) % 4 == 0:
    print(str(i) + " " + str((y-n)//4) + " " + str((5 * n - y) // 4))
    f = 1
  i += 1
if f == 0:
  print("-1 -1 -1")
Problem p03478 (python)

Fixed submission:
N, A, B = map(int, input().split())
ans = 0
for i in range(1, N+1):
  x = sum(list(map(int, str(i))))
  if A <= x <= B:
    ans += i
print(ans)

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
ans = 0
for i in range(1, N+1):
  x = sum(list(map(int, str(i))))
  if A <= X <= B:
    ans += i
print(ans)

Buggy submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
ans = 0
for i in range(1, N+1):
  x = sum(list(map(str, i)))
  if A <= X <= B:
    ans += i
print(ans)
Problem p03486 (python)

Fixed submission:
s = list(input())
t = list(input())
s.sort()
t.sort(reverse = True)
if s < t:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
s.sort()
t.sort(reverse = True)
if s < t:
  print("Yes")
else:
  print("No")
Problem p03599 (python)

Fixed submission:
A, B, C, D, E, F = map(int, input().split())
perc = 0.0
ans = [0, 0]
op = [0, 0, 0, 0]
a = 0
while 100 * a <= F:
  b = 0
  while 100 * (a + b) <= F:
    c = 0
    while 100 * (a + b) + c <= F:
      if c > (a + b) * E:
        break
      d = 0
      while 100 * (a + b) + c + d <= F:
        if c + d > (a + b) * E:
          break
        if a == b == c == d == 0:
          break
        p = (c + d) * 1.0 / (100 * (a + b) + c + d)
        if p >= perc:
          perc = p
          ans = [100 * (a + b) + c + d, c + d]
          op = [a, b, c, d]
        d += D
      c += C
    b += B
  a += A
print(str(ans[0]) + " " + str(ans[1]))

Buggy submission (verdict: Runtime Error):
A, B, C, D, E, F = map(int, input().split())A, B, C, D, E, F = map(int, input().split())
perc = 0.0
ans = [0, 0]
op = [0, 0, 0, 0]
a = 0
while 100 * a <= F:
  b = 0
  while 100 * (a + b) <= F:
    c = 0
    while 100 * (a + b) + c <= F:
      if c > (a + b) * E:
        break
      d = 0
      while 100 * (a + b) + c + d <= F:
        if c + d > (a + b) * E:
          break
        if a == b == c == d == 0:
          break
        p = (c + d) * 1.0 / (100 * (a + b) + c + d)
        if p > perc:
          perc = p
          ans = [100 * (a + b) + c + d, c + d]
          op = [a, b, c, d]
        d += D
      c += C
    b += B
  a += A
print(str(ans[0]) + " " + str(ans[1]))
Problem p03606 (python)

Fixed submission:
N = int(input())
ans = 0
for i in range(N):
  l, r = map(int, input().split())
  ans += (r - l + 1)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = 0
for i in range(N):
  l, r = map(int. input().split())
  ans += (r - l + 1)
print(ans)
Problem p03611 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
d = {}
for a in A:
  for i in range(a - 1, a + 2):
    d[i] = d.get(i, 0) + 1
x = sorted(d.values())
print(max(x))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
d = {}
for a in A:
  for i in range(a - 1, a + 2)
  d[i] = d.get(i, 0) + 1
x = sorted(d.values())
print(max(x))
Problem p03695 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
X = [0 for i in range(8)]
cnt = 0
for a in A:
  if a >= 3200:
    cnt += 1
  else:
    X[a // 400] = 1
s = sum(X)
if s == 0:
  print(str(1) + " " + str(cnt))
else:
  print(str(s) + " " + str(s + cnt))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
X = [0 for i in range(8)]
cnt = 0
for a in A:
  if a == 3200:
    cnt += 1
  else:
    X[a // 400] = 1
s = sum(X)
if s == 0:
  print(str(1) + " " + str(min(8, cnt)))
else:
  print(str(s) + " " + str(min(8, s + cnt)))
Problem p03731 (python)

Fixed submission:
N, T = map(int, input().split())
A = list(map(int, input().split()))
ans = T
for i in range(1, N):
  if A[i] - A[i-1] >= T:
    ans += T
  else:
    ans += (A[i] - A[i-1])
print(ans)

Buggy submission (verdict: Runtime Error):
N, T = map(int, input().split())
A = list(map(int, input().split()))
ans = T
for i in range(1, N):
  if A[i] - A[i-1] >= T:
    ans += T
  else:
    ans += (A[i] - A[i+1])
print(ans)
Problem p03797 (python)

Fixed submission:
N, M = map(int, input().split())
if N * 2 >= M:
  print(M // 2)
else:
  print(N + (M - N * 2) // 4)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input())
if N * 2 >= M:
  print(M // 2)
else:
  print(N + (M - N * 2) // 3)
Problem p03844 (python)

Fixed submission:
A, B, C = input().split()
if B == "+":
  print(int(A) + int(C))
else:
  print(int(A) - int(C))

Buggy submission (verdict: Runtime Error):
A, B, C = input().split()
if B == "+":
  print(int(A) + int(B))
else:
  print(int(A) - int(B))
Problem p03861 (python)

Fixed submission:
a, b, x = map(int, input().split())
print(b // x - (a - 1) // x)

Buggy submission (verdict: Runtime Error):
a, b, x = input().split()
print(b // x - (a - 1) // x)
Problem p03997 (python)

Fixed submission:
a = int(input())
b = int(input())
h = int(input())
print((a + b) * h // 2)

Buggy submission (verdict: Runtime Error):
a, b, h = map(int, input().split())
print((a + b) * h // 2)
Problem p04012 (python)

Fixed submission:
w = input()
X = [0 for i in range(26)]
for i in range(len(w)):
  X[ord(w[i]) - 97] ^= 1
if sum(X) == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
w = input()
X = [0 for i in range(26)]
for i in range(len(w)):
  X[ord(w[i]) - 97] ^= 1
if sum(X) == 0:
  print("Yes")
else:
  print("No)
Problem p04047 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()
ans = 0
for i in range(0, 2 * N, 2):
  ans += A[i]
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A.sort()
ans = 0
for i in range(0, 2 * N + 1, 2):
  ans += A[i]
print(ans)
Problem p03160 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)

N = int(input())
h = list(map(int, input().split()))
dp = [-1] * (N+1)

def rec(i):
    if i == 0:
        return 0
    if dp[i] != -1:
        return dp[i]
    dp[i] = 2**60 # 十分大きな値
    if i - 1 >= 0:
        dp[i] = min(dp[i], rec(i - 1) + abs(h[i - 1] - h[i]))
    if i - 2 >= 0:
        dp[i] = min(dp[i], rec(i - 2) + abs(h[i - 2] - h[i]))
    return dp[i]

print(rec(N-1))

Buggy submission (verdict: Runtime Error):
N = int(input())
h = list(map(int, input().split()))
dp = [-1] * (N+1)

def rec(i):
    if i == 0:
        return 0
    if dp[i] != -1:
        return dp[i]
    dp[i] = 2**60 # 十分大きな値
    if i - 1 >= 0:
        dp[i] = min(dp[i], rec(i - 1) + abs(h[i - 1] - h[i]))
    if i - 2 >= 0:
        dp[i] = min(dp[i], rec(i - 2) + abs(h[i - 2] - h[i]))
    return dp[i]

print(rec(N-1))

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <vector>
using namespace std;

template<class T> void chmin(T &a, T b) {
    if (a > b) a = b;
}

const long long INF = 1LL<<60;

int main() {
    int N; cin >> N;
    vector<int> h(N);
    for (int i = 0; i < N; ++i) cin >> h[i];
    
    vector<long long> dp(N, INF);
    dp[0] = 0;
    
    for (int i = 1; i < N; ++i) {
        chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]));
        if (i > 1) {
            chmin(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
        }   
    }
    
    cout << dp[N-1] << endl;
}
Problem p03163 (python)

Fixed submission:
import numpy as np
N, W = map(int, input().split())
wv = [map(int, input().split()) for i in range(N)]
dp = np.zeros((N+1, W+1), dtype = np.int)
for i, (w, v) in enumerate(wv):
    dp[i+1] = np.maximum(dp[i+1], dp[i])
    dp[i+1][w:] = np.maximum(dp[i+1][w:], dp[i][:-w] + v)
print(dp[N][W])

Buggy submission (verdict: Runtime Error):
import numpy as np
INF = 2**60 # 無限大を表す値
N, W = map(int, input().split())
wv = [tuple(map(int, input().split())) for i in range(N)]
dp = np.full((N+1, W+1), -INF, dtype = np.int64)
dp[0][0] = 0 # 初期条件
for i, (w, v) in enumerate(wv):
    dp[i+1] = np.max(dp[i+1], dp[i])
    dp[i+1][w:] = np.max(dp[i+1][w:], dp[i][:-w] + v)
print(np.max(dp[N][:W+1]))

Buggy submission (verdict: Runtime Error):
import numpy as np
N, W = map(int, input().split())
wv = [map(int, input().split()) for i in range(N)]
dp = [[0] * (W+1)] * (N+1)
for i, (w, v) in enumerate(wv):
    for j in range(W+1):
        dp[i+1][j] = max(dp[i+1][j], dp[i][j])
        if j-w >= 0:
            dp[i+1][j] = max(dp[i+1][j], dp[i][j-w] + v)
print(dp[N][W])

Buggy submission (verdict: Runtime Error):
import numpy as np
N, W = map(int, input().split())
wv = [map(int, input().split()) for i in range(N)]
dp = [[0] * (W+1) for _ in range(N+1)]
for i, (w, v) in enumerate(wv):
    for j in range(W+1):
        dp[i+1][j] = max(dp[i+1][j], dp[i][j])
        if j-w >= 0:
            dp[i+1][j] = max(dp[i+1][j], dp[i][j-w] + v)
print(dp[N][W])