Language: C++

#include <bits/stdc++.h>
#include <cstdio>
#include <vector>
#include <iostream>
#include <utility>

#define fir first
#define sec second
#define get(n) scanf("%d",&n);
#define gets(s) string s;cin >> (s);
#define All(s) (c).begin(), (c).end()
#define chmin(x, y) x = min(x, y);
#define chmax(x, y) x = max(x, y);
#define rep(i, j) for (int (i)=0;(i)<(j);(i)++)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long int ll;

int N, T;
int time[3001];
int del[3001];

void input(){
    cin >> N >> T;
    for(int i=0;i<N;i++){
        int a, b;cin >> a >> b;
        time[i] = a;
        del[i] = b;
    }
}

int nap(int i, int lefttime){
    if(time < time[i]){
        return nap(i+1, time);
    }
    return max(nap(i+1, lefttime - time[i]) + del[i],  nap(i+1, time));
}

void solve() {
    input();
    int ans = nap(0, T-0.5);
    cout << ans << endl;
    return ;
}

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


Compiler output:
a.cc:21:14: error: 'int time [3001]' redeclared as different kind of entity
   21 | int time[3001];
      |              ^
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/streambuf:43,
                 from /usr/include/c++/14/bits/streambuf_iterator.h:35,
                 from /usr/include/c++/14/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54,
                 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 'void input()':
a.cc:28:15: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   28 |         time[i] = a;
      |               ^
a.cc:28:17: error: assignment of read-only location '*(time + ((sizetype)i))'
   28 |         time[i] = a;
      |         ~~~~~~~~^~~
a.cc: In function 'int nap(int, int)':
a.cc:34:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   34 |     if(time < time[i]){
      |                     ^
a.cc:35:25: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
   35 |         return nap(i+1, time);
      |                         ^~~~
      |                         |
      |                         time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:33:20: note:   initializing argument 2 of 'int nap(int, int)'
   33 | int nap(int i, int lefttime){
      |                ~~~~^~~~~~~~
a.cc:37:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   37 |     return max(nap(i+1, lefttime - time[i]) + del[i],  nap(i+1, time));
      |                                          ^
a.cc:37:34: error: invalid operands of types 'int' and 'time_t(time_t*) noexcept' {aka 'long int(long int*) noexcept'} to binary 'operator-'
   37 |     return max(nap(i+1, lefttime - time[i]) + del[i],  nap(i+1, time));
      |                         ~~~~~~~~ ^ ~~~~~~~
      |                         |                |
      |                         int              time_t(time_t*) noexcept {aka long int(long int*) noexcept}
a.cc:37:65: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
   37 |     return max(nap(i+1, lefttime - time[i]) + del[i],  nap(i+1, time));
      |                                                                 ^~~~
      |                                                                 |
      |                                                                 time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
a.cc:33:20: note:   initializing argument 2 of 'int nap(int, int)'
   33 | int nap(int i, int lefttime){
      |                ~~~~^~~~~~~~