Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

  
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
  
  
N,M = map(int, input().split())
m_factorized = factorize(M)
mod = 10 ** 9 + 7
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
ans = 1
for i in range( 2, 2**N + 1 ):
  g1.append( ( g1[-1] * i ) % mod )
  inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
  g2.append( (g2[-1] * inverse[-1]) % mod )
    
    
for i in m_factorized:
  k = i[1] 
  ans *= cmb(N-1+k,k,mod)
  ans %= mod
print(ans)
  

Fixed submission:
n = list(map(int,input().split()))
n.sort()
n.reverse()
print(n[0]*10+n[1]+n[2])

Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
for i in range(len(s)-2):
  if (s[i] == s[i+1]) != (t[i] == t[i+1]):
    print("No")
    exit()
print("Yes")

Fixed submission:
n = list(map(int,input().split()))
n.sort()
n.reverse()
print(n[0]*10+n[1]+n[2])

Buggy python submission (verdict: Runtime Error):
n = list(map(int,input().split())).sort()
print(n[2]*10+n[1]+n[0])


Fixed submission:
n = list(map(int,input().split()))
n.sort()
n.reverse()
print(n[0]*10+n[1]+n[2])

Buggy python submission (verdict: Runtime Error):
n = list(map(int,input(),split()))
n.sort()
n.reverse()
print(n[0]*10+n[1]+n[2])

Fixed submission:
n = list(map(int,input().split()))
n.sort()
n.reverse()
print(n[0]*10+n[1]+n[2])
Buggy python submission (verdict: Runtime Error):
n,m,x,y = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = 0
a.sort()
b.sort()
if a[len(a)-1] < b[0]:
 for i in range(a[len(a),b]):
  if i > x and i <= y:
   c = 1
   break
if c == 1:
 print("No war")
else:
 print("War")


Fixed submission:
n,m,x,y = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split())) 
set1 = set()
set2 = set()
c = 0
maxa = max(a)
minb = min(b)
if maxa < minb:
  for i in range(maxa+1,minb+1):
    set1.add(i)
if x < y:
  for i in range(x+1,y+1):
    set2.add(i)
set3 = set1 & set2
if len(set3) >= 1:
  print("No War")
else:
  print("War")
Buggy python submission (verdict: Runtime Error):
a, b = input().split()
print("Yes") if a % 2 != 0 and b % 2 != 0 else print("No")
                 

Fixed submission:
a, b = map(int, input().split())
print("Yes") if a % 2 != 0 and b % 2 != 0 else print("No")
Buggy python submission (verdict: Runtime Error):
def move(x1, y1, x2, y2):
  number = abs(x1-x2)+abs(y1-y2)
  result = []
  while x1 > x2:
    result.append([x1, y1, x1-1, y1])
    x1 -= 1
  while x1 < x2:
    result.append([x1, y1, x1+1, y1])
    x1 += 1
  while y1 > y2:
    result.append([x1, y1, x1, y1-1])
    y1 -= 1
  while y1 < y2:
    result.append([x1, y1, x1, y1+1])
    y1 += 1
  return number, result


H,W = map(int, input().split())
a = [[j%2 for j in range(w)] for i in range(h)]
b = 0
x1, y1 = 0,0
n = 0
moved = []
for x,i in enumerate(a):
  x += 1
  for y,j in enumerate(i):
    y += 1
    if j:
      if b:
        d = move(x1,y1,x,y)
        n += d[0]
        moved += d[1]
        b = 0
      else:
        x1, y1 = x,y
        b = 1
print(n)        
for i in moved:
  print(*i)

Fixed submission:
def move(moves):
  b = []
  for (y1,x1),(y2,x2) in zip(moves[:-1],moves[1:]):
    b.append((y1,x1,y2,x2))
  return b

h,w = map(int, input().split())
a = [list(map(int, input().split())) for i in range(h)]
now = 0
moves = []
ans = []
for y,coins in enumerate(a,1):
  if y % 2:
    for x,coin in enumerate(coins,1):
      if now:
        moves.append((y,x))
        if coin % 2:
          b = move(moves)
          ans += b
          moves = []
          now = 0
      else:
        if coin % 2:
          moves.append((y,x))
          now = 1
  else:
    for x,coin in enumerate(coins[::-1]):
      x = w - x
      if now:
        moves.append((y,x))
        if coin % 2:
          b = move(moves)
          ans += b
          moves = []
          now = 0
      else:
        if coin % 2:
          moves.append((y,x))
          now = 1
print(len(ans))
for i in ans:
  print(*i)
Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())
for i,j in enumerate(s):
  if j == "1"
    if (i+1) == k:
      print(j)
      break
  else:
    print(j)
    break

Fixed submission:
s = input()
k = int(input())
for i,j in enumerate(s):
  if j == "1":
    if (i+1) == k:
      print("1")
      break
  else:
    print(j)
    break
Buggy python submission (verdict: Time Limit Exceeded):
n,m,Q = map(int, input().split())
train = []
for i in range(n):
  a = []
  for j in range(n):
    a.append(0)
  train.append(a)
  
for i in range(m):
  l,r = map(int, input().split())
  train[l-1][r-1] += 1

for i in range(n):
  lst = [0,train[i][0]]
  for j in range(1,n):
    lst.append(lst[j]+train[i][j])
  train[i] = lst 
pq = []
for i in range(Q):
  p,q = map(int, input().split())
  ans = 0
  for i in range(p-1,q):
      ans += train[i][q]

  print(ans)


Fixed submission:
n,m,Q = map(int, input().split())
train = []
for i in range(n):
  a = []
  for j in range(n):
    a.append(0)
  train.append(a)
  
for i in range(m):
  l,r = map(int, input().split())
  train[l-1][r-1] += 1
cumsum = []
list1 = []
for i in range(n+1):
  list1.append(0)
cumsum.append(list1)
for i in range(n):
  lst = [0,cumsum[i][1]+train[i][0]]
  for j in range(1,n):
    lst.append(lst[j]+train[i][j]+(cumsum[i][j+1]-cumsum[i][j]))
  cumsum.append(lst)
for i in range(Q):
  p,q = map(int, input().split())
  print(cumsum[q][q]-cumsum[p-1][q]-cumsum[q][p-1]+cumsum[p-1][p-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,m,Q = map(int, input().split())
train = []
for i in range(n):
  a = []
  for j in range(n):
    a.append(0)
  train.append(a)
  
for i in range(m):
  l,r = map(int, input().split())
  train[l-1][r-1] += 1

for i in range(n):
  lst = [train[i][0]]
  for j in range(1,n):
    lst.append(lst[j-1]+train[i][j])
  train[i] = lst 
pq = []
for i in range(Q):
  p,q = map(int, input().split())
  ans = 0
  for i in range(p-1,q):
    if p == 1:
      ans += train[i][q-1]
    else:
      ans += train[i][q-1] - train[i][p-2]
  print(ans)

Fixed submission:
n,m,Q = map(int, input().split())
train = []
for i in range(n):
  a = []
  for j in range(n):
    a.append(0)
  train.append(a)
  
for i in range(m):
  l,r = map(int, input().split())
  train[l-1][r-1] += 1
cumsum = []
list1 = []
for i in range(n+1):
  list1.append(0)
cumsum.append(list1)
for i in range(n):
  lst = [0,cumsum[i][1]+train[i][0]]
  for j in range(1,n):
    lst.append(lst[j]+train[i][j]+(cumsum[i][j+1]-cumsum[i][j]))
  cumsum.append(lst)
for i in range(Q):
  p,q = map(int, input().split())
  print(cumsum[q][q]-cumsum[p-1][q]-cumsum[q][p-1]+cumsum[p-1][p-1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = "No"
for i in range(n // 7 + 1):
  if (n - i*7) % 4 == 0:
    ans = "Yes"
    break
print(ans)


Fixed submission:
import math
n,k = map(int, input().split())
print(math.ceil(n/k)-n//k)

Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = "No"
for i in range(n // 7 + 1):
  if (n - i*7) % 4 == 0:
    ans == "Yes"
    break
print(ans)


Fixed submission:
import math
n,k = map(int, input().split())
print(math.ceil(n/k)-n//k)

Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = "No"
for i in range(n // 7 + 1):
  if (n - i*7) % 4 == 0:
    ans == "Yes"
print(ans)


Fixed submission:
import math
n,k = map(int, input().split())
print(math.ceil(n/k)-n//k)
Buggy python submission (verdict: Runtime Error):
s = input()
mod = 10**9 + 7
abc = 0
bc = 0
c = 0
q = 0
for i in s[::-1]:
  elif i == "A":
    abc = (abc + bc) % mod
  elif i == "B":
    bc = (bc + c) % mod
  elif i == "C":
    c = (3**q+c) % mod
  elif i == "?":
    abc = (abc*3 + bc) % mod
    bc = (bc*3 + c) % mod 
    c = (3**q + c*3) % mod
    q += 1
print(abc)


Fixed submission:
n = int(input())
if n >= 2800:
  print("AGC")
elif n >= 1200:
  print("ARC")
else:
  print("ABC")
Buggy python submission (verdict: Runtime Error):
s = input()
if s[0] == "A" and s[2:-1].count("C") == 1:
  s[s[2:-1].find("C")] = c
  if s[1:].islower():
    print("AC")
  else:
    print("WA")
else:
  print("WA")

Fixed submission:
s = input()
if s[0] == "A" and s[2:-1].count("C") == 1:
  index_C = s.find("C")
  if s[1:index_C].islower() and s[index_C+1:].islower():
    print("AC")
  else:
    print("WA")
else:
  print("WA")
Buggy python submission (verdict: Time Limit Exceeded):
t = int(input())
a = []
for i in range(t):
  a.append(list(map(int,input().split())))
for j in a:
  b = j[0]
  for k in range(j[1]):
    if j[0] < j[1]:
      print("No")
      break
    j[0] %= j[1]
    if j[0] <= j[2]:
      j[0] += j[3]
    else:
      print("No")
      break
    if j[0] < j[1]:
      print("No")
      break
    if k == j[1]-1:
      print("Yes")
    

Fixed submission:
def gcd(x, y):
	while y:
		x, y = y, x % y
	return x

t = int(input())
a = []
d = 0
for i in range(t):
  a.append(list(map(int,input().split())))
for j in a:
  if j[0] < j[1] or j[1] > j[3]:
    print("No")
  else:
    b = j[0] % j[1]
    k = gcd(j[1],j[3])
    c = j[0] % k
    d = j[2] % k
    if c > d:
      e = j[2] + c - d
    else:
      e = j[2] + k + c - d

    if j[1] > e:
      print("No")
    else:
      print("Yes")
Buggy python submission (verdict: Runtime Error):
def con(n,d):
  if d == 0:
    return n
  else:
    return (n - d) * 2

n,m,d = map(int, input().split())
beauty_sum = pow(con(n,d),m-1) * (m - 1)
print(beauty_sum / pow(n,m))


Fixed submission:
def con(n,d):
  if d == 0:
    return 1 / n
  else:
    return (n - d) * 2 / (n ** 2)

n,m,d = map(int, input().split())
beauty = con(n,d) * (m - 1)
print(beauty)
Buggy python submission (verdict: Runtime Error):
n = input().split()
a = 0
for i in n:
  if i = "+"
    a+=1
  else
    a-=1
print(a)

Fixed submission:
n = input()
a = 0
for i in n:
  if i == "+":
    a+=1
  else:
    a-=1
print(a)
Buggy python submission (verdict: Runtime Error):
n = int(input())
sn = sum(list(map(int, n.split())))
if n % sn == 0:
  print("Yes")
else:
  print("No")

Fixed submission:
n = input()
sn = sum([int(i) for i in list(n)])
n = int(n)
if n % sn == 0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
print("Yay!") if a <= 8 and b <= 8 else print(":(
")


Fixed submission:
a, b = map(int, input().split())
print("Yay!") if a <= 8 and b <= 8 else print(":(")

Buggy python submission (verdict: Runtime Error):
a, b = int(input())
print("Yay!") if a <= 8 and b <= 8 else print(":(
")

Fixed submission:
a, b = map(int, input().split())
print("Yay!") if a <= 8 and b <= 8 else print(":(")
Buggy python submission (verdict: Runtime Error):
n = int(input())

if n <=999:
  print("ABC")
else:
  print("ABD"))

Fixed submission:
n = int(input())
if n <=999:
  print("ABC")
else:
  print("ABD")
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
t = 0
for i in range(len(s)-1):
  a = {s[:i]} 
  b = {s[i+1:]}
  c = a & b
  print(c)
  if c > t:
    t = c

print(c)


  
  
  

Fixed submission:
n = int(input())
s = input()
ans = 0
for i in range(1,n):
  a = set([j for j in s[:i]])
  b = set([k for k in s[i:]])
  c = a & b
  d = len(c)
  if d > ans:
    ans = d    
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
ans = s[1:].count("E")
a = ans
for i in range(n-1):
  if s[i] == "W"
    a += 1
  if s[i+1] == "E"
    a -= 1
  if a < ans:
    ans = a
print(ans)
  

Fixed submission:
n = int(input())
s = input()
ans = s[1:].count("E")
a = ans
for i in range(n-1):
  if s[i] == "W":
    a += 1
  if s[i+1] == "E":
    a -= 1
  if a < ans:
    ans = a
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
str = s[1:]
a = 0
for i in str:
  if i == "E":
    a += 1
b = a

for i in range(len(n)):
  if str[i] == "w":
  	if str[i+1] == "E":
      continue
    else:
      a += 1 
  else:
    if str[i+1] == "E"
      a -= 1
      if b > a:
        a = b
    else:
      continue
      
print(b)
    

    

Fixed submission:
n = int(input())
s = input()
ans = s[1:].count("E")
a = ans
for i in range(n-1):
  if s[i] == "W":
    a += 1
  if s[i+1] == "E":
    a -= 1
  if a < ans:
    ans = a
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())
c = len(s)
a = []
for i in range(5):
  b = [s[j:i+j+1] for j in range(c-i-1)]
  b = list(set(b))
  a = a + b
a.sort()
print(a[k-1])

Fixed submission:
s = input()
k = int(input())
c = len(s)
d = 0
a = []
if c < 5:
  d = c
else:
  d = 5
for i in range(d):
  b = [s[j:i+j+1] for j in range(c-i)]
  b = list(set(b))
  a = a + b
a.sort()
print(a[k-1])
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate

N = int(input())
balls = []

# 初期位置を覚えておく
placeB = [0] * N
placeW = [0] * N

# 入力処理 & 初期位置処理
for i in range(2*N):
    c, a = input().split()
    a = int(a)
    balls.append([c, a])
    if c == "B":
        placeB[a-1] = i
    else:
        placeW[a-1] = i


costB = [[0]*(2*N+1) for i in range(N+1)]  # i番目まででjより大きいB
costW = [[0]*(2*N+1) for i in range(N+1)]  # i番目まででjより大きいW

for i in range(N):
    for j in range(2*N):
        if balls[j][1] > i:
            if balls[j][0] == "B":
                costB[i][j+1] = 1
            else:
                costW[i][j+1] = 1

# 累積和
costB = [list(accumulate(cB)) for cB in costB]
costW = [list(accumulate(cW)) for cW in costW]

# dp
dp = [[float('inf')]*(N+1) for i in range(N+1)]
dp[0][0] = 0
for b in range(N+1):
    for w in range(N+1):
        if b > 0:
            dp[b][w] = min(dp[b][w], dp[b-1][w] + costB[b][placeB[b-1]] + costW[w][placeB[b-1]])
        if w > 0:
            dp[b][w] = min(dp[b][w], dp[b][w-1] + costW[w][placeW[w-1]] + costB[b][placeW[w-1]])

print(dp[N][N])


Fixed submission:
from itertools import accumulate

N = int(input())
balls = []

# 初期位置を覚えておく
placeB = [0] * N
placeW = [0] * N

# 入力処理 & 初期位置処理
for i in range(2*N):
    c, a = input().split()
    a = int(a)
    balls.append([c, a])
    if c == "B":
        placeB[a-1] = i
    else:
        placeW[a-1] = i


costB = [[0]*(2*N+1) for i in range(N+1)]  # i番目まででjより大きいB
costW = [[0]*(2*N+1) for i in range(N+1)]  # i番目まででjより大きいW

for i in range(N):
    for j in range(2*N):
        if balls[j][1] > i:
            if balls[j][0] == "B":
                costB[i][j+1] = 1
            else:
                costW[i][j+1] = 1

# 累積和
costB = [list(accumulate(cB)) for cB in costB]
costW = [list(accumulate(cW)) for cW in costW]

# dp
dp = [[float('inf')]*(N+1) for i in range(N+1)]
dp[0][0] = 0
for b in range(N+1):
    for w in range(N+1):
        if b > 0:
            dp[b][w] = min(dp[b][w], dp[b-1][w] + costB[b][placeB[b-1]] + costW[w][placeB[b-1]])
        if w > 0:
            dp[b][w] = min(dp[b][w], dp[b][w-1] + costW[w][placeW[w-1]] + costB[b][placeW[w-1]])

print(dp[N][N])
Buggy python submission (verdict: Runtime Error):
a,b,c,x,y = map(int, input().split())
mx = a if x >= y else b
if c * 2 <= (a+b):
  if c * 2 <= mx:
    print((min(x,y)+abs(x-y))*c*2)
  else:
    print(min(x,y)*c*2+ans(x-y)*mx)
else:
  print(a*x+b*y)

Fixed submission:
a,b,c,x,y = map(int, input().split())
mx = a if x >= y else b
if c * 2 <= (a+b):
  if c * 2 <= mx:
    print((min(x,y)+abs(x-y))*c*2)
  else:
    print(min(x,y)*c*2+abs(x-y)*mx)
else:
  print(a*x+b*y)
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = list(map(int, input().split()))
y = sorted(x)
for i in x:
  if i > y[n/2-1]:
    print(y[n/2-1])
  else:
    print(y[n/2])

Fixed submission:
n = int(input())
x = list(map(int, input().split()))
y = sorted(x)
for i in x:
  if i > y[n//2-1]:
    print(y[n//2-1])
  else:
    print(y[n//2])
Buggy python submission (verdict: Runtime Error):
s = input()
a = ["abc","acb","bac","bca","cab","cba"]
print["No","Yes"][s in a]

Fixed submission:
s = input()
if s.count("a") == 1 and s.count("b") == 1 and s.count("c") == 1:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
A, B, C = sorted([a, b, c])
if (B - A) % 2 == (C - A) % 2 == 0:
    print((C - A) // 2 + (C - B) // 2)
else:
    print((C - A) // 2 + (C - B) // 2 + 2)

Fixed submission:
s = input()
if s.count("a") == 1 and s.count("b") == 1 and s.count("c") == 1:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
for x in range(a,b):
  if x < a + k  or x > b - k:
    print(x)
  else:
    continue

Fixed submission:
s = input()
if s.count("a") == 1 and s.count("b") == 1 and s.count("c") == 1:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
s = input
if s.count("a") == 1 and s.count("b") == 1 and s.count("c") == 1:
  print("Yes")
else:
  print("No")

Fixed submission:
s = input()
if s.count("a") == 1 and s.count("b") == 1 and s.count("c") == 1:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k= map(int, input().split())
for x in range(a,b+1):
    if x < a + k:
        print(x)
    elif x > b - k:
        print(x)  
    else:
        continue

Fixed submission:
a, b, k= map(int, input().split())
for x in range(a,min(a+k,b+1)):
    print(x)
for x in range(b-k+1,b+1):
    if x < a+k:
        continue
    else:
        print(x)

Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, raw_input().split())
for x in range(a,b):
  if x < a + k  or x > b - k:
    print(x)
  else:
    continue

Fixed submission:
a, b, k= map(int, input().split())
for x in range(a,min(a+k,b+1)):
    print(x)
for x in range(b-k+1,b+1):
    if x < a+k:
        continue
    else:
        print(x)

Buggy python submission (verdict: Time Limit Exceeded):
a, b, k= map(int, input().split())
for x in range(a,b+1):
  if x < a + k or x > b - k:
    print(x)
  else:
    continue

Fixed submission:
a, b, k= map(int, input().split())
for x in range(a,min(a+k,b+1)):
    print(x)
for x in range(b-k+1,b+1):
    if x < a+k:
        continue
    else:
        print(x)
Buggy python submission (verdict: Runtime Error):
a={chr(i) for i in range(ord(a),ord(a)+25)}
s=input()
n=len(s)
if n<26:
  print(s+sorted(a-set(s))[0])
else:
  for i in range(2,27):
    if s[-i]<s[-i+1]:
      break
    if i==26:
      print(-1)
      exit()
  for j in sorted(s[-i+1:]):
    if j>s[-i]:break
  print(s[:-i]+j)


Fixed submission:
a={chr(i) for i in range(ord("a"),ord("a")+26)}
s=input()
n=len(s)
if n<26:
  print(s+sorted(a-set(s))[0])
else:
  for i in range(2,27):
    if s[-i]<s[-i+1]:
      break
    if i==26:
      print(-1)
      exit()
  for j in sorted(s[-i+1:]):
    if j>s[-i]:break
  print(s[:-i]+j)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(input().split())
if any(i === "Y" for i in s):
  print("Four")
else:
  print("Three")

Fixed submission:
n = int(input())
s = list(input().split())
if any(i == "Y" for i in s):
  print("Four")
else:
  print("Three")
Buggy python submission (verdict: Runtime Error):
import sys

n = int(input())
l = 0
r = n-1
mid = r // 2
re = [None] * n
print(0, flush=True)
re[0] = input()
if re[0] == "Vacant":
  sys.exit()
print(mid, flush=True)
re[mid] = input()
while re[mid] != "Vacant":
  if re[l] == re[mid]:
    if (mid - l) % 2:
      r = mid
    else:
      l = mid
  else:
    if (mid - l) % 2:
      l = mid
    else:
      r = mid
  mid = (l + r) // 2
  print(mid, flush=True)
  re[mid] = input()
else:
  sys.exit()


Fixed submission:
x,y = map(int, input().split())
if x % y == 0:
  print(-1)
else:
  print(x)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if i+*500+j*100+k*50 == x:
        ans += 1
print(ans)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if i*500+j*100+k*50 == x:
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if i+*500+j*100+k*50 == x:
        ans += 1


Fixed submission:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if i*500+j*100+k*50 == x:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())
print("Even") if (a * b) % 2 == 0: else print("Odd")

Fixed submission:
a,b = map(int, input().split())
print("Even") if (a * b) % 2 == 0 else print("Odd")
Buggy python submission (verdict: Runtime Error):
import math
a,b = input(),input()
c = int(a+b)
d = math.sqrt(c)
if c / d == d:
  print("Yes")


Fixed submission:
a,b = input().split()
c = int(a + b)
d = []
for i in range(400):
  d.append(i**2)
if c in d:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
import math
a,b = input(),input()
c = int(a+b)
d = math.sqrt(c)
if c / d = d:
  print("Yes")

Fixed submission:
a,b = input().split()
c = int(a + b)
d = []
for i in range(400):
  d.append(i**2)
if c in d:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n,a,b = map(int, input().split())
if b - a % 2 == 0:
  print("Alice")
elif b - a % 2 == 1
  print("Borys")

Fixed submission:
n,a,b = map(int, input().split())
c = b-a
if c % 2 == 0:
  print("Alice")
elif c % 2 == 1:
  print("Borys")

Buggy python submission (verdict: Runtime Error):
n,a,b = map(int, input().split())
if b - a % 2 == 0:
  print("Alice")
elif b - a % 2 == 1
  print("Borys")

Fixed submission:
n,a,b = map(int, input().split())
c = b-a
if c % 2 == 0:
  print("Alice")
elif c % 2 == 1:
  print("Borys")
Buggy python submission (verdict: Runtime Error):
n, y = map(int, input().split())
for i in range(0, n+1):
  for j in range(0, n+1-a):
    k = n - i - j
    if 10000 * i + 5000 * j + 1000 * k == y:
      print(i, j, k)
      exit()
print(-1, -1, -1)


Fixed submission:
n, y = map(int, input().split())
for i in range(0, n+1):
  for j in range(0, n+1-i):
    k = n - i - j
    if 10000 * i + 5000 * j + 1000 * k == y:
      print(i, j, k)
      exit()
print(-1, -1, -1)
Buggy python submission (verdict: Runtime Error):
import bisect
n,h = map(int, input().split())
a = []
b = []
for i in range(n):
  a1,b1 = map(int, input().split())
  a.append(a1)
  b.append(b1)
b.sort()
max_a = max(a)
ans = 0
for i in b[::-1]:
  if i > max_a:
    h -= i
    ans += 1
  else:
    break
  if h <= 0:
    print(ans)
    exit()
ans += math.ceil(h/max_a)
print(ans)

Fixed submission:
import math
n,h = map(int, input().split())
a = []
b = []
for i in range(n):
  a1,b1 = map(int, input().split())
  a.append(a1)
  b.append(b1)
b.sort()
max_a = max(a)
ans = 0
for i in b[::-1]:
  if i > max_a:
    h -= i
    ans += 1
  else:
    break
  if h <= 0:
    print(ans)
    exit()
ans += math.ceil(h/max_a)
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
print((x-z)//(y+z))

Fixed submission:
x,y,z = map(int, input().split())
print((x-z)//(y+z))