Language: C++

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    long long M;
    cin >> N >> M;
    vector<ll,ll> v(N);
    for (int i = 0; i < N; ++i) cin >> v[i].first >> v[i].second;
    sort(v.begin(), v.end());

    long long res = 0;
    for (int i = 0; i < N && M > 0; ++i) {
        res += v[i].first * min(M, v[i].second);
        M -= min(M, v[i].second);
    }
    cout << res << endl;
}



Compiler output:
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h: In instantiation of 'struct std::_Vector_base<long long int, long long int>':
/usr/include/c++/14/bits/stl_vector.h:428:11:   required from 'class std::vector<long long int, long long int>'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
a.cc:26:22:   required from here
   26 |     vector<ll,ll> v(N);
      |                      ^
/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<long long int, long long int>':
a.cc:26:22:   required from here
   26 |     vector<ll,ll> v(N);
      |                      ^
/usr/include/c++/14/bits/stl_vector.h:518:20: error: '_M_allocate' has not been declared in 'std::vector<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<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<long long int, long long int>::_Base'
  521 |       using _Base::_M_get_Tp_allocator;
      |                    ^~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:26:22: error: call of overloaded 'vector(int&)' is ambiguous
   26 |     vector<ll,ll> v(N);
      |                      ^
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = long long int; _Alloc = long long int]'
  620 |       vector(vector&&) noexcept = default;
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = long long int]'
  601 |       vector(const vector& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = long long int; _Alloc = long long int; size_type = long unsigned int; allocator_type = long long int]'
  556 |       vector(size_type __n, const allocator_type& __a = allocator_type())
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = long long int; _Alloc = long long int; allocator_type = long long int]'
  542 |       vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
      |       ^~~~~~
a.cc:27:41: error: no match for 'operator[]' (operand types are 'std::vector<long long int, long long int>' and 'int')
   27 |     for (int i = 0; i < N; ++i) cin >> v[i].first >> v[i].second;
      |                                         ^
a.cc:27:55: error: no match for 'operator[]' (operand types are 'std::vector<long long int, long long int>' and 'int')
   27 |     for (int i = 0; i < N; ++i) cin >> v[i].first >> v[i].second;
      |                                                       ^
a.cc:28:12: error: 'class std::vector<long long int, long long int>' has no member named 'begin'
   28 |     sort(v.begin(), v.end());
      |            ^~~~~
a.cc:28:23: error: 'class std::vector<long long int, long long int>' has no member named 'end'
   28 |     sort(v.begin(), v.end());
      |                       ^~~
a.cc:32:17: error: no match for 'operator[]' (operand types are 'std::vector<long long int, long long int>' and 'int')
   32 |         res += v[i].first * min(M, v[i].second);
      |                 ^
a.cc:32:37: error: no match for 'operator[]' (operand types are 'std::vector<long long int, long long int>' and 'int')
   32 |         res += v[i].first * min(M, v[i].second);
      |                                     ^
a.cc:33:22: error: no match for 'operator[]' (operand types are 'std::vector<long long int, long long int>' and 'int')
   33 |         M -= min(M, v[i].second);
      |                      ^