Language: C++

include <bits/stdc++.h>
 
using namespace std;
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define lp(i, a, b) for (int i=a; i<(b); i++)
#define lpd(i,a,b) for (int i = (b)-1; i >= a; i--)
	
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
 
bool cmp(pi &a, pi &b){
    return (a.first < b.first);
}
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
 
    int n, a, b;
    ll m;
    cin>>n>>m;
 
    vector<pi> v(n);
    lp(i, 0, n){
        cin>>a>>b;
        v[i] = mp(a, b);
    }
    sort(all(v), cmp);
 
    ll sum = 0, price = 0;
    lp (i, 0, n){
        if (sum == m) break;
        ll b = min(m-sum, (ll)v[i].second);
        sum += b;
        price += ((ll)b*(ll)v[i].first);
    }
    cout<<price<<endl;
 
    return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'void __print(int)':
a.cc:5:22: error: 'cerr' was not declared in this scope
    5 | void __print(int x) {cerr << x;}
      |                      ^~~~
a.cc: In function 'void __print(long int)':
a.cc:6:23: error: 'cerr' was not declared in this scope
    6 | void __print(long x) {cerr << x;}
      |                       ^~~~
a.cc: In function 'void __print(long long int)':
a.cc:7:28: error: 'cerr' was not declared in this scope
    7 | void __print(long long x) {cerr << x;}
      |                            ^~~~
a.cc: In function 'void __print(unsigned int)':
a.cc:8:27: error: 'cerr' was not declared in this scope
    8 | void __print(unsigned x) {cerr << x;}
      |                           ^~~~
a.cc: In function 'void __print(long unsigned int)':
a.cc:9:32: error: 'cerr' was not declared in this scope
    9 | void __print(unsigned long x) {cerr << x;}
      |                                ^~~~
a.cc: In function 'void __print(long long unsigned int)':
a.cc:10:37: error: 'cerr' was not declared in this scope
   10 | void __print(unsigned long long x) {cerr << x;}
      |                                     ^~~~
a.cc: In function 'void __print(float)':
a.cc:11:24: error: 'cerr' was not declared in this scope
   11 | void __print(float x) {cerr << x;}
      |                        ^~~~
a.cc: In function 'void __print(double)':
a.cc:12:25: error: 'cerr' was not declared in this scope
   12 | void __print(double x) {cerr << x;}
      |                         ^~~~
a.cc: In function 'void __print(long double)':
a.cc:13:30: error: 'cerr' was not declared in this scope
   13 | void __print(long double x) {cerr << x;}
      |                              ^~~~
a.cc: In function 'void __print(char)':
a.cc:14:23: error: 'cerr' was not declared in this scope
   14 | void __print(char x) {cerr << '\'' << x << '\'';}
      |                       ^~~~
a.cc: In function 'void __print(const char*)':
a.cc:15:30: error: 'cerr' was not declared in this scope
   15 | void __print(const char *x) {cerr << '\"' << x << '\"';}
      |                              ^~~~
a.cc: At global scope:
a.cc:16:20: error: 'string' does not name a type
   16 | void __print(const string &x) {cerr << '\"' << x << '\"';}
      |                    ^~~~~~
a.cc: In function 'void __print(const int&)':
a.cc:16:32: error: 'cerr' was not declared in this scope
   16 | void __print(const string &x) {cerr << '\"' << x << '\"';}
      |                                ^~~~
a.cc: In function 'void __print(bool)':
a.cc:17:23: error: 'cerr' was not declared in this scope
   17 | void __print(bool x) {cerr << (x ? "true" : "false");}
      |                       ^~~~
a.cc: At global scope:
a.cc:20:20: error: 'pair' does not name a type
   20 | void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
      |                    ^~~~
a.cc:20:24: error: expected ',' or '...' before '<' token
   20 | void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
      |                        ^
a.cc: In function 'void __print(int)':
a.cc:20:36: error: 'cerr' was not declared in this scope
   20 | void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
      |                                    ^~~~
a.cc:20:57: error: 'x' was not declared in this scope
   20 | void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
      |                                                         ^
a.cc: In function 'void __print(const T&)':
a.cc:22:38: error: 'cerr' was not declared in this scope
   22 | void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
      |                                      ^~~~
a.cc: In function 'void _print()':
a.cc:23:16: error: 'cerr' was not declared in this scope
   23 | void _print() {cerr << "]\n";}
      |                ^~~~
a.cc: In function 'void _print(T, V ...)':
a.cc:25:57: error: 'cerr' was not declared in this scope
   25 | void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
      |                                                         ^~~~
a.cc: At global scope:
a.cc:42:9: error: 'pair' does not name a type
   42 | typedef pair<int, int> pi;
      |         ^~~~
a.cc:43:9: error: 'pair' does not name a type
   43 | typedef pair<ll,ll> pl;
      |         ^~~~
a.cc:44:9: error: 'vector' does not name a type
   44 | typedef vector<int> vi;
      |         ^~~~~~
a.cc:45:9: error: 'vector' does not name a type
   45 | typedef vector<ll> vl;
      |         ^~~~~~
a.cc:47:10: error: 'pi' was not declared in this scope; did you mean 'pb'?
   47 | bool cmp(pi &a, pi &b){
      |          ^~
      |          pb
a.cc:47:14: error: 'a' was not declared in this scope
   47 | bool cmp(pi &a, pi &b){
      |              ^
a.cc:47:17: error: 'pi' was not declared in this scope; did you mean 'pb'?
   47 | bool cmp(pi &a, pi &b){
      |                 ^~
      |                 pb
a.cc:47:21: error: 'b' was not declared in this scope; did you mean 'pb'?
   47 | bool cmp(pi &a, pi &b){
      |                     ^
      |                     pb
a.cc:47:22: error: expression list treated as compound expression in initializer [-fpermissive]
   47 | bool cmp(pi &a, pi &b){
      |                      ^
a.cc: In function 'int main()':
a.cc:52:5: error: 'ios' has not been declared
   52 |     ios::sync_with_stdio(false);
      |     ^~~
a.cc:53:5: error: 'cin' was not declared in this scope
   53 |     cin.tie(0);
      |     ^~~
a.cc:59:5: error: 'vector' was not declared in this scope
   59 |     vector<pi> v(n);
      |     ^~~~~~
a.cc:59:12: error: 'pi' was not declared in this scope; did you mean 'pb'?
   59 |     vector<pi> v(n);
      |            ^~
      |            pb
a.cc:59:16: error: 'v' was not declared in this scope
   59 |     vector<pi> v(n);
      |                ^
a.cc:37:12: error: 'make_pair' was not declared in this scope
   37 | #define mp make_pair
      |            ^~~~~~~~~
a.cc:62:16: note: in expansion of macro 'mp'
   62 |         v[i] = mp(a, b);
      |                ^~
a.cc:64:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   64 |     sort(all(v), cmp);
      |     ^~~~
      |     short
a.cc:69:16: error: 'min' was not declared in this scope; did you mean 'main'?
   69 |         ll b = min(m-sum, (ll)v[i].second);
      |                ^~~
      |                main
a.cc:73:5: error: 'cout' was not declared in this scope
   73 |     cout<<price<<endl;
      |     ^~~~
a.cc:73:18: error: 'endl' was not declared in this scope
   73 |     cout<<price<<endl;
      |                  ^~~~