func_code_string: #include <bits/stdc++.h>   using namespace std;   long long pred[300005];   long long suffc[300005];   long long ans[300005];   int main() {     int n, m;     scanf( %d %d , &n, &m);     pair<int, int> ara[n];     vector<pair<int, int> > vt(n);     for (int i = 0; i < n; i++) {       scanf( %d %d , &ara[i].first, &ara[i].second);       vt[i] = {ara[i].second - ara[i].first, i};     }     sort(vt.begin(), vt.end());     pred[0] = ara[vt[0].second].second;     for (int i = 1; i < n; i++) {       pred[i] = pred[i - 1] + ara[vt[i].second].second;     }     suffc[n - 1] = ara[vt[n - 1].second].first;     for (int i = n - 2; i >= 0; i--) {       suffc[i] = suffc[i + 1] + ara[vt[i].second].first;     }     for (int i = 0; i < n; i++) {       int pos = upper_bound(vt.begin(), vt.end(),                             make_pair(ara[i].second - ara[i].first, n + 1)) -                 vt.begin();       ans[i] += 1ll * suffc[pos] + 1ll * (n - pos) * ara[i].second;       pos--;       if (pos >= 0)         ans[i] += 1ll * pred[pos] + 1ll * (pos + 1) * ara[i].first,             ans[i] -= ara[i].first + ara[i].second;       if (i == 0) {       }     }     for (int i = 0; i < m; i++) {       int u, v;       scanf( %d %d , &u, &v);       u--, v--;       ans[u] -= min(ara[u].first + ara[v].second, ara[u].second + ara[v].first);       ans[v] -= min(ara[u].first + ara[v].second, ara[u].second + ara[v].first);     }     for (int i = 0; i < n; i++) printf( %lld  , ans[i]);     return 0;   }   