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 
import numpy as np   
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


readline = sys.stdin.readline 

N = int(input())

fact = prime_factorize(N)
collections_fact = collections.Counter(fact)

pre_z = 0
duplicate_num = 1
counter = 0
for z in fact:
    if z != pre_z:
        N /= z
        counter += 1
        duplicate_num = 1
    else:
        duplicate_num += 1
        duplicate_z = z**duplicate_num 
        if N % duplicate_z == 0:
            N /= duplicate_z
            counter += 1
    pre_z = z 

print(counter)

Submission status: Accepted

Solution code:
N = int(input())
A = [0 for k in range(int(N**0.5)+1)]

#N=1の処理
if N == 1:
  print(0)
  exit()
ans = 0


prime = [2]
for k in range(3, len(A), 2):
  if A[k] == 0:
    prime.append(k)
    for j in range(k, len(A), k):
      A[j] = 1
for p in prime:
  if N%p == 0:
    break
else: 
  print(1)
  exit()

use = []
for p in prime:
  if p > N:
    break
  if N%p == 0:
    ans += 1
    use.append(p)
    N = N // p
  np = p * p
  while N % np == 0:
    ans += 1
    N = N // np
    np = np * p
    
for u in use:
  while N % u == 0:
    N = N // u
if N > 1:
  ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = [0 for k in range(int(N**0.5)+1)]

#N=1の処理
if N == 1:
  print(0)
  exit()
ans = 0


prime = [2]
for k in range(3, len(A), 2):
  if A[k] == 0:
    prime.append(k)
    for j in range(k, len(A), k):
      A[j] = 1
for p in prime:
  if N%p == 0:
    break
else: 
  print(1)
  exit()

used = []
use = []
#print(prime)
for p in prime:
  if p > N:
    break
  if N%p == 0:
    #print(p)
    ans += 1
    used.append(p)
    use.append(p)
    N = N // p
  np = p * p
  while N % np == 0:
    #print(np)
    ans += 1
    used.append(np)
    N = N // np
    np = np * p
    
#print(use)
#print(N)

for u in used:
  if N % u == 0:
    N = N // u
for u in used:
  if N % u == 0:
    N = N // u
for u in used:
  if N % u == 0:
    N = N // u
if N > 1:
  ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

d = 2
while d * d <= N:
  e = 0
  while N % d == 0:
    e += 1
    N //= d
  i = 1
  while i <= e:
    ans += 1
    e -= i
    i += 1
  d += 1

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

Submission status: Accepted

Solution code:
import bisect
import math
import sys
 
jd = []
for i in range(1,50) :
  jd.append((1+i)*i//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

n = int(input())

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

p = factorization(n)

ans = 0
for i in p :
  c = i[1]
  ans += bisect.bisect_right(jd, c)
  
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 not arr:
        arr.append([n, 1])

    return arr


N = int(input())
p = factorization(N)
count = 0
for x in p:
    if N == 1:
        break
    for j in range(1, x[1] + 1):
        if N % (x[0] ** j) == 0:
            N /= x[0] ** j
            count += 1
        else:
            break
print(count)

Submission status: Accepted

Solution code:
import collections
N = int(input())
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
c = collections.Counter(pf(N))
ans = 0
for i in c.keys():
    for j in range(1,40):
        if j*(j+1)/2 <= c[i] < (j+1)*(j+2)/2:
            ans += j
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
a=[]
while(n%2==0):
    a.append(2)
    n=n/2
for i in range(3,int((n**0.5))+1,2):
    while(n%i==0):
        a.append(i)
        n=n/i
if(n>2):
    a.append(int(n))
l=list(set(a))
c=1
t=0
for i in range(len(l)):
    while(0.5*(c*(c+1))<=a.count(l[i])):
        t=t+1
        c=c+1
    c=1
print(t)

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

ans = 0

n = int(input())
for i,j in factorization(n):
  if i == 1:
    continue
  for k in range(int((2 * j)**0.5), 0 ,-1):
    if k*(k+1) <= 2 * j and (k+1)*(k+2) >= 2 * j:
      ans += k
      break
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
NN = N
L = []
p = 2
while p <= int(N**0.5):
    if N % p == 0:
        L.append([p])
        N /= p
        while N % p == 0:
            L[-1].append(p)
            N /= p
    p += 1
if N != 1:
    L.append([int(N)])
ans = 0
for i in range(len(L)):
    for j in range(1,len(L[i])+1):
        if NN % (L[i][0])**j == 0:
            NN = NN // (L[i][0])**j
            ans += 1
        else:
            break
print(ans)

Submission status: Accepted

Solution code:
from itertools import groupby
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

from itertools import groupby
ans = 0
p = prime_decomposition(n)
for k,g in groupby(p):
  gn = len(list(g))
  for i in range(1,1000000):
    gn -= i
    if gn >= 0:
      ans += 1
    else:
      break
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

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

Submission status: Accepted

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





n=int(input(""))
s=0
if(n!=1):
    

    

    t=0
    lista=prime(n)
    #print(lista)
    
    c=lista[0]
    for i in lista:
        if (c==i):
            t+=1
        else:
            k=1
            while(t>=k):
                t-=k
                s+=1
                k+=1
            t=1
            c=i


    k=1
    while(t>=k):
        t-=k
        s+=1
        k+=1
        


            
        
        
    
    


print(s)

Submission status: Accepted

Solution code:
import sys
import collections


#https://python.ms/factorize/
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 main():
    input = sys.stdin.readline
    change_to_count_list = []
    for i in range(62):
        if i == 0:
            change_to_count_list.append(1)
        else:
            change_to_count_list.append(change_to_count_list[i-1]+i+1)
    N = int(input())
    yakusu_list = factorize(N)
    c = collections.Counter(yakusu_list)
    result = 0
    for count in c.values():
        for i in range(62):
            if change_to_count_list[i] == count:
                if i == 0:
                    result += 1
                    break
                else:
                    result += i + 1
                    break

            elif change_to_count_list[i-1] < count and change_to_count_list[i] > count:
                result += i
                break
    print(result)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def f(n):
    res = 0
    s = 0
    for i in range(1,n+1):
        s += i
        if s <=n:
            res = i
        else:
            break
    return res
n = int(input())
p =2
ans = 0
while p*p <= n:
    e = 0
    while n%p == 0:
        e += 1
        n//=p
    ans += f(e)
    p +=1
if n >1:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
def this (k):
  a=int(pow(1+8*k,0.5))
  return (a-1)//2
from collections import Counter
c=Counter([])
n=int(input())
for i in range(2,int(pow(n,0.5))+1):
  if n%i==0:
    sumi=0
    while n%i==0:
      n=n//i
      sumi+=1
    c[i]=sumi
if n!=1:
  c[n]=1
ans=0
for item in c.values():
  ans+=this(item)
print (ans)

Submission status: Accepted

Solution code:
def prime(n):
    nums = [True]*n
    primes = []
    for i in range(2,n):
        if nums[i]:
            primes.append(i)
            for j in range(2*i,n,i):
                nums[j] = False
    return primes

def prime_fac(n):
    fac = {}
    primes = prime(int(n**0.5)+1)
    for p in primes:
        while n%p==0:
            fac[p] = fac.get(p,0)+1
            n//=p
    if n > 1:
        fac[n] = 1
    return fac

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

    ans = 0
    for i in fac.values():
        ct = 1
        while i >= ct*(ct+1)//2:
            ct += 1
            ans+=1
    print(ans)
main()

Submission status: Accepted

Solution code:
import math
from collections import Counter

N = int(input())

max_itr = math.ceil(math.sqrt(N))

factors = []
while True:
    for i in range(2, max_itr):
        if N%i == 0:
            N = N // i
            factors.append(i)
            break
    else:
        if N != 1:
            factors.append(N)
        break

c = Counter(factors)
f = lambda x: math.floor((math.sqrt(8*x+1) - 1)/2)
print(sum(f(v) for v in c.values()))

Submission status: Accepted

Solution code:
import math
a=int(input())
ans=0
for i in range(1,int(math.sqrt(a)),1):
  if a%i==0 and not i==1:
    cnt=0
    while a%i==0:
      cnt+=1
      a=a/i
    ans+=(math.sqrt(2*cnt+0.25)-0.5)//1
if not a==1:
  print(int(ans+1))
else:
  print(int(ans))

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())
    primes = Counter(get_prime_factors(n))
    ans = 0
    for k, v in primes.items():
        num = 1
        while v >= num:
            v -= num
            ans += 1
            num += 1
    print(ans)
    

if __name__ == "__main__":
    main()

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 != 0 and temp != 1:
        arr.append([temp, 1])

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

    return arr

arr = factorization(N)
ans = 0
for i in range(len(arr)):
    for j in range(arr[i][1]):
        if j / 2 * (j + 3) + 1 <= arr[i][1] < (j + 1) / 2 * (j + 4) + 1:
            ans += j + 1
            break

print(ans)

Submission status: Accepted

Solution code:
from collections import Counter

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


n = int(input())

A = list(Counter(prime_factorization(n)).values())

ans = 0
e = 1
while True:
    cnt = 0
    for i in range(len(A)):
        if A[i] >= e:
            A[i] -= e
            cnt += 1
    if cnt == 0:
        break
    ans += cnt
    e += 1

print(ans)

Submission status: Accepted

Solution code:
from collections import Counter
n = int(input())
ans = 0

dp = []
cl = []
n1 = n
if n == 1:
    ans = 0
else:
    for i in range(2, int(n**0.5)+1):
        if n%i == 0:
            cl.append(i)
            while n%i == 0:
                n = n/i
                dp.append(i)
        if n == 1:
            break
    if n != 1:
        ans = 1

c = Counter(dp)

for i in cl:
    cnt = 1
    while c[i] >= cnt:
        c[i] -= cnt
        ans += 1
        cnt += 1
        
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict
n=int(input())
d=defaultdict(int)

while n%2==0:
  n//=2
  d[2]+=1
f=3

while f*f<=n:
  if n%f==0:
    n//=f
    d[f]+=1
  else:
    f+=2
if n!=1:
  d[n]+=1
c=0
for k,v in d.items():
  i=1
  while v>=i:
    v-=i
    c+=1
    i+=1
print(c)

Submission status: Accepted

Solution code:
import math

n = int(input())

prm_dict = {}
for i in range(2, math.floor(math.sqrt(n))):
    while n % i == 0:
        n //= i
        if i not in prm_dict.keys():
            prm_dict[i] = 0
        prm_dict[i] += 1
    if n == 1:
        break
if n != 1:
    prm_dict[n] = 1

ans = 0
for prm in prm_dict.keys():
    prm_cnt = prm_dict[prm]
    i = 1
    while prm_cnt >= i:
        prm_cnt -= i
        i += 1
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
import math
Max = 1000001
prime = Max*[1]
def sieve():
	prime[0] = 0
	prime[1] = 0
	for i in range(2,Max):
		if prime[i]==1:				
			j = 2*i
			while j < Max:
				prime[j] = 0
				j += i

def Howmany(x):
	res = 1
	while x>=res:
		x -= res
		res += 1
	return res-1

N = int(input())
sieve()
ans = 0
R = int(math.sqrt(N))
for i in range(2, R):
	if prime[i]==1 and N%i==0:
		cnt = 0
		while N%i==0:
			N //= i
			cnt+=1
		ans += Howmany(cnt)

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

Submission status: Accepted

Solution code:
import numpy as np
import math
from decimal import *
#from numba import njit

def getVar():
    return map(int, input().split())
def getArray():
    return list(map(int, input().split()))
def getNumpy():
    return np.array(list(map(int, input().split())), dtype='int64')

def factorization(n):
    d = {}
    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
            d.update({i: cnt})

    if temp!=1:
        d.update({temp: 1})

    if d==[]:
        d.update({n:1})

    return d

def main():
    N = int(input())
    d = factorization(N)
    count = 0

    for v in d.values():
        i = 1
        while(v >= i):
            v -= i
            i += 1
            count += 1
        
    print(count)


main()

Submission status: Accepted

Solution code:
# -*- codinf: utf-8 -*-
import math
N = int(input())
# 素因数分解
n = N
i = 2
f = {} # keyが素因数、valueが素因数の数
while i * i <= n:
  count = 0
  while n % i == 0:
    count += 1
    f[i] = count
    n /= i
  i += 1
if 1 < n:
  f[n] = 1

if len(f) == 0:
  print(0)
  exit()

count = 0
for v in f.values():
  d = 1
  while v > 0:
    v -= d
    if v >= 0:
      count += 1
    d += 1
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([i, cnt])

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

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

    return arr

def countstep(a):
    i = 0
    while a>=i+1:
        i += 1
        a -= i
    return i

def main():
    n = int(input())
    a = factorization(n)
    
    if n==1:
        print(0)
        return
    
    if a[0][0]==0:
        print(0)
    else:
        count = 0
        for i in range(len(a)):
            count += countstep(a[i][1])
        print(count)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

s=dict(Counter(prime_factorize(n)))
#print(s)
sum_ans=0
for i in s.values():
  
  if i==1:
    sum_ans+=1
    
  else:
    k=1
    while i>0:
      i-=k
      k+=1
      #print(i)
      if i<0:
        break
      sum_ans+=1
      
print(sum_ans)

Submission status: Accepted

Solution code:
n = int(input())

def factrization(m):
    temp = m
    ans = 0
    for i in range(2, int(n**0.5) + 1):
        if temp % i == 0:
            cnt = 0
            e = 1
            while temp % i == 0:
                cnt += 1
                temp //= i
                if cnt == e:
                    e += 1
                    cnt = 0
                    ans += 1

    if temp != 1:
        ans += 1

    return ans

print(factrization(n))

Submission status: Accepted

Solution code:
# まあできるだけ小さい単位で割ったほうが嬉しいので、素因数分解して因数で割ったほうがうれしい
# ただし以前つかったやつは使えないので、x^1, x^2, x^3... に限定されてしまう
# -> 冪数を増やしていく感じでいけそう

n = int(input())


def div_primes(x):
    ret = {}
    for i in range(2, int(x**0.5) + 1):
        tmp = 0
        while x % i == 0:
            tmp += 1
            x /= i
        if tmp > 0:
            ret[i] = tmp

    if x > 1:
        ret[x] = 1
    return ret


primes = div_primes(n)
ans = 0
for k, v in primes.items():
    j = 1
    while v - j >= 0:
        v -= j
        j += 1
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from collections import defaultdict

def prime(n: int) -> defaultdict:
    f, i = defaultdict(int), 2
    while i * i <= n:
        while n % i == 0: f[i] += 1; n //= i
        i += 1
    if n != 1: f[n] = 1
    return f

def solve(n: int) -> int:
    if n == 1: return 1
    r, l = n, 0
    while (r - l) > 1:
        m = (l + r) // 2
        if m * (m + 1) // 2 <= n: l = m
        else: r = m
    return l

n, res = int(input()), 0
for k, v in prime(n).items(): res += solve(v)
print(res)

Submission status: Accepted

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

i=2
l=0
k=int(math.sqrt(n))+1
s=[0]*k
while i<k:
    if s[i]==0:
        z=i
        while n%z==0:
            n//=z
            #print(z,n)
            z*=i
            l+=1
        while n%i==0:
            n//=i
            
            
    for j in range(i,k,i):
        s[j]=1
    i+=1
if n>1:
    r=0
    for i in range(2,k):
        if n%i==0:
            r=1
            break
    if r==0:
        l+=1
print(l)

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()
a = factorization(N)
ans = 0

for i in range(len(a)):
    k = a[i][1]
    cnt = 1
    while k-cnt>=0:
        k -= cnt
        cnt += 1
    ans += cnt-1
    
    
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

from collections import Counter

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
  
n = int(input())
x = Counter(prime_factorize(n))
x_keys = list(x.keys())
x_values = list(x.values())
ans = 0
for i in range(len(x_keys)):
    z = x_values[i]
    mai = 1
    while z - mai >= 0:
        z -= mai
        mai += 1
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

d = 2
ans = 0

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

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

    while n % d == 0:
        n //= d

if n != 1:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
import 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())
res = collections.Counter(prime_factorize(N)) # Counter({2: 4, 3: 1})
keys = list(res.keys()) # [2, 3]
length = len(keys)
ans = 0

# 因数に関する処理
for i in range(length):
    num = keys[i] # 因数
    beki = res[num] # 因数numの個数
    temp = 1
    while(beki >= temp):
        beki -= temp
        ans += 1
        temp += 1
print(ans)

Submission status: Accepted

Solution code:
import math

def is_prime(n):
    if n==1:
        return False
    nmax = int(math.sqrt(n)) + 1
    for i in range(2, nmax):
        if(n%i)==0:
            return False
    return True

def pf(n):
    sn = int(math.sqrt(n)) + 1
    ps = []
    for i in range(1, sn):
        if (n%i)==0:
            ps.append(i)
            ps.append(int(n/i))
    del ps[0]
    return ps        

n = int(input())
ps = []
num = pf(n)
for i in num:
    if is_prime(i):
        ps.append(i)
        
zs = []        
for p in ps:
    z = p
    while(z<=n):
        zs.append(z)
        z *= p
zs.sort()

cnt = 0
for z in zs:
    if(n>1):
        if(n%z==0):
            n /= z
            cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
flag = True if n == 1 else False

tmp = 0
while n % 2 == 0:
    n //= 2
    tmp += 1
i = 0
while tmp >= (i+1)*(i+2)//2:
    i += 1
ans += i

idx = 3
while n > idx**2:
    tmp = 0
    if n % idx == 0:
        while n % idx == 0:
            n //= idx
            tmp += 1
        i = 1
        while tmp >= (i+1)*(i+2)//2:
            i += 1
        ans += i
    idx += 2

print(0 if flag else (ans+1 if n > 1 else ans))

Submission status: Accepted

Solution code:
def resolve():
    import sys
    import collections
    sys.setrecursionlimit(10 ** 6)  # 再帰関数の再帰の深さを設定
    to_index = lambda x: int(x) - 1  # 入力した数字に1を引いたものを返す
    print_list_in_2D = lambda x: print(*x, sep="\n")  # リストの要素を改行を挟んで表示する関数

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

    def map_int_input():
        return map(int, input())

    MII = map_int_input

    def MII_split():
        return map(int, input().split())

    def MII_to_index():
        return map(to_index, input())

    def MII_split_to_index():
        return map(to_index, input().split())

    # 入力全てを整数に変換したものの配列を受け取る
    def list_int_inputs():
        return list(map(int, input()))

    LII = list_int_inputs

    def LII_split():
        return list(map(int, input().split()))

    # 2次元リスト化
    def LII_2D(rows_number):
        return [LII() for _ in range(rows_number)]

    def LII_split_2D(rows_number):
        return [LII_split() for _ in range(rows_number)]

    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 = input_int()
    c = collections.Counter(prime_factorize(N))
    ans = 0
    # print(c)
    for _, value in c.items():
        for i in range(41):
            if value > i:
                value -= i + 1
                ans += 1
            else:
                break
    print(ans)
    
resolve()

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

flist = factorization(N)

ans = 0
for f in flist:
    if f[0] == 1:
        continue
    num = f[1]
    for i in range(1, num+1):
        if i <= num:
            num -= i
            ans += 1
        else:
            break

print(ans)

Submission status: Accepted

Solution code:
def primefact(n):
    l=[]
    if n%2==0:
        while n%2==0:
            n=n//2
        l.append(2)
    for i in range(3,int(n**0.5)+1,2):
        if n%i==0:
            while n%i==0:
                n=n//i
            l.append(i)
    if n>2:
        l.append(n)
    return l

n=int(input())
c=0
a=(primefact(n))
for i in a:
    x=i
    while n%x==0:
        n=n//x
        c+=1
        x=x*i
print(c)

Submission status: Accepted

Solution code:
N = int(input())
def factorization(n): # => {prime:count,...}
    fac = {}
    count = 0
    while n % 2 == 0:
        n //= 2
        count += 1
    if count > 0:
        fac[2] = count
    for i in range(3, int(n ** .5) + 1, 2):
        count = 0
        while n % i == 0:
            n //= i
            count += 1
        if count > 0:
            fac[i] = count
    if n > 1:
        fac[n] = 1
    return fac
ans = 0
for key, cnt in factorization(N).items():
    n = 1
    while cnt >= 0:
        cnt -= n
        n += 1
        ans += 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())
x=factorization(n)
ans=0

if n==1:
  print(0)
  exit()
for i in range(len(x)):
  p=x[i][1]
  j=1
  while True:
    if p>=j:
      p-=j
      ans+=1
      j+=1
    if p<j:
      break
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

chk = factorization(n)
ans = 0
for num,k in chk:
  now = 1
  while True:
    if k < now:
      break
    ans += 1
    k -= now
    now += 1

print(ans)

Submission status: Accepted

Solution code:
def factorization(n):
    res = []
    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
            res.append([i, cnt])
 
    if tmp!=1:
        res.append([tmp, 1])
 
    return res

N = int(input())
ans = 0
for tmp,cnt in factorization(N):
    i = 1
    while i<=cnt:
        ans += 1
        cnt-=i
        i += 1
print(ans)

Submission status: Accepted

Solution code:
def II(): return int(input())
N=II()
d=2
ans=0
while d*d<=N:
  if N%d!=0:
    d+=1
    continue
  z=d
  while N%z==0:
    ans+=1
    N//=z
    z*=d
  while N%d==0:
    N//=d
if N!=1:
  ans+=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

n = int(input())
m = n

answer = 0
i = 2
while i ** 2 <= m:
    t = 0
    while n % i == 0:
        n //= i
        t += 1
    answer += int((-1+math.sqrt(1+8*t)) / 2)
    i += 1

if n > 1000000:
    answer += 1

print(answer)

Submission status: Accepted

Solution code:
def prime_factor(n):
  ass=[]
  for i in range(2,int(n**0.5)+1):
    while n%i==0:ass.append(i);n//=i
  if n!=1:ass.append(n)
  return ass

n = int(input())
ans = 0
pf = prime_factor(n)

from collections import Counter
c = Counter(pf)
for i in c.keys():
    v = c[i]
    for j in range(1, 10**20):
        if j>v:
            break
        ans += 1
        v -= j
print(ans)

Submission status: Accepted

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

while i * i <= n + 1:
    count = 0
    while n % i == 0:
        count += 1
        n //= i
    i += 1
    if count != 0:
        numlist.append(count)
if n != 1:
    numlist.append(1)

while len(numlist) != 0:
    i = 1
    a = numlist.pop(0)
    while a - i >= 0:
        a -= i 
        i += 1
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
#create date: 2020-06-30 09:34

import sys
stdin = sys.stdin
from collections import Counter

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

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

def main():
    n = ni()
    prime_count = Counter(prime_decomposition(n))
    ans = 0
    for p in prime_count.values():
        i = 1
        while p - i >= 0:
            p -= i
            ans += 1
            i += 1
    print(ans)


if __name__ == "__main__":
    main()