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:
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

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

temp = factorization(N)
temp = sorted(temp, key= lambda x: x[0])

# temp = [[2,9]]



output_set = []
output = [ output_set + [t[0]]*t[1] for t in temp ]

count = 0
for i in output:
    temp = len(i)
    sums = 0
    for t in range(1,temp+1):
        sums += t
        if temp >= sums:
            count += 1

if N==1:
    print(0)
else:
    print(count)

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

cnt = collections.Counter(prime_factorize(N))
ans = 0
# print(cnt)
for val in cnt.values():
    # print(val)1
    m = 1
    while m*(m+1)//2 <= val:
        m += 1
    ans += m-1

print(ans)

Submission status: Accepted

Solution code:

def solve():
    N=n=int(input())
    q=int(n**0.5)
    ans=0
    for d in range(2,q+1) :
        a=0
        while n % d == 0 :
            a+=1
            n//=d
        if a>0 :
            ans+=int(((a*8+1)**0.5-1)/2)
    if n > 1 :
        ans+=1
    return ans

print(solve())

Submission status: Accepted

Solution code:
def prime_fac(x):
    pfs = {1}
    for i in range(2, x):
        if i * i > x:
            break
        while x % i == 0:
            pfs.add(i)
            x //= i
    pfs.add(x)
    return pfs


n = int(input())
xs = prime_fac(n)
xs.remove(1)
ans = 0
for v in xs:
    t = v
    while n % t == 0:
        n //= t
        t *= v
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter

N=int(input())
N_=N
f_=[]
for n in range(2,int(N**(1/2))+2):    
    while N_ % n==0: 
        N_=int(N_/n)
        f_.append(n)
        
if N_ != 1:
	f_.append(N_)
    
C=Counter(f_)
N_=N
ans=0
for c in C.keys():
    for c_ in range(1,C[c]+1):
        if N_ % c**c_ == 0:
            N_ = N_/c**c_
            ans+=1
if N==1:
    ans=0
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

def factorization(num):
    res = []
    n = num
    div_max = int(num ** 0.5)
    for i in range(2, div_max+1):
        if n % i == 0:
            count = 0
            while n % i == 0:
                count += 1
                n //= i
            res.append([i, count])

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

    if len(res) == 0:
        res.append([num, 1])

    return res

res = factorization(N)

ans = 0
for i in range(len(res)):

    p, n = res[i]
    if p != 1:
        j = 1
        while n - j >= 0:
            ans += 1
            n -= j
            j += 1

print(ans)

Submission status: Accepted

Solution code:
import itertools

n = int(input())
ans = 0


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 q(m):
    check = 0
    while m >= check * (check + 1) / 2:
        check += 1
    return check - 1


a = prime_factorize(n)
gr = itertools.groupby(a)
for key, group in gr:
    ans += q(len(list(group)))

print(ans)

Submission status: Accepted

Solution code:
def INT():
    return int(input())

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

from math import sqrt

N = INT()
tmp = N
fact = {}

for n in range(2, int(sqrt(N)) + 1):
    if tmp == 1:
        break
    
    e = 0
    while 1:
        if tmp % n != 0:
            break
        tmp //= n
        e += 1
    
    if e == 0:
        continue

    fact[n] = e

if tmp != 1:
    fact[tmp] = 1

if fact == {}:
    fact[N] = 1

ans = 0

for p in fact.keys():
    e = 1
    z = p
    
    if N == 1:
        break
    
    while 1:
        if N % z != 0:
            break
        N //= z
        e += 1
        z = pow(p, e)
        ans += 1
        
print(ans)

Submission status: Accepted

Solution code:
def INT():
    return int(input())

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

from math import sqrt

N = INT()
tmp = N
fact = {}
is_prime = True

for n in range(2, int(sqrt(N)) + 1):
    if tmp == 1:
        break
    
    e = 0
    while 1:
        if tmp % n != 0:
            break
        tmp //= n
        e += 1
    
    if e == 0:
        continue

    fact[n] = e

if tmp != 1:
    fact[tmp] = 1

if fact == {}:
    fact[N] = 1

ans = 0

for p in fact.keys():
    e = 1
    z = p
    
    if N == 1:
        break
    
    while 1:
        if N % z != 0:
            break
        N //= z
        e += 1
        z = pow(p, e)
        ans += 1
        
print(ans)

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())
D = collections.Counter(prime_factorize(N))
A=0
for d in D:
    e=D[d]
    for i in range(40):
        if (i+1)*(i+2)>2*e:
            A=A+i
            break
print(A)

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

Solution code:
import math
n=int(input());
arr=[]
j=2
while j*j<=n:
	cnt=0
	while n%j==0:
		cnt=cnt+1
		n=n/j
	if cnt!=0:
		arr.append(cnt)
	j=j+1
if n>1:
	arr.append(1)
ans=int(0)
for i in arr:
	ans=ans+int((math.sqrt(1+8*i)-1)/2)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
#nを素因数分解したリストを返す
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
a = prime_decomposition(n)
list_num=[]
for i,n in enumerate(a):
  if i ==0:
    list_num.append(n)
  if n in list_num:
    continue
  elif n not in list_num:
    list_num.append(n)
count = 0
for i in list_num:
  num = a.count(i)
  handan = True
  j = 1
  counter = 0
  while handan == True:
    num -=j
    if num<0:
      handan =False
    elif num>=0:
      counter+=1
      j+=1
  count +=counter

print(count)

Submission status: Accepted

Solution code:
# import sys
# input = sys.stdin.readline
import itertools
import collections
from decimal import Decimal


# 持っているビスケットを叩き、1枚増やす
# ビスケット A枚を 1円に交換する
# 1円をビスケット B枚に交換する
def main():
    n = int(input())
    p = prime_factorize(n)
    cp = collections.Counter(p)
    ans = 0
    for c, num in cp.items():
        count = 0
        jou = 1
        for _ in range(num):
            count += 1
            if count == jou:
                count = 0
                jou += 1
                ans += 1
    print(ans)

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 bfs(H, W, black_cells, dist):
    d = 0
    while black_cells:
        h, w = black_cells.popleft()
        d = dist[h][w]
        for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
            new_h = h + dy
            new_w = w + dx
            if new_h < 0 or H <= new_h or new_w < 0 or W <= new_w:
                continue
            if dist[new_h][new_w] == -1:
                dist[new_h][new_w] = d + 1
                black_cells.append((new_h, new_w))
    return d


def input_list():
    return list(map(Decimal, input().split()))


def input_list_str():
    return list(map(str, input().split()))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())


hash = {}
end = int(N ** (1/2))
for i in range(2, end + 1):
    while N % i == 0:
        hash[i] = hash.get(i, 0) + 1
        N = N // i
if N != 1:
        hash[i] = hash.get(i, 0) + 1


count = 1
res = 0
for i in hash.values():
    count = 1
    while i >= count:
        res += 1
        i -= count
        count += 1

print(res)

Submission status: Accepted

Solution code:
N = int(input())


hash = {}
end = int(N ** (1/2))
for i in range(2, end + 1):
    while N % i == 0:
        hash[i] = hash.get(i, 0) + 1
        N = N // i
if N != 1:
        hash[i] = hash.get(i, 0) + 1



count = 0
trans = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55]

res = 0
for i in hash.values():
    for j in range(len(trans)):
        if i > trans[j]:
            continue
        elif i == trans[j]:
            res += (j + 1)
            break
        else:
            res += j
            break



print(res)

Submission status: Accepted

Solution code:
N = int(input())


hash = {}
end = int(N ** (1/2))
for i in range(2, end + 1):
    while N % i == 0:
        if i in hash:
            hash[i] += 1
        else:
            hash[i] = 1
        N = N // i
if N != 1:
        if N in hash:
            hash[N] += 1
        else:
            hash[N] = 1

if len(hash.keys()) == 0 and N != 1:
    print(1)
    exit()


count = 0
trans = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55]

res = 0
for i in hash.values():
    for j in range(len(trans)):
        if i > trans[j]:
            continue
        elif i == trans[j]:
            res += (j + 1)
            break
        else:
            res += j
            break



print(res)

Submission status: Accepted

Solution code:
import math
def factorization(n):
    fac_list = []
    tmp = n
    for i in range(2, int(math.sqrt(n)) + 1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            fac_list.append(cnt)
    if tmp != 1:
        fac_list.append(1)
    if fac_list == []:
        fac_list.append(1)
    return fac_list

n = int(input())
fac_list = factorization(n)
ans = 0

for x in fac_list:
    tmp = 1
    while x - tmp >= 0:
        x -= tmp
        tmp += 1
        ans += 1

print(ans if n != 1 else 0)

Submission status: Accepted

Solution code:
import math

# 素数か否かを判定する関数
def is_prime(n):
    for i in range(2, int(math.sqrt(n))+1):
        if n%i == 0:
            return False
    return True      

# nまでの素数を返す関数（エラトステネスの篩）
def getPrime(n):
    n_sqrt = int(math.sqrt(n))
    array = [True]*(n_sqrt+1)
    result = []
    for i in range(2, n_sqrt+1):
        if array[i]:
            array[i] = False
            result.append(i)
            for j in range(i*2, n_sqrt+1, i):
                array[j] = False
    return result

N = int(input())
n = N
prime = getPrime(n)
prime_exp = []
# print(prime)
for p in prime:
    cnt = 0
    while n%p == 0:
        n = int(n/p)
        # print(n)
        cnt += 1
    if cnt != 0:
        prime_exp.append([p, cnt])
if is_prime(n) and n != 1:
    prime_exp.append([n, 1])
ans = 0
for pe in prime_exp:
    ans += int((-1+math.sqrt(1+8*pe[1]))/2)
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
  
c = collections.Counter(prime_factorize(n))
cc=list(c.keys())
def countcheck(x):
  a=0
  aa=0
  b=[1]
  while x>=a:
    a+=b[-1]
    c=b[-1]+1
    b.append(c)
    if x>=a:
      aa+=1
    
  return aa

ans=0

for x in range(len(cc)):
  dd=cc[x]
  d=c[dd]
  e=countcheck(d)
  ans+=e
  
print(ans)

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

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 = inp()
if n == 1:
    print(0)
    exit()

f = factorization(n)

ans = 0
for i in range(len(f)):
    sum = f[i][1]
    tmp = 0
    if sum == 1:
        ans += 1
    else:
        for j in range(1,int(sum)):
            tmp += j
            if tmp > sum:
                break
            ans += 1

print(ans)

Submission status: Accepted

Solution code:
import collections
n = int(input())
arr = collections.Counter()
def factorize(num):
    while num % 2 == 0:
        arr[2] += 1
        num //= 2
    f = 3
    while f ** 2 <= n:
        if num % f == 0:
            arr[f] += 1
            num //= f
        else:
            f += 2
    if num != 1:
        arr[num] = 1

factorize(n)
varr = list(arr.values())
ans = 0
for i in varr:
    c = 0
    while c < i:
        ans += 1
        c += 1
        i -= c
print(ans)

Submission status: Accepted

Solution code:
import collections
n = int(input())
arr = collections.Counter()
def factorize(num):
    while num % 2 == 0:
        arr[2] += 1
        num //= 2
    f = 3
    while f ** 2 <= n:
        if num % f == 0:
            arr[f] += 1
            num //= f
        else:
            f += 2
    if num != 1:
        arr[num] = 1

factorize(n)
varr = list(arr.values())
ans = 0
for i in varr:
    c = 1
    while c <= i:
        i -= c
        ans += 1
        c += 1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())

def prime_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 solve():
    if N==1:
        print(0)
        return

    pri_arr=prime_factorization(N)
    ans=0

    for i in range(len(pri_arr)):
        e=pri_arr[i][1]
        temp=0
        cur=1

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

    print(ans)
    
if __name__ == "__main__":
     solve()

Submission status: Accepted

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

def getpattern(x):
  pattern = 0
  d = 0
  for i in range(1, 1000000):
    d += i
    if x < d:
      break
    pattern += 1
  return pattern

n = int(input())
f = factorize(n)
fu = set(factorize(n))
r = 0
for fui in fu:
  r += getpattern(f.count(fui))
print(r)

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

cnt = 0
n = int(input())
#if n == 1:
#  print(0)

f_list = factorization(n)

for item in f_list:
  power = item[1]
  counter = 1
  while(True):
    power -= counter
    if power<0:
      break
    cnt+=1
    counter+=1
if n == 1:
  cnt = 0
print(cnt)

Submission status: Accepted

Solution code:
from collections import Counter
 
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)
num = list(Counter(a).values())

ans = 0
for i in num:
    j = 1
    while i - j >= 0:
        ans += 1
        i -= j
        j += 1
 
print(ans)

Submission status: Accepted

Solution code:
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): #各素因数の指数について、k(k+1)//2<=(指数)を満たす最大のkを求める
   if (i*(i+1))//2>val:
     ans+=i-1
     break
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


ans = 0
# print(prime_factorize(n))
a = collections.Counter(prime_factorize(n))
# print(a)
for i in a.keys():
    for j in range(1, a[i]+1):  # 1乗　2乗...
        if a[i] < j:
            break
        else:
            a[i] -= j
            ans += 1
        # print(a[i])

print(ans)

Submission status: Accepted

Solution code:
from math import *
from collections import Counter
def factorize(n):
	res = []
	while n%2 == 0:
		res.append(2)
		n = n//2
	for i in range(3,int(sqrt(n))+1,2):
		while n%i == 0:
			res.append(i)
			n = n//i
	if n > 2:
		res.append(n)

	return set(res)

n = int(input())
primes = factorize(n)
ans = 0
for i in primes:
	c = i
	while n%c == 0:
		n = n // c
		c = c * i
		ans+=1
print(ans)

Submission status: Accepted

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

def add(X):
    counter = 0
    while True:
        if counter * (counter + 1) <= X * 2:
            counter += 1
        else:
            counter -= 1
            break
    # print(X, counter)
    return counter

facts = factorization(N)
answer = 0
for f in facts:
    if f[0] != 1:
        answer += add(f[1])
print(answer)

Submission status: Accepted

Solution code:

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

n = int(input())
a = [0]*(int(n**0.5)+1)
cnt=1
for i in range(1,len(a)):
    for j in range(cnt,cnt+i+1):
        if j < len(a):
            a[j] = i
            cnt += 1
        else:
            break
sum = 0
insu = soinsu(n)

for i in range(len(insu)):
    sum += a[insu[i][1]]
print(sum)

Submission status: Accepted

Solution code:
n = int(input())
if n == 1:
    print(0)
else:
    cnt_ls = [0] * 41
    cnt = 0
    add = 1
    for i in range(1, 41):
        cnt_ls[i] = add
        cnt += 1
        if cnt == add + 1:
            add += 1
            cnt = 0

    f_ls = []
    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
            f_ls.append(cnt)
    if tmp != 1:
        f_ls.append(1)
    if f_ls == []:
        f_ls.append(1)

    ans = 0
    for i in f_ls:
        ans += cnt_ls[i]

    print(ans)

Submission status: Accepted

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

import collections
c = collections.Counter(prime_factorize(n))
ans = 0
for _,value in c.items():
    i = 0
    while value>i:
        i += 1
        value -= i
    ans += i
print(ans)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def prime_factorize(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(readline())

p = prime_factorize(n)

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

ans = 0
for f, c in p:
    cnt = 0
    while c >= cnt+1:
        c -= cnt+1
        cnt += 1
    ans += cnt
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import math


def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


def LI(): return list(map(int, sys.stdin.readline().split()))


def generate_primes(n):
    if n < 2:
        return []
    is_prime_array = [True] * (n + 1)
    is_prime_array[0], is_prime_array[1] = False, False
    for i in range(2, n+1):
        if is_prime_array[i]:
            k = 2 * i
            while k < n + 1:
                is_prime_array[k] = False
                k += i
    return list(filter(lambda i: is_prime_array[i], range(n+1)))


def main():
    N = II()
    if N <= 1:
        print(0)
        exit()
    max_prime = math.ceil(N**0.5)
    primes = generate_primes(max_prime)
    es = [0] * len(primes)
    for i in range(len(primes)):
        while N % primes[i] == 0:
            N /= primes[i]
            es[i] += 1

    ans = 0
    if int(N) != 1:
        ans += 1

    for i in range(len(es)):
        k = 1
        while es[i] - k >= 0:
            es[i] -= k
            k += 1
            ans += 1

    print(ans)


main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import math


def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


def LI(): return list(map(int, sys.stdin.readline().split()))


def generatePrimes(n):
    if n < 2:
        return []
    isPrimeArray = [True] * (n + 1)
    isPrimeArray[0], isPrimeArray[1] = False, False
    for i in range(2, n+1):
        if isPrimeArray[i]:
            k = 2 * i
            while k < n + 1:
                isPrimeArray[k] = False
                k += i
    return list(filter(lambda i: isPrimeArray[i], range(n+1)))


def main():
    N = II()
    if N <= 1:
        print(0)
        exit()
    max_prime = math.ceil(N**0.5)
    primes = generatePrimes(max_prime)
    es = [0] * len(primes)
    for i in range(len(primes)):
        while N % primes[i] == 0:
            N /= primes[i]
            es[i] += 1

    ans = 0
    if int(N) != 1:
        ans += 1

    for i in range(len(es)):
        k = 1
        while es[i] - k >= 0:
            es[i] -= k
            k += 1
            ans += 1

    print(ans)


main()

Submission status: Accepted

Solution code:
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==[] and n!=1:
        arr.append([n, 1])

    return arr

arr = factorization(N)


candidate_arr = sorted([arr[i][0]**(j+1) for i in range(len(arr)) for j in range(arr[i][1])])

ans = 0
for c in candidate_arr:
    if N%c==0:
        ans+=1
        N /= c

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

def prime_factor(n):
    factor = []
    for i in range(2, int(n ** 0.5) + 1):
        while (n % i == 0):
            factor.append(i)
            n //= i
    if n != 1:
        factor.append(n)
    return list(set(factor))

factor = prime_factor(n)

cnt = 0
for p in factor:
    if n % p == 0:
        e = 1
        while n % pow(p, e) == 0:
            cnt += 1
            n //= pow(p, e)
            e += 1

print(cnt)

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()
a = factorization(N)
cnt = 0
for i in a:
  temp = i[1]-1
  d = 2
  while temp>=d:
    temp -= d
    d += 1
  cnt+=d-1
print(cnt)

Submission status: Accepted

Solution code:
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())
if N == 1:
    count = 0
else:
    fact = factorization(N)
    count = 0

    for i in range(len(fact)):
        count += math.floor((-1+(1+8*fact[i][1])**0.5)/2)
print(count)

Submission status: Accepted

Solution code:
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
if n == 1:
    print(0)
    exit()
primes = prime_factorize(n)
max_primes = primes[-1]
dic = {}
tmp = 0
for i in primes:
    if i not in dic:
        dic[i] = 1
        tmp = 0
        continue
    if tmp == 0:
        tmp = i
    else:
        tmp *= i
        if tmp not in dic:
            dic[tmp] = 1
            tmp = 0
print(len(dic))

Submission status: Accepted

Solution code:
from collections import Counter

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

n = int(input())
prime_numbers = prime_factorize(n)
prime_counter = Counter(prime_numbers)

ans = 0
for v in prime_counter.values():
    i = 1
    while v >= i:
        ans += 1
        v -= i
        i += 1

print(ans)

Submission status: Accepted

Solution code:
from math import sqrt

pf={}
m=int(input())
for i in range(2,int(m**0.5)+1):
    while m%i==0:
        pf[i]=pf.get(i,0)+1
        m//=i
if m>1:pf[m]=1

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

Submission status: Accepted

Solution code:
#
import sys
n = int(input())
#素因数分解
def factorization(n):
    arr = []
    tmp = n
    #2から√n で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
            arr.append([i, cnt])
    if tmp != 1:  #割り切れなかったとき
        arr.append([tmp, 1])
    if arr == []: #素数の場合(割れなかった場合)
        arr.append([n, 1])
    return arr

p = factorization(n)
count = 0
#すべての素因数で分解する
for x in p:
    #割れなくなったら抜ける
    if n == 1:
        break
    #x[i][0]の１からp[i][1]乗で割る
    for j in range(1, x[1] + 1):
        if n % (x[0]**j) == 0:
            n /= x[0]**j
            count += 1
        else:#割れなくなったら抜ける
            break
print(count)

Submission status: Accepted

Solution code:
n = int(input())

def factorization(n):
    arr = []
    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

f_list = factorization(n)
ans = 0
#print(f_list)
for i in range(len(f_list)):
    _tmp = f_list[i][1]
    #print("tmp",_tmp)
    j = 1
    #素因数分解したときのx^y y=1,2のとき1 y=3,4,5のとき2 y=6,7,8,9のとき3
    while _tmp >= 0:
        _tmp -= j
        j += 1
    ans += j-2

print(ans)