Problem:


Score : 400 points

Problem Statement

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

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

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

z divides N;

z is different from all integers chosen in previous operations.

Then, replace N with N/z.

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

Constraints

All values in input are integers.

1 \leq N \leq 10^{12}

Input

Input is given from Standard Input in the following format:

N

Output

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

Sample Input 1

24

Sample Output 1

3

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

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

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

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

Sample Input 2

1

Sample Output 2

0

We cannot apply the operation at all.

Sample Input 3

64

Sample Output 3

3

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

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

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

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

Sample Input 4

1000000007

Sample Output 4

1

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

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

Sample Input 5

997764507000

Sample Output 5

7



Sample input:
24


Sample output:
3

Submission status: Accepted

Solution code:
import numpy as np
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix
import itertools
import copy

n = int(input())

def seachPrimeNum(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum


def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

if is_prime(n):
    print(1)
    exit()

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

nums = factorization(n)

ans = 0
cnt = 0
tmp = {}
#print(nums)
for i in range(len(nums)):
    num = nums[i][1]

    for j in range(1,10*8):
        num -= j
        ans += 1
        if (num < j+1):
            if num>0:
                #print(tmp)
                if len(tmp) == 0:
                    tmp[nums[i][0]] = num
                    tmp2 = copy.copy(tmp)
                else:
                    tmp = copy.copy(tmp2)
                    for a in tmp.values():
                        #print(a)
                        if a > 0:
                            a -= 1
                            #ans += 1
                            #print(tmp)
                            if num - 1 > 0:
                                tmp2[nums[i][0]] = num -1
            break

#print(tmp)

tmp = sorted(tmp.items(), key=lambda x:x[1])

print(ans)

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
def tri(num):
  s=int(math.sqrt(2*num))
  t=s*(s+1)//2
  if t>num:
    return s-1
  else:
    return s

if N==1:
  print(0)
else:
  ls=factorization(N)
  ans=0
  for a,b in ls:
    ans+=tri(b)
  print(ans)

Submission status: Accepted

Solution code:
N=int(input())
ans=0
def prime_factorize(n):
    a = []
    count=0
    while n % 2 == 0:
        count+=1
        n //= 2
    if count!=0:a.append(count)
    f = 3
    count=0
    while f * f <= n:
        if n % f == 0:
            count+=1
            n //= f
        else:
            f += 2
            if count!=0:a.append(count)
            count=0
    if f==n:
        count+=1
        n=1
    if count!=0:a.append(count)
    if n != 1:
        a.append(1)
    return a
c = prime_factorize(N)
for i in range(len(c)):
    a=c[i]
    for j in range(1,c[i]+1):
        if a>=j:
            ans+=1
            a-=j
        else:
            break
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())
cnt = 0
past = []
while True:
    n = prime_factorize(N)
    if not n:
        break
    m = set(n)
    nn = []
    for i in m:
        for j in range(1, n.count(i)+1):
            nn.append(pow(i, j))
    for i in nn:
        if not (i in past):
            N = int(N / i)
            past.append(i)
            cnt+=1
            break
    else:
        break
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

d = 2
ans = 0
while d * d <= n:
    if (n % d != 0):
        d += 1
        continue
    z = d
    while n % z == 0:
        n //= z
        z *= d
        ans += 1

    while n % d == 0:
        # 残りかすを除去
        n //= d

if (n != 1):
    ans += 1

print(ans)

Submission status: Accepted

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

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

def main():
    n = int(input())
    cache = set()
    a = prime_factorize(n)
    tmp = 1
    ans = 0
    while a:
        x = a.pop()
        if tmp % x == 0:
            tmp *= x
        else:
            tmp = x
        if tmp in cache:
            continue
        cache.add(tmp)
        ans += 1
        tmp = 1


    print(ans)


main()

Submission status: Accepted

Solution code:
import math
n=int(input())
sqn=int(math.sqrt(n))
p=[1]*int(2*sqn+20)
p[0]=0;p[1]=0
for i in range(2,sqn):
    if p[i]:
        for j in range(2,sqn//i+1):
            p[i*j]=0

p=[i for i in range(sqn+7) if p[i]]
f={}
for pi in p:
    if n%pi==0:
        cnt=1
        n//=pi
        while n%pi==0:
            cnt+=1
            n//=pi
        f[pi]=cnt
    
#print(f)
if n>1:
    f[n]=1
ans=0
for k in f:
    tmp=1
    while (tmp+1)*(tmp+2)//2<=f[k]:
        tmp+=1
    ans+=tmp
    #print(ans,tmp,k,f[k])
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
M=10**6
l=[]
p=[1]*M
for i in range(2,M):
  if p[i]:
    l+=[i]
    for j in range(2*i,M,i): p[j]=0
d={}
for k in l:
  while n%k<1: n//=k; d[k]=d.get(k,0)+1
a=0
for i in d.values():
  t=c=0
  while t+c<i: c+=1; t+=c
  a+=c
print(a+(n>1))

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

Submission status: Accepted

Solution code:
from collections import Counter
import math
N=int(input())
s=[]
z=Counter()
def prime(a):
    i=2
    while i*i<=a:
        if a%i==0:return 0
        i+=1
    return 1

def vsum(a):
    s=0
    for i in range(1,a+1):
        s+=i
        if s==a:return i
        elif s>a:return i-1

if N==1:
    print(0)
    exit()
elif prime(N)==1:
    print(1)
    exit()

for i in range(2,int(math.sqrt(N))):
    while N%i==0:
        s.append(i)
        N=N//i
        if N==1:break
        elif prime(N)==1:
            s.append(N)
            break

z=Counter(s)
ans=0
for key,values in z.items():
    ans+=vsum(values)
print(ans)

Submission status: Accepted

Solution code:
#4問目
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 has_duplicates2(seq):
    seen = []
    unique_list = [x for x in seq if x not in seen and not seen.append(x)]
    return len(seq) != len(unique_list)

fact = prime_factorize(N)
# print(fact)
result  =  0

if has_duplicates2(fact):
    #重複した数字のリスト
    chofuku = [x for x in set(fact) if fact.count(x) > 1]
    for i in chofuku:
        flag = True
        n = 1
        Count = fact.count(i) + 1
        while flag:
            if(1/2 * n * (n - 1) < Count <= 1/2 * n * (n + 1)):
                result += n-1
                flag = False
            else:
                n += 1
    
    #重複していない数の個数
    NOTchofuku = len((list(set(fact)))) - len(chofuku)
    print(result + NOTchofuku)
else:
    print(len(fact))

Submission status: Accepted

Solution code:

N = int(input())

#素因数分解。
pf={}
m=N
for i in range(2,int(m**0.5)+1):
    while m%i==0:
        pf[i]=pf.get(i,0)+1
        m//=i
if m>1:pf[m]=1
#print(pf)

val = list(pf.values())
#print('val', val)

T = len(val)
count=0

for i in range(T):
    j=1
    while True:
        val[i] -= j
        j+=1
        if val[i]>=0:
            count+=1
        else:
            break

print(count)

Submission status: Accepted

Solution code:
n = int(input())

mp = {}
for f in range(2, 1000000):
    while n % f == 0:
        mp[f] = 1 if f not in mp else mp[f] + 1
        n //= f
if n > 1:
    mp[n] = 1

def fn(x):
    for i in range(2, 100):
        sm = i*(i+1)//2
        if x < sm:
            return i - 1

#print(mp)
#print({p:fn(mp[p]) for p in mp})
print(sum(fn(mp[p]) for p in mp))

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

fact = factorization(N)
fact_num = []
fact_num2 = []
 

for i in range(len(fact)):
    fact_num.append(fact[i][0])
    fact_num2.append(fact[i][1])

cnt=0

for j in range(max(fact_num2)+1):
    for i in range(len(fact)):
        if N%fact_num[i]==0 and N%(fact_num[i]**(j+1))==0:
            N = N/(fact_num[i]**(j+1))
            cnt+=1

            if N==1:
                print(cnt)
                sys.exit()
print(cnt)

Submission status: Accepted

Solution code:
a=int(input())
ans = 0
tmp = 2 
while tmp*tmp <=a:
    ct = 0 
    while not a % tmp:
        ct+=1
        a/=tmp
    for i in range(1,ct+1):
        if (1+i)*i/2<=ct:
            ans+=1
        else:
            break
    tmp+=1
if a != 1:
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(read())

U = 10**6
is_prime = np.zeros(U, np.bool_)
is_prime[2] = 1
is_prime[3::2] = 1
for p in range(3, U, 2):
    if p * p >= U:
        break
    if is_prime[p]:
        is_prime[p * p::p * p] = 0

primes = is_prime.nonzero()[0]


def factor(N):
    div = primes[N % primes == 0]
    for p in div:
        e = 0
        while N % p == 0:
            e += 1
            N //= p
        yield (p, e)
    if N != 1:
        yield (N, 1)


A = np.zeros(100, np.int32)
for i in range(14):
    k = i * (i + 1) // 2
    A[k] = i
np.maximum.accumulate(A, out=A)

x = 0
for p, e in factor(N):
    x += A[e]
print(x)

Submission status: Accepted

Solution code:
# from math import factorial,sqrt,ceil #,gcd
# from itertools import permutations,combinations,combinations_with_replacement
from collections import deque,Counter
# from bisect import bisect_left
from heapq import heapify,heappush,heappop
# from numba import njit
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from fractions import gcd

# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np    # numpy.lcm()
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb,perm #permはnPk
# import networkx as nx
# G = Graph()

# slist = "abcdefghijklmnopqrstuvwxyz"
N = int(input())

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

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

ans = 0
cnt_primes = Counter(prime_factorize(N))

for i in cnt_primes:
    j = 1
    while cnt_primes[i]>=0:
        cnt_primes[i] -= j
        if cnt_primes[i]>=0:
            ans += 1
        else:
            break
        j += 1

print(ans)

Submission status: Accepted

Solution code:
from collections import Counter

N = int(input())

def prime(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 = Counter(prime(N))

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
aaa = 2
maxi = 2
def prime(aaa):
    global primemode
    if n != 1:
        i = 2
        while i*i <= aaa:
            if aaa % i == 0:
                primemode = False
                return False
            i += 1
        return True
    else:
        return False
def make_divisors(n):
    if prime(n):
        return True
    a = 0
    i = 2
    while i <= n:
        if n % i == 0:
            if a == 0:
                a = i
                n /= i
                i -= 1
                if n == 1:
                    return True
            elif a == i:
                n /= i
                i -= 1
                if n == 1:
                    return True
                pass
            else:
                return False
        i += 1
    return True
def divisors(a, i):
    global ans, aaa, maxi, primemode
    while i <= n and i <= a:
        if i * i <= a and primemode:
            if prime(a):
                ans += 1
                break
        if a % i == 0:
            if make_divisors(i):
                primemode = True
                ans += 1
                num = a / i
                aaa = num
                if maxi <= i:
                    maxi = i
                divisors(num, i+1)
                break
        i += 1
if n == 1:
    print(0)
else:
    if prime(n):
        print(1)
    else:
        divisors(n, 2)
        print(ans)

Submission status: Accepted

Solution code:
n=int(input())
from math import sqrt as S 
pf=[]
for i in range(2,int(S(n))+1):
    if n%i==0:
        c=0 
        while n%i==0:
            n//=i 
            c+=1 
        pf.append([i,c])
if n>1:
    pf.append([n,1])
cnt=0 
def search(x):
    i=1 
    while i*(i+1)//2<=x:
        i+=1 
    return i-1 
for x in range(len(pf)):
    a=pf[x][0]
    b=pf[x][1]
    cnt+=search(b)
print(cnt)

Submission status: Accepted

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

l=factorization(n) 

for i in range(len(l)):
    m=l[i]
    m2=m[1]
    a=1
    while m2>=a:
        count+=1
        m2-=a
        a+=1
if n==1:
    print(0)
else:
    print(count)

Submission status: Accepted

Solution code:
from functools import lru_cache


def PrimeFactorization(n):
    pf = {}
    i = 2
    while i ** 2 < n:
        while n % i == 0:
            pf[i] = pf.get(i, 0) + 1
            n //= i
        i += 1
    if n > 1:
        pf[n] = 1
    return pf


@lru_cache(maxsize=100000)
def f(x):
    return int((-1 + (1 + 8 * x) ** 0.5) // 2 + 0.001)


def resolve():
    n = int(input())
    d = PrimeFactorization(n)
    ans = 0
    for v in d.values():
        ans += f(v)
    print(ans)


if __name__ == '__main__':
    resolve()

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

li = factorization(n)
ans = 0
for f in li:
    f = f[1]
    for i in range(1,f+1):
        if i>f:
            break
        f-=i
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
import sys

#2以上の整数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 count(n):
    ret = 0
    for i in range(1,10):
        n -= i
        if n < 0:
            break
        else:
            ret += 1
    return ret

N = int(input())
if N == 1:
    print(0)
    sys.exit()
bunkai = factorization(N)
ans = 0
for i in bunkai:
    ans += count(i[1])
print(ans)

Submission status: Accepted

Solution code:
a=[]
for i in range(51):
    a+=[i]*(i+1)

def prime_factor(n):
    ass=[]
    for i in range(2,int(n**0.5)+1):
        while n%i==0:
            ass.append(i)
            n=n//i
    if n!=1:
        ass.append(n)
    return ass
    
from collections import Counter
c=Counter(prime_factor(int(input())))
ans=0
for i in c.values():
    ans+=a[i]
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)
m = set(l)
l2 = list(m)
ans = 0

for i in range(len(l2)):
    x = l.count(l2[i])
    y = 1
    while x >= y:
        x = x - y
        y += 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])

    return arr

n = int(input())
l = factorization(n)
ans = 0
for c in l:
    lim = c[1]
    num = 0
    while lim > num:
        num += 1
        lim -= num
    ans += num

print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict
def factorize(M):
  res=defaultdict(int)
  for i in range(2,int(M**0.5)+1):
    if M==1:
      break
    while M%i==0:
      M//=i
      res[i]+=1  
  if M!=1:
    res[M]=1
  return res

N=int(input())
fact=factorize(N)
#print(fact)

def times(n):
  s=0
  for i in range(1,10**9):
    s+=i
    if n<s:
      return i-1
    
answer=0
for v in fact.values():  
  #print(v,times(v))
  answer+=times(v)
  
print(answer)

Submission status: Accepted

Solution code:
N = int(input())
things = []
c = N
for i in range(2, c):
	if i*i > N:
		break
	count = 0
	if c%i == 0:
		while c%i == 0:
			c//=i
			count += 1
		things.append(count)
if c > 1:
	things.append(1)
final = 0
for x in things:
	count = 0
	start = 1
	step = 2
	while start <= x:
		start += step
		step += 1
		count += 1
	final += count

print(final)

Submission status: Accepted

Solution code:
import sys
from math import sqrt
from bisect import bisect_right


def _i(): return int(sys.stdin.readline().strip())


def main():
    n = _i()
    sqn = int(sqrt(n))
    p = [True] * (sqn+1)
    d = {}
    for i in range(2, sqn + 1):
        if not p[i]:
            continue

        for j in range(i+i, sqn+1, i):
            p[j] = False

        while n % i == 0:
            d[i] = d.get(i, 0) + 1
            n //= i

    c = 0 if n == 1 else 1
    arr = [1, 3, 6, 10, 15, 21, 28, 36]
    for v in d.values():
        c += bisect_right(arr, v)
    return c


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

Submission status: Accepted

Solution code:
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(read())

U = 10**6
is_prime = np.zeros(U, np.bool_)
is_prime[2] = 1
is_prime[3::2] = 1
for p in range(3, U, 2):
    if p * p >= U:
        break
    if is_prime[p]:
        is_prime[p * p::p + p] = 0

primes = is_prime.nonzero()[0]


def factor(N):
    div = primes[N % primes == 0]
    for p in div:
        e = 0
        while N % p == 0:
            e += 1
            N //= p
        yield (p, e)
    if N != 1:
        yield (N, 1)


A = np.zeros(100, np.int32)
for i in range(14):
    k = i * (i + 1) // 2
    A[k] = i
np.maximum.accumulate(A, out=A)

x = 0
for p, e in factor(N):
    x += A[e]
print(x)

Submission status: Accepted

Solution code:
# Contest No.: ABC169
# Problem No.: D
# Solver:      JEMINI
# Date:        20200531

import sys
import heapq

def main():
    temp = [True] * (10 ** 6 + 10)
    temp[0] = False
    temp[1] = False
    for i in range(2, 10 ** 6 + 10):
        if temp[i]:
            cnt = 2 * i
            while cnt < 10 ** 6 + 10:
                temp[cnt] = False
                cnt += i
    prime = []
    for i in range(10 ** 6 + 10):
        if temp[i]:
            prime.append(i)
 
    n = int(input())
    ans = 0
    tempN = n
    for i in prime:
        if i > tempN:
            break
        if tempN % i:
            continue
        div = 0
        while tempN % i == 0:
            tempN = tempN // i
            div += 1
        tempAns = int((div * 2) ** 0.5)
        if tempAns * (tempAns + 1) // 2 > div:
            tempAns -= 1
        #print(tempAns)
        ans += tempAns
    if tempN > 1:
        ans += 1
    print(ans)
    return
 
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())
a = factorization(N)

ans = []

for i in range(len(a)):
    tmp = 1
    while a[i][1] >= tmp and a[i][0] != 1:
        b = a[i][0]**tmp
        ans.append(b)
        a[i][1] -= tmp
        tmp += 1

print(len(ans))

Submission status: Accepted

Solution code:
n = int(input())

if n == 1:
    print(0)
    exit()
a = {}
i = 2
while i*i < n:
    while n % i == 0:
        n /= i
        if i in a:
            a[i] += 1
        else:
            a[i] = 1
    if n == 1:
        break
    else:
        i += 1
if n != 1:
    a[n] = 1
ans = 0
for i in a.values():
    j = 1
    while i >= j:
        i -= j
        ans += 1
        j += 1

print(ans)

Submission status: Accepted

Solution code:
n=int(input())

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

if n==1:
  print(0)
  exit()  
  
f=factorization(n)
cnt=0
for i in range(len(f)):
  m=2 # 強引
  while f[i][1]>0:
    f[i][1]-=m
    m+=1
    cnt+=1
#    print(f)
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

import heapq 





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,i, cnt])

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

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

    return arr

# for N in range(1,100000):
# N = 288
# print(N)

heap = factorization(N) 
# print(heap)
# print(heap)
heapq.heapify(heap)
ans = 0

while(heap):
    # print(heap)
    if N == 1:
        break
    sub,prime,cnt = heapq.heappop(heap)
    if N < sub:
        break
    if N % sub == 0:
        N = N // sub
        ans += 1
        if cnt > 0:
            cnt -= 1
            sub *= prime
            heapq.heappush(heap, [sub,prime,cnt])

print(ans)

Submission status: Accepted

Solution code:
from collections import Counter

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

    def getPrimeFactors(x):
        anss = []
        while x%2 == 0:
            anss.append(2)
            x //= 2
        for d in range(3, int(x**0.5)+1, 2):
            while x%d == 0:
                anss.append(d)
                x //= d
        if x != 1:
            anss.append(x)
        return anss

    PFs = getPrimeFactors(N)
    cnt = Counter(PFs)

    ans = 0
    for p, e in cnt.items():
        for i in range(1, 50):
            if e >= i:
                ans += 1
                e -= i

    print(ans)


solve()

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


n = inp()
ans = 0
for i in range(2, 10**6 + 1):
    for j in range(1, 40):
        x = i**j
        if n % x == 0:
            ans += 1
            n //= x
        else:
            while n % i == 0:
                n //= i
            break
if n > 10**6:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
import collections
N = int(input())
ans = 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))
so = c.keys()

num = 0
for i in so :
  num =c[i] 
  for j in range(1, num+1):
    if num >= j :
      num -= j
      ans += 1
    else :
      break
      
print(ans)

Submission status: Accepted

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

n = int(input())
a = prime_factorize(n)
c = Counter(a)
ans = 0
for k,v in c.items():
    ans += 1
    now = 1
    v -= now
    while now < v:
        ans += 1
        now += 1
        v -= now
print(ans)

Submission status: Accepted

Solution code:
import itertools

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

def main():
    N = int(input())
    primes = list(set(prime_factorize(N)))
    cnt = 0
    while len(primes) != 0:
        d = primes.pop(0)
        e = 1
        # print(d,e)
        # print('===================')
        while N%d**e == 0:
            # print(d,N,e,cnt)
            N = N/(d**e)
            e += 1
            cnt += 1
        #     print(d,N,e,cnt)
        # print('===================')
    print(cnt)

if __name__ == '__main__':
    main()

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

a=fctr1(n)

ans=0

for i in range(len(a)):
    tmp=3
    p=2
    while a[i][1]>=tmp:
        p+=1
        tmp+=p
    ans+=(p-1)
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter

N = int(input())

sosu = []
while N % 2 == 0:
    sosu.append(2)
    N = int(N/2)

f = 3
while f * f <= N:
    while N % f == 0:
        sosu.append(f)
        N = int(N/f)
    f += 2
if N != 1: sosu.append(N)

count = Counter(sosu)

ans = 0
for k,v in count.items():
    beki = 1
    while beki <= v:
        ans += 1
        v -= beki
        beki += 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())
if n == 1:
  print(0)
  exit()
  
facs = factorization(n)

nums = []

for fac in facs:
  for i in range(1, fac[1]+1):
    nums.append(fac[0]**i)
    
nums = list(set(nums))
cnt = 0
nums.sort()

for num in nums:
  if n % num == 0:
    n = n / num
    cnt += 1
    
print(cnt)