Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate
from collections import defaultdict


def main():
    n = int(input())
    prime_counter = defaultdict(int)  # key ^ value
    acc = tuple(accumulate(range(1, 42)))  # because 10^12 < 2^39

    def facs(n):
        yield 2
        for x in range(3, int(pow(n, 0.5)) + 1, 2):
            yield x
        yield n

    for fac in facs(n):
        while n % fac == 0:
            n //= fac
            prime_counter[fac] += 1
            # ここで if fac * fac > n: braek を入れると，
            # 計算量の少ないケースでは早く，多いケースでは遅くなる。
    if n != 1:
        prime_counter[n] += 1

    ans = 0
    for c in prime_counter.values():
        for i, x in enumerate(acc):
            if c < x:
                tmp = i
                break
        ans += tmp
    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
from collections import Counter
from itertools import accumulate


def prime_factorize(n):
    """素因数分解し，ユニークな素因数のsetを返す。"""
    ans = []
    ans_add = ans.append
    while n % 2 == 0:
        ans_add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            ans_add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        ans_add(n)
    return ans


def main():
    n = int(input())
    primes = prime_factorize(n)
    acc = tuple(accumulate(range(1, 42)))
    counted = Counter(primes)
    ans = 0

    for c in counted.values():
        for i, x in enumerate(acc):
            if c >= x:
                tmp = i + 1
            else:
                break
        ans += tmp

    print(ans)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate
from collections import defaultdict


def main():
    n = int(input())
    prime_counter = defaultdict(int)  # key ^ value
    acc = tuple(accumulate(range(1, 42)))  # because 10^12 < 2^39

    def facs(n):
        yield 2
        for x in range(3, int(n ** 0.5) + 1, 2):
            yield x
        yield n

    for fac in facs(n):
        while n % fac == 0:
            n //= fac
            prime_counter[fac] += 1
            # ここで if fac * fac > n: braek を入れると，
            # 計算量の少ないケースでは早く，多いケースでは遅くなる。
    if n != 1:
        prime_counter[n] += 1

    ans = 0
    for c in prime_counter.values():
        for i, x in enumerate(acc):
            if c < x:
                tmp = i
                break
        ans += tmp
    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
from collections import Counter
from itertools import accumulate


def prime_factorize(n):
    """素因数分解し，ユニークな素因数のsetを返す。"""
    ans = []
    ans_add = ans.append
    while n % 2 == 0:
        ans_add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            ans_add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        ans_add(n)
    return ans


def main():
    n = int(input())
    primes = prime_factorize(n)
    acc = tuple(accumulate(range(1, 42)))
    counted = Counter(primes)
    ans = 0

    for c in counted.values():
        for i, x in enumerate(acc):
            if c >= x:
                tmp = i + 1
            else:
                break
        ans += tmp

    print(ans)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    ans = 0

    e = 1
    for fac in (2, *(x * 2 + 3 for x in range(pow(10, 12)))):
        while n % (div := pow(fac, e)) == 0:
            n //= div
            ans += 1
            e += 1

        while n % fac == 0:
            n //= fac

        if fac * fac > n:
            break
        e = 1

    if n != 1:
        ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
from collections import Counter
from itertools import accumulate


def prime_factorize(n):
    """素因数分解し，ユニークな素因数のsetを返す。"""
    ans = []
    ans_add = ans.append
    while n % 2 == 0:
        ans_add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            ans_add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        ans_add(n)
    return ans


def main():
    n = int(input())
    primes = prime_factorize(n)
    acc = tuple(accumulate(range(1, 42)))
    counted = Counter(primes)
    ans = 0

    for c in counted.values():
        for i, x in enumerate(acc):
            if c >= x:
                tmp = i + 1
            else:
                break
        ans += tmp

    print(ans)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    ans = 0

    fac = 2
    e = 1
    while pow(fac, 2) <= n:
        while n % (div := pow(fac, e)) == 0:
            n //= div
            ans += 1
            e += 1

        while n % fac == 0:
            n //= fac

    fac = 3
    e = 1
    while pow(fac, 2) <= n:
        while n % (div := pow(fac, e)) == 0:
            n //= div
            ans += 1
            e += 1

        while n % fac == 0:
            n //= fac
        e = 1
        fac += 2

    if n != 1:
        ans += 1

    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
from collections import Counter
from itertools import accumulate


def prime_factorize(n):
    """素因数分解し，ユニークな素因数のsetを返す。"""
    ans = []
    ans_add = ans.append
    while n % 2 == 0:
        ans_add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            ans_add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        ans_add(n)
    return ans


def main():
    n = int(input())
    primes = prime_factorize(n)
    acc = tuple(accumulate(range(1, 42)))
    counted = Counter(primes)
    ans = 0

    for c in counted.values():
        for i, x in enumerate(acc):
            if c >= x:
                tmp = i + 1
            else:
                break
        ans += tmp

    print(ans)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
from itertools import accumulate


def main():
    n = int(input())
    prime_counter = [0] * n
    acc = tuple(accumulate(range(1, 42)))  # 10^12 < 2^39

    f = 2
    while f * f <= n:
        if n % f == 0:
            n //= f
            prime_counter[f] += 1
        else:
            f += 2
    if n != 1:
        prime_counter[n] += 1

    ans = 0
    for c in prime_counter:
        for i, x in enumerate(acc):
            if c < x:
                tmp = i
                break
        ans += tmp
    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
from collections import Counter
from itertools import accumulate


def prime_factorize(n):
    """素因数分解し，ユニークな素因数のsetを返す。"""
    ans = []
    ans_add = ans.append
    while n % 2 == 0:
        ans_add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            ans_add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        ans_add(n)
    return ans


def main():
    n = int(input())
    primes = prime_factorize(n)
    acc = tuple(accumulate(range(1, 42)))
    counted = Counter(primes)
    ans = 0

    for c in counted.values():
        for i, x in enumerate(acc):
            if c >= x:
                tmp = i + 1
            else:
                break
        ans += tmp

    print(ans)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
from itertools import accumulate


def main():
    n = int(input())
    prime_counter = [0] * int(n ** 0.5 + 2)
    acc = tuple(accumulate(range(1, 42)))  # 10^12 < 2^39

    f = 2
    while f * f <= n:
        if n % f == 0:
            n //= f
            prime_counter[f] += 1
        else:
            f += 2
    if n != 1:
        prime_counter[n] += 1

    ans = 0
    for c in prime_counter:
        for i, x in enumerate(acc):
            if c < x:
                tmp = i
                break
        ans += tmp
    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
from collections import Counter
from itertools import accumulate


def prime_factorize(n):
    """素因数分解し，ユニークな素因数のsetを返す。"""
    ans = []
    ans_add = ans.append
    while n % 2 == 0:
        ans_add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            ans_add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        ans_add(n)
    return ans


def main():
    n = int(input())
    primes = prime_factorize(n)
    acc = tuple(accumulate(range(1, 42)))
    counted = Counter(primes)
    ans = 0

    for c in counted.values():
        for i, x in enumerate(acc):
            if c >= x:
                tmp = i + 1
            else:
                break
        ans += tmp

    print(ans)


if __name__ == '__main__':
    main()