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()
{
	int N, T;
	cin >> N >> T;
	pairs(K);
	fx(N) {
		pairsp(K);
	}

	fx(N+1) {
		fy(T+1){
			dp[x][y] = -1;
		}
	}
	dp[0][0] = 0;
	fx(N) {
		dp[x + 1][T] = max(dp[x][T], dp[x + 1][T]);
		fy(T) {
			dp[x + 1][y] = max(dp[x][y], dp[x + 1][y]);
			if (dp[x][y]>=0) {
				if (y+K[x].first<T) {
					dp[x + 1][y + K[x].first] =max( dp[x][y] + K[x].second, dp[x + 1][y + K[x].first]);
				}
				else {
					dp[x + 1][T] =max( dp[x][y] + K[x].second, dp[x + 1][T]);
				}
			}
		}
	}

	ll ans = 0;
	fx(T+1) {
		ans = max(ans, dp[N][x]);
	}
	ce(ans)

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:49:30: error: invalid types 'long long int[int]' for array subscript
   49 |                         dp[x][y] = -1;
      |                              ^
a.cc:52:14: error: invalid types 'long long int[int]' for array subscript
   52 |         dp[0][0] = 0;
      |              ^
a.cc:54:26: error: invalid types 'long long int[int]' for array subscript
   54 |                 dp[x + 1][T] = max(dp[x][T], dp[x + 1][T]);
      |                          ^
a.cc:54:41: error: invalid types 'long long int[int]' for array subscript
   54 |                 dp[x + 1][T] = max(dp[x][T], dp[x + 1][T]);
      |                                         ^
a.cc:54:55: error: invalid types 'long long int[int]' for array subscript
   54 |                 dp[x + 1][T] = max(dp[x][T], dp[x + 1][T]);
      |                                                       ^
a.cc:56:34: error: invalid types 'long long int[int]' for array subscript
   56 |                         dp[x + 1][y] = max(dp[x][y], dp[x + 1][y]);
      |                                  ^
a.cc:56:49: error: invalid types 'long long int[int]' for array subscript
   56 |                         dp[x + 1][y] = max(dp[x][y], dp[x + 1][y]);
      |                                                 ^
a.cc:56:63: error: invalid types 'long long int[int]' for array subscript
   56 |                         dp[x + 1][y] = max(dp[x][y], dp[x + 1][y]);
      |                                                               ^
a.cc:57:34: error: invalid types 'long long int[int]' for array subscript
   57 |                         if (dp[x][y]>=0) {
      |                                  ^
a.cc:59:50: error: invalid types 'long long int[int]' for array subscript
   59 |                                         dp[x + 1][y + K[x].first] =max( dp[x][y] + K[x].second, dp[x + 1][y + K[x].first]);
      |                                                  ^
a.cc:59:78: error: invalid types 'long long int[int]' for array subscript
   59 |                                         dp[x + 1][y + K[x].first] =max( dp[x][y] + K[x].second, dp[x + 1][y + K[x].first]);
      |                                                                              ^
a.cc:59:106: error: invalid types 'long long int[int]' for array subscript
   59 |                                         dp[x + 1][y + K[x].first] =max( dp[x][y] + K[x].second, dp[x + 1][y + K[x].first]);
      |                                                                                                          ^
a.cc:62:50: error: invalid types 'long long int[int]' for array subscript
   62 |                                         dp[x + 1][T] =max( dp[x][y] + K[x].second, dp[x + 1][T]);
      |                                                  ^
a.cc:62:65: error: invalid types 'long long int[int]' for array subscript
   62 |                                         dp[x + 1][T] =max( dp[x][y] + K[x].second, dp[x + 1][T]);
      |                                                                 ^
a.cc:62:93: error: invalid types 'long long int[int]' for array subscript
   62 |                                         dp[x + 1][T] =max( dp[x][y] + K[x].second, dp[x + 1][T]);
      |                                                                                             ^
a.cc:70:37: error: invalid types 'long long int[int]' for array subscript
   70 |                 ans = max(ans, dp[N][x]);
      |                                     ^