func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 213700;   vector<int> g[N];   int t[N];   int n;   vector<int> divisiors[N];   vector<int> genDivisiors(int a) {     vector<int> v;     for (int i = 1; i * i <= a; i++) {       if (a % i == 0) {         v.push_back(i);         if (i * i != (a)) v.push_back(a / i);       }     }     return v;   }   vector<int> himmler[N];   bool vis[N];   vector<int> wywal;   void dfs(int a, int sraka, int& size) {     vis[a] = true;     wywal.push_back(a);     size++;     for (int i = 0; i < g[a].size(); i++) {       int d = g[a][i];       if (!vis[d] and (t[d] % sraka == 0)) {         dfs(d, sraka, size);       }     }   }   long long dp1[N];   long long dp2[N];   vector<pair<int, long long>> sraka;   int main() {     scanf( %d , &n);     int maxa = 0;     for (int i = 1; i <= n; i++) {       scanf( %d , &t[i]);       maxa = max(maxa, t[i]);     }     for (int i = 0; i < n - 1; i++) {       int a, b;       scanf( %d%d , &a, &b);       g[a].push_back(b);       g[b].push_back(a);     }     for (int i = 1; i <= n; i++) {       if (divisiors[t[i]].empty()) divisiors[t[i]] = genDivisiors(t[i]);       for (int j = 0; j < divisiors[t[i]].size(); j++) {         himmler[divisiors[t[i]][j]].push_back(i);       }     }     for (int i = 1; i <= maxa; i++) {       for (int j = 0; j < himmler[i].size(); j++) {         int a = himmler[i][j];         if (!vis[a]) {           int s = 0;           dfs(a, i, s);           dp1[i] += ((long long)s * (long long)(s + 1)) / 2;         }       }       for (int i = 0; i < wywal.size(); i++) vis[wywal[i]] = false;       wywal.clear();     }     for (int i = maxa; i >= 1; i--) {       if (dp1[i] != 0) {         for (int j = 2 * i; j <= maxa; j += i) {           dp1[i] -= dp1[j];         }         if (dp1[i] != 0) sraka.emplace_back(i, dp1[i]);       }     }     sort(sraka.begin(), sraka.end());     for (auto it : sraka) {       printf( %d %lld n , it.first, it.second);     }   }   