Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main() {
  ll A, B; cin >> A >> B;
  queue<int> a;
  queue<int> b;
  queue<int> c;
  queue<int> d;

  rep(i+1,A+1){
    
    if(A % i+1 ==0){
    a.push(i+1);
  }
  }
  
   rep(i+1,B+1){
    
    if(B % i+1 ==0){
    b.push(i+1);
  }
  }
  
  rep(i,a.size()){
    
    if(IsPrime(a.front())){
      c.push(a.front);
      a.pop();
    }
    a.pop();
  }
  
   rep(i,b.size()){
     
    if(IsPrime(b.front())){
      d.push(b.front());
      b.pop();
    }
     b.pop()
  }
  
  int ans=0;
  vector<int> e(c.size());
  vector<int> f(d.size());
  
  rep(i,c.size()){
    e[i] = c.front();
    c.pop();
  }
  
  rep(i,d.size()){
    f[i] = d.front();
    f.pop();
  }
  
  rep(i,c.size()){
    rep(j,d.size()){
      if(e[i] == f[j]){
        ans++; 
      }
    }
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:8: error: expected ';' before '+' token
   33 |   rep(i+1,A+1){
      |        ^
a.cc:2:26: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(int i=0;i<(n);i++)
      |                          ^
a.cc:33:8: error: lvalue required as left operand of assignment
   33 |   rep(i+1,A+1){
      |        ^~
a.cc:2:26: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(int i=0;i<(n);i++)
      |                          ^
a.cc:2:35: error: expected ')' before ';' token
    2 | #define rep(i,n) for(int i=0;i<(n);i++)
      |                     ~             ^
a.cc:33:3: note: in expansion of macro 'rep'
   33 |   rep(i+1,A+1){
      |   ^~~
a.cc:33:7: error: 'i' was not declared in this scope
   33 |   rep(i+1,A+1){
      |       ^
a.cc:2:36: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(int i=0;i<(n);i++)
      |                                    ^
a.cc:33:9: error: lvalue required as increment operand
   33 |   rep(i+1,A+1){
      |         ^
a.cc:2:36: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(int i=0;i<(n);i++)
      |                                    ^
a.cc:40:9: error: expected ';' before '+' token
   40 |    rep(i+1,B+1){
      |         ^
a.cc:2:26: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(int i=0;i<(n);i++)
      |                          ^
a.cc:40:9: error: lvalue required as left operand of assignment
   40 |    rep(i+1,B+1){
      |         ^~
a.cc:2:26: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(int i=0;i<(n);i++)
      |                          ^
a.cc:2:35: error: expected ')' before ';' token
    2 | #define rep(i,n) for(int i=0;i<(n);i++)
      |                     ~             ^
a.cc:40:4: note: in expansion of macro 'rep'
   40 |    rep(i+1,B+1){
      |    ^~~
a.cc:40:10: error: lvalue required as increment operand
   40 |    rep(i+1,B+1){
      |          ^
a.cc:2:36: note: in definition of macro 'rep'
    2 | #define rep(i,n) for(int i=0;i<(n);i++)
      |                                    ^
a.cc:50:13: error: no matching function for call to 'std::queue<int>::push(<unresolved overloaded function type>)'
   50 |       c.push(a.front);
      |       ~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_queue.h:283:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >; value_type = int]'
  283 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:283:30: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const std::queue<int>::value_type&' {aka 'const int&'}
  283 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:288:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >; value_type = int]'
  288 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:288:25: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::queue<int>::value_type&&' {aka 'int&&'}
  288 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
a.cc:62:13: error: expected ';' before '}' token
   62 |      b.pop()
      |             ^
      |             ;
   63 |   }
      |   ~          
a.cc:76:7: error: 'class std::vector<int>' has no member named 'pop'
   76 |     f.pop();
      |       ^~~