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):
import math
def get_prime(n):
    if n <= 1:
        return []
    prime = [2]
    if n > 2:
        limit = int(math.sqrt(n))
        odd = [i for i in range(3, n + 1, 2)]
        while limit >= odd[0]:
            prime.append(odd[0])
            odd = [j for j in odd if j % odd[0] != 0]
        prime += odd
    return prime

from collections import defaultdict
def prime_factorization(n):
    if n <= 1:
        return {}
    else:
        
        prime = get_prime(int(math.sqrt(n)))
        dct = defaultdict(int)
        for p in prime:
            while n % p == 0:
                dct[p] += 1
                n //= p
        if n != 1:
            dct[n] += 1
        dct = dict(dct)
        return dct

n = int(input())
pf = prime_factorization(n)

Z = []
for k, v in pf.items():
    for i in range(1, v + 1):
        Z.append(k ** i)
Z.sort()
count = 0
for z in Z:
    if n % z == 0:
        count += 1
        n //= z
    if n == 1:
        break

print(count)

Solution (Python):
import math
from collections import Counter
A= int(input())
if A == 1:
    print(0)
    exit()
resArray = []
tmpA = A
i = 1
while i <= math.sqrt(A):
    
    i += 1
    if tmpA == 1:
        break

    if i >2 and i %2 == 0:
        continue


    while tmpA % i == 0:
        tmpA = tmpA / i
        resArray.append(i)

res = 0
if tmpA == A:
    print(1)
    exit()
elif tmpA > 1:
    res += 1


cArray = Counter(resArray)

for i in cArray.values():
    if i > 0:
        
        tmp = 1
        while tmp*(tmp+1)//2 <= i:
            tmp += 1
        res += tmp -1
print(res)

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

def factorize(n):
    fct = []  
    b, e = 2, 0  
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

f = factorize(n)
ans = 0
for i,j in f:
    ans += int((-1+pow(1+8*j,0.5))/2)
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 sum(k):
    return k*(k+1)/2

n = int(input())

factor = factorization(n)

ans = 0

if n == 1:
    print(ans)

else:
    for i in range(len(factor)):
        k = 1
        s = k*(k+1)/2
        while True:
            if factor[i][1]>=sum(k) and factor[i][1]<sum(k+1):
                ans += k
                break
            else:
                k += 1
    print(ans)

Solution (Python):

def prime_factorize(n):
    a = []
    tmp = n
    for i in range(2,int(n**0.5//1+1)):
        if tmp%i == 0:
            cnt = 0
            while tmp%i == 0:
                cnt += 1
                tmp //= i
            a.append([i,cnt])
        
    if tmp != 1:
        a.append([tmp,1])
    
    if a == []:
        a.append([n,1])
    
    return a

n = int(input())

x = prime_factorize(n)
cnt = 0


for i in range(len(x)):
    if x[0][0]==1:
        break
        
    k = x[i][1]
    for j in range(k):
        if n%(x[i][0]**(j+1)) == 0:
            n //= x[i][0]**(j+1)
            cnt += 1
            k-=(j+1)
        elif n%(x[i][0]**(j+1)) != 0:
            break
        if k <= 0:
            break
print(cnt)

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

if n == 1:
    print(0)
else:

    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)

    ans = 0
    for x, y in fact:
        tmp = 1
        while True:
            if (tmp + 1) * (tmp + 2) // 2 <= y:
                tmp += 1
            else:
                break

        ans += tmp

    print(ans)

Solution (Python):
N = int(input())
ans = 0
n = N
for i in range(2, int(N**0.5)+1):
    if n % i == 0:
        list1 = []
        while n % i == 0:
            list1.append(i)
            n //= i
        x = len(list1)
        ans += int(-0.5+((1+8*x)**0.5)*0.5)
if n != 1:
  ans += 1
if ans == 0 and N != 1:
    ans = 1
print(ans)

Solution (Python):
"""
~~ Author : Bhaskar
~~ Dated : 01~06~2020
"""

import sys
from bisect import *
from math import floor,sqrt,ceil,factorial as F,gcd,pi
from itertools import chain,combinations,permutations,accumulate
from collections import Counter,defaultdict,OrderedDict,deque
from array import array
INT_MAX = sys.maxsize
INT_MIN = -(sys.maxsize)-1
mod = 1000000007
lcm = lambda a,b : (a*b)//gcd(a,b)
setbit = lambda x : bin(x)[2:].count("1")

def solve():
    n = int(sys.stdin.readline())
    d = Counter()
    while n%2 == 0:
        d[2] += 1
        n //= 2
    i = 3
    while i*i < n:
        if n%i == 0:
            while n%i == 0:
                d[i] += 1
                n //= i
        i += 2
    if n != 1:
        d[n] += 1
    ans = 0
    for k,v in d.items():
        minn = 1
        while v-minn >= 0:
            v -= minn
            minn +=1
            ans += 1
    print(ans)

if __name__ == "__main__":
    try:
        sys.stdin = open("input.txt","r")
    except :
        pass
    solve()

Solution (Python):
sieve = [True] * 10**6
prime = []
for i in range(2, 10**6):
  if sieve[i]:
    prime.append(i)
    if i < 10**3:
      for j in range(i**2, 10**6, i):
        sieve[j] = False
n = int(input())
if n == 1:
  print(0)
else:
  e = []
  for p in prime:
    if n % p == 0:
      idx = 0
      while n % p == 0:
        n = n // p
        idx += 1
      e.append(idx)
    if n == 1:
        break
  if len(e) > 0:
    total = 0
    for idx in e:
      cnt = 1
      while idx >= cnt*(cnt+1)//2:
        cnt += 1
      cnt -= 1
      total += cnt 
    if n == 1:
      print(total)
    else:
      print(total + 1)
  else:
    print(1)

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

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

num1 = prime_decomposition(N)
num2 = collections.Counter(num1)

ans = 0

for j in set(num1):
  number = 0
  for k in range(50):
    number += k
    if number > num2[j]:
      ans += (k-1)
      break
        
print(ans)

Solution (Python):
def isprime(x):
    for i in range(2,int(x**0.5)+1):
        if x%i==0:
            return False
    return x!=1


dic={}
n=int(input())
t=int(n**0.5)+1
for i in range(2,t):
    cnt=0
    while n%i==0:
        cnt+=1
        n//=i
    dic[i]=cnt
if n!=1:
    dic[n]=1
ans=0
for i in dic:
    x=dic[i]
    r=(-1+(1+8*x)**0.5)//2
    ans+=r
print(int(ans))

Solution (Python):
n = int(input())
ans = 0
N = n

for i in range(2,int(n**0.5//1 + 2)):
  if n % i == 0:
    c = 0
    while n%i == 0:
      n//=i
      c += 1
    j = 1
    while c-j >= 0:
      ans += 1
      c -= j
      j += 1
    
if n > 1:
  ans = ans + 1
print(ans)

Solution (Python):

def factorize(n):
    res = []
    for i in range(2,n):
        if i*i > n: break
        if n%i: continue
        res += [[i,0]]
        while n%i == 0:
            n //= i
            res[-1][1] += 1
    if n != 1: res += [[n,1]]
    return res

n = int(input())
P = factorize(n)
ans = 0
for p, c in P:
    pi = 1
    for i in range(1, c+1):
        pi *= p
        if n%pi: continue
        n //= pi
        ans += 1
print(ans)

Solution (Python):


def intSqrt(n):
    x = 1
    while True:
        x2 = (x + n // x) // 2
        if x2 ** 2 <= n and abs(x - x2) <= 1:
            break
        x = x2
    return x2


def divisor(n):
    if n % 2 == 0:
        return 2
    elif n % 3 == 0:
        return 3
    maxitr = intSqrt(n)
    i = 1
    while True:
        i += 4
        if i > maxitr:
            return n
        elif n % i == 0:
            return i
        i += 2
        if i > maxitr:
            return n
        elif n % i == 0:
            return i


def factorization2(n):
    """
    returns [(factor, count), ...]
    factorization2(64*9) --> [(2, 6), (3, 2)]
    """
    result = []
    while n > 1:
        div = divisor(n)
        result.append(div)
        n //= div
    factors = set(result)
    result2 = []
    for f in factors:
        result2.append((f, result.count(f)))
    return result2

n = int(input())
import numpy as np
result = factorization2(n)
ans = 0
for factor, m in result:
    ans += np.floor((-1 + intSqrt(1 + 8 * m)) / 2) 
print(int(ans))

Solution (Python):
def is_prime(N):
    i = 2
    table = []
    while i*i <= N:
        while N%i == 0:
            N //= i
            table.append(i)
        i += 1
    if N > 1:
        table.append(N)
    return table

from itertools import groupby
N = int(input())
P = is_prime(N)
ans = 0
for v, g in groupby(P):
    n = len(list(g))
    for i in range(1, 10**5):
        n -= i
        if n >= 0:
            ans += 1
        else:
            break
print(ans)

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

ans = 0

i = 2
num = n
while i * i <= n:
  cnta = 0
  cntb = 0
  while num % i == 0:
    num //= i
    if cnta == cntb:
      ans += 1
      cnta = 0
      cntb += 1
    else:
      cnta += 1
  i += 1
  
if (ans == 0 and n != 1) or num != 1:
  ans += 1
print(ans)

Solution (Python):

def factorize(n):
    res = []
    for i in range(2,n):
        if i*i > n: break
        if n%i: continue
        res += [[i,0]]
        while n%i == 0:
            n //= i
            res[-1][1] += 1
    if n != 1: res += [[n,1]]
    return res

n = int(input())
P = factorize(n)
ans = 0
for p, c in P:
    for i in range(1, c+1):
        if c <= 0: break
        c -= i
        if c >= 0: ans += 1
print(ans)

Solution (Python):
n = int(input())
if n == 1:
    print(0)
    exit()
F = {}
tmp = n
i = 2
while i**2 <= tmp:
    cnt = 0
    while tmp % i == 0:
        cnt += 1
        tmp //= i
    if cnt > 0:
        F[i] = cnt
    i += 1
if tmp != 1 or F == {}:
    F[tmp] = 1
ans = 0
for p in F:
    a = 1
    while F[p] >= a:
        F[p] -= a
        ans += 1
        a += 1
print(ans)

Solution (Python):
import collections

n=int(input())

if n==1:
    print(0)
    exit()
    
a=[]
M=n
p=2

while p <= M**0.5:
    while n%p ==0:
        a.append(p)
        n = n//p       
        if n==1:
            break
    p += 1
if n!=1:
    a.append(n)
if len(a)==0:
    a.append(M)

c=collections.Counter(a)

x=c.most_common()

ans=0
for i in x:
    ans += int((-1+(1+8*i[1])**0.5)/2)

print(ans)

Solution (Python):
n = int(input())
ans = 0
i = 2
 
while n>1 and i*i<=n:
  if n % i == 0:
    c = 0
    while n % i == 0:
      n = n / i
      c += 1
    j = 1
    while c>=j:
      ans=ans+1
      c -= j
      j += 1
 
  i = i + 1
      
    
if n > 1:
  ans = 1 + ans
 
print(ans)

Solution (Python):
n = int(input())
ans = 0
i = 2

while n>1 and i*i<=n:
  if n % i == 0:
    c = 0
    while n % i == 0:
      n = n / i
      c += 1
    Y=1
    U=2
    while c>=Y:
      ans=ans+1
      Y=Y+U
      U=U+1

  i = i + 1
      
    
if n > 1:
  ans = 1 + ans

print(ans)

Solution (Python):
n = int(input())
ans = 0
i = 2

while n>1 and i*i<=n:
  if n % i == 0:
    c = 0
    while n % i == 0:
      n = n / i
      c = c + 1
    Y=1
    U=2
    while c>=Y:
      ans=ans+1
      Y=Y+U
      U=U+1

  i += 1
      
    
if n > 1:
  ans = 1 + ans

print(ans)

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

d = 2
while d * d <= n:
    if n % d != 0:
        d += 1
        continue

    e = d
    while n % e == 0:
        n //= e
        e *= d
        ans += 1

    while n % d == 0:
        n //= d
if n != 1:
    ans += 1

print(ans)

Solution (Python):
n = int(input())
ans = 0
i = 2

while n>1 and i*i<=n:
  if n % i == 0:
    c = 0
    while n % i == 0:
      n = n / i
      c = c + 1
    Y=1
    U=2
    while c>=Y:
      ans=ans+1
      Y=Y+U
      U=U+1

  i = i + 1
      
    
if n > 1:
  ans = 1 + ans

print(ans)

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


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


primes = prime_factor(N)

prime_dic = {}
for i in range(len(primes)):
    if primes[i] in prime_dic:
        prime_dic[primes[i]] += 1
    else:
        prime_dic[primes[i]] = 1

sum_list = [0 for _ in range(30)]
sum_list[0] = 1
for i in range(29):
    sum_list[i+1] += sum_list[i] + (i + 2)

ans = 0
for key in prime_dic:
    for i in range(30):
        if sum_list[i] > prime_dic[key]:
            ans += i
            break

print(ans)

Solution (Python):
N=int(input())
ans=0
p=2
 
while N>1 and p*p<=N:
  if N%p==0:
    c=0
    while N%p==0:
      N=N/p
      c=c+1
    Y=1
    U=2
    while c>=Y:
      ans=ans+1
      Y=Y+U
      U=U+1
  p=p+1
 
if N>1:
  ans=ans+1
 
print(ans)

Solution (Python):
def solve(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())
arr = solve(n)

cnt = 0
for n in arr:
    a=1
    if n[0]==1:
        break
    while n[1]>=a:
        n[1] -= a
        a += 1
        cnt += 1

print(cnt)

Solution (Python):
import sys
sys.setrecursionlimit(100000)


def ins(): return input().split()
def ii(): return int(input())
def iil(): return list(map(int, ins()))
def lin(): return list(input())
def iin(): return map(int, ins())

from collections import defaultdict
from math import sqrt

arr = []
max_p = int(500000)
l1 = [1 for i in range(max_p)]
l2 = set()
l2.add(2)
for i in range(max_p):
    if not l1[i]:
        continue
    l2.add(2*i+3)
    for j in range(3*i+3, max_p, 2*i+3):
        l1[j] = 0

n = int(input())

dic = defaultdict(int)
for i in l2:
    while n % i == 0:
        n //= i
        dic[i] += 1
if n != 1:
    dic[n] += 1

ans = 0
for i in dic.values():
    ans += (-1 + sqrt(1 + 8 * i))//2
print(int(ans))

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

d = 2
while d * d < n:
    if n % d != 0:
        d += 1
        continue

    e = d
    while n % e == 0:
        n //= e
        e *= d
        ans += 1

    while n % d == 0:
        n //= d
if n != 1:
    ans += 1

print(ans)

Solution (Python):
N=int(input())
ans=0
p=2
 
while N>1 and p*p<=N:
  if N%p==0:
    c=0
    while N%p==0:
      N=N/p
      c=c+1
    Y=1
    U=2
    while c>=Y:
      ans=ans+1
      Y=Y+U
      U=U+1
  p=p+1
 
if N>1:
  ans=ans+1
 
print(ans)

Solution (Python):
from collections import defaultdict

N = int(input())


def prime_factorization(N):
    PC = defaultdict(int)

    P = 2
    while N % P == 0:
        PC[P] += 1
        N //= P

    P = 3
    while P * P <= N:
        if N % P == 0:
            PC[P] += 1
            N //= P
        else:
            P += 2

    if N != 1:
        PC[N] += 1

    return PC


PC = prime_factorization(N)

ans = 0
for PI in PC.values():
    PIc = 1
    while PI >= PIc:
        ans += 1
        PI -= PIc
        PIc += 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

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

f = factorization(n)
count = 0

for i in range(len(f)):
  k = f[i][1]
  r = 1
  count += 1
  for j in range(2,k+1):
    r += j
    if k-r >= 0:
      count += 1

print(count)

Solution (Python):
from collections import Counter
import bisect

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())
L = Counter(prime_factorize(n))
A = [0]*50
for i in range(50):
    cnt = 1
    while i >= (cnt+1)*(cnt+2)//2:
        cnt += 1
    A[i] = cnt
ans = 0
for c in L.values():
    ans += A[c]
print(ans)

Solution (Python):
import math

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

primes = factorization(n)
cnt = 0

for i in primes:
    if primes == [[1, 1]]:
        break
    cnt += math.floor(math.sqrt(2*i[1]+1/4)-1/2)

print(cnt)

Solution (Python):
def is_prime(n):
  i=2
  r=[]
  while i*i<=n:
    if n%i==0:
      c=0
      while n%i==0:
        c+=1
        n//=i
      r.append((i,c))
    i+=1
  if n> 1:
    r.append((n,1))
  return r

def main():
  n=int(input())
  r=0
  for p,e in is_prime(n):
    i=1
    while e>=i:
      r+=1
      e-=i
      i+=1
  return r
print(main())

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

ans = 0

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

second_prime_max = int(N ** 0.5)

check = 2

while check <= second_prime_max:
    if N % check == 0:
        N //= check
        prime_count = 1
        while N % check == 0:
            N //= check
            prime_count += 1
        z_count = 0
        while z_count < prime_count:
            z_count += 1
            ans += 1
            prime_count -= z_count
        second_prime_max = int(N ** 0.5)
    check += 1

if N != 1:
    ans += 1

print(ans)

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

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""
if n==1:
    print(0)
    exit(0)
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)


n = len(a)

cnt =0
for i in range(n):
    k = a[i][1]

    fr=1
    cnt+=1
    for j in range(2,k+1):
        fr+=j
        if k-fr>=0:
            cnt+=1

print(cnt)

Solution (Python):
import sys
from math import ceil, floor
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def factorization(n):
    
    dic = defaultdict(int)
    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
            dic[i] = cnt
            
    if temp!=1:
        dic[temp] = 1


    return dic

def main():
    n = int(input())
    prime_dic = factorization(n)
    ans = 0
    for p in prime_dic:
        j = 1
        while prime_dic[p] >= j:
            ans += 1
            prime_dic[p] -= j
            j += 1            
    
    print(ans)
    return

if __name__ == '__main__':
    main()

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


def factorization(n):
    retval = []
    tmp = n
    for p in range(2, int(n**.5)+1):
        if tmp % p == 0:
            cnt = 0
            while tmp % p == 0:
                cnt += 1
                tmp //= p
            retval.append([p, cnt])
    if tmp != 1:
        retval.append([tmp, 1])
    return retval


fact = factorization(n)
m = len(fact)
ans = 0
for i in range(1, 1000):
    for j in range(m):
        if i <= fact[j][1]:
            fact[j][1] -= i
            ans += 1
print(ans)

Solution (Python):

import math
N = int(input())
Nsyo = N
count = 0
div = 2
divcount = 0
divlist = []
while N > 1 and div <= math.sqrt(Nsyo)+1:
    if N%div == 0:
        while N%div == 0:
            N = N/div
            divcount = divcount+1
        divlist.append(divcount)
        divcount = 0
    else:
        pass
    div = div + 1
div = 1
divcount = 0
for i in divlist:
    while i >= div:
        i = i-div
        divcount = divcount + 1
        div = div + 1
        
    count = count +divcount
    divcount = 0
    div = 1
if N > math.sqrt(Nsyo):
    count = count + 1
print(count)

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


def factorization(n):
    retval = []
    tmp = n
    for i in range(2, int(-(-n**.5//1))+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            retval.append([i, cnt])
    if tmp != 1:
        retval.append([tmp, 1])
    return retval


fact = factorization(n)
m = len(fact)
ans = 0
for i in range(1, 1000):
    update = 0
    for j in range(m):
        if i <= fact[j][1]:
            fact[j][1] -= i
            ans += 1
            update = 1
    if not update:
        break
print(ans)

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


def factorization(n):
    retval = []
    tmp = n
    for i in range(2, int(-(-n**.5//1))+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            retval.append([i, cnt])
    if tmp != 1:
        retval.append([tmp, 1])
    return retval


fact = factorization(n)
m = len(fact)
ans = 0
for i in range(1, 1000):
    for j in range(m):
        if i <= fact[j][1]:
            fact[j][1] -= i
            ans += 1
print(ans)

Solution (Python):
def prime(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 = prime(N)
a.sort()
import copy
b = copy.copy(a)
b = list(set(b))
b.sort()

ret = 0
for i in b:
    cnt = 0
    idx=0
    while True:
        idx += 1
        cnt = cnt + idx
        if a.count(i) >= cnt:
            ret += 1
        else:
            break

print(ret)

Solution (Python):
def fac(n):
    dic = {}
    cur = n
    for i in range(2,(int(n**0.5)+2)):
        if cur % i == 0:
            count = 0
            while cur % i == 0:
                count += 1
                cur //= i
            dic[i] = count
            if cur == 1:
                break
    if cur != 1:
        dic[cur] = 1
    return dic

N = int(input())
lists = fac(N)
ans = 0
for i in lists.values():
    count = 1
    while i >= count:
        i -= count
        count += 1
        ans += 1
print(ans)

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

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

p = prime_factor(n)

count = 0
for prime in p:
    power = prime[1]
    time = 1
    while power > 0 and power >= time:
        power -= time
        time += 1
        count+=1
print(count)

Solution (Python):
n=int(input())
a=0
for i in range(2,10**6):
    b=0
    while n%i==0:
        n//=i
        b+=1
    c=d=0    
    while c+d<b:
        c+=1
        d+=c
    a+=c    
print(a+(n>1))

Solution (Python):
import math

n = int(input())
count = 0
p = n

for z in range(2, int(math.sqrt(n)) + 1):
    e = 1
    while n % z ** e == 0:
        n //= z ** e
        count += 1
        e += 1
    if n % z == 0: 
        while n % z == 0:
            n //= z

if n != 1:
    count += 1
if count == 0 and p != 1:
    count = 1

print(count)

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


N = int(input())

primes = prime_factorize(N)

num = 0
hist = [1]
c = 1

tmp = 1
for p in primes:
    
    if tmp != p:
        c = 1
    tmp = p
    c *= p
    if c not in hist:
        hist.append(c)
        num += 1
        c = 1
print(num)

Solution (Python):
def prime_factorize(n):
    '''引数nの因数分解結果のlistを返す。'''
    arr = []
    while n % 2 == 0:
        arr.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            arr.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        arr.append(n)
    return arr

def main():
    n = int(input())
    f = set(prime_factorize(n))
    s = set()
    for p in f:
        e = 1
        z = p ** e
        while z <= n:
            if n % z == 0:
                if z not in s:
                    n //= z
                    s.add(z)
            e += 1
            z = p ** e
    print(len(s))
        
if __name__ == '__main__':
    main()

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

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

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

    return arr



N = int(input())
fac_dic = factorization(N) 
count = 0


for k,v in fac_dic.items():
  tmp = 1
  while(v >= tmp):
    v = v - tmp
    tmp += 1
    count += 1
  


print(count)

Solution (Python):

def factorize(n):
    res = []
    for i in range(2,n):
        if i*i > n: break
        if n%i: continue
        res += [[i,0]]
        while n%i == 0:
            n //= i
            res[-1][1] += 1
    if n != 1: res += [[n,1]]
    return res

n = int(input())
P = factorize(n)
ans = 0
for p, c in P:
    for i in range(1, c+1):
        pi = p**i
        if n%pi: continue
        n //= pi
        ans += 1
print(ans)

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



def factorize(n):
    res = []
    for i in range(2,n):
        if i*i > n: break
        if n%i: continue
        res += [[i,0]]
        while n%i == 0:
            n //= i
            res[-1][1] += 1
    if n != 1: res += [[n,1]]
    return res

P = factorize(n)


ans = 0
for pc in P:
    for c in range(1, pc[1]+1):
        pp = pc[0]**c
        if n%pp: continue
        n //= pp
        ans += 1

print(ans)

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




prime = []
for i in range(2, int(n**0.5)+1): 
  cnt = 0
  while n%i == 0:
    n //= i 
    cnt += 1
  prime.append(cnt) 
  if n == 1:
    break


if n > 1:
  prime.append(1)
  
ans = 0
for x in prime:
  for i in range(1, x+1):
    if x >= i: 
      ans += 1
      x -= i
    else:
      break
print(ans)

Solution (Python):
import math

n = int(input())
if n == 1:
    print(0)
    exit(0)
max = int(math.sqrt(n) + 0.1)
ans = 0
for i in range(2, max):
    count = 0
    while n % i == 0:
        count += 1
        n = n // i
    if count > 0:
        for j in range(1, 64):
            if count >= j:
                ans += 1
            else:
                break
            count -= j
    if n == 1:
        print(ans)
        exit(0)
print(ans + 1)

Solution (Python):
def prime_factorization(n):
    
    
    num = int(n ** 0.5)
    rec = dict()
    for prime in range(2, num + 2):
        if n % prime == 0:
            cnt = 0
            while True:
                if n % prime != 0:break
                cnt += 1
                n = n // prime
            rec[prime] = cnt

    if n != 1:rec[n] = 1
    return rec

n = int(input())
rec = prime_factorization(n)
ans = 0
for key, cnt in rec.items():
    temp = 1
    while True:
        if cnt < temp:break
        ans += 1
        cnt -= temp
        temp += 1
print(ans)

Solution (Python):
import math
import sys
input = sys.stdin.readline

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

def main():
  n = original_n = int(input().strip())
  factored = factorization(n)
  result = 0

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

  for i, count in factored:
    diff = 1
    while count > 0:
      count -= diff
      if count >= 0:
        result += 1
        diff += 1

  print(result)

main()

Solution (Python):

import sys

from functools import reduce

import math


from collections import defaultdict
from math import sqrt

def is_prime(n):
    for i in range(2, int(sqrt(n))):
        if n % i == 0:
            return False
    return True

def prime_factors(n):
    primes = defaultdict(int)
    i = 2
    mx = sqrt(n)
    while n != 1:
        if n % i == 0:
            n = n // i
            primes[i] += 1
        elif i >= mx:
            if is_prime(n):
                primes[i] += 1
            break
        else:
            i += 1
    return primes

def solve_n(x):
    return (-1 + sqrt(1 + 4 * 2* x)) / 2

def solve(N: int):
    fs = prime_factors(N)
    count = 0
    for key, value in fs.items():
        val = solve_n(value)
        count += math.floor(val)

    print(count)
    return




def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  
    solve(N)


if __name__ == "__main__":
    main()