Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
d = []
for i in range(n+1):
    d.append(int(input()))
ans = len(set(d))
print(ans)

Fixed submission:
n = int(input())
d = []
for i in range(n):
    d.append(int(input()))
ans = len(set(d))
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
d = []
for i in range(n+1):
    d.append(int(input()))
ans = len(set(d))
print(ans)

Fixed submission:
n = int(input())
d = []
for i in range(n):
    d.append(int(input()))
ans = len(set(d))
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
for i in range(n):
    d[i] = int(input())
ans = len(set(d))
print(ans)


Fixed submission:
n = int(input())
d = []
for i in range(n):
    d.append(int(input()))
ans = len(set(d))
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
for i in range(n+1):
    d[i] = int(input())
ans = len(set(d))
print(ans)


Fixed submission:
n = int(input())
d = []
for i in range(n):
    d.append(int(input()))
ans = len(set(d))
print(ans)
Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
count = 0
for i in range(n+1):
	ans = i % 10
	while (i // 10) != 0:
        ans += (i // 10)
		i = (i // 10)
	if ans >= a and ans <= b:
		count += 1
print(count)



Fixed submission:
n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
    if a <= sum(list(map(int, list(str(i))))) <= b:
        ans += i
print(ans)
Buggy python submission (verdict: Runtime Error):
int a,b
a=input()
b=input()
print(a**2-b)

Fixed submission:
a=int(input())
b=int(input())
print(a**2-b)
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
if B > N*A
	or B == N*A:
  print(N*A)
else:
  print(B)

Fixed submission:
N, A, B = map(int, input().split())
S = N*A
if B < S or B == S:
  print(B)
else:
  print(S)

Buggy python submission (verdict: Runtime Error):
N, A, B = int(input().split)
if B < N*A:
  print(B)
  else:
    (N*A)

Fixed submission:
N, A, B = map(int, input().split())
S = N*A
if B < S or B == S:
  print(B)
else:
  print(S)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

#1～nまでの数列
p = [i+1 for i in range(n)]
print(sum(p[:n-1]))


Fixed submission:
n=int(input())

#1～n-1までの数列の和
print((n-1)*n//2)
Buggy python submission (verdict: Time Limit Exceeded):
l,r = map(int,input().split())

mod_min = 10000000
chk = 10000000000

for i in range(l,r):
    for j in range(i+1,r+1):
        chk = (i*j)%2019
        if chk < mod_min:
            mod_min = chk

print(mod_min)

Fixed submission:
l,r = map(int,input().split())

chk = 0
flg = 1
i = l
mod_min = 100000

while flg:
    for j in range(i+1,r+1):
        chk = (i*j)%2019
        if chk == 0:
            print(0)
            flg = 0
            break
        elif chk < mod_min:
            mod_min = chk
    i += 1
    if i >= r-1:
        print(mod_min)
        flg = 0
Buggy python submission (verdict: Runtime Error):
import math

n,k = map(int,input().split())

def combinations_count(a, b):
    return math.factorial(a)//(math.factorial(a-b)*math.factorial(b))

if n==k:
    print(1)
    for i in range(2,k+1):
        print(0)
            
else:
    for i in range(1,k+1):
        #print(k-1,i-1)    
        #青のグループ分けの組合せ
        b_num = combinations_count(k-1,i-1)
        #赤を並べて，そこに青のグループを置く組合せ
        a_num = combinations_count(n-k+1,i)
        #出力
        print((b_num*a_num)%(10**9+7))

Fixed submission:
import math

n,k = map(int,input().split())

def combinations_count(a, b):
    return math.factorial(a)//(math.factorial(a-b)*math.factorial(b))


blue = k
#両端を除いた隙間の数
blue_sp = k-1
red = n-k
#両端を含む隙間の数
red_sp = red+1


#青をグループに分けて，赤の隙間に入れる組合せを考える
#1から
for i in range(1,blue+1):
    #print(blue_sp,i-1,":",red_sp,i)        

    #出力
    #青のグループ数が赤の隙間より多い場合
    if i > red_sp:
        print(0)
    else:       
        #青のグループ分けの組合せ(両端を除いた隙間，選択する数)
        b_num = combinations_count(blue_sp,i-1)
        #赤を並べて，そこに青のグループを置く組合せ
        a_num = combinations_count(red_sp,i)
        print((b_num*a_num)%(10**9+7))

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

n,k = map(int,input().split())

def combinations_count(a, b):
    return math.factorial(a)//(math.factorial(a-b)*math.factorial(b))

for i in range(1,k+1):
    #青のグループ分けの組合せ
    b_num = combinations_count(k-1,i-1)
    #赤を並べて，そこに青のぶるーぷを置く組合せ
    a_num = combinations_count(n-k+1,i)
    #出力
    print((b_num*a_num)%(10**9+7))

Fixed submission:
import math

n,k = map(int,input().split())

def combinations_count(a, b):
    return math.factorial(a)//(math.factorial(a-b)*math.factorial(b))


blue = k
#両端を除いた隙間の数
blue_sp = k-1
red = n-k
#両端を含む隙間の数
red_sp = red+1


#青をグループに分けて，赤の隙間に入れる組合せを考える
#1から
for i in range(1,blue+1):
    #print(blue_sp,i-1,":",red_sp,i)        

    #出力
    #青のグループ数が赤の隙間より多い場合
    if i > red_sp:
        print(0)
    else:       
        #青のグループ分けの組合せ(両端を除いた隙間，選択する数)
        b_num = combinations_count(blue_sp,i-1)
        #赤を並べて，そこに青のグループを置く組合せ
        a_num = combinations_count(red_sp,i)
        print((b_num*a_num)%(10**9+7))
Buggy python submission (verdict: Runtime Error):
a = str(input())

if (a == 'A'): 
    print('T')
elif (a == 'T):
    print('A')
elif (a == 'G'):
    print('C')
elif(a =='C'):
    print('G')
else: print("none")  
    
    
    

Fixed submission:
a = str(input())

if (a == 'A'): 
    print('T')
elif (a == 'T'):
    print('A')
elif (a == 'G'):
    print('C')
elif(a =='C'):
    print('G')
else: print("none")
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
#入力
N = map(int,input().strip().split(' '))         #モンスタ数
A = list(map(int, input().strip().split(' '))) #それぞれの体力


#最大公約数
print( reduce(lambda x, y: math.gcd(x,y), A) )

Fixed submission:
import fractions as fr
import functools as ft


N = map(int, input().split())
A = list(map(int, input().split())) # "1 2 3"と入力

cal1 = lambda x, y : fr.gcd(x, y)

print(ft.reduce(cal1, A))

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
#入力
N = map(int,input().strip().split(' '))         #モンスタ数
A = list(map(int, input().strip().split(' '))) #それぞれの体力


#最大公約数
print( reduce(lambda x, y: math.gcd(x,y), A) )

#PASS (lambda A[i], A[i-1] :math.gcd(A[i],A[i-1]), A))

Fixed submission:
import fractions as fr
import functools as ft


N = map(int, input().split())
A = list(map(int, input().split())) # "1 2 3"と入力

cal1 = lambda x, y : fr.gcd(x, y)

print(ft.reduce(cal1, A))
Buggy python submission (verdict: Runtime Error):
N, H, W = list(map(int, input().strip().split(' ')))

AB = []

cnt = 0

for i in range(N):
	AB.append(input().strip().split(' '))	#[A][B]
	

for i in range(N):
	if int(AB[i][0]) >= H:
		if int(AB[0][i]) >= W:
			cnt += 1

		
		


	
print(cnt)

Fixed submission:
N, H, W = list(map(int, input().strip().split(' ')))

AB = []

cnt = 0

for i in range(N):
	AB.append(list(map(int, input().strip().split(' '))))	#[A][B]
	
	
for i in range(N):
	if int(AB[i][0]) >= H:
			if int(AB[i][1]) >= W:
				cnt += 1

print(cnt)
Buggy python submission (verdict: Runtime Error):
def function(n,k,a):
    ind1 = a.index(1)
    pre = len(a[:ind1])
    ex = len(a[ind1:])    
    ans = -(-pre//(k-1)) + -(-ex//(k-1))
    if n == k:
        ans = 1
    return int(ans)

print(function(n,k,a))

Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))

ans = -(-(n-1)//(k-1))

print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int,input().strip().split(' '))
a_rev = ""
i = 0
j = 0
cnt = 0

#chk = []

for i in range(b - a):
    a+=1
    
    for j in range(len(str(a))):
        a_rev = a_rev + str(a)[len(str(a)) - 1 - j]   

    if str(a_rev) == str(a):
        cnt+=1
        #chk.append(a_rev)   #test
    else:
        pass
    
    a_rev =""
    
print(cnt)
#print(chk)

Fixed submission:
N = 3
c = []
i = 0

for i in range(N):
	c.append(input().strip())

out = ""

for i in range(N):
    out = out + c[i][i]
    
print(out)

Buggy python submission (verdict: Runtime Error):
N = 3
c = []
i = 0


for i in range(N):
	c.append(list(map(str, input().strip().split(' '))))	#[A][B]

print(c[0][0] + c[1][1] + c[2][2])

Fixed submission:
N = 3
c = []
i = 0

for i in range(N):
	c.append(input().strip())

out = ""

for i in range(N):
    out = out + c[i][i]
    
print(out)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

a = int(input())
b = int(input())

out = "Even"	#Even奇数,Odd偶数


if ((a * b) % 2 == 0):
	out = "Odd"

print(out)

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

if (X*Y % 2 == 0):  print("Even")
else:               print("Odd")
Buggy python submission (verdict: Runtime Error):
n,y = map(int,input().split())
 
y /= 1000
 
y10 = 0
y5 = 0
y1 = 0
 
i = 0
#i,j,k = 10000,5000,1000
while 1:
    y1 = i
    y5 = (10*n-y-9*y1)//5
    y10 = n-y5-y1
    if (10*n-y-9*y1)%5 == 0 and y10>=0 and y5>=0 and y1>=0:
        print(int(y10),int(y5),int(y1))
        break
    i += 1
    if i>n:
        print(-1,-1,-1)
        break

Fixed submission:
s = input()

if s[:4] == "2017":
    s = s.replace(s[:4],"2018")
    
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
a = list(map(int,input().split()))

#まとめる
a_set = list(set(a))

#数えてソートする
a_cnt =[0 for i in range(len(a_set))]
for i in range(len(a_set)):
    a_cnt[i] = a.count(a_set[i])
a_cnt.sort() 
#種類の数はa_setの要素数
num_typ = len(a_set)
#数が少ない数値から書き換えていく
if num_typ <= k:
    print(0)
else:
    print(sum(a_cnt[:len(a_cnt)-k]))


Fixed submission:
import collections

n,k = map(int,input().split())
a = list(map(int,input().split()))

#数える
a = collections.Counter(a)

#ソートする
a_sort = sorted(a.items(), key=lambda x:x[1])

#必要な分だけ足す
out = 0
if len(a_sort) <= k:
    print(0)
else:
    for i in range(len(a_sort)-k):
        out += a_sort[i][1]
    print(out)

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

#まとめる
a_set = list(set(a))
a_cnt =[0 for i in range(len(a_set))]
#数えてソートする
for i in range(len(a_set)):
    a_cnt[i] = a.count(a_set[i])
a_cnt.sort() 
#種類の数はa_setの要素数
num_typ = len(a_set)
#数が少ない数値から書き換えていく
if num_typ <= k:
    print(0)
else:
    print(sum(a_cnt[:len(a_cnt)-k]))


Fixed submission:
import collections

n,k = map(int,input().split())
a = list(map(int,input().split()))

#数える
a = collections.Counter(a)

#ソートする
a_sort = sorted(a.items(), key=lambda x:x[1])

#必要な分だけ足す
out = 0
if len(a_sort) <= k:
    print(0)
else:
    for i in range(len(a_sort)-k):
        out += a_sort[i][1]
    print(out)
Buggy python submission (verdict: Runtime Error):
s = input()
s_set = list(set(s))    #重複削除

s_set.sort()

chk = list("abcdefghijklmnopqrstuvwxyz")

i = 0

while 1:
    if s_set[i] != chk[i]:
        print(chk[i])
        break
    i += 1
    if i >= 26 or i>=len(s):
        print("None")
        break
    
    
    

Fixed submission:
s = input()
s_set = list(set(s))    #重複削除

s_set.sort()

chk = list("abcdefghijklmnopqrstuvwxyz")

i = 0

while 1:
    if s_set[i] != chk[i]:
        print(chk[i])
        break
    i += 1
    
    if i >= (len(s_set)):
        print(chk[i])
        break
    if i >= 25:
        print("None")
        break

Buggy python submission (verdict: Runtime Error):
s = input()
s_set = list(set(s))    #重複削除

s_set.sort()

chk = list("abcdefghijklmnopqrstuvwxyz")

i = 0

while 1:
    if s_set[i] != chk[i]:
        print(chk[i])
        break
    i +=1
    if i >= 26:
        print("None")
        break
    
    

Fixed submission:
s = input()
s_set = list(set(s))    #重複削除

s_set.sort()

chk = list("abcdefghijklmnopqrstuvwxyz")

i = 0

while 1:
    if s_set[i] != chk[i]:
        print(chk[i])
        break
    i += 1
    
    if i >= (len(s_set)):
        print(chk[i])
        break
    if i >= 25:
        print("None")
        break
Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())

cnt = 0

for x in range(k+1):
    for y in range(k+1):
        if x + y > s:
            break
        z = s-x-y
        if (z>=0) and (z <= k and x+y+z == s):
            cnt +=1
            
            
print(cnt)
    

Fixed submission:
k,s = map(int,input().split())

cnt = 0

for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if (z>=0) and (z <= k):
            cnt +=1
            
            
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())

cnt = 0

for x in range(k+1):
    for y in range(k+1):
        if x + y <= s:
            z = s-x-y
            if (z>=0) and (z <= k and x+y+z == s):
                cnt +=1
            
            
print(cnt)
    

Fixed submission:
k,s = map(int,input().split())

cnt = 0

for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if (z>=0) and (z <= k):
            cnt +=1
            
            
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())

cnt = 0

for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if z>=0 and z <= k and x+y+z == s:
            cnt +=1
            
            
print(cnt)
    

Fixed submission:
k,s = map(int,input().split())

cnt = 0

for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if (z>=0) and (z <= k):
            cnt +=1
            
            
print(cnt)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())

if sum(a,b) == c or sum(a,c) == b or sum(c,b) == a:
    print("Yes")
else:
    print("No")

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

if a+b==c or a+c==b or c+b==a:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
h,w,a,b =map(int,input().split())
mod = 10**9+7

nfact_l = [1 for i in range(h+w+1)]
def nfact_mod(n0,mod0):
    for i in range(1,len(nfact_l)):
        nfact_l[i] *= (nfact_l[i-1]*i)%mod
nfact_mod(h+w+1,mod)

#二分累乗法 あとで使う
def powfunc_mod(n0,r0,mod0):
    ans0 = 1
    r0 = bin(r0)[:1:-1]
    for i in r0:
        if i == "1":
            ans0 *= (n0 % mod0)
        n0 *= (n0 % mod0)
        ans0 %= mod0
    return ans0

nfact_inv_l = [1 for i in range(h+w+1)]
for i in range(len(nfact_inv_l)):
    nfact_inv_l[i] = powfunc_mod(nfact_l[i],mod-2,mod)

point1 = [0 for i in range(w-b)]
for i in range(len(point1)):
    #  ... = n!*r!^(p-2)*(n-r)!^(p-2) [mod]
    yoko = b+i
    tate = h-a-1
    n = yoko+tate
    r = tate
    point1[i] = (nfact_l[n]*nfact_inv_l[r]*nfact_inv_l[n-r])%mod

#point1から目的まで行く経路数
out = 0
for i in range(len(point1)):
    yoko = w-b-1+i
    tate = a-1
    n = yoko+tate
    r = tate
    out += ((((point1[i]*nfact_l[n])%mod)*nfact_inv_l[r]%mod)*nfact_inv_l[n-r])%mod

print(out)

Fixed submission:
h,w,a,b =map(int,input().split())
mod = 10**9+7

#階乗を求める
fact_l = [1 for i in range(h+w+1)]
for i in range(1,len(fact_l)):
    fact_l[i] *= (fact_l[i-1]*i)%mod

#逆元
factinv_l = [1 for i in range(h+w+1)]
for i in range(1,len(fact_l)):
    factinv_l[i] = pow(fact_l[i],mod-2,mod)
    
#必ず通るポイントまでの組み合わせ
point1 = [1 for i in range(w-b)]
for i in  range(len(point1)):
    yoko = b+i 
    tate = h-a-1
    n = yoko+tate
    r = yoko
    point1[i] = fact_l[n]*factinv_l[r]*factinv_l[n-r]%mod

#point1からの経路
out = 0
for i in range(len(point1)):
    yoko = w-b-i-1
    tate = a-1
    n = yoko+tate
    r = yoko
    case = fact_l[n]*factinv_l[r]*factinv_l[n-r]%mod
    out += (point1[i]*case)%mod
print(out%mod)

Buggy python submission (verdict: Time Limit Exceeded):
import math
def nCr(n,r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))

h,w,a,b=map(int,input().split())
amari = 10**9+7

#1.境界まで行く順路のパターン数を求める
l1 = [0 for i in range(w-b)]
for i in range(len(l1)):
    l1[i]=nCr((h-a-1)+b+i,b+i)
#2.境界の1コ下からゴールまで行く順路のパターン数を求める
l2 = [0 for i in range(w-b)]
for i in range(len(l2)):
    l2[i]=nCr((a-1)+(w-b-i-1),a-1)

out= 0 
for i,j in zip(l1,l2):
    #print(i*j)
    out += i*j

print(out%amari)

Fixed submission:
h,w,a,b =map(int,input().split())
mod = 10**9+7

#階乗を求める
fact_l = [1 for i in range(h+w+1)]
for i in range(1,len(fact_l)):
    fact_l[i] *= (fact_l[i-1]*i)%mod

#逆元
factinv_l = [1 for i in range(h+w+1)]
for i in range(1,len(fact_l)):
    factinv_l[i] = pow(fact_l[i],mod-2,mod)
    
#必ず通るポイントまでの組み合わせ
point1 = [1 for i in range(w-b)]
for i in  range(len(point1)):
    yoko = b+i 
    tate = h-a-1
    n = yoko+tate
    r = yoko
    point1[i] = fact_l[n]*factinv_l[r]*factinv_l[n-r]%mod

#point1からの経路
out = 0
for i in range(len(point1)):
    yoko = w-b-i-1
    tate = a-1
    n = yoko+tate
    r = yoko
    case = fact_l[n]*factinv_l[r]*factinv_l[n-r]%mod
    out += (point1[i]*case)%mod
print(out%mod)
Buggy python submission (verdict: Runtime Error):
[s,t]=input().split();
cnt = 0;
for i in range(len(s)):
    if s[i] != t[i] :
        cnt=cnt+1;
print(cnt);


Fixed submission:
#[s,t]=input().split();
s=input();
t=input();
cnt = 0;
for i in range(len(s)):
    if s[i] != t[i] :
        cnt=cnt+1;
        
print(cnt);

Buggy python submission (verdict: Runtime Error):
[s,t]=input().split();

cnt = 0;
for i in range(len(s)):
    if s[i] != t[i] :
        cnt=cnt+1;
        
print(cnt);

Fixed submission:
#[s,t]=input().split();
s=input();
t=input();
cnt = 0;
for i in range(len(s)):
    if s[i] != t[i] :
        cnt=cnt+1;
        
print(cnt);
Buggy python submission (verdict: Runtime Error):
S=input();
K=input();
i = 0;
for i in range(len(S)) :
    if int(S[i]) > 1 :
        print(S[i]);
        break;
    elif i + 1 >= K :
        print(1);


Fixed submission:
S=input();
K=input();
i = 0;
for i in range(len(S)) :
    if int(S[i]) > 1 :
        print(S[i]);
        break;
    elif i + 1 >= int(K) :
        print(1);
        break;

Buggy python submission (verdict: Runtime Error):
S=input();
K=input();
i = 0;
for i in range(len(S)) :
    if int(S[i]) > 1 :
        print(S[i]);
        break;
    elif i + 1 >= K :
        print(1);


Fixed submission:
S=input();
K=input();
i = 0;
for i in range(len(S)) :
    if int(S[i]) > 1 :
        print(S[i]);
        break;
    elif i + 1 >= int(K) :
        print(1);
        break;

Buggy python submission (verdict: Runtime Error):
import math;
S=input();
K=input();
i = 0;
for i in range(len(S)) :
    if int(S[i]) > 1 :
        print(S[i]);
        break;
    elif i >= K :
        print(1);


Fixed submission:
S=input();
K=input();
i = 0;
for i in range(len(S)) :
    if int(S[i]) > 1 :
        print(S[i]);
        break;
    elif i + 1 >= int(K) :
        print(1);
        break;
Buggy python submission (verdict: Runtime Error):
price = [int(x) for x in input().split()];
N = int(input());
price_d = price[3];
price_s = 2*price[2];
price_h = 4*price[1];
price_q = 8*price[0];
p = min([price_q,price_h,price_s]);
if price_d < p :
    if N%2 == 1 :
        ans = (N-1)//2*price_d + p//2;
    else :
        ans = N//2*price_d;
else :
    ans = N*p//2;

print(ans));



Fixed submission:
price = [int(x) for x in input().split()];
N = int(input());
price_d = price[3];
price_s = 2*price[2];
price_h = 4*price[1];
price_q = 8*price[0];
p = min([price_q,price_h,price_s]);
if price_d < p :
    if N%2 == 1 :
        ans = (N-1)//2*price_d + p//2;
    else :
        ans = N//2*price_d;
else :
    ans = N*p//2;

print(ans);
Buggy python submission (verdict: Runtime Error):
N,T = map(int,input().split());
t = [int(x) for x in input().split()];

end = 0;
ans = 0;
for i in range(N) :
    if end > t[i] :
        ans += t[i] + T - end;
        else :
        ans += T;
    end += t[i] + T;
    #print(ans,end);

print(ans); 

Fixed submission:
N,T = map(int,input().split());
t = [int(x) for x in input().split()];

end = 0;
ans = 0;
for i in range(N) :
    if end > t[i] :
        ans += t[i] + T - end;
    else :
        ans += T;
    end = t[i] + T;
    #print(ans,end);

print(ans);
Buggy python submission (verdict: Runtime Error):
lenght = int(input())

x = list(map(int,input().split()))

for i in range(lenght-1):
  x[i+1] = x[i] * x[i+1]
if x[-1] > 1e18:
  x[-1] = -1
print(x[-1])

Fixed submission:
x = list(map(int,input().split()))
result = x[0]*x[1]
print(result)

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

x = list(map(int,input().split()))

でf

first_val = x[0]
for i in range(lenght-1):
  first_val *= x[i+1]

if first_val > 1e18:
  first_val = -1

print(first_val)

Fixed submission:
x = list(map(int,input().split()))
result = x[0]*x[1]
print(result)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N,K,Q = [int(i) for i in input().split()]
mem_point = np.array([K for i in range(N)])
_points = np.array([-1 for i in range(N)])
for rounds in range(Q):
  anser = int(input())
  temp = _points.copy()
  temp[anser-1] = 0
  mem_point += temp
for point in mem_point:
  if 0 < point:
    print("Yes")
  else:
    print("No")


Fixed submission:
S = input()
check = ["Sunny", "Cloudy", "Rainy"]
if "Sunny" == S:
  print("Cloudy")
elif "Cloudy" == S:
  print("Rainy")
else:
  print("Sunny")
Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q = [int(i) for i in input().split()]
mem_point = [K for i in range(N)]
_points = [-1 for i in range(N)]


for rounds in range(Q):
  temp = _points.copy()
  anser = int(input())
  temp[anser-1] = 0
  mem_point = list(map(lambda x,y:x+y,mem_point,temp))
  
for point in mem_point:
  if 0 < point:
    print("Yes")
  else:
    print("No")


Fixed submission:
N,K,Q = [int(i) for i in input().split()]
mem_point = [K-Q for i in range(N)]


for rounds in range(Q):
  temp = int(input())
  mem_point[temp-1] += 1 
  
for point in mem_point:
  if 0 < point:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q = [int(i) for i in input().split()]
mem_point = [K for i in range(N)]
for rounds in range(Q):
  anser = int(input())
  for i in range(len(mem_point)):
    if anser == (i+1):
      pass
    else:
      mem_point[i] -= 1
      
for point in mem_point:
  if point > 0:
    print("Yes")
  else:
    print("No")

Fixed submission:
N,K,Q = [int(i) for i in input().split()]
mem_point = [K-Q for i in range(N)]


for rounds in range(Q):
  temp = int(input())
  mem_point[temp-1] += 1 
  
for point in mem_point:
  if 0 < point:
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
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

def dfs(a, x, y):
  if len(x)+len(y)==len(a):
    if len(x)==0 or len(y)==0:
      a_ = a[0]
      for i in range(1, len(a)):
        a_ *= a[i]
      return a_ + 1
    else:
      x_ = x[0]
      y_ = y[0]
      for i in range(1, len(x)):
        x_ *= x[i]
      for i in range(1, len(y)):
        y_ *= y[i]
      return x_ + y_
  res1 = dfs(a, x + [a[len(x)+len(y)]], y)
  res2 = dfs(a, x, y + [a[len(x)+len(y)]])
  return min(res1, res2)

n = int(input())
primes = prime_factorize(n)
print(dfs(primes, [], [])-2)

Fixed submission:
n = int(input())
ans = n - 1
for i in range(1, int(n**0.5)+2):
  if n%i!=0:
    continue
  ans = min(ans, i + n//i - 2)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
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

def dfs(a, x, y):
  if len(x)+len(y)==len(a):
    if len(x)==0 or len(y)==0:
      a_ = a[0]
      for i in range(1, len(a)):
        a_ *= a[i]
      return a_ + 1
    else:
      x_ = x[0]
      y_ = y[0]
      for i in range(1, len(x)):
        x_ *= x[i]
      for i in range(1, len(y)):
        y_ *= y[i]
      return x_ + y_
  res1 = dfs(a, x + [a[len(x)+len(y)]], y)
  res2 = dfs(a, x, y + [a[len(x)+len(y)]])
  return min(res1, res2)

n = int(input())
primes = prime_factorize(n)
print(dfs(primes, [], [])-2)

Fixed submission:
n = int(input())
ans = n - 1
for i in range(1, int(n**0.5)+2):
  if n%i!=0:
    continue
  ans = min(ans, i + n//i - 2)
print(ans)