func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<pair<int, int> > Div[5 * int(1e5 + 100)];   int a[2 * int(1e5 + 100)];   bool Have[2 * int(1e5 + 100)];   int calc[5 * int(1e5 + 100)];   int root[5 * int(1e5 + 100)];   int val = 1;   void Prime(int x) {     int u = x;     root[x] = 1;     for (int i = 2; i <= sqrt(x); i++)       if (x % i == 0) {         Div[u].push_back(pair<int, int>(i, 1));         while (x % i == 0) x /= i;         root[u] *= i;       }     if (x > 1) {       Div[u].push_back(pair<int, int>(x, 1));       root[u] *= x;     }   }   void Generate(int x, int n, int maxnumber, int number, int pos) {     if (number > maxnumber) {       Div[x].push_back(pair<int, int>(val, maxnumber));       return;     }     for (int j = pos; j <= n - (maxnumber - number); j++) {       val *= Div[x][j].first;       Generate(x, n, maxnumber, number + 1, j + 1);       val /= Div[x][j].first;     }   }   int main() {     for (int i = 2; i <= 5e5; i++) {       Prime(i);       if (i != root[i]) Div[i].clear();     }     for (int i = 2; i <= 5e5; i++)       if (i == root[i]) {         int n = Div[i].size();         for (int j = 2; j <= n; j++) Generate(i, n - 1, j, 1, 0);       }     int n, q;     cin >> n >> q;     for (int i = 0; i < n; i++) scanf( %d , &a[i]);     int Size = 0;     long long ans = 0;     for (int i = 1; i <= q; i++) {       int x, base;       scanf( %d , &x);       x--;       if (!Have[x]) {         Have[x] = true;         base = 1;         ans += 1ll * Size;         Size++;       } else {         Have[x] = false;         base = -1;         Size--;         ans -= 1ll * Size;       }       for (int j = 0; j < Div[root[a[x]]].size(); j++) {         int base2;         if (Div[root[a[x]]][j].second % 2 == 1)           base2 = -1;         else           base2 = 1;         if (base == -1) calc[Div[root[a[x]]][j].first]--;         ans = ans + (1ll * base * base2 * calc[Div[root[a[x]]][j].first]);         if (base == 1) calc[Div[root[a[x]]][j].first]++;       }       printf( %I64d n , ans);     }   }   