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: Wrong Answer

Solution code:
import math

def F(A,B):
    if A > B:
        return len(str(A))
    else:
        return len(str(B))
            

N = int(input())
min = F(1,N)
rt = int(math.sqrt(N))
for i in range(2,rt):
    if N % i != 0:
        continue
    f = F(i,int(N/i))
    if f < min:
        min = f
        break
print(min)

Submission status: Wrong Answer

Solution code:
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

N=_I()

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

#高々10**5まで見れば良い
ans=inf
for i in range(1,min(N,10**5+3)):
	if N%i==0:
		ans=min(ans,F(i,int(N/i)))
		
print(ans)

Submission status: Wrong Answer

Solution code:
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

N=_I()

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

#高々10**5まで見れば良い
ans=inf
for i in range(1,min(N,10**5+1)):
	if N%i==0:
		ans=min(ans,F(i,int(N/i)))
		
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def getPrimeFactorsList(num):
  pn = 2 #素数は2から
  pflist = [] #素因数のリスト
  while pn * pn <= num: #√numまで調べる
    while num % pn == 0: #現在の素数で割り切れる範囲でループ
      num = num / pn
      pflist.append(pn)
    pn += 1 #割り切れなくなったら次の素数へ
  if num > 1:
    pflist.append(int(num))
    
  return pflist

n = int(input())

pf = getPrimeFactorsList(n)
pf_r = reversed(pf)

a = 1
b = 1
for i in pf_r:
  if a > b:
    b *= i
  else:
    a *= i

print(max([len(list(str(int(a)))), len(list(str(int(b))))]))

Submission status: Wrong Answer

Solution code:
def getPrimeFactorsList(num):
  pn = 2 #素数は2から
  pflist = [] #素因数のリスト
  while pn * pn <= num: #√numまで調べる
    while num % pn == 0: #現在の素数で割り切れる範囲でループ
      num = num / pn
      pflist.append(pn)
    pn += 1 #割り切れなくなったら次の素数へ
  if num > 1:
    pflist.append(int(num))
    
  return pflist

n = int(input())

pf = getPrimeFactorsList(n)
pf_r = reversed(pf)

a = 1
b = 1
for i in pf_r:
  if a >= b:
    b *= i
  else:
    a *= i

print(max([len(list(str(int(a)))), len(list(str(int(b))))]))

Submission status: Wrong Answer

Solution code:
def getPrimeFactorsList(num):
  pn = 2 #素数は2から
  pflist = [] #素因数のリスト
  while pn * pn <= num: #√numまで調べる
    while num % pn == 0: #現在の素数で割り切れる範囲でループ
      num = num / pn
      pflist.append(pn)
    pn += 1 #割り切れなくなったら次の素数へ
  if num > 1:
    pflist.append(int(num))
    
  return pflist

n = int(input())

pf = getPrimeFactorsList(n)
pf_r = reversed(pf)
print(pf)
a = 1
b = 1
for i in pf_r:
  if a >= b:
    b *= i
  else:
    a *= i

print(max([len(list(str(int(a)))), len(list(str(int(b))))]))

Submission status: Wrong Answer

Solution code:
N = int(input())

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

def isPrime(n):
    if n < 2:
        return False
    elif n == 2:
        return True
    else:
        for i in range(2, int(n**(1/2))+1):
            if n%i == 0:
                return False
        return True

if isPrime(N):
    print(f(N, 1))
else:
    ans = 10**20
    for i in range(2, int(N**(1/2))+1)[::-1]:
        if N%i == 0:
            ans = min(ans, f(N//i, i))
    print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = N
for i in range(2, int(pow(N, 0.5)) + 1):
    if N % i == 0:
        A = N / i
for j in range(1, N):
    if A < 10 ** j:
        print(j)
        exit()

Submission status: Wrong Answer

Solution code:
import sys
from itertools import product
from collections import deque

def sieve(n):
    """Sieve of Eratosthenes"""
    if n < 2:
        is_prime = [False for _ in range(n+1)]
        return []

    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False
    is_prime[1] = False

    primes = []
    for i in range(2, int(n**0.5)+1):
        if is_prime[i]:
            primes.append(i)
            for j in range(i*2, n+1, i):
                is_prime[j] = False

    return primes


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


def main():
    input = sys.stdin.readline
    N = int(input())
    n = int(N**0.5) + 1
    primes = sieve(n)

    a = 1
    b = 1
    fact = []
    for p in primes:
        while N % p == 0:
            fact.append(p)
            N //= p

    fact.append(N)
    m = len(fact)
    ans = 11
    for x in product(range(2), repeat=m):
        a, b = 1, 1
        for i in range(m):
            if x[i] == 0:
                a *= fact[i]
            else:
                b *= fact[i]

        if ans > f(a, b):
            ans = f(a, b)

    return ans


if __name__ == '__main__':
    print(main())

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque

def sieve(n):
    """Sieve of Eratosthenes"""
    if n < 2:
        is_prime = [False for _ in range(n+1)]
        #return is_prime
        return []

    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False
    is_prime[1] = False

    primes = []

    for i in range(2, int(n**0.5)+1):
        if is_prime[i]:
            primes.append(i)
            for j in range(i*2, n+1, i):
                is_prime[j] = False

    #return is_prime
    return primes


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


def main():
    input = sys.stdin.readline
    N = int(input())
    n = int(N**0.5) + 1
    primes = sieve(n)

    a = 1
    b = 1
    fact = deque()
    for p in primes:
        while N % p == 0:
            fact.append(p)
            N //= p

    fact.append(N)
    while len(fact) > 0:
        p = fact.pop()
        if a > b:
            b *= p
        else:
            a *= p

    return f(a, b)


if __name__ == '__main__':
    print(main())

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque

def sieve(n):
    """Sieve of Eratosthenes"""
    if n < 2:
        is_prime = [False for _ in range(n+1)]
        return []

    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False
    is_prime[1] = False

    primes = []

    for i in range(2, int(n**0.5)+1):
        if is_prime[i]:
            primes.append(i)
            for j in range(i*2, n+1, i):
                is_prime[j] = False

    return primes


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


def main():
    input = sys.stdin.readline
    N = int(input())
    n = int(N**0.5)
    primes = sieve(n)

    a = 1
    b = 1
    fact = deque()
    for p in primes:
        while N % p == 0:
            fact.append(p)
            N //= p

    fact.append(N)
    while len(fact) > 0:
        p = fact.pop()
        if a > b:
            b *= p
        else:
            a *= p

    return f(a, b)


if __name__ == '__main__':
    print(main())

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque

def sieve(n):
    """Sieve of Eratosthenes"""
    if n < 2:
        is_prime = [False for _ in range(n+1)]
        #return is_prime
        return []

    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False
    is_prime[1] = False

    primes = []

    for i in range(2, int(n**0.5)+1):
        if is_prime[i]:
            primes.append(i)
            for j in range(i*2, n+1, i):
                is_prime[j] = False

    #return is_prime
    return primes


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


def main():
    input = sys.stdin.readline
    N = int(input())
    n = int(N**0.5)
    primes = sieve(n)

    a = 1
    b = 1
    residue = deque()
    ans = f(a, N)
    for p in primes:
        cnt = 0
        while N % p == 0:
            cnt += 1
            N //= p

        if cnt % 2 == 1:
            residue.append(p)

        a *= p**(cnt//2)
        b *= p**(cnt//2)

    if a * b < N:
        a *= b
        b = 1

    residue.append(N)
    while len(residue) > 0:
        p = residue.pop()
        if a > b:
            b *= p
        else:
            a *= p

    return f(a, b)


if __name__ == '__main__':
    print(main())

Submission status: Wrong Answer

Solution code:
import sys

def sieve(n):
    """Sieve of Eratosthenes"""
    if n < 2:
        is_prime = [False for _ in range(n+1)]
        return []

    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False
    is_prime[1] = False

    primes = []
    for i in range(2, int(n**0.5)+1):
        if is_prime[i]:
            primes.append(i)
            for j in range(i*2, n+1, i):
                is_prime[j] = False

    return primes


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


def main():
    input = sys.stdin.readline
    N = int(input())
    n = int(N**0.5)

    primes = sieve(n)
    a = 1
    ans = f(a, N)
    for p in primes:
        while N % p == 0:
            a *= p
            N //= p
            ans_ = f(a, N)

            if ans >= ans_:
                ans = ans_
            else:
                return ans

    return ans


if __name__ == '__main__':
    print(main())

Submission status: Wrong Answer

Solution code:
n = int(input())
pf_list = []

min_digit = float('inf')
for i in range(1, n//2+1):
  if n % i == 0:
    a = len(str(int(i)))
    b = len(str(int(n/i)))
    tmp_list = [a, b]
    tmp_list = list(map(int, tmp_list))
    if min_digit > max(tmp_list):
      min_digit = max(tmp_list)

print(min_digit)

Submission status: Wrong Answer

Solution code:
import numpy as np

n = int(input())
n_s = int(np.sqrt(n))

b = n_s
a = 1

for i in range(2, n_s+1):
  if n % i == 0:
    a = i
    b = n//i

print(int(max(np.log10(a), np.log10(b)))+1)

Submission status: Wrong Answer

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 len(prime_list) <= 2:
    prime_list.append(1)

if prime_list and len(prime_list) >= 2:
    X = prime_list.pop(-1)
    Y = prime_list.pop(-1)
    for L in reversed(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: Wrong Answer

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)
print(prime_list)

X = 0
Y = 0

if len(prime_list) <= 2:
    prime_list.append(1)

if prime_list and len(prime_list) >= 2:
    X = prime_list.pop(-1)
    Y = prime_list.pop(-1)
    for L in reversed(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: Wrong Answer

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 len(prime_list) <= 2:
    prime_list.append(1)

if prime_list and len(prime_list) >= 2:
    X = prime_list.pop(-1)
    Y = prime_list.pop(-1)
    for L in reversed(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: Wrong Answer

Solution code:
import math

N = 25
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(max(len(str(a)),len(str(b))))

Submission status: Wrong Answer

Solution code:
import math

N = 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: Wrong Answer

Solution code:
import math

N = int(input())

min_l = len(str(N))

if type(math.sqrt(N)) is int:
    for i in range(1, int(math.sqrt(N))):
        if N % i == 0:
            j = int(N / i)
            min_l = min(min_l, max(len(str(i)), len(str(j))))
    print(min_l)
else:
    print(min_l)

Submission status: Wrong Answer

Solution code:
import math

N = int(input())

min_l = len(str(N))
o_min_l = min_l

for i in range(1, int(math.sqrt(N))):
    if N % i == 0:
        j = int(N / i)
        min_l = min(min_l, max(len(str(i)), len(str(j))))
print(min_l)

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=10
for i in range(1,10**5+1):
  if n%i==0:
    ans=min(ans,len(str(n//i)))
print(ans)

Submission status: Wrong Answer

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 and len(prime_list) >= 2:
    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 len(prime_list) == 1:
    print(1)
elif X >= Y:
    print(len(str(X)))
else:
    print(len(str(Y)))

Submission status: Wrong Answer

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)
print(prime_list)

X = 0
Y = 0

if prime_list and len(prime_list) >= 2:
    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 len(prime_list) == 1:
    print(1)
elif X >= Y:
    print(len(str(X)))
else:
    print(len(str(Y)))

Submission status: Wrong Answer

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 len(prime_list) <= 2:
    prime_list.append(1)

if prime_list and len(prime_list) >= 2:
    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: Wrong Answer

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 and len(prime_list) >= 2:
    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: Wrong Answer

Solution code:
N = int(input())

import math
sqrtN = int(math.sqrt(N))

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

best = 10*9
for n in range(1, sqrtN):
    q, mod = divmod(N, n)
    if mod != 0:
        continue
    v = F(n, q)
    if v < best:
        best = v

print(best)

Submission status: Wrong Answer

Solution code:
import math

def count(a, b):
    a = len(str(a))
    b = len(str(b))

    return max(a, b)

N = int(input())
ans = 10**10

for a in range(1, math.ceil(math.sqrt(N))):
    if not N % a:
        b = N//a
        ans = min(ans, count(a, b))
print(ans)

Submission status: Wrong Answer

Solution code:
9876543210

Submission status: Wrong Answer

Solution code:
import math
N=int(input())
for i in reversed(range(1,math.ceil(math.sqrt(N)))):
    if N%i==0:
        B=N//i
        print(math.floor(math.log10(B))+1)
        break

Submission status: Wrong Answer

Solution code:
N = int(input())
import math
def is_prime(num):
    if num < 2:
        return False
    if num == 2 or num == 3 or num == 5:
        return True
    if num % 2 == 0 or num % 3 == 0 or num % 5 == 0:
        return False

    # 疑似素数(2でも3でも5でも割り切れない数字)で次々に割っていく
    prime = 7
    step = 4
    num_sqrt = math.sqrt(num)
    while prime <= num_sqrt:
        if num % prime == 0:
            return False
        prime += step
        step = 6 - step

    return True
  
import math
if is_prime(N):
    print(len(str(N)))
else:
    print(math.floor(len(str(N)) / 2) + 1)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
val = n
vals = []
for i in range(1, math.ceil(val**0.5)):
    if val % i == 0:
        vals.append(i)

ans = float('inf')
for v in vals:
    ans = min(ans, max(len(str(v)), len(str(n // v))))
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

min_len = len(str(n))
for i in range(2,int(n**(1/2))+1):
    if n%i==0:
        l = max(len(str(i)), len(str(n/i)))
        min_len = min(min_len, l)

print(min_len)

Submission status: Wrong Answer

Solution code:
n = int(input())

import math
import random


class Prime:
    seed_primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]

    def is_prime(self, n):
        """
        prime test (hybrid)

        see also: https://qiita.com/gushwell/items/ff9ed83ba55350aaa369

        :param n:
        :return: boolean
        """
        is_prime_common = self.is_prime_common(n)
        if is_prime_common is not None:
            return is_prime_common

        if n < 2000000:
            return self.is_prime_brute_force(n)
        else:
            return self.is_prime_miller_rabin(n)

    def is_prime_common(self, n):
        if n == 1: return False
        if n in Prime.seed_primes: return True
        if any(map(lambda x: n % x == 0, self.seed_primes)): return False

    def is_prime_brute_force(self, n):
        """
        brute force prime test
        use with is_prime_common if you want to skip seed_primes

        :param n:
        :return: boolean
        """
        for k in range(2, int(math.sqrt(n)) + 1):
            if n % k == 0:
                return False
        return True

    def is_prime_miller_rabin(self, n):
        """
        miller rabin prime test
        use with is_prime_common if you want to skip seed_primes

        see also
            algorithm: https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test
            implementation: https://qiita.com/srtk86/items/609737d50c9ef5f5dc59
            improvement: https://qiita.com/gushwell/items/ff9ed83ba55350aaa369

        :param n:
        :return: boolean
        """

        d = n - 1
        while d & 1 == 0:
            d >>= 1

        # use one of these lines / upper is more efficient.
        witnesses = self.get_witnesses(n)
        # witnesses = [random.randint(1, n - 1) for _ in range(100)]

        for w in witnesses:
            y = pow(w, d, n)

            while d != n - 1 and y != 1 and y != n - 1:
                y = (y * y) % n
                d <<= 1

            if y != n - 1 and d & 1 == 0:
                return False

        return True

    def get_witnesses(self, num):
        def _get_range(num):
            if num < 2047:
                return 1
            if num < 1373653:
                return 2
            if num < 25326001:
                return 3
            if num < 3215031751:
                return 4
            if num < 2152302898747:
                return 5
            if num < 3474749660383:
                return 6
            if num < 341550071728321:
                return 7
            if num < 3825123056546413051:
                return 9
            return 12

        return self.seed_primes[:_get_range(num)]

    def gcd(self, a, b):
        if a < b:
            return self.gcd(b, a)
        if b == 0:
            return a
        while b:
            a, b = b, a % b
        return a

    @staticmethod
    def f(x, n, seed):
        """
        pseudo prime generator
        :param x:
        :param n:
        :param seed:
        :return: pseudo prime
        """
        p = Prime.seed_primes[seed % len(Prime.seed_primes)]
        return (p * x + seed) % n

    def find_factor(self, n, seed=1):
        """
        find one of factor of n
        this function is based to Pollard's rho algorithm

        see also
            algorithm: https://en.wikipedia.org/wiki/Pollard%27s_rho_algorithm
            implementation: https://qiita.com/gushwell/items/561afde2e00bf3380c98

        :param n:
        :param seed:
        :return: factor
        """
        if self.is_prime(n):
            return n

        x, y, d = 2, 2, 1
        count = 0
        while d == 1:
            count += 1
            x = self.f(x, n, seed)
            y = self.f(self.f(y, n, seed), n, seed)
            d = self.gcd(abs(x - y), n)

        if d == n:
            return self.find_factor(n, seed+1)
        return self.find_factor(d)

    def find_factors(self, n):
        primes = {}
        if self.is_prime(n):
            primes[n] = 1
            return primes

        while n > 1:
            factor = self.find_factor(n)

            primes.setdefault(factor, 0)
            primes[factor] += 1

            n //= factor

        return primes

if n==1:
    print(1)
    exit()

prime = Prime()
primes = prime.find_factors(n)

a=1
b=1
for k,v in sorted(primes.items(), reverse=True):
    for i in range(v):
        if a<b:
            a*=k
        else:
            b*=k

print(max(len(str(a)), len(str(b))))

Submission status: Wrong Answer

Solution code:
n = int(input())

import math
import random


class Prime:
    seed_primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]

    def is_prime(self, n):
        """
        prime test (hybrid)

        see also: https://qiita.com/gushwell/items/ff9ed83ba55350aaa369

        :param n:
        :return: boolean
        """
        is_prime_common = self.is_prime_common(n)
        if is_prime_common is not None:
            return is_prime_common

        if n < 2000000:
            return self.is_prime_brute_force(n)
        else:
            return self.is_prime_miller_rabin(n)

    def is_prime_common(self, n):
        if n == 1: return False
        if n in Prime.seed_primes: return True
        if any(map(lambda x: n % x == 0, self.seed_primes)): return False

    def is_prime_brute_force(self, n):
        """
        brute force prime test
        use with is_prime_common if you want to skip seed_primes

        :param n:
        :return: boolean
        """
        for k in range(2, int(math.sqrt(n)) + 1):
            if n % k == 0:
                return False
        return True

    def is_prime_miller_rabin(self, n):
        """
        miller rabin prime test
        use with is_prime_common if you want to skip seed_primes

        see also
            algorithm: https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test
            implementation: https://qiita.com/srtk86/items/609737d50c9ef5f5dc59
            improvement: https://qiita.com/gushwell/items/ff9ed83ba55350aaa369

        :param n:
        :return: boolean
        """

        d = n - 1
        while d & 1 == 0:
            d >>= 1

        # use one of these lines / upper is more efficient.
        witnesses = self.get_witnesses(n)
        # witnesses = [random.randint(1, n - 1) for _ in range(100)]

        for w in witnesses:
            y = pow(w, d, n)

            while d != n - 1 and y != 1 and y != n - 1:
                y = (y * y) % n
                d <<= 1

            if y != n - 1 and d & 1 == 0:
                return False

        return True

    def get_witnesses(self, num):
        def _get_range(num):
            if num < 2047:
                return 1
            if num < 1373653:
                return 2
            if num < 25326001:
                return 3
            if num < 3215031751:
                return 4
            if num < 2152302898747:
                return 5
            if num < 3474749660383:
                return 6
            if num < 341550071728321:
                return 7
            if num < 3825123056546413051:
                return 9
            return 12

        return self.seed_primes[:_get_range(num)]

    def gcd(self, a, b):
        if a < b:
            return self.gcd(b, a)
        if b == 0:
            return a
        while b:
            a, b = b, a % b
        return a

    @staticmethod
    def f(x, n, seed):
        """
        pseudo prime generator
        :param x:
        :param n:
        :param seed:
        :return: pseudo prime
        """
        p = Prime.seed_primes[seed % len(Prime.seed_primes)]
        return (p * x + seed) % n

    def find_factor(self, n, seed=1):
        """
        find one of factor of n
        this function is based to Pollard's rho algorithm

        see also
            algorithm: https://en.wikipedia.org/wiki/Pollard%27s_rho_algorithm
            implementation: https://qiita.com/gushwell/items/561afde2e00bf3380c98

        :param n:
        :param seed:
        :return: factor
        """
        if self.is_prime(n):
            return n

        x, y, d = 2, 2, 1
        count = 0
        while d == 1:
            count += 1
            x = self.f(x, n, seed)
            y = self.f(self.f(y, n, seed), n, seed)
            d = self.gcd(abs(x - y), n)

        if d == n:
            return self.find_factor(n, seed+1)
        return self.find_factor(d)

    def find_factors(self, n):
        primes = {}
        if self.is_prime(n):
            primes[n] = 1
            return primes

        while n > 1:
            factor = self.find_factor(n)

            primes.setdefault(factor, 0)
            primes[factor] += 1

            n //= factor

        return primes

if n==1:
    print(1)
    exit()

prime = Prime()
primes = prime.find_factors(n)

a=1
b=1
cnt=0
for k,v in sorted(primes.items()):
    for i in range(v):
        if cnt%2==0:
            a*=k
        else:
            b*=k
        cnt+=1

print(max(len(str(a)), len(str(b))))

Submission status: Wrong Answer

Solution code:
import math
N=int(input())
ans=10**5
for i in range(1, int(math.sqrt(N))+1):
    if int(N/i) != N/i:
        continue
    else:
        j = int(N/i)
        ans = min(ans, len(str(i)), len(str(j)))
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
import math as m
div = []

for i in range(1,int(m.sqrt(N))):
    if N % i == 0:
        div.append(i)

min = float("inf")
for i in div:
    if max(len(str(i)),len(str(N//i))) <= min:
        min = max(len(str(i)),len(str(N//i)))
print(min)

Submission status: Wrong Answer

Solution code:

def f(A,B):
    return max(len(str(A)),len(str(B)))

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

def main():
    N = int(input())
    factors = prime_factors(N)
    factors.reverse()
    A,B = 1,1
    for i in range(len(factors)):
        if A >= B:
            B *= factors[i]
        else:
            A *= factors[i]

    print(f(A,B))

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
data=dict()
check=2
now=N
bef=1
while check<1+int(N**0.5):
    if now==1:break
    if now<=int(N**0.5):break
    if now%check==0:
        now//=check
        bef*=check
        if check in data:
            data[check]+=1
        elif check not in data:
            data[check]=1
    else:
        check+=1
if now!=1:
    if now not in data:
        data[now]=1
    elif now in data:
        data[now]+=1
if len(data)==0:
    print(len(str(N)))
else:
    print(max(len(str(bef)),len(str(now))))

Submission status: Wrong Answer

Solution code:
N=int(input())
data=dict()
check=2
now=N
while check<1+int(N**0.5):
    if now==1:break
    if now%check==0:
        now//=check
        if check in data:
            data[check]+=1
        elif check not in data:
            data[check]=1
    else:
        check+=1
if now!=1:
    if now not in data:
        data[now]=1
    elif now in data:
        data[now]+=1
if len(data)==0:
    print(len(str(N)))
else:
    A=1
    B=1
    while len(data)>0:
        if A<=B:
            A*=max(data.keys())
            data[max(data.keys())]-=1
            if data[max(data.keys())]==0:
                data.pop(max(data.keys()))
        elif B<A:
            B*=max(data.keys())
            data[max(data.keys())]-=1
            if data[max(data.keys())]==0:
                data.pop(max(data.keys()))
    
    print(len(str(max(A,B))))