Problem:


Score : 400 points

Problem Statement

Given is a positive integer N. Consider repeatedly applying the operation below on N:

First, choose a positive integer z satisfying all of the conditions below:

z can be represented as z=p^e, where p is a prime number and e is a positive integer;

z divides N;

z is different from all integers chosen in previous operations.

Then, replace N with N/z.

Find the maximum number of times the operation can be applied.

Constraints

All values in input are integers.

1 \leq N \leq 10^{12}

Input

Input is given from Standard Input in the following format:

N

Output

Print the maximum number of times the operation can be applied.

Sample Input 1

24

Sample Output 1

3

We can apply the operation three times by, for example, making the following choices:

Choose z=2 (=2^1). (Now we have N=12.)

Choose z=3 (=3^1). (Now we have N=4.)

Choose z=4 (=2^2). (Now we have N=1.)

Sample Input 2

1

Sample Output 2

0

We cannot apply the operation at all.

Sample Input 3

64

Sample Output 3

3

We can apply the operation three times by, for example, making the following choices:

Choose z=2 (=2^1). (Now we have N=32.)

Choose z=4 (=2^2). (Now we have N=8.)

Choose z=8 (=2^3). (Now we have N=1.)

Sample Input 4

1000000007

Sample Output 4

1

We can apply the operation once by, for example, making the following choice:

z=1000000007 (=1000000007^1). (Now we have N=1.)

Sample Input 5

997764507000

Sample Output 5

7



Sample input:
24


Sample output:
3

Submission status: Runtime Error

Solution code:
from sympy import isprime
N, count = eval(input()), 0
x = N % 2
for i in range(2, N):
    if isprime(i):
        for f in range(1, 5):
            d = i**f
            if N % d == 0:
                count += 1
                N = N // d
print(count)

Submission status: Runtime Error

Solution code:
import collections
N = int(input())
c = collections.Counter(prime_factorize(N))

ans = 0
for j in c:
    for i in range(1,c[j]+1):
        if c[j] == 1:
            ans += 1
        elif i*(i+1)<= 2*c[j] < (i+1)*(i+2):
            ans += i

print(ans)

Submission status: Runtime Error

Solution code:
import math
import sympy
import sys

n = int(input())

if n == 1:
    print(0)
    sys.exit()

yakusu = set(sympy.divisors(n))
yakusu.discard(1)

sosu = set([min(yakusu)])
tansaku = set(yakusu)
kari = set(tansaku)



while 1:
    for var in tansaku:
        if var % max(sosu) == 0:
            kari.discard(var)
    tansaku = set(kari)
    if len(tansaku) == 0:
        break
    sosu.add(min(tansaku))
sosu = sosu | tansaku

i = 1
j = 0
kari = set(sosu)

while n != 1:
    for var in sosu:
        if n % (var ** i) == 0:
            n = n / (var ** i)
            j += 1
        else:
            kari.discard(var)
    sosu = set(kari)

    i += 1
    if i > 1000:
        break

print(j)

Submission status: Runtime Error

Solution code:
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

N = int(input())
list = make_divisors(N)
i=0
cnt=0
while(1):
  N = N / list[i]
  if N==1:
    break
  cnt=cnt+1
  i=i+1
print(cnt)

Submission status: Runtime Error

Solution code:
import math
import sys

def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0 # 1は素数ではない

    # エラトステネスのふるい
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]

"""
def isPrime(n):
  if n == 2:
    return True
  if n % 2 == 0:
    return False
  
  # nの平方根まで計算する
  m = math.floor(math.sqrt(n)) + 1
  for p in range(3, m, 2):
      if n % p == 0:
        return False
  return True
"""

def isPrime(n):
    if n == 1: return False

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

    return True

N = int(input())

if N == 1:
    print(0)
    sys.exit(0)

PL = primes(10000)
#print(PL)

i = 0
cnt = 0

while(not isPrime(N)):
    flg = 0
    while(1):
        pl = PL[i]
        c = 1
        while(N % (pl**c) == 0):
            N = N // (pl**c)
            cnt += 1
            c += 1
            flg = 1
        i += 1
        if N == 1:
            print(cnt)
            sys.exit(0)
        if flg == 1:
            break

print(cnt+1)
#print(isPrime(1))
"""
if N == 1:
    print(cnt)
else:
    print(cnt + 1)
"""

Submission status: Runtime Error

Solution code:
def prime_sieve(n):
    if n == 1:
        return []
    else:
        x = list(range(2,n+1))
        y = []
        while x[0]<pow(n,1/2):
            y += [x[0]]
            a = x[0]
            for i in x:
                if i % a == 0:
                    del x[x.index(i)]
        for i in x:
            y += [i]
        return y

n = int(input())
ans = 0
for i in prime_sieve(n):
    count = 1
    while n%i == 0:
        n /= i
        count -= 1
        loop = 1
        if count == 0:
            ans += 1
            loop += 1
            count = loop


print(ans)

Submission status: Runtime Error

Solution code:
import math
def trial_division(n):
    factor = []
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    if not factor:
        return 0
    else:
        factor.append(n)
        return factor

def func(x):
    ans=0
    x.remove(1)
    x2=set(x)
    for i in x2:
        a=x.count(i)
        for j in range(1,a+1):
            a-=j
            if a>=0:
                ans+=1
            else:
                break
    return ans


number = int(input())
x=trial_division(number)
print(0 if number==1 else func(x) if x else 1)

Submission status: Runtime Error

Solution code:
import math
from sympy import isprime
N = int(input())

z = []

def isprime(n):
    if n <= 1:
        return False
    for i in range(2, int(math.sqrt(n)) + 1):
        if n % i == 0:
            return False
    return True
    
def judge(n):
    if isprime(n):
        return True
    for i in range(2, int(math.sqrt(n)+1)):
        if n % i == 0:
            n = n // i
            while n != 1:
                if n % i != 0:
                    return False
                n //= i
            return True
        return False


ans = 0
num = []
i = 2
while N != 1:
    
    if isprime(N):
        ans += 1
        break
    if N % i == 0 and judge(i): 
        N //= i
        ans += 1
        num.append(i)

    i += 1
    



print(ans)

Submission status: Runtime Error

Solution code:
import sympy

def pop(stack):
	return stack[0],stack[1:]

def push(stack,x):
	stack.append(x)
	s = set(stack)
	p = list(s)
	p.sort()
	return p
	"""
	for i in range(len(stack)):
		#print(type(stack[i]),type(x))
		if stack[i] < x:
			t = stack[:i+1]
			t.append(x)
			g = t + stack[i+1:]
			return g
		if stack[i] == x:
			return stack
	"""

n = int(input())
a = sympy.factorint(n)
#print(type(a))
stack = []
temp = []
for i in a:
	stack.append(i)
	temp.append(i)
#print(stack)
#print(set(stack))
ans = 0
while 1 < n:
	v, stack = pop(stack)
	#print(v,n,n%v,stack)
	#print(type(v))
	#v_a = factorint(v)
	#aとv_aとの比較
	if n%v == 0:
		ans += 1
		n /= v
		if n <= v: break
		for i in temp:
			#print(i*v)
			stack = push(stack,i*v)
	else:
		continue
print(ans)

Submission status: Runtime Error

Solution code:
import math
n = int(input())
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(cnt)

if temp!=1:
    arr.append(1)
if arr==[]:
    arr.append(1)
for i in range(len(arr)):
    if arr[i] == 1:
        arr[i] = 1
    else:
        s = (-1+math.sqrt(1+8*arr[i]))/2
        arr[i] = s
if n = 1:
    print(0)
else:
    print(int(sum(arr)))

Submission status: Runtime Error

Solution code:
n = int(input())
b = n
def pf(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
l = list(set(pf(n)))
cnt = 0
for i in l:
    n = b
    t = 1
    j = i
    while i <= n:
        if n % i == 0:
            cnt += 1
            n = n // i
            a.append(i)
        i *= j
print(cnt)

Submission status: Runtime Error

Solution code:
#4問目
N = int(input())

# 使った数字を入れておくやつ
save = []

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def has_duplicates2(seq):
    seen = []
    unique_list = [x for x in seq if x not in seen and not seen.append(x)]
    return len(seq) != len(unique_list)

fact = prime_factorize(N)
# print(fact)
result  =  0
if has_duplicates2(fact):
    #重複した数字のリスト
    chofuku = [x for x in set(fact) if fact.count(x) > 1]
#     print(chofuku)
    for i in chofuku:
        Count = fact.count(i)
#         print(Count)
        if(Count == 3):
            result += 2
        else:
            result += math.floor(Count / 2)
#         print(result)
    #重複していない数の個数
    NOTchofuku = len((list(set(fact)))) - len(chofuku)
    print(result + NOTchofuku)
else:
    print(len(fact))

Submission status: Runtime Error

Solution code:
import math
import sys

def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0 # 1は素数ではない

    # エラトステネスのふるい
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]

"""
def isPrime(n):
  if n == 2:
    return True
  if n % 2 == 0:
    return False
  
  # nの平方根まで計算する
  m = math.floor(math.sqrt(n)) + 1
  for p in range(3, m, 2):
      if n % p == 0:
        return False
  return True
"""

def isPrime(n):
    if n == 1: return False

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

    return True

N = int(input())

if N == 1:
    print(0)

PL = primes(10000)
#print(PL)

i = 0
cnt = 0

while(not isPrime(N)):
    flg = 0
    while(1):
        pl = PL[i]
        c = 1
        while(N % (pl**c) == 0):
            N = N // (pl**c)
            cnt += 1
            c += 1
            flg = 1
        i += 1
        if N == 1:
            print(cnt)
            sys.exit(0)
        if flg == 1:
            break

print(cnt+1)
#print(isPrime(1))
"""
if N == 1:
    print(cnt)
else:
    print(cnt + 1)
"""

Submission status: Runtime Error

Solution code:
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

A  = factorization(N) 

count = 0
for i in A:
  judge = 1
  temp = i[1]
  while temp >= judge:
    count += 1
    temp -=judge
    judge += 1

if N == 1:
  count = 0

print(count)

Submission status: Runtime Error

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

divisor_lst = sympy.divisors(n)
del divisor_lst[0]

# print(divisor_lst)

count = 0
for i in range(len(divisor_lst)):
    if n % divisor_lst[i] == 0:
        # print("a")
        n /= divisor_lst[i]
        count += 1
    else:
        break

print(count)

Submission status: Runtime Error

Solution code:
def soinsu(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n=int(input())
a=soinsu(n)
c=[]
if n>=2:
    for i in range(max(a)):
        c.append(0)
for i in a:
    c[i-1]+=1
if n>=2:
    f=max(c)
z=0
g=[1]
d=1
e=1
while e<=f:
    d+=1
    e=d*(d+1)/2
    g.append(e)
l=len(g)
g=tuple(g)
c=tuple(c)
for i in c:
    for j in range(l):
        if i<g[j]:
            z+=j
            break
        
print(z)

Submission status: Runtime Error

Solution code:
import math
n=int(input())
noso=[]
count=0
if n==1:
    count=0
elif sosu(n)==1:
        count=1
else:
    for x in range(2,int(n/2)+2):
        if x>n:
            break
        if x in noso:
            pass
        elif x<=10:
            xx=x
            while n%xx==0:
                noso.append(xx)
                count+=1
                n=n/xx
                xx=xx*x
        elif x>11:
            xx=x
            while n%xx==0:
                noso.append(xx)
                count+=1
                n=n/x
                xx=xx*x
print(count)

Submission status: Runtime Error

Solution code:
import math
import sympy
import sys

n = int(input())

if n == 1:
    print(0)
    sys.exit()

yakusu = set(sympy.divisors(n))
yakusu.discard(1)

sosu = set([min(yakusu)])
tansaku = set(yakusu)
kari = set(tansaku)



while len(tansaku) > 0:
    for var in tansaku:
        if var % max(sosu) == 0:
            kari.discard(var)
    tansaku = set(kari)
    if len(tansaku) == 0:
        break
    sosu.add(min(tansaku))
sosu = sosu | tansaku

i = 1
j = 0
kari = set(sosu)

while n != 1:
    for var in sosu:
        if n % (var ** i) == 0:
            n = n / (var ** i)
            j += 1
        else:
            kari.discard(var)
    sosu = set(kari)

    i += 1
    if i > 1000:
        break

print(j)

Submission status: Runtime Error

Solution code:
# from math import factorial,sqrt,ceil #,gcd
# from itertools import permutations,combinations,combinations_with_replacement
# from collections import deque,Counter
# from bisect import bisect_left
from heapq import heapify,heappush,heappop
# from numba import njit
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from fractions import gcd

# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np    # numpy.lcm()
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb,perm #permはnPk
# import networkx as nx
# G = Graph()

# slist = "abcdefghijklmnopqrstuvwxyz"
N = int(input())

def primes(n):
    ass = []
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass

if N == 1:
    print(0)
    exit()

ans = 0
_ , Zque = primes(N)
Zset = set(Zque)
Z = heappop(Zque)
if N in Zque:
    print(1)
    exit()

while N >= Z:
    # print(N,Z)
    if N%Z == 0:
        ans += 1
        N = N//Z
    i = Z
    num = Z
    j = 2
    while num <= N:
        # print("num=",num,"N=",N,"j=",j)
        if not num in Zset:
            heappush(Zque,num)
            Zset.add(num)
        num = i**j
        j += 1
    Z = heappop(Zque)

print(ans)
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Submission status: Runtime Error

Solution code:
n = int(input())
counter = 0
i = 2
while i <= n:
  print(i,n)
  if n%i == 0:
    counter += 1
    n = n//i
  i += 1
print(counter)

Submission status: Runtime Error

Solution code:
import math
def trial_division(n):
    factor = []
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    if not factor:
        return 0
    else:
        factor.append(n)
        return factor

def func(x):
    ans=0
    x.remove(1)
    x2=set(x)
    for i in x2:
        a=x.count(i)
        for j in range(1,a+1):
            a-=j
            if a>=0:
                ans+=1
            else:
                break
    return ans

def main():
    number = int(input())
    x=trial_division(number)
    print(0 if number==1 else func(x) if x else 1)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

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



//------------------------- syntax shortening ----------------------
#define ull                 unsigned long long int
#define el                  cout<<"\n"
#define np                  nullptr
#define endl								"\n"
#define hello              ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb 									push_back
#define mp                  make_pair
#define vi									vector<int>
#define vall(vec)						vec.begin(), vec.end()
#define vitr(cursor)				vector<int>::iterator cursor;

//---------------------- common declaration macro ---------------
#define si(x)	            scanf("%d",&x)
#define sf(x)	            scanf("%f",&x)
#define sl(x)	            scanf("%lld",&x)
#define ss(s)	            scanf("%s",s)
#define ph(x)							printf("%s\n", "hello world!")
#define pi(x)	            printf("%d\n",x)
#define pf(x)							printf("%f\n",x)
#define pl(x)	            printf("%lld\n",x)
#define ps(s)	            printf("%s\n",s)

#define decMatrix(r,c)      int **mat;   mat = new int *[r];   for(int i = 0; i <r; i++){ mat[i] = new int[c]; int j=0; fo(j,c) mat[i][j]=0; }

//---------------------- loop shortening macro ------------------
#define ff(i,n)             for(i;i<n;i++)
#define fr(i,n)             for(i; i>=0;i--)
#define ffr(i,j,n)          for(i,j; i<n, j>=0; i++,j--)
#define whltc(tc)           int tc; si(tc); while(tc--)

//--------------- debugging macro --------------------------

#define px(x)              cout << #x << "=" << x << endl
#define pxy(x, y)          cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pxyz(x,y,z)        cout << #x << "=" << x << ",\t" << #y << "=" << y << ",\t" << #z << "=" << z << endl
#define pxyzw(x,y,z,w)     cout << #x << "=" << x << ",\t" << #y << "=" << y << ",\t" << #z << "=" << z << ",\t" << #w << "=" << w << endl

#define pa(arr,n)        		cout<< #arr << "=" ; for(int i=0;i<n;i++) cout<< arr[i] <<" "; cout<< endl
#define pm(mat,r,c)      		cout<< #mat << "=" << endl;  for(int i=0; i<r; i++){ pv(mat[i]) } cout<<endl

#define pv(vec)          		cout<< #vec << "=" ; for(auto ele: vec)  cout<< ele <<" ";  cout<< endl
#define pvp(vec)						cout<< #vec << "=\n" ; for(auto v: vec)	cout<< v.first <<":"<< v.second << endl;	 cout<< endl;
#define phsmp(map)       		cout<< #map << "=" ;  for(auto pair: map) cout<< pair.first<< " " << pair.second << "\n";  cout<< endl;

#define psep1()            cout<<"\n_________________________"<<" \n";
#define psep2()            cout<<"-------------------------"<<" \n";

//------------------ math macro --------------------------
#define max(a,b)            ((a)>(b)?(a):(b))
#define MIN(a,b)            ((a)<(b)?(a):(b))
#define ABS(a)              ((a)>(0)?(a):-(a))
#define mod                 1000000007
#define prec(x,y)           fixed<<setprecision(y)<<x;
//prec(ans,6)

//----------------------- boolean macro -------------------------
#define isKeyExist(hashtbl, key)	(hashtbl.find(key)!=hashtbl.end())
#define lb(vec,key,l,r) 					(lower_bound(vec.begin()+l, vec.end()-r, key) - vec.begin())  // return index work same as binary search    
#define ub(vec,key,l,r) 					(upper_bound(vec.begin()+l, vec.end()-r, key) - vec.begin())  // return index
#define bs(vec,key,l,r) 					(binary_search(vec.begin()+l, vec.end()-r, key)  // return bool

#define ll unsigned long int


// FIND FACTOR OF NUMBER N 

template <typename t>
vector<t> findFactor(t n){
	vector<t> res;
	if(n<1)	return res;
	res.pb(1);
	if(n==1)	return res;

	priority_queue<t, vector<t>, greater<t>> min_pq;
	t a=0;
	for(int i=2; i<=sqrt(n); i++){
		if(n%i==0){
			min_pq.push(i);
			if(i!=n/i)
				min_pq.push(n/i);
		}
	}

	while(!min_pq.empty()){
		res.pb(min_pq.top());
		min_pq.pop();
	}

	res.pb(n);
	return res;
}


int main()
{
    
    hello
    
    ll n, res=1, prod=1;
    
    cin>>n;

	vector<ll> ftr = findFactor(n);
	res=-1;
	for(auto i: ftr){
		prod*=i;
		res++;
		if(prod==n)
			break;
	}
	cout<<res;

	return 0;
}

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD (int)(1e9+7)
#define ceil(x, y) (x%y==0? (x/y) : (x/y+1))
#define FOR(i, N) for(int i = 0; i < N; ++i)
#define FOR1(i, N) for(int i = 1; i <= N; ++i)
#define vi vector <int>
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mset(a, v) memset(a, v, sizeof(a))
#define all(v) (v).begin(), (v).end()
#define INF 2e9
#define EPS 1e-9
#define int long long
using namespace std; 
void primeFactorise(int X, map<int, int>& pows){
		while(X % 2 == 0){
			pows[2] += 1;
			X /= 2;
		}
		for(int i = 3; i*i <= X; i+=2){
			while(X % i == 0){
				pows[i] += 1;
				X /= i;
			}
		}
		if(X > 2){
			pows[X] += 1;
		}
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    	freopen("in.txt", "r", stdin);
    	freopen("out.txt", "w", stdout);
    #endif

	int T=1;
	//cin >> T;
	FOR1(tp, T)
	{
		//cout << "Case #" << i << ": ";
		
		int n; cin >> n;
		map<int, int> pows;
		primeFactorise(n, pows);
		int ans = 0;
		for(pii p : pows){
			int e = p.ss;
			int sum = 0;
			for(int k = 1; sum + k <= e; k++){
				sum += k;
				ans++;
			}

		}
		cout << ans;
		cout<<'\n';
	}
	return 0;
}

Submission status: Runtime Error

Solution code:
N = int(input())

total=0

sqrt_set = {}

def isqrt(n):
    x = n
    y = (x + 1) // 2
    while y < x:
        x = y
        y = (x + n // x) // 2
    return x
  

for i in range(1,N+1):
  n = isqrt(i)
  sqrt_set.add(n)
  
sqrt_list = list(sqrt_set)
M = N
for i in sqrt_list:
  if i == 0 or i== 1:
    continue
  else:
    if M % i == 0:
      M = M//i
      total+=1
print(total)

Submission status: Runtime Error

Solution code:
import math
from sympy import isprime
N = int(input())

z = []

def judge(n):
    if isprime(n):
        return True
    for i in range(2, int(math.sqrt(n)+1)):
        if n % i == 0:
            n = n // i
            while n != 1:
                if n % i != 0:
                    return False
                n //= i
            return True
        return False


ans = 0
num = []
i = 2
while N != 1:
    
    if isprime(N):
        ans += 1
        break
    if N % i == 0 and judge(i): 
        N //= i
        ans += 1
        num.append(i)

    i += 1
    



print(ans)

Submission status: Runtime Error

Solution code:
import math
#試し割法
def trial_division(n):
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    #リストが空ならそれは素数
    if not factor:
        return 0
    else:
        factor.append(n)
        return factor

def func(x):
    ans=0
    x.remove(1)
    x2=set(x)
    for i in x2:
        a=x.count(i)
        for j in range(1,a+1):
            a-=j
            if a>=0:
                ans+=1
            else:
                break
    return ans

def main():
    number = int(input())
    x=trial_division(number)
    print(0 if number==1 else func(x) if x else 1)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
def soinsu(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n=int(input())
a=soinsu(n)
c=[]
if n>=2:
    for i in range(max(a)):
        c.append(0)
for i in a:
    c[i-1]+=1
z=0
f=max(c)
g=[1]
d=1
e=1
while e<=f:
    d+=1
    e=d*(d+1)/2
    g.append(e)
l=len(g)
g=tuple(g)
for i in c:
    for j in range(l):
        if i<g[j]:
            z+=j
            break
        
print(z)

Submission status: Runtime Error

Solution code:
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


def calcN(num):
    if num >= 45:
        return 9
    elif num >= 36:
        return 8
    elif num >= 28:
        return 7
    elif num >= 21:
        return 6
    elif num >= 15:
        return 5
    elif num >= 10:
        return 4
    elif num >= 6:
        return 3
    elif num >= 3:
        return 2
    elif num >= 1:
        return 1
    

A = int(input().split())
insuu =  factorization(A)
ret = 0
for i in insuu:
    ret += calcN(i[1])
print(ret)

Submission status: Runtime Error

Solution code:
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(cnt)

    if temp!=1:
        arr.append(1)

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

    return arr

n = int(input())
ln = factorization(n)
ans = 0
for i in range(1, max(ln) + 1):
    for j in range(len(ln)):
        if ln[j] < i:
            ln.pop(j)
    ans += len(ln)
    ln = list(map(lambda x: x - i, ln))
    if ln == [] or sum(ln)==0:
        break
print(ans)

Submission status: Runtime Error

Solution code:
import math
N=int(input())
def hantei(u):
  if u==1:
    return 1
  for i in range(1,u+1):
    if (1/2)*i**2+(1/2)*i>u:
      return int(i-1)
    else:
      continue
   
a=[0]*int(N)
for i in range(2,N+1):
  while N%i==0:
    N=N//i
    a[i-1]=a[i-1]+1
c=0
for t in range(len(a)):
  if a[t]!=0:
    c+=hantei(a[t])
print(c)

Submission status: Runtime Error

Solution code:
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(cnt)

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

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

    return arr

m = int(input())
a = factorization(m)
ans = 0
for i in a:
    j = 1
    while j *(j+1) //2 <= i:
        j += 1
    ans += j-1
print(ans)

Submission status: Runtime Error

Solution code:
N=int(input())
c=0
for i in range(N):
    if N%i==0:
        N=N/i
        c+=1
        for j in N:
            if N%j==0 and j!=i:
                c+=1
                N=N/j
print(c)

Submission status: Runtime Error

Solution code:
N = int(input())
i = 2
count = 0
if N == 1:
    print(0)
else:
    for k in range(2, int(math.sqrt(N)) + 1):
        if N % i == 0:
            N = N / i
            i = i + 1
            count += 1
        else:
            i = i + 1
    if count == 0:
        count += 1
print(count)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> VI;
typedef vector<VI> VVI;
typedef pair<ll, ll> P;
#define INF (1LL << 31)
#define FOR(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define PRINT(V) for (auto v : (V)) cout << v << " "

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main() {
    long long N;
    cin >> N;
    const auto &res = prime_factorize(N);
    ll ans = 0;
    ll b = 0;
    
    for (auto p : res) {
        b = p.second;
        int i = 0;

        while(b >= i*(i+1)/2) {
            ++i;
        }
        --i;
        // if (b == i*(i+1)/2) i;
        cout << i << endl;
        ans += i;
    }
    cout << ans << endl;
}

Submission status: Runtime Error

Solution code:
N = int(input())

def factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

def make_divisors(n: int):
    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



facts = factorize(N)
fs = set(facts)

from collections import Counter
fc = Counter(facts)
divisiors = sorted(make_divisors(N))
fms = max([v for k,v in fc.items()])
fm = max(max(facts), fms) 
ans = 0

# print(facts)
# print(divisiors)
done = set()

for d in divisiors:
    if d == 1:
        continue
    if N % d == 0:
        N //= d
        ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
def sieve_of_eratosthenes(n): #エラトステネスのふるい
    candidate = list(range(2, n+1)) #候補
    prime = []
    limit = n**0.5 + 1 #+1がないと平方数を素数にしてしまう

    while True:
        p = candidate[0] 
        if limit <= p:
            prime.extend(candidate) #この時点での残っているのは素数
            break
        prime.append(p) #pを素数リストに登録

        candidate = [i for i in candidate if i % p != 0]

        # i = 0
        # while True:
            # if i >= len(candidate): #iはcandidateの長さ分
                # break
            # elif candidate[i] % p == 0: #余りがゼロなら
                # candidate.pop(i) #素数ではないのでpop(取り除く)する
            # i += 1

    return prime

n = int(input())
if n == 1:
  print(0)
  exit()
n_list = []
prime = sieve_of_eratosthenes(n)
flag = False
for i in range(len(prime)):
  for j in range(1,n+1):
    z = prime[i]**j
    if n%z == 0:
      if not(z in n_list):
        n_list.append(z)
        n = int(n/z)
print(len(n_list))