Language: C++

#include<iostream>
#include<algorithm>
#include<queue>
#include<cmath>
#include<map>
#include<vector>
#include<iomanip>
using namespace std;
typedef long long ll;
ll inf = 100000000;
ll v[205];
ll x[20000005];
ll a[10000005];
ll b[10000005];
ll dp[10005][10005];
ll ex = 1000000007;
int dx[4] = { 1,-1,0,0 };
int dy[4] = { 0,0,1,-1 };
typedef pair<ll, ll> P;
double q[200005];
ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}
string s[200005];
int main() {
	ll n, m;
	cin >> n >> m;
	vector<P, ll>p;
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
		p[i] = make_pair(a[i], b[i]);
	}
	sort(p.begin(), p.end());
	ll sum = 0;
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		if (b[i] + sum <= m) {
			sum += b[i];
			ans += a[i] * b[i];
			m -= b[i];
		}
		else {
			ans += a[i] * m;
			break;
		}
	}
	cout << ans << endl;
	return 0;
}





Compiler output:
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/queue:63,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'struct std::_Vector_base<std::pair<long long int, long long int>, long long int>':
/usr/include/c++/14/bits/stl_vector.h:428:11:   required from 'class std::vector<std::pair<long long int, long long int>, long long int>'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
a.cc:28:15:   required from here
   28 |         vector<P, ll>p;
      |                      ^
/usr/include/c++/14/bits/stl_vector.h:87:28: error: 'long long int' is not a class, struct, or union type
   87 |         rebind<_Tp>::other _Tp_alloc_type;
      |                            ^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:89:9: error: 'long long int' is not a class, struct, or union type
   89 |         pointer;
      |         ^~~~~~~
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'class std::vector<std::pair<long long int, long long int>, long long int>':
a.cc:28:15:   required from here
   28 |         vector<P, ll>p;
      |                      ^
/usr/include/c++/14/bits/stl_vector.h:518:20: error: '_M_allocate' has not been declared in 'std::vector<std::pair<long long int, long long int>, long long int>::_Base'
  518 |       using _Base::_M_allocate;
      |                    ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:519:20: error: '_M_deallocate' has not been declared in 'std::vector<std::pair<long long int, long long int>, long long int>::_Base'
  519 |       using _Base::_M_deallocate;
      |                    ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:521:20: error: '_M_get_Tp_allocator' has not been declared in 'std::vector<std::pair<long long int, long long int>, long long int>::_Base'
  521 |       using _Base::_M_get_Tp_allocator;
      |                    ^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/requires_hosted.h:31,
                 from /usr/include/c++/14/iostream:38,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl() [with _Tp = std::pair<long long int, long long int>; _Alloc = long long int]':
a.cc:28:15:   required from here
   28 |         vector<P, ll>p;
      |                      ^
/usr/include/c++/14/bits/stl_vector.h:136:24: error: 'long long int' is not a class, struct, or union type
  136 |         _Vector_impl() _GLIBCXX_NOEXCEPT_IF(
      |                        ^~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:31:18: error: no match for 'operator[]' (operand types are 'std::vector<std::pair<long long int, long long int>, long long int>' and 'int')
   31 |                 p[i] = make_pair(a[i], b[i]);
      |                  ^
a.cc:33:16: error: 'class std::vector<std::pair<long long int, long long int>, long long int>' has no member named 'begin'
   33 |         sort(p.begin(), p.end());
      |                ^~~~~
a.cc:33:27: error: 'class std::vector<std::pair<long long int, long long int>, long long int>' has no member named 'end'
   33 |         sort(p.begin(), p.end());
      |                           ^~~
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'std::_Vector_base<_Tp, _Alloc>::_Vector_impl::_Vector_impl() [with _Tp = std::pair<long long int, long long int>; _Alloc = long long int]':
/usr/include/c++/14/bits/stl_vector.h:314:7:   required from here
  314 |       _Vector_base() = default;
      |       ^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:141:26: error: 'long long int' is not a class, struct, or union type
  141 |         : _Tp_alloc_type()
      |                          ^