func_code_string: #include <bits/stdc++.h>   using namespace std;   bool comp(pair<long long, long long> a, pair<long long, long long> b) {     if (a.first > a.second && a.first > b.first) return 1;     return 0;   }   void solve() {     long long n;     cin >> n;     vector<pair<double, pair<long long, long long>>> v(n);     for (long long i = (0); i < (n); ++i) {       cin >> v[i].second.first >> v[i].second.second;       v[i].first = v[i].second.first - v[i].second.second;     }     sort(v.begin(), v.end());     reverse(v.begin(), v.end());     long long s = 0;     for (long long i = (0); i < (n); ++i) {       s += v[i].second.first * i + v[i].second.second * (n - i - 1);     }     cout << s;   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long t1 = 1;     while (t1--) {       solve();       cout <<   n ;       ;     }   }   