Language: C++

#include <vector> // factoring

namespace Integer {
  using Int = std::int_fast64_t;
  constexpr Int Max = 1e5+7;

  template<typename T, Int N> struct Seq {
    T ary[N];
    constexpr Seq() : ary{} {};
    constexpr T& operator[](Int n) { return ary[n]; }
    constexpr T const& operator[](Int n) const { return ary[n]; }
    constexpr Int size() { return N; }
  };
  template<Int M=Max> constexpr auto osk_a() {
    Seq<Int, M> res{};
    for(Int i=0; i<M; ++i) res.ary[i] = i;
    for(Int i=2; i*i<M; ++i) {
      if(res.ary[i] < i) continue;
      for(Int j=i; i*j<M; ++j) if(res.ary[i*j] == i*j) res.ary[i*j] = i;
    }
    return res;
  }
  constexpr auto a = osk_a();
  template<Int M=Max> constexpr Int prime_count(Seq<Int, M> const& s = a) {
    Int cnt = 0;
    for(Int i=2; i<M; ++i) if(s.ary[i] == i) ++cnt;
    return cnt;
  }
  constexpr Int PC = prime_count();
  template<Int M=Max, Int N=PC> constexpr auto prime_list(Seq<Int, M> const& s = a) {
    Seq<Int, N> res{};
    for(Int i=0,j=2; j<M; ++j) if(s.ary[j] == j) res.ary[i++] = j;
    return res;
  }
  constexpr auto p = prime_list();

  template<Int M=Max, Int N=PC> constexpr Int min_divisor(Int const& n, Seq<Int, M> const& s = a, Seq<Int, N> const& q = p) {
    if(n<M) return s.ary[n];
    if(n > (M-1)*(M-1)) return -1;
    for(Int i=0; i<N; ++i) if(n % q.ary[i] == 0) return q.ary[i];
    return n;
  }
  template<Int M=Max, Int N=PC> constexpr bool is_prime(Int const& n, Seq<Int, M> const& s = a, Seq<Int, N> const& q = p) {
    return n == min_divisor<M, N>(n, s, q);
  }

  template<Int M=Max, Int N=PC> inline auto factoring(Int n, Seq<Int, M> const& s = a, Seq<Int, N> const& q = p) {
    std::vector<Int> res{};
    while(n>1) {
      res.push_back(min_divisor<M, N>(n, s, q));
      n /= res.back();
    }
    return res;
  }
}

#include <iostream>
#include <utility>

template<typename T> constexpr T gcd2(T a, T b) { while(b) { T t=b; b=a%b; a=t; } return a; }
template<class C> inline auto RLE(C const& v) { // run length encoding
  using T = typename C::value_type;
  using U = typename C::size_type;
  std::vector<std::pair<T, U>> w{};
  auto t=std::begin(v);
  U cnt=0;
  for(auto i=std::begin(v); i!=std::end(v); ++i) {
    if(*t == *i) ++cnt;
    else w.emplace_back(*t, cnt), t=i, cnt=1;
  }
  if(cnt > 0) w.emplace_back(*t, cnt);
  return w;
}

signed main() {
  using namespace std;
  cin.tie(0); cout.tie(0);
  ios_base::sync_with_stdio(false);
  cout << boolalpha;

  constexpr int n = 57;
  static_assert(!Integer::is_prime(n), "n is not prime");

  Integer::Int A, B;
  cin >> A >> B;
  const auto D = gcd2(A, B);
  const auto L = RLE(Integer::factoring(D));
  int cnt = 1 + L.size();
  cout << cnt << endl;

  return 0;
}

Compiler output:
a.cc:4:20: error: 'int_fast64_t' in namespace 'std' does not name a type
    4 |   using Int = std::int_fast64_t;
      |                    ^~~~~~~~~~~~
a.cc:5:13: error: 'Int' does not name a type; did you mean 'int'?
    5 |   constexpr Int Max = 1e5+7;
      |             ^~~
      |             int
a.cc:7:24: error: 'Int' has not been declared
    7 |   template<typename T, Int N> struct Seq {
      |                        ^~~
a.cc:8:11: error: 'N' was not declared in this scope
    8 |     T ary[N];
      |           ^
a.cc:10:29: error: 'Int' has not been declared
   10 |     constexpr T& operator[](Int n) { return ary[n]; }
      |                             ^~~
a.cc:11:35: error: 'Int' has not been declared
   11 |     constexpr T const& operator[](Int n) const { return ary[n]; }
      |                                   ^~~
a.cc:12:15: error: 'Int' does not name a type; did you mean 'int'?
   12 |     constexpr Int size() { return N; }
      |               ^~~
      |               int
a.cc:14:12: error: 'Int' has not been declared
   14 |   template<Int M=Max> constexpr auto osk_a() {
      |            ^~~
a.cc:14:18: error: 'Max' was not declared in this scope
   14 |   template<Int M=Max> constexpr auto osk_a() {
      |                  ^~~
a.cc: In function 'constexpr auto Integer::osk_a()':
a.cc:15:9: error: 'Int' was not declared in this scope; did you mean 'int'?
   15 |     Seq<Int, M> res{};
      |         ^~~
      |         int
a.cc:15:14: error: 'M' was not declared in this scope
   15 |     Seq<Int, M> res{};
      |              ^
a.cc:15:15: error: template argument 1 is invalid
   15 |     Seq<Int, M> res{};
      |               ^
a.cc:15:15: error: template argument 2 is invalid
a.cc:16:12: error: expected ';' before 'i'
   16 |     for(Int i=0; i<M; ++i) res.ary[i] = i;
      |            ^~
      |            ;
a.cc:16:18: error: 'i' was not declared in this scope
   16 |     for(Int i=0; i<M; ++i) res.ary[i] = i;
      |                  ^
a.cc:16:32: error: request for member 'ary' in 'res', which is of non-class type 'int'
   16 |     for(Int i=0; i<M; ++i) res.ary[i] = i;
      |                                ^~~
a.cc:17:12: error: expected ';' before 'i'
   17 |     for(Int i=2; i*i<M; ++i) {
      |            ^~
      |            ;
a.cc:17:18: error: 'i' was not declared in this scope
   17 |     for(Int i=2; i*i<M; ++i) {
      |                  ^
a.cc:18:14: error: request for member 'ary' in 'res', which is of non-class type 'int'
   18 |       if(res.ary[i] < i) continue;
      |              ^~~
a.cc:19:14: error: expected ';' before 'j'
   19 |       for(Int j=i; i*j<M; ++j) if(res.ary[i*j] == i*j) res.ary[i*j] = i;
      |              ^~
      |              ;
a.cc:19:22: error: 'j' was not declared in this scope
   19 |       for(Int j=i; i*j<M; ++j) if(res.ary[i*j] == i*j) res.ary[i*j] = i;
      |                      ^
a.cc:19:39: error: request for member 'ary' in 'res', which is of non-class type 'int'
   19 |       for(Int j=i; i*j<M; ++j) if(res.ary[i*j] == i*j) res.ary[i*j] = i;
      |                                       ^~~
a.cc:19:60: error: request for member 'ary' in 'res', which is of non-class type 'int'
   19 |       for(Int j=i; i*j<M; ++j) if(res.ary[i*j] == i*j) res.ary[i*j] = i;
      |                                                            ^~~
a.cc: At global scope:
a.cc:23:27: error: no matching function for call to 'osk_a()'
   23 |   constexpr auto a = osk_a();
      |                      ~~~~~^~
a.cc:14:38: note: candidate: 'template<<declaration error> > constexpr auto Integer::osk_a()'
   14 |   template<Int M=Max> constexpr auto osk_a() {
      |                                      ^~~~~
a.cc:14:38: note:   template argument deduction/substitution failed:
a.cc:24:12: error: 'Int' has not been declared
   24 |   template<Int M=Max> constexpr Int prime_count(Seq<Int, M> const& s = a) {
      |            ^~~
a.cc:24:18: error: 'Max' was not declared in this scope
   24 |   template<Int M=Max> constexpr Int prime_count(Seq<Int, M> const& s = a) {
      |                  ^~~
a.cc:24:33: error: 'Int' does not name a type; did you mean 'int'?
   24 |   template<Int M=Max> constexpr Int prime_count(Seq<Int, M> const& s = a) {
      |                                 ^~~
      |                                 int
a.cc:29:13: error: 'Int' does not name a type; did you mean 'int'?
   29 |   constexpr Int PC = prime_count();
      |             ^~~
      |             int
a.cc:30:12: error: 'Int' has not been declared
   30 |   template<Int M=Max, Int N=PC> constexpr auto prime_list(Seq<Int, M> const& s = a) {
      |            ^~~
a.cc:30:18: error: 'Max' was not declared in this scope
   30 |   template<Int M=Max, Int N=PC> constexpr auto prime_list(Seq<Int, M> const& s = a) {
      |                  ^~~
a.cc:30:23: error: 'Int' has not been declared
   30 |   template<Int M=Max, Int N=PC> constexpr auto prime_list(Seq<Int, M> const& s = a) {
      |                       ^~~
a.cc:30:29: error: 'PC' was not declared in this scope
   30 |   template<Int M=Max, Int N=PC> constexpr auto prime_list(Seq<Int, M> const& s = a) {
      |                             ^~
a.cc:30:63: error: 'Int' was not declared in this scope; did you mean 'int'?
   30 |   template<Int M=Max, Int N=PC> constexpr auto prime_list(Seq<Int, M> const& s = a) {
      |                                                               ^~~
      |                                                               int
a.cc:30:68: error: 'M' was not declared in this scope
   30 |   template<Int M=Max, Int N=PC> constexpr auto prime_list(Seq<Int, M> const& s = a) {
      |                                                                    ^
a.cc:30:69: error: template argument 1 is invalid
   30 |   template<Int M=Max, Int N=PC> constexpr auto prime_list(Seq<Int, M> const& s = a) {
      |                                                                     ^
a.cc:30:69: error: template argument 2 is invalid
a.cc: In function 'constexpr auto Integer::prime_list(const int&)':
a.cc:31:9: error: 'Int' was not declared in this scope; did you mean 'int'?
   31 |     Seq<Int, N> res{};
      |         ^~~
      |         int
a.cc:31:14: error: 'N' was not declared in this scope
   31 |     Seq<Int, N> res{};
      |              ^
a.cc:31:15: error: template argument 1 is invalid
   31 |     Seq<Int, N> res{};
      |               ^
a.cc:31:15: error: template argument 2 is invalid
a.cc:32:12: error: expected ';' before 'i'
   32 |     for(Int i=0,j=2; j<M; ++j) if(s.ary[j] == j) res.ary[i++] = j;
      |            ^~
      |            ;
a.cc:32:22: error: 'j' was not declared in this scope
   32 |     for(Int i=0,j=2; j<M; ++j) if(s.ary[j] == j) res.ary[i++] = j;
      |                      ^
a.cc:32:24: error: 'M' was not declared in this scope
   32 |     for(Int i=0,j=2; j<M; ++j) if(s.ary[j] == j) res.ary[i++] = j;
      |                        ^
a.cc:32:37: error: request for member 'ary' in 's', which is of non-class type 'const int'
   32 |     for(Int i=0,j=2; j<M; ++j) if(s.ary[j] == j) res.ary[i++] = j;
      |                                     ^~~
a.cc:32:54: error: request for member 'ary' in 'res', which is of non-class type 'int'
   32 |     for(Int i=0,j=2; j<M; ++j) if(s.ary[j] == j) res.ary[i++] = j;
      |                                                      ^~~
a.cc:32:58: error: 'i' was not declared in this scope
   32 |     for(Int i=0,j=2; j<M; ++j) if(s.ary[j] == j) res.ary[i++] = j;
      |                                                          ^
a.cc: At global scope:
a.cc:35:32: error: no matching function for call to 'prime_list()'
   35 |   constexpr auto p = prime_list();
      |                      ~~~~~~~~~~^~
a.cc:30:48: note: candidate: 'template<<declaration error>, <declaration error> > constexpr auto Integer::prime_list(const int&)'
   30 |   template<Int M=Max, Int N=PC> constexpr auto prime_list(Seq<Int, M> const& s = a) {
      |                                                ^~~~~~~~~~
a.cc:30:48: note:   template argument deduction/substitution failed:
a.cc:37:12: error: 'Int' has not been declared
   37 |   template<Int M=Max, Int N=PC> constexpr Int min_divisor(Int const& n, Seq<Int, M> const& s = a, Seq<Int, N> const& q = p) {
      |            ^~~
a.cc:37:18: error: 'Max' was not declared in this scope
   37 |   template<Int M=Max, Int N=PC> constexpr Int min_divisor(Int const& n, Seq<Int, M> const& s = a, Seq<Int, N> const& q = p) {
      |                  ^~~
a.cc:37:23: error: 'Int' has not been declared
   37 |   template<Int M=Max, Int N=PC> constexpr Int min_divisor(Int const& n, Seq<Int, M> const& s = a, Seq<Int, N> const& q = p) {
      |                       ^~~
a.cc:37:29: error: 'PC' was not declared in this scope
   37 |   template<Int M=Max, Int N=PC> constexpr Int min_divisor(Int const& n, Seq<Int, M> const& s = a, Seq<Int, N> const& q = p) {
      |                             ^~
a.cc:37:43: error: 'Int' does not name a type; did you mean 'int'?
   37 |   template<Int M=Max, Int N=PC> constexpr Int min_divisor(Int const& n, Seq<Int, M> const& s = a, Seq<Int, N> const& q = p) {
      |                                           ^~~
      |                                           int
a.cc:43:12: error: 'Int' has not been declared
   43 |   template<Int M=Max, Int N=PC> constexpr bool is_prime(Int const& n, Seq<Int, M> const& s = a, Seq<Int, N> const& q = p) {
      |            ^~~
a.cc:43:18: error: 'Max' was not declared in this scope
   43 |   template<Int M=Max, Int N=PC> constexpr bool is_prime(Int const& n, Seq<Int, M> const& s = a, Seq<Int, N> const& q = p) {
      |                  ^~~
a.cc:43:23: error: 'Int' has not been declared
   43 |   template<Int M=Max, Int N=PC> constexpr bool is_prime(Int const& n, Seq<Int, M> const& s = a, Seq<Int, N> const& q = p) {
      |                       ^~~
a.cc:43:29: error: 'PC' was not declared in this scope
   43 |   template<Int M=Max, Int N=PC> constexpr bool is_prime(Int const& n, Seq<Int, M> const& s = a, Seq<Int, N> const& q = p) {
      |                             ^~
a.cc:43:57: error: