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: Accepted

Solution code:
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())
c = collections.Counter(prime_factorize(N))
c = list(c.items())
ans = 0
for i in range(len(c)):
    d= c[i][1]
    t=1
    while d>0:
        d -= t
        t += 1
        if d>=0:
            ans +=1

print(ans)

Submission status: Accepted

Solution code:

import sys

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

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

ans = factorization(n)

def f(v):
    i = 1
    s = 0
    while s < v:
        i += 1
        s += i
    return i - 1

print(sum([ f(v) for k,v in ans]))

Submission status: Accepted

Solution code:
from collections import defaultdict

N = int(input())
if N == 1:
    print(0)
    exit()
index = int(pow(N, 0.5) + 1)
ans = []
for i in range(2, index):
    while N % i == 0:
        N //= i
        ans.append(i)

if N != 1:
    ans.append(N)
if ans == []:
    print(1)
    exit()
d = defaultdict(int)
for i in ans:
    d[i] += 1
sosuLst = []
for v, c in d.items():
    cnt = 1
    while c > 0:
        c -= cnt
        cnt += 1
        if c != 0 and c < cnt:
            sosuLst.append(v ** cnt)
            break
        else:
            sosuLst.append(v ** (cnt - 1))

print(len(set(sosuLst)))

Submission status: Accepted

Solution code:
def factorization(n):
    if n==1:
        return []
    arr = []
    temp = n
    cand = [2]+list(range(3, int(-(-n**0.5//1))+1, 2))
    for i in cand:
        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

max_N=1000
s = [i for i in range(1, max_N)]
sums = [sum(s[:i]) for i in range(1,max_N)]
def comb(a):
    for i in range(max_N):
        if a<sums[i]:
            return i

N = int(input())
fac = factorization(N) 
res = 0
for a in [el[1] for el in fac]:
    res += comb(a)
print(res)

Submission status: Accepted

Solution code:
import collections

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
  
a=int(input())
pl=pf(a)
c=collections.Counter(pl)
nl=list(c.values())

re=0
for x in nl:
  for y in range(1,100):
    if x*2<(y+1)*(y+2):
      re+=y
      break
      
print(re)

Submission status: Accepted

Solution code:
import bisect
import collections
import math
N = int(input())

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


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 [n]
    else:
        if n != 1:
            factor.append(n)
        return factor


C = collections.Counter(trial_division(N))
# print(C)

L = [1]
for i in range(2, 1000):
    L.append(L[-1]+i)
# print(L)


ans = 0
for V in C.values():
    ans += bisect.bisect_right(L, V)
print(ans)

Submission status: Accepted

Solution code:
import collections
N = int(input())
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
A = collections.Counter(prime_factorize(N))
ans = 0
for i in A.values():
  for j in range(40):
    if ((j + 1) * (j + 2) / 2 <= i) and ((j + 2) * (j + 3) / 2 > i):
      ans = ans + j + 1
print(ans)

Submission status: Accepted

Solution code:
from math import log
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


yakusu_list = make_divisors(n)
ans_list = []
# print(yakusu_list)
ans = 0
for r in yakusu_list:
    if r == 1:
        continue
    if len(factorization(r)) == 1 and n % r == 0:
        n //= r
        ans += 1
        ans_list.append(r)
    if n == 1:
        break
# print(ans_list)
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
def fact(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
ans=0  
if N==1:
  print(0)
else:
  for i in range(len(fact(N))):
    j=1
    while fact(N)[i][1]>=j*(j+1)/2:
      j+=1
    ans+=(j-1)
  print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

tmp = n
ans = 0
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
        i_cnt = int((cnt*2)**0.5//1)
        if i_cnt * (i_cnt+1) //2 <= cnt and (i_cnt+1) * (i_cnt+2) //2 > cnt:
            ans += i_cnt
        elif (i_cnt-1) * i_cnt //2 <= cnt and i_cnt * (i_cnt+1) //2 > cnt:
            ans += i_cnt - 1

if tmp != 1:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import collections
# factrize
def factorize(target_number):
    factor = 2
    factor_list = []
    while factor * factor <= target_number:
        while target_number % factor == 0:
            target_number //= factor
            factor_list.append(factor)
        factor = factor + 1
    if target_number > 1:
        factor_list.append(target_number)
    return factor_list

N = int(input())

fact_list = factorize(N)

fact_counter_dict = collections.Counter(fact_list)
ans = 0
for fact, freq in fact_counter_dict.items():
    freq_copy = freq
    for i in range(1, freq + 1):
        freq_copy -= i
        if freq_copy < 0:
            break
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
N=n
p=2
d={}
ans=0
while(1):
    while(n%p==0):
        n//=p
        if d.get(p)==None:
            d[p]=1
        else:
            d[p]+=1
    if p**2>=N:
        if n!=1:
            d[n]=1
        break
    p+=1
for k,v in d.items():
    i=1
    while(1):
        v-=i
        if v>=0:
            ans+=1
            i+=1
        else:
            break
if (ans==0) and (N>1):
    print(1)
else:
    print(ans)

Submission status: Accepted

Solution code:
def factorization(n):
    ans = 0
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            tmp = set()
            while temp%i==0:
                cnt+=1
                temp //= i
                if not cnt in tmp:
                    tmp.add(cnt)
                    cnt = 0
                    ans += 1

    if temp!=1:
        ans += 1

    if ans==0 and temp!=1:
        ans += 1

    return ans

N = int(input())
print(factorization(N))

Submission status: Accepted

Solution code:
n=int(input())
if n==1: print(0); exit()
M=10**6+1
l=[]
p=[1]*M
p[0]=p[1]=0
for i in range(2,M):
  if p[i]:
    l.append(i)
    for j in range(2*i,M,i):
      p[j]=0
d={}
for k in l:
  c=0
  while n%k==0: n//=k; c+=1
  if c>0: d[k]=c
s=[1]
for i in range(2,9):
  s.append(s[-1]+i)
a=0
for i in d.values():
  for j in s:
    if j>i: break
    a+=1
print(a+(n>1))

Submission status: Accepted

Solution code:
def main():
    from sys import setrecursionlimit, stdin
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor, gcd
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**9+10

    def sieve_of_eratosthenes(upper_bound):
        upper_bound += 1
        P = [True] * upper_bound
        P[0] = P[1] = False
        for i in range(4,upper_bound,2):
            P[i] = False
        for i in range(3,int(upper_bound**0.5),2):
            if P[i]:
                for j in range(i**2,upper_bound,i):
                    P[j] = False
        res = []
        for i in range(upper_bound):
            if P[i]:
                res.append(i)
        return res






    N = II()
    primes = deque()
    p_counts = deque()
    tmp = N
    if tmp % 2 == 0:
        c = 0
        while tmp % 2 == 0:
            tmp //= 2
            c += 1
        primes.append(2)
        p_counts.append(c)
        
    for i in range(3,int(N**0.5)+1,2):
        c = 0
        if tmp % i == 0:
            while tmp % i == 0:
                tmp //= i
                c += 1
            primes.append(i)
            p_counts.append(c)

    if tmp != 1:
        primes.append(tmp)
        p_counts.append(1)



    ans = 0



    for i in p_counts:
        max_num = 1
        while (1+max_num)*max_num//2 <= i:
            max_num += 1

        ans += max_num-1
    print(ans)
            



    
main()

Submission status: Accepted

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy

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

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

if __name__ == "__main__":
    n = int(input())
    a = list(set(prime_factorize(n)))
    a.sort()
    cnt = 0
    for i in range(len(a)):
        e = 1
        while n%(a[i]**e) == 0:
            n = n//a[i]**e
            e += 1
            cnt+=1
    print(cnt)

Submission status: Accepted

Solution code:
import math
def factorization(n):
    if n == 1:
      return []
    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 ston(s):
  return (-1+math.sqrt(1+8*s))/2

n = int(input())

s = 0
soinsu = factorization(n)
#print(soinsu)
for i in soinsu:
  num = int(ston(i[1]))
  s += num
  
print(s)

Submission status: Accepted

Solution code:
N = int(input())

p = [0]*10**6
for i in range(2, 10**6):
    if p[i] == 0:
        p[i] = 1
        j = 2
        while i*j < 10**6:
            p[i*j] = -1
            j += 1

ans = 0
for i in range(10**6):
    if p[i] < 1:
        continue
    j = 1
    while N%pow(i, j) == 0:
        N //= pow(i, j)
        j += 1
        ans += 1

for i in range(10**6):
    if p[i] < 1:
        continue
    while N%i == 0:
        N //= i
    
if N > 10**6:
    i = 2
    f = True
    while i <= N**0.5:
        if N%i == 0:
            f = False
            break
        i += 1
    if f:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict

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

index = int(pow(N, 0.5) + 1)
ans = []
for i in range(2, index):
    while N % i == 0:
        N //= i
        ans.append(i)

if N != 1:
    ans.append(N)

if ans == []:
    print(1)
    exit()
d = defaultdict(int)
for i in ans:
    d[i] += 1

sosuLst = []
for v, c in d.items():
    cnt = 1
    while c > 0:
        c -= cnt
        cnt += 1
        if c != 0 and c < cnt:
            sosuLst.append(v ** cnt)
            break
        else:
            sosuLst.append(v ** (cnt - 1))

print(len(set(sosuLst)))

Submission status: Accepted

Solution code:
import math 

def prime(n):
    
    while n % 2 == 0: 
        if 2 in lis:
            lis[2] = lis[2] + 1
        else:
            lis[2] = 1
            
        n = n // 2

    for i in range(3,int(math.sqrt(n))+1,2): 
          
        while n % i== 0: 
            if i in lis:
                lis[i] = lis[i] + 1
            else:
                lis[i] = 1
            n = n // i 

    if n > 2: 
        if n in lis:
            lis[n] = lis[n] + 1
        else:
            lis[n] = 1


x = int(input())
lis = {}
prime(x)
total = 0

for i in lis:
    temp = 0
    rSum = 0

    while lis[i] > rSum:
        temp = temp + 1
        rSum = rSum + temp

    if lis[i] == rSum:
        total = total + temp
    else:
        total = total + temp-1

print(total)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
def factorization(n):
    ret = []
    tmp = n
    for i in range(2, int(n ** 0.5 + 1)):
        cnt = 0
        if tmp % i == 0:
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            ret.append([i, cnt])

    if tmp != 1:
        ret.append([tmp, 1])
    if ret == []:
        ret.append[n, 1]

    return ret


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

    if n == 1:
        print(0)
    else:
        f_list = factorization(n)
        p_list = []
        for f in f_list:
            p_list.append(f[1])

        cnt = 0
        for p in p_list:
            i = 1
            while p > 0:
                if p - i >= 0:
                    cnt += 1
                p -= i
                i += 1

        print(cnt)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

def factorization_in_prime_number(x):
    prime_factor = []
    degree = 0
    while x % 2 == 0:
        x //= 2
        degree += 1
    if degree:
        prime_factor.append((2, degree))
    m = int(x**.5) + 1
    for i in range(3, m, 2):
        degree = 0
        while x % i == 0:
            x //= i
            degree += 1
        if degree:
            prime_factor.append((i, degree))
    if x != 1:
        prime_factor.append((x, 1))
    return prime_factor


z = factorization_in_prime_number(N)
ans = 0
for x, i in z:
    cnt = 0
    while cnt*(1+cnt)/2 < i:
        cnt += 1
    if cnt*(1+cnt)/2 > i:
        cnt -= 1
    # print(cnt, i)
    ans += cnt
print(ans)

Submission status: Accepted

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

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

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

ib = factorization(N)

ans = 0
for i in ib:
    count = 0
    tousa = 0
    while int(tousa) <= i[1]:
        count += 1
        tousa = (count*(count+1))/2
    ans += (count-1)
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter


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

c = Counter(prime_factorize(N))
keys = c.keys()
ans = 0

for key in keys:
    cnt = 0
    while c[key] >= cnt + 1:
        ans += 1
        c[key] -= (cnt + 1)
        cnt += 1

print(ans)

Submission status: Accepted

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


n = int(input())
f = factorization(n)
#print(f)
ans = 0
for a,b in f:
    if a > 1:
        i = 1
        t = 0
        while True:
            if b - i >= 0:
                t += 1
                b -= i
                i += 1
            else:
                break

        #print(a,t)
        ans += t

print(ans)

Submission status: Accepted

Solution code:
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())
t=prime_factorize(n)
t.append(0)
count=0
num=1
answer=0
for i in range(len(t)-1):
    if num==1:
        answer+=1
        if t[i]==t[i+1]:
            num+=1
    else:
        count+=1
        if t[i]!=t[i+1] and count!=num:
            num=1
            count=0
        elif count==num:
            answer+=1
            count=0
            if t[i]==t[i+1]:
                num+=1
            else:
                num=1
if n==1:
    answer=0
print(answer)

Submission status: Accepted

Solution code:
import math


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N = read_int()
    if N == 1:
        return 0
    max_divisor = math.sqrt(N)
    divisor = 2
    counter = 0
    while divisor <= max_divisor:
        temp_divisor = divisor
        while N%temp_divisor == 0:
            N //= temp_divisor
            temp_divisor *= divisor
            counter += 1
        while N%divisor == 0:
            N //= divisor
        divisor += 1
    if N != 1:
        counter += 1
    return counter


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

Submission status: Accepted

Solution code:
import sys
# from collections import defaultdict
# from collections import Counter
# from queue import Queue
import math

sys.setrecursionlimit(10000)

def solve(n, start):
    if n == 1:
        return 0

    for i in range(start, int(math.sqrt(n+1))):
        sys.stderr.write('i = {}\n'.format(i))

        if n % i == 0:
            # 素因数を枯らす
            sys.stderr.write('hit: n = {}, i = {}^1\n'.format(n, i))
            sys.stderr.write('hit: {}^1\n'.format(i))
            cnt = 1
            tmp = n // i
            while(tmp % (i ** (cnt+1)) == 0):
                sys.stderr.write('hit: {}^{}\n'.format(i, cnt+1))
                tmp = tmp // (i ** (cnt+1))
                cnt += 1

            while(tmp % i == 0):
                tmp = tmp // i

            return solve(tmp, i+1) + cnt

    return 1

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

    ans = solve(N, 2)
    print(ans)

    # N, M = [int(s) for s in input().split()]

    # As = []
    # for i in range(N):
    #     tmp = int(input())
    #     As.append(tmp)

    return 0

if __name__ == '__main__':
    sys.exit(main())

Submission status: Accepted

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

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

a = prime_factorize(N)
c = collections.Counter(a)

ind = []
ans = 0
for x in range(1,10):
    ans += x
    ind.append(ans)

cnt = 0
for y in c.values():
    for j,x in enumerate(ind):
        if y < x:
            cnt += j
            break

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())


def simple_factrization(n):
    table = []  # 素因数を格納する
    temp = n    # 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

            table.append([i, cnt])

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

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

    return table


f = simple_factrization(N)

count = 0
for i, f_i in enumerate(f):

    tmp_f_i = f_i[1]

    for j in range(1, f_i[1] + 1):
        tmp_f_i -= j
        if tmp_f_i < 0:
            break
        count += 1

print(count)

Submission status: Accepted

Solution code:
from collections import Counter


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

    A = prime_factorize(n)
    AC = Counter(A)

    ans = 0
    for v in AC.values():
        k = 1
        while True:
            v -= k
            if v < 0:
                break

            ans += 1
            k += 1

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from sys import stdin, stdout
import math

def primeFactors(n): 
    ans = []
    # Print the number of two's that divide n 
    while n % 2 == 0: 
        ans.append(2) 
        n = n / 2
          
    # n must be odd at this point 
    # so a skip of 2 ( i = i + 2) can be used 
    for i in range(3,int(math.sqrt(n))+1,2): 
          
        # while i divides n , print i ad divide n 
        while n % i== 0: 
            ans.append(i)
            n = n / i 
              
    # Condition if n is a prime 
    # number greater than 2 
    if n > 2: 
        ans.append(int(n))

    return ans 

n = int(stdin.readline())

from collections import Counter

c = Counter(primeFactors(n))
# print(c)

ans = 0
t = list(c.keys())

for key in t:
    i = 1
    while c[key]!=0:
        if c[key]>=i:
            c[key] -= i
            ans += 1
            i += 1

        else:
            if c[key]%2 == 1:
                c[key] -= 1
            
            if c[key] == 0:
                del c[key]
            break

print(ans)
# if len(c) == 0:
#     print(ans)
# else:
#     print(ans)
#     print(c)

#     t = list(c.keys())

#     processed = set()
#     for k1 in t:
#         for k2 in t:
#             if k1!=k2:
#                 if (k1, k2) not in processed and (k2, k1) not in processed:
#                     if c[k1] >= 2 and c[k2] >= 2:
                        
#                         i = 2
#                         while c[k1]>1 and c[k2]>1:
#                             if c[k1] - i >= 0 and c[k2] - i >= 0:
#                                 ans += 1
#                                 c[k1] -= i
#                                 c[k2] -= i
#                                 i += 2

#                             else:
#                                 processed.add((k1, k2))
#                                 break
#     print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

c1 = collections.Counter(prime_factorize(N))
ans = 0
c = list(c1.values())
# print(c)

for i in c:
    k = 1
    while True:
        i =i - k
        if i >=0:
            ans += 1
            k += 1
        else:
            break
print(ans)

Submission status: Accepted

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

#超えない最大の三角数
tmp = 0
ls = [0]
for i in range(1,41):
    tmp += i
    ls += [i]*(i+1)

#print(ls[:10])

N = int(input())
if N == 1:
    print(0)
else:
    fac = factorization(N)
    ans = 0
    for p in fac:
        ans += ls[p[1]]
        #print(p)
    print(ans)

Submission status: Accepted

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())
if n == 1:
  print(0)
  exit()
f = factorization(n)
ans = 0
sum_list = [1, 3, 6, 10, 15, 21, 28, 36, 45]
for i in f:
  for j, m in enumerate(sum_list):
    if i < m:
      ans += j
      break
print(ans)

Submission status: Accepted

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

n = int(input())
if n == 1:
    print(0)
else:
    answer = 0
    for factor in factorization(n):
        x = factor[1]
        kouho = int((2*x)**0.5)-1
        if (kouho)*(kouho+1)/2 <=x and x < (kouho+1)*(kouho+2)/2:
            kaisu = kouho
        else:
            kaisu = kouho+1
        answer += kaisu

    print(answer)

Submission status: Accepted

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




N = int(input())
sosuu = factorization(N)
#print(sosuu)
ans = 0

for partial in sosuu:
    #print(partial)
    partial_count = 0
    if partial[0] == 1:
        #print(0)
        ans = 0
        break
    for x in range(1,partial[1]+1):
        partial_count += x
        if partial_count > partial[1]:
            break
        ans += 1

print(ans)

Submission status: Accepted

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

n=int(input())
if n==1:
    print(0)
    exit()
ans=factorization(n) 
f=0
for i in range(len(ans)):
    p=ans[i][1]
    j=1
    while p>=j:
        p=p-j
        j+=1
        f+=1
print(f)

Submission status: Accepted

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

  
table = factorization(N)

if N == 1:
  print(0)
else:
  ans = 0
  for a,b in table:
    cand = int(math.sqrt(2*b))
    cnt = 0
    for i in range(max(0,cand-10),cand+10):
      if 2*b >= i*(i+1):
        cnt=i
      else:
        break
    ans += cnt
  print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

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
ans = factorization(n)
s= 0
for i in range(len(ans)):
    now = 1
    while(ans[i][1] >= 0):
        ans[i][1] -= now
        #print(ans[i][0],now)
        s += 1
        now += 1
    s -= 1
print(s)

Submission status: Accepted

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

B = factorization(A)
N = len(B)
ans = 0
for n in range(N):
  m =1
  b = B[n][1]
  while b >= ((m+1)*(m+2)//2):
    m+=1
  ans += m
if A==1:
  print(0)
else:
  print(ans)