ZhenlongDai/ACPR huggingface dataset:
Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
p=1
for i in range(2,int(n**0.5)+1):
  if n%i==0:
    p=i
print(p+n/p-2)

Failing test case input:
1922250

Expected output:
2771


Actual output:
2771.0


Fixed submission (verdict: Accepted):
n=int(input())
p=1
for i in range(2,int(n**0.5)+1):
  if n%i==0:
    p=i
print(p+n

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from math import sqrt

n = int(input())
for i in range(int(sqrt(n)), 1, -1):
  if n % i == 0:
    print(i + n/i -2)
    break
else:
  print(n-1)

Failing test case input:
31959760

Expected output:
11334


Actual output:
11334.0


Fixed submission (verdict: Accepted):
from math import sqrt

n = int(input())
for i in range(int(sqrt(n)), 1, -1):
  if n % i == 0:
    print(i + n
    break
else:
  print(n-1)

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
ans = 10**20
a = n ** 0.5
a = int(a)
for i in range(a):
  if i ==0:
    continue
  if n % i != 0:
    continue
  j = n
  j = int(j)
  ans = min(ans, i+j-2)
print(ans)

Failing test case input:
38100885

Expected output:
12372


Actual output:
38100884


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

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())

i=int(N**0.5);

while i>0:
    if N%i==0:
        i,j=(i,N/i)
        break
    i-=1

print(i+j-2)

Failing test case input:
6518607

Expected output:
2172870


Actual output:
2172870.0


Fixed submission (verdict: Accepted):
N=int(input())

i=int(N**0.5);

while i>0:
    if N%i==0:
        i,j=(i,N/i)
        break
    i-=1

print(int(i+j-2))

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
import math
l= n-1
for i in range (1,int(math.sqrt(n))+1):
  if n % i ==0 and i+ n/i -2<l:
    l = i + n/i -2
print(l)

Failing test case input:
6785456

Expected output:
424105


Actual output:
424105.0


Fixed submission (verdict: Accepted):
n=int(input())
import math
l= n-1
for i in range (1,int(math.sqrt(n))+1):
  if n % i ==0 and i+ n/i -2<l:
    l = i + n/i -2
print(int(l))
Problem: p02881
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):

import math

N = int(input())


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)

    divisors.sort()
    return divisors

li = make_divisors(N)


if len(li) == 1:
    print(N-1)
    exit()

if len(li) % 2 == 0:
    ind = int(len(li) / 2)
else:
    ind = int(len(li) / 2 + 1)

x = li[ind]
y = int(N / x)

x -= 1
y -= 1

print(x+y)


Failing test case input:
14135619

Expected output:
277218


Actual output:
831522


Fixed submission (verdict: Accepted):

import math

N = int(input())


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n 
                divisors.append(n

    divisors.sort()
    return divisors

li = make_divisors(N)


if len(li) == 1:
    print(N-1)
    exit()

n = math.sqrt(N)
str_n = str(n)
if str_n[-1] == '0':
    x = int(n) -1
    y = int(n) -1
    print(x+y)
    exit()


if len(li) % 2 == 0:
    ind = int(len(li) / 2)
else:
    ind = int(len(li) / 2 + 1)

x = li[ind]
y = int(N / x)

x -= 1
y -= 1

print(x+y)

Problem: p02881
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
i = 1 
res =N
flag = True
if N ==1:
  print(0)
else:
  k = int(N**0.5)
  for j in range(1,k+1):
    k = N / j
    b = int(k)
    if k-b == 0:
      res = min(res,i+b-2)
print(res)
  

Failing test case input:
223605823

Expected output:
31934


Actual output:
21568


Fixed submission (verdict: Accepted):
N = int(input())
i = 1 
res =N
flag = True
if N ==1:
  print(0)
else:
  k = int(N**0.5)
  for j in range(1,k+1):
    k = N / j
    b = int(k)
    if k-b == 0:
      res = min(res,j+b-2)
print(res)

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
b=0
for i in range(1,int(n**0.5)+1):
  if n%i==0:
    b=i
    
print(b)

Failing test case input:
4343039

Expected output:
228598


Actual output:
19


Fixed submission (verdict: Accepted):
n=int(input())
b=0
for i in range(1,int(n**0.5)+1):
  if n%i==0:
    b=i
    
print(b+n

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
for i in range(int(N**0.5)+1,1,-1):
  if N%i==0:
    print(N/i+i-2)

Failing test case input:
46755701

Expected output:
18100


Actual output:
18100.0
221800.0
658600.0


Fixed submission (verdict: Accepted):
N=int(input())
for i in range(int(N**0.5)+1,0,-1):
  if N%i==0:
    print(int(N/i+i-2))
    exit()

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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 = 0


print(ans)


Failing test case input:
23879760

Expected output:
9830


Actual output:
0


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


num = int(input())
print(solve(num))
Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
int_n = int(input())
i = (math.sqrt(int_n))
i = math.floor(i)
while i > 1:
    if int_n % i == 0:
        j = int_n/i
        print(math.floor((i - 1) + (j - 1)))
        break
    i = i - 1

Failing test case input:
28427327

Expected output:
28427326


Actual output:

Fixed submission (verdict: Accepted):
import math
int_n = int(input())
i = (math.sqrt(int_n))
i = math.floor(i)
while i >= 1:
    if int_n % i == 0:
        j = int_n/i
        print(math.floor((i - 1) + (j - 1)))
        break
    i = i - 1

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N = int(input())
n = round(math.sqrt(N))
counter = 0
for i in range(n):
		if N%(n-i) == 0 and counter == 0:
			counter+=1
			var1=(n-i)
			var2=N/(n-i)
            
print(var1+var2-2)        


Failing test case input:
6326357

Expected output:
275080


Actual output:
275080.0


Fixed submission (verdict: Accepted):
import math
N = int(input())
n = round(math.sqrt(N))
counter = 0
for i in range(n):
		if N%(n-i) == 0 and counter == 0:
			counter+=1
			var1=(n-i)
			var2=N/(n-i)
            
print(int(var1+var2-2))

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
yaku = 1

import math

    



if N % 2 == 0:
	yaku = 2
	
for i in range(3,int(math.sqrt(N))+1 ,2):
	if N % i == 0:
		yaku = i
		

yaku2 = int(N/yaku)

print(int(yaku2+yaku - 2))


Failing test case input:
4343380

Expected output:
217187


Actual output:
868679


Fixed submission (verdict: Accepted):
N = int(input())
yaku = 1
import math

if N % 2 == 0:
	yaku = 2
	
for i in range(3,int(math.sqrt(N))+1 ,1):
	if N % i == 0:
		yaku = i
		
		
yaku2 = int(N/yaku)

print(int(yaku2+yaku - 2))

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
r = int(n**0.5)
while r>0:
    if n % r == 0:
        print(int(r + n/r - 2))
        break
    else:
        r =- 1

Failing test case input:
21977871

Expected output:
7325958


Actual output:

Fixed submission (verdict: Accepted):
n = int(input())
r = int(n**0.5)
while r>0:
    if n % r == 0:
        print(int(r + n/r - 2))
        break
    r = r - 1

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

n = int(input())
m = int(math.sqrt(n))

for i in range(m):
  if n % (m - i) == 0:
    print(m-i + n/(m-i) - 2)
    break

Failing test case input:
14845338

Expected output:
824757


Actual output:
824757.0


Fixed submission (verdict: Accepted):
import math

n = int(input())
m = int(math.sqrt(n))

for i in range(m):
  if n % (m - i) == 0:
    print(int(m-i + n/(m-i) - 2))
    break
Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n = int(input())
sq = math.floor(pow(n, 0.5))
flg = False
for i in range(2, sq):
    if n % i == 0:
        flg = True
        break
if flg:
    print(sq * 2 - 1)
else:
    print(n - 1)


Failing test case input:
15129587

Expected output:
1375426


Actual output:
7777


Fixed submission (verdict: Accepted):
import math
n = int(input())
sq = math.floor(pow(n, 0.5))
ans = []
for i in range(2, sq + 1):
    if n % i == 0:
        ans.append((i - 1) + ((n 
if len(ans) > 0:
    print(min(ans))
else:
    print(n - 1)

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N=int(input())
x=[]
min=10000000000000000
ans=0
sqN=math.ceil(math.sqrt(N))
for i in range(1,sqN+1):
  if N%i==0:
    j=int(N/i)
    a=[i,j]
    x.append(a)
for i,j in x:
  if i+j<=min:
    ans=i+j-2
    min=i+j
print(ans)
print(x)

Failing test case input:
529745

Expected output:
1552


Actual output:
1552
[[1, 529745], [5, 105949], [101, 5245], [505, 1049]]


Fixed submission (verdict: Accepted):
import math
N=int(input())
x=[]
min=10000000000000000
ans=0
sqN=math.ceil(math.sqrt(N))
for i in range(1,sqN+1):
  if N%i==0:
    j=int(N/i)
    a=[i,j]
    x.append(a)
for i,j in x:
  if i+j<=min:
    ans=i+j-2
    min=i+j
print(ans)

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n = int(input())
a = [1,1]
ans = 100000000000000
for i in range(int(math.sqrt(n))):
    a[0] += 1
    if(n%a[0] == 0):
        ans =min(ans,a[0] + int(n/a[0])-2)
    

a[1] = int(n/a[0])

print(ans)




Failing test case input:
6321719

Expected output:
6321718


Actual output:
100000000000000


Fixed submission (verdict: Accepted):
import math
n = int(input())
a = [1,1]
ans = 100000000000000
for i in range(int(math.sqrt(n))):
    
    if(n%a[0] == 0):
        ans =min(ans,a[0] + int(n/a[0])-2)
    a[0] += 1

a[1] = int(n/a[0])

print(ans)

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
num_s = input()
num = int(num_s)

def check(num):
    n = []
    for i in range(1, int(num**0.5)+1):
        if i > num:
            break
        if (num % i == 0):
            n.append(i)
    return n


ans = check(num)
a = max(ans)
b = num / a

if a == 1:
    a = 1
else:
    a = a - 1
if b == 1:
    b = 1
else:
    b = b - 1

print(int(a + b))

Failing test case input:
10000000019

Expected output:
10000000018

Actual output:
10000000019


Fixed submission (verdict: Accepted):
num_s = input()
num = int(num_s)

def check(num):
    n = []
    for i in range(1, int(num**0.5)+1):
        if i > num:
            break
        if (num % i == 0):
            n.append(i)
    return n
ans = check(num)
a = max(ans)
b = int(num / a)


a = a - 1
b = b - 1

print(a + b)
Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N=int(input())
x=[]
min=10000000
ans=0
sqN=math.ceil(math.sqrt(N))
for i in range(1,sqN+1):
  if N%i==0:
    j=int(N/i)
    a=[i,j]
    x.append(a)
for i,j in x:
  if i+j<=min:
    ans=i+j-2
    min=i+j
print(ans)

Failing test case input:
39774117

Expected output:
13258040


Actual output:
0


Fixed submission (verdict: Accepted):
import math
N=int(input())
x=[]
min=10000000000000000
ans=0
sqN=math.ceil(math.sqrt(N))
for i in range(1,sqN+1):
  if N%i==0:
    j=int(N/i)
    a=[i,j]
    x.append(a)
for i,j in x:
  if i+j<=min:
    ans=i+j-2
    min=i+j
print(ans)

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n = int(input())
m = n-1
for i in range(1,int(math.sqrt(n))):
  if n%i==0:
    m = min(m,i+n/i-2)
print(m)

Failing test case input:
6785456

Expected output:
424105


Actual output:
424105.0


Fixed submission (verdict: Accepted):
import math
n = int(input())
m = n-1
for i in range(1,int(math.sqrt(n))+1):
  if n%i==0:
    m = min(m,i+n
print(m)

Problem: p02881
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import math
import copy

n=int(input())

i=int(n**0.5)
j=0


for i in range(i+1,0,-1):
    
    if n==i:
        print(n-1)
        break
    if n%i==0:
        j=n/i
        print(i+j-2)
        break


Failing test case input:
1630296

Expected output:
22713


Actual output:
22713.0


Fixed submission (verdict: Accepted):
import math
import copy

n=int(input())

i=int(n**0.5)
j=0


for i in range(i+1,0,-1):
    
    if n==i:
        print(n-1)
        break
    if n%i==0:
        j=n/i
        print(int(i+j-2))
        break

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
yaku = 1

import math

    



if N % 2 == 0:
	yaku = 2
	
for i in range(3,int(math.sqrt(N)),2):
	if N % i == 0:
		yaku = i
		

yaku2 = int(N/yaku)

print(int(yaku2+yaku - 2))

100000



Failing test case input:
18833720

Expected output:
9136


Actual output:
9277


Fixed submission (verdict: Accepted):
N = int(input())
yaku = 1
import math

if N % 2 == 0:
	yaku = 2
	
for i in range(3,int(math.sqrt(N))+1 ,1):
	if N % i == 0:
		yaku = i
		
		
yaku2 = int(N/yaku)

print(int(yaku2+yaku - 2))

Problem: p02881
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
ans = []
for i in range(1,int(n**0.5)+1):
    if n % i == 0:
        x = n/i
        ans.append(i + x -2)
print(min(ans))


Failing test case input:
2326170

Expected output:
3051


Actual output:
3051.0


Fixed submission (verdict: Accepted):
n = int(input())
ans = []
for i in range(1,int(n**0.5)+1):
    if n % i == 0:
        x = n/i
        ans.append(int(i + x -2))
print(min(ans))
Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
import math
from copy import deepcopy
from collections import deque, defaultdict
from operator import mul
from functools import reduce
sys.setrecursionlimit(20000000)




def main():
    N = int(input())
    min_s = 10 ** 12

    for i in range(1, int(math.sqrt(N))):
        if N % i == 0:
            if min_s > i+(N/i):
                min_s = i + (N/i)

    print(min_s - 2)


if __name__ == '__main__':
    main()

Failing test case input:
39774117

Expected output:
13258040


Actual output:
13258040.0


Fixed submission (verdict: Accepted):

import sys
import math
from copy import deepcopy
from collections import deque, defaultdict
from operator import mul
from functools import reduce
sys.setrecursionlimit(20000000)




def main():
    N = int(input())
    min_s = 10 ** 12

    for i in range(1, int(math.sqrt(N))+1):
        if N % i == 0:
            if min_s > i+(N/i):
                min_s = i + (N/i)

    print(int(min_s - 2))


if __name__ == '__main__':
    main()

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N = int(input())
i = 1
min = 9000000000000
for _ in range(1, int(math.sqrt(N)+1)):
  if N % i == 0:
    j = N/i
    sum = j + i
    if sum < min:
      min = sum
      ans = i-1+j-1
    else:
      break
  i += 1
print(ans)

Failing test case input:
23879760

Expected output:
9830


Actual output:
9830.0


Fixed submission (verdict: Accepted):
import math
N = int(input())
i = 1
min = 9000000000000
for _ in range(1, int(math.sqrt(N)+1)):
  if N % i == 0:
    j = N/i
    sum = j + i
    if sum < min:
      min = sum
      ans = i-1+j-1
    else:
      break
  i += 1
print(int(ans))

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from math import sqrt
n = int(input())
m = 2*n

for i in range(1, int(sqrt(n))):
    if n % i == 0:
        a = n 
        b = n 
        if a+b <= m:
            m = a+b

print(m-2)

Failing test case input:
1074356

Expected output:
2143


Actual output:
2148710


Fixed submission (verdict: Accepted):
from math import sqrt
n = int(input())
m = 2*n

for i in range(1, int(sqrt(n))+1):
    if n % i == 0:
        a = n / i
        b = n / a
        if a+b <= m:
            m = a+b

print(int(m-2))

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
ans = n - 1
for i in range(2, 10^6):
  
  if n%i==0 and i+n/i-2<ans:
    ans = int(i + n / i - 2)
print(ans)


Failing test case input:
46755701

Expected output:
18100


Actual output:
46755700


Fixed submission (verdict: Accepted):
n = int(input())
ans = n - 1
for i in range(2, 10**6+1):
  
  if n%i==0 and i+n/i-2<ans:
    ans = int(i + n / i - 2)
print(ans)
Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = 50
ans = 10**12
for i in range(2,int(n**0.5)+1):
    if n%i == 0:
        if (i+n/i)<ans:
            ans = i+n/i
print(int(ans-2))

Failing test case input:
68324856

Expected output:
2846891


Actual output:
13


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

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):





def main():
    N = int(input())
    org = N
    i = 2
    table = []
    while i * i <= N:
        while N % i == 0:
            j = org / i
            N /= i
            table.append(i + j - 2)
        i += 1
    table.append(org - 1)
    print(int(min(table)))


if __name__ == '__main__':
    main()


Failing test case input:
1074356

Expected output:
2143


Actual output:
3523


Fixed submission (verdict: Accepted):





def main():
    N = int(input())
    org = N
    i = 2
    table = []
    while i * i <= N:
        if N % i == 0:
            j = org / i
            table.append(i + j - 2)
        i += 1
    table.append(org - 1)
    print(int(min(table)))


if __name__ == '__main__':
    main()

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
int_n = int(input())
i = (math.sqrt(int_n))
i = math.floor(i)
while i > 1:
    if int_n % i == 0:
        j = int_n/i
        print((i - 1) + (j -1))
        break
    i = i - 1

Failing test case input:
31632100

Expected output:
316419


Actual output:
316419.0


Fixed submission (verdict: Accepted):
import math
int_n = int(input())
i = (math.sqrt(int_n))
i = math.floor(i)
while i >= 1:
    if int_n % i == 0:
        j = int_n/i
        print(math.floor((i - 1) + (j - 1)))
        break
    i = i - 1

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math as m

n = int(input())
q = int(m.sqrt(n))

for i in range(q,0,-1):
    if n%i == 0:
        k = i
        l = n/i
        break

print(int(k+l-2))
print(q)



Failing test case input:
2830931

Expected output:
6298


Actual output:
6298
1682


Fixed submission (verdict: Accepted):
import math as m

n = int(input())
q = int(m.sqrt(n))

for i in range(q,0,-1):
    if n%i == 0:
        k = i
        l = int(n/i)
        break

print(int(k+l-2))
Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

N=int(input())
n=math.ceil(math.sqrt(N))

ans=1000000000000

for i in range(1,n+1):
    if N%i==0:
        if ans>i+(N/i):
            ans=i+(N/i)
            print(i,N/i,ans)

print(ans-2)


Failing test case input:
1873386

Expected output:
2761


Actual output:
1 1873386.0 1873387.0
2 936693.0 936695.0
3 624462.0 624465.0
6 312231.0 312237.0
9 208154.0 208163.0
18 104077.0 104095.0
199 9414.0 9613.0
398 4707.0 5105.0
523 3582.0 4105.0
597 3138.0 3735.0
1046 1791.0 2837.0
1194 1569.0 2763.0
2761.0


Fixed submission (verdict: Accepted):
import math

N=int(input())
n=math.ceil(math.sqrt(N))

ans=1000000000000

for i in range(1,n+1):
    if N%i==0:
        if ans>i+(N/i):
            ans=i+(N/i)

print(int(ans-2))

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = 50
ans = 10**12
for i in range(2,int(n**0.5)+1):
    if n%i == 0:
        if (i+n/i)<ans:
            ans = i+n/i
print(ans-2)

Failing test case input:
2830931

Expected output:
6298


Actual output:
13.0


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

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
temp=10**13
for i in range(1,int(n**(1/2))+1):
    if n%i==0:temp=min(temp,i+n/i)
print(temp-2)

Failing test case input:
1456296

Expected output:
60701


Actual output:
60701.0


Fixed submission (verdict: Accepted):
n=int(input())
temp=10**13
for i in range(1,int(n**(1/2))+1):
    if n%i==0:temp=min(temp,i+n/i)
print(int(temp-2))

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N=int(input())
a=int(math.sqrt(N))
while a>0:
  if N%a==0:
    print(a+N%a-2)
    break
  a-=1


Failing test case input:
3329894

Expected output:
5149


Actual output:
756


Fixed submission (verdict: Accepted):
import math
N=int(input())
a=int(math.sqrt(N))
while a>0:
  if N%a==0:
    print(a+N
    break
  a-=1

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
ans=10**12
for i in range(1,100):
    if N%i==0:
        ans=min(ans,int((i-1)+N/i-1))
print(ans)

Failing test case input:
1922250

Expected output:
2771


Actual output:
25703


Fixed submission (verdict: Accepted):
N=int(input())
ans=10**12
for i in range(1,1000001):
    if N%i==0:
        ans=min(ans,int((i-1)+N/i-1))
print(ans)

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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 = 0
for e in a:
    continue
    
print(ans)


Failing test case input:
38100885

Expected output:
12372


Actual output:
0


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


num = int(input())
print(solve(num))
Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
l = []
for i in range(1,n):
    sur = n%i
    ans = n/i
   
    if ans < i:
        break
    elif sur == 0:
        l.append(i)
l.sort(reverse=True)
max = l[0]
max_op = n/max
ite = max-1+max_op-1
print(ite)

Failing test case input:
13758358

Expected output:
221969


Actual output:
221969.0


Fixed submission (verdict: Accepted):
n = int(input())
l = []
for i in range(1,n):
    sur = n%i
    ans = n/i
   
    if ans < i:
        break
    elif sur == 0:
        l.append(i)
l.sort(reverse=True)
max = l[0]
max_op = n/max
ite = max-1+max_op-1
print(int(ite))

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from math import sqrt
from math import floor
n = int(input())
for i in range(2, floor(sqrt(n)) + 1):
    if n % i == 0:
        min_div = i
        break
else:
    min_div = n
ans = min_div + int(n / min_div) - 2
print(ans)


Failing test case input:
42496184

Expected output:
13648


Actual output:
21248092


Fixed submission (verdict: Accepted):
from math import sqrt
from math import floor
n = int(input())
for i in range(floor(sqrt(n)), 1, -1):
    if n % i == 0:
        min_div = i
        break
else:
    min_div = n
ans = min_div + int(n / min_div) - 2
print(ans)

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
b = input()
a = int(b)

c = int(math.sqrt(a))

for i in range(1000):
    d = a / (c + i)
    if d.is_integer() == True:
        break

e = c + i

print(d + e - 2)

Failing test case input:
8076879

Expected output:
5694


Actual output:
5694.0


Fixed submission (verdict: Accepted):
import math
b = input()
a = int(b)

sqA = int(math.sqrt(a))

for i in range(10000000):
    d = a / (sqA - i)
    if d.is_integer() == True:
        break


e = d + sqA - i - 2

print(int(e))

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N = int(input())
n = int(math.sqrt(N))
for i in range(n+1, 1, -1):
  if N % i == 0:
      print( i + int(N / i) - 2 )
      exit()

Failing test case input:
6321719

Expected output:
6321718


Actual output:

Fixed submission (verdict: Accepted):
import math
N = int(input())
n = int(math.sqrt(N))
for i in range(n, 0, -1):
  if N % i == 0:
      print( i + int(N / i) - 2 )
      exit()

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n = int(input())
m = n-1
for i in range(1,int(math.sqrt(n))+1):
  if n%i==0:
    m = min(m,i+n/i-2)
print(m)

Failing test case input:
33875203

Expected output:
43194


Actual output:
43194.0


Fixed submission (verdict: Accepted):
import math
n = int(input())
m = n-1
for i in range(1,int(math.sqrt(n))+1):
  if n%i==0:
    m = min(m,i+n
print(m)
Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=int(input())
c=a
for i in range(10000000,2,-1):
    if a%i==0:
        b=a/i
        if i+b<c:
            c=i+b
print(int(c-2))


Failing test case input:
10000000019

Expected output:
10000000018

Actual output:
10000000017


Fixed submission (verdict: Accepted):
a=int(input())
c=a+1
for i in range(1,10000000,1):
    if a%i==0:
        b=a/i
        if i+b<=c:
            c=i+b
print(int(c-2))

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
s = input().split() 
n = int(s[0])
root = int(math.sqrt(n))
ans = 10**9
for i in range(1, root):
    if n % i != 0:
        continue
    j = n / i
    ans = min(ans, i + j - 2)
print(int(ans))

Failing test case input:
10000000019

Expected output:
10000000018

Actual output:
1000000000


Fixed submission (verdict: Accepted):
import math
s = input().split() 
n = int(s[0])
root = int(math.sqrt(n))
ans = 10**18
for i in range(1, root + 1):
    if n % i != 0:
        continue
    j = n / i
    ans = min(ans, i + j - 2)
print(int(ans))

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n=int(input())

d=1e12
for i in range(1,int(math.sqrt(n))+1):
    if(n % i == 0):
        m=n/i + i- 2;
        if(m < d):
            d=m
print(d)


Failing test case input:
7817298

Expected output:
45099


Actual output:
45099.0


Fixed submission (verdict: Accepted):
import math
n=int(input())

d=1e12
for i in range(1,int(math.sqrt(n))+1):
    if(n % i == 0):
        m=n/i + i- 2;
        if(m < d):
            d=m
print(int(d))

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

def main():
    n = int(input())
    m = math.sqrt(n)
    ans = []
    for i in range(1, int(m) + 1):
        div = n / i
        if not float.is_integer(div):
            continue
        ans.append((div+i)-2)

    print(min(ans))


if __name__ == '__main__':
    main()

Failing test case input:
27772949

Expected output:
18868


Actual output:
18868.0


Fixed submission (verdict: Accepted):
import math

def main():
    n = int(input())
    m = math.sqrt(n)
    ans = []
    for i in range(1, int(m) + 1):
        div = n / i
        if not float.is_integer(div):
            continue
        ans.append((div+i)-2)

    print(int(min(ans)))


if __name__ == '__main__':
    main()

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n=int(input())
m=math.sqrt(n)
m=math.floor(m)+1
li=[]
for i in range(1,m):
    a=i+n/i
    li.append(a)
li=[li[i] for i in range(m-1) if li[i].is_integer()]
print(int(min(li))-2)
print(li)


Failing test case input:
14845338

Expected output:
824757


Actual output:
824757
[14845339.0, 7422671.0, 4948449.0, 2474229.0, 1649491.0, 824759.0]


Fixed submission (verdict: Accepted):
import math
n=int(input())
m=math.sqrt(n)
m=math.floor(m)+1
li=[]
for i in range(1,m):
    a=i+n/i
    li.append(a)
li=[li[i] for i in range(m-1) if li[i].is_integer()]
print(int(min(li))-2)
Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

def solv(N):
    x = N-1
    for i in range(1, int(math.sqrt(N))):
        if N % i == 0:
            x = min(x, i + N / i -2)
    return x

N = int(input())
print(solv(N))


Failing test case input:
18833720

Expected output:
9136


Actual output:
9136.0


Fixed submission (verdict: Accepted):
import math

def solv(N):
    x = N-1
    for i in range(1, int(math.sqrt(N)) + 1):
        if N % i == 0:
            x = min(x, i + N / i -2)
    return x

N = int(input())
print(int(solv(N)))

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
import sys

N = int(input())
a = 0

for i in reversed(range(round(math.sqrt(N)))):
  j = i + 1
  if N % j == 0:
    print(j - 1 + N / j - 1)
    sys.exit()

Failing test case input:
6069423871

Expected output:
23434326


Actual output:
23434326.0


Fixed submission (verdict: Accepted):
import math

N = int(input())
a = N + 1
b = round(math.sqrt(N))

for i in range(b):
  j = i + 1
  if N % j == 0:
    if a > j + N / j:
      a = j + N / j
print(round(a) - 2)

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N=int(input())
dis=N-1

for i in range(2,int(math.sqrt(N))+1):
    if N%i==0:
        if ((N/i)-1)+(i-1)<dis:
            dis=((N/i)-1)+(i-1)
        else:
            pass
    else:
        pass
print(dis)
        
        


Failing test case input:
40908102

Expected output:
13401


Actual output:
13401.0


Fixed submission (verdict: Accepted):
import math
N=int(input())
dis=N-1

for i in range(2,int(math.sqrt(N))+1):
    if N%i==0:
        if ((N/i)-1)+(i-1)<dis:
            dis=((N/i)-1)+(i-1)
        else:
            pass
    else:
        pass
print(int(dis))

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
ans = 0
a = n ** 0.5
a = int(a)
for i in range(a):
  if i ==0:
    continue
  if n % i != 0:
    continue
  j = n
  ans = i+j-2
print(ans)

Failing test case input:
593859

Expected output:
28298


Actual output:
593878


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

Problem: p02881
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import math
import itertools
n = int(input())
x = 1
for i in reversed(range(1, int(math.sqrt(n)))):
    if n % i == 0:
        x = n / i
        break

print(x - 1 + n / x - 1)

Failing test case input:
1922250

Expected output:
2771


Actual output:
2771.0


Fixed submission (verdict: Accepted):
import math
import itertools
n = int(input())
x = 1
for i in reversed(range(1, math.ceil(math.sqrt(n))+1)):
    if n % i == 0:
        x = n / i
        break

print(math.floor(x - 1 + n / x - 1))
Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

n=int(input())

min=-1
for i in range(1,int(math.sqrt(n))+1):
    if n%i==0:
        j=int(n/i)
        print("divide",i,j)
        calc=j+i-2
        if min==-1 or min>calc:
            min=calc

print(min)


Failing test case input:
42496184

Expected output:
13648


Actual output:
divide 1 42496184
divide 2 21248092
divide 4 10624046
divide 8 5312023
divide 1201 35384
divide 2402 17692
divide 4423 9608
divide 4804 8846
13648


Fixed submission (verdict: Accepted):
import math

n=int(input())

min=-1
for i in range(1,int(math.sqrt(n))+1):
    if n%i==0:
        j=int(n/i)
        calc=j+i-2
        if min==-1 or min>calc:
            min=calc

print(min)

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N = int(input())
x = math.floor(math.sqrt(N))
y = 0
for i in range(1, x+1):
    if N % i == 0:
        y = i
        break
    else:
        continue
ans = y + (N/y) - 2
print(int(ans))


Failing test case input:
6518607

Expected output:
2172870


Actual output:
6518606


Fixed submission (verdict: Accepted):
import math
N = int(input())
x = math.floor(math.sqrt(N))
y = 0
for i in reversed(range(1, x+1)):
    if N % i == 0:
        y = i
        break
    else:
        continue
ans = y + (N/y) - 2
print(int(ans))

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N = int(input())
    
for i in range(1, int(math.sqrt(N)+1) ):
    if  N % i == 0:
        print(int(i + N/i - 2))
        exit()


Failing test case input:
345437

Expected output:
1180


Actual output:
345436


Fixed submission (verdict: Accepted):
import math
N = int(input())
min_root = N - 1
for i in range(1, int(math.sqrt(N)+1) ):
    if  N % i == 0:
        min_root = min(int(i + N/i - 2), min_root)
print(min_root)

Problem: p02881
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())

ans=N
for i in range(1, int(N**0.5+1)):
    if N%i==0:
        a = N/i
        b = N/a
        up_ans = a + b -2
        print(up_ans)
        ans = min(ans, up_ans)
    else:
        continue
print(int(ans))

Failing test case input:
15129587

Expected output:
1375426


Actual output:
15129586.0
1375426.0
1375426


Fixed submission (verdict: Accepted):
N = int(input())

ans=N
for i in range(1, int(N**0.5+1)):
    if N%i==0:
        a = N/i
        b = N/a
        up_ans = a + b -2
        ans = min(ans, up_ans)
    else:
        continue
print(int(ans))

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
print([sum([i-1,round(N/i)-1]) for i in range(1,int(N**0.5)+1) if N%i==0])


Failing test case input:
1013510

Expected output:
2785


Actual output:
[1013509, 506755, 202705, 101359, 23611, 11869, 4927, 2785]


Fixed submission (verdict: Accepted):
N=int(input())
print(min([sum([i-1,round(N/i)-1]) for i in range(1,int(N**0.5)+1) if N%i==0]))
Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n = int(input())
root = int(math.sqrt(n))
ans = 0
flag = 0
for i in range(1, root+1):
    if n % i == 0:
        flag = 1
        ans = int((n/i)) + i - 2
        break
print(ans)

Failing test case input:
39774117

Expected output:
13258040


Actual output:
39774116


Fixed submission (verdict: Accepted):
import math
n = int(input())
root = int(math.sqrt(n))
ans = 0
for i in range(1, root+1):
  if n % i == 0:
    ans = int((n/i)) + i - 2
print(ans)

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
b = input()
a = int(b)

c = int(math.sqrt(a))

for i in range(1000000):
    d = a / (c + i)
    if d.is_integer() == True:
        break

e = d + c + i - 2
print(int(e))


Failing test case input:
39774117

Expected output:
13258040


Actual output:
1006342


Fixed submission (verdict: Accepted):
import math
b = input()
a = int(b)

sqA = int(math.sqrt(a))

for i in range(10000000):
    d = a / (sqA - i)
    if d.is_integer() == True:
        break


e = d + sqA - i - 2

print(int(e))

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

raw = input()
N = int(raw)
n = math.sqrt(N)
listm = math.modf(n)
m = int(listm[1])

count = N - 1

for i in range(m,1,-1):
    if (N % i)==0:
        ans = i +(N % i) -2
        count = ans
        break

print(count) 

Failing test case input:
2007462

Expected output:
19781


Actual output:
100


Fixed submission (verdict: Accepted):
import math

raw = input()
N = int(raw)
n = math.sqrt(N)
a,b = math.modf(n)
m = int(b)

count = N - 1

for i in range(m,1,-1):
    if (N % i)==0:
        ans = i + (N 
        count = ans
        break

print(count)

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=input()
a=int(a)
c=1
b=round(a**0.5)+2
for n in range(1,b):
    if a%n==0:
        c=n
d=a/c
print(d+c-2)

Failing test case input:
415214

Expected output:
1507


Actual output:
1507.0


Fixed submission (verdict: Accepted):
a=input()
a=int(a)
c=1
b=round(a**0.5)+2
for n in range(1,b):
    if a%n==0:
        c=n
d=a/c
print(int(d+c-2))

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=int(input())
c=a+1
for i in range(1000000,2,-1):
    if a%i==0:
        b=a/i
        if i+b<c:
            c=i+b
print(int(c-2))

Failing test case input:
46849766

Expected output:
23424883


Actual output:
46849765


Fixed submission (verdict: Accepted):
a=int(input())
c=a+1
for i in range(1,10000000,1):
    if a%i==0:
        b=a/i
        if i+b<=c:
            c=i+b
print(int(c-2))
Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
int_n = int(input())
i = (math.sqrt(int_n))
math.floor(i)
while i >= 1:
    if int_n % i == 0:
        j = int_n/i
        print((i - 1) + (j -1))
        break
    i = i - 1

Failing test case input:
42496184

Expected output:
13648


Actual output:

Fixed submission (verdict: Accepted):
import math
int_n = int(input())
i = (math.sqrt(int_n))
i = math.floor(i)
while i >= 1:
    if int_n % i == 0:
        j = int_n/i
        print(math.floor((i - 1) + (j - 1)))
        break
    i = i - 1

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

a = int(input())
j=0
mass=100000000000001000000000
for i in range(9):
    j = j+1
    h=a/j
    if (h.is_integer()):    
        ans="Yes"
        mass2=j+h-2
        if(mass>=mass2):
            mass=mass2
    else:
        ans="No"
    

print(int(mass))

Failing test case input:
68324856

Expected output:
2846891


Actual output:
8540613


Fixed submission (verdict: Accepted):

a = int(input())
j=0
mass=1000000000000
for i in range(round(a**(1/2))):
    j = j+1
    h=a/j
    if (h.is_integer()):    
        mass2=j+h-2
        if(mass>mass2):
            mass=mass2
        

    

print(int(mass))

Problem: p02881
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
save = 1
for i in range(2, int(n**(1/2)), -1):
    print(i)
    if n % i == 0:
        save = i
        break
print(int(save+n/save - 2))


Failing test case input:
63407968

Expected output:
152837


Actual output:
63407967


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

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
N = int(input())
sqN = int(math.sqrt(N))
for i in range(sqN):
  if N % (sqN-i) == 0:
    print(int(N/(sqN-i)+sqN-i))
    break

Failing test case input:
68833649

Expected output:
68833648


Actual output:
68833650


Fixed submission (verdict: Accepted):
import math
N = int(input())
sqN = int(math.sqrt(N))
for i in range(sqN):
  if N % (sqN-i) == 0:
    print(int(N/(sqN-i)+sqN-i)-2)
    break

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = [1,1]
ans = 100000000
for i in range(1000000):
    a[0] += 1
    if(n%a[0] == 0):
        ans =min(ans,a[0] + int(n/a[0])-2)
    
    if( i >=n):
        break


print(ans)




Failing test case input:
6321719

Expected output:
6321718


Actual output:
100000000


Fixed submission (verdict: Accepted):
import math
n = int(input())
a = [1,1]
ans = 100000000000000
for i in range(int(math.sqrt(n))):
    
    if(n%a[0] == 0):
        ans =min(ans,a[0] + int(n/a[0])-2)
    a[0] += 1

a[1] = int(n/a[0])

print(ans)
Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

def dictcheck(dict):
    min = 0
    for k,v in dict.items():
        if k == 1:
            min = v
            break
        elif min == 0:
            min=(int(k)-1)+(int(v)-1)
        elif min > (int(k)-1)+(int(v)-1):
            min = (int(k)-1)+(int(v)-1)
        else:
            continue
    print(min)

def main():
    N = int(input())
    i = 2
    tmpdict= {}
    while i <= math.sqrt(N):
        if N % i == 0:
            tmpdata = {i:N/i}
            tmpdict.update(tmpdata)
            i+=1
        else:
            i+=1
    if len(tmpdict)==0:
        tmpdata = {1:N-1}
        tmpdict.update(tmpdata)
    print(tmpdict)
    dictcheck(tmpdict)

if __name__ == "__main__":
    main()

Failing test case input:
2326170

Expected output:
3051


Actual output:
{2: 1163085.0, 3: 775390.0, 5: 465234.0, 6: 387695.0, 7: 332310.0, 10: 232617.0, 11: 211470.0, 14: 166155.0, 15: 155078.0, 19: 122430.0, 21: 110770.0, 22: 105735.0, 30: 77539.0, 33: 70490.0, 35: 66462.0, 38: 61215.0, 42: 55385.0, 53: 43890.0, 55: 42294.0, 57: 40810.0, 66: 35245.0, 70: 33231.0, 77: 30210.0, 95: 24486.0, 105: 22154.0, 106: 21945.0, 110: 21147.0, 114: 20405.0, 133: 17490.0, 154: 15105.0, 159: 14630.0, 165: 14098.0, 190: 12243.0, 209: 11130.0, 210: 11077.0, 231: 10070.0, 265: 8778.0, 266: 8745.0, 285: 8162.0, 318: 7315.0, 330: 7049.0, 371: 6270.0, 385: 6042.0, 399: 5830.0, 418: 5565.0, 462: 5035.0, 530: 4389.0, 570: 4081.0, 583: 3990.0, 627: 3710.0, 665: 3498.0, 742: 3135.0, 770: 3021.0, 795: 2926.0, 798: 2915.0, 1007: 2310.0, 1045: 2226.0, 1113: 2090.0, 1155: 2014.0, 1166: 1995.0, 1254: 1855.0, 1330: 1749.0, 1463: 1590.0}
3051


Fixed submission (verdict: Accepted):
import math

def dictcheck(dict):
    min = 0
    for k,v in dict.items():
        if k == 1:
            min = v
            break
        elif min == 0:
            min=(int(k)-1)+(int(v)-1)
        elif min > (int(k)-1)+(int(v)-1):
            min = (int(k)-1)+(int(v)-1)
        else:
            continue
    print(min)

def main():
    N = int(input())
    i = 2
    tmpdict= {}
    while i <= math.sqrt(N):
        if N % i == 0:
            tmpdata = {i:N/i}
            tmpdict.update(tmpdata)
            i+=1
        else:
            i+=1
    if len(tmpdict)==0:
        tmpdata = {1:N-1}
        tmpdict.update(tmpdata)

    dictcheck(tmpdict)

if __name__ == "__main__":
    main()

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n = int(input())

ans = 10**18
for i in range(1, int(math.sqrt(n))+1):
  if n % i == 0:
    ans = min(ans, i + n / i)
print(ans-2)

Failing test case input:
605667865

Expected output:
82100


Actual output:
82100.0


Fixed submission (verdict: Accepted):
import math
n = int(input())

ans = 10**18
for i in range(1, int(math.sqrt(n))+1):
  if n % i == 0:
    ans = min(ans, i + n / i)
print(int(ans)-2)
Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n=int(input())
sn=int(math.sqrt(n))
tl=list(range(1,sn+1))
ans=0
for i in range(1,sn+1):
    a=n/tl[-i]
    if a.is_integer():
        ans=int(a)
        break
b=int(n/ans)
print(n,ans,b)
print(ans-1+b-1)

Failing test case input:
6785456

Expected output:
424105


Actual output:
6785456 424091 16
424105


Fixed submission (verdict: Accepted):
import math
n=int(input())
sn=int(math.sqrt(n))
tl=list(range(1,sn+1))
ans=0
for i in range(1,sn+1):
    a=n/tl[-i]
    if a.is_integer():
        ans=int(a)
        break
b=int(n/ans)
print(ans-1+b-1)

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
import math 
yakusuu_list = []
for i in range (int(math.sqrt(N)),0,-1):
  if N % i == 0:
    yakusuu = i
    break
print(i+ N/i -2)
  

Failing test case input:
65898355

Expected output:
13179674


Actual output:
13179674.0


Fixed submission (verdict: Accepted):
N = int(input())
import math 
yakusuu_list = []
for i in range (int(math.sqrt(N)),0,-1):
  if N % i == 0:
    yakusuu = i
    break
print(i+ N

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

n = int(input())

ans  = 10 ** 12 
for i in range(1, math.floor(math.sqrt(n)) + 1):
    if n%i != 0:
        continue
    j = n/i
    ans = min(ans, i+j-2)

print(ans)

Failing test case input:
54734725

Expected output:
17348


Actual output:
17348.0


Fixed submission (verdict: Accepted):
import math

n = int(input())

ans  = 10 ** 12 
for i in range(1, math.floor(math.sqrt(n)) + 1):
    if n%i != 0:
        continue
    j = int(n/i)
    ans = min(ans, i+j-2)

print(ans)

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
b = input()
a = int(b)

sqA = int(math.sqrt(a))

for i in range(10000000):
    d = a / (sqA - i)
    if d.is_integer() == True:
        break


e = d + sqA - i - 2
print(d)
print(sqA + i)
print(int(e))


Failing test case input:
13758358

Expected output:
221969


Actual output:
221909.0
7356
221969


Fixed submission (verdict: Accepted):
import math
b = input()
a = int(b)

sqA = int(math.sqrt(a))

for i in range(10000000):
    d = a / (sqA - i)
    if d.is_integer() == True:
        break


e = d + sqA - i - 2

print(int(e))

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())

ans=1e9
i=1
while i*i<=N:
    if (N%i==0):
       ans=min(ans,(i-1)+(N/i-1)) 
    i+=1
print(ans)

Failing test case input:
1013510

Expected output:
2785


Actual output:
2785.0


Fixed submission (verdict: Accepted):
N=int(input())

ans=1e15
i=1
while i*i<=N:
    if (N%i==0):
       ans=min(ans,(i-1)+(N/i-1)) 
    i+=1
print(int(ans))
Problem: p02881
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())

i = 1
answer = N - 1
while i * i <= N:
    if N % i == 0:
        new_answer = (i - 1) + ((N / i) - 1)
        if answer > new_answer:
            answer = new_answer
    i += 1

print(answer)

Failing test case input:
223605823

Expected output:
31934


Actual output:
31934.0


Fixed submission (verdict: Accepted):
N = int(input())

i = 1
answer = N - 1
while i * i <= N:
    if N % i == 0:
        new_answer = (i - 1) + ((N / i) - 1)
        if answer > new_answer:
            answer = new_answer
    i += 1

print(int(answer))

Problem: p02881
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math
n= int(input())
x=n+1
for i in range(2,int(math.sqrt(n)+1)):
  if n%i==0:
    x= i+ (n%i)
print(x-2)

Failing test case input:
6785456

Expected output:
424105


Actual output:
14


Fixed submission (verdict: Accepted):
import math
n= int(input())
x=n+1
for i in range(2,int(math.sqrt(n)+1)):
  if n%i==0:
    x= i+ (n/i)
print(int(x)-2)

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

N = int(input())
a = N
b = round(math.sqrt(N))

for i in range(b):
  j = i + 1
  if N % j == 0:
    if a > j + N / j:
      a = j + N / j
print(round(a) - 2)

Failing test case input:
10000000019

Expected output:
10000000018

Actual output:
10000000017


Fixed submission (verdict: Accepted):
import math

N = int(input())
a = N + 1
b = round(math.sqrt(N))

for i in range(b):
  j = i + 1
  if N % j == 0:
    if a > j + N / j:
      a = j + N / j
print(round(a) - 2)

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
int_n = int(input())
i = (math.sqrt(int_n))
i = math.floor(i)
while i >= 1:
    if int_n % i == 0:
        j = int_n/i
        print((i - 1) + (j -1))
        break
    i = i - 1

Failing test case input:
4495368

Expected output:
4257


Actual output:
4257.0


Fixed submission (verdict: Accepted):
import math
int_n = int(input())
i = (math.sqrt(int_n))
i = math.floor(i)
while i >= 1:
    if int_n % i == 0:
        j = int_n/i
        print(math.floor((i - 1) + (j - 1)))
        break
    i = i - 1

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

ans = 1

for i in range(1,int(N**0.5)+1):
    if N % i == 0:
        ans = i

print(ans+(N/ans)-2)

Failing test case input:
6518607

Expected output:
2172870


Actual output:
2172870.0


Fixed submission (verdict: Accepted):
N = int(input())

ans = 1

for i in range(1,int(N**0.5)+1):
    if N % i == 0:
        ans = i

print(ans+int(N/ans)-2)

Problem: p02881
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
tall = int(input())
bit = int(tall**(1/2))
while ((tall/bit)%1 != 0):
  bit -= 1
print(bit+tall/bit-2)

Failing test case input:
14135619

Expected output:
277218


Actual output:
277218.0


Fixed submission (verdict: Accepted):
tall = int(input())
bit = int(tall**(1/2))
while ((tall/bit)%1 != 0):
  bit -= 1
print(int(bit+tall/bit-2))