Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
ls = [1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, 128, 144, 169, 196, 216, 225, 243, 256, 289, 324, 343, 361, 400, 441, 484, 512, 529, 576, 625, 676, 729, 784, 841, 900, 961, 1000,1020]
X = int(input())
for i in range(len(ls)):
  if X<ls[i]:
    print(ls[i-1])
    break


Fixed submission:
a,b,c,d=map(int,input().split())
if abs(c-a)<=d:
  print("Yes")
elif abs(c-b)<=d and abs(b-a)<=d:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
k = 0
if d>=abs(a-c):
  print("Yes")
  k += 1
if d>=abs(a-b):
  if d>=abd(b-c):
    if k == 1:
      break
    else:
      print("Yes")
      k += 1
if k == 0:
  print("No")

Fixed submission:
a,b,c,d=map(int,input().split())
if abs(c-a)<=d:
  print("Yes")
elif abs(c-b)<=d and abs(b-a)<=d:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
l = 0
if abs(a-c)=<d:
  print("Yes")
  l += 1
if abs(a-b)=<d:
  if abs(b-c)=<d:
    if l == 0:
      print("Yes")
  else:
    print("No")
else:
  print("No")

Fixed submission:
a,b,c,d=map(int,input().split())
if abs(c-a)<=d:
  print("Yes")
elif abs(c-b)<=d and abs(b-a)<=d:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
if abs(a-b)=<d:
  if abs(b-c)=<d:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Fixed submission:
a,b,c,d=map(int,input().split())
if abs(c-a)<=d:
  print("Yes")
elif abs(c-b)<=d and abs(b-a)<=d:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
K = int(input())
L = max(A,B,C)
if L ==A:
print((A*(2**K))+B+C
elif L ==B:
print(A+(B*(2**K))+C)
else:
print(A+B+(C*(2**K)))

Fixed submission:
A,B,C = map(int,input().split())
K = int(input())
L = max(A,B,C)
if L == A:
  print((A*(2**K))+B+C)
elif L == B:
  print(A+(B*(2**K))+C)
else:
  print(A+B+(C*(2**K)))
Buggy python submission (verdict: Time Limit Exceeded):
a,b,K = map(int,input().split())
k = []
count = 1
if a<b:
    count_g = b-a+1
    for i in range(a,b+1):
        if count<=K or count_g<=K:
            k.append(i)
        count += 1
        count_g -= 1
else:
    count_g = a-b+1
    for i in range(b,a+1):
        if count<=K or count_g<=K:
            k.append(i)
        count += 1
        count_g -= 1
for i in range(len(k)):
    print(k[i])

Fixed submission:
A,B,K = map(int,input().split())
k = []
for i in range(A,A+K):
    if A<=i<=B:
        k.append(i)
for i in range(B-K+1,B+1):
    if A<=i<=B:
        k.append(i)
p = set(k)
q = list(p)
q.sort()
for i in range(len(q)):
    print(q[i])
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input().split()
K = set(S)
p = list(k)
if len(p) == 3:
  print("Three")
elif len(p) == 4:
  print("Four")

Fixed submission:
N = int(input())
S = input().split()
K = set(S)
p = list(K)
if len(p) == 3:
  print("Three")
elif len(p) == 4:
  print("Four")
Buggy python submission (verdict: Runtime Error):
if (a*b)%2 == 1:
  print("Odd")
else:
  print("Even")

Fixed submission:
a,b = map(int,input().split())
K = a*b
if K%2 == 0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 1
d = []
for i in range(N):
  d.append(int(input()))
sorted(d,reverse=True)
print(set(d))


Fixed submission:
S=str(input())
 
k=S.replace("2017","2018")
 
print(k)
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 1
d = []
for i in range(N):
  d.append(int(input()))
sorted(d,reverse=True)
for i in range(len(d)-1):
  if d[i] == d[i+1]:
    d.remove(d[i+1])
print(len(d))

Fixed submission:
N = int(input())
ans = 1
d = []
for i in range(N):
  d.append(int(input()))
sorted(d,reverse=True)
k = set(d)
K = list(k)
print(len(K))
Buggy python submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
ans = 0
for i in range(N):
  s = str(i)
  if 1<=i<=9:
    if A<=i<=B:
      ans += i
  elif 10<=i<=99:
    if A<=((int(s[0])+int(s[1])))<=B:
      ans += i
  elif 100<=i<=999:
    if A<=((int(s[0])+int(s[1])+int(s[2])))<=B:
      ans += i
  elif 1000<=i<=9999:
    if A<=((int(s[0])+int(s[1])+int(s[2])+int(s[3])))<=B:
      ans += i
  else:
    if A<=((int(s[0])+int(s[1])+int(s[2])+int(s[3])+int(s[4])))<=B:
      ans += i
print(ans)

Fixed submission:
N,A,B = map(int,input().split())
ans = 0
for i in range(1,N+1):
  K = str(i)
  if len(K) == 1:
    if A<=int(K[0])<=B:
      ans += i
  elif len(K) == 2:
    if A<=int(K[0])+int(K[1])<=B:
      ans += i
  elif len(K) == 3:
    if A<=int(K[0])+int(K[1])+int(K[2])<=B:
      ans += i
  elif len(K) == 4:
    if A<=int(K[0])+int(K[1])+int(K[2])+int(K[3])<=B:
      ans += i
  elif len(K) == 5:
    if A<=int(K[0])+int(K[1])+int(K[2])+int(K[3])+int(K[4])<=B:
      ans += i
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
k = [2,1]
if N == 1:
  print(1)
else:
  for i in range(N-1):
    S = k[i]+k[i+1]
    k.append(S)
print(S)

Fixed submission:
L = [2,1]
for i in range(100):
  L.append(L[i+1]+L[i])
n = int(input())
print(L[n])

Buggy python submission (verdict: Runtime Error):
N = int(input())
L_2 = 2
L_1 = 1
for i in range(N-1):
  K = L_1+L_2
  L_2 = L_1
  L_1 = K
print(K)


Fixed submission:
L = [2,1]
for i in range(100):
  L.append(L[i+1]+L[i])
n = int(input())
print(L[n])

Buggy python submission (verdict: Runtime Error):
N = int(input())
L_2 = 2
L_1 = 1
p = 0
for i in range(N-1):
  K = L_1+L_2
  L_2 = L_1
  L_1 = K
print(K)

Fixed submission:
L = [2,1]
for i in range(100):
  L.append(L[i+1]+L[i])
n = int(input())
print(L[n])

Buggy python submission (verdict: Runtime Error):
N = int(input())
L_2 = 2
L_1 = 1
p = 0
for i in range(2,N+1):
  K = L_1+L_2
  L_2 = L_1
  L_1 = K
print(K)

Fixed submission:
L = [2,1]
for i in range(100):
  L.append(L[i+1]+L[i])
n = int(input())
print(L[n])

Buggy python submission (verdict: Runtime Error):
N,M,C = map(int,input().split())
B = list(map(int,input().split()))
K = []
S = 0
ans = 0
J = []
for i in range(N):
  K.append(list(map(int,input().split())))
for i in range(N):
  for j in range(M):
    S += K[i][j]*B[j]
  S = S + C
  J.append(S)
for i in range(N):
  if J[i] >0:
    ans += 1
  else:
    ans += 0
print(ans)

Fixed submission:
L = [2,1]
for i in range(100):
  L.append(L[i+1]+L[i])
n = int(input())
print(L[n])

Buggy python submission (verdict: Runtime Error):
N = int(input())
L0 = 2
L1 = 1
for i in range(N-1):
  M = L0+L1
  L0 = L1
  L1 = M
print(M)

Fixed submission:
L = [2,1]
for i in range(100):
  L.append(L[i+1]+L[i])
n = int(input())
print(L[n])

Buggy python submission (verdict: Runtime Error):
N = int(input())
L0 = 2
L1 = 1
for i in range(N-1):
  M = L0+L1
  L0 = L1
  L1 = M
print(M)

Fixed submission:
L = [2,1]
for i in range(100):
  L.append(L[i+1]+L[i])
n = int(input())
print(L[n])
Buggy python submission (verdict: Runtime Error):
R = int(input())
G = int(input())
print(2*G-R)

Fixed submission:
C = str(input())
D = str(input())
if C[0] == D[2] and C[1] == D[1] and C[2] == D[0]:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
R = int(input())
G = int(input())
print(2*G-R)

Fixed submission:
C = str(input())
D = str(input())
if C[0] == D[2] and C[1] == D[1] and C[2] == D[0]:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
import bisect
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
sum = 0
for i in range(0,N):
  a = A[i]
  for j in range(1,N):
    b = B[j]
    c_min = b-a+1
    c_max = a+b-1
    l = bisect.bisect_left(C,c_min,lo = j+1)
    if l! = N:
      r = bisect.bisect_right(C,c_max,lo = j+1)
      if r:
        r = r-1
        if r >= l:
          sum += r-l+1
print(sum)

Fixed submission:
import bisect
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
ans = 0
A.sort()
C.sort()
for i in B:
    x = bisect.bisect_left(A,i)
    y = N-bisect.bisect_right(C,i)
    ans += x*y
print(ans)
Buggy python submission (verdict: Runtime Error):
h,w = map(int,input().split())
ls = []
side = [[-1,-1],[-1,0],[-1,1],[0,-1],[0,1],[1,-1],[1,0],[1,1]]
for i in range(h):
  ls.append(list(input()))
for i in range(h):
  ans2 = ""
  for j in range(w):
    ans = 0
    if ls[i][j] == "#":
      ans2 += "#"
    else:
      for k in range(8):
        if i+side[k][0] < 0 or j+side[k][1] < 0 or h <=i+side[k][0] or w <= j+side[k][1]:
          continue
        else:
          ans += (1 if ls[i+side[k][0]][j+side[k][1]] == "#" else 0)
      ans2 += str(ans)
  print(ans2)


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

if A-B == A-C:
  print(A)
elif B-A == B-C:
  print(B)
else:
  print(C)

Buggy python submission (verdict: Runtime Error):
h,w = map(int,input().split())
ls = []
side = [[-1,-1],[-1,0],[-1,1],[0,-1],[0,1],[1,-1],[1,0],[1,1]]
for i in range(h):
  ls.append(list(input()))
for i in range(h):
  ans2 = ""
  for j in range(w):
    ans = 0
    if ls[i][j] == "#":
      ans2 += "#"
    else:
      for k in range(8):
        if i+side[k][0] < 0 or j+side[k][1] < 0 or h <=i+side[k][0] or w <= j+side[k][1]:
          continue
        else:
          ans += (1 if ls[i+side[k][0]][j+side[k][1]] == "#" else 0)
      ans2 += str(ans)
  print(ans2)


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

if A-B == A-C:
  print(A)
elif B-A == B-C:
  print(B)
else:
  print(C)

Buggy python submission (verdict: Runtime Error):
h,w = map(int,input().split())
ls = []
side = [[-1,-1],[-1,0],[-1,1],[0,-1],[0,1],[1,-1],[1,0],[1,1]]
for i in range(h):
  ls.append(list(input()))
for i in range(h):
  ans2 = ""
  for j in range(w):
    ans = 0
    if ls[i][j] == "#":
      ans2 += "#"
    else:
      for k in range(8):
        if i+side[k][0] < 0 or j+side[k][1] < 0 or h <=i+side[k][0] or w <= j+side[k][1]:
          continue
        else:
          ans += (1 if ls[i+side[k][0]][j+side[k][1]] == "#" else 0)
      ans2 += str(ans)
  print(ans2)


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

if A-B == A-C:
  print(A)
elif B-A == B-C:
  print(B)
else:
  print(C)
Buggy python submission (verdict: Runtime Error):
from itertools import permutations
N,M,R = map(int,input().split())
r = list(map(int,input().split()))
for i in range(R):
  r[i] -= 1
g = [[10 ** 8] * N for i in range(N)]
for i in range(M):
  A,B,C = map(int,input().split())
  A -= 1 
  B -= 1
  g[A][B] = C
  g[B][A] = C
def warchall_floyd(n):
  for i in range(n):
    #経由する頂点
    for j in range(n):
      #始点
      for k in range(n):
        #終点
        g[j][k] = min(g[j][k],g[j][i]+g[i][k])
        
warchall_floyd(N)
ans = float('inf')
for i in permutations(r):
  now = 0
  for j in range(R-1):
    now += g[i[j]][i[j+1]]
  if now < ans:
    ans = now
print(ans)


Fixed submission:
N = str(input())
if N[0] =="9":
  print("Yes")
elif N[1] == "9":
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
k = []
for i in range(N):
  A = input()
  if A in k:
    k.remove(A)
  else:
    k.append(A)
print(len(k))


Fixed submission:
import collections
N = int(input())
ans = 0
now = 0
k = []
for i in range(N):
  A = int(input())
  k.append(A)
p = collections.Counter(k)
for i in p:
  if p[i]%2 == 1:
    ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
k = []
for i in range(N):
  A = input()
  if A in k:
    k.remove(A)
  else:
    k.append(A)
print(len(k))


Fixed submission:
import collections
N = int(input())
ans = 0
now = 0
k = []
for i in range(N):
  A = int(input())
  k.append(A)
p = collections.Counter(k)
for i in p:
  if p[i]%2 == 1:
    ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
k = []
for i in range(N):
  A = input()
  if A in k:
    k.remove(A)
  else:
    k.append(A)
print(len(k))

Fixed submission:
import collections
N = int(input())
ans = 0
now = 0
k = []
for i in range(N):
  A = int(input())
  k.append(A)
p = collections.Counter(k)
for i in p:
  if p[i]%2 == 1:
    ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import permutations
N,M,R = map(int,input().split())
r = list(map(int,input().split()))
for i in range(R):
  r[i] -= 1
g = [[10 ** 8] * N for i in range(N)]
for i in range(M):
  A,B,C = map(int,input().split())
  A -= 1 
  B -= 1
  g[A][B] = C
  g[B][A] = C
def warchall_floyd(n):
  for i in range(n):
    #経由する頂点
    for j in range(n):
      #始点
      for k in range(n):
        #終点
        g[j][k] = min(g[j][k],g[j][i]+g[i][k])
        
warchall_floyd(N)
ans = float('inf')
for i in permutations(r):
  now = 0
  for j in range(R-1):
    now += g[i[j]][i[j+1]]
  if now < ans:
    ans = now
print(ans)

Fixed submission:
from itertools import permutations
N,M,R = map(int,input().split())
r = list(map(int,input().split()))
for i in range(R):
  r[i] -= 1
g = [[10 ** 8] * N for i in range(N)]
for i in range(M):
  A,B,C = map(int,input().split())
  A -= 1 
  B -= 1
  g[A][B] = C
  g[B][A] = C
def warchall_floyd(n):
  for i in range(n):
    #経由する頂点
    for j in range(n):
      #始点
      for k in range(n):
        #終点
        g[j][k] = min(g[j][k],g[j][i]+g[i][k])
        
warchall_floyd(N)
ans = float('inf')
for i in permutations(r):
  now = 0
  for j in range(R-1):
    now += g[i[j]][i[j+1]]
  if now < ans:
    ans = now
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
k = []
ans = []
alphabet = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
for i in range(len(S)):
  k.append(S[i])
k = sorted(k)
for i in range(26):
  if k[i] not in alphabet:
    ans.append(k[i])
print(ans[0])


Fixed submission:
S = input()
ls= ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
ls2=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
for i in range(len(S)):
  for j in range(len(ls)):
    if S[i] == ls[j]:
      if ls[j] in ls2:
        ls2.remove(ls[j])
      break
if len(ls2) == 0:
  print("None")
else:
  print(ls2[0])
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
ruiseki = [0]*(N+1)
total = 0
now = 10**9+7
sa = 0
now_2 = 0
for i in range(N):
  total += A[i]
  ruiseki[i+1] = total
for i in range(1,len(ruiseki)-1):
  snuke = ruiseki[i]-ruiseki[0]
  arai = ruiseki[N]-ruiseki[i]
  now_2 = abs(snuke-arai)
  now = min(now,now_2)
print(now)


Fixed submission:
A,B = map(int,input().split())
if A%3 == 0:
  print("Possible")
elif B%3 == 0:
  print("Possible")
elif (A+B)%3 == 0:
  print("Possible")
else:
  print("Impossible")

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
l = list(map(int,input().split()))
ans = 0
sorted(l)
for i in range(K):
  ans += l[n-i-1]
print(ans)

Fixed submission:
A,B = map(int,input().split())
if A%3 == 0:
  print("Possible")
elif B%3 == 0:
  print("Possible")
elif (A+B)%3 == 0:
  print("Possible")
else:
  print("Impossible")

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
l = list(map(int,input().split()))
ans = 0
sorted(l)
for i in range(K):
  ans += l[n-i+1]
print(ans)

Fixed submission:
A,B = map(int,input().split())
if A%3 == 0:
  print("Possible")
elif B%3 == 0:
  print("Possible")
elif (A+B)%3 == 0:
  print("Possible")
else:
  print("Impossible")

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
l = list(map(int,input().split()))
ans = 0
l.sort()
for i in range(K):
  ans += l[i]
print(ans)

Fixed submission:
A,B = map(int,input().split())
if A%3 == 0:
  print("Possible")
elif B%3 == 0:
  print("Possible")
elif (A+B)%3 == 0:
  print("Possible")
else:
  print("Impossible")
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
l = list(map(int,input().split()))
ans = 0
l.sorted()
for i in range(K):
  ans += l[i]
print(ans)

Fixed submission:
N,K = map(int,input().split())
L = list(map(int,input().split()))
L.sort()
ans = 0
for i in range(K):
  ans += L[-(i+1)]
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
Ma = max(A)
Mi = min(A)
print(Ma-Mi)

Fixed submission:
S = input()
K =[]
for i in range(len(S)):
  if S[i] in K:
    print("no")
    break
  else:
    K.append(S[i])
  if i == len(S)-1:
    print("yes")
Buggy python submission (verdict: Runtime Error):
i = list(map(int,input().split()))
A_list[1,3,5,7,8,10,12]
B_list[4,6,9,11]
C_list[2]
if i[0] in A_list and i[1] in A_list:
  print("Yes")
if i[0] in B_list and i[1] in B_list:
  print("Yes")
if i[0] in C_list and i[1] in C_list:
  print("Yes")
else:
  print("No")

Fixed submission:
i = list(map(int, input().split()))
 
A_list = [1, 3, 5, 7, 8, 10, 12]
B_list = [4, 6, 9, 11]
C_list = [2]
 
if i[0] in A_list and i[1] in A_list:
    print("Yes")
elif i[0] in B_list and i[1] in B_list:
    print("Yes")
elif i[0] in C_list and i[1] in C_list:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
x = list(map(int,input().split()))
A_list[1,3,5,7,8,10,12]
B_list[4,6,9,11]
C_list[2]
if i[0] in A_list and i[1] in A_list:
  print("Yes")
if i[0] in B_list and i[1] in B_list:
  print("Yes")
if i[0] in C_list and i[1] in C_list:
  print("Yes")
else:
  print("No")

Fixed submission:
i = list(map(int, input().split()))
 
A_list = [1, 3, 5, 7, 8, 10, 12]
B_list = [4, 6, 9, 11]
C_list = [2]
 
if i[0] in A_list and i[1] in A_list:
    print("Yes")
elif i[0] in B_list and i[1] in B_list:
    print("Yes")
elif i[0] in C_list and i[1] in C_list:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
A,B,C = map(int,input(),split())
if C>=A and C<=B:
  print("Yes")
else:
  print("No")

Fixed submission:
a,b,c = map(int,input().split())
if c>=a:
  if b>=c:
    print("Yes")
  else:
    print("No")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
N,T = map(int,input().split())
t = list(map(int,input().split()))
sum = 0
for i in range(N-1):
  sum += (T,t[i+1]-t[i])
print(sum)

Fixed submission:
N,T = map(int,input().split())
t = list(map(int,input().split()))
sum = 0
for i in range(N-1):
  sum += min(T,(t[i+1]-t[i]))
print(sum+T)

Buggy python submission (verdict: Runtime Error):
N,T = map(int,input().split())
t = list(map(int,input().split()))
sum = 0
sum += t[0]
for i in range(N-1):
  sum += (T,t[i+1]-t[i])
print(sum)
      

Fixed submission:
N,T = map(int,input().split())
t = list(map(int,input().split()))
sum = 0
for i in range(N-1):
  sum += min(T,(t[i+1]-t[i]))
print(sum+T)
Buggy python submission (verdict: Runtime Error):
a,b = map(str,input().split())
num = 0
if a == "D"
  num = num + 1
if b == "D"
  num = num + 1
if num%2 == 0:
  print("H")
else:
  print("D")

Fixed submission:
a,b = map(str,input().split())
num = 0
if a == "D":
  num = num + 1
if b == "D":
  num = num + 1
if num%2 == 0:
  print("H")
else:
  print("D")
Buggy python submission (verdict: Runtime Error):
N = int(input())
print(N*500-200*(N//15)

Fixed submission:
N = int(input())
K = N//15
print(800*N-200*K)

Buggy python submission (verdict: Runtime Error):
N = int(input())
print(N*500-200*(N//15)

Fixed submission:
N = int(input())
K = N//15
print(800*N-200*K)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
K = []
ans = 0
for i in range(S):
  if S[i] == "I":
    ans += 1
    K.append(ans)
  else:
    ans -= 1
    K.append(ans)
print(max(K))

Fixed submission:
N = int(input())
S = input()
K = []
ans = 0
K.append(0)
for i in range(N):
  if S[i] == "I":
    ans += 1
    K.append(ans)
  else:
    ans -= 1
    K.append(ans)
print(max(K))
Buggy python submission (verdict: Runtime Error):
import math
def factorization(n):
    i = 2
    factors = []
    while i <= math.floor(math.sqrt(n)):
        print(i,n)
        if n%i == 0:
            factors.append(i)
            n //= i
        else:
            i += 1
    if n > 1:
        factors.append(n)
    return factors
N = int(input())
S = math.factorial(N)
print(S)
print(factorization(S))

Fixed submission:
import math
def factorization(n):
    i = 2
    factors = []
    while i <= math.floor(n**0.5):
        if n%i == 0:
            factors.append(i)
            n //= i
        else:
            i += 1
    if n>1:
        factors.append(n)
    return factors
#約数列挙
N = int(input())
ls = []
if N == 1:
    print(1)
else:
    for i in range(1,N+1):
        ls.extend(factorization(i))
    ls.sort()
    ans = 1
    now = 1
    now_2 = 0
    for i in range(len(ls)):
        if i == 0:
            now_2 = ls[i]
        else:
            if ls[i] == now_2:
                now += 1
            else:
                ans *= (now+1)
                now = 1
                now_2 = ls[i]
    ans *= (now+1)
    print(ans%(10**9+7))

Buggy python submission (verdict: Runtime Error):
def factorization(n):
    i = 2
    factors = []
    while i <= math.floor(n**0.5):
        if n%i == 0:
            factors.append(i)
            n //= i
        else:
            i += 1
    if n>1:
        factors.append(n)
    return factors
#約数列挙
N = int(input())
ls = []
for i in range(1,N+1):
    ls.extend(factorization(i))
ls.sort()
ans = 1
now = 1
now_2 = 0
for i in range(len(ls)):
    if i == 0:
        now_2 = ls[i]
    else:
        if ls[i] == now_2:
            now += 1
        else:
            ans *= (now+1)
            now = 1
            now_2 = ls[i]
ans *= (now+1)
print(ans%(10**9+7))

Fixed submission:
import math
def factorization(n):
    i = 2
    factors = []
    while i <= math.floor(n**0.5):
        if n%i == 0:
            factors.append(i)
            n //= i
        else:
            i += 1
    if n>1:
        factors.append(n)
    return factors
#約数列挙
N = int(input())
ls = []
if N == 1:
    print(1)
else:
    for i in range(1,N+1):
        ls.extend(factorization(i))
    ls.sort()
    ans = 1
    now = 1
    now_2 = 0
    for i in range(len(ls)):
        if i == 0:
            now_2 = ls[i]
        else:
            if ls[i] == now_2:
                now += 1
            else:
                ans *= (now+1)
                now = 1
                now_2 = ls[i]
    ans *= (now+1)
    print(ans%(10**9+7))
Buggy python submission (verdict: Runtime Error):
s = input()
s[5] = " "
s[:5] = " "
print(s)

Fixed submission:
s = input()
k = []
ans = ""
for i in range(19):
  k.append(s[i])
for i in range(19):
  if k[i] == ",":
    k[i] = " "
  ans += k[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
K,S = map(int,input().split())
ans = 0
for i in range(0,K+1):
    for j in range(0,K+1):
        for _ in range(0,K+1):
            if i+j+_ == S:
                ans += 1
print(ans)

Fixed submission:
K,S = map(int,input().split())
ans = 0
for i in range(0,K+1):
    for j in range(0,K+1):
        z = S-i-j
        if 0<=z<=K:
            ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
A = input().split()
print({}{}{}.format(A[0],A[1][0],A[2])

Fixed submission:
A = input().split()
print("{}{}{}".format(A[0][0],A[1][0],A[2][0]))
Buggy python submission (verdict: Runtime Error):
w,h,n = map(int,input().split())
x_min = 0
y_min = 0
x_max = w
y_max = h
for i in range(n):
  x,y,a = map(int,input().split())
  if a == 1:
    if x_min < x:
      x_min = x
  elif a == 2:
    if x_max > x:
      x_max = x
  elif a == 3:
    if y_min < y:
      y_min = y
  elif a == 4:
    if y_max > y:
      y_max = y
S = (x_max-x_min)*(y_max-y_min)
if S < 0:
  print(0)
else:
  print(S)


Fixed submission:
a,b,c = map(int,input().split())
if a+b == c or a+c == b or b+c == a:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
S = input()
K = "CODEFESTIVAL2016"
sum = 0
for i in range(len(S)):
  if S[i] != K[i]
  sum += 1
print(sum)

Fixed submission:
S = input()
K = "CODEFESTIVAL2016"
sum = 0
for i in range(len(S)):
  if S[i] != K[i]:
    sum += 1
print(sum)