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

/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


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 COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll 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 Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b) {
  return b ? GCD(b,a%b) : a;
}


ll LCM(ll a,ll b){
  return a/GCD(a,b)*b;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




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;
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n,w;
  cin>>n>>w;
  vector<ll> weight(n),value(n);
  rep(i,n) cin>>weight[i]>>value[i];
  ll dp[n+1][w+1];
  rep(i,n+1) rep(j,w+1) dp[i][j]=MOD;
  rep(i,w+1) d[0][i]=0;
  rep(i,n+1){
    rep(j,w+1){
      if(j-weight[i]) dp[i+1][j]=max(dp[i][j],dp[i][j-weight[i]]+value[i]);
      else dp[i+1][j]=dp[i][j];
    }
  }
  cout<<dp[n][w]<<endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:146:14: error: 'd' was not declared in this scope
  146 |   rep(i,w+1) d[0][i]=0;
      |              ^
Language: C++

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define eb 			emplace_back
#define mp 			make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define puts(n)		cout<<n;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define setbits(x) __builtin_popcount(x)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
vi v1,v2;
ll dp[1001][100001]={-1};
ll ks(ll n, ll b){
if(dp[n][b]!=-1)
    return dp[n][b];
    if(n==0 || b==0)
    return 0;
    else if(v1[n]>b)
    return ks(n-1,b);
    else {ll temp1=ks(n-1,b);
    ll temp2=v2[n]+ks(n-1,b-v1[n]);
    dp[n][b]=max(temp1,temp2);
        return dp[n][b];
    }
    
    
}
int main(){
	ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        ll a,b,k,o;
        cin>>a>>b;
        rep(i,0,a){
            cin>>k>>o;
            v1.pb(k);
            v2.pb(o);
        }
        ll ans=ks(v1.size()-1,b);
        cout<<ans;
        return 0;}

Compiler output:
g++: internal compiler error: File size limit exceeded signal terminated program as
Please submit a full bug report, with preprocessed source (by using -freport-bug).
See <file:///usr/share/doc/gcc-14/README.Bugs> for instructions.
Language: C++

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define eb 			emplace_back
#define mp 			make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define puts(n)		cout<<n;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define setbits(x) __builtin_popcount(x)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
vi v1,v2;
ll dp[1001][100001]={-1};
ll ks(ll n, ll b){
if(dp[n][b]!=-1)
    return dp[n][b];
    if(n==0 || b==0)
    return 0;
    else if(v1[n]>b)
    return ks(n-1,b);
    else {ll temp1=ks(n-1,b);
    ll temp2=v2[n]+ks(n-1,b-v1[n]);
    dp[n][b]=max(temp1,temp2);
        return dp[n][b];
    }
    
    
}
int main(){
	ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        ll a,b,k;
        cin>>a>>b;
        rep(i,0,a){
            cin>>k>>o;
            v1.pb(k);
            v2.pb(o);
        }
        ll ans=ks(v1.size()-1,b);
        cout<<ans;
        return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:21: error: 'o' was not declared in this scope
   47 |             cin>>k>>o;
      |                     ^
Language: C++

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define eb 			emplace_back
#define mp 			make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define puts(n)		cout<<n;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define setbits(x) __builtin_popcount(x)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
vi v1,v2;
ll dp[1001][1000000000]={-1};
ll ks(ll n, ll b){
if(dp[n][b]!=-1)
    return dp[n][b];
    if(n==0 || b==0)
    return 0;
    else if(v1[n]>b)
    return ks(n-1,b);
    else {ll temp1=ks(n-1,b);
    ll temp2=v2[n]+ks(n-1,b-v1[n]);
    dp[n][b]=max(temp1,temp2);
        return dp[n][b];
    }
    
    
}
int main(){
	ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        ll a,b,k,o;
        cin>>a>>b;
        rep(i,0,a){
            cin>>k>>o;
            v1.pb(k);
            v2.pb(o);
        }
        ll ans=ks(v1.size()-1,b);
        cout<<ans;
        return 0;}

Compiler output:
g++: internal compiler error: File size limit exceeded signal terminated program as
Please submit a full bug report, with preprocessed source (by using -freport-bug).
See <file:///usr/share/doc/gcc-14/README.Bugs> for instructions.
Language: C++

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define eb 			emplace_back
#define mp 			make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define puts(n)		cout<<n;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define setbits(x) __builtin_popcount(x)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
vi v1,v2;
ll dp[1001][1000000000]={-1};
ll ks(ll n, ll b){
if(dp[n][b]!=-1)
    return dp[n][b];
    if(n==0 || b==0)
    return 0;
    else if(v1[n]>b)
    return ks(n-1,b);
    else {ll temp1=ks(n-1,b);
    ll temp2=v2[n]+ks(n-1,b-v1[n]);
    dp[n][b]=max(temp1,temp2);
        return dp[n][b];
    }
    
    
}
int main(){
	ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        ll a,b,k;
        cin>>a>>b;
        rep(i,0,a){
            cin>>k>>o;
            v1.pb(k);
            v2.pb(o);
        }
        ll ans=ks(v1.size()-1,b);
        cout<<ans;
        return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:21: error: 'o' was not declared in this scope
   47 |             cin>>k>>o;
      |                     ^
Language: Java

import java.util.Scanner;

class Main{
   
 public static void main(String... args){
      Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      int W = sc.nextInt();

      int[] dp = new int[W+1];
      for(int i = 0; i < N; i++){
        int weight = sc.nextInt();
        int value = sc.nextInt();
        for(int wt = 0; wt <= W; wt++){
          if(wt >= weight){
          	dp[wt] = Math.max(dp[wt], dp[wt - weight] + value);
          }
        }
      }
   
   	  int ans = 0;
      for(i = 0; i <= W; i++){
      	ans = Math.max(ans, dp[i]);
      }
      System.out.println(ans);
   
      if(sc != null)
        sc.close();
  }
}


Compiler output:
Main.java:22: error: cannot find symbol
      for(i = 0; i <= W; i++){
          ^
  symbol:   variable i
  location: class Main
Main.java:22: error: cannot find symbol
      for(i = 0; i <= W; i++){
                 ^
  symbol:   variable i
  location: class Main
Main.java:22: error: cannot find symbol
      for(i = 0; i <= W; i++){
                         ^
  symbol:   variable i
  location: class Main
Main.java:23: error: cannot find symbol
      	ans = Math.max(ans, dp[i]);
      	                       ^
  symbol:   variable i
  location: class Main
4 errors
Language: C

#include<iostream>
#include<vector>
using namespace std;
int main()
{
	long long N,W,w[100005],v[100005],dp[100005]={0};
	cin>>N>>W;
	for(int i=0;i<N;i++)
	{
		cin>>w[i]>>v[i];
	}

	for(int i=0;i<N;i++)
	{
		for(int j=W-w[i];j>=0;j--)
		{
			dp[j+w[i]]=max(dp[j]+v[i],dp[j+w[i]]);
		}
	}
	long long max=0;
	for(int i=0;i<100005;i++)
		if(dp[i]>max)max=dp[i];
	printf("%Ld\n",max);
	return 0;
}




Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: Java

import java.util.*;

class Main{
  
/**
 * dp[i] = Maximum value by having exact weight of i
 */
		long[] dp = new long[W + 1];
		for (int i = 0; i < N; i++) {
			dp[i] = -1;
			int w = sc.nextInt();
			int v = sc.nextInt();
			for (int existing_wt = W - w; existing_wt >= 0; existing_wt--) {
				dp[existing_wt + w] = Math.max(dp[existing_wt + w], dp[existing_wt] + v);
			}
		}

		long ans = 0;
		for (int i = 0; i < W + 1; i++)
			ans = Math.max(ans, dp[i]);

		return ans;
	}

	public static void main(String... args) {
		Scanner sc = new Scanner(System.in);
		int N, W;
		N = sc.nextInt();
		W = sc.nextInt();
		System.out.println(go(N, W, sc));
	}}


Compiler output:
Main.java:9: error: illegal start of type
		for (int i = 0; i < N; i++) {
		^
Main.java:9: error: > or ',' expected
		for (int i = 0; i < N; i++) {
		                     ^
Main.java:9: error: <identifier> expected
		for (int i = 0; i < N; i++) {
		                        ^
Main.java:19: error: illegal start of type
		for (int i = 0; i < W + 1; i++)
		^
Main.java:19: error: > or ',' expected
		for (int i = 0; i < W + 1; i++)
		                      ^
Main.java:19: error: <identifier> expected
		for (int i = 0; i < W + 1; i++)
		                            ^
Main.java:20: error: <identifier> expected
			ans = Math.max(ans, dp[i]);
			   ^
Main.java:22: error: illegal start of type
		return ans;
		^
Main.java:22: error: <identifier> expected
		return ans;
		          ^
Main.java:25: error: unnamed classes are a preview feature and are disabled by default.
	public static void main(String... args) {
	              ^
  (use --enable-preview to enable unnamed classes)
Main.java:31: error: class, interface, enum, or record expected
	}}
	 ^
11 errors
Language: Java

import java.util.*;

class Main{
  
  private static long go(int N, int W){
    long[] dp = new long[W+1];
    for(int i = 0; i < N; i++){
      dp[i] = -1;
      int w = sc.nextInt();
      int v = sc.nextInt();
      for(int existing_wt = w; existing_wt >= 0; existing_wt--){
        dp[i] = Math.max(dp[existing_wt], dp[existing_wt - w] + v);
      }
      
      int ans = 0;
      for(int i = 0; i < W+1; i++)
        ans = Math.max(ans, dp[i]);
      
      return ans;
  }
    
  public static void main(String... args){
  	Scanner sc = new Scanner(System.in);
    int N, W;
    N = sc.nextInt();
    W = sc.nextInt();
    
    System.out.println(go(N, W));
  }
}


Compiler output:
Main.java:22: error: illegal start of expression
  public static void main(String... args){
  ^
1 error
Language: Java

import java.util.*;

class Main{
  
  private static long go(int N, int W){
    long[] dp = new long[W+1];
    for(int i = 0; i < N; i++){
      dp[i] = -1;
      int w = sc.nextInt();
      int v = sc.nextInt();
      for(int existing_wt = w; existing_wt >= 0; existing_wt--){
        dp[i] = Math.max(dp[existing_wt], dp[existing_wt - w] + v);
      }
      
      int ans = 0;
      for(int i = 0; i < W+1; i++)
        ans = Math.max(ans, dp[i]);
      
      return ans;
  }
  public static void main(String... args){
  	Scanner sc = new Scanner(System.in);
    int N, W;
    N = sc.nextInt();
    W = sc.nextInt();
    
    System.out.println(go(N, W));
    }
  }
}


Compiler output:
Main.java:21: error: illegal start of expression
  public static void main(String... args){
  ^
Main.java:30: error: class, interface, enum, or record expected
}
^
2 errors
Language: Java

import java.util.*;

class Main{
  
  public static void main(String... args){
  	Scanner sc = new Scanner(System.in);
    int N, W;
    N = sc.nextInt();
    W = sc.nextInt();
    
    long[] dp = new long[W+1];
    for(int i = 0; i < N; i++){
      dp[i] = -1;
      int w = sc.nextInt();
      int v = sc.nextInt();
      for(int existing_wt = w; existing_wt >= 0; existing_wt--){
        dp[i] = Math.max(dp[existing_wt], dp[existing_wt - w] + v);
      }
      
      int ans = 0;
      for(int i = 0; i < W+1; i++)
        ans = Math.max(ans, dp[i]);
      
      return ans;
    }
  }
}

Compiler output:
Main.java:21: error: variable i is already defined in method main(String...)
      for(int i = 0; i < W+1; i++)
              ^
Main.java:22: error: incompatible types: possible lossy conversion from long to int
        ans = Math.max(ans, dp[i]);
                      ^
Main.java:24: error: incompatible types: unexpected return value
      return ans;
             ^
3 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
int dp[100001,101];
struct node{
  int w,v;
};
long long int knapsack(int n,int w,vector<node> v)
{
  if(n==0)
    return 0;
  if(w==0)
    return 0;
  long long int o1,o2;
  if(dp[n-1][w]!=-1)
    o1=dp[n-1][w];
  else
    o1=knapsack(n-1,w,v);
  if(dp[n-1][w-v[n].w]!=-1)
    o2=dp[n-1][w-v[n].w]+v[n].v;
  else
    o2=knapsack(n-1,w-v[n].w,v)+v[n].v;
  if(o1>o2)
    dp[n][w]=o1;
  else
    dp[n][w]=o2;
  return dp[n][w];
}
int main()
{
  for(int i=0;i<100001;i++)
    for(int j=0;j<101;j++)
      dp[i][j]=-1;
  int n,w;cin>>n>>w;
  vector<node> v(n+1);
  v[0].v=v[0].w=0;
  for(int i=1;i<=n;i++)
    cin>>v[i].w>>v[i].v;
  cout<<knapsack(n,w,v)<<endl;
  return 0;
}
  

Compiler output:
a.cc:3:14: error: expected ']' before ',' token
    3 | int dp[100001,101];
      |              ^
      |              ]
a.cc:3:15: error: expected unqualified-id before numeric constant
    3 | int dp[100001,101];
      |               ^~~
a.cc: In function 'long long int knapsack(int, int, std::vector<node>)':
a.cc:14:6: error: 'dp' was not declared in this scope; did you mean 'dup'?
   14 |   if(dp[n-1][w]!=-1)
      |      ^~
      |      dup
a.cc:18:6: error: 'dp' was not declared in this scope; did you mean 'dup'?
   18 |   if(dp[n-1][w-v[n].w]!=-1)
      |      ^~
      |      dup
a.cc:23:5: error: 'dp' was not declared in this scope; did you mean 'dup'?
   23 |     dp[n][w]=o1;
      |     ^~
      |     dup
a.cc:25:5: error: 'dp' was not declared in this scope; did you mean 'dup'?
   25 |     dp[n][w]=o2;
      |     ^~
      |     dup
a.cc:26:10: error: 'dp' was not declared in this scope; did you mean 'dup'?
   26 |   return dp[n][w];
      |          ^~
      |          dup
a.cc: In function 'int main()':
a.cc:32:7: error: 'dp' was not declared in this scope; did you mean 'dup'?
   32 |       dp[i][j]=-1;
      |       ^~
      |       dup
Language: Java

class Main{
  
  private static long bruteGo(int[] weight, int[] value, int W, int index, long v){
    
  		if(index >= weight.length) return v;
      if(W <= 0) return v;
      //if(index < weight.length && W == weight[index])
        //return v + value[index];
      if(W >= weight[index])
       return Math.max(bruteGo(weight, value, W, index+1, v),
        bruteGo(weight, value, W-weight[index], index+1, v + value[index]));
      
      return v;
  }
  
  private static long brute(int N, int W, int[] weight, int[] value){
    return bruteGo(weight, value, W, 0, 0l);
  }
    
 public static void main(String... args){
      Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      int W = sc.nextInt();

      int[] weight = new int[N] ;
      int[] value = new int[N] ;

      for(int i = 0; i< N; i++){
            weight[i] = sc.nextInt();
            value[i] = sc.nextInt();
      }
      System.out.println(brute(N, W, weight, value));
      if(sc != null)
        sc.close();
  }
}


Compiler output:
Main.java:21: error: cannot find symbol
      Scanner sc = new Scanner(System.in);
      ^
  symbol:   class Scanner
  location: class Main
Main.java:21: error: cannot find symbol
      Scanner sc = new Scanner(System.in);
                       ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: Java

class Main{
  public static void main(String... args){
    
      private static long bruteGo(int[] weight, int[] value, int W, int index, long v){
    
  		if(index >= weight.length) return v;
      if(W <= 0) return v;
      if(W >= weight[index])
       return Math.max(bruteGo(weight, value, W, index+1, v),
        bruteGo(weight, value, W-weight[index], index+1, v + value[index]));
      
      return v;
  }

  private static long brute(int N, int W, int[] weight, int[] value){
    return bruteGo(weight, value, W, 0, 0l);
  }
    
 public static void main(String... args){
      Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      int W = sc.nextInt();

      int[] weight = new int[N] ;
      int[] value = new int[N] ;

      for(int i = 0; i< N; i++){
            weight[i] = sc.nextInt();
            value[i] = sc.nextInt();
      }
      System.out.println(brute(N, W, weight, value));
      if(sc != null)
        sc.close();
  }
}

Compiler output:
Main.java:4: error: illegal start of expression
      private static long bruteGo(int[] weight, int[] value, int W, int index, long v){
      ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (in i = 0; i < (in)(n); i++)
const double PI=3.14159265358979323846;
const int64_t waru = 1000000007;
const in INF=pow(2,60);
using vec = vector<vector<int>>;

bool chmax(in &a,in b){if(a<b){a=b;return 1;}return 0;}

int main(){
in n,w;
  cin>>n>>w;
 vector<in> s(n);
  vector<in> t(n);
  rep(i,n){cin>>s[i]>>t[i];}
  
  in dp[110][100010];
  rep(i,110)rep(j,100010) dp[i][j]=0ll;
  
  rep(i,100010) dp[0][i]=0;
  bool x;
  
  for(in i=1ll;i<n;i++){
     rep(j,w+1ll){
        x=chmax(dp[i][j],dp[i-1][j]);
       if(j-w[i-1]>=0ll) x=chmax(dp[i][j],dp[i-1][j-t[i-1]]+s[i-1]);
     }
  }
  cout<<dp[n][w];
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:14: error: invalid types 'in {aka long int}[in {aka long int}]' for array subscript
   30 |        if(j-w[i-1]>=0ll) x=chmax(dp[i][j],dp[i-1][j-t[i-1]]+s[i-1]);
      |              ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const double PI=3.14159265358979323846;
const int64_t waru = 1000000007;
const in INF=pow(2,60);
using vec = vector<vector<int>>;

bool chmax(in &a,in b){if(a<b){a=b;return 1;}return 0;}

int main(){
in n,w;
  cin>>n>>w;
 vector<in> s(n);
  vector<in> t(n);
  rep(i,n){cin>>s[i]>>t[i];}
  
  in dp[110][100010];
  rep(i,110)rep(j,100010) dp[i][j]=0ll;
  
  rep(i,100010) dp[0][i]=0;
  bool x;
  
  for(int i=1;i<n;i++){
     rep(j,w+1){
        x=chmax(dp[i][j],dp[i-1][j]);
       if(j-w[i-1]>=0ll) x=chmax(dp[i][j],dp[i-1][j-t[i-1]]+s[i-1]);
     }
  }
  cout<<dp[n][w];
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:14: error: invalid types 'in {aka long int}[int]' for array subscript
   30 |        if(j-w[i-1]>=0ll) x=chmax(dp[i][j],dp[i-1][j-t[i-1]]+s[i-1]);
      |              ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const double PI=3.14159265358979323846;
const int64_t waru = 1000000007;
const in INF=pow(2,60);
using vec = vector<vector<int>>;

bool chmax(in &a,in b){if(a<b){a=b;return 1;}return 0;}

int main(){
in n,w;
  cin>>n>>w;
 vector<in> s(n);
  vector<in> t(n);
  rep(i,n){cin>>s[i]>>t[i];}
  
  in dp[110][100010];
  rep(i,110)rep(j,100010) dp[i][j]=0ll;
  
  rep(i,100010) dp[0][i]=0;
  bool x;
  
  for(int i=1;i<n;i++){
     rep(j,w+1){
        x=chmax(dp[i][j],dp[i-1][j]);
       if(j-w[i-1]>=0) x=chmax(dp[i][j],dp[i-1][j-t[i-1]]+s[i-1]);
     }
  }
  cout<<dp[n][w];
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:14: error: invalid types 'in {aka long int}[int]' for array subscript
   30 |        if(j-w[i-1]>=0) x=chmax(dp[i][j],dp[i-1][j-t[i-1]]+s[i-1]);
      |              ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const double PI=3.14159265358979323846;
const int64_t waru = 1000000007;
const in INF=pow(2,60);
using vec = vector<vector<int>>;

bool chmax(int &a,int b){if(a<b){a=b;return 1;}return 0;}

int main(){
in n,w;
  cin>>n>>w;
 vector<in> s(n);
  vector<in> t(n);
  rep(i,n){cin>>s[i]>>t[i];}
  
  in dp[110][100010];
  rep(i,110)rep(j,100010) dp[i][j]=0ll;
  
  rep(i,100010) dp[0][i]=0;
  bool x;
  
  for(int i=1;i<n;i++){
     rep(j,w+1){
        x=chmax(dp[i][j],dp[i-1][j]);
       if(j-w[i-1]>=0) x=chmax(dp[i][j],dp[i-1][j-t[i-1]]+s[i-1]);
     }
  }
  cout<<dp[n][w];
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:24: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'in' {aka 'long int'}
   29 |         x=chmax(dp[i][j],dp[i-1][j]);
      |                 ~~~~~~~^
a.cc:12:17: note:   initializing argument 1 of 'bool chmax(int&, int)'
   12 | bool chmax(int &a,int b){if(a<b){a=b;return 1;}return 0;}
      |            ~~~~~^
a.cc:30:14: error: invalid types 'in {aka long int}[int]' for array subscript
   30 |        if(j-w[i-1]>=0) x=chmax(dp[i][j],dp[i-1][j-t[i-1]]+s[i-1]);
      |              ^
a.cc:30:39: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'in' {aka 'long int'}
   30 |        if(j-w[i-1]>=0) x=chmax(dp[i][j],dp[i-1][j-t[i-1]]+s[i-1]);
      |                                ~~~~~~~^
a.cc:12:17: note:   initializing argument 1 of 'bool chmax(int&, int)'
   12 | bool chmax(int &a,int b){if(a<b){a=b;return 1;}return 0;}
      |            ~~~~~^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const double PI=3.14159265358979323846;
const int64_t waru = 1000000007;
const in INF=pow(2,60);
using vec = vector<vector<int>>;

bool chmax(int &a,int b){if(a<b){a=b;return 1;}return 0;}

int main(){
in n,w;
  cin>>n>>w;
 vector<in> v(n);
  vector<in> w(n);
  rep(i,n){cin>>w[i]>>v[i];}
  
  in dp[110][100010];
  rep(i,110)rep(j,100010) dp[i][j]=0ll;
  
  rep(i,100010) dp[0][i]=0;
  bool x;
  
  for(int i=1;i<n;i++){
     rep(j,w+1){
        x=chmax(dp[i][j],dp[i-1][j]);
       if(j-w[i-1]>=0) x=chmax(dp[i][j],dp[i-1][j-w[i-1]]+v[i-1]);
     }
  }
  cout<<dp[n][w];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:14: error: conflicting declaration 'std::vector<long int> w'
   18 |   vector<in> w(n);
      |              ^
a.cc:15:6: note: previous declaration as 'in w'
   15 | in n,w;
      |      ^
a.cc:19:18: error: invalid types 'in {aka long int}[int]' for array subscript
   19 |   rep(i,n){cin>>w[i]>>v[i];}
      |                  ^
a.cc:29:24: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'in' {aka 'long int'}
   29 |         x=chmax(dp[i][j],dp[i-1][j]);
      |                 ~~~~~~~^
a.cc:12:17: note:   initializing argument 1 of 'bool chmax(int&, int)'
   12 | bool chmax(int &a,int b){if(a<b){a=b;return 1;}return 0;}
      |            ~~~~~^
a.cc:30:14: error: invalid types 'in {aka long int}[int]' for array subscript
   30 |        if(j-w[i-1]>=0) x=chmax(dp[i][j],dp[i-1][j-w[i-1]]+v[i-1]);
      |              ^
a.cc:30:52: error: invalid types 'in {aka long int}[int]' for array subscript
   30 |        if(j-w[i-1]>=0) x=chmax(dp[i][j],dp[i-1][j-w[i-1]]+v[i-1]);
      |                                                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007ll
#define mod1 998244353ll
#define endl "\n"
using namespace std::chrono;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n,W;
    cin>>n>>W;
    ll w[n],v[n];
    for(ll x=0;x<n;x++){
        cin>>w[x]>>v[x];
    }
    ll dp[n][W+1];
    for(ll x=0;x<n;x++){
        dp[x][0]=0;
    }
    for(ll x=0;x<=W;x++){
        dp[0][x]=0;
    }
    dp[0][w[0]]=v[0];
    for(ll x=1;x<n;x++){
        for(ll y=1;y<=W;y++){
            dp[x][y]=dp[x-1][y];
            if(w[x]<=y){
                dp[x][y]=max(dp[x][y],dp[x-1][y-w[x]]+v[x]);
            }
        }
    }
    ll maxi=0;
    for(ll x=0;x<n;x++){
        maxi=max(maxi,dp[x][W]);
    }
    cout<<maxi<<endl;
    return 0;
}#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007ll
#define mod1 998244353ll
#define endl "\n"
using namespace std::chrono;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n,W;
    cin>>n>>W;
    ll w[n],v[n];
    for(ll x=0;x<n;x++){
        cin>>w[x]>>v[x];
    }
    ll dp[n][W+1];
    for(ll x=0;x<n;x++){
        dp[x][0]=0;
    }
    for(ll x=0;x<=W;x++){
        dp[0][x]=0;
    }
    dp[0][w[0]]=v[0];
    for(ll x=1;x<n;x++){
        for(ll y=1;y<=W;y++){
            dp[x][y]=dp[x-1][y];
            if(w[x]<=y){
                dp[x][y]=max(dp[x][y],dp[x-1][y-w[x]]+v[x]);
            }
        }
    }
    ll maxi=0;
    for(ll x=0;x<n;x++){
        maxi=max(maxi,dp[x][W]);
    }
    cout<<maxi<<endl;
    return 0;
}

Compiler output:
a.cc:41:2: error: stray '#' in program
   41 | }#include <bits/stdc++.h>
      |  ^
a.cc:41:3: error: 'include' does not name a type
   41 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:49:5: error: redefinition of 'int main()'
   49 | int main()
      |     ^~~~
a.cc:9:5: note: 'int main()' previously defined here
    9 | int main()
      |     ^~~~
Language: C++

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

typedef long long ll;
typedef vector<pair<ll , ll>> vll;
typedef vector<ll> vl;

#define f first
#define s second

void findMax(ll i , ll n ,ll k ,ll v , ll w ,vll h, , ll *res)
{
	//if(dp_v[i] == 0)
	//{
	
	if(i<n)
	{
		for(int j=i+1;j<n;j++)
		{
			if(w+h[j].s <= k)
			{
					
				findMax(j, n, k, v+h[j].f , w+h[j].s, h , res);
			}
		}

		if(*res<v)
		{
			*res = v;
		}
	}
	//}
	//else
	//{
		//if(w+dp_w[i]	
	//}
}


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll n , k;
	cin>>n>>k;

	vll s(n); // <value , weight>
	vl dp_v(n,0) , dp_w(n,0);

	ll v,w;
	for(ll i=0;i<n;++i)
	{
		cin>>w>>v;
		s[i] = make_pair(v , w);
	}

	ll res =0 ;
	findMax(-1 , n , k, 0 , 0 , s  , &res);
	cout<<res<<'\n';

	return 0;
}

Compiler output:
a.cc:11:53: error: expected identifier before ',' token
   11 | void findMax(ll i , ll n ,ll k ,ll v , ll w ,vll h, , ll *res)
      |                                                     ^
a.cc: In function 'void findMax(ll, ll, ll, ll, ll, vll, int, ll*)':
a.cc:23:75: error: invalid conversion from 'll*' {aka 'long long int*'} to 'int' [-fpermissive]
   23 |                                 findMax(j, n, k, v+h[j].f , w+h[j].s, h , res);
      |                                                                           ^~~
      |                                                                           |
      |                                                                           ll* {aka long long int*}
a.cc:23:40: error: too few arguments to function 'void findMax(ll, ll, ll, ll, ll, vll, int, ll*)'
   23 |                                 findMax(j, n, k, v+h[j].f , w+h[j].s, h , res);
      |                                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:11:6: note: declared here
   11 | void findMax(ll i , ll n ,ll k ,ll v , ll w ,vll h, , ll *res)
      |      ^~~~~~~
a.cc: In function 'int main()':
a.cc:59:42: error: invalid conversion from 'll*' {aka 'long long int*'} to 'int' [-fpermissive]
   59 |         findMax(-1 , n , k, 0 , 0 , s  , &res);
      |                                          ^~~~
      |                                          |
      |                                          ll* {aka long long int*}
a.cc:59:16: error: too few arguments to function 'void findMax(ll, ll, ll, ll, ll, vll, int, ll*)'
   59 |         findMax(-1 , n , k, 0 , 0 , s  , &res);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:11:6: note: declared here
   11 | void findMax(ll i , ll n ,ll k ,ll v , ll w ,vll h, , ll *res)
      |      ^~~~~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <stack>
int max(long int a, long int b)
{
    if (a>b) return a;
    return b;
}
using namespace std;

int main()
{
    int n,w;
    cin >> n >> w;
    long long int f[101][101];
    long long int m[101];
    long long int v[101];
    for ( int i = 1; i <= n ; i ++ )
        cin >> m[i] >> v[i];
    for ( int i = 0 ; i <= n ; i++ )
        f[i][0] = 0;
    for ( int i = 1; i <= w; i++ )
        f[0][i] = 0;
    for ( int i = 1; j <= n; j++ )
    {
        for ( int j = 1; i <= w; i++ )
        {
            if ( m[i] > j )
            {
                f[i][j] = f[i-1][j];
            }
            else
                f[i][j] = max(f[i-1][j],f[i-1][j-m[i]] + v[i]);
        }
    }
    cout << f[n][w]<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:22: error: 'j' was not declared in this scope
   24 |     for ( int i = 1; j <= n; j++ )
      |                      ^
Language: Java

import java.util.*;

public class Main {
  public static void main(String args[]) {
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int W = scan.nextInt();
    int[][] weightValues = new int[2][N];

    for (int i = 0; i < N; i++) {
      for (int j = 0; j < 2; j++) {
        weightValues[j][i] = scan.nextInt();
      }
    }
    scan.close();

    System.out.println(knapsack(weightValues, N, W));
  }

  private static int knapsack(int[][] weightValues, int N, int W) {
    if (N == 0 || W == 0)
      return 0;

    int[] dp = new int[weightValues.length][W + 1];

    for (int i = 0; i < dp.length; i++) {
      for (int j = 1; j < dp[0].length; j++) {
        int currentMinimum = i == 0 ? 0 : dp[i - 1][j];
        int currentWeight = weightValues[i][0];
        int currentValue = weightValues[i][1];
        int weightLeftover = j - currentWeight;
        int candidateMinimum = weightLeftover < 0 : Integer.MAX_VALUE : dp[weightLeftover];

        dp[i][j] = Math.min(currentMinimum, candidateMinimum);
      }
    }

    return dp[dp.length - 1][dp[0].length - 1];
  }

}


Compiler output:
Main.java:32: error: ';' expected
        int candidateMinimum = weightLeftover < 0 : Integer.MAX_VALUE : dp[weightLeftover];
                                                 ^
Main.java:32: error: not a statement
        int candidateMinimum = weightLeftover < 0 : Integer.MAX_VALUE : dp[weightLeftover];
                                                           ^
Main.java:32: error: ';' expected
        int candidateMinimum = weightLeftover < 0 : Integer.MAX_VALUE : dp[weightLeftover];
                                                                     ^
Main.java:32: error: not a statement
        int candidateMinimum = weightLeftover < 0 : Integer.MAX_VALUE : dp[weightLeftover];
                                                                          ^
4 errors
Language: C++

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

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;
}
const long long INF=1LL<<60;

int N 
long long W;
long long weight[110];
long long value[110];
long long dp[110][100010]={0};

int main(){
  cin >> N >> W;
  for(int i=0;i<N;i++) cin >> weight[i] >> value[i];

  for(int i=0;i<N;i++){
    for(int sum_w=0;sum_w<=W;++sum_w){
      if(sum_w-weight[i]>=0){
        chmax(dp[i+1][sum_w],dp[i][sum_w-weight[i]]+value[i]);
      }
      chmax(dp[i+1][sum_w],dp[i][sum_w]);
    }
  }
  cout << dp[N][W] <<endl;
}


Compiler output:
a.cc:22:1: error: expected initializer before 'long'
   22 | long long W;
      | ^~~~
a.cc: In function 'int main()':
a.cc:28:10: error: 'N' was not declared in this scope
   28 |   cin >> N >> W;
      |          ^
a.cc:28:15: error: 'W' was not declared in this scope
   28 |   cin >> N >> W;
      |               ^
Language: C++

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

long long INF = 1LL << 40;
template <class T>
bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    else
        return false;
}

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

long long dp[100010][100010];//weight , value
int w[100010];
int v[100010];
int main(){
    int N,W; cin >> N >> W;

    for(int i = 0; i < N; i++)cin >> w[i] >> v[i];

    for(int i = 0; i < N;i++){
        for(int sum_w = 0; sum_w <= W; sum_w++){
            if(sum_w -w[i] >= 0){
                chmax(dp[i+1][sum_w-w[i]],dp[i][sum_w]+v[i]);
            }
            chmax(dp[i+1][sum_w],dp[i][sum_w]);
        }

    }

    long long ans = 0;
    for(int i = 0; i <= W;i ++){
        chmax(ans,dp[N][i]);
    }
    cout << ans << endl;


}

Compiler output:
/tmp/ccUfMyxG.o: in function `main':
a.cc:(.text+0x49): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccUfMyxG.o
a.cc:(.text+0x75): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccUfMyxG.o
a.cc:(.text+0xbb): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccUfMyxG.o
a.cc:(.text+0x107): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccUfMyxG.o
a.cc:(.text+0x129): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccUfMyxG.o
collect2: error: ld returned 1 exit status
Language: C++

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

long long INF = 1LL << 40;
template <class T>
bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    else
        return false;
}

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

long long dp[100010][100010];//weight , value
int w[100010];
int v[100010];
int main(){
    int N,W; cin >> N >> W;

    for(int i = 0; i < N; i++)cin >> w[i] >> v[i];

    for(int i = 0; i < N;i++){
        for(int sum_w = 0; sum_w <= W; sum_w++){
            if(sum_w -w[i] >= 0){
                chmax(dp[i+1][sum_w-w[i]],dp[i][sum_w]+v[i]);
            }
            chmax(dp[i+1][sum_w],dp[i][sum_w]);
        }

    }

    long long ans = 0;
    for(int i = 0; i <= W;i ++){
        chmax(ans,dp[N][i]);
    }
    cout << ans << endl;


}

Compiler output:
/tmp/ccwO9Xz9.o: in function `main':
a.cc:(.text+0x49): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccwO9Xz9.o
a.cc:(.text+0x75): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccwO9Xz9.o
a.cc:(.text+0xbb): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccwO9Xz9.o
a.cc:(.text+0x107): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccwO9Xz9.o
a.cc:(.text+0x129): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccwO9Xz9.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n); for(long long i = 0;i < (n);i++)
typedef long long ll;
typedef vector<long long> vl;

const ll INF =100000000009;
ll dp[200][200000] = 0;

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

int main(){
	ll N,W; cin >> N >> W;
	vl n(N),vl w(N);
	rep(i,N)cin >> n[i] >> w[i];
	rep(i,N){
		rep(j,W+1){
			if(j >= w[i])dp[i+1][j] = max(dp[i][j],dp[i][j-w[i]] + n[i]);
			else dp[i+1][j] = dp[i][j];
		}
	}
	cout << dp[N][W] << endl;
}

Compiler output:
a.cc:8:22: error: array must be initialized with a brace-enclosed initializer
    8 | ll dp[200][200000] = 0;
      |                      ^
a.cc: In function 'int main()':
a.cc:17:20: error: expected initializer before 'w'
   17 |         vl n(N),vl w(N);
      |                    ^
a.cc:18:32: error: 'w' was not declared in this scope
   18 |         rep(i,N)cin >> n[i] >> w[i];
      |                                ^
a.cc:21:33: error: 'w' was not declared in this scope
   21 |                         if(j >= w[i])dp[i+1][j] = max(dp[i][j],dp[i][j-w[i]] + n[i]);
      |                                 ^
Language: C++

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

int thing[100][2];
int n;
int dp[100000];
bool used[100000];l
int solve(int w, bool used[], int s) {
    if(w == 0 || s == n) return 0;
    if(dp[w] != 0) return dp[w];
    for(int i = 0; i < n; i++) {
        if(w - thing[i][0] >= 0 && !used[i]) {
        used[i]=1;
        dp[w] = max(dp[w], solve(w-thing[i][0], used, s+1) + thing[i][1]);
        used[i]=0;
        }
    } 
    return dp[w];
}

int main() {
    int w;
    cin >> n >> w;
    for(int i = 0; i < n; i++) {
        cin >> thing[i][0] >> thing[i][1];
    }
    
    int ans = 0;
    for(int i = 0; i <n; i++) {
        if(!used[i] && thing[i][0] <= w) {
        used[i]=1;
        ans = max(ans, solve(w-thing[i][0], used, 1) + thing[i][1]);
        used[i]=0;
        }
    }
    cout << ans ;
    
    return 0;
}

Compiler output:
a.cc:7:19: error: 'l' does not name a type
    7 | bool used[100000];l
      |                   ^
a.cc: In function 'int main()':
a.cc:32:24: error: 'solve' was not declared in this scope
   32 |         ans = max(ans, solve(w-thing[i][0], used, 1) + thing[i][1]);
      |                        ^~~~~
Language: C++

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

    vector<ll> dp(W+1);
    // dp[i]: the maximum value that could be avaialble at weight i

    for(int item=0; item<n; item++){
        int weight, value;
        cin>>weight>>value;

        for(int weight_already = W - weight; weight_already>=0; weight_already--){
            dp[weight_already+weight] = max(dp[weight_already+weight], value+dp[weight_already]);
        }
    }

    cout<<*max_element(all(dp))<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'cin' was not declared in this scope
    3 |     cin>>n>>W;
      |     ^~~
a.cc:5:5: error: 'vector' was not declared in this scope
    5 |     vector<ll> dp(W+1);
      |     ^~~~~~
a.cc:5:12: error: 'll' was not declared in this scope
    5 |     vector<ll> dp(W+1);
      |            ^~
a.cc:5:16: error: 'dp' was not declared in this scope
    5 |     vector<ll> dp(W+1);
      |                ^~
a.cc:13:41: error: 'max' was not declared in this scope
   13 |             dp[weight_already+weight] = max(dp[weight_already+weight], value+dp[weight_already]);
      |                                         ^~~
a.cc:17:5: error: 'cout' was not declared in this scope
   17 |     cout<<*max_element(all(dp))<<endl;
      |     ^~~~
a.cc:17:24: error: 'all' was not declared in this scope
   17 |     cout<<*max_element(all(dp))<<endl;
      |                        ^~~
a.cc:17:12: error: 'max_element' was not declared in this scope
   17 |     cout<<*max_element(all(dp))<<endl;
      |            ^~~~~~~~~~~
a.cc:17:34: error: 'endl' was not declared in this scope
   17 |     cout<<*max_element(all(dp))<<endl;
      |                                  ^~~~
Language: C++

#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define speed                                                                  \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define oprecision                                                             \
  cout.precision(30);                                                          \
  cerr.precision(7);
#define bruh int
#define int long long
using namespace std;
int n, W, wt[500005], val[500005];
int knapSack(int W, int wt[], int val[], int n) {
  int i, w;
  int K[n + 1][W + 1];
  for (i = 0; i <= n; i++) {
    for (w = 0; w <= W; w++) {
      if (i == 0 || w == 0)
        K[i][w] = 0;
      else if (wt[i - 1] <= w)
        K[i][w] = max(val[i - 1] + K[i - 1][w - wt[i - 1]], K[i - 1][w]);
      else
        K[i][w] = K[i - 1][w];
    }
  }
  return K[n][W];
}
bruh main() {
  speed;
  oprecision;
  /*#ifndef ONLINE_JUDGE
freopen("outd.txt", "rt", stdin);
#endif*/
  // code
  cin >> n >> W;
  for (int i = 0; i < n; i++) {
    cin >> wt[i] >> val[i];
  }
  cout << knapSack(W, wt, val, n);
// endl
#ifndef ONLINE_JUDGE
  cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false) ;
    cin.tie(NULL) ;
    cout.tie(NULL) ;
    
    int n, w;
    scanf("%d%d", &n, &w);
    vector<ll> dp(w + 1); 
    
    for(int i1 = 0; i1 < n; i1++) 
    {
        int weight, value;
        scanf("%d%d", &weight, &value);

        for(int i = w - weight; i >= 0; i--) 
        {
            dp[i + weight] = max(dp[i + weight], dp[i] + value);
        }
    }

    ll answer = 0;
    for(int i = 0; i <= w; ++i) 
        answer = max(answer, dp[i]);

    printf("%lld\n", answer);

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:12: error: 'll' was not declared in this scope
   11 |     vector<ll> dp(w + 1);
      |            ^~
a.cc:11:14: error: template argument 1 is invalid
   11 |     vector<ll> dp(w + 1);
      |              ^
a.cc:11:14: error: template argument 2 is invalid
a.cc:20:15: error: invalid types 'int[int]' for array subscript
   20 |             dp[i + weight] = max(dp[i + weight], dp[i] + value);
      |               ^
a.cc:20:36: error: invalid types 'int[int]' for array subscript
   20 |             dp[i + weight] = max(dp[i + weight], dp[i] + value);
      |                                    ^
a.cc:20:52: error: invalid types 'int[int]' for array subscript
   20 |             dp[i + weight] = max(dp[i + weight], dp[i] + value);
      |                                                    ^
a.cc:24:7: error: expected ';' before 'answer'
   24 |     ll answer = 0;
      |       ^~~~~~~
      |       ;
a.cc:26:9: error: 'answer' was not declared in this scope
   26 |         answer = max(answer, dp[i]);
      |         ^~~~~~
a.cc:26:32: error: invalid types 'int[int]' for array subscript
   26 |         answer = max(answer, dp[i]);
      |                                ^
a.cc:28:22: error: 'answer' was not declared in this scope
   28 |     printf("%lld\n", answer);
      |                      ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#include <math.h>
int dp[100000]={0};
func(int w,int i,int arr[][2],int n)
{
     if(w<0)
    {
        return -1*arr[i-1][1];
    }

    if(i>n-1)
    {
        return 0;
    }


    return max(arr[i][1]+func(w-arr[i][0],i+1,arr,n),func(w,i+1,arr,n));

}

int main()
{
    int n,w;
    cin>>n;
    cin>>w;
    int arr[n][2];
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<2;j++)
        {
            cin>>arr[i][j];
        }
    }
   cout<<func(w,0,arr,n);
    //cout<<dp[0];
    return 0;
}


Compiler output:
a.cc:5:1: error: ISO C++ forbids declaration of 'func' with no type [-fpermissive]
    5 | func(int w,int i,int arr[][2],int n)
      | ^~~~
Language: C++

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

int max(int a, int b) 
{ 
    if(a>b)
        return a;
    else
        return b;
} 

int knapSack(int W, int wt[], int val[], int n) 
    { 
        if (n == 0 || W == 0) 
        	return 0; 
        if (wt[n-1] > W) 
        	return knapSack(W, wt, val, n-1); 
        else 
            return max( val[n-1] + knapSack(W-wt[n-1], wt, val, n-1), knapSack(W, wt, val, n-1) ); 
    } 
int main() 
{ 
    int n,W;
    cin>>n>>W;
	long long int val[n],wt[n]; 
	for(int i=0;i<n;i++)
	    {
	        cin>>wt[i]>>val[i];
	    }
	cout<<knapSack(W, wt, val, n); 
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:30:27: error: cannot convert 'long long int*' to 'int*'
   30 |         cout<<knapSack(W, wt, val, n);
      |                           ^~
      |                           |
      |                           long long int*
a.cc:12:25: note:   initializing argument 2 of 'int knapSack(int, int*, int*, int)'
   12 | int knapSack(int W, int wt[], int val[], int n)
      |                     ~~~~^~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <climits>
#include <queue>
#include <cstring>
#include <stack>
#include <map>
using namespace std;
#define rep(i,a,b) for(int i=a; i<=b; i++)
#define ii pair <int, int>
#define fi first
#define se second
#define ll unsigned long long
int n, w;
ll f[101][100001];
ii a[101];

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0);
//	freopen("Test.inp", "r", stdin);
//    freopen("Test.out", "w", stdout);
    cin>>n>>w;
    rep(i,1,n) cin>>a[i].fi>>a[i].se;
    rep(i,1,n){
        rep(j,1,w){
            f[i][j]=f[i-1][j];
            if(a[i].fi<=j) f[i][j] = maz(f[i][j], f[i-1][j-a[i].fi] + a[i].se);
        }
    }
    cout<<f[n][w];
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:38: error: 'maz' was not declared in this scope
   33 |             if(a[i].fi<=j) f[i][j] = maz(f[i][j], f[i-1][j-a[i].fi] + a[i].se);
      |                                      ^~~