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

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

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

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

    return arr


N = int(input())
div = factorization(N)


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

ans = 0

for d in div:
    c = d[1]
    i = 1

    while c >= 0:
        c -= i
        if c >= 0:
            ans += 1
        i += 1

print(ans)

Solution (Python):
from collections import Counter


def main():
    n = int(input())
    m = n
    factorization_p = []
    while m % 2 == 0:
        factorization_p.append(2)
        m //= 2
    prime_num = 3
    while prime_num * prime_num <= m:
        if m % prime_num == 0:
            factorization_p.append(prime_num)
            m //= prime_num
        else:
            prime_num += 2
    if m != 1:
        factorization_p.append(m)
    factorization_p = Counter(factorization_p)
    answer = 0
    for _, p in factorization_p.items():
        i = 1
        p *= 2
        while i * (i + 1) <= p:
            answer += 1
            i += 1
    print(answer)


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())

ans = 0
for i in range(2,int(n**0.5)+1):
    count = 1
    loop = 1
    while n % i == 0:
        n = int(n/i)
        count -= 1
        if count == 0:
            ans += 1
            loop += 1
            count = loop

if n > 1:
    ans += 1
print(ans)

Solution (Python):
from collections import Counter

def factors(n: int):
    l = []
    for i in range(2, int(n**0.5) + 1):
        
        while n % i == 0:
            n //= i
            l.append(i)
    if n > 1:
        l.append(n)
    return l

c = Counter(factors(int(input())))
ans = 0
for items,values in c.items():
    cnt = 1
    while cnt <= values:
        values -= cnt
        ans += 1
        cnt += 1
print(ans)

Solution (Python):
from collections import Counter
N = int(input())
factors = []
i = 2
while N > 1:
  if N < i * i:
    factors.append(N)
    break
  while N % i == 0:
    factors.append(i)
    N //= i
  i += 1

ans = 0
for count in Counter(factors).values():
  i = 1
  while count >= i:
    count -= i
    i += 1
    ans += 1
print(ans)

Solution (Python):
import collections
 
def primes(n): 
 cnt=collections.defaultdict(int)
 for i in range(2,int(n**0.5)+1):
   if n%i==0:
     while n%i==0:
       cnt[i]+=1
       n//=i
 if n!=1:
   cnt[n]+=1
 return cnt
 
n=int(input())
cnt=primes(n)
ans=0
for key in cnt.keys():
    val=cnt[key]
    for i in range(100): 
        if (i*(i+1))//2>val:
            ans+=i-1
            break
print(ans)

Solution (Python):
import math
N=int(input())
L=[]
for i in range(2,int(math.sqrt(N))):
    if N%i==0:
        c=0
        while N%i==0:
            N/=i
            c+=1
        L.append(c)
if N!=1:
    L.append(1)
ans=0
for i in L:
    for n in range(10):
        if (n*(n+1))//2>i:
            ans+=n-1
            break
print(ans)

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


def get_knu(a):
    before = 1
    n = 2
    while True:
        knum = (n * (n + 1)) // 2
        if a == knum:
            return n
        elif knum > a > before:
            return n - 1
        else:
            n += 1
            before = knum


D = int(input())
p = get_prime_fact(D)

if len(p) != len(set(p)):
    res = 0
    for n in set(p):
        count = p.count(n)
        if count == 1:
            res += 1
        else:
            add = get_knu(count)
            res += add

    print(res)
else:
    print(len(p))

Solution (Python):
n = int(input())
if n == 1:
    print(0)
    exit()

def fact(n):
    arr = []
    res = []
    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])
            res.append(cnt)
    if temp!=1:
        arr.append([temp, 1])
        res.append(1)

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


    return res

alist = fact(n)

ans = 0
for a in alist:
    for i in range(1,a+3):
        if a < i*(i+1)//2:
            
            ans += i-1
            break

print(ans)

Solution (Python):
def prime_factorization(N):
    tmp = N
    ans = []
    for i in range(2, int(N ** 0.5) + 1):
        count = 0
        while tmp % i == 0:
            tmp //= i
            count += 1
        if count != 0:
            ans.append([i, count])
    if tmp != 1:
        ans.append([tmp, 1])
    if ans == []:
        ans.append([N, 1])
    return ans

def GetLimit(x):
    X = 2*x
    n = 1
    while True:
        if n*(n+1) <= 2 * x < (n+1)*(n+2):
            return n
        n += 1
N = int(input())
if N==1:
    print(0)
    exit()
PrimeList = prime_factorization(N)
ans = 0
for a, b in PrimeList:
    ans += GetLimit(b)
print(ans)

Solution (Python):
"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""

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

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

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

    return arr

n = int(input())
f = factorization(n)




ans = 0
for i in range(len(f)):
  if f[i][0] == 1:
    continue
  t = f[i][1]
  
  
  for j in range(1, 40):
    if (t - j) < 0:
      break
    ans += 1
    t -= j

print(ans)

Solution (Python):
n=int(input())
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

l=factorization(n)

ans=0
cnt=1
if n==1:
  print(0)
else:
  for i,e in l:
    cnt=1
    while(cnt<=e):
      e-=cnt
      ans+=1
      cnt+=1
  print(ans)

Solution (Python):
import math
n=int(input())
ans=0
for i in range(2,int(math.sqrt(n)+1)):
    if n%i==0:
        prime=i
        power=0
        while n%i==0:
            n=n//i
            power+=1
        st=1
        while st<=power:
            ans+=1
            power-=st
            st+=1
if n>1:
    ans+=1
print(ans)

Solution (Python):
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 maxsum(e):
	n = 0
	while n*(n + 1)/2 <= int(e):
		n = n + 1 
	return n - 1

def solve(N):
	if N == 1:
		return 0
	fac = factorization(N)
	sum = 0
	for ret in fac:
		sum = sum + maxsum(ret[1])
	return sum

N = input()
print(solve(N))

Solution (Python):
N = int(input())



def prime_factorize(n: int): 
    ret = []

    while n % 2 == 0:
        ret.append(2)
        n //= 2
    
    f = 3
    while f * f <= n:
        if n % f == 0:
            ret.append(f)
            n //= f
        else:
            f += 2
    
    if n != 1:
        ret.append(n)
    
    return ret


pf = prime_factorize(N)

ans = 0
from collections import Counter

cpf = Counter(pf)

for k, v in cpf.items():
    e = v
    tmp = 0
    cur = 1

    while e >= cur:
        e -= cur
        cur += 1
        tmp += 1
    
    ans += tmp

print(ans)

Solution (Python):
import collections


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


n = int(input().strip())
c = collections.Counter(prime_factorize(n))
ans = 0
for elem in c.items():
    count = 1
    value = elem[1]
    while True:
        value -= count
        count += 1
        ans += 1
        if value < count:
            break
print(ans)

Solution (Python):
import math

def prime(x):
    if x==1:
        prime=False
    else:
        prime=True
        for i in range(2,int(math.sqrt(x)+1)):
            if x%i==0:
                prime=False
                break
    return prime

def count_prime(N):
    p=[0 for n in range(int(math.sqrt(N)+1))]
    
    if prime(N):
        big_prime=True
        
    else:
        big_prime=False
        rtN_init=int(math.sqrt(N)+1)
        
        
        while N>1:
            
            if prime(N) and N>rtN_init:
                big_prime=True
                break
            else:
                for i in range(2,rtN_init):
                    if N%i==0 and prime(i):
                        p[i]+=1
                        N=N//i
                        break
    return p,big_prime

def main():
    N=int(input())
    p,q=count_prime(N)
    cnt=0
    
    for n in range(len(p)):
        num=1
        while p[n]>=1:
            p[n]-=num
            if p[n]>=0:
                cnt+=1
                num+=1
    if q==True:
        cnt+=1
    print(cnt)
        
if __name__=="__main__":
    main()

Solution (Python):

from collections import defaultdict
from math import sqrt
from typing import ValuesView


def prime_factorize_indices(n: int) -> ValuesView[int]:
    """Prime factorization of n (trial division)."""
    if n < 1:
        raise ValueError

    prime_factors = defaultdict(int)
    while n % 2 == 0:
        n //= 2
        prime_factors[2] += 1

    for i in range(3, int(sqrt(n)) + 1, 2):
        while n % i == 0:
            n //= i
            prime_factors[i] += 1
        if n == 1:
            break

    if n > 2:  
        prime_factors[n] += 1

    return prime_factors.values()


def main():
    N = int(input())
    calc = lambda n: (sqrt(8 * n + 1) - 1) // 2
    print(int(sum(calc(e) for e in prime_factorize_indices(N))))


if __name__ == "__main__":
    main()

Solution (Python):
import math
n = int(input())
a = []
b= []
while n % 2 == 0:
    b.append(2)
    n //= 2
if(len(b)!= 0):
    a.append(b)
    b= [] 
f = 3
while f * f <= n:

    if n % f == 0:
        b.append(f)
        n //= f
    else:
        f += 2
        if(len(b)!= 0):
            a.append(b)
            b= [] 

if(len(b)!= 0):
        a.append(b)
        b= [] 
if(len(a) != 0):
    if(n == a[len(a)-1][0]):
        a[len(a)-1].append(n)
        n  = 1
if (n != 1 ):
    b.append(n)
    a.append(b)

ans =0
for i in range(len(a)):
    ans += int((-1 + math.sqrt(1 + 8 * len(a[i])))/2)

print(ans)

Solution (Python):

from collections import defaultdict
from math import sqrt
from typing import ValuesView


def prime_factorize_indices(n: int) -> ValuesView[int]:
    """Prime factorization of n (trial division)."""
    if n < 1:
        raise ValueError

    prime_factors = defaultdict(int)
    while n % 2 == 0:
        n //= 2
        prime_factors[2] += 1

    for i in range(3, int(sqrt(n)) + 1, 2):
        while n % i == 0:
            n //= i
            prime_factors[i] += 1
        if n == 1:
            break

    if n > 2:  
        prime_factors[n] += 1

    return prime_factors.values()


def main():
    N = int(input())
    calc = lambda n: int((sqrt(8 * n + 1) - 1) / 2)
    print(sum(calc(e) for e in prime_factorize_indices(N)))


if __name__ == "__main__":
    main()

Solution (Python):
def factorize(n):
    res = []
    i = 2
    while i * i <= n:
        cnt = 0
        while n % i == 0:
            cnt += 1
            n //= i
        if cnt > 0:
            res.append([i, cnt])
        i += 1
    if n != 1:
        res.append([n, 1])
    return res

n = int(input())
nlist = factorize(n)
ans = 0
for k, v in nlist:
    i = 1
    while v >= i:
        v -= i
        i += 1
    ans += i-1
print(ans)

Solution (Python):

from collections import defaultdict
from math import sqrt
from typing import Dict


def prime_factorize_naive(n: int) -> Dict[int, int]:
    """Prime factorization of n (trial division)."""
    if n < 1:
        raise ValueError

    prime_factors = defaultdict(int)
    while n % 2 == 0:
        n //= 2
        prime_factors[2] += 1

    for i in range(3, int(sqrt(n)) + 1, 2):
        while n % i == 0:
            n //= i
            prime_factors[i] += 1
        if n == 1:
            break

    if n > 2:  
        prime_factors[n] += 1

    return prime_factors


def main():
    N = int(input())
    calc = lambda n: int((sqrt(8 * n + 1) - 1) / 2)
    print(sum(calc(e) for e in prime_factorize_naive(N).values()))


if __name__ == "__main__":
    main()

Solution (Python):
import math

N = int(input())

fact = set()
counter = 0

for i in range(2, int(math.sqrt(N))+1):
    if N % i != 0:
        continue
    powt = 0
    while N % i == 0:
        powt += 1
        N /= i
    fact.add((i, powt))

if N != 1:
    fact.add((N, 1))

for base, e in fact:
    for t in range(1, e+1):
        if t <= e:
            e -= t
            counter += 1
print(counter)

Solution (Python):
n=int(input())

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

def prime_fact(x):
    fact=[]
    for i in range(2, int(x**(0.5))+1):
        while x%i==0:
            fact.append(i)
            x//=i
    if x!=1:
        fact.append(x)
    if not fact:
        fact=[x]
    return fact

divisors=make_divisors(n)
divisors.pop(0)
cnt=0
for div in divisors:
    
    
    if len(set(prime_fact(div)))==1 and n>1 and n%div==0:
        n//=div
        cnt+=1
    elif n<1:
        break
print(cnt)

Solution (Python):
n=int(input())

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

def prime_fact(x):
    fact=[]
    for i in range(2, int(x**(0.5))+1):
        while x%i==0:
            fact.append(i)
            x//=i
    if x!=1:
        fact.append(x)
    if not fact:
        fact=[x]
    return fact

divisors=make_divisors(n)
divisors.pop(0)
cnt=0
for div in divisors:
    
    
    if len(set(prime_fact(div)))==1 and n>1 and n%div==0:
        n//=div
        cnt+=1
    elif n<1:
        break
print(cnt)

Solution (Python):
def factorize(n):
    res = []
    i = 2
    while i * i <= n:
        cnt = 0
        while n % i == 0:
            cnt += 1
            n //= i
        if cnt > 0:
            res.append([i, cnt])
        i += 1
    if n != 1:
        res.append([n, 1])
    return res

n = int(input())
nlist = factorize(n)
ans = 0
for k, v in nlist:
    i = 1
    while v >= i:
        v -= i
        i += 1
    ans += i-1
print(ans)

Solution (Python):
n = int(input())

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)
b = [1,3,6,10,15,21,28,36,43]
ans = 0
if len(a) == 1 and a[0][0] == 1:
    print(0)
    exit()
for i in a:
    for j in range(len(b)):
        if i[1] <b[j]:
            ans += j
            break
print(ans)

Solution (Python):
def is_prime(num:int):
    if num == 1:
        return False
    elif num == 2:
        return True
    elif num % 2 == 0:
        return False

    r_num = int(num ** 0.5)
    for i in range(3, r_num + 1, 2):
        if num % i == 0:
            return False
    return True


def main():
    n = int(input())

    if n == 1:
        print(0)
        return

    cnt = 0
    r_n = int(n ** 0.5)
    divided = []
    for i in range(2, n):
        if n < i:
            break
        elif cnt == 0 and r_n+1 < i:
            break
        if n % i == 0 and is_prime(i):
            n = int(n/i)
            divided.append(i)
            cnt += 1
            x = 2
            while True:
                q = i ** x
                if q > n:
                    break

                if n % q == 0:
                    n = int(n/q)
                    x += 1
                    cnt += 1
                else:
                    break
            if is_prime(n) and n not in divided:
                n = 1
                cnt += 1
                break

    if cnt == 0:
        cnt = 1
    print(cnt)


main()

Solution (Python):

import sys
import math
import itertools
import collections







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[i]=cnt

    if temp!=1:
        arr[temp] = 1

    if arr==[]:
        arr[n] = 1

    return arr

factorization(24) 




N = int(input())
dic = factorization(N)
cnt = 0

for key,value in sorted(dic.items()):
    if(N == 1):
        break
    for i in range(1,value+1):
        if(N % key ** i != 0):
            break
        N //= key ** i
        cnt += 1
print(cnt)

Solution (Python):
def prime(p):
    memo = []
    for i in range(2,(int(p**0.5)+1)):
        while p%i==0:
            p //= i
            memo.append(i)
    if p != 1:
        memo.append(p)
    return memo

import collections

n=int(input())

memo = prime(n)

memo = collections.Counter(memo)

memo = sorted(memo.items(), key=lambda x:-x[1])

ans = 0

for sosu, count in memo:
  kosu = 1
  while 0 <= count-kosu:
    count -= kosu
    ans += 1
    kosu += 1
print(ans)

Solution (Python):
def main():
    n = int(input())
    ans = 0
    e = 1

    def facs():
        yield 2
        for x in range(10 ** 6):
            yield x * 2 + 3

    for fac in facs():
        while n % (div := pow(fac, e)) == 0:
            n //= div
            ans += 1
            e += 1
        while n % fac == 0:
            n //= fac
        if fac * fac > n:
            break
        e = 1

    if n != 1:
        ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    n = int(input())
    ans = 0
    e = 1
    facs = (2 if x == 0 else x * 2 + 1 for x in range(10 ** 6))
    for fac in facs:
        while n % (div := pow(fac, e)) == 0:
            n //= div
            ans += 1
            e += 1
        while n % fac == 0:
            n //= fac
        if fac * fac > n:
            break
        e = 1

    if n != 1:
        ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    n = int(input())
    ans = 0

    fac = 2
    e = 1
    while True:
        if n % (div := pow(fac, e)) == 0:
            n //= div
            ans += 1
            e += 1
            continue

        while n % fac == 0:
            n //= fac

        if fac == 2:
            fac += 1
        else:
            fac += 2

        if fac * fac > n:
            break
        e = 1

    if n != 1:
        ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    n = int(input())
    ans = 0

    fac = 2
    e = 1
    while True:
        div = pow(fac, e)
        if n % div == 0:
            n //= div
            ans += 1
            e += 1
        else:
            while n % fac == 0:
                n //= fac
            if fac == 2:
                fac += 1
            else:
                fac += 2
            if fac * fac > n:
                break
            e = 1
    if n != 1:
        ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    n = int(input())
    ans = 0

    fac = 2
    e = 1
    while True:
        div = pow(fac, e)
        if n % div == 0:
            n //= div
            ans += 1
            e += 1
        else:
            while n % fac == 0:
                n //= fac
            fac += 1
            if fac * fac > n:
                break
            e = 1
    if n != 1:
        ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    n = int(input())
    ans = 0

    fac = 2
    e = 1
    while True:
        div = pow(fac, e)
        if n % div == 0:
            n //= div
            ans += 1
            e += 1
        else:
            while n % fac == 0:
                n //= fac
            fac += 1
            if fac * fac > n:
                break
            e = 1
    if n != 1:
        ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    n = int(input())
    ans = 0

    fac = 2
    e = 1
    while n % (div := pow(fac, e)) == 0:
        n //= div
        ans += 1
        e += 1

    while n % fac == 0:
        n //= fac

    fac = 3
    e = 1
    while pow(fac, 2) <= n:
        while n % (div := pow(fac, e)) == 0:
            n //= div
            ans += 1
            e += 1

        while n % fac == 0:
            n //= fac
        e = 1
        fac += 2

    if n != 1:
        ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    n = int(input())
    ans = 0

    fac = 2
    e = 1
    while pow(fac, 2) <= n:
        while n % (div := pow(fac, e)) == 0:
            n //= div
            ans += 1
            e += 1

        while n % fac == 0:
            n //= fac

        e = 1
        fac += 1

    if n != 1:
        ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
 
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]

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 is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

k=make_divisors(n)
c=0


for i in range(len(k)):
    if i==0:pass 
    else:
        l1=factorization(k[i])
        seigo=is_prime(l1[0][0])
        
        if len(l1)==1 and seigo==True and n%k[i]==0:
            n//=k[i]
            c+=1
        
print(c)

Solution (Python):
N = int(input())

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
    
fact = factorization(N)

import math

ans = 0

if N!= 1:
    
    for f in fact:
        X = f[1]
        n = math.ceil(math.sqrt(2*X)-1)
        if n * (n+1) > 2* X:
            n = n-1
            
        ans += n
        
print(ans)

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

from collections import Counter

n = int(input())
if n == 1:
    print(0)
else:
    a = prime_factorize(n)
    c = Counter(a)
    ans = 0
    for v in c.values():
        temp = 1
        while True:
            v -= temp
            if v >= 0:
                ans +=1
                temp += 1
            else:
                break
    print(ans)

Solution (Python):
n=int(input())
d={}

for i in range(2, int(n**0.5)+1):
    while n % i == 0:
        if n<2:
            break
        d[i] = d.get(i, 0)+1
        n //=i
    if n<2:
        break
if n>1:
    d[n] = 1
def get(n):
    cur, total = 0, 0
    while cur+total<n:
        cur +=1
        total +=cur
    return cur
ans = 0
for v in d.values():
    ans += get(v)
print(ans)

Solution (Python):
import sys

n = int(input())

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

count = 0
i = 2

while True:
    if i * i > n:
        break

    e = 0
    while n % i == 0:
        n = n // i
        e += 1
    curr = 1
    while e >= curr:
        e -= curr
        curr += 1
        count += 1
    i += 1

if n > 1:
    print(count + 1)
else:
    print(count)

Solution (Python):
n=int(input())
d={2:0}
while n%2<1:  n//=2;  d[2]+=1
for i in range(3,int(n**0.5)+1,2):
  while n%i<1:  n//=i;  d[i]=d.get(i,0)+1
  if n<2: break
if n>1: d[n]=1
a=0
for i in d.values():
  t=c=0
  while t+c<i: c+=1; t+=c
  a+=c
print(a)

Solution (Python):
n=int(input())
d={2:0}
while n%2<1:  n//=2;  d[2]+=1
for i in range(3,int(n**0.5)+1,2):
  while n%i<1:  n//=i;  d[i]=d.get(i,0)+1
  if n<2: break
if n>1: d[n]=1
a=0
for i in d.values():
  t=c=0
  while t+c<i: c+=1; t+=c
  a+=c
print(a)

Solution (Python):
n=int(input())

int_sqrt=lambda x:int(x**0.5)+1
def prime_factor(x):
  d={}
  for i in p:
    while x%i<1:
      x//=i
      d[i]=d.get(i,0)+1
    if x<2: break
  if x>1: d[x]=1
  return d

p=range(2,int_sqrt(n))
d=prime_factor(n)
a=0
for i in d.values():
  t=c=0
  while t+c<i: c+=1; t+=c
  a+=c
print(a)

Solution (Python):
n=int(input())

int_sqrt=lambda x:int(x**0.5)+1
def sieve(x):
  p=[]
  b=[1]*x
  for i in range(2,x):
    if b[i]:
      p+=[i]
      for j in range(2*i,x,i): b[j]=0
  return p
def prime_factor(x):
  d={}
  for i in p:
    while x%i<1:
      x//=i
      d[i]=d.get(i,0)+1
    if x<2: break
  if x>1: d[x]=1
  return d

p=sieve(int_sqrt(n))
d=prime_factor(n)
a=0
for i in d.values():
  t=c=0
  while t+c<i: c+=1; t+=c
  a+=c
print(a)

Solution (Python):


import math 

def primeFactors(n):
    A=[] 
    while n % 2 == 0:
        A.append(2)
        n = n // 2
        
 
    for i in range(3,int(math.sqrt(n))+1,2): 
        
        
        while n % i== 0: 
            A.append(i)
            n = n // i 
            
   
    if n > 2: 
        A.append(n)
    
    return A
        


N = int(input())
primes = set(primeFactors(N))
answer = 0
for p in primes:
    d = p
    while N%d == 0:
        answer += 1
        N //= d
        d *= p
 
print(answer)

Solution (Python):
def get_prime_factorizations(n):
    """
    [summary]

    Parameters
    ----------
    n : int
        the number factorized by prime numbers.

    Returns
    -------
    dict[int: int]
        prime and exponent pair
        ex.) if n == 40, the function return  {2:3, 5:1} 
    """    
    root_n = int( n**(1/2) )
    primes = {2:0}
    primes.update({i:0 for i in range(3, root_n+1, 2)})
    for i in primes.keys():
        if n == 1:
            primes = {i: v for i, v in primes.items() if v > 0}
            return primes
        
        exponent = 0
        while n % i == 0:
            n //= i
            exponent += 1
        
        primes[i] = exponent

    primes = {i: v for i, v in primes.items() if v > 0}

    if n!=1:
        primes[n] = 1

    if len(primes) == 0:
        return {n: 1}
    return primes

n = int(input())
if n == 1:
    print(0)
else:
    primes =  get_prime_factorizations(n)
    result = 0
    for exponent  in primes.values():
        count = 0
        while exponent - count > 0:
            count += 1
            exponent -= count
        result += count
    print(result)

Solution (Python):
def d_div_game():
    def prime_factorization(n):
        """n を素因数分解したときの素数とその指数の辞書"""
        from collections import defaultdict
        if n == 1:
            return {2: 0}  
        i, table = 2, defaultdict(int)
        while i**2 <= n:
            while n % i == 0:
                table[i] += 1
                n //= i
            i += 1
        if n > 1:
            table[n] = 1
        return table

    def sub(n):
        """1 + ... + e = e*(e+1)//2 <= n となる最大の e を返す"""
        for e in range(1, n + 2):
            if e * (e + 1) > 2 * n:  
                return e - 1

    return sum(sub(v) for v in prime_factorization(int(input())).values())

print(d_div_game())

Solution (Python):
from collections import defaultdict
import decimal
import sys
input = sys.stdin.readline


def prime_factor_count(n):
    def count(n, i):
        cnt = 0
        while n % i == 0:
            cnt += 1
            n //= i
        return n, cnt

    d = {}
    if n == 1:
        return d

    n, cnt = count(n, 2)
    d[2] = cnt

    lst = [2]
    for num in range(3, int(n ** 0.5) + 1, 2):
        if n == 1:
            break
        for p_num in lst:
            if num % p_num == 0:
                break
            elif p_num * p_num > num:
                lst.append(num)
                n, cnt = count(n, num)
                d[num] = cnt
                break
    else:
        if n != 1:
            d[n] = 1
    return d



def main():
    n = int(input())
    d = prime_factor_count(n)

    cnt = 0
    tmp_n = 0
    for k, v in d.items():
        exp_cnt = 1
        while 1:
            if exp_cnt > v:
                break
            else:
                if tmp_n % (tmp_exp := k ** exp_cnt) == 0:
                    tmp_n //= tmp_exp
                    cnt += 1
                    v -= exp_cnt
                    exp_cnt += 1
    else:
        if n == tmp_n:
            cnt += 1
    print(cnt)


if __name__ == '__main__':
    main()