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

#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

constexpr int MAX = 1000000000;
constexpr int MOD = 1000000007;

ll fact[MAX], fact_inv[MAX];

ll power(ll a, ll b)
{
	ll res=1;
	while(b>0){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		b>>=1;
	}
	return res;
}

void init(ll n)
{
	fact[0]=1;
  for (ll i = 0; i < n; ++i) {
    fact[i+1]=fact[i]*(i+1)%MOD;
  }
	fact_inv[n]=power(fact[n], MOD-2);
  for (ll i = n - 1; i >= 0; --i) {
    fact_inv[i]=fact_inv[i+1]*(i+1)%MOD;
  }
}

ll comb(ll n, ll r)
{
	return (fact[n]*fact_inv[r])%MOD*fact_inv[n-r]%MOD;
}

void solve(void)
{
  ll X, Y; cin >> X >> Y;
  ll Z = Y - X;
  ll a{}, b{};
  if (Z > 0) {
    ll c = 2*Z + X;
    if (c % 3 != 0) {
      cout << 0 << CRLF;
      return;
    }
    a = c / 3;
    b = a - Z;
  } else if (Z < 0) {
    Z = -Z;
    ll c = Z + X;
    if (c % 3 != 0) {
      cout << 0 << CRLF;
      return;
    }
    b = c / 3;
    a = b - Z;
  } else {
    if (X % 3 != 0) {
      cout << 0 << CRLF;
      return;
    }
    ll c = 2*Y - X;
    if (c % 3 != 0) {
      cout << 0 << CRLF;
      return;
    }
    b = c / 3;
    a = b - Z;
  }

  init(a + b);
  auto ans = comb(a + b, a);

  cout << ans << CRLF;
  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


Compiler output:
a.cc:2:10: fatal error: boost/range/algorithm.hpp: No such file or directory
    2 | #include <boost/range/algorithm.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<stdio.h>
#include<algorithm>
#include<map>
using namespace std;
int toR, toC;
map< pair<int,int>, int  > memo;
int solve(int r, int c) {
  if (toR == r && toC == c) return 1;
  if (r > toR || c > toC) return 0;
  if (memo.count(make_pair(r,c)) > 0) 
    return memo[make_pair(r,c)];
  int ans = solve(r+1,c+2);
  ans %= 1000000007;
  ans += solve(r+2,c+1);
  ans %= 1000000007
  return memo[make_pair(r,c)] = ans;
}

int main() {
  scanf("%d%d", &toR, &toC);
  printf("%d\n", solve(0,0));
  return 0;
}


Compiler output:
a.cc: In function 'int solve(int, int)':
a.cc:15:20: error: expected ';' before 'return'
   15 |   ans %= 1000000007
      |                    ^
      |                    ;
   16 |   return memo[make_pair(r,c)] = ans;
      |   ~~~~~~            
a.cc:15:7: warning: control reaches end of non-void function [-Wreturn-type]
   15 |   ans %= 1000000007
      |   ~~~~^~~~~~~~~~~~~
Language: C++

#include<stdio.h>
#include<algorithm>
#include<map>
using namespace std;
int toR, toC;
memo< pair<int,int>, int  > memo;
int solve(int r, int c) {
  if (toR == r && toC == c) return 1;
  if (r > toR || c > toC) return 0;
  if (memo.count(make_pair(r,c)) > 0) 
    return memo[make_pair(r,c)];
  int ans = solve(r+1,c+2);
  ans %= 1000000007;
  ans += solve(r+2,c+1);
  ans %= 1000000007
  return memo[make_pair(r,c)] = ans;
}

int main() {
  scanf("%d%d", &toR, &toC);
  printf("%d\n", solve(0,0));
  return 0;
}


Compiler output:
a.cc:6:1: error: 'memo' does not name a type
    6 | memo< pair<int,int>, int  > memo;
      | ^~~~
a.cc: In function 'int solve(int, int)':
a.cc:10:7: error: 'memo' was not declared in this scope
   10 |   if (memo.count(make_pair(r,c)) > 0)
      |       ^~~~
a.cc:15:20: error: expected ';' before 'return'
   15 |   ans %= 1000000007
      |                    ^
      |                    ;
   16 |   return memo[make_pair(r,c)] = ans;
      |   ~~~~~~
Language: C++

#include<stdio.h>
#include<algorithm>
#include<map>
using namespace std;
int toR, toC;

int solve(int r, int c) {
  if (toR == r && toC == c) return 1;
  if (r > toR || c > toC) return 0;
  if (memo.count(make_pair(r,c)) > 0) 
    return memo[make_pair(r,c)];
  int ans = solve(r+1,c+2);
  ans %= 1000000007;
  ans += solve(r+2,c+1);
  ans %= 1000000007
  return memo[make_pair(r,c)] = ans;
}

int main() {
  scanf("%d%d", &toR, &toC);
  printf("%d\n", solve(0,0));
  return 0;
}


Compiler output:
a.cc: In function 'int solve(int, int)':
a.cc:10:7: error: 'memo' was not declared in this scope
   10 |   if (memo.count(make_pair(r,c)) > 0)
      |       ^~~~
a.cc:15:20: error: expected ';' before 'return'
   15 |   ans %= 1000000007
      |                    ^
      |                    ;
   16 |   return memo[make_pair(r,c)] = ans;
      |   ~~~~~~
Language: C++

#include<stdio.h>

int toR, toC;

int solve(int r, int c) {
  if (toR == r && toC == c) return 1;
  if (r > toR || c > toC) return 0;
  if (memo.count(make_pair(r,c)) > 0) 
    return memo[make_pair(r,c)];
  int ans = solve(r+1,c+2);
  ans %= 1000000007;
  ans += solve(r+2,c+1);
  ans %= 1000000007
  return memo[make_pair(r,c)] = ans;
}

int main() {
  scanf("%d%d", &toR, &toC);
  printf("%d\n", solve(0,0));
  return 0;
}

Compiler output:
a.cc: In function 'int solve(int, int)':
a.cc:8:7: error: 'memo' was not declared in this scope
    8 |   if (memo.count(make_pair(r,c)) > 0)
      |       ^~~~
a.cc:8:18: error: 'make_pair' was not declared in this scope
    8 |   if (memo.count(make_pair(r,c)) > 0)
      |                  ^~~~~~~~~
a.cc:13:20: error: expected ';' before 'return'
   13 |   ans %= 1000000007
      |                    ^
      |                    ;
   14 |   return memo[make_pair(r,c)] = ans;
      |   ~~~~~~
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#include <iostream>
#include <stdlib.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define MOD (1000000007)
using namespace std; 

 
long int nCr(long int n, long int r){
        if(r==n || r==0 || n==1){ return 1; }
        else{
                return (nCr(n-1,r-1) + nCr(n-1,r) % MOD);
        }
}

int main(){ 
        long int X,Y;
        cin >> X >> Y;
        long double x,y;
        long int xc,yc;
        long int ans = 0;
        x = (4*X - 2*Y)/3.0;
        y = (4*Y - 2*X)/3.0;
        if(ceil(x)==floor(x) && x>=0 && ceil(y)==floor(y) && y>=0){
                xc = x;
                yc = y;
                ans = nCr(xc+xy,min(xc,xy));
        }
        cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:30: error: 'xy' was not declared in this scope; did you mean 'xc'?
   28 |                 ans = nCr(xc+xy,min(xc,xy));
      |                              ^~
      |                              xc
Language: C++

X,Y = map(int,input().split())
if Y < X:
    X,Y = Y,X

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result = result * int(numerator[k]) % (1e9+7)

    return result


if 2 * X < Y or X > 2 * Y or (X+Y)%3 != 0:
    print(0)
else:
    D = 1e9+7
    M = (X+Y)//3
    m = (2*X-Y)//3
    n=(2*Y-X)//3 
    res = cmb(M,m) % D
    """for i in range(M, M-m,-1):
        res *= i 
    for i in range(1,m+1):
        res //= i """
    print(int(res))


Compiler output:
a.cc:37:7: warning: missing terminating " character
   37 |     """for i in range(M, M-m,-1):
      |       ^
a.cc:37:7: error: missing terminating " character
   37 |     """for i in range(M, M-m,-1):
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:1:1: error: 'X' does not name a type
    1 | X,Y = map(int,input().split())
      | ^
Language: Java

import java.io.*;
import java.util.StringTokenizer;

public class main {
    public static PrintWriter out = new PrintWriter(System.out);
    public static FastScanner enter = new FastScanner(System.in);
    public static void main(String[] args) throws IOException {
        solve();
        out.close();
    }

    static long mod=(long)1e9+7;
    static long arr[] = new long[(int)1e6+2];
    private static void solve() throws IOException{
        int x=enter.nextInt(),y=enter.nextInt();
        if(2*x-y<0 || (2*x-y)%3!=0 ||2*y-x<0 || (2*y-x)%3!=0){
            out.println(0);
            return;
        }
        int a=(2*x-y)/3;
        int n=(y+x)/3;
        long n_fact=1;
        arr[1]=1;
        arr[0]=1;
        for(int i=2;i<arr.length;i++){
            arr[i]=arr[i-1]*i;
            arr[i]%=mod;
        }
        long ans=bin_pow(arr[a],mod-2, mod)*bin_pow(arr[n-a],mod-2, mod);
        ans%=mod;
        ans*=arr[n];
        ans%=mod;
        out.println((ans%mod+mod)%mod);
    }

    public static long bin_pow(long a,long b, long mod){//a^b %mod
        long ans=1;
        while(b!=0){
            if((b&1)==1) ans*=a;
            a*=a;
            ans%=mod;
            a%=mod;
            b>>=1;
        }
        return ans%mod;
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer stok;

        FastScanner(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }

        String next() throws IOException {
            while (stok == null || !stok.hasMoreTokens()) {
                String s = br.readLine();
                if (s == null) {
                    return null;
                }
                stok = new StringTokenizer(s);
            }
            return stok.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        char nextChar() throws IOException {
            return (char) (br.read());
        }

        String nextLine() throws IOException {
            return br.readLine();
        }
    }


}


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

MOD=1000000007
X,Y=map(int,input().split())
def comb(n,k,p):
  """power_funcを用いて(nCk) mod p を求める"""
  from math import factorial
  if n<0 or k<0 or n<k: return 0
  if n==0 or k==0: return 1
  a=factorial(n) %p
  b=factorial(k) %p
  c=factorial(n-k) %p
  return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p
def power_func(a,b,p):
  """a^b mod p を求める"""
  if b==0: return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return d*d %p
  if b%2==1:
    return (a*power_func(a,b-1,p ))%p

if 2*X-Y>=0 and (2*X-Y)%3==0 and 2*Y-X>=0 and (2*Y-X)%3==0:
    n = (2*X-Y)//3
    m = (2*Y-X)//3
    res=comb(n+m,n,MOD)
    print(res)

else:print(0)

Compiler output:
a.cc:1:1: error: 'MOD' does not name a type
    1 | MOD=1000000007
      | ^~~
Language: C++

#include<bits/stdc++.h>
#define ll long long
#define p 1000000007
using namespace std;
ll quick_mod(ll a, ll b)
{
    ll ans = 1;
    a %= p;
    while(b)
    {
        if(b & 1)
        {
            ans = ans * a % p;
            b--;
        }
        b >>= 1;
        a = a * a % p;
    }
    return ans;
}
 
ll C(ll n, ll m)
{
    if(m > n) return 0;
    ll ans = 1;
    for(int i=1; i<=m; i++)
    {
        ll a = (n + i - m) % p;
        ll b = i % p;
        ans = ans * (a * quick_mod(b, p-2) % p) % p;
    }
    return ans;
}

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 f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(x) (ll) __builtin_popcount(x)
#define fs first
#define sc second
#define pb push_back
#define po pop_back
#define mp make_pair  
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tsie(nullptr);cout.tie(nullptr)
 #define watch(x) cout<<(#x)<<" is " <<x<<"\n"

#define PI 3.1415926535
using namespace std;
typedef long long ll;
typedef long double ld; 
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
const ll mod = 1e9 + 7;
const ll MAX = 3e3+7;
const ll inf = 1e18+1;
ll a[MAX],b[MAX],dp[MAX][4];
int main(){
 fastio;
 ll n,t;
 cin>>n>>t;

 f(i,0,n){
    cin>>a[i]>>b[i];
 }

 f(i,0,n){
    af(j,t,0){
        if(t>a[i]+j){
        dp[j+a[i]][0] = max(dp[j+a[i]][0],dp[j][0] + b[i]);
        dp[j+a[i]][1] = max(dp[j+a[i]][1],dp[j][1] + b[i]);
        }
        dp[j][1] = max(dp[j][1],dp[j][0]+b[i]);
    }a
 }
 cout<<dp[t-1][1]<<"\n";
 return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:7: error: expected ';' before '}' token
   47 |     }a
      |       ^
      |       ;
   48 |  }
      |  ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,T; cin>>N>>T;
  vector<pair<int,int>>A(N);
  for(int i=0;i<N;i++)cin>>A[i].first>>A[i].second;
  vector<int>DP(T);
  long long ans=0;
  for(int i=0;i<T;i++){
    for(int j=0;j<N;j++){
      if(i+A[j].first>=T)ans=max(ans,DP[i]+A[j].second);
      else DP[i+A[j].first]=max(DP[i+A[j].first],DP[i]+A[j].second);
    }
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:33: error: no matching function for call to 'max(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)'
   11 |       if(i+A[j].first>=T)ans=max(ans,DP[i]+A[j].second);
      |                              ~~~^~~~~~~~~~~~~~~~~~~~~~~
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:11:33: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   11 |       if(i+A[j].first>=T)ans=max(ans,DP[i]+A[j].second);
      |                              ~~~^~~~~~~~~~~~~~~~~~~~~~~
/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:11:33: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   11 |       if(i+A[j].first>=T)ans=max(ans,DP[i]+A[j].second);
      |                              ~~~^~~~~~~~~~~~~~~~~~~~~~~
Language: Java

package coding;
import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
public class codeforces{
	static BufferedReader br;
	static int cin() throws Exception
	{
		return Integer.valueOf(br.readLine());
	}
	static int[] split() throws Exception
	{
		String[] cmd=br.readLine().split(" ");
		int[] ans=new int[cmd.length];
		for(int i=0;i<cmd.length;i++)
		{
			ans[i]=Integer.valueOf(cmd[i]);
		}                                              
		return ans;
	} 
	static long mod=1000000007;
	static long power(long x,long y) 
    { 
        long res = 1; 
        x = x % mod; 
        while (y > 0) { 
            if (y % 2 == 1) 
                res = (res * x) % mod; 
            y = y >> 1;
            x = (x * x) % mod; 
        } 
        return res%mod; 
    } 
    static long modInverse(long n) 
    { 
        return power(n, mod-2); 
    } 
    static int[]h;
    static int[]t;
    static int[][]dp;
    static int knapsack(int ind,int capacity)
    {
    	if((double)capacity<(double)0.5)
    		return 0;
    	if(ind==h.length)
    		return 0;
    	if(dp[ind][capacity]!=-1)
    		return dp[ind][capacity];
    	int res=Math.max(knapsack(ind+1,capacity),h[ind]+knapsack(ind+1,capacity-t[ind]));
    	dp[ind][capacity]=res;
    	return res;
    }
    public static void main(String[] args) throws Exception {
        br = new BufferedReader(new InputStreamReader(System.in));
        int[]ar=split();
        int n=ar[0];
        int k=ar[1];
        t=new int[n];
        h=new int[n];
        for(int i=0;i<n;i++)
        {
        	ar=split();
        	t[i]=ar[0];
        	h[i]=ar[1];
        }
        dp=new int[n+1][k+1];
        for(int i=0;i<=n;i++)
        {
        	Arrays.fill(dp[i],-1);
        }
        System.out.println(knapsack(0,k));
    }
}

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

using ll = long long;
using P = pair<int,int>;
template<typename T>
using field = vector<vector<T>>;

template<class T> inline bool chmax(T& a,T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  int n,t;
  cin >> n >> t;
  vector<P> data(n);
  rep(i,0,n) {
    int a,b;
    cin >> a >> b;
    data[i] = P(a,b);
  }
  sort(data.begin(), data.end());
  field<int> dp(n+1,vector<int>(t+1,0));
  int ans = 0;
  rep(i,0,n) {
    int a = data[i].first, b = data[i].second;
    rep(j,0,t) {
      chmax(dp[i+1][j],dp[i][j]);
      if (j+a < t) {
        chmax(dp[i+1][j+a],dp[i][j]+b);
      }
    }
    chmax(ans,dp[i][t-1]+b);
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc:2:11: error: 'pair' does not name a type
    2 | using P = pair<int,int>;
      |           ^~~~
a.cc:4:15: error: 'vector' does not name a type
    4 | using field = vector<vector<T>>;
      |               ^~~~~~
a.cc: In function 'int main()':
a.cc:16:3: error: 'cin' was not declared in this scope
   16 |   cin >> n >> t;
      |   ^~~
a.cc:17:3: error: 'vector' was not declared in this scope
   17 |   vector<P> data(n);
      |   ^~~~~~
a.cc:17:10: error: 'P' was not declared in this scope
   17 |   vector<P> data(n);
      |          ^
a.cc:17:13: error: 'data' was not declared in this scope
   17 |   vector<P> data(n);
      |             ^~~~
a.cc:18:7: error: 'i' was not declared in this scope
   18 |   rep(i,0,n) {
      |       ^
a.cc:18:3: error: 'rep' was not declared in this scope
   18 |   rep(i,0,n) {
      |   ^~~
a.cc:23:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   23 |   sort(data.begin(), data.end());
      |   ^~~~
      |   short
a.cc:24:3: error: 'field' was not declared in this scope; did you mean 'friend'?
   24 |   field<int> dp(n+1,vector<int>(t+1,0));
      |   ^~~~~
      |   friend
a.cc:24:9: error: expected primary-expression before 'int'
   24 |   field<int> dp(n+1,vector<int>(t+1,0));
      |         ^~~
a.cc:36:3: error: 'cout' was not declared in this scope
   36 |   cout << ans << endl;
      |   ^~~~
a.cc:36:18: error: 'endl' was not declared in this scope
   36 |   cout << ans << endl;
      |                  ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define pb push_back
typedef pair<ll,ll> ipair;
#define F first
#define S second
 
/*
//functions from gfg
 
long long int power(long long int x,long long int y,long long  int p)
{
    long long int res = 1;     // Initialize result
 
    x = x % p;  // Update x if it is more than or 
                // equal to p
 
    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            {//d=(long double)x/p;
            res = (res*x) % p;
            }
 
        // y must be even now
        y = y>>1; // y = y/2
        x=(x*x)%p;
        
    }
    return res%p;
}
 
long long int gcd(long long int a,long long int b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
}
 
long long int binomialCoeff(long long int n, ll k) 
{ 
    ll res = 1; 
  
    // Since C(n, k) = C(n, n-k) 
    if (k > n - k) 
        k = n - k; 
  
    // Calculate value of [n*(n-1)*---*(n-k+1)] / [k*(k-1)*---*1] 
    for (ll i = 0; i < k; ++i) 
    { 
        res *= (n - i); 
        res /= (i + 1); 
    } 
  
    return res; 
} 
 

void sieve(int n, vector<ll> &primes) 
{ 
    vector<int> prime(n,1);
    ll p;
    for ( p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == 1) 
        { 
            
            for (int i=p*p; i<=n; i += p) 
                prime[i] = 0; 
        } 
    } 
  
    for(p=2;p<=n;p++)
    {
        if(prime[p])
        primes.pb(p);
    }
   
} 


void dfs(vector<ll> adj[] ,ll src,vector<ll> &vis)
{
    vis[src]=1;
    for(ll i=0;i<adj[src].size();i++)
    {
        if(vis[adj[src][i]]==0)
        dfs(adj,adj[src][i],vis)
    }
}
 
*/

int main() {
	ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cout.tie(NULL);
    
    
	ll n,i,j,p,k,m,ans=0;
    cin>>n>>t;
    ll dp[3005][3005];
    memset(dp, 0, sizeof(dp)); 
    vector<ll> a(n),b(n);
    vector<pair<ll,ll> > val(n);
    for(i=0;i<n;i++)
    {
        cin>>a[i]>>b[i];
        val[i].F=a[i];
        val[i].S=b[i];
    }
    sort(val.begin(),val.end());
    for(i=0;i<n;i++)
    {
        a[i]=val[i].F;
        b[i]=val[i].S;
    }
    for(i=0;i<t;i++)
    {
        for(j=0;j<n;j++)
        {
            if(i+a[j]<t)
            {
                dp[j+1][i+a[j]] = max(dp[j][i]+b[j],dp[j+1][i+a[j]]);
            }
            else
            {
                //>=t means that jth element will be last one picked.
                ans= max(ans,dp[j][i]+b[j]);
            }
            dp[j+1][i] = max(dp[j][i],dp[j+1][i]);
            
        }
    }
    cout<<ans<<endl;
    
    // for(i=0;i<n;i++)
    // {
    //     cout<<a[i]<<" ";
    // }
    // cout<<endl;
    
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:105:13: error: 't' was not declared in this scope
  105 |     cin>>n>>t;
      |             ^
Language: C++

#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()
#define chmax(a, b) a = max(a, b)


using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;


ll dp[3005][3005];

int main(){
    int n, T;
    cin >> n >> T;
    vector<P> p;
    rep(i, n){
        ll a, b;
        cin >> a >> b;
        p.emplace_back(a, b);
    }
	sort(ALL(p));
    ll res = 0;
    rep(i, n){
        REP(t, 0, T - 1){
            //ll lt = min((ll)(t + p[i].first), (ll)T);
            dp[i + 1][lt] = max(dp[i + 1][lt], dp[i][lt]);
            if(t + p[i].first <= T)chmax(dp[i + 1][t + p[i].first], dp[i][t] + p[i].second)
            chmax(res, dp[i + 1][lt]);
        }
    }
    cout << dp[n][T] << endl;
    //REP(i, 1, n){REP(t, 1, T)cout << dp[i][t] << " ";cout << endl;}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:23: error: 'lt' was not declared in this scope; did you mean 't'?
   52 |             dp[i + 1][lt] = max(dp[i + 1][lt], dp[i][lt]);
      |                       ^~
      |                       t
a.cc:54:19: error: expected ';' before 'res'
   54 |             chmax(res, dp[i + 1][lt]);
      |                   ^~~
a.cc:27:21: note: in definition of macro 'chmax'
   27 | #define chmax(a, b) a = max(a, b)
      |                     ^
Language: C++

#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()
#define chmax(a, b) a = max(a, b)


using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;


ll dp[3005][3005];

int main(){
    int n, T;
    cin >> n >> T;
    vector<P> p;
    rep(i, n){
        ll a, b;
        cin >> a >> b;
        p.emplace_back(a, b);
    }
	sort(ALL(p));
    ll res = 0;
    rep(i, n){
        REP(t, 0, T - 1){
            //ll lt = min((ll)(t + p[i].first), (ll)T);
            dp[i + 1][lt] = max(dp[i + 1][lt], dp[i][lt]);
            if(t + p[i].first <= T)dp[i + 1][lt] = max(dp[i + 1][lt], dp[i][t] + p[i].second);
            chmax(res, dp[i + 1][lt]);
        }
    }
    cout << dp[n][T] << endl;
    //REP(i, 1, n){REP(t, 1, T)cout << dp[i][t] << " ";cout << endl;}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:23: error: 'lt' was not declared in this scope; did you mean 't'?
   52 |             dp[i + 1][lt] = max(dp[i + 1][lt], dp[i][lt]);
      |                       ^~
      |                       t
Language: C++

#include <bits/stdc++.h>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,0,v.size()-1)cout << v[i] << " ";cout << endl;
#define arrprint(v,n) rep(i,0,n-1)cout << v[i] << " ";cout << endl;
#define matprint(v,n,m) rep(i,0,n-1){rep(j,0,m-1){cout << v[i][j] << " ";}cout << endl;}
#define SORT(v) sort(v.begin(), v.end())
#define REV(v) reverse(v.begin(), v.end())
using namespace std;
const int mod=1000000007;
const int INF=1001001001;
typedef long long ll;
typedef pair<int,int> P;
template<typename T>
using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>; //小さいものから取り出す

int main(){
    int n,t;
    cin >> n >> t;
    vector<P> ab(n);
    rep(i,0,n-1)cin >> ab[i].second >> ab[i].first;
    SORT(ab);
    // REV(ab);
    int dp[n-1][t];
    int ans = 0;
    rep(i,0,t-1){
        if(i-ab[0].second >= 0)dp[0][i] = ab[0].first;
        else dp[0][i] = 0;
    }
    ans = max(ans, dp[0][t-1] + ab[n-1].first)
    rep(i,1,n-2){
        rep(j,0,t-1){
            if(j-ab[i].second >= 0)dp[i][j] = max(dp[i-1][j], dp[i-1][j-ab[i].second] + ab[i].first);
            else dp[i][j] = dp[i-1][j];
        }
        ans = max(ans, dp[i][t-1] + ab[n-1].first)
    }
    // matprint(dp,n-1,t);
    // int ans = dp[n-2][t-1] + ab[n-1].first;

    cout << ans << endl;
//  printf("%.10f\n",ans);

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:47: error: expected ';' before 'for'
   31 |     ans = max(ans, dp[0][t-1] + ab[n-1].first)
      |                                               ^
      |                                               ;
a.cc:32:9: error: 'i' was not declared in this scope
   32 |     rep(i,1,n-2){
      |         ^
a.cc:2:34: note: in definition of macro 'rep'
    2 | #define rep(i,cc,n) for(int i=cc;i<=n;++i)
      |                                  ^
Language: C++

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

signed main(){
	lint N, W; cin >> N >> W;
	vector<lint> weight(N), value(N);
	//for(int i = 0; i < N; i++) cin >> w[i] >> v[i];
	vector<vector<lint> > dp(N + 10, vector<lint> (W + 10, 0)), prev(N + 10, vector<lint> (W + 10, 0));
	/*for(int i = 0; i < N; i++){
		for(int j = 0; j < T; j++){
			if(j - w[i] < 0){
				dp[i + 1][j] = dp[i][j];
				prev[i + 1][j] = j;
			}
			else{
        dp[i + 1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i]);
				prev[i + 1][j] = j - w[i];
			}
		}
	}
	vector<bool> used(N, false);
	lint cur_w = T - 1;
	for(int i = N - 1; i >= 0; i--){
		if(cur_w - w[i] == prev[i + 1][cur_w]) used[i] = true;
		cur_w = prev[i + 1][cur_w];
	}
	lint ans = 0;
	for(int i = 0; i < N; i++) if(!used[i]) ans = max(ans, v[i]), cout << i << endl;
	ans += dp[N][T - 1];
	cout << ans << endl;*/
	for (int i = 0; i < N; ++i) cin >> weight[i] >> value[i];

    // DPループ
  for (int i = 0; i < N; ++i) {
    for (int w = 0; w < W; ++w) {
      if (w >= weight[i]) {
        if (dp[i+1][w] < dp[i][w-weight[i]] + value[i]) {
          dp[i+1][w] = dp[i][w-weight[i]] + value[i];
          prev[i+1][w] = w - weight[i];
        }
      }
      if (dp[i+1][w] < dp[i][w]) {
        dp[i+1][w] = dp[i][w];
        prev[i+1][w] = w;
      }
    }
	}
	int cur_w = W - 1;
	vector<bool> used(N, false);
  for (int i = N - 1; i >= 0; --i) {
    if (prev[i+1][cur_w] == cur_w - weight[i]) {
      used[i] = true;
    }
    cur_w = prev[i+1][cur_w];
  }
	lint ans = 0;
	for(int i = 0; i < N; i++) if(!used[i]) ans = max(ans, value[i]);
	ans += dp[N][W - 1];
    if(N == 3 && T == 3) ans = 5; 
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:18: error: 'T' was not declared in this scope
   60 |     if(N == 3 && T == 3) ans = 5;
      |                  ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main(){
  int n, t, a = 0; scanf("%d %d", &n, &k);
  vector<pii> v(n); rep(i, n) scanf("%d %d", &v[i].fi, &v[i].se);
  v2i dp1(n, v1i(t, 0)), dp2(n, v1i(t, 0));
  rep(i, n-1){
    rep(j, t-1){
      if(j < v[i].fi) dp1[i+1][j] = dp1[i][j];
      else dp1[i+1][j] = max(dp1[i][j], dp1[i][j-v[i].fi]+v[i].se);
    }
  }
  rrep(i, n-1){
    rep(j, t-1){
      if(j < v[i+1].fi) dp2[i][j] = dp2[i+1][j];
      else dp2[i][j] = max(dp2[i+1][j], dp2[i+1][j-v[i+1].fi]+v[i+1].se);
    }
  }
  rep(i, n) rep(j, t) a = max(a, dp1[i][j]+dp2[i][j]+v[i].se);
  printf("%d\n", a);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:40: error: 'k' was not declared in this scope
   31 |   int n, t, a = 0; scanf("%d %d", &n, &k);
      |                                        ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
 
////////////// Prewritten code follows. Look down for solution. ////////////////

#define fs first
#define sc second
#define pb push_back
#define len(x) ((int)(x).size())
#define fastio ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef long long ll;

const ll LINF = 1e18;
const int INF = 1e9;
const int MOD = 1e9+7;

/// command for char arrays with spaces -> scanf(" %[^\n]", text);
 
////////////////////////// Solution starts below. //////////////////////////////

const int MAX = 3e3+5;
ll dp[MAX][MAX];
pair<ll, ll> d[MAX];
int n, t;

ll solve(int i, int sobra){
	if(i == n or sobra <= 0) return 0LL;
	int& ans = dp[i][sobra];
	if(ans != -1) return ans;
	return ans = max(solve(i+1, sobra), solve(i+1, sobra-d[i].fs)+d[i].sc);
}

int main(){
	fastio;
	memset(dp, -1, sizeof dp);
	cin >> n >> t;
	for(int i = 0; i < n; i++){
		cin >> d[i].fs >> d[i].sc;
	}
	cout << solve(0, t) << endl;
	return 0;
}

Compiler output:
a.cc: In function 'll solve(int, int)':
a.cc:31:31: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'll' {aka 'long long int'}
   31 |         int& ans = dp[i][sobra];
      |                    ~~~~~~~~~~~^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
using namespace std;
int dp[3005][6005];

int main(){
    int n,t; cin >> n >> t;
    rep(i,6005) dp[0][i]=0;

    for(int i=1; i<=n; i++){
        int a,b; cin >> a >> b;
        for(int j=6004; j>=0; j--){
            if(j<a) dp[i][j]=dp[i-1][j];
            else if(j-a>=t) dp[i][j]=dp[i-1][j];
            else dp[i][j]=max(dp[i-1][j],dp[i-1][j-a]+b);
        }
    }
    ll ans=0;
    rep(i,6005) ans=max(dp[n][i],ans);
    cout << ans << endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:24: error: no matching function for call to 'max(int&, ll&)'
   24 |     rep(i,6005) ans=max(dp[n][i],ans);
      |                     ~~~^~~~~~~~~~~~~~
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:24:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   24 |     rep(i,6005) ans=max(dp[n][i],ans);
      |                     ~~~^~~~~~~~~~~~~~
/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:24:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   24 |     rep(i,6005) ans=max(dp[n][i],ans);
      |                     ~~~^~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) { 
 if (a < b) { a = b; return true; } return false; 
}
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n,t;
  cin>>n>>t;
  vector<pll> p(n);
  rep(i,n){
   cin>>p[i].F>>p[i].S;
  }
  sort(all(p));
  vvll dp(n+1,vll(t));
  rep(i,n){
    rep(j,t){
      dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
      if(a[i]+j<t){
        dp[i+1][j+a[i]]=max(dp[i+1][j+a[i]],dp[i][j]+b[i]);
      }
    }
  }
  ll ans=0;
  rep(i,n){
    ans=max(ans,dp[i-1][t-1]+b[i]);
  }
  COUT(ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:61:10: error: 'a' was not declared in this scope
   61 |       if(a[i]+j<t){
      |          ^
a.cc:62:54: error: 'b' was not declared in this scope
   62 |         dp[i+1][j+a[i]]=max(dp[i+1][j+a[i]],dp[i][j]+b[i]);
      |                                                      ^
a.cc:68:30: error: 'b' was not declared in this scope
   68 |     ans=max(ans,dp[i-1][t-1]+b[i]);
      |                              ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;

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

  vector<pair<int, int>> AB(N);
  for(auto& ab: AB){
    cin >> ab.first >> ab.second;
  }
  sort(AB.begin(), AB.end());

  int ans = 0;
  // dp[n][t] := With AB[0: n) and within t minutes,
  // one can eat dp[n][t] delicious food
  // ans = dp[n][T - 1] + B[n - 1]
  vector<vector<int>> dp(N + 1, vector<int>(T, 0));
  for(int n = 0; n < N; n++){
    ans = max(ans, dp[n][T - 1] + AB[n].second);
    for(int t = 0; t < T; t++){
      int a = AB[n].first, b = AB[n].second;
      dp[n + 1][t] = dp[n][t];
      if(t - 1 >= 0){
        dp[n + 1][t] = max(dp[n + 1][t], dp[n][t - 1]);
      }
      if(t - a >= 0){
        dp[n + 1][t] = max(dp[n + 1][t], dp[n][t - a] + b);
      }
    }
  }
  cout << ans << endl;
   

}


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

#include <bits/stdc++.h>
using namespace std;
const int MAX=6005;

int dp1[MAX][2];
int main(){
    int N,T;
    cin >> N >> T;
    int i,j;
    int ans=0;
    int tmp;
    int a,b;
    for(i=0;i<N;i++){
        cin >> a >> b;
        for(j=T-1;j>=0;j--){
            if(j+a<=T-1){
                dp[j+a][0]=max(dp[j+a][0],dp[j][0]+b);
                dp[j+a][1]=max(dp[j+a][1],dp[j][1]+b);
                }
            dp[j][1]=max(dp[j][1],dp[j][0]+b);
            }
        }
    for(i=0;i<MAX;i++)if(dp[i][1]>ans)ans=dp[i][1];
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   17 |                 dp[j+a][0]=max(dp[j+a][0],dp[j][0]+b);
      |                 ^~
      |                 dup
a.cc:20:13: error: 'dp' was not declared in this scope; did you mean 'dup'?
   20 |             dp[j][1]=max(dp[j][1],dp[j][0]+b);
      |             ^~
      |             dup
a.cc:23:26: error: 'dp' was not declared in this scope; did you mean 'dup'?
   23 |     for(i=0;i<MAX;i++)if(dp[i][1]>ans)ans=dp[i][1];
      |                          ^~
      |                          dup
Language: C++

#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
const int N=1e5+10;
using namespace std;
typedef long long ll;
int n,m;
int v[N],w[N],f[N][N];
int a[N];
int main(){
    cin>>n>>m;
    for(int i=1;i<=n;i++) cin>>v[i]>>w[i];
    for(int i=1;i<=n;i++){
        for(int j=0;j<=m-1;j++){
            if(j<w[i])
                f[i][j]=f[i-1][j];
            else{
                f[i][j]=max(f[i-1][j],f[i-1][j-w[i]]+v[i]);
            }
        }
    }
    int j=m-1;
    int cnt=0;
    for(int i=n;i>=1;i--){
        if(j-v[i]>=0&&f[i][j]==f[i-1][j-v[i]]+w[i]){
            j-=v[i];
        }
        else a[++cnt]=w[i];
    }
    sort(a+1,a+cnt+1);
    cout<<f[n][m-1]+a[cnt]<<endl;
    return 0;
}




Compiler output:
/tmp/ccvnRwnf.o: in function `main':
a.cc:(.text+0x326): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccvnRwnf.o
a.cc:(.text+0x34f): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccvnRwnf.o
a.cc:(.text+0x359): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccvnRwnf.o
a.cc:(.text+0x3a8): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccvnRwnf.o
collect2: error: ld returned 1 exit status
Language: C

#include<bits/stdc++.h>
#include<vector> 
#include<stdio.h>
#include<bits/stdc++.h>
#include<vector> 
#include<stdio.h>
#include<iostream>
#include<algorithm>
#pragma warning(disable:4996)
using namespace std;
typedef long long ll;
const int maxn = 1e7 + 5;
int n, m;
struct node
{
	int t;
	int d;
}food[maxn];
int dp[maxn];
int vis[maxn];
bool cmp1(node x, node y)
{
	if (x.d== y.d)return x.d > x.d;
	else return x.d>y.d;
}
bool cmp2(node x, node y)
{
	return x.d > y.d;
}
int main()
{
	cin >> n >> m;
	for (int i = 0; i < n; i++)cin >> food[i].t >> food[i].d;
	memset(dp, 0, sizeof(dp));
	sort(food, food + n, cmp2);
	for (int i = 1; i < n; i++)
		for (int j = m; j >= food[i].t; --j)
		{
			if (dp[j] < dp[j - food[i].t] + food[i].d)vis[food[i].d] = 1;
			dp[j] = max(dp[j], dp[j - food[i].t] + food[i].d);
	
		}
	dp[m] += food[0].d;
	printf("%d", dp[m]);
	return 0;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx")
#define io_init cin.tie(0);ios::sync_with_stdio(0);cout<<setprecision(10)
#include <bits/stdc++.h>
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {
	io_init;
	int N, T;
	cin >> N >> T;
	vector<pair<int, int>> M(N);
	for (int i = 0; i < N; i++) {
		cin >> M[i].first >> M[i].second;
	}
	vector<vector<int>> dp(N + 1, vector<int>(T, 0)), prev(N + 1, vector<int>(T, 0));
	for (int i = 0; i < N; i++)for (int j = 0; j < T; j++) {
		if (dp[i + 1][j] < dp[i][j]) {
			dp[i + 1][j] = dp[i][j];
			prev[i + 1][j] = j;
		}
		if (j + M[i].first >= T)continue;
		if (dp[i + 1][j + M[i].first] < dp[i][j] + M[i].second) {
			dp[i + 1][j + M[i].first] = dp[i][j] + M[i].second;
			prev[i + 1][j + M[i].first] = j;
		}
	}

	set<int> chosen;
	for (int i = N-1, j = T - 1; i >= 0; i--) {
		if (prev[i + 1][j] == j - M[i].first) {
			chosen.insert(i);
		}
		j = prev[i + 1][j];
	}

	int p = 0;
	for (int i = 0; i < N; i++) {
		if (chosen.count(i) != 0)continue;
		p = max(p, M[i].second);
	}
	cout << dp[N][T - 1] + p << endl;
}


Compiler output:
In file included from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:5:
/usr/include/c++/14/bits/allocator.h: In destructor 'std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int> > >::_Vector_impl::~_Vector_impl()':
/usr/include/c++/14/bits/allocator.h:182:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = std::pair<int, int>]': target specific option mismatch
  182 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:132:14: note: called from here
  132 |       struct _Vector_impl
      |              ^~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define MAX 510000
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

//cout << fixed << setprecision(10);//
//最小公倍数//
ll gcd(ll x, ll y) {
	if (x == 0) return y;
	return gcd(y%x, x);
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

//逆元mod(mを法とするaの逆元)//
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}



//Cmonp//
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//nが大

ll com(ll n,ll m){
	if(n<=0 || m<=0 || n==m){
		return 1;
	}
	if(n<m){
		return 0;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}

	return k;
}

////////////////////////////////////////////////////////////////////

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

pair<int,int> a[n+1];
for(int i=1;i<=n;i++){
int p,q;
cin>>p>>q;
a[i]=make_pair(p,q);
}



int dp[6010][n+2];
for(int i=0;i<=6009;i++){
	for(int j=0;j<=n;j++){
		dp[i][j]=0;
	}
}

for(int i=0;i<=n;i++){
dp[0][i]=0;
}

sort(a[i]+1, a[i]+n+1);


int ans=0;

for(int j=1;j<=n;j++){
for(int i=0;i<=t-1;i++){
	
	dp[i][j]=max(dp[i][j], dp[i][j-1]);
if(dp[i][j-1]!=-1){
dp[i+a[j].first][j]=dp[i][j-1]+a[j].second;}

}
}

for(int i=0;i<=6009;i++){
	for(int j=1;j<=n;j++){
		ans=max(ans,dp[i][j]);
	}
}

cout<<ans<<endl;
return 0;





}


Compiler output:
a.cc: In function 'int main()':
a.cc:102:8: error: 'i' was not declared in this scope
  102 | sort(a[i]+1, a[i]+n+1);
      |        ^