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

#include <bits/stdc++.h> 
#define l_ength size const int inf = (1<<30); const int mod = 1000000007; using ll = long long; using namespace std; ll dp[3050][3050]; struct c{ 	ll s; 	ll d; }; int main(){ 	int n, t; cin >> n >> t; 	vector<c> l(n); 	for( int i = 0; i < n; ++i ){ 		cin >> l[i].s >> l[i].d; 	} 	sort( 		l.begin(), l.end(), 		[]( const c& x, const c& y ){ 			return ( x.s == y.s ) ? ( x.d < y.d ) : ( x.s < y.s ); 		} 	); 	ll ans = 0; 	for( int i = 0; i < n; ++i ){ 		for( int x = 0; x < t; ++x ){ 			if( x+l[i].s < t ){ 				dp[i+1][x+l[i].s] = max( 					{dp[i][x+l[i].s], dp[i][x]+l[i].d,dp[i+1][l[i].s+x]} 				); 			} else { 				ans = max( ans, dp[i][x]+l[i].d ); 			} 		} 	} 	ll tempans = 0; 	for( int x = 0; x < t; ++x ){ 		tempans = max( tempans, dp[n][x] ); 	} 	cout << max(tempans, ans) << endl; }


Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

ll dp[3050][3050];

struct c{
	ll s;
	ll d;
};

int main(){
	int n, t; cin >> n >> t;
	vector<c> l(n);
	for( int i = 0; i < n; ++i ){
		cin >> l[i].s >> l[i].d;
	}
	sort(
		l.begin(), l.end(),
		[]( const c& x, const c& y ){
			return ( x.s == y.s ) ? ( x.d < y.d ) : ( x.s < y.s );
		}
	);
	ll ans = 0;
	for( int i = 0; i < n; ++i ){
		for( int x = 0; x < t; ++x ){
			if( x+l[i].s < t ){
				dp[i+1][x+l[i].s] = max({
					dp[i][x+l[i].s], dp[i][x]+l[i].d,dp[i+1][l[i].s+x}
				);
			} else {
				ans = max( ans, dp[i][x]+l[i].d );
			}
		}
	}
	ll tempans = 0;
	for( int x = 0; x < t; ++x ){
		tempans = max( tempans, dp[n][x] );
	}
	cout << max(tempans, ans) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:90: error: expected ']' before '}' token
   32 |                                         dp[i][x+l[i].s], dp[i][x]+l[i].d,dp[i+1][l[i].s+x}
      |                                                                                          ^
      |                                                                                          ]
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
template <typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<ll> &v) {
    std::for_each(v.begin(), v.end(), [](ll x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int dp[3000 + 10][3000 + 10][2];
// dp[i][j][k]
// i品目まで食べるのかを選んで，jの時間がかかったときの美味しさの最大値
// kが0のときは最後に食べるものをまだ選んでいない
// 1のときは最後に食べるものをもう選んでいる
int main() {
    int N, T;
    cin >> N >> T;
    vector<int> A(N), B(N);
    vector<pair<int, int>> C(N);
    REP(i, N) {
        cin >> A[i] >> B[i];
        C[i] = make_pair(A[i], B[i]);
    }
    dp[0][0][0] = 0;
    for(int i = 1; i < = N; i++) {
        for(int j = 0; j < T - 1; j++) {
            for(int k = 0; k < 2; k++) {
                dp[i][j][k] = max(dp[i][j][k], dp[i - 1][j][k]);
                if(j - A[i - 1] >= 0) {
                    // Aを入れることができる
                    dp[i][j][k] =
                        max(dp[i][j][k], dp[i - 1][j - A[i - 1]][k] + B[i - 1]);
                }
                if(k == 0) {
                    //これから最後にたべるものを選ぶ
                    dp[i][j][1] = max(dp[i][j][1], dp[i - 1][j][k] + B[i - 1]);
                }
            }
        }
    }
    int ans = 0;
    for(int i = 0; i <= T - 1; i++) {
        for(int j = 0; j < 2; j++) {
            ans = max(ans, dp[N][i][j]);
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:24: error: expected primary-expression before '=' token
   53 |     for(int i = 1; i < = N; i++) {
      |                        ^
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 timer[3001];
int del[3001];

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

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

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

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


Compiler output:
a.cc: In function 'int nap(int, int)':
a.cc:35:25: error: 'lefttime' was not declared in this scope; did you mean 'lefttimer'?
   35 |         return nap(i+1, lefttime);
      |                         ^~~~~~~~
      |                         lefttimer
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 timer[3001];
int del[3001];

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

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

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

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


Compiler output:
a.cc: In function 'int nap(int, int)':
a.cc:34:8: error: 'lefttime' was not declared in this scope; did you mean 'lefttimer'?
   34 |     if(lefttime < timer[i]){
      |        ^~~~~~~~
      |        lefttimer
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 timer[3001];
int del[3001];

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

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

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

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


Compiler output:
a.cc: In function 'int nap(int, int)':
a.cc:34:8: error: 'lefttime' was not declared in this scope; did you mean 'lefttimer'?
   34 |     if(lefttime < timer[i]){
      |        ^~~~~~~~
      |        lefttimer
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 lefttimer){
      |                ~~~~^~~~~~~~~
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 timer[3001];
int del[3001];

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

int nap(int i, int lefttimer){
    if(time < timer[i]){
        return nap(i+1, time);
    }
    return max(nap(i+1, lefttimer - timer[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: In function 'int nap(int, int)':
a.cc:34:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   34 |     if(time < timer[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 lefttimer){
      |                ~~~~^~~~~~~~~
a.cc:37:67: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
   37 |     return max(nap(i+1, lefttimer - timer[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 lefttimer){
      |                ~~~~^~~~~~~~~
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 time){
    if(time < time[i]){
        return nap(i+1, time);
    }
    return max(nap(i+1, time - 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:19: error: invalid types 'int[int]' for array subscript
   34 |     if(time < time[i]){
      |                   ^
a.cc:37:36: error: invalid types 'int[int]' for array subscript
   37 |     return max(nap(i+1, time - time[i]) + del[i],  nap(i+1, time));
      |                                    ^
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[3000+1];
int del[3000+1]

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 time){
    if(time < time[i]){
        return nap(i+1, time);
    }
    return max(nap(i+1, time - 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:16: error: 'int time [3001]' redeclared as different kind of entity
   21 | int time[3000+1];
      |                ^
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:24:1: error: expected initializer before 'void'
   24 | void input(){
      | ^~~~
a.cc: In function 'int nap(int, int)':
a.cc:34:19: error: invalid types 'int[int]' for array subscript
   34 |     if(time < time[i]){
      |                   ^
a.cc:37:36: error: invalid types 'int[int]' for array subscript
   37 |     return max(nap(i+1, time - time[i]) + del[i],  nap(i+1, time));
      |                                    ^
a.cc:37:43: error: 'del' was not declared in this scope
   37 |     return max(nap(i+1, time - time[i]) + del[i],  nap(i+1, time));
      |                                           ^~~
a.cc: In function 'void solve()':
a.cc:41:5: error: 'input' was not declared in this scope; did you mean 'int'?
   41 |     input();
      |     ^~~~~
      |     int
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    ofstream w_file("abc145_e.txt", ios::out);

    ll N, T;
    cin >> N >> T;
    vector<pair<ll, ll>> dish(N);
    Rep (i, N) {
        ll A, B;
        cin >> A >> B;
        dish[i] = make_pair(A, B);
    }

    vector<vector<ll>> dp(N+1, vector<ll>(T+1, 0)), dp2(N+1, vec(T+1, 0));
    Rep (i, N) {
        ll a = dish[i].first, b = dish[i].second;
        Rep (j, T+1) {
            chmax(dp[i+1][j], dp[i][j]);
            if (j-a >= 0) {
                chmax(dp[i+1][j-a], dp[i][j] + b);
            }
        }
    }

    for (ll i = N-1; i >= 0; i--) {
        ll a = dish[i].first, b = dish[i].second;
        Rep (j, T+1) {
            chmax(dp2[i][j], dp2[i+1][j]);
            if (j-a >= 0) chmax(dp2[i][j-a], dp2[i+1][j] + b);
        }
    }

    ll ans = 0;
    Rep (i, N) {
        ll tmp = 0;
        Rep (j, T) {
            chmax(tmp, dp[i][j] + dp2[i+1][T-1-j])
        }
        chmax(ans, tmp + dish[i].second);
    }

    cout << ans << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:71:51: error: expected ';' before '}' token
   71 |             chmax(tmp, dp[i][j] + dp2[i+1][T-1-j])
      |                                                   ^
      |                                                   ;
   72 |         }
      |         ~
Language: C++

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

int main(void){
    int n,t;
    vector< pair<int,int> > v, v_rev;
    cin >> n >> t;
    for(ll i=0; i<n; i++){
        ll a,b;
        cin >> a >> b;
        v.push_back(make_pair(a,b));
        v_rev.push_back(make_pair(a,b));
    }

    // 時間の順にsort
    sort(v.begin(), v.end());
    sort(v_rev.begin(), v_rev.end(), greater< pair<int,int> >());

    // dp[i][j] := 1番目~i番目までから選んで
    // 時間j以下で食べる時の満足度の最大値
    int dp_1[n+1][t];
    int dp_2[n+1][t];
    for(int i=0; i<=n; i++){
        for(int j=1; j<=t-1; j++){
            dp_1[i][j] = 0;
            dp_2[i][j] = 0;
        }
    }

    // dp_1
    for(int i=0; i<n; i++){
        for(int j=1; j<=t-1; j++){
            if(v[i].first > j){
                dp_1[i+1][j] = dp_1[i][j];
            }
            else{
                dp_1[i+1][j] = max(dp_1[i][j], dp_1[i][j-v[i].first]+v[i].second);
            }
        }
    }

    // dp_2
    for(int i=0; i<n; i++){
        for(int j=1; j<=t-1; j++){
            if(v_rev[i].first > j){
                dp_2[i+1][j] = dp_2[i][j];
            }
            else{
                dp_2[i+1][j] = max(dp_2[i][j], dp_2[i][j-v_rev[i].first]+v_rev[i].second);
            }
        }
    }

    int ans = 0;
    // 端以外
    for(int i=1; i<n; i++){
        for(int j=1; j<=t-1; j++){
            if(ans < dp_1[i-1][j] + dp_2[n-i-2][t-1-j] + v[i-1].second){
                ans = dp_1[i-1][j] + dp_2[n-i-2][t-1-j] + v[i-1].second;
            }
        }
    }
    // 端
    for(int j=1; j<=t-1; j++){
        if(ans < dp_2[n-1][t-1-j] + v[0].second){
            ans = dp_2[n-1][t-1-j] + v[0].second
        }
        if(ans < dp_1[n-1][t-1-j] + v[n-1].second){
            ans = dp_1[n-1][t-1-j] + v[n-1].second;
        }
    }
    cout << ans;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:70:49: error: expected ';' before '}' token
   70 |             ans = dp_2[n-1][t-1-j] + v[0].second
      |                                                 ^
      |                                                 ;
   71 |         }
      |         ~
Language: C++

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

int main(void){
    int n,t;
    vector< pair<int,int> > v, v_rev;
    cin >> n >> t;
    for(ll i=0; i<n; i++){
        ll a,b;
        cin >> a >> b;
        v.push_back(make_pair(a,b));
        v_rev.push_back(make_pair(a,b));
    }

    // 時間の順にsort
    sort(v.begin(), v.end());
    sort(v_rev.begin(), v_rev.end(), greater< pair<int,int> >());

    // dp[i][j] := 1番目~i番目までから選んで
    // 時間j以下で食べる時の満足度の最大値
    int dp_1[n+1][t];
    int dp_2[n+1][t];
    for(int i=0; i<=n; i++){
        for(int j=1; j<=t-1; j++){
            dp[i][j] = 0;
        }
    }

    // dp_1
    for(int i=0; i<n; i++){
        for(int j=1; j<=t-1; j++){
            if(v[i].first > j){
                dp_1[i+1][j] = dp_1[i][j];
            }
            else{
                dp_1[i+1][j] = max(dp_1[i][j], dp_1[i][j-v[i].first]+v[i].second);
            }
        }
    }

    // dp_2
    for(int i=0; i<n; i++){
        for(int j=1; j<=t-1; j++){
            if(v_rev[i].first > j){
                dp_2[i+1][j] = dp_2[i][j];
            }
            else{
                dp_2[i+1][j] = max(dp_2[i][j], dp_2[i][j-v_rev[i].first]+v_rev[i].second);
            }
        }
    }

    int ans = 0;
    // 端以外
    for(int i=1; i<n; i++){
        for(int j=1; j<=t-1; j++){
            if(ans < dp_1[i-1][j] + dp_2[n-i-2][t-1-j] + v[i-1].second){
                ans = dp_1[i-1][j] + dp_2[n-i-2][t-1-j] + v[i-1].second;
            }
        }
    }
    // 端
    for(int j=1; j<=t-1; j++){
        if(ans < dp_2[n-1][t-1-j] + v[0].second){
            ans = dp_2[n-1][t-1-j] + v[0].second
        }
        if(ans < dp_1[n-1][t-1-j] + v[n-1].second){
            ans = dp_1[n-1][t-1-j] + v[n-1].second;
        }
    }
    cout << ans;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:13: error: 'dp' was not declared in this scope; did you mean 'dup'?
   29 |             dp[i][j] = 0;
      |             ^~
      |             dup
a.cc:69:49: error: expected ';' before '}' token
   69 |             ans = dp_2[n-1][t-1-j] + v[0].second
      |                                                 ^
      |                                                 ;
   70 |         }
      |         ~
Language: C++

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

int main(void){
    int n,t;
    vector< pair<ll,ll> > v, v_rev;
    cin >> n >> t;
    for(ll i=0; i<n; i++){
        ll a,b;
        cin >> a >> b;
        v.push_back(make_pair(a,b));
        v_rev.push_back(make_pair(a,b));
    }

    // 時間の順にsort
    sort(v.begin(), v.end());
    sort(v_rev.begin(), v_rev.end(), greater< pair<int,int> >());

    // dp[i][j] := 1番目~i番目までから選んで
    // 時間j以下で食べる時の満足度の最大値
    int dp_1[n+1][t];
    int dp_2[n+1][t];
    for(int i=0; i<=n; i++){
        for(int j=1; j<=t-1; j++){
            dp[i][j] = 0;
        }
    }

    // dp_1
    for(int i=0; i<n; i++){
        for(int j=1; j<=t-1; j++){
            if(v[i].first > j){
                dp[i+1][j] = dp[i][j];
            }
            else{
                dp[i+1][j] = max(dp[i][j], dp[i][j-v[i].first]+v[i].second);
            }
        }
    }

    // dp_2
    for(int i=0; i<n; i++){
        for(int j=1; j<=t-1; j++){
            if(v_rev[i].first > j){
                dp[i+1][j] = dp[i][j];
            }
            else{
                dp[i+1][j] = max(dp[i][j], dp[i][j-v_rev[i].first]+v_rev[i].second);
            }
        }
    }

    int ans = 0;
    // 端以外
    for(int i=1; i<n; i++){
        for(int j=1; j<=t-1; j++){
            if(ans < dp_1[i-1][j] + dp_2[n-i-2][t-1-j] + v[i-1].second){
                ans = dp_1[i-1][j] + dp_2[n-i-2][t-1-j] + v[i-1].second;
            }
        }
    }
    // 端
    for(int j=1; j<=t-1; j++){
        if(ans < dp_2[n-1][t-1-j] + v[0].second){
            ans = dp_2[n-1][t-1-j] + v[0].second
        }
        if(ans < dp_1[n-1][t-1-j] + v[n-1].second){
            ans = dp_1[n-1][t-1-j] + v[n-1].second;
        }
    }
    cout << ans;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:13: error: 'dp' was not declared in this scope; did you mean 'dup'?
   29 |             dp[i][j] = 0;
      |             ^~
      |             dup
a.cc:37:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   37 |                 dp[i+1][j] = dp[i][j];
      |                 ^~
      |                 dup
a.cc:40:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   40 |                 dp[i+1][j] = max(dp[i][j], dp[i][j-v[i].first]+v[i].second);
      |                 ^~
      |                 dup
a.cc:49:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   49 |                 dp[i+1][j] = dp[i][j];
      |                 ^~
      |                 dup
a.cc:52:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   52 |                 dp[i+1][j] = max(dp[i][j], dp[i][j-v_rev[i].first]+v_rev[i].second);
      |                 ^~
      |                 dup
a.cc:69:49: error: expected ';' before '}' token
   69 |             ans = dp_2[n-1][t-1-j] + v[0].second
      |                                                 ^
      |                                                 ;
   70 |         }
      |         ~
Language: C++

#include <stdio.h>
#include <array>
#include <tuple>

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

using lli = long long int;

constexpr int N = 3000;
std::pair<int, int> A[N];
std::array<lli, N+1> R;

int main(void){
    int n, t; scanf("%d%d", &n, &t);
    REP(i, n) scanf("%d%d", &A[i].first, &A[i].second);
    std::sort(A, A+n);
    REP(i, n){
        int a = A[i].first, b = A[i].second;
        int j;
        for(j = t-1; j + a >= t; --j) if(R[t] < R[j] + b) R[t] = R[j] + b;
        for(; j >= 0; --j) if(R[j+a] < R[j] + b) R[j+a] = R[j] + b;
    }
    lli res = 0;
    for(int i = 0; i <= t; ++i) if(res < R[i]) res = R[i];
    printf("%lld\n", res);
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:17:10: error: 'sort' is not a member of 'std'
   17 |     std::sort(A, A+n);
      |          ^~~~
Language: C++

#include<iostream>
#include <vector>

#define lli long long
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define rep0(i,j) for(int i=0;i<j;i++)
#define rep1(i,j) for(int i=1;i<=j;i++)
#define rep0d(i,j) for(int i=j-1;i>=0;i--)
#define MOD 1000000007

using namespace std;

bool cmp(const pair<lli, lli> left, const pair<lli, lli> right) {
	return left.second < right.second;
}

lli f[1000000], rf[1000000];
lli inv(lli x) {
    lli res = 1;
    lli k = MOD - 2;
    lli y = x;
    while (k) {
        if (k & 1) res = (res * y) % MOD;
        y = (y * y) % MOD;
        k /= 2;
    }
    return res;
}
void init() {
    f[0] = 1;
    rep1(i, 1000000) f[i] = (f[i - 1] * i) % MOD;
    rep0(i, 1000001) rf[i] = inv(f[i]);
}
lli C(lli n, lli k) {
    lli a = f[n]; // = n!
    lli b = rf[n-k]; // = (n-k)!
    lli c = rf[k]; // = k!

    lli bc = (b * c) % MOD;

    return (a * bc) % MOD;
}

int main() {
    lli n,t;
    cin >> n >> t;

    vector<vector<lli>> a(t+1);
    rep0(i,n){
        lli tem1,tem2;
        cin >> tem1 >> tem2;
        if(tem1>=t){
            a[t].push_back(tem2);
        }else{
            a[tem1].push_back(tem2);
        }
    }
    rep1(i,t)sort(all(a[i]),greater<lli>());

    vector<vector<lli>> wh(t,vector<lli>(t+1,0));
    vector<lli> size(t+1,0);
    rep1(i,t-1){
        lli temp=0,maxsize=0,num=-1;
        rep1(j,i){
            if((temp=wh[i-j][j])>=a[j].size())continue;
            if(maxsize <= size[i-j] + a[j][temp]){
                maxsize=size[i-j] + a[j][temp];
                num = j;
            }
        }
        if(num!=-1){
            wh[i] = wh[i-num];
            wh[i][num]++;
            size[i]=maxsize;
        }else{
            wh[i] = wh[i-1];
            size[i] = size[i-1];
        }
    }
    lli temp=0,maxsize=0;
  rep1(j,t-1)
    rep1(i,t){
        if((temp=wh[j][i])>=a[i].size())continue;
        if(maxsize < size[j]+a[i][temp]){
            maxsize = size[j]+a[i][temp];
        }
    }

    cout << maxsize;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:59:14: error: 'sort' was not declared in this scope; did you mean 'short'?
   59 |     rep1(i,t)sort(all(a[i]),greater<lli>());
      |              ^~~~
      |              short
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
long long maximum;
long long mod = 1000000007;
const int INF = 1001001001;
vector<vector<int>> dp;

int main(){
  int n,t;
  cin >> n >> t;
  vector<pair<int,int>> sushi(n);
  for(int i=0;i<n;i++){
    int a;
    cin >> a;
    sushi.at(i).first = a;
    int b;
    cin >> b;
    sushi.at(i).second = b;
  }
  sort(sushi.begin(),it, [](const pair<int,int> a, const pair<int,int> b) {
    if(a.first != b.first) return a.first < b.first; 
    else return a.second > b.second;
  });

  dp.resize(n,vector<int>(t,0));
  for(int i=1;i<n;i++){
    for(int j=0;j<t;j++){
      if(j<sushi.at(i-1).first){
        dp.at(i).at(j) = dp.at(i-1).at(j); 
      }else{
        dp.at(i).at(j) = max(dp.at(i-1).at(j),dp.at(i-1).at(j- sushi.at(i-1).first)+sushi.at(i-1).second);
      }
    }
  }
  cout << dp.at(n-1).at(t-1) + sushi.at(n-1).second << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:22: error: 'it' was not declared in this scope; did you mean 't'?
   21 |   sort(sushi.begin(),it, [](const pair<int,int> a, const pair<int,int> b) {
      |                      ^~
      |                      t
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
long long maximum;
long long mod = 1000000007;
const int INF = 1001001001;
vector<vector<int>> dp;

int main(){
  int n,t;
  cin >> n >> t;
  vector<pair<int,int>> sushi(n);
  for(int i=0;i<n;i++){
    int a;
    cin >> a;
    sushi.at(i).first = a;
    int b;
    cin >> b;
    sushi.at(i).second = b;
  }
  sort(sushi.begin(),it, [](const pair<int,int> a, const pair<int,int> b) {
    if(a.first != b.first) return a.first < b.first; 
    else return a.second > b.second;
  });
  for(int i=0;i<n;i++){
    cout << i<<" "<<sushi.at(i).first << " " << sushi.at(i).second << endl;
  }
  dp.resize(n,vector<int>(t,0));
  for(int i=1;i<n;i++){
    for(int j=0;j<t;j++){
      if(j<sushi.at(i-1).first){
        dp.at(i).at(j) = dp.at(i-1).at(j); 
      }else{
        dp.at(i).at(j) = max(dp.at(i-1).at(j),dp.at(i-1).at(j- sushi.at(i-1).first)+sushi.at(i-1).second);
      }
    }
  }
  cout << dp.at(n-1).at(t-1) + sushi.at(n-1).second << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:22: error: 'it' was not declared in this scope; did you mean 't'?
   21 |   sort(sushi.begin(),it, [](const pair<int,int> a, const pair<int,int> b) {
      |                      ^~
      |                      t
Language: C++

// 解説PDF https://img.atcoder.jp/abc145/editorial.pdf
// の解法2を実装

#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>


using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple

ll solve(ll N, ll T, vector<ll>& A, vector<ll>& B) {
    
    vector<pair<ll, ll>> AB(N);
    REP(n, N) {
        ll a = A[n];
        ll b = B[n];
        AB[n] = mp(a, b);
    }
    sort(ALL(AB));
    cout << dp_solver(A, B, T) << endl;
}

int main(void)
{
    cin.sync_with_stdio(false);
    ll N, T;
    cin >> N >> T;
    vector<ll> A(N);
    vector<ll> B(N);

    REP(n, N) {
        ll a, b;
        cin >> a >> b;
        A[n] = a;
        B[n] = b;
    }
    cout << solve(N, T, A, B) << endl;
    return 0;
}


Compiler output:
a.cc: In function 'll solve(ll, ll, std::vector<long long int>&, std::vector<long long int>&)':
a.cc:47:13: error: 'dp_solver' was not declared in this scope
   47 |     cout << dp_solver(A, B, T) << endl;
      |             ^~~~~~~~~
a.cc:48:1: warning: no return statement in function returning non-void [-Wreturn-type]
   48 | }
      | ^
Language: C++

// May this submission get accepted!

#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define STEP(i, is, ie, step) for (long long i=(is), i##_end=(ie), i##_step = (step); i<=i##_end; i+=i##_step)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) do { cerr << "[DEBUG] " #q ": ["; REP(i, (q).size()) { cerr << (q)[i] << (i == i_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; } while (false)
template<class T> T gcd(T a, T b) { if (a < b) std::swap(a, b); while (b) std::swap(a %= b, b); return a; }
template<class T> T lcm(const T a, const T b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
#define CHOKUDAI_ const
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using cll = DANCE_ DANCE_ CHOKUDAI_;
using  ld = long double;
using namespace std;

// モジュール

// 処理内容
int main() {
    
    // インタラクティブ問題では除去した方がいいかも
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    ll n, t; cin >> n >> t;
    vector<ll> a(n), b(n);
    REP(i, n) cin >> a[i] >> b[i];

    vector<ll> r(n);
    iota(ALL_OF(r), 0LL);
    sort(ALL_OF(r), [&](ll i, ll j) {
        return a[i] < a[j];
    });
    
    vector<vector<ll>> dp(n+1, vector<ll>(t, 0));
    REP(_i, n) { ll i = r[_i];
        REP(w, t) {
            if (0 <= w - a[i]) {
                // 食べるかもしれない
                dp[i+1][w] = max(dp[i][w], dp[i][w - a[i]] + b[i]);
            } else {
                // 食べ(られ)ない
                dp[i+1][w] = dp[i][w];
            }
        }
    }
    
    ll ans = 0;
    REP(i, n) {
        chmax(ans, b[i] + *max_element(ALL_OF(dp[i]));
    }
    cout << ans << endl;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:78:54: error: expected ')' before ';' token
   78 |         chmax(ans, b[i] + *max_element(ALL_OF(dp[i]));
      |              ~                                       ^
      |                                                      )
Language: C++

// May this submission get accepted!

#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define STEP(i, is, ie, step) for (long long i=(is), i##_end=(ie), i##_step = (step); i<=i##_end; i+=i##_step)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) do { cerr << "[DEBUG] " #q ": ["; REP(i, (q).size()) { cerr << (q)[i] << (i == i_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; } while (false)
template<class T> T gcd(T a, T b) { if (a < b) std::swap(a, b); while (b) std::swap(a %= b, b); return a; }
template<class T> T lcm(const T a, const T b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
#define CHOKUDAI_ const
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using cll = DANCE_ DANCE_ CHOKUDAI_;
using  ld = long double;
using namespace std;

// モジュール

// 処理内容
int main() {
    
    // インタラクティブ問題では除去した方がいいかも
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    ll n, t; cin >> n >> t;
    vector<ll> a(n), b(n);
    REP(i, n) cin >> a[i] >> b[i];

    vector<ll> r(n);
    iota(ALL_OF(r), 0LL);
    sort(ALL_OF(r), [&](ll i, ll j) {
        return a[i] < a[j];
    });
    
    vector<vector<ll>> dp(n+1, vector<ll>(t+3005, 0));
    REP(_i, n) { ll i = r[_i];
        REP(w, t+3005) {
            if (0 <= w - a[i] && w - a[i] < t) {
                // 食べるかもしれない
                dp[i+1][w] = max(dp[i][w], dp[i][w - a[i]] + b[i]);
            } else if (w < t[i]) {
                // 食べ(られ)ない
                dp[i+1][w] = dp[i][w];
            }
        }
    }
    
    ll ans = 0;
    REP(i, n) REP(j, t+3005) {
        chmax(ans, dp[i][j]);
    }
    cout << ans << endl;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:69:29: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
   69 |             } else if (w < t[i]) {
      |                             ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int memo[3123][3123],N,T;

vector <pair <int,int> > vet;

int Ray(int pos, int tempo){
	if (pos == N)
		return 0;
	if (tempo >= T)
		return 0;
	if (memo[pos][tempo] != -1)
		return memo[pos][tempo];

	return memo[pos][tempo]=max(Ray(pos+1,tempo),Ray(pos+1,tempo+vet[pos].first)+vet[pos].second);
}
int main() {
	int aux1,aux2;
	scanf("%d%d", &N, &T);
	memset(memo, -1, sizeof(memo));
	for (int i = 0;i < N;i++) {
		scanf("%d%d", &aux1,&aux2);
		vet.push_back(make_pair(aux1,aux2));
	}
  sort(vet.begin(), v.end());

	printf("%d\n",Ray(0,0));

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:21: error: 'v' was not declared in this scope
   27 |   sort(vet.begin(), v.end());
      |                     ^
Language: Java

import java.util.Scanner;
import java.util.Arrays;
import java.util.Comparator;

public class ABC145E {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int T = sc.nextInt();
        int[][] AB = new int[N][2];
        for (int i = 0; i < N; i++) {
            AB[i][0] = sc.nextInt();
            AB[i][1] = sc.nextInt();
        }

        Arrays.sort(AB, new Comparator<int[]>() {
            public int compare(int[] a, int[] b) {
                return Integer.compare(a[0], b[0]);
            }
        });

        int[][] ot = new int[N+1][T];
        int[][] ft = new int[N+1][T];

        for (int i = 0; i < N; i++) {
            for (int j = 0; j < T; j++) {
                int finishTime = ft[i][j];
                if (j >= AB[i][0]) {
                    finishTime = Math.max(finishTime, ft[i][j-AB[i][0]] + AB[i][1]);
                }
                ft[i+1][j] = finishTime;

                ot[i+1][j] = Math.max(ot[i][j], ft[i][j] + AB[i][1]);
            }
        }
        System.out.println(ot[N][T-1]);
    }
}


Compiler output:
Main.java:5: error: class ABC145E is public, should be declared in a file named ABC145E.java
public class ABC145E {
       ^
1 error
Language: Java

import java.util.Scanner;

public class ABC145E {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int T = sc.nextInt();
        int[] A = new int[N];
        int[] B = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
            B[i] = sc.nextInt();
        }

        int[][] ot = new int[N+1][T];
        int[][] ft = new int[N+1][T];

        for (int i = 0; i < N; i++) {
            for (int j = 0; j < T; j++) {
                int finishTime = ft[i][j];
                if (j >= A[i]) {
                    finishTime = Math.max(finishTime, ft[i][j-A[i]] + B[i]);
                }
                ft[i+1][j] = finishTime;

                ot[i+1][j] = Math.max(ot[i][j], ft[i][j] + B[i]);
            }
        }

        int max = 0;
        for (int j = 0; j < T; j++) {
            max = Math.max(max, ot[N][j]);
        }

        System.out.println(max);
    }
}


Compiler output:
Main.java:3: error: class ABC145E is public, should be declared in a file named ABC145E.java
public class ABC145E {
       ^
1 error
Language: C++

#include <iostream>
#include <queue>
#include <algorithms>
using namespace std;

pair<int, int> sira[3000];
int deger[3000], sure[3000], taban=0, test=0, t, n, g, current, max_deger;

int main(void){
	cin>>n>>t;
	int x, y;
	for(int i=0;i<n;i++){
		cin>>x>>y;
		deger[i]=y;
		sure[i]=x;
		sira[i]=make_pair(y*1000/x, i);
		max_deger=max(mex_deger, y);
	}
	sort(sira, sira+3000);
	while(sure[sira[taban].second]+g<t){
		current+=deger[sira[taban].second];
		g+=sure[sira[taban].second];
		taban++;
		test++;
	}
	for(;test<n;test++)if(sure[sira[test].second]+g<t){
		current+=deger[sira[test].second];
		g+=sure[sira[test].second];
		test++;
	}
	current+=max_deger;
	cout<<current;
	
	
	return 0;
}



Compiler output:
a.cc:3:10: fatal error: algorithms: No such file or directory
    3 | #include <algorithms>
      |          ^~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int N, T;
vector<pair<int, int>> dishes;
int cache[3001][3001];

int dp(int index, int time) {
  if (index == N || time <= 0) {
    return 0;
  }

  if (cache[index][time] == -1) {
    cache[index][time] = max(dp(index + 1, time), dp(index + 1, time - dishes[index].first) + dishes[index].second);
  }

  return cache[index][time];
}

int solve() {
  sort(dishes.begin(), dishes.end());

  return dp(0, T - 1);
}

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

  dishes = vector<pair<int, int>>(N);
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < T; ++j) {
      cache[i][j] = -1;
    }
  }

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

  cout << solve() << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int solve()':
a.cc:23:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   23 |   sort(dishes.begin(), dishes.end());
      |   ^~~~
      |   short
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,T;cin>>N>>T;
  vector<int> A(N),B(N);
  for(int i=0;i<N;i++)cin>>A[i]>>B[i];
  int tmax=0;
  for(int i=0;i<N;i++){if(tmax<A[i])tmax=A[i];}
  vector<vector<int>>DP(T+1+tmax,vector<int>(N,0));
  int ans=0;
  for(int j=1;j<T+1+tmax;j++){
    for(int i=0;i<N;i++){
      //品物iを加えるかどうか
      if(j-A[i]>=0 && j-A[i]<T){
        if(i==0)DP[j][i]=B[i];
        else DP[j][i]=max(DP[j][i-1],DP[j-A[i]][i-1]+B[i]);
      }
      else{
        if(i==0)DP[j][i]=DP[j-1][i];
        else DP=max(DP[j-1][i],DP[j][i-1]);
        
      }
      
      if(DP[j][i]>ans)ans=DP[j][i];
    }
  } 
  cout<<ans;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:20:42: error: no match for 'operator=' (operand types are 'std::vector<std::vector<int> >' and 'const int')
   20 |         else DP=max(DP[j-1][i],DP[j][i-1]);
      |                                          ^
In file included from /usr/include/c++/14/vector:72,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'const int' to 'const std::vector<std::vector<int> >&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'const int' to 'std::vector<std::vector<int> >&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'const int' to 'std::initializer_list<std::vector<int> >'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~