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
from collections import deque
import math

# I/O
def read(): return input()
def read_int(): return int(input())
def read_array(type=int): return list(map(type, input().split()))
def read_tupple(type=None):
    tmp = input().split()
    if type is None: return map(int, tmp)
    assert len(tmp) == len(type)
    return [type[i](tmp[i]) for i in range(len(tmp))]

# Implementation
class PrimeNumber:
    def __init__(self, N):
        self.N = N
        self.ok, self.F, self.P = self.compute(N)

    def compute(self, N):
        isP, F, P = [True] * (N + 1), [-1] * (N + 1), []
        for i in range(2, N+1):
            if isP[i]:
                F[i] = i
                P.append(i)
                for j in range(2*i, N+1, i):
                    isP[j] = False
                    F[j] = i
        return isP, F, P

    def factorization(self, x):
        ret, MAX_P = [], int(math.sqrt(x))
        for p in self.P:
            if p > MAX_P: break
            cnt = 0
            while x % p == 0:
                x /= p
                cnt += 1
            ret.append((x, cnt))
        if x > 1: ret.append((x, 1))
        return ret

N = read_int()

pn = PrimeNumber(1000006)
ans = 0
for p, cnt in pn.factorization(N):
    dec = 1
    while cnt >= dec:
        cnt -= dec
        dec += 1
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

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

N = I()

def trial_division(n):
    d = defaultdict(int)
    while n%2 == 0:
        d[2] += 1
        n = n//2
    p = 3
    while p**2 <= n:
        while n%p == 0:
            d[p] += 1
            n = n//p
        p += 2
    if n != 1:
        d[n] += 1
    return d


d = trial_division(N)
ans = 0
for k in d.keys():
    ok = 0
    ng = 2*d[k]
    while abs(ok-ng) > 1:
        mid = (ok+ng)//2
        if mid*(mid+1) <= 2*d[k]:
            ok = mid
        else:
            ng = mid
    ans += ok

print(ans)

Submission status: Accepted

Solution code:
# Import
from collections import deque
import math

# I/O
def read(): return input()
def read_int(): return int(input())
def read_array(type=int): return list(map(type, input().split()))
def read_tupple(type=None):
    tmp = input().split()
    if type is None: return map(int, tmp)
    assert len(tmp) == len(type)
    return [type[i](tmp[i]) for i in range(len(tmp))]

# Implementation
class PrimeNumber:
    def __init__(self, N):
        self.N = N
        self.isP, self.P = self.compute(N)

    def compute(self, N):
        isP, P = [True] * (N + 1), []
        for i in range(2, N+1):
            if isP[i]:
                P.append(i)
                for j in range(2*i, N+1, i):
                    isP[j] = False
        return isP, P

    def factorization(self, x):
        ret, MAX_P = [], math.sqrt(x)
        for p in self.P:
            if p > MAX_P:
                break
            cnt = 0
            while x % p == 0:
                x /= p
                cnt += 1
            ret.append((x, cnt))
        if x > 1:
            ret.append((x, 1))
        return ret

N = read_int()

pn = PrimeNumber(1000006)
ans = 0
for p, cnt in pn.factorization(N):
    dec = 1
    while cnt >= dec:
        cnt -= dec
        dec += 1
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
# Import
from collections import deque

# I/O
def read(): return input()
def read_int(): return int(input())
def read_array(type=int): return list(map(type, input().split()))
def read_tupple(type=None):
    tmp = input().split()
    if type is None: return map(int, tmp)
    assert len(tmp) == len(type)
    return [type[i](tmp[i]) for i in range(len(tmp))]

# Implementation
class PrimeNumber:
    def __init__(self, N):
        self.N = N
        self.isP, self.P = self.compute(N)

    def compute(self, N):
        isP, P = [True] * (N + 1), []
        for i in range(2, N+1):
            if isP[i]:
                P.append(i)
                for j in range(2*i, N+1, i):
                    isP[j] = False
        return isP, P

    def factorization(self, x):
        ret = []
        for p in self.P:
            cnt = 0
            while x % p == 0:
                x /= p
                cnt += 1
            ret.append((x, cnt))
        if x > 1:
            ret.append((x, 1))
        return ret

N = read_int()

pn = PrimeNumber(1000006)
ans = 0
for p, cnt in pn.factorization(N):
    dec = 1
    while cnt >= dec:
        cnt -= dec
        dec += 1
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
# Import
from collections import deque

# I/O
def read(): return input()
def read_int(): return int(input())
def read_array(type=int): return list(map(type, input().split()))
def read_tupple(type=None):
    tmp = input().split()
    if type is None: return map(int, tmp)
    assert len(tmp) == len(type)
    return [type[i](tmp[i]) for i in range(len(tmp))]

# Implementation
class PrimeNumber:
    def __init__(self, N):
        self.N = N
        self.isP, self.P = self.compute(N)

    def compute(self, N):
        isP, P = [True] * (N + 1), []
        for i in range(2, N+1):
            if isP[i]:
                P.append(i)
                for j in range(2*i, N+1, i):
                    isP[j] = False
        return isP, P

N = read_int()

pn = PrimeNumber(1000006)
ans = 0
for p in pn.P:
    cnt = 0
    while N % p == 0:
        N /= p
        cnt += 1
    dec = 1
    while cnt >= dec:
        cnt -= dec
        dec += 1
        ans += 1
if N > 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() )
fact = factorization( n )
cnt = 0
for f in fact:
  if f[0] == 1:
    continue
  i = 1
  while True:
    f[1] -= i
    i += 1
    if f[1] < 0:
      break
    cnt += 1
print( cnt )

Submission status: Accepted

Solution code:
n=int(input())
a=0
b=1
c=0
d=n**0.5+1
d=int(d)
for i in range(2,d):
  while(n%i==0):
    a+=1
    n/=i
  while(1):
    if a>=b:
      c+=1
      a-=b
      b+=1
    else: break
  a=0
  b=1
if n>1: c+=1
print(c)

Submission status: Accepted

Solution code:
# Import
from collections import deque

# I/O
def read(): return input()
def read_int(): return int(input())
def read_array(type=int): return list(map(type, input().split()))
def read_tupple(type=None):
    tmp = input().split()
    if type is None: return map(int, tmp)
    assert len(tmp) == len(type)
    return [type[i](tmp[i]) for i in range(len(tmp))]

# Implementation
class PrimeNumber:
    def __init__(self, N):
        self.N = N
        self.compute()

    def compute(self):
        self.isP, self.P = [True] * (self.N + 1), []
        for i in range(2, self.N+1):
            if self.isP[i]:
                self.P.append(i)
                for j in range(2*i, self.N+1, i):
                    self.isP[j] = False

N = read_int()

pn = PrimeNumber(1000006)
ans = 0
for p in pn.P:
    cnt = 0
    while N % p == 0:
        N /= p
        cnt += 1
    dec = 1
    while cnt >= dec:
        cnt -= dec
        dec += 1
        ans += 1
if N > 1:
    ans += 1
print(ans)

Submission status: Accepted

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

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

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

    return arr

res = 0
for _, x in factorization(N):
    i = 1
    while i <= x:
        res += 1
        x -= i
        i += 1
if N == 1:
    print(0)
else:
    print(res)

Submission status: Accepted

Solution code:
n=int(input())

z=[]

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

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

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

    return arr

f=factorization(n)

count=0
for i in f:
  if i[0]==1:
    pass
  else:
    a=i[1]
    c=1
    while True:
      if a>=c:
        a-=c
        count+=1
        c+=1
      else:
        break
      
print(count)

Submission status: Accepted

Solution code:
# Import
from collections import deque

# I/O
def read(): return input()
def read_int(): return int(input())
def read_array(type=int): return list(map(type, input().split()))
def read_tupple(type=None):
    tmp = input().split()
    if type is None: return map(int, tmp)
    assert len(tmp) == len(type)
    return [type[i](tmp[i]) for i in range(len(tmp))]

# Implementation
N = read_int()

MAX_P = 1000006
isP = [True] * MAX_P
for i in range(2,MAX_P):
    if isP[i]:
        for j in range(2*i,MAX_P,i):
            isP[j] = False

P = [i for i in range(2,MAX_P) if isP[i]]
ans = 0
for p in P:
    cnt = 0
    while N % p == 0:
        N /= p
        cnt += 1
    dec = 1
    while cnt >= dec:
        cnt -= dec
        dec += 1
        ans += 1
if N > 1:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
def p_facto(n):
    ret = []
    nc = n
    for i in range(2, nc):
        if i*i > nc:
            break
        if n % i == 0:
            ex = 0
            while n % i == 0:
                ex += 1
                n //= i
            ret.append([i, ex])
    if n != 1:
        ret.append([n, 1])
    return ret


def main(N):
    ans = 0
    for p, e in pf:
        ex = 1
        while e >= ex:
            z = p**ex
            if N % z == 0:
                ans += 1
                N //= z
            else:
                break
            e -= ex
            ex += 1
    print(ans)


if __name__ == "__main__":
    N = int(input())
    pf = p_facto(N)
    main(N)

Submission status: Accepted

Solution code:
import math
from collections import Counter



def prime_factorization(num):
    """
    素因数分解
    ;param num 素因数分解したい数字
    ;return result {素因数: 回数, ・・・}
    """

    result = dict()

    N = num

    x = 2
    while x <= int(math.sqrt(num)) + 1:
        if (num % x) == 0:
            count = 0
            while (num % x) == 0:
                count += 1
                num = num / x

            result[x] = count

        x += 1

    if num != 1:
        result[num] = 1

    if result == []:
        result[N] = 1

    return result


N = int(input())

# 素因数分解
result = prime_factorization(N)

# 操作の回数を求める
ans = 0
for value in result.values():
    c = 1
    while (value - c) >= 0:
        ans += 1
        value -= c
        c += 1

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin


# 素因数分解 -> tuple で返す
def prime_factorization_tuple(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


def get_result(data):
    N = data[0]
    fct = prime_factorization_tuple(N)
    ans = 0
    for (_, exp) in fct:
        cnt = 0
        for i in range(1, 11):
            exp -= i
            if exp >= 0:
                cnt += 1
        ans += cnt
    return ans


if __name__ == '__main__':
    data = list(map(int, stdin.readline().rstrip().split(' ')))
    result = get_result(data)
    print(result)

Submission status: Accepted

Solution code:
n = int(input())

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

def factorization(n):
    seq = []
    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
            seq.append([i, cnt])

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

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

    return seq

so = factorization(n)

ans = 0
for i in range(len(so)):
    j = 1
    mun = so[i][1]
    while mun >= j:
        if mun - j >= 0:
            ans += 1
            mun -= j
            j += 1

print(ans)

Submission status: Accepted

Solution code:
def factorization(N):
    factoring={}
    num=N
    for i in range(2,int(N**.5)+1):
        if num%i==0:
            count=0
            while num%i==0:
                count+=1
                num//=i
            factoring[i]=count
    if num!=1:
        factoring[num]=1
    return factoring

N=int(input())
prime=factorization(N)
count=0
for num in prime:
    e=1
    while prime[num]>=e:
        count+=1
        prime[num]-=e
        e+=1
print(count)

Submission status: Accepted

Solution code:
import collections

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)

c = collections.Counter(a)

sosu_list = list(c.keys())

kosu_list = list(c.values())

count = 0

for index, num in enumerate(sosu_list):
    kosu = kosu_list[index]
    p = num
    e = 1
    while True:
        if kosu - e > e:
            z = p ** e
            kosu = kosu - e
            e = e + 1
            N = N / z
            count = count + 1
        else:
            count = count + 1
            break
print(count)

Submission status: Accepted

Solution code:
import math
from collections import Counter
A= int(input())
if A == 1:
    print(0)
    exit()
resArray = []
tmpA = A
i = 1
while i <= math.sqrt(A):
    #print (i)
    i += 1
    if tmpA == 1:
        break

    if i >2 and i %2 == 0:
        continue


    while tmpA % i == 0:
        tmpA = tmpA / i
        resArray.append(i)

res = 0
if tmpA == A:
    print(1)
    exit()
elif tmpA > 1:
    res += 1


cArray = Counter(resArray)

for i in cArray.values():
    if i > 0:
        
        tmp = 1
        while tmp*(tmp+1)//2 <= i:
            tmp += 1
        res += tmp -1
print(res)

Submission status: Accepted

Solution code:
n = int(input())

def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

f = factorize(n)
ans = 0
for i,j in f:
    ans += int((-1+pow(1+8*j,0.5))/2)
print(ans)

Submission status: Accepted

Solution code:
#ABC169d

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 sum(k):
    return k*(k+1)/2

n = int(input())

factor = factorization(n)

ans = 0

if n == 1:
    print(ans)

else:
    for i in range(len(factor)):
        k = 1
        s = k*(k+1)/2
        while True:
            if factor[i][1]>=sum(k) and factor[i][1]<sum(k+1):
                ans += k
                break
            else:
                k += 1
    print(ans)

Submission status: Accepted

Solution code:
#4 Div Game
def prime_factorize(n):
    a = []
    tmp = n
    for i in range(2,int(n**0.5//1+1)):
        if tmp%i == 0:
            cnt = 0
            while tmp%i == 0:
                cnt += 1
                tmp //= i
            a.append([i,cnt])
        
    if tmp != 1:
        a.append([tmp,1])
    
    if a == []:
        a.append([n,1])
    
    return a

n = int(input())

x = prime_factorize(n)
cnt = 0


for i in range(len(x)):
    if x[0][0]==1:
        break
        
    k = x[i][1]
    for j in range(k):
        if n%(x[i][0]**(j+1)) == 0:
            n //= x[i][0]**(j+1)
            cnt += 1
            k-=(j+1)
        elif n%(x[i][0]**(j+1)) != 0:
            break
        if k <= 0:
            break
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

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

    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

    fact = factorization(n)

    ans = 0
    for x, y in fact:
        tmp = 1
        while True:
            if (tmp + 1) * (tmp + 2) // 2 <= y:
                tmp += 1
            else:
                break

        ans += tmp

    print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
n = N
for i in range(2, int(N**0.5)+1):
    if n % i == 0:
        list1 = []
        while n % i == 0:
            list1.append(i)
            n //= i
        x = len(list1)
        ans += int(-0.5+((1+8*x)**0.5)*0.5)
if n != 1:
  ans += 1
if ans == 0 and N != 1:
    ans = 1
print(ans)

Submission status: Accepted

Solution code:
"""
~~ Author : Bhaskar
~~ Dated : 01~06~2020
"""

import sys
from bisect import *
from math import floor,sqrt,ceil,factorial as F,gcd,pi
from itertools import chain,combinations,permutations,accumulate
from collections import Counter,defaultdict,OrderedDict,deque
from array import array
INT_MAX = sys.maxsize
INT_MIN = -(sys.maxsize)-1
mod = 1000000007
lcm = lambda a,b : (a*b)//gcd(a,b)
setbit = lambda x : bin(x)[2:].count("1")

def solve():
    n = int(sys.stdin.readline())
    d = Counter()
    while n%2 == 0:
        d[2] += 1
        n //= 2
    i = 3
    while i*i < n:
        if n%i == 0:
            while n%i == 0:
                d[i] += 1
                n //= i
        i += 2
    if n != 1:
        d[n] += 1
    ans = 0
    for k,v in d.items():
        minn = 1
        while v-minn >= 0:
            v -= minn
            minn +=1
            ans += 1
    print(ans)

if __name__ == "__main__":
    try:
        sys.stdin = open("input.txt","r")
    except :
        pass
    solve()

Submission status: Accepted

Solution code:
sieve = [True] * 10**6
prime = []
for i in range(2, 10**6):
  if sieve[i]:
    prime.append(i)
    if i < 10**3:
      for j in range(i**2, 10**6, i):
        sieve[j] = False
n = int(input())
if n == 1:
  print(0)
else:
  e = []
  for p in prime:
    if n % p == 0:
      idx = 0
      while n % p == 0:
        n = n // p
        idx += 1
      e.append(idx)
    if n == 1:
        break
  if len(e) > 0:
    total = 0
    for idx in e:
      cnt = 1
      while idx >= cnt*(cnt+1)//2:
        cnt += 1
      cnt -= 1
      total += cnt 
    if n == 1:
      print(total)
    else:
      print(total + 1)
  else:
    print(1)

Submission status: Accepted

Solution code:
import collections
N = int(input())
  
# 素因数分解
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

num1 = prime_decomposition(N)
num2 = collections.Counter(num1)

ans = 0

for j in set(num1):
  number = 0
  for k in range(50):
    number += k
    if number > num2[j]:
      ans += (k-1)
      break
        
print(ans)

Submission status: Accepted

Solution code:
def isprime(x):
    for i in range(2,int(x**0.5)+1):
        if x%i==0:
            return False
    return x!=1


dic={}
n=int(input())
t=int(n**0.5)+1
for i in range(2,t):
    cnt=0
    while n%i==0:
        cnt+=1
        n//=i
    dic[i]=cnt
if n!=1:
    dic[n]=1
ans=0
for i in dic:
    x=dic[i]
    r=(-1+(1+8*x)**0.5)//2
    ans+=r
print(int(ans))

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
N = n

for i in range(2,int(n**0.5//1 + 2)):
  if n % i == 0:
    c = 0
    while n%i == 0:
      n//=i
      c += 1
    j = 1
    while c-j >= 0:
      ans += 1
      c -= j
      j += 1
    
if n > 1:
  ans = ans + 1
print(ans)

Submission status: Accepted

Solution code:
# 素数と個数を求める
def factorize(n):
    res = []
    for i in range(2,n):
        if i*i > n: break
        if n%i: continue
        res += [[i,0]]
        while n%i == 0:
            n //= i
            res[-1][1] += 1
    if n != 1: res += [[n,1]]
    return res

n = int(input())
P = factorize(n)
ans = 0
for p, c in P:
    pi = 1
    for i in range(1, c+1):
        pi *= p
        if n%pi: continue
        n //= pi
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
# ABC169C

def intSqrt(n):
    x = 1
    while True:
        x2 = (x + n // x) // 2
        if x2 ** 2 <= n and abs(x - x2) <= 1:
            break
        x = x2
    return x2


def divisor(n):
    if n % 2 == 0:
        return 2
    elif n % 3 == 0:
        return 3
    maxitr = intSqrt(n)
    i = 1
    while True:
        i += 4
        if i > maxitr:
            return n
        elif n % i == 0:
            return i
        i += 2
        if i > maxitr:
            return n
        elif n % i == 0:
            return i


def factorization2(n):
    """
    returns [(factor, count), ...]
    factorization2(64*9) --> [(2, 6), (3, 2)]
    """
    result = []
    while n > 1:
        div = divisor(n)
        result.append(div)
        n //= div
    factors = set(result)
    result2 = []
    for f in factors:
        result2.append((f, result.count(f)))
    return result2

n = int(input())
import numpy as np
result = factorization2(n)
ans = 0
for factor, m in result:
    ans += np.floor((-1 + intSqrt(1 + 8 * m)) / 2) # n*(n+1)/2 > m の整数解
print(int(ans))

Submission status: Accepted

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

from itertools import groupby
N = int(input())
P = is_prime(N)
ans = 0
for v, g in groupby(P):
    n = len(list(g))
    for i in range(1, 10**5):
        n -= i
        if n >= 0:
            ans += 1
        else:
            break
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

i = 2
num = n
while i * i <= n:
  cnta = 0
  cntb = 0
  while num % i == 0:
    num //= i
    if cnta == cntb:
      ans += 1
      cnta = 0
      cntb += 1
    else:
      cnta += 1
  i += 1
  
if (ans == 0 and n != 1) or num != 1:
  ans += 1
print(ans)

Submission status: Accepted

Solution code:
# 素数と個数を求める
def factorize(n):
    res = []
    for i in range(2,n):
        if i*i > n: break
        if n%i: continue
        res += [[i,0]]
        while n%i == 0:
            n //= i
            res[-1][1] += 1
    if n != 1: res += [[n,1]]
    return res

n = int(input())
P = factorize(n)
ans = 0
for p, c in P:
    for i in range(1, c+1):
        if c <= 0: break
        c -= i
        if c >= 0: ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
if n == 1:
    print(0)
    exit()
F = {}
tmp = n
i = 2
while i**2 <= tmp:
    cnt = 0
    while tmp % i == 0:
        cnt += 1
        tmp //= i
    if cnt > 0:
        F[i] = cnt
    i += 1
if tmp != 1 or F == {}:
    F[tmp] = 1
ans = 0
for p in F:
    a = 1
    while F[p] >= a:
        F[p] -= a
        ans += 1
        a += 1
print(ans)

Submission status: Accepted

Solution code:
import collections

n=int(input())

if n==1:
    print(0)
    exit()
    
a=[]
M=n
p=2

while p <= M**0.5:
    while n%p ==0:
        a.append(p)
        n = n//p       
        if n==1:
            break
    p += 1
if n!=1:
    a.append(n)
if len(a)==0:
    a.append(M)

c=collections.Counter(a)

x=c.most_common()

ans=0
for i in x:
    ans += int((-1+(1+8*i[1])**0.5)/2)

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
i = 2
 
while n>1 and i*i<=n:
  if n % i == 0:
    c = 0
    while n % i == 0:
      n = n / i
      c += 1
    j = 1
    while c>=j:
      ans=ans+1
      c -= j
      j += 1
 
  i = i + 1
      
    
if n > 1:
  ans = 1 + ans
 
print(ans)

Submission status: Accepted

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

while n>1 and i*i<=n:
  if n % i == 0:
    c = 0
    while n % i == 0:
      n = n / i
      c += 1
    Y=1
    U=2
    while c>=Y:
      ans=ans+1
      Y=Y+U
      U=U+1

  i = i + 1
      
    
if n > 1:
  ans = 1 + ans

print(ans)

Submission status: Accepted

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

while n>1 and i*i<=n:
  if n % i == 0:
    c = 0
    while n % i == 0:
      n = n / i
      c = c + 1
    Y=1
    U=2
    while c>=Y:
      ans=ans+1
      Y=Y+U
      U=U+1

  i += 1
      
    
if n > 1:
  ans = 1 + ans

print(ans)

Submission status: Accepted

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

d = 2
while d * d <= n:
    if n % d != 0:
        d += 1
        continue

    e = d
    while n % e == 0:
        n //= e
        e *= d
        ans += 1

    while n % d == 0:
        n //= d
if n != 1:
    ans += 1

print(ans)

Submission status: Accepted

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

while n>1 and i*i<=n:
  if n % i == 0:
    c = 0
    while n % i == 0:
      n = n / i
      c = c + 1
    Y=1
    U=2
    while c>=Y:
      ans=ans+1
      Y=Y+U
      U=U+1

  i = i + 1
      
    
if n > 1:
  ans = 1 + ans

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

#nを素因数分解したリストを返す
def prime_factor(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


primes = prime_factor(N)

prime_dic = {}
for i in range(len(primes)):
    if primes[i] in prime_dic:
        prime_dic[primes[i]] += 1
    else:
        prime_dic[primes[i]] = 1

sum_list = [0 for _ in range(30)]
sum_list[0] = 1
for i in range(29):
    sum_list[i+1] += sum_list[i] + (i + 2)

ans = 0
for key in prime_dic:
    for i in range(30):
        if sum_list[i] > prime_dic[key]:
            ans += i
            break

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
ans=0
p=2
 
while N>1 and p*p<=N:
  if N%p==0:
    c=0
    while N%p==0:
      N=N/p
      c=c+1
    Y=1
    U=2
    while c>=Y:
      ans=ans+1
      Y=Y+U
      U=U+1
  p=p+1
 
if N>1:
  ans=ans+1
 
print(ans)

Submission status: Accepted

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

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

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

    return arr

n = int(input())
arr = solve(n)

cnt = 0
for n in arr:
    a=1
    if n[0]==1:
        break
    while n[1]>=a:
        n[1] -= a
        a += 1
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(100000)


def ins(): return input().split()
def ii(): return int(input())
def iil(): return list(map(int, ins()))
def lin(): return list(input())
def iin(): return map(int, ins())

from collections import defaultdict
from math import sqrt

arr = []
max_p = int(500000)
l1 = [1 for i in range(max_p)]
l2 = set()
l2.add(2)
for i in range(max_p):
    if not l1[i]:
        continue
    l2.add(2*i+3)
    for j in range(3*i+3, max_p, 2*i+3):
        l1[j] = 0

n = int(input())
#n = 10 ** 12
dic = defaultdict(int)
for i in l2:
    while n % i == 0:
        n //= i
        dic[i] += 1
if n != 1:
    dic[n] += 1

ans = 0
for i in dic.values():
    ans += (-1 + sqrt(1 + 8 * i))//2
print(int(ans))

Submission status: Accepted

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

d = 2
while d * d < n:
    if n % d != 0:
        d += 1
        continue

    e = d
    while n % e == 0:
        n //= e
        e *= d
        ans += 1

    while n % d == 0:
        n //= d
if n != 1:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict

N = int(input())


def prime_factorization(N):
    PC = defaultdict(int)

    P = 2
    while N % P == 0:
        PC[P] += 1
        N //= P

    P = 3
    while P * P <= N:
        if N % P == 0:
            PC[P] += 1
            N //= P
        else:
            P += 2

    if N != 1:
        PC[N] += 1

    return PC


PC = prime_factorization(N)

ans = 0
for PI in PC.values():
    PIc = 1
    while PI >= PIc:
        ans += 1
        PI -= PIc
        PIc += 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)
count = 0

for i in range(len(f)):
  k = f[i][1]
  r = 1
  count += 1
  for j in range(2,k+1):
    r += j
    if k-r >= 0:
      count += 1

print(count)