Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
A, B = map(int,input().split())
mod = 10**9+7
def factorical(n):
  ret = 1
  for i in range(1,n+1):
    ret *= i
    ret %= 
  return ret%mod

a = factorical(A)
b = factorical(B)
if(abs(A-B) >= 2):
  print(0)
elif(A == B):
  print(a*b*2%mod)
else:
  print(a*b%mod)

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

def factorical(n):
  ret = 1
  for i in range(1,n+1):
    ret *= i
    ret %= 10**9+7
  return ret

diff = abs(N - M)
max_ = int(1e9+7)

if(diff >= 2):
  print(0)
elif(diff == 1):
  n = N % max_
  m = M % max_
  print((factorical(n)*factorical(m)) % max_)
else:
  n = N % max_
  m = M % max_
  print((2*factorical(n)*factorical(m)) % max_)

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

def factorical(n):
  ret = 1
  for i in range(1,n+1):
    ret *= i%(10**9+7)
    ret %= (10**9+7)
  return ret%(10**9+7)

a = factorical(A)
b = factorical(B)
if(abs(M-N)>= 2):
  print(0)
elif(A == B):
  print(a*b*2%(10**9+7))
else:
  print(a*b%(10**9+7))

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

def factorical(n):
  ret = 1
  for i in range(1,n+1):
    ret *= i
    ret %= 10**9+7
  return ret

diff = abs(N - M)
max_ = int(1e9+7)

if(diff >= 2):
  print(0)
elif(diff == 1):
  n = N % max_
  m = M % max_
  print((factorical(n)*factorical(m)) % max_)
else:
  n = N % max_
  m = M % max_
  print((2*factorical(n)*factorical(m)) % max_)
Buggy python submission (verdict: Runtime Error):
N, K = map(int,input().split())
AB = sorted([[list(map(int,input().split())) for _ in range(N)]])

tmp = 0
for a, b in AB:
  if(tmp < K-b):
    tmp += b
  else:
    print(a)
    break

Fixed submission:
N, K = map(int,input().split())
A = sorted([list(map(int,input().split())) for _ in range(N)])

cnt = 0
for a in A:
  if(cnt < K-a[1]):
    cnt += a[1]
  else:
    print(a[0])
    break
"""
unk buriburi
"""

Buggy python submission (verdict: Runtime Error):
N, K = map(int,input().split())
AB = sorted([[list(map(int,input().split())) for _ in range(N)]])
cnt = 0
for a, b in AB:
  if(cnt < K - b):
    cnt += b
  else:
    print(a)
    break

Fixed submission:
N, K = map(int,input().split())
A = sorted([list(map(int,input().split())) for _ in range(N)])

cnt = 0
for a in A:
  if(cnt < K-a[1]):
    cnt += a[1]
  else:
    print(a[0])
    break
"""
unk buriburi
"""

Buggy python submission (verdict: Runtime Error):
N, K = map(int,input().split())
AB = sorted([[list(map(int,input().split())) for _ in range(N)]])
cnt = 0
for a, b in AB:
  if(cnt < K - b)
    cnt += b
  else:
    print(a)
    break


Fixed submission:
N, K = map(int,input().split())
A = sorted([list(map(int,input().split())) for _ in range(N)])

cnt = 0
for a in A:
  if(cnt < K-a[1]):
    cnt += a[1]
  else:
    print(a[0])
    break
"""
unk buriburi
"""

Buggy python submission (verdict: Runtime Error):
N, K = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(N)]

result = [a for j in range(b) for a, b in A]
print(result[K+1])

"""
result = []
for a, b in A:
  for j in range(b):
    result.append(a)
print(result[K-1])
"""

Fixed submission:
N, K = map(int,input().split())
A = sorted([list(map(int,input().split())) for _ in range(N)])

cnt = 0
for a in A:
  if(cnt < K-a[1]):
    cnt += a[1]
  else:
    print(a[0])
    break
"""
unk buriburi
"""
Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))

def main():
  n = ni()

  def divi(n):
    res = []
    for i in range(1, int(n**0.5)+1):
      if n % i == 0:
        res.append(i)
        if i != n // i:
          res.append(n // i)
    return res

  def digitlen(n):
    return len(str(n))

  x = divi(n)
  x.sort()
  m = len(x) // 2
  if m == 1:
    m = 0
  print(max(digitlen(x[m]), digitlen(x[m+1])))

main()

Fixed submission:
N = int(input())
x = round(N**0.5)
while N%x != 0:
  x -= 1
print(len(str(N//x)))

Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
na = lambda : map(int, stdin.readline().split())
ni = lambda : int(ns())
def main():
  n = ni()
  nagasa = lambda x: len(str(x))
  def f(a, b):
    x = nagasa(a)
    y = nagasa(b)
    return x if x > y else y

  def divi(n):
    res = []
    for i in range(1, int(n**0.5)+1):
      if n % i == 0:
        res.append(i)
        if i != n // i:
          res.append(n // i)
    return res
  x = divi(n)
  print(f(x[-1], x[-2]))

main()

Fixed submission:
N = int(input())
x = round(N**0.5)
while N%x != 0:
  x -= 1
print(len(str(N//x)))
Buggy python submission (verdict: Runtime Error):
A, B = map(int,input().split())
if((A == 1 and A < B) or A > B):
  print('Alice')
elif((B == 1 and A > B) or A < B):
  print('Bob')
else:
  print(Draw)

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

if(A == 1 and B == 1):
  print("Draw")
  exit()
elif(A == 1):
  print("Alice")
  exit()
elif(B == 1):
  print("Bob")
  exit()
elif(A > B):
  print("Alice")
elif(A < B):
  print("Bob")
else:
  print("Draw")
Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))

def main():
  n = ni()
  ans = n // 11 * 2
  if 0 < x % 11 < 7:
    ans += 1
  elif x % 11 > 6:
    ans += 2
  print(ans)
main()

Fixed submission:
x = int(input())
ans = x//11 * 2
if(0 < x%11 < 7):
  ans += 1
elif(x%11 > 6):
  ans += 2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int,input().split())

if(3*K == S):
  print(1)
  exit()
cnt = 0
for i in range(K+1):
  for j in range(K+2):
    for k in range(K+3):
      if(i+j+k == S):
        cnt += 1
print(cnt)

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

cnt = 0
for i in range(K+1):
  for j in range(K+1):
    if(S-(i+j) <= K and S-(i+j) >= 0):
      cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))

def main():
  n = ni()
  a = na()

  if n % 2 == 0:
    if 0 in a:
      print(0)
      return 
    else:
      print(2 ** len(list(set(a))))
  else:
    zero = 0
    for aa in a:
      if aa == 0:
        zero += 1
    if zero > 1:
      print(0)
      return
    else:
      if zero == 1:
        print(2 ** (len(list(set(a)) - 1))
      else:
        print(2 ** len(list(set(a)))

main()

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

mod = 10**9+7
if(N%2 == 0 and len(set(A)) == N//2):
  print(2**(N//2) % mod)
elif(N%2 != 0 and A.count(0) == 1):
  print(2**((N-1)//2) % mod)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
H, W = map(int,input().split())
S = [input().split() for _ in range(H)]

w = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"]

for i in range(H):
  for j in range(W):
    if(S[i][j] == "snuke"):
      print(w[j]+str(i+1))

Fixed submission:
H, W = map(int,input().split())
S = [input().split() for _ in range(H)]

for i in range(H):
  for j in range(W):
    if(S[i][j] == "snuke"):
      print(chr(64+(j+1))+str(i+1))
Buggy python submission (verdict: Runtime Error):
W, H, N = map(int,input().split())
dx, dy = 0, 0

for i in range(N):
  x, y, a = map(int,input().split())
  if(a == 1):
    dx = max(dx, x)
  elif(a == 2):
    W = min(W, x)
  elif(a == 3):
    dy = max(dy, y)
  else:
    H = min(H, y)
if(dx <= W or dy <= H):
  print(0)
else:
  print((dx-W) * (dy-H))


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

if((a+b == c) or (b+c == a) or (a+c == b)):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
T = input()

for i in range(N, 0, -1):
  if(S[-i:] == T[:i]):
    tmp = i
    break
print(N*2-tmp)

Fixed submission:
N = int(input())
S = input()
T = input()
tmp = 0
for i in range(N, 0, -1):
  if(S[-i:] == T[:i]):
    tmp = i
    break
print(N*2-tmp)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()

tmp = len(S)
while True:
  S = S.replace("ST", "")
  if(len(S) == tmp):
    break
  tmp = len(S)
print(len(S))

Fixed submission:
S = input()

result = ""
for s in S:
  if(s == "T" and result == ""):
    result += s
  elif(s == "T" and result[-1] == "S"):
    result = result[:-1]
  else:
    result += s
print(len(result))
Buggy python submission (verdict: Runtime Error):
S = list(input())
cnt = 0
for i in range(1 << len(S)-1):
  f = S[0]
  for j, b in enumerate(format(i, 'b').zfill(len(S)-1)):
    if(b == '1'):
      f += '+'
    f += S[j+1]
  cnt += sum(map(int,f.split('+')))
print(cnt)

Fixed submission:
S = list(input())
"""
if(len(S) == 1):
  print(S[0])
  exit()
cnt = 0
for i in range(1 << len(S)-1):
  f = S[0]
  for j, b in enumerate(format(i, 'b').zfill(len(S)-1)):
    if(b == '1'):
      f += '+'
    f += S[j+1]
  cnt += sum(map(int,f.split('+')))
print(cnt)

"""

cnt = 0
for i in range(1 << len(S)-1):
  f = S[0]
  for j in range(len(S)-1):
    if(((i >> j) & 1)== 1):
      f += '+'
    f += S[j+1]
  cnt += sum(map(int, f.split('+')))
print(cnt)
Buggy python submission (verdict: Runtime Error):
N, A = map(int,input().split())
X = list(map(int,input().split()))

X = [int(x) - A for x in input().split()]
dp = [[0 for _ in range(100*N+1)] for _ in range(N+1)]
dp[0][50*N] = 1

for i in range(N):
  for j in range(50, 100*N+1-50):
    dp[i+1][j] = dp[i][j] + dp[i][j - X[i]]
print(dp[N][50*N] - 1)


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

X = [int(x) - A for x in input().split()]
dp = [[0 for _ in range(100*N+1)] for _ in range(N+1)]
dp[0][50*N] = 1

for i in range(N):
  for j in range(50, 100*N+1-50):
    dp[i+1][j] = dp[i][j] + dp[i][j - X[i]]
print(dp[N][50*N] - 1)

Buggy python submission (verdict: Time Limit Exceeded):
N, A = map(int,input().split())
X = list(map(int,input().split()))

from itertools import combinations

cnt = 0
for i in range(1,N+1):
  for per in combinations(X, i):
    #print(per,i,sum(per))
    if(sum(per)/i == A):
      cnt += 1
print(cnt)


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

X = [int(x) - A for x in input().split()]
dp = [[0 for _ in range(100*N+1)] for _ in range(N+1)]
dp[0][50*N] = 1

for i in range(N):
  for j in range(50, 100*N+1-50):
    dp[i+1][j] = dp[i][j] + dp[i][j - X[i]]
print(dp[N][50*N] - 1)
Buggy python submission (verdict: Runtime Error):
import math
n_num,m_num=map(int,input().split())
n_comb=math.factorial(n_num)//(math.factorial(n_num-2)*math.factorial(2))
m_comb=math.factorial(m_num)//(math.factorial(m_num-2)*math.factorial(2))
print(int(n_comb+m_comb))


Fixed submission:
def c(i):
    return i*(i-1)//2

n,m=map(int,input().split())
print(c(n)+c(m))

Buggy python submission (verdict: Runtime Error):
import math
n_num,m_num=map(int,input().split())
n_comb=math.factorial(n_num)/(math.factorial(n_num-2)*math.factorial(2))
m_comb=math.factorial(m_num)/(math.factorial(m_num-2)*math.factorial(2))
print(int(n_comb+m_comb))


Fixed submission:
def c(i):
    return i*(i-1)//2

n,m=map(int,input().split())
print(c(n)+c(m))
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int, input().split())
d = 10**9+7

A = [i for i in range(N+1)]
A_rev = sorted(A, reverse=True)
ans = 0
for i in range(K, N+2):
    maximum = sum(A_rev[0:i])
    minimum = sum(A[0:i])
    ans += maximum - minimum + 1
print(ans%d)

Fixed submission:
N,K = map(int, input().split())
d = 10**9+7

A = [i for i in range(N+1)]
A_rev = sorted(A, reverse=True)
ans = 0
dp = {'max':sum(A_rev[0:K]), 'min':sum(A[0:K])}
ans += dp['max'] - dp['min'] + 1
for i in range(K, N+1):
    dp['max'] += A_rev[i]
    dp['min'] += A[i]
    ans += dp['max'] - dp['min'] + 1
print(ans%d)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int, input().split())
d = 10**9+7

A = [i for i in range(N+1)]
A_rev = sorted(A, reverse=True)
ans = 0
for i in range(K, N+2):
    maximum = sum(A_rev[0:i])
    minimum = sum(A[0:i])
    ans += maximum - minimum + 1
print(ans%d)

Fixed submission:
N,K = map(int, input().split())
d = 10**9+7

A = [i for i in range(N+1)]
A_rev = sorted(A, reverse=True)
ans = 0
dp = {'max':sum(A_rev[0:K]), 'min':sum(A[0:K])}
ans += dp['max'] - dp['min'] + 1
for i in range(K, N+1):
    dp['max'] += A_rev[i]
    dp['min'] += A[i]
    ans += dp['max'] - dp['min'] + 1
print(ans%d)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

dp = [0]*N

for i in range(N):
  dp[i] = min(A[i], B[i])
  A[i], B[i] -= dp[i]
  if rem==0:
    tmp = min(A[i+1], B[i])
    dp[i] += tmp
    A[i+1] -= tmp
print(sum(dp))


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

dp = [0]*N #勇者が倒す数

for i in range(N):
  dp[i] = min(A[i], B[i])
  A[i] -= dp[i]
  B[i] -= dp[i]
  rem = A[i]
  if rem==0:
    tmp = min(A[i+1], B[i])
    dp[i] += tmp
    A[i+1] -= tmp
print(sum(dp))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for i in range(N)]
for i in range(N):
    tmp = A[i]
    A[i] = 0
    print(max(A))
    A[i] = tmp

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]
maximum = max(A)
if A.count(maximum) != 1:
    for i in range(N):
        print(maximum)
else:
    B = A[:]
    B.remove(maximum)
    maximum_ne = max(B)
    for i in range(N):
        if A[i] == maximum:
            print(maximum_ne)
        else:
            print(maximum)
Buggy python submission (verdict: Runtime Error):
N = int(input())
d = map(int, input().split())
d.sort()
a = d[N//2-1]
b = d[N//2]
if a==b:
  print(0)
else:
  print(b-a)

Fixed submission:
N = int(input())
d = list(map(int, input().split()))
d.sort()
a = d[N//2-1]
b = d[N//2]
if a==b:
  print(0)
else:
  print(b-a)
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print(min([a+b, a+c, b+c])

Fixed submission:
a, b, c = map(int, input().split())
print(min([a+b, a+c, b+c]))
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int, input().split())
a = [int(input()) for _ in range(M)]
dp = [0]*(N+1)
dp[0] = 1
dp[1] =0 if 1 in a else 1
for i in range(2, N+1):
  dp[i] = (dp[i-1] + dp[i-2])%(10**9+7) if i not in a else 0
print(dp[N])

Fixed submission:
N,M = map(int, input().split())
a = set([int(input()) for _ in range(M)])
dp = [0]*(N+1)
dp[0] = 1
dp[1] =0 if 1 in a else 1
for i in range(2, N+1):
  dp[i] = (dp[i-1] + dp[i-2])%(10**9+7) if i not in a else 0
print(dp[N])

Buggy python submission (verdict: Runtime Error):
N,M = map(int, input().split())
a = [int(input()) for _ in range(M)]
dp = [0]*n
dp[0] = 1
dp[1] =0 if 2 in a else 1
for i in range(2, N+1):
  dp[i] = (dp[i-1] + dp[i-2])%(10**9+7) if i not in a else 0
print(dp[n])

Fixed submission:
N,M = map(int, input().split())
a = set([int(input()) for _ in range(M)])
dp = [0]*(N+1)
dp[0] = 1
dp[1] =0 if 1 in a else 1
for i in range(2, N+1):
  dp[i] = (dp[i-1] + dp[i-2])%(10**9+7) if i not in a else 0
print(dp[N])
Buggy python submission (verdict: Runtime Error):
S = input().rstrip()
S = input().rstrip()
be = int(S[:2])
en = int(S[2:])
flag_be = False
flag_en = False
answer = ""
if be <= 12 and be >= 1:
    flag_be = True
if en <= 12 and en >= 1:
    flag_en = True

if flag_be and flag_en:
    answer = "AMBIGUOUS"
elif flag_be == True and flag_en == False:
    answer = "MMYY"
elif flag_be == False and flag_en == True:
    answer = "YYMM"
else:
    answer = "NA"
print(answer)

Fixed submission:
S = input().rstrip()
be = int(S[:2])
en = int(S[2:])
flag_be = False
flag_en = False
answer = ""
if be <= 12 and be >= 1:
    flag_be = True
if en <= 12 and en >= 1:
    flag_en = True

if flag_be and flag_en:
    answer = "AMBIGUOUS"
elif flag_be == True and flag_en == False:
    answer = "MMYY"
elif flag_be == False and flag_en == True:
    answer = "YYMM"
else:
    answer = "NA"
print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
s = input()
count = 0

for _ in range(1000000):
    if s.count("01") != 0:
        num = s.count("01")
        s = s.replace("01", "")
        count += 2*num
    elif s.count("10") != 0:
        num = s.count("10")
        s = s.replace("10", "")
        count += 2*num
    else:
        break

print(count)


Fixed submission:
import sys
input = sys.stdin.readline
s = input().rstrip()
 
if s.count("0") != 0 and s.count("1") != 0:
    if s.count("0") > s.count("1"):
        print(2*s.count("1"))
    elif s.count("1") > s.count("0"):
        print(2*s.count("0"))
    else:
        print(len(s))
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
s = input()
count = 0

while True:
    if s.count("01") != 0:
        num = s.count("01")
        s = s.replace("01", "")
        count += 2*num
    elif s.count("10") != 0:
        num = s.count("10")
        s = s.replace("10", "")
        count += 2*num
    else:
        break

print(count)


Fixed submission:
import sys
input = sys.stdin.readline
s = input().rstrip()
 
if s.count("0") != 0 and s.count("1") != 0:
    if s.count("0") > s.count("1"):
        print(2*s.count("1"))
    elif s.count("1") > s.count("0"):
        print(2*s.count("0"))
    else:
        print(len(s))
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
import copy

n, m = map(int, input().rstrip().split())
number_list = list(map(int, input().rstrip().split()))
number_list.sort()
match = [2, 5, 5, 4, 5, 6, 3, 7, 6]
new_match = []
answer = []

for i in number_list:
    new_match.append(match[i-1])


for index in range(m):
    value = new_match[index]
    new_match_tmp = copy.copy(new_match)
    new_match_tmp.remove(value)
    maximum = max(new_match_tmp)
    #商と余りを計算
    quotient = int(n / value)
    remainder = n % value
    answer_tmp = [number_list[index]] * quotient
    #余りがあるなら余りをなくすように組み合わせを考える
    if remainder != 0:
        while True:
            quotient -= 1
            remainder += value
            answer_tmp.pop(0)
            if remainder in new_match:
                answer_tmp.append(number_list[new_match.index(remainder)])
                break
            elif remainder > maximum:
                try:
                    minimum = min(new_match_tmp)
                    remainder -= minimum
                    answer_tmp.append(number_list[new_match.index(minimum)])
                except:
                    answer_tmp = []
                    break
            if remainder == n:
                answer_tmp = []
                break

    if len(answer_tmp) != 0:
        answer.append(answer_tmp)

answer.sort(key=lambda x:len(x), reverse=True)
ans = reversed(answer[0])

print(*ans, sep='')
print()


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

if b % a == 0:
  print(a+b)
else:
  print(b-a)
Buggy python submission (verdict: Runtime Error):
n = int(input())
target = [int(input()) for _ in range(n)]

zero = target.count(0)

if zero == 0:
    print(0)
elif zero == 1:
    if len(target[:target.index(0)]) > len(target[target.index(0)+1:]):
        print(sum(target[target.index(0)+1:]))
    else:
        print(sum(target[:target.index(0)]))


Fixed submission:
# coding: utf-8
n, k = map(int, input().rstrip().split())

tmp = n%2
if tmp == 0:
    ok = int(n/2)
else:
    ok = int(n/2) + 1

if k <= ok:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
N = int(input())
N_10 = N
S_N = 0
for i in range(10):
  rem = N%10
  S_N += rem
  N_10 //= 10
  if N_10 == 0:
    break
print("Yes" if N%S_N == 0 else "No")


Fixed submission:
N = int(input())
N_10 = N
S_N = 0
for i in range(10):
  rem = N_10%10
  S_N += rem
  N_10 //= 10
  if N_10 == 0:
    break
if S_N == 0:
    answer = "No"
else:
    if N%S_N == 0:
        answer = "Yes"
    else:
        answer = "No"
print(answer)
Buggy python submission (verdict: Runtime Error):
N = int(input())
arare = list(map(int, input().rstrip().split()))
count = {"P": 0, "W": 0, "G": 0, "Y": 0}
for i in range(N):
  cur = arare[i]
  if cur == "P":
    count["P"] += 1
  elif cur == "W":
    count["W"] += 1
  elif cur == "G":
    count["G"] += 1
  else:
    count["Y"] += 1
print("Four" if count["Y"] >= 1 else "Three")

Fixed submission:
N = int(input())
arare = input().rstrip().split()
count = {"P": 0, "W": 0, "G": 0, "Y": 0}
for i in range(N):
  cur = arare[i]
  if cur == "P":
    count["P"] += 1
  elif cur == "W":
    count["W"] += 1
  elif cur == "G":
    count["G"] += 1
  else:
    count["Y"] += 1
print("Four" if count["Y"] >= 1 else "Three")
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().rstrip().split())

if a * b % 2 == 0:
  print("Even")
eles:
  print("Odd")

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

if a * b % 2 == 0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
N = int(input())
num = [int(input()) for i in range(N)]
num_set = set(tuple(num))
count = 0
for i in num_set:
    if num.count(i)%2 == 1:
        count += 1
print(count)

Fixed submission:
N = int(input())
A = {}
for i in range(N):
    a = input()
    A.setdefault(a, 0)
    A[a] = 1 - A[a]
print(sum(A.values()))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
num = tuple(int(input()) for i in range(N))
num_set = set(num)
count = 0
for i in num_set:
    if num.count(i)%2 == 1:
        count += 1
print(count)

Fixed submission:
N = int(input())
A = {}
for i in range(N):
    a = input()
    A.setdefault(a, 0)
    A[a] = 1 - A[a]
print(sum(A.values()))
Buggy python submission (verdict: Runtime Error):
A,B,C,D = map(int, input().rstrip().split())
print(max([A,B]) - min([C,D])

Fixed submission:
A,B,C,D = map(int, input().rstrip().split())
print(min([B, D]) - max([A,C]) if min([B, D]) - max([A,C]) > 0 else 0)
Buggy python submission (verdict: Runtime Error):
R = input()
print (R*6.28)

Fixed submission:
R = float(input())
print(R*6.28)

Buggy python submission (verdict: Runtime Error):
print ((R*6.28))

Fixed submission:
R = float(input())
print(R*6.28)

Buggy python submission (verdict: Runtime Error):
print (6.28*R)

Fixed submission:
R = float(input())
print(R*6.28)

Buggy python submission (verdict: Runtime Error):
print (2R*3.1419)

Fixed submission:
R = float(input())
print(R*6.28)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

# reduce(function, iterable, initializer)
def gcd(*number):
    return reduce(math.gcd, number)

def gcd_list(number):
    return reduce(math.gcd, number)

sum = 0
K = int(input())
for i in range(1,K+1):
    for j in range(1,K+1):
        tmp = gcd(i, j)
        for k in range(1,K+1):
            sum += gcd(tmp, k)

print(sum)


Fixed submission:
import math
from functools import reduce

# reduce(function, iterable, initializer)
def gcd(*number):
    return reduce(math.gcd, number)

def gcd_list(number):
    return reduce(math.gcd, number)

def main():
    sum = 0
    K = int(input())
    for i in range(1,K+1):
        for j in range(1,K+1):
            tmp = math.gcd(i, j)
            for k in range(1,K+1):
                sum += math.gcd(tmp, k)
    print(sum)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

# reduce(function, iterable, initializer)
def gcd(*number):
    return reduce(math.gcd, number)

def gcd_list(number):
    return reduce(math.gcd, number)

sum = 0
K = int(input()) + 1
for i in range(1,K):
    for j in range(1,K):
        for k in range(1,K):
            sum += gcd(i, j, k)
print(sum)

Fixed submission:
import math
from functools import reduce

# reduce(function, iterable, initializer)
def gcd(*number):
    return reduce(math.gcd, number)

def gcd_list(number):
    return reduce(math.gcd, number)

def main():
    sum = 0
    K = int(input())
    for i in range(1,K+1):
        for j in range(1,K+1):
            tmp = math.gcd(i, j)
            for k in range(1,K+1):
                sum += math.gcd(tmp, k)
    print(sum)

if __name__ == "__main__":
    main()