Problem:


Score : 400 points

Problem Statement

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

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

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

z divides N;

z is different from all integers chosen in previous operations.

Then, replace N with N/z.

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

Constraints

All values in input are integers.

1 \leq N \leq 10^{12}

Input

Input is given from Standard Input in the following format:

N

Output

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

Sample Input 1

24

Sample Output 1

3

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

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

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

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

Sample Input 2

1

Sample Output 2

0

We cannot apply the operation at all.

Sample Input 3

64

Sample Output 3

3

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

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

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

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

Sample Input 4

1000000007

Sample Output 4

1

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

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

Sample Input 5

997764507000

Sample Output 5

7



Sample input:
24


Sample output:
3

Submission status: Accepted

Solution code:
def 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())
p = factorization(N)
def cou(n):
    temp = n
    count = 1
    out = 0
    while temp - count >= 0:
        temp -= count
        count += 1
        out += 1
    return out

ans = []

for i in range(len(p)):
    ans.append(cou(p[i][1]))

answer = 0 if N == 1 else sum(ans)
print(answer)

Submission status: Accepted

Solution code:
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(n**0.5)+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(int(input()))
b = [1, 3, 6, 10, 15, 21, 28, 36, 45]

ans = 0

if len(a) == 1 and a[0][0] == 1:
  print(0)
  exit()
  
for i in a:
  for j in range(len(b)):
    if i[1] < b[j]:
      ans+=j
      break
    
print(ans)

Submission status: Accepted

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

def primeFactorization2(x):
    ps = []
    es = []
    i=2
    k=x
    while i<=k**0.5:
        if k%i==0 and isPrime(i):
            ps.append(i)
            e=0
            while k%i==0:
                k = k//i
                e+=1
            es.append(e)
        i+=1
    if x==1:
        return [[],[]]
    elif isPrime(x):
        return [[x],[1]]
    else:
        return [ps + primeFactorization2(k)[0], es + primeFactorization2(k)[1]]


n=int(input())

if isPrime(n):
    print(1)
else:
    nums = primeFactorization2(n)[1]

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

    print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))

import math


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

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

   return arr


def main():
    n = input_int()

    ans = 0
    if n < 1:
        print(ans)
        return
    a = factorization(n)
    for _, i in a:
        j = 1
        while i >= j:
            ans += 1
            i -= j
            j += 1

    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
n, p, score = N, 2, 0
while p ** 2 <= N and n > 1:
  e = 1
  while n % (p ** e) == 0:
    n //= (p ** e)
    score += 1
    e += 1
  else:
    while n % p == 0:
      n //= p
    p += 2 - (p == 2)
else:
  score += n > 1
print(score)

Submission status: Accepted

Solution code:
import math
n = int(input())
ans = 0
k = int(math.sqrt(n)) + 1

for i in range(2,k):
    p = 1
    while n%(i**p)==0:
        ans+=1
        n = n//(i**p)
        p+=1
        
    while n % i == 0:
        n //= i

    if n<i: break

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

Submission status: Accepted

Solution code:
N = int(input())
n, p, score = N, 2, 0
while p ** 2 <= N:
  e = 1
  while n % (p ** e) == 0:
    n //= (p ** e)
    score += 1
    e += 1
  else:
    while n % p == 0:
      n //= p
    p += 2 - (p == 2)
else:
  score += n > 1
print(score)

Submission status: Accepted

Solution code:
N = int(input())
n, p, score = N, 2, 0
while p ** 2 <= N:
  e = 1
  while n % (p ** e) == 0:
    n //= (p ** e)
    score += 1
    e += 1
  else:
    while n % p == 0:
      n //= p
    p += 2 - (p == 2)
else:
  score += (n > 1)
print(score)

Submission status: Accepted

Solution code:
N = int(input())
n, p, score = N, 2, 0
while p ** 2 <= N:
  e = 1
  while n % (p ** e) == 0:
    n //= (p ** e)
    score += 1
    e += 1
  else:
    while n % p == 0:
      n //= p
    p = p + 1 if p == 2 else p + 2
else:
  if n != 1:
    score += 1
print(score)

Submission status: Accepted

Solution code:
N = int(input())
n, p, score = N, 2, 0
while p ** 2 <= N:
  e = 1
  while n % (p ** e) == 0:
    n //= (p ** e)
    score += 1
    e += 1
  else:
    while n % p == 0:
      n //= p
    p += 1
else:
  if n != 1:
    score += 1
print(score)

Submission status: Accepted

Solution code:
N = int(input())

result = 0

n = N
e = 0
while True:
    if n%2 == 0:
        n = n//2
        e += 1
    else:
        m = 1
        while e >= m:
            e -= m
            result += 1
            m += 1
        break

p = 3
e = 0
l = int(N**(1/2))
while True:
    if n%p == 0:
        n = n//p
        e += 1
    else:
        m = 1
        while e >= m:
            e -= m
            result += 1
            m += 1
        e = 0
        p += 2
        if p >= l:
            break

if n != 1 and N != 1:
    result += 1

print(result)

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

s = factorization(n)

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

count,ans = 1,0
for i in range(len(s)):
    while(s[i][1] >= count):
        ans += 1
        s[i][1] -= count
        count += 1
    count = 1

print(ans)

Submission status: Accepted

Solution code:
def primefactorize(n) :
    res = []
    if n%2 == 0 :
        t = 0
        while n%2 == 0 :
            n //= 2
            t += 1
        res.append((2,t))
    for i in range(3, int(n**0.5)+1, 2) :
        if n%i != 0 :
            continue
        t = 0
        while n%i == 0 :
            n //= i
            t += 1
        res.append((i,t))
        if n == 1 :
            break
    if n != 1 :
        res.append((n,1))
    return res


N = int(input())
res = 0
for p, e in primefactorize(N) :
    i = 1
    while e >= i :
        res += 1
        e -= i
        i += 1
print(res)

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:
from math import sqrt
itl = lambda: list(map(float, input().strip().split()))


def solve():
    N = int(input())
    if N == 1:
        return 0

    ans = 0
    for i in range(2, int(sqrt(N)) + 1):
        nxt = 1
        count = 0
        while N % i == 0:
            N //= i
            count += 1
            if count == nxt:
                count = 0
                ans += 1
                nxt += 1
    if N > int(sqrt(N)):
        ans += 1        
    return ans

 
if __name__ == '__main__':
    print(solve())

Submission status: Accepted

Solution code:
import sys
import math


def is_prime(N):
    if N == 1:
        return False
    i = 2
    while i * i <= N:
        if N % i == 0:
            return False
        i += 1
    return True

def prime(N):
    prime = []
    is_prime = []  # 全て素数であると初期化
    for i in range(N):
        if i * i > N:
            break
        is_prime.append(True)
    is_prime[0] = is_prime[1] = False # 0,1は素数ではない
    n = len(is_prime)
    for i in range(2, n):
        if is_prime[i]:
            # iは素数である
            prime.append(i)
            for j in range(2 * i, n, i):
                # iの倍数は素数でない
                is_prime[j] = False
    # N以下の素数を表示
    return prime, n

def main():
    N = int(input())
    if N == 1:
        print(0)
    else:
        if is_prime(N):
            print(1)
        else:
            prime_list, n = prime(N)
            used = []
            prime_exponentiation = []
            count = 0
            for i in range(len(prime_list)):
                now = prime_list[i]
                j = 1
                while now ** j <= N:
                    prime_exponentiation.append(now ** j)
                    j += 1
            prime_exponentiation.sort()
            for i in range(len(prime_exponentiation)):
                now = prime_exponentiation[i]
                if N < now:
                    j = 0
                    while not is_prime(N):
                        if N == 1:
                            break
                        while N % prime_list[j] == 0:
                            N //= prime_list[j]
                        j += 1 
                    break
                if N % now == 0:
                    count += 1
                    used.append(now)
                    N //= now
            if N not in used and N != 1:
                count += 1
            print(count)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
num  = int(input())
#prime number counter
ans = 0
prime_check = [1]*1000100
count = 2
while num>1:
    if prime_check[count]==1: #countが素数だった場合
        tmp = 0
        while num % count == 0: #numの因数にcountが何個含まれているか
            num/= count
            tmp += 1
        tmp2 =1
        while tmp>=tmp2: #ansに加える
            ans += 1
            tmp -= tmp2
            tmp2 += 1
        tmp = count
        while tmp*count<=1e6:
            prime_check[tmp*count] = 0
            tmp += 1
    count += 1
    if(count>1e6):
        num = 0
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
a = []
count =0
count2 = 0
count3 = 0
X=int(N**0.5)
for i in range(X+1):
	if i ==0 or i == 1:
		pass
	elif N % i == 0:

		while N % i==0:
			N /= i
			count2 += 1
		j =1
		count3 = 0
		while count2 - j >=0:
			count2 -= j
			j = j+1
			count3 += 1 
		count += count3 		
		count2 = 0            
if  N >1:
	count +=1
print(count)

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from fractions import Fraction
import math


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

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

count = 0
for key in result.keys():
    v = result[key]
    i = 1
    while(v >= i):
        v -= i
        count += 1
        i += 1
print(count)

Submission status: Accepted

Solution code:
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(n**0.5)+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(int(input()))
b = [1, 3, 6, 10, 15, 21, 28, 36, 43]

ans = 0

if len(a) == 1 and a[0][0] == 1:
  print(0)
  exit()
  
for i in a:
  for j in range(len(b)):
    if i[1] < b[j]:
      ans+=j
      break
    
print(ans)

Submission status: Accepted

Solution code:
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5))+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(int(input()))
b = [1, 3, 6, 10, 15, 21, 28, 36, 43]

ans = 0

if len(a) == 1 and a[0][0] == 1:
  print(0)
  exit()
  
for i in a:
  for j in range(len(b)):
    if i[1] < b[j]:
      ans+=j
      break
    
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
n, p, score = N, 2, 0
while p ** 2 <= N:
  e = 1
  while n >= (p ** e) and n % (p ** e) == 0:
    n //= (p ** e)
    score += 1
    e += 1
  else:
    while n >= p and n % p == 0:
      n //= p
    p += 1
else:
  if n != 1:
    score += 1
print(score)

Submission status: Accepted

Solution code:
import collections
n=int(input())
a=[]
count=0
while n%2==0:
    a.append(2)
    n=n/2
num=3
while num**2<=n+1:
    if n%num==0:
        a.append(num)
        n=n/num
    else:
        num+=2
if n!=1:
    a.append(n)
a=collections.Counter(a)
for i in a.values():
    x=1
    while x<=i:
        count+=1
        i-=x
        x+=1
print(count)

Submission status: Accepted

Solution code:
N = int(input())
N_prime = []

n = N
i = 2
while i <= N**0.5:
    if n%i != 0:
        i += 1
        continue
    
    N_prime.append(i)
    n = n/i
    if n == 1:
        break

if N_prime == [] and N != 1:
    N_prime.append(N)
elif n != 1:
    N_prime.append(int(n))

ct = []
for i in N_prime:
    if i not in ct:
        ct.append(i)
        temp_i = 1
        continue
    temp_i *= i
    if temp_i not in ct:
        ct.append(temp_i)
        temp_i = 1
        continue

print(len(ct))

Submission status: Accepted

Solution code:
from collections import Counter

def get_prime_factors(x):
    out = []
    if x < 1:
        return out
    while not x%2:
        out.append(2)
        x //= 2
    i = 3
    while i*i <= x:
        if not x%i:
            out.append(i)
            x //= i
        else:
            i += 2
    if x != 1:
        out.append(x)
    return out
    
def main():
    n = int(input())
    ans = 0
    primes = Counter(get_prime_factors(n))
    for k, v in primes.items():
        num = 1
        while v >= num:
            v -= num
            num += 1
            ans += 1
    print(ans)
    

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from collections import defaultdict
import math

## 素因数分解実施用
def find(x):
  limit = math.sqrt(x)
  p = 2
  while True:
    if limit < p:
      d[x] += 1
      return 0
    if x%p == 0:
      d[p] += 1
      return find(x//p)
    p += 1
  
## 結果からいくつ取り出せる探す
def extract(y):
  cnt  = 1
  patn = 0
  while True:
    y -= cnt
    patn += 1
    cnt += 1
    ## 判定部分
    if y == 0:
      return patn
    elif y < 0:
      return patn-1

N = int(input())

d = defaultdict(int)

if N == 1:
  print(0)
else:
  _ = find(N)
  cnt = 0
  for i in d.keys():
    cnt += extract(d[i])
  print(cnt)

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
ans = 0
for i in range(2, int(math.sqrt(n)) + 1):
    if n % i == 0:
        cnt = 0
        while n % i == 0:
            cnt += 1
            n //= i
        tmp = 1
        while cnt >= tmp:
            ans += 1
            cnt -= tmp
            tmp += 1
if n != 1:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
from math import floor

arr = []

def factorization(n):
    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])

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

for prime,power in arr:
  ans += floor((-1+(1+8*power)**0.5)/2)
  
print(ans)

Submission status: Accepted

Solution code:
def f(n):
  p=[]
  if n%2==0:
    c=0
    while n%2==0:
      c+=1
      n/=2
    p.append(c)
  for i in range(3,int(n**0.5)+1,2):
    if n%i==0:
      c=0
      while n%i==0:
        c+=1
        n/=i
      p.append(c)
  if n!=1:
    p.append(1)
  return p
  
N=int(input())
p=f(N)
r=0
while p:
  r+=int(((8*p.pop()+1)**0.5-1)/2)
print(r)

Submission status: Accepted

Solution code:
from math import floor

arr = []

def factorization(n):
    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])
    
n = int(input())
if n == 1:
  print(0)
  exit()
  
factorization(n)
ans = 0

for prime,power in arr:
  ans += floor((-1+(1+8*power)**0.5)/2)
  
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
p=[]
r=0

if N%2==0:
  c=0
  while N%2==0:
    N=N//2
    c+=1
  p.append(c)
for i in range(3,int(N**0.5)+1,2):
  if N%i==0:
    c=0
    while N%i==0:
      N=N//i
      c+=1
    p.append(c)
if N!=1:
  p.append(1)
  
while p:
  r+=int(((8*p.pop()+1)**0.5-1)/2)
  
print(r)

Submission status: Accepted

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

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""
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 cnt(n):
    count = 1
    while n>=count:
        n -= count
        count+=1
    return count-1

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

lst = factorization(n)
for i in lst:
    ans += cnt(i[1])

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
def divisor_enu(N):
   l=[]
   for i in range(2,int(N**0.5)+1):
      cnt=0
      if N%i==0:
         while N%i==0:
            cnt+=1
            N//=i
         l.append(cnt)
   if N != 1:
      l.append(1)
   return l
l=divisor_enu(N)
ans=0
for i in l:
   for j in range(1,11):
      if i >= (1+j)*j//2:
         ans+=1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
p=[]
r=0

if N%2==0:
  c=0
  while N%2==0:
    c+=1
    N/=2
  p.append(c)
  
for i in range(3,int(N**0.5)+1,2):
  if N%i==0:
    c=0
    while N%i==0:
      c+=1
      N/=i
    p.append(c)
  
if N!=1:
  p.append(1)
  
for i in p:
  r+=int(((8*i+1)**0.5-1)/2)
print(r)

Submission status: Accepted

Solution code:
N=int(input())
p=[]
r=0

if N%2==0:
  c=0
  while N%2==0:
    c+=1
    N/=2
  p.append([c])
  
i=3
while i<N**0.5+1:
  if N%i==0:
    c=0
    while N%i==0:
      c+=1
      N/=i
    p.append([c])
  i+=2
  
if N!=1:
  p.append([1])
  
for i in range(len(p)):
  j=1
  while p[i][0]>=j:
    p[i][0]-=j
    j+=1
    r+=1
    
print(r)

Submission status: Accepted

Solution code:
N=int(input())
p_list=[]

if N%2==0:
  count=0
  while N%2==0:
    count+=1
    N/=2
  p_list.append([2,count])

i=3
while i<N**0.5+1:
  if N%i==0:
    count=0
    while N%i==0:
      count+=1
      N/=i
    p_list.append([i,count])
  i+=2

if N!=1:
  p_list.append([int(N),1])

result=0
for i in range(len(p_list)):
  j=1
  while p_list[i][1]>=j:
    p_list[i][1]-=j
    j+=1
    result+=1
print(result)

Submission status: Accepted

Solution code:
n = int(input())
x = n
soinsuubunkai = []
for i in range(2,int(x**(1/2))+1):
         if n % i == 0:
                  soinsuu = i
                  zyousuu = 0
                  while n % i == 0:
                           n = n // i
                           zyousuu += 1
                  soinsuubunkai.append([soinsuu,zyousuu])
if n != 1:
         soinsuubunkai.append([n,1])

ans = 0
for i in range(len(soinsuubunkai)):
         for j in range(1,100):
                  soinsuubunkai[i][1] -= j
                  if soinsuubunkai[i][1] < 0:
                           break
                  else:
                           ans += 1

print(ans)

Submission status: Accepted

Solution code:
def factor(n):
    arr = []
    temp = n
    for i in range(2, int(n**0.5)+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 == [] and n != 1:
        arr.append([n, 1])
    return arr

n = int(input())
fact_n = factor(n)
cnt = 0
for _, e in fact_n:
    i = 1
    while i <= e:
        e -= i
        i += 1
    cnt += i - 1
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

a = factorization(int(input()))
b = [1, 3, 6, 10, 15, 21, 28, 36, 43]

ans = 0

if len(a) == 1 and a[0][0] == 1:
  print(0)
  exit()
  
for i in a:
  for j in range(len(b)):
    if i[1] < b[j]:
      ans+=j
      break
    
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

def factorize(n):
    fct = []
    b, e = 2, 0
    while b*b <= n:
        # √n 以上でまだ約数がある場合nが約数になるためそれ以下まで調べればいい
        while n%b == 0:
            n //= b
            e += 1
        if e > 0:
            fct.append((b, e))
        b, e = b+1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

cnt = 0
for p, e in factorize(n):
    i = 1
    while e >= i:
        cnt += 1
        e -= i
        i += 1
print(cnt)

Submission status: Accepted

Solution code:
# D - Div Game

from collections import Counter

n = int(input())

def factorize(n):
    f = Counter()
    d = 2
    while d * d <= n:
        if n % d == 0:
            f[d] += 1
            n //= d
        else:
            d += 1
    if 1 < n:
        f[n] += 1
    return f

f = factorize(n)

s = 0
for d in f:
    # x * (x+1)//2 <= f[d] < (x+1) * (x+2)//2 -> x回割れる
    x = 1
    while x * (x+1)//2 <= f[d]:
        x += 1
    s += x - 1
print(s)

Submission status: Accepted

Solution code:
def factorize(n):
    x = 2
    f = []
    while x**2 <= n:
        c = 0
        if n % x != 0:
            x += 1
            continue
        else:
            while n % x == 0:
                n //= x
                c += 1
            f.append([x, c])
        x += 1

    if n > 1:
        f.append([n, 1])
    return f

n = int(input())
f = factorize(n)
ans = 0
for el in f:
    m = el[1]
    i = 1
    while True:
        if i*(i+1)//2 > m:
            ans += i-1
            break
        i += 1

print(ans)

Submission status: Accepted

Solution code:
def factorint(n):
    d = dict()
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            c = 0
            while n % i == 0:
                c += 1
                n /= i
            d[i] = c
    if n != 1:
        d[n] = 1
    return d

n = int(input())
c = 0
for i, j in factorint(n).items():
    for k in range(j):
        if n % i ** (k + 1) == 0:
            n = n / i ** (k + 1)
            c += 1
        else:
            break
print(c)

Submission status: Accepted

Solution code:
import math
N = int(input())
if N == 1:
    print(0)
    exit()
div = {}
for i in range(2, int(math.sqrt(N))+1):
    while N % i == 0:
        N = N // i
        if i in div:
            div[i] += 1
        else:
            div[i] = 1
    if N == 1:
        break
if N != 1:
    div[N] = 1
ans = 0
for v in div.values():
    i = 1
    while v >= i:
        v -= i
        i += 1
        ans += 1
print(ans)

Submission status: Accepted

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

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

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

    return arr

n = int(input())

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

ar = factorization(n) 
ar_len = len(ar)
ans = 0
for i in range(ar_len):
    jo = ar[i][1]
    ad = 0
    for j in range(1000):
        base = j*(j+1)/2
        if jo < base:
            ad = j-1
            break
    ans = ans + ad

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
n, p, score = N, 2, 0
while p ** 2 <= N:
  e = 1
  while n >= (p ** e) and n % (p ** e) == 0:
    n //= (p ** e)
    score += 1
    e += 1
  else:
    while n >= p and n % p == 0:
      n //= p
    p = p + 1 if p == 2 else p + 2
else:
  if n != 1:
    score += 1
print(score)

Submission status: Accepted

Solution code:
import numpy as np
import sys
#import copy


def xnxn(n=0):
    """
    args:
        int n: a number of lows to read
    example:
        input   1
        retrun  1

        input   1 2 3
        return  [1,2,3]
        input   1 2 3
                4
        return  [[1,2,3],
                [4]]
    """
    if n == 0:
        temp = list(map(int, input().split()))
        if len(temp) == 1:
            return temp[0]
        elif len(temp) > 1:
            return temp
    else:
        temp = [list(map(int, input().split())) for _ in range(n)]
        return temp


def sp_xnxn(n=0):
    """
    args:
        int n: a number of lows to read
    example
        input   1
        retrun  [1]

        input   123
        return  [1,2,3]

        input   123
                4
        return  [[1,2,3],
                [4]]
    """
    if n == 0:
        return [int(k) for k in xsxs()]
    else:
        return [[int(k) for k in xsxs()] for _ in range(n)]


def xsxs(n=0):
    """
    args:
        int n: a number of lows to read
    example:
        input   AA
        retrun  AA

        input   A BBB CC
        return  ["A","BBB","CC"]

        input   A BB CCC
                D
        return  [["A","BBB","CC"],
                ["D"]]
    """
    if n == 0:
        temp = list(input().split())
        if len(temp) == 1:
            return temp[0]
        elif len(temp) > 1:
            return temp
    else:
        return [list(input().split()) for _ in range(n)]


def sp_xsxs(n=0):
    """
    args:
        int n: a number of lows to read
        example:
            input   A
            retrun  ["A"]

            input   ABC
            return  ["A","B","C"]

            input   ABC
                    D
            return  [["A","B","C"],
                    ["D"]]
    """
    if n == 0:
        return [s for s in xsxs()]
    else:
        return [[s for s in xsxs()] for _ in range(n)]


def p_num(a):

    if a == 1:
        return [[a, 1]]
    else:
        tmp = 2
        ans = []
        while tmp < np.sqrt(a) + 1:
            n = 0
            p = [tmp]

            while a % tmp == 0:
                a = int(a / tmp)
                # p.append(tmp)
                n += 1
                c = 1
            if n != 0:
                p.append(n)
                ans.append(p)
            tmp += 1
            c = 0
        if c == 0 and a != 1:
            ans.append([a, 1])
        return ans


def p_num_edit(n):
    tmp = n
    ans = []
    for i in range(2, int(np.sqrt(n)) + 1):
        cnt = 0
        while tmp % i == 0:
            cnt += 1
            tmp = int(tmp / i)
        if cnt > 0:
            ans.append([i, cnt])
    if tmp != 1:
        ans.append([tmp, 1])
    if ans == []:
        ans.append([n, 1])
    return ans


n = xnxn()

if n == 1:
    print(0)
    sys.exit()
else:
    a = p_num_edit(n)
    c = 0
    for num in a:
        i = 1
        while num[1] - i > -1:
            num[1] -= i
            i += 1
            c += 1
    print(c)

Submission status: Accepted

Solution code:
import math
def isPrime(n):
  if n<2:
    return False
  if n == 2:
    return True
  if n % 2 == 0:
    return False
  m = math.floor(math.sqrt(n))
  for p in range(3,n+1,2):
      if n % p == 0:
        return False
      if p > m:
        # 素数がnの平方根を超えたら終了
        break
  return True
N=int(input())
if isPrime(N):
    print(1)
else:
    n=N
    count=0
    s=0
    S=0
    for i in range(2,N+1):
        if n<i:
            break
        s=1
        count=0
        while 1:
            if n%i!=0:
                break
            count+=1
            n=int(n/i)
        while 1:
            if count<int(s*(s+1)/2):
                S+=s-1
                break
            s+=1
        if i==10000:
            if isPrime(n):
                S+=1
                break
    print(S)

Submission status: Accepted

Solution code:
N = int(input())
n, p, score = N, 2, 0
while p ** 2 <= N:
  e = 1
  # print(n, p, e)
  while n >= (p ** e) and n % (p ** e) == 0:
    n = n // (p ** e)
    score += 1
    e += 1
  else:
    while n >= p and n % p == 0:
      n = n // p
    p = p + 1 if p == 2 else p + 2
else:
  if n != 1:
    score += 1
print(score)