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


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

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


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

        input   123
        return  [1,2,3]

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


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

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

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


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

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

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


def p_num(a):

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

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


n = xnxn()

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

Submission status: Accepted

Solution code:
def solve(n):
    for i in range(n+2):
        if (i+1)*i//2 > n:
            return i-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])


    return arr



N = int(input())
li = factorization(N)
ans = 0
for [a,b] in li:
    ans += solve(b)
    
if ans == 0:
    if N != 1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
# @oj: atcoder
# @id: hitwanyang
# @email: 296866643@qq.com
# @date: 2020-06-05 15:25
# @url:https://atcoder.jp/contests/abc169/tasks/abc169_d
import sys,os
from io import BytesIO, IOBase
import collections,itertools,bisect,heapq,math,string
from decimal import *
# region fastio

BUFSIZE = 8192

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
# ------------------------------
def main():
    n=int(input())
    #判断n是否为素数
    def isprime(n):
        if n <= 1:
            return 0
        for x in range(2,int(math.sqrt(n))+1):
            if n%x == 0:
                return 0
        return 1
    #利用递归分解n并打印质因数
    ans=[]
    def bprime(n):
        if isprime(n):
            ans.append(n)
        else:
            x = 2
            while x <= int(n/2):
                if n%x == 0:
                    ans.append(x)
                    return bprime(n//x)
                x = x + 1
    bprime(n)
    # print (ans)
    d=collections.Counter(ans)
    mx=0
    for k in d.keys():
        i=1
        v=d[k]
        cnt=0
        while v>0:
            v=v-i
            i=i+1
            cnt+=1
        if v==0:
            mx+=cnt
        else:
            mx+=(cnt-1)
    print (mx)
if __name__ == "__main__":
    main()

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
ans = 0
primes = prime_factorize(N)
pc = Counter(primes)
for v in pc.values():
    now = 1
    while now*(now+1)//2 <= v:
        now += 1
    ans += now-1
print(ans)

Submission status: Accepted

Solution code:
from collections import deque
import bisect
m=int(input())
def fa(n):
    arr =deque([])
    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

x=0
count=0
box=[]
for i in range(1,1000):
    box.append(i*(i+1)//2)
# print(box)
for i,j in fa(m):
    # print(i,j)

    count+=bisect.bisect_right(box, j)


print(count)

Submission status: Accepted

Solution code:
def factorization(y):
    arr = []
    temp = y
    for i in range(2, int(-(-y**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([y, 1])
    return arr
n=int(input())
if n==1:
  print(0)
  exit()
ans=0
l=factorization(n)
for i,j in l:
    if j<=2:
      ans+=1
    else:
      t=1
      while j:
        if j<t:
          break
        ans+=1
        j-=t
        t+=1           
print(ans)

Submission status: Accepted

Solution code:
from math import *

def aaa(n):
  return int((sqrt(8*n+1)-1)/2)

def bk(n):
  if n <= 1:
    return {}
  r = {}
  for i in range(2, ceil(sqrt(n))+1):
    if n % i != 0:
      continue
    r.setdefault(i,0)
    while n % i == 0:
      n //= i
      r[i] += 1
    if n == 1:
      return r
  r.setdefault(n, 1)
  return r

n = int(input())
f = bk(n)
print(sum((aaa(m) for m in f.values())))

Submission status: Accepted

Solution code:
#import numpy as np
#dict = {}
N = int(input())
#def search(n):
#    if n == 1:
#        return
#    else:
#        s = int(np.sqrt(n)//1)
#        for i in range(2, s+1):
#            if n % i == 0:
#                global dict
#                dict[i] = dict.get(i, 0) + 1
#                search(int(n/i))
#                break
#        else:
#            dict[n] = dict.get(n, 0) + 1
#search(N)
p = 2
dict = {}
while p**2 <= N:
    if N % p == 0:
        now = 0
        while N % p == 0:
            N //= p
            now += 1
        dict[p] = now
    p += 1
if N != 1:
    dict[N] = 1
ans = 0
for i in dict.keys():
    n = dict[i]
    j = 1
    while j <= n:
        n -= j
        j += 1
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
def main():
  ## IMPORT MODULE
  #import sys
  from collections import Counter

  #sys.setrecursionlimit(100000)
  #input=lambda :sys.stdin.readline().rstrip()

  #f_inf=float("inf")
  #MOD=10**9+7
  
  if 'get_ipython' in globals(): 
    ## SAMPLE INPUT
    n = 64

  else:
    ##INPUT 
    n =int(input())
    #a, b = map(int, input().split())

  ## SUBMITION CODES HERE
  def prime_fact(n):
    P = []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            P.append(i)
            n //= i
    if n != 1:
        P.append(n)
    return P

  cnt = Counter(prime_fact(n))

  ans = 0
  for c in cnt.values():
    tmp = 1
    while c >= tmp:
      c -= tmp
      ans += 1
      tmp += 1
    
  print(ans)
    
main()

Submission status: Accepted

Solution code:
from collections import Counter

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

n = int(input())
cnt = Counter(prime_fact(n))

ans = 0
for c in cnt.values():
  tmp = 1
  while c >= tmp:
    c -= tmp
    ans += 1
    tmp += 1
print(ans)

Submission status: Accepted

Solution code:
def fc(n):
    wk =0
    for i in range(2,int(n**0.5)):
        j=i
        while n%j == 0:
            wk+=1
            n//=j 
            j*=i
        while n%i==0:
            n//=i
            continue
    if n!=1:
        wk+=1
    return wk

n =int(input())
print(fc(n))

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

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

x = int(input())
y = Counter(prime_factorize(x))

num = 0
for v in y.values():
    now_v = v
    i = 1
    while True:
        if now_v < i:
            break
        now_v -= i
        num += 1
        i += 1

print(num)

Submission status: Accepted

Solution code:
def prime_factorize(n):
    a = {}
    while n % 2 == 0:
        if 2 not in a:
            a[2] = 1
        else:
            a[2] += 1
        n //= 2
    f = 3
    while f * f <= n:
        while n % f == 0:
            if f not in a:
                a[f] = 1
            else:
                a[f] += 1
            n //= f
        f += 2
    if n != 1:
        if f not in a:
            a[f] = 1
        else:
            a[f] += 1
    return a

x = int(input())
y = prime_factorize(x)

num = 0
for v in y.values():
    now_v = v
    i = 1
    while True:
        if now_v < i:
            break
        now_v -= i
        num += 1
        i += 1

print(num)

Submission status: Accepted

Solution code:
def prime_factorize(n):
    a = {}
    while n % 2 == 0:
        if 2 not in a:
            a[2] = 1
        else:
            a[2] += 1
        n //= 2
        # print('[A]n:{}, a:{}'.format(n, a))
    f = 3
    while f * f <= n:
        while n % f == 0:
            if f not in a:
                a[f] = 1
            else:
                a[f] += 1
            n //= f
        f += 2
        # print('[B]f:{}, n:{}, a:{}'.format(f, n, a))
    if n != 1:
        if f not in a:
            a[f] = 1
        else:
            a[f] += 1
        # print('[C]f:{}, n:{}, a:{}'.format(f, n, a))
    return a

x = int(input())
y = prime_factorize(x)

# print(y)

num = 0
for v in y.values():
    now_v = v
    i = 1
    while True:
        if now_v < i:
            break
        now_v -= i
        num += 1
        i += 1

print(num)

Submission status: Accepted

Solution code:
from collections import Counter


n = int(input())

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


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


ans = 0
for v in Counter(prime_factorize(n)).values():
    i = 1
    while v >= i:
        v -= i
        ans += 1
        i += 1

print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())
Prime = []
ans = 0

def func(n):
    while n % 2 == 0:
        n = n // 2
        Prime.append(2)
    for i in range(3, int(math.sqrt(n)) + 1, 2):
        while n % i == 0:
            n = n //i
            Prime.append(i)
    if n > 2:
        Prime.append(n)

func(N)

for i in set(Prime):
    c = i
    while N % c == 0:
        N = N // c
        ans += 1
        c = c * i

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

if n==1:
    print(0)
else:
    result=factorization(n)
    primes=len(result)
    
    ans=0
    for i in range(primes):
        tmp=result[i][1]
        cnt=0
        j=1
        while 1:
            tmp-=j
            if tmp>=0:
                cnt+=1
            else:
                break
            j+=1
        
        ans+=cnt

    print(ans)

Submission status: Accepted

Solution code:
def resolve():
	answer = 0
	N = int(input())
	if N==1:
		print(answer)
	else:
		# 素因数pを見つける。範囲は2から√Nまででよい。
		for p in range(2, int(N**0.5)+2):
			e = 0
			while (N % p == 0):
				N /= p
				e += 1
			# z=p**eが見つかった
			if e>0:
				# eを1, 2, 3, 4...に分けられる回数カウント
				for i in range(1, e+1):
					if e >= i:
						e -= i
						answer += 1
		# √Nまでで割り切れなかった場合、N自身が素数
		if N!=1:
			answer += 1
		print(answer)
        
resolve()

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


primes = collections.Counter(prime_factorize(N))
ans = 0
for prime, num in primes.items():
    n = 1
    while (n + 1) * (n + 2) / 2 <= num:
        n += 1
    ans += n

print(ans)

Submission status: Accepted

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

def primary(x):
  D = {}
  for num in range(2, int(math.sqrt(x))+2):
    while x % num == 0:
      if num in D:
        D[num] += 1
      else:
        D.setdefault(num, 1)
      x = x // num
  if x > 1:
    D.setdefault(x, 1)
  if not D:
    return 0
  else:
    return D

primaryN = primary(N)
#print(primary(N))
a = 0
if N == 1:
  print(0)
elif primary(N) == 0:
  print(1)
else:
  for i in primaryN:
    j = 1
    while primaryN[i] > 0:
      primaryN[i] = primaryN[i] - j
      if primaryN[i] >= 0:
        a = a + 1
      j = j + 1
  print(a)

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 math
def prime_diviation(n):
    factors = []
    i = 2
    while i <= math.floor(math.sqrt(n)):
        if n%i == 0:
            factors.append(int(i))
            n //= i
        else:
            i += 1
    if n > 1:
        factors.append(n)
    return factors
N = int(input())
#素因数分解
ls = prime_diviation(N)
now = 0 #現在参照する数字
ren = 0 #連続している数
target = 2 #連続している数の目標
ans = 0 #割り切れる回数
for i in range(len(ls)):
    if i == 0:
        #はじめの処理
        now = ls[i]
        ans += 1
    else:
        #もしnowと同じなら
        if ls[i] == now:
            ren += 1
            if ren == target:
                ans += 1
                ren = 0
                target += 1
        else:
            ans += 1
            ren = 0
            target = 2
            now = ls[i]
print(ans)

Submission status: Accepted

Solution code:
import math
import bisect

def main():
    n = int(input())
    primes = {}
    s = [(1+i) * i // 2 for i in range(1, 300000)]
    for i in range(2, int(math.sqrt(n))+2):
        if n % i == 0:
            primes[i] = 0
        else:
            continue
        while n % i == 0:
            n /= i
            primes[i] += 1

    if n != 1:
        primes[n] = 1

    ans = 0
    for _, v in primes.items():
        i = bisect.bisect_right(s, v)
        ans += i

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
from math import cos,sin,tan
import cmath as cma
import copy as cp
import sys
import re
def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def barr(n): return [False for _ in range(n)]
def adj(n): return [[] for _ in range(n)]
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

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

n = iinput()
primes = prime(n)
cnt = col.Counter(primes)

ans = 0
for key,val in cnt.items():
    i = 1
    while 1:
        val -= i
        if val < 0: break
        ans += 1
        i += 1

print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
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 div_game(n):
    zs = []
    li = list(set( prime_factorize(n)))
    #print(li)
    for p in li:
        a = 1
        z = 1        
        while n > 1 and n >= z:
            z = p ** a
            if n % z == 0 and z not in zs:
                n = n/z
                zs.append(z)
                #print(p**a,n,z)
            a += 1
    #print(zs)
    return len(zs)

if __name__ == "__main__":
    n = int(input())
    print(div_game(n))

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())
S = []
if N == 1:
  print(0)
  exit(0)
fac = factorization(N)
for i in range(len(fac)):
  S.append(fac[i][1])
ans = 0
for i in range(len(S)):
  for j in range(1,S[i] + 1):
    if S[i] - j < 0:
      break
    ans += 1
    S[i] -= j
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
N = int(input())
pf = prime_factorize(N)
m = 1
ext = {}
c = 0
l = 1
if len(pf) > 0:
  l = pf[0]
while True:
  if len(pf) == 0:
    break
  i = pf.pop()
  if l != i:
    l = i
    m = 1
  m = m * i
  if not m in ext:
    ext[m] = m
    m = 1
    c += 1
print(c)

Submission status: Accepted

Solution code:
n=int(input())

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

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

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

    return arr
  
  l=factorization(n)
  ans=0
  for i in l:
    m=i[1]
    j=1
    while m>=j:
      m-=j
      ans+=1
      j+=1
  print(ans)

Submission status: Accepted

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

import math

n = ni()


nn = 10**6+2
divs=[0]*nn
ans=0

for i in range(2,nn):
  while n%i==0:
    divs[i]+=1
    n//=i

# for i in range(nn):
#   if divs[i]>0:
#     print('{} {}'.format(i,divs[i]))


if n!=1:
  ans+=1

for i in range(nn):
  for j in range(1,nn):
    if divs[i]<j:
      break
    divs[i]-=j
    ans+=1


print(ans)

Submission status: Accepted

Solution code:
import math
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())

c = collections.Counter(prime_factorize(n))

d = list(c.values())

# d = 2 #素数
ans = 0
# print(c)
x = 1
for i in d:
    s = i
    x=1
    while s>0:
        s = s - x
        # print(x,"引いて",s)
        x +=1
        if s>=0:
            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())
fact = prime_factorize(N)

b = []
c = fact.copy()
q = 1
for p in fact:
    if p not in b:
        while c.count(p) >= q:
            for i in range (q):
                c.remove(p)
                #print(c)
            b.append(p ** q)
            #print(b)
            q += 1
    q = 1
    #print(p)
    #print(fact)

print(len(b))

Submission status: Accepted

Solution code:
a=int(input())
x=[]
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 a==1:
	print(0)
else:
	x=factorization(a)
	t=len(x)
	k=0
	n=1
	ans=0
	for i in range(t):
		k=x[i][1]
		n=1
		while k>=n:
			ans=ans+1
			k=k-n
			n=n+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())
arr=factorization(n)
#print(arr)
cnt=0

if n == 1:
  cnt=0
else:
  for i in arr:
    #print(i)
    x=i[1]
    inc=0
    if x == 1:
      cnt+=1
    else:
      for ii in range(1,x):
        inc+=ii
        #print("inc", inc)
        if inc > x:
          break
        cnt+=1
        #print(inc, cnt)

print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
cnt=0
for i in range(2,int(n**0.5)+2):
    if n%i==0:
        expo=0
        while n%i==0:
            n//=i
            expo+=1
        j=1
        while expo-j>=0:
            cnt+=1
            expo-=j
            j+=1
if n>1:
    cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
import math

n = int(input())
nroot = int(math.sqrt(n)) +1

result = {}

for i in range(2,nroot+1):
    while n%i==0:
        if i in result:
            result[i] +=1
        else:
            result[i] = 1
        
        n = n//i
if (n>nroot):
    result[n] = 1

ans = 0
for _, i in result.items():
    r = 1
    add = 0
    while  i >= r:
        i -=  r
        r +=1
        add +=1
    
        
    ans += add
if ans > 0:
    print(ans)
else:
    if n > 1:
        print(1)
    else:
        print(0)

Submission status: Accepted

Solution code:
#import numpy as np
#import functools
#import operator
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with
#from itertools import permutations as perm


N = int(input())
#H1,M1,H2,M2,K= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())
#prod = functools.partial(functools.reduce, operator.mul)
#c=np.array(A)
#p=np.prod(A)
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
z=0
for v in factorization(N):
    fla=True

    i=1
    while fla==True:
#        print(v)
        if v[1]-i>=0:
            v[1] -= i
            z+=1
            i+=1
        else:
            fla=False
print(z)

Submission status: Accepted

Solution code:
#abc169d
n=int(input())
res=0
for i in range(2,int(n**0.5)+2):
 if n%i==0:
  cnt=0
  while n%i==0:
   n//=i
   cnt+=1
  j=1
  while cnt-j>=0:
   res+=1
   cnt-=j
   j+=1
if n>1:
 res+=1
print(res)

Submission status: Accepted

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

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

    return arr
N = int(input())
ans = 0
if N != 1:
    fact_list = factorization(N)
    for _, i in fact_list:
        j = 1
        while i >= j:
            ans += 1
            i = i - j
            j += 1
            
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
p = []
n2 = n
for i in range(2,int(n2**0.5//1 + 1)):
  index = 0
  while n2%i == 0:
    index+=1
    n2 = n2//i
  if index != 0:
    p.append(index)
  else:
    continue
count = 0
t = 1

if n2 == 1:
  next
else:
  count+=1

if n == 1:
  print(0)
elif not p:
  print(1)
else:
  for i in range(len(p)):
    while p[i] - t >= 0:
      p[i]-=t
      count+=1
      t+=1
    t = 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

N = int(input())
ans = 0

A = factorization(N)

for x in A:
    e = x[1]
    for y in range(1,N):
        if e >= y:
            e -= y
            ans += 1
        else:
            break

print(ans)

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.buffer.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.buffer.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.buffer.readline().split()))

n = ri()
ans = 0
d = 2
while d**2 <= n:
    if n % d != 0:
        d += 1
        continue

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

    while n % dd == 0:
        n //= dd
    d = dd + 1

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