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: Time Limit Exceeded

Solution code:
n = int(input())
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
  
def is_prime(num):
    for i in range(2, num):  # 第二引数は sqrt(num)+1 でも良い
        if num % i == 0:
            return False

    return True

def only_div(num_1, num_2):
    if num_2 > 1:
        while num_1 > 1:
            num_1 = num_1 / num_2
            if num_1 % 1 != 0:
                return(False)
                break
        else:
            return(True)
    else:
        return(False)

z = 0
count = 0

while True:
  z += 1 #zを1から探す
  #zが条件を満たすか確認
  list_ = make_divisors(z)
  for i in list_: #iはzの約数
    if is_prime(i) and only_div(z, i) and n % z == 0: #iは素数で、iのなんとか乗がz
      n = int(n / z) #nをzでわる。
      count += 1
      #print(n, z)
      break
  if n == 1:
    break

print(count)

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input())
H = N
count = 0
coun = 0
flag = False
lis = list()
for i in range(2,int(math.sqrt(N))+1):
  if N % i == 0:
    flag = True
    break
if flag == True:
  for i in range(2,int(math.sqrt(N))+100000000):
    if N%i == 0:
      count = 0
      while N%i == 0:
        N = N//i
        count += 1
      lis.append(count)
  M = len(lis)
  for i in range(M):
    su = 1
    for j in range(lis[i]):
      if lis[i] - su >= 0:
        lis[i] -= su
        su += 1
        coun += 1
if flag == True or H == 1:
  print(coun)
else:
  print(1)

Submission status: Time Limit Exceeded

Solution code:
#-------------------------------------------------------------------
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------
import math

def factorize(n):
  ret, a = [], n
  for i in range(2, int(n**0.5)+1):
    if a%i>0: continue
    c=0
    while a%i==0:
      a//=i
      c+=1
    else:
      ret.append((i,c))
  if a!=1: ret.append((a,1))
  return ret

#nの素数判定
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


n = int(input())
N = factorize(n)
#p(N)

i = 2
ans=0
while n >= i:
  if is_prime(n):
    n /= n
    ans += 1
    #p("ans=",ans)
  elif n % i ==0:
    for k,_ in N:
      a = math.log(i, k)
      #p("n,i,k,a,int(a)=",n,i,k,int(a),a)
      if int(a)==a:
        n /= i
        ans += 1
        #p("ans=",ans)

  i += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

def get_primenumber(N):
    prime_list = [2]
    for num in range(3,N+1,2):
      if all( num % prime != 0 for prime in prime_list):
        prime_list.append(num)

    return prime_list

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

pri = get_primenumber(100000)

l = []
for z in make_divisors(n):
  if n == 1:
    break
  if n == z:
    l.append(z)
    break
  for i in reversed(pri):
    for e in range(1,5):
      if z < i**e:
        break
      if z == i**e:
        if n%z == 0:
          l.append(z)
          n = int(n/z)
          if n == 1:
            print(l)
            exit()
        
print(len(l))

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
import sys
from random import randint
from math import gcd


def solve(N: int):
    # zの条件
    # - Nの約数
    # - 素数pのn乗
    # - 過去に選択したzと被らない
    n = N
    ds = make_divisors(n)
    print(ds)
    used = []
    while(True):
        count = len(used)
        for d in ds:
            if d in used:
                continue
            p, k = primePower(d)
            print(p)
            if p == 0:
                continue
            n /= d
            used.append(d)
            break

        if count == len(used):
            print(count)
            return
    return


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 findWitness(n, k=5): # miller-rabin
    s, d = 0, n-1
    while d % 2 == 0:
        s, d = s+1, d/2
    for i in range(k):
        a = randint(2, n-1)
        x = pow(a, d, n)
        if x == 1 or x == n-1: continue
        for r in range(1, s):
            x = (x * x) % n
            if x == 1: return a
            if x == n-1: break
        else: return a
    return 0


def primePower(n):
    def checkP(n, p):
        k = 0
        while n > 1 and n % p == 0:
            n, k = n / p, k + 1
        if n == 1: return p, k
        else: return 0, 0

    if n % 2 == 0: return checkP(n, 2)
    q = n
    while True:
        a = findWitness(q)
        if a == 0: return checkP(n, q)
        d = gcd(pow(a,q,n)-a, q)
        if d == 1 or d == q: return 0, 0
        q = d


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import math


n = int(input())
cnt_list = [1,3,6,10,15,21,28,36]

def get_list(i):
    loop_cnt = max([int(math.sqrt(i)) + 10, i])
    ret_list = []
    j = 2
    cnt = 0
    while j <= loop_cnt:
        if i % j == 0:
            i /= j
            cnt += 1
        else:
            if cnt > 0:
                for k in range(8):
                    if cnt < cnt_list[k]:
                        break
                for _ in range(k):
                    ret_list.append(j)
                cnt = 0
            j += 1
    if i != 1:
        ret_list.append(i)
    return ret_list

print(len(get_list(n)))

Submission status: Time Limit Exceeded

Solution code:
mod=1000000007
p_l=[]
def prime_t(t):
    i=2
    while i**2<=t:
        if t%i==0:
            return 0
        i+=1
    return 1

def prime_list(tt):
    #pl=[]
    ans=0
    ns=tt
    for i in range(2,tt+1):
        x=i
        if prime_t(i):
            if ns%i==0:
                while 1:
                    if ns%x: break
                    ans+=1
                    ns//=x
                    x*=i
        if i>ns:
            break

    return ans


n=int(input())
if n==1:
    print(0)
    exit()
ans=prime_list(n)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

factor = {}

a = 2
N0 = N

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

while N > 1:
    if N % a == 0:
        N //= a
        if a not in factor:
            factor[a] = 1
        else:
            factor[a] = factor[a] + 1
    else:
        a += 1

        if N0 < a * a:
            a = N0

count = 0

for f in factor.keys():
    e_sum = factor[f]

    e = 1

    while e_sum >= e:
        count += 1
        e_sum -= e
        e += 1
    
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = input()

N = int(N)
j = 0
i = 2
for i in range(i, N):
    if N % i == 0:
        N = N//i
        j += 1

print(j)

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(input())

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

if is_prime(n):
    print(1)
else:
    count = 0
    nums = []
    while n != 1:
        for i in range(2, 10*12):
            v, m = divmod(n, i)
            if m == 0:
                if i in nums:
                    continue

                nums.append(i)
                n = v
                count += 1
            else:
                pass

    print(count)

Submission status: Time Limit Exceeded

Solution code:
import math

def isPrime(num):
    if num < 2:
        return False
    elif num == 2:
        return True
    elif num % 2 == 0:
        return False

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


def find_all_prime(num):
    prime_list = [2]
    for i in range(3, num, 2):
        if isPrime(i):
            prime_list.append(i)

    return prime_list


if __name__ == "__main__":
    N = int(input())
    if isPrime(N):
        print(1)
    else:      
        prime_list = find_all_prime(int(1.25*10**6))
        count = 0  
        for i in prime_list:
            j = 1
            while N > 1:
                if N // i**j == 0:
                    break
                if N % i**j == 0:
                    N = N // i**j
                    count += 1
                j +=1
        
        print(count)

Submission status: Time Limit Exceeded

Solution code:
import math


def is_prime(n):
    if n == 1:
        return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


def primes(n):
    ps = {}
    x = n
    for i in range(2, n):
        if x == 1:
            break
        cnt = 0
        while x % i == 0:
            x = x // i
            cnt += 1
        if cnt > 0:
            ps[i] = cnt
        # print(n,i,cnt)

    return ps


def main():
    import decimal
    n = int(input())
    if n == 1:
        print(0)
        exit()

    if is_prime(n):
        print(1)
        exit()

    ps = primes(n)
    # print(ps)
    ans = sum([int(decimal.Decimal((-1 + (1 + 8 * v) ** 0.5) / 2)) for v in ps.values()])

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input())
H = N
count = 0
coun = 0
flag = False
lis = list()
for i in range(2,int(math.sqrt(N))+1):
  if N % i == 0:
    flag = True
    break
if flag == True:
  for i in range(2,int(math.sqrt(N))+1000000000):
    if N%i == 0:
      count = 0
      while N%i == 0:
        N = N//i
        count += 1
      lis.append(count)
  M = len(lis)
  for i in range(M):
    su = 1
    for j in range(lis[i]):
      if lis[i] - su >= 0:
        lis[i] -= su
        su += 1
        coun += 1
if flag == True or H == 1:
  print(coun)
else:
  print(1)

Submission status: Time Limit Exceeded

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

def iskaijo(n):
    i=1
    while True:
        if(n==1):
            break
        if(n%i==0):
            n=n/i
            i=i+1
        else:
            i=-1
            break
    return i


N=int(input())

ng=False
ans=0
List =prime_factorize(N)
c=collections.Counter(List)
for i in range(len(c.most_common())):
    test = c.most_common()[i][1]
    i=1
    while True:
        test=test-i
        i=i+1
        ans=ans+1
        if(test == 0):
            break
        # elif(test < 0 ):
        #     ng = True
        #     break

print(ans)

Submission status: Time Limit Exceeded

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
B = N
for z in range(2, int(N**(1/2))+1):
    if B == 1:
        break
    if B < z:
        break
    cnt = len(factorization(z))
    if cnt == 1 and B % z == 0:
        B = B // z
        #print(z)
        ans += 1

if(N == 1):
    print(0)
elif(N != 1 and ans == 0):
    print(1)
else:
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

total=0

sqrt_set = {0,1}

def isqrt(n):
    x = n
    y = (x + 1) // 2
    while y < x:
        x = y
        y = (x + n // x) // 2
    return x
  

for i in range(1,N+1):
  n = isqrt(i)
  sqrt_set.add(n)
  
sqrt_list = list(sqrt_set)
M = N
for i in sqrt_list:
  if i == 0 or i== 1:
    continue
  else:
    if M % i == 0:
      M = M//i
      total+=1
print(total)

Submission status: Time Limit Exceeded

Solution code:

def pri_me(x):
    if x == 2:
        return True
    for i in range(2,int(x**0.5)+1):
        if x%i==0:
            return False
    return True
#print(pri_me(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

n = int(input())
if n==1 or n == 0:
    print(0)
    exit()
if pri_me(n):
    print(1)
    exit()
N = n
ans = 0
for i in range(2,N+1):
    if n%i==0 and len(set(prime_factorize(i)))==1: 
        n=n//i
        ans += 1
        if n <=i:
            break
        #print(n,i)
        #print(len(set(prime_factorize(i)))
print(ans)

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt

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

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

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

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

    return arr

base=int(input())
tmp=base
num=[]
if is_prime(base):
  num.append(base)
else:
  for i in range(2, base+1):
    if i > tmp:
      break
    if tmp % i == 0 and len(factorization(i)) == 1:
      num.append(i)
      tmp/=i
print(len(num))

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
"""
import math

#def main(N):
def main():
    N = int(input())
    # Nが1のときは答えは0
    if N == 1:
        return 0
    else:
        N_remein = N
        # Nを素因数分解する。
        p_list = []
        p_factor_list = []
        p = 2
        while N_remein >= 2:
        #for p in range(2, math.ceil(math.sqrt(N))+1):
            if N_remein%p == 0:
                counter = 0
                #p_pow_counter = 1
                while True:
                    #p_pow_counter *= p
                    if N_remein%p == 0:
                        N_remein = N_remein//p
                        counter+=1
                    else:
                        p_list.append(p)
                        p_factor_list.append(counter)
                        break
            if p > math.ceil(math.sqrt(N)) and N_remein == N:
                break
            p += 1
        #print(p_list)
        #print(p_factor_list)
        # Nが素数の場合は、答えは1。
        if not p_factor_list:
            return 1
        else:
            answer = 0
            # 各素因数の指数に対して、、
            # 1,2,3,...と正整数を順番に引いていき、
            # 引けた回数を合計する。
            for factor in p_factor_list:
                counter = 1
                while (counter*(counter+1))//2 <= factor:
                    counter += 1
                answer += (counter-1) 
            #return answer, p_list, p_factor_list
            return answer

if __name__ == "__main__":
    print(main())
    #for i in range(1, 100):
    #    print(i, main(i))

Submission status: Time Limit Exceeded

Solution code:
import math
n = int(input())
prime = []
insu = {}
for i in range(2, math.ceil(math.sqrt(n))):
    if i > n:
        break
    flag = 0
    for p in prime:
        if i%p == 0:
            flag = 1
            break
    if flag == 0:
        prime.append(i)
        while n%i == 0:
            if i in insu:
                insu[i] += 1
            else:
                insu[i] = 1
            n //= i

if n != 1 and len(insu)==0:
    insu[n] = 1

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

print(count)

Submission status: Time Limit Exceeded

Solution code:
def solve():
    n = int(input())

    p = [2]
    A = 100000
    for L in range(3, A, 2): # 2 以外の素数は奇数なので
        if all(L % L2 != 0 for L2 in p):  # すべての既存素数で割り切れなかったら素数
            p.append(L)
    z = []
    for i in p:
        for e in range(1, 10):
            if n%i**e == 0 and i**e not in z:
                n /= i**e
                z.append(i**e)
    if not z: z.append(n)
    return len(z)
    

print(solve())

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
count = 0
for i in range(2,N):
    if N % i == 0:
        N = N / i
        count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
import sys
sys.setrecursionlimit(10 ** 9)
a = int(input())
count = 0
first = 2
def num_div(num):
  a = 2
  while num!=1:
    if num % a == 0:
      while True:
        if num % a ==0:
          num /= a
        elif num == 1:
          return 0
        else:
          return -1
    a += 1

#print(num_div(2))
#sys.exit(0)

while a!=1:
  #素因数は一つ？
  if a % first == 0:
    if num_div(first) == -1:
      first += 1
      continue
    else:
      a /= first
      count += 1
  first += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
from collections import defaultdict
from math import sqrt
n = int(input())
cnt = defaultdict(int)
index = defaultdict(int)
ans = 0
flag = True

def judge_prime(i):
    cnt = 0
    for j in range(1, int(sqrt(i)) + 1):
        if i % j == 0:
            cnt += 1
    
    if cnt == 1 and i != 1:
        return True
    else:
        return False

def calc_ans(cnt):
    ans = 0
    for v in cnt.values():
        i = 1
        cnt = 0
        while cnt + i <= v:
            cnt += i
            i += 1
        ans += i - 1
    return ans
if judge_prime(n):
    print(ans + 1)
    exit()
for i in range(2, n):
    if judge_prime(i):
        while n % i == 0:
            n //= i
            cnt[i] += 1
        if n == 1:
            break
print(calc_ans(cnt))

Submission status: Time Limit Exceeded

Solution code:
from queue import deque

N = int(input())

primenum = []

for i in range(2, N):
    for n in primenum:
        if i % n == 0:
            break
    else:
        primenum.append(i)

kouho_num = set()

for i in range(1, N//2):
    for n in primenum:
        if n ** i < N:
            kouho_num.add(n**i)
        else:
            break

queue = deque([(N, 0, kouho_num)])

divnum, countnum = 0, 0
pnum = set()

res = 0

while queue:
    divnum, countnum, pnum = queue.popleft()
    if divnum == 1:
        res = max(res, countnum)
        continue
    elif divnum < 0:
        continue
    for num in pnum:
        if divnum % num == 0:
            queue.append((divnum//num, countnum + 1, pnum - set([num])))

print(res)

Submission status: Time Limit Exceeded

Solution code:
import math

def isPrime(num):
    if num < 2:
        return False
    elif num == 2:
        return True
    elif num % 2 == 0:
        return False

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


def find_all_prime(num):
    prime_list = [2]
    for i in range(3, num, 2):
        if isPrime(i):
            prime_list.append(i)

    return prime_list


if __name__ == "__main__":
    N = int(input())
    if isPrime(N):
        print(1)
    else:      
        prime_list = find_all_prime(2*10**6)
        count = 0  
        for i in prime_list:
            j = 1
            while N > 1:
                if N // i**j == 0:
                    break
                if N % i**j == 0:
                    N = N // i**j
                    count += 1
                j +=1
        
        print(count)

Submission status: Time Limit Exceeded

Solution code:
import math


def is_prime(n):
    if n == 1:
        return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


def primes(n):
    ps = {}
    x = n
    for i in range(2, n):
        if x == 1:
            break
        cnt = 0
        while x % i == 0:
            x = x // i
            cnt += 1
        if cnt > 0:
            ps[i] = cnt
        # print(n,i,cnt)

    return ps


def main():
    import decimal
    n = int(input())
    if n == 1:
        print(0)
        exit()

    if is_prime(n):
        print(1)
        exit()

    ps = primes(n)
    # print(ps)
    # ans = sum([int(decimal.Decimal((-1 + (1 + 8 * v) ** 0.5) / 2)) for v in ps.values()])
    ans = 0
    for v in ps.values():
        i = 1
        while v - i >= 0:
            ans += 1
            v -= i
            i += 1

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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


def f(x):
    if x < 2:
        return False

    i = 2
    while i * i <= x:
        if x % i == 0:
            return False
        i += 1

    return True


n = int(input())

if f(n):
    print(1)
    exit()

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

ans = 0
used = set()
for e in primes:
    div = e
    while div <= n:
        if n % div == 0:
            ans += 1
            n //= div
            used.add(div)
        div *= e


print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
 
pn=[2];A=100000
for L in range(3,A):
    chk=True
    for L2 in pn:
        if L%L2 == 0:chk=False
    if chk==True:pn.append(L)
        
A246655 = []
for p in pn:
    pe = p
    while pe < A:
        A246655.append(pe)
        pe *= p
A246655 = sorted(A246655)
 
c=0
for i in range(len(A246655)):
    if N%A246655[i]==0:
        N = N//A246655[i]
        c+=1
print(c)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
primeNum = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999]

pow = 1
time = 0
while True:
    for p in primeNum:
        if pow <= N:
            z = p**pow
            if p <= N:
                if N % z == 0:
                    N = int(N / (z))
                    time+=1
            else:
                break
    pow+=1
    if pow >= N:
        break

print(time)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
counter = 0
for i in range(2,n):
    if n%i == 0:
        counter += 1
        n = n//i
print(counter)

Submission status: Time Limit Exceeded

Solution code:
def isprime(x):
    for i in range(2,int(x**0.5)+1):
        if x%i==0:
            return False
    return x!=1
def sieve(m):
    n=1
    primes = {}
    arr=set([])
    for i in range(2, int(m ** 0.5) + 1):
        a = n // i
        b = m // i
        for k in range(max(2, a), b + 1):
            c = i * k
            primes[c] = 1

    for i in range(max(n, 2), m + 1):
        if i not in primes:
            arr.add(i)

    return arr
arr=sieve(10**7)
dic={}
n=int(input())

if isprime(n):
    print(1)
    exit()
for i in arr:
    if n%i==0:
        cnt=0
        while n%i==0:
            cnt+=1
            n//=i
        dic[i]=cnt
ans=0
for i in dic:
    x=dic[i]
    r=(-1+(1+8*x)**0.5)//2
    ans+=r
print(int(ans))

Submission status: Time Limit Exceeded

Solution code:
n= int(input())

def div(x):
	for p in primes:
		if p>x**0.5:
			break
		if x%p== 0:
			return False
	return True

primes= [2]
for num in range(3, int(n**0.5)):
	if div(num):
		primes.append(num)

###

prime_factors= {}

while n != 1:
	for p in primes:
		if n%p==0:
			if p in prime_factors:
				prime_factors[p]+=1
				n= int(n/p)
				break
			else:
				prime_factors[p]=1
				n= int(n/p)
				break
		elif div(n):
			if n in prime_factors:
				prime_factors[n]+=1
				n=1
				break
			else:
				prime_factors[n]=1
				n=1
				break
tot= 0
for p in prime_factors:
	if prime_factors[p]>=36:
		tot+= 8
	elif prime_factors[p]>=28:
		tot+=7
	elif prime_factors[p]>=21:
		tot+=6
	elif prime_factors[p]>=15:
		tot+=5
	elif prime_factors[p]>=10:
		tot+=4
	elif prime_factors[p]>=6:
		tot+=3
	elif prime_factors[p]>=3:
		tot+=2
	else:
		tot+=1	
print(tot)

Submission status: Time Limit Exceeded

Solution code:
import math

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

N = int(input())
count = 0
p = 2
while p <= math.sqrt(N):
  if is_prime(p):
    e = 0
    NE = N
    while NE % (p**(e+1)) == 0:
      NE = NE / (p**(e+1))
      e += 1
      count += 1
  p += 1
if count == 0 and N >= 2:
  count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = input()

N = int(N)
j = 0

for i in range(2, N):
    if N % i == 0:
        N = N//i
        j += 1

print(j)

Submission status: Time Limit Exceeded

Solution code:
import sys
sys.setrecursionlimit(10 ** 9)
a = int(input())
count = 0
first = 2
def num_div(num):
  a = 2
  while num!=1:
    if num % a == 0:
      while True:
        if num % a ==0:
          num /= a
        elif num == 1:
          return 0
        else:
          return -1
    a += 1

#print(num_div(2))
#sys.exit(0)

while a!=1:
  #素因数は一つ？
  if num_div(first) == -1:
    first += 1
    continue
  if a % first == 0:
    a /= first
    first += 1
    count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
if n ==1:
    print(0)
    exit()

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)
    
ans = 0
if len(a)==1:
    print(1)
    exit()

for i in range(len(a)):
    if i==0:
        memory = a[i]
        counter = 1
        continue
    
    elif memory == a[i] and i!=len(a)-1:
        counter += 1
        continue
    
    else:
        if memory ==a[i]:
            counter+=1
        cnt = 0
        while counter > -1:
            cnt += 1
            if cnt<=counter:
                counter -= cnt
            else:
                ans+=(cnt)
        memory =a[i]
        counter =0
                
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

import math


n = math.sqrt(N) + 1

cm = []
idx = 2
while True:
    if N % idx == 0:
        N //= idx
        cm.append(idx)
    else:
        idx += 1
     
    if N == 1:
        break
        
    if (idx > n+1) and len(cm) == 0:
        print(1)
        exit()
        


#print(cm)

su = [0] * 1000
s = 0
for i in range(1, 40+1):
    s += i
    #print(s)
    su[s] = i
    
#print(su)

f = 0
for i in range(1000):
    if su[i] == 0:
        su[i] = f
    else:
        f = su[i]

#print(su)

count = 0
for i in list(set(cm)):
    #print(cm.count(i))
    count += su[cm.count(i)]

    
print(count)

Submission status: Time Limit Exceeded

Solution code:
import sys
N=int(input())
ans=0
for i in range(2,int(N**(1/2))+1):
  if N%i==0:
    break
  if i==int(N**(1/2)):
    print(1)
    sys.exit()
i=1
k=1
while N % (2**i) == 0:
  ans+=1
  N=N//(2**i)
  i+=1
while N % 2 == 0:
  N=N//2
f=3
while f <= N:
  if N % (f**k) == 0:
    ans+=1
    N=N//(f**k)
    k+=1
  else:
    while N % f == 0:
      N=N//f
    f += 2
    k=1
print(ans)