func_code_string: #include <bits/stdc++.h>   using namespace std;   const int size = 1007;   const long long modulo = 1000000007;   const long long oo = 1e18;   const double EPS = 1e-13;   const double PI = acos(-1.0);   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int n, m;     cin >> n >> m;     vector<vector<int> > g(n);     vector<long long> cost(n), v(n);     for (int i = 0; i < n; i++) cin >> v[i];     while (m--) {       int a, b;       cin >> a >> b;       --a;       --b;       cost[a] += v[b];       cost[b] += v[a];       g[a].push_back(b);       g[b].push_back(a);     }     vector<bool> was(n, false);     long long ans = 0;     for (int h = 0; h < n; h++) {       int ver = -1;       for (int i = 0; i < n; i++)         if (!was[i] && (ver < 0 || v[ver] < v[i])) ver = i;       was[ver] = true;       ans += cost[ver];       for (int i = 0; i < g[ver].size(); i++) {         int to = g[ver][i];         if (!was[to]) {           cost[ver] -= v[to];           cost[to] -= v[ver];         }       }     }     cout << ans << endl;     return 0;   }   