criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <iostream>
using namespace std;

pair<int,int> ar[3005];
long long int dp[3005][3005];
vector<int> late;

int main() {
	int n,t;
	cin>>n>>t;
	for(int i=0;i<n;i++){
		cin>>ar[i].first>>ar[i].second;
		if(ar[i].first>=t)
			late.push_back(ar[i].second);
	}
	
	for(int i=0;i<n;i++)
		for(int j=0;j<t;j++){
			if(j<t-ar[i].first)
				dp[i][j+ar[i].first]=max(dp[i][j+ar[i].first],dp[i][j]+ar[i].second);
			dp[i+1][j]=max(dp[i][j],dp[i+1][j]);
		}
	sort(late.begin(),late.end(),greater<int>());
	for(int i=0;i<t;i++)
		maxn=max(maxn,dp[n][i]);
	cout<<late[0]+maxn<<'\n';
}

Compiler output:
a.cc:6:1: error: 'vector' does not name a type
    6 | vector<int> late;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:14:25: error: 'late' was not declared in this scope
   14 |                         late.push_back(ar[i].second);
      |                         ^~~~
a.cc:23:14: error: 'late' was not declared in this scope
   23 |         sort(late.begin(),late.end(),greater<int>());
      |              ^~~~
a.cc:23:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   23 |         sort(late.begin(),late.end(),greater<int>());
      |         ^~~~
      |         short
a.cc:25:17: error: 'maxn' was not declared in this scope; did you mean 'main'?
   25 |                 maxn=max(maxn,dp[n][i]);
      |                 ^~~~
      |                 main
a.cc:26:23: error: 'maxn' was not declared in this scope; did you mean 'main'?
   26 |         cout<<late[0]+maxn<<'\n';
      |                       ^~~~
      |                       main
Language: C++

#include "bits/stdc++.h"
#define rep(i,n) for(ll i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define d_5 100000
#define d9_7 1000000007
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define pf push_front
#define ld long double
#define ll long long
struct meal{
  ll a;
  ll b;
};
bool cmp1(const meal &a, const meal &b)//ソート用
{
    if(a.b!=b.b){
      return a.b<b.b;
      }else{
        return a.a<b.a;
      }
}
bool cmp2(const meal &a, const meal &b)//ソート用
{
    if(a.a!=b.a){
      return a.a<b.a;
      }else{
        return a.b>b.b;
      }
}
int main(void){
  ll n,t;
  cin>>n>>t;
  t++;
  vector<meal> m(n);
  rep(i,n){
    cin>>m[i].a>>m[i].b;
  }
  
  vll dp=vll(n+1,vl(t,0));
  /*rep(i,n){
    rep(j,t){
      if(j+m[i].a<t){
        dp[i+1][j+m[i].a]=dp[i][j]+m[i].b;
      }
      dp[i+1][j]=max(dp[i][j],dp[i+1][j]);
    }
  }
  /*rep(i,n){
    rep(j,t){
      cout<<dp[i][j]<<" ";
    }
    cout<<endl;
  }*/
  ll amax=0;
  rep(i,t){
    amax=max(amax,dp[n][i]);
 
  }
  ll ans1=0;
  /*dp=vll(n+1,vl(t,0));
  sort(m.begin(),m.end(),cmp1);
  //t-=1;
  ll tmpans=m[n-1].b;
  rep(i,n-1){
    rep(j,t){
      if(j+m[i].a<t){
        dp[i+1][j+m[i].a]=dp[i][j]+m[i].b;
      }
      dp[i+1][j]=max(dp[i][j],dp[i+1][j]);
    }
  }
  /*rep(i,n){
    rep(j,t){
      cout<<dp[i][j]<<" ";
    }
    cout<<endl;
  }*/
  /*amax=0;
  rep(i,t){
    amax=max(amax,dp[n-1][i]);
 
  }
  ans1=max(amax+tmpans,ans1);*/
  dp=vll(n+1,vl(t,0));
  sort(m.begin(),m.end(),cmp2);
  tmpans=m[n-1].b;
  rep(i,n-1){
    rep(j,t){
      if(j+m[i].a<t){
        dp[i+1][j+m[i].a]=dp[i][j]+m[i].b;
      }
      dp[i+1][j]=max(dp[i][j],dp[i+1][j]);
    }
  }
  /*rep(i,n){
    rep(j,t){
      cout<<dp[i][j]<<" ";
    }
    cout<<endl;
  }*/
  amax=0;
  rep(i,t){
    amax=max(amax,dp[n-1][i]);
 
  }
  cout<<max(amax+tmpans,ans1)<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:93:3: error: 'tmpans' was not declared in this scope; did you mean 'tmpnam'?
   93 |   tmpans=m[n-1].b;
      |   ^~~~~~
      |   tmpnam
Language: C++

#include "bits/stdc++.h"
#define rep(i,n) for(ll i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define d_5 100000
#define d9_7 1000000007
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define pf push_front
#define ld long double
#define ll long long
struct meal{
  ll a;
  ll b;
};
bool cmp1(const meal &a, const meal &b)//ソート用
{
    if(a.b!=b.b){
      return a.b<b.b;
      }else{
        return a.a<b.a;
      }
}
bool cmp2(const meal &a, const meal &b)//ソート用
{
    if(a.a!=b.a){
      return a.a<b.a;
      }else{
        return a.b>b.b;
      }
}
int main(void){
  ll n,t;
  cin>>n>>t;
  t++;
  vector<meal> m(n);
  rep(i,n){
    cin>>m[i].a>>m[i].b;
  }
  
  vll dp=vll(n+1,vl(t,0));
  /*rep(i,n){
    rep(j,t){
      if(j+m[i].a<t){
        dp[i+1][j+m[i].a]=dp[i][j]+m[i].b;
      }
      dp[i+1][j]=max(dp[i][j],dp[i+1][j]);
    }
  }
  /*rep(i,n){
    rep(j,t){
      cout<<dp[i][j]<<" ";
    }
    cout<<endl;
  }*/
  ll amax=0;
  rep(i,t){
    amax=max(amax,dp[n][i]);
 
  }
  ll ans1=0;
  /*dp=vll(n+1,vl(t,0));
  sort(m.begin(),m.end(),cmp1);
  //t-=1;
  ll tmpans=m[n-1].b;
  rep(i,n-1){
    rep(j,t){
      if(j+m[i].a<t){
        dp[i+1][j+m[i].a]=dp[i][j]+m[i].b;
      }
      dp[i+1][j]=max(dp[i][j],dp[i+1][j]);
    }
  }
  /*rep(i,n){
    rep(j,t){
      cout<<dp[i][j]<<" ";
    }
    cout<<endl;
  }*/
  amax=0;
  rep(i,t){
    amax=max(amax,dp[n-1][i]);
 
  }
  ans1=max(amax+tmpans,ans1);*/
  dp=vll(n+1,vl(t,0));
  sort(m.begin(),m.end(),cmp2);
  tmpans=m[n-1].b;
  rep(i,n-1){
    rep(j,t){
      if(j+m[i].a<t){
        dp[i+1][j+m[i].a]=dp[i][j]+m[i].b;
      }
      dp[i+1][j]=max(dp[i][j],dp[i+1][j]);
    }
  }
  /*rep(i,n){
    rep(j,t){
      cout<<dp[i][j]<<" ";
    }
    cout<<endl;
  }*/
  amax=0;
  rep(i,t){
    amax=max(amax,dp[n-1][i]);
 
  }
  cout<<max(amax+tmpans,ans1)<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:90:17: error: 'tmpans' was not declared in this scope; did you mean 'tmpnam'?
   90 |   ans1=max(amax+tmpans,ans1);*/
      |                 ^~~~~~
      |                 tmpnam
a.cc:90:31: error: expected primary-expression before '/' token
   90 |   ans1=max(amax+tmpans,ans1);*/
      |                               ^
Language: C++

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
	struct nmd{
		int x,y;
	}n[3100];

bool mmp(nmd e,nmd f)
{
	if(e.y==f.y)
	return e.x<f.x;
	else
	return e.y>f.y;
}
int max(int x,int y)
{
	return x>y?x:y;
}
int main(){

	int a,b,c,d,i,j,k,l,g,e,sum,max,sum1;
	while(~scanf("%d%d",&a,&b))
	{
		b-=1;sum=0;max=0;sum1=0;e=b;
		for(i=0;i<a;i++)
		scanf("%d%d",&n[i].x,&n[i].y);
	
	sort(n,n+a,mmp);
	for(i=0;i<a;i++)
	{
		if(b>=n[i].x)
		{
			b-=n[i].x;
			sum+=n[i].y;
		}
		else
		{
		break;
		}
	}
	sum+=n[i].y;
	for(i=0;i<a;i++)
	{
		if(e>=n[i].x)
		{
			e-=n[i].x;
			sum1+=n[i].y;
		}
		else
		{
		max=max>n[i].y?max:n[i].y;
		}
	}
	if(e)
	sum1+=max;
		g=max(sum,sum1);
	printf("%d\n",g);
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:22: error: 'max' cannot be used as a function
   57 |                 g=max(sum,sum1);
      |                   ~~~^~~~~~~~~~
Language: C++

#include <bits/stdc++.h>

void input ();
void solve ();

const int MAXN = 3e3 + 1;

long long n, t;
std::pair <long long, long long> arr [MAXN];
long long dp [MAXN][MAXN];

long long f (long long x, long long r) {
  if (dp [x][r] != -1)
    return dp [x][r];

  if (x >= n || r < 1)
    return dp [x][r] = std::max (0, dp [x][r]);

  return dp [x][r] = std::max (f (x + 1, r), f (x + 1, r - arr [x].first) + arr [x].second);
}

void input () {
  scanf ("%lld%lld", &n, &t);
  for (long long i = 0, a, b; i < n; i++) {
    scanf ("%lld%lld", &a, &b);
    arr [i] = std::make_pair (a, b);
  }

  memset (dp, -1, sizeof dp);

  solve ();
}

void solve () {

  printf ("%lld\n", f (0, t));
}

int main () {
  input ();
  return 0;
}


Compiler output:
a.cc: In function 'long long int f(long long int, long long int)':
a.cc:17:33: error: no matching function for call to 'max(int, long long int&)'
   17 |     return dp [x][r] = std::max (0, dp [x][r]);
      |                        ~~~~~~~~~^~~~~~~~~~~~~~
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:17:33: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   17 |     return dp [x][r] = std::max (0, dp [x][r]);
      |                        ~~~~~~~~~^~~~~~~~~~~~~~
/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:17:33: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   17 |     return dp [x][r] = std::max (0, dp [x][r]);
      |                        ~~~~~~~~~^~~~~~~~~~~~~~
Language: C++

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

const int N = (int)1e6;

pair<int,int> dat[N+5];
int dp[N+5];

int main() {
    for (int i=0; i<N+3; i++) dp[i] = -1;
    dp[0] = 0;

    int n,t; scanf("%d %d", &n, &t);
    for (int i=1; i<=n; i++) {
        scanf("%d %d", &dat[i].first, &dat[i].second);
    }

    sort(dat+1, dat+1+n);

    int res = 0;
    for (int i=1; i<=n; i++) {
        int a = dat[i].first;
        int b = dat[i].second;

        for (int j=t-1+a; j>=a; j--) {
            if (dp[j-a] != -1) {
                dp[j] = max(dp[j], dp[j-a] + b);
                res = max(resa, dp[j]);
            }
        }
    }

    printf("%d\n", res);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:27: error: 'resa' was not declared in this scope; did you mean 'res'?
   28 |                 res = max(resa, dp[j]);
      |                           ^~~~
      |                           res
Language: C++

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

const int N = (int)1e6;

pair<int,int> dat[N+5];
int dp[N+5];

int main() {
    for (int i=0; i<N+3; i++) dp[i] = -1;
    dp[0] = 0;

    int n,t; scanf("%d %d", &n, &t);
    for (int i=1; i<=n; i++) {
        scanf("%d %d", &dat[i].first, &dat[i].second);
    }

    sort(dat+1, dat+1+n);

    int res = 0;
    for (int i=1; i<=n; i++) {
        int a = dat[i].first;
        int b = dat[i].second;

        for (int j=t-1+a; j>=a; j--) {
            if (dp[j-a] != -1) {
                dp[j] = max(dp[j], dp[j-a] + b);
                resa = max(resa, dp[j]);
            }
        }
    }

    printf("%d\n", resa);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:17: error: 'resa' was not declared in this scope; did you mean 'res'?
   28 |                 resa = max(resa, dp[j]);
      |                 ^~~~
      |                 res
a.cc:33:20: error: 'resa' was not declared in this scope; did you mean 'res'?
   33 |     printf("%d\n", resa);
      |                    ^~~~
      |                    res
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll i,j,N,M,a,b;
  cin>>N>>M;
  vector<vector<ll>> dp(N+1,vector<ll>(M+1,LLOMG_MIN));
  dp[0][0]=0;
  for(i=1;i<N+1;i++){
    cin>>a>>b;
    for(j=0;j<M+1;j++){
      dp[i][j]=max(dp[i][j],dp[i-1][j]);
      if(j<M){
        dp[i][min(M,j+a)]=max(dp[i][min(M,j+a)],dp[i-1][j]+b);
      }
    }
  }
  for(j=0;j<M;j++)dp[N][M]=max(dp[N][M],dp[N][j]);
  cout<<dp[N][M]<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:44: error: 'LLOMG_MIN' was not declared in this scope; did you mean 'LLONG_MIN'?
    7 |   vector<vector<ll>> dp(N+1,vector<ll>(M+1,LLOMG_MIN));
      |                                            ^~~~~~~~~
      |                                            LLONG_MIN
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
# define mod 1000000007
# define INF (1 << 29)
/* ちゃんと考えて実装して問題なくACできた時嬉しいよ！！ */

ll n,t;
vector< pair<ll,ll> > v;

bool judge(ll x){
    ll time_sum = -1*v[i].second;
    ll i = 0;
    ll sum_b = 0;
    while(time_sum < t && i<n){
        time_sum += v[i].second;
        sum_b += v[i].first;
        i++;
    }
    if(sum_b >= x) return true;
    else return false;
}

int main(void){
    cin >> n >> t;
    for(ll i=0; i<n; i++){
        ll a,b;
        cin >> a >> b;
        v.push_back(make_pair(b,a));
    }
    sort(v.begin(), v.end(), greater< pair<ll,ll> >());
    ll lb = 0;
    ll ub = 100000000;
    while(ub - lb > 1){
        ll mid = (lb + ub)/2;
        if(judge(mid)) lb = mid;
        else ub = mid;
    }
    cout << lb << "\n";
    return 0;
}

Compiler output:
a.cc: In function 'bool judge(ll)':
a.cc:12:24: error: 'i' was not declared in this scope
   12 |     ll time_sum = -1*v[i].second;
      |                        ^
Language: C++

#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <deque>
#include <queue>
using namespace std;

typedef long long ll;

const int MAX_N = 3000;
ll dp[MAX_N+1][MAX_N+1];

int main(){
   int N, T;
   cin >> N >> T;
   int A[2][N+1];
   A[0][0] = 0; A[1][0] = 0;
   for(int i = 1; i <= N; i++){
       cin >> A[0][i] >> A[1][i];
   }
   ll ans = 0;
   for(int i = 1; i <= N; i++){
       ll ma = 0;
       ll mi = 0;
        for(int j = 0; j <= MAX_N; j++){
            if(j < T){
                if(j >= A[0][i]){
                       dp[i][j] = max(dp[i-1][j], A[1][i]+dp[i-1][j-A[0][i]]);
                       ma = max(ma, dp[i][j]);
                } else {
                     dp[i][j] = dp[i-1][j];
                     mi = max(mi, dp[i][j]);
                }
            } else {
                dp[i][j] = max(ma, mi+A[1][i]);
            }

       }
   }
   for(int i = 0; i < =N; i++){
       ans = max(dp[i][MAX_N], ans);
   }
   cout << ans << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:44:23: error: expected primary-expression before '=' token
   44 |    for(int i = 0; i < =N; i++){
      |                       ^
Language: C++

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007
ll dp[6001];
int main()
{
	dp[0] = 1;
	fx(N) {
		for (int i = T - 1; i >= 0;i--) {
			if (dp[i]>0) {
				if (i + K[x].first<T) {
					dp[i + K[x].first] = max(dp[i + K[x].first], dp[i] + K[x].second);
				}
				else {
					dp[T] = max(dp[T], dp[i] + K[x].second);
				}

			}
		}
	}
	ll ans = 0;
	fx(6001) {
		ans = max(dp[x],ans);
	}
	ce(ans-1)
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:41:12: error: 'N' was not declared in this scope
   41 |         fx(N) {
      |            ^
a.cc:6:30: note: in definition of macro 'fx'
    6 | #define fx(p) for(int x=0;x<(p);x++)
      |                              ^
a.cc:42:30: error: 'T' was not declared in this scope
   42 |                 for (int i = T - 1; i >= 0;i--) {
      |                              ^
a.cc:44:41: error: 'K' was not declared in this scope
   44 |                                 if (i + K[x].first<T) {
      |                                         ^
Language: C++

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<vector<vector<vector<int>>>> vvvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
typedef vector<vector<vector<vector<ll>>>> vvvvl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;

int N, T;

int main() {
  cin >> N >> T;
  vector<vector<double>> ryouri(N, vector<double>(3)) ;
  map<double, int> ranking;
  int ichiban = 0;
  for(int i = 0; i < N; i++){
    cin >> ryouri[i][0] >> ryouri[i][1];
    ryouri[i][2] = ryouri[i][1] / ryouri[i][0];
    //cout << ryouri[i][0] << " " << ryouri[i][1] << " " << ryouri[i][2] <<endl;
    if(ryouri[i][1] > ryouri[ichiban][1]){
      ichiban = i;
    }
    //cout << ranking.at(ryouri[i][2]) <<endl;
    }
    for(int i = 0; i < N; i++){
      if(ryouri[i][0] < T && i != ichiban){
      ranking[ryouri[i][2]] = i;
      }
    }
  int oisisa = ryouri[ichiban][1];
    for (int i = 0; i < N-1; i++) {
      if(T - ryouri[ranking[N-1-i]][0] <= 0){
        break;
      }
      T -= ryouri[ranking[N-1-i]][0];
      oisisa += ryouri[ryouriranking[N-1-i]][1];
    }
    cout << oisisa <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:24: error: 'ryouriranking' was not declared in this scope
   44 |       oisisa += ryouri[ryouriranking[N-1-i]][1];
      |                        ^~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL<<60;
#define REP(i,n) for(int i=0; i<(n);++i)
#define FOR(i,k,n) for(int i=(k);i<(n);++i)

int dp[3005][3005];
vector<int> v(3005),w(3005);
int n;
int W;

void solve(){
    REP(i,3005)REP(j,3005)dp[i][j]=0;
    REP(i,n){
        REP(j,W+1){
            if(j<w[i]){
                dp[i+1][j]=dp[i][j];
            }else{
                dp[i+1][j]=max(dp[i][j],dp[i][j-w[i]]+v[i]);
            }
        }
    }
}
int main(){
    cin>>n>>W;
    int c=0;
    REP(i,n){cin>>w[i]>>v[i];c=max(c,v[i]);}
    solve();
    priority_queue<int> que;
    int x=W;
    int y=n;
    while(y>0 && x>0){
        if(x>=w[y-1] && dp[y][x]==dp[y-1][x-w[y-1]]+v[y-1]){
            x-=w[y-1];
        }else{
            que.push(w[y-1]);
        }
        y--;
    }
    if(x>0){int u=que.front(); cout<< max(c,dp[n][W]+u)<<endl;}  
    else cout<<max(c,dp[n][W])<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:23: error: 'class std::priority_queue<int>' has no member named 'front'
   41 |     if(x>0){int u=que.front(); cout<< max(c,dp[n][W]+u)<<endl;}
      |                       ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; ++i)
typedef long long ll;
const ll MOD = 1e9+7;

int main(){
    int n, t; cin >> n >> t;
    vector<pair<int,int>> food(n);
    int a,b;
    rep(i,n){
        cin >> a >> b;
        food[i] = make_pair(b,a); // first:美味しさ, second:かかる時間
    }
    rep(i,n) dp[0][t] = food[i].first;
    vector<vector<int>> dp(n+1, vector<int>(t+2,0));
    rep(i,n){
        rep(j,t+1){
            if(j == t){
                dp[i+1][j] = max(dp[i][j-1] + food[i].first, dp[i][j]);
            }else{
                if(j >= food[i].second) dp[i+1][j] = max(dp[i][j-food[i].second] + food[i].first, dp[i][j]);     
                else dp[i+1][j] = dp[i][j];
            }
        }
    }
    cout << dp[n][t] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:14: error: 'dp' was not declared in this scope; did you mean 'dup'?
   15 |     rep(i,n) dp[0][t] = food[i].first;
      |              ^~
      |              dup
Language: C++

// ~maqsat~
/*
*/

// #pragma GCC target ("avx2")
// #pragma GCC optimization ("Ofast")
// #pragma GCC optimization ("unroll-loops")

// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define in insert
#define pb push_back
#define eb emplace_back
#define sz(x) int(x.size())
#define all(x) x.begin(), x.end()
#define count1 __builtin_popcountl
#define debug(x) cerr << (#x) << " = " << (x) << "\n"
#define ACCELERATE ios_base::sync_with_stdio(false),cin.tie(nullptr)
#define fre(f) if(fopen(f".in", "r")) freopen(f".in", "r", stdin),freopen(f".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ull = unsigned long long;
// using big = __int128_t; // -10^38...10^38
using db = double;
using ld = long double;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;

template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class T> inline void cmin(T &a, T b) { a = min(a, b); }
template <class T> inline void cmax(T &a, T b) { a = max(a, b); }

const int oo = 0x3f3f3f3f;
const ll N = 1e4 + 345;
const ll MOD = 1e9 + 7;
const ll INF = 1e10 + 9;
const db EPS = 1e-9;
const db PI = acos(-1); // 3.14159265358979323846
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};
ll n,t;
pair<ll,ll> p[N];
ll dp[N];

signed main() {
    fre("");
    ACCELERATE;

    cin >> n >> t;
    for(int i = 1; i <= n; i++) {
    	cin >> p[i].F >> p[i].S;
    }
    sort(p+ 1, p+n+1);
    ll ans=0;
    for(int i =1;i<=n;i++){
    	for(j = t;j>= 1;j--) {
    		dp[j+p[i].F]=max(dp[j+p[i].F],dp[j]+p[i].S);
    	}
    }

    for(int i=1;i<=10000;i++){
	    ans=max(ans,dp[i]);
	 }
  	cout<<ans;
    return 0;
}
/*
 
*/


Compiler output:
a.cc: In function 'int main()':
a.cc:66:13: error: 'j' was not declared in this scope
   66 |         for(j = t;j>= 1;j--) {
      |             ^
Language: C++

#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,t;
    cin>>n>>t;
    ll a,b;
    vector<pair<ll,ll> > v;
    for(int i=0;i<n;i++){
        cin>>a>>b;
        v.pb(make_pair(a,b));
    }
    ll dp[n+1][t+10000];
    memset(dp,0,sizeof(dp));
    dp[1][1]=1;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=t;j++){
            dp[i][a[i]+j]+=dp[i-1][j]+b[i];
        }
        
    }    
    cout << dp[n][t]<<endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:20: error: invalid types 'll {aka long long int}[int]' for array subscript
   24 |             dp[i][a[i]+j]+=dp[i-1][j]+b[i];
      |                    ^
a.cc:24:40: error: invalid types 'll {aka long long int}[int]' for array subscript
   24 |             dp[i][a[i]+j]+=dp[i-1][j]+b[i];
      |                                        ^
Language: C++

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<vector<vector<vector<int>>>> vvvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
typedef vector<vector<vector<vector<ll>>>> vvvvl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;

int N, T;

int main() {
  cin >> N >> T;
  vector<vector<double>> ryouri(N, vector<double>(3)) ;
  map<double, int> ranking;
  int ichiban = 0;
  for(int i = 0; i < N; i++){
    cin >> ryouri[i][0] >> ryouri[i][1];
    ryouri[i][2] = ryouri[i][1] / ryouri[i][0];
    //cout << ryouri[i][0] << " " << ryouri[i][1] << " " << ryouri[i][2] <<endl;
    if(ryouri[i][1] > ryouri[ichiban][1]){
      ichiban = i;
    }
    //cout << ranking.at(ryouri[i][2]) <<endl;
    }
    for(int i = 0; i < N; i++){
      if(ryouri[i][0] < T && i != ichiban){
      ranking[ryouri[i][2]] = i;
      }
    }
    for (auto p : ranking) {
  auto k = p.first;
  auto v = p.second;
  cout << k << " => " << v << endl;
}
  int oisisa = ryouri[ichiban][1];
    for (int i = 0; i < N-1; i++) {
      if(T - ryouriranking[N-1-i][0] <= 0){
        break;
      }
      T -= ryouriranking[N-1-i][0];
      oisisa += ryouriryouriranking[N-1-i][1];
    }
    cout << oisisa <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:14: error: 'ryouriranking' was not declared in this scope
   45 |       if(T - ryouriranking[N-1-i][0] <= 0){
      |              ^~~~~~~~~~~~~
a.cc:48:12: error: 'ryouriranking' was not declared in this scope
   48 |       T -= ryouriranking[N-1-i][0];
      |            ^~~~~~~~~~~~~
a.cc:49:17: error: 'ryouriryouriranking' was not declared in this scope
   49 |       oisisa += ryouriryouriranking[N-1-i][1];
      |                 ^~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, T;
	cin >> N >> T;
	vector<pii> C;
	int dp[6010][3010] = { 0 };
	//int dp[1000][1000] = { 0 };
	//int dp[6010] = { 0 };
	REP(i, N) {
		int a, b;
		cin >> a >> b;
		C.push_back(pii(a, b));
	}
	SORT(A);

	/*eREP(i, 6010) {
		int tmp=-1;
		REP(j, N) {
			int t = C[j].first, v = C[j].second;
			if (!F[j])continue;
			if (i - t >= 0&&i-t<=T) {
				if (dp[i] < dp[i - t] + v) {
					cout << i << " " << j << endl;
					cout << dp[i] << endl;
					tmp = j;
					dp[i] = max(dp[i], dp[i - t] + v);
				}
				//dp[i] = max(dp[i], dp[i - t] + v);
				//cout << i << " " << j << endl;
				//cout << dp[i] << endl;
				if (tmp != -1)F[tmp] = false;
			}
			else {
				if (i - 1 >= 0)dp[i] = max(dp[i],dp[i-1]);
			}
		}
	}
	*/

	eREP(i, 6008) {
		REP(j, N) {
			int t = C[j].first, v = C[j].second;
			if (i - t >= 0&&i-t<T) {
				dp[i][j+1] = max(dp[i][j+1], dp[i - t][j]+v);
				//cout << i << " " << j << endl;
				//cout << dp[i][j+1] << endl;
			}

			if(i-1>=0)dp[i][j+1] = max(dp[i][j+1],dp[i-1][j+1]);
			dp[i][j + 1] = max(dp[i][j + 1], dp[i][j]);
		}
	}
	//REP(i, 11) {
		//cout << i<<" "<<dp[i][1] << " " << dp[i][2] << endl;
		//\cout << i<<" "<<dp[i] << endl;
	//}
	cout << dp[6008][N] << endl;
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:51:14: error: 'A' was not declared in this scope
   51 |         SORT(A);
      |              ^
a.cc:21:23: note: in definition of macro 'SORT'
   21 | #define SORT(c) sort((c).begin(),(c).end())
      |                       ^
Language: C++

#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int n, W, ma=0, tmp2;
int w[3010], v[3010];

// i番目以降の品物から重さの和がj以下なるように選んだときの、
// 取りうる価値の総和の最大値を返す関数
int rec(int i, int j) {
	int res;
	if (i == n) {
		// 品物がもう残っていないときは、価値の和の最大値は0で確定
		res = 0;
	}
	else if (j < w[i]) {
		// 残りの容量が足りず品物iを入れられないので、入れないパターンだけ処理
		// i+1 以降の品物で判定したときの最大値をそのままこの場合の最大値にする
		res = rec(i + 1, j);
	}
	else {
		// 品物iを入れるか入れないか選べるので、両方試して価値の和が大きい方を選ぶ
		res = max(
			rec(i + 1, j),
			rec(i + 1, j - w[i]) + v[i]
		);
	}
	return res;
}



// メモ化テーブル
// dp[i][j]はi番目以降の品物から重さの和がj以下なるように選んだときの価値の和の最大値を表す。
// -1なら値が未決定であることを表す
int dp[3010][3010];

// i番目以降の品物から重さの和がj以下なるように選んだときの、
// 取りうる価値の総和の最大値を返す関数。メモ配列で計算結果を再利用する
int rec_dp(int i, int j) {
	if (dp[i][j] != -1) {
		// すでに調べたことがあるならその結果を再利用
		return dp[i][j];
	}
	int res;
	if (i == n) {
		// 品物がもう残っていないときは、価値の和の最大値は0で確定
		res = 0;
	}
	else if (j < w[i]) {
		// 残りの容量が足りず品物iを入れられないので、入れないパターンだけ処理
		res = rec_dp(i + 1, j);
	}
	else {
		// 品物iを入れるか入れないか選べるので、両方試して価値の和が大きい方を選ぶ
		res = max(
			rec_dp(i + 1, j),
			rec_dp(i + 1, j - w[i]) + v[i]
		);
	}
	// 結果をテーブルに記憶する
	return dp[i][j] = res;
}

// メモ化再帰を用いた解法
void solve_dp() {
	memset(dp, -1, sizeof(dp)); // メモ化テーブルを-1で初期化　以下のforループと等価
								//  for (int i = 0; i < MAX_N + 1; i++)
								//    for (int j = 0; j < MAX_W + 1; j++)
								//      dp[i][j] = -1;

								// 0番目以降で容量W以下の場合の結果を表示する
	//cout << rec_dp(0, W) << endl;
	ma=max(ma, rec_dp(0, W))
}

int main() {
	int mv1 = -1, mv2 = -1, mv3 = -1, mi1=-1, mi2=-1, mi3=-1, tmp;
	cin >> n >> W;
	for (int i = 0; i < n; i++) {
		cin >> w[i] >> v[i];
		if (v[i] > mv1) {
			mv3 = mv2;
			mi3 = mi2;
			mv2 = mv1;
			mi2 = mi1;
			mv1 = v[i];
			mi1 = i;
		}
		else if (v[i] > mv2) {
			mv3 = mv2;
			mi3 = mi2;
			mv2 = v[i];
			mi2 = i;

		}
		else if (v[i] > mv3) {
			mv3 = v[i];
			mi3 = i;
		}
	}

	tmp = w[mi1];
	tmp2 = v[mi1];
	w[mi1] = 99999;
	solve_dp(); // メモ化再帰によるDP
	w[mi1] = tmp;

	tmp = w[mi2];
	tmp2 = v[mi2];
	w[mi2] = 99999;
	solve_dp(); // メモ化再帰によるDP
	w[mi2] = tmp;

	tmp = w[mi3];
	tmp2 = v[mi3];
	w[mi3] = 99999;
	solve_dp(); // メモ化再帰によるDP
	w[mi3] = tmp;

	cout << ma << endl;

	return 0;
}



Compiler output:
a.cc: In function 'void solve_dp()':
a.cc:77:33: error: expected ';' before '}' token
   77 |         ma=max(ma, rec_dp(0, W))
      |                                 ^
      |                                 ;
   78 | }
      | ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int MAX_N = 3030;
template<typename T> inline bool chmax(T& a,T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> inline bool chmin(T& a,T b) { if (a > b) { a = b; return true; } return false; }

int main() {
    int N, W;
    cin >> N >> W;
    vector<pair<int, int>> A(N);
    long long dp[MAX_N][MAX_N] = {0};

    for (int i = 0; i < N; i++) {
        cin >> A[i].second >> A[i].first;
    }

    sort(A.begin(), A.end(), greater<pair<int, int>>());
    int MAX = A[0].first;
    vector<pair<int, int>> B(N-1);
    for (int i = 0; i < N-1; i++) {
        B[i].first = A[i+1].first;
        B[i].second = A[i+1].second;
    }

     for (int i = 0; i < N-1; ++i) {
        for(int w = 0; w <= W; ++w) {
            if (w >= B[i].second) {
                chmax(dp[i + 1][w], dp[i][w - B[i].second] + B[i].first);
            }
            chmax(dp[i + 1][w], dp[i][w]);
        }
    }
    
    cout << max(dp[N-1][W-1] + MAX, dp[N-1][W] << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:48: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator<<'
   35 |     cout << max(dp[N-1][W-1] + MAX, dp[N-1][W] << endl;
      |                                     ~~~~~~~~~~~^~~~~~~
Language: C++

#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define REP(i, n) FOR((i), 0, (n))

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}

typedef int long long;
signed main() {
    int n, t;
    cin >> n >> t;
    vector<pii> ab(n);
    REP(i, n){
        cin >> ab[i].first >> ab[i].second;
    }
    sort(ab.begin(), ab.end());

    vector<vector<int>> dp(n+1, vector<int>(6001, -1));
    dp[0][0] = 0;
    // onlyはjを実際に使う場合のみ更新
    vector<vector<int>> only(dp);

    IFOR(i, 1, n){
        RFOR(j, 6000, 0){
            dp[i][j] = dp[i-1][j];
            if(j-ab[i-1].first >= 0 && dp[i-1][j-ab[i-1].first] >= 0){
                if(dp[i][j] <= dp[i-1][j-ab[i-1].first] + ab[i-1].second){
                    dp[i][j] = dp[i-1][j-ab[i-1].first] + ab[i-1].second;
                    only[i][j] = dp[i][j];
                }
            }
        }
    }

    int ans = 0;
    IFOR(i, 1, n){
        int limit = t + ab[i-1].first - 1;
        IFOR(j, 0, limit){
            ans = max(ans, only[i][j]);
        }
    }

    cout << ans << endl;


    return 0;
}

Compiler output:
a.cc:50:18: error: declaration does not declare anything [-fpermissive]
   50 | typedef int long long;
      |                  ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std; 
#define REP(i, n) for (int i = 0; i < (n); i++)

typedef long long ll;
typedef pair<ll,ll> pll;

ll dfs(priority_queue<pll,vector<pll>,greater<pll>> pq, int rest) {
    if (rest <= 0 || pq.empty()) return 0;
    pll cur = pq.top();pq.pop();
    if (rest <= cur.first) {
        ll ma = cur.second;
        while(!pq.empty()){
            pll p pq.top();pq.pop();
            ma = max(ma, p.second);
        }
        return ma;
    }
    ll use_cur = dfs(pq, rest - cur.first) + cur.second;
    ll unuse_cur = dfs(pq, rest);
    return max(use_cur,unuse_cur);
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int N, T; cin >> N >> T;
    priority_queue<pll,vector<pll>,greater<pll>> v_pqll;
    REP(i,N) {
        pll tmp;
        cin >> tmp.first >> tmp.second;
        v_pqll.push(tmp);
    }
    cout << dfs(v_pqll, T) << endl;
    return 0;
}


Compiler output:
a.cc: In function 'll dfs(std::priority_queue<std::pair<long long int, long long int>, std::vector<std::pair<long long int, long long int> >, std::greater<std::pair<long long int, long long int> > >, int)':
a.cc:15:19: error: expected initializer before 'pq'
   15 |             pll p pq.top();pq.pop();
      |                   ^~
a.cc:16:26: error: 'p' was not declared in this scope; did you mean 'pq'?
   16 |             ma = max(ma, p.second);
      |                          ^
      |                          pq
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
signed main(void){
    int n,w; cin>>n>>w;
    vector <pair<int,int>> data(n);
    rep(i,n){
        int a,b; cin>>a>>b;
        data[i] = {a,b}; //a time, b value
    }
    vector<vector<vector<int>>> dp (2, vector<vector<int>>(3010, vector<int>(6010)));
    rep(i,n){//i版めの料理
        rep(j, w){
            
                
                    chmax(dp[0][i+1][j], dp[0][i][j]);
                    chmax(dp[1][i+1][j], dp[1][i][j]);
                    chmax(dp[0][i+1][j+1], dp[0][i][j+1]);
                    chmax(dp[1][i+1][j+1], dp[1][i][j+1]);
                    chmax(dp[0][i+1][j + data[i].F], dp[0][i][j] + data[i].S);
                    chmax(dp[1][i+1][j], dp[0][i][j] + data[i].S);
                    if(j == w -1){
                        chmax(data[1][i+1][j] , data[0][i][j] + data[i].S);
                    }
            
            /*chmax(dp[0][i+1][j], dp[0][i][j]);
            chmax(dp[1][i+1][j], dp[1][i][j]);
            
            
            chmax(dp[0][i+1][j + data[i].F], dp[0][i][j] + data[i].S);
            
            chmax(dp[1][i+1][j], dp[0][i][j] + data[i].S);*/
            
        }
    }
    int ans = 0;
    rep(i,w){
        chmax(ans, dp[0][n][i+1]);
        chmax(ans, dp[1][n][i+1]);
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:38: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and 'long long int')
   33 |                         chmax(data[1][i+1][j] , data[0][i][j] + data[i].S);
      |                                      ^
a.cc:33:56: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and 'long long int')
   33 |                         chmax(data[1][i+1][j] , data[0][i][j] + data[i].S);
      |                                                        ^
Language: C++

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

int main(){
    int n, t, i, j;
    cin >> n >> t;
    int dp[n+1][t+1] = {};
    pair<int, int> p[n];
    for(i=0; i<n; i++){
        cin >> p[i].second >> p[i].first;
    }
    for(i=0; i<n+1; i++){
        for(j=0; j<=t; j++){
            if(i == 0){
                dp[i][j] = 0;
            }else{
                if(j == t){
                    dp[i][j] = max(max(dp[i][j-1], dp[i-1][j-1]+p[i-1].first), d[i-1][j]);
                }else if(j<p[i-1].second){
                    dp[i][j] = dp[i-1][j];
                }else{
                    dp[i][j] = max(dp[i-1][j-p[i-1].second]+p[i-1].first, dp[i-1][j]);
                }
            }
        }
    }
    cout << dp[n][t];
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:80: error: 'd' was not declared in this scope
   18 |                     dp[i][j] = max(max(dp[i][j-1], dp[i-1][j-1]+p[i-1].first), d[i-1][j]);
      |                                                                                ^
Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>

using namespace std;
typedef long long ll;

int main() {
  int N, T;
  cin >> N >> T;
  vector<int> A(N);
  vector<int> B(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i] >> B[i];
  }

  vector<pair<int, bitset<3000> > > vp(T, make_pair(0, bitset<3000>(0)));

  // init
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < N; ++j) {
      if (j == i) continue;
      int nt = A[j];
      if (nt >= T) continue;
      if (vp[nt].first < B[i] + B[j]) {
	vp[nt].first = B[i] + B[j];
	vp[nt].second.set(i);
	vp[nt].second.set(j);
      }
    }
  }

  {
    int mx = 0;
    for (int i = 0; i < N; ++i) {
      mx = max(mx, B[i]);
    }
    vp[0].first = mx;
  }

  // iterate
  for (int t = 1; t < T; ++t) {
    for (int i = 0; i < N; ++i) {
      if (vp[t].second[i]) continue;
      int nt = t + A[i];
      if (nt >= T) continue;
      if (vp[nt].first < vp[t].first + B[i]) {
	vp[nt].first = vp[t].first + B[i];
	vp[nt].second = vp[t].second;
	vp[nt].second.set(i);
      }
    }
  }

  // terminate
  int ans = -1;
  for (int t = 0; t < T; ++t) {
    ans = max(ans, vp[t].first);
  }
  cout << ans << endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:20: error: 'bitset' was not declared in this scope
   26 |   vector<pair<int, bitset<3000> > > vp(T, make_pair(0, bitset<3000>(0)));
      |                    ^~~~~~
a.cc:13:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
   12 | #include <cassert>
  +++ |+#include <bitset>
   13 | 
a.cc:26:31: error: template argument 2 is invalid
   26 |   vector<pair<int, bitset<3000> > > vp(T, make_pair(0, bitset<3000>(0)));
      |                               ^
a.cc:26:33: error: template argument 1 is invalid
   26 |   vector<pair<int, bitset<3000> > > vp(T, make_pair(0, bitset<3000>(0)));
      |                                 ^
a.cc:26:33: error: template argument 2 is invalid
a.cc:26:35: error: expected unqualified-id before '>' token
   26 |   vector<pair<int, bitset<3000> > > vp(T, make_pair(0, bitset<3000>(0)));
      |                                   ^
a.cc:34:11: error: 'vp' was not declared in this scope
   34 |       if (vp[nt].first < B[i] + B[j]) {
      |           ^~
a.cc:47:5: error: 'vp' was not declared in this scope
   47 |     vp[0].first = mx;
      |     ^~
a.cc:53:11: error: 'vp' was not declared in this scope
   53 |       if (vp[t].second[i]) continue;
      |           ^~
a.cc:56:11: error: 'vp' was not declared in this scope
   56 |       if (vp[nt].first < vp[t].first + B[i]) {
      |           ^~
a.cc:67:20: error: 'vp' was not declared in this scope
   67 |     ans = max(ans, vp[t].first);
      |                    ^~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repp(i,n) for(int i=1;i<=n;i++)

int dp[3030][3030];
int n,t,w[3030],v[3030];
int rec(int i,int j){
    if(dp[i][j]>=0) return dp[i][j];
    int res;
    if(i==n) res=0;
    else if(j<w[i]) res=rec(i+1,j);
    else res=max(rec(i+1,j),rec(i+1,j-w[i])+v[i]);
    return res;
}
int main(){
    cin >> n >> t;
    rep(i,n){
        cin >> w[i] >> v[i];
    }
    memset(dp,-1,sizeof(dp));
    int ans=rec(0,t);
    rep(i,n){
        int j=w[i],k=v[i];
        w[i]=0; v[i]=0;
        ans = max(ans,rec(0,t-1)+k);
        w[i]=j; v[i]=k;
    }
    cout << ans;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:27:5: error: 'memset' was not declared in this scope
   27 |     memset(dp,-1,sizeof(dp));
      |     ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <iomanip>
  +++ |+#include <cstring>
    7 | using namespace std;
Language: C++

#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);
    int n, t;
    cin >> n >> t;
    vector<int> mi(n), de(n);
    for (int i = 0; i < n; ++i)
        cin >> mi[i] >> de[i];
    vector< vector<ll> > dp(n, vector<ll>(6010, -1));
    for (int i = mi[0]; i < 6010; ++i)
        dp[0][i] = de[0];
    for (int i = 1; i < n; ++i)
    {
        for (int j = 0; j < 6010; ++j)
        {
            if (j - mi[i] < t && j - mi[i] >= 0 && dp[i - 1][j - mi[i]] != -1)
                dp[i][j] = max(dp[i][j], dp[i - 1][j - mi[i]] + de[i]);
            if (dp[i - 1][j] != -1)
                dp[i][j] = max(dp[i][j], dp[i - 1][j]);
            if (mi[i] <= j)
                dp[i][j] = max(dp[i][j], de[i]);
            if (j != 0)
                dp[i][j] = max(dp[i][j], dp[i][j - 1]);
        }
    }
    cout << dp[n - 1][6005];
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:31: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   28 |                 dp[i][j] = max(dp[i][j], de[i]);
      |                            ~~~^~~~~~~~~~~~~~~~~
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:28:31: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   28 |                 dp[i][j] = max(dp[i][j], de[i]);
      |                            ~~~^~~~~~~~~~~~~~~~~
/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
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <map>
using namespace std;

const int MAX_N = 3000; // nの最大値
const int MAX_W = 3000; // Wの最大値

						// 入力
int n, W;
int w[MAX_N], v[MAX_N];

// メモ化テーブル。
// dp[i][j]はi番目以降の品物から重さの和がj以下なるように選んだときの価値の和の最大値を表す。
// -1なら値が未決定であることを表す
int dp[MAX_N + 1][MAX_W + 1];

// i番目以降の品物から重さの和がj以下なるように選んだときの、
// 取りうる価値の総和の最大値を返す関数
int rec_dp(int i, int j) {
	if (dp[i][j] != -1) {
		// すでに調べたことがあるならその結果を再利用
		return dp[i][j];
	}
	int res;
	if (i == n || j <= 0) {
		// 品物がもう残っていないときは、価値の和の最大値は0で確定
		res = 0;
	}
	else {
		// 品物iを入れるか入れないか選べるので、両方試して価値の和が大きい方を選ぶ
		res = max(
			rec_dp(i + 1, j),
			rec_dp(i + 1, max(0, j - w[i])) + v[i]
		);
	}
	// 結果をテーブルに記憶する
	return dp[i][j] = res;
}

void solve_dp() {
	memset(dp, -1, sizeof(dp)); // メモ化テーブルを-1で初期化　以下のforループと等価
								//  for (int i = 0; i < MAX_N + 1; i++)
								//    for (int j = 0; j < MAX_W + 1; j++)
								//      dp[i][j] = -1;

								// 0番目以降で容量W以下の場合の結果を表示する
	cout << rec_dp(0, W) << endl;
}

int main() {
	cin>>n>>W;

	for (int i = 0; i < n; i++)
	{
		int a,b;cin>>a>>b;
		w[i] = a;
		v[i] = b;
	}

	solve_dp();
	
	return 0;
}

Compiler output:
a.cc: In function 'void solve_dp()':
a.cc:48:9: error: 'memset' was not declared in this scope
   48 |         memset(dp, -1, sizeof(dp)); // メモ化テーブルを-1で初期化　以下のforループと等価
      |         ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    9 | #include <map>
  +++ |+#include <cstring>
   10 | using namespace std;