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 sys

#input = sys.stdin.readline

#import heapq
import math
import fractions

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True

def main():
#    h,w,a,b = map(int, input().split())
    a,b=map(int,input().split())
    m=2
    k=1

    count=1
    if a>b:
        a,b=b,a
    sosu=set()
    c=math.sqrt(a)
    while m<c:
        if sosuhante(m)==False:
            m+=1
            continue
        if a%m==0:
            while True:
                if a%m==0:
                    a//=m
                else:
                    break
            if b%m==0:
                sosu.add(m)
                count+=1
            c = math.sqrt(a)
        m+=1

 #   print(sosu)
 
 #       if b%i==0:
  #          count+=1



    print(count)

#            print(aaa)

if __name__ == "__main__":
    main()

#import sys

#input = sys.stdin.readline

#import heapq
import math

def main():
#    h,w,a,b = map(int, input().split())
    a,b=map(int,input().split())
    m=2
    k=1
    c=math.sqrt(max(a,b))
    count=1

    c = math.sqrt(max(a, b))

    while m<c:
        if a % m == 0 and b % m == 0:
            count += 1
            while True:
                a //= m
                b //= m
                if a % m == 0 and b % m == 0:
                    continue
                else:
                    break
            c = math.sqrt(max(a, b))
        elif a % m == 0:
            a //= m
            c = math.sqrt(max(a, b))
        elif b % m == 0:
            b //= m
            c = math.sqrt(max(a, b))
        m+=1





    print(count)

#            print(aaa)

if __name__ == "__main__":
    main()

#import sys

#input = sys.stdin.readline

#import heapq
import math
import fractions

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True

def main():
#    h,w,a,b = map(int, input().split())
    a,b=map(int,input().split())
    m=2
    k=1

    count=1
    if a>b:
        a,b=b,a
    sosu=set()
    #d = math.gcd(a,b)
#    print(d)
    c=math.sqrt(a)+111
    print(c)
    while m<c and m<=a:
        if a%m==0:
            sosu.add(m)
            if b%m==0:
                count+=1
            while a%m==0:
                a//=m

        m+=1

#    print(sosu)

 #       if b%i==0:
 #           count+=1



    print(count)

#            print(aaa)

if __name__ == "__main__":
    main()

#import sys

#input = sys.stdin.readline

#import heapq
import math
import fractions

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True

def main():
#    h,w,a,b = map(int, input().split())
    a,b=map(int,input().split())
    m=2
    k=1
    c=math.sqrt(max(a,b))
    count=1

    c = math.sqrt(max(a, b))

    while m<c:
        if sosuhante(m)==False:
            m+=1
            continue
        if a % m == 0 and b % m == 0:
            count += 1
            while True:
                a //= m
                b //= m
                if a % m == 0 and b % m == 0:
                    continue
                else:
                    break
            c = math.sqrt(max(a, b))
        elif a % m == 0:
            a //= m
            c = math.sqrt(max(a, b))
        elif b % m == 0:
            b //= m
            c = math.sqrt(max(a, b))
        m+=1




    print(count)

#            print(aaa)

if __name__ == "__main__":
    main()

#import sys

#input = sys.stdin.readline

#import heapq
import math
import fractions

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True

def main():
#    h,w,a,b = map(int, input().split())
    a,b=map(int,input().split())
    m=4
    k=1

    count=1
    if a>b:
        a,b=b,a
    sosu=set()
    a = fractions.gcd(a,b)
    if a%2==0:
        sosu.add(2)
        while a%2==0:
            a//=2
    if a%3==0:
        sosu.add(3)
        while a%3==0:
            a//=3
#    print(d)
    c=math.sqrt(a)+1
 #   print(c)
    while m<=c:
        if a%m==0:
            sosu.add(m)
            while a%m==0:
                a//=m

        m+=1
#    print(sosu)
    if sosu==set() and a!=1:
        sosu.add(a)
    if sosuhante(a):
        sosu.add(a)
#    print(sosu)
    count+=len(sosu)
    print(count)

#            print(aaa)

if __name__ == "__main__":
    main()

#import sys

#input = sys.stdin.readline

#import heapq
import math
import fractions

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))):
        if n% k ==0:
            return False
    return True

def main():
#    h,w,a,b = map(int, input().split())
    a,b=map(int,input().split())
    m=2
    k=1
    c=math.sqrt(max(a,b))
    count=1

    c = math.sqrt(max(a, b))

    while m<c:
        if sosuhante(m)==False:
            m+=1
            continue
        if a % m == 0 and b % m == 0:
            count += 1
            while True:
                a //= m
                b //= m
                if a % m == 0 and b % m == 0:
                    continue
                else:
                    break
            c = math.sqrt(max(a, b))
        elif a % m == 0:
            a //= m
            c = math.sqrt(max(a, b))
        elif b % m == 0:
            b //= m
            c = math.sqrt(max(a, b))
        m+=1




    print(count)

#            print(aaa)

if __name__ == "__main__":
    main()

#import sys

#input = sys.stdin.readline

#import heapq
import math
import fractions

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True

def main():
#    h,w,a,b = map(int, input().split())
    a,b=map(int,input().split())
    m=2
    k=1

    count=1
    if a>b:
        a,b=b,a
    sosu=set()
    #d = math.gcd(a,b)
#    print(d)
    c=math.sqrt(a)+1
 #   print(c)
    while m<c and m<=a:
        if a%m==0:
            sosu.add(m)
            if b%m==0:
                count+=1
            while a%m==0:
                a//=m

        m+=1
    if sosuhante(a):
        if b%a==0:
            count+=1

#    print(sosu)

 #       if b%i==0:
 #           count+=1



    print(count)

#            print(aaa)

if __name__ == "__main__":
    main()

#import sys

#input = sys.stdin.readline

#import heapq
import math
#import fractions

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True

def main():
#    h,w,a,b = map(int, input().split())
    a,b=map(int,input().split())
    m=4
    k=1
    count=0

    if a>b:
        a,b=b,a
    sosu={1}
#    a = fractions.gcd(a,b)
    if a%2==0:
        sosu.add(2)
        while a%2==0:
            a//=2
    if a%3==0:
        sosu.add(3)
        while a%3==0:
            a//=3
#    print(d)
    c=math.sqrt(a)+1
 #   print(c)
    while m<=c and m!=1:
        if a%m==0:
            sosu.add(m)
            while a%m==0:
                a//=m

        m+=1
#    print(sosu)
    sosu.add(a)
#    print(sosu)

    for i in sosu:
        if b%i==0:
            count+=1
    print(count)

#            print(aaa)

if __name__ == "__main__":
    main()

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted