func_code_string: #include <bits/stdc++.h>   using namespace std;   inline long long mod(long long n, long long m) {     long long ret = n % m;     if (ret < 0) ret += m;     return ret;   }   long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }   long long exp(long long a, long long b, long long m) {     if (b == 0) return 1;     if (b == 1) return mod(a, m);     long long k = mod(exp(a, b / 2, m), m);     if (b & 1) {       return mod(a * mod(k * k, m), m);     } else       return mod(k * k, m);   }   map<vector<long long>, long long> mp;   long long a[500100];   vector<long long> adj[500100];   void solve() {     mp.clear();     long long n, m;     cin >> n >> m;     for (long long i = 1; i <= n; i++) {       adj[i].clear();       cin >> a[i];     }     for (long long i = 0; i < m; i++) {       long long a, b;       cin >> a >> b;       adj[b].push_back(a);     }     for (long long i = 1; i <= n; i++) {       sort(adj[i].begin(), adj[i].end());       if (adj[i].size()) {         mp[adj[i]] += a[i];       }     }     long long g = -1;     for (map<vector<long long>, long long>::iterator it = mp.begin();          it != mp.end(); it++) {       if (g == -1)         g = it->second;       else         g = gcd(g, it->second);     }     if (g == -1) g = 0;     cout << g <<   n ;   }   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     long long t;     cin >> t;     while (t--) {       solve();     }   }   