func_code_string: #include <bits/stdc++.h>   using namespace std;   using ll = long long;   const int N = 5e5 + 5;   int n, m;   ll c[N];   vector<int> adj[N];   map<vector<int>, ll> mp;   ll custom_gcd(ll a, ll b) {     ll c;     while (b > 0) {       c = a % b;       a = b;       b = c;     }     return a;   }   void solve() {     mp.clear();     cin >> n >> m;     for (int i = 1; i <= n; ++i) {       cin >> c[i];       adj[i].clear();     }     for (int i = 1, u, v; i <= m; ++i) {       cin >> u >> v;       adj[v].emplace_back(u);     }     for (int i = 1; i <= n; ++i) {       sort(adj[i].begin(), adj[i].end());       if (!adj[i].empty()) mp[adj[i]] += c[i];     }     ll ans = 0;     for (auto &p : mp) {       ans = custom_gcd(ans, p.second);     }     cout << ans <<   n ;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int t;     cin >> t;     while (t--) solve();     return 0;   }   