Problem p02660 (python)

Fixed submission:
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]))


def maxvalue(n):
    if (n < 3):
        return 1
    elif (n < 6):
        return 2
    elif (n < 10):
        return 3
    elif (n < 15):
        return 4
    elif (n < 21):
        return 5
    elif (n < 28):
        return 6
    elif (n < 36):
        return 7
    elif (n < 45):
        return 8
    elif (n < 55):
        return 9
    elif (n < 66):
        return 10

sum = 0
for i in range(len(key)):
    sum += maxvalue(val[i])
    # 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)

Buggy submission (verdict: Runtime Error):
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]))


numList = [0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8]

sum = 0
for i in range(len(key)):
    sum += numList[val[i]]
    # 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)

Buggy submission (verdict: Runtime Error):
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]))


numList = [0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6]

sum = 0
for i in range(len(key)):
    sum += numList[val[i]]
    # 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)

Buggy submission (verdict: Runtime Error):
import sympy

N = sympy.factorint(int(input()))

key = list(N.keys())
val = list(N.values())

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
            count += 1

print(sum)

Buggy submission (verdict: Runtime Error):
import sympy

N = sympy.factorint(int(input()))

key = list(N.keys())
val = list(N.values())

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
            count += 1

print(sum)

Buggy submission (verdict: Runtime Error):
import sympy

N = sympy.factorint(int(input()))

key = list(N.keys())
val = list(N.values())

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
            count += 1

print(sum)