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 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

def countLoop(n):
  if n == 1 :
    return 1
  cnt = 0
  for i in range(1,n+1):
    if n >= i :
      n -= i
      cnt += 1
    else :
      return cnt

n = int(input())

c =  collections.Counter(prime_factorize(n))

cnt = 0
for x in c:
  cnt += countLoop(c[x])

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

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

for i in (c.keys()) :
    for j in range (50) :
        if j*(j+1)/2 <= c[i] < (j+1)*(j+2)/2 :
            ans += j

print(ans)

Submission status: Accepted

Solution code:
import collections
import numpy as np

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())
#print(N)
A = prime_factorize(N)
c = collections.Counter(A)

#print(A)

d = np.floor((-1. + np.sqrt(1 + 8 * np.array(list(c.values()))))/2)
#print(d)
print(int(np.sum(d)))

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 math

n = int(input())

lis = factorization(n)

c = 0

for i in range(len(lis)):
    b = math.floor((lis[i][1]*2)**(1/2))
    if b*(b+1) > lis[i][1]*2:
        b = b - 1
    c = c + b
if n == 1:
    print(0)
else:
    print(c)

Submission status: Accepted

Solution code:
n=int(input())
a={}
temp=n
for i in range(2,int(n**0.5)+1):
    if temp % i ==0:
        count=0
        while temp % (i**(count+1)) ==0:
            count+=1
        temp= temp/(i**count)
        a[i]=count
if temp !=1:
    a[temp]=1

sum=0
for i in a:
  jisu= a[i]
  temp=1
  while temp*(temp+1)/2<= jisu:
          temp+=1
  sum+= temp-1
print(sum)

Submission status: Accepted

Solution code:
#import sympy

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 = 1

#dic = sympy.factorint(n)
arr = factorization(n)

cnt  = 1
ans = 0
flag = False
while True:
  for k in arr:
    if k[1] >= cnt:
      k[1] -= cnt
      ans += 1
      flag = True
  if not flag:
    break
  cnt += 1
  flag = False

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

Submission status: Accepted

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

ans = 0

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)

if a == []:
    print(0)
else:
    c = collections.Counter(a)
    for i in c.values():
        m = 1
        while 2*(i+1)>(m+1)*(m+2):
            m += 1
        ans += m
    print(ans)

Submission status: Accepted

Solution code:
import collections

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

c = collections.Counter(prime_factorize(n))

c = list(c.values())

ans = 0

for i in range(len(c)):
    j = 1
    num = c[i]
    while num >= j:
        ans += 1
        num -= j
        j += 1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())

def divisore(n):
    divisors=[]
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            divisors.append(i)
            if i!=n//i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

def factorization(n):
    p=2
    fcr=[]
    while p*p<=n:
        while n%p==0:
            fcr.append(p)
            n//=p
        p+=1
    if n>1:
        fcr.append(n)
    return fcr

l=divisore(n)[1:]

ans=0
for i in l:
  t_l=factorization(i)
  if len(set(t_l))!=1:
    continue

  if n%i==0:
    ans+=1
    n//=i

print(ans)

Submission status: Accepted

Solution code:
import sys

n = int(sys.stdin.readline())

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

def divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

def calc(n):
    used = set()
    a = 0
    c = True
    c1 = []
    ds = divisors(n)
    m = max(ds)
    for d in ds:
        if not isPrime(d):
            continue
        v = d
        i = 1
        while v <= m:
            c1.append(v)
            i += 1
            v = d ** i
    c1.sort()
    while c:
        c = False
        for d in c1:
            if d in used:
                continue
            if n % d != 0:
                continue
            #print(n, d)
            n //= d
            a += 1
            c = True
            used.add(d)
            break
    return a

print(calc(n))

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


def counter(n):

    ccc = 1

    for i in range(2, 16):
        n -= i
        if n < 1:
            return ccc
        else:
            ccc += 1


results = prime_factorize(n)
numbers = {}

for nn in results:
    if nn in numbers.keys():
        numbers[nn] += 1
    else:
        numbers[nn] = 1

output = 0
for v in numbers.values():
    output += counter(v)

print(output)

Submission status: Accepted

Solution code:
n=int(input())
count=0
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
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
  
for i in make_divisors(n):
  if int(n)!=n or n==1:
    break
  if n%i==0 and len(factorization(i))==1:
    n=n/i
    count+=1
if count-1>=0:
  print(count-1)
else:
  print(0)

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 readinput():
    n=int(input())
    return n

def possibleCnt(n):
    cnt=0
    resu=n
    for i in range(1,n+1):
        if resu >= i:
            cnt+=1
            resu-=i
            #print(cnt,resu)
    return cnt       

def main(n):
    ansList=factorization(n)
    #print(ansList)
    count=0
    for l in ansList:
        if(l[0]!=1):
            count+=possibleCnt(l[1])
    return count    


if __name__=='__main__':
    n=readinput()
    ans=main(n)
    print(ans)

Submission status: Accepted

Solution code:

n=int(input())

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

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

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

    return arr

arr2=[]
arr2=factorization(n)

def cnt(nn):
    if nn<3:
        return 1
    elif nn<6:
        return 2
    elif nn<10:
        return 3
    elif nn<15:
        return 4
    elif nn<21:
        return 5
    elif nn<28:
        return 6
    elif nn<36:
        return 7
    elif nn<45:
        return 8
    elif nn<55:
        return 9
    else:
        return 10
icnt=0
for i in range(len(arr2)):
    icnt=icnt+cnt(arr2[i][1])

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

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 resolve():
    N = int(input())
    if N == 1:
        print(0)
    else:
        N_fact = factorization(N)
        ans = 0
        for i in range(len(N_fact)):
            Ni =  N_fact[i][1]
            ans = ans + int((-1 + math.sqrt(1 + 8 * Ni)) / 2)
        print(ans)
resolve()

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
    
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():
    N = int(input())
    if N == 1:
        print(0)
        return
    arr = factorization(N)
    CNT = 0
    for p, e in arr:
        CNT += 1
        for i in range(2, 100):
            if e > i:
                e -= i
                CNT += 1
            else:
                break
    print(CNT)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    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 = ni()
    a = prime_factorize(n)

    c = collections.Counter(a)

    ans = 0
    for v in c.values():
        cnt = 1
        while True:
            v -= cnt
            cnt += 1
            if v >= 0:
                ans += 1
            else:
                break

    print(ans)


if __name__ == '__main__':
    main()

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

a=int(input())
b=factorization(a)
ans=0
for i in range(len(b)):
    c=b[i][1]
    check=math.floor(((-1)+math.sqrt(1+8*c))/2)
    ans=ans+check
if a==1:
    print(0)
else:
    print(ans)

Submission status: Accepted

Solution code:
import collections

N = int(input())

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

A = collections.Counter(A)
del A[1]
count = 0

for a in A.values():
	n = 1
	th = n*(n+1)/2
	while a >= th:
		n += 1
		th = n*(n+1)/2
	count += n-1

print(count)

Submission status: Accepted

Solution code:
def resolve():
    '''
    code here
    '''
    import math
    import collections

    N = int(input())

    def mk_factor(num):
        max_divisor = int(math.sqrt(num))+1
        divisor = 2
        factor_list = [1]

        while divisor <= max_divisor:
            if num % divisor == 0:
                factor_list.append(divisor)
                num //= divisor
            else:
                divisor += 1

        factor_list.append(num)
        return factor_list


    fact_dic = dict(collections.Counter(mk_factor(N)))

    fact_dic.pop(1)

    cnt = 0
    for i in range(1, int(math.sqrt(N))+1):
        for j in fact_dic.keys():
            if fact_dic[j] >= i:
                cnt += 1
            fact_dic[j] -= i


    print(cnt)

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
from math import sqrt, ceil

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 make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

ans = 0
search_list = make_divisors(N)[1:]
if (N > 1) and (N not in search_list):
    search_list.append(N)

for i in search_list:
    if N%i == 0:
        fact = factorization(i)
        if len(fact) == 1:
            N = N // i
            if N >= 1:
                ans += 1
            else:
                break

print(ans)

Submission status: Accepted

Solution code:
import math
from collections import defaultdict


N = int(input())
n = N
#素因数分解
factor = defaultdict(lambda: 0)
tmp = int(math.sqrt(N))+1
for num in range(2,tmp):
    while N % num == 0:
        N //= num
        factor[num] += 1
if not factor and n!=1:
    factor[n] += 1
elif N != 1:
    factor[N] += 1



ans = 0
for num in factor:
    i = 1
    while True:
        factor[num] -= i
        if factor[num]<0:
            break
        ans += 1
        i+=1

print(ans)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

#素因数分解を行う関数O(root(N))
#int -> list
def factorize(x):
      res = []
      for i in range(2, int(x**0.5)+1):
          if x%i != 0:
              continue
          cnt = 0
          while x%i == 0:
              x //= i
              cnt += 1 
          res.append((i, cnt))
      if x != 1:
          res.append((x, 1))
      return res
 
def main():
    n = int(readline())
    if n == 1:
        print(0)
        return
    fact = factorize(n)
    num = [int(i) for i in range(50)]
    def f(x):
        i = 2
        j = 2
        cnt = 1
        while 1:
            if x<=i:
                break
            cnt += 1
            j += 1
            i += j
        return cnt 
    ans = 0
    for i, j in fact:
        ans += f(j)
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors[1:] + upper_divisors[::-1]

def isPrime(n):
  if n == 2:
    return True
  if n % 2 == 0:
    return False

  m = math.floor(math.sqrt(n)) + 1
  for p in range(3, m, 2):
      if n % p == 0:
        return False
  return True


n = int(input())
if n == 1:
    print(0)
    exit()
if isPrime(n):
    print(1)
    exit()
div = make_divisors(n)
ans = 0
for i in range(len(div)):
    if n % div[i] == 0:
        divdiv = make_divisors(div[i])
        if div[i] == divdiv[0] ** len(set(divdiv)):
            if isPrime(divdiv[0]):
                n //= div[i]
                ans += 1
    if n == 1:
        break
print(ans)

Submission status: Accepted

Solution code:
def cultimes(x):
  base=0
  start=0
  if x==0:
    return 0
  if x==1:
    return 1
  while  start <x+1:
    base+=1
    start=(base+1)*(base+2)//2
  return base
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())
m=factorization(n)
t=0
for x in m:
  t+=cultimes(x[1])
t=int(t)
if n==1:
  t=0
print(t)

Submission status: Accepted

Solution code:
import math
from collections import defaultdict

def isPrime(num):
    prime = True
    save = num
    save2 = None
    for i in range(2, int(math.sqrt(num))+1):
        if num % i == 0:
            prime = False
            save = i
            save2 = num // i
            break
    return prime, save, save2

store = defaultdict(int)

def solve(num):
    check, num1, num2 = isPrime(num)
    if check == True:
        global store
        store[num1] += 1
    if check == False:
        solve(num1)
        solve(num2)

n = int(input())
if n <= 1:
    print(0)
else:
    count = 0
    solve(n)
    for key, v in store.items():
        for i in range(1, v+1):
            if store[key] >= i:
                store[key] -= i
                count += 1
            else:
                break
    print(count)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
c = 0
m = int(input())
pf={}
for i in range(2,int(m**0.5)+1):
    while m%i==0:
        pf[i]=pf.get(i,0)+1
        m//=i
if m>1:pf[m]=1
for i in pf:
    for j in range(pf[i]):
        pf[i] -= j + 1
        c += 1
        if pf[i] < 0:
            c -= 1
            break
        elif pf[i] == 0:
            break
print(c)

Submission status: Accepted

Solution code:
from collections import Counter

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

cnt = Counter(prime_factorize(n))
z = []
for k, v in cnt.items():
    for i in range(1, v+1):
        z.append(k**i)
z = list(set(z))
z.sort()

ans = 0
for pe in z:
    if n%pe == 0:
        n /= pe
        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())
prime_factors = factorization(n)
# print(prime_factors)

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

counter = 0
for factor in prime_factors:
  factor_num = factor[1]
  power = 1
  while factor_num - power >= 0:
    factor_num -= power
    counter += 1
    power += 1

print(counter)

Submission status: Accepted

Solution code:
n = int(input())

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

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

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

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

    return arr

def count(m):
    count = 0
    for i in range(1, 10**12+1):
        if m >= i :
            m -= i
            count += 1
        else:
            return count


bun = factorization(n)

kazu = len(bun)

#if kazu == 1 and bun[0][1] ==1:
#    print(0)
#    exit(0)


countup = 0
for i in range(kazu):
    countup += count(bun[i][1])

print(countup)

Submission status: Accepted

Solution code:
import math
data = input()
target = int(data)

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

list = primes(2000000)
result =[]
for i in list:
    check = target
    k = 0
    while True:
        if check % i != 0:
            break
        else:
            check = check/i
            k +=1
    result.append(k)

ans = 0
for j in result:
    y = 0
    z = j
    while z > y:
        y += 1
        z -= y
        ans += 1


cover = 1
for i in range(len(list)):
    cover = cover*(list[i]**result[i])
if target/cover >2000000:
    ans +=1
print(ans)

Submission status: Accepted

Solution code:
import collections
import numpy as np

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

c = collections.Counter(prime_factorize(N))
X = np.array([])
for i in c.values():
    X = np.append(X,i)

ans = 0

for i in range(1,10**6):
    if len(X) == 0:
        print(ans)
        exit()
    X -= i
    X = X[X>=0]
    ans += len(X)

Submission status: Accepted

Solution code:
import math
import numpy as np

def myfunc(n):
    f = []
    c = 0
    r = int(n ** 0.5)
    for i in range(2, r + 2):
        while n % i == 0:
            c += 1
            n = n // i
        if c != 0:
            f.append([i, c])
            c = 0

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

    return f

N = int(input())
M = (math.sqrt(N)) + 1

L = np.array([1, 3, 6, 10, 15, 21, 28, 36])

f = myfunc(N)
count = 0
for _, c in f:
    if c == 1:
        count += c
    else:
        i = (L <= c).sum()
        count += i

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)



    return arr

N=int(input())
count_list=factorization(N)
ans=0
for k in range(0,len(count_list)):
    dlt=1
    c=count_list[k]
    while (c-dlt)>=0:
        c=c-dlt
        dlt+=1
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = 0
Tri = [0,1,3,6,10,15,21,28,36,45,55,66,78,91]
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(N)

if N > 1:
    for i in range (len(A)):
        T = A[i][1]
        j = 0
        while(T>=Tri[j]):
            j += 1
        S += (j-1)
                

print(S)

Submission status: Accepted

Solution code:
#include <CodeforcesSolutions.h>
#include <ONLINE_JUDGE <solution.cf(contestID = "1359",problemID = "C",method = "GET")>.h>
"""
    Author : thekushalghosh
    Team   : CodeDiggers
 
    I prefer Python language over the C++ language :p :D
        
    Visit my website : thekushalghosh.github.io
"""
import sys,math,cmath,time,decimal
start_time = time.time()
##########################################################################
################# ---- THE ACTUAL CODE STARTS BELOW ---- #################

def qw(n): 
    q = []
    # Print the number of two's that divide n 
    while n % 2 == 0: 
        q.append(2)
        n = n // 2
          
    # n must be odd at this point 
    # so a skip of 2 ( i = i + 2) can be used 
    for i in range(3,int(math.sqrt(n))+1,2): 
          
        # while i divides n , print i ad divide n 
        while n % i== 0: 
            q.append(i) 
            n = n // i 
              
    # Condition if n is a prime 
    # number greater than 2 
    if n > 2: 
        q.append(n)
    return(q)

def solve():
    n = inp()
    if n == 1:
        print(0)
        return
    a = qw(n)
    c = 0
    q = a[0]
    w = 0
    qq = 0
    for i in range(len(a)):
        if a[i] == q:
            c = c + 1
            if c > w:
                qq = qq + 1
                w = c
                c = 0
        else:
            qq = qq + 1
            c = 0
            w = 1
            q = a[i]
    print(qq)
                
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
 
def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
    sys.stdout.close()
    
#---------------------- USER DEFINED INPUT FUNCTIONS ----------------------#
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    return(input().strip())
def invr():
    return(map(float,input().split()))
 
#------------------ USER DEFINED PROGRAMMING FUNCTIONS ------------------#
def counter(a):
    q = [0] * max(a)
    for i in range(len(a)):
        q[a[i] - 1] = q[a[i] - 1] + 1
    return(q)
 
def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
    return(q)
 
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
    input = sys.stdin.readline
   
  
  
main()

Submission status: Accepted

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

a = collections.Counter(prime_factorize(n))

res = 0

for i in a.items():
    if i[1] > 3:
        x = 2
        y = 3
        while True:
            x += 1
            y = y + x
            if y > i[1]:
                res += x - 1
                break
    elif i[1] == 3:
        res += 2
    else:
        res += 1

print(res)

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 step(n):
    s = 1
    ret = 0
    while n >= s:
        n -= s
        s += 1
        ret += 1
    return ret
if N == 1:
    print(0)
    exit()

factor = factorization(N)
ret = 0
for f, g in factor:
    ret += step(g)
print(ret)

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)
x.sort(key=lambda x: x[-1])
a = [0]
b = 3
for i in range(3,30):
    a.append(b)
    b += i
ans = 0
c = 1
for i in range(len(x)):
    for j in range(len(a)):
        if x[i][1] >= a[c]:
            c += 1
        else:
            break
    ans += c
if n == 1:
    print(0)
else:
    print(ans)

Submission status: Accepted

Solution code:
import collections
import numpy as np
num =  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
c = collections.Counter(prime_factorize(num))
ln = np.array(list(c.values()) )# 各素因数の乗数
#print('ln = ', ln )
minus = 1
number = 0
#print(number)
if len(ln) == 0:
    ln = [-1]
    
while max(ln) >= 0:
    ln = ln - minus
    #print(ln)
    for i in range(len(ln)):
        if ln[i] >= 0:
            number += 1
    
    minus += 1
print(number)