Language: C++

#ifdef LOCAL
#include <bits/stdc++.h>
#endif
using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;
typedef vector<vector<vector<ll>>> VVV;
typedef vector<vector<vector<vector<ll>>>> VVVV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#ifdef LOCAL
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define dbgmint(n,arr) rep(i,n){cerr<<arr[i].x<<" ";}cerr<<endl;
#define dbgarrmint(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j].x<<" ";}cerr<<endl;}
#else
#define dbg(...)
#define dbgmap(...)
#define dbgarr(...)
#define dbgdp(...)
#define dbgmint(...)
#define dbgarrmint(...)
#endif
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    ll n,m;
    cin>>n>>m;

    VP vp;
    rep(i,n){
        ll a,b;
        cin>>a>>b;
        vp.emplace_back(a,b);
    }
    sort(ALL(vp));
    ll cnt = 0;
    priority_queue<ll> q;
    ll ans = 0;
    REP(i,1,m+1){
        while(cnt<n && vp[cnt].fi<=i){
            q.push(vp[cnt].se);
            cnt++;
        }
        if(!q.empty()){
            ans += q.top();
            q.pop();
        }
    }
    out(ans);
    return  0;
}

Compiler output:
a.cc:7:9: error: 'pair' does not name a type
    7 | typedef pair<ll, ll> P;
      |         ^~~~
a.cc:8:9: error: 'pair' does not name a type
    8 | typedef pair<int, int> Pi;
      |         ^~~~
a.cc:9:9: error: 'vector' does not name a type
    9 | typedef vector<ll> Vec;
      |         ^~~~~~
a.cc:10:9: error: 'vector' does not name a type
   10 | typedef vector<int> Vi;
      |         ^~~~~~
a.cc:11:9: error: 'vector' does not name a type
   11 | typedef vector<string> Vs;
      |         ^~~~~~
a.cc:12:9: error: 'vector' does not name a type
   12 | typedef vector<P> VP;
      |         ^~~~~~
a.cc:13:9: error: 'vector' does not name a type
   13 | typedef vector<vector<ll>> VV;
      |         ^~~~~~
a.cc:14:9: error: 'vector' does not name a type
   14 | typedef vector<vector<int>> VVi;
      |         ^~~~~~
a.cc:15:9: error: 'vector' does not name a type
   15 | typedef vector<vector<vector<ll>>> VVV;
      |         ^~~~~~
a.cc:16:9: error: 'vector' does not name a type
   16 | typedef vector<vector<vector<vector<ll>>>> VVVV;
      |         ^~~~~~
a.cc: In function 'int main()':
a.cc:57:5: error: 'cin' was not declared in this scope
   57 |     cin.tie(0);
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #ifdef LOCAL
a.cc:58:5: error: 'ios' has not been declared
   58 |     ios::sync_with_stdio(false);
      |     ^~~
a.cc:59:5: error: 'cout' was not declared in this scope
   59 |     cout<<std::setprecision(10);
      |     ^~~~
a.cc:59:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:59:16: error: 'setprecision' is not a member of 'std'
   59 |     cout<<std::setprecision(10);
      |                ^~~~~~~~~~~~
a.cc:1:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
  +++ |+#include <iomanip>
    1 | #ifdef LOCAL
a.cc:64:5: error: 'VP' was not declared in this scope
   64 |     VP vp;
      |     ^~
a.cc:68:9: error: 'vp' was not declared in this scope; did you mean 'mp'?
   68 |         vp.emplace_back(a,b);
      |         ^~
      |         mp
a.cc:70:14: error: 'vp' was not declared in this scope; did you mean 'mp'?
   70 |     sort(ALL(vp));
      |              ^~
a.cc:27:16: note: in definition of macro 'ALL'
   27 | #define ALL(v) v.begin(), v.end()
      |                ^
a.cc:70:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   70 |     sort(ALL(vp));
      |     ^~~~
      |     short
a.cc:72:5: error: 'priority_queue' was not declared in this scope
   72 |     priority_queue<ll> q;
      |     ^~~~~~~~~~~~~~
a.cc:1:1: note: 'std::priority_queue' is defined in header '<queue>'; this is probably fixable by adding '#include <queue>'
  +++ |+#include <queue>
    1 | #ifdef LOCAL
a.cc:72:22: error: expected primary-expression before '>' token
   72 |     priority_queue<ll> q;
      |                      ^
a.cc:72:24: error: 'q' was not declared in this scope
   72 |     priority_queue<ll> q;
      |                        ^
a.cc:48:25: error: 'endl' was not declared in this scope
   48 | #define out(a) cout<<a<<endl
      |                         ^~~~
a.cc:84:5: note: in expansion of macro 'out'
   84 |     out(ans);
      |     ^~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #ifdef LOCAL