Buggy python submission (verdict: Runtime Error):
n=int(input())
ans = []
for i in range(int(n**0.5),0,-1):
    if n%i==0:
        ans += n//i+i-2
print(min(ans))

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

Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = n
for i in range(int(n**0.5),0,-1):
  if n % i == 0:
    j = target // i
    if (i+j-2) < ans:
      ans = i+j-2
print(ans)

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

Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = n
for i in range(1,int(n**0.5)):
  if n % i == 0:
    j = target // i
    if (i+j-2) < ans:
      ans = i+j-2
print(ans)


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

Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = n
for i in range(0,int(n**0.5)):
  if n % i == 0:
    j = target // i
    if (i+j-2) < ans:
      ans = i+j-2
print(ans)

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

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

for i in range(1,target**0.5):
  if target % i == 0:
    j = target // i
    if (i+j-2) < curAns:
      curAns = i+j-2
print(curAns)


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

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

for i in range(1,target**0.5):
  if target % i == 0:
    j = target // i
    if (i+j-2) < curAns:
      curAns = i+j-2
print(curAns)

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

Buggy python submission (verdict: Runtime Error):
import math
target = int(input())
curAns = target

for i in range(0,int(math.sqrt(target))):
  if target % i == 0:
    j = target // i
    if (i+j-2) < curAns:
      curAns = i+j-2
print(curAns)

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

Buggy python submission (verdict: Time Limit Exceeded):
target = int(input())
curAns = 10 ** 12
 
for i in range(1,target):
  if target % i == 0:
    j = target // i
    if (i+j-2) < curAns:
      curAns = i+j-2
print(curAns)

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

Buggy python submission (verdict: Runtime Error):
target = int(input())
possibleAns = []
 
for i in range(1,10):
  for j in range(1,10):
    if i*j == target:
		possibleAns.append(i+j)
print(min(possibleAns))

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

Buggy python submission (verdict: Runtime Error):
target = int(input())
possibleAns = []

for i in range(1,10):
  for j in range(1,10):
    if i*j == taget:
		possibleAns.append(i+j)
print(min(possibleAns))


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