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:
import math
def prime(n):
  for x in range(2, math.isqrt(n)+1):
    if n%x==0:
      return False
  return True

n = int(input())
count = 0
h = math.isqrt(n)
for x in range(2,h+1):
  if n==1:
    break
  if not prime(x):
    continue
  p = 1
  while n>1 and n%(x**p)==0:
    n //= (x**p)
    count += 1
    p += 1

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

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt
n=int(input())
rn=int(sqrt(n))
s=[0]*(rn+1)
s[0]=-1
s[1]=-1
t=[0]*(rn+1)
for i in range(2,rn+1):
    if s[i] != 0:
        continue
    s[i] = i
    j = i
    while j < rn + 1:
        t[j] = 1
        j *= i
        for j in range(i * i, rn + 1,i):
            if s[j] == 0:
                s[j] == i

result = 0
last = -1
for i in range(2,rn+1):
    if t[i] == 0:
        continue
    if n % i == 0:
        result += 1
        n //= i
        last =i
if n != 1 and n > rn:
    result += 1
print(result)

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt
n=int(input())
rn=int(sqrt(n))
s=[0]*(rn+1)
s[0]=-1
s[1]=-1
t=[0]*(rn+1)
for i in range(2,rn+1):
    if s[i] != 0:
        continue
    s[i] = i
    j = i
    while j < rn + 1:
        t[j] = 1
        j *= i
        for j in range(i * i, rn + 1):
            if s[j] == 0:
                s[j] == i

result = 0
last = -1
for i in range(2,rn+1):
    if t[i] == 0:
        continue
    if n % i == 0:
        result += 1
        n //= i
        last =i
if n != 1 and n > rn:
    result += 1
print(result)

Submission status: Time Limit Exceeded

Solution code:

def f(exponent):
	#reurns how many times a prime raised to exponent can be used
	step = 1
	cumul = 0
	count = 0
	while( cumul <= exponent):
		cumul += step
		count +=1
		step +=1
	return count - (1 if cumul > exponent else 0)

def answer(n):
	if n == 1: return 0
	res = 0
	on = n
	d = 2
	while(d * d <= on and n > 1):
		if n % d == 0:
			e = 0
			while(n%d == 0): e +=1
			res+= f(e)
		d +=1
	return res if n == 1 else 1

print answer(int(raw_input()))

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:
N = int(input())
ans = 0

def pf(n):
    ret = []
    for i in range(2, n):
        if n % i != 0: continue
        c = 0
        while n % i == 0:
            c += 1
            n //= i
        ret.append((i, c))
    while n % 2 ==0:
        n //= 2
        ret.append(2)
    f = 3
    c = 0
    while f * f <= n:
        if n % f == 0:
            c += 1
            n //= f
        else:
            ret.append((f, c))
            c = 0
            f += 2
    if n != 1:
        ret.append((n, 1))
    return ret

for p in pf(N):
    i, c = p
    t = 1
    while c >= t:
        c -= t
        t += 1
        ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
def prime(num):
    c=0
    for i in range(2,num+1):
        if num%i==0:
            c+=1
    if c==1:
        return True
    else:
        return False


def getFACT(number):
    arr=[i for i in range(2,number+1) if number%i==0]
    return arr


N=eval(input())
count=0
if prime(N)==True:
    count=1

else:
    factors=getFACT(N)
    for Z in factors:
        if N%Z==0:
            if prime(Z)==True:
                count+=1
                N=N//Z
            else:
                f=0
                psntFACT=getFACT(Z)
                for i in psntFACT:
                    if prime(i)==True:
                        f=1
                        break
                    

                if f==1:
                    count+=1
                    N=N//Z
        
        if N==1:
            break

print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
t = n
pf = []
i = 2
if n == 1:
    print(0)
    exit()

while i <= n or i ** 2 <= t:
    j = 0
    while n % i == 0:
        n = n // i
        j += 1
    if j > 0:
        pf.append(j)
    i += 1
if len(pf) == 0: pf.append(1)

ans = 0
for i in pf:
    tmp = i
    j = 1
    while j <= tmp:
        tmp -= j
        ans += 1
        j += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
import decimal


def main():

    N = int(input())
    ans = 0
    pn = [2]
    A = int(math.ceil(N**0.5)+1)

    if N >= 3:
        for L in range(3, A):
            chk = True
            for L2 in pn:
                if L % L2 == 0:
                    chk = False
            if chk == True:
                pn.append(L)
    elif N == 2:
        print(1)
        return
    else:
        print(0)
        return

    for i in pn:
        d = i
        while(True):
            if N % d == 0:
                N /= d
                ans += 1
                d *= i
            else:
                break

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
pf = []
i = 2
while n > 1:
    j = 0
    while n % i == 0:
        n = n // i
        j += 1
    if j > 0:
        pf.append(j)
    i += 1

ans = 0
for i in pf:
    tmp = i
    j = 1
    while j <= tmp:
        tmp -= j
        ans += 1
        j += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
import decimal


def main():

    N = int(input())
    ans = 0
    pn = [2]
    A = int(math.ceil(N**0.5)+1)

    if N >= 3:
        for L in range(3, A):
            chk = True
            for L2 in pn:
                if L % L2 == 0:
                    chk = False
            if chk == True:
                pn.append(L)
    elif N == 2:
        print(1)
        return
    else:
        print(0)
        return

    for i in pn:
        cnt = 0
        while(True):
            if N % i == 0:
                N /= i
                cnt += 1
            else:
                break

        for j in range(1, A):
            if cnt-j >= 0:
                ans += 1
                cnt -= j
            else:
                break

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

a = int(input())
li = []
li = fact(a)
count = 0
i = 0
dif = 1

while i < len(li):
    if a == 1:
        break
    
    if li[i][1] >= dif:
        count += 1
        li[i][1] -= dif
        dif += 1
    
    if li[i][1] <= 1:
        dif = 1
        i += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
import math
import copy 
N = input()
N = np.int64(N)
# print(np.sqrt(N))
l = []
x  = 2
while N>1:
    if N%x ==0:
        l.append(x)
        N = N/x
    else:
        x = x + 1
        if x > np.sqrt(N):
            l.append(int(N))
            break
# l = [2, 2, 2, 3, 3, 3, 5, 5, 5, 6079, 6079]
# l = [2, 2, 2, 3]
l2 = []
while l!=[]:
#     print(l)
    i = l[0]
    n = l.count(i)
    l = l[n:]
    l2.append(n)
    if l==[]:break
# print(l2)
# print('///')

i = 0
m = 0
l2 = np.array(l2)
# print(l2)
ans = 0
while True:
    i += 1
#     m = m + i
#     print(m)
    l2 = l2-i
    l2 = l2[l2>=0]
    ans = ans + len(l2)
#     print(l2)
    if len(l2)==0:break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
nn=N
import math
sq=round(math.sqrt(N))+1

i=2
ans=0
count1=0
count2=1
while sq>=i:
    if nn%i==0:
        nn//=i
        count1+=1
        if count1==count2:
            ans+=1
            count2+=1
            count1=0
            sq=N//i
    else:
        i+=1
        count1=0
        count2=1

if ans==0 and N>=2:
    ans+=1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
def calc(n):
    A=[]
    while n%2==0:
        n//=2
        A.append(2)
    x=3
    while n!=1:
        if n%x==0:
            n//=x
            A.append(x)
        else:
            x +=2
    return A

number=int(input())
consequence=calc(number)
c=list(set(consequence))

ans=0

for i in range(len(c)):
    Count=consequence.count(c[i])
    d=f=1
    while Count >= d:
        f +=1
        d +=f
        ans +=1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys
import math
import copy

def is_prime(N):
    i = 2
    while i * i <= N:
        if N % i == 0:
            return i
        i += 1
    return N

def main():
    N = int(input())
    if N == 1:
        print(0)
        sys.exit()
    a = is_prime(N)
    if a == N:
        print(1)
        sys.exit()
    else:
        count = 0
        ori_N = copy.copy(N)
        for i in range(2, ori_N):
            if N < i:
                break
            if N % i == 0:
                a = is_prime(i)
                if a == i:
                    count += 1
                    N //= i
                else:
                    now = i
                    while now > a:
                        now /= a
                        if now == a:
                            count += 1
                            N //= i
        print(count)

if __name__ == '__main__':
     main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ans = 0
aaa = 2
maxi = 2
def prime(aaa):
    if n != 1:
        i = 2
        while i*i <= aaa:
            if aaa % i == 0:
                return False
            i += 1
        return True
    else:
        return False
def make_divisors(n):
    if prime(n):
        return True
    a = 0
    i = 2
    while i <= n:
        if n % i == 0:
            if a == 0:
                a = i
                n /= i
                i -= 1
                if n == 1:
                    return True
            elif a == i:
                n /= i
                i -= 1
                if n == 1:
                    return True
                pass
            else:
                return False
        i += 1
    return True
def divisors(a, i):
    global ans, aaa, maxi
    while i <= n and i <= a:
        if prime(a) and i * i <= a:
            ans += 1
            break
        if a % i == 0:
            if make_divisors(i):
                ans += 1
                num = a / i
                aaa = num
                if maxi <= i:
                    maxi = i
                divisors(num, i+1)
                break
        i += 1
if n == 1:
    print(0)
else:
    if prime(n):
        print(1)
    else:
        divisors(n, 2)
        print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys
import math
import copy

def is_prime(N):
    if N == 1:
        return False
    i = 2
    while i * i <= N:
        if N % i == 0:
            return False
        i += 1
    return True


def main():
    N = int(input())
    if N == 1:
        print(0)
        sys.exit()
    if is_prime(N):
        print(1)
        sys.exit()
    else:
        count = 0
        ori_N = copy.copy(N)
        for i in range(2, ori_N):
            if N < i:
                break
            if N % i == 0:
                if is_prime(i):
                    count += 1
                    N //= i
                else:
                    j = 2
                    while i % j != 0:
                        j += 1
                    now = i
                    while now > j:
                        now /= j
                        if now == j:
                            count += 1
                            N //= i
        print(count)

if __name__ == '__main__':
     main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ans = 0
aaa = 2
maxi = 2
def prime(aaa):
    if n != 1:
        i = 2
        while i*i <= aaa:
            if aaa % i == 0:
                return False
            i += 1
        return True
    else:
        return False
def make_divisors(n):
    if prime(n):
        return True
    a = 0
    i = 2
    while i <= n:
        if n % i == 0:
            if a == 0:
                a = i
                n /= i
                i -= 1
                if n == 1:
                    return True
            elif a == i:
                n /= i
                i -= 1
                if n == 1:
                    return True
                pass
            else:
                return False
        i += 1
    return True
def divisors(a, i):
    global ans, aaa, maxi
    while i <= n and i <= a:
        if a % i == 0:
            if make_divisors(i):
                ans += 1
                num = a / i
                aaa = num
                if maxi <= i:
                    maxi = i
                divisors(num, i+1)
                break
        i += 1
if n == 1:
    print(0)
else:
    if prime(n):
        print(1)
    else:
        divisors(n, 2)
        print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys
import math


def is_prime(N):
    if N == 1:
        return False
    i = 2
    while i * i <= N:
        if N % i == 0:
            return False
        i += 1
    return True


def main():
    N = int(input())
    if N == 1:
        print(0)
        sys.exit()
    if is_prime(N):
        print(1)
        sys.exit()
    else:
        count = 0
        for i in range(2, N):
            if N < i:
                break
            if N % i == 0:
                if is_prime(i):
                    count += 1
                    N //= i
                else:
                    j = 2
                    while i % j != 0:
                        j += 1
                    now = i
                    while now > j:
                        now /= j
                        if now == j:
                            count += 1
                            N //= i
        print(count)

if __name__ == '__main__':
     main()

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

    ans = 0

    for i in range(2, n):
        if n == 1:
            break
        cnt = 1
        while n % (i ** cnt) == 0:
            # print(n, i, cnt)
            n = n // (i ** cnt)
            cnt += 1
        else:
            while n % i == 0:
                n = n // i
        ans += cnt - 1

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans = 0

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

prime_list = prime_factorize(N)

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

Solution code:
import math


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


def using_sqrt(limit):
    n = []
    for k in range(2, limit + 1):
        factor = 0

        # 2以外の偶数は素数ではないので無視する
        if k % 2 == 0 and k != 2:
            continue

        # 繰り返しの上限を対象の平方根にする
        for divisor in range(2, math.floor(math.sqrt(k)) + 1):
            if k % divisor == 0:
                factor += 1

        if factor == 0:
            n.append(k)

    return n


def isPrime(limit):
    for k in range(limit, limit + 1):
        factor = 0

        # 2以外の偶数は素数ではないので無視する
        if k % 2 == 0 and k != 2:
            continue

        # 繰り返しの上限を対象の平方根にする
        for divisor in range(2, math.floor(math.sqrt(k)) + 1):
            if k % divisor == 0:
                factor += 1

        if factor == 0:
            return True
    return False


n = int(input())
prime = using_sqrt(50**5)
prev = []

if n > 1 and isPrime(n):
    print(1)
    exit()


def check(n, prev):
    divs = make_divisors(int(n))
    flag = False
    for i in divs[1:]:
        for p in prime:
            e = math.log(i, p)
            if e.is_integer() and i not in prev:
                prev.append(i)
                flag = True
                check(n/i, prev)
                break
        if flag:
            break


check(n, prev)
print(len(prev))

Submission status: Time Limit Exceeded

Solution code:
import collections
n=int(input())
if n==1:
  print(0)
  exit()
b=int(n**0.5)
if all(n%aa!=0 for aa in range(2,b+1)):
  print(1)
  exit()
  
i=2
l=[]
cnt=0
while True:
  cnt+=1
  if n==1:
    break
  if n%i==0:
    l.append(i)
    n=n//i
  else:
    i+=1
c=collections.Counter(l)
v=list(c.values())
ans=0
for vv in v:
  wa=1
  s=1
  while True:
    if vv<wa:
      break
    s+=1
    wa+=s
  ans+=(s-1)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
def soinsu(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())
a=soinsu(n)
c=[]
if n>=2:
    for i in range(max(a)):
        c.append(0)
for i in a:
    c[i-1]+=1
f=0
if n>=2:
    f=max(c)
    s=[]
    for i in range(f+1):
        s.append(0)
    for i in c:
        s[i]+=1
z=0
g=[1]
d=1
e=1
while e<=f:
    d+=1
    e=d*(d+1)/2
    g.append(e)
for i in range(len(g)):
    g[i]=int(g[i])
for i in range(1,len(g)):
    z+=i*(sum(s[g[i-1]:g[i]]))


print(z)

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
 
import sys     
N = int(input())
if N == 1:
    print(0)
    sys.exit()
# if isPrime(N)==True:
#     print(0)
fact = factorization(N)
fact_num = []
fact_num2 = []
 
    
for i in range(len(fact)):
    fact_num.append(fact[i][0])
    fact_num2.append(fact[i][1])
 
cnt=0
 
for j in range(10**12):
    for i in range(len(fact)):
        if N%fact_num[i]==0 and N%(fact_num[i]*(j+1))==0:
            N = N/(fact_num[i]*(j+1))
            cnt+=1
 
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
num = int(input())
l = []
cnt = 0

for i in range(1,num):
    if num % i == 0:
        l.append(i)

for z in l[1:]:
    if num == 1:
        break
    elif num % z == 0:
        num /= z
        cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
k=2
p=0
m=n/2
while k<=m:
  if n%k==0:
    n=n/k
    p=p+1
  k=k+1
print(p)

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt
n = int(input())
ans = 0
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 i > n:
        break
    if judge_prime(i):
        j = 1
        while n % (i ** j) == 0:
            n //= (i ** j)
            j += 1
            ans += 1
            if i ** j > n:
                break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
def get_prime(n):
    if n <= 1:
        return []
    prime = [2]
    if n > 2:
        limit = int(math.sqrt(n))
        odd = [i for i in range(3, n + 1, 2)]
        while limit >= odd[0]:
            prime.append(odd[0])
            odd = [j for j in odd if j % odd[0] != 0]
        prime += odd
    return prime

from collections import defaultdict
def prime_factorization(n):
    if n <= 1:
        return False
    else:
        # print(int(math.sqrt(n)))
        prime = get_prime(int(math.sqrt(n)))
        dct = defaultdict(int)
        for p in prime:
            while n % p == 0:
                dct[p] += 1
                n //= p
        if n != 1:
            dct[n] += 1
        dct = dict(dct)
        return dct


n = int(input())
select = []
for i in range(2, n):
    pf = prime_factorization(i)
    if len(pf) == 1:
        p, e = list(pf.keys())[0], list(pf.values())[0]
        z = p ** e
        if n % z == 0 and z not in select:
            select.append(z)
            n //= z
    if n == 1:
        break

print(len(select))

Submission status: Time Limit Exceeded

Solution code:
import math as mp
N = int(input())
count=0
for i in range(2, int(N/2+1)):
    q, mod = divmod(N,i)
    if mod ==0:
        count = count+1
        N = q

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

Submission status: Time Limit Exceeded

Solution code:
import math
#試し割法
def trial_division(n):
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            if num not in factor:
                factor.append(num)
    #リストが空ならそれは素数
    if not factor:
        return 'prime number'
    else:
        factor.append(n)
        return factor
    
n=int(input())
if n==1:
  ans=0
elif trial_division(n)== 'prime number':
    ans=1
else:
    z=2
    ans=0
    while z <= n:
        if trial_division(z)== 'prime number' and n%z ==0:
            n = n/z
            z += 1
            ans += 1
        elif len(trial_division(z))==2 and n%z ==0:
            n = n/z
            z += 1
            ans += 1
        
print(ans)

Submission status: Time Limit Exceeded

Solution code:
def factorization(n):
    temp = n
    coun=0
    for i in range(2,n):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            for l in range(1,cnt+1):
                cnt-=l
                #print(cnt)
                if cnt<0:
                    pass
                else:
                    coun+=1

    return coun
n =int(input())

print(factorization(n))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

repeat = [1]*9
for i in range(1,10):
    repeat[i-1] = i*(i+1)//2

d = 1
ans = 0
judge = False
while n != 1:
    if d > 10**6 +1 and ans == 0:
        ans = 1
        break
    d += 1
    count = 0
    if n%d == 0:
        judge = True
        j = -1
    while n%d == 0:
        n = n//d
        count += 1
    while judge:
        j += 1
        if count < repeat[j]:
            ans += j
            judge = False

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
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
if is_prime(n):
    print("1")
    
else:
    used = []
    ans = 0
    for i in range(2,int(math.sqrt(n)) + 1):
        if is_prime(i):
            if n%i ==0:
                n = n/i
                count = 2
                j = i**count
                while j < n:
                    j = i**count
                    count += 1
                    used.append(j)
                ans += 1    
        elif i in used:
            if n%i ==0:
                n = n/i
                ans += 1
        
        if i > n:
            break
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
count = 0
for z in range(n):
    if n%(z+2) == 0:
        n =n/(z+2)
        count += 1
    else:
        continue
print(count)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

import math

# 素数判定関数
def isPrime(num):
    # 2未満の数字は素数ではない
    if num < 2: return False
    # 2は素数
    elif num == 2: return True
    # 偶数は素数ではない
    elif num % 2 == 0: return False

    # 3 ~ numまでループし、途中で割り切れる数があるか検索
    # 途中で割り切れる場合は素数ではない
    for i in range(3, math.floor(math.sqrt(num))+1, 2):
        if num % i == 0:
            return False

    # 素数
    return True

# 素数判定
def callIsPrime(input_num=1000):
    numbers = []
    # ループしながら素数を検索する
    for i in range(1, input_num):
        if isPrime(i):
            numbers.append(i)

    # 素数配列を返す
    return numbers

# 関数の呼び出し
prime = callIsPrime(n)
for i in prime:
    for j in range(2,n):
        if i ** j <= n:
            prime.append(i **j)
prime = sorted(prime)
cnt = 0
for i in prime:
    if n % i == 0:
        n = n/i
        cnt +=1
    
print(cnt)

Submission status: Time Limit Exceeded

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

DONE = []
num = [i for i in range(int(N ** 0.5 + 1))]
i = 2
while i < int(N ** 0.5 + 1):
    n = num[i + 1]
    if n == -1:
        continue

    if N == 1 or N in DONE:
        break

    if not N % n:
        z = n
        num = list(map(lambda x: n if x % n else -1, num))
        DONE.append(z)
        N /= z
        z *= n
        while not N % z:
            DONE.append(z)
            N /= z
            z *= n

if not DONE:
    DONE.append(N)

print(len(DONE))

Submission status: Time Limit Exceeded

Solution code:
import math
# 素数判定関数
def isPrime(num):
    # 2未満の数字は素数ではない
    if num < 2: return False
    # 2は素数
    elif num == 2: return True
    # 偶数は素数ではない
    elif num % 2 == 0: return False

    # 3 ~ numまでループし、途中で割り切れる数があるか検索
    # 途中で割り切れる場合は素数ではない
    for i in range(3, math.floor(math.sqrt(num))+1, 2):
        if num % i == 0:
            return False

    # 素数
    return True

# 素数判定
def callIsPrime(input_num=1000):
    numbers = []
    # ループしながら素数を検索する
    for i in range(1, input_num):
        if isPrime(i):
            numbers.append(i)

    # 素数配列を返す
    return numbers

N = int(input())
prime_num = callIsPrime(N)
count = 0
target = list()
ans = list()
while N != 1:
    for i in range(len(prime_num)):
        if N % prime_num[i] != 0:
            continue # 次の素数に行く
        e = 1
        while True:
            z = prime_num[i] ** e
            if z in target:
                e += 1
                continue
            target.append(int(prime_num[i] ** e))
            N = int(N/(prime_num[i] ** e))
            ans.append(N)
            break

# print(ans)
print(len(ans))

Submission status: Time Limit Exceeded

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

count=0
turn=1
while True:
 for i in range(len(arr)):
  if arr[i][1]!=0:
   arr[i][1]=arr[i][1]-turn
   count=count+1
   if arr[i][1]<(turn+1):
    arr[i]==[0]
  turn=turn+1
  print(arr)
  if all(arr)==0:
   print(count)
   exit()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

        if n == 1:
            break

    return a

list = prime_factorize(N)

if len(list)==0:
    print(0)
else:
    print(len(list))

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(input())
count = 0
temp = True
z = []

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

for i in range(2, int(math.sqrt(n)) + 1):
    if n % i == 0:
        temp = False
        z.append(i)

if temp == True:
    print(1)
    exit()

for j in range(7):
    for k in z:
        if k > 1000000:
            break
        z.append(k ** j)

for l in z:
    if n % l == 0:
        count += 1
        n = n // l

print(count)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-

N=int(input())
count = 0
for x in range(2,N):
    if N % x == 0:
        arr = []
        temp = x
        for i in range(2, int(-(-x**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([x, 1])

        if int(len(arr)) == 1 :
            N=N/x
            count =count+1

print(count)