func_code_string: #include <bits/stdc++.h>   using namespace std;   bool cmp(const pair<int, int> &p1, const pair<int, int> &p2) {     if (p1.first == p2.first) {       return p1.second < p2.second;     }     return p1.first > p2.first;   }   int main() {     int n, m, e, x, y;     cin >> n >> m;     std::vector<pair<int, int> > E;     for (int i = 0; i < n; ++i) {       cin >> e;       E.push_back(make_pair(e, i));     }     sort(E.begin(), E.end(), cmp);     int inv[n];     for (int i = 0; i < n; ++i) {       inv[E[i].second] = i;     }     bool isThere[n];     for (int i = 0; i < n; ++i) isThere[i] = false;     std::vector<vector<int> > adj(n);     for (int i = 0; i < m; ++i) {       cin >> x >> y;       adj[x - 1].push_back(y - 1);       adj[y - 1].push_back(x - 1);     }     long long int sum = 0;     for (int i = 0; i < n; ++i) {       int ind = E[i].second;       for (int j = 0; j < adj[ind].size(); ++j) {         if (isThere[adj[ind][j]]) continue;         sum += E[inv[adj[ind][j]]].first;       }       isThere[ind] = true;     }     cout << sum;     return 0;   }   