Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N = int(input())

List = []
for i in range(1,10**4):
    for j in range(1,10**4):
        if N == i*j:
            List.append(i+j)

print(min(List)-2)

Fixed submission:
A, B = map(int, input().split())
print(A*B if A <= 9 and B <= 9 else -1)

Buggy python submission (verdict: Runtime Error):
N = int(input())
if(N in [1,2,3,4,5,6,7,8,9,10,12,14,15,16,18,20,21,24,25,27,30,32,35,36,40,42,45,48,49,54,56,63,64,72,81]):
    print("Yes")
else:
    print("No")

Fixed submission:
A, B = map(int, input().split())
print(A*B if A <= 9 and B <= 9 else -1)

Buggy python submission (verdict: Runtime Error):
N = int(input())
if(N in [1, 2, 3, 4, 5, 6, 7 ,8 ,9,10, 12, 14, 15, 16, 18, 20, 21 ,24, 25, 27, 30, 32, 35, 36, 40,45, 48, 49, 54, 56, 63, 64 ,72, 81]):
    print("Yes")
else:
    print("No")

Fixed submission:
A, B = map(int, input().split())
print(A*B if A <= 9 and B <= 9 else -1)

Buggy python submission (verdict: Runtime Error):
N = int(input())
if(N in [1, 2, 3, 4, 5, 6, 7 ,8 ,9,10, 12, 14, 15, 16, 18, 20, 21 ,24, 25, 27, 30, 32, 35, 36, 40,42,45, 48, 49, 54, 56, 63, 64 ,72, 81]):
    print("Yes")
else:
    print("No")

Fixed submission:
A, B = map(int, input().split())
print(A*B if A <= 9 and B <= 9 else -1)

Buggy python submission (verdict: Runtime Error):
N = int(input())
if(N in [1, 2, 3, 4, 5, 6, 7 ,8 ,9,10, 12, 14, 15, 16, 18, 20, 21 ,24, 25, 27, 30, 32, 35, 36, 40,42,45, 48, 49, 54, 56, 63, 64 ,72, 81]):
    print("Yes")
else:
    print("No")

Fixed submission:
A, B = map(int, input().split())
print(A*B if A <= 9 and B <= 9 else -1)

Buggy python submission (verdict: Runtime Error):
N = int(input())
if(N in [1, 2, 3, 4, 5, 6, 7 ,8 ,9,10, 12, 14, 15, 16, 18, 20, 21 ,24, 25, 27, 30, 32, 35, 36, 40,42,45, 48, 49, 54, 56, 63, 64 ,72, 81]):
    print("Yes")
else:
    print("No")

Fixed submission:
A, B = map(int, input().split())
print(A*B if A <= 9 and B <= 9 else -1)

Buggy python submission (verdict: Runtime Error):
N = int(input())
if(N in [1, 2, 3, 4, 5, 6, 7 ,8 ,9, 10, 12, 14, 15, 16, 18, 20, 21 ,24, 25, 27, 30, 32, 35, 36, 40, 42, 45, 48, 49, 54, 56, 63, 64 ,72, 81]):
    print("Yes")
else:
    print("No")


Fixed submission:
A, B = map(int, input().split())
print(A*B if A <= 9 and B <= 9 else -1)

Buggy python submission (verdict: Runtime Error):
N = int(input())
if(N in [1, 2, 3, 4, 5, 6, 7 ,8 ,9, 10, 12, 14, 15, 16, 18, 20, 21 ,24, 25, 27, 30, 32, 35, 36, 40, 42,45, 48, 49, 54, 56, 63, 64 ,72, 81]):
    print("Yes")
else:
    print("No")


Fixed submission:
A, B = map(int, input().split())
print(A*B if A <= 9 and B <= 9 else -1)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
N = int(input())

List = []
for i in range(1,10**4):
    for j in range(1,10**4):
        if N == i*j:
            List.append(i+j)

print(min(List)-2)

Fixed submission:
#--------------------------------------------
#ライブラリ等
import sys
import math
from math import sqrt
input = sys.stdin.readline

#---------------------------------------------
N = int(input())
for i in range(int(sqrt(N))+1,-1,-1):
    if N % i == 0:
        print(int(i+(N/i)-2))
        exit()

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

List = []
for i in range(1,10**5):
    for j in range(1,10**5):
        if N == i*j:
            List.append(i+j)

print(min(List)-2)

Fixed submission:
#--------------------------------------------
#ライブラリ等
import sys
import math
from math import sqrt
input = sys.stdin.readline

#---------------------------------------------
N = int(input())
for i in range(int(sqrt(N))+1,-1,-1):
    if N % i == 0:
        print(int(i+(N/i)-2))
        exit()

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

List = []
for i in range(1,10*5):
    for j in range(1,10**5):
        if N == i*j:
            List.append(i+j)

print(min(List)-2)

Fixed submission:
#--------------------------------------------
#ライブラリ等
import sys
import math
from math import sqrt
input = sys.stdin.readline

#---------------------------------------------
N = int(input())
for i in range(int(sqrt(N))+1,-1,-1):
    if N % i == 0:
        print(int(i+(N/i)-2))
        exit()
Buggy python submission (verdict: Runtime Error):
N = int(input())
arr = list(map(int, input().split()))

ans = 0
for i in range(N):
    for i in range(i+1,N):
        ans += i*J

print(ans)

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

ans = 0
for i in range(N):
    for j in range(i+1,N):
        ans += arr[i]*arr[j]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
arr = list(map(int, input().split()))

ans =0
for i in range(N-1):
    count =0
    for j in range(i,N-1,1):
        if arr[j] >= arr[j+1]:
            count +=1
        else:
            break
    if count>ans:
        ans =count
print(ans)

Fixed submission:
N = int(input())
arr = list(map(int, input().split()))
jump_flg = [0]*N

for i in range(N-1):
    if arr[i] >= arr[i+1]:
        jump_flg[i] =1

ans = 0
count = 0
for i in range(N):
    if jump_flg[i] == 1:
        count +=1
        if ans<count:
            ans =count
    else:
        count =0

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
moji =[]
for i in range(N):
    a = sorted(input())
    moji.append(''.join(a))

ans = 0
for i in range(N):
    for j in range(i+1,N,1):
        if moji[i] == moji[j]:
            ans += 1

print(ans)



Fixed submission:
import math
def P(n, r):
    return math.factorial(n)//math.factorial(n-r)
def C(n, r):
    return P(n, r)//math.factorial(r)

N = int(input())
moji =[]
for i in range(N):
    a = sorted(input())
    moji.append(''.join(a))


dic = {}
for i in moji:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1

ans = 0
for value in dic.values():
    if value >=2:
        a= C(value, 2)
        ans+=a

print(ans)
Buggy python submission (verdict: Runtime Error):
N=input()
A=len(set(N))
if A==2 and N.count(A[0]) == N.count(A[1]) == 2:
    print("Yes")
else:
    print("No")

Fixed submission:
N=input()
A=len(set(N))
if A==2 and N.count(N[0]) == N.count(N[1]) == 2:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
"""
N段の階段 M個の階段が壊れている
"""

N, M = map(int, input().split())
arr = [int(input()) for _ in range(M)]
no_step =[0]*N

for i in range(M):
    no_step[arr[i]-1]=1

count = [0]*N
if no_step[0]==0:
    count[0]=1

if no_step[1]==1:
    count[1]=0
elif no_step[0]==0 and no_step[1]==0:
    count[1]=2
elif no_step[0]==1 and no_step[1]==0:
    count[1]=1

for i in range(3,N+1,1):
    count[i-1] = count[i-2]+count[i-3]
    if no_step[i-1] == 1:
        count[i-1] = 0

ans =count[N-1]%1000000007
print(ans)

Fixed submission:
"""
N段の階段 M個の階段が壊れている
"""

N, M = map(int, input().split())
arr = [int(input()) for _ in range(M)]
no_step =[0]*N

if N==1:
    print(1)
    exit()

for i in range(M):
    no_step[arr[i]-1]=1

count = [0]*N
if no_step[0]==0:
    count[0]=1

if no_step[1]==1:
    count[1]=0
elif no_step[0]==0 and no_step[1]==0:
    count[1]=2
elif no_step[0]==1 and no_step[1]==0:
    count[1]=1

for i in range(3,N+1,1):
    count[i-1] = count[i-2]+count[i-3]
    if no_step[i-1] == 1:
        count[i-1] = 0

ans =count[N-1]%1000000007
print(ans)

Buggy python submission (verdict: Runtime Error):
"""
N段の階段 M個の階段が壊れている
"""

N, M = map(int, input().split())
arr = [int(input()) for _ in range(M)]
no_step =[0]*N

for i in range(M):
    no_step[arr[i]-1]=1

count = [0]*N
if no_step[0]==0:
    count[0]=1

if no_step[1]==1:
    count[1]=0
elif no_step[0]==0 and no_step[1]==0:
    count[1]=2
elif no_step[0]==1 and no_step[1]==0:
    count[1]=2

for i in range(3,N+1,1):
    count[i-1] = count[i-2]+count[i-3]
    if no_step[i-1] == 1:
        count[i-1] = 0

print(count[-1]%1000000007)


Fixed submission:
"""
N段の階段 M個の階段が壊れている
"""

N, M = map(int, input().split())
arr = [int(input()) for _ in range(M)]
no_step =[0]*N

if N==1:
    print(1)
    exit()

for i in range(M):
    no_step[arr[i]-1]=1

count = [0]*N
if no_step[0]==0:
    count[0]=1

if no_step[1]==1:
    count[1]=0
elif no_step[0]==0 and no_step[1]==0:
    count[1]=2
elif no_step[0]==1 and no_step[1]==0:
    count[1]=1

for i in range(3,N+1,1):
    count[i-1] = count[i-2]+count[i-3]
    if no_step[i-1] == 1:
        count[i-1] = 0

ans =count[N-1]%1000000007
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
"""
i番目のゲートは LiからRiまでのIDカードのうちどれか1枚を持っていれば通過できます
"""

N, M = map(int, input().split())
arr = [0]*N

for i in range(M):
    L, R = map(int, input().split())
    for j in range(L,R+1,1):
        arr[j-1] += 1

print(arr.count(M))


Fixed submission:
"""
i番目のゲートは LiからRiまでのIDカードのうちどれか1枚を持っていれば通過できます
"""

N, M = map(int, input().split())
left = 0
right =float("inf")

for i in range(M):
    L, R = map(int, input().split())
    if left<L:
        left = L
    if right > R:
        right = R

print(max(right-left+1,0))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

arr = [N,0,0,0,0]
count = 0

while True:
    count += 1
    arr[4] =max(0,arr[4]-E)
    arr[4] +=min(D,arr[3])

    arr[3] =max(0,arr[3]-D)
    arr[3] +=min(C,arr[2])

    arr[2] =max(0,arr[2]-C)
    arr[2] +=min(B,arr[1])

    arr[1] =max(0,arr[1]-B)
    arr[1] +=min(A,arr[0])

    arr[0] =max(0,arr[0]-A)
    if sum(arr) == 0:
        break

print(count)

Fixed submission:
import math
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

print(math.ceil(N/min(A,B,C,D,E))+4)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
ashi = list(map(int, input().split()))

if N<=K:    
    print(abs(ashi[-1]-ashi[0]))
    exit()

arr = [0]*N
for i in range(1,K+1,1):
    arr[i] = abs(ashi[i]-ashi[0])


for i in range(K+1,N,1):
    x = arr[i-1]+abs(ashi[i]-ashi[i-1])
    for j in range(1,K+1,1):
        if arr[i-j]+abs(ashi[i]-ashi[i-j]) < x:
            x=arr[i-j]+abs(ashi[i]-ashi[i-j])
    arr[i] = x

print(arr[-1])

Fixed submission:
N, K = map(int, input().split())
ashi = list(map(int, input().split()))
 
if N<=K:    
    print(abs(ashi[-1]-ashi[0]))
    exit()
 
arr = [0]*N
for i in range(1,K+1,1):
    arr[i] = abs(ashi[i]-ashi[0])
 
 
for i in range(K+1,N,1):
    x = arr[i-1]+abs(ashi[i]-ashi[i-1])
    for j in range(1,K+1,1):
        if arr[i-j]+abs(ashi[i]-ashi[i-j]) < x:
            x=arr[i-j]+abs(ashi[i]-ashi[i-j])
    arr[i] = x
 
print(arr[-1])

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

if N<=K:    
    print(abs(ashi[N]-ashi[0]))
    exit()

arr = [0]*N
for i in range(1,K+1,1):
    arr[i] = abs(ashi[i]-ashi[0])


for i in range(K+1,N,1):
    x = arr[i-1]+abs(ashi[i]-ashi[i-1])
    for j in range(1,K+1,1):
        if arr[i-j]+abs(ashi[i]-ashi[i-j]) < x:
            x=arr[i-j]+abs(ashi[i]-ashi[i-j])
    arr[i] = x

print(arr[N-1])

Fixed submission:
N, K = map(int, input().split())
ashi = list(map(int, input().split()))
 
if N<=K:    
    print(abs(ashi[-1]-ashi[0]))
    exit()
 
arr = [0]*N
for i in range(1,K+1,1):
    arr[i] = abs(ashi[i]-ashi[0])
 
 
for i in range(K+1,N,1):
    x = arr[i-1]+abs(ashi[i]-ashi[i-1])
    for j in range(1,K+1,1):
        if arr[i-j]+abs(ashi[i]-ashi[i-j]) < x:
            x=arr[i-j]+abs(ashi[i]-ashi[i-j])
    arr[i] = x
 
print(arr[-1])
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input(),split())
print(a*b-a-b+1)

Fixed submission:
A, B = map(int, input().split())
print(A*B-A-B+1)
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
arr = [input() for _ in range(H)]

for i in range(H):
    for j in range(W):
        if arr[i][j] == '#':
            flg =False
            if i-1>=0:
                if arr[i-1][j] == '#':
                    flg = True
            if j-1>=0:
                if arr[i][j-1] == '#':
                    flg = True
            if i+1<W:
                if arr[i+1][j] == '#':
                    flg = True
            if j+1<H:
                if arr[i][j+1] == '#':
                    flg = True
            if flg == False:
                print('No')
                exit()

print('Yes')




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

for i in range(H):
    for j in range(W):
        if arr[i][j] == '#':
            flg =False
            if i-1>=0:
                if arr[i-1][j] == '#':
                    flg = True
            if j-1>=0:
                if arr[i][j-1] == '#':
                    flg = True
            if i+1<H:
                if arr[i+1][j] == '#':
                    flg = True
            if j+1<W:
                if arr[i][j+1] == '#':
                    flg = True
            if flg == False:
                print('No')
                exit()

print('Yes')
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
 
if (a*b) % 2 =0:
  print("Even")
else:
  print("Odd")

Fixed submission:
a,b=map(int,input().split())
 
if a*b % 2 == 0:
  print("Even")
else:
  print("Odd")

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

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

Fixed submission:
a,b=map(int,input().split())
 
if a*b % 2 == 0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Time Limit Exceeded):
N, Y = map(int, input().split())

flag=False
for i in range(0,N+1):
    for j in range(0,N+1):
        for k in range(0,N+1):
            if i+j+k == N and 10000*i+5000*j+1000*k==Y:
                print(i,j,k)
                flag=True
                break
        if flag==True:
            break
    if flag==True:
            break
     

else:
    print("-1 -1 -1")


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

flag=False
for i in range(N+1):
    for j in range(N+1-i):    
        if 10000*i+5000*j+1000*(N-i-j)==Y:
            print(i,j,N-i-j)
            flag=True
            break

    if flag==True:
        break
     
else:
    print("-1 -1 -1")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
mod =10**9+7
ans = 1

for i in range(N):
    ans *=(i+1)

print(ans%mod)

Fixed submission:
N = int(input())

import math

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

count=0
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if x+y+z == S:
                count +=1

print(count)


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

count=0
for x in range(K+1):
    for y in range(K+1):
        if 0 <= S-(x+y) <= K:
            count +=1

print(count)
Buggy python submission (verdict: Runtime Error):
c = input()
if c in (a,i,u,e,o):
    print('vowel')
else:
    print('consonant')

Fixed submission:
c = input()
if c in ('a','i','u','e','o'):
    print('vowel')
else:
    print('consonant')
Buggy python submission (verdict: Runtime Error):
-1000000000 0 -1000000000 0

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

print(max(a*c,a*d,b*c,d*b))
Buggy python submission (verdict: Runtime Error):
s = str(input())
a = []

for i in s:
    if i == '0':
        a.append('0') 
    elif i == '1':
        a.append('1')
    elif i == 'B':
        del a[-1]
        

print(''.join(a))

Fixed submission:
s = str(input())
a = []

for i in s:
    if i == '0':
        a.append('0') 
    elif i == '1':
        a.append('1')
    elif i == 'B':
        if len(a) ==0:
            continue
        else:
            del a[-1]
        

print(''.join(a))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n-1):
  ans+=a[i]*sum(a[i+1:])
  if ans>(10**9+7):
    ans=ans%(10**9+7)
                
print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
s=sum(a)
ans=0
for i in range(n-1):
  s-=a[i]
  ans+=a[i]*s
  if ans>(10**9+7):
    ans=ans%(10**9+7)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n-1):
  ans+=a[i]*sum(a[i+1:])
  
print(ans%(10**9+7))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
s=sum(a)
ans=0
for i in range(n-1):
  s-=a[i]
  ans+=a[i]*s
  if ans>(10**9+7):
    ans=ans%(10**9+7)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n-1):
  for j in range(i+1,n):
    ans+=a[i]*a[j]
  
print(ans%(10**9+7))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
s=sum(a)
ans=0
for i in range(n-1):
  s-=a[i]
  ans+=a[i]*s
  if ans>(10**9+7):
    ans=ans%(10**9+7)
print(ans)
Buggy python submission (verdict: Runtime Error):
x,k,d=map(int,input().split())
x=abs(x)

semin=x//d #最小に行くための個数
if semin%2==0:
  minb=0 #最小に行くための個数が偶数
else:
  minb=1 #最小に行くための個数が奇数

if semin>k:
  print(abs(x-k*d))
else:
  k=k-semin
  if k%2==0:
    ans=0 #偶数
  else:
    ans=1 #奇数
  if ans==0:#ｋが偶数の時
    if minb==0:
      print(abs(x-d*semin))
    else:
      print(min(abs((x-(d*semin))-d),abs(x-d*semin)))
  else:#ｋが奇数の時
    if minb==0:
      print(abs((x-(d*semin))-d))
    else:
      print(abs(x-d*semin))  

Fixed submission:
s=input()
count=0
if s.count('R')==1:
  print(1)
elif s.count('R')==3:
  print(3)
elif s.count('R')==2:
  if s[1]=="R":
    print(2)
  else:
    print(1)
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=list(map(int,input().split()))
count=0
ans=None
d=0
for i in range(n-k+1):
  if d==0:
    d=1
    gakki=1
    for j in range(count,k+count):
      gakki*=a[j]
      
  else:
    gakki/=a[count]
    gakki*=a[k+count]
    count+=1
  
  if ans is None:
    ans=gakki
  else:
    if ans<gakki:
      print('Yes')
      ans=gakki
    else:
      print("No")
      ans=gakki

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n-k):
  if a[i]<a[k+i]:
    print('Yes')
  else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=list(map(int,input().split()))
count=0
ans=None
d=0
for i in range(n-k+1):
  if d==0:
    s=a[count:k+count]
    gakki=1
    for w in s:
      gakki*=w
    d=1
  else:
    gakki/=a[count]
    gakki*=a[k+count]
    count+=1
  
  if ans is None:
    ans=gakki
  else:
    if ans<gakki:
      print('Yes')
      ans=gakki
    else:
      print("No")
      ans=gakki

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n-k):
  if a[i]<a[k+i]:
    print('Yes')
  else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=list(map(int,input().split()))
count=0
ans=None
d=0
for i in range(n-k+1):
  if d==0:
    s=a[count:k+count]
    gakki=1
    d=1
  else:
    del s[0]
    s.append(a[k+count])
    count+=1
    gakki=1
  
  for w in s:
    gakki*=w
  
  
  if ans is None:
    ans=gakki
  else:
    if ans<gakki:
      print('Yes')
      ans=gakki
    else:
      print("No")
      ans=gakki

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n-k):
  if a[i]<a[k+i]:
    print('Yes')
  else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=list(map(int,input().split()))
count=0
ans=None

for i in range(n-k+1):
  s=a[count:k+count]
  gakki=1
  count+=1
  for w in s:
    gakki*=w
  
  
  if ans is None:
    ans=gakki
  else:
    if ans<gakki:
      print('Yes')
      ans=gakki
    else:
      print("No")
      ans=gakki

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n-k):
  if a[i]<a[k+i]:
    print('Yes')
  else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

for i in range(1,n+1):
  count=0
  for x in range(1,101):
    for y in range(1,101):
      for z in range(1,101):
        a=x**2+z**2+(x+y)*(y+z)
        if i<a:
          break
        if i==a:
          count+=1
          
  print(count)

Fixed submission:
n=int(input())
ans=[0]*n
for x in range(1,101):
  for z in range(1,101):
    for y in range(1,101):
      a=(x+y+z)**2-(x*y+y*z+z*x)
      if a<=n:
          ans[a-1]+=1
for i in ans:
  print(i)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
q=int(input())
for i in range(q):
  b,c=map(int,input().split())
  
  for j in range(n):
    if a[j]==b:
      a[j]=c
  print(sum(a))

Fixed submission:
n=int(input())
b=""

while n>0:
  n-=1
  b+=chr(ord("a")+n%26)
  n=n//26
  
print(b[::-1])
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
q=int(input())
for i in range(q):
  b,c=map(int,input().split())
  
  for j in range(n):
    if a[j]==b:
      a[j]=c
  print(sum(a))

Fixed submission:
import collections
n=int(input())
a=list(map(int,input().split()))
q=int(input())
d=collections.Counter(a)
ans=sum(a)
for i in range(q):
  b,c=map(int,input().split())
  ans+=d[b]*(c-b)
  d[c]+=d[b]
  d[b]=0
  print(ans)
Buggy python submission (verdict: Runtime Error):
import math
a,b,h,m=map(int,input().split())
tyok=h*30+m*0.5
tank=m*6
sa=abs(tyok-tank)
c=a**2+b**2-2*a*b*math.cos(math.radians(sa))
print(math.sqrt(c))


Fixed submission:
n=list(input())
if n[-1]=='3':
  print('bon')
elif n[-1]=='0' or n[-1]=='1' or n[-1]=='6' or n[-1]=='8':
  print("pon")
else :
  print("hon")

Buggy python submission (verdict: Runtime Error):
import math
a,b,h,m=map(int,input().split())
tyok=h*30+m*0.5
tank=m*6
sa=abs(tyok-tank)
print(math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(sa))))


Fixed submission:
n=list(input())
if n[-1]=='3':
  print('bon')
elif n[-1]=='0' or n[-1]=='1' or n[-1]=='6' or n[-1]=='8':
  print("pon")
else :
  print("hon")
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=input().split()
a=sorted(a)
count=1
ans=0

for i in range(n-2):
  if a[i]==a[i+1]:
    count+=1
  else:
    print(count)
    ans+=1
    count=1

if a[-2]==a[-1]:
  print(count)
  ans+=1
else:
  print(1)
  ans+=1
  
if ans!=n:
  for i in range(n-ans):
    print(0)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
A=[0]*n
for i in range(n-1):
  A[a[i]-1]+=1
for i in range(n):
  print(A[i])
Buggy python submission (verdict: Runtime Error):
n=input()
if n[1]=='7' or n[2]=='7' or n[3]=='7':
  print('Yes')
else:
  print('No')

Fixed submission:
n=input()
if n[0]=='7' or n[1]=='7' or n[2]=='7':
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import math
k=int(input())
sum=0
    
for i in range(1,k+1):
  for j in range(1,k+1):
    for z in range(1,k+1):
      sum+=math.gcd(i,math.gcd(j,z))
      
print(sum)

Fixed submission:
k=int(input())
sum=0

def gcd(x,y):
  while y!=0:
    x,y=y,x%y
  return x
    
for i in range(1,k+1):
  for j in range(1,k+1):
    for z in range(1,k+1):
      sum+=gcd(i,gcd(j,z))
      
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
sum=0

def gcd(x,y):
  while y!=0:
    x,y=y,x%y
  return x
    
for i in range(1,k+1):
  for j in range(1,k+1):
    for z in range(1,k+1):
      sum+=gcd(i,gcd(j,z))
      
print(sum)

Fixed submission:
k=int(input())
sum=0

def gcd(x,y):
  while y!=0:
    x,y=y,x%y
  return x
    
for i in range(1,k+1):
  for j in range(1,k+1):
    for z in range(1,k+1):
      sum+=gcd(i,gcd(j,z))
      
print(sum)
Buggy python submission (verdict: Runtime Error):
k,n=map(int,input().split())
a=list(map(int,input().split()))
b=0
s=[0]*n
#間隔を求める
for i in range(n-1):
    s[i]=a[i+1]-a[i]
#間隔を足す
for i in range(n):
  if s[i]<k/3:
    b=b+s[i]
  else:
    con=k-s[i]
    print(con)
    exit()
  
print(b)

Fixed submission:
s=input()
if s[2]==s[3] and s[4]==s[5]:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
s=input()
if s[3]==s[4] and s[5]==s[6]:
  print('Yes')
  exit()
  
print('No')

Fixed submission:
s=input()
if s[2]==s[3] and s[4]==s[5]:
  print('Yes')
else:
  print('No')