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())
ans=0
i=2
while i*i<=n:
    cnt=0
    while n%i==0:
        n//=i
        cnt+=1
    j=0
    # print(i,cnt)
    for k in range(1,cnt+1):
        if (k*(k+1))//2<=cnt:
            j=max(j,k)
    ans+=j
    i+=1
# print('n',n)
if n>1:
    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



c = collections.Counter(prime_factorize(int(input())))
ans=0
l=list(c.values())

for i in l:
    j=int(i)
    a=1
    while j>0:
        if j>=a:
            j-=a
            ans+=1
            a+=1
        else:
            break
#print(l)
print(ans)

Submission status: Accepted

Solution code:
def d():
    import collections

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

    N = int(input())
    c = collections.Counter(prime_factorize(N))
    ans = 0
    for i in c.values():
        j = 1
        while j <= i:
            i -= j
            ans += 1
            j += 1

    print(ans)


##########
if __name__ == "__main__":
    d()

Submission status: Accepted

Solution code:
# abc169_d.py

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())
lis = factorization(N)
ans = 0
# print(lis)
if N == 1:
    print(0)
    exit()
for i in lis:
    cnt = 1
    target = i[1]
    while target > 0:
        if target - cnt >= 0:
            ans += 1
        target -= cnt
        cnt+=1
print(ans)

Submission status: Accepted

Solution code:
import sys

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

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

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

    return arr

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prl = lambda x: print(*x ,sep='\n')

a = [i*(i+1)//2 for i in range(60)]
n = ni()
l = factorization(n)
res = 0
for i in range(len(l)):
    j =  l[i][1]
    if l[i][0] == 1:
        continue
    for k,k_ in enumerate(a):
        if j < k_:
            res += k-1
            break
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())
fac_list = factorization(n)
a = [0]*len(fac_list)
for i in range(len(fac_list)):
    a[i] = fac_list[i][1]
t = 0
if n == 1:
        print(0)
else:
    for j, aa in enumerate(a):
        p = 0
        for i in range(1,aa+1):
            p += i
            if p <= aa:
                t += 1
            else:
                break
    print(t)

Submission status: Accepted

Solution code:
import collections
n = int(input())
result = 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

c = collections.Counter(prime_factorize(n))
for i in c.values():
    temp = 0
    for j in range(i+1):
        if (1+j/2)*(j+1) > i:
            result += j
            break
        else:
            continue
print(result)

Submission status: Accepted

Solution code:

import numpy as np
from functools import *
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline


import numpy as np

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

    
def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    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



s=factorize(float(input()))

res=0

for ss,n in s:
    tmp=np.floor((np.sqrt(8*n+1)-1)/2)
    #print(tmp)
    res+=tmp

print(int(np.floor(res)))

#print(s)

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

a=factorization(n)

l=len(a)
ans=l
c=1
for i in range(l):
    a[i][1]-=1

while(c<100):
    c+=1
    for i in range(l):
        if a[i][1]>=c:
            a[i][1]-=c
            ans+=1
if n!=1 and n!=0:
    print(ans)
else:
    print(0)

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=[]
#check=[0]*(n+1)
p=factorization(n) 
sum=0
if n==1:
    print(0)
    exit()
else:
    for pair in p:
        for i in range(pair[1]):
            z.append(pair[0]**(i+1))
            
#print(z)
while True:
    now=z.pop(0)
    if n>=now and n%now==0:
        sum+=1

        n=n/now
    if len(z)==0:
        break
print(sum)

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:  
 listA=factorization(N) 
 nagasa=len(listA)
 nn=0
 kk=1
 count=0
 while nn<nagasa:
   while kk*(kk+1)/2 <=listA[nn][1]:
     count=count+1
     kk=kk+1
   kk=1
   nn=nn+1
 print(count)
if N==1:
  print(0)

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())
prime = factorization(n)
prime_array = []
for i in range(len(prime)):
    prime_array.append(prime[i][1])

ans = 0
for j in range(len(prime_array)):
    check = True
    num = 1
    test = 1
    while check == True:
        if prime_array[j] == num:
            check = False
            ans += test
        elif prime_array[j] < num:
            check = False
            ans += test - 1
        test += 1
        num += test
if n == 1:
    ans = 0
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

P = collections.Counter(prime_factorize(n))

def counter(n):
    i = 1
    counter = 0
    while True:
        n-=i
        if n<0:
            break
        else:
            counter += 1
            i += 1
    return counter
  
ans = 0
for p in P.values():
  ans += counter(p)

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 getTime(v):
  time = 0
  total = 0
  while total <= v:
    time += 1
    total += time
  return (time - 1)

N = int(input())
result = 0
c = collections.Counter(prime_factorize(N))
for k in c.keys():
  result += getTime(c[k])
  
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([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
def make_divisors(n):
  lower_divisors,upper_divisors=[],[]
  i=1
  while i*i<=n:
    if n%i==0:
      lower_divisors.append(i)
      if i!=n//i:
        upper_divisors.append(n//i)
    i+=1
  return lower_divisors+upper_divisors[::-1]
N=int(input())
t=make_divisors(N)
u=[]
count=0
if N==1:
  print(0)
else:
  for i in range(1,len(t)):
    if 2>len(factorization(t[i])):
      u.append(t[i])
  for i in range(len(u)):
    if N%u[i]==0:
      N=int(N//u[i])
      count+=1
    if N==1:
      break
  print(count)

Submission status: Accepted

Solution code:
import collections
def 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 numcount(n):
    i = 1
    while True:
        n -= i
 
        if n <= i:
            break
        i += 1
    return i
A = int(input())
L = factorize(A)
C = collections.Counter(L)
ret = 0
for c in C:
    ret += numcount(C[c])
print(ret)

Submission status: Accepted

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

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

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

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

    return arr

arr = factorization(N)
sum = 0
for s in arr:
    if s[0] == 1:
        print(0)
        exit()
    sum += math.floor((-1+math.sqrt(1+8*s[1]))/2)
print(sum)

Submission status: Accepted

Solution code:
import numpy as np
import math
from decimal import Decimal

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())
ans = factorization(N)
if ans[0][0] == 1:
    print(0)
else:
    count = 0
    for i in range(len(ans)):
        an = 1
        n = 1
        while an <= ans[i][1]:
            n = n + 1
            an = n*(n+1)/2
            count = count +1

    print(count)

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)
    ans = 0
    for i in range(len(F)):
        k, num = F[i]
        j = 1
        while num >= j:
            ans += 1
            num -= j
            j += 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())
c= collections.Counter(prime_factorize(n))
#ここまでで素因数分解して個数が何個あるかcheckしてる
sum=0
for i in c:
    n=1
    while n*(n+1)/2<=c[i]:
        n=n+1
    sum=sum+n-1
print(sum)

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

factorization(24) 

n = int(input())
P = factorization(n)

Q = []
for i in range(len(P)):
    temp = 1
    while P[i][1] >= temp and P[i][0] != 1:
        t = P[i][0] ** temp
        Q.append(t)
        P[i][1] -= temp
        temp += 1

print(len(Q))

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())
N = factorization(N)
count = 0

if N[0][0] == 1:
    print(0)
else:
    for i in range(0,len(N)):
        t = 0
        for j in range(1,N[i][1]+1):
            t += j
            if N[i][1] == t:
                count += j
                break
            elif N[i][1] < t:
                count += j-1
                break
            else:
                pass
    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

f = prime_factorize(n)

ans = 0
for i in set(f):
    c = f.count(i)
    j = 1
    while True:
        if 0 <= c-j:
            ans += 1
            c = c-j
            j += 1
        else:
            break

print (ans)

Submission status: Accepted

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

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

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

    return arr

n = int(input())
if n == 1:
    print(0)
else:
    l = factorization(n)
    dic = []
    for i in range(len(l)):
        tmp = l[i][0]
        dic.append(tmp)
        while n >= tmp:
            tmp *= l[i][0]
            if n < tmp:
                break
            dic.append(tmp)
    dic.sort()
    cnt = 0
    while n != 1:
        flag = True
        for i in range(len(dic)):
            if n%dic[i] == 0:
                n //= dic[i]
                cnt += 1
                dic.pop(i)
                flag = False
                break
        if flag:
            break
    print(cnt)

Submission status: Accepted

Solution code:
# 取得
nn = int(input());
n = nn;

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)

b = len(a);

#操作回数
if nn == 1:
    count = 0;
else:
    count = 1;
    x = 1;
    y = 1;

    for i in range(1,b):
        if a[i] == a[i-1]:
            x += 1;
            z = y * (y+1) // 2;
            if x - z > y:
                count += 1;
                y += 1;
            
        else:
            x = 1;
            y = 1;
            count += 1;
            
    
print(count);

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())
pf = factorization(n)
cnt = 0
for p in pf:
    i = 1
    while True:
        if p[0] == 1:
            break
        n /= p[0]**i
        p[1] -= i
        cnt += 1
        i += 1
        if p[1] < i:
            break

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

ans = 0

if N == 1:
    print(0)
else:
    t = factorization(N)
    for i in t:
        t_ = i[1]
        now = 1
        while True:
            if now > t_:
                break
            ans += 1
            t_ -= now
            now += 1
    print(ans)

Submission status: Accepted

Solution code:
n=int(input())
ans=0
p=2

while p<=10**6 and n!=1:
  dv=0
  wa=1
  num=1
  while n%p==0:
    n/=p
    n=int(n)
    dv+=1
  if dv>0:
    while dv>=wa:
      num+=1
      wa+=num
    num-=1
    ans+=num
  p+=1
  
if n!=1:
  print(str(ans+1))
  exit()
  
print(str(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)

ttl = 0
if l == [[1, 1]]:
    ttl = 0
else:
    for m in l:
        x = m[1]
        for i in range(1, x + 1):
            x -= i
            if x >=0:
                ttl += 1
            else:
                break

print(ttl)

Submission status: Accepted

Solution code:
import collections

def fanctionA(n):
    AList = []
    tmp = 2
    
    while n % tmp == 0:
        AList.append(tmp)
        n //= tmp
    tmp = 3
    while tmp * tmp <= n:
        if n % tmp == 0:
            AList.append(tmp)
            n //= tmp
        else:
            tmp += 2
    if n != 1:
        AList.append(n)
    return AList
  
    
N = int(input())

arr = collections.Counter(fanctionA(N))

arr = list(arr.values())

tmp = 1
count = 0
for a in arr:
    while 'true':
        if a >= tmp:
            a -= tmp
            count += 1
            tmp += 1
        else:
            tmp = 1
            break

print(count)

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=[]
            count = 1
            while temp%i==0:
                if(count not in cnt):
                  cnt.append(count)
                  count = 0 
                count += 1
                temp //= i
            arr.append(len(cnt))

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

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

    return arr

n = int(input())
num = factorization(n)
if(n == 1):
  num = [0]

print(sum(num))

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

ans = 0
s = factorization(N)

if s[0][0] != 1:
    for i in range(len(s)):
        cnt = 1
        rest = s[i][1]
        while True:
            if cnt <= rest:
                N = N//(s[i][0]**cnt)
                rest -= cnt
                cnt += 1
                ans += 1
            else:
                break
    print(ans)
else:
    print(0)

Submission status: Accepted

Solution code:
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 = int(input())
    answer = 0
    ans_list = factorization(N)
    sum_list = [1, 3, 6, 10, 15, 21, 28, 36, 45]
    if N == 1:
        print(0)
        exit()
    for i in ans_list:
        for j in range(len(sum_list)):
            if i[1] < sum_list[j]:
                answer += j
                break
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import collections
n = int(input())
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)
a = collections.Counter(a)

count = 0
for i in a.values():
    for j in range(1,1000000):
        if i - j >= 0:
            count += 1
            i -= j
        else:
            break
print(count)

Submission status: Accepted

Solution code:
#素因数分解
def prime_factorization(N):
    ans = []
    if N==1:
        return [[1,0]]
    a = 2
    count = 0
    t = N
    while a*a<=t:
        if N%a!=0:
            a = a + 1
            count = 0
            continue
        while N%a==0:
            count = count + 1
            N = N//a
        ans.append([a, count])
        a = a + 1
        count = 0
    if (N!=1):
        ans.append([N,1])
    return ans
e = 0
def dfs(N, n, sum):
    global e
    if N<sum:
        e = e - 1
        return
    e = e + 1
    dfs(N, n+1, sum+n)

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

ans = 0

for a,b in L:
   e = 0
   dfs(b, 1, 0)
   ans = ans + e
#print(L)
print(ans)

#print(dfs(2, 1, 0))

Submission status: Accepted

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

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

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

    return arr
if(N==1):
    print(0)
else:
    prime_factor=factorization(N) 
    nrow=len(prime_factor)
    n=0
    for i in range(nrow):
        order=prime_factor[i][1]
        n+=math.floor((-1.0+math.sqrt(1.0+8.0*order))/2.0)
    print(n)

Submission status: Accepted

Solution code:
import math
n = int(input())
if n == 1:
  print(0)
  exit()

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

ans = 0
for i in arr:
  if i[1] == 1 or i[1] == 2:
    ans += 1
  else:
    ans = ans + int(-1/2 + math.sqrt(1+8*i[1])/2)
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())
res = prime_factorize(n)
if len(res) == 1:
  print(1)
else:
  cnt = 0
  c = None
  p = 0
  l = set()
  for r in res:
    if c == r:
      p += 1
      if not p in l:
        l.add(p)
        p = 0
        cnt += 1
    else:
      l.clear()
      p = 0
      l.add(1)
      cnt += 1
      c = r
  print(cnt)

Submission status: Accepted

Solution code:
from math import sqrt
def factorint(n):
    d = {}
    for i in range(2, int(sqrt(n))+1):
        c = 0
        q, r = divmod(n, i)
        while not r:
            c += 1
            n = q
            q, r = divmod(n, i)
        if c:
            d[i] = c
    if n != 1:
        d[n] = 1
    return d

n = int(input())
if n == 1:
    print(0)
else:
    d = factorint(n)
    s = 0
    for v in d.values():
        s += int((sqrt(8*v+1)-1)/2)
    print(s)

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

        fac = factorization(N)

        arr = []

        for i in range(len(fac)):
                for j in range(fac[i][1]):
                        temp = fac[i][0]**(j+1)
                        arr.append(temp)

        arr.sort()

        count = 0

        for i in range(len(arr)):
                if N==1:
                        break
                else:
                        if N%arr[i]==0:
                                N = N/arr[i]
                                count += 1

        return count

if __name__=="__main__":
        ans = main()
        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

import sys
inp = int(input())
x=prime_factorize(inp)
a=0
xset = set(x)
for i in xset:
  z=x.count(i)
  a+=1
  n=2
  ar=(n*(n+1))/2
  while z>=ar:
    a+=1
    n+=1
    ar=(n*(n+1))/2
print(a)

Submission status: Accepted

Solution code:
def pfactor(n):
    result = []
    for i in range(2, int(n**0.5)+1):
        while n%i == 0:
            result.append(i)
            n //= i
    
    if n != 1:
        result.append(n)
    return result

  
N = int(input())
factor = pfactor(N)
ans = 0

for p in set(factor):
    i = factor.count(p)
    while i > 0:
        c = (1 + 8*i) ** 0.5
        if c.is_integer():
            ans += (int(c)-1) // 2
            break
        i -= 1

print(ans)

Submission status: Accepted

Solution code:
# Template 1.0
import sys, re
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def primeFactors(n):
    facs = defaultdict(int)
    # Print the number of two's that divide n
    while n % 2 == 0:
        facs[2]+=1
        n = n / 2

    # n must be odd at this point
    # so a skip of 2 ( i = i + 2) can be used
    for i in range(3, int(sqrt(n)) + 1, 2):

        # while i divides n , print i ad divide n
        while n % i == 0:
            facs[i]+=1
            n = n / i

            # Condition if n is a prime
    # number greater than 2
    if n > 2:
        facs[n]+=1

    return facs

n = INT()

factors = primeFactors(n)

canBe = []

for el in factors:
    for po in range(1, 60):
        if(factors[el]<=0):
            break
        canBe.append(int(el**po))
        factors[el]-=1


canBe.sort()
i = 0
ans = 0

while (True):
    if (i >= len(canBe) or canBe[i] > n):
        break
    if(n/canBe[i]==n//canBe[i]):
        n /= canBe[i]
        ans += 1
    i += 1
    # print(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())
if N==1:
	print(0)
	exit()


arr=prime_factorize(N)
kaisu=0
####################

#print(arr)

while(len(arr)>0):
	#print(arr)

	minval = min(arr)
	c=arr.count(minval)
	lp=c
	
	for i in range(1,lp+1):
		#print(i)
		if c >= i:
			c-=i
			kaisu+=1
			#print(kaisu)
		arr.remove(minval)

print(kaisu)