Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = [input() for _ in range(N)]

B = 0

for i in range(N):
    B += 1
    for j in range(1,N-1):
        if i == j+1:
            break
        if S[i] == S[i-j]:
            B -= 1
            break

print(B)


Fixed submission:
N = int(input())
S = [input() for _ in range(N)]

S_set = list(set(S))



print(len(S_set))
Buggy python submission (verdict: Runtime Error):
N = int(input())
M = int(input())

A = [input()for i in range(M)]

x = N
#残り日数
for j in range(M):
    x = x - int(A[j])
    j += 1

if x < 0 :
    print(-1)

else :
    print(x)


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


A = list(map(int,input().strip().split()))

x = int(N)
#残り日数
for j in range(int(M)):
    x = x - int(A[j])
    j += 1

if x < 0 :
    print(-1)

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

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


Fixed submission:
S, T = input().split()
A, B = map(int, input().split())
U = input()
 
if U == S:
  A -= 1
if U == T:
  B -= 1

print(A, B)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
S = list(set(A))
if len(A) == len(S):
  return "YES"
else:
  return "NO"

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

if len(A) == len(S):
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))

res = 0
for i in range(N):
  for j in range(i):
    if P[i] <= P[j]:
      continue
    else:
      break
  else:
    res += 1
print(res)

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

res = 1
minp = P[0]
for p in P[1:]:
  if p < minp:
    minp = p
    res += 1
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from fractions import gcd
N = int(input())
A = list(map(int, input().split()))
MOD = 10**9+7
def lcm (x,y):
  return (x//gcd(x,y))*y

p = A[0]
for a in A[1:]:
  p = lcm(p, a)

ans = 0
for a in A:
  ans += p//a
print(ans % MOD)


Fixed submission:
from fractions import gcd
N = int(input())
A = list(map(int, input().split()))
MOD = 10**9+7
def lcm (x,y):
  return x*y//gcd(x,y)
 
p = A[0]
for a in A[1:]:
  p = lcm(p, a)
 
ans = 0
for a in A:
  ans += p//a
print(ans % MOD)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

half=[]
for i in range(N):
  half.append(abs(sum(A[:i])-sum(A[i:])))
print(min(half))

Fixed submission:
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))

acum = np.cumsum(A)

print(int(min(abs(acum-(sum(A)/2)))*2))
Buggy python submission (verdict: Runtime Error):
N=int(input())
if N>81:
    print("No")
else: 
    if N in (1,2,3,4,5,6,7,8,9,10,12,14,15,16,18,20,21,24,25,27,28,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())
if A>9 or A<1:
    print("{}".format(-1))
else:
    if B>9 or B<1:
        print("{}".format(-1))
    else:
        print("{}".format(A*B))

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


Fixed submission:
A,B=map(int, input().split())
if A>9 or A<1:
    print("{}".format(-1))
else:
    if B>9 or B<1:
        print("{}".format(-1))
    else:
        print("{}".format(A*B))

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

Fixed submission:
A,B=map(int, input().split())
if A>9 or A<1:
    print("{}".format(-1))
else:
    if B>9 or B<1:
        print("{}".format(-1))
    else:
        print("{}".format(A*B))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,K,Q=map(int,input().split(' '))
A=[]
for i in range(Q):
  A.append(int(input()))
  
scores=np.array([K for x in range(N)])
for x in A:
  scores-=1
  scores[x-1]+=1

for xx in scores:
  if xx>0:
    print('Yes')
  else:
    print('No')


Fixed submission:
import numpy as np
import collections

N,K,Q=map(int,input().split(' '))
A=[]
for i in range(Q):
  A.append(int(input()))

c = collections.Counter(A)
for i in range(1,N+1):
  if K+c[i]-Q>0:
    print('Yes')
  else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,K,Q=map(int,input().split(' '))
A=[]
for i in range(Q):
  A.append(int(input()))
  
scores=np.array([K for x in range(N)])
for x in A:
  scores-=1
  scores[x-1]+=1

for i,xx in enumerate(scores):
  if xx>0:
    print('Yes')
  else:
    print('No')


Fixed submission:
import numpy as np
import collections

N,K,Q=map(int,input().split(' '))
A=[]
for i in range(Q):
  A.append(int(input()))

c = collections.Counter(A)
for i in range(1,N+1):
  if K+c[i]-Q>0:
    print('Yes')
  else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import copy
N=int(input())
A=[]
for i in range(N):
  A.append(int(input()))

for i,x in enumerate(A):
  A_=copy.copy(A)
  del A_[i]
  print(max(A_))

Fixed submission:
import numpy as np
N=int(input())
A=[]
for i in range(N):
  A.append(int(input()))

lenA=len(A)
Amax=max(A)
ind=A.index(Amax)
del A[ind]
Amax2=max(A)

AA=np.repeat(Amax,lenA, axis=0)
AA[ind]=Amax2
for x in AA:
  print(x)
Buggy python submission (verdict: Runtime Error):
L,R=map(int,input().split(' '))
l,r=L%2019,R%2019
D=R-L
d=r-l
if D<2019:
  if D==d:
    if 
    print( (l*(l+1))%2019 )
  else:
    print(0)
else:
  print(0)

Fixed submission:
import numpy as np
L,R=map(int,input().split(' '))
l,r=L%2019,R%2019
D=R-L
d=r-l
if D<2019:
  if D==d:
    res=[]
    for i in range(L,R+1):
      for j in range(i+1,R+1):
        res.append((i*j)%2019)
    print(min(res))
  else:
    print(0)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
S=list(input())
N=len(S)
flg=0
for i in range(S-1):
  if S[i]==S[i+1]:
    print("Bad")
    break
if flg:
  print("Good")

Fixed submission:
S=list(input())
N=len(S)
flg=1
for i in range(N-1):
  if S[i]==S[i+1]:
    print("Bad")
    flg=0
    break
if flg:
  print("Good")
Buggy python submission (verdict: Runtime Error):
T=list(map(int,input().split(' '))).sort()
print(sum(T[-1]))


Fixed submission:
T=list(map(int,input().split(' ')))
T.sort()
print(sum(T[:2]))
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split(' '))
sum_=[0]*N
for i in range(M):
  LR=list(map(int,input().split(' ')))
  for j in range(LR[0]-1,LR[1]):
    sum_[j]+=1

from collections import Counter
c=Counter(sum_)
print(c[M])


Fixed submission:
import numpy as np
N,M=map(int,input().split(' '))
LR=[list(map(int,input().split(' '))) for i in range(M)]
LR=np.array(LR)

if min(LR[:,1])-max(LR[:,0])+1>0:
  print(min(LR[:,1])-max(LR[:,0])+1)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
s = int(input())

def calc(n):
  if n % 2:
    return 3 * n + 1
  else:
    return n // 2

if s == 1 or s == 2 or s == 4:
  print(4)
else:
  count = 1
  while s != 4:
    s = calc(s)
    count += 1

print(count + 3)

Fixed submission:
s = int(input())

def calc(n):
  if n % 2:
    return 3 * n + 1
  else:
    return n // 2

if s == 1 or s == 2 or s == 4:
  print(4)
else:
  count = 1
  while s != 4:
    s = calc(s)
    count += 1
  print(count + 3)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input())
print(max([A + B, A - B, A * B]))

Fixed submission:
A, B = map(int, input().split())
print(max(A + B, A - B, A * B))
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
num = int(input())
s = list(map(int,input().split()))
res = 1
for i in s:
    res *= i
    
if res <= 10 ** 18:    
    print(res)
else:
    print(-1)
    


Fixed submission:
# coding: utf-8
# Your code here!
num = int(input())
s = list(map(int,input().split()))
res = 1
for i in s:
    res *= i
    if res >= 10 ** 18:
        break

if 0 in s:
    print(0)
elif res <= 10 ** 18:    
    print(res)
else:
    print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
num = int(input())
s = list(map(int,input().split()))
res = 1
for i in s:
    res *= i
    
if res <= 10 ** 18:    
    print(res)
else:
    print(-1)
    

Fixed submission:
# coding: utf-8
# Your code here!
num = int(input())
s = list(map(int,input().split()))
res = 1
for i in s:
    res *= i
    if res >= 10 ** 18:
        break

if 0 in s:
    print(0)
elif res <= 10 ** 18:    
    print(res)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8

num = int(input())
from sympy import sieve
prime_list = [i for i in sieve.primerange(2,num + 1)]
from sympy import nextprime
if num in prime_list:
    print(nextprime(num - 1))
else:
    print(nextprime(num))

Fixed submission:
# coding: utf-8

import math

def get_primenumber(number):
    prime_list = []
    
    search_list = list(range(2,number+1))
    while True:
      
      if search_list[0] > math.sqrt(number):
        
        prime_list.extend(search_list)
        break
      else:
        
        head_num = search_list[0]
        prime_list.append(head_num)
        
        search_list.pop(0)
        
        search_list = [num for num in search_list if num % head_num != 0]
    return max(prime_list)

    
a = int(input())
r_before = get_primenumber(a)
s_after = get_primenumber(a)
count = a + 1
if a != r_before:
    while r_before == s_after:
        s_after = get_primenumber(count)
        count += 1
    
print(s_after)
Buggy python submission (verdict: Runtime Error):
import math

def least_common_multiple(x,y):
    return int((x * y) / math.gcd(x, y))
    
a,b = map(int,input().split(" "))

print(least_common_multiple(a,b))




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

import fractions
def lcm(x, y):
    return (x * y) / fractions.gcd(x,y)
    
print(int(lcm(a, b)))

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

def least_common_multiple(x,y):
    return (x * y) / math.gcd(x, y)
    
a,b = map(int,input().split(" "))

print(int(least_common_multiple(a,b)))


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

import fractions
def lcm(x, y):
    return (x * y) / fractions.gcd(x,y)
    
print(int(lcm(a, b)))

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

def least_common_multiple(x,y):
    return (x * y) / math.gcd(x, y)
    
a,b = map(int,input().split(" "))

print(int(least_common_multiple(a,b)))

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

import fractions
def lcm(x, y):
    return (x * y) / fractions.gcd(x,y)
    
print(int(lcm(a, b)))
Buggy python submission (verdict: Runtime Error):
uantity = int(input())
block = list(map(int,input().rstrip().split(" ")))

print(block)

num = 1
for i in block:
    if i == num:
        num += 1

if num == 1:
    print(0)
else:
    print(quantity - num + 1)
    

Fixed submission:
quantity = int(input())
block = list(map(int,input().rstrip().split(" ")))

num = 1
for i in block:
    if i == num:
        num += 1

if num == 1:
    print(-1)
else:
    print(quantity - num + 1)
Buggy python submission (verdict: Runtime Error):
line = input()
line = list(line)

count = 0
for i in line:
	if i == "1":
      count += 1
      
print(count)


Fixed submission:
line = input()
line = list(line)

count = 0
for i in line:
    if i == "1":
        count += 1
        
print(count)
Buggy python submission (verdict: Runtime Error):
X,N = map(int,input().split())
if N==0:
    print(X)
    exit()
P = [int(i) for i in input().split()]
ans = X+10
tmp = []
P2 = [int(i) for i in range(min(P),max(P)+1)]
P3 = list(set(P2)-set(P))

for i in P3:
    if ans > abs(X-i):
        ans = abs(X-i)
        tmp.append(i)
print(max(tmp))

Fixed submission:
X,N = map(int,input().split())
if N==0:
    print(X)
    exit()
P = [int(i) for i in input().split()]

ans = X+10
tmp = []
P2 = [int(i) for i in range(-200,200)]
P3 = list(set(P2)-set(P))
P3.sort()
P3[::-1]
for i in P3:
    if ans > abs(X-i):
        ans = abs(X-i)
        tmp.append(i)
print(max(tmp))
Buggy python submission (verdict: Runtime Error):
A,V= map(int,input().split())
B,W= map(int,input().split())
T = int(input())

if V!=W and  abs(A-B)/(V-W) <= T:
    ans = "YES"
elif A==B:
    ans = "YES"
elif A!=B and V==W:
    ans ="NO"
print(ans)


Fixed submission:
A,V= map(int,input().split())
B,W= map(int,input().split())
T = int(input())
if A < B and A + T* V >=B+ T* W:
    ans = "YES"
elif B < A and A -T* V <=B- T* W:
    ans = "YES"
else:
    ans ="NO"
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(j) for j in input().split()]
from collections import Counter

A_C =Counter(A)
A_C = sorted(A_C.items(),key=lambda x:x[0])

result = 1
for a in A_C:
    if a[0]==0:
        print(0)
        exit()
    result*=(a[0]**a[1])

if result >10**18:
    print(-1)
else:
    print(result)

Fixed submission:
N = int(input())
A = [int(j) for j in input().split()]
from collections import Counter

A_C =Counter(A)
A_C = sorted(A_C.items(),key=lambda x:-x[0])

if 0 == A_C[-1][0]:
    print(0)
    exit()
    
result = 1
for a in A_C:
    result*=(a[0]**a[1])

    if result >10**18:
        print(-1)
        exit()

print(result)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(j) for j in input().split()]
result = 1

for a in A:
    result *=a


if result >10**18:
    print(-1)
else:
    print(result)

Fixed submission:
N = int(input())
A = [int(j) for j in input().split()]
from collections import Counter

A_C =Counter(A)
A_C = sorted(A_C.items(),key=lambda x:-x[0])

if 0 == A_C[-1][0]:
    print(0)
    exit()
    
result = 1
for a in A_C:
    result*=(a[0]**a[1])

    if result >10**18:
        print(-1)
        exit()

print(result)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(j) for j in input().split()]
import functools
import operator

result = functools.reduce(operator.mul, A)
if result >10**18:
    print(-1)
else:
    print(result)

Fixed submission:
N = int(input())
A = [int(j) for j in input().split()]
from collections import Counter

A_C =Counter(A)
A_C = sorted(A_C.items(),key=lambda x:-x[0])

if 0 == A_C[-1][0]:
    print(0)
    exit()
    
result = 1
for a in A_C:
    result*=(a[0]**a[1])

    if result >10**18:
        print(-1)
        exit()

print(result)
Buggy python submission (verdict: Runtime Error):
# ABC 167 C
N,M,X = map(int,input().split())
C =[]
for m in range(N):
    C.append([int(i) for i in input().split()])
C.sort(key=lambda x:x[0])

from itertools import combinations
import numpy as np

ans = 10**5 +1

for m in range(1,M+1):
    P=list(combinations(C,m))
    tmp =np.sum(P,axis=1)
    if ans < tmp[0,0]:
        print(ans)
        exit()
    elif min(tmp[0,1:])>=X and ans > tmp[0,0]:
        ans = tmp[0,0]


if min(tmp[0,1:])<X:
    print(-1)
else:
    print(ans)


Fixed submission:
N,M,X =map(int,input().split())
A =[]
for m in range(N):
    A.append([int(j) for j in input().split()])
ans = 10**10
import numpy as np
from itertools import product,compress
for i in list(product([True,False],repeat=N)):
    tmp = np.sum(list(compress(A, i)),axis=0)
    if type(tmp)!=np.float64:
    	if tmp[0]< ans and min(tmp[1:])>=X:
            ans =tmp[0]
if ans ==10**10:
    print(-1)
else:
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# ABC 163
N =int(input())
A =[int(j) for j in input().split()]
memo = dict()
for i in set(A):
    memo[str(i)]=A.count(i)
    
for i in range(1,N+1):
    if str(i) in memo.keys():
        print(memo[str(i)])
    else:
        print(0)

Fixed submission:
# ABC 163
N =int(input())
A =[int(j) for j in input().split()]
memo = [0] * N

for a in A:
    memo[a -1]+=1
for i in memo:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
# ABC 163
N =int(input())
A =[int(j) for j in input().split()]
for i in range(1,N+1):
    print(A.count(i))

Fixed submission:
# ABC 163
N =int(input())
A =[int(j) for j in input().split()]
memo = [0] * N

for a in A:
    memo[a -1]+=1
for i in memo:
    print(i)
Buggy python submission (verdict: Runtime Error):
# ABC 162

A = int(input())
# 最小公倍数
ans = 0
import math


for i in range(1,A+1):
    for j in range(1,A+1):
        for k in range(1,A+1):
            ans += gcd(gcd(i,j),k)
print(ans)

Fixed submission:
A = int(input())
# 最小公倍数
ans = 0
from math import gcd


for i in range(1,A+1):
    for j in range(1,A+1):
        for k in range(1,A+1):
            ans += gcd(gcd(i,j),k)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# ABC 162

# https://note.nkmk.me/python-gcd-lcm/
A = int(input())
# 最小公倍数
ans = 0
from fractions import gcd
from functools import reduce

def Ngcd(*numbers):
    return reduce(gcd, numbers)
d = dict()

for i in range(1,A+1):
    for j in range(1,A+1):
        for k in range(1,A+1):
            tmp = ','.join(list(map(str,sorted([i,j,k]))))
            if tmp in d.keys():
                ans +=d[tmp]
            else:
                min_bai = Ngcd(i,j,k)
                d[tmp] = min_bai
                ans += min_bai
print(ans)

Fixed submission:
A = int(input())
# 最小公倍数
ans = 0
from math import gcd


for i in range(1,A+1):
    for j in range(1,A+1):
        for k in range(1,A+1):
            ans += gcd(gcd(i,j),k)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):

A,B,M =map(int,input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
x = []
for m in range(M):
    x.append([int(i) for i in input().split()])
_min = 10**7
for i in range(len(a)):
	for j in range(len(b)):
		_min = min(a[i]+b[j],_min)

for i in x:
    _min = min( (a[i[0]-1]+b[i[1]-1] - i[2]),_min)
print(_min)

Fixed submission:

A,B,M =map(int,input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
x = []
for m in range(M):
    x.append([int(i) for i in input().split()])
_min = min(a)+min(b)
		
for i in x:
    _min = min( (a[i[0]-1]+b[i[1]-1] - i[2]),_min)
print(_min)

Buggy python submission (verdict: Runtime Error):

A,B,M =map(int,input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
x = []
for m in range(M):
    x.append([int(i) for i in input().split()])
_min = 10**7
for i in range(len(a)):
    _min = min(a[i]+b[i],_min)

for i in x:
    _min = min( (a[i[0]-1]+b[i[1]-1] - i[2]),_min)
print(_min)

Fixed submission:

A,B,M =map(int,input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
x = []
for m in range(M):
    x.append([int(i) for i in input().split()])
_min = min(a)+min(b)
		
for i in x:
    _min = min( (a[i[0]-1]+b[i[1]-1] - i[2]),_min)
print(_min)
Buggy python submission (verdict: Time Limit Exceeded):
# ABC 153 D
H = int(input())
def del_jug(L):
    return set(L) !=set([1])

cnt=0
L = [H]
while  del_jug(L):
    
    H = int(L[-1]/2)
    L.append(H)
    L.append(H)
    L =sorted(L)
    
    L.pop(-1)
    
    cnt+=1
    
print(cnt+len(L))

Fixed submission:
from sys import setrecursionlimit
setrecursionlimit(1000000)

H = int(input())

def f(n):
    if n ==1:
        return 1
    else:
        return  2*f(n//2) +1
    
print(f(H))
Buggy python submission (verdict: Time Limit Exceeded):
#ABC 151 
N,M = map(int,input().split())
p = []
for i in range(M):
    p.append([str(j) for j in input().split()])
    
pena = 0
acc = 0
acc_list =[]
for m in range(M):
    for i in set([i[0] for i in p]):
        if i not in acc_list:
            if p[m][1]=='AC':
                acc_list.append(i)
                acc+=1
            else:
                pena+=1
print(str(acc) +" "+str(pena))  

Fixed submission:

N,M = map(int,input().split())
PS =[""]*N
PS2 =[0]*N

PENALTY = 0
AC = 0
for m in range(M):
    p,s = map(str,input().split())
    p=int(p)-1
    if PS[p]!="AC" and s=="WA":
        PS2[p]+=1
    elif PS[p]!="AC" and s=="AC":
        AC+=1
        PENALTY+=PS2[p]
        PS[p]="AC"
        
print(AC,PENALTY)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = (input())
from operator import itemgetter
from itertools import combinations
L = [int(i) for i in range(N)]
memo = []
for i in list(combinations(L,3)):
    memo.append(itemgetter(*i)(S))
print(len(set(memo)))

Fixed submission:
N = int(input())
S = list((input()))
L = [str(i) for i in range(0,10)]
ALL =[]
for i in L:
    for j in L:
        for k in L:
            ALL.append(i+j+k)
cnt=0    
for a in ALL:
    try:
        
        I1 = S.index(a[0])
        I2 = S[I1+1:].index(a[1])+len(S[:I1+1])
        I3 = S[I2+1:].index(a[2])+len(S[:I2+1])

        if I1<I2 and I2<I3:
            cnt+=1
    except:
        continue
print(cnt)
Buggy python submission (verdict: Runtime Error):
#ABC 144 C - Walk on Multiplication Table
N = int(input())

import math 
def get_prime(n):
    
    if n <=1:
        return []
    prime = [2]
    limit = int(math.sqrt(n))
    
    # 奇数のリストを作成
    data = [i+1 for i in range(2,n,2)]
    while limit > data[0]:
        prime.append(data[0])
        data = [j for j in data if j % data[0] !=0]
    return prime + data
from itertools import combinations
import functools
import operator
P = get_prime(N)
m = N+1
memo = []
for i in range(1,len(P)+1):
    L1 = list(combinations(P,i))
    L1 = [list(l) for l in L1]
    for l in L1:
        if l not in memo:
            memo.append(l)
            s1 = functools.reduce(operator.mul,l)
            s2 = N/s1
            if s1+s2 <=m:
                m = s1+s2
print(int(m-2))

Fixed submission:
N = int(input())
ans = N*3
for i in range(1,int(N**0.5)+1):
    if N%i==0:
        s1 = i
        s2 =N/i
        
        if ans > s1+s2:
            ans =int(s1+s2)
print(ans-2)

Buggy python submission (verdict: Time Limit Exceeded):
#ABC 144 C - Walk on Multiplication Table
N = int(input())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
from itertools import combinations
import functools
import operator
P = prime_factorize(N)
m = N+1
memo = []
for i in range(1,len(P)+1):
    L1 = list(combinations(P,i))
    L1 = [list(l) for l in L1]
    for l in L1:
        if l not in memo:
            memo.append(l)
            s1 = functools.reduce(operator.mul,l)
            s2 = N/s1
            if s1+s2 <=m:
                m = s1+s2
print(int(m-2))

Fixed submission:
N = int(input())
ans = N*3
for i in range(1,int(N**0.5)+1):
    if N%i==0:
        s1 = i
        s2 =N/i
        
        if ans > s1+s2:
            ans =int(s1+s2)
print(ans-2)
Buggy python submission (verdict: Time Limit Exceeded):
# ABC 142 C 
N = int(input())
A = [int(j) for j in input().split()]
ans =""
for i in range(1,N+1):
    ans += str(A.index(i)+1)+" "
print(ans)

Fixed submission:
N = int(input())
A =[int(a) for a in input().split()]
AL=[]
for i,a in enumerate(A):
    AL.append([i+1,a])
AL.sort(key=lambda x:x[1])
AL = [a[0]for a in AL]
ans =""
for a in AL:
    ans+=str(a)+" "
print(ans)
Buggy python submission (verdict: Runtime Error):
#ABC 141 C  Attack Survival
N,K,Q= map(int,input().split())
A=[K-Q]*N
for i in range(1,Q+1):
    A[int(input())]+=1
for a in A:
    if a < 1:
        print('No')
    else:
        print('Yes')

Fixed submission:
#ABC 141 C  Attack Survival
N,K,Q= map(int,input().split())
A=[K-Q]*N
for i in range(Q):
    A[int(input())-1]+=1
for a in A:
    if a < 1:
        print('No')
    else:
        print('Yes')