qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n = int(input())
import math
r = math.sqrt(n)
l1 = []
l2 = []
for i in range(1, int(r+1)):
    if n % i == 0:
        a = i
        b = n / i
        if a <= b:
            l1.append([str(a), str(int(b))])
print(l1)

for j in l1:
    u = j[0]
    v = j[1]
    if len(u) >= len(v):
        f = len(j[0])
    else:
        f = len(j[1])
    l2.append(f)

print(min(l2))


Fixed code:
n = int(input())
import math
r = math.sqrt(n)
l1 = []
l2 = []
for i in range(1, int(r+1)):
    if n % i == 0:
        a = i
        b = n / i
        if a <= b:
            l1.append([str(a), str(int(b))])

for j in l1:
    u = j[0]
    v = j[1]
    if len(u) >= len(v):
        f = len(u)
    else:
        f = len(v)
    l2.append(f)

print(min(l2))
Buggy code:
n=int(input())
ans=1
for i in range(1,int(n**0.5)+1):
    if n%i==0:
        ans=i
print(len(str(ans)))
    

Fixed code:
n=int(input())
ans=1
for i in range(1,int(n**0.5)+1):
    if n%i==0:
        ans=i
print(len(str(n//ans)))
Buggy code:
import math
N= int(input())
mn = 100
ref = 100
for i in range(1,int(N/2)+1):
    if N%i == 0:
        #print(i,int(N/i))
        ref = max(len(str(i)),len(str(int(N/i))))
        #print(mn,ref)
        if ref < mn:
            mn = ref
print(mn)

Fixed code:
import math
N= int(input())
mn = 100
ref = 100
for i in range(1,int(math.sqrt(N))+1):
    if N%i == 0:
        #print(i,int(N/i))
        ref = max(len(str(i)),len(str(int(N/i))))
        #print(mn,ref)
        if ref < mn:
            mn = ref
print(mn)
Buggy code:
N = int(input())

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

print(len(str(max(sosuu, B))))


Fixed code:
import math

N = int(input())

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

print(len(str(max(sosuu, B))))
Buggy code:
N = int(input())

for i in range(int(N**0.5)+1, 0, -1):
    div, mod = divmod(N, i)
    if not mod:
        print(len(str(min(div, N//div))))
        exit()


Fixed code:
N = int(input())

for i in range(int(N**0.5)+1, 0, -1):
    div, mod = divmod(N, i)
    if not mod:
        print(len(str(max(div, N//div))))
        exit()
Buggy code:
import math
import fractions
N=int(input())
A=fractions.sqrt(N)
A=fractions.ceil(A)
mini=100000000000
for i in range(1,A+1):
    if N%i==0:
        x=len(str(i))
        y=len(str(N//i))
        if mini>max(x,y):
            mini=max(x,y)
print(mini)


Fixed code:
import math
import fractions
N=int(input())
A=math.sqrt(N)
A=math.ceil(A)
mini=100000000000
for i in range(1,A+1):
    if N%i==0:
        x=len(str(i))
        y=len(str(N//i))
        if mini>max(x,y):
            mini=max(x,y)
print(mini)
Buggy code:
N=int(input())
M=int((N**(1/2)))

print(min([max([len(str(i)),len(str(int(N/i)))]) for i in range(int(N/2)-M,int(N/2)+M) if N%i==0]))

Fixed code:
N=int(input())
M=int((N**(1/2)))
print(min([max([len(str(i)),len(str(int(N/i)))]) for i in range(1,M+1) if N%i==0]))
Buggy code:
def m():
    n = int(input())
    i=1
    div = []
    while i*i <= n:
        if n % i == 0:
            div.append(i)
        i+=1
    a = max(div)
    b = n / a
    d = max(a,b)
    return len(str(d))

print(m())

Fixed code:
def m():
    n = int(input())
    i=1
    div = []
    while i*i <= n:
        if n % i == 0:
            div.append(i)
        i+=1
    a = max(div)
    b = n // a
    d = max(a,b)
    return len(str(d))

print(m())
Buggy code:
import math
N = int(input())
rt = 0
A = int(math.sqrt(N))+1
for i in range(A,0,-1):
    if N % i == 0:
      rt = len(str(N-i))-len(str(i))
      break
print(rt)


Fixed code:
import math
N = int(input())
rt = 0
A = int(math.sqrt(N))
for i in range(A,0,-1):
    if N % i == 0:
      rt = len(str(N//i))
      break
print(rt)
Buggy code:
b = input()
a =int(b)
m = len(b)
for i in reversed(range(1,int(math.sqrt(a))+1)):
    if a/i == int(a/i):
        m = max(len(str(a//i)),len(str(i)))
        break
print(m)

Fixed code:
import math
b = input()
a =int(b)
m = len(b)
for i in reversed(range(1,int(math.sqrt(a))+1)):
    if a/i == int(a/i):
        m = max(len(str(a//i)),len(str(i)))
        break
print(m)
Buggy code:
import math

N = int(input())
N_max = math.floor(pow(N, 0.5))

ans = math.floor(math.log10(N))

for i in range(1, N_max+1):
    if N % i == 0:
        M = N / i
        digI = math.floor(math.log10(i)) + 1
        digM = math.floor(math.log10(M)) + 1
        if digI >= digM:
            score = digI
        else:
            score = digM

        if score <= ans:
            ans = score

print(ans)

Fixed code:
import math

N = int(input())
N_max = math.floor(pow(N, 0.5))

ans = math.floor(math.log10(N)) + 1

for i in range(1, N_max+1):
    if N % i == 0:
        M = N / i
        digI = math.floor(math.log10(i)) + 1
        digM = math.floor(math.log10(M)) + 1
        if digI >= digM:
            score = digI
        else:
            score = digM

        if score <= ans:
            ans = score

print(ans)
Buggy code:
import math
N = int(input())
n = math.ceil(math.sqrt(N))
A = 1
B = N
for i in range(n+1):
  A = n-i
  if N%A==0:
    B = N//A
    break

print(len(str(A)))

Fixed code:
import math
N = int(input())
n = math.ceil(math.sqrt(N))
A = 1
B = N
for i in range(n+1):
  A = n-i
  if N%A==0:
    B = N//A
    break

print(len(str(B)))
Buggy code:
import math
N = int(input())
ans = math.inf
for i in range(1, 1+math.floor(math.sqrt(N))):
    if N % i == 0:
        ans = min(ans, len(str(N/i)))
print(ans)


Fixed code:
import math
N = int(input())
ans = N
for i in range(1, 1+math.floor(math.sqrt(N))):
    if N % i == 0:
        ans = min(ans, len(str(N//i)))
print(ans)
Buggy code:
n = int(input())
if n < 10:
  print(1)
else:
  sqn = int(n**0.5)
  c = float("inf")
  for i in range(1, sqn):
    if n%i == 0:
      d = max(i//10, (n//i)//10)
      c = min(c, d)
  print(c)

Fixed code:
n = int(input())
if n < 10:
  print(1)
else:
  sqn = int(n**0.5)
  c = float("inf")
  for i in range(1, sqn+1):
    if n%i == 0:
      d = max(len(str(i)), len(str(n//i)))
      c = min(c, d)
  print(c)
Buggy code:
import math
N = int(input())
c = math.sqrt(N) // 1
while 1:
  if N % c == 0:
    A = int(c)
    B = int(N / c)
    break
  c -= 1
print(A,B)
print(max(len(str(A)),len(str(B)) ))


Fixed code:
import math
N = int(input())
c = math.sqrt(N) // 1
while 1:
  if N % c == 0:
    A = int(c)
    B = int(N / c)
    break
  c -= 1
print(max(len(str(A)),len(str(B)) ))
Buggy code:
N = int(input())

ans1 = 0

A = '1'
B = str(N)

if len(A)>=len(B):
    ans = len(A)
else:
    ans = len(B)
    
for i in range(2,int(math.sqrt(N)+1):
    A = i
    if N%A==0:
        B = int(N / A)
        A = str(A)
        B = str(B)
        if len(A)>=len(B):
            ans1 = len(A)
        else:
            ans1 = len(B)
        if ans1 <= ans:
            ans = ans1
    if len(str(A))==len(str(B)):
        break
print(ans)


Fixed code:
import math

N = int(input())

ans1 = 0

A = '1'
B = str(N)

if len(A)>=len(B):
    ans = len(A)
else:
    ans = len(B)
    
for i in range(2,int(math.sqrt(N))+1):
    A = i
    if N%A==0:
        B = int(N / A)
        A = str(A)
        B = str(B)
        if len(A)>=len(B):
            ans1 = len(A)
        else:
            ans1 = len(B)
        if ans1 <= ans:
            ans = ans1
    if len(str(A))==len(str(B)):
        break
print(ans)
Buggy code:
def divisible_length(n):
	min_length = len(str(n))
  	for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            min_length = min(min_length, len(str(i)))
            if i != n // i:
	            min_length = min(min_length, len(str(n // i)))
    return min_length


n = int(input())
print(divisible_length(n))

Fixed code:
def divisible_length(n):
    min_length = len(str(n))
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            min_length = min(min_length, max(len(str(i)), len(str(n // i))))
    return min_length

n = int(input())
print(divisible_length(n))
Buggy code:
n = int(input())
for i in range(int(n**0.5), 0, -1):
  if n % i == 0:
    print(n//i)
    break

Fixed code:
n = int(input())
for i in range(int(n**0.5), 0, -1):
  if n % i == 0:
    print(len(str(n//i)))
    break
Buggy code:
import math
n=int(input())
l=math.floor(math.sqrt(n))

for i in range(l,1,-1):
    if n%i==0:
        a,b=i,n//i
        x=max(math.floor(math.log10(a))+1,math.floor(math.log10(b))+1)
        break
print(k)


Fixed code:
import math
n=int(input())
l=math.floor(math.sqrt(n))

for i in range(l+1,0,-1):
    if n%i==0:
        a,b=i,n//i
        k=max(math.floor(math.log10(a))+1,math.floor(math.log10(b))+1)
        break
print(k)
Buggy code:
n=int(input())
ans = []
for i in range(1,n**0.5+1):
  if n%i==0:
    j=n//i
    ans.append(len(str(i))+len(str(j)))
print(max(ans))

Fixed code:
n=int(input())
ans = []
for i in range(1,int(n**0.5+1)):
  if n%i==0:
    j=n//i
    ans.append(max(len(str(i)),len(str(j))))
print(min(ans))
Buggy code:
def getdigit(N):
  cnt = 0
  while(N>0):
    cnt++
    N //= 10
  return cnt

N = int(input())
for i in reversed(range(1,sqrt(N)+1)):
  if(N % i == 0):
    print(max(getdigit(i), getdigit(N/i)))
    exit()
          
  


Fixed code:
def getdigit(N):
  cnt = 0
  while(N>0):
    cnt += 1
    N //= 10
  return cnt

N = int(input())
for i in reversed(range(1,int(pow(N, 1/2))+1)):
  if(N % i == 0):
    print(max(getdigit(i), getdigit(N/i)))
    exit()
Buggy code:
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 // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

def digit_count(n):
  str_n = str(n)
  
  return len(str_n)

N = int(input())
divisor = make_divisors(N)

if len(divisor) % 2 == 1:
  num = divisor[int(len(divisor)/2)]
  ans = digit_count(num)
  print(ans)
else:
  num1 = divisor[int(len(divisor)/2) -1]
  num2 = divisor[int(len(divisor)/2)]
  
  print(num1)
  print(num2)
  
  ans1 = digit_count(num1)
  ans2 = digit_count(num2)
  
  if ans1 > ans2:
    print(ans1)
  elif ans2 > ans1:
    print(ans2)
  else:
    print(ans1)

Fixed code:
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 // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

def digit_count(n):
  str_n = str(n)
  
  return len(str_n)

N = int(input())
divisor = make_divisors(N)

if len(divisor) % 2 == 1:
  num = divisor[int(len(divisor)/2)]
  ans = digit_count(num)
  print(ans)
else:
  num1 = divisor[int(len(divisor)/2) -1]
  num2 = divisor[int(len(divisor)/2)]  
  ans1 = digit_count(num1)
  ans2 = digit_count(num2)
  
  if ans1 > ans2:
    print(ans1)
  elif ans2 > ans1:
    print(ans2)
  else:
    print(ans1)
Buggy code:
n=int(input())
m=0
for i in range(1,int((n)**(1/2))+1):
  if n%i==0:
    num1=i
    num2=n//i
    l1=len(str(num1))
    l2=len(str(num2))
    if m>max(l1,l2):
      m=max(l1,l2)
print(m)

Fixed code:
n=int(input())
m=100000000000
for i in range(1,int((n)**(1/2))+1):
  if n%i==0:
    num1=i
    num2=n//i
    l1=len(str(num1))
    l2=len(str(num2))
    m1=max(l1,l2)
    if m>m1:
      m=m1
print(m)
Buggy code:
import math
N=int(input())
a=0
for i in range(1,1+math.ceil(math.sqrt(N))):
    if N%i==0 and i>a:
        a=i
b=int(N/a)
print(max([len(str(a)),len(str(b))]))9876543210

Fixed code:
import math
N=int(input())
a=0
for i in range(1,1+math.ceil(math.sqrt(N))):
    if N%i==0 and i>a:
        a=i
b=int(N/a)
print(max([len(str(a)),len(str(b))]))
Buggy code:
import math
N = int(input())
ans = 10

for i in reversed(range(1,int(math.sqrt(N)) + 1)):
    if N % i == 0:
        A = len(str(i))
        B = len(str(N / i))
        ans = min(ans,max(A,B))

print(ans)

Fixed code:
import math
N = int(input())
ans = 10

for i in reversed(range(1,int(math.sqrt(N)) + 1)):
    if N % i == 0:
        A = len(str(i))
        B = len(str(N //  i))
        ans = min(ans,max(A,B))

print(ans)
Buggy code:
# 14 : 05 - 14 : 18
import math
N = int(input())
for_max = math.ceil(math.sqrt(N))
ans = 10 ** 18

for i in range(1, for_max + 1):
    if N % i == 0:#dividible
        a = N // i
        b = i
        #digit = log10(N) + 1
        func = max(math.log10(a) + 1, math.log10(b) + 1)
        func = math.ceil(func)
        ans = min(ans, func)
print(ans)


    


Fixed code:
# 14 : 05 - 14 : 18
import math
N = int(input())
for_max = math.ceil(math.sqrt(N))
ans = 10 ** 18

for i in range(1, for_max + 1):
    if N % i == 0:#dividible
        a = N // i
        b = i
        #digit = log10(N) + 1
        func = max(math.log10(a) + 1, math.log10(b) + 1)
        func = int(func)
        ans = min(ans, func)
print(ans)
Buggy code:
import math
N = int(input())

dvs = []
pair = []
digit = []

for i in range(1, N+1):
  if N % i == 0:
    dvs.append(i)
    
for i in range(len(dvs)//2+1):
  pair.append([dvs[i], dvs[-(i+1)]])

for i in range(len(pair)):
  digitA = int(math.log10(pair[i][0])) + 1
  digitB = int(math.log10(pair[i][1])) + 1
  digit.append(max(digitA, digitB))

ans = min(digit)
print(ans)

Fixed code:
import math
N = int(input())

dvs = []
pair = []
digit = []

for i in range(1, int(N**0.5)+1):
  if N % i == 0:
    pair.append([i, N/i])
    
#for i in range(len(dvs)//2+1):
#  pair.append([dvs[i], dvs[-(i+1)]])

for i in range(len(pair)):
  digitA = int(math.log10(pair[i][0])) + 1
  digitB = int(math.log10(pair[i][1])) + 1
  digit.append(max(digitA, digitB))

ans = min(digit)
print(ans)
Buggy code:
N = int(input()) 
ans = 111111111110
for i in range(int(N**0.5+2)):
    if N%i == 0:
        use = N//i 
        s = str(use) 
        t = str(i) 
        ans = min(ans, max(len(s), len(t))) 

print(ans)

Fixed code:
N = int(input()) 
ans = 111111111110
for i in range(1,int(N**0.5+2)):
    if N%i == 0:
        use = N//i 
        s = str(use) 
        t = str(i) 
        ans = min(ans, max(len(s), len(t))) 

print(ans)
Buggy code:
n=int(input())
f=[0]*int(n**0.5)
for a in range(int(n**0.5)):
    b=n/(a+1)
    f[a]=max(len(str(a)), len(str(b)))
print(min(f)-2)

Fixed code:
n=int(input())
f=[10]*int(n**0.5)
for a in range(int(n**0.5)):
    b=n/(a+1)
    if b-int(b)==0:
        f[a]=max(len(str(a)), len(str(int(b))))
print(min(f))
Buggy code:
import math
n = int(input())
nn = int(math.sqrt(n))
while n%nn != 0: nn-=1
print(len(str(n/nn)))

Fixed code:
import math
n = int(input())
a = int(math.sqrt(n))
while n%a != 0: a-=1
print(len(str(n//a)))
Buggy code:
import math
n = int(input())
nn = int(math.sqrt(n))
while n%i != 0: i-=1
print(len(str(n//i)))


Fixed code:
import math
n = int(input())
nn = int(math.sqrt(n))
while n%nn != 0: nn-=1
ans = len(str(n//nn))
print(ans)
Buggy code:
n = int(input())

def F(a, b):
    return max(len(str(a)), len(str(b)))

ans = 10**10
for i in range(1, n//2+1):
    j = n / i
    if (n/i)%1 == 0:
        j = n // i
        if ans > F(i, j):
            ans = F(i, j)
        
print(ans)

Fixed code:
n = int(input())

def F(a, b):
    return max(len(str(a)), len(str(b)))

ans = 10**10
for i in range(1, int(n**(1/2))+1):
    j = n / i
    if (n/i)%1 == 0:
        j = n // i
        if ans > F(i, j):
            ans = F(i, j)
        
print(ans)
Buggy code:
# ABC 057 C - Digits in Multiplication
# 2020/04/07　20:6-
n = int(input())

def F(a, b):
    A = len(str(a))
    B = len(str(b))
    return max(A, B)

ans = math.inf
for i in range(1, int(n**(1/2))+1):
    j = n / i
    if j%1 == 0:
        j = n // i
        if ans > F(i, j):
            ans = F(i, j)
            
print(ans)

Fixed code:
# ABC 057 C - Digits in Multiplication
# 2020/04/07　20:6-
n = int(input())

def F(a, b):
    A = len(str(a))
    B = len(str(b))
    return max(A, B)

ans = 10**12
for i in range(1, int(n**(1/2))+1):
    j = n / i
    if j%1 == 0:
        j = n // i
        if ans > F(i, j):
            ans = F(i, j)
            
print(ans)
Buggy code:
import fractions
n = int(input())
half = int(fractions.sqrt(n))

ans = []
for i in range(half, 0, -1):
    if n%i==0:
        ans.append(max(len(str(i)), len(str(n//i))))
print(min(ans))

Fixed code:
import math
n = int(input())
half = int(math.sqrt(n))

ans = []
for i in range(half, 0, -1):
    if n%i==0:
        ans.append(max(len(str(i)), len(str(n//i))))
print(min(ans))
Buggy code:
n = int(input())
import math as ms
dic = []
for i in range(1,ms.floor(n / 2) + 1):
    if n % i == 0:
        dic.append([i,n // i])
    
f = []
for i in range(len(dic)):
    a = ms.floor(ms.log10(dic[i][0])) + 1
    b = ms.floor(ms.log10(dic[i][1])) + 1
    f.append(max(a,b))
    
print(min(f))
    

Fixed code:
n = int(input())
import math as ms
dic = []
for i in range(1,ms.floor(ms.sqrt(n)) + 1):
    if n % i == 0:
        dic.append([i,n // i]) 
f = []
for i in range(len(dic)):
    a = ms.floor(ms.log10(dic[i][0])) + 1
    b = ms.floor(ms.log10(dic[i][1])) + 1
    f.append(max(a,b))
    
print(min(f))
Buggy code:
import itertools

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n = int(input())

f = factorization(n)

print(f)

if len(f) == 1:
    print(len(str(n)))
else:
    pf = []
    for r in f:
        pf += [r[0]]*r[1]
    ans = len(str(n))
    for i in range(1,len(pf)//2+2):
        for c in itertools.combinations(pf, i):
            tmp = 1
            for t in c:
                tmp *= t
            ans = min(ans, max(len(str(tmp)), len(str(n//tmp))))
    print(ans)

Fixed code:
import itertools

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n = int(input())

f = factorization(n)

#print(f)

if len(f) == 1 and f[0][1] == 1:
    print(len(str(n)))
else:
    pf = []
    for r in f:
        if r[0] == 1:
            continue
        pf += [r[0]]*r[1]
    ans = len(str(n))
    for i in range(1,len(pf)//2+1):
        for c in itertools.combinations(pf, i):
            #print(c)
            tmp = 1
            for t in c:
                tmp *= t
            ans = min(ans, max(len(str(tmp)), len(str(n//tmp))))
    print(ans)
Buggy code:
import math
n=int(input())
k=int(math.sqrt(n))
l=[]
for i in range(1,k+2):
    n%i==0:l.append(max(len(str(i),len(str(n//i))))
print(min(l))

Fixed code:
import math
n=int(input())
k=int(math.sqrt(n))
l=[]
for i in range(1,k+2):
    if n%i==0:l.append(max( len(str(i)), len(str(n//i)) ))
print(min(l))
Buggy code:
from math import sqrt

def F(t):
    return max(len(str(t[0])), len(str(t[1])))

N = long(input())
m = list(map(F,[(r,int(N / r)) for r in range(2, int(sqrt(N))) if N % r == 0]))
print(min(m)) if len(m) != 0 else print(len(str(N)))

Fixed code:
from math import sqrt

def F(t):
    return max(len(str(t[0])), len(str(t[1])))

N = int(input())
m = list(map(F,[(r,int(N / r)) for r in range(2, int(sqrt(N)) + 1) if N % r == 0]))
print(min(m) if len(m) != 0 else len(str(N)))
Buggy code:
def resolve():
    N = int(input())
    factors = prime_factors(N)
    print(factors)
    minf = float("inf")
    
    for bits in range(1<<len(factors)):
        fac_a = 1
        for odr in range(len(factors)):
            if bits & (1<<odr):
                fac_a *= factors[odr]
                
        fac_b = N // fac_a
        l = max(len(str(fac_a)), len(str(fac_b)))
        minf = min(minf, l)
    print(minf)

def prime_factors(n):
    i = 2
    factors = []
    while i**2 <= n:
        if n % i != 0:
            i += 1
        else:
            factors.append(i)
            n = n // i
    if n > 1:
        factors.append(n)
    return factors
    



if '__main__' == __name__:
    resolve()

Fixed code:
def resolve():
    N = int(input())
    factors = prime_factors(N)
    minf = float("inf")
    
    for bits in range(1<<len(factors)):
        fac_a = 1
        for odr in range(len(factors)):
            if bits & (1<<odr):
                fac_a *= factors[odr]

        fac_b = N // fac_a
        l = max(len(str(fac_a)), len(str(fac_b)))
        minf = min(minf, l)
    print(minf)

def prime_factors(n):
    i = 2
    factors = []
    while i**2 <= n:
        if n % i != 0:
            i += 1
        else:
            factors.append(i)
            n = n // i
    if n > 1:
        factors.append(n)
    return factors
    



if '__main__' == __name__:
    resolve()
Buggy code:
N=int(input())
import math
rootN=math.sqrt(N)
if rootN==int(rootN):
    n=int(rootN)
else:
    for m in reversed(range(1,int(rootN)+1)):
        if N%m==0:
            n=m
            break
print(len(str(n)))


Fixed code:
N=int(input())
import math
rootN=math.sqrt(N)
if rootN==int(rootN):
    n=int(rootN)
else:
    for m in reversed(range(1,int(rootN)+1)):
        if N%m==0:
            n=int(N/m)
            break
print(len(str(n)))
Buggy code:
def func(num):
    cnt=0
    while(num>0):
        num/=10
        cnt+=1
    return cnt
N=int(input())
ans=100
for i in range(1,N**(1/2)+1):
    tmp=0
    if(N%i==0):
        tmp=max(func(i),func(N/i))
    ans=min(ans,tmp)
print(ans)

Fixed code:
def func(num):
    cnt=0
    while(num>0):
        num=int(num/10)
        cnt+=1
    return cnt

N=int(input())
ans=100
for i in range(1,int(N**(1/2)+1)):
    tmp=100
    if(N%i==0):
        tmp=max(func(i),func(N/i))
    ans=min(ans,tmp)
print(ans)
Buggy code:
N = int(input())

score = len(str(N))

i = 2
while i ** 2 < N:
    a, b = divmod(N, i)
    if b == 0:
        score = len(str(a))
	i += 1
print(score)


Fixed code:
N = int(input())

score = len(str(N))

i = 2
while i ** 2 <= N:
    a, b = divmod(N, i)
    if b == 0:
        score = min(score, len(str(a)))
    i += 1
print(score)
Buggy code:
N = int(input())

x = []
for i in range(1, int((N+1)**0.5)+1):
  if N % i == 0:
    x.append(i)

y = int(N/x[-1])
print(y)
print(len(str(y)))


Fixed code:
N = int(input())

x = []
for i in range(1, int((N+1)**0.5)+1):
  if N % i == 0:
    x.append(i)

y = int(N/x[-1])
print(len(str(y)))
Buggy code:
import math

n = int(input())

def f(a,b):
    return len(str(a)) if len(str(a)) > len(str(b)) else len(str(b))

min = 10

for i in range(1,int(math.sqrt(n))):
    if n%i==0 and min > f(i,n//i):
        min = f(i,n//i)

if len(str(n))<10:
    min=1

print(min)

Fixed code:
import math

n = int(input())

def f(a,b):
    return len(str(a)) if len(str(a)) > len(str(b)) else len(str(b))

min = 10

for i in range(1,int(math.sqrt(n))+1):
    if n%i==0 and min > f(i,n//i):
        min = f(i,n//i)

if n<10:
    min=1

print(min)
Buggy code:
N = int(input())
rootn = int(N*0.5) +1
A = range(1, rootn)
min_digits = 11
for i in A:
    if (N % A) == 0:
        B = N // A
        p, q =len(str(A)), len(str(B))
        if (p > q) and p < min_digits:
            min_digits = p
        elif (p <= q) and q < min_digits:
            min_digits = q
print(min_digits)
            
      

Fixed code:
N = int(input())
rootn = int((N**0.5) +1)
A = range(1, rootn)
min_digits = 11
for i in A:
    if (N % i) == 0:
        B = N // i
        p, q =len(str(i)), len(str(B))
        if (p > q) and (p < min_digits):
            min_digits = p
        elif (p <= q) and (q < min_digits):
            min_digits = q
print(min_digits)
Buggy code:
n=int(input())

for a in range(1,n**0.5+1):
    if n%a==0:
        b=n//a
        sa=str(a)
        sb=str(b)
        if a<=b:
             ans=len(sb)
        else:
            break

print(ans)

Fixed code:
n=int(input())

for a in range(1,int(n**0.5+1)):
    if n%a==0:
        b=n//a
        sa=str(a)
        sb=str(b)
        if a<=b:
             ans=len(sb)
        else:
            break

print(ans)
Buggy code:
N=int(input())
ans=float('inf')

for i in range(1,N**0.5+1):
    if N%i==0:
        ans=min(ans,len(str(N//i)))
print(ans)

Fixed code:
N=int(input())
ans=float('inf')

for i in range(1,int(N**0.5+1)):
    if N%i==0:
        ans=min(ans,len(str(N//i)))
print(ans)