Buggy python submission (verdict: Time Limit Exceeded):
import fractions
import heapq

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

cd = []
max_cd = fractions.gcd(A, B)

if max_cd == 1:
    cd.append(1)
else:
    for i in range(1, max_cd + 1):
        if not max_cd % i == 0:
            continue

        a = max_cd // i

        if i > a:
            break

        heapq.heappush(cd, i)
        heapq.heappush(cd, a)

l = []

for i in range(0, len(cd)):
    c = heapq.heappop(cd)
    if not l:
        l.append(c)
    else:
        join = True
        for j in range(0, len(l)):
            k = l[j]
            if fractions.gcd(c, k) != 1:
                join = False
                break
        if join:
            l.append(c)

print(len(l))


Fixed submission:
import fractions
import heapq
import itertools


def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


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

cd = []
max_cd = fractions.gcd(A, B)

if max_cd == 1:
    cd.append(1)
else:
    heapq.heappush(cd, 1)

    f = [k[0] for k in factorize(max_cd)]
    for v in f:
        heapq.heappush(cd, v)

l = []

for i in range(0, len(cd)):
    c = heapq.heappop(cd)
    if not l:
        l.append(c)
    else:
        join = True
        for j in range(0, len(l)):
            k = l[j]
            if fractions.gcd(c, k) != 1:
                join = False
                break
        if join:
            l.append(c)

print(len(l))

Buggy python submission (verdict: Time Limit Exceeded):
import fractions

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

cd = []

for i in range(1, min(A, B) + 1):
    if A % i == 0 and B % i == 0:
        if i % 2 == 0 and i != 2:
            continue
        if i % 3 == 0 and i != 3:
            continue
        if i % 5 == 0 and i != 5:
            continue
        if i % 7 == 0 and i != 7:
            continue
        if i % 11 == 0 and i != 11:
            continue
        if i % 13 == 0 and i != 13:
            continue
        cd.append(i)

l = []

for i in range(0, len(cd)):
    c = cd[i]
    if not l:
        l.append(c)
    else:
        join = True
        for j in range(0, len(l)):
            k = l[j]
            if fractions.gcd(c, k) != 1:
                join = False
                break
        if join:
            l.append(c)

print(len(l))


Fixed submission:
import fractions
import heapq
import itertools


def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


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

cd = []
max_cd = fractions.gcd(A, B)

if max_cd == 1:
    cd.append(1)
else:
    heapq.heappush(cd, 1)

    f = [k[0] for k in factorize(max_cd)]
    for v in f:
        heapq.heappush(cd, v)

l = []

for i in range(0, len(cd)):
    c = heapq.heappop(cd)
    if not l:
        l.append(c)
    else:
        join = True
        for j in range(0, len(l)):
            k = l[j]
            if fractions.gcd(c, k) != 1:
                join = False
                break
        if join:
            l.append(c)

print(len(l))

Buggy python submission (verdict: Time Limit Exceeded):
import fractions

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

cd = []

for i in range(1, min(A, B) + 1):
    if A % i == 0 and B % i == 0:
        cd.append(i)

l = []

for i in range(0, len(cd)):
    c = cd[i]
    if not l:
        l.append(c)
    else:
        join = True
        for j in range(0, len(l)):
            k = l[j]
            if fractions.gcd(c, k) != 1:
                join = False
                break
        if join:
            l.append(c)

print(len(l))


Fixed submission:
import fractions
import heapq
import itertools


def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


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

cd = []
max_cd = fractions.gcd(A, B)

if max_cd == 1:
    cd.append(1)
else:
    heapq.heappush(cd, 1)

    f = [k[0] for k in factorize(max_cd)]
    for v in f:
        heapq.heappush(cd, v)

l = []

for i in range(0, len(cd)):
    c = heapq.heappop(cd)
    if not l:
        l.append(c)
    else:
        join = True
        for j in range(0, len(l)):
            k = l[j]
            if fractions.gcd(c, k) != 1:
                join = False
                break
        if join:
            l.append(c)

print(len(l))