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

//in the name of god
//if you read this code please search about imam hussain
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define pb push_back
#define endl "\n"
#define X first
#define Y second
#define pii pair<int,int>
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define read freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout)

const int maxn=1e5+5;
const int mod=1e9+7;
const int inf=1e9;
const int del=728729;

ll poww(ll a, ll b, ll md) {return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));}
ll dp[105][100005];

ll w[10000],v[10000];

ll n ;
ll m ; 
ll w[maxn];
ll v[maxn];
ll dp[100][maxn];
int main(){
	migmig;
	
	cin >> n >> m ;
	
	for(int i=0;i<n;i++){
    	cin>>w[i]>>v[i];
  	}
  	
  	for(int i=1;i<=n;i++){
    	for(int j=0;j<=m;j++){
      		if(w[i-1]<=j){
      				dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i-1]]+v[i-1]);
			  } 
      		else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
    	}
  	}
  cout<<dp[n][m]<<"\n";
}
	return 0;
}



Compiler output:
a.cc:29:4: error: conflicting declaration 'll w [100005]'
   29 | ll w[maxn];
      |    ^
a.cc:25:4: note: previous declaration as 'll w [10000]'
   25 | ll w[10000],v[10000];
      |    ^
a.cc:30:4: error: conflicting declaration 'll v [100005]'
   30 | ll v[maxn];
      |    ^
a.cc:25:13: note: previous declaration as 'll v [10000]'
   25 | ll w[10000],v[10000];
      |             ^
a.cc:31:4: error: conflicting declaration 'll dp [100][100005]'
   31 | ll dp[100][maxn];
      |    ^~
a.cc:23:4: note: previous declaration as 'll dp [105][100005]'
   23 | ll dp[105][100005];
      |    ^~
a.cc:51:9: error: expected unqualified-id before 'return'
   51 |         return 0;
      |         ^~~~~~
a.cc:52:1: error: expected declaration before '}' token
   52 | }
      | ^
Language: C++

//in the name of god
//if you read this code please search about imam hussain
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define pb push_back
#define endl "\n"
#define X first
#define Y second
#define pii pair<int,int>
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define read freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout)

const int maxn=1e5+5;
const int mod=1e9+7;
const int inf=1e9;
const int del=728729;

ll poww(ll a, ll b, ll md) {return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));}
ll dp[105][100005];

ll w[10000],v[10000];

ll n ;
ll m ; 
ll w[maxn];
ll v[maxn];
int main(){
	migmig;
	
	cin >> n >> m ;
	
	for(int i=0;i<n;i++){
    	cin>>w[i]>>v[i];
  	}
  	
  	for(int i=1;i<=n;i++){
    	for(int j=0;j<=m;j++){
      		if(w[i-1]<=j){
      				dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i-1]]+v[i-1]);
			  } 
      		else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
    	}
  	}
  cout<<dp[n][m]<<"\n";
}
	return 0;
}



Compiler output:
a.cc:29:4: error: conflicting declaration 'll w [100005]'
   29 | ll w[maxn];
      |    ^
a.cc:25:4: note: previous declaration as 'll w [10000]'
   25 | ll w[10000],v[10000];
      |    ^
a.cc:30:4: error: conflicting declaration 'll v [100005]'
   30 | ll v[maxn];
      |    ^
a.cc:25:13: note: previous declaration as 'll v [10000]'
   25 | ll w[10000],v[10000];
      |             ^
a.cc:50:9: error: expected unqualified-id before 'return'
   50 |         return 0;
      |         ^~~~~~
a.cc:51:1: error: expected declaration before '}' token
   51 | }
      | ^
Language: C++

#include<iostream>

using namespace std;
long long int max(long long int a,long long int b)
{
    if(a>=b)
    return a;
    return b;
}
int main()
{

  long long int n,w;
	    cin>>n;
	    cin>>w;
	    long long int value[n];
	    long long int weight[n];
	    for(long long int i=0;i<n;i++)
        { cin>>weight[i];
	    cin>>value[i];
        }
  

  
long long int dp[n+1][w+1];
  
  for(long long int i=0;i<=n;i++)
  {
    for(long long int j=0;j<=w;j++)
    {
	if(i==0||j==0)
      dp[i][j]=0;
      else if(weight[i-1]>j)
        dp[i][j]=dp[i-1][j];
      else
        dp[i][j]=max(val[i-1]+dp[i-1][j-weight[i-1]],dp[i-1][j]);
    }
  }
  
 cout<<dp[n][w]<<endl;
 
  
  return 0;
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:36:22: error: 'val' was not declared in this scope; did you mean 'value'?
   36 |         dp[i][j]=max(val[i-1]+dp[i-1][j-weight[i-1]],dp[i-1][j]);
      |                      ^~~
      |                      value
Language: C++

#include<iostream>

using namespace std;
long long int max(long long int a,long long int b)
{
    if(a>=b)
    return a;
    return b;
}
int main()
{

  long long int n,w;
	    cin>>n;
	    cin>>w;
	    long long int value[n];
	    long long int weight[n];
	    for(long long int i=0;i<n;i++)
        { cin>>weight[i];
	    cin>>value[i];
        }
  

  
long long int dp[n+1][w+1];
  
  for(long long int i=0;i<=n;i++)
  {
    for(long long int j=0;j<=w;j++)
    {
	if(i==0||j==0)
      dp[i][j]=0;
      else if(weight[i-1]>j)
        dp[i][j]=dp[i-1][j];
      else
        dp[i][j]=max(val[i-1]+dp[i-1][j-weight[i-1]],dp[i-1][j])
    }
  }
  
 cout<<dp[n][w]<<endl;
 
  
  return 0;
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:36:22: error: 'val' was not declared in this scope; did you mean 'value'?
   36 |         dp[i][j]=max(val[i-1]+dp[i-1][j-weight[i-1]],dp[i-1][j])
      |                      ^~~
      |                      value
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <utility>

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;

using namespace std;

int N,W,w[105],v[105];
int mem[105][10005];

int dp(int i,int j){
    if(i==n){
	return 0;
    }
    if(mem[i][j]!=-1){
	return mem[i][j];
    }
    if(j+w[i]>W){
	return mem[i][j]=dp(i+1,j);
    }
    return mem[i][j]=max(dp(i+1,j+w[i])+v[i],dp(i+1,j));
}

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

    cin>>N>>W;
    rep(i,N){
	cin>>w[i]>>v[i];
    }

    memset(mem,-1,sizeof(mem));
    cout<<dp(0,0)<<'\n';
    return 0;
}


Compiler output:
a.cc: In function 'int dp(int, int)':
a.cc:27:11: error: 'n' was not declared in this scope
   27 |     if(i==n){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define N 100000
int f[N];
int main(){
    int n,w;
    int w[100],v[100];
    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;j<w[i];j--){
            if(f[j-w[i]+v[i]>f[j])f[j]=f[j-w[i]]+v[i];

        }
    }
    cout<<f[w]<<"\n";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: conflicting declaration 'int w [100]'
    7 |     int w[100],v[100];
      |         ^
a.cc:6:11: note: previous declaration as 'int w'
    6 |     int n,w;
      |           ^
a.cc:9:31: error: invalid types 'int[int]' for array subscript
    9 |     for(int i=0;i<n;i++)cin>>w[i]>>v[i];
      |                               ^
a.cc:11:24: error: invalid types 'int[int]' for array subscript
   11 |         for(int j=w;j<w[i];j--){
      |                        ^
a.cc:12:21: error: invalid types 'int[int]' for array subscript
   12 |             if(f[j-w[i]+v[i]>f[j])f[j]=f[j-w[i]]+v[i];
      |                     ^
a.cc:12:34: error: expected ']' before ')' token
   12 |             if(f[j-w[i]+v[i]>f[j])f[j]=f[j-w[i]]+v[i];
      |                                  ^
      |                                  ]
a.cc:12:45: error: invalid types 'int[int]' for array subscript
   12 |             if(f[j-w[i]+v[i]>f[j])f[j]=f[j-w[i]]+v[i];
      |                                             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int knapsack( int w1,long long int w[],long long int v[],int n){
    int k[n+1][w1+1];
    for(int i=0;i<=n;i++){
        for(int w2=0;w2<=w1;w2++){
            if(i==0||w2==0){
                k[i][w2]=0;
            }
            else if(w[i-1]<=w2){
                k[i][w2]=max(v[i-1]+k[i-1][w2-w[i-1]],k[i-1][w2]);
            }
            else{
                k[i][w2]=k[i-1][w2];
            }
        }
    }
    return k[n][w1];
}
int main()
{
    int n,w1;
    cin>>n>>w1;
    long long int w[n];
    long long int v[n];
    for(int i=0;i<n;i++){
        cin>>w[i]>>v[i];
    }
    cout<<knapsack(w1,w,v,n);
}

Compiler output:
a.cc: In function 'int knapsack(int, long long int*, long long int*, int)':
a.cc:11:29: error: no matching function for call to 'max(long long int, int&)'
   11 |                 k[i][w2]=max(v[i-1]+k[i-1][w2-w[i-1]],k[i-1][w2]);
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:29: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   11 |                 k[i][w2]=max(v[i-1]+k[i-1][w2-w[i-1]],k[i-1][w2]);
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:29: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   11 |                 k[i][w2]=max(v[i-1]+k[i-1][w2-w[i-1]],k[i-1][w2]);
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    long long int n,k,a[102],p[102,dp[102[100006];
    cin>>n>>k;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=1;i<=n;i++){
        cin>>p[i];
    }
    dp[0][0]=0;
    for(int i=1;i<=n;i++){
        for(int j=0;j<=k;j++){
            dp[i][j]=dp[i-1][j];
            if(j-a[i]>=0)dp[i][j]=max(dp[i][j],dp[i-1][j-a[i]]+p[i]);
        }
     }
     cout<<dp[n][k]<<'\n';
 
 
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'ios_base' has not been declared
    3 |     ios_base::sync_with_stdio(0);
      |     ^~~~~~~~
a.cc:4:5: error: 'cin' was not declared in this scope
    4 |     cin.tie(0);
      |     ^~~
a.cc:5:35: error: expected ']' before ',' token
    5 |     long long int n,k,a[102],p[102,dp[102[100006];
      |                                   ^
      |                                   ]
a.cc:5:42: error: invalid types 'int[int]' for array subscript
    5 |     long long int n,k,a[102],p[102,dp[102[100006];
      |                                          ^
a.cc:5:50: error: expected ']' before ';' token
    5 |     long long int n,k,a[102],p[102,dp[102[100006];
      |                                                  ^
      |                                                  ]
a.cc:11:14: error: 'p' was not declared in this scope
   11 |         cin>>p[i];
      |              ^
a.cc:13:5: error: 'dp' was not declared in this scope
   13 |     dp[0][0]=0;
      |     ^~
a.cc:17:64: error: 'p' was not declared in this scope
   17 |             if(j-a[i]>=0)dp[i][j]=max(dp[i][j],dp[i-1][j-a[i]]+p[i]);
      |                                                                ^
a.cc:17:35: error: 'max' was not declared in this scope
   17 |             if(j-a[i]>=0)dp[i][j]=max(dp[i][j],dp[i-1][j-a[i]]+p[i]);
      |                                   ^~~
a.cc:20:6: error: 'cout' was not declared in this scope
   20 |      cout<<dp[n][k]<<'\n';
      |      ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>w;
  vector<int> weight(n);
   vector<int> value(n);
  for(int i=1;i<=n;i++) cin>>weight[i];
   for(int i=1;i<=n;i++) cin>>value[i];
  vector<int> k(n+1)(m+1);
  for(int i=0;i<=n;i++){
    for(int j=0;j<=m;j++){
      if(i==0 || j==0) k[i][j]=0;
      
      else if(weight[i-1] <= j)
        k[i][j]=max(k[i-1][j],k[i-1][j-weight[i]]+value[i]);
      else
        k[i][j]=k[i-1][j];
    }
  }
  cout<<k[n][w];
  return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:11: error: 'w' was not declared in this scope
    5 |   cin>>n>>w;
      |           ^
a.cc:10:21: error: expected ',' or ';' before '(' token
   10 |   vector<int> k(n+1)(m+1);
      |                     ^
a.cc:13:28: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   13 |       if(i==0 || j==0) k[i][j]=0;
      |                            ^
a.cc:16:13: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   16 |         k[i][j]=max(k[i-1][j],k[i-1][j-weight[i]]+value[i]);
      |             ^
a.cc:16:27: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   16 |         k[i][j]=max(k[i-1][j],k[i-1][j-weight[i]]+value[i]);
      |                           ^
a.cc:16:37: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   16 |         k[i][j]=max(k[i-1][j],k[i-1][j-weight[i]]+value[i]);
      |                                     ^
a.cc:18:13: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   18 |         k[i][j]=k[i-1][j];
      |             ^
a.cc:18:23: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   18 |         k[i][j]=k[i-1][j];
      |                       ^
Language: Java

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

public class KnapSack2 {
final static int INF=(int) 1e9;
static int []w;
static int []v;
static long memo[][];
static int n;
	public static void main(String[] args) {

		Scanner sc=new Scanner(System.in);
		n=sc.nextInt();
		int maxw=sc.nextInt();
		v=new int[n+1];
		w=new int[n+1];
		memo=new long[maxw+1][n+1];
		for(int i=0;i<=maxw;i++)
			Arrays.fill(memo[i],-1);
		for(int i=0;i<n;i++ ) {
			w[i]=sc.nextInt();
			v[i]=sc.nextInt();
		}
		
		System.out.println(dp(maxw,0));
		
	}
	public static long dp(int remw,int idx) {
		if(remw<0) {
			return -INF;
		}
		if(remw==0||idx==n) {
			return 0;
		}
		if(memo[remw][idx]!=-1)
			return memo[remw][idx];
		
		return memo[remw][idx]=Math.max(dp(remw-w[idx],idx+1)+v[idx],dp(remw,idx+1));
	}

}


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

#include <iostream>
#include <cmath>
using namespace std;
int knapsackA(int w,int wt[],int val[],int n){
    if(w==0 || n==0){
        return 0;
    }
    if(wt[n-1]>w){
        return knapsackA(w,wt,val,n-1);
    }
    return max(knapsackA(w-wt[n-1],wt,val,n-1)+val[n-1],knapsackA(w,wt,val,n-1));
}
long int knapsackADP(int w,int wt[],int val[],int n){
    long int dp[n+1][w+1];
    for(int i=0;i<=n;i++){
        for(int j=0;j<=w;j++){
            if(i==0 || j==0){
                dp[i][j]=0;
            }
            else if(wt[i-1]<=j){
                dp[i][j]=max((dp[i-1][j-wt[i-1]]+val[i-1]),dp[i-1][j]);
            }
            else{
                dp[i][j]=dp[i-1][j];
            }
        }
    }
    return dp[n][w];
}
int main() {
    int n,w;
    cin>>n>>w;
    long int wt[n];
    long int val[n];
    for(int i=0;i<n;i++){
        cin>>wt[i]>>val[i];
    }
    cout<<knapsackADP(w,wt,val,n)<<endl;

    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:25: error: cannot convert 'long int*' to 'int*'
   38 |     cout<<knapsackADP(w,wt,val,n)<<endl;
      |                         ^~
      |                         |
      |                         long int*
a.cc:13:32: note:   initializing argument 2 of 'long int knapsackADP(int, int*, int*, int)'
   13 | long int knapsackADP(int w,int wt[],int val[],int n){
      |                            ~~~~^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll a[100000][2];
ll dp[100000][2];
int n,w;
ll rec(int idx, int c)
{
	if(dp[idx][c]!=0)
	{ return dp[idx][c];}
	if(idx==n)
	{
		return 0;
	}
	ll x=-1;
	if(a[idx][0]>c)
	{
		x=rec(idx+1,c));
		dp[idx][c]=x;
	}
	else{
	 x=rec(idx+1,c);
     x=max(rec(idx+1,c-a[idx][0])+a[idx][1], x);
     return dp[idx][c]=x;
     }
}
int main()
{
	cin>>n>>w;
	for(int i=0;i<n;i++)
	{
	    for(int j=0;j<2;j++)
	    {
	        cin>>a[i][j];
	    }
	}
	cout<<rec(0,w);
}
	

Compiler output:
a.cc: In function 'long long int rec(int, int)':
a.cc:18:31: error: expected ';' before ')' token
   18 |                 x=rec(idx+1,c));
      |                               ^
      |                               ;
a.cc:26:1: warning: control reaches end of non-void function [-Wreturn-type]
   26 | }
      | ^
Language: Java

import java.util.Scanner;;

public class Fuck {
static int []iw;
static int[]iv;
static int n;

public static int val(int in,int w) {
	if(in==n||w<=0)
		return 0;
	if(iw[in]>w)
		return 0;
	return Math.max(val(in+1,w),iv[in]+val(in+1,w-iw[in]));
}

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		n=sc.nextInt();
		int w=sc.nextInt();
		iw=new int[n];
		iv=new int[n];
		for(int i=0;i<n;i++) {
			iw[i]=sc.nextInt();
			iv[i]=sc.nextInt();
		}
		System.out.println(val(0,w));
		
		
		sc.close();
	}

}


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

#include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
typedef pair <int,int> ii ;
typedef vector < ii > vii ;
typedef vector < vii > viii ;
#define rep(i,n)                   for( ll i = 0 ; i < n ; i++)
#define repu(i,a,b)                for(int i = a ; i <= b ; i++) 
#define repd(i,b,a)                for(int i = b ; i >= a ; i--)
#define pb push_back
#define db double 
#define fi first
#define se second

int solveDp(int r, int i, int* w, int* val, int n) 
{ 
    // Base cases 
    if (r <= 0) 
        return 0; 
    if (i == n) 
        return W_MAX; 
    if (v[r][i]) 
        return dp[r][i]; 
  
    // Marking state as solved 
    v[r][i] = 1; 
  
    // Recurrence relation 
    dp[r][i] 
        = min(solveDp(r, i + 1, w, val, n), 
              w[i] + solveDp(r - val[i], 
                             i + 1, w, val, n)); 
    return dp[r][i]; 
} 
  

int maxWeight(int* w, int* val, int n, int c) 
{ 
  
    // Iterating through all possible values 
    // to find the the largest value that can 
    // be represented by the given weights 
    for (int i = V_SUM_MAX; i >= 0; i--) { 
        if (solveDp(i, 0, w, val, n) <= c) { 
            return i; 
        } 
    } 
    return 0; 
} 

int main() {
   ll n,w; cin>>n>>w;
  ll val[n], wt[n];
   rep(i,n) {
   	cin>>wt[i]>>val[i];
   }
    cout << maxWeight(wt, val, n, w); 
  
}

Compiler output:
a.cc: In function 'int solveDp(int, int, int*, int*, int)':
a.cc:21:16: error: 'W_MAX' was not declared in this scope; did you mean 'NL_NMAX'?
   21 |         return W_MAX;
      |                ^~~~~
      |                NL_NMAX
a.cc:22:9: error: 'v' was not declared in this scope
   22 |     if (v[r][i])
      |         ^
a.cc:23:16: error: 'dp' was not declared in this scope; did you mean 'dup'?
   23 |         return dp[r][i];
      |                ^~
      |                dup
a.cc:26:5: error: 'v' was not declared in this scope
   26 |     v[r][i] = 1;
      |     ^
a.cc:29:5: error: 'dp' was not declared in this scope; did you mean 'dup'?
   29 |     dp[r][i]
      |     ^~
      |     dup
a.cc: In function 'int maxWeight(int*, int*, int, int)':
a.cc:43:18: error: 'V_SUM_MAX' was not declared in this scope
   43 |     for (int i = V_SUM_MAX; i >= 0; i--) {
      |                  ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:57:23: error: cannot convert 'll*' {aka 'long long int*'} to 'int*'
   57 |     cout << maxWeight(wt, val, n, w);
      |                       ^~
      |                       |
      |                       ll* {aka long long int*}
a.cc:37:20: note:   initializing argument 1 of 'int maxWeight(int*, int*, int, int)'
   37 | int maxWeight(int* w, int* val, int n, int c)
      |               ~~~~~^
Language: Java

import java.util.*;
import java.io.*;
public class Q {
   static class pair implements Comparable<pair>{
        int a;
        long b;
        public pair(int a, long b){
            this.a=a;
            this.b=b;
        }
        public int compareTo(pair p){
            return (a-p.a==0)?Long.compare(b,p.b):Integer.compare(a,p.a);
        }
          
   }
  public static void main(String[] args) throws IOException,InterruptedException{
	BufferedReader	 br = new BufferedReader(new InputStreamReader(System.in));
	PrintWriter out = new PrintWriter(System.out);
     	// String s = br.readLine();
        // char[] arr=s.toCharArray();
        // ArrayList<Integer> arrl = new ArrayList<Integer>(); 
        // TreeSet<Integer> ts1 = new TreeSet<Integer>(); 
        // HashSet<Integer> h = new HashSet<Integer>(); 
        // HashMap<Integer, Integer> map= new HashMap<>(); 
        // PriorityQueue<String> pQueue = new PriorityQueue<String>(); 
        // LinkedList<String> object = new LinkedList<String>(); 
        // StringBuilder str = new StringBuilder();
        
        //*******************************************************//
 	   //  StringTokenizer   st = new StringTokenizer(br.readLine());
 	   // 	  int t = Integer.parseInt(st.nextToken());
 	   //    while(t-->0){
 	   //        st = new StringTokenizer(br.readLine());
 	   // 	  int n = Integer.parseInt(st.nextToken());
 	   // 	  int[] arr = new int[n];
 	   // 	  st = new StringTokenizer(br.readLine());
 	   // 	  for(int i=0; i<n; i++){
 	   // 	      arr[i] =Integer.parseInt(st.nextToken());
 	   // 	  }
 	   // 	  int ans =0;
 	   // 	  out.println(ans);
 	   //    }
 	         StringTokenizer   st = new StringTokenizer(br.readLine());
 	    	  n = Integer.parseInt(st.nextToken());
 	    	  w = Integer.parseInt(st.nextToken());
 	    	 arr = new pair[n];
 	    	 for(int i=0; i<n; i++){
 	    	     st = new StringTokenizer(br.readLine());
 	    	  arr[i] = new pair(Integer.parseInt(st.nextToken()),Long.parseLong(st.nextToken()));
 	    	 }
 	    	 dp = new long[n][w+5];
 	    	 for(int i=0; i<n; i++) Arrays.fill(dp[i],-1l);
 	    	 out.println(solve(0,0));
              out.flush();
 	    	  }
 	    	  static int n;
 	    	  static int w;
 	    	  static long[][] dp;
 	    	  static pair [] arr;
              public static long solve(int i, int sum){
                  if(i>=n) return 0l;
                  if(dp[i][sum]!=-1) return dp[i][sum];
                  long take = (sum+arr[i].a<=w)?arr[i].b+ solve(i+1,sum+arr[i].a):(long)-1e17;
                  long leave = solve(i+1,sum);
                  return dp[i][sum] = Math.max(take,leave);
              }
	}
	
	


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

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

public class A {
	static int n;
	static int w;
	static int[] val;
	static int[] wei;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		n = sc.nextInt();
		w = sc.nextInt();
		val = new int[n];
		wei = new int[n];

		for (int i = 0; i < n; i++) {
			wei[i] = sc.nextInt();
			val[i] = sc.nextInt();
		}
		out.println(dp(0, 0));

		out.flush();
	}

	public static int dp(int idx, int totW) {
		if (totW > w) {
			return -999999999;
		}
		if (idx >= n) {
			return 0;
		}
		if (totW == w) {
			return 0;
		}
	
		int take = val[idx] + dp(idx + 1, totW + wei[idx]);
		int leave = dp(idx + 1, totW);
		return Math.max(take, leave);
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

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

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

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

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

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

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

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

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

import java.util.Scanner;


public class Knapsack {
	public static long Knapsack(long W,int n,long[]w,long[]v){
		if(n==0||W==0){
			return 0;
		}else{ if(w[n-1]>W){
			return Knapsack(W, n-1, w, v);}
		else{ return Math.max((v[n-1]+Knapsack(W-w[n-1], n-1, w, v)), (Knapsack(W, n-1, w, v)));
	}}}
	public static void main(String[]args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		long W=sc.nextLong();
		long []v=new long[n];
		long []w=new long[n];
		for(int i=0;i<n;i++){
			w[i]=sc.nextLong();
			v[i]=sc.nextLong();
		}
		System.out.print(Knapsack(W,n,w,v));
	}
}


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

import java.util.Scanner;


public class knapsack {
	public static int Knapsack(int W,int n,int[]w,int[]v){
		if(n==0||W==0){
			return 0;
		}else{ if(w[n-1]>W){
			return Knapsack(W, n-1, w, v);}
		else{ return Math.max(v[n-1]+Knapsack(W-w[n-1], n-1, w, v), Knapsack(W, n-1, w, v));
	}}}
	public static void main(String[]args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int W=sc.nextInt();
		int []v=new int[n+1];
		int []w=new int[n+1];
		v[0]=0;
		w[0]=0;
		for(int i=0;i<n;i++){
			w[i]=sc.nextInt();
			v[i]=sc.nextInt();
		}
		System.out.print(Knapsack(W,n,w,v));
	}
}

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

import java.util.Scanner;


public class Knapsack {
	public static int Knapsack(int W,int n,int[]w,int[]v){
		if(n==0||W==0){
			return 0;
		}else{ if(w[n-1]>W){
			return Knapsack(W, n-1, w, v);}
		else{ return Math.max(v[n-1]+Knapsack(W-w[n-1], n-1, w, v), Knapsack(W, n-1, w, v));
	}}}
	public static void main(String[]args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int W=sc.nextInt();
		int []v=new int[n+1];
		int []w=new int[n+1];
		v[0]=0;
		w[0]=0;
		for(int i=0;i<n;i++){
			w[i]=sc.nextInt();
			v[i]=sc.nextInt();
		}
		System.out.print(Knapsack(W,n,w,v));
	}
}

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


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

public class ggg {
    public static long ciel(long x,long y){
        long res=x/y;
        if(x%y!=0)res++;
        return res;
    }
    public static boolean check(String str){
        if(str.equals(".")||str.equals(",")||str.equals("!")||str.equals("?"))return true;
        return false;
    }
    public static long gcd(long u,long v){
        if(v==0)return u;
        return gcd(v, u%v);
    }
    static int n,m,mod= (int) (1e9+7);
    static long memo[][];
    static long inf= (long) 1e18;
    static int[]cost,weight;
    public static long dp(int i,int rem){
        if(rem<0)return -1*inf;
        if(i==n)return 0;
     if(memo[i][rem]!=-1)return memo[i][rem];
     return memo[i][rem]=Math.max(dp(i+1, rem),cost[i]+ dp(i+1,rem-weight[i]));
    }
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        PrintWriter pw=new PrintWriter(System.out);
        n=sc.nextInt();
        int w=sc.nextInt();
        weight=new int[n];
        cost=new int[n];
    for(int i=0;i<n;i++){
        weight[i]=sc.nextInt();
        cost[i]=sc.nextInt();
    }
        memo=new long[n][w+1];
        for(long []x:memo)Arrays.fill(x, -1);
        pw.println(dp(0, w));
        pw.close();
    }

  public static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

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

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

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

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

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException, IOException {
            return br.ready();
        }

    }
}


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


                    import java.io.*;
                    import java.util.*;
                        public class Main {

                    	    static long[][] dp = new long[105][1000000+5];
                    	    public static long f(int[] arr,int[] w,int n,int sum,int W) {
                    	    	if(n==arr.length)return 0;
                    	    	if(dp[n][sum]!=-1)return dp[n][sum];
                    	    	if(w[n]+sum<=W) {
                    	    		return dp[n][sum] = Math.max(arr[n]+f(arr,w,n+1,sum+w[n],W), f(arr,w,n+1,sum,W));
                    	    	}
                    	    	return dp[n][sum] = f(arr,w,n+1,sum,W);
                    	    }
                    	public static void main(String[] args) throws IOException {
                    		
                    		Scanner sc = new Scanner(System.in);
                    		for(int i=0;i<dp.length;i++)
                    			for(int j=0;j<dp[i].length;j++)
                    				dp[i][j]=-1;
                    		int n = sc.nextInt();int W= sc.nextInt();
                    		int[] arr = new int[n];int[] w = new int[n];
                    		for(int i=0;i<n;i++) {
                    			w[i] = sc.nextInt();arr[i] = sc.nextInt();
                    		}
                    		pw.println(f(arr,w,0,0,W));
                    		pw.flush();
                    		pw.close();
                    	}
                    }


Compiler output:
Main.java:26: error: cannot find symbol
                    		pw.println(f(arr,w,0,0,W));
                    		^
  symbol:   variable pw
  location: class Main
Main.java:27: error: cannot find symbol
                    		pw.flush();
                    		^
  symbol:   variable pw
  location: class Main
Main.java:28: error: cannot find symbol
                    		pw.close();
                    		^
  symbol:   variable pw
  location: class Main
3 errors
Language: Java

package specialists;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Knapsack {
	static long [][] memo ;
	static int [] w ;
	static int [] v;
	public static long dp(int i,int max) {
		if(i==memo.length)return 0;
		if (w[i]>max) { 
		return 	memo[i][max]=dp(i+1, max);
		}
		long take = dp(i+1, max-w[i])+ v[i];
		long leave = dp(i+1, max);
		 return memo[i][max]= Math.max(take, leave);
	}

	public static void main(String[] args) throws IOException {
		  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		   StringTokenizer st = new StringTokenizer(br.readLine());
			int n = Integer.parseInt(st.nextToken());
			int W = Integer.parseInt(st.nextToken());
			memo = new long [n][W+1];
			 w = new int [n];
			 v= new int [n];
			for (int i = 0; i < n; i++) {
				st = new StringTokenizer(br.readLine());
				w[i] = Integer.parseInt(st.nextToken());
				v[i]= Integer.parseInt(st.nextToken());
			}
			System.out.println(dp(0, W));

	}

}


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

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
int main(){
  ll n,w;cin>>n>>w;
  vector<ll> weight(n),value(n);
  cin>>weight[i]>>value[i];
  ll dp[n+1][w+1];
  rep(i,w+1) dp[0][i]=0;
  rep(i,n){
    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:8:15: error: 'i' was not declared in this scope
    8 |   cin>>weight[i]>>value[i];
      |               ^
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class solve {
    public static long max=0;
    public static void rec(long total,long[][]arr,int pos){
        rec(total,arr,pos,0);
    }
    public static void rec(long total,long[][]arr,int pos,long val){
        if(pos<0&&total>0){
            max=Long.max(max,val);
        }
        else if(total > 0){
            max=Long.max(max,val);
                rec(total - arr[pos][0], arr, pos - 1, val + arr[pos][1]);
                rec(total, arr, pos - 1, val);
        }
        else if(total==0){
            max=Long.max(max,val);
        }
    }
    public static void main(String[] args)throws IOException {
        PrintWriter out = new PrintWriter(System.out);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(br.readLine());
        int number = Integer.parseInt(st.nextToken());
        long [][] arr = new long[number][2];
        long weight= Long.parseLong(st.nextToken());
        for(int i = 0;i <number;i++){
            st=new StringTokenizer(br.readLine());
            arr[i][0]=Long.parseLong(st.nextToken());
            arr[i][1]=Long.parseLong(st.nextToken());
        }
        rec(weight,arr,number-1);
        out.println(max);
        out.flush();
    }
}

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

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class graph {
	static long  memo[][];
	static int we[];
	static long v[];
	public static long dp(int i,int w) {
        if(i==we.length||w==0)return 0;
		if(we[i]>w) {return dp(i+1,w);}else {
		 return	Math.max(dp(i+1,w), dp(i+1,w-we[i])+v[i]);
		}
		}
	
	public static void main(String []args) throws IOException {
 		PrintWriter pw =new PrintWriter(System.out);
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		StringTokenizer st =new StringTokenizer(br.readLine());
		int n=Integer.parseInt(st.nextToken());
		int w=Integer.parseInt(st.nextToken());
		we=new int [n];
		v=new long[n];
		for(int i=0;i<n;i++) {
			st =new StringTokenizer(br.readLine());
			we[i]=Integer.parseInt(st.nextToken());
			v[i]=Long.parseLong(st.nextToken());
		}
		System.out.println(dp(0,w));
		
		
}}

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

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class P1 {
	static int[][] weights;
	static long[][] memo;
	static int w , n;
	
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String inp[] = br.readLine().split(" ");
		 n = Integer.parseInt(inp[0]);
		 w = Integer.parseInt(inp[1]);
		weights = new int[n][2];
		memo = new long[n][w+1];
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<w;j++)
				memo[i][j]=-1;
		}
		for(int i=0;i<n;i++)
		{
			inp=br.readLine().split(" ");
			weights[i][0]=Integer.parseInt(inp[0]);
			weights[i][1]=Integer.parseInt(inp[1]);
		}
		System.out.println(dp(0,0));
		
	}
	
	public static long dp(int i , int weight)
	{
		if(i==n)return 0;
		
		if(memo[i][weight]!=-1)return memo[i][weight];
		long take=-1;
		if (weight+weights[i][0]<=w)
			take = dp(i+1,weight+weights[i][0])+weights[i][1];
		long leave = dp(i+1,weight);
		return memo[i][weight] = Math.max(take, leave);	
		
	}

}


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



import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.TreeMap;

import javafx.util.Pair;

public class Main{
//	static int[][] memo = new int[][];

	public static Pair<Integer, Long> dp(int[] weights, long[] values, int i, int N, int W) {
		if (i >= N)
			return new Pair(0, 0L);
		Pair<Integer, Long> p = dp(weights, values, i + 1, N, W);
		int takeWeight = weights[i] + p.getKey();
		long takeValue = values[i] + p.getValue();
		int leaveWeight = p.getKey();
		long leaveValue = p.getValue();
		if (takeWeight > W) {
			takeValue = 0;
			takeWeight = 0;
		}
		if (leaveWeight > W) {
			leaveValue = 0;
			leaveWeight = 0;
		}
		System.out.println((takeValue > leaveValue)? takeValue:leaveValue);
		return (takeValue > leaveValue)? new Pair<Integer, Long>(takeWeight, takeValue) : new Pair<Integer, Long>(leaveWeight, leaveValue);
	}
	public static long dp2(int[] weights, long[] values, int i, int N, int W, int curW) {
		if(i>=N || curW>W)
			return 0;
		long take = values[i]+dp2(weights,values,i+1,N,W,curW+weights[i]);
		if(weights[i]+curW>W)
			take = -1;
		long leave = dp2(weights,values,i+1,N,W,curW);
		return (take>leave)?take:leave;
		
	}

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int N = Integer.parseInt(st.nextToken());
		int W = Integer.parseInt(st.nextToken());
		int w;
		long v;
		int[] weights = new int[N];
		long[] values = new long[N];

		for (int i = 0; i < N; i++) {
			st = new StringTokenizer(br.readLine());
			w = Integer.parseInt(st.nextToken());
			v = Long.parseLong(st.nextToken());
			weights[i] = w;
			values[i] = v;
		}
//		System.out.println(dp(weights, values, 0, N, W).getValue());
		System.out.println(dp2(weights, values, 0, N, W,0));
	}

}


Compiler output:
Main.java:10: error: package javafx.util does not exist
import javafx.util.Pair;
                  ^
Main.java:15: error: cannot find symbol
	public static Pair<Integer, Long> dp(int[] weights, long[] values, int i, int N, int W) {
	              ^
  symbol:   class Pair
  location: class Main
Main.java:17: error: cannot find symbol
			return new Pair(0, 0L);
			           ^
  symbol:   class Pair
  location: class Main
Main.java:18: error: cannot find symbol
		Pair<Integer, Long> p = dp(weights, values, i + 1, N, W);
		^
  symbol:   class Pair
  location: class Main
Main.java:32: error: cannot find symbol
		return (takeValue > leaveValue)? new Pair<Integer, Long>(takeWeight, takeValue) : new Pair<Integer, Long>(leaveWeight, leaveValue);
		                                     ^
  symbol:   class Pair
  location: class Main
Main.java:32: error: cannot find symbol
		return (takeValue > leaveValue)? new Pair<Integer, Long>(takeWeight, takeValue) : new Pair<Integer, Long>(leaveWeight, leaveValue);
		                                                                                      ^
  symbol:   class Pair
  location: class Main
6 errors
Language: Java

import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
public class c {
    public static long dp(int[]w,int []v,int max){
        long[][] memo=new long[w.length+1][max+1];
        long ans=0;
        for(int i=w.length-1;i>=0;i--){
            for(int j=0;j<=max;j++){
                long take=0;
                long leave=0;
                if(j+w[i]<=max&&i!=w.length)take=memo[i+1][j+w[i]]+v[i];
                if(i!=w.length-1)leave=memo[i+1][j];
                memo[i][j]=Math.max(take,leave);
                ans=Math.max(memo[i][j],ans);
            }
        }

    return ans;
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        //StringBuilder sb=new StringBuilder();
        //StringTokenizer st=new StringTokenizer(br.readLine());
        //PriorityQueue<Integer> pq=new PriorityQueue<>();
        //HashSet<Integer> hs=new HashSet<>();
        //int q = Integer.parseInt(br.readLine());
        int kk =1;
        while (kk-- > 0) {
            StringTokenizer st=new StringTokenizer(br.readLine());
            int n =Integer.parseInt(st.nextToken());
            int max =Integer.parseInt(st.nextToken());

            int w[]=new int[n];
            int v[]=new int[n];
            for(int i=0;i<n;i++){
                st=new StringTokenizer(br.readLine());
                w[i]=Integer.parseInt(st.nextToken());
                v[i]=Integer.parseInt(st.nextToken());
            }

            out.println(dp(w,v,max));
            // for(int i=0;i<a.length;i++){
            //  out.println(Arrays.toString(a[i]));
            //}
            //out.println();
            //out.println(Arrays.toString(b));
        }//out.println();
        out.close();
    }
}

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

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

const int N = 150;
long long mem[N][M], n, w, arrW[M], V[N];

int DP(int i, int we){

    if(we > w || i >= n)
        return 0;
    if(mem[i][we] != -1)
        return mem[i][we];

    int op1 = we +arrW[i] <= w ? (DP(i+1, we + arrW[i]) + V[i]) : 0;  //Take
    int op2 = DP(i+1, we);  //Leave
    return mem[i][we] = max(op1, op2);
}

int main() {
    memset(mem, -1, sizeof(mem));
    scanf("%d %d",&n, &w);
    for(int i = 0 ; i < n ; ++i) {
    	scanf("%d", arrW + i);
    	scanf("%d", V + i);
    }
    //for(int i = 0 ; i < w ; ++i)    scanf("%d", V + i);
    printf("%d", DP(0, 0));

    return 0;
}

Compiler output:
a.cc:5:18: error: 'M' was not declared in this scope
    5 | long long mem[N][M], n, w, arrW[M], V[N];
      |                  ^
a.cc:5:33: error: 'M' was not declared in this scope
    5 | long long mem[N][M], n, w, arrW[M], V[N];
      |                                 ^
a.cc: In function 'int DP(int, int)':
a.cc:11:8: error: 'mem' was not declared in this scope
   11 |     if(mem[i][we] != -1)
      |        ^~~
a.cc:14:19: error: 'arrW' was not declared in this scope
   14 |     int op1 = we +arrW[i] <= w ? (DP(i+1, we + arrW[i]) + V[i]) : 0;  //Take
      |                   ^~~~
a.cc:16:12: error: 'mem' was not declared in this scope
   16 |     return mem[i][we] = max(op1, op2);
      |            ^~~
a.cc: In function 'int main()':
a.cc:20:12: error: 'mem' was not declared in this scope
   20 |     memset(mem, -1, sizeof(mem));
      |            ^~~
a.cc:23:21: error: 'arrW' was not declared in this scope
   23 |         scanf("%d", arrW + i);
      |                     ^~~~
Language: Java

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

public class dpA {

	static int MAXW = 100000+1;
	static int MAXN = 101;
	
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
		
		StringTokenizer st = new StringTokenizer(br.readLine());
		
		int n = Integer.parseInt(st.nextToken());
		int mw = Integer.parseInt(st.nextToken());
		
		long[] maxv = new long[mw+1];
		
		for(int i = 0; i < n; i++) {
			st = new StringTokenizer(br.readLine());
			int w = Integer.parseInt(st.nextToken());
			int v = Integer.parseInt(st.nextToken());
			for(int j = mw-w; j >=0; j--) {
				maxv[j+w] = Math.max(maxv[j] + v, maxv[j+w]);
			}
		}
		
		bw.write(""+maxv[mw]);
		bw.close();
	}

}


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