Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = input()
A = input()
B = input()
if (B-A)%2==1:
  	print(A)
else:
    print((B-A)//2)


Fixed submission:
x=[]
N,A,B=map(int,input().split())
if (B-A)%2==0:
    print((B-A)//2)
else:
    c=(A-1)+(B-A+1)//2
    d=(N-B)+(B-A+1)//2
    print(min(c,d))
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int, input().split())
A_list = list(map(int, input().split()))



for i in range(N-K+1):
  i = i+K
  sum_list = A_list[i-K:i]
  after = sum(sum_list)
  if(i!=K):
    if(before<after):
      print("Yes")
    else:
      print("No")
  before = after

Fixed submission:
N,K = map(int, input().split())
A_list = list(map(int, input().split()))

for i in range(N-K):
  #print(i,K+i)
  #print(A_list[i],A_list[K+i])
  if(A_list[i]<A_list[K+i]):
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Runtime Error):
#文字列の入力
S_list = list(input())

#最後の文字はD
if(S_list[len(S_list)-1] == "?"):
  S_list[len(S_list)-1] = "D"
  print("1",S_list)

for i in range(len(S_list)-1):
  if(S_list[i] == "?"):
    if(S_list[i+1] == "D"):
      S_list[i] = "P"
      print("2",S_list)
    elif(S_list[i+1] == "?"):
      S_list[i] = "D"
      S_list[i+1] = "D"
      print("3",S_list)
    else:
      S_list[i] = "D"
      print("4",S_list)

print(*S_list, sep="")



Fixed submission:
#文字列の入力
S_list = list(input())

for i in range(len(S_list)):
  if(S_list[i] == "?"):
    S_list[i] = "D"
      
print(*S_list, sep="")
Buggy python submission (verdict: Time Limit Exceeded):
A, B,C,K = map(int, input().split())
ans = 0
for i in range(K):
  if(i+1<=A):
    ans = ans + 1
  elif(i+1<=A+B):
    ans = ans +0
  elif(i+1<=A+B+C):
     ans = ans -1
  #print(ans)
        
        


print(ans)

Fixed submission:
A, B,C,K = map(int, input().split())
if(K<A):
  print(K)
elif(K>A+B):
  print(A - (K-A-B))
else:
  print(A)

Buggy python submission (verdict: Runtime Error):
A, B,C,K = map(int, input().split())
K_list = [0]*K

for i in range(K):
  if(i+1<=A):
    K_list[i] = 1
  elif(i+1<=A+B):
     K_list[i] = 0
  elif(i+1<=A+B+C):
     K_list[i] = -1
  
        
        


sun = sum(K_list)
print(sun)

Fixed submission:
A, B,C,K = map(int, input().split())
if(K<A):
  print(K)
elif(K>A+B):
  print(A - (K-A-B))
else:
  print(A)

Buggy python submission (verdict: Time Limit Exceeded):
A, B,C,K = map(int, input().split())

ans = 0

for i in range(A):
  if(K>0):
    ans = ans + 1
    K = K-1
for i in range(B):
  if(K>0):
    ans = ans 
    K = K-1
for i in range(C):
  if(K>0):
    ans = ans - 1
    K = K-1
print(ans)

Fixed submission:
A, B,C,K = map(int, input().split())
if(K<A):
  print(K)
elif(K>A+B):
  print(A - (K-A-B))
else:
  print(A)
Buggy python submission (verdict: Runtime Error):
#整数の入力
N,K = int(input())

d_list = []
A_list_list = []
for i in range(K):
  #整数の入力
  d = int(input())
  d_list.append(d)
  #スペース区切りの整数の入力リスト
  A_list = list(map(int, input().split()))
  A_list_list.append(A_list)
  
counter = 0
for i in range(N):
  if((i+1 in A_list) ==True):
    counter = counter
  else:
    counter = counter + 1
print(counter)
  


Fixed submission:
#整数の入力
N,K = map(int, input().split())

d_list = []
A_list_list = []
for i in range(K):
  #整数の入力
  d = int(input())
  d_list.append(d)
  #スペース区切りの整数の入力リスト
  A_list = list(map(int, input().split()))
  #print(A_list)
  A_list_list.extend(A_list)
#print(A_list)
counter = 0
for i in range(N):
  if((i+1 in A_list_list) ==True):
    counter = counter
  else:
    counter = counter + 1
print(counter)
Buggy python submission (verdict: Runtime Error):
#スペース区切りの整数の入力
tairyoku_A, kougeki_B,tairyoku_C,kougeki_D = map(int, input().split())

one = int(tairyoku_A /kougeki_D)
two = int(tairyoku_C /kougeki_B)


if(one>two):
  print("Yes")
elif:
  print("No")
else:
  print("Yes")

Fixed submission:
#スペース区切りの整数の入力
A, B,C,D = map(int, input().split())

ans_a = A
ans_c = C
count_a = 0
count_c = 0

while(ans_a>0):
  ans_a = ans_a - D
  count_a = count_a +1
  #print(count_a,":",ans_a)

while(ans_c>0):
  ans_c = ans_c - B
  count_c = count_c +1
  #print(count_c,":",ans_c)
  
if(count_a>=count_c):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
#スペース区切りの整数の入力
N,M = map(int, input().split())
#スペース区切りの整数の入力リスト
A_list = list(map(int, input().split()))

sum_ = 0
for i in range(len(A_list)):
  sum_ = sum + A_list[i]
  
ans = N - sum_

print(ans)

Fixed submission:
#スペース区切りの整数の入力
N,M = map(int, input().split())
#スペース区切りの整数の入力リスト
A_list = list(map(int, input().split()))

sum_ = 0
for i in range(len(A_list)):
  sum_ = sum_ + A_list[i]
  
  
ans = N - sum_
if(ans>=0):
  print(ans)
else:
  print("-1")
Buggy python submission (verdict: Time Limit Exceeded):
#整数の入力
N = int(input())
#スペース区切りの整数の入力リスト
A_list = list(map(int, input().split()))

ans = 0
for i in range(N):
  ans = A_list.count(i+1)
  print(ans)


Fixed submission:
#整数の入力
N = int(input())
#スペース区切りの整数の入力リスト
A_list = list(map(int, input().split()))

ans = 0
  
  
ans_list = [0]*N
  
for i in range(len(A_list)):
  #ans = A_list.count(i+1)
  ans_list[A_list[i]-1]+=1


for i in range(len(ans_list)):
  print(ans_list[i])

Buggy python submission (verdict: Time Limit Exceeded):
#整数の入力
N = int(input())
#スペース区切りの整数の入力リスト
A_list = list(map(int, input().split()))

ans = 0
for i in range(len(A_list)+1):
  ans = A_list.count(i+1)
  print(ans)

Fixed submission:
#整数の入力
N = int(input())
#スペース区切りの整数の入力リスト
A_list = list(map(int, input().split()))

ans = 0
  
  
ans_list = [0]*N
  
for i in range(len(A_list)):
  #ans = A_list.count(i+1)
  ans_list[A_list[i]-1]+=1


for i in range(len(ans_list)):
  print(ans_list[i])

Buggy python submission (verdict: Runtime Error):
#整数の入力
N = int(input())
#スペース区切りの整数の入力リスト
A_list = list(map(int, input().split()))

ans = 0
for i in range(len(A_list)):
  ans = A _list.count(i+1)
  print(ans)

Fixed submission:
#整数の入力
N = int(input())
#スペース区切りの整数の入力リスト
A_list = list(map(int, input().split()))

ans = 0
  
  
ans_list = [0]*N
  
for i in range(len(A_list)):
  #ans = A_list.count(i+1)
  ans_list[A_list[i]-1]+=1


for i in range(len(ans_list)):
  print(ans_list[i])
Buggy python submission (verdict: Runtime Error):
#複数の入力
input_list = input().split( )
input_list = input_list.sort()
print(input_list[0],input_list[1],input_list[2])


Fixed submission:
#複数の入力
input_list = input().split( )
print(input_list[2],input_list[0],input_list[1])

Buggy python submission (verdict: Runtime Error):
#複数の入力
input_list = input().split( )
input_list = input_list.sort
print(input_list[0],input_list[1],input_list[2])

Fixed submission:
#複数の入力
input_list = input().split( )
print(input_list[2],input_list[0],input_list[1])
Buggy python submission (verdict: Runtime Error):
#スペース区切りの整数の入力
N, K = map(int, input().split())
print(min(N%K),K-N%K)

Fixed submission:
#スペース区切りの整数の入力
N, K = map(int, input().split())
if(N%K<K-N%K):
    print(N%K)
else:
    print(K-N%K)

Buggy python submission (verdict: Runtime Error):
#スペース区切りの整数の入力
N, K = map(int, input().split())

aa = int(N/K)
ans = N - K*aa
ans_2 = ans - K

if(N<K):
  print(N)
elif(N%K == 0):
  print("0")
elif(ans<ans_2)
  print(ans)
else:
  print(ans_2)

Fixed submission:
#スペース区切りの整数の入力
N, K = map(int, input().split())
if(N%K<K-N%K):
    print(N%K)
else:
    print(K-N%K)
Buggy python submission (verdict: Runtime Error):
#スペース区切りの整数の入力
A, B, C = map(int, input().split())

A = float(A)
B = float(B)
C = float(C)


A_sq = pow(A, 0.5)
B_sq = pow(B, 0.5)
C_sq = pow(C, 0.5)

if(A_sq+B_sq < C_sq):
  print("Yes")
else:
  print("No")




Fixed submission:
#整数の入力
A = int(input())

list_a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(list_a[A-1])
Buggy python submission (verdict: Runtime Error):
#文字列の入力
S = input()

#listを一文字ずつのlistに
list_S = list(S)

AorB = S_list[0]
counter = 0
for i in range(len(S_list)):
  if(AorB == S_list[i]):
    counter =+ 1

if(counter == len(S_list)):
  print("No")
else:
  print("Yes")

Fixed submission:
#文字列の入力
S = input()
 
#listを一文字ずつのlistに
S_list = list(S)
 
AorB = S_list[0]
counter = 0
for i in range(len(S_list)):
  if(AorB == S_list[i]):
    counter = counter + 1
 
if(counter == len(S_list)):
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 0

if(N%2 == 0):
  ans = N/2
else:
  ans = math.floor(N/2) + 1
  
print(ans)


Fixed submission:
N = int(input())
ans = 0

if(N%2 == 0):
  ans = N/2
else:
  ans = N/2 + 0.5
  
ans = int(ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 0
if(N%2 == 0):
  ans = n/2
else:
  ans = n/2 + 1
print(ans)

Fixed submission:
N = int(input())
ans = 0

if(N%2 == 0):
  ans = N/2
else:
  ans = N/2 + 0.5
  
ans = int(ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
N, R = map(int, input().split())
ans = 0

if(N>=10):
  ans = R
else:
  ans = R + 100*(10−N)

print(ans)


Fixed submission:
N, R = map(int, input().split())
ans = 0

if(N>=10):
  ans = R
else:
  ans = R + 100*(10 - N)

print(ans)

Buggy python submission (verdict: Runtime Error):
N, R = map(int, input().split())
ans = 0

if(N>=10):
  ans = R
else:
  ans = R + 100*(10−K)

print(ans)


Fixed submission:
N, R = map(int, input().split())
ans = 0

if(N>=10):
  ans = R
else:
  ans = R + 100*(10 - N)

print(ans)

Buggy python submission (verdict: Runtime Error):
N, R = map(int, input().split())
ans = 0

if(N>=10):
  ans = R
else:
  ans = R + 100×(10−K)

print(ans)


Fixed submission:
N, R = map(int, input().split())
ans = 0

if(N>=10):
  ans = R
else:
  ans = R + 100*(10 - N)

print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())

ans = 0

while(n_k > 1):
  n_k = N/K
  ans += 1
  
  
print(ans)

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

ans = 0

while(N >= 1):
    N= N/K
    ans += 1
  
  
print(ans)
Buggy python submission (verdict: Runtime Error):
#整数の入力
N = int(input())

#複数の入力
input_list = input().split( )

for i in range(N):
  if(input_list[i]%2==0):
    if((input_list[i]%3==0)or(input_list[i]%5==0)):
      counter = counter + 1
if(counter == N):
  print("APPROVED")
else:
  print("DENIED")

Fixed submission:
#整数の入力
N = int(input())

#複数の入力
input_list = input().split( )

counter = 0

for i in range(N):
  if(int(input_list[i])%2==0):
    if((int(input_list[i])%3==0)or(int(input_list[i])%5==0)):
      counter = counter + 1
  else:
    counter = counter + 1
if(counter == N):
  print("APPROVED")
else:
  print("DENIED")
Buggy python submission (verdict: Runtime Error):
S, T = map(input().split())
A, B = map(int, input().split())
U = input()
ans = 0

if(S == U):
  ans = A - 1
  print(ans,B)
else:
  ans = B - 1
  print(A,ans)

Fixed submission:
S, T = map(str,input().split())
A, B = map(int, input().split())
U = input()
ans = 0

if(S == U):
  ans = A - 1
  print(ans,B)
else:
  ans = B - 1
  print(A,ans)

Buggy python submission (verdict: Runtime Error):
S, T = map(input().split())
A, B = map(int, input().split())
U = input()
ans = 0

if(S == U):
  ans = A - 1
  print(ans,B)
else:
  ans = B - 1
  print(A,ans)

Fixed submission:
S, T = map(str,input().split())
A, B = map(int, input().split())
U = input()
ans = 0

if(S == U):
  ans = A - 1
  print(ans,B)
else:
  ans = B - 1
  print(A,ans)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
input_list = input().split( )

for i in (range(len(input_list))):
  input_list[i] = int(input_list)

input_sum = sum(input_list)

if(A <= input_sum):
  print("Yes")
else:
  print("No")


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

for i in (range(len(input_list))):
  input_list[i] = int(input_list[i])

input_sum = sum(input_list)

if(A <= input_sum):
  print("Yes")
else:
  print("No")

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

for i in (range(input_list)):
  input_list[i] = int(input_list)

input_sum = sum(input_list)

if(A <= input_sum):
  print("Yes")
else:
  print("No")


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

for i in (range(len(input_list))):
  input_list[i] = int(input_list[i])

input_sum = sum(input_list)

if(A <= input_sum):
  print("Yes")
else:
  print("No")

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

input_sum = sum(input_list)

if(A <= input_sum):
  print("Yes")
else:
  print("No")

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

for i in (range(len(input_list))):
  input_list[i] = int(input_list[i])

input_sum = sum(input_list)

if(A <= input_sum):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
#スペース区切りの整数の入力
A, B = map(int, input().split())

ans = ""
if(A>B):
  for i in range(A):
    ans = ans + B
else:
  for i in range(B):
    ans = ans + A
    
    
    
print(ans)

Fixed submission:
#スペース区切りの整数の入力
A, B = map(int, input().split())

ans = ""
if(A>B):
  for i in range(A):
    ans = ans + str(B)
else:
  for i in range(B):
    ans = ans + str(A)
    
    
    
print(ans)
Buggy python submission (verdict: Runtime Error):
C = input()
print chr(ord(C) + 1)

Fixed submission:
C = input()
print(chr(ord(C) + 1))
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()

ans = 0
str_list = list(S)

for i in range (len(str_list)-2):
  if(str_list[i] == "A"):
    ans = ans
    if(str_list[i+1] == "B"):
      ans = ans
      if(str[i+2] == "C"):
        ans += 1

print(ans)


Fixed submission:
N = int(input())
S = input()

ans = 0
str_list = list(S)

for i in range (len(str_list)-2):
  if(str_list[i] == "A"):
    if(str_list[i+1] == "B"):
      if(str_list[i+2] == "C"):
        ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()

ans = 0
str_list = list(S)

for i in range (len(str_list)-2):
  if(str_list[i] == "A"):
    pass
    if(str_list[i+1] == "B"):
      pass
      if(str[i+2] == "C"):
        ans += 1

print(ans)

Fixed submission:
N = int(input())
S = input()

ans = 0
str_list = list(S)

for i in range (len(str_list)-2):
  if(str_list[i] == "A"):
    if(str_list[i+1] == "B"):
      if(str_list[i+2] == "C"):
        ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()

ans = 0
str_list = list(S)

for i in range (len(str_list)-2):
  if(str_list[i] == "A"):
    if(str_list[i+1] == "B"):
      if(str[i+2] == "C"):
        ans += 1

print(ans)

Fixed submission:
N = int(input())
S = input()

ans = 0
str_list = list(S)

for i in range (len(str_list)-2):
  if(str_list[i] == "A"):
    if(str_list[i+1] == "B"):
      if(str_list[i+2] == "C"):
        ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
N, S = map(str, input().split())
N = int(N)

ans = 0
str_list = list(S)

for i in range (len(str_list)-2):
  if(str_list[i] == "A"):
    if(str_list[i+1] == "B"):
      if(str[i+2] == "C"):
        ans += 1

print(ans)

Fixed submission:
N = int(input())
S = input()

ans = 0
str_list = list(S)

for i in range (len(str_list)-2):
  if(str_list[i] == "A"):
    if(str_list[i+1] == "B"):
      if(str_list[i+2] == "C"):
        ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
N, S = map(str, input().split())
N = int(N)

ans = 0
str_list = list(S)

for i in range (len(str_list)-2):
  if(str_list[i] == A):
    if(str_list[i+1] == B):
      if(str[i+2] == C):
        ans += 1

print(ans)

Fixed submission:
N = int(input())
S = input()

ans = 0
str_list = list(S)

for i in range (len(str_list)-2):
  if(str_list[i] == "A"):
    if(str_list[i+1] == "B"):
      if(str_list[i+2] == "C"):
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
#文字列の入力
S = input()

#listを一文字ずつのlistに
S_list = list(S)

if(len(S_list)%2==0):
  for i in range(len(S_list)/2):
    if(S_list[i]==S_list[len(S_list)-1]):
      ans = ans + 0
    else:
      ans = ans + 1
  for i in range(len(S_list)/2 + 1):
    if(S_list[i]==S_list[len(S_list)-1]):
      ans = ans + 0
    else:
      ans = ans + 1
print(ans)

Fixed submission:
#文字列の入力
S = input()

#listを一文字ずつのlistに
S_list = list(S)
ans = 0
#偶数文字の場合
if(len(S_list)%2==0):
  #文字数/2回for文
  for i in range(int(len(S_list)/2)):
    #i文字目と後ろからi文字目が一緒なら何もしない
    #print(i,len(S_list)-i-1)
    if(S_list[i]==S_list[len(S_list)-i-1]):
      ans = ans + 0
    #一緒じゃ無い場合
    else:
      ans = ans + 1
else:
  for i in range(int(len(S_list)/2)):
    #print(i,len(S_list)-i-1)
    if(S_list[i]==S_list[len(S_list)-i-1]):
      ans = ans + 0
    else:
      ans = ans + 1
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
day_list = ["SUN","MON","TUE","WED","THU","FRI","SAT"]

day_num = day_list.index(S)

print(day_list[day_num+1])

Fixed submission:
S = input()
day_list = ["SUN","MON","TUE","WED","THU","FRI","SAT"]

day_num = day_list.index(S)

print(7-day_num)
Buggy python submission (verdict: Runtime Error):
#整数の入力
N = int(input())
#文字列の入力
S = input()

#listを一文字ずつのlistに
S_list = list(S)

ans = ""
for i in range(len(S_list)):
  if(N+i<=len(S_list)):
    ans = ans + S_list[N+i]
  else:
    ans = ans + S_list[len(S_list)-N-i]
  
print(ans)



Fixed submission:
#整数の入力
N = int(input())
#文字列の入力
S = input()
#listを一文字ずつのlistに
S_list = list(S)

ans = ""
for i in range(len(S_list)):
  if(ord(S_list[i])+N<=90):
    #インクリンメント 次の文字を表示
    ans = ans + chr(ord(S_list[i]) + N)
  else:
    a = ord(S_list[i])+N - 90
    #print(a)
    ans = ans + chr(a+64)
  
print(ans)

Buggy python submission (verdict: Runtime Error):
#整数の入力
N = int(input())
#文字列の入力
S = input()

#listを一文字ずつのlistに
S_list = list(S)

ans = ""
for i in range(len(S_list)):
  ans = ans + S_list[N+i]
  
print(ans)

Fixed submission:
#整数の入力
N = int(input())
#文字列の入力
S = input()
#listを一文字ずつのlistに
S_list = list(S)

ans = ""
for i in range(len(S_list)):
  if(ord(S_list[i])+N<=90):
    #インクリンメント 次の文字を表示
    ans = ans + chr(ord(S_list[i]) + N)
  else:
    a = ord(S_list[i])+N - 90
    #print(a)
    ans = ans + chr(a+64)
  
print(ans)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
ans = 0

if((A <= 9 )&&(B <= 9)):
  ans = A*B
else:
  ans = -1
  
print(ans)

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

if((A <= 9 )and(B <= 9)):
  ans = A*B
else:
  ans = -1
  
print(ans)
Buggy python submission (verdict: Runtime Error):
#奇数文字目がすべて R, U, D のいずれか。
#偶数文字目がすべて L, U, D のいずれか。

#文字列の入力
S = input()
S_list = []
S_list = list(S)
counter = 0

for i in range(len(S_list)):
  #奇数
  if(i%2 == 0):
    if((S_list[i] == "R")or(S_list[i] == "U")or(S_list[i] == "D")):
      counter = counter + 1
  else:
    if((S_list[i] == "L")or(S_list[i] == "U")or(S_list[i] == "D")):
      counter = counter + 1
      
if(counter = len(S_list)):
  print("Yes")
else:
  print("No")

Fixed submission:
#奇数文字目がすべて R, U, D のいずれか。
#偶数文字目がすべて L, U, D のいずれか。

#文字列の入力
S = input()
S_list = []
S_list = list(S)
counter = 0

for i in range(len(S_list)):
  #奇数
  if(i%2 == 0):
    if((S_list[i] == "R")or(S_list[i] == "U")or(S_list[i] == "D")):
      counter = counter + 1
  else:
    if((S_list[i] == "L")or(S_list[i] == "U")or(S_list[i] == "D")):
      counter = counter + 1
      
if(counter == len(S_list)):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

N = int(input())
x = 0
ans = [0 for _ in range(N)]
maxv = ceil(sqrt(N)) + 1
for x in range(1, maxv):
    for y in range(1, maxv):
        for z in range(1, maxv):
            f = x*x + y*y + z*z + x*y + y*z + z*x - 1
            if f > N: continue
            ans[f] += 1
for i in range(N):
    print(ans[i])

Fixed submission:
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

N = int(input())
x = 0
ans = [0 for _ in range(N)]
maxv = ceil(sqrt(N)) + 1
for x in range(1, maxv):
    for y in range(1, maxv):
        for z in range(1, maxv):
            f = x*x + y*y + z*z + x*y + y*z + z*x - 1
            if f > N-1: continue
            ans[f] += 1
for i in range(N):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

lin = [0 for i in range(10**5)]
n = int(input())
a = list(map(int, input().split()))
ans = 0
for x in a:
    ans += x
    lin[x] += 1
q = int(input())
for i in range(q):
    b, c = map(int, input().split())
    ans += (c - b)*lin[b]
    print(ans)
    lin[c] += lin[b]
    lin[b] = 0

Fixed submission:
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

lin = [0 for i in range(10**5+1)]
n = int(input())
a = list(map(int, input().split()))
ans = 0
for x in a:
    ans += x
    lin[x] += 1
q = int(input())
for i in range(q):
    b, c = map(int, input().split())
    ans += (c - b)*lin[b]
    lin[c] += lin[b]
    lin[b] = 0
    print(ans)
Buggy python submission (verdict: Runtime Error):
x, y = map(int, input().split())

if y % 2 == 0:
    turu = y // 2 - x
    kame = 2*x - y // 2
    if turu >= 0 and kame >= 0:
        print('Yes')
        sys.exit()
print('No')

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

ans = 'No'
if y % 2 == 0:
    turu = y // 2 - x
    kame = 2*x - y // 2
    if turu >= 0 and kame >= 0:
        ans = 'Yes'
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(n-1, 0, -1):
    x = i - a[i]
    if x < 0:
        continue
    for j in range(i-1, -1, -1):
        if j + a[j] == x:
            cnt += 1
print(cnt)

Fixed submission:
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))
n = int(input())
a = list(map(int, input().split()))

x = {}
y = {}
for i in range(n):
    t = i - a[i]
    s = i + a[i]
    if t in x:
        x[t] += 1
    else:
        x[t] = 1
    if s in y:
        y[s] += 1
    else:
        y[s] = 1
cnt = 0
for i in x.keys():
    if i in y:
        cnt += x[i]*y[i]
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

ans = 0
for i in range(n-3):
    for j in range(i+1, n-1):
        if s[i] == s[j]: continue
        for k in range(j+1, n):
            if (j - i) == (k - j): continue
            if s[i] == s[k] or s[j] == s[k]: continue
            ans += 1
print(ans)

Fixed submission:
n = int(input())
s = input()

r = 0
g = 0
b = 0

for i in s:
    if i == 'R':
        r += 1
    elif i == 'G':
        g += 1
    else:
        b += 1

ans = r * g * b

for i in range(n-1):
    for j in range(i+1, n):
        if s[i] == s[j]: continue
        k = 2*j - i
        if k >=n: continue
        if s[i] == s[k] or s[j] == s[k]: continue
        ans -= 1

print(ans)