Buggy python submission (verdict: Runtime Error):
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

#define rep(i, a, n) for(int i = a; i < (n); ++i)
#define ll long long

template<typename T>
bool isPrime(T x) {
  if (x == 1) return false;
  for (int i = 2; i <= sqrt(x); i += 2) {
    if (x % i == 0) return false;
  }
  return true;
}

template<typename T>
T gcd(T n, T m) {
  while (m != 0) {
    n %= m;
    swap(n, m);
  }
  return n;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);

  ll a, b;
  cin >> a >> b;
  
  ll x = gcd(a, b);
  ll ans = 1;
  for (int i = 1; i * i <= x; ++i) {
    if (x % i == 0) {
      if (isPrime(i)) {
       ++ans;
       if (i * i != x) {
         if (isPrime(x / i)) ++ans;
       }
      }
    }
  }
  cout << ans << endl;
}

Fixed submission:
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : map(int, stdin.readline().split())

def divi(n):
  res = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      res.append(i)
      if i != n // i:
        res.append(n // i)
  return res

def isprime(n):
  if n == 2:
    return True
  if n % 2 == 0 or n < 2:
    return False
  for i in range(3, int(n**0.5)+1, 2):
    if (n % i == 0):
      return False
  return True

def main():
  a, b = sorted(na())
  x = divi(a)
  cnt = 1
  for bb in divi(b):
    if bb in x and isprime(bb):
      cnt += 1
  print(cnt)
main()

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

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : map(int, stdin.readline().split())

def divi(n):
  res = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      res.append(i)
      if i != n // i:
        res.append(n // i)
  return res

def isprime(n):
  for i in range(2, n+1):
    if i*i <= n:
      if (n % i == 0):
        return False
  return True

def main():
  a, b = sorted(na())
  x = divi(a)
  cnt = 0
  for bb in divi(b):
    if bb in x and isprime(bb):
      cnt += 1
  print(cnt)
main()

Fixed submission:
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : map(int, stdin.readline().split())

def divi(n):
  res = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      res.append(i)
      if i != n // i:
        res.append(n // i)
  return res

def isprime(n):
  if n == 2:
    return True
  if n % 2 == 0 or n < 2:
    return False
  for i in range(3, int(n**0.5)+1, 2):
    if (n % i == 0):
      return False
  return True

def main():
  a, b = sorted(na())
  x = divi(a)
  cnt = 1
  for bb in divi(b):
    if bb in x and isprime(bb):
      cnt += 1
  print(cnt)
main()

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

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : map(int, stdin.readline().split())

def divi(n):
  res = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      res.append(i)
      if i != n // i:
        res.append(n // i)
  return res

def isprime(n):
  for i in range(2, n+1):
    if i*i <= n:
      if (n % i == 0):
        return False
  return True

def main():
  a, b = sorted(na())
  x = divi(a)
  y = []
  for bb in divi(b):
    if bb in x:
      y.append(bb)
  cnt = 0
  for i, yy in enumerate(y):
    if not isprime(yy):
      continue
    cnt += 1
  print(cnt)
main()

Fixed submission:
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : map(int, stdin.readline().split())

def divi(n):
  res = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      res.append(i)
      if i != n // i:
        res.append(n // i)
  return res

def isprime(n):
  if n == 2:
    return True
  if n % 2 == 0 or n < 2:
    return False
  for i in range(3, int(n**0.5)+1, 2):
    if (n % i == 0):
      return False
  return True

def main():
  a, b = sorted(na())
  x = divi(a)
  cnt = 1
  for bb in divi(b):
    if bb in x and isprime(bb):
      cnt += 1
  print(cnt)
main()

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

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : map(int, stdin.readline().split())

def divi(n, d = []):
  res = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      if i in d or not d:
        res.append(i)
      if i != n // i:
        if n // i in d or not d:
          res.append(n // i)
  return res

def isprime(n):
  for i in range(2, n+1):
    if i*i <= n:
      if (n % i == 0):
        return False
  return True

def main():
  a, b = sorted(na())
  x = divi(a)
  y = divi(b, x)
  cnt = 0
  for i, yy in enumerate(y):
    if not isprime(yy):
      continue
    cnt += 1
  print(cnt)
main()

Fixed submission:
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : map(int, stdin.readline().split())

def divi(n):
  res = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      res.append(i)
      if i != n // i:
        res.append(n // i)
  return res

def isprime(n):
  if n == 2:
    return True
  if n % 2 == 0 or n < 2:
    return False
  for i in range(3, int(n**0.5)+1, 2):
    if (n % i == 0):
      return False
  return True

def main():
  a, b = sorted(na())
  x = divi(a)
  cnt = 1
  for bb in divi(b):
    if bb in x and isprime(bb):
      cnt += 1
  print(cnt)
main()

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

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : map(int, stdin.readline().split())

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def divi(n, d = []):
  res = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      if i in d or not d:
        res.append(i)
      if i != n // i:
        if n // i in d or not d:
          res.append(n // i)
  return res

def isprime(n):
  for i in range(2, n+1):
    if i*i <= n:
      if (n % i == 0):
        return False
  return True

def main():
  a, b = sorted(na())
  x = divi(a)
  y = divi(b, x)
  res = []
  for i, yy in enumerate(y):
    if not isprime(yy):
      continue
    res.append(yy)
  print(len(res))
main()

Fixed submission:
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : map(int, stdin.readline().split())

def divi(n):
  res = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      res.append(i)
      if i != n // i:
        res.append(n // i)
  return res

def isprime(n):
  if n == 2:
    return True
  if n % 2 == 0 or n < 2:
    return False
  for i in range(3, int(n**0.5)+1, 2):
    if (n % i == 0):
      return False
  return True

def main():
  a, b = sorted(na())
  x = divi(a)
  cnt = 1
  for bb in divi(b):
    if bb in x and isprime(bb):
      cnt += 1
  print(cnt)
main()