Buggy python submission (verdict: Runtime Error):
from math import sqrt, inf

a = []


def dis(n):
    for i in range(1, int(sqrt(n)) + 1):
        if n % i == 0: a.append(i)


num = int(input())
dis(num)
ans = 100000000
for e in a:
    ans = min(ans, e + num // e - 2)
print(ans)

Fixed submission:
def solve(n):
    ans = int(1e12)
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0 and i + n // i - 2 < ans:
            ans = i + n // i - 2
    return int(ans)


num = int(input())
print(solve(num))

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

a = []


def dis(n):
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            a.append(int(i))


num = int(input())
dis(num)
ans = inf
for e in a:
    if e + num // e - 2 < ans:
        ans = e + num // e - 2
    # ans = min(ans, e + num / e - 2)
print(int(ans))


Fixed submission:
def solve(n):
    ans = int(1e12)
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0 and i + n // i - 2 < ans:
            ans = i + n // i - 2
    return int(ans)


num = int(input())
print(solve(num))

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

a = []


def dis(n):
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            a.append(int(i))


num = int(input())
dis(num)
ans = inf
for e in a:
    if e + num / e - 2 < ans:
        ans = e + num / e - 2
    # ans = min(ans, e + num / e - 2)
print(int(ans))


Fixed submission:
def solve(n):
    ans = int(1e12)
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0 and i + n // i - 2 < ans:
            ans = i + n // i - 2
    return int(ans)


num = int(input())
print(solve(num))

Buggy python submission (verdict: Runtime Error):
from math import sqrt, inf

a = []


num = int(input())
for i in range(1, int(num ** 0.5) + 1):
    if num % i == 0:
        a.append(int(i))
ans = inf
for e in a:
    ans = min(ans, e + num / e - 2)
print(int(ans))


Fixed submission:
def solve(n):
    ans = int(1e12)
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0 and i + n // i - 2 < ans:
            ans = i + n // i - 2
    return int(ans)


num = int(input())
print(solve(num))

Buggy python submission (verdict: Runtime Error):
from math import sqrt, inf

a = []


def dis(n):
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            a.append(int(i))


num = int(input())
dis(num)
ans = inf
for e in a:
    ans = min(ans, e + num / e - 2)
print(int(ans))


Fixed submission:
def solve(n):
    ans = int(1e12)
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0 and i + n // i - 2 < ans:
            ans = i + n // i - 2
    return int(ans)


num = int(input())
print(solve(num))

Buggy python submission (verdict: Runtime Error):
from math import sqrt, inf

a = []


def dis(n):
    for i in range(1, int(sqrt(n)) + 1):
        if n % i == 0:
            a.append(int(i))


num = int(input())
dis(num)
ans = inf
for e in a:
    ans = min(ans, e + num / e - 2)
print(int(ans))


Fixed submission:
def solve(n):
    ans = int(1e12)
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0 and i + n // i - 2 < ans:
            ans = i + n // i - 2
    return int(ans)


num = int(input())
print(solve(num))

Buggy python submission (verdict: Runtime Error):
from math import sqrt, inf

a = []


def dis(n):
    for i in range(1, int(sqrt(n)) + 1):
        if n % i == 0:
            a.append(i)


num = int(input())
dis(num)
ans = inf
for e in a:
    ans = min(ans, e + num // e - 2)
print(ans)


Fixed submission:
def solve(n):
    ans = int(1e12)
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0 and i + n // i - 2 < ans:
            ans = i + n // i - 2
    return int(ans)


num = int(input())
print(solve(num))

Buggy python submission (verdict: Runtime Error):
from math import sqrt, inf

a = []


def dis(n):
    for i in range(1, int(sqrt(n)) + 1):
        if n % i == 0: a.append(i)


num = int(input())
dis(num)
ans = inf
for e in a:
    ans = min(ans, e + num // e - 2)
print(ans)


Fixed submission:
def solve(n):
    ans = int(1e12)
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0 and i + n // i - 2 < ans:
            ans = i + n // i - 2
    return int(ans)


num = int(input())
print(solve(num))