Buggy python submission (verdict: Time Limit Exceeded):
#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)
    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<=a:
        if a%m==0:
            sosu.add(m)
            while a%m==0:
                a//=m

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



    print(count)
#    for i in range(h):
#            print(aaa)

if __name__ == "__main__":
    main()

Fixed submission:
#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 and m!=1:
        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) and a!=1:
        sosu.add(a)
#    print(sosu)
    count+=len(sosu)
    print(count)
#    for i in range(h):
#            print(aaa)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#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<=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 a not in sosu:
  #          if b%a==0:
  #              count+=1

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



    print(count)
#    for i in range(h):
#            print(aaa)

if __name__ == "__main__":
    main()

Fixed submission:
#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 and m!=1:
        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) and a!=1:
        sosu.add(a)
#    print(sosu)
    count+=len(sosu)
    print(count)
#    for i in range(h):
#            print(aaa)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
#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
    sosu=[2,3]
    for i in range(len(sosu)):
        if a%sosu[i]==0 and b%sosu[i]==0:
            count+=1
            a//=sosu[i]
            b//=sosu[i]
        elif a%sosu[i]==0:
            a//=sosu[i]
        elif b%sosu[i]==0:
            b//=sosu[i]


    c = math.sqrt(max(a, b))
    while m < c:
        m = 6 * k +1
        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))
 #           print(count)
        k += 1

    k = 1
    m = 2
    while m < c:
        m = 6 * k -1
        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))
        k += 1

    print(count)
#    for i in range(h):
#            print(aaa)

if __name__ == "__main__":
    main()

Fixed submission:
#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 and m!=1:
        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) and a!=1:
        sosu.add(a)
#    print(sosu)
    count+=len(sosu)
    print(count)
#    for i in range(h):
#            print(aaa)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#import sys

#input = sys.stdin.readline

import heapq

def main():
#    h,w,a,b = map(int, input().split())
    a,b=map(int,input().split())
    m=2
    k=1
    c=max(a,b)
    count=1
    sosu=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]
    for i in range(len(sosu)):
        if a%sosu[i]==0 and b%sosu[i]==0:
            count+=1
            a//=sosu[i]
            b//=sosu[i]
        elif a%sosu[i]==0:
            a//=sosu[i]
        elif b%sosu[i]==0:
            b//=sosu[i]


    while m < c:
        m = 6 * k +1
        if a % m == 0 and b % m == 0:
            count += 1
            a//=m
            b//=m
        elif a%m==0:
            a//=m
        elif b%m==0:
            b//=m
 #           print(count)
        k += 1
    k = 1
    m = 2
    while m < c:
        m = 6 * k -1
        if a % m == 0 and b % m == 0:
            count += 1
            a//=m
            b//=m
        elif a%m==0:
            a//=m
        elif b%m==0:
            b//=m
        k += 1
    print(count)
#    for i in range(h):
#            print(aaa)

if __name__ == "__main__":
    main()

Fixed submission:
#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 and m!=1:
        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) and a!=1:
        sosu.add(a)
#    print(sosu)
    count+=len(sosu)
    print(count)
#    for i in range(h):
#            print(aaa)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#import sys

#input = sys.stdin.readline

import heapq

def main():
#    h,w,a,b = map(int, input().split())
    a,b=map(int,input().split())
    m=2
    k=1
    c=max(a,b)
    count=1
    sosu=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]
    for i in range(len(sosu)):
        if a%sosu[i]==0 and b%sosu[i]==0:
            count+=1
            a//=sosu[i]
            b//=sosu[i]

    while m < c:
        m = 6 * k +1
        if a % m == 0 and b % m == 0:
            count += 1
        k += 1
    k = 1
    m = 2
    while m < c:
        m = 6 * k -1
        if a % m == 0 and b % m == 0:
            count += 1
        k += 1
    print(count)
#    for i in range(h):
#            print(aaa)

if __name__ == "__main__":
    main()

Fixed submission:
#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 and m!=1:
        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) and a!=1:
        sosu.add(a)
#    print(sosu)
    count+=len(sosu)
    print(count)
#    for i in range(h):
#            print(aaa)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#import sys

#input = sys.stdin.readline

import heapq

def main():
#    h,w,a,b = map(int, input().split())
    a,b=map(int,input().split())
    i=2
    k=1
    c=max(a,b)
    count=1
    if a%2==0 and b%2==0:
        count+=1
    if a%3==0 and b%3==0:
        count+=1
    while i < c:
        i = 6 * k +1
        if a % i == 0 and b % i == 0:
            count += 1
        k += 1
    k = 1
    i = 2
    while i < c:
        i = 6 * k -1
        if a % i == 0 and b % i == 0:
            count += 1
        k += 1
    print(count)
#    for i in range(h):
#            print(aaa)

if __name__ == "__main__":
    main()

Fixed submission:
#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 and m!=1:
        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) and a!=1:
        sosu.add(a)
#    print(sosu)
    count+=len(sosu)
    print(count)
#    for i in range(h):
#            print(aaa)

if __name__ == "__main__":
    main()