func_code_string: #include <bits/stdc++.h>   using namespace std;   struct gam {     int o;     long long k;     int nez;     long long bd;     long long kd;     gam() {       o = 0;       k = 0;       nez = 0;       bd = 0;       kd = 0;     }   };   bool mycomp(gam i, gam j) { return (i.k < j.k); }   int main() {     long long n;     long long r;     long long tr;     long long sum = 0;     cin >> n;     cin >> r;     cin >> tr;     gam* a = new gam[n + 1];     a[0].k = 0;     for (int i = 1; i <= n; i++) {       cin >> a[i].o;       cin >> a[i].k;       a[i].nez = r - a[i].o;       sum = sum + a[i].o;     }     sort(a + 1, a + n + 1, mycomp);     long long nug = tr * n - sum;     if (nug > 0) {       int cur;       for (int i = 1; i <= n; i++) {         a[i].bd = a[i - 1].bd + a[i].nez;         a[i].kd = a[i - 1].kd + a[i].k * a[i].nez;         if (a[i].bd >= nug) {           cur = i;           break;         }       }       long long enug = nug - a[cur - 1].bd;       long long rez = a[cur - 1].kd + enug * a[cur].k;       cout << rez;     } else       cout << 0;     return 0;   }   