Problem p02900 (python)

Fixed submission:
from fractions import gcd
from math import sqrt


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 main():
    A, B = map(int, input().split())
    C = gcd(A, B)
    if (C == 1):
        print(1)
        exit(0)
    arr = factorization(C)
    # print(arr)
    print(len(arr) + 1)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from math import gcd
from math import sqrt


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 main():
    A, B = map(int, input().split())
    C = gcd(A, B)
    if (A == 1 or B == 1):
        print(1)
        exit(0)
    if (C == 1):
        print(1)
        exit(0)
    arr = factorization(C)
    # print(arr)
    print(len(arr) + 1)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from math import gcd
from math import sqrt


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


A, B = map(int, input().split())

C = gcd(A, B)
if (C == 1):
    print(1)
    exit(0)
arr = factorization(C)

#print(arr)
print(len(arr) + 1)

Buggy submission (verdict: Runtime Error):
from math import gcd
from math import sqrt


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


A, B = map(int, input().split())
if (A == 1 or B == 1 or A % B != 0):
    print(1)
    exit(0)
if (A == B):
    print(2)
    exit(0)

C = gcd(A, B)
arr = factorization(C)
#print(arr)
print(len(arr) + 1)

Buggy submission (verdict: Runtime Error):
from math import gcd
from math import sqrt


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


A, B = map(int, input().split())
if (A == 1 or B == 1):
    print(1)
    exit(0)
if (A == B):
    print(2)
    exit(0)

C = gcd(A, B)
arr = factorization(C)
print(len(arr) + 1)

Buggy submission (verdict: Runtime Error):
from math import gcd
from math import sqrt
A, B = map(int, input().split())
if (A == 1 or B == 1 or A == B):
    print(1)
    exit(0)

C = gcd(A, B)
ans = []
print(C)
for i in range(2, C + 1):
    if (C % i == 0): ans.append(i)
    if (i >= C // i): break
N = len(ans)
seen = [0] * N
cnt = 0
for i in range(N):
    if(seen[i]): continue
    for j in range(i, N):
        if (ans[j] % ans[i] == 0):
            seen[j] = 1
    cnt += 1
print(cnt + 1)

Buggy submission (verdict: Runtime Error):
from math import gcd
from math import sqrt
A, B = map(int, input().split())
if (A == 1 or B == 1 or A == B):
    print(1)
    exit(0)

C = gcd(A, B)
ans = 0
for i in range(1, C + 1):
    if (C % i == 0):
        C //= i
        ans += 1
    if (i >= C): break
print(ans)

Buggy submission (verdict: Runtime Error):
from math import gcd
from math import sqrt
A, B = map(int, input().split())
if (A == 1 or B == 1):
    print(1)
    exit(0)
C = gcd(A, B)
ans = 0
for i in range(1, C + 1):
    if (C % i == 0):
        C //= i
        ans += 1
    if (i >= C): break
print(ans)