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

t = N
ans = 0

so = [2]
for s in range(2, N):
    if t < s:
        break
    if t % s == 0:
        if s % 2 == 0:
            if math.log2(s) % 1 == 0:
                t = int(t / s)
                ans += 1
        else:
            if all(s % s2 != 0 for s2 in so):
                so.append(s)
                is_so = True
            elif any(math.log(s, s2) % 1 == 0 for s2 in so):
                is_so_baisu = True
            if is_so or is_so_baisu:
                t = int(t / s)
                ans += 1
print(ans)

Submission status: Wrong Answer

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

print(count)

Submission status: Wrong Answer

Solution code:
#D - Div Game
N = int(input())

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

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

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

    return arr
A = factorization(N)
#print(factorization(N))
ans = 0
if N == 1:
    print(0)
    exit()

for i in range(len(A)):
    if A[i][1] == 1:
        ans += 1
    else:
        k = A[i][1]
        for j in range(A[i][1]):
            if k-j-1 > 0:
                k -= j
                ans += 1
            else:
                break
print(ans)

Submission status: Wrong Answer

Solution code:
#デフォルト
import itertools
from collections import defaultdict
import collections
from decimal import *
import math
import sys
sys.setrecursionlimit(200000)
mod = 1000000007

n = int(input())

def 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
if (Prime(n)):
    print("1")
else:
    ans = 0
    for i in range(2, 10 ** 5  * 3):
        if Prime(i):
            for j in range(1, 10 * 3):
                sub = i**j
                if n % (sub) == 0:
                    ans += 1
                    n = n // (sub)
                if n == 1:
                    break
        if n == 1:
            break

    print(ans)

Submission status: Wrong Answer

Solution code:
import math

n = int(input())
count = 0
flg = 1

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

for i in range(2, int(math.sqrt(n)) + 1):

    if n % i == 0:
        n = n // i
        flg *= 0
        count += 1

if flg == 1:
    print(1)
    exit()

print(count)

Submission status: Wrong Answer

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

base = pow(N, 1/2)
dic = {}
i = 2
li = []
now = 0
count = 0

for j in range(1, 51):
    now += j
    li.append(now)

while N != 1 and i <= base:
    # print(N)
    if N % i == 0:
        dic[i] = 0
        while N % i == 0:
            N /= i
            dic[i] += 1
    i += 1
if len(dic.keys()) == 0:
    if N == 1:
        print(0)
    else:
        print(1)
else:
    # print(li)
    for d in dic.values():
        # print(d)
        count += bisect.bisect_right(li, d)
    print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

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

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

    return arr

def check(S):
  for i in range(S):
    if S != 1 and S != 2:
      if (i**2+i) > S:
        return i
    else:
      return 1

if N != 1:
  result = factorization(N) 

  a = 0
  for r in result:
    b = check(r[1])
    a += b
  print(a)
else:
  print(0)

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 0
i = 2
N
l=2
flag=True
while(N**0.5>l):
    if N%l==0:
        flag=False
        break
    l+=1
if N ==1:
    ans = 0
elif flag:
    ans = 1
else:
    while(N**0.5>i):
        tmpi = i
        while(N%i==0):
            if N%tmpi==0:
                N/=tmpi
                tmpi*=i
                ans += 1
            else:
                N/=i
        i+=1
print(ans)

Submission status: Wrong Answer

Solution code:


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


def get_knu(a):
    if a == 1:
        return 1
    before = 1
    n = 2
    while True:
        knum = (n * (n + 1)) // 2
        if a == knum:
            return n
        elif knum > a > before:
            return -1
        else:
            n += 1
            before = knum


D = int(input())
p = get_prime_fact(D)

if len(p) != len(set(p)):
    res = 0
    for n in set(p):
        count = p.count(n)
        if count == 1:
            res += 1
        else:
            add = get_knu(count)
            if add == -1:
                print(res + 1)
                exit(0)
            res += add

    print(res)
else:
    print(len(p))

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**6)


n=int(input().rstrip())
a=[]
tmp=n
for i in range(2,int(n**0.5)+1):
    if tmp%i==0:
        while tmp%i==0:
            a.append(i)
            tmp//=i
#print(a)
if tmp!=1:
    a.append(tmp)
s=set()
t=1
for i in a:
    if i not in s:
        s.add(i)
    else:
        t*=i
        if t not in s:
            s.add(t)
            t=1
    #print(t,s)
#if t not in s and t!=1:
    #s.add(i)
print(len(s))

Submission status: Wrong Answer

Solution code:
import sys
# from random import choice,randint
# from bisect import bisect_left as bl             
# from bisect import bisect_right as br  
# from collections import deque,defaultdict,Counter
from math import sqrt,floor,ceil
# from itertools import combinations,permutations
# from heapq import heapify,heappop,heappush,heappushpop
# inp=sys.stdin.readline
# out=sys.stdout.write
# flsh=sys.stdout.flush
# ranomd string generator --> a = ''.join(random.choices(string.ascii_lowercase, k = 1000))
 
sys.setrecursionlimit(10**9)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod1=998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

#fact=[1]
#for i in range(1,100001):
#    fact.append((fact[-1]*i)%mod)
#ifact=[0]*100001
#ifact[100000]=pow(fact[100000],mod-2,mod)
#for i in range(100000,0,-1):
#    ifact[i-1]=(i*ifact[i])%mod
 
def MI(): return map(int, inp().strip().split())
def LI(): return list(map(int, inp().strip().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]
def LI_(): return [int(x)-1 for x in inp().strip().split()] #use list comprehension for loops
def LF(): return [float(x) for x in inp().strip().split()] #use try and except for dictionaries
def LS(): return inp().strip().split() #declare local variables ... for functions assing them to variables
def I(): return int(inp().strip()) # before using example ... func = len for using len() funtcion
def F(): return float(inp().strip()) #sort dictionary after zipping
def S(): return inp().strip() #use map function for mapping list to a fuction
def pf(s): return out(s+'\n')
def JA(a, sep): return sep.join(map(str, a)) #use this for string concatenation
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)
def modinv(n,p):return pow(n,p-2,p)
def ncr(n,r,p):                      
    t=((fact[n])*((ifact[r]*ifact[n-r])%p))%p
    return t

####################Actualcode################################
def isPrime2(n):
    if n==2 or n==3: return True
    if n%2==0 or n<2: return False
    for i in range(3, int(n**0.5)+1, 2):
        if n%i==0:
            return False    

    return True

def solve():
    n = I()
    if n==1:
        print(0)
    else:
        x = n
        c=0
        for i in range(2,int(sqrt(x))+1):
            if n%i==0:
                # print(n)
                n = n//i
                c+=1
        if isPrime2(n):
            c+=1
        print(c)
def main():
    solve()


######## Python 2 and 3 footer by Pajenegod and c1729
py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0
    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s
    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s:self.buffer.write(s.encode('ascii'))
            self.read = lambda:self.buffer.read().decode('ascii')
            self.readline = lambda:self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

inp = lambda: sys.stdin.readline().rstrip('\r\n')
out = lambda x: sys.stdout.write(x)
flsh= lambda: sys.stdout.flush()

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

    N = int(input())
    N = 2*5+3*5

    if N == 1:
        print(0)
        return

    def get_prime(n):
        import math
        p = []
        if n % 2 == 0:
            p.append(2)

        sq = math.ceil(math.sqrt(n))
        i = 3
        while i <= sq:
            if n % i == 0:
                p.append(i)
                if i*i != n:
                    p.append(n//i)
            i += 2
        p.append(n)
        return p
    
    p = get_prime(N)

    def prime_factorization(n, p):
        from collections import Counter
        d = Counter()
        for i in p:
            while n % i == 0:
                d[i] += 1
                n //= i
        return d

    d = prime_factorization(N, p)

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

    print(ans)

main()

Submission status: Wrong Answer

Solution code:
import collections
n = int(input())
if n == 1:
    print(0)
else:
    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))

    ans = 0
    if len(c) == 1:
        if list(c.values())[0] == 1 or list(c.values())[0] == 2:
            ans += 1
        else:
            for k in range(1,100):
                if k/2*(2+(k-1)) >= list(c.values())[0]:
                    ans += k
                    break
    else:
        i = 0
        j = 0
        for l in range(len(c)):
            i = list(c.keys())[l]
            j = list(c.values())[l]
            if j == 1 or j == 2:
                ans += 1
            else:
                for k in range(1,100):
                    if k/2*(2+(k-1)) >= j:
                        ans += k
                        break

    print(ans)

Submission status: Wrong Answer

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


def primes(n):
    ps = {}
    for i in range(2, int(n ** 0.5) + 20):
        if n == 1:
            break
        if n % i == 0:
            cnt = 0
            while n % i == 0:
                n = n // i
                cnt += 1

            ps[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)

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

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

n=int(input())
c = Counter(prime_factorize(n))
ans=0
for k,v in c.items():
	ans+=int(math.log(v,2)-0.000001)+1
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [0 for i in range(int(N**0.5)+1)]
c = 0
i = 2
m = 0
while i < N**0.5:
    if N % i == 0:
        a[i] += 1
        N = N / i
        m = i
        i -= 1
    i += 1
    if N == 1:
        break 
for j in range(2, m+1):
    if a[j] != 0:
        d = 0
        while a[j] > d:
            a[j] -= d+1
            d += 1
        c += d
if N == 0:
    print(0)
else:
    print(c+1, end='')

Submission status: Wrong Answer

Solution code:
"nの約数列挙"
def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            if i**2 == n:
                continue
            ass.append(n//i)
    return ass

"nの素因数分解"
def prime_factor(n):
    ass = []
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.append(i)
            n = n//i
    if n != 1:
        ass.append(n)
    return ass

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())
A = divisor(N)
A.sort()

count = 0
print(A)
for a in A:
  if a == 1:
    continue
  if N % a != 0 and is_prime(a) == False:
    continue
  N //= a
  count += 1

print(count)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
num = 0
for i in range(2, int(math.sqrt(N))+1):
    if N % i == 0:
        N = N / i
        num = num + 1
if N == 1:
    print(0)
else:
    if num == 0:
        print(1)
    else:
        print(num)

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys
sys.setrecursionlimit(10**6)

n=int(input())

m=int(np.sqrt(n))+1

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

ans=0
for i in range(2,m+1):
    cnt=0
    for j in range(44):
        if n%i==0:
#            print("i=",i,"n=",n)
            n=n/i
            cnt+=1
        else:
            break
    if 1<=cnt<3:
        ans+=1
    if 3<=cnt<6:
        ans+=2
    if 6<=cnt<10:
        ans+=3
    if 10<=cnt<15:
        ans+=4
    if 15<=cnt<21:
        ans+=5
    if 21<=cnt<28:
        ans+=6
    if 28<=cnt<36:
        ans+=7
    if 36<=cnt<45:
        ans+=8

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

print(ans)

Submission status: Wrong Answer

Solution code:
from math import sqrt
from sys import stdin, stdout

int_in = lambda: int(stdin.readline())
arr_in = lambda: [int(x) for x in stdin.readline().split()]
mat_in = lambda rows: [arr_in() for y in range(rows)]
str_in = lambda: stdin.readline().strip()
out = lambda o: stdout.write("{}\n".format(o))
arr_out = lambda o: out(" ".join(map(str, o)))
bool_out = lambda o: out("YES" if o else "NO")
tests = lambda: range(1, int_in() + 1)
case_out = lambda i, o: out("Case #{}: {}".format(i, o))


def non_one_factors(n):
    result = set([n])
    for i in range(2, int(sqrt(n)) + 1):
        if n % i == 0:
            result.add(i)
            result.add(n//i)
    return result

def solve(n):
    factors_to_try = sorted(non_one_factors(n))
    result = 0
    i = 0
    while n > 1 and i < len(factors_to_try) and n >= factors_to_try[i]:
        if n % factors_to_try[i] == 0:
            n //= factors_to_try[i]
            result += 1
        i += 1
    return result

if __name__ == "__main__":
    n = int_in()
    out(solve(n))

Submission status: Wrong Answer

Solution code:
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

INF = float("inf")

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

def I():
    return int(input())

def MI():
    return map(int,input().split())

def RI():
    return list(map(int,input().split()))

def CI(n):
    return [ int(input()) for _ in range(n) ]

def LI(n):
    return [ list(map(int,input().split())) for _ in range(n) ]

def S():
    return input()

def MS():
    return input().split()

def RS():
    return list(input().split())

def CS(n):
    return [ input() for _ in range(n) ]

def LS(n):
    return [ list(input().split()) for _ in range(n) ]

n = I()

# nまでの自然数が素数かどうかを表すリストを返す
# Sieve of Eratosthenes
def makePrimeChecker(n):
    isPrime = [True] * (n + 1)
    isPrime[0] = False
    isPrime[1] = False
    for i in range(2, int(n ** 0.5) + 1):
        if isPrime[i]:
            for j in range(i * i, n + 1, i):
                isPrime[j] = False
    return isPrime

# """nを素因数分解"""
# """2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""
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
# print(factorization(m))
## [[2, 3], [3, 1]] 
##  24 = 2^3 * 3^1

a = factorization(n)
# print(a)

ls = []
count = -1
wa = 0
for i in range(40):
    count += 1
    wa += count
    ls.append(wa)
# print(ls)

ans = 0
for _,m in a:
    ind = bisect_right(ls,m)
    ans += ind-1
print(ans)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
def prime_factorization(n):
    arr = []
    temp = n
    for i in range(2, int(math.sqrt(temp)) + 1):
        if n%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            if cnt != 0:
                arr.append([i, cnt])

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

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

    return arr
if n == 1:
    print(0)
elif len(prime_factorization(n)) == 1:
    print(1)
else:
    ans = 0
    prime_list = prime_factorization(n)
    # print(prime_list)
    for i in prime_list:
        a = i[1]
        sub = 1
        j = 0
        while True:
            if a < sub:
                break
            a -= sub
            sub += 1
            j += 1
            
        #     print(a, sub, j)
        # print(j, i[1])
        ans += j
        
    print(ans)

Submission status: Wrong Answer

Solution code:
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()
N=int(input())
#N=10**18
if N==1:
    print(0)
    exit()

lst=defaultdict(int)
for i in list(range(2,int(N**.5)+1))+[N]:
    while N%i==0:
        N//=i
        lst[i]+=1
c=0
#print(lst)
for l in lst:
    l=lst[l]
    i=1
    while l>=i:
        l-=i
        c+=1
        i+=1
print(c)

Submission status: Wrong Answer

Solution code:
n = int(input())


def Pf(n):
    l = {}
    if n == 1:
        return 0
    else:
        i = 2
        tnp = 0
        while n > 1 and i < int(n**0.5)+1:
            if n % i == 0:
                tnp += 1
                n //= i
            else:
                l[i] = tnp
                tnp = 0
                i += 1
        l[i] = tnp
        return l


def f(x):  # 何個取り出せるか
    if x == 0:
        return 0
    elif 1 <= x <= 2:
        return 1
    elif 3 <= x <= 5:
        return 2
    elif 6 <= x <= 9:
        return 3
    elif 10 <= x <= 14:
        return 4
    elif 15 <= x <= 20:
        return 5
    elif 21 <= x <= 27:
        return 6
    elif 28 <= x <= 35:
        return 7
    else:
        return 8


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

info = Pf(n).values()
# print(info)
ans = 0
for i in info:
    ans += f(i)

print(ans)

Submission status: Wrong Answer

Solution code:
from collections import deque


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

    if temp != 1:
        arr.append(1)

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

    return arr


n = int(input())
d = factorization(n)
d = deque(d)
count = 0
while d:
    m = 1
    a = d.popleft()
    while a >= m:
        a = a - m
        m += 1
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
M = (math.sqrt(N)) + 1

count = 0
for n in range(2, int(M)):
    count += (N % n == 0)

if count == 0:
    count = 1

print(count)

Submission status: Wrong Answer

Solution code:
import math
#試し割法
def trial_division(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 = trial_division(int(input()))

key = []
val = []

dupli = set()
for i in range(len(N)):
    if (not N[i] in dupli):
        key.append(N[i])
        dupli.add(N[i])

for i in range(len(key)):
    val.append(N.count(key[i]))

sum = 0
for i in range(len(key)):
    count = 1
    length = val[i]
    if (length < 3):
        sum += 1
    else:
        while(length > 0):
            sum += 1
            length -= count
            if (length == count):
                break
            count += 1

print(sum)

Submission status: Wrong Answer

Solution code:
"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""

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

#print(n)
#print(f)

ans = 0
for i in range(len(f)):
  if f[i][0] == 1:
    continue
  t = f[i][1]
  #print(t)
  
  ans += t // 2
  ans += t % 2
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools

N = int(input())

# 素因数分解
# 戻り値: リスト
def prime_factor(n):
    ass = []
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.append(i)
            n = n//i
    if n != 1:
        ass.append(n)
    return ass

pf = prime_factor(N)
if len(pf) == 0:
    print(0)
    exit()

d = {}
for i in pf:
    if i not in d:
        d[i] = 1
        continue
    d[i] += 1

exist_num = []
ans = 0
for k in d.keys():
    for c in range(1, 100):
        if d[k] >= c:
            exist_num.append(k ** c)
            ans += 1
            d[k] -= c

l = []
for k in d.keys():
    if d[k] > 0:
        for _ in range(d[k]):
            l.append(k)

for i in range(1, 100):
    combs = list(itertools.combinations(l, i))
    if len(combs) > 0:
        for comb in combs:
            n = 1
            for j in comb:
                n *= j
            if n not in exist_num:
                ans += 1
                exist_num.append(n)
    else:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
import math

n=int(input())

if n==1:
    ans=0

else:
    #入力nは2以上でお願いします
    sqn=int(math.sqrt(n))
    soinsu=[]
    #soinsu[i]はi+2で何回割れるか示す.
    #soinsu[-1]はnが素数ならば1合成数ならば0.
    goseisu=0
    for i in range(2,sqn+1):
        count=0
        while True:
            if n%i==0:#iで割れるなら
                n=n//i
                count+=1
                goseisu=1
            else:
                soinsu.append(count)
                break
    if goseisu==0:#素数ならば
        soinsu.append(1)
    else:#合成数ならば
        soinsu.append(0)
            
    ans=0
    for i in range(len(soinsu)):
        ans+=int((-1+math.sqrt(1+8*soinsu[i]))/2)



print(ans)

Submission status: Wrong Answer

Solution code:
def divisor(x):
    ret = []
    for i in range(1, int(x ** 0.5) + 1):
        if x % i == 0:
            ret.append(i)
            ret.append(x // i)
    return list(set(ret))

n = int(input())

div = divisor(n)[1:]

ans=0
for i in div:
    if n % i == 0:
        ans += 1
        n //= i

print(ans)

Submission status: Wrong Answer

Solution code:
# import sympy

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]


N=int(input())
zlist = make_divisors(N)
done=[]
cnt=0
for n in range(len(zlist)):
    if(len(zlist)>1):
        for z in zlist:
            if(z not in done):
                if(N%z==0 and z!=1):
                    done.append(z)
                    N=int(N/z)
                    zlist = make_divisors(N)
                    cnt+=1
                    done.append(z)
                    break
    else:
        break
print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

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

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

    return arr

def check(S):
  for i in range(S):
    if S != 1 and S != 2:
      if (i**2+i) > S:
        return i
    else:
      return 1

if N != 1:
  result = factorization(N) 
  print(result)

  a = 0
  for r in result:
    b = check(r[1])
    a += b

else:
  print(0)

Submission status: Wrong Answer

Solution code:
import collections

N=int(input())
ans=0

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


if N==1:
	print(0)
	
else:
	lis=collections.Counter(prime_factorize(N))
	lis_=list(lis.values())
	for i in range(len(lis_)):
		for h in range(1,45):
			if lis_[i]>=h*(h+1)/2:
				ans+=1

Submission status: Wrong Answer

Solution code:
N=int(input())
p=[i for i in range(2,N+1)]
count=0
for item in p:
  if N%item==0:
  	N=N/item
  	count+=1
  	p.remove(item)
  if N==1:
    	break
print(count)

Submission status: Wrong Answer

Solution code:
from itertools import combinations
from functools import reduce
from operator import mul

N = int(input())

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

facts = prime_factorize(N)

used = set()
cnt = 0

while facts:
  #print(used)
  #print(facts)
  for i in range(1, len(facts)):
    for s in combinations(facts, i):
      m = reduce(mul, s)
      if not m in used:
        used |= {m}
        cnt += 1
        for j in s:
          facts.remove(j)
        break
    else:
      continue
    break
  else:
    break

print(cnt)