Buggy python submission (verdict: Runtime Error):
N = int(input())
check = []
k = int()
for i in range(2,N):
    if N % i == 0:
        k = int( N / i )
        check.append(i + k - 2)
        
print(min(check))

Fixed submission:
N = int ( input() )
check_list = []
for i in range( 1, int( N**( 1/2 )+1 ) ):
    check = 0
    if N % i == 0:
        check = i + int( N / i ) - 2
        check_list.append(check)

print( min(check_list) )

Buggy python submission (verdict: Runtime Error):
N = int(input())
check = []
k = int()
for i in range(int( N ** (1/2) ) + 2 , 2 , -1 ):
    if N % i == 0:
        k = int( N / i )
        check.append(i + k - 2)
        
print(min(check))

Fixed submission:
N = int ( input() )
check_list = []
for i in range( 1, int( N**( 1/2 )+1 ) ):
    check = 0
    if N % i == 0:
        check = i + int( N / i ) - 2
        check_list.append(check)

print( min(check_list) )

Buggy python submission (verdict: Runtime Error):
N = int(input())
check = []
k = int()
for i in range(int( N ** (1/2) ) + 1 , 2 , -1 ):
    if N % i == 0:
        k = int( N / i )
        check.append(i + k - 2)
        
print(min(check))

Fixed submission:
N = int ( input() )
check_list = []
for i in range( 1, int( N**( 1/2 )+1 ) ):
    check = 0
    if N % i == 0:
        check = i + int( N / i ) - 2
        check_list.append(check)

print( min(check_list) )

Buggy python submission (verdict: Runtime Error):
N = int(input())
divide = []
for i in range(2,int( (10**6) ) + 1):
    while( N % i == 0):
        divide.append(i)
        N = int( N/i )
    if N ==1:
        break

i = 0
check = []
while(i < len(divide)-1):
    x = 1
    a = divide[:i+1]
    for j in a:
        x= x * j
    b = divide[i+1:]
    y = 1
    for j in b:
        y = y * j
    check.append(x + y)
    i += 1
    
ans = min(check) - 2
print(ans)

Fixed submission:
N = int ( input() )
check_list = []
for i in range( 1, int( N**( 1/2 )+1 ) ):
    check = 0
    if N % i == 0:
        check = i + int( N / i ) - 2
        check_list.append(check)

print( min(check_list) )

Buggy python submission (verdict: Runtime Error):
N = int(input())
divide = []
for i in range(2,int( (10**12) ** (1/ 2) ) + 1):
    while( N % i == 0):
        divide.append(i)
        N = int( N/i )
    if N ==1:
        break

i = 0
check = []
while(i < len(divide)-1):
    x = 1
    a = divide[:i+1]
    for j in a:
        x= x * j
    b = divide[i+1:]
    y = 1
    for j in b:
        y = y * j
    check.append(x + y)
    i += 1
    
ans = min(check) - 2
print(ans)


Fixed submission:
N = int ( input() )
check_list = []
for i in range( 1, int( N**( 1/2 )+1 ) ):
    check = 0
    if N % i == 0:
        check = i + int( N / i ) - 2
        check_list.append(check)

print( min(check_list) )

Buggy python submission (verdict: Runtime Error):
from functools import reduce
from operator import mul
N = int(input())
divide = []
for i in range(2,int( (10**12) ** (1/ 2) ) + 1):
    while( N % i == 0):
        divide.append(i)
        N = int( N/i )
    if N ==1:
        break

i = 0
check = []
while(i < len(divide)-1):
    x = 1
    a = divide[:i+1]
    for j in a:
        x= x * j
    b = divide[i+1:]
    y = 1
    for j in b:
        y = y * j
    check.append(x + y)
    i += 1
    
ans = min(check) - 2
print(ans)


Fixed submission:
N = int ( input() )
check_list = []
for i in range( 1, int( N**( 1/2 )+1 ) ):
    check = 0
    if N % i == 0:
        check = i + int( N / i ) - 2
        check_list.append(check)

print( min(check_list) )

Buggy python submission (verdict: Runtime Error):
from functools import reduce
from operator import mul
N = int(input())
divide = []
for i in range(2,int( (10**12) ** (1/ 2) ) + 1):
    while( N % i == 0):
        divide.append(i)
        N = int( N/i )
    if N ==1:
        break

i = 0
check = []
while(i < len(divide)-1):
    a = divide[:i+1]
    x = reduce(mul,a)
    b = divide[i+1:]
    y = reduce(mul,b)
    check.append(x + y)
    i += 1
    
ans = min(check) - 2
print(ans)

Fixed submission:
N = int ( input() )
check_list = []
for i in range( 1, int( N**( 1/2 )+1 ) ):
    check = 0
    if N % i == 0:
        check = i + int( N / i ) - 2
        check_list.append(check)

print( min(check_list) )

Buggy python submission (verdict: Runtime Error):
from functools import reduce
from operator import mul
N = int(input())
divide = []
for i in range(2,int( (10**12) / 2 ) + 1):
    while( N % i == 0):
        divide.append(i)
        N = int( N/i )
    if N ==1:
        break

i = 0
check = []
while(i < len(divide)-1):
    a = divide[:i+1]
    x = reduce(mul,a)
    b = divide[i+1:]
    y = reduce(mul,b)
    check.append(x + y)
    i += 1
    
ans = min(check) - 2
print(ans)

Fixed submission:
N = int ( input() )
check_list = []
for i in range( 1, int( N**( 1/2 )+1 ) ):
    check = 0
    if N % i == 0:
        check = i + int( N / i ) - 2
        check_list.append(check)

print( min(check_list) )