Problem:


Score : 300 points

Problem Statement

You are given an integer N.

For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.

For example, F(3,11) = 2 since 3 has one digit and 11 has two digits.

Find the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.

Constraints

1 \leq N \leq 10^{10}

N is an integer.

Input

The input is given from Standard Input in the following format:

N

Output

Print the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \times B.

Sample Input 1

10000

Sample Output 1

3

F(A,B) has a minimum value of 3 at (A,B)=(100,100).

Sample Input 2

1000003

Sample Output 2

7

There are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.

Sample Input 3

9876543210

Sample Output 3

6



Sample input:
10000


Sample output:
3

Submission status: Runtime Error

Solution code:
n=int(input())
import fractions
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n = n//i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table
d=list(prime_decomposition(n))
cnt=n
ans=[]
a=1
if n==1:
    print(1)
else:
    if len(list(str(d[len(d)-1])))>=(len(list(str(n)))+1)//2:
        print(len(list(str(d[len(d)-1]))))
    else:
        for i in range(d):
            a*=d[i]
            if a>n**(1/2):
                break
        a=str(a)
        print(len(list(a)))

Submission status: Runtime Error

Solution code:
n=int(input())
import fractions
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n = n//i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table
d=list(prime_decomposition(n))
cnt=n
ans=[]
a=1
if len(list(str(d[len(d)-1])))>=len(list(str(n)))//2+1:
    print(len(list(str(d[len(d)-1]))))
else:
    print(len(list(str(n)))//2+1)

Submission status: Runtime Error

Solution code:
def make_divisors(n):
    divisors = []
    min_k = []
    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)
                k = max(len(str(int(i))), len(str(int(n // i))))
                min_k.append(k)

    # divisors.sort()
    return min_k

N = int(input())
# min_k = len(str(N)) + 1
# for i in range(1, N):
#     if N % i != 0:
#         continue
#     if i ** 2 > N:
#         break
#     else:
#         ii = N // i
#         k = max(len(str(i)), len(str(ii)))
#         # print(i, ii, k, min_k)
#         if min_k > k:
#             min_k = k
print(min(make_divisors(N)))

Submission status: Runtime Error

Solution code:
def make_divisors(n):
    divisors = []
    min_k = []
    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)
                k = max(len(str(i)), len(str(n // i)))
                min_k.append(k)

    # divisors.sort()
    return min_k

N = int(input())
# min_k = len(str(N)) + 1
# for i in range(1, N):
#     if N % i != 0:
#         continue
#     if i ** 2 > N:
#         break
#     else:
#         ii = N // i
#         k = max(len(str(i)), len(str(ii)))
#         # print(i, ii, k, min_k)
#         if min_k > k:
#             min_k = k
print(min(make_divisors(N)))

Submission status: Runtime Error

Solution code:
import math
from sys import stdin
input = stdin.readline

n = int(input())
ans=[]
for i in range(1,round(math.sqrt(n))):
    if n%i==0:
        tmp=max(len(str(i)),len(str(n//i)))
        ans.append(tmp)
print(min(ans))

Submission status: Runtime Error

Solution code:
n = int(input())
 
a = []
b = []
 
 
for i in range(1, n):
    if n%i == 0:
        a.append(i)
        b.append(int(n/i))
 
a = list(map(str, a))
b = list(map(str, b))
 
 
result = []
for i in range(len(a)):
    result.append(max(len(a[i]), len(b[i])))
 
print(min(result))

Submission status: Runtime Error

Solution code:
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
    return divisors
 
N=int(input()) 
div = make_divisors(N)

A = div[-1]
B = N//A
print(max(len(str(A)),len(str(B))))

Submission status: Runtime Error

Solution code:
n=int(input())
def di(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)
    return divisors
li=di(n)
a=li[-1]
b=li[-2]
if a**2==n:
    print(len(str(a)))
else:
    print(max(len(str(a)),len(str(b))))

Submission status: Runtime Error

Solution code:
n=int(input())
def di(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)
    return divisors
li=di(n)
a=li[-1]
b=li[-2]
print(max(len(str(a)),len(str(b))))

Submission status: Runtime Error

Solution code:
import math
N=int(input())
m=int(len(str(N)))
for j in range(2,math.int(sqrt(N))+1):
  a=j
  b=N//j
  m1=len(str(max(a,b)))
  m=min(m,m1)
print(m)

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
    ll N;
    cin >> N;
    int res = 30;
    for(ll i = 1; i*i <= N; ++i) {
        if(N%i) continue;
        ll j = N/i;
        int cnt = 0;
        while(j > 0) ++cnt, j /= 10;
        res = min(res, cnt);
    }
    cout << res << endl;
    return 0;
}

Submission status: Runtime Error

Solution code:
n = int(input())

def get_divisors(num):
    f_divs, l_divs = [], []
    for i in range(1, int(num**0.5)+1):
        if not num % i:
            f_divs.append(i)
            if i != num // i:
                l_divs.append(num // i)
    return f_divs[-1], l_divs[-1]

print(max(*map(lambda x: len(str(x)), get_divisors(n))))

Submission status: Runtime Error

Solution code:
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))

def main():
  n = ni()

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

  def digitlen(n):
    return len(str(n))

  x = divi(n)
  x.sort()
  m = len(x) // 2
  if m == 1:
    m = 0
  print(max(digitlen(x[m]), digitlen(x[m+1])))

main()

Submission status: Runtime Error

Solution code:
import math
n = int(input())
sqrt_n = math.ceil(math.sqrt(n))

list_cand = []
for i in range(1, sqrt_n):
  if n % i == 0:
    list_cand.append(max(len(str(i)), len(str(n // i))))

print(min(list_cand))

Submission status: Runtime Error

Solution code:
n = int(input())
if n == 1:
  print(0)
else:
  PFs = []
  PNs = []
  for div in range(2, int(n**(0.5) + 1)):
    for pn in PNs:
      if div % pn == 0:
        break
    else:
      PNs.append(div)
      while n % div == 0:
        n /= div
        PFs.append(div)
if len(PFs) == 0:
  PFs = [n]
#print(PFs)
  
Pats = [[]]
for i in range(len(PFs)):
  temp = []
  for pat in Pats:
    temp.append(pat + [0])
    temp.append(pat + [1])
  Pats = temp
  
min_max = 1000000000000000
for pat in Pats:
  a = 1
  b = 1
  for i, num in enumerate(pat):
    if num == 0:
      a *= PFs[i]
    else:
      b *= PFs[i]
#  print(a, b, pat)
  fx = max(len(str(a)), len(str(b)))
  min_max = min(min_max, fx)
print(min_max)

Submission status: Runtime Error

Solution code:
import math
n = int(input())
l = []
for i in range(1, int(math.sqrt(n)//1)):
    if n % i == 0:
        l.append(int(n / i))
print(len(str(l[-1])))

Submission status: Runtime Error

Solution code:
n = int(input())
l = []
for i in range(1, int(math.sqrt(n)//1)):
    if n % i == 0:
        l.append(int(n / i))
print(len(str(l[-1])))

Submission status: Runtime Error

Solution code:
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
na = lambda : map(int, stdin.readline().split())
ni = lambda : int(ns())
def main():
  n = ni()
  nagasa = lambda x: len(str(x))
  def f(a, b):
    x = nagasa(a)
    y = nagasa(b)
    return x if x > y else y

  def divi(n):
    res = []
    for i in range(1, int(n**0.5)+1):
      if n % i == 0:
        res.append(i)
        if i != n // i:
          res.append(n // i)
    return res
  x = divi(n)
  print(f(x[-1], x[-2]))

main()

Submission status: Runtime Error

Solution code:
import math as m
N = int(input())
F_ab = 0
for i in range(1, int(sqrt(N))+1):
    if N%i != 0:
        continue
    if i == 1:
        F_ab = len(str(N//i))
    else:
        F_ab = min(F_ab, max(len(str(i)), len(str(N//i))))

print(F_ab)

Submission status: Runtime Error

Solution code:
N = int(input())
K = int(n**(1/2))
a = len(str(N))

for i in range(1,k+1):
  if N%i==0:
    a=len(str(n//i))

print(a)

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
AB = []
for i in range(N):
  AB.append(list(map(int, input().split())))
CD = []
for i in range(M):
  CD.append(list(map(int, input().split())))
idx = 0
for i in range(N):
  d0 = 9900000000
  for j in range(M):
    d = abs(AB[i][0]-CD[j][0])+abs(AB[i][1]-CD[j][1])
    if d0 > d:
      d0 = d
      idx = j+1
  print(idx)

Submission status: Runtime Error

Solution code:
import sys
import copy
import string
import  math
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

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

li = make_divisors(ni())
ans = 10000000000000000
for i in range(len(li) // 2):
    f = max(len(str(li[i])), len(str(li[-(i+1)])))
    ans = min(f, ans)
if len(li) % 2 != 0:
    if len(li) == 1
        ans = 1
    else:
        ans = min(len(str(li[len(li)//2 + 1])), ans)
print(ans)

Submission status: Runtime Error

Solution code:
import sys
import copy
import string
import  math
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

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

li = make_divisors(ni())
ans = 10000000000000000
for i in range(len(li) // 2):
    f = max(len(str(li[i])), len(str(li[-(i+1)])))
    ans = min(f, ans)
if len(li) % 2 != 0:
    ans = min(len(str(li[len(li)//2 + 1])), ans)
print(ans)

Submission status: Runtime Error

Solution code:
import math

N = int(input())

box = []

for A in range(1, math.floor(math.sqrt(N))):
     if N % A == 0:
        B = N // A
        box.append(max(math.floor(math.log10(A)+1),math.floor(math.log10(B)+1)))
    
   

print(min(box))

Submission status: Runtime Error

Solution code:
import math

N = int(input())

box = []

for A in range(1, N):
    if N % A == 0:
        B = N // A
        box.append(max(math.floor(math.log10(A)+1),math.floor(math.log10(B)+1)))

print(min(box))

Submission status: Runtime Error

Solution 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)

Submission status: Runtime Error

Solution code:
n=int(input())
m=n**(1/2)//1+1
l=[]
for i in range(m+1)[:0:-1]:
  if n%i==0:
    l.append(max(len(str(i)),len(str(n//i))))
  if len(l)==3:
    break
print(min(l))

Submission status: Runtime Error

Solution code:
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
using namespace std;
using ll = long long;

vector<ll> prime_factor(ll n) {
  vector<ll> ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
        ret.push_back(i);
        n /= i;
    }
  }
  if(n != 1) ret.push_back(n);
  return ret;
}

int main() {
    ll n;
    vector<ll> ans;
    cin >> n;
    ans = prime_factor(n);
    ll a=1,b=1;
    reverse(ans.begin(),ans.end());
    for (auto r:ans) {
        if (a<b) a*=r;
        else b*=r;
    }
    string z=to_string(max(a,b));
    cout << z.length() << endl;
    return 0;
}

Submission status: Runtime Error

Solution code:
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
using namespace std;
using ll = long long;

vector<ll> prime_factor(ll n) {
  vector<ll> ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
        ret.push_back(i);
        n /= i;
    }
  }
  if(n != 1) ret.push_back(n);
  return ret;
}

int main() {
    ll n;
    vector<ll> ans;
    cin >> n;
    ans = prime_factor(n);
    ll a=1,b=1;
    reverse(ans.begin(),ans.end());
    for (auto r:ans) {
        if (a<b) a*=r;
        else b*=r;
    }
    string z=to_string(max(a,b));
    cout << z.length() << endl;
    return 0;

Submission status: Runtime Error

Solution code:
n = int(input())

ab = []
ans = []
for i in range(1, int(n**(0.5))):
	ab.clear()
	if n%i == 0:
		ab.append(i)
		ab.append(int(n/i))
		ans.append(len(str(max(ab))))
			

print(min(ans))

Submission status: Runtime Error

Solution code:
x

Submission status: Runtime Error

Solution code:
n = int(input())
res = 0
for i in int(sqrt(n) + 1):
  if(n % i == 0):
    tmp = max([len(i), len(n*i)])
    if(res > tmp):
      res = tmp
print(res)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import math

if __name__ == '__main__':
    N = int(input())
    val = len(N)
    li = []
    for i in range(1, math.ceil(math.sqrt(N))+1):
        if N % i == 0:
            a = len(str(int(i)))
            b = len(str(int(N/i)))
            print(a, b)
            c = max(a, b)

            if c < val:
                val = c

    print(val)

Submission status: Runtime Error

Solution code:
N = long(raw_input())
def dig(A,B):
        if A > B:
                return A
        else:
                return B
A = 0
B = 0 
X = []
i = long(1)
while N > i:
        if N%i == 0:
                A = long(i)
                B = long(N/i)
                X.append(dig(A,B))
        if A in X:
                break
        i+=1
print len(str(min(X)))

Submission status: Runtime Error

Solution code:
N = long(raw_input())
def dig(A,B):
        if A > B:
                return A
        else:
                return B
A = 0
B = 0 
X = []
i = long(1)
print N
while N > i:
        if N%i == 0:
                A = long(i)
                B = long(N/i)
                X.append(dig(A,B))
        if A in X:
                break
        i+=1
print len(str(min(X)))

Submission status: Runtime Error

Solution code:
N = int(raw_input())
a = []
t = []
for i in range(1,N+1):
        for j in range(1,N+1):
                if i*j == N:
                        a.append(i)
                        a.append(j)
                        a.sort() 
                        if a in t:
                                break       
                        else:
                                t.append(a)
                        a = []
        else:
                continue
        break
ans = []
for i in range(0,len(t)):
        x = t[i][0]
        y = t[i][1]
        if x > y:
                ans.append(len(str(x)))
        else:
                ans.append(len(str(y)))
        
print min(ans)

Submission status: Runtime Error

Solution 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))

Submission status: Runtime Error

Solution code:
n = int(input())
half = min(n//10**(len(str(n))//2),n%10**(len(str(n))//2))

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))

Submission status: Runtime Error

Solution code:
n=int(input())
import math
for i in range (math.sqrt(n),0,-1):
  if n%i==0:
    print(max(len(str(i)),len(str(n//i))))
    quit()

Submission status: Runtime Error

Solution code:
N = int(input())
last = N
for num in range(1, N):
  if num**2 > N:
    print(len(str(last)))
    break
  elif num**2 == N:
    print(len(str(num)))
    break
  else
    if N%num == 0:
      last = N//num

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import math

n = int(input())
#tmp = input().split()
#hoge = list(map(lambda a: int(a), tmp))

tmp= math.ceil(math.sqrt(n))

for i in range(0,tmp):
	if(n%(tmp-i)==0):
		break

#print(tmp-i)
ansn=n//(tmp-i)
#print(ansn)
ans=math.floor(math.log10(ansn-1)) + 1

print(ans)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import math

n = int(input())
#tmp = input().split()
#hoge = list(map(lambda a: int(a), tmp))


tmp= math.ceil(math.sqrt(n))

for i in range(0,n):
	if(n%(tmp+i)==0):
		break

#print(tmp+i)
print(math.floor(math.log10(tmp+i-1) + 1))

Submission status: Runtime Error

Solution code:
import bisect
n = int(input())
ls = list(range(n+1))

ans = 10**9
for a in range(1,n):
    b = bisect.bisect_left(ls, n/a)
    ans = min(ans,int(max(len(str(a)),len(str(ls[b])))))
print(ans)

Submission status: Runtime Error

Solution code:
def ans(N):
    v1 = 1

    for i in range(2, int(N)+1):
        if N % i == 0:
            v1 = i
            if v1 >= int(N/i):
                return v1, int(N/i)
    
def F(a, b):
    c = max(a,b)
    return len(str(c))
    
N = int(input())
value1, value2 = ans(N)

print(F(value1,value2))

Submission status: Runtime Error

Solution code:
def ans(N):
    a = []
    while(N > 1):
        for i in range(2, int(N)+1):
            if N % i == 0:
                N /= i
                a.append(i)
                break
    return a
    
def F(a, b):
    c = max(a,b)
    return len(str(c))
    
def ans_value(A):
    v1 = 1
    v2 = 1
    v4 = 1
    for i in A:
        if v1 <= v2:
            v1 *= i
        else:
            v2 *= i
        v4 *= i
    v3 = A[-1]
    v4 /= A[-1]
    if max(v1,v2) <= max(v3,v4):
        return v1, v2
    else:
        return v3, v4
    
N = int(input())
A = ans(N)
value1, value2 = ans_value(A)
print(F(value1,value2))

Submission status: Runtime Error

Solution code:
n=int(input())
ans=len(str(n))
for i in range(1, int(n**0.5)+1):
    if n % i != 0:
        continue
    a=i
    if i != n // i:
        b=n//i
    ans=min(ans,len(str(max(a,b))))
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())

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

    # divisors.sort()
    return divisors

X = make_divisors(N)

for i in X:
    ans = min(1000, max(len(str(i[0])), len(str(i[1]))))

print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())

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

    # divisors.sort()
    return divisors

X = make_divisors(N)

for i in X:
    ans = min(10, max(len(str(i[0])), len(str(i[1]))))

print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())

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

    # divisors.sort()
    return divisors

X = make_divisors(N)

for i in X:
    ans = min(11, max(len(str(i[0])), len(str(i[1]))))

print(ans)

Submission status: Runtime Error

Solution code:
l=make_divisors(n)

Submission status: Runtime Error

Solution code:
import numpy as np

# 整数Nを入力する
N = int(input())
print(N)

# 整数A、Bの桁数のうち、大きい方を返す関数F(A, B)を定義
def F(A, B):
    C = np.vstack((A, B))
    digit_C = np.array(np.log10(C) + 1, dtype = int)
    return np.max(digit_C, axis = 0)

# 被除数の配列を作成
dividend = np.ones(N) * N
# 除数の配列を作成
divisor = np.arange(1, N + 1)
# 商および余りを計算
residue = dividend % divisor

# N = A * B となるようなAおよびBの配列を作成
A = divisor[residue == 0]
B = quotient[residue == 0]

# F(A, B)の最小値を返す
print(np.min(F(A, B)))

Submission status: Runtime Error

Solution code:
import numpy as np

# 整数Nを入力する
N = int(input())

# 整数A、Bの桁数のうち、大きい方を返す関数F(A, B)を定義
def F(A, B):
    C = np.vstack((A, B))
    digit_C = np.array(np.log10(C) + 1, dtype = int)
    return np.max(digit_C, axis = 0)

# 被除数の配列を作成
dividend = np.ones(N, dtype = int) * N
# 除数の配列を作成
divisor = np.arange(1, N + 1)
# 商および余りを計算
quotient = dividend // divisor
residue = dividend % divisor

# N = A * B となるようなAおよびBの配列を作成
A = divisor[residue == 0]
B = quotient[residue == 0]

# F(A, B)の最小値を返す
print(np.min(F(A, B)))

Submission status: Runtime Error

Solution code:
import math
n = int(input())

def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1

def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table

sq = math.sqrt(n)
if sq.is_integer():
    ansInt = sq

if is_prime(n):
    ansInt = n
else:
    ansInt = prime_decomposition(n)
print(len(str(int(max(ansInt)))))

Submission status: Runtime Error

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

# Factoring by trial split
def getPrimeList(n):
  l=[]
  t=int(math.sqrt(n))+1
  
  for a in range(2,t):
    while n%a==0:
      n//=a
      l.append(a)
  
  if n!=1:
    l.append(n)
  
  return l

# 10 -> n
def ten2n(a,n):
  x=a//n
  y=a%n
  if x:
    return ten2n(x,n)+str(y)
  return str(y)

# 方針
# 入力値を素因数分解する
# 制約のn<=10^10は、一見巨大に見えるが
# 2^n でさえ（素因数が最大になる場合）
# nは100にすら満たないことが実験するとわかる
# すなわち全探索ができる
# bit全探索を使用して各素数を振り分けを全パターン試す
# 全パターンについて、F(A,B)の最小値を見ていく

def main():
  n=I()

  if n==9876543210:
    exit()

  l=getPrimeList(n)

  l2=[]
  for i in range(pow(2,len(l))):
    l2.append(list(ten2n(i,2).zfill(len(l))))

  mn=inf
  for y in l2:
    a=b=1
    for i in range(len(y)):
      x=y[i]
      if x=='0':
        a*=l[i]
      else:
        b*=l[i]
    mn=min(mn,max(len(str(a)),len(str(b))))

  return mn

print(main())

Submission status: Runtime Error

Solution code:
n = int(input())
pf={}
for i in range(2,int(n**0.5) + 1):
    if n % i == 0:
      pf[i] = pf.get(i,0) + 1
a = max(pf)
b = int(n/a)
ans = max(len(str(a)), len(str(b)))
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
f = float('inf')
for a in range(1, int(n**0.5)):
    if n % a == 0:
        b = n // a
        x = max(len(str(a)), len(str(b)))
        if f > x:
            f = x
print(x)

Submission status: Runtime Error

Solution code:
from math import sqrt
N = int(input())
ans = []
for i in range(1, int(sqrt(N)) + 1):
    if i * (N // i) == N:
        ans.append(max(len(str(i)), len(str(N // i)))
print(min(ans))

Submission status: Runtime Error

Solution code:
from math import sqrt
N = int(input())
ans = []
for i in range(1, int(sqrt(N))):
    if i * (N // i) == N:
        ans.append(max(len(str(i)), len(str(N // i))))
        
print(max(min(ans), 1))

Submission status: Runtime Error

Solution code:
from math import sqrt

N = int(input())
ans = []
for i in range(1, int(sqrt(N))):
    if i * (N // i) == N:
        ans.append(max(len(str(i)), len(str(N // i))))
        
print(min(ans))

Submission status: Runtime Error

Solution 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]))

Submission status: Runtime Error

Solution 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))

Submission status: Runtime Error

Solution 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)

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T1, class T2>
ostream &operator<<(ostream &s, pair<T1, T2> P)
{
    return s << '<' << P.first << ", " << P.second << '>';
}
template <class T>
ostream &operator<<(ostream &s, vector<T> P)
{
    for (int i = 0; i < P.size(); ++i)
    {
        if (i > 0)
        {
            s << " ";
        }
        s << P[i];
    }
    return s;
}
template <class T>
ostream &operator<<(ostream &s, vector<vector<T>> P)
{
    for (int i = 0; i < P.size(); ++i)
    {
        s << endl
          << P[i];
    }
    return s << endl;
}
template <class T>
ostream &operator<<(ostream &s, set<T> P)
{
    EACH(it, P) { s << "<" << *it << "> "; }
    return s << endl;
}
template <class T1, class T2>
ostream &operator<<(ostream &s, map<T1, T2> P)
{
    EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; }
    return s << endl;
}
typedef long long ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int func(long long num){
    int cnt = 0;
    while (num > 0)
    {
        num /= 10;
        cnt++;
    }
    return cnt;
}

int main()
{
    long long  n;
    cin >> n;
    int ans = INF;
    for (int i = 1; i <= sqrt(n) + 1; i++)
    {
        int tmp=INF;
        if (n % i == 0)
        {
            tmp = max(func(i), func(n / i));
            
        }
        ans = min(ans, tmp);
    }
    cout << ans << endl;
}

Submission status: Runtime Error

Solution code:
N = int(input())

def divisor(N):
    '''
    create divisor_list < sqrt(N) from natural number
    '''
    divisor_list = []
    
    for num in range(1, math.ceil(math.sqrt(N)) + 1):
        if N % num == 0:
            divisor_list.append(num)
    
    return divisor_list
    
def F(A, B):
    return max(len(str(A)), len(str(B)))
  
def minimumF(N):
    factoring_list = divisor(N)
    
    candidate_list = []
    
    for A in factoring_list:
        B = N // A
        candidate_list.append(F(A, B))
        
    return min(candidate_list)
  
print(minimumF(N))

Submission status: Runtime Error

Solution code:
N = int(input())

for i in range(math.ceil(math.sqrt(N)), 0, -1):
    if N % i == 0:
        print(len(str(N//i)))
        break

Submission status: Runtime Error

Solution code:
import math
n = int(input())
a = []
for i in range(1, math.ceil(n**(1/2))):
    if n % i == 0:
        a.append(max(len(str(i)), len(str(n // i))))
print(min(a))

Submission status: Runtime Error

Solution code:
n = int(input())
a = []
for i in range(1, n//2):
    if n % i == 0:
        a.append(max(len(str(i)), len(str(n // i))))
print(min(a))

Submission status: Runtime Error

Solution code:
N = int(input())

Soinsuu = [1]

for i in range(2, N+1):
    while N % i == 0:
        Soinsuu.append(i)
        N = N // i
    else:
        if N == 1:
            break

Soinsuu.sort(reverse=True)

a = Soinsuu[0]
b = Soinsuu[1]

for i in Soinsuu[2:]:
    if a > b:
        b *= i
    else:
        a *= i
        
print(max(len(str(a)), len(str(b))))

Submission status: Runtime Error

Solution code:
N = int(input())

for i in range(1,N):
    if i * i <= N:
        if N % i == 0:
            ans = i
    else:
        break
print(len(str(N // ans)))

Submission status: Runtime Error

Solution 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()

Submission status: Runtime Error

Solution code:
N = map(int,input())
M = int(N**0.5//1)
S = list()
for i in range(M+1):
    if i > 0 :
       if N%i == 0:
           S.append(i)
a =  S[-1]
b = N//a
print(len(str(a))+len(str(b)))

Submission status: Runtime Error

Solution code:
N = input()
M = int(N**0.5//1)
S = list()
for i in range(M+1):
    if i > 0 :
       if N%i == 0:
           S.append(i)
a =  S[-1]
b = N//a
print(len(str(a))+len(str(b)))

Submission status: Runtime Error

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

N = int(input())
prime_list = prime_factors(N)

X = 0
Y = 0

if prime_list:
    X = prime_list.pop(0)
    Y = prime_list.pop(-1)
    for L in prime_list:
        if X < Y:
            X = X*L
        else:
            Y = Y*L

if X >= Y:
    print(len(str(X)))
else:
    print(len(str(Y)))

Submission status: Runtime Error

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

N = int(input())
prime_list = prime_factors(N)
 
X = prime_list.pop(0)
Y = prime_list.pop(-1)
for L in prime_list:
    if X < Y:
        X = X*L
    else:
        Y = Y*L

if X >= Y:
    print(len(str(X)))
else:
    print(len(str(Y)))

Submission status: Runtime Error

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

N = input()
prime_list = prime_factors(N)

X = prime_list.pop(0)
Y = prime_list.pop(-1)
for L in prime_list:
    if X < Y:
        X = X*L
    else:
        Y = Y*L

if X >= Y:
    print(len(str(X)))
else:
    print(len(str(Y)))