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 sys
input = sys.stdin.readline
from collections import *

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

N = int(input())
fct = factorize(N)
ans = 0

for _, c in fct:
    sub = 1
    
    while c-sub>=0:
        ans += 1
        c -= sub
        sub += 1

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

num = int(input())
maxnum = num
l = prime_factorize(num)
if(num == 1):
    print(0)
elif(len(l)==0):
    print(1)
else:
    cnt = 0
    list=list(dict.fromkeys(l))
    for i in list:
        for n in range(maxnum):
            if(num%(i**(n+1))==0):
                num = num/(i**(n+1))
                cnt += 1
            else:
                break
    print(cnt)

Submission status: Accepted

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

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

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


ans = 0
for i in range(len(arr)):
    k = 1
    while True:
        if arr[i][1] >= k:
            ans += 1
            arr[i][1] -= k
            k += 1
        else:
            break

print(ans)

Submission status: Accepted

Solution code:
from collections import Counter
N = int(input())
a = []
x = 2
while x ** 2 <= N:
    if N % x == 0:
        a.append(x)
        N /= x
        x = 2
    else:
        x += 1
else:
    if x <= N:
        a.append(int(N))

a = Counter(a)
ans = 0
for i in a:
    k = 1
    while True:
        if a[i] >= k:
            ans += 1
            a[i] -= k
            k += 1
        else:
            break

print(ans)

Submission status: Accepted

Solution code:
#わかったこと　2~N**0.5まで素数関係なく調べればいい
n=int(input())
bunkai=[]

def different_value(e):
    cnt=0
    i=1
    while e-i>=0:
        e-=i
        i+=1
        cnt+=1
    return cnt

def soinsuu(x):
    for i in range(2,int(n**0.5)+1):
        cnt=0
        while x%i==0:
            x//=i
            cnt+=1
        if cnt==0:
            continue
        bunkai.append([i,cnt])
    if x!=1:
        bunkai.append([n,1])
soinsuu(n)

ans=0
for num,e in bunkai:
    ans+=different_value(e)

print(ans)

#print(bunkai)

Submission status: Accepted

Solution code:
from sys import stdin
from math import sqrt


def is_prime(q, primes):
    if len(primes) == 0:
        return True

    maxq = int(sqrt(q))
    for prime in primes:
        if prime > maxq:
            break
        if q % prime == 0:
            return False
    return True

def get_primes(n):
    if n < 2:
        return []
    if n == 2:
        return [2]

    max = int(sqrt(n))
    primes = [2]
    for q in range(3, max+1):
        if is_prime(q, primes):
            primes.append(q)

    return primes

def breakdown_to_primes_as_dic(n, primes):
    prime_dic = {}
    for prime in primes:
        if n % prime != 0:
            continue
        prime_dic[prime] = 0
        while n % prime == 0:
            prime_dic[prime] += 1
            n = n // prime
    if n >= 2:
        prime_dic[n] = 1
    return prime_dic

def get_int_sums(n):
    int_sums = [0]
    for i in range(1, n+1):
        int_sums.append(int_sums[i-1] + i)
    int_sums.pop(0)
    return int_sums


def main():
    for line in stdin:
        n = int(line)
        break

    primes = get_primes(n)
    prime_dic = breakdown_to_primes_as_dic(n, primes)

    if len(prime_dic.keys()) == 0:
        print(0)
        return

    max_prime_occurance = max(prime_dic.values())
    int_sums = get_int_sums(max_prime_occurance + 1)

    answer = 0
    for prime in prime_dic.keys():
        occr = prime_dic[prime]
        for i in range(1, len(int_sums)):
            if occr >= int_sums[i-1] and occr < int_sums[i]:
                answer += i
                break

    print(answer)


main()

Submission status: Accepted

Solution code:
#

import sys
input=sys.stdin.readline

def main():
    N=int(input())
    ps=[]
    for i in range(2,int((N**0.5))+1):
        if N%i==0:
            cnt=0
            for j in range(40):
                if N%i==0:
                    N//=i
                    cnt+=1
            ps.append([i,cnt])
    if N!=1:
        ps.append([N,1])
        
    ans=0
    for p in ps:
        ans+=int(((8*p[1]+1)**0.5-1)/2)
    print(ans)
    
    
if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
from math import sqrt

N = int(input())
M = N
p=2
ans=0

while p <= sqrt(M):
  z = p
  while N % z == 0:
    N //= z
    z *= p
    ans += 1
  while N % p == 0:
    N //= p
  p+=1
if N > 1:
  ans+=1
print(ans)

Submission status: Accepted

Solution code:
import bisect
from collections import defaultdict as dd

def factorize(n):
    b = 2
    fct = []

    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b += 1
    
    if n > 1:
        fct.append(n)
    
    return fct

N = int(input())
f = factorize(N)
dic = dd(int)

for val in f:
    if val != 1:
        dic[val] += 1
res = 0

ls = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66]

for val in dic.values():
    tmp = bisect.bisect_right(ls, val)
    res += tmp

print(res)

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

a=factorization(int(input()))

b=[1,3,6,10,15,21,28,36,43]

ans=0
if len(a)==1 and a[0][0]==1:
    print(0)
    exit()

for i in a:
    for j in range(len(b)):
        if i[1]<b[j]:
            ans+=j
            break
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
def decomp(a):
    factors = []
    sqrt = round(n ** 0.5 + 0.5)
    for i in range(2, sqrt + 1):
        if not a % i:
            count = 0
            while a % i == 0:
                count += 1
                a //= i
            factors.append((i, count))
    if a != 1:
        factors.append((a, 1))
    return factors
total = 0
for i, j in decomp(n):
    temp = 1
    while j >= temp:
        total += 1
        j -= temp
        temp += 1
print(total)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    if n==1:
        print(0)
        return
    k = int(n**0.5)+1
    ans = 0
    for i in range(2,k+1):
        if n%i==0:
            m = 0
            cnt = 0
            while n%i==0:
                cnt +=1
                n = int(n/i)
                if cnt>m:
                    ans += 1
                    cnt = 0
                    m +=1
                if n==1:
                    break
    if n==1:
        print(ans)
    else:
        print(ans+1)
    
if __name__ == "__main__":
    main()

Submission status: Accepted

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

res = 0
if n <= 1:
	print(res)
else:
	max_num = math.ceil(math.sqrt(n + 1))
	org_n = n
	target_list = []
	for z in range(2, max_num + 1):
		if n % z == 0:
			z_p = 1
			z_count = 0
			while n % z == 0:
				z_p *= z
				n = n // z
				if z_p not in target_list:
					target_list.append(z_p)
					z_p = 1
		if n == z:
			break
	res = len(target_list)
	if n > max_num and n not in target_list:
		res += 1

	print(res)

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:
    l=[]
    for i in range(0,len(factorization(N))):
        l.append(factorization(N)[i][1])
    l.sort(reverse=True)
    s=0
    t=1
    while l[0]>0:
        for i in range(0,len(l)):
            if l[i]>=t:
                s += 1
            l[i]-=t
        t+=1
    print(s)

Submission status: Accepted

Solution code:
import math
N = int(input())
rootN  = math.floor(math.sqrt(N))
priFacInd = {}
count = 0
for i in range(2, rootN+1):
  if N % i ==0:
    priFacInd[i] = 0
  while N % i ==0:
    N /= i
    priFacInd[i] += 1
if not N == 1:
  priFacInd[N] = 1
for priFac in priFacInd:
  for i in range(1, rootN+1):
    priFacInd[priFac] -= i
    count += 1
    if priFacInd[priFac] < i+1:
      break
print(count)

Submission status: Accepted

Solution code:
from collections import Counter

def get_prime_factors(x):
    out = []
    if x < 1:
        return out
    while not x%2:
        out.append(2)
        x //= 2
    i = 3
    while i*i <= x:
        if not x%i:
            out.append(i)
            x //= i
        else:
            i += 2
    if x != 1:
        out.append(x)
    return out
    
def main():
    n = int(input())
    primes = Counter(get_prime_factors(n))
    ans = 0
    for k, v in primes.items():
        num = 1
        while v >= num:
            v -= num
            ans += 1
            num += 1
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math
n = int(input())
l = int(math.sqrt(n))
ans = 0
  
insu = []
sisu = []
i = 2
while i <= l:
  if n % i == 0:
    if i in insu:
      sisu[insu.index(i)] += 1
    else:
      insu.append(i)
      sisu.append(1)
    n //= i
  else:
    i += 1
if n != 1:
  insu.append(n)
  sisu.append(1)
  
if not insu:
  if n == 1:
    print(0)
  else:
    print(1)
  exit()

for s in sisu:
  cnt = 1
  while cnt * (cnt + 1) / 2 <= s:
    ans += 1
    cnt += 1
    
# print(insu)
# print(sisu)
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

  
def main():
    n = int(input())
    ans = 0 
    zs = []
    f = factorization(n) 
    for p, c in f:
        for i in range(1, c + 1):
            zs.append(p ** i)
    zs = sorted(zs, reverse=True)
    while n >1 and zs != []:
        a = zs.pop()
        if n  % a == 0:
            n = n / a
            ans += 1
    print(ans)
        
            
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from collections import Counter

def get_prime_factors(x):
    out = []
    if x < 1:
        return out
    while not x%2:
        out.append(2)
        x //= 2
    i = 3
    while i*i <= x:
        if not x%i:
            out.append(i)
            x //= i
        else:
            i += 2
    if x != 1:
        out.append(x)
    return out

def main():
    n = int(input())
    primes = Counter(get_prime_factors(n))
    ans = 0
    for k, v in primes.items():
        num = 1
        while v >= num:
            ans += 1
            v -= num
            num += 1
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def doit(n):
	if(n == 1):
		return 0
	c = 0
	temp = n
	for p in range(2, int(n ** 0.5) + 1):
		if temp % p == 0:
			e = 0
			while temp % p == 0:
				e += 1
				temp //= p
			c += int(0.5 * (-1 + (1 + 8 * e) ** 0.5))

	if temp == n:
		c += 1
	elif temp != 1:
		c += 1

	return c

print(doit(int(input())))

Submission status: Accepted

Solution code:
N=int(input())

a={}
c=0
while N%2==0:
  N//=2
  c+=1
if c!=0:
  a[2]=c

f,c=3,0
while f*f<=N:
  if N%f==0:
    N//=f
    c+=1
    a[f]=c
  else:
    f+=2
    c=0
if N!=1:
  if N in a:
    a[N]+=1
  else:
    a[N]=1

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

print(t)

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())
 
count = 0
a = factorization(n)
if n == 1:
  print(0)
  exit()
  
for i in range(len(a)):
  a[i][1] -= 1
  count += 1
  b = 2
  while a[i][1] > 0:
    a[i][1] -= b
    if a[i][1] >= 0:
      count += 1
    b += 1
 
print(count)

Submission status: Accepted

Solution code:
arr = []
temp = int(input())
su =0
for i in range(2, int(-(-temp**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==[] and temp !=1:
  arr.append(1)
  su =1


for t in range(len(arr)):
  cnt =1
  while arr[t] -cnt>=0:
    arr[t] -=cnt
    su +=1
    cnt +=1
    
   
print(su)

Submission status: Accepted

Solution code:
# 素因数分解の関数　
def prime_factorize(n):
    result = []
    # 偶数時の処理
    if n % 2 == 0:
        t = 0
        while n % 2 == 0:
            n //= 2
            t += 1
        result.append((2, t))
    # ここまでのresultの出力結果[(2, 3)]
    # 偶数で破れなかった奇数の処理
    for i in range(3, int(n ** 0.5) + 1, 2):
        if n % i != 0:
            continue
        t = 0
        # 残例題の場合3が残る
        while n % i == 0:
            n //= i
            t += 1
        # 例1の場合(3,1)
        result.append((i, t))
        if n == 1:
            break
    if n != 1:
        result.append((n, 1))
    # result出力結果[(2, 3), (3, 1)]
    return result


N = int(input())
# 偶数が2回奇数が1回処理される
result = 0
for p, e in prime_factorize(N):
    i = 1
    while e >= i:
        result += 1
        e -= i
        i += 1
print(result)

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 n==1:
    arr.append(0)
  return arr
def kak(n):
  return ((1+8*n)**(1/2)-1)//2
  
A=factorization(int(input()))
print(int(sum([kak(i) for i in A])))

Submission status: Accepted

Solution code:
def main(n):

    prime = []
    if n < 2:
        prime.append((1,0))
    for p in range(2,int(n**0.5)):
        cnt = 0
        if p*p > n:
            break
        while n%p == 0:
            n //= p
            cnt += 1
        prime.append((p,cnt))
    if n > 1:
        prime.append((n,1))
    return prime
                    
n = int(input())    
pf = main(n)

ans = 0
for p, f in pf:
    cnt = 1
    while f >= cnt:
        f -= cnt
        ans += 1
        cnt += 1

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
import math
s= int(math.sqrt(n))+1

i=2
c1=0
c2=1
ans=0
while i<=s:
    if n%i==0:
        n//=i
        c1+=1
        if c1==c2:
            c1=0
            c2+=1
            ans+=1
    else:
        c2=1
        i+=1
        c1=0
if n>s:
    ans+=1
    
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter
from collections import defaultdict


def trivial_division(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乗のときの最大試行回数
dd = defaultdict(int)
total = 0
for i in range(1, 100):
    for j in range(total, total+i):
        dd[j] = i-1
    total += i

# 素因数分解後、各頻度を抽出
N = int(input())
li = trivial_division(N)
cnt = Counter(li)

ans = 0
for v in cnt.values():
    ans += dd[v]
print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())
arr = []
if N == 1:
    print(0)
    quit()


def loop_attr(num):
    temp = num
    for i in range(2, math.ceil(N**0.5)):
        counter = 0
        while(temp%i == 0):
            counter += 1
            temp //= i
        if counter != 0:
            arr.append(counter)
        if temp == 1:
            break

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


ans = 0
loop_attr(N)
for j in arr:
    count = 1
    while(j - count >= 0):
        j -= count
        count += 1
    ans += (count-1)

print(ans)

Submission status: Accepted

Solution code:
a =int(input())
list = []
b = 1
for i in range(2,44):
    list.append(b)
    b = b + i
n = 0
e = 0
k = 0
for i in range(2,1000000):
    if (a % i == 0):
        warikaisi = True
        while(warikaisi):
            if a % i == 0:
                list.append(i)
                a = a / i
                e = e + 1
                if (e == list[k]):
                    n = n + 1
                    k = k + 1
            else:
                e = 0
                k = 0
                warikaisi = False
if (a >= 1000000):
    n = n + 1
print(n)

Submission status: Accepted

Solution code:
n = int(input())


def factorization(n):
    arr = []
    tmp = n 
    for i in range(2, int(n**0.5)+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]) # n is prime
    if arr == []: 
        arr.append([n, 1]) # n==1 only
    return arr 


p_list=factorization(n)


N=n
cnt=0
while N!=1:
    for i in range(len(p_list)):
        p=p_list[i][0]
        for e in range(1,p_list[i][1]+1):
            z=p**e
            if z > N:
                break
            else:
                if N%z==0:
                    N=N//z
                    cnt+=1
    N=1    
print(cnt)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    
    ans = 0
    i = 2
    while i * i <= n:
        count = 0
        while n % i == 0:
            count += 1
            n //= i
        times = 1
        while count > 0:
            count -= times
            times += 1
            ans += 1
        if count < 0:
            ans -= 1
        i += 1
    
    if n > 1:
        ans += 1
    
    print(ans)

main()

Submission status: Accepted

Solution code:
import math
import functools

def main():
    n = int(input())
    ans = solve(n)
    print(ans)

def solve(n):
    if n == 1:
        return 0
    cnt = [[i] * (i + 1) for i in range(20)]
    cnt = [i for inner in cnt for i in inner]
    factor = prime_factorization(n)
    ans = 0
    for p, e in factor:
        ans += cnt[e]
    return ans

def prime_factorization(n):
    nn = n
    lim = math.floor(n ** (1 / 2))
    primelist = prime_list(lim)
    ans = []
    for p in primelist:
        if n % p == 0:
            e = 0
            while n % p == 0:
                e += 1
                n /= p
            ans.append((p, e))
    if ans == []:
        ans.append((n, 1))
    tmp = functools.reduce(lambda x, y: x * y, [p ** e for p, e in ans])
    if tmp != nn:
        ans.append([int(nn / tmp), 1])
    return ans

def prime_list(n):
    if n < 2:
        return []
    tmp = [True for i in range(n + 1)]
    tmp[:2] = [False, False]
    for i in range(n + 1):
        if tmp[i]:
            for j in range(2 * i, n + 1, i):
                tmp[j] = False
    ans = [num for num, flag in enumerate(tmp) if flag]
    return ans

def test():
    n = int(input())
    ans = prime_factorization(n)
    print(*ans, sep = '\n')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

def factorization(n):
    arr = []
    tmp = n 
    for i in range(2, int(n**0.5)+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]) # n is prime
    if arr == []: 
        arr.append([n, 1]) # n==1 only
    return arr 

def tri(m):
    if m==1:
        return 1
    s = 0 
    ans = 0 
    for i in range(1, m): 
        s += i
        if s > m:
             break
        ans += 1
    return ans 

n = int(input())
ans = 0 
fts = factorization(n)
if n == 1:
    print(0)
    exit(0)
for i in fts:
    ans += tri(i[1])
print(ans)

Submission status: Accepted

Solution code:
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
a=0
for i,j in factorize(int(input())):
    a+=int((-1+pow(1+8*j,0.5))/2)
print(a)

Submission status: Accepted

Solution code:
import collections

N = int(input())

def prime_factorize(n):
    a = []

    for f in range(2, int(n**0.5) + 1):
        while n % f == 0:
            a.append(f)
            n /= f
    if n != 1:
        a.append(n)
    return a

if N == 1:
    print(0)
else:
    c = collections.Counter(prime_factorize(N))
    ans = 0
    for p, max_e in c.items():
        e = 1
        while max_e > 0:
            N /= p ** e

            ans += 1
            max_e -= e        
            e += 1
            if max_e < 0:
                ans -=1
    print(ans)

Submission status: Accepted

Solution code:
#
import sys
import math
import numpy as np
import itertools

n = int(input())

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

p = factorialization(n)
#print(p)
answer = 0
for i in p:
    k = i[1]
    x = 1
    while k > 0:
        x += 1
        answer += 1
        k -= x
print(answer)

Submission status: Accepted

Solution code:
n=int(input())
ans=0
c=0
while not n%2:
    n=n//2
    c+=1
ans+=int((pow(1+8*c,0.5)-1)/2)
for i in range(3,int(pow(n,0.5))+1,2):
    
    c=0
    while not n%i:
        n=n//i
        c+=1
    ans+=int((pow(1+8*c,0.5)-1)/2)
if n>2:
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

nn = n
nnn = n 

e = []
while n % 2 == 0:
    e.append(2)
    n = n // 2
p = 3
while p * p <= n:
    if n % p == 0:
        e.append(p)
        n = n // p
    else:
        p = p + 2
if n != 1:
    e.append(n)

ue = set(e)
cnt = 0
for f in ue:
    tmpf = f
    while nn % f == 0:
        cnt = cnt + 1
        nn = nn // f
        f = f*tmpf

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

Submission status: Accepted

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

factors = prime_factorize(N)

c = collections.Counter(factors)

count = 0

for k, v in c.items():
    i = 0
    rem = v
    while True:
        i += 1
        rem -= i
        if rem < 0:
            break
        count += 1

print(count)

Submission status: Accepted

Solution code:
n=int(input())
import math
s=round(math.sqrt(n))+1

i=2
c1=0
c2=1
ans=0
while i<=s:
    if n%i==0:
        n//=i
        c1+=1
        if c1==c2:
            c1=0
            c2+=1
            ans+=1
    else:
        c2=1
        i+=1
        c1=0
if n>s:
    ans+=1
    
print(ans)

Submission status: Accepted

Solution code:
import collections

def prime_fact_counts(n):
    c = collections.Counter(prime_factorize(n))
    return c.values()


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())
count = 0
for x in prime_fact_counts(n):
    for i in range(1, x + 1):
        if x >= i:
            x -= i
            count += 1
        else:
            break
print(count)

Submission status: Accepted

Solution code:
from collections import Counter
def get_prime_factors(x):
    out = []
    if x < 1:
        return out
    while not x%2:
        out.append(2)
        x //= 2
    i = 3
    while i*i <= x:
        if not x%i:
            out.append(i)
            x //= i
        else:
            i += 2
    if x != 1:
        out.append(x)
    return out
    
    
def main():
    n = int(input())
    primes = Counter(get_prime_factors(n))
    ans = 0
    for k, v in primes.items():
        num = 1
        while v >= num:
            v -= num
            num += 1
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())

a = 1
p = 1

while p < 1e6:
    c = 0
    t = 0
    p += 1
    while n%p == 0:
        n /= p
        x=c==t
        t += x
        c += 1-t*x
        a += x

print(a-(n<2))

Submission status: Accepted

Solution code:
n=int(input())

a = 1
p = 1

while p < 1e6:
    c = 0
    t = 0
    p += 1
    while n%p < 1:
        n /= p
        x=c==t
        t += x
        c += 1-t*x
        a += x

print(a-(n<2))

Submission status: Accepted

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

import math

n=int(input())
if(1==n):
    print(0)
    exit()
a=factorization(n)
ans=0
for i,j in a:
    c=1
    while True:
        j-=c
        c+=1
        ans+=1
        if(j<c):break

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

a = []
n = N
if n % 2 == 0:
    a.append(2)
    while n%2 == 0:
        n /= 2
        
f = 3
while f**2 <= n:
    if n % f == 0:
        a.append(f)
        while n%f == 0:
            n //= f
    f += 2
if n != 1 and n not in a:
    a.append(n)

answer = 0

for i in a:
    c = 1
    while N % i**c == 0:
        answer += 1
        N /=  i**c
        c += 1
print(answer)

Submission status: Accepted

Solution code:
# N:正の整数
# ある素数p
# 正の整数e
# z=p**eと表せる
# N % z == 0
# N = N/Z

# 因数分解
# 各因数は1からカウントアップして取れるだけ取る
import math
N=int(input())
p={}

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


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

#素数が残った場合
if N!=1:
    p[N]=1

ans=0
for Pi in p.values():
    for j in range (1,Pi+1) :
        if Pi >= j:
            Pi  -= j
            ans +=1

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

Submission status: Accepted

Solution code:
import math
n = int(input())
q = int(math.sqrt(n))

ans = []
scores = []

div = 2
score = 0
while True:
  if div > q or div > n:
    if n != 1:
      ans.append(int(n))
      scores.append(1)
    break
  while n % div ==0:
    n /= div
    ans.append(div)
    score += 1
  else:
    div += 1
    if score > 0 :
      scores.append(score)
    score = 0
#print(ans,scores)

count = 0
for score in scores:
  i=1
  while score >= i:
    score -= i
    i += 1
    count += 1
print(count)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
if n == 1:
    print(0)
    exit()

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)

cnt = 0
pre = None
current_pow = 1
target_pow = 1

for i in a:
    if pre == None or pre != i:
        cnt += 1
        pre = i
        current_pow = 0
        target_pow = 2
        continue

    current_pow += 1

    if current_pow == target_pow:
        cnt += 1
        current_pow = 0
        target_pow += 1

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
i = 2
 
##N>1で√N>=iまで処理を続ける
while N > 1 and i*i <= N:
  if N % i == 0:
    c = 0
    ##Nがiで割り切れる限り続ける
    ##割った回数を記録
    while N% i == 0:
      N = N / i
      c += 1
    ##[1,3,6,10,15,,,]を作る。2**10だと(2**1)*(2**2)*(2**3),,,累積和
    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)

Submission status: Accepted

Solution code:
import math 
import sys 
input =sys.stdin.readline 

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

Submission status: Accepted

Solution code:
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(n**0.5)+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(int(input()))
b = [1, 3, 6, 10, 15, 21, 28, 36, 45]

ans = 0

if len(a) == 1 and a[0][0] == 1:
  print(0)
  exit()
  
for i in a:
  for j in range(len(b)):
    if i[1] < b[j]:
      ans+=j
      break
    
print(ans)