func_code_string: #include<bits/stdc++.h>      #define pb push_back   #define x first   #define y second   #define all(a) (a).begin(), (a).end()      using namespace std;      typedef long long ll;   typedef pair<int, int> ii;      const int maxn = 3e5 + 5;      int n, m, X;   ll A[maxn];   int par[maxn];   set<pair<ll, ii>> adj[maxn];   map<ii, int> pos;   set<pair<ll, int>> s;   int exists = 1;      int find(int x) {return (x == par[x]) ? x : par[x] = find(par[x]);}      int merge(int x, int y) {    x = find(x), y = find(y);    if(x == y) return 0;        if(adj[x].size() < adj[y].size()) swap(x, y);    par[y] = x;    s.erase({A[y], y});    s.erase({A[x], x});    A[x] += A[y];    A[x] -= X;    s.insert({A[x], x});    if(A[x] < 0) exists = 0;    for(auto p : adj[y]) adj[x].insert(p);    return 1;   }      int main() {    scanf( %d %d %d , &n, &m, &X);    for(int i = 0;i < n;i++) scanf( %lld , A + i);    for(int i = 0;i < n;i++) par[i] = i;    for(int i = 0;i < m;i++) {     int x, y;     scanf( %d %d , &x, &y);     x--, y--;     if(x > y) swap(x, y);     pos[{x, y}] = i + 1;     adj[x].insert({A[y], {x, y}});     adj[y].insert({A[x], {x, y}});    }        vector<int> ans;    for(int i = 0;i < n;i++) s.insert({A[i], i});    for(int i = 0;i < n - 1;i++) {     auto it1 = s.end();it1--;     auto p1 = *it1;          while(1) {      auto it2 = adj[p1.y].end();it2--;      auto p2 = *it2;      int flag = merge(p2.y.x, p2.y.y);      if(flag) {       ans.pb(pos[{p2.y.x, p2.y.y}]);       break;      }      adj[p1.y].erase(it2);     }     if(!exists) {printf( NO n );return 0;}    }        printf( YES n );    for(int i : ans) printf( %d n , i);    return 0;   }   