Problem:
 Score : 400 points    Problem Statement Given are positive integers A and B .  Let us choose some number of positive common divisors of A and B .  Here, any two of the chosen divisors must be coprime.  At most, how many divisors can we choose?  Definition of common divisor  An integer d is said to be a common divisor of integers x and y when d divides both x and y .   Definition of being coprime  Integers x and y are said to be coprime when x and y have no positive common divisors other than 1 .   Definition of dividing  An integer x is said to divide another integer y when there exists an integer \alpha such that y = \alpha x .       Constraints  All values in input are integers.  1 \leq A, B \leq 10^{12}         Input Input is given from Standard Input in the following format:  A  B       Output Print the maximum number of divisors that can be chosen to satisfy the condition.        Sample Input 1 12 18      Sample Output 1 3  12 and 18 have the following positive common divisors: 1 , 2 , 3 , and 6 .  1 and 2 are coprime, 2 and 3 are coprime, and 3 and 1 are coprime, so we can choose 1 , 2 , and 3 , which achieve the maximum result.       Sample Input 2 420 660      Sample Output 2 4       Sample Input 3 1 2019      Sample Output 3 1  1 and 2019 have no positive common divisors other than 1 .

Solution (Python):
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys
import random
import itertools
import math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt


def LI(): return list(map(int, input().split()))


def LF(): return list(map(float, input().split()))


def LI_(): return list(map(lambda x: int(x)-1, input().split()))


def II(): return int(input())


def IF(): return float(input())


def LS(): return list(map(list, input().split()))


def S(): return list(input().rstrip())


def IR(n): return [II() for _ in range(n)]


def LIR(n): return [LI() for _ in range(n)]


def FR(n): return [IF() for _ in range(n)]


def LFR(n): return [LI() for _ in range(n)]


def LIR_(n): return [LI_() for _ in range(n)]


def SR(n): return [S() for _ in range(n)]


def LSR(n): return [LS() for _ in range(n)]


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


def gcdx(x, y):
    g = 0
    if (x % y != 0):
        g = x % y
        gcdx(y, g)
    return g


mod = 1000000007
inf = float('INF')


def A():
    a = II()
    b = a//2
    p = b/a
    if a % 2:
        print(1-p)
    else:
        print(p)

    return




def B():
    N, K = map(int, input().split())
    h = LI()
    count = 0

    for i in h:
        if i >= K:
            count += 1
        else:
            continue
    print(count)
    return




def C():
    N = II()
    A = LI()
    J = [0] * N
    for i, n in enumerate(A):
        J[n-1] = i+1
    for s in J:
        print(s, end=" ")

    return




def D():
    A, B = map(int, input().split())
    g = gcd(A, B)
    
    
    sq = int(sqrt(g)) + 2
    ans = 1

    for i in range(2, sq):
        if g % i == 0:
            ans += 1
        while g % i == 0:
            g /= i

            
        if g == 1:
            break
        if i == sq - 1:
            
            ans += 1

    print(ans)

    return




def E():
    N, M = LI()

    price = [-1] * N
    ans = [0]*N

    for i in range(M):
        a, b = LI()
        c = LI()
        for k in c:
            if price[k-1] > a/b or price[k-1] == -1:
                price[k-1] = a/b
                ans[i] = a

    if -1 in price:
        print(-1)
    else:
        print(sum(price))

    return




def F():
    return



if __name__ == '__main__':
    D()

Solution (Python):
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys
import random
import itertools
import math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt


def LI(): return list(map(int, input().split()))


def LF(): return list(map(float, input().split()))


def LI_(): return list(map(lambda x: int(x)-1, input().split()))


def II(): return int(input())


def IF(): return float(input())


def LS(): return list(map(list, input().split()))


def S(): return list(input().rstrip())


def IR(n): return [II() for _ in range(n)]


def LIR(n): return [LI() for _ in range(n)]


def FR(n): return [IF() for _ in range(n)]


def LFR(n): return [LI() for _ in range(n)]


def LIR_(n): return [LI_() for _ in range(n)]


def SR(n): return [S() for _ in range(n)]


def LSR(n): return [LS() for _ in range(n)]


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


def gcdx(x, y):
    g = 0
    if (x % y != 0):
        g = x % y
        gcdx(y, g)
    return g


mod = 1000000007
inf = float('INF')


def A():
    a = II()
    b = a//2
    p = b/a
    if a % 2:
        print(1-p)
    else:
        print(p)

    return




def B():
    N, K = map(int, input().split())
    h = LI()
    count = 0

    for i in h:
        if i >= K:
            count += 1
        else:
            continue
    print(count)
    return




def C():
    N = II()
    A = LI()
    J = [0] * N
    for i, n in enumerate(A):
        J[n-1] = i+1
    for s in J:
        print(s, end=" ")

    return




def D():
    A, B = map(int, input().split())
    g = gcd(A, B)
    go = g
    myset = set([1])
    sq = int(sqrt(g)) + 2
    ans = 1

    for i in range(2, sq):
        if g % i == 0:
            ans += 1
        while g % i == 0:
            g /= i

            myset.add(i)
        if g == 1:
            break
        if i == sq - 1:
            myset.add(go)
            ans += 1

    print(ans)

    return




def E():
    N, M = LI()

    price = [-1] * N
    ans = [0]*N

    for i in range(M):
        a, b = LI()
        c = LI()
        for k in c:
            if price[k-1] > a/b or price[k-1] == -1:
                price[k-1] = a/b
                ans[i] = a

    if -1 in price:
        print(-1)
    else:
        print(sum(price))

    return




def F():
    return



if __name__ == '__main__':
    D()

Solution (Python):
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys
import random
import itertools
import math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt


def LI(): return list(map(int, input().split()))


def LF(): return list(map(float, input().split()))


def LI_(): return list(map(lambda x: int(x)-1, input().split()))


def II(): return int(input())


def IF(): return float(input())


def LS(): return list(map(list, input().split()))


def S(): return list(input().rstrip())


def IR(n): return [II() for _ in range(n)]


def LIR(n): return [LI() for _ in range(n)]


def FR(n): return [IF() for _ in range(n)]


def LFR(n): return [LI() for _ in range(n)]


def LIR_(n): return [LI_() for _ in range(n)]


def SR(n): return [S() for _ in range(n)]


def LSR(n): return [LS() for _ in range(n)]


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


def gcdx(x, y):
    g = 0
    if (x % y != 0):
        g = x % y
        gcdx(y, g)
    return g


mod = 1000000007
inf = float('INF')


def A():
    a = II()
    b = a//2
    p = b/a
    if a % 2:
        print(1-p)
    else:
        print(p)

    return




def B():
    N, K = map(int, input().split())
    h = LI()
    count = 0

    for i in h:
        if i >= K:
            count += 1
        else:
            continue
    print(count)
    return




def C():
    N = II()
    A = LI()
    J = [0] * N
    for i, n in enumerate(A):
        J[n-1] = i+1
    for s in J:
        print(s, end=" ")

    return




def D():
    A, B = map(int, input().split())
    g = gcd(A, B)
    go = g
    myset = set([1])
    sq = int(sqrt(g)) + 2

    for i in range(2, sq):
        while g % i == 0:
            g /= i
            myset.add(i)
        if g == 1:
            break
        if i == sq - 1:
            myset.add(go)

    print(len(myset))

    return




def E():
    N, M = LI()

    price = [-1] * N

    for i in range(M):
        a, b = LI()
        c = LI()
        for k in c:
            if price[k-1] > a or price[k-1] == -1:
                price[k-1] = a
    print(sum(price))

    return




def F():
    return



if __name__ == '__main__':
    D()

Solution (Python):
def prime_factorize(n):
    a = [1]
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
  
def gcd(x,y):
    if y == 0:
       return x
    else:
       return gcd(y, x % y)
 
A,B = [int(x) for x in input().split()]
koyaku = gcd(A,B)
 
koyaku_insu = list(set(prime_factorize(koyaku)))
 
 
print(len(koyaku_insu))

Solution (Python):
def fact(n):
    arr = [1]
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(i)

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

    if arr==[]:
        arr.append(n)

    return arr

a, b = map(int, input().split())
L = set(fact(a)) & set(fact(b))
print(len(L))

Solution (Python):
from fractions import gcd
a, b = map(int, input().split())
g = gcd(a, b)
ans = 1
for i in range(2, int(g ** 0.5) + 1):
  if g % i != 0:
    continue
  while g % i == 0:
    g //= i
  ans += 1
if g > 1:
  ans += 1
print(ans)

Solution (Python):
from fractions import gcd

def primes(N):
    p = [False, False] + [True] * (N - 1)
    for i in range(2,int(N ** 0.5) + 1):
        if p[i]:
            for j in range(i * 2, N + 1, i):
                p[j] = False
    return [i for i in range(N + 1) if p[i]]

def prime_factors(N):
    ret = []
    for p in primes(int(N ** 0.5) + 1):
        while N % p == 0:
            ret.append(p)
            N //= p
    if N > 1:
        ret.append(N)
    return ret
    
a, b = map(int, input().split())
g = gcd(a, b)
print(len(set(prime_factors(g))) + 1)

Solution (Python):
from fractions import gcd


def primes(N):
    p = [False, False] + [True] * (N - 1)
    for i in range(2, int(N ** 0.5) + 1):
        if p[i]:
            for j in range(i * 2, N + 1, i):
                p[j] = False
    return [i for i in range(N + 1) if p[i]]


def prime_factors(N):
    ret = []
    for p in primes(int(N ** 0.5) + 1):
        while N % p == 0:
            ret.append(p)
            N //= p
    if N > 1:
        ret.append(N)
    return ret


A, B = map(int, input().split())
g = gcd(A, B)
print(len(set(prime_factors(g))) + 1)

Solution (Python):
from fractions import gcd


def primes(N):
    p = [False, False] + [True] * (N - 1)
    for i in range(2, int(N ** 0.5) + 1):
        if p[i]:
            for j in range(i * 2, N + 1, i):
                p[j] = False
    ret = [i for i in range(N + 1) if p[i]]
    return ret


def trial_division(N):
    factors = []
    for p in primes(int(N ** 0.5)):
        while N % p == 0:
            factors.append(p)
            N //= p
    if N > 1:
        factors.append(N)
    return factors


A, B = map(int, input().split())
g = gcd(A, B)
print(len(set(trial_division(g))) + 1)

Solution (Python):


def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

def factorize(a):
    ret = set()
    i = 2
    while i * i < a:
        if a % i != 0:
            i += 1
        else:
            while a % i == 0:
                a //= i
                ret.add(i)
            i += 1
    if a != 1:
        ret.add(a)
    return ret

def main():
    A, B = map(int,input().split())
    ABgcd = gcd(A, B)
    ABfactor = factorize(ABgcd)
    Ans = len(ABfactor) + 1
    print(Ans)

if __name__ == "__main__":
    main()

Solution (Python):
from fractions import*;g=gcd(*map(int,input().split()));s={1}
for i in range(2,int(g**.5)+1):
	while g%i<1:g//=i;s|={i}
print(len(s)+(g>1))

Solution (Python):

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













def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

A_so = prime_factorize(A)
B_so = prime_factorize(B)


A_so = set(A_so)
B_so = set(B_so)


A_B = A_so & B_so


ans = len(A_B) + 1
print(ans)

Solution (Python):
from fractions import gcd
A, B = map(int, input().split())
G = gcd(A, B)


def prime_factoring(n):
    from math import sqrt
    factors = []
    for num in range(2, int(sqrt(n))+1):
        if n % num == 0:
            count = 0
            while(n % num == 0):
                n //= num
                count += 1
            factors.append([num, count])
    else:
        if n != 1:
            factors.append(n)
    return factors

print(len(prime_factoring(G))+1)

Solution (Python):
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

import fractions as fs

def main():
  a, b = map(int, input().split())
  arr = factorization(fs.gcd(a, b))
  if arr[0][0] == 1:
    print(len(arr))
  else:
    print(len(arr) + 1)

if __name__ == "__main__":
  main()

Solution (Python):
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

def factorize(n):
    res = set()
    i = 2
    while i*i <= n:
        if n % i != 0:
            i += 1
            continue
        while n % i == 0:
            n //= i
            res.add(i)
        i += 1
    if n != 1:
        res.add(n)
    return res

def main():
    A, B = map(int,input().split())

    g = gcd(A, B)
    f = factorize(g)
    ans = len(f) + 1
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
import math
 
D = input().split(' ')
A = int(D[0])
B = int(D[1])

result = []
result.append(1)

a_result = []
b_result = []

for i in range(2, int(A**0.5) + 2):
    flg = 0
    while A % i == 0:
        if flg == 0:
            a_result.append(i)
            flg = 1
            
        A = A / i
if A != 1:
  a_result.append(A)
        
for i in range(2, int(B**0.5) + 2):
    flg = 0
    while B % i == 0:
        if flg == 0:
            b_result.append(i)
            flg = 1
            
        B = B / i
if B != 1:
  a_result.append(B)
  
print(len(a_result) + len(b_result) - len(set(a_result + b_result)) + 1)

Solution (Python):
from collections import Counter

def prime(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
  
_a, _b = map(int, input().split())
_a_set = set(prime(_a))
_b_set = set(prime(_b))
_common_prime = _a_set & _b_set
print(len(_common_prime) + 1)

Solution (Python):
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys
import random
import itertools
import math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt


def LI(): return list(map(int, input().split()))


def LF(): return list(map(float, input().split()))


def LI_(): return list(map(lambda x: int(x)-1, input().split()))


def II(): return int(input())


def IF(): return float(input())


def LS(): return list(map(list, input().split()))


def S(): return list(input().rstrip())


def IR(n): return [II() for _ in range(n)]


def LIR(n): return [LI() for _ in range(n)]


def FR(n): return [IF() for _ in range(n)]


def LFR(n): return [LI() for _ in range(n)]


def LIR_(n): return [LI_() for _ in range(n)]


def SR(n): return [S() for _ in range(n)]


def LSR(n): return [LS() for _ in range(n)]


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


mod = 1000000007
inf = float('INF')


def A():
    a = II()
    b = a//2
    p = b/a
    if a % 2:
        print(1-p)
    else:
        print(p)

    return




def B():
    N, K = map(int, input().split())
    h = LI()
    count = 0

    for i in h:
        if i >= K:
            count += 1
        else:
            continue
    print(count)
    return




def C():
    N = II()
    A = LI()
    J = [0] * N
    for i, n in enumerate(A):
        J[n-1] = i+1
    for s in J:
        print(s, end=" ")

    return




def D():
    A, B = map(int, input().split())
    g = gcd(A, B)
    go = g
    myset = set([1])
    sq = int(sqrt(g)) + 2

    for i in range(2, sq):
        while g % i == 0:
            g /= i
            myset.add(i)
        if g == 1:
            break
        if i == sq - 1:
            myset.add(go)

    print(len(myset))

    return




def E():
    return




def F():
    return



if __name__ == '__main__':
    D()

Solution (Python):
def GCD(n, m):
    if n % m == 0:
        return m
    else:
        return GCD(m, n % m)

def PF(n):
    pfArray = []
    i = 2
    while (i * i <= n):
        if n % i == 0:
            pfArray.append(i)
            j = 1
            while (n % (i ** j) == 0):
                n = n / (i ** j)
        i += 1
    if n != 1:
        pfArray.append(int(n))
    return pfArray

N_i = list(map(int, input().split(" ")))
A = max(N_i)
B = min(N_i)
print(len(PF(GCD(A, B)))+1)

Solution (Python):
a,b=map(int,input().split()) 
 

def factorization(n):
	lista=[]
	temp=n
	
	i=2
	while i<=int(n**0.5//1):
		if temp%i==0:
			lista.append(i)
			temp=temp//i
		else:
			i=i+1
	if temp!=1:
		lista.append(temp)
	if lista==[]:
		lista.append(n)
	
	lista.append(1)
	return lista
	



c=set(factorization(a))&set(factorization(b))
ans=len(c)
print(ans)

Solution (Python):
A, B = map(int, input().split())

def gcd(x, y):
    while y != 0:
        x, y = y, x%y
    return x

def trial_division(n):
    """Return a list of the prime factors for a natural number."""
    if n < 2:
        return [1]
    prime_factors = [1]
    n_prime_lim = int(n**0.5) + 1
    for p in range(2, n_prime_lim):
        if p*p > n:
            break
        if n % p == 0:
            prime_factors.append(p)
        while n % p == 0:
            n //= p
    if n > 1:
        prime_factors.append(n)
    return prime_factors

gcd_ab = gcd(A, B)
prime_factors = trial_division(gcd_ab)
print(len(prime_factors))

Solution (Python):
A, B = map(int, input().split())
answer = []

def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
     
A_div = divisor(A)
B_div = divisor(B) 
common_div = list(set(A_div) & set(B_div))
common_div.sort()

for i in common_div:
  tmp = [1 for j in answer[1:] if i % j == 0]
  if len(tmp) == 0:
    answer.append(i)
    
print(len(answer))

Solution (Python):
import math


def gcd(a,b):
   if a%b==0:
       return b
   else:
        return gcd(b,a%b)


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


if A>=B:
    MD=gcd(A,B)
else:
    MD=gcd(B,A)


count=1
    

for i in range(2,int(math.sqrt(MD))+1):
    if MD%i==0:
        count+=1
        while MD%i==0:
            MD=MD/i
    else:
        pass

if MD!=1:
    count+=1
else:
    pass
print(count)

Solution (Python):


import math
import os
import sys


DEBUG = 'DEBUG' in os.environ


def inp():
    return sys.stdin.readline().rstrip()


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


def gcd(a, b):
    if a < b:
        a, b = b, a
    while b > 0:
        a, b = b, a % b
    return a


def main():
    A, B = [int(e) for e in inp().split()]

    G = gcd(A, B)

    ans = 1
    v = G
    p = 2
    while p * p <= v:
        if v % p == 0:
            ans += 1
            v //= p
            while v % p == 0:
                v //= p
        p += 1

    if v > 1:
        ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
import sys
from fractions import gcd
def prime_factorize_2(n):
    res = set()
    div = 2
    if n % 2 == 0:
        while n % div == 0:
            n //= div
        res.add(div)
    div += 1
    while div ** 2 <= n:
        if n % div == 0:
            n //= div
            res.add(div)
        else:
            div += 2
    if n != 1:
        res.add(n)
    return res

def main(a, b):
    
    _gcd = gcd(a,b)
    
    
    cnt = 0
    if _gcd == 1:
        print(1)
    else:
        res = prime_factorize_2(_gcd)
        print(len(res) + 1)
if __name__ == "__main__":
    a, b = [int(i) for i in sys.stdin.readline().split()]
    main(a, b)

Solution (Python):
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

def coprime(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)

    
    return divisors

A,B=map(int, input().split())
if (A==1)or(B==1)or(coprime(A,B)):
  print(1)
else:
  A=make_divisors(A)
  B=make_divisors(B)
  C=list(set(A)&set(B))
  C.sort(reverse=True)
  count=0
  for i in range(len(C)):
    for j in range(i+1,len(C)):
      if (C[j]!=1)and(C[i]%C[j]==0):
        count=count+1
        break
  print(len(C)-count)

Solution (Python):
import sys
from fractions import gcd
def prime_factorize(n):
    a = set()
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a

def main(a, b):
    
    _gcd = gcd(a,b)
    
    
    cnt = 0
    if _gcd == 1:
        print(1)
    else:
        res = prime_factorize(_gcd)
        print(len(res) + 1)
if __name__ == "__main__":
    a, b = [int(i) for i in sys.stdin.readline().split()]
    main(a, b)

Solution (Python):
import collections

x, y = map(int, input().split())
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)
z=gcd(x,y)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
print(len(collections.Counter(prime_factorize(z))) +1 )

Solution (Python):
import fractions
import sys
A, B = map(int,input().split())

GCD = fractions.gcd(A,B)

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

l = factorization(GCD)
if len(l) == 1 and l[0][0] == 1:
    print(len(l))
else:
    print(len(l)+1)

Solution (Python):
from fractions import gcd
A,B = map(int, input().split())
g=gcd(A,B)
def prime_factorization(n):
    prime_num = []
    for i in range(2, int(n**.5)+1):
        num = 0
        while True:
            x,y = divmod(n, i)
            if y!= 0:
                break
            n = x
            num += 1
        if num>0:
            prime_num.append(i)
    if n > 1:
        prime_num.append(n)
    return prime_num
print(len(prime_factorization(g))+1)

Solution (Python):
from fractions import gcd
A,B=map(int,input().split())
s=set()
x=gcd(A,B)
y=2
while y*y<=x:
  while x%y==0:
    s.add(y)
    x//=y
  y+=1
if x>1:
  s.add(x)
print(len(s)+1)

Solution (Python):
from fractions import*
n=gcd(*map(int,input().split()))
a=i=1
while i*i<n:
 	i+=1;a+=n%i<1
 	while n%i<1:n/=i
print(a+(n>1))

Solution (Python):
def trial_division(n):
    a = [1]
    while n % 2 == 0:
        a.append(2)
        n /= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n /= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


def gcd(x, y):
    if x > y:
        return gcd(y, x)
    
    temp = y % x
    if temp == 0:
        return x
    else:
        return gcd(temp, x)


def main():
    a, b = map(int, input().split())
    gcd_ab = gcd(a, b)
    temp_list = trial_division(gcd_ab)
    
    
    temp_set = set(temp_list)
    print(len(temp_set))


if __name__ == '__main__':
    main()

Solution (Python):
"""
GCD(A, B) の公約数を素因数分解して出てきた素数の数+1 が答え.
"""

import math
from fractions import gcd  
from collections import OrderedDict


a, b = map(int, input().split())



gcd_num = gcd(a, b)


"""
N = p * q    (p <= q, pとqは素因数) の時
p <= sqrt(N)    となる

つまり, sqrt(N) まで試して, 割り切れなかった(残った)ものは素因数と言える.
言い方を変えると, sqrt(N)以上の素因数は高々1個まで.

これから, 順番に割っていくのをsqrt(N)までやり, 残ったのが1じゃなければそれも素数.
これなら計算量 O(sqrt(N)) でいける.
"""
def factorize(n):
    """素因数分解を行う

    Parameters
    ----------
    n : int
        正の自然数
    """
    res = dict()
    for i in range(2, math.ceil(math.sqrt(n))):
        if n%i:  
            continue
        res[i] = 0
        while (n%i == 0):
            n /= i
            res[i] += 1

    if (n != 1):
        res[n] = 1
    return res


res = factorize(gcd_num)
ans = len(res.keys()) + 1  
print(ans)