Problem p02660 (python)

Fixed submission:
history = set([])

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]

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 func(n):
    if n == 1:
        return 
    l = make_divisors(n)
    for i in sorted(l[1:]):
        if i in history:
            continue
        if len(factorization(i)) > 1:
            continue
        history.add(i)
        _ = n // i
        func(_)
        break
    return

N = int(input())
if N == 0:
    print(0)
elif N == 1:
    print(0)
else:
    func(N)
    print(len(history))

Buggy submission (verdict: Runtime Error):
history = set([])


import sympy

def func(n):
    if n == 1:
        return 
    l = sympy.divisors(n)
    for i in sorted(l[1:]):
        if i in history:
            continue
        if len(sympy.factorint(i)) > 1:
            continue
        print(i, n)
        history.add(i)
        _ = n // i
        func(_)
        break
    return

N = int(input())
if N == 0:
    print(0)
elif N == 1:
    print(1)
else:
    func(N)
    print(len(history))

Buggy submission (verdict: Runtime Error):
import sympy

def func(n, history):
    l = sympy.divisors(n)
    if len(l) == 1:
        history.append(l[0])
        return history
    for i in l[1:]:
        if n == i:
            history.append(i)
            return history
        if i in history:
            continue
        history.append(i)
        _ = n // i
        func(_, history)
        break
    return history

N = int(input())
if N == 0:
    print(0)
else:
    h = func(N, [])
    print(len(set(h)))

Buggy submission (verdict: Runtime Error):

import sympy

def func(n, history):
    l = sympy.divisors(n)
    for i in l[1:]:
        if n == i:
            history.append(i)
            return history
        if i in history:
            continue
        history.append(i)
        try:
            _ = n // i
        except:
            return history
        func(_, history)
        break
    return history

N = int(input())
if N == 0:
    print(0)
else:
    h = func(N, [])
    print(len(set(h)))

Buggy submission (verdict: Runtime Error):
input_count = 0

import sympy

def func(n, history):
    try:
        l = sympy.divisors(n)
    except:
        return history
    for i in l[1:]:
        if n == i:
            history.append(i)
            return history
        if i in history:
            continue
        history.append(i)
        func(n//i, history)
        break
    return history

N = int(input())
if N == 0:
    print(0)
else:
    h = func(N, [])
    print(len(set(h)))

Buggy submission (verdict: Runtime Error):

import sympy

def func(n, history):
    l = sympy.divisors(n)
    #print(l, n)
    for i in l[1:]:
        if n == i:
            history.append(i)
            return history
        if i in history:
            continue
        history.append(i)
        func(n//i, history)
        break
    return history

N = int(input())
if N == 0:
    print(0)
else:
    h = func(N, [])
    print(len(set(h)))

Buggy submission (verdict: Runtime Error):
import sympy

def func(n, history):
    l = sympy.divisors(n)
    for i in l[1:]:
        if n == i:
            history.append(i)
            return history
        if i in history:
            continue
        history.append(i)
        func(n//i, history)
        break
    return history

N = int(input())
print(len(func(N, [])))

Buggy submission (verdict: Runtime Error):
input_count = 0

import math

A, B = input().split()

A = int(A)
if '.' in B:
    B_a = int(B.split('.')[0])
    B_b_size = len(B.split('.')[1])
    B_b =  int(B.split('.')[1])
else:
    B_a = int(B)
    B_b_size = 0
    B_b = 0
ans_a = A * B_a
ans_b = A * B_b 
ans = ans_a + int(ans_b * pow(10, B_b_size))
print(ans)