Buggy python submission (verdict: Runtime Error):
#-------------------------------------------------------------------
def make_divisors(n):
    divisors = set()
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.add(i)
            if i != n // i:
                divisors.add(n//i)
    return divisors
#-------------------------------------------------------------------
def is_prime(n):
    if n == 2: return True
    if n == 1 or n & 1 == 0: return False
 
    d = (n - 1) >> 1
    while d & 1 == 0:
        d >>= 1
 
    for k in range(100):
        a = random.randint(1, n - 1)
        t = d
        y = pow(a, t, n)
 
        while t != n - 1 and y != 1 and y != n - 1:
            y = (y * y) % n
            t <<= 1
 
        if y != n - 1 and t & 1 == 0:
            return False
 
    return True

#-------------------------------------------------------------------
#Python -3.4.x
from fractions import gcd
#-------------------------------------------------------------------
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------
a,b = map(int, input().split())			# "5 7" -> ["5", "7"] -> 5, 7 => N=5,K=7

g=gcd(a,b)
#p('g ', g)
L=make_divisors(g)

#p( gcd(a,b) )
#p( L )

ans=1
for l in L:
	#if a%l==0 and b%l==0: ans+=1
	if is_prime(l): ans+=1

print(ans)


Fixed submission:
#-------------------------------------------------------------------
def make_divisors(n):
    divisors = set()
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.add(i)
            if i != n // i:
                divisors.add(n//i)
    return divisors
#-------------------------------------------------------------------
import random
def is_prime(n):
    if n == 2: return True
    if n == 1 or n & 1 == 0: return False
 
    d = (n - 1) >> 1
    while d & 1 == 0:
        d >>= 1
 
    for k in range(100):
        a = random.randint(1, n - 1)
        t = d
        y = pow(a, t, n)
 
        while t != n - 1 and y != 1 and y != n - 1:
            y = (y * y) % n
            t <<= 1
 
        if y != n - 1 and t & 1 == 0:
            return False
 
    return True

#-------------------------------------------------------------------
#Python -3.4.x
from fractions import gcd
#-------------------------------------------------------------------
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------
a,b = map(int, input().split())			# "5 7" -> ["5", "7"] -> 5, 7 => N=5,K=7

g=gcd(a,b)
#p('g ', g)
L=make_divisors(g)

#p( gcd(a,b) )
#p( L )

ans=1
for l in L:
	#if a%l==0 and b%l==0: ans+=1
	if is_prime(l): ans+=1

print(ans)

Buggy python submission (verdict: Runtime Error):
#-------------------------------------------------------------------
def make_divisors(n):
    divisors = set()
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.add(i)
            if i != n // i:
                divisors.add(n//i)
    return divisors
#-------------------------------------------------------------------
def is_prime(n):
    if n == 2: return True
    if n == 1 or n & 1 == 0: return False
 
    d = (n - 1) >> 1
    while d & 1 == 0:
        d >>= 1
 
    for k in range(100):
        a = random.randint(1, n - 1)
        t = d
        y = pow(a, t, n)
 
        while t != n - 1 and y != 1 and y != n - 1:
            y = (y * y) % n
            t <<= 1
 
        if y != n - 1 and t & 1 == 0:
            return False
 
    return True

#-------------------------------------------------------------------
#Python -3.4.x
from fractions import gcd
#-------------------------------------------------------------------
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------
a,b = map(int, input().split())			# "5 7" -> ["5", "7"] -> 5, 7 => N=5,K=7

g=gcd(a,b)
#p('g ', g)
L=make_divisors(g)

#p( gcd(a,b) )
#p( L )

ans=1
for l in L:
	#if a%l==0 and b%l==0: ans+=1
	if is_prime(l): ans+=1

print(ans)


Fixed submission:
#-------------------------------------------------------------------
def make_divisors(n):
    divisors = set()
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.add(i)
            if i != n // i:
                divisors.add(n//i)
    return divisors
#-------------------------------------------------------------------
import random
def is_prime(n):
    if n == 2: return True
    if n == 1 or n & 1 == 0: return False
 
    d = (n - 1) >> 1
    while d & 1 == 0:
        d >>= 1
 
    for k in range(100):
        a = random.randint(1, n - 1)
        t = d
        y = pow(a, t, n)
 
        while t != n - 1 and y != 1 and y != n - 1:
            y = (y * y) % n
            t <<= 1
 
        if y != n - 1 and t & 1 == 0:
            return False
 
    return True

#-------------------------------------------------------------------
#Python -3.4.x
from fractions import gcd
#-------------------------------------------------------------------
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------
a,b = map(int, input().split())			# "5 7" -> ["5", "7"] -> 5, 7 => N=5,K=7

g=gcd(a,b)
#p('g ', g)
L=make_divisors(g)

#p( gcd(a,b) )
#p( L )

ans=1
for l in L:
	#if a%l==0 and b%l==0: ans+=1
	if is_prime(l): ans+=1

print(ans)

Buggy python submission (verdict: Runtime Error):
#-------------------------------------------------------------------
# 約数を高速で列挙するコード(Python)
# https://qiita.com/LorseKudos/items/9eb560494862c8b4eb56
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 is_prime(n):
    if n == 2: return True
    if n == 1 or n & 1 == 0: return False
 
    d = (n - 1) >> 1
    while d & 1 == 0:
        d >>= 1
 
    for k in range(100):
        a = random.randint(1, n - 1)
        t = d
        y = pow(a, t, n)
 
        while t != n - 1 and y != 1 and y != n - 1:
            y = (y * y) % n
            t <<= 1
 
        if y != n - 1 and t & 1 == 0:
            return False
 
    return True

#-------------------------------------------------------------------
#Python -3.4.x
from fractions import gcd
#-------------------------------------------------------------------
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------
a,b = map(int, input().split())			# "5 7" -> ["5", "7"] -> 5, 7 => N=5,K=7

g=gcd(a,b)
#p('g ', g)
L=make_divisors(g)

#p( gcd(a,b) )
#p( L )

ans=1
for l in L:
	#if a%l==0 and b%l==0: ans+=1
	if is_prime(l): ans+=1

print(ans)


Fixed submission:
#-------------------------------------------------------------------
def make_divisors(n):
    divisors = set()
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.add(i)
            if i != n // i:
                divisors.add(n//i)
    return divisors
#-------------------------------------------------------------------
import random
def is_prime(n):
    if n == 2: return True
    if n == 1 or n & 1 == 0: return False
 
    d = (n - 1) >> 1
    while d & 1 == 0:
        d >>= 1
 
    for k in range(100):
        a = random.randint(1, n - 1)
        t = d
        y = pow(a, t, n)
 
        while t != n - 1 and y != 1 and y != n - 1:
            y = (y * y) % n
            t <<= 1
 
        if y != n - 1 and t & 1 == 0:
            return False
 
    return True

#-------------------------------------------------------------------
#Python -3.4.x
from fractions import gcd
#-------------------------------------------------------------------
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------
a,b = map(int, input().split())			# "5 7" -> ["5", "7"] -> 5, 7 => N=5,K=7

g=gcd(a,b)
#p('g ', g)
L=make_divisors(g)

#p( gcd(a,b) )
#p( L )

ans=1
for l in L:
	#if a%l==0 and b%l==0: ans+=1
	if is_prime(l): ans+=1

print(ans)

Buggy python submission (verdict: Runtime Error):
#-------------------------------------------------------------------
# 約数を高速で列挙するコード(Python)
# https://qiita.com/LorseKudos/items/9eb560494862c8b4eb56
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
#-------------------------------------------------------------------
import random
def is_prime3(q,k=50):
    q = abs(q)
    #計算するまでもなく判定できるものははじく
    if q == 2: return True
    if q < 2 or q&1 == 0: return False

    #n-1=2^s*dとし（但しaは整数、dは奇数)、dを求める
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    
    #判定をk回繰り返す
    for i in xrange(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        #[0,s-1]の範囲すべてをチェック
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

#-------------------------------------------------------------------
#Python -3.4.x
from fractions import gcd
#-------------------------------------------------------------------
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------
a,b = map(int, input().split())			# "5 7" -> ["5", "7"] -> 5, 7 => N=5,K=7

g=gcd(a,b)
#p('g ', g)
L=make_divisors(g)

#p( gcd(a,b) )
#p( L )

ans=1
for l in L:
	#if a%l==0 and b%l==0: ans+=1
	if is_prime3(l): ans+=1

print(ans)


Fixed submission:
#-------------------------------------------------------------------
def make_divisors(n):
    divisors = set()
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.add(i)
            if i != n // i:
                divisors.add(n//i)
    return divisors
#-------------------------------------------------------------------
import random
def is_prime(n):
    if n == 2: return True
    if n == 1 or n & 1 == 0: return False
 
    d = (n - 1) >> 1
    while d & 1 == 0:
        d >>= 1
 
    for k in range(100):
        a = random.randint(1, n - 1)
        t = d
        y = pow(a, t, n)
 
        while t != n - 1 and y != 1 and y != n - 1:
            y = (y * y) % n
            t <<= 1
 
        if y != n - 1 and t & 1 == 0:
            return False
 
    return True

#-------------------------------------------------------------------
#Python -3.4.x
from fractions import gcd
#-------------------------------------------------------------------
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------
a,b = map(int, input().split())			# "5 7" -> ["5", "7"] -> 5, 7 => N=5,K=7

g=gcd(a,b)
#p('g ', g)
L=make_divisors(g)

#p( gcd(a,b) )
#p( L )

ans=1
for l in L:
	#if a%l==0 and b%l==0: ans+=1
	if is_prime(l): ans+=1

print(ans)

Buggy python submission (verdict: Runtime Error):
#-------------------------------------------------------------------
# 【Python】エラトステネスの篩を使ってPythonで素数を探す
# https://a-zumi.net/python-prime/
def prime(n):
    seq = list(range(2, n))
    while len(seq) > 0:
        prime = seq.pop(0)
        yield prime
        # 素数で割り切れない数字のリストを作成
        seq = [i for i in seq if not i % prime == 0]

#-------------------------------------------------------------------
#Python -3.4.x
from fractions import gcd
#-------------------------------------------------------------------
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------



a,b = map(int, input().split())			# "5 7" -> ["5", "7"] -> 5, 7 => N=5,K=7

#L=list(prime(gcd(a,b)))

g=gcd(a,b)
p('g ', g)
L=list(prime(g))

#p( gcd(a,b) )
#p( L )

ans=1
for l in L:
	if a%l==0 and b%l==0: ans+=1

print(ans)


Fixed submission:
#-------------------------------------------------------------------
def make_divisors(n):
    divisors = set()
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.add(i)
            if i != n // i:
                divisors.add(n//i)
    return divisors
#-------------------------------------------------------------------
import random
def is_prime(n):
    if n == 2: return True
    if n == 1 or n & 1 == 0: return False
 
    d = (n - 1) >> 1
    while d & 1 == 0:
        d >>= 1
 
    for k in range(100):
        a = random.randint(1, n - 1)
        t = d
        y = pow(a, t, n)
 
        while t != n - 1 and y != 1 and y != n - 1:
            y = (y * y) % n
            t <<= 1
 
        if y != n - 1 and t & 1 == 0:
            return False
 
    return True

#-------------------------------------------------------------------
#Python -3.4.x
from fractions import gcd
#-------------------------------------------------------------------
import sys
def p(*_a):
  _s=" ".join(map(str,_a))
  #print(_s)
  sys.stderr.write(_s+"\n")
#-------------------------------------------------------------------
a,b = map(int, input().split())			# "5 7" -> ["5", "7"] -> 5, 7 => N=5,K=7

g=gcd(a,b)
#p('g ', g)
L=make_divisors(g)

#p( gcd(a,b) )
#p( L )

ans=1
for l in L:
	#if a%l==0 and b%l==0: ans+=1
	if is_prime(l): ans+=1

print(ans)