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 sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left
from functools import reduce
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7

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

def main():
    n = i_input()

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

    tmp = prime_factorize(n)

    if len(tmp) == 1:
        print(1)
        exit()

    count = 0

    counter_tmp = Counter(tmp)

    a_list = []

    for k, v in counter_tmp.items():
        while v >= 1:
            a_list.append(k**v)
            v -= 1

    a_list.sort()

    for a in a_list:
        if n % a != 0:
            continue
        n /= a

        count += 1

    print(count)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
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

n = int(input())
a = sorted(divisor(n))
cnt = 0
for i in range(1, len(a)):
    b = prime_decomposition(a[i])
    if len(list(set(b))) == 1:
        if n % a[i] == 0:
            n //= a[i]
            cnt += 1
print(cnt)

Submission status: Accepted

Solution code:

def prime_factorization(number):
    n = number
    i = 2
    factor = {}
    while i * i <= n:
        while n % i == 0:
            if i in factor:
                factor[i] += 1
            else:
                factor.update({i : 1})
            n //= i
        i += 1
    if n > 1 or not factor:
        if n in factor:
            factor[n] += 1
        else:
            factor.update({n : 1})
    return factor

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

    if n == 1:
        print(0)
        return

    prime_factor = prime_factorization(n)
    p = len(prime_factor)
    prime_count = [0 for _ in range(p)]
    for i, x in enumerate(prime_factor.items()):
        prime_count[i] = x[1]

    ans = 0
    for i in range(p):
        need = 1
        while prime_count[i] >= need:
            prime_count[i] -= need
            ans += 1
            need += 1

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from collections import deque
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)
    a.sort()
    return a

q = deque()
prime = prime_factorize(N)
for x in prime:
  q.append(x)

#print(q)
count = 0
done = []
while N != 1:
  break_flag = False
  if len(q) == 0:
    break
  x = q.popleft()
  #print(N, q, x)
  if x == 1:
    continue
  
  if x in done:
    mul = x
    while mul in done:
      if len(q) == 0:
        break_flag = True
        break
      pop = q.popleft()
      #print(x, pop)
      if x != pop:
        #print(x, pop, q)
        q.appendleft(pop)
        #print(q)
        break_flag = True
        break
      mul *= pop
    x = mul
    if break_flag:
      continue
  
  if N % x == 0:
    N = N // x
    count += 1
    done.append(x)

print(count)
#print(done)

Submission status: Accepted

Solution code:
import collections
n = int(input())
a = []
while n % 2 == 0:
    a.append(2)
    n //= 2
f = 3
while f * f <= n:
    if n % f == 0:
        a.append(f)
        n //= f
    else:
        f += 2
if n != 1:
    a.append(n)
c = collections.Counter(a)
l = list(c.values())

def func(n):
    i = 2
    counter = 1
    while counter <= n:
        counter += i
        i += 1
    return i-2

print(sum(map(func, l)))

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

def cnt(arr):
    c = 0
    n = arr[1]
    i = 1
    while True:
        if 0 <= n - i:
            c += 1
            n -= i
            i += 1
        else:
            break

    return c

arr = factorization(n)

ans = 0
if n != 1:
    for i in arr:
        ans += cnt(i)

print(ans)

Submission status: Accepted

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

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

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

    return arr

def main():
    N = int(input())
    z_list=[]
    arr = fanction(N)
    k=0
    for i in range(len(arr)):
        p=arr[i][1]
        for j in range(1,arr[i][1]+1):
            if p>=j:
                z = arr[i][0]
                z_list.append(z)
                k+=1
                p-=j
    if N==1:
        k=0
    print(k)

main()

Submission status: Accepted

Solution code:
n = int(input())

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

import collections
c = collections.Counter(prime_factorize(n))

ret = 0
for k, num in c.items():
    cnt = 1
    while True:
        num -= cnt
        if num >= 0:
            ret += 1
        else:
            break
        cnt += 1

print(ret)

Submission status: Accepted

Solution code:
import math

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


primes = prime_factorize(n)

d = {}
for p in primes:
    if p in d:
        d[p] += 1
    else:
        d[p] = 1

ans = 0
for k, v in d.items():
    wp = 2
    d[k] -= 1
    ans += 1
    if wp == 2 and d[k] == 1:
        d[k] = 0
        continue
    while d[k] != 0:
        if wp * 2 + 1 <= d[k]:
            d[k] -= wp
            wp += 1
            ans += 1
        else:
            d[k] = 0
            ans += 1

print(ans)

Submission status: Accepted

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

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

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

    return arr
n=int(input())
ans=0
insu=factorization(n)

if n==1:
    print(0)
else:
    for i in range(len(insu)):
        ans+=math.floor((-1+math.sqrt(1+8*insu[i][1]))/2)
    
    print(ans)

Submission status: Accepted

Solution code:
import math
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
def ff(x):
    temp=(-1+math.sqrt(1+8*x))/2
    return int(temp)
s=0
x=factorize(n)
for i in x:
    s+=ff(i[1])
    
    
if(n==1):
    print(0)
else:
    print(s)

Submission status: Accepted

Solution code:
from collections import defaultdict
def prime_factorization(n):
  if n==1:
    return {}
  res=defaultdict(int)
  for f in range(2,n):
    if f*f>n:
      break
    while n%f==0:
      n=n//f
      res[f]+=1
  if n>1:
    res[n]+=1
  return res

def cnt_ope(n):
  return min(k for k in range(n+1) if (k+2)*(k+1)//2>n)

def main():
  fac=prime_factorization(int(input()))
  return sum(cnt_ope(cnt) for cnt in fac.values())
print(main())

Submission status: Accepted

Solution code:
def pf(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 f(x):
    N = 2
    while 1:
        A = N * (N + 1) / 2
        if x < A:
            return N - 1
        N += 1

N = int(input())

div = pf(N)
exp = []

begin =-1
for i in range(len(div)):
    A = div[i]

    if i == len(div) - 1:
        exp.append(i - begin)
        break

    if div[i + 1] != A:
        exp.append(i - begin)
        begin = i

ans = 0

for i in exp:
    ans += f(i)

print(ans)

Submission status: Accepted

Solution code:
import collections
import math
from statistics import mode
N = int(input())
c = 0
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
e = []
for i in set(prime_factorize(N)):
	e.append(prime_factorize(N).count(i))

for i in e:
	for j in range(math.ceil(math.sqrt(2*i))+1):
		if (j+1)*(j+2)//2 > i:
			break
		c += 1
	ans += c
	c = 0
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 is_prime(n):
    if n == 1: return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True
if is_prime(N):
    print(1)
elif N == 1:
    print(0)
else:
    insu = factorization(N)
    ans = 0
    for i,j in insu:
        p = 1
        while True:
            j -= p
            if j >= 0:
                N = N // (i**p)
                ans += 1
            else:
                break
            p += 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())

L = []
L = factorization(n)
c = 0
#print(L)
if L[0][0] != 1:
    for i in range(len(L)):
        a = 1
        while L[i][1]>=a:
            L[i][1] = L[i][1]-a
            a += 1
            c += 1

print(c)

Submission status: Accepted

Solution code:
import math

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

def saidai(n):
    ans = int(math.sqrt(2 * n)) - 1
    while 2 * n >= (ans + 1) * (ans + 2):
        ans += 1
    return(ans)

N = int(input())
fac = factorization(N)
index = []
for i in fac:
    index.append(i[1])
ans = 0
for i in index:
    ans += saidai(i)
if N == 1:
    print(0)
else:
    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


import collections

N = int(input())
c = collections.Counter(prime_factorize(N))
ans = 0

for p, n in c.items():
    for i in range(1, 10000000):
        if n < i:
            break
        ans += 1
        n -= i

print(ans)

Submission status: Accepted

Solution code:
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()
N=int(input())
#N=10**18

lst=defaultdict(int)
lst2=[]
lst3=[]
for i in range(2,int(N**.5)+100):
    if N%i==0:
        lst2.append(i)
        lst3.append(N//i)
lst3.reverse()
lst2+=lst3

for i in lst2+[N]:
    while N>1 and N%i==0:
        N//=i
        lst[i]+=1
c=0
#print(lst)
for s in lst:
    l=lst[s]
    i=1
    while l>=i:
        l-=i
        c+=1
        i+=1
print(c)

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
x = factorize(N)
counter = 0
for item in x:
  if item[1]==1:
    counter += 1
  else:
    temp = item[1]
    i = 1
    while temp > 0:
      temp -= i
      i += 1
      if temp >= 0:
        counter += 1
print(counter)

Submission status: Accepted

Solution code:
from math import sqrt
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 hoge(c):
    return int((-1+sqrt(1+8*c))/2)
n = int(input())
a = prime_factorize(n)
b = set(a)
print(sum([hoge(a.count(e)) for e in b]))

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())
insu = prime_factorize(N)

insu_num = []
ans = 0

while len(insu) != 0:
    num = insu.count(insu[0])
    insu_num.append(num)
    insu = insu[num:]

for num in insu_num:
    p = 1
    while True:
        num -= p
        if num>=0:
            ans += 1
        else:
            break 
        p += 1   

print(ans)

Submission status: Accepted

Solution code:
import math 
def primeFactors(n): 
    a=[]  
    while n % 2 == 0: 
        a.append(2) 
        n = n // 2
    for i in range(3,int(math.sqrt(n))+1,2):  
        while n % i== 0: 
            a.append(i) 
            n = n // i  
    if n > 2: 
        a.append(n) 
    return a    
import math as m
n=int(input())
x=0
i=0
a=list(set(primeFactors(n)))
ans=0
p=1
flag=False
while(i<len(a)):
    j=a[i]
    x=a[i]
    while(True):
        if n%j==0:  
            ans+=1 
            n//=j
            j*=x
        else:
            break
        if p==n:
            flag=True
            break
    if(flag):break    
    i+=1         
print(ans)

Submission status: Accepted

Solution code:
import collections

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

N = int(input())
A = prime_factorize(N)

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

cnt = 0
B = []
a,b = 0,0
for i in range(10**3):
    a += 1
    b += a
    B.append(b)

ls = collections.Counter(A)

for k in ls.values():
    i = 0
    while k >= B[i]:
        i +=1
    cnt += i
print(cnt)

Submission status: Accepted

Solution code:
import collections

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

n = int(input())
a = prime_factorize(n)
c = collections.Counter(a)
num = 0
for v in c.values():
    for i in range(1,n):
        v -= i
        if v >=0:
            num +=1
        else:break

print(num)

Submission status: Accepted

Solution code:
import sys, io, os, re
import bisect
from pprint import pprint
from math import sin, cos, pi, radians, sqrt, floor
from copy import copy, deepcopy
from collections import deque
from fractions import gcd
from functools import reduce

def array1(n): return [0] * n
def array2(n, m): return [[0] * m for x in range(n)]
def array3(n, m, l): return [[[0] * l for y in xrange(m)] for x in xrange(n)]

N = int(sys.stdin.readline().strip())

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

e = factorization(N)
#print(e)

ans = 0
for p, q in e:
    c = 0
    j = 1
    while c+j <= q:
        c += j
        j += 1

    ans += (j-1)
    #print(j-1)

print(ans)

Submission status: Accepted

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

N = int(input())
from collections import Counter
c = Counter(prime_decomposition(N))
ans = 0
for i in c:
    k = 1
    while(c[i]-k>=0):
        if c[i]>0:
           c[i] -= k
           ans += 1
           k += 1
print(ans)

Submission status: Accepted

Solution code:
import math
n=int(input())
p=2
c=0
curr=0
while n%p==0:
    curr+=1
    n//=p
j=0
j=(math.sqrt(1+8*curr)-1)//2
c+=int(j)
#print(j)
for i in range (3,int(math.sqrt(n))+1,2):
    p=i
    curr=0
    while n%p==0:
        curr+=1
        n//=p
    j=0
    j=(math.sqrt(1+8*curr)-1)//2
    c+=int(j)
    #print(j)
if n>2:
    c+=1
print(c)

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

data = factorize(N)

ans = 0
j = 1
for i in range(len(data)):
    k = data[i][1]
    while k - j >= 0:
        k -= j
        ans += 1
        j += 1
    j = 1

print(ans)

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


count = 0

arr = factorization(N)

for a in arr:
    now = a[0]
    now_z = a[0]
    while True:
        if N % now_z == 0:
            count += 1
            N //= now_z
            now_z *= now
        else:
            break
print(count)

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(cnt)
    if temp!=1:
        arr.append(1)
    if arr==[]:
        arr.append(1)
    return arr

def calc(n):
    val = 1
    count = 0
    for i in range(2,100000):
        count += 1
        val = val + i
        if val > n:
            return count

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

arr = factorization(N)

ans = 0 
for val in arr:
    ans += calc(val)
 
print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)


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

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

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

    return arr


def main(input, print):
    n = int(input())
    ans = 0
    ret = factorization(n)
    if ret[0][0] == 1:
        print('0')
        return
    for i in range(len(ret)):
        cnt = 0
        while ret[i][1] > 0:
            cnt += 1
            ret[i][1] -= cnt
            ans += 1
        if ret[i][1] < 0:
            ans -= 1

    print(ans)


if __name__ == '__main__':
    main(sys.stdin.readline, print)

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
def calc_n_value(i):
  return(int((
    ((i*8+1)**0.5-1)*0.5
  )//1))

n=int(input())
fcts = prime_factorize(n)
tmp = Counter(fcts).values()
out=0
for _ in tmp:
  out += calc_n_value(_)
print(out)

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

comb = factorization(n)
lst = []
for i in comb:
    for j in range(i[1]):
        lst.append(i[0]**(j+1))

lst.sort()
ans = 0
for i in lst:
    if n == 1:
        break
    elif n > 1:
        if n%i == 0:
            n = n/i
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
import numpy as np
from math import sqrt

def sieve(n):
    S = [True] * (n+1)
    S[0] = S[1] = False
    i = 2
    while i * i <= n:
        if S[i]:
            k = i * i
            while k <= n:
                S[k] = False
                k += i
        i += 1
    return S

  
def arrayF(n): 
    F=[0]*(n+1) 
    i=2 
    while i*i<=n:
        if F[i] == 0: 
            k=i*i
            while k <= n:
                if F[k] == 0:
                    F[k] = i
                k += i
        i += 1 
    return F


def factorization(x, F): 
    primeFactors = [] 
    while (F[x] > 0):
        primeFactors.append(F[x])
        x //= F[x] 
    primeFactors.append(x) 
    return primeFactors


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

rt = int(sqrt(n)+1)
S = sieve(rt)
primes = np.arange(rt+1)[S]

for i in primes:
    if n % i == 0:
        break
else:
    print(1)  # n is prime
    exit(0)

m = n
facts = {}
for i in primes:
    if m % i == 0:
        facts[i] = 0
        while m % i == 0:
            m //= i
            facts[i] += 1
if m != 1:
    facts[m] = 1

for k in facts:
    v = facts[k]
    if v < 3:
        facts[k] = 1
    elif v < 6:
        facts[k] = 2
    elif v < 10:
        facts[k] = 3
    elif v < 15:
        facts[k] = 4
    elif v < 21:
        facts[k] = 5
    elif v < 28:
        facts[k] = 6
    elif v < 36:
        facts[k] = 7
    elif v < 45:
        facts[k] = 8
    elif v < 55:
        facts[k] = 9
    elif v < 66:
        facts[k] = 10
print(sum(facts.values()))

Submission status: Accepted

Solution code:
N=int(input())
if N==1:
  print(0)
  exit()
# https://qiita.com/snow67675476/items/e87ddb9285e27ea555f8
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

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

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

    return arr

S = factorization(N)
ans=0
start=1
for i in S:
  U=0
  for j in range(1,i[1]+1):
    U+=j
    ans+=1
    if U>i[1]:
      ans-=1
      break
print(ans)

Submission status: Accepted

Solution code:
import math
#試し割法
def trial_division(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 = trial_division(int(input()))

key = []
val = []

dupli = set()
for i in range(len(N)):
    if (not N[i] in dupli):
        key.append(N[i])
        dupli.add(N[i])

for i in range(len(key)):
    val.append(N.count(key[i]))


def maxvalue(n):
    if (n < 3):
        return 1
    elif (n < 6):
        return 2
    elif (n < 10):
        return 3
    elif (n < 15):
        return 4
    elif (n < 21):
        return 5
    elif (n < 28):
        return 6
    elif (n < 36):
        return 7
    elif (n < 45):
        return 8
    elif (n < 55):
        return 9
    elif (n < 66):
        return 10

sum = 0
for i in range(len(key)):
    sum += maxvalue(val[i])
    # count = 1
    # length = val[i]
    # if (length < 3):
    #     sum += 1
    # else:
    #     while(length > 0):
    #         sum += 1
    #         length -= count
    #         if (length == count):
    #             break
    #         count += 1

print(sum)

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 itertools
import bisect
n = int(input())
if n == 1:
    print(0)
    exit()
arr = list(range(1, 50))
arr_sum = list(itertools.accumulate(arr))
ans = 0
for i in factorization(n):
    if i[1] in arr_sum:
        ans += (bisect.bisect_left(arr_sum, i[1])+1)
    else:
        ans += bisect.bisect_left(arr_sum, i[1])
print(ans)

Submission status: Accepted

Solution code:
import collections

N = int(input())

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct

yaku = factorize(N)
c = collections.Counter(yaku)

count = 0
for i in c.values():
    hoge = 1
    for j in range(2,10*5):
        if hoge <= i:
            hoge += j
            count += 1
        else:
            break

print(count)

Submission status: Accepted

Solution code:
import math
import sys
N = int(input())
temp = N
arr = []
if N == 1:
  print('0')
  sys.exit()
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])
sum = 0
for i in range(len(arr)):
  p = arr[i][1]
  q = 1
  while p > 0:
    p -= q
    if p >= 0:
      sum += 1
      q += 1
print(sum)

Submission status: Accepted

Solution code:
import math 
import itertools



def factorize(n):
   
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct


def resolve(N):

    ans = 0
    factorize_N = factorize(N)

    if not factorize_N:
        print(0)
        return

    for key, value in itertools.groupby(factorize_N):
        count = len(list(value))
        for i in range(1, count + 1):
            count -= i
            if (count < 0):
                break
            ans += 1

    print(ans)


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

Submission status: Accepted

Solution code:
import math
import sys

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

N = int(input())
ans = factorization(N)
x = len(ans)
time = 0
count = 2
s = 1

if ans[0][0] == 1 :
    print(0)
    sys.exit()

for i in range(x) :
    while ans[i][1] >= s :
        time += 1
        s += count
        count += 1
    s = 1
    count = 2

print(time)