Language: C++

#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()
#define chmax(a, b) a = max(a, b)


using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;


ll dp[3005][6005];

int main(){
    int n, T;
    cin >> n >> T;
    vector<P> p;
    rep(i, n){
        ll a, b;
        cin >> a >> b;
        p.emplace_back(a, b);
    }
	sort(ALL(p));
    ll res = 0;
    rep(i, n){
        rep(t, T){
            chmax(dp[i + 1][t], dp[i][t]);
            int nt = t + p[i].first;
            if(nt < T)chmax(dp[i + 1][nt], dp[i][t] + p[i].second);
        }
        int now = dp[i][T - 1] + p[i].second;
        chmax(res, now);
    }
    cout << dp[n][T] << endl;
    //REP(i, 1, n){REP(t, 1, T)cout << dp[i][t] << " ";cout << endl;}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:28: error: no matching function for call to 'max(ll&, int&)'
   27 | #define chmax(a, b) a = max(a, b)
      |                         ~~~^~~~~~
a.cc:56:9: note: in expansion of macro 'chmax'
   56 |         chmax(res, now);
      |         ^~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:27:28: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   27 | #define chmax(a, b) a = max(a, b)
      |                         ~~~^~~~~~
a.cc:56:9: note: in expansion of macro 'chmax'
   56 |         chmax(res, now);
      |         ^~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:7:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:27:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   27 | #define chmax(a, b) a = max(a, b)
      |                         ~~~^~~~~~
a.cc:56:9: note: in expansion of macro 'chmax'
   56 |         chmax(res, now);
      |         ^~~~~