Language: C++

#include <bits/stdc++.h>
#include <string>
using namespace std;
int N,M;
typedef long long ll;
typedef pair<int,int> p;
#define NMAX 1000
vector<p> data;
ll dp[NMAX][NMAX];

ll nap(int jn,int day){
    ll na;
    cout << jn << " " << day <<" "<< dp[jn][day]<< endl;
    if(jn >= N) return 0;
    if(dp[jn][day]>=0) return dp[jn][day];
    if(day <= 1 ){
         na = 0;
    }else if(data[jn].first > day ){
        na = nap(jn+1,day);
    }else{
        na = max(nap(jn+1,day),nap(jn+1,day-1)+data[jn].second);
    }
    return dp[jn][day]=na;
}
bool cmb(p a,p b){
     return a.second >= b.second && a.first >= b.first;
}

int main(){
    cin >> N >> M;
    vector<vector<int>> jobs(M);
    for(int i=0;i<N;i++){
        int tmp1,tmp2;
        cin >> tmp1 >> tmp2;
        if(tmp1 > M) continue;
        jobs[m-a].push_back(b)
    }
    ll ans=0;
    priority_queue<int> q;
    for(int i=M-1;i>=0;i--){
        for(int b:jobs[i]){
            q.push(b);
        }
        if(!q.empty()){
            ans += q.top();
            q.pop();
        }
    }
    // int day = M;

    // // for(int i=0;i<N;i++){
    // //     cout << data[i].first << " " << data[i].second << endl;
    // // }
    // for(int i=0;i<N;i++){
    //     if(day < 1) continue;
    //     else if(data[i].second > day) continue;
    //     else{
    //         ans += data[i].first;
    //         day -= 1;
    //     }
    // }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'll nap(int, int)':
a.cc:18:14: error: reference to 'data' is ambiguous
   18 |     }else if(data[jn].first > day ){
      |              ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:8:11: note:                 'std::vector<std::pair<int, int> > data'
    8 | vector<p> data;
      |           ^~~~
a.cc:21:48: error: reference to 'data' is ambiguous
   21 |         na = max(nap(jn+1,day),nap(jn+1,day-1)+data[jn].second);
      |                                                ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:8:11: note:                 'std::vector<std::pair<int, int> > data'
    8 | vector<p> data;
      |           ^~~~
a.cc: In function 'int main()':
a.cc:36:14: error: 'm' was not declared in this scope
   36 |         jobs[m-a].push_back(b)
      |              ^
a.cc:36:16: error: 'a' was not declared in this scope
   36 |         jobs[m-a].push_back(b)
      |                ^
a.cc:36:29: error: 'b' was not declared in this scope
   36 |         jobs[m-a].push_back(b)
      |                             ^