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


def sieve(x):
    """
    Sieve of Eratosthenes
    :param x: max value
    :return: list of bool
    """

    is_prime = [True] * (x + 1)
    is_prime[0] = is_prime[1] = False

    for i in range(2, x + 1):
        if is_prime[i]:
            for j in range(i * 2, x + 1, i):
                is_prime[j] = False

    return is_prime


n = int(input())

is_prime = sieve(10 ** 6)
primes = [i for i, e in enumerate(is_prime) if e]

d = defaultdict(int)
for e in primes:
    while n % e == 0:
        n //= e
        d[e] += 1

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

ans = 0
for v in d.values():
    mn = 1
    while v >= mn:
        v -= mn
        ans += 1
        mn += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
 
ans = 0
f = 2
while True:
  if N%f==0:
    c = 0
    while N%f==0:
      N /= f
      c += 1
    n = 1
    while n*(n+1)//2<=c:
      n += 1
    ans += n-1
  if f*f>N:
    break
  f += 1
if N>1:
  ans += 1
print(ans)

Submission status: Accepted

Solution code:
def resolve():
    import math

    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())
    p = prime_factorize(n)
    if len(p) == 0:
        print(0)
        return

    pn = list(set(p))
    ans = 0
    for m in pn:
        i = 1
        k = p.count(m)
        while(k > 0):
            k -= i
            i += 1
            if k >= 0:
                ans += 1
    print(ans)

resolve()

Submission status: Accepted

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


N = int(input())

l = [2]
for i in range(1, 9):
    l.append(l[i-1] + 2 + i)

l_N = factorization(N)
ans = []
for j in l_N:
    for k in range(len(l)):
        if j[0] == 1:
            continue
        if j[1] <= l[k]:
            ans.append(len(l[:k+1]))
            break
print(sum(ans))

Submission status: Accepted

Solution code:
import math
import numpy as np
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True
def prime_factor(n):
    ass = {}
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            if i not in ass:
                ass[i]=1
            else:
                ass[i]+=1
            n = n//i
    if n != 1:
        if n not in ass:
            ass[n]=1
        else:
            ass[n]+=1
    return ass
N=int(input())
if N==1:
    print(0)
    exit()
if is_prime(N):
    print(1)
    exit()
primelist=prime_factor(N)
num_list=[]
ans=0
for i,j in primelist.items():
    for k in range(1,j+1):
        num_list.append(i**k)
for i in num_list:
    if N%i==0:
        ans+=1
        N/=i
print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
if N == 1:
    print(0)
    exit()
div = {}
i = 2
while i*i <= N:
    while N % i == 0:
        N = N // i
        if i in div:
            div[i] += 1
        else:
            div[i] = 1
    if N == 1:
        break
    i += 1
if N != 1:
    div[N] = 1
ans = 0
for v in div.values():
    i = 1
    while v >= i:
        v -= i
        i += 1
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import collections

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

l = prime_factorize(p)
sl = set(l)
lsl = list(set(l))
c = collections.Counter(l)
ans = 0
#print(c)
#print(lsl)
for i in range(len(lsl)):
    cnt = 0
    #print(c[lsl[i]])
    #print(i)
    if c[lsl[i]] == 1:
        ans += 1
    else:
        for j in range(1, c[lsl[i]]):
            cnt += j

            #print(c[lsl[i]])
            if cnt <= c[lsl[i]]:
                ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
import collections
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]

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 main():
    N = II()
    n = N
    ans = 0

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

    else:
        numl = prime_factorize(N)
        j = len(set(numl))
        setl = list(set(numl))
        c = collections.Counter(numl)

        for i in setl:
            #print(i,c[i])
            k = 1
            ci = c[i]
            while True:
                if ci-k>=0:
                    ans += 1
                else:
                    break
                ci = ci-k
                k += 1


        print(ans)

        """
        for i in range(2,N+1):
            if n % i == 0:
                n = n/i
                ans += 1
            if n == 1:
                break
        print(ans)
        """

    


if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
#! /usr/bin/env python3

import sys
from collections import deque, Counter
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N = int(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


c = list(Counter(prime_factorize(N)).values())

ans = 0
used = {}

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

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
import pprint
import math

sys.setrecursionlimit(10 ** 6)

class Logger:
	def __init__(self, debug):
		self.debug = debug
	def print(self, *args):
		if self.debug:
			pprint.pprint(args)

def prime_fact(n):
	p = {}
	for i in range(2, int(-(-n**0.5//1))+1):
		if n % i == 0:
			while n % i == 0:
				n //= i
				p[i] = p.get(i, 0) + 1
	if n != 1:
		p[n] = p.get(n, 0) + 1
	return p
# s = n(n+1)/2 

def main():
	log = Logger(0)
	n = int(sys.stdin.readline())
	if n == 1:
		print(0)
		exit()
	p = prime_fact(n)
	ans = 0
	if len(p.keys()) == 0:
		print(1)
		exit(0)
	for key in p:
		i = 1
		while p[key] >= i:
			p[key] -= i
			ans += 1
			i += 1
	print(ans)


	# keys = list(p.keys())
	# key = keys[0]
	# i = 1
	# j = 0
	# while 1:
	# 	if p[key] < i:
	# 		j += 1
	# 		if len(keys) == j:
	# 			break
	# 		key = keys[j]
	# 		i = 1
	# 		continue
	# 	log.print(p, n, key)
	# 	z = key ** i
	# 	n /= z
	# 	p[key] -= i
	# 	ans += 1
	# 	i += 1
	# print(ans)


main()

Submission status: Accepted

Solution code:
import collections
from itertools import accumulate
from operator import add
import bisect

N = int(input())

def primef(n):
  i = 2
  p_nums = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      p_nums.append(i)
    i += 1
  if n > 1:
    p_nums.append(int(n))
  return p_nums

ans = primef(N)
ans = dict((collections.Counter(ans)))
con = 0

acadd = list(accumulate(range(1,30),add))

for k in ans.values():
  con += bisect.bisect_right(acadd,k)
    
print(con)

Submission status: Accepted

Solution code:
from collections import Counter
from itertools import accumulate


def prime_factorize(n):
    """素因数分解し，ユニークな素因数のsetを返す。"""
    ans = []
    ans_add = ans.append
    while n % 2 == 0:
        ans_add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            ans_add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        ans_add(n)
    return ans


def main():
    n = int(input())
    primes = prime_factorize(n)
    acc = tuple(accumulate(range(1, 42)))
    counted = Counter(primes)
    countcount = Counter(counted.values())
    ans = 0
    for c, cc in countcount.items():
        for i, x in enumerate(acc):
            if c < x:
                tmp = i
                break
        ans += tmp * cc
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from collections import Counter
from itertools import accumulate


def prime_factorize(n):
    """素因数分解し，ユニークな素因数のsetを返す。"""
    ans = []
    ans_add = ans.append
    while n % 2 == 0:
        ans_add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            ans_add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        ans_add(n)
    return ans


def main():
    n = int(input())
    primes = prime_factorize(n)
    acc = tuple(accumulate(range(1, 42)))
    counted = Counter(primes)
    countcount = Counter(counted.values())
    ans = 0

    for c, cc in countcount.items():
        for i, x in enumerate(acc):
            if c >= x:
                tmp = i + 1
            else:
                break
        ans += tmp * cc

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def furui(n):
    if n < 2:
        return []
    plist = [1 for i in range(n)]
    plist[0] = plist[1] = 0
    for i in range(2, n):
        if plist[i]:
            for j in range(i*2, n, i):
                plist[j] = 0
    ret = []
    for i in range(n):
        if plist[i] != 0:
            ret.append(i)
    return ret


primes = furui(1000000)
count = 0
N = int(input())


if N == 1:
    print(0)
else:
    # 素因数分解する
    factors = []
    for p in primes:
        if N % p == 0:
            e = 1
            while N % (p ** (e+1)) == 0:
                e += 1
            factors.append((p, e))
            N /= p ** e
    if N != 1:
        # 10^6より大きい素数
        factors.append((N, 1))
    # print(factors)

    # 数える
    count = 0
    for p, e in factors:
        s = 0
        for i in range(1, e+1):
            s += i
            if s <= e:
                # print(p ** i)
                count += 1
            else:
                break
    print(count)

Submission status: Accepted

Solution code:
N = int(input())

import math
def prime(x):
  p = {}
  last = math.floor(x ** 0.5)
  if x % 2 == 0:
    cnt = 1
    x //= 2
    while x & 1 == 0:
      x //= 2
      cnt += 1
    p[2] = cnt
  for i in range(3, last + 1, 2):
    if x % i == 0:
      x //= i
      cnt = 1
      while x % i == 0:
        cnt += 1
        x //= i
      p[i] = cnt
  if x != 1:
    p[x] = 1
  return p

p = prime(N)

ans = 0
for i in p.values():
  c = 1
  t = i
  while t >= c:
    t -= c
    ans += 1
    c += 1

print(ans)

Submission status: Accepted

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

if n == 1:
    print(0)
    exit()
else:
    c = collections.Counter(prime_factorize(n))

res = 0
for x, y in c.items():
    num = int( (-1 + (1 +8*y)**(0.5))/2 )
    res += num

print(res)

Submission status: Accepted

Solution code:
N = int(input())


def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        j = 0
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table


if N == 1:
    print(0)
else:
    table = prime_decomposition(N)
    temp = list(set(table))

    count = 0
    for i in range(len(temp)):
        c = table.count(temp[i])
        k = 1
        while c > 0:
            c -= k
            k += 1
            if c >= 0:
                count += 1

    print(count)

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
 
A = factorization(N)
 
def func(x):
    import math
    return int((-1+math.sqrt(1+8*x))/2)
 
ans = 0
for i in range (len(A)):
    ans = ans + func(A[i][1])
    
if N != 1:
  print(ans)
else:
  print(0)

Submission status: Accepted

Solution code:
import collections
import sys

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

Z = prime_factorize(N)

if not Z:
    print(0)
    sys.exit(0)

P = collections.Counter(Z)

#print(P)

x = 0

for i in P.values():
    #print(i)
    y = 0
    z = 0
    for j in range(1, i+1):
        y = y + j
        z += 1
        #print(i, y, z)
        if y >= i:
            if y > i:
                z -= 1
            break
    
    x = x + z

print(x)

Submission status: Accepted

Solution code:
n=int(input())
a=p=1
while p<1e6:
 c=t=0;p+=1
 while n%p<1:n//=p;x=c==t;t+=x;c+=1-t*x;a+=x
print(a-(n<2))

Submission status: Accepted

Solution code:
import math
N = int(input())
if N == 1:
    print(0)
    exit()
 
#素数リスト
M = int(math.sqrt(N))+1
sosu = [2]
a = 0
for i in range(3,M,2):
  if sosu[a] <= math.sqrt(i):
    a += 1
  hantei = (i%x for x in sosu[:a+1])
  if 0 not in hantei:
    sosu.append(i)
 
soin = []
for p in sosu:
    for j in range(1,N+1):
        pe = p**j
        if N % pe != 0:
            if pe != p:
                soin.append(j-1)
                N //= p**(j-1)
            break

Ans = 0
if N != 1:
    Ans += 1

for k in soin:
    if k == 1:
        Ans += 1
        continue
    for n in range(1,k+1):
        if (n*(n+1))//2 > k:
            Ans += n-1
            break
print(max(Ans,1))

Submission status: Accepted

Solution code:
import sys
N = int(sys.stdin.readline().rstrip())

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

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 = set(a)
    if len(a) == 1:
        return True
    else:
        return False

divisors = make_divisors(N)
ans = 0
for d in divisors:
    if prime_factorize(d) and N % d == 0:
        N //= d
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
# Python program to print prime factors 
global l
l=[]
import math 

# A function to print all prime factors of 
# a given number n 
def primeFactors(n): 
	
	# Print the number of two's that divide n 
	while n % 2 == 0: 
		l.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: 
			l.append(int(i)) 
			n = n / i 
			
	# Condition if n is a prime 
	# number greater than 2 
	if n > 2: 
		l.append(int(n))
		


n = int(input())
primeFactors(n)

s=list(set(l))
#print(s)
ans=0
for i in range(len(s)):
    c=s[i]
    while c<=n:
        if n%c==0:
            n=int(n/c)
            ans+=1
            c*=s[i]
        else:
            break
            
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

def main():
    n = int(input())
    if n == 1:
        print(0)
        return 0
    l = factorization(n)
    cnt = 0
    for i in range(len(l)):
        tmp = l[i][1]
        for j in range(1,l[i][1]+1):
            if j <= tmp:
                cnt += 1
                tmp -= j
            else:
                break
    print(cnt)

if __name__ == '__main__':
    main()

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 main():
    n = int(input())
    if n == 1:
        print(0)
        exit()

    d = collections.Counter(prime_factorize(n))
    #print(d)

    ans = 0
    for _, cnt in d.items():
        now = 1
        while cnt >= now:
            #print("cnt:",cnt,"now:",now)
            cnt -= now
            now += 1
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math

n = int(input())
i = 2
count = 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

a = factorization(n) 
a_l = len(a)
#print(a)
ans = 0

for i in range(a_l):
  w = a[i][1]
  w_n = 1
  c_n = 0
  while True:
    if w < w_n:
      break
    else:
      w = w-w_n
      w_n = w_n + 1
      c_n = c_n + 1
  ans = ans + c_n
if n == 1:
  print(0)
else:
  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

if n == 1:
    print(0)
    quit()
f = factorization(n)
ans = 0
c = len(f)
for i in range(c):
    s = 0
    g = f[i][1]
    for j in range(g):
        s += j + 1
        f[i][1] -= j+1
        if s > g:
            break
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for i in range(2, 10 ** 6 + 1):
    for x in range(1, 40):
        y = i ** x
        if N // y == N / y:
            ans += 1
            N = N // y
        else:
            while N // i == N / i:
                N = N // i
            break


if N > 10 ** 6:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
import itertools
import math
import fractions
import functools
import copy
from collections import deque
from functools import reduce
from decimal import Decimal

n = int(input())
prime = {}

num = n
i = 2
while True:
    if i * i > n:
        if(num > 1):
            prime[num] = 1
        break
    while num%i == 0:
        prime[i] = prime.get(i, 0) + 1
        num = num//i
    i += 1

count = 0
for val in prime.values():
    use = 1
    while True:
        if(val < use):
            break
        val -= use
        use += 1
        count+=1
print(count)

Submission status: Accepted

Solution code:
def main():
    import sys
    sys.setrecursionlimit(10**9)
    input = sys.stdin.readline

    N = int(input())

    if N == 1:
        print(0)
        return

    def prime_factorization(n):
        from collections import Counter
        p = Counter()
        while n % 2 == 0:
            p[2] += 1
            n //= 2

        i = 3
        while i*i <= n:
            if n % i == 0:
                p[i] += 1
                n //= i
            else:
                i += 2

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

        return p

    d = prime_factorization(N)

    ans = 0
    for i in d:
        tmp = 1
        for j in range(d[i]):
            tmp *= i
            if N % tmp == 0:
                ans += 1
                N //= tmp
            else:
                break
            if N == 1:
                break
        if N == 1:
            break

    print(ans)

main()

Submission status: Accepted

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

l = prime_factorize(N)
c = collections.Counter(l)

kazu_l = [1, 1]
t = 1
for i in range(100):
    for j in range(t+2):
        kazu_l.append(t+1)
    t += 1

v = list(c.values())
ans = 0

for i in range(len(v)):
    ans += kazu_l[v[i]-1]

print(ans)

Submission status: Accepted

Solution code:
import heapq
import math

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

li = factorization(n)
ans = 0
for f in li:
    f = f[1]
    for i in range(1,f+1):
        if i>f:
            break
        f-=i
        ans+=1
print(ans)

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
A = prime_factorize(N)
b = {}
for i in A:
    if i not in b:
        b[i] = 1
    elif i in b:
        b[i] += 1
count = 0
for v in b.values():
    if v >= 45:
        count += 9
        continue
    
    elif v >= 36:
        count += 8
        continue
    elif v >= 28:
        count += 7
        continue
    elif v >= 21:
        count += 6
        continue
    
    elif v >= 15:
        count += 5
        continue
    elif v >= 10 :
        count += 4
        continue
    elif v >= 6:
        count += 3
        continue
    elif v >= 3 :
        count += 2
        continue
    elif v >= 1 :
        count += 1
        continue
#print(b)
print(count)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

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

prime_list = prime_factorize(N)

# 通ったやつ
# if prime_list:
#     for prime_num in prime_list:
#         if N % prime_num == 0:
#             for j in range(1, 100):
#                 if N < prime_num**j:
#                     break
#                 if N % prime_num**j == 0:
#                     N //= prime_num**j
#                     ans += 1

# 通ってないやつ
if prime_list:
    for prime_num in prime_list:
        if N % prime_num == 0:
            i = 1
            while N % prime_num**i == 0:
                N //= prime_num**i
                ans += 1
                i += 1


print(ans)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

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

prime_list = prime_factorize(N)

# 通ったやつ
if prime_list:
    for prime_num in prime_list:
        if N % prime_num == 0:
            for j in range(1, 100):
                if N < prime_num**j:
                    break
                if N % prime_num**j == 0:
                    N //= prime_num**j
                    ans += 1

# 通ってないやつ
# if prime_list:
#     for prime_num in prime_list:
#         if N % prime_num == 0:
#             i = 1
#             while N % prime_num**i == 0:
#                 N //= prime_num**i
#                 ans += 1
#                 i += 1


print(ans)

Submission status: Accepted

Solution code:
import math
n = int(input())
if n==1:
    print(0)
    quit()
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 sigma(n):
    s=0
    for i in range(1,n+1):
         s+=i
    return s
ans = 0
for f in factorization(n):
    index = f[1]
    num=1
    while True:
        num+=1
        if index<sigma(num):
            ans+=num-1
            break
print(ans)

Submission status: Accepted

Solution code:
def fanction(n):
    listIn = []
    tmp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if tmp % i == 0:
            cnt_in = 0
            while tmp % i ==0:
                cnt_in += 1
                tmp //= i
            listIn.append([i, cnt_in])
 
    if tmp != 1:
        listIn.append([tmp, 1])
 
    return listIn
    
N = int(input())
 
arr = fanction(N)
 
tmp = 1
count = 0
for a, b in arr:
    while 'true':
        if b >= tmp:
            b -= tmp
            count += 1
            tmp += 1
        else:
            tmp = 1
            break
 
print(count)

Submission status: Accepted

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

import collections

c = collections.Counter(prime_factorize(N))

ans = 0
for i in c.keys():
    num = c[i]
    m = 2
    while num > 0:
        num = num - m
        m += 1
        ans += 1

print(ans)

Submission status: Accepted

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

    if tmp != 1:
        listIn.append([tmp, 1])

    return listIn
    
N = int(input())

arr = fanction(N)

tmp = 1
count = 0
for a, b in arr:
    while 'true':
        if b >= tmp:
            b -= tmp
            count += 1
            tmp += 1
        else:
            tmp = 1
            break

print(count)

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())
sosu = prime_factorize(N)
history = set()
count = 0
while len(sosu) > 0:
    num = sosu.pop(0)
    cursor = num
    while True:
        if num not in history:
            history.add(num)
            break
        if (len(sosu) <= 0):
            break
        if (cursor != sosu[0]):
            break
        num *= sosu.pop(0)

print(len(history))

Submission status: Accepted

Solution code:
n = int(input())

def divisorize(fct):
    b, e = fct.pop()  # base, exponent
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]


def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a


if n==1:
    print(0)
else:
    div = []
    count = 0
    fct = factorize(n)
    div += [num(div) for div in divisorize(fct)]
    div = sorted(div)
    #div = div
    for i in div[1:]:
        fct2 = factorize(i)
        if n%i==0 and len(fct2)==1:
            n = n/i
            count += 1
        if n==1:
            break
    print(count)

Submission status: Accepted

Solution code:
n = int(input())
lst = []
temp = n
s = 0
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
    lst.append(cnt)
    for x in range(1,9):
      if x*(x+1)/2 <= cnt and (x+2)*(x+1)/2 > cnt:
        break
    s = s+x    

if temp!=1:
  s = s + 1
if n == 1:
  s = 0
elif lst==[]:
  s = 1

print(s)