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 math
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
  
ps = primes(10**6)
ans = 0
for p in ps:
  d = 1
  while n%(p**d) == 0:
    #print(n, p**d, p, d)
    n = n//(p**d)
    ans += 1
    d += 1
    
if n>10**6:
  print(ans + 1)
else:
  print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
i = 2
N
l=2
flag=True
if N ==1:
    ans = 0
else:
    while(N**0.5>i):
        tmpi = i
        while(N%i==0):
            if N%tmpi==0:
                N/=tmpi
                tmpi*=i
                ans += 1
            else:
                N/=i
        i+=1
while(N**0.5>l):
    if N%l==0:
        flag=False
        break
    l+=1
if flag and N!=1:
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
import bisect
ans = 0
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
lis = factorization(N)
suum = [0]*(10**5)
for k in range(1,10**5):
    suum[k] = suum[k-1]+k
for j in range(len(lis)):
    index = bisect.bisect_right(suum,lis[j][1])
    ans += index
    if lis[j][1] >= 1:
        ans -= 1
if N != 1:
    print(ans)
else:
    print(0)

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

n=int(input())
if n==1:
  print(0)
  sys.exit()
arr = factorization(n)
res = 0
for st in arr:
  tmp =0
  for i in range(1,40):
    tmp += i
    if st[1] >= tmp:
      res += 1
    else:
      break
print(res)

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 collections
n=int(input())

c = collections.Counter(prime_factorize(n))
count=0
for k,v in c.items():
  i=3
  count+=1
  if v>=3:
    while v>2:
      count+=1
      v-=i
      i+=1
print(count)

Submission status: Accepted

Solution code:
n = int(input())

""" def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

print(make_divisors(n))
#[1, 2, 3, 4, 6, 8, 12, 24] """

def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table
li = prime_decomposition(n)
#print(prime_decomposition(n))
#[2, 2, 2, 3.0]
import collections
c = collections.Counter(li)
v_li = list(c.values())
#print(v_li)
#[3, 1]
ans = 0
for v in v_li:
    ans += 1
    tmp = 1
    while v >= tmp:
        v -= tmp
        tmp += 1
        if v >= tmp:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
import math

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

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

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

    return arr

def kirisute(n):
    p=(-1+math.sqrt(1+8*n))/2
    q=math.floor(p)
    return q

N = int(input())

div_arr = factorization(N)
if div_arr[0][0] == 1:
    div_arr.pop(0)

cnt = 0

for a in div_arr:
    cnt += kirisute(a[1])

print(cnt)

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

r = 0
for n, i in factorization(N):
    m = 1
    while i >= m:
        i -= m
        m += 1
        r += 1
print(r)

Submission status: Accepted

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

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

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

    return arr

a = [0]
for i in range(1, 10):
    a.append(a[i-1]+i)
a = a[1:]

n = int(input())
if n == 1:
    ans = 0
else:
    primes = factorization(n)
    ans = 0
    for prime in primes:
        t = prime[1]
        for i in range(10):
            if t < a[i]:
                ans += i
                break
print(ans)

Submission status: Accepted

Solution code:
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n = int(ipt())
    ni = n
    d = dict()
    t = 0
    ans = 0
    while True:
        if ni%2 == 0:
            ni //= 2
            t += 1
        else:
            break
    if t > 0:
        d[2] = t
    pi = 3
    t = 0
    while ni > 1 and pi < 10**6+1:
        if ni%pi == 0:
            t += 1
            ni //= pi
        else:
            if t == 0:
                pi += 2
                continue
            else:
                d[pi] = t
                t = 0
                pi += 2
    if t > 0:
        d[pi] = t
    if ni > 1:
        d[ni] = 1
    for i in d.values():
        t = 0
        ni = i
        while True:
            if ni >= t+1:
                ni -= t+1
                t += 1
            else:
                break
        ans += t
    print(ans)



    return



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def prime(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

def solve(N):
    import sys
    #print(N, file=sys.stderr)
    org = N
    A = []
    a = 0
    f = prime(N)
    for p, c in f:
        for i in range(1, c+1):
            z = p ** i
            if c > 0 and N >=z and N %z == 0:
                c -= i
                #print(N, p**i)
                N //= z
                A.append(z)
                a += 1
    return a, A

def primes():
    primes = [2]
    for i in range(3, 10**5+1, 2):
        if all(i % p != 0 for p in primes):
            primes.append(i)
    return primes

def test():
    def primes():
        with open("primes.txt", "r") as f:
            return [int(x) for x in f.readline().split()]
    primes = primes()
    for N in range(1, 10**5+1):
        org = N
        a0, A = solve(N)
        a1 = 0
        B = []
        for p in primes:
            for i in range(1, 10**16):
                z = p ** i
                if N < z:
                    break
                if N % z == 0:
                    N //= z
                    a1 += 1
                    B.append(z)
        if a0 != a1:
            print("NG on", org, "actual=%d"%a0, A, "expect=%d"%a1, B)
            break
#print("solve(36)",prime(36), solve(36))
#test()
N = int(input())
print(solve(N)[0])

Submission status: Accepted

Solution code:
import collections
N = int(input())
def prime(N):
  a = []
  while N%2 ==0:
    a.append(2)
    N = N/2
  f = 3
  while f**2 <= N:
    if N%f ==0:
      a.append(f)
      N = N/f
    else:
      f += 2
  if N != 1:
    a.append(int(N))
  return(a)
M = collections.Counter(prime(N))
M_ls = list(M.values())
count = 0
for i in range(len(M_ls)):
  n = 1
  while M_ls[i] >= n*(n+1)/2:
    count += 1
    n += 1
    
print(count)

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


li =  prime_factorize(N)
li_=[]
for i in set(li):
    co = li.count(i)
    counter = 0
    count = 0
    while True:
        if co< count:
            break
        else:
            counter += 1
            count += counter
    li_.append(counter-1)
print(sum(li_))

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

list=factorization(N)
#print(list)

a=len(list)
A=[0]*a
def fun(n):
    qw=0
    qe=1
    while not n-qe<0:
        n=n-qe
        qe=qe+1
        qw+=1
    return qw
qwe=0

for i in list:
    qwe+=fun(i[1])
if N==1:
    print(0)
else:
    print(qwe)

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

def getScore(n):
    c = 0
    for i in range(1, 100):
        c += i
        if n < c:
            return i-1
    return 0


from collections import defaultdict
factors = defaultdict(int)
res = prime_factorize(N)
for n in res:
    factors[n] += 1


ans = 0
for k in factors.keys():
    ans += getScore(factors[k])

print(ans)

Submission status: Accepted

Solution code:
from collections import Counter
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)

lst = Counter(a)
lst = list(lst.values())

ans = 0
for i in lst:
    cnt = 0
    while i - (cnt) > 0:
        cnt += 1
        i = i - (cnt)
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import math
import sys
sys.setrecursionlimit(10**9)

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

    res = []
    def isP(i):
        if i == 1:
            return False
        for j in res:
            if i % j == 0:
                return False
        return True

    def calc(p):
        mx = math.floor(math.log(N,p))
        # print("mx",mx)
        e_v = pow(p,mx)
        e = 0
        ng = False
        for i in reversed(range(mx)):
            if not ng and N % e_v == 0:
                ng = True
                e = i+1

            if not ng:
                e_v //= p
                e = i+1

        # print("e",e)
        base = -1+math.sqrt(1+8*e)
        return math.floor(base/2)

    tail = []
    ans = 0
    for p in range(1, int(N**0.5)+1):
        tail.append(N//p)
        if N % p == 0 and isP(p):
            res.append(p)
            # print("p",p)

            ans += calc(p)
    for p in tail:
        if N % p == 0 and isP(p):
            res.append(p)
            # print("p",p)

            ans += calc(p)


    print(ans)

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


r = 0
if n != 1:
    f = factorization(n) 
    num = []
    for a, b in f:
        for i in range(b):
            num.append(a ** (i + 1))
    num.sort()
    for c in num:
        if n < c:
            break
        else:
            if n % c == 0:
                n /= c
                r += 1

print(r)

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))
answer = 0

for i in list(c.keys()):
    n = 1
    a = c[i]
    while a > n*(n+1)/2:
        n += 1
    if a == n*(n+1)/2:
        answer += n
    else:
        answer += n-1

print(answer)

Submission status: Accepted

Solution code:
N=int(input())

def fact(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


garr=0

def idontknow(P):
    global garr
    D=P
    garr=0
    for i in range(1,P+1):
        if D>=i:
            garr+=1
            D=D-i
        else:
            return garr


FFF=fact(N)


ans=0

for i in range(len(FFF)):
    idontknow(int(FFF[i][1]))
    ans+=garr

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

Submission status: Accepted

Solution code:
N = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

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

lst = list(make_divisors(N))
#print(lst)
#print(len(lst))
cnt = 0
#print(lst)

lst2 = []

for i in lst:
    if len(set(prime_factorize(i))) == 1:
        lst2.append(i)
#print(lst2)

for i in range(len(lst2)):
    if N > 1:
        if N%lst2[i] == 0:
            N = N//lst2[i]
            cnt+=1
            #print(N)
            #print(lst2[i])
            #print(N)
#print()
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

def main():
    N = int(input())  # 文字列または整数(一変数)
    answer = 0

    if N == 1:
        print(0)
        return

    ll = factorization(N)

    for l in ll:
        e = 1
        rest_e = l[1]
        while True:
            if rest_e >= e:
                answer += 1
                rest_e -= e
                e += 1
            else:
                break


    print(answer)

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

def main():
    N = int(input())
    if N==1:
        print(0)
        return
    factors = factorization(N)
    ans = 0
    for (k,v) in factors:
        count = 1
        tmp = 1
        rest = v
        while True:
            if rest-tmp<tmp+1:
                break
            rest -= tmp
            tmp += 1
            count += 1
        ans += count
    print(ans)

main()

Submission status: Accepted

Solution code:
import collections

N = int(input())
ans = 0

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)

A = list(A.values())

for i in range(len(A)):
    cnt = 1
    val = A[i]
    while val >= cnt:
        ans += 1
        val -= cnt
        cnt += 1
print(ans)

Submission status: Accepted

Solution code:

from decimal import Decimal, ROUND_DOWN
import heapq
from fractions import gcd
from functools import reduce
from collections import deque
# from math import factorial
import itertools
import collections
import math
import sys
sys.setrecursionlimit(2000000)
# import statistics
# import numpy as np
# n = int(input())
# a, b, c, k = list(map(int, input().split()))
# a = list(map(int, input().split()))
# abc = [int(input()) for i in range(5)]
n = int(input())
# h1, m1, h2, m2, k = list(map(int, input().split()))
#a, b = list(map(float, input().split()))
# a = list(map(int, input().split()))
# data = [list(map(int, input().split())) for i in range(n)]
# k = int(input())
# p = list(map(int, input().split()))
# ab_sorted = sorted(ab, key=lambda x: x[0])
# py = [list(map(int, input().split())) for i in range(m)]


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]


def pre(k):
    for divisor in range(2, math.floor(math.sqrt(k))+1):
        if k % divisor == 0:
            return False
    return True


def judge(z):
    if n % z != 0:
        return False
    elif pre(z):
        return True
    else:
        for i in range(2, z+1):
            if z % i == 0:
                a = 1
                while(a < z):
                    a *= i
                #print(a, end=" ")
                # print(z)
                if a == z:
                    return True
                else:
                    return False


data = make_divisors(n)
count = 0
for i in range(len(data)):
    if judge(data[i]):
        n /= data[i]
        count += 1
print(count-1)
# print(data)

Submission status: Accepted

Solution code:
from math import sqrt
from collections import Counter


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 num_z(n):
    return int((sqrt(1 + 8 * n) - 1) / 2)

################################################################

N = int(input())
factors = Counter(prime_factorize(N))
ans = 0
for n in factors.values():
    ans += num_z(n)
print(ans)

Submission status: Accepted

Solution code:
#D - Div Game
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)
#print(factorization(N))
ans = 0
if N == 1:
    print(0)
    exit()

for i in range(len(A)):
    if A[i][1] == 1:
        ans += 1
    else:
        k = A[i][1]
        for j in range(A[i][1]):
            if k-j > j:
                k -= j
                ans += 1
            else:
                break
print(ans)

Submission status: Accepted

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

L = factorization(N)

for i in range(len(L)):
    for j in range(50):
        if j * (j+1) > 2 * L[i][1]:
            ANS += j - 1
            break
if len(L) == 1 and L[0][0] == 1:
    ANS = 0

print(ANS)

Submission status: Accepted

Solution code:
from sys import *
from collections import Counter
N = int(stdin.readline())
things = []
if N ==1:
    print(0)
    exit()
for i in range(2,N):
    if i*i > N:
        if len(things) == 0:
            print(1)
            exit()
        if N > 1:
            things.append(int(N))
        break
    while(N%i == 0):
        things.append(i)
        N = N/i
c = Counter(things)
vals = 0
for item in c:
    hue = 0
    for i in range(1,100000):
        if (hue + i) > c[item]:
            break
        else:
            hue += i
            vals += 1

print(vals)

Submission status: Accepted

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

# 素因数分解 参考: https://note.nkmk.me/python-prime-factorization/
def f_prime(n):
    ANS = []
    # P = [2]

    while n % 2 == 0:
        ANS.append(2)
        n = n//2
    m = 3
    # P.append(m)
    while m ** 2 <= n:
        while n % m == 0:
            ANS.append(m)
            n = n//m
        m += 2
    
    if n != 1:
        ANS.append(n)
    return ANS

# print(f_prime(n))

c = collections.Counter( f_prime(n) )
c_key = list(c.keys())

count = 0
for k in c_key:
    t = c[k]
    s = 1
    while t >= s:
        count += 1
        t -= s
        s += 1 

print(count)

Submission status: Accepted

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

    if num != 1:
        index.append(1)

    if index == []:
        index.append(-1)

    return index

def main():
    n = int(input())
    a = factorization(n)
    ans = 0
    for i in a:
        for j in range(1, 45):
            if i >= j:
                i -= j
                ans += 1
            else:
                break
    print(ans)

main()

Submission status: Accepted

Solution code:
N = int(input())
def prime_factorize(n):
    ans = 0
    while n % 2 == 0:
        i = 1
        j = 0
        while n % 2 == 0:
            n = n//2
            j += 1
            if i <= j:
                ans += 1
                i += 1
                j = 0
    f = 3
    while f * f <= n:
        i = 1
        j = 0
        while n % f == 0:
            n //= f
            j += 1
            if i <= j:
                ans += 1
                i += 1
                j = 0
        f += 2
    if n != 1:
        ans += 1
    return ans
print(prime_factorize(N))

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

for i in range(2, 10**6+1):
    if N % i != 0: continue
    ans += 1
    cnta = 0
    cntb = 2
    while N % i == 0:
        N //= i
        cnta += 1
        if cnta > cntb:
            cnta -= cntb
            cntb += 1
            ans += 1
    if N == 1:
        break
if N != 1:
    ans += 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

n = int(input())
l = prime_factorize(n)
set = list(set(l))
result = 0

for i in range(len(set)):
    tmp = l.count(set[i])
    for j in range(l.count(l[i])):
        if j+1 <= tmp:
            result += 1
            tmp -= j+1
        else:
            break

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
N = input()
N = int(N)
if N == 1:
    print(0)
else:    
    ans = 0
    lis = factorization(N)
    for l in lis:
        cnt = 1
        a = l[1]
        while a > 0:
            a = a - cnt
            if a >= 0:
                cnt = cnt + 1
            else:
                break
        ans = ans + cnt - 1
    print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
ruteN = math.ceil(math.sqrt(N))
prime=[1]*(ruteN+2)
prime[0]=0
primes=[]
count=0
for i in range(2,ruteN+2,1):
    if prime[i]==1:
        primes.append(i)
        count+=1
        for j in range(i*2,ruteN+2,i):
            prime[j]=0

ans =0
for i in range(0,count,1):
    tmp = primes[i]
    while True:
        if N%tmp==0:
            ans += 1
            N = N//tmp
        else:
            while N % primes[i] == 0:
                N=N//primes[i]
            break
        tmp = tmp*primes[i]

if N!=1:
    ans +=1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

A = fac(N)
if N == 1:
    A = []
ans = 0
for i in range(len(A)):
    count = 1
    while True:
        if A[i][1] < 0.5*(count+1)*(count+2):
            break
        else:
            count += 1
    ans += count
    #print(A[i][1])
print(ans)

Submission status: Accepted

Solution code:
import math
def eratos(n):
    isprime = [True for i in range(n+1)]
    isprime[0] = False
    isprime[1] = False
    for i in range(2, int(math.sqrt(n))+13):
        if isprime[i]:
            j = i + i
        while j <= n:
            isprime[j] = False
            j = j + i
    return isprime
N = int(input())
ans = 0
is_prime = eratos(10**6+13)
for i in range(2, 10**6+14):
    if not is_prime[i]:
        continue
    x = i
    while N % x == 0:
        ans += 1
        N //= x
        x *= i
        # print(N)
if ans == 0 and N != 1:
    ans += 1
elif N > 10**6:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
import math
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())
N = collections.Counter(prime_factorize(n))
total = 0
for i in N.values():
    for j in range(40):
        if j*(j+1)//2 <= i < (j+1)*(j+2)//2:
            total += j
            break
print(total)

Submission status: Accepted

Solution code:
# import sys
# readline = sys.stdin.readline
# generator = (readline().strip() for _ in range(N))

# N, M = map(int, input().split())
# As = list(map(int, input().split()))
# queries = (input() for _ in range(N))

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

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

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

    return arr


def solve():
    N = int(input())
    factors = factorization(N)

    # print(factors)

    total = 0
    for factor in factors:
        f, z = factor
        if f == 1:
            continue

        t = 0
        for i in range(0, 1000):
            m = i * (i+1) / 2
            if m > z:
                t = i - 1
                break

        total += t
        # print(f, z, t)

    return total


def main():
    print(solve())


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math

N = int(input())

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

def sosu(n):
  if n != 1:
    for i in range(2, int(pow(n, 0.5)) + 1, 1):
      if n % i != 0:
        pass
      else:
  	    break
    else:
      return 1
  	
  return 0

for i in soinsu:
  num = 1
  if sosu(i[0]):
    while 1:
      #print(soinsu, i)
      if i[1] - num >= 0:
        i[1] -= num
        num += 1
        count += 1
      else:
  	    break
  	  
print(count)