Problem:


Score : 400 points

Problem Statement

Given is a positive integer N. Consider repeatedly applying the operation below on N:

First, choose a positive integer z satisfying all of the conditions below:

z can be represented as z=p^e, where p is a prime number and e is a positive integer;

z divides N;

z is different from all integers chosen in previous operations.

Then, replace N with N/z.

Find the maximum number of times the operation can be applied.

Constraints

All values in input are integers.

1 \leq N \leq 10^{12}

Input

Input is given from Standard Input in the following format:

N

Output

Print the maximum number of times the operation can be applied.

Sample Input 1

24

Sample Output 1

3

We can apply the operation three times by, for example, making the following choices:

Choose z=2 (=2^1). (Now we have N=12.)

Choose z=3 (=3^1). (Now we have N=4.)

Choose z=4 (=2^2). (Now we have N=1.)

Sample Input 2

1

Sample Output 2

0

We cannot apply the operation at all.

Sample Input 3

64

Sample Output 3

3

We can apply the operation three times by, for example, making the following choices:

Choose z=2 (=2^1). (Now we have N=32.)

Choose z=4 (=2^2). (Now we have N=8.)

Choose z=8 (=2^3). (Now we have N=1.)

Sample Input 4

1000000007

Sample Output 4

1

We can apply the operation once by, for example, making the following choice:

z=1000000007 (=1000000007^1). (Now we have N=1.)

Sample Input 5

997764507000

Sample Output 5

7



Sample input:
24


Sample output:
3

Submission status: Accepted

Solution code:
def resolve():
    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)
    ans = 0
    
    for i in range(len(arr)):
        for j in range(1,100):
            if arr[i][0] == 1:
                break
            elif arr[i][1] == 1:
                ans += 1
                break
            elif arr[i][1] == sum(range(0,j+1)):
                ans += j
                break
            elif arr[i][1] < sum(range(0,j+1)):
                ans += j-1
                break
    
    print(ans)
resolve()

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

prime_factors = collections.Counter(prime_factorize(N))

counter = 0
for p in prime_factors:
    e = 1
    while prime_factors[p] >= e:
        N //= p ** e
        prime_factors[p] -= e
        e += 1
        counter += 1

print(counter)

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

#    print(arr)
    cnt = 0
    N = n
    prime_arr = []
    array = []
#    print(len(arr))
    if len(arr) > 1:
        for i in range(len(arr)):
            array.append(arr[i][0])
#        print(array)
        for i in range(len(arr)):
            for j in range(arr[i][1]):
                prime_arr.append(array[i]**(j+1))
        prime_arr.sort()
#        print(prime_arr)
        for i in range(len(prime_arr)):
            if (N/prime_arr[i] >= 1 and N%prime_arr[i] == 0):
                N /= prime_arr[i]
                cnt += 1
        print(cnt)
    elif len(arr) == 1:
        if arr[0][0] == 1:
            print(0)
        else:
            num = arr[0][1]
            for i in range(num):
                prime_arr.append(arr[0][0]**(i+1))
            prime_arr.sort()
#            print(prime_arr)
            for i in range(len(prime_arr)):
                if (N/prime_arr[i] >= 1):
                    N /= prime_arr[i]
                    cnt += 1
            print(cnt)

    return arr
    

if __name__=="__main__":
    n = int(input())
    factorization(n)

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

f = factorization(int(input()))
c=0
for _,i in f:
    if _ == 1:
        print(0)
        exit()
    a=1
    while a*-~a//2 <= i:
        a+=1
    c+=~-a
print(c)

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
fn = factorization(N)
for i in range(len(fn)):
  if 0 < fn[i][1] <= 2:
    ans += 1
  elif 2 < fn[i][1] < 6:
    ans += 2
  elif 5 < fn[i][1] < 10:
    ans += 3
  elif 10 <= fn[i][1] < 15:
    ans += 4
  elif 15 <= fn[i][1] < 21:
    ans += 5
  elif 21 <= fn[i][1] < 28:
    ans += 6
  elif 28 <= fn[i][1] < 36:
    ans += 7
  elif 36 <= fn[i][1] < 45:
    ans += 8
  elif 45 <= fn[i][1] < 55:
    ans += 9

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

Submission status: Accepted

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

base = pow(N, 1/2)
dic = {}
i = 2
li = []
now = 0
count = 0

for j in range(1, 51):
    now += j
    li.append(now)

while N != 1 and i <= base:
    # print(N)
    if N % i == 0:
        dic[i] = 0
        while N % i == 0:
            N /= i
            dic[i] += 1
    i += 1
if N != 1:
    dic[N] = 1
# print(dic)
if len(dic.keys()) == 0:
    if N == 1:
        print(0)
    else:
        print(1)
else:
    # print(li)
    for d in dic.values():
        # print(d)
        count += bisect.bisect_right(li, d)
    print(count)

Submission status: Accepted

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

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

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

    return arr

n=int(input())
if n==1:
    print(0)
    exit()
a=factorization(n) 

count=0
for i in range(len(a)):
    j=1
    while 1:
        a[i][1]=a[i][1]-j

        count+=1
        if a[i][1]<0:
            a[i][1]=a[i][1]+j
            count-=1
            break
        elif a[i][1]==0:
            break
        j+=1
print(count)

Submission status: Accepted

Solution code:
N=int(input())
#[[素因数,数]]を出力
def fctr1(n): 
    f=[]
    c=0
    r=int(n**0.5)
    for i in range(2,r+2):
        while n%i==0:
            c+=1
            n=n//i
        if c!=0:
            f.append([i,c])
            c=0
    if n!=1:
        f.append([n,1])
    return f
L=fctr1(N)
ans=0
for i in range(len(L)):
  if L[i][1]==1:
    ans+=1
  else:
    ans+=(-1+(1+8*L[i][1])**0.5)//2
print(int(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 calcN(num):
    if num >= 45:
        return 9
    elif num >= 36:
        return 8
    elif num >= 28:
        return 7
    elif num >= 21:
        return 6
    elif num >= 15:
        return 5
    elif num >= 10:
        return 4
    elif num >= 6:
        return 3
    elif num >= 3:
        return 2
    elif num >= 1:
        return 1
    

A = int(input())
if A == 1:
    print(0)
else:
    insuu =  factorization(A)
    ret = 0
    for i in insuu:
        ret += calcN(i[1])
    print(ret)

Submission status: Accepted

Solution code:
n = int(input())

def prime(n_):
    if n_ == 1:
        return []
    num = int(pow(n_, 0.5)) + 1
    pr = [True] * (num + 1)
    pr[0], pr[1] = False, False
    for i in range(2, int(pow(num, 0.5) + 1)):
        if not pr[i]:
            continue
        for j in range(i * 2, num + 1, i):
            pr[j] = False
    return [i for i in range(num + 1) if pr[i]]

def factorization(num):
    pr = prime(num)
    data = []
    temp = num
    for i in pr:
        if temp % i == 0:
            count = 0
            while temp % i == 0:
                count += 1
                temp //= i
            data.append([i, count])
    if temp != 1:
        data.append([temp, 1])
    if data == []:
        data.append([n, 1])
    return data

def main():
    ans = 0
    pr = factorization(n)
    for i, j in pr:
        count = 1
        sub = j
        while sub >= count:
            ans += 1
            sub -= count
            count += 1
    if n == 1:
        ans = 0
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())

n = 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)

pset = list(set(a))

#print(a)
#print(pset)

M = len(pset)
number = 0

for i in range(M):
    p = pset[i]
    c = a.count(p)
    if c >= 1 and c<3:
        number += 1
    elif c >= 3 and c<6:
        number += 2
    elif c >= 6 and c<10:
        number += 3
    elif c >= 10 and c<15:
        number += 4
    elif c >= 15 and c<21:
        number += 5
    elif c >= 21 and c<28:
        number += 6
    elif c >= 28 and c<36:
        number += 7
    elif c >= 36 and c<45:
        number += 8
    elif c >= 45 and c<55:
        number += 9
    else:
        number += 10

print(number)

Submission status: Accepted

Solution code:

import math

n = int(input())

#faccs = [0 for i in range(int(n/2) +1)]
faccs = {}


def isPrime(n) : 
  
    if (n <= 1) : 
        return False
    if (n <= 3) :
        return True

    if (n % 2 == 0 or n % 3 == 0) : 
        return False
  
    i = 5
    while(i * i <= n) : 
        if (n % i == 0 or n % (i + 2) == 0) : 
            return False
        i = i + 6
  
    return True

if isPrime(n):
    print(1)
else:
    while n % 2 == 0:
        if 2 in faccs:
            faccs[2] += 1
        else:
            faccs[2] = 1
        n = n / 2

    for i in range(3,int(math.sqrt(n))+1,2): 
          

        while n % i== 0:
            if i in faccs:
                faccs[i] += 1
            else:
                faccs[i] = 1
            n = n / i 

    if n > 2:
        faccs[math.floor(n)] = 1 

    count = 0

    for i in faccs.values():
        if i > 0:
            temp = 1
            while (i-temp)>=0:
                i -= temp
                temp +=1
                count += 1
    print(count)

Submission status: Accepted

Solution code:
import math
N=int(input())
def hantei(u):
  if u==1:
    return 1
  for i in range(1,u+1):
    if (1/2)*i**2+(1/2)*i>u:
      return int(i-1)
    else:
      continue
   
a=[0]*int(math.sqrt(N))
for i in range(2,int(math.sqrt(N))+1):
  while N%i==0:
    N=N//i
    a[i-1]=a[i-1]+1
c=0
if N!=1:
  c+=1
for t in range(len(a)):
  if a[t]!=0:
    c+=hantei(a[t])
print(c)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    usedz=[]
    cnt=0
    def prime_factorize1(N):
        """
        Nをくって、Nの素因数を格納したリストresを返す。
        リストの要素をすべて掛ければNになる"""
        l = []
        x = N
        y = 2
        while y*y <= x:
            while x % y == 0:
                l.append(y)
                x //= y
            y += 1
        if x > 1:
            l.append(x)
        prev=1
        newl=[]
        for x in range(len(l)):
            if l[x]!=prev:
              newl.append(l[x])
              prev=l[x]
            else:
                newl.append(newl[x-1]*l[x])
        newl.sort()
        for x in newl:
            if x not in usedz:
                usedz.append(x)
                return x
        return -1

    while True:
        z = prime_factorize1(n)
        if z==-1:
            break
        else:
            n=n//z
            cnt+=1
    print(cnt)

resolve()

Submission status: Accepted

Solution code:

from bisect import bisect_right
import math
import numpy as np

def primes(n):
    yield 2
    import numpy as np
    nn = int(math.sqrt(n)+1)
    a = np.arange(1, nn+1)
    b = a * a.reshape((nn, 1))
    b = b[1:,1:]
    c = b.reshape((nn-1)*(nn-1), )
    notprimes = set(c)
    for p in range(3, n+1, 2):
        if p not in notprimes:
            yield p

def bunkai(N):
    result = dict()
    for p in primes(int(math.sqrt(N))+1):
        if N == 1:
            return result
        count = 0
        while N % p == 0:
            count += 1
            N /= p
        if count != 0:
            result[p] = count
    
    if N != 1:
        result[N] = 1
    
    return result


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

    s = np.arange(math.log(N,2)+1, dtype=np.int32)
    S = (s * (s + 1) ) // 2
    p_list = bunkai(N)

    ans = 0
    for c in p_list.values():
        i = bisect_right(S, c) - 1
        #print(f"c={c} i={i}")
        ans += i
    
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import collections
N=int(input())
def prime_factorize(n):
    a = []
    b=[]
    c=[]
    d=[]
    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)
    for z in a:
        if not z in b:
            b.append(z)
    for z in b:
        c.append(a.count(z))
    for z in range(len(c)):
        for y in range(1,c[z]+1):
            d.append(b[z]**y)
    d=sorted(d)
    number=N
    answer=0
    for z in d:
        if number%z==0:
            number=int(number/z)
            answer+=1
    return answer
if N==1:
    print(0)
else:
    print(prime_factorize(N))

Submission status: Accepted

Solution code:
import math
import collections
 
N = int(input())
prime_number = False
ans = 0
 
def trial_division(n):
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    #リストが空ならそれは素数
    if not factor:
      global prime_number
      prime_number = True
      return
    else:
        factor.append(n)
        return factor

list_num = trial_division(N)

if N == 1:
  ans = 0
elif prime_number:
  ans = 1
else:
  if 1 in list_num:
    prime_list = list_num[:-1]
  else:
    prime_list = list_num
  counter = collections.Counter(prime_list)
  for key,val in counter.items():
    temp = val
    for i in range(1,val+1):
      if temp-i > 0:
        temp -= i
        ans += 1
      elif temp-i == 0:
        temp -= i
        ans += 1
        break
      else:
        break
    
print(ans)

Submission status: Accepted

Solution code:
import collections


def f(x):  # 何個取り出せるか
    if x == 0:
        return 0
    elif 1 <= x <= 2:
        return 1
    elif 3 <= x <= 5:
        return 2
    elif 6 <= x <= 9:
        return 3
    elif 10 <= x <= 14:
        return 4
    elif 15 <= x <= 20:
        return 5
    elif 21 <= x <= 27:
        return 6
    elif 28 <= x <= 35:
        return 7
    elif 36 <= x <= 44:
        return 8
    else:
        return 9



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

c = collections.Counter(prime_factorize(n))
cl = c.values()

ans = 0
for i in cl:
    ans += f(i)

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

Submission status: Accepted

Solution code:
import math
N = int(input())
def make_prime_list_2(num):
    if num < 2:
        return []
    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]

def prime_factorization_2(num):
    if num <= 1:
        return {1: 1}
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(num_sqrt)

        dict_counter = {}
        for prime in prime_list:
            while num % prime == 0:
                if prime in dict_counter:
                    dict_counter[prime] += 1
                else:
                    dict_counter[prime] = 1
                num //= prime
        if num != 1:
            if num in dict_counter:
                dict_counter[num] += 1
            else:
                dict_counter[num] = 1

        return dict_counter

dict = prime_factorization_2(N)
lst = list(dict.values())

res = 0
for i in range(1,(N//2)+1):
    for j in range(len(lst)):
        if lst[j] >= i:
            lst[j] = lst[j] - i
            res += 1
    if all(k <= i for k in lst):
        break

print(res)

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

itm = collections.Counter(prime_factorize(n))

ans = 0

for i in itm.keys():
    num = 1
    while True:
        if itm[i] - num < 0:
            break
        else:
            ans+=1
            itm[i] -= num
            num += 1

counter = 0

for i in itm.keys():
    if itm[i] != 0:
        counter += 1

# if counter != 1:
#     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())
fac_list=factorization(N)
if fac_list[0][0]==1:
  print(0)
else:
  ans=0
  for i in range(len(fac_list)):
    temp=fac_list[i][1]
    j=1
    while temp>=j:
      temp-=j
      ans+=1
      j+=1
  print(ans)

Submission status: Accepted

Solution code:
import copy
from collections import defaultdict

N = int(input())
tmp = copy.copy(N)
d = defaultdict(int)
if N == 1:
    print(0)
    exit()
for i in range(2, int(N ** 0.5) + 3):
    while N % i == 0:
        N //= i
        d[i] += 1
if N > 1:
    d[N] += 1
ans = 0
for i in d.values():
    tmp = 1
    while i - tmp >= 0:
        i -= tmp
        tmp += 1
        ans += 1
print(ans)

Submission status: Accepted

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

from functools import reduce

import math

def is_prime(n):
    if n % 2 == 0 and n > 2: 
        return False
    for i in range(3, int(math.sqrt(n)) + 1, 2):
        if n % i == 0:
            return False
    return True

def sieve(n):
    n=int(n)
    # Create a boolean array "prime[0..n]" and initialize 
    # all entries it as true. A value in prime[i] will 
    # finally be false if i is Not a prime, else true. 
    prime = [True for i in range(n + 1)] 
    p = 2
    while (p * p <= n): 
          
        # If prime[p] is not changed, then it is a prime 
        if (prime[p] == True): 
              
            # Update all multiples of p 
            for i in range(p * 2, n + 1, p): 
                prime[i] = False
        p += 1
    prime[0]= False
    prime[1]= False

    return [i for i, p in enumerate(prime) if p]

def inthroot(x,n):
    "calculate floor(x**(1/n))"
    return math.floor(x**(1/n))

def is_a_power(n):
    "return (a,b) if n=a**b otherwise throw ValueError"
    for b in sieve( math.log2(n) +1 ):
        if b == 0:
            raise ValueError
            
        a = inthroot(n,b)
        if a**b == n:
            return a,b
    raise ValueError
    


def smooth_factorization(n):
    "return (p,e) where p is prime and n = p**e if such value exists, otherwise throw ValueError"
    e=1
    p=n
    while True:
        try:
            p,n = is_a_power(p)
            e = e*n
        except ValueError:
            break
    if is_prime(p): 
        return p,e


def factors(n):
    return set(
        reduce(
            list.__add__,
            ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0),
        )
    )
        
def solve(N: int):
    count = 0
    picked_z = set([])

    while True:
        zs = list(factors(N))
        zs.remove(1)

        for _ in range(len(zs)):
                    
            z = min(zs)
            i = zs.index(z)

            is_prime_power = smooth_factorization(z)
            if is_prime_power and z not in picked_z:
                picked_z.add(z)
                N = N / z
                count += 1
                del zs[i]
                break

            del zs[i]

        if len(zs) == 0:
            break

    print(count)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)


if __name__ == "__main__":
    main()

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:
    fact_list = factorization(N)
    for _, i in fact_list:
        j = 1
        while i >= j:
            ans += 1
            i = i - j
            j += 1
            
print(ans)

Submission status: Accepted

Solution code:
def fact(n):
    p_factors = []

    for i in range(2, int(n**0.5)+1):
        while n%i == 0:
            p_factors.append(i)
            n //= i
    if n>1:
        p_factors.append(n)
    return p_factors



n = int(input())

factors = fact(n)
# print(factors)
factors_set = set(factors)
# print(factors_set)

nums = []
for i in factors_set:
    nums.append(factors.count(i))

# print(nums)

count = 0
for i in nums:
    temp = i
    j = 1
    while True:
        temp -= j
        if temp < 0:
            break
        count += 1
        j += 1

print(count)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sun May 31 21:31:49 2020

@author: NEC-PCuser
"""
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


if __name__ == "__main__":
    N = int(input())
    if N == 1:
        print(0)
    else:
        b = factorization(N)
        ans = 0
        for i in range(0, len(b)):
            j = 1
            while b[i] - j >= 0:
                b[i] = b[i] - j
                j += 1
                ans += 1
        print(ans)

Submission status: Accepted

Solution code:
from functools import reduce
from decimal import *
from operator import mul

def main():
    n = int(input())
    p = prime_factorize(n)
    sa = list(sorted(p))
    pp = []
    num = 1
    for i, v in enumerate(sa):
        if i > 0 and sa[i-1] != v:
            num = 1
        num *= v
        if num not in pp and n % num == 0:
            pp.append(num)
            num = 1
    print(len(pp))

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

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 __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

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

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

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

    return arr

s = factorization(n)

ans = 0
for i in s:
    tmp = 0
    c = 0
    while True:
        c += 1
        tmp += c
        if tmp > i[1]:
            break
    ans += c-1
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict
n = int(input())

def soinsu(n):
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            n //= i
            S[i] += 1
    if S == {}:
        S[n]+=1
    else:
        if n != 1:
            S[n] += 1
    return S


if n==1:
    print(0)
else:
    S = defaultdict(int)
    S=soinsu(n)
    r=0
    for k,v in S.items():
        i=1
        while v>=i:
            v-=i
            r+=1
            i+=1
    print(r)

Submission status: Accepted

Solution code:
import math

n=int(input())

if n==1:
    ans=0

else:
    #入力nは2以上でお願いします
    temp=n
    sqn=int(math.sqrt(temp))
    soinsu=[]
    #soinsu=[[素因数,指数],...]
    for i in range(2,sqn+1):
        count=0
        while temp%i==0:
            temp%i==0#iで割れるなら
            temp=temp//i
            count+=1
        if count!=0:
            soinsu.append([i,count])

    if temp!=1:#割り残した素数を回収
        soinsu.append([temp,1])
    if soinsu==[]:#素数ならば
        soinsu.append([n,1])

            
    ans=0
    for i in range(len(soinsu)):
        ans+=int((-1+math.sqrt(1+8*soinsu[i][1]))/2)



print(ans)

Submission status: Accepted

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

def get_sieve_of_eratosthenes_new(n):
    import math
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 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

def get_count(beki) :
    count = 0
    for i in range(1,beki+1) :
        tmp = beki - i
        if (0 <= tmp) :
            count += 1
            beki = tmp
        else :
            return count
    
    return 1

def main() :
    N = int(input())
    count = 0
    if (N == 1) :
        print(0)
        return

    factorized = factorization(N)
    # print(factorized)
    for fact in factorized :
        fact_c = fact[1]
        count += get_count(fact_c)


    # primes = get_sieve_of_eratosthenes_new(N)
    # for prime in primes :
    #     if (N < prime) :
    #         # 判定する素数よりもNが小さければ今後割り切れることはない
    #         break
        
    #     beki = 1
    #     while (True) :
    #         z = prime
    #         if (beki > 1) :
    #             z = pow(prime,beki)
    #         if (N % z == 0) :
    #             count += 1
    #             N = N // z
    #             beki += 1
    #             if (N < prime) :
                    
    #                 break
    #         else :
    #             # わりきれなくなったら終了
    #             break

    print(count)
main()

Submission status: Accepted

Solution code:
N = int(input())
L_P = []
num = N
ans = 0
if N == 1:
    print(ans)
else:
    for i in range(2,int(-(-num**0.5//1))+1):
        if num % i == 0:
            cnt = 0
            while num % i == 0:
                cnt += 1
                num //= i
            L_P.append(cnt)
        if num == 1:
            break
    else:
        L_P.append(1)
    for x in L_P:
        for i in range(1,100):
            if i*(i+1)//2 > x:
                ans += i-1
                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

a = int(input())

fact = factorization(a)

count = 0

for tup in fact:
    countTup = 0
    while True:
        countTup += 1
        if tup[1] < countTup:
            break
        tup[1] -= countTup
    count += countTup - 1

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

Submission status: Accepted

Solution code:
import math

def f(n):
    arr = list()
    temp = n
    for i in range(2, int(math.sqrt(n)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append(tuple([i, cnt]))

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

    if len(arr) == 0:
        tup = tuple([n, 1])
        arr.append(tup)

    return arr

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

t = f(N)
res = 0

for a in t:
    cnt = 0
    c = 0
    while cnt <= a[1]:
        c += 1
        cnt += c
    res += c - 1
    
print(res)

Submission status: Accepted

Solution code:
n = int(input())

if n == 1:
    c = 0
else:
    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])
    z = []
    for i in arr:
        for j in range(1,i[1]+1):
            z.append(i[0]**j)
    z = sorted(set(z))
    c = 0
    for i in z:
        if n%i == 0:
            c += 1
            n = int(n/i)
print(c)