Buggy python submission (verdict: Time Limit Exceeded):
import sys
if sys.version_info.minor < 5:
    from fractions import gcd
else:
    from math import gcd
import math

DEBUG = False

A, B = map(int, input().split())
g = gcd(A, B)
if DEBUG:
    print("gcd(A, B): {}".format(g))

ans = [1]
i= 2
while g >= i:
    if DEBUG:
        print("i: {}, g: {}".format(i, g))

    if g % i == 0:
        if DEBUG:
            print("This is a cd of A and B.")
        ans.append(i)

    while g % i == 0:
        g //= i

    i += 1

if DEBUG:
    print(ans)

print(len(ans))


Fixed submission:
import sys
if sys.version_info.minor < 5:
    from fractions import gcd
else:
    from math import gcd
import math

DEBUG = False

A, B = map(int, input().split())
g = gcd(A, B)
if DEBUG:
    print("gcd(A, B): {}".format(g))

ans = [1]
i= 2
temp = g
while i <= int(-(-g**0.5//1))+1:
    if DEBUG:
        print("i: {}, g: {}".format(i, g))

    if temp % i == 0:
        if DEBUG:
            print("This is a cd of A and B.")
        ans.append(i)

    while temp % i == 0:
        temp //= i

    i += 1

if temp != 1:
    ans.append(temp)

if DEBUG:
    print(ans)

print(len(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
if sys.version_info.minor < 5:
    from fractions import gcd
else:
    from math import gcd
import math

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

ans = [1]
i= 2
while g >= i:
    # print("i: {}".format(i))

    if g % i == 0:
        # print("This is a cd of A and B.")
        ans.append(i)

    while g % i == 0:
        g /= i

    i += 1

# print(ans)

print(len(ans))


Fixed submission:
import sys
if sys.version_info.minor < 5:
    from fractions import gcd
else:
    from math import gcd
import math

DEBUG = False

A, B = map(int, input().split())
g = gcd(A, B)
if DEBUG:
    print("gcd(A, B): {}".format(g))

ans = [1]
i= 2
temp = g
while i <= int(-(-g**0.5//1))+1:
    if DEBUG:
        print("i: {}, g: {}".format(i, g))

    if temp % i == 0:
        if DEBUG:
            print("This is a cd of A and B.")
        ans.append(i)

    while temp % i == 0:
        temp //= i

    i += 1

if temp != 1:
    ans.append(temp)

if DEBUG:
    print(ans)

print(len(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
if sys.version_info.minor < 5:
    from fractions import gcd
else:
    from math import gcd
import math

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

ans = [1]
for i in range(2, g+1):
    # print("i: {}".format(i))

    if g % i == 0:
        # print("This is a cd of A and B.")
        ans.append(i)

    while g % i == 0:
        g /= i

# print(set(ans))

print(len(set(ans)))


Fixed submission:
import sys
if sys.version_info.minor < 5:
    from fractions import gcd
else:
    from math import gcd
import math

DEBUG = False

A, B = map(int, input().split())
g = gcd(A, B)
if DEBUG:
    print("gcd(A, B): {}".format(g))

ans = [1]
i= 2
temp = g
while i <= int(-(-g**0.5//1))+1:
    if DEBUG:
        print("i: {}, g: {}".format(i, g))

    if temp % i == 0:
        if DEBUG:
            print("This is a cd of A and B.")
        ans.append(i)

    while temp % i == 0:
        temp //= i

    i += 1

if temp != 1:
    ans.append(temp)

if DEBUG:
    print(ans)

print(len(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
if sys.version_info.minor < 5:
    from fractions import gcd
else:
    from math import gcd
import math

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

ans = [1]
for i in range(2, gcd(A, B)+1):
    # print("i: {}".format(i))

    if A % i == 0 and B % i == 0:
        # print("This is a cd of A and B.")
        ans.append(i)

    while A % i == 0:
        A /= i
    while B % i == 0:
        B /= i

# print(set(ans))

print(len(set(ans)))


Fixed submission:
import sys
if sys.version_info.minor < 5:
    from fractions import gcd
else:
    from math import gcd
import math

DEBUG = False

A, B = map(int, input().split())
g = gcd(A, B)
if DEBUG:
    print("gcd(A, B): {}".format(g))

ans = [1]
i= 2
temp = g
while i <= int(-(-g**0.5//1))+1:
    if DEBUG:
        print("i: {}, g: {}".format(i, g))

    if temp % i == 0:
        if DEBUG:
            print("This is a cd of A and B.")
        ans.append(i)

    while temp % i == 0:
        temp //= i

    i += 1

if temp != 1:
    ans.append(temp)

if DEBUG:
    print(ans)

print(len(ans))