Problem p02900 (python)

Fixed submission:
#!/usr/bin/env python3
import sys

# from math import gcd
from fractions import gcd

def isprime(x :int):
    if(x == 1):
        return False

    for i in range(2, int(x**0.5)+1):
        if(x%i == 0):
            return False

    return True


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


def solve(A: int, B: int):

    x = list(set(make_divisors(A)) & set(make_divisors(B)))
    
    ans = 1
    for i in x:
        if(isprime(i)):
            ans += 1

    print(ans)
            
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys

# from math import gcd
from fraction import gcd

def coprime2(a, b):
    return gcd(a, b) == 1

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors



def solve(A: int, B: int):
    x = list(set(make_divisors(A)) & set(make_divisors(B)))
    
    ans = 0
    nn = len(x)
    for i in range(nn):
        t = [x[i]]
        for j in range(i+1,nn):
            f = True
            for k in t:
                if(coprime2(x[j],k) != 1):
                    f = False
            if(f):
                t.append(x[j])
                ans = max(ans, len(t))
    if(len(x) == 1 and x[0] == 1):
        print(1)
    else:
        print(ans)
            
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys

from math import gcd
# from fraction import gcd

def coprime2(a, b):
    return gcd(a, b) == 1

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors



def solve(A: int, B: int):
    x = list(set(make_divisors(A)) & set(make_divisors(B)))
    
    ans = 0
    nn = len(x)
    for i in range(nn):
        t = [x[i]]
        for j in range(i+1,nn):
            f = True
            for k in t:
                if(coprime2(x[j],k) != 1):
                    f = False
            if(f):
                t.append(x[j])
                ans = max(ans, len(t))
    if(len(x) == 1 and x[0] == 1):
        print(1)
    else:
        print(ans)
            
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()