Problem: 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.

Submission attempts (in order):
import fractions

  
def isprime(x):
    count = 1
    for i in range(2,int(x**0.5)+1):
        if x % i == 0:
            count += 1
      
    return count

a,b = map(int,input().split())
g = fractions.gcd(a,b)



ans=1
for i in range(2,int(g**0.5)+1):
    if g % i == 0:
        if isprime(i) == 1:
            ans += 1
        if i != g//i:
            if isprime(g//i) == 1:
                ans += 1
       

print(ans)
  

  

  

  

  


import fractions

  
def isprime(x):
    count = 1
    for i in range(2,int(x**0.5)+1):
        if x % i == 0:
            count += 1
      
    return count

a,b = map(int,input().split())
g = fractions.gcd(a,b)



ans=0
for i in range(1,int(g**0.5)+1):
    if g % i == 0:
        if isprime(i) == 1:
            ans += 1
        if i != g//i:
            if isprime(g//i) == 1:
                ans += 1
       

print(ans)
  

  

  

  

  


import fractions

  
def isprime(x):
    count = 1
    for i in range(2,int(x**0.5)+1):
        if x % i == 0:
            count += 1
      
    return count

a,b = map(int,input().split())
g = fractions.gcd(a,b)



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

print(ans)
  

  

  

  

  


import fractions
def getlist(x):
    l = []
    
    for i in range(2,int(x**0.5)+2):
        if x % i == 0:
            l.append(i)
            while x%i == 0:
                x = x//i
      
    return l
  
def isprime(x):
    count = 1
    for i in range(2,int(x**0.5)+1):
        if x % i == 0:
            count += 1
      
    if count == 1:
        return True
    else:
        return False

a,b = map(int,input().split())
g = fractions.gcd(a,b)

g1 = getlist(g)

ans=1
for i in g1:
    if isprime(i):
        ans+=1
       

print(ans)
  

  

  

  

  


import fractions
def getlist(x):
    l = []
    
    for i in range(2,int(x**0.5)+2):
        if x % i == 0:
            l.append(i)
            while x%i == 0:
                x = x//i
      
    return l
  
def isprime(x):
    count = 1
    for i in range(2,x):
        if x % i == 0:
            count += 1
      
    return count

a,b = map(int,input().split())
g = fractions.gcd(a,b)

g1 = getlist(g)

ans=1
for i in g1:
    if isprime(i) == 1:
        ans+=1
       

print(ans)
  

  

  

  

  


import fractions

  
def isprime(x):
    count = 1
    for i in range(2,int(x**0.5)+1):
        if x % i == 0:
            count += 1
            break
      
    return count

a,b = map(int,input().split())
g = fractions.gcd(a,b)



ans=1
for i in range(2,int(g**0.5)+1):
    if g % i == 0:
        if isprime(i) == 1:
            ans += 1
        if i != g//i:
            if isprime(g//i) == 1:
                ans += 1
       

print(ans)
  

  

  

  

  


import fractions
def getlist(x):
    l = []
    if x == 1:
    	return l
    else:
        for i in range(2,int(x**0.5)+1):
            if x % i == 0:
                l.append(i)
            
      
        return l
  
def isprime(x):
    count = 1
    for i in range(2,int(x**0.5)+1):
        if x % i == 0:
            count += 1
      
    return count

a,b = map(int,input().split())
g = fractions.gcd(a,b)

g1 = getlist(g)

ans=1
for i in g1:
    if isprime(i) == 1:
        ans+=1
       

print(ans)
  

  

  

  

  


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

def divisors(x):
    D = []
    for i in range(1, int(x**0.5) + 1):
        if x % i == 0:
            D.append(i)
            if i != x**0.5:
                D.append(x // i)
    D.sort()
    return D

def isprime(x):
    t = 1
    for i in range(2, int(x**0.5) + 1):
        if x % i == 0:
            t = 0
            break
    if t == 1 and x != 1:
        return True
    else:
        return False


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

CD = divisors(gcd(a, b))

ans = 1
for cd in CD:
    if isprime(cd):
        ans += 1

print(ans)


Verdicts: Wrong Answer

Time Limit Exceeded

Time Limit Exceeded

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted