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 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):
            if L % 2 == 0:
                continue
            chk = True
            for L2 in pn:
                if L % L2 == 0:
                    chk = False
            if chk == True:
                for i in pn:
                    d = L
                    while(True):
                        if N % d == 0:
                            N /= d
                            ans += 1
                            d *= i
                        else:
                            break
        print(ans)
        return
    elif N == 2:
        print(1)
        return
    else:
        print(0)
        return


if __name__ == '__main__':
    main()


import math
import decimal


def main():

    N = int(input())
    ans = 0
    A = int(math.ceil(N**0.5)+1)
    explist = []
    flag = False
    if N >= 3:
        for L in range(2, A):
            if N < L:
                break
            d = L
            cnt = 0
            while(True):
                if N % d == 0:
                    N /= d
                    cnt += 1
                    flag = True
                else:
                    break
            explist.append([d, cnt])
        for i in explist:
            c = i[1]
            for j in range(1, A):
                if c >= j:
                    ans += 1
                    c -= j
                    print(c[0])
                else:
                    break
        if flag:
            print(ans)
            return
        else:
            print(1)
            return
    elif N == 2:
        print(1)
        return
    else:
        print(0)
        return


if __name__ == '__main__':
    main()


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
        d = i
        while(True):
            if N % d == 0:
                N /= d
                cnt += 1
                d *= d
            else:
                break

    print(ans)


if __name__ == '__main__':
    main()


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):
            if L % 2 == 0:
                continue
            chk = True
            for L2 in pn:
                if L % L2 == 0:
                    chk = False
            if chk == True:
                for i in pn:
                    d = L
                    while(True):
                        if N % d == 0:
                            N /= d
                            ans += 1
                            d *= i
                        else:
                            break
    elif N == 2:
        print(1)
        return
    else:
        print(0)
        return

    print(ans)


if __name__ == '__main__':
    main()


import math
import decimal


def main():

    N = int(input())
    ans = 0
    A = int(math.ceil(N**0.5)+1)
    explist = []
    flag = False
    if N >= 3:
        for L in range(2, A):
            if N < L:
                break
            d = L
            cnt = 0
            while(True):
                if N % d == 0:
                    N /= d
                    cnt += 1
                    flag = True
                else:
                    break
            explist.append([d, cnt])
        for i in explist:
            c = i[1]
            for j in range(1, A):
                if c >= j:
                    ans += 1
                    c -= j
                else:
                    break
        if N >= A:
            ans += 1
        if flag:
            print(ans)
            return
        else:
            print(1)
            return
    elif N == 2:
        print(1)
        return
    else:
        print(0)
        return


if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Accepted