Buggy python submission (verdict: Time Limit Exceeded):
# D - Disjoint Set of Common Divisors
A, B = map(int, input().split())

from fractions import gcd

#nの素数判定
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

ans = 0
gcd1 = gcd(A, B)
for i in range(2, gcd1+1):
    if A%i == 0 and B%i == 0:
        if is_prime(i):
            ans += 1

print(ans+1)

Fixed submission:
# D - Disjoint Set of Common Divisors
A, B = map(int, input().split())

from fractions import gcd

# nの素数判定
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

# nの約数列挙
def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            ass.append(n//i)
    return ass #sortされていない

ans = 0
gcd1 = gcd(A, B)
for i in divisor(gcd1):
    if is_prime(i):
        ans += 1

print(ans+1)

Buggy python submission (verdict: Runtime Error):
# D - Disjoint Set of Common Divisors
A, B = map(int, input().split())

from fractions import gcd

# n以下の素数列挙 O(n log(n))
def primes(n):
    ass = []
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass

ans = 0
prms = primes(gcd(A, B))
if len(prms) > 0:
    for pr in prms:
        if A%pr == 0 and B%pr == 0:
            ans += 1

print(ans+1)
# 1は素数に含まれないが今回の問題の回答に含まれるので+1

Fixed submission:
# D - Disjoint Set of Common Divisors
A, B = map(int, input().split())

from fractions import gcd

# nの素数判定
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

# nの約数列挙
def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            ass.append(n//i)
    return ass #sortされていない

ans = 0
gcd1 = gcd(A, B)
for i in divisor(gcd1):
    if is_prime(i):
        ans += 1

print(ans+1)

Buggy python submission (verdict: Runtime Error):
# D - Disjoint Set of Common Divisors
A, B = map(int, input().split())

from fractions import gcd

# n以下の素数列挙 O(n log(n))
def primes(n):
    ass = []
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass

ans = 0
for pr in primes(gcd(A, B)):
    if A%pr == 0 and B%pr == 0:
        ans += 1

print(ans+1)
# 1は素数に含まれないが今回の問題の回答に含まれるので+1

Fixed submission:
# D - Disjoint Set of Common Divisors
A, B = map(int, input().split())

from fractions import gcd

# nの素数判定
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

# nの約数列挙
def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            ass.append(n//i)
    return ass #sortされていない

ans = 0
gcd1 = gcd(A, B)
for i in divisor(gcd1):
    if is_prime(i):
        ans += 1

print(ans+1)

Buggy python submission (verdict: Time Limit Exceeded):
def isPrime(N, arr):
	if N == 1:
		return True
	for i, x in enumerate(arr):
		if x > 1 and N % x == 0:
			return False
	return True

def q_D(A, B):
	target = A
	another = B
	if A > B:
		target = B
		another = A
	yaku = []
	if target == 1:
		yaku.append(1)
	for i in range(int(target/2)):
		x = i + 1
		if target % x == 0 and another % x == 0:
			if isPrime(x, yaku):
				yaku.append(x)
	print(len(yaku))

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


Fixed submission:
# D - Disjoint Set of Common Divisors
A, B = map(int, input().split())

from fractions import gcd

# nの素数判定
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

# nの約数列挙
def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            ass.append(n//i)
    return ass #sortされていない

ans = 0
gcd1 = gcd(A, B)
for i in divisor(gcd1):
    if is_prime(i):
        ans += 1

print(ans+1)

Buggy python submission (verdict: Time Limit Exceeded):
def isPrime(N):
	if N == 1:
		return True
	for i in range(1, int(N**0.5)):
		k = i + 1
		if N % k == 0:
			return False
	return True

def q_D(A, B):
	target = A
	another = B
	if A > B:
		target = B
		another = A
	yaku = []
	sosu = []
	if target == 1:
		yaku.append(1)
	for i in range(int(target/2)):
		n = i + 1
		if target % n == 0:
			if another % n == 0:
				yaku.append(n)
	for i, x in enumerate(yaku):
		if isPrime(x):
			sosu.append(x)
	print(len(sosu))

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

Fixed submission:
# D - Disjoint Set of Common Divisors
A, B = map(int, input().split())

from fractions import gcd

# nの素数判定
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

# nの約数列挙
def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            ass.append(n//i)
    return ass #sortされていない

ans = 0
gcd1 = gcd(A, B)
for i in divisor(gcd1):
    if is_prime(i):
        ans += 1

print(ans+1)