Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 998244353;
const ll INF = 1000000000000000;
ll N, T, A[3010], B[3010], dp[3010], ans, time[3010], score[3010];
vector<P> vec;

ll pow(ll x, ll y)
{
	if (y == 0) return 1;
	if (y % 2)
	{
		return pow(x, y - 1) * x % mod;
	}
	else
	{
		ll yyy = pow(x, y / 2);
		return yyy * yyy % mod;
	}
}

ll pow_ll(ll x, ll y)
{
	if (y == 0) return 1;
	return x * pow_ll(x, y - 1);
}

ll div(ll x)
{
	return pow(x, mod - 2);
}



int main(void)
{
	cin >> N >> T;

	for (int i = 0; i < N; i++)
	{
		cin >> A[i] >> B[i];
		vec.push_back(P(B[i], A[i]));
	}
	
	sort(vec.begin(), vec.end());

	for (int i = N - 1; i >= 0; i--)
	{
		time[i] = time[i + 1] + vec[i].second;
		score[i] = score[i + 1] + vec[i].first;
	}

	if (time[1] <= T - 1)
	{
		ans = score[0];
	}

	for (int i = 1; i < N; i++)
	{
		for (int j = T - 1; j > 0; j--)
		{
			if (j < vec[i - 1].second) break;
			dp[j] = max(dp[j - vec[i - 1].second] + vec[i - 1].first, dp[j]);
		}

		if (time[i + 1] < T)
		{
			ll S = 0;
			for (int j = 0; j < T - time[i + 1]; j++)
			{
				S = max(S, dp[j]);
			}
			
			ans = max(ans, score[i + 1] + S + vec[i].first);
		}
	}

	cout << ans << endl;

	int xxx;
	cin >> xxx;
}


Compiler output:
a.cc:12:52: error: 'll time [3010]' redeclared as different kind of entity
   12 | ll N, T, A[3010], B[3010], dp[3010], ans, time[3010], score[3010];
      |                                                    ^
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 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/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'int main()':
a.cc:56:23: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   56 |                 time[i] = time[i + 1] + vec[i].second;
      |                       ^
a.cc:56:37: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   56 |                 time[i] = time[i + 1] + vec[i].second;
      |                                     ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:56:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   56 |                 time[i] = time[i + 1] + vec[i].second;
      |                           ~~~~~~~~~~~~^~~~~~~~~~~~~~~
a.cc:56:25: error: assignment of read-only location '*(time + ((sizetype)i))'
   56 |                 time[i] = time[i + 1] + vec[i].second;
      |                 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:60:19: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   60 |         if (time[1] <= T - 1)
      |                   ^
a.cc:60:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   60 |         if (time[1] <= T - 1)
      |             ~~~~~~~~^~~~~~~~
a.cc:73:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   73 |                 if (time[i + 1] < T)
      |                               ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:73:33: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   73 |                 if (time[i + 1] < T)
      |                     ~~~~~~~~~~~~^~~
a.cc:76:59: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   76 |                         for (int j = 0; j < T - time[i + 1]; j++)
      |                                                           ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:76:47: error: invalid operands of types 'll' {aka 'long long int'} and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'} to binary 'operator-'
   76 |                         for (int j = 0; j < T - time[i + 1]; j++)
      |                                             ~ ^ ~~~~~~~~~~~
      |                                             |             |
      |                                             |             time_t(time_t*) noexcept {aka long int(long int*) noexcept}
      |                                             ll {aka long long int}