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: Wrong Answer

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

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

yakusu = []
multi = []

i = 2
while(i <= int(math.sqrt(N))):
    
    if(n % i == 0):
        if(i in yakusu):
            multi[yakusu.index(i)] += 1
        else:
            yakusu.append(i)
            multi.append(1)
        n = int(n / i)
        continue
    
    if(n == 1):
        break
    
    i += 1

if(len(yakusu) == 0):
    yakusu.append(n)
    multi.append(1)
    
ans = 0

for j in range(len(multi)):
    h = (-1 + int(math.sqrt(1 + 8 * multi[j]))) / 2
    ans += int(h)

print(ans)

Submission status: Wrong Answer

Solution code:
import collections
import math

n = int(input())
B = [1,2,6,10,15,21,28,36,45,55]
ans = 0

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) == True:
  print(1)
  exit()

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

c = collections.Counter(prime_factorize(n))  

for v in c.values():
  for j in range(len(B)):
    if v <=B[j]:
      ans += j
      break

print(ans)

Submission status: Wrong Answer

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, int(n ** 0.5) + 1):
        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: Wrong Answer

Solution code:
import math
A= int(input())
resArray = []
tmpA = A
for i in range(2, int(math.sqrt(A))):
    if tmpA == 1:
        break
    tmp = tmpA%i
    resArray.append(0)
    while tmp == 0:
        tmpA = tmpA/i
        resArray[-1] += 1
        tmp = tmpA%i
'''
if tmpA != 1:
    print(1)
    exit()
'''
res = 0
for i in resArray:
    if i != 0:
        tmp = 0
        for j in range(1, i + 1):
            tmp += j
            if tmp > i:
                break
            res += 1
        
        
print(res)

Submission status: Wrong Answer

Solution code:
#D
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/2:
        if n%z !=0:
            continue
        if trial_division(z)== 'prime number':
            n = n/z
            z += 1
            ans += 1
        elif len(trial_division(z))==2:
            n = n/z
            z += 1
            ans += 1
        else:
            z +=1
        
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
things = []
final = []
c = N
for i in range(2, c):
	if i*i > N:
		break
	count = 0
	if c%i == 0:
		while c%i == 0:
			c//=i
			count += 1
		things.append(count)
final = 0
for x in things:
	count = 0
	start = 1
	step = 2
	while start <= x:
		start += step
		step += 1
		count += 1
	final += count

print(1) if things == [] else print(final)

Submission status: Wrong Answer

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

count = 0

def sosu(n,z):
    for i in range(z, int(math.sqrt(n))+1):
        if n%i == 0:
            return i
            break
    return -1

if sosu(n,2) == -1 and n != 1:
    print(1)
    exit()

ans  = 0
z = 2

def hantei(n):
    i = sosu(n,2)
    s = 0
    if sosu(n,2) == -1:
        return True
    if sosu(n,2) > 0:
        s = n ** (1/i)
        if int(s) == math.floor(s):
            #print(n,s)
            return True
        else:
            return False

memo = []

while(n != 1) :
    ans = sosu(n,z)
    print(n,ans,z)
    if ans == -1:
        if memo.count(n) == 0 and hantei(n):
            count +=1
            break
        else:
            break

    if hantei(ans) :
        memo.append(ans)
        z = ans+1
        n = n//ans
        count += 1
    else:
        z = ans +1
    #print(count)



print(count)

Submission status: Wrong Answer

Solution code:
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


n = inp()
ans = 0
for i in range(2, int(math.sqrt(n)) + 1):
    for j in range(1, 40):
        x = i**j
        if x > n:
            break
        if n % x == 0:
            ans += 1
            n //= x
if n > int(math.sqrt(n)):
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
import math
A= int(input())
resArray = []
tmpA = A
for i in range(2, int(math.sqrt(A))):
    if tmpA == 1:
        break
    tmp = tmpA%i
    resArray.append(0)
    while tmp == 0:
        tmpA = tmpA/i
        resArray[-1] += 1
        tmp = tmpA%i
if tmpA != 1:
    print(1)
    exit()
res = 0
for i in resArray:
    if i != 0:
        tmp = 0
        for j in range(1, i + 1):
            tmp += j
            if tmp > i:
                break
            res += 1
        
        
print(res)

Submission status: Wrong Answer

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(max(fact_num) + 3):
    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
            if N==1:
                print(cnt)
                sys.exit()
print(cnt)

Submission status: Wrong Answer

Solution code:
import collections
import math

n = int(input())
B = [1,2,6,10,15,21,28,36,45,55]
ans = 0

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) == True:
  print(1)
  exit()

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

c = collections.Counter(prime_factorize(n))  

for v in c.values():
  for j in range(len(B)):
    if v < B[j]:
      ans += j
      break

print(ans)

Submission status: Wrong Answer

Solution code:
plist = [2, 3, 5, 7]

for i in range(11, 1000000, 2):
    j = 0
    flag = False
    while plist[j] <= i ** 0.5:
        if i % plist[j] == 0:
            flag = True
            break
        j += 1
    if flag == False:
        plist.append(i)

for i in plist:
    if i ** 3 < 1000000000000:
        plist.append(i**2)
    if i ** 6 < 1000000000000:
        plist.append(i**3)
    if i ** 10 < 1000000000000:
        plist.append(i**4)
    if i ** 15 < 1000000000000:
        plist.append(i**5)
    if i ** 21 < 1000000000000:
        plist.append(i**6)
plist.append(128)
plist.append(256)

plist.sort()

n = int(input())
count = 0

for i in plist:
    if n % i == 0:
        n /= i
        count += 1
        
if n > 1000000:
    count += 1

print(count)

Submission status: Wrong Answer

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

count = 0

def sosu(n,z):
    for i in range(z, int(math.sqrt(n))+1):
        if n%i == 0:
            return i
            break
    return -1

if sosu(n,2) == -1 and n != 1:
    print(1)
    exit()

ans  = 0
z = 2

def hantei(n):
    i = sosu(n,2)
    s = 0
    if sosu(n,2) == -1:
        return True
    if sosu(n,2) > 0:
        s = n ** (1/i)
        if int(s) == math.floor(s):
            print(n,s)
            return True
        else:
            return False

memo = []

while(n != 1) :
    ans = sosu(n,z)
    print(n,ans,z)
    if ans == -1:
        if memo.count(n) == 0 and hantei(n):
            count +=1
            break
        else:
            break

    if hantei(ans) :
        memo.append(ans)
        z = ans+1
        n = n//ans
        count += 1
    else:
        z = ans +1
    #print(count)



print(count)

Submission status: Wrong Answer

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, int(n ** 0.5) + 1):
        if n == 1:
            break
        j = i
        cnt = 0
        while n % i == 0:
            n = n // i
            cnt += 1
            i *= j
        else:
            while n % j == 0:
                n = n // j
        ans += cnt

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


n = inp()
ans = 0
for i in range(2, int(math.sqrt(n)) + 1):
    for j in range(1, 40):
        x = i**j
        if x > n:
            break
        if n % x == 0:
            ans += 1
            n //= x
if n > 10**6:
    ans += 1
print(ans)

Submission status: Wrong Answer

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())
facs = factorization(n)

nums = []

for fac in facs:
  for i in range(1, fac[1]+1):
    nums.append(fac[0]**i)
    
nums = list(set(nums))
cnt = 0
nums.sort()

for num in nums:
  if n % num == 0:
    n = n / num
    cnt += 1
    
print(cnt)

Submission status: Wrong Answer

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

count = 0

def sosu(n,z):
    for i in range(z, int(math.sqrt(n))+1):
        if n%i == 0:
            return i
            break
    return -1

if sosu(n,2) == -1 and n != 1:
    print(1)
    exit()

ans  = 0
z = 2

def hantei(n):
    i = sosu(n,2)
    s = 0
    if sosu(n,2) == -1:
        return True
    if sosu(n,2) > 0:
        s = n ** (1/i)
        if int(s) == math.floor(s):
            print(n,s)
            return True
        else:
            return False

memo = []

while(n != 1) :
    ans = sosu(n,z)
    print(n,ans,z)
    if ans == -1:
        if memo.count(n) == 0 and hantei(n) and n != 1:
            count +=1
            break
        else:
            break

    if hantei(ans) :
        memo.append(ans)
        z = ans+1
        n = n//ans
        count += 1
    else:
        z = ans +1
    #print(count)



print(count)

Submission status: Wrong Answer

Solution code:
def main():
  n = int(input())
  if n == 1:
    return 0
  index = []
  no = []
  i = 1
  result = 0
  while n > 1:
    i += 1
    if n % i == 0:
      n /= i
      cnt = 1
      while n % i == 0:
        n /= i
        cnt += 1
      index.append(cnt)
    if i ** 2 < n and len(index) == 0:
      return 1    
  for j in index:
    result += (j + 1) // 2
  return result

print(main())

Submission status: Wrong Answer

Solution code:
def prime_factorize(n):
    a = []
    cnt = 0
    while n % 2 == 0:
        cnt += 1
        n //= 2
    a.append(cnt)
    f = 3
    cnt = 0
    while f * f <= n:

        if n % f == 0:
            cnt += 1
            n //= f
        else:
            f += 2
            a.append(cnt)
            cnt = 0

    if n != 1:
        a.append(1)
    return a

n = int(input())
ans = 0
lis = prime_factorize(n)
#print(lis)

for i in range(len(lis)):
    val = 1
    while val <= lis[i]:
        lis[i] -= val
        val += 1
        ans += 1
print(ans)

Submission status: Wrong Answer

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
    x = n
    for i in range(2, int(n ** 0.5) + 1):
        if x == 1:
            break
        j = i
        cnt = 0
        while x % i == 0:
            x = x // i
            cnt += 1
            i *= j
        else:
            while x % j == 0:
                x = x // j
        ans += cnt

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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())
facs = factorization(n)

nums = []

for fac in facs:
  for i in range(1, fac[1]+1):
    nums.append(fac[0]**i)
    
nums = set(nums)
cnt = 0

for num in nums:
  if n % num == 0:
    n = n / num
    cnt += 1
    
print(cnt)

Submission status: Wrong Answer

Solution code:
from math import sqrt

n = int(input())
div = []
for i in range(2, int(sqrt(n))+1):
    if n % i == 0:
        div.append(i)
        
if n == 1:
    print(0)
    exit()

if len(div) == 0:
    print(1)
    exit()

prime = {}
for i in div:
    while n % i == 0:
        n /= i
        if i not in prime:
            prime[i] = 1
        else:
            prime[i] += 1
    
ans = 0
for i, num in enumerate(prime):
    ans += int( (-1+sqrt(1+8*prime[num])) / 2 )
   
    
print(ans)

Submission status: Wrong Answer

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
    x = n
    for i in range(2, int(n ** 0.5) + 1):
        if x == 1:
            break
        j = i
        cnt = 0
        while x % i == 0 and x // i > 0:
            x = x // i
            cnt += 1
            i *= j
        else:
            while x % j == 0:
                x = x // j
        ans += cnt

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


n = inp()
ans = 0
for i in range(2, int(math.sqrt(n)) + 1):
    for j in range(1, 40):
        x = i**j
        if x > n:
            break
        if n % x == 0:
            ans += 1
            n //= x
print(ans)

Submission status: Wrong Answer

Solution code:
# Contest No.: ABC169
# Problem No.: D
# Solver:      JEMINI
# Date:        20200531

import sys
import heapq

def main():
    temp = [True] * (10 ** 6 + 10)
    temp[0] = False
    temp[1] = False
    for i in range(2, 10 ** 6 + 10):
        if temp[i]:
            cnt = 2 * i
            while cnt < 10 ** 6 + 10:
                temp[cnt] = False
                cnt += i
    prime = []
    for i in range(10 ** 6 + 10):
        if temp[i]:
            prime.append(i)
 
    n = int(input())
    ans = 0
    tempN = n
    for i in prime:
        if i > tempN:
            break
        if tempN % i:
            continue
        div = 0
        while tempN % i == 0:
            tempN = tempN // i
            div += 1
        #print(div)
        if div > 2:
            div = int((div * 2) ** 0.5)
        else:
            div = 1
        #print(i, div, tempN)
        ans += div
    if tempN > 1:
        ans += 1
    print(ans)
    return
 
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:

import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 7)
# ----------

INF = float("inf")
MOD = 10 ** 9 + 7
# ----------

def P(n):
    cnt = 0
    tmp = 0
    for i in range(1, n+1):
        if tmp + i > n:
            break
        tmp += i
        cnt += 1
    return cnt

N = int(input())

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

e = defaultdict(int)
for i in range(2, int(N ** 0.5) + 1):
    while N % i == 0:
        e[i] += 1
        N //= i

if len(e) == 0:
    print(1)
    exit()

ans = 0
for k, v in e.items():
    ans += P(v)
print(ans)

Submission status: Wrong Answer

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

primes = prime_factorize(N)

num = 0
hist = [1]
c = 1
for p in primes:
    c *= p
    if c not in hist:
        hist.append(c)
        num += 1
        c = 1

print(num)

Submission status: Wrong Answer

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


def solve(N: int):
    # zの条件
    # - Nの約数
    # - 素数pのn乗
    # - 過去に選択したzと被らない
    n = N
    ds = make_divisors(n)
    used = []
    for d in ds:
        count = len(used)
        if d in used:
            continue
        # 2乗して10**12以下の数は20**6まで探索すれば十分
        for i in range(20**6):
            if not is_prime(i):
                continue
            # 2でも50乗すれば10**12は超える
            for j in range(50):
                if n == i ** j:
                    used.append(d)
                    n /= d
                    break
            if count < len(used):
                break
    print(len(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 is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1


# 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: Wrong Answer

Solution code:
n=int(input())

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

l=lower_divisors + upper_divisors[::-1]

if l==[1]:
    print(0)
else:
    l=l[1:]
    m=1
    c=0
    for i in l:
        if n%(m*i)==0:
            m*=i
            c+=1           
        if m==n:
            break
    print(c)

Submission status: Wrong Answer

Solution code:
#D
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/2:
        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
        else:
            z +=1
        
print(ans)

Submission status: Wrong Answer

Solution code:

import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 7)
# ----------

INF = float("inf")
MOD = 10 ** 9 + 7
# ----------

def P(n):
    cnt = 0
    tmp = 0
    for i in range(1, n):
        if tmp + i > n:
            break
        tmp += i
        cnt += 1
    return cnt

N = int(input())

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

e = defaultdict(int)
for i in range(2, int(N ** 0.5) + 1):
    while N % i == 0:
        e[i] += 1
        N //= i

if len(e) == 0:
    print(1)
    exit()

ans = 0
for k, v in e.items():
    ans += P(v)
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

if N == 1:
    print(0)

else:
    ans = 0
    for i in range(2, int(N**0.5)+1):
        cnt = 0
        while N%i == 0:
            N /= i
            cnt += 1
        
        a = 0
        b = 0
        for j in range(1, cnt+1):
            a += j
            if a > cnt:
                break
            b += 1    
        ans += b

    if ans == 0:
        print(1)
    else:
        print(ans)

Submission status: Wrong Answer

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)
    used = []
    for d in ds:
        count = len(used)
        if d in used:
            continue
        # 2乗して10**12以下の数は20**6まで探索すれば十分
        for i in range(20**6):
            if not is_prime(i):
                continue
            # 2でも50乗すれば10**12は超える
            for j in range(50):
                if n == i ** j:
                    used.append(d)
                    n /= d
                    break
            if count < len(used):
                break
    print(len(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 is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1


# 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: Wrong Answer

Solution code:
N = int(input())
current_num = 2
count = 0

import math
S=int(math.sqrt(N))
list1=[N]
def p_judge1(num) :
  q=int(math.sqrt(num))
  if num==1 :
    return False
  for i in range(2,q) :
    if num%i==0 :
      return False
  return True
while (S >= current_num):
  if N%current_num==0 and p_judge1(current_num):

    N=int(N/current_num)
    if N!=current_num :
      list1.append(N)
    count+=1
  current_num += 1



list1=reversed(list1)
for item in list1 :
  if p_judge1(item) and N%item==0 :
    N=int(N/item)
    count+=1

print(count)

Submission status: Wrong Answer

Solution code:


import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 7)
# ----------

INF = float("inf")
MOD = 10 ** 9 + 7
# ----------

def P(n):
    cnt = 0
    tmp = 0
    for i in range(1, n):
        if tmp > n:
            break
        tmp += i
        cnt += 1
    return cnt

N = int(input())

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

e = defaultdict(int)
for i in range(2, int(N ** 0.5) + 1):
    while N % i == 0:
        e[i] += 1
        N //= i

if len(e) == 0:
    print(1)
    exit()

ans = 0
for k, v in e.items():
    ans += P(v)
print(ans)

Submission status: Wrong Answer

Solution code:
import collections as cc
I = lambda : list(map(int,input().split()))
ans=0
n,=I()
k=2
ff=cc.defaultdict(int)
while 1:
	f=0
	g=0
	for i in range(k,int(n**0.5)+1):
		if n%i==0:
			g=1
			ff[i]=n
			n//=i
			f=1
			k+=1
			ans+=1
			break
	if not g and not ff[n]:
		ans+=1
		break
	if not f :
		break
print(ans)

Submission status: Wrong Answer

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] -= 1
			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: Wrong Answer

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


if n == 1:
    print(0)
else:
    prime = []
    saidai = math.sqrt(n)
    i = 2
    while i <= saidai:
        if n % i == 0:
            n //= i
            prime.append(i)
        else:
            i +=1
    if len(prime) == 0:
        print(1)
    else:
        count = 1
        ans = 0
        i = 0
        prime.append(0)
        while i < len(prime)-1:
            if count == 1:
                ans += 1
                if prime[i] == prime[i+1]:
                    count += 1
                i += 1
            else:
                hantei = True
                atai = prime[i]
                j = 1
                while hantei:
                    if i + j >= len(prime)-1:
                        hantei = False
                        i = i+j
                        count = 1
                    elif atai != prime[i+j]:
                        hantei = False
                        i = i + j
                        count = 1
                    else:
                        if j + 1 == count:
                            hantei = False
                            ans += 1
                            i = i + j + 1
                            if atai == prime[i]:
                                count += 1
                            else:
                                count = 1
                        else:
                            j += 1
        print(ans)