Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>

using namespace std;

int main(int argc, const char * argv[]) {
    
    // source code
    long long A,B;
    cin >> A >> B;
    long long tmp;
    int i,j;

    std::vector<long long> AVec, BVec, resVec;

    long long numA = A;
    long long numB = B;

    bool divFlag;

    for (i = 2; i <= long long(sqrt(A))+2; i++) {
        divFlag = false;
        while (numA % i == 0) { // 素数で割り切れなくなるまで割っていく
            if(divFlag == false){
                AVec.push_back(i);
                divFlag = true;
            }
            numA /= i;
        }
    }
    if(numA>1){
        AVec.push_back(numA);
    }

//    for(i=0;i<AVec.size();i++){
//        cout << AVec.at(i) << " ";
//    }
//    cout << endl;


    for (i = 2; i <= long long(sqrt(B))+2; i++) {
        divFlag = false;
        while (numB % i == 0) { // 素数で割り切れなくなるまで割っていく
            if(divFlag == false){
                BVec.push_back(i);
                divFlag = true;
            }
            numB /= i;
        }
    }
    if(numB>1){
        BVec.push_back(numB);
    }

    i=0;
    j=0;
    int count = 1;
    while(i<AVec.size() && j<BVec.size()){
        if(AVec.at(i)==BVec.at(j)){
            count++;
            i++;
            j++;
        }else{
            if(AVec.at(i)>BVec.at(j)){
                j++;
            }else{
                i++;
            }
        }
    }

    cout << count;
    return 0;
}



Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:28:22: error: expected primary-expression before 'long'
   28 |     for (i = 2; i <= long long(sqrt(A))+2; i++) {
      |                      ^~~~
a.cc:28:21: error: expected ';' before 'long'
   28 |     for (i = 2; i <= long long(sqrt(A))+2; i++) {
      |                     ^~~~~
      |                     ;
a.cc:28:22: error: expected primary-expression before 'long'
   28 |     for (i = 2; i <= long long(sqrt(A))+2; i++) {
      |                      ^~~~
a.cc:28:21: error: expected ')' before 'long'
   28 |     for (i = 2; i <= long long(sqrt(A))+2; i++) {
      |         ~           ^~~~~
      |                     )
a.cc:28:22: error: expected primary-expression before 'long'
   28 |     for (i = 2; i <= long long(sqrt(A))+2; i++) {
      |                      ^~~~
a.cc:28:47: error: expected ';' before ')' token
   28 |     for (i = 2; i <= long long(sqrt(A))+2; i++) {
      |                                               ^
      |                                               ;
a.cc:48:22: error: expected primary-expression before 'long'
   48 |     for (i = 2; i <= long long(sqrt(B))+2; i++) {
      |                      ^~~~
a.cc:48:21: error: expected ';' before 'long'
   48 |     for (i = 2; i <= long long(sqrt(B))+2; i++) {
      |                     ^~~~~
      |                     ;
a.cc:48:22: error: expected primary-expression before 'long'
   48 |     for (i = 2; i <= long long(sqrt(B))+2; i++) {
      |                      ^~~~
a.cc:48:21: error: expected ')' before 'long'
   48 |     for (i = 2; i <= long long(sqrt(B))+2; i++) {
      |         ~           ^~~~~
      |                     )
a.cc:48:22: error: expected primary-expression before 'long'
   48 |     for (i = 2; i <= long long(sqrt(B))+2; i++) {
      |                      ^~~~
a.cc:48:47: error: expected ';' before ')' token
   48 |     for (i = 2; i <= long long(sqrt(B))+2; i++) {
      |                                               ^
      |                                               ;