func_code_string: #include <bits/stdc++.h>   using namespace std;   void swap(int& a, int& b) {     int tmp;     tmp = a;     a = b;     b = tmp;   }   void QuickSort(int l, int h, int a[], int b[]) {     int i = l, j = h;     int pivot = a[l + rand() % (h - l + 1)];     while (i <= j) {       while (a[i] < pivot) i++;       while (a[j] > pivot) j--;       if (i <= j) {         swap(a[i], a[j]);         swap(b[i], b[j]);         i++;         j--;       }     }     if (l < j) QuickSort(l, j, a, b);     if (i < h) QuickSort(i, h, a, b);   }   int main() {     int n, r, avg;     long long s = 0;     cin >> n >> r >> avg;     int b[n + 1], a[n + 1];     for (int i = 1; i <= n; i++) {       cin >> a[i] >> b[i];       s += (long long)a[i];     }     long long d = (long long)n * avg - s;     if (d <= 0) {       cout << 0;       return 0;     }     QuickSort(1, n, b, a);     long long ans = 0;     for (int i = 1; i <= n; i++) {       if (d >= r - a[i]) {         ans += (long long)(r - a[i]) * b[i];         d -= r - a[i];         if (!d) break;       } else {         ans += (long long)d * b[i];         break;       }     }     cout << ans;   }   