func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = 1 << 30;   const int p = 10000007;   pair<long long, int> c[500005];   pair<long long, long long> sum[500005];   int id[500005];   long long a[500005], b[500005], ans[500005];   int main() {     int n, m;     scanf( %d%d , &n, &m);     for (int i = (int)1; i <= (int)n; i++) {       scanf( %I64d%I64d , &a[i], &b[i]);       c[i] = make_pair(a[i] - b[i], i);     }     sort(c + 1, c + n + 1);     for (int i = (int)1; i <= (int)n; i++) id[c[i].second] = i;     sum[0] = make_pair(0, 0);     sum[n + 1] = make_pair(0, 0);     for (int i = (int)1; i <= (int)n; i++)       sum[i].first = sum[i - 1].first + a[c[i].second];     for (int i = (int)n; i >= (int)1; i--)       sum[i].second = sum[i + 1].second + b[c[i].second];     for (int i = (int)1; i <= (int)n; i++)       ans[i] = a[i] * (n - id[i]) + b[i] * (id[i] - 1) + sum[id[i] - 1].first +                sum[id[i] + 1].second;     for (int times = (int)1; times <= (int)m; times++) {       int x, y;       scanf( %d%d , &x, &y);       if (id[x] < id[y])         ans[x] -= a[x] + b[y], ans[y] -= a[x] + b[y];       else         ans[x] -= a[y] + b[x], ans[y] -= a[y] + b[x];     }     for (int i = (int)1; i <= (int)n; i++) printf( %I64d  , ans[i]);     puts(  );     return 0;   }   