Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N =int(input())
amari = N % 10
if |m == 2||m ~~ 4||m == 5||m == 7||m == 9| in str(amari) :
    print ('hon')


Fixed submission:
N = int(input())
n = N%10
if n == 3:
    print('bon')
elif n == 0 or n == 1 or n == 6 or n == 8:
    print('pon')
else:
    print('hon')

Buggy python submission (verdict: Runtime Error):
amari = N % 10
if 2 and 4 and 5 and 7 and 9 in amari :
        print str(N) + 'hon'
elif 0 and 1 and 6 and 8 in amari :
    print str(N) + 'pon' 
else print str(N) + 'bon'

Fixed submission:
N = int(input())
n = N%10
if n == 3:
    print('bon')
elif n == 0 or n == 1 or n == 6 or n == 8:
    print('pon')
else:
    print('hon')
Buggy python submission (verdict: Runtime Error):

Fixed submission:
#A
a, b = map(int,input().split())
print(a*b)
Buggy python submission (verdict: Time Limit Exceeded):
#B
def unti():
    N = int(input())
    A = list(map(int, input().split()))
    result = 1
    if 0 in A:
        print(0)
        return
    for a in A:
        if 0 in A:
            print(0)
            break
        result *= a
    if result >10**18:
        print(-1)
    else:
        print(result)

unti()

Fixed submission:
#B
def main ():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
main ()

Buggy python submission (verdict: Runtime Error):
#B
unti()

def unti():
    N = int(input())
    A = list(map(int, input().split()))
    result = 1
    if 0 in A:
        print(0)
        return
    for a in A:
        if 0 in A:
            print(0)
            break
        result *= a
    if result >10**18:
        print(-1)
    else:
        print(result)

Fixed submission:
#B
def main ():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
main ()

Buggy python submission (verdict: Time Limit Exceeded):
#B
N = int(input())
A = list(map(int, input().split()))
result = 1
for a in A:
    result *= a
if result >10**18:
    print(-1)
else:
    print(result)

Fixed submission:
#B
def main ():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
main ()
Buggy python submission (verdict: Runtime Error):
#C
A,B = map(int,input().split())
C = str(A*B)
print(C.split('.')[0])

Fixed submission:
#C
A,B = input().split()
A = int(A)
B = round(float(B)*100)
 
res = (A*B)//100
print(res)
Buggy python submission (verdict: Runtime Error):
# A
K = int(input())
A, B = map(int,input().split())

if(A%K==0 or B%K==0 or (B-A>=K and B!=A):
    print('OK')
else:
    print('NG')

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

if(A%K==0 or B%K==0):
    print('OK')
elif(B-A >= K - A%K):
    print('OK')
else:
    print('NG')

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

if(A%K==0 and B%K==0 and B-A=>K):
    print('OK')
else:
    print('NG')

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

if(A%K==0 or B%K==0):
    print('OK')
elif(B-A >= K - A%K):
    print('OK')
else:
    print('NG')
Buggy python submission (verdict: Runtime Error):
#157
def main():
    N, M = map(int,input().split())
    num = [-1]*N
    for i in range(M):
        s, c = map(int,input().split())
        if(s==1 and c==0 and N!=1):
            print(-1)
            return
        if(num[s-1]==-1 or num[s-1]==c):
            num[s-1] = c
        else:
            print(-1)
            return
    result = ''
    for i in ramge(N):
        if(num[i]!=-1):
            result+=str(num[i])
        else:
            if(N==1):
                result+='0'
            elif(i==0):
                result+='1'
            else:
                result+='0'
    print(result)

main()

Fixed submission:
#157
def main():
    N, M = map(int,input().split())
    num = [-1]*N
    for i in range(M):
        s, c = map(int,input().split())
        if(s==1 and c==0 and N!=1):
            print(-1)
            return
        if(num[s-1]==-1 or num[s-1]==c):
            num[s-1] = c
        else:
            print(-1)
            return
    result = ''
    for i in range(N):
        if(num[i]!=-1):
            result+=str(num[i])
        else:
            if(N==1):
                result+='0'
            elif(i==0):
                result+='1'
            else:
                result+='0'
    print(result)

main()
Buggy python submission (verdict: Time Limit Exceeded):
#155
def main():
    N = int(input())
    S = [input() for i in range(N)]
    S_set = set(S)
    max_num = 0
    candidate = []
    for s in S_set:
        if S.count(s) == max_num: 
            candidate.append(s)
        elif S.count(s) > max_num:
            max_num = S.count(s)
            candidate=[s]
    candidate.sort()
    for c in candidate:
        print(c)
main()

Fixed submission:
#155
def main():
    N = int(input())
    S = [input() for i in range(N)]
    S.sort()
    ans = []
    max_len = 0
    streak = 1
    for i in range(N-1):
        if(S[i]==S[i+1]):
            streak+=1
            if(i==N-2):
                if(streak>max_len):
                    max_len = streak
                    ans = [S[i]]
                elif(streak==max_len):
                    ans.append(S[i])
        else:
            if(streak>max_len):
                max_len = streak
                ans = [S[i]]
            elif(streak==max_len):
                ans.append(S[i])
            streak=1
    if(N==1 or S[-2]!=S[-1]):
        ans.append(S[-1])
    for a in ans:
        print(a)
main()
Buggy python submission (verdict: Runtime Error):
#154
N = int(input())
A = map(int,input().split())
A_set = set(A)
if(len(A)==len(A_set)):
    print('YES')
else:
    print('NO')

Fixed submission:
#154
N = int(input())
A = list(map(int,input().split()))
A_set = set(A)
if(len(A)==len(A_set)):
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Runtime Error):
#154
N = int(input())
A = [int(input()) for i in range(N)]
A_set = set(A)
if(len(A)==len(A_set)):
    print('YES')
else:
    print('NO')

Fixed submission:
#154
N = int(input())
A = list(map(int,input().split()))
A_set = set(A)
if(len(A)==len(A_set)):
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
#152
def main():
    N = int(input())
    P = list(map(int,input().split()))
    count = 1
    for i in range(1, N):
        p = P[:i]
        if(min(p)>=P[i]):
            count+=1
    print(count)
main()

Fixed submission:
#152
def main():
    N = int(input())
    P = list(map(int,input().split()))
    count = 0
    min = 10000000000
    for p in P:
        if(p<=min):
            count+=1
            min=p
    print(count)
main()
Buggy python submission (verdict: Runtime Error):
N = int(input())
X = int(input())
T = int(input())

if X >= N:
    print(T)
elif N % X == 0:
    print(N//X*T)
else:
    print((N//X*T)+T)

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

if X >= N:
    print(T)
elif N % X == 0:
    print(N//X*T)
else:
    print((N//X+1)*T)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

a, v = map(int,input().split())
b, w = map(int,input().split())
t = int(input())
for i in range(t):
    a = a + v 
    b = b + w 
if a >= b :
    print("YES")
else:
    print("NO")

Fixed submission:

a, v = map(int,input().split())
b, w = map(int,input().split())
t = int(input())

if a > b:
    v = -v
    if w > 0:
        w = -w
if a < b and  w < 0:
    w = -w



A = t * v + a
B = t * w + b

if A > B:
    if  a < b:
        print("YES")
    else:
        print("NO")
elif A == B:
    print("YES")
elif A < B :
    if a < b:
        print("NO")
    else:
        print("YES")

Buggy python submission (verdict: Time Limit Exceeded):
a, v = map(int,input().split())
b, w = map(int,input().split())
t = int(input())
for i in range(t):
    a = a + v
    b = b + w
if a >= b :
    print("YES")
else:
    print("NO")

Fixed submission:

a, v = map(int,input().split())
b, w = map(int,input().split())
t = int(input())

if a > b:
    v = -v
    if w > 0:
        w = -w
if a < b and  w < 0:
    w = -w



A = t * v + a
B = t * w + b

if A > B:
    if  a < b:
        print("YES")
    else:
        print("NO")
elif A == B:
    print("YES")
elif A < B :
    if a < b:
        print("NO")
    else:
        print("YES")
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, k = map(int, input().split())

x = 0
yy = 0

while x != k:
    if a >= 1:
        yy += 1
        a -= 1
        x += 1
       
    elif b >= 1:
        b -= 1
        x += 1
      
    elif c >= 1:
        yy -= 1
        c -= 1
        x += 1
print(yy)

Fixed submission:

a, b, c, k = map(int, input().split())



if k <= a:      #aのほうがｋ（カードを引く回数より）大きかった時
    ans = k     #ｋの回数分＝最大値
else:           #aよりｋのほうが大きかった時
    y = k - a   #引く回数 - a = 残りの引ける数
    if y <= b:  #ｂより残り引ける数が小さければ
        ans = a
    else :
        y -= b
        ans = a - y
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a,b,c,d =0
for i in range(n):
  e = input()
  if e == 'AC':
    a+=1
  elif e == 'WA':
    b +=1
  elif e == 'TLE':
    c+=1
  else:
    d+=1

print('AC ×'+str(a)+'\n'+'WA ×' +str(b) + '\n'
      +'TLE ×'+str(c) +'\n' + 'RE ×'+str(d))
  

Fixed submission:
n = int(input())
a=b=c=d=0
for i in range(n):
  e = input()
  if e == 'AC':
    a+=1
  elif e == 'WA':
    b +=1
  elif e == 'TLE':
    c+=1
  else:
    d+=1

    

print('AC x '+str(a)+'\n'+'WA x ' +str(b) + '\n'
      +'TLE x '+str(c) +'\n' + 'RE x '+str(d))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from itertools import combinations
n,k = map(int,input().split())
if n==1:
    print(int(input()))
else:
    lis = input().split()
    total =np.inf

    for i in combinations(lis,k):
        ml =0

        for a in i:

            ml += int(a)

        total = min(total,ml)


    print(total)

Fixed submission:
n,k = map(int,input().split())
if n==1:
    print(int(input()))
else:
    total = 0
    lis = list(map(int,input().split()))
    lis.sort()
    for i in range(k):
        total += lis[i]
    print(total)

Buggy python submission (verdict: Runtime Error):
import numpy as np
from itertools import combinations
if n==1:
    print(int(input()))
else:
    n,k = map(int,input().split())
    lis = input().split()
    total =np.inf

    for i in combinations(lis,k):
        ml =0

        for a in i:

            ml += int(a)

        total = min(total,ml)


    print(total)

Fixed submission:
n,k = map(int,input().split())
if n==1:
    print(int(input()))
else:
    total = 0
    lis = list(map(int,input().split()))
    lis.sort()
    for i in range(k):
        total += lis[i]
    print(total)
Buggy python submission (verdict: Runtime Error):
X,Y,Z = input().split()
print(Z X Y)

Fixed submission:
X,Y,Z = input().split()
print(Z,X,Y)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = input().split()
N1 = int(N)
K1 = int(K)
for i in range (1000000):
    if K1**(i-1) <= N1 and N1 < K1**i:
        print(i)

Fixed submission:
N,K = input().split()
N1 = int(N)
K1 = int(K)
for i in range (1000):
    if K1**(i-1) <= N1 and N1 < K1**i:
        print(i)
        break
Buggy python submission (verdict: Time Limit Exceeded):
n  =int(input())
s = input()

cnt = 0

for a in range(10):
    for b in range(10):
        for c in range(10):
            flag = False
            for j in range(n):
                if s[j] == str(a):
                    for k in range(j+1,n):
                        if s[k] == str(b):
                            for l in range(k+1,n):
                                if s[l] == str(c):
                                    flag = True
                                    cnt+=1
                                    #print(a,b,c)
                                    break       
                                if flag:
                                    break
                                                               
                            if flag:
                                break
                        if flag:
                            break
                if flag:
                    break
                    
               
        
print(cnt)

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

cnt = 0

for a in range(10):
    s_index = s.find(str(a)) 
    if s_index == -1:
        continue##この先はやらない
    for b in range(10):
        t_index = s.find(str(b),s_index+1)
        if t_index==-1:
            continue
        for c in range(10):
            u_index = s.find(str(c),t_index+1)
            if u_index != -1:
                cnt+=1
                    
               
        
print(cnt)
Buggy python submission (verdict: Runtime Error):
n= input()
s = input()
G = groupby(s)

print(len(list(G)))

Fixed submission:
from itertools import groupby
n= input()
s = input()
G = groupby(s)

print(len(list(G)))
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
lis = [0]*n+1
a = []
for i in range(m):
    a.append(int(input()))
    
mod = 10**9+7
ans = 0
if n==1:
    print(1)
elif n==2:
    if m==1:
        print(1)
    else:
        print(2)
else:
    if 1 in a and 2 in a:
        print(0)
    elif 1 in a:
        lis[1] = 1
    elif 2 in a:
        lis[0] = 1
    else:
        lis[0] = 1
        lis[1] = 2
    
    for j in range(3,n+1):
        if j in a:
            lis[0] = lis[1]
            lis[1] = 0
        else:
            ans = lis[0]%mod + lis[1]%mod
            lis[0] = lis[1]
            lis[1] = ans
        
        if lis[0] == 0 and lis[1] == 0:
            ans = 0
            break
        

    print(ans%mod)

Fixed submission:
n,m = map(int,input().split())
lis = [False]*(n+1)
a = []
for i in range(m):
    a = int(input())
    lis[a] = True

mod = 10**9+7
dp =[0]*(n+1)
dp[0] =1
for i in range(n):
    dp[i] %= mod
    if (lis[i]):dp[i] = 0
    if i+1 <=n:
        dp[i+1] += dp[i]
    if i+2 <=n:
        dp[i+2] += dp[i]

print(dp[n]%mod)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
card =[[0]*n for _ in range(m)]
for i in range(m):
    switch = list(map(int,input().split()))[1:]
    for k in switch:
        card[i][k-1] = 1
##どこに繋がっているかを配列で表現

#print(card)


ans =list(map(int,input().split()))
cnt=0
from itertools import combinations
##全通りを調べる
for epoch in range(1,n+1):
    
    for j in combinations(range(1,n+1),epoch):
        sco =[]
        for lisa in card:##一つずつの照明について調べる
            score =0
            for l in j:
                score += lisa[l-1]
                
            sco.append(score)
        #print(sco)
        if list(np.array(sco)%2) == ans:
            cnt+=1
            
print(cnt)

Fixed submission:
import numpy as np
from itertools import combinations
n,m = map(int,input().split())
card =[[0]*n for _ in range(m)]
for i in range(m):
    switch = list(map(int,input().split()))[1:]
    for k in switch:
        card[i][k-1] = 1
##どこに繋がっているかを配列で表現

#print(card)


ans =list(map(int,input().split()))
cnt=0
from itertools import combinations
##全通りを調べる
for epoch in range(1,n+1):
    
    for j in combinations(range(1,n+1),epoch):
        sco =[]
        for lisa in card:##一つずつの照明について調べる
            score =0
            for l in j:
                score += lisa[l-1]
                
            sco.append(score)
        #print(sco)
        if list(np.array(sco)%2) == ans:
            cnt+=1
    

if ans == [0]*m:
    cnt+=1
        
print(cnt)
Buggy python submission (verdict: Runtime Error):
a,b= map(int,input().split())
if A >= 13:
    print(b)
elif 6<=A:
    print(b/2)
else:
    print(0)

Fixed submission:
a,b= map(int,input().split())
if a >= 13:
    print(b)
elif a > 5:
    print(b//2)
elif a <= 5:
    print(0)
Buggy python submission (verdict: Runtime Error):
import functools
from math import gcd
n,x =map(int,input().split())
lis = list(map(int,input().split()))
for i in range(n):
lis[i] = abs(lis[i]-x)
print(functools.reduce(gcd,lis))

Fixed submission:
from functools import reduce
from fractions import gcd
N,X=map(int,input().split())
x=[abs(X-int(i)) for i in input().split()]
print(reduce(gcd,x))

Buggy python submission (verdict: Runtime Error):
from functools import reduce
from math import gcd
n,x =map(int,input().split())
if n==1:
    c = abs(int(input())-x)
    print(c)
else:
    lis = list(map(int,input().split()))
    for i in range(n):
        lis[i] = abs(lis[i]-x)
    print(reduce(gcd,lis))

Fixed submission:
from functools import reduce
from fractions import gcd
N,X=map(int,input().split())
x=[abs(X-int(i)) for i in input().split()]
print(reduce(gcd,x))

Buggy python submission (verdict: Runtime Error):
import functools
from math import gcd
n,x =map(int,input().split())
if n==1:
    print(abs(int(input())-x))
else:
    lis = list(map(int,input().split()))
    for i in range(n):
        lis[i] = abs(lis[i]-x)
    print(functools.reduce(gcd,lis))


Fixed submission:
from functools import reduce
from fractions import gcd
N,X=map(int,input().split())
x=[abs(X-int(i)) for i in input().split()]
print(reduce(gcd,x))

Buggy python submission (verdict: Runtime Error):
import math,functools

n,x =map(int,input().split())
if n==1:
    print(abs(int(input())-x))
else:
    lis = list(map(int,input().split()))
    for i in range(n):
        lis[i] = abs(lis[i]-x)
    print(functools.reduce(math.gcd,lis))


Fixed submission:
from functools import reduce
from fractions import gcd
N,X=map(int,input().split())
x=[abs(X-int(i)) for i in input().split()]
print(reduce(gcd,x))

Buggy python submission (verdict: Runtime Error):
import math,functools

n,x =map(int,input().split())
if n==1:
    print(abs(int(input())-x))
else:
    lis = list(map(int,input().split()))
    for i in range(n):
        lis[i] = abs(lis[i]-x)
    print(functools.reduce(math.gcd,lis))


Fixed submission:
from functools import reduce
from fractions import gcd
N,X=map(int,input().split())
x=[abs(X-int(i)) for i in input().split()]
print(reduce(gcd,x))
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = 0
for i in range(1,n+1):
  res = 0
  for j in range(i+1):
    if i % j ==0:
      res +=1
    if res == 8 :
      ans +=1

print(ans)
    

Fixed submission:
n = int(input())
ans = 0
for i in range(1,n+1,2):
  res = 0
  for j in range(1,i+1):
    if i % j == 0:
      res +=1
    if res == 8:
      ans +=1
print(ans)
Buggy python submission (verdict: Runtime Error):
top = input()
count = 0
for i in len(str(top)):
  if top[i] == 'o':
    count += 1

sum = 700 + count*100
print(sum)


Fixed submission:
top = input()
count = 0
for i in range(len(top)):
  if top[i] == 'o':
    count += 1

sum = 700 + count*100
print(sum)

Buggy python submission (verdict: Runtime Error):
top = input()
count = 0
for i in len(str(top)):
  if top[i] == 'o':
    count += 1

sum = 700 + int(count)*100
print(sum)


Fixed submission:
top = input()
count = 0
for i in range(len(top)):
  if top[i] == 'o':
    count += 1

sum = 700 + count*100
print(sum)

Buggy python submission (verdict: Runtime Error):
top = input()
count = 0
for i in len(str(top)):
  if top[i] == 'o':
    count += 1

print(count)

Fixed submission:
top = input()
count = 0
for i in range(len(top)):
  if top[i] == 'o':
    count += 1

sum = 700 + count*100
print(sum)
Buggy python submission (verdict: Runtime Error):
s= input()
print(s.replace('2017','2018')

Fixed submission:
s= input()
print(s.replace('2017','2018'))

Buggy python submission (verdict: Runtime Error):
s = input()
m = s.replace(2017,2018)
print(m)


Fixed submission:
s= input()
print(s.replace('2017','2018'))
Buggy python submission (verdict: Runtime Error):
N,Y = map(int,input().split())
if N*10000 == Y:
    print(N,0,0)
else:
    for a in range(N):
        for b in range (N+1-a):
            if a*10000+b*5000+1000*(N-a-b) == Y:
                print(a,b,N-a-b)
                break
        if a*10000+b*5000+1000*(N-a-b) == Y:
            break

if a == N-1 and  b == 1 and (N-1)*10000 + 5000 < Y:
    print(-1,-1,-1)

Fixed submission:
N,Y = map(int,input().split())
for a in range(N+1):
    for b in range (N+1-a):
        if a*10000+b*5000+1000*(N-a-b) == Y:
            print(a,b,N-a-b)
            exit()
print(-1,-1,-1)

Buggy python submission (verdict: Runtime Error):
N,Y = map(int,input().split())
if N*10000 == Y:
    print(N,0,0)
else:
    for a in range(N):
        for b in range (N-a):
            if a*10000+b*5000+1000*(N-a-b) == Y:
                print(a,b,N-a-b)
                break
        if a*10000+b*5000+1000*(N-a-b) == Y:
            break

if a == N-1 and  b == 1 and a*10000 + b*5000 < Y:
    print(-1,-1,-1)

Fixed submission:
N,Y = map(int,input().split())
for a in range(N+1):
    for b in range (N+1-a):
        if a*10000+b*5000+1000*(N-a-b) == Y:
            print(a,b,N-a-b)
            exit()
print(-1,-1,-1)

Buggy python submission (verdict: Runtime Error):
N,Y = map(int,input().split())
if N*10000 == Y:
    print(N,0,0)
else:
    for a in range(N):
        for b in range (N+1-a):
            if a*10000+b*5000+1000*(N-a-b) == Y:
                print(a,b,N-a-b)
                break
        if a*10000+b*5000+1000*(N-a-b) == Y:
            break

if a == N-1 and  b == 1 and a*10000 + b*5000 < Y:
    print(-1,-1,-1)

Fixed submission:
N,Y = map(int,input().split())
for a in range(N+1):
    for b in range (N+1-a):
        if a*10000+b*5000+1000*(N-a-b) == Y:
            print(a,b,N-a-b)
            exit()
print(-1,-1,-1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
A = Counter(list(map(int,input().split())))
keys,counts = zip(*A.most_common())
total = 0
for key,count in zip(keys,counts):
    if key > count:
        total += count
    else:
        total += count-key
print(total)

Fixed submission:
from collections import Counter
n = int(input())
A = Counter(list(map(int,input().split())))
keys,counts = zip(*A.most_common())
total = 0
for key,count in zip(keys,counts):
    if key > count:
        total += count
    else:
        total += count-key
print(total)
Buggy python submission (verdict: Runtime Error):
a = string(input())
n = 0
if a[0] == '1':
  n = n+1
if a[1] == '1':
  n = n+1
if a[2] == '1':
  n = n+1
  
print(n)

Fixed submission:
a = input()
n = 0
if a[0] == '1':
  n = n+1
if a[1] == '1':
  n = n+1
if a[2] == '1':
  n = n+1
  
print(n)

Buggy python submission (verdict: Runtime Error):
a = string(input())
n = 0
if a[0] == 1:
  n = n+1
if a[1] == 1:
  n = n+1
if a[2] == 1:
  n = n+1
  
print(n)

Fixed submission:
a = input()
n = 0
if a[0] == '1':
  n = n+1
if a[1] == '1':
  n = n+1
if a[2] == '1':
  n = n+1
  
print(n)