Language: C++

#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define loop(i, a, b) for(lli i=a; i<b; i++)
#define loopb(i, a, b) for(lli i=a; i>=b; i--)
#define fastio ios_base::sync_with_stdio(false); cin.tie(0)
#define pb push_back
typedef long long int lli;
typedef pair<lli, lli> pii;
typedef vector<lli> vll;
#define umap unordered_map
#define all(x) x.begin(), x.end()
// use to avoid collision
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
// for pair in unordered_map
struct hash_pair {
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};
lli M = 1e9 + 7;
lli power(lli x, lli y){
    lli res = 1;
    x = x%M;
    while (y > 0) {
        if (y & 1)
            res = (res*x)%M ;
        y = y>>1;
        x = (x*x)%M ;
    }
    return res%M;
}
bool cmp(const vll&a, const vll& b){
    if(a[0] + a[1] != b[0] + b[1])
        return a[0] + a[1] > b[0] + b[1];
    else
        return a[1] > b[1];
}
lli dp[1002][10009];
lli calc(lli index, lli cap, vector<vll>& A){
    lli n = A.size();
    if(cap < 0)
        return -1e16;
    else if(index >= n)
        return 0;
    else if(dp[index][cap] != -1)
        return dp[index][cap];
    lli ans = 0;
    ans = max(calc(index+1, cap, A), calc(index+1, min(cap-A[index][0], A[index][1]), A) + A[index][2]);\
    ans = max(ans, 0);
    dp[index][cap] = ans;
    return ans;
}
lli solve(){
    lli n;
    cin>>n;
    vector<vll> A(n, vll(3, 0));
    loop(i, 0, n)
        cin>>A[i][0]>>A[i][1]>>A[i][2];
    sort(all(A), cmp);
    // cout<<"\n";
    // loop(i, 0, n)
        // cout<<A[i][0]<<" "<<A[i][1]<<" "<<A[i][2]<<"\n";
    memset(dp, -1, sizeof(dp));
    cout<<calc(0, 10002, A)<<"\n";
    return 0;
}
int main(){
    fastio;
    lli t;
	// cin>>t;
    t = 1;
    while(t>0){ 
        t--;
        solve();
    }
}

Compiler output:
a.cc: In function 'lli calc(lli, lli, std::vector<std::vector<long long int> >&)':
a.cc:68:14: error: no matching function for call to 'max(lli&, int)'
   68 |     ans = max(ans, 0);
      |           ~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 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:68:14: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   68 |     ans = max(ans, 0);
      |           ~~~^~~~~~~~
/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:
/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:68:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   68 |     ans = max(ans, 0);
      |           ~~~^~~~~~~~