Language: C++

#include <bits/stdc++.h>
int main()
{
  int N,M;std::cin>>N>>M;
  std::vector<std::vector<ll>> W(M);
  for (int i=0;i<N;i++){
    int A,B;std::cin>>A>>B;
    if(A<=M){W[M-A].push_back(B);}
  }
  std::priority_queue<ll> Q;
  ll ans =0;
  for(int i=0;i<M;i++){
    for(const ll b:W[i]){Q.push(b);}
    if(not Q.empty){ans+=Q.top(),Q.pop();}
  }
  std::cout<<ans<<std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:27: error: 'll' was not declared in this scope
    5 |   std::vector<std::vector<ll>> W(M);
      |                           ^~
a.cc:5:27: error: template argument 1 is invalid
a.cc:5:27: error: template argument 2 is invalid
a.cc:5:29: error: template argument 1 is invalid
    5 |   std::vector<std::vector<ll>> W(M);
      |                             ^~
a.cc:5:29: error: template argument 2 is invalid
a.cc:8:15: error: invalid types 'int[int]' for array subscript
    8 |     if(A<=M){W[M-A].push_back(B);}
      |               ^
a.cc:10:25: error: template argument 2 is invalid
   10 |   std::priority_queue<ll> Q;
      |                         ^
a.cc:10:25: error: template argument 3 is invalid
a.cc:11:5: error: expected ';' before 'ans'
   11 |   ll ans =0;
      |     ^~~~
      |     ;
a.cc:13:15: error: 'll' does not name a type
   13 |     for(const ll b:W[i]){Q.push(b);}
      |               ^~
a.cc:13:37: error: expected ';' before 'if'
   13 |     for(const ll b:W[i]){Q.push(b);}
      |                                     ^
      |                                     ;
   14 |     if(not Q.empty){ans+=Q.top(),Q.pop();}
      |     ~~                               
a.cc:14:5: error: expected primary-expression before 'if'
   14 |     if(not Q.empty){ans+=Q.top(),Q.pop();}
      |     ^~
a.cc:13:37: error: expected ';' before 'if'
   13 |     for(const ll b:W[i]){Q.push(b);}
      |                                     ^
      |                                     ;
   14 |     if(not Q.empty){ans+=Q.top(),Q.pop();}
      |     ~~                               
a.cc:14:5: error: expected primary-expression before 'if'
   14 |     if(not Q.empty){ans+=Q.top(),Q.pop();}
      |     ^~
a.cc:13:37: error: expected ')' before 'if'
   13 |     for(const ll b:W[i]){Q.push(b);}
      |        ~                            ^
      |                                     )
   14 |     if(not Q.empty){ans+=Q.top(),Q.pop();}
      |     ~~                               
a.cc:14:14: error: request for member 'empty' in 'Q', which is of non-class type 'int'
   14 |     if(not Q.empty){ans+=Q.top(),Q.pop();}
      |              ^~~~~
a.cc:14:21: error: 'ans' was not declared in this scope; did you mean 'abs'?
   14 |     if(not Q.empty){ans+=Q.top(),Q.pop();}
      |                     ^~~
      |                     abs
a.cc:14:28: error: request for member 'top' in 'Q', which is of non-class type 'int'
   14 |     if(not Q.empty){ans+=Q.top(),Q.pop();}
      |                            ^~~
a.cc:14:36: error: request for member 'pop' in 'Q', which is of non-class type 'int'
   14 |     if(not Q.empty){ans+=Q.top(),Q.pop();}
      |                                    ^~~
a.cc:16:14: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |   std::cout<<ans<<std::endl;
      |              ^~~
      |              abs