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

    #include<bits/stdc++.h>
    using namespace std;
    #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #define endl "\n"
    #define int long long

    const int N=1e5+5; 
    

    // int32_t main(){
    //     IOS;
    //     cin>>n>>s;
    //     int val[n],w[n];
    //     for(int i=0;i<n;i++){
    //         cin>>w[i]>>val[i];
    //     }
    //     int dp[n+1][s+1];
    //     for(int i=0;i<=n;i++)
    //         dp[i][0]=0;
    //     for(int i=1;i<=s;i++)
    //         dp[0][i]=0;
    //     for(int i=1;i<=n;i++){
    //         for(int j=1;j<=s;j++){
    //             if(j<w[i-1])
    //                 dp[i][j]=dp[i-1][j];
    //             else
    //             {
    //                 dp[i][j]=max(dp[i-1][j],val[i-1]+dp[i-1][j-w[i-1]]);
    //             }
                
    //         }
    //     }
    //     cout<<dp[n][s]<<endl;
    // return 0;

    // }

    // int knapsack(int w[],int val[],int s,int i,int*dp[]){
    //     if(i<0)
    //         return 0;
    //     if(dp[i][s]!=-1)
    //         return dp[i][s];
        
    //     if(w[i]>s){
    //         dp[i][s]=knapsack(w,val,s,i-1,dp);
    //         return dp[i][s];
    //     }
    //     else
    //     {
    //         dp[i][s]=max(val[i]+knapsack(w,val,s-w[i],i-1,dp),knapsack(w,val,s,i-1,dp));
    //         return dp[i][s];
    //     }
            
                
        
    // }

    
    int32_t main(){
        IOS;
        int s,n;
        cin>>n>>s;
        int val[n],w[n];
        int sum=0;
        for(int i=0;i<n;i++){
            cin>>w[i]>>val[i];
            sum+=val[i];
        }
        // int** dp;
        // dp=new int*[n];
        // for(int i=0;i<n;i++)
        //     dp[i]=new int[s+1];
        // for(int i=0;i<n;i++){
        //     for(int j=0;j<=s;j++)
        //         dp[i][j]=-1;
        // }
        // memset(dp,-1,sizeof(dp)*sizeof(int));
        int dp[n+1][sum+1];
        for(int i=0;i<=n;i++)
            dp[i][0]=0;
        for(int i=1;i<=n;i++){
            for(int  j=1;j<=sum;j++){
                dp[i][j]=min(dp[i-1][j],val[i-1]<=j?w[i-1]+dp[i-1][j]:INT_MAX);
            }
        }
        int ans=0;
        for(int i=sum;i>0;i--){
            if(dp[n][i]!=INT_MAX && dp[n][i]<=s){
                ans=i;
                break;
            }
        }
        cout<<ans<<endl;
        cout<<knapsack(w,val,s,n-1)<<endl;
    return 0;

    }

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:94:15: error: 'knapsack' was not declared in this scope
   94 |         cout<<knapsack(w,val,s,n-1)<<endl;
      |               ^~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
void min_self(ll& a, ll b){
  a = min(a,b);
}
int main(){
	ll n,w; cin>>n>>w;
	vector<ll> val(n), weight(n);
 	for(int i = 0 ; i < n; i++){
    	cin>>weight[i]>>val[i];
  	int sumtot = 0;
    for(int i = 0; i < n; i++)
      	sumtot += val[i];
    
	vector<ll> dp(sumtot+1,1e18);
    dp[0] = 0;
    for(int i = 0 ; i < n; i++){
    	for(int curr_val = sumtot - val[i]; curr_val >=0; curr_val--){
          min_self(dp[curr_val+val[i]], dp[curr_val]+weight[i]);
        }
    }
    ll ans = 1e18;
    for(int i = 1; i < sumtot+1; i++)
      min_self(ans, dp[i]);
    cout<<ans<<endl;
    return 0;
}
    


Compiler output:
a.cc: In function 'int main()':
a.cc:28:2: error: expected '}' at end of input
   28 | }
      |  ^
a.cc:7:11: note: to match this '{'
    7 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
void min_self(ll& a, ll b){
  a = min(a,b);
}
int main(){
	ll n,w; cin>>n>>w;
	vector<ll> val(n), weight(n);
 	for(int i = 0 ; i < n; i++){
    	cin>>weight[i]>>val[i];
  	int sumtot = 0;
    for(int i = 0; i < n; i++)
      	sumtot += val[i];
    
	vector<ll> dp(sumtot+1,1e18);
    dp[0] = 0;
    for(int i = 0 ; i < n; i++){
    	for(int curr_val = sumtot - val[i]; curr_val >=0; curr_val--){
          min_self(dp[curr_val+val[i]], dp[curr+val]+val[i]);
        }
    }
    ll ans = 1e18;
    for(int i = 1; i < sumtot+1; i++)
      min_self(ans, dp[i]);
    cout<<ans<<endl;
    return 0;
}
    


Compiler output:
a.cc: In function 'int main()':
a.cc:20:44: error: 'curr' was not declared in this scope
   20 |           min_self(dp[curr_val+val[i]], dp[curr+val]+val[i]);
      |                                            ^~~~
a.cc:28:2: error: expected '}' at end of input
   28 | }
      |  ^
a.cc:7:11: note: to match this '{'
    7 | int main(){
      |           ^
Language: C++

#include <bits\stdc++.h>

using namespace std;

const int maxV = 1e5+10;
const long long  INF = 1e14;
long long dp[maxV];

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

	fill(dp, dp+maxV-1, INF);
	dp[0] = 0;
	for (int i = 0; i < n; ++i) {
		int w, v;
		cin >> w >> v;
		
		for(int j = maxV-1; j >= 0; j--) {
			if(dp[j] != INF && j+v < maxV) {
				dp[j+v] = min(dp[j+v], dp[j]+w);
			}
		}
	}

	for(int i = maxV-5; i >= 0; --i) {
		if(dp[i] <= W) {
			cout << i;
			return 0;
		}
	}
}

Compiler output:
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory
    1 | #include <bits\stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: Java


import java.util.*;

public class Main{
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		int size = sc.nextInt();
		long maxWeight = sc.nextLong();
		long values[] = new long[size];
		long weight[] = new long[size];
		for(int i=0;i<values.length;i++){
			weight[i]=sc.nextLong();
			values[i]=sc.nextLong();
		}
		long dp[][] = new long[values.length+1][maxWeight+1];
		for(int i=0;i<dp.length;i++){
			for(int j=0;j<dp[0].length;j++){
				if(i==0||j==0)dp[i][j]=0;
				else if(weight[i-1]<=j){
					dp[i][j]=Math.max(dp[i-1][j],dp[i-1][j-weight[i-1]]+values[i-1]);
				}else{
					dp[i][j]=dp[i-1][j];
				}
			}
		} 
		System.out.println(dp[values.length][maxWeight]);
	}
}

Compiler output:
Main.java:15: error: incompatible types: possible lossy conversion from long to int
		long dp[][] = new long[values.length+1][maxWeight+1];
		                                                 ^
Main.java:20: error: incompatible types: possible lossy conversion from long to int
					dp[i][j]=Math.max(dp[i-1][j],dp[i-1][j-weight[i-1]]+values[i-1]);
					                                      ^
Main.java:26: error: incompatible types: possible lossy conversion from long to int
		System.out.println(dp[values.length][maxWeight]);
		                                     ^
3 errors
Language: C++

/*   ꧁༒☬महाकाल☬༒꧂ ꧁༒ঔमहाकालঔ༒꧂
                   
                   ঔৣ۝महाकालᴳᵒᵈ۝ঔৣ            
 
 */ 
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template <typename T, typename cmp=less<T>> using oset =tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long 
#define mod 1000000007
#define inf 100000000000000000
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _it iterator
#define all(_x) _x.begin(),_x.end()
#define f first
#define s second
#define pb push_back
#define ar array
#define ld long double
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};
char c[4]={'D' , 'R' , 'U' , 'L'};
const ll maxN=2e5+5 , N=2e3;
ll w[N] , v[N] , dp[N][maxN] , n , W;
void solve(){
	cin>> n >> W ;
	for(ll i=0;i<n ;i++)cin>>w[i]>>v[i];
	for(ll i=1;i<maxN ; i++)dp[0][i]=inf;
	for(ll i=1;i<=n ;i++){
		for(ll j=0;j<maxN ; j++)dp[i][j]=inf;
		for(ll j=0;j<maxN ; j++){
			dp[i][j]=min(dp[i][j] , dp[i-1][j]);
			if(j-v[i-1]>=0)dp[i][j]=min(dp[i][j] , dp[i-1][j-v[i-1]]+w[i-1]);
		}
	}
	ll ans=0;
	for(ll i=0;i<maxN ; i++){
		if(dp[n][i]<=W)ans=i;
	}
	cout<<ans<<endl;
}

int main(){
	// mahakal();
	fast;
	ll t =1 ;
	// cin>> t ; 
	while(t--)solve();
	// cerr << "\ntime taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl; 
	return 0;
}

Compiler output:
/tmp/ccOpEkwP.o: in function `solve()':
a.cc:(.text+0x7b): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccOpEkwP.o
a.cc:(.text+0x97): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccOpEkwP.o
a.cc:(.text+0x104): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccOpEkwP.o
a.cc:(.text+0x333): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccOpEkwP.o
a.cc:(.text+0x356): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccOpEkwP.o
a.cc:(.text+0x37e): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccOpEkwP.o
collect2: error: ld returned 1 exit status
Language: C++

/*   ꧁༒☬महाकाल☬༒꧂ ꧁༒ঔमहाकालঔ༒꧂
                   
                   ঔৣ۝महाकालᴳᵒᵈ۝ঔৣ            
 
 */ 
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template <typename T, typename cmp=less<T>> using oset =tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long 
#define mod 1000000007
#define inf 100000000000000000
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _it iterator
#define all(_x) _x.begin(),_x.end()
#define f first
#define s second
#define pb push_back
#define ar array
#define ld long double
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};
char c[4]={'D' , 'R' , 'U' , 'L'};
const ll maxN=2e5+5 , N=2e3;
ll w[N] , v[N] , dp[N][maxN] , n , W;
void solve(){
	cin>> n >> W ;
	for(ll i=0;i<n ;i++)cin>>w[i]>>v[i];
	for(ll i=1;i<maxN ; i++)dp[0][i]=inf;
	for(ll i=1;i<=n ;i++){
		for(ll j=0;j<maxN ; j++)dp[i][j]=inf;
		for(ll j=0;j<maxN ; j++){
			dp[i][j]=min(dp[i][j] , dp[i-1][j]);
			if(j-v[i-1]>=0)dp[i][j]=min(dp[i][j] , dp[i-1][j-v[i-1]]+w[i-1]);
		}
	}
	ll ans=0;
	for(ll i=0;i<maxN ; i++){
		if(dp[n][i]<=W)ans=i;
	}
	cout<<ans<<endl;
}

int main(){
	//mahakal();
	fast;
	ll t =1 ;
	// cin>> t ; 
	while(t--)solve();
	cerr << "\ntime taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl; 
	return 0;
}

Compiler output:
/tmp/ccR0mXaG.o: in function `solve()':
a.cc:(.text+0x7b): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccR0mXaG.o
a.cc:(.text+0x97): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccR0mXaG.o
a.cc:(.text+0x104): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccR0mXaG.o
a.cc:(.text+0x333): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccR0mXaG.o
a.cc:(.text+0x356): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccR0mXaG.o
a.cc:(.text+0x37e): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccR0mXaG.o
collect2: error: ld returned 1 exit status
Language: C++

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

long long memo[101][10e9+1];

long long knapsack(int N, int W, vector<long long>& weight, vector<long long>& value){
	if(N == 0 || W == 0){
		return 0;
	}
	if(memo[N][W] != -1) return memo[N][W];
	if(weight[N-1] > W){
		return memo[N][W] =  knapsack(N-1,W,weight,value);
	}
	else {
		return memo[N][W] = max(
			value[N-1] + knapsack(N-1, W - weight[N-1],weight,value),
			knapsack(N-1,W,weight,value)
		);
	}
}

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

	vector<long long>weight;
	vector<long long>value;

	memset(memo,-1,sizeof(memo));

	for(int i = 0; i < N; ++i){
		int w;
		int v;
		cin>>w>>v;
		weight.push_back(w);
		value.push_back(v);
	}
	// cout<<knapsack(N,W,weight,value);
	long long res = knapsack(N,W,weight,value);
	cout<<res<<endl;
}

Compiler output:
a.cc:4:25: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    4 | long long memo[101][10e9+1];
      |                     ~~~~^~
a.cc:4:25: error: could not convert '(1.0e+10 + (double)1)' from 'double' to 'long unsigned int'
    4 | long long memo[101][10e9+1];
      |                     ~~~~^~
      |                         |
      |                         double
a.cc:4:25: error: size of array 'memo' has non-integral type 'double'
Language: C++

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

long long memo[101][10e9+!];

long long knapsack(int N, int W, vector<long long>& weight, vector<long long>& value){
	if(N == 0 || W == 0){
		return 0;
	}
	if(memo[N][W] != -1) return memo[N][W];
	if(weight[N-1] > W){
		return memo[N][W] =  knapsack(N-1,W,weight,value);
	}
	else {
		return memo[N][W] = max(
			value[N-1] + knapsack(N-1, W - weight[N-1],weight,value),
			knapsack(N-1,W,weight,value)
		);
	}
}

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

	vector<long long>weight;
	vector<long long>value;

	memset(memo,-1,sizeof(memo));

	for(int i = 0; i < N; ++i){
		int w;
		int v;
		cin>>w>>v;
		weight.push_back(w);
		value.push_back(v);
	}
	// cout<<knapsack(N,W,weight,value);
	long long res = knapsack(N,W,weight,value);
	cout<<res<<endl;
}

Compiler output:
a.cc:4:27: error: expected primary-expression before ']' token
    4 | long long memo[101][10e9+!];
      |                           ^
a.cc: In function 'long long int knapsack(int, int, std::vector<long long int>&, std::vector<long long int>&)':
a.cc:10:12: error: 'memo' was not declared in this scope
   10 |         if(memo[N][W] != -1) return memo[N][W];
      |            ^~~~
a.cc:12:24: error: 'memo' was not declared in this scope
   12 |                 return memo[N][W] =  knapsack(N-1,W,weight,value);
      |                        ^~~~
a.cc:15:24: error: 'memo' was not declared in this scope
   15 |                 return memo[N][W] = max(
      |                        ^~~~
a.cc: In function 'int main()':
a.cc:29:16: error: 'memo' was not declared in this scope
   29 |         memset(memo,-1,sizeof(memo));
      |                ^~~~
Language: C++

//g++ t.cpp -o t && t < p.txt
//d>p.txt&&t<p.txt&&t2<p.txt

#include <iostream> // プログラムの耳と口
#include <vector> // 超有能配列秘書
#include <algorithm> // みんな大好きソートと二分探索
#include <queue> // きゅーちゃん、だいすき
#include <string> // to_string
#include <functional> // 関数を変数に入れる子
#include <set> // 値の取得・挿入・削除を高速に
#include <map> // setの妹 これまた優秀
#include <random> // 乱択さん
#include <cassert>

#define DB cerr<<"D"<<endl
using namespace std; using ll=long long; using ld=long double; const int INF=1e9; const ll LINF=1e18; const double dINF = 1e18; const ld ldINF = 1e18; const double EPS = 1e-6;
template<typename T, typename U, typename O> void caut(T a, U b, O c){cout<<"("<<a<<","<<b<<","<<c<<") ";} template<typename T, typename U> void caut(T a, U b){cout<<"("<<a<<","<<b<<") ";} template<typename T> void caut(T a){cout<<"("<<a<<") ";};
using P=pair<ll,ll>;
const ll M = 1e9+7;
ll mod_pow(ll x, ll a) { ll an = 1; while(a > 0) { if (a&1) an = an * x % M; x = x * x % M; a >>= 1;} return an;}
void add(ll& x, ll y) {x+=y; x%=M;}; void mul(ll& x, ll y) {x*=y; x%=M;}; template<typename T, typename U> void chmax(T& x, U y) {if (x<y) x=y;}; template<typename T, typename U> void chmin(T& x, U y) {if (x>y) x=y;}
bool vaild(int x, int y, int hh, int ww){return 0<=x&&x<hh&&0<=y&&y<ww;}
int keta(ll a) {int res=0; while(a>0) res+=(a%10/5)+(a%5), a/=10; return res;}

int main() {
  int n,W; cin>>n>>W;
  ll dp[100001]; fill(dp,dp+100001,LINF); dp[0]=0;
  for(int i=0;i<n;i++) {
    ll w,v; cin>>w>>v;
    for(int j=100001-v;j>=0;j--) {
      chmin(dp[j+v],dp[j]+w);
    }
  }
  ll an = 0;
  for(int i=0;i<=100000;i++) {
    if (dp[i] <= w) an = i;
  }
  cout<<an<<endl;
}
// ・配列の大きさok？　・priority_queueはgreater？　・debug消した？
// ・落ち着いて。提出まで4分待ってね……WJ……1/10……2/10……

// Thank you for making problems and running the contest

Compiler output:
a.cc: In function 'int main()':
a.cc:36:18: error: 'w' was not declared in this scope
   36 |     if (dp[i] <= w) an = i;
      |                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll dp[110][1000000007];
vector<ll> w1,v;
ll knap(ll n,ll w)
{
    if(n==0||w==0)return 0;
    if(dp[n][w]!=-1)return dp[n][w];
    else
    {
        if(w1[n]>w)
        {
            return dp[n][w]=knap(n-1,w)  ;     
            }
            
            else 
            {
                return dp[n][w]=max(v[n]+knap(n-1,w-w1[n]),knap(n-1,w));
            }
    }
}
int main()
{ll n,w;
    cin>>n>>w;
    memset(dp,-1,sizeof(dp));
w1.resize(n+1);
v.resize(n+1);
    for(int i=0;i<n;i++)
    {
        ll x,y;
        cin>>x>>y;
        w1[i+1]=x;
        v[i+1]=y;
    }
    cout<<knap(n,w);
    
}


Compiler output:
/tmp/cckvZAW3.o: in function `knap(long long, long long)':
a.cc:(.text+0x88): relocation truncated to fit: R_X86_64_PC32 against symbol `w1' defined in .bss section in /tmp/cckvZAW3.o
a.cc:(.text+0x12d): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cckvZAW3.o
a.cc:(.text+0x146): relocation truncated to fit: R_X86_64_PC32 against symbol `w1' defined in .bss section in /tmp/cckvZAW3.o
/tmp/cckvZAW3.o: in function `main':
a.cc:(.text+0x23c): relocation truncated to fit: R_X86_64_PC32 against symbol `w1' defined in .bss section in /tmp/cckvZAW3.o
a.cc:(.text+0x256): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cckvZAW3.o
a.cc:(.text+0x2a5): relocation truncated to fit: R_X86_64_PC32 against symbol `w1' defined in .bss section in /tmp/cckvZAW3.o
a.cc:(.text+0x2c6): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cckvZAW3.o
/tmp/cckvZAW3.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x31f): relocation truncated to fit: R_X86_64_PC32 against symbol `w1' defined in .bss section in /tmp/cckvZAW3.o
a.cc:(.text+0x338): relocation truncated to fit: R_X86_64_PC32 against symbol `w1' defined in .bss section in /tmp/cckvZAW3.o
a.cc:(.text+0x351): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cckvZAW3.o
a.cc:(.text+0x36a): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll dp[110][1000000009];
vector<ll> w1,v;
ll knap(ll n,ll w)
{
    if(n==0||w==0)return 0;
    if(dp[n][w]!=-1)return dp[n][w];
    else
    {
        if(w1[n]>w)
        {
            return dp[n][w]=knap(n-1,w)  ;     
            }
            
            else 
            {
                return dp[n][w]=max(v[n]+knap(n-1,w-w1[n]),knap(n-1,w));
            }
    }
}
int main()
{ll n,w;
    cin>>n>>w;
    memset(dp,-1,sizeof(dp));
w1.resize(n+1);
v.resize(n+1);
    for(int i=0;i<n;i++)
    {
        ll x,y;
        cin>>x>>y;
        w1[i+1]=x;
        v[i+1]=y;
    }
    cout<<knap(n,w);
    
}


Compiler output:
/tmp/cc0fjvOF.o: in function `knap(long long, long long)':
a.cc:(.text+0x88): relocation truncated to fit: R_X86_64_PC32 against symbol `w1' defined in .bss section in /tmp/cc0fjvOF.o
a.cc:(.text+0x12d): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc0fjvOF.o
a.cc:(.text+0x146): relocation truncated to fit: R_X86_64_PC32 against symbol `w1' defined in .bss section in /tmp/cc0fjvOF.o
/tmp/cc0fjvOF.o: in function `main':
a.cc:(.text+0x23c): relocation truncated to fit: R_X86_64_PC32 against symbol `w1' defined in .bss section in /tmp/cc0fjvOF.o
a.cc:(.text+0x256): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc0fjvOF.o
a.cc:(.text+0x2a5): relocation truncated to fit: R_X86_64_PC32 against symbol `w1' defined in .bss section in /tmp/cc0fjvOF.o
a.cc:(.text+0x2c6): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc0fjvOF.o
/tmp/cc0fjvOF.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x31f): relocation truncated to fit: R_X86_64_PC32 against symbol `w1' defined in .bss section in /tmp/cc0fjvOF.o
a.cc:(.text+0x338): relocation truncated to fit: R_X86_64_PC32 against symbol `w1' defined in .bss section in /tmp/cc0fjvOF.o
a.cc:(.text+0x351): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc0fjvOF.o
a.cc:(.text+0x36a): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

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

int val[101];
long long wt[101];
unordered_map< long long, int> dp[101];

int knapsck(int n, long long w){
    if(n==0 || w < 0)
        return 0;
    if(dp[n][w])
        return dp[n][w];
    int a = -1;
    if(w-wt[n-1] >= 0)
        a = knapsck(n-1, w-wt[n-1]) + val[n-1];
    int b = knapsck(n-1, w);
    return dp[n][w] = max(a, b); 
}

int main() {
    int n;
    long long w;

    scanf("%d %lld",&n, &w);
    for (int i=0;i<n; i++)
        scanf("%lld %d", wt+i, val+i);
    printf("%d",knapsck(n, w));
     
    return 0;
}

Compiler output:
a.cc:7:1: error: 'unordered_map' does not name a type
    7 | unordered_map< long long, int> dp[101];
      | ^~~~~~~~~~~~~
a.cc: In function 'int knapsck(int, long long int)':
a.cc:12:8: error: 'dp' was not declared in this scope
   12 |     if(dp[n][w])
      |        ^~
a.cc:18:12: error: 'dp' was not declared in this scope
   18 |     return dp[n][w] = max(a, b);
      |            ^~
Language: C++

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

int val[101];
long long wtt[101];
unordered_map< long long, int> dp[101];

int knapsck(int n, long long w){
    if(n==0 || w < 0)
        return 0;
    if(dp[n][w])
        return dp[n][w];
    int a = -1;
    if(w-wt[n-1] >= 0)
        a = knapsck(n-1, w-wt[n-1]) + val[n-1];
    int b = knapsck(n-1, w);
    return dp[n][w] = max(a, b); 
}

int main() {
    int n;
    long long w;

    scanf("%d %lld",&n, &w);
    for (int i=0;i<n; i++)
        scanf("%lld %d", wt+i, val+i);
    printf("%d",knapsck(n, w));
     
    return 0;
}

Compiler output:
a.cc: In function 'int knapsck(int, long long int)':
a.cc:15:10: error: 'wt' was not declared in this scope; did you mean 'w'?
   15 |     if(w-wt[n-1] >= 0)
      |          ^~
      |          w
a.cc: In function 'int main()':
a.cc:27:26: error: 'wt' was not declared in this scope; did you mean 'w'?
   27 |         scanf("%lld %d", wt+i, val+i);
      |                          ^~
      |                          w
Language: C++

#define ll long long
#define mod 1000000007
#include <iostream>
#include <map>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <vector>

using namespace std;

ll gcd(ll a, ll b)
{
	//my base case if gcd(a,0) return a

	if (b == 0)
		return a;

	//we know gcd(a,b)==gcd(b,r)    and r is (a%b)
	return gcd(b, a%b);
}

ll fastPower(ll base, ll po)
{
	if (po == 0)
		return 1;
	if (po == 1)
		return base;

	ll x = fastPower(base, po / 2.0) % mod;
	ll res = (x*x) % mod;

	//cout << "x = " << x << endl << "res = " << res << endl;

	if (po % 2)
		res = ( (res % mod)*(base % mod) ) % mod;

	return res%mod;
}

ll inversemod(ll x)
{
	return fastPower(x, mod - 2) % mod;
}


int main()
{

	//ll a, b;
	//a = 25; b = 7;
	//ll power = pow(a, b-2);
	//cout << (a * ( power % b) % b) << endl;
	//cout << pow(7, 9) << endl;
	//cout << "Final answer    : " << fastPower(2, 8) << endl;
	//cout << fastPower(2, 2) << endl;
	/////////////////////////////////////////////
	//ll n, w;
	////cin >> n >> w;
	////   W , V
	//pair<ll, ll>items[200];

	////for (int i = 0;i < n; i++)
	////	cin >> items[i].first >> items[i].second;

	////  R , C
	//vector<vector<ll>>dp(1000000);
	////memset(dp[0] , -1, sizeof dp);
	//dp[0].push_back(8);
	//ll res=0;
	////res = max(dp[0][0], dp[0][1]);
	//cout << res << endl;
	////dp[w - 1][0] = 0;
	////////////////////////////////////////////////
	/*int n, c, stairs[200005], elevator[200005];
   long long res=0;
	cin >> n >> c;
	for (int i = 0; i < (n - 1); i++)
		cin >> stairs[i];

	for (int i = 0; i < (n - 1); i++)
		cin >> elevator[i];

	cout << 0 << " ";
	bool elev=false;
	for (int i = 0; i < (n - 1); i++)
    {
        if(elev==true)
        {
           res+=min(stairs[i], elevator[i]);

            if(elevator[i]==min(stairs[i], elevator[i]))
                elev=true;
            else
                elev=false;
        }


        else
        {
            if((elevator[i]+c)==min(stairs[i], (elevator[i]+c)))
                elev=true;
            else
                elev=false;

            res+=min(stairs[i], (elevator[i]+c));
        }

        cout<<res<<" ";
    }*/
	//    w,v
	pair<ll, ll>items[1000];

	ll n, w;
	cin >> n >> w;
	for (int i = 0; i<n; i++)
		cin >> items[i].first >> items[i].second;

	ll dp[1000000000][105];
	memset(dp, -1, sizeof dp);

	dp[w][0] = 0;
	if (w >= items[0].first)
		dp[w - items[0].first][0] = items[0].second;

	ll res = 0;

	for (int c = 1; c < n; c++)
	{
		for (int r = 0; r <= w; r++)
		{
			if (dp[r][c - 1] != -1)
			{
				if (r >= items[c].first)
				{
					dp[r - items[c].first][c] = max(dp[r][c - 1] + items[c].second, dp[r - items[c].first][c-1]);//////////////
					res = max(res, dp[r - items[c].first][c]);
				}

				dp[r][c] = dp[r][c - 1];
			}
		}

	}

	cout << res << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:121:9: error: 'memset' was not declared in this scope
  121 |         memset(dp, -1, sizeof dp);
      |         ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    9 | #include <vector>
  +++ |+#include <cstring>
   10 |
Language: C++

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

#define ll long long

const int maxV = 1e5 + 1;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int N, W, V;
	cin >> N >> W;
	vector<pair<int>> arr(N);
	vector<int> dp(maxV); // Min weight in which value i can be reached
	for (int i = 0; i < N; ++i) {
		int a, b;
		cin >> a >> b;
		arr[i] = make_pair(a, b);
		V += b;
	}

	for (int i = V; i > 0; --i) {
		dp[i] = INT_MAX;
	}

	for (int item = 0; item < N; ++item) {
		int w = arr[item].first, v = arr[item].second;
		for (int i = V; i >= 0; --i) {
			dp[i] = min(dp[i], dp[i - v] + w);
		}
	}

	for (int i = V; i >= 0; --i) {
		if (dp[i] <= W) {
			cout << i << endl;
			break;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:21: error: wrong number of template arguments (1, should be 2)
   13 |         vector<pair<int>> arr(N);
      |                     ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 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_pair.h:89:12: note: provided for 'template<class _T1, class _T2> struct std::pair'
   89 |     struct pair;
      |            ^~~~
a.cc:13:24: error: template argument 1 is invalid
   13 |         vector<pair<int>> arr(N);
      |                        ^~
a.cc:13:24: error: template argument 2 is invalid
a.cc:18:20: error: invalid types 'int[int]' for array subscript
   18 |                 arr[i] = make_pair(a, b);
      |                    ^
a.cc:27:28: error: invalid types 'int[int]' for array subscript
   27 |                 int w = arr[item].first, v = arr[item].second;
      |                            ^
a.cc:29:51: error: 'v' was not declared in this scope
   29 |                         dp[i] = min(dp[i], dp[i - v] + w);
      |                                                   ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i,a,n) for(int i=a;i<n;i++)
ll N,W;
vector<ll> v(N);
vector<ll> w(N);
ll dp[101][100001];
int knapsack(ll i,ll val)
{
	if(val==0)
	return 0;
	if(i==n||val<0)
	return INT_MAX;
	if(dp[i][val]!=-1)
	return dp[i][val];
	return dp[i][val]=min(knapsack(i+1,val-v[i])+w[i],knapsack(i+1,val));
}
int main()
{
	cin>>N>>W;
	memset(dp,-1,sizeof(dp));
	ll sum=0;
	for(int i=0;i<N;i++)
	{
		cin>>w[i]>>v[i];
		sum+=v[i];
	}
	ll maxvalue;
	for(ll i=sum;i>=0;i--)
	{
		if(knapsack(0,i)<=W)
		{
			maxvalue=i;
			break;
		}
	}
	cout<<maxvalue<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int knapsack(long long int, long long int)':
a.cc:13:15: error: 'n' was not declared in this scope
   13 |         if(i==n||val<0)
      |               ^
a.cc:17:30: error: no matching function for call to 'min(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type, int)'
   17 |         return dp[i][val]=min(knapsack(i+1,val-v[i])+w[i],knapsack(i+1,val));
      |                           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:17:30: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   17 |         return dp[i][val]=min(knapsack(i+1,val-v[i])+w[i],knapsack(i+1,val));
      |                           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:17:30: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   17 |         return dp[i][val]=min(knapsack(i+1,val-v[i])+w[i],knapsack(i+1,val));
      |                           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: Java

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

public class Main{
  public static void main(String[] args) throws IOException{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] s = br.readLine().split(" ");
    int n = Integer.parseInt(s[0]);
    int W = Integer.parseInt(s[1]);
    long[] val = new long[n];
    long[] wt = new long[n];
    long maxVal = 0;
    for(long i=0;i<n;i++){
      String[] str = br.readLine().split(" ");
      wt[(int)i] = Long.parseLong(str[0]);
      val[(int)i] = Long.parseLong(str[1]);
      maxVal += val[(int)i];
    }
    long[][] dp = new long[(int)n+1][(int)maxVal+1];
    
    for(int i=0;i<=n;i++){
      Arrays.fill(dp[i],100005);
    }
    long max = 0;
    for(long i=1;i<=n;i++){
      for(long j=0;j<=maxVal;j++){
        if(j==0)
          dp[(int)i][(int)j] = 0;
        else if(j>=val[(int)(i)-1] && dp[(int)(i)-1][(int)j-(int)val[(int)(i)-1]]!=100005)
          dp[(int)i][(int)j] = Math.min(dp[(int)(i)-1][(int)j], wt[(int)(i)-1] + dp[(int)(i)-1][(int)j-(int)val[(int)(i)-1]]);
        else
          dp[(int)i][(int)j] = dp[(int)(i)-1][(int)j];
        
        if(dp[i][j]<=W)
          max = Math.max(max,j);
      }
    }
    
    
    System.out.println(max);
  }
}


Compiler output:
Main.java:34: error: incompatible types: possible lossy conversion from long to int
        if(dp[i][j]<=W)
              ^
Main.java:34: error: incompatible types: possible lossy conversion from long to int
        if(dp[i][j]<=W)
                 ^
2 errors
Language: Java

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

public class Main{
  public static void main(String[] args) throws IOException{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] s = br.readLine().split(" ");
    int n = Integer.parseInt(s[0]);
    int W = Integer.parseInt(s[1]);
    long[] val = new long[n];
    long[] wt = new long[n];
    long maxVal = 0;
    for(long i=0;i<n;i++){
      String[] str = br.readLine().split(" ");
      wt[(int)i] = Long.parseLong(str[0]);
      val[(int)i] = Long.parseLong(str[1]);
      maxVal += val[(int)i];
    }
    long[][] dp = new long[(int)n+1][(int)maxVal+1];
    
    for(int i=0;i<=n;i++){
      Arrays.fill(dp[i],100005);
    }
    
    for(long i=0;i<=n;i++){
      for(long j=0;j<=maxVal;j++){
        if(j==0)
          dp[(int)i][(int)j] = 0;
        else if(j>=val[(int)(i)-1])
          dp[(int)i][(int)j] = Math.min(dp[(int)(i)-1][(int)j], wt[(int)(i)-1] + dp[(int)(i)-1][(int)j-(int)val[(int)(i)-1]]);
        else
          dp[(int)i][(int)j] = dp[(int)(i)-1][(int)j];
      }
    }
    long max = 0;
    for(long i=0;i<=maxVal;i++){
      if(dp[n][i]<=W)
        max = dp[n][i];
  }
    System.out.println(max);
  }
}


Compiler output:
Main.java:37: error: incompatible types: possible lossy conversion from long to int
      if(dp[n][i]<=W)
               ^
Main.java:38: error: incompatible types: possible lossy conversion from long to int
        max = dp[n][i];
                    ^
2 errors
Language: Java

import java.util.*;
import java.io.*;
 
public class Main{
  public static void main(String[] args) throws IOException{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] s = br.readLine().split(" ");
    long n = Long.parseLong(s[0]);
    long W = Long.parseLong(s[1]);
    long[] val = new long[(int)n];
    long[] wt = new long[(int)n];
    int maxValue = n*1000;
    for(long i=0;i<n;i++){
      String[] str = br.readLine().split(" ");
      wt[(int)i] = Long.parseLong(str[0]);
      val[(int)i] = Long.parseLong(str[1]);
    }
    long[][] dp = new long[(int)n+1][(int)maxValue+1];
    long INF = (long) 1e9+1;
    for(int i=0;i<=maxValue;i++)
      dp[1][i] = INF;
    
    for(long i=0;i<=n;i++){
      for(long j=0;j<=W;j++){
        if(i==0 || j==0)
          dp[(int)i][(int)j] = 0;
        else if(j>=wt[(int)(i)-1])
          dp[(int)i][(int)j] = Math.max(dp[(int)(i)-1][(int)j], val[(int)(i)-1] + dp[(int)(i)-1][(int)j-(int)wt[(int)(i)-1]]);
        else
          dp[(int)i][(int)j] = dp[(int)(i)-1][(int)j];
      }
    }
    long max = 0;
    for(long i=0;i<=W;i++)
      max = Math.max(max,dp[(int)n][(int)i]);
    System.out.println(max);
  }
}


Compiler output:
Main.java:12: error: incompatible types: possible lossy conversion from long to int
    int maxValue = n*1000;
                    ^
1 error
Language: Java

import java.util.*;
import java.io.*;
 
public class Main{
  public static void main(String[] args) throws IOException{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] s = br.readLine().split(" ");
    long n = Long.parseLong(s[0]);
    long W = Long.parseLong(s[1]);
    long[] val = new long[n];
    long[] wt = new long[n];
    for(long i=0;i<n;i++){
      String[] str = br.readLine().split(" ");
      wt[(int)i] = Long.parseLong(str[0]);
      val[(int)i] = Long.parseLong(str[1]);
    }
    long[][] dp = new long[(int)n+1][(int)W+1];
    
    for(long i=0;i<=n;i++){
      for(long j=0;j<=W;j++){
        if(i==0 || j==0)
          dp[(int)i][(int)j] = 0;
        else if(j>=wt[(int)(i)-1])
          dp[(int)i][(int)j] = Math.max(dp[(int)(i)-1][(int)j], val[(int)(i)-1] + dp[(int)(i)-1][(int)j-(int)wt[(int)(i)-1]]);
        else
          dp[(int)i][(int)j] = dp[(int)(i)-1][(int)j];
      }
    }
    long max = 0;
    for(long i=0;i<=W;i++)
      max = Math.max(max,dp[(int)n][(int)i]);
    System.out.println(max);
  }
}


Compiler output:
Main.java:10: error: incompatible types: possible lossy conversion from long to int
    long[] val = new long[n];
                          ^
Main.java:11: error: incompatible types: possible lossy conversion from long to int
    long[] wt = new long[n];
                         ^
2 errors
Language: C++

#include <bits/stdc++.h>
using namespace std; 
#define fastio() ios_base::sync_with_stdio(false);\
cin.tie(NULL);
 

 
 
#define lli long long int
#define pb push_back
#define vvi(r,c) vector<vector<lli>> v(r,vector<lli>(c));
 
void solve(){
  int n,W;
  cin>>n>>W;
  vector<int> w(n),v(n);
  int sum=0;
  for(int i=0;i<n;i++){
    cin>>w[i]>>v[i];
    sum+=v[i];
  }
 // cout<<sum<<endl;
  vector<int> dp(sum+1,md);
  dp[0]=0;
  for(int j=0;j<n;j++){
  for(int i=sum;i>0;i--){
      if(i-v[j]>=0){
        dp[i]=min(dp[i],w[j]+dp[i-v[j]]);
      }  
  }
  }
  int i;
  for(i=sum;i>0;i--){
  //  cout<<dp[i]<<endl;
      if(dp[i]<=W){
        // cout<<dp[i]<<" ";
        break;
      }
  }
  cout<<i<<endl;
 
}
 
 
int main()
{  
    fastio();
  int t;
  
  t=1;
  while(t--){
    solve();
  }
 
  return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:23:24: error: 'md' was not declared in this scope
   23 |   vector<int> dp(sum+1,md);
      |                        ^~
Language: Java

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

class Item{
   int val, weight;
   public Item(int weight, int val){
      this.weight = weight;
      this.val = val;
   }
   
}
public class Main {
   public static void main(String[]abc) {
      Main ans = new Main();
      long solution = ans.solve();
      System.out.println(solution);
   }
   private long solve() {
      Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      int maxWeight = sc.nextInt();
      // max value of an item is 10000
      int maxValue = N*1000;
      Item [] array = new Item[N];
      for(int i=0;i<N;i++){
         array[i] = new Item(sc.nextInt(),sc.nextInt());
      }
      long [][] dp = new long[(N+1)][maxValue+1];
      long INF = (long) 1e9+1;
	  for(int val=1;val<=maxValue;val++){
         dp[1][val] = INF;
      }
      dp[1][array[0].val]= array[0].weight;
      dp[1][0] = 0;
      for(int i=2;i<=N;i++){
         for(int val=0;val<=maxValue;val++){
            dp[i][val] = dp[i-1][val];
            if (array[i].val>val) continue;
            dp[i][val] = Math.min(dp[i][val], array[i].weight+dp[i-1][val-array[i].val]);
         }
      }
      long bestVal=0;
      for(int val=1;val<=maxValue;val++){
         if (dp[N][val]>maxWeight) continue;
         bestVal = Math.max(bestVal, i);
      }
      return bestVal;
	       
   }
}


Compiler output:
Main.java:45: error: cannot find symbol
         bestVal = Math.max(bestVal, i);
                                     ^
  symbol:   variable i
  location: class Main
1 error
Language: Java

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

class Item{
   long val, weight;
   public Item(long weight, long val){
      this.weight = weight;
      this.val = val;
   }
   
}
public class Main {
   public static void main(String[]abc) {
      Main ans = new Main();
      long solution = ans.solve();
      System.out.println(solution);
   }
   private long solve() {
      Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      int maxWeight = sc.nextInt();
      // max value of an item is 10000
      int maxValue = N*1000;
      Item [] array = new Item[N];
      for(int i=0;i<N;i++){
         array[i] = new Item(sc.nextLong(),sc.nextLong());
      }
      long [][] dp = new long[(N+1)][maxValue+1];
      long INF = (long) 1e9+1;
	  for(int val=1;val<=maxValue;val++){
         dp[1][val] = INF;
      }
      dp[1][array[0].val]= array[0].weight;
      dp[1][0] = 0;
      for(int val=2;val<=maxValue;val++){
         for(int i=1;i<=N;i++){
            dp[i][val] = dp[i-1][val];
            if (array[i].val>val) continue;
            dp[i][val] = Math.min(dp[i][val], dp[i-1][val-array[i].val]);
         }
      }
      long bestVal=0;
      for(int val=1;val<=maxValue;val++){
         if (dp[N][val]>maxWeight) continue;
         bestVal = Math.max(bestVal, dp[N][val]);
      }
      return bestVal;
	       
   }
}


Compiler output:
Main.java:33: error: incompatible types: possible lossy conversion from long to int
      dp[1][array[0].val]= array[0].weight;
                    ^
Main.java:39: error: incompatible types: possible lossy conversion from long to int
            dp[i][val] = Math.min(dp[i][val], dp[i-1][val-array[i].val]);
                                                         ^
2 errors
Language: Java

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

class Item{
   long val, weight;
   public Item(long weight, long val){
      this.weight = weight;
      this.val = val;
   }
   
}
public class Main {
   public static void main(String[]abc) {
      Main ans = new Main();
      long solution = ans.solve();
      System.out.println(solution);
   }
   private long solve() {
      Scanner sc = new Scanner(System.in);
      int N = sc.nextLong();
      long maxWeight = sc.nextLong();
      // max value of an item is 10000
      long maxValue = N*1000;
      Item [] array = new Item[N];
      for(int i=0;i<N;i++){
         array[i] = new Item(sc.nextLong(),sc.nextLong());
      }
      long [][] dp = new long[(int)(N+1)][(int)maxValue+1];
      long INF = (long) 1e9+1;
	  for(int val=1;val<=maxValue;val++){
         dp[1][val] = INF;
      }
      dp[1][array[0].val]= array[0].weight;
      dp[1][0] = 0;
      for(long val=2;val<=maxValue;val++){
         for(int i=1;i<=N;i++){
            dp[i][val] = dp[i-1][val];
            if (array[i].val>val) continue;
            dp[i][val] = Math.min(dp[i][val], dp[i-1][val-array[i].val]);
         }
      }
      long bestVal=0;
      for(int val=1;val<=maxValue;val++){
         if (dp[N][val]>maxWeight) continue;
         bestVal = Math.max(bestVal, dp[N][val]);
      }
      return bestVal;
	       
   }
}


Compiler output:
Main.java:20: error: incompatible types: possible lossy conversion from long to int
      int N = sc.nextLong();
                         ^
Main.java:33: error: incompatible types: possible lossy conversion from long to int
      dp[1][array[0].val]= array[0].weight;
                    ^
Main.java:37: error: incompatible types: possible lossy conversion from long to int
            dp[i][val] = dp[i-1][val];
                  ^
Main.java:37: error: incompatible types: possible lossy conversion from long to int
            dp[i][val] = dp[i-1][val];
                                 ^
Main.java:39: error: incompatible types: possible lossy conversion from long to int
            dp[i][val] = Math.min(dp[i][val], dp[i-1][val-array[i].val]);
                  ^
Main.java:39: error: incompatible types: possible lossy conversion from long to int
            dp[i][val] = Math.min(dp[i][val], dp[i-1][val-array[i].val]);
                                        ^
Main.java:39: error: incompatible types: possible lossy conversion from long to int
            dp[i][val] = Math.min(dp[i][val], dp[i-1][val-array[i].val]);
                                                         ^
7 errors
Language: Java

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

class Item{
   long val, weight;
   public Item(long weight, long val){
      this.weight = weight;
      this.val = val;
   }
   
}
public class Main {
   public static void main(String[]abc) {
      Main ans = new Main();
      long solution = ans.solve();
      System.out.println(solution);
   }
   private long solve() {
      Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      int maxWeight = sc.nextInt();
      // max value of an item is 10000
      ing maxValue = N*1000;
      Item [] array = new Item[N];
      for(int i=0;i<N;i++){
         array[i] = new Item(sc.nextLong(),sc.nextLong());
      }
      long [][] dp = new long[N+1][maxValue+1];
      long INF = (long) 1e9+1;
	  for(int val=1;val<=maxValue;val++){
         dp[1][val] = INF;
      }
      dp[1][array[0].val]= array[0].weight;
      dp[1][0] = 0;
      for(int val=2;val<=maxValue;val++){
         for(int i=1;i<=N;i++){
            dp[i][val] = dp[i-1][val];
            if (array[i].val>val) continue;
            dp[i][val] = Math.min(dp[i][val], dp[i-1][val-array[i].val]);
         }
      }
      long bestVal=0;
      for(int val=1;val<=maxValue;val++){
         if (dp[N][val]>maxWeight) continue;
         bestVal = Math.max(bestVal, dp[N][val]);
      }
      return bestVal;
	       
   }
}


Compiler output:
Main.java:23: error: cannot find symbol
      ing maxValue = N*1000;
      ^
  symbol:   class ing
  location: class Main
Main.java:33: error: incompatible types: possible lossy conversion from long to int
      dp[1][array[0].val]= array[0].weight;
                    ^
Main.java:39: error: incompatible types: possible lossy conversion from long to int
            dp[i][val] = Math.min(dp[i][val], dp[i-1][val-array[i].val]);
                                                         ^
3 errors
Language: Java

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

class Item{
   long val, weight;
   public Item(long weight, long val){
      this.weight = weight;
      this.val = val;
   }
   
}
public class Main {
   public static void main(String[]abc) {
      Main ans = new Main();
      long solution = ans.solve();
      System.out.println(solution);
   }
   private long solve() {
      Scanner sc = new Scanner(System.in);
      int N = sc.nextLong();
      int maxWeight = sc.nextInt();
      // max value of an item is 10000
      long maxValue = (long) N*1000;
      Item [] array = new Item[N];
      for(int i=0;i<N;i++){
         array[i] = new Item(sc.nextLong(),sc.nextLong());
      }
      long [][] dp = new long[N+1][maxValue+1];
      long INF = (long) 1e9+1;
	  for(int val=1;val<=maxValue;val++){
         dp[1][val] = INF;
      }
      dp[1][array[0].val]= array[0].weight;
      dp[1][0] = 0;
      for(int val=2;val<=maxValue;val++){
         for(int i=1;i<=N;i++){
            dp[i][val] = dp[i-1][val];
            if (array[i].val>val) continue;
            dp[i][val] = Math.min(dp[i][val], dp[i-1][val-array[i].val]);
         }
      }
      long bestVal=0;
      for(int val=1;val<=maxValue;val++){
         if (dp[N][val]>maxWeight) continue;
         bestVal = Math.max(bestVal, dp[N][val]);
      }
      return bestVal;
	       
   }
}


Compiler output:
Main.java:20: error: incompatible types: possible lossy conversion from long to int
      int N = sc.nextLong();
                         ^
Main.java:28: error: incompatible types: possible lossy conversion from long to int
      long [][] dp = new long[N+1][maxValue+1];
                                           ^
Main.java:33: error: incompatible types: possible lossy conversion from long to int
      dp[1][array[0].val]= array[0].weight;
                    ^
Main.java:39: error: incompatible types: possible lossy conversion from long to int
            dp[i][val] = Math.min(dp[i][val], dp[i-1][val-array[i].val]);
                                                         ^
4 errors