func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 5;   const int M = 5.1e6 + 5;   const int B = 10;   int n, q;   int h[M];   int go[B + 1][N];   vector<int> dv[N];   int best[8][M];   int main() {     for (int i = 2; i * i < M; i++) {       if (!h[i]) {         for (int j = i; j < M; j += i) h[j] = i;       }     }     scanf( %d %d , &n, &q);     for (int i = 1; i <= n; i++) {       int x;       scanf( %d , &x);       while (h[x]) {         int y = h[x], c = 0;         while (x % y == 0) {           x /= y;           c ^= 1;         }         if (c) dv[i].push_back(y);       }       if (x > 1) dv[i].push_back(x);       assert(dv[i].size() <= 7);     }     for (int need = 0; need <= B; need++) {       go[need][n + 1] = n + 1;       memset(best, 0, sizeof(best));       for (int i = n; i >= 1; i--) {         go[need][i] = go[need][i + 1];         for (int mask = 0; mask < (1 << dv[i].size()); mask++) {           int prod = 1, cnt = dv[i].size() - __builtin_popcount(mask);           for (int j = 0; j < dv[i].size(); j++)             if (mask & (1 << j)) prod *= dv[i][j];           if (cnt <= need and need - cnt <= 7 and best[need - cnt][prod]) {             go[need][i] = min(go[need][i], best[need - cnt][prod]);           }           best[cnt][prod] = i;         }       }     }     for (int i = 1; i <= q; i++) {       int l, r;       scanf( %d %d , &l, &r);       for (int i = 0; i <= B + 1; i++) {         if (i > B or go[i][l] <= r) {           printf( %d n , i);           break;         }       }     }     return 0;   }   