func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 1;   vector<int> adj[N];   int numDiv[N];   int a[N];   bool cand[N];   int sz[N], dsu[N];   int f(int x) {     if (x == dsu[x]) {       return x;     }     return dsu[x] = f(dsu[x]);   }   void merge(int x, int y) {     x = f(x), y = f(y);     if (x != y) {       dsu[x] = y;       sz[y] += sz[x];     }   }   int val[N];   int numPrime[N];   long long all[N];   vector<int> in[N];   int lastColor[N];   int isGood[N];   int curColorList[N];   int go[N];   int bfs(int root, int curColor) {     int sz = 0;     queue<int> q;     q.push(root);     lastColor[root] = curColor;     while (!q.empty()) {       int node = q.front();       q.pop();       ++sz;       for (int i = 0; i < (int)adj[node].size(); ++i) {         int nextNode = adj[node][i];         if (isGood[nextNode] == curColor && lastColor[nextNode] < curColor) {           lastColor[nextNode] = curColor;           q.push(nextNode);         }       }     }     return sz;   }   void solve() {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; ++i) {       scanf( %d , &a[i]);       in[a[i]].push_back(i);     }     for (int i = 0; i < n - 1; ++i) {       int x, y;       scanf( %d %d  , &x, &y);       adj[x].push_back(y);       adj[y].push_back(x);     }     int g = N;     for (int i = 1; i < N; ++i) {       val[i] = 1;     }     int maxi = 0;     for (int i = 2; i < N; ++i) {       if (val[i] == 1) {         for (int j = i; j < N; j += i) {           val[j] *= i;           numPrime[j] ^= 1;         }       }     }     int curColor = 1;     int lim = (int)2e5;     int pos;     for (int num = lim; num >= 1; --num) {       ++curColor;       pos = 0;       for (int j = num; j <= lim; j += num) {         for (auto node : in[j]) {           if (isGood[node] != curColor) {             isGood[node] = curColor;             curColorList[pos++] = node;           }         }       }       long long tmp = 0;       for (int i = 0; i < pos; ++i) {         int node = curColorList[i];         if (lastColor[node] < curColor) {           int sz = bfs(node, curColor);           tmp += (long long)sz * (sz + 1);         }       }       tmp /= 2;       all[num] = tmp;     }     for (int num = 1; num <= lim; ++num) {       int g = 1;       long long ret = 0;       for (int j = num; j <= lim; j += num, ++g) {         if (val[g] == g) {           if (numPrime[g]) {             ret -= all[j];           } else {             ret += all[j];           }         }       }       if (ret > 0) {         printf( %d %lld n , num, ret);       }     }   }   int main() { solve(); }   