func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxx = 5e5 + 7;   long long a[maxx], prime[maxx], cnt[maxx], sum, tedad;   bool mark[maxx];   int main() {     int n, q;     cin >> n >> q;     for (int i = 0; i < n; i++) cin >> a[i];     for (int i = 2; i < maxx; i++) {       if (prime[i] == 0)         for (int j = i; j < maxx; j += i) prime[j] = i;     }     while (q--) {       int ind, adad, ans = 0;       cin >> ind;       ind--;       adad = a[ind];       vector<int> v;       while (adad > 1) {         int p = prime[adad];         v.push_back(p);         while (adad % p == 0) adad /= p;       }       int sz = (int)v.size();       for (int mask = 0; mask < (1 << sz); mask++) {         if (!mark[ind]) {           int t = 1;           for (int i = 0; i < sz; i++)             if ((mask >> i) & 1) t *= v[i];           if (__builtin_popcount(mask) % 2 == 0)             ans += cnt[t];           else             ans -= cnt[t];           cnt[t]++;         } else {           int t = 1;           for (int i = 0; i < sz; i++)             if ((mask >> i) & 1) t *= v[i];           cnt[t]--;           if (__builtin_popcount(mask) % 2 == 0)             ans += cnt[t];           else             ans -= cnt[t];         }       }       if (!mark[ind]) {         mark[ind] = true;         sum += ans;         tedad++;       } else {         mark[ind] = false;         sum -= ans;         tedad--;       }       cout << sum <<   n ;     }   }   