Problem: 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.

Submission attempts (in order):
import collections

def prime_factorize(n):
    a = []
    f = 2
    while n % f == 0:
        a.append(f)
        n //= f
        f *= 2 

    g = 3
    while g * g <= n:
        if n % g == 0:
            a.append(g)
            n //= g
            g += 2
        else:
            g += 2
    flag = 0
    if n != 1 and n not in a:
        m = n
        while n % 2 == 0:
            n //= 2
            if n == 2:
                flag == 1
        g = 3
        while g * g <= n:
            if n % g == 0:
                n //= g
                if n == g:
                    flag == 1
            else:
                g += 2
                n = m
        if flag == 1:
            a.append(n)
    return a
N = int(input())
fact = prime_factorize(N)
#print(fact)
print(len(fact))


import collections

def prime_factorize(n):
    a = []
    f = 2
    while n % f == 0:
        a.append(f)
        n //= f
        f *= 2 

    g = 3
    while g * g <= n:
        if n % g == 0:
            a.append(g)
            n //= g
            g += 2
        else:
            g += 2
    return a

N = int(input())
fact = prime_factorize(N)
print(len(fact))


import collections

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

N = int(input())
fact = prime_factorize(N)

b = []
q = 1
for p in fact:
    if p not in b:
        while fact.count(p) > q:
            for i in range (q):
                fact.remove(p)
            b.append(p ** q)
            #print(b)
            q += 1
    q = 1
    #print(p)

#print(b)
print(len(b))


import collections

def prime_factorize(n):
    a = []
    f = 2
    while n % f == 0:
        a.append(f)
        n //= f
        f *= 2 

    g = 3
    while g * g <= n:
        if n % g == 0:
            a.append(g)
            n //= g
            g += 2
        else:
            g += 2
    aflag = 0
    bflag = 0
    if n != 1 and n not in a:
        m = n
        while n % 2 == 0:
            bflag = 1
            n //= 2
            if n == 2:
                aflag == 1
        g = 3
        n = m
        while g * g <= n:
            if n % g == 0:
                bflag = 1
                n //= g
                if n == g:
                    aflag == 1
            else:
                g += 2
                n = m
        if aflag == 1 or bflag == 1:
            a.append(m)
    return a
N = int(input())
fact = prime_factorize(N)
#print(fact)
print(len(fact))


import collections

def prime_factorize(n):
    a = []
    f = 2
    while n % f == 0:
        a.append(f)
        n //= f
        f *= 2 

    g = 3
    while g * g <= n:
        if n % g == 0:
            a.append(g)
            n //= g
            g += 2
        else:
            g += 2
    flag = 0
    if n != 1 and n not in a:
        m = n
        while n % 2 == 0:
            n //= 2
            if n == 2:
                flag == 1
        g = 3
        while g * g <= n:
            if n % g == 0:
                n //= g
                if n == g:
                    flag == 1
            else:
                g += 2
                n = m
        if flag == 1:
            a.append(n)
    return a
N = int(input())
fact = prime_factorize(N)
print(fact)
print(len(fact))


import collections

def prime_factorize(n):
    a = []
    f = 2
    while n % f == 0:
        a.append(f)
        n //= f
        f *= 2 

    g = 3
    while g * g <= n:
        if n % g == 0:
            a.append(g)
            n //= g
            g += 2
        else:
            g += 2
    return a
    if n != 1 and n in a:
        a.append(n)

N = int(input())
fact = prime_factorize(N)
print(len(fact))


import collections

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

N = int(input())
fact = prime_factorize(N)

b = []
c = fact.copy()
q = 1
for p in fact:
    if p not in b:
        while c.count(p) >= q:
            for i in range (q):
                c.remove(p)
                #print(c)
            b.append(p ** q)
            #print(b)
            q += 1
    q = 1
    #print(p)
    #print(fact)

print(len(b))


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted