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:
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
c = collections.Counter(prime_factorize(N))

ans = 0
for i in c.values():
    for j in range(1,i+1):
        i -= j
        if i >= 0:
            ans += 1
        else:
            break

print(ans)

Submission status: Accepted

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

if t!=1:
    a.append([t,1])

if a==[] and t!=1:
    a.append([n, 1])
ans=0
for i in a:
    j = 1
    while i[1]>=0:
        i[1]-=j
        if i[1]>=0:
            ans+=1
            j+=1
print(ans)

Submission status: Accepted

Solution code:
import collections

# input
N = int(input())

# process
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))

ans = 0
for c in C.values():
    t = c
    for i in range(1, c+1):
        t -= i
        if t >= 0:
            ans += 1
        else:
            break

# output
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(cnt)

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

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

    return arr

arr = factorization(N)
if N==1:
  arr = []
def solv(c):
    D = (1 - 8*(-c)) ** (1/2)
    x_1 = (-1 + D) / 2
    x_2 = (-1 - D) / 2
    
    return int(max(x_1, x_2))
ans = 0
for i in arr:
  ans += solv(i)

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

z = []

f = sorted(factorization(n), key=lambda x: x[1], reverse=True)
# print(f)
for i in range(len(f)):
    if f[i][1] < 0:
        f[i][1] = -1 * f[i][1]

for i in range(len(f)):
    for j in range(1, f[i][1] + 1):
        if f[i][0] == 1:
            continue
        f[i][1] -= j
        if f[i][1] >= 0:
            z.append(f[i][0] ** j)
# print(z)
print(len(z))

Submission status: Accepted

Solution code:
n = int(input())

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

x = n ** 0.5
d = {}
z = 2
ans = 0
while True:
    if n % z == 0:
        n //= z
        if d.get(z) == None:
            d[z] = 1
        else:
            d[z] += 1
    else:
        z += 1
    if n == 1:
        break
    if x < z:
        ans = 1
        break
    
for dv in d.values():
    i = 1
    while True:
        dv -= i
        i += 1
        if dv < 0:
            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())
arr=factorization(n)
num=[1,3,6,10,15,21,28,36,45,55,66]

res=0
for x,y in arr:
	 for i in num:
	 	if y>=i:
	 		res+=1

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

Submission status: Accepted

Solution code:
import bisect
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())
    if n == 1:
        print(0)
        return
    ans = 0
    p = factorization(n)

    for i, pp in enumerate(p):
        tmp = pp[1]
        ary = [0] * (tmp+1)
        cnt = 1
        while tmp > 0:
            ans += 1
            tmp -= cnt
            if tmp <= cnt:
                cnt += 1
                break
            if tmp < 0:
                tmp += cnt

            cnt += 1
    print(ans)


if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:

from collections import Counter
import math

N = int(input())
def prime_factors(n):
    """Returns all the prime factors of a positive integer"""
    factors = []
    d = 2
    while n > 1:
        while n % d == 0:
            factors.append(d)
            n /= d
        d = d + 1
        if d*d > n:
            if n > 1: factors.append(int(n))
            break
    return factors


def count_moves(exponents):
    num = 0
    for ex in exponents:
        num += math.floor(0.5*(math.sqrt(8*ex+1) - 1))

    return num


pf = prime_factors(N)
pf = Counter(pf)
exponents = list(pf.values())
ans = count_moves(exponents)

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())
f=prime_factorize(n)
if len(f)==0:
  print(0)
  exit()
s=set(f)
r=0

def func(m):
  r=0
  for ii in range(m):
    if m>=ii+1:
      m-=(ii+1)
      r+=1
      #print(ii+1,m,r)
    else:
      break
  return r

for ii in s:
  m=f.count(ii)
  fm=func(m)
  #print("ii",ii,fm)
  r+=fm
  
print(r)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


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().strip())
    if N == 1:
        return 0
    factors = factorization(N)
    ans = 0
    for factor in factors:
        counter = 1
        while True:
            if factor[1] >= counter:
                factor[1] -= counter
                counter += 1
                ans += 1
            else:
                break
    return ans


if __name__ == "__main__":
    print(main())

Submission status: Accepted

Solution code:
import sys
n=int(input())
if n==1:
    print(0)
    sys.exit()
def f(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=f(n)
ans=0
for i in tmp:
    dd=i[1]
    tt=1
    while dd>0:
        if dd-tt>=0:
            dd-=tt
            tt+=1
            ans+=1
        else:
            break
print(ans)

Submission status: Accepted

Solution code:
import numpy as np
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)
else:
    b = factorization(N)
    count = 0
    for i in b:
        j = 1
        while(1):
            i -= j
            if i<0:
                break
            else:
                count += 1
                j += 1
    print(count)

Submission status: Accepted

Solution code:
n = int(input())
a = []
b = []
if n == 1:
    print(0)
    exit()
if True:
    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)
kosuu = 1
mae = a[0]
for i in range(1,len(a)):
    if mae == a[i]:
        kosuu += 1
    else:
        mae = a[i]
        b.append(kosuu)
        kosuu = 1
b.append(kosuu)
ans = 0
for i in range(len(b)):
    for j in range(2,100):
        if b[i] < j*(j+1)//2:
            ans += j-1
            break
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
n  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

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

f = factorization(n)

if f == [[1, 1]]:
    print(0)
    exit()

ans = 0
for sosu in f:
    p, n_ = sosu

    cur = 1
    for _ in range(n_):
        if cur <= n_:
            ans += 1
            n_ -= cur
            cur += 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
from collections import Counter
n = int(input())
ans = 0
list_N = prime_factorize(n)
list_Q = Counter(list_N).values()

for num in list_Q:
    k = 0
    while True:
        k += 1
        if num - k < 0:
            break
        num -= k
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
# D

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 i in c.items():
  num = i[1]
  temp = 1
  while True:
    num -= temp
    if num < 0:
      break
    ans += 1
    temp += 1

print(ans)

Submission status: Accepted

Solution code:
import numpy as np
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))

ans = 0
for num in c:
    cnt= 1
    total = 2
    while c[num] >= cnt:
        cnt += total
        total += 1
        ans += 1


print(ans)

Submission status: Accepted

Solution code:
import math


def primefac(x):
    fac = []
    for i in range(2, int(math.sqrt(x)) + 1 + 1):
        if x % i != 0:
            continue
        ex = 0
        while x % i == 0:
            ex += 1
            x = x // i
        fac.append((i, ex))

    if x != 1:
        fac.append((x, 1))
    return fac


def ans(fac):
    count = 0
    for _, ex in fac:
        for i in range(1, 10 ** 12):
            ex -= i
            if ex < 0:
                break
            else:
                count += 1
    return count


if __name__ == "__main__":
    N = int(input())
    fac = primefac(N)
    # print(fac)
    print(ans(fac))

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))
kiso = [1]
for i in range(2, 10):
    kiso.append(kiso[i-2]+i)
d = dict()
k = 1
for i in range(1, 46):
    if i in kiso and i != 1:
        k += 1
    d[i] = k

ans = 0
for n in c:
    ans += d[c[n]]

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

plist = prime_factorize(n)

import collections
c = collections.Counter(plist)

#print(c)
cnt=0
for k,v in c.items():
    cnt2=0
    idx=0
    while True:
        idx+=1
        cnt2+=idx
        if cnt2 > v:
            break
        else:
            cnt+=1
#        print("{}:{}  {} <= {}".format(k,v,cnt,cnt2))        

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())
line = factorization(n)
m = len(line)
ans = 0
for i in range(m):
    power = line[i][1]
    j = 1
    while power > 0:
        power -= j
        if power < 0:
            break
        j += 1
        ans += 1

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

if n == 1:
    print(0)
else:
    f = factorization(n)
    result = 0
    for each in f:
        shisu = each[1]
        counter = 1
        while shisu >= counter and shisu >= 0:
            shisu -= counter
            counter += 1
            result += 1
    print(result)

Submission status: Accepted

Solution code:
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools



sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]

N = int(input())
ans = 0

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

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

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

    return arr

A = factorization(N)

#print(A)

for i in A:
    for j in range(1, 10**12):
        if(i[1]<j*(j+1)//2):
            ans += j-1
            break
if(N == 1):
    print(0)
else:
    print(ans)

Submission status: Accepted

Solution code:

K = int(input())

N = 10**6
dp = [1] * (N+1)
dp[0] =  dp[1] =  0

def pw(j,i):
    while(j%i==0):
        j //= i
        
    if j == 1:
        return True
    else:
        return False

for i in range(2,N+1):
    if dp[i]:
        for j in range(i*i, N+1, i):
            #if not pw(j,i):
            dp[j] = 0
ans = 0
for n in range(N):
    i = 0
    while(1):
        i+=1
        v = pow(n,i)
        if (dp[n] == 1 and K%v==0):
            K //= v
            ans += 1
        else:
            break

for n in range(N):
    while(dp[n] == 1 and K%n==0):
        K //= n

#print (K)
if K!=1:
    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

l=factorization(n)
cnt=0

if n==1:
    print(0)
else:
    for num,i in l:
        p=1
        while i>0:
            cnt+=1
            i-=p
            p+=1
            if i<p:
                break
    print(cnt)

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
  
def nannko(s):
  i = 1
  while s > i-1:
    s -= i
    i +=1
  return i-1

c = collections.Counter(prime_factorize(n))
kosuu = list(c.values())

ans = 0
for i in kosuu:
  ans += nannko(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
p = prime_factorize(n)

import collections
cnt = collections.Counter(p)

ans = 0
for pi, ci in cnt.items():
    num = 1
    for i in range(1, 10000):
        if (i * (i+1))//2 <= ci:
            num = i
        if (i * (i+1))//2 > ci:
            break
    ans += num

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

if N == 1:
    ans = 0
else:
    ans = 0
    checked = set()
    fact = factorization(N)
    candidates = []
    for num in fact:
        for i in range(1,num[1]+1):
            candidates.append(num[0]**i)

    candidates.sort(reverse=True)
    #print(candidates)
    while N != 1 and len(candidates) > 0:
        
        while len(candidates) != 0:
            tmp = candidates.pop()
            if N%tmp == 0:
                break
        #print(N,tmp)
        if N >= tmp:
            N = N//tmp
            ans += 1


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
a = prime_factorize(n)
from collections import Counter
c = Counter(a)
x = set()
ans = 0
import itertools
r = list(itertools.accumulate(list(range(1,10**5))))
from bisect import bisect
for i in c:
    if c[i]==1:
        ans += 1
    else:
        ind = bisect(r,c[i])
        ans += ind


print(ans)

Submission status: Accepted

Solution code:
from bisect import bisect_right
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
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 LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def pf(x):
    ee=[]
    pp=[]
    if x&1==0:
        k=(x&-x).bit_length()-1
        pp.append(2)
        ee.append(k)
        x>>=k
    d=3
    while d**2<=x:
        while x%d==0:
            x//=d
            if pp and pp[-1]==d:ee[-1]+=1
            else:
                pp.append(d)
                ee.append(1)
        d+=2

    if x>1:
        if pp and pp[-1] == x: ee[-1] += 1
        else:ee.append(1)

    return ee

def main():
    n=II()
    ss=[1]
    for a in range(2,45):ss.append(ss[-1]+a)
    #print(ss)
    ee=pf(n)
    #print(ee)
    ans=0
    for e in ee:
        i=bisect_right(ss,e)
        ans+=i
    print(ans)

main()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline

N = int(input())
N0 = N
primes = []
exp = []
num = 2
while N>1 and num<int(N0**0.5)+1:
    if N%num==0:
        primes.append(num)
        temp = 0
        while N%num==0:
            N //= num
            temp += 1
        exp.append(temp)
    num += 1

if N>1:
    primes.append(N)
    exp.append(1)

        
ans = 0
import math
def solve(e):
    ret = (-1 + math.sqrt(1+8*e))
    ret //= 2
    return int(ret)
for e in exp:
    ans += solve(e)
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
def main():
  N = int(input())
  dic = collections.Counter(prime_factorize(N))
  ans = 0
  for pri, num in dic.items():
    total = 0
    e = 1
    while True:
      total = total + e
      if total > num:
        ans += e-1
        break
      e+=1
  print(ans)
if __name__ == "__main__":
  main()

Submission status: Accepted

Solution code:
def fac(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:
    ans=0
    for i in range(len(fac(N))):
        a=fac(N)[i][1]
        b=int((2*a+1/4)**0.5-1/2)
        ans+=b
    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())
a = factorization(n)
# print(a)

i = 0
count = 1
allcount = 0

while n > 1:
    if a[i][1] >= count:
        n /= a[i][0]
        a[i][1] -= count
        count += 1
        allcount += 1
    else:
        i += 1
        count = 1
    if i >= len(a):
        break

print(allcount)

Submission status: Accepted

Solution code:
# coding: utf-8
from math import ceil
def prime_factorization(N):
    # 辞書型で素因数分解を返す
    pf = {}
    for i in range(2, int(N**0.5) + 1):
        while N % i == 0:
            if i not in pf.keys():
                pf[i] = 1
            else:
                pf[i] += 1
            N //= i
    if N > 1:
        pf[N] = 1
    return pf
N = int(input())
# N = 2**8
pf = prime_factorization(N)
# print(pf)
ans = 0
for k in pf.keys():
    idx = 1
    v = 0
    while pf[k] >= v + idx:
        ans += 1
        v += idx
        idx += 1
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

if n == 1:print(0)
else:
    c = collections.Counter(prime_factorize(n))
    kouho = []
    soinnsuu = list(c.keys())
    sisuu = list(c.values())
    '''for i in range(len(soinnsuu)):
        for j in range(1,sisuu[i] + 1):
            kouho.append(soinnsuu[i]**j)
    kouho = list(set(kouho))
    kouho.sort()
    ans = 0
    while n != 1:
        for i in range(len(kouho)):
            if n%kouho[i] == 0 and kouho[i] != -1:
                n //= kouho[i]
                kouho[i] = -1
                ans += 1
                break
    '''
    ans = 0
    for i in sisuu:
        for j in range(1,100):
            if i >= j:
                ans += 1
                i -= j
            else:break
    print(ans)

Submission status: Accepted

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

if(N == 1):
  print(0)
  sys.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

hoges = factorization(N)

#print(hoges)

ans = 0

for hoge in hoges:
    n = hoge[1]

    i = 0
    tmp = 0
    while True:
        i += 1
        tmp += i

        if(tmp > n):
            break
    
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
from collections import Counter

N = int(input())

if N == 1:
    print(0)
else:
    factors = []

    tmp = N
    for i in range(2, int((N+1)**(1/2))+1):
        while tmp % i == 0:
            factors.append(i)
            tmp //= i
    if tmp != 1:
        factors.append(tmp)
    # print(factors)

    counter = Counter(factors)
    # print(counter)

    remains = []
    ans = 0
    for i, item in enumerate(counter.items()):
        # print(item)
        key = item[0]
        val = item[1]
        for j in range(1, val+1):
            if val-j >= 0:
                val -= j
                ans += 1
            else:
                break
            # print("val: {}".format(val))
        if val > 0:
            remains.append([key, val])

    # print(remains)

    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

ans = 0
f_arr = factorization(n)
for item in f_arr:
    if item[0] == 1: break

    i = 1
    d = item[1]
    while d > 0:
        d -= i
        if d >= 0:
            ans += 1
        i += 1

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import collections

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


n = int(input())
pf_n = prime_factorize(n)
count_pf_n = collections.Counter(pf_n)
result = 0
#print(count_pf_n)
for ci in count_pf_n.items():
#    print("key: " + str(ci[0]))
    num_ci = ci[1]
    for j in range(1, 9):
        if num_ci < j:
#            print("num: " + str(j-1))
            break
        num_ci -= j
        result += 1

print(result)

Submission status: Accepted

Solution code:
INT_MAX=10**11+7
MOD=10**9+7
def INPUT():return list(float(i) for i in input().split())
def LIST_1D_ARRAY(n):return [0 for _ in range(n)]
def LIST_2D_ARRAY(m,n):return [[0 for _ in range(n)]for _ in range(m)]
import math
#=======================================================================
n=int(input())
def calc(x):
    a=0
    return int((math.sqrt(1+8*x)-1)/2)
def primefactorisation(n):
	P=[]
	while(n%2==0):
		P.append(2)
		n//=2
	i=3
	while(i<=int(math.sqrt(n))):
		while(n%i==0):
			P.append(i)
			n//=i
		i+=2
	if(n>2):
		P.append(n)
	return P
A=primefactorisation(n)
i=0
Ans=[]
while(i<len(A)):
    p=A[i]
    count=1
    i+=1
    while(i<len(A) and p==A[i]):
        count+=1
        i+=1
    Ans.append(count)
real=0
for ele in Ans:
    real+=calc(ele)
print(real)

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())
p=factorization(n)
ans=0
if n==1:
    print(0)
    exit()
for i in range(len(p)):
    k=1
    while p[i][1]>0:
        p[i][1]-=k
        if p[i][1]>=0:
            ans+=1
            k+=1
        else:
            break
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

N = factorization(N)
ans = 0
for p, a in N:
    if p == 1:
        break
    for i in range(1, a+1):
        if i*(i+1) >= 2*a:
            if i*(i+1) == 2*a:
                ans += i
            else:
                ans += (i - 1)
            break

print(ans)