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:
# coding: utf-8
import sys

stdin = sys.stdin
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))


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

def cnt(n):
    x = int(-0.5 + pow(1+8*n,0.5)/2)
    if n < x*(x+1)//2:
        return x-1
    else:
        return x
    

def main():
    n = ni()
    ps = factorization(n)
    ans = 0
    for pi in ps:
        if pi[0] != 1:
            ans += cnt(pi[1])
    print(ans)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin python3
# -*- coding: utf-8 -*-
def factorization(n):
    primen, degree, primend = [], [], []
    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
            primen.append(i)
            degree.append(cnt)
            primend.append([i,cnt])
    if temp!=1:
        primen.append(temp)
        degree.append(1)
        primend.append([temp,1])
    if primen==[]:
        primen.append(n)
        degree.append(1)
        primend.append([n,1])
    return degree


def main():
    N = int(input())
    if N==1:
        ret = 0
    else:
        de= factorization(N)
        ret = 0
        for d in de:
            for k in range(d+1):
                if (k+1)*(k+2)//2<=d:
                    continue
                else:
                    break
#            print(d,k)
            ret += k
    print(ret)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
def 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
li = []
for i in range(1,10):
    li.append(i*(i+1)//2)
sum1 = 0
a = factorize(n)
liset = set(a)
relist = list(liset)
for i in range(len(liset)):
    b = a.count(relist[i])
    for j in range(10):
        if b >= li[j] and b < li[j+1]:
            sum1 += j+1
            break
print(sum1)

Submission status: Accepted

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

for k in c.values():
    temp_num = 1
    k_values = k
    while k_values > 0:
        if k_values - temp_num >= 0:
            k_values -= temp_num
            num += 1
            temp_num += 1
        else:
            k_values = 0
print(num)

Submission status: Accepted

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

f = fact(n)
ans=0
for itm in f:
    p,num=itm
    nxt=1
    while num > 0:
        if nxt<=num:
            ans+=1
            num-=nxt
            nxt+=1
        else:
            break
print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
LOCAL = len(sys.argv) > 1 and sys.argv[1] == 'LOCAL'


def dprint(*args):
  if LOCAL:
    print(*args)


n = int(input())

# https://note.nkmk.me/python-prime-factorization/


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


import collections

c = collections.Counter(prime_factorize(n))

ans = 0
for k, v in c.items():
  dprint('k', '=', k)
  dprint('v', '=', v)
  a = 0
  i = 0
  while True:
    if v < i * (i + 1) // 2:
      a = i - 1
      break
    i += 1
  dprint('a', '=', a)
  ans += a


print(ans)

Submission status: Accepted

Solution code:
import math
import sys

#素数か(x>=2)
def prime_check(x): #x>=2
    if x==2:
        return True,2
    elif x%2==0:
        return False,2
    else:
        limit=int(math.sqrt(x))
        for factor in range(3,limit+1,2):
            if x%factor==0:
                return False,factor
        return True,x

#素因数分解(x>=2)
def prime_factorization(x): #x>=2
    factor_dictionary={}
    factor_set=set()
    judge,factor=prime_check(x)
    while True:
        if factor in factor_set:
            factor_dictionary[factor]+=1
        else:
            factor_dictionary[factor]=1
            factor_set.add(factor)

        if judge:
            return factor_dictionary,factor_set
            break
        else:
            x//=factor
            judge,factor=prime_check(x)

n=int(input())
Fd,Fs=prime_factorization(n)

def culc(x):
    temp=1
    while True:
        if x>=temp:
            x-=temp
            temp+=1
        else:
            return temp-1
            break

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

ans=0
while Fs:
    now=Fs.pop()
    ans+=culc(Fd[now])

print(ans)

Submission status: Accepted

Solution code:
from math import sqrt
from collections import Counter
n = int(input())
if n == 1:
    print(0)
    quit()
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    a.sort()
    return a
l = prime_factorize(n)
c = Counter(l)
ans = 0
for v in c.values():
    i = 1
    while True:
        s = i*(i+1)//2
        if s <= v <= s+i:
            ans += i
            break
        i += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
import collections
N = int(input())
Ans = 0

if N <= 1:
  print(Ans)
  sys.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

c = collections.Counter(prime_factorize(N))
A = list(c.values())
p = len(A)
#print(A)
#print(p)

Ans = Ans + p
now = 0

for r in range(p):
  now = int(A[r]) - 1
  loop = 2

  for q in range(1000):
    now = now - loop
    if now >= 0:
      Ans = Ans + 1
      loop = loop + 1
    else:
      break

print(Ans)

Submission status: Accepted

Solution code:
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())
def S(): return input()
def MI(): return map(int, input().split())
def MS(): return map(str, input().split())
def LI(): return [int(i) for i in input().split()]
def LI_(): return [int(i)-1 for i in input().split()]
def StoI(): return [ord(i)-97 for i in input()]
def ItoS(nn): return chr(nn+97)
def input(): return sys.stdin.readline().rstrip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def print_matrix(mat):
    for i in range(len(mat)):
        print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False
# show_flg = True

def factorization(n):
    if n <= 1:
        return []

    ret = []
    while n > 2 and n % 2 == 0:
        ret.append(2)
        n //= 2
    i = 3
    while i <= math.sqrt(n):
        if n % i == 0:
            ret.append(i)
            n //= i
        else:
            i += 2
    ret.append(n)
    return ret


def main():
    N = I()
    a = factorization(N)
    ans = 0
    cnts = Counter(a)
    cursor = defaultdict(int)
    d = [i for i in range(1, 1000)]
    d = list(accumulate(d))

    for k in cnts.keys():
        sep = bisect.bisect_right(d, cnts[k])
        # print(k ,cnts[k], sep)
        ans += sep

    # print(cnts)
    print(ans)



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
ma = lambda :map(int,input().split())
ni = lambda:int(input())
import collections
import math
import itertools
gcd = math.gcd
n  = ni()
def f(cnt):
    ret  = 0
    for i in range(1,10**9):
        ret +=i
        if ret>cnt:
            return i-1
def factorize(n):
    b = 2
    fct = [(1,1)]
    while b * b <= n:
        cnt =0
        while n % b == 0:
            n //= b
            cnt +=1
        if cnt >=1:
            fct.append((b,cnt))
        b = b + 1
    if n > 1:
        fct.append((n,1))
    return fct
d = factorize(n)
ans = 0
for num,cnt in d:
    ans += f(cnt)
print(ans-1)

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

from collections import Counter

N = int(open(0).read())
l = prime_factorize(N)
c = Counter(l)
ans = 0
cl = [x for x in c.values()]
for i in range(1,41):
    for j in range(len(cl)):
        if cl[j] >= i:
            ans += 1
            cl[j] -= i
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())
c = collections.Counter(prime_factorize(n))
ans=0
for i in c:
    tmp=1
    while 1:
        c[i]-=tmp
        if c[i]>=0:
            ans+=1
        else:
            break
        if c[i]==0:
            break
        tmp+=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
    
ans=0
n=int(input())
if n==1:
    print(0)
    exit()

cnt=collections.Counter(prime_factorize(n))
for num in cnt.values():
    if num<3:
        ans+=1
    elif num<6:
       ans+=2
    elif num<10:
        ans+=3
    elif num<15:
        ans+=4
    elif num<21:
        ans+=5
    elif num<28:
        ans+=6
    elif num<36:
        ans+=7
    elif num<45:
        ans+=8
    else:
        num+=9
print(ans)

Submission status: Accepted

Solution code:
def factorize(n):
    i=2
    result={}
    while True:
        if i**2>n:
            break
        count=0
        while n%i==0:
            n//=i
            count+= 1
        if count!=0:
            result[i]=count
        i+=1
    if n>1:
        result[n]=1
    return result

def count(v):
    cnt=0
    num=1
    while cnt<=v:
        cnt+=num
        num+=1
        #print(cnt,num)
    return num-2

def main():
    n=int(input())
    F=factorize(n)
    #print(F)
    ans=0
    for val in F.values():
        #print(val,count(val))
        ans+=count(val)
    print(ans)
    
if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
from collections import defaultdict


def main():
    N = int(input())
    i = 2
    primes = defaultdict(int)
    while i**2 <= N:
        while N % i == 0:
            primes[i] += 1
            N //= i
        i += 1
    if N > 1:
        primes[N] = 1
    elements = list(primes.values())
    ans = 0
    for i in range(len(elements)):
        for j in range(1, 10):
            if elements[i] >= j:
                elements[i] -= j
                ans += 1
    print(ans)


if __name__ == "__main__":
    main()

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

Submission status: Accepted

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

def make_primes(n): #nまでの素数列挙
    ass = []
    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
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass  


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(int(n))
  return table

def make_divisors(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

n = onem()

kkk = prime_decomposition(n)
ppp = make_divisors(n)
k = s(kkk)
ans = 0

for i in range(len(k)):
	no = k[i]
	po = 1
	while True:
		if no[1] - po >= 0:
			no[1] -= po
			ans += 1
			po += 1
		else:
			break 
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
r = 0
for i, j in factorization(n):
    f = 1
    if i==1:
        break
    while j >= f:
        r += 1
        j -= f
        f += 1
print(r)

Submission status: Accepted

Solution code:
from __future__ import division, print_function

''' Hey stalker :) '''
INF = 10 ** 10
TEST_CASES = False
import math

def prime_factors(n):  # n**0.5 complex
    factors = dict()
    for i in range(2, math.ceil(math.sqrt(n)) + 1):
        while n % i == 0:
            if i in factors:
                factors[i] += 1
            else:
                factors[i] = 1
            n = n // i
    if n > 2:
        factors[n] = 1
    return (factors)

def main():
    n = get_int()
    fac = prime_factors(n)
    #print(fac)
    res = 0
    for key in fac:
        base = 1
        while fac[key]>=base:
            res += 1
            fac[key] -= base
            base += 1
    print(res)


''' FastIO Footer: PyRival Library, Thanks @c1729 and contributors '''
import os
import sys
from bisect import bisect_left, bisect_right
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip
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")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
# else:
#     sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")
get_int = lambda: int(input())
get_list = lambda: list(map(int, input().split()))

if __name__ == "__main__":
    if TEST_CASES:
        [main() for _ in range(int(input()))]
    else:
        main()

Submission status: Accepted

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

if N==1:
    print(0)
    sys.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
target=factorization(N)
ans=0
for i in target:
    count=1
    while(i[1]>=count):
        ans+=1
        i[1]-=count
        count+=1
print(ans)

Submission status: Accepted

Solution code:
from math import sqrt
from collections import Counter

def prime_factorization(n):
    counter = Counter()
    for i in range(2, int(sqrt(n)) + 1):
        while n % i == 0:
            n //= i
            counter[i] += 1

    if n != 1:
        counter[n] += 1

    return list(counter.items())

N = int(input())

candinates = []

for p, c in prime_factorization(N):
    # print(p, c)
    i = 1
    while i <= c:
        candinates.append(pow(p, i))
        c -= i
        i += 1


candinates.sort()

# print(candinates)

count = 0
for z in candinates:
    N, r = divmod(N, z)
    if r != 0:
        break
    count += 1

print(count)

Submission status: Accepted

Solution code:
N=int(input())
fn=N
li=[0]*(10**6+100)
flag=False
if N==1:
  print(0)
  exit()
for i in range(2,int(N**0.5)+1):
  while N%i==0:
    flag=True
    N/=i
    li[i]+=1
if flag==False:
  print(1)
  exit()

ans=0
if N>fn**0.5:
  ans+=1
  
for count in li:
  use=1
  while count-use>=0:
    ans+=1
    count-=use
    use+=1
print(ans)

Submission status: Accepted

Solution code:
def f(x):
    c = 1

    while x >= c:
        x -= c
        c += 1

    return c - 1


N = int(input())

ans = 0
for i in range(2, round(N**.5)):
    x = 0

    while N%i == 0:
        x += 1
        N //= i

    if x > 0:
        ans += f(x)


if N > 1:
    ans += 1

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

ls = factorization(N)

ans = 0
for p,e in ls:
    i = 1
    if p != 1:
        while e-i >= 0:
            e -= i
            i += 1
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
import math
from functools import reduce
from collections import deque, Counter
import sys
sys.setrecursionlimit(10**7)

def input():
    return sys.stdin.readline().strip()

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def rangeI(it, l, r):
    for i, e in enumerate(it):
        if l <= i < r:
            yield e
        elif l >= r:
            break

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

INF = 999999999999999999999999
MOD = 10**9+7

n = int(input())

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

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

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

    if len(arr) == 0:
        arr.append((n, 1))
    return arr

fac_ = prime_factorize(n)
fac = Counter(fac_)
# log(fac)

ans = 0
for p,e in fac.items():
    # log(p,e)
    x = e
    for i in range(1, 99999999):
        if x >= i:
            x -= i
            ans += 1
        else:
            break

print(ans)

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

c = collections.Counter(prime_factorize(N))

l = list(c.keys())
v = list(c.values())
cnt = 0
for i in range(len(l)):
    cnt += math.floor((math.sqrt(1+8*v[i])-1)/2)

if N == 1:
    print(0)
else:
    print(cnt)

Submission status: Accepted

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

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

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

    return arr

N = int(input())

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

primes = factorization(N)

ans = 0
for _, cnt in primes:
    n = 0
    while n * (n + 1) // 2 <= cnt:
        n += 1
    ans += n - 1

print(ans)

Submission status: Accepted

Solution code:
# input()
# int(input())
# map(int,input().split())
# list(map(int,input().split()))
# [input() for _ in range(n)]

import collections
import math

n = int(input())

c = collections.Counter()
i=2
nn = n
while nn!=1:
  #print(i)
  if i>math.sqrt(nn):
    c[nn]+=1
    break
  if nn%i==0:
    c[i]+=1
    nn = nn // i
  else:
    i += 1
#print(c)

ans = 0
for i in c.keys():
  j = 1
  while j<=c[i]:
    ans+=1
    c[i]-=j
    j+=1

if n==1:
  ans = 0

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
from sys import setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)

INF = int(1e10)
MOD = int(1e9 + 7)

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():
    from builtins import int, map
    n = int(input())
    if n == 1:
        print(0)
        exit()

    fn = factorization(n)
    cmax = max([f[1] for f in fn])
    z = set({})

    k = 1
    flag_get = True
    while flag_get and k <= cmax:
        flag = False
        for i in range(len(fn)):
            pi, ni = fn[i]
            if ni >= k:
                flag = True
                z.add(pi ** k)
                fn[i][1] -= k
        if not flag:
            break
        k += 1
    print(len(z))

if __name__ == '__main__':
    main()

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
cnt = 2
ss = 1
for num,k in chk:
  while k >= ss:
    ans += 1
    ss += cnt
    cnt += 1
    #print(num,k,ss,cnt,chk,ans)
  ss = 1
  cnt = 2

print(ans)

Submission status: Accepted

Solution code:
import collections
import bisect

def prim(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())
p=prim(n)
c = collections.Counter(p)
d=c.values()
m=0

l=[1]
for i in range(2,100):
        l.append(i+l[-1])
for i in d:
        m+=bisect.bisect_right(l,i)
print(m)

Submission status: Accepted

Solution code:
#!python3

iim = lambda: map(int, input().rstrip().split())

def factor(n):
    ans = []
    i = 0
    while n & 1 == 0:
        n >>= 1
        i += 1

    if i > 0:
        ans.append((2, i))

    for i in range(3, int(n**.5) +1, 2):
        x, y = divmod(n, i)

        if y == 0:
            j = 1
            x1 = x
            while True:
                x1, y = divmod(x, i)
                if y == 0:
                    x = x1
                    j += 1
                else:
                    ans.append((i, j))
                    break
            n = x

    if n > 1:
        ans.append((n, 1))

    return ans

def resolve():
    N = int(input())

    ans = 0
    for a, b in factor(N):
        c = 1
        while b >= c:
            b -= c
            ans += 1; c += 1
    print(ans)

if __name__ == "__main__":
    resolve()

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()
res = factorization(n)
d = dict()
for i,j in res:
    d[i] = j
ans = 0
for n in d.keys():
    for i in range(100):
        #print(d[n],i*(i+1)//2)
        if d[n] < i*(i+1)//2:
            ans += i-1
            break
        else:
            pass
print(ans)