criyle/codenet-compile-errors huggingface dataset:
Language: Java

import java.util.Scanner;

public class Main {

    private static long[][] dp;
    private static int[] w;
    private static int[] v;

    public static void main( String[] args ) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long w1 = sc.nextLong();

        dp = new long[n + 1][(int)w1];
        w = new int[n + 1];
        v = new int[n + 1];

        w[0] = 0;
        v[0] = 0;

        for (int i = 1; i <= n; i++) {
            w[i] = Integer.parseInt(sc.next());
            v[i] = Integer.parseInt(sc.next());
        }

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

        System.out.println(nap(n, w1));
        sc.close();
    }

    private static long nap( int i, int j ) {
        if (dp[i][j] >= 0)
            return dp[i][j];

        long rem;

        if (i == 0) {
            rem = 0;
        }
        //if weight of item is more than remainingWeight then try next item by skipping current item
        else if (j < w[i]) {
            rem = nap(i - 1, j);
        } else {  //try to get maximumValue of either by picking the currentItem or not picking currentItem
            rem = Math.max(nap(i - 1, j - w[i]) + v[i], nap(i - 1, j));
        }

        dp[i][j] = rem;

        return rem;
    }
}

Compiler output:
Main.java:33: error: incompatible types: possible lossy conversion from long to int
        System.out.println(nap(n, w1));
                                  ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
Language: C++

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

vector<pair<long long int, long long int>> dp[102];
long long int c, n, k, cisim[100][2];

long long int recursive(int konum, int agirlik){
	if(konum>=n)return 0;
	if(agirlik>=c)return 0;
	for(int i=0;i<dp[konum].size();i++)if(dp[konum][i].first()==agirlik)return dp[konum][i];
	if(cisim[konum][0]>c-agirlik){
		dp[konum].push_back(recursive(konum+1,agirlik);)}
	else {
		dp[konum].push_back(max(cisim[konum][1]+recursive(konum+1, agirlik+cisim[konum][0]), recursive(konum+1, agirlik)));
	}
	return dp[konum][dp[konum].size()-1];
}

int main(void){
	cin>>n>>c;
	for(int i=0;i<n;i++)cin>>cisim[i][0]>> cisim[i][1];
	memset(dp, 0, sizeof(long long int)*(n+1)*100002);
	cout<<recursive(0,0);
	return 0;
}


Compiler output:
a.cc:5:1: error: 'vector' does not name a type
    5 | vector<pair<long long int, long long int>> dp[102];
      | ^~~~~~
a.cc: In function 'long long int recursive(int, int)':
a.cc:11:23: error: 'dp' was not declared in this scope
   11 |         for(int i=0;i<dp[konum].size();i++)if(dp[konum][i].first()==agirlik)return dp[konum][i];
      |                       ^~
a.cc:13:17: error: 'dp' was not declared in this scope
   13 |                 dp[konum].push_back(recursive(konum+1,agirlik);)}
      |                 ^~
a.cc:13:63: error: expected ')' before ';' token
   13 |                 dp[konum].push_back(recursive(konum+1,agirlik);)}
      |                                    ~                          ^
      |                                                               )
a.cc:13:64: error: expected primary-expression before ')' token
   13 |                 dp[konum].push_back(recursive(konum+1,agirlik);)}
      |                                                                ^
a.cc:15:17: error: 'dp' was not declared in this scope
   15 |                 dp[konum].push_back(max(cisim[konum][1]+recursive(konum+1, agirlik+cisim[konum][0]), recursive(konum+1, agirlik)));
      |                 ^~
a.cc:17:16: error: 'dp' was not declared in this scope
   17 |         return dp[konum][dp[konum].size()-1];
      |                ^~
a.cc: In function 'int main()':
a.cc:23:16: error: 'dp' was not declared in this scope
   23 |         memset(dp, 0, sizeof(long long int)*(n+1)*100002);
      |                ^~
Language: C++

#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (int i = 0; i < (n); i++)
#define IREP(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, k, n) for (int i = (k); i < (n); i++)
#define REPEACH(itr, k) for (auto &&itr : k)
#define MOD 1000000007

using namespace std;
typedef long long ll;

const ll INF = 1LL<<60;
template<class T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}
template<class T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}

int main()
{
    ll n,w;
    cin >> n >> w;
    vector<vector<ll>> dp(100002,vector<ll>(n+2,INF));
    dp[0][0]=0;
    vector<ll> weight(n+1);
    vector<ll> value(n+1);
    REP(i,n){
        cin >> weight[i] >> value[i];
    }
    REP(i,n){
        REP(sum_v,100002){
            if(sum_v-value[i]>=0) chmin(dp[i+1][sum_v],dp[i][sum_v-value[i]]+weight[i]);
            chmin(dp[i+1][sum_v],dp[i][sum_v]);
        }
    }
    ll ans=0;
    REP(i,100002){
        if(dp[n][i]<=w) ans=i;
    }
    cout << i << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:13: error: 'i' was not declared in this scope
   37 |     cout << i << endl;
      |             ^
Language: C++

#include<bits/stdc++.h>
#pragma GCC optimize ("-O3")
#define ll long long
#define en "\n"
const ll inf = 1e9;
const ll mod = 1e9 + 7;
using namespace std;
int main(){
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
    ll a[100005], b[100005], m, n, dp[300005] = {0}, sum = 0;
    cin>>n>>m;
    for(int i = 1; i <= n; i++){
        cin>>a[i]>>b[i];
    }
    for(int i = 1; i <= min(n, 100000); i++){
        for(int j = m; j > 0; j--){
            if(dp[j] != 0){
                dp[j + a[i]] = max(dp[j + a[i]], b[i] + dp[j]);
            }
        }
        dp[a[i]] = max(dp[a[i]], b[i]);
    }
    ll mx = -inf * inf;
    for(int i = m; i > 0; i--){
        mx = max(mx, dp[i]);
    }
    cout<<mx<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:28: error: no matching function for call to 'min(long long int&, int)'
   17 |     for(int i = 1; i <= min(n, 100000); i++){
      |                         ~~~^~~~~~~~~~~
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:28: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   17 |     for(int i = 1; i <= min(n, 100000); i++){
      |                         ~~~^~~~~~~~~~~
/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:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   17 |     for(int i = 1; i <= min(n, 100000); i++){
      |                         ~~~^~~~~~~~~~~
Language: C++

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

long long solve(vector<vector<long long> >&ans, vector<int> &val, vector<int> &wt, int i, int w)
{

    if(i<0)return 0;
    if(w==0)return 0;

    if(ans[i][w]!=-1)return ans[i][w];

    ans[i][w]=0;
    long long temp1 = solve(ans,val,wt,i-1, w);
    if(w>=wt[i])
        temp1 = max(temp1, (long long)val[i] + solve(ans,val,wt,i-1,w-wt[i]));
    ans[i][w]=temp1;
    return ans[i][w];
}
const long long  INF 1e18+5;
int main()
{
    int n,w;
    cin>>n>>w;
    vector<int> val(n);
    vector<long long> wt(n);
    
    for(int i=0; i<n; i++)
        cin>>wt[i]>>val[i];

    vector<vector<long long> >  ans(n,vector<long long> (100001,INF));

    ans[0][0]=0;
    for(int i=1; i<=val[0]; i++)
        ans[0][i]=wt[0];

    for(int i=1; i<n; i++)
    {
        for(int v=0; v<100001; v++)
        {
            ans[i][v] = ans[i-1][v];
            if(v-val[i]>=0)
            {
                ans[i][v] = min(ans[i][v], ans[i-1][v-val[i]] + wt[i]);
            }
            else
            {
                ans[i][v] = min(ans[i][v], wt[i]);
            }
        }
    }
    int a=1;
    while(ans[n-1][a]<=w)a++;
    cout<<max(a-1,0);
    return 0;
} 

Compiler output:
a.cc:19:22: error: expected initializer before numeric constant
   19 | const long long  INF 1e18+5;
      |                      ^~~~
a.cc: In function 'int main()':
a.cc:30:65: error: 'INF' was not declared in this scope
   30 |     vector<vector<long long> >  ans(n,vector<long long> (100001,INF));
      |                                                                 ^~~
Language: Java

import java.util.*;
import java.io.*;
import java.lang.*;
// ArrayList<Integer>[] arr=new ArrayList[n];
public class Main_E{	
public static void main(String[] args) throws FileNotFoundException, IOException{
        Scanner s = new Scanner(System.in);
         StringBuilder sb=new StringBuilder();
         BufferedWriter out=new BufferedWriter(new OutputStreamWriter(System.out));
         int n=s.nextInt(),w=s.nextInt();
        int[][] arr=new int[n+1][2];
        long[][] dp=new long[100001][101];
        
        for(int i=1;i<100001;i++){
            Arrays.fill(dp[i],(long)1e13); 
        }
       
        //dp[i][j] hold- minimum wt needed to get i values given j objects
        for(int i=1;i<=n;i++){
            arr[i][0]=s.nextInt(); arr[i][1]=s.nextInt();
        }

        for(int i=1;i<100001;i++){
            for(int j=1;j<=n;j++){
                if(arr[j][1]<=i){
                    dp[i][j]=Math.min(dp[i][j-1],arr[j][0]+dp[i-arr[j][1]][j-1]);
                }
                else{
                    dp[i][j]=dp[i][j-1];
                }
                //else{dp[j]=(long)1e13;}
            }
        }
        int res=0;
        for(int i=1;i<100001;i++){
            if(dp[i][n]<=w){res=i;}
        }       
        System.out.println(res);
    }
}

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

#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <vector>
#include <string>
using namespace std;

#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)
#pragma GCC optimize("unroll-loops")

#define DEBUG(x) cout << ">> " << #x << ": " << x << endl;
#define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int MOD = 1000000007;
typedef long long ll;
typedef long double ld;

int maxv = 0;

int main() { _
  ll n, w; cin >> n >> w;
  vector<ll> weights(n, 0);
  vector<ll> values(n, 0);
  for (ll i = 0; i < n; i++) {
    cin >> weights[i] >> values[i];
    maxv += values[i];
  }
  vector<vector<ll> > dp(n+1, vector<ll>(maxv+1, w+1));
  dp[0][0] = 0;
  
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= maxv; j++) {
      dp[i][j] = min(dp[i-1][j], j >= values[i-1] ? dp[i-1][j-values[i-1]] + weights[i-1] : LLONG_MAX);
    }
  }
  ll ans = 0;
  for (ll i = 1; i <= maxv; i++) {
    if (dp[n][i] <= w)
      ans = max(ans, i);
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:93: error: 'LLONG_MAX' was not declared in this scope
   38 |       dp[i][j] = min(dp[i-1][j], j >= values[i-1] ? dp[i-1][j-values[i-1]] + weights[i-1] : LLONG_MAX);
      |                                                                                             ^~~~~~~~~
a.cc:6:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include <set>
  +++ |+#include <climits>
    6 | #include <vector>
Language: C++

#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) (int)((x).size())
#define debug(x) cout << #x << ":" << x << ' ';
#define debugg(x) cout << #x << ":" << x << ' ' << "\n";
#define endl "\n"
#define L(X) ((X)<<1)
#define R(X) (((X)<<1)|1)
#define M(X,Y) (((X)+(Y))>>1)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int MAXN = 1e5 + 5;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const long long int LLINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-9;
const double PI = acos(-1);

template<typename T>   T max_self(T& a, T b) { if (a < b) a = b; return a; }
template<typename T>   T min_self(T& a, T b) { if (a > b) a = b; return a; }
template<typename T>   T add(T x, T y) { return ((x % MOD)  + (y % MOD)) % MOD;}
template<typename T>   T mul(T x, T y) { return ((x % MOD) * (long long)(y % MOD)) % MOD;}
template<typename T>   T sub(T x, T y) { return add(x, -y + MOD);}
template<typename T>   T gcd(T a, T b) { return b ? gcd(b, a % b) : a;}
template<typename T>   T lcm(T a, T b) { return a / gcd(a, b) * b;}
template<typename T>   vector<T> read(vector<T>& v, int n) {v.resize(n); for (auto &x : v)cin >> x;}
template<typename T>   void trav(vector<T> &v) {for (int i = 0 ; i < (int)v.size() ; ++i) {cout << v[i]; if (i != (int)v.size() - 1) cout << ' ';}}
int lg2(long long x)   {   return 64 - __builtin_clzll(x) - 1;	}
int lg2(int x)   {   return 32 - __builtin_clz(x) - 1;	}


//Variables Declaration
int N , W ;

vector<ll> w;
vector<ll> v ;


ll dp[(int)(2e3 * 100 ) + ];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	memset(dp, 0x3f, sizeof(dp));

	cin >> N >> W;
	w.resize(N);
	v.resize(N);

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

	dp[0] = 0;
	for (int k = 0 ; k < N ; ++k ) {
		for (int x = 100000 ; x >= 0 ; x--) {
			dp[x + v[k]] = min(dp[x + v[k]] , dp[x] + w[k]);
		}
	}

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

	return 0;
}


Compiler output:
a.cc:45:27: error: expected primary-expression before ']' token
   45 | ll dp[(int)(2e3 * 100 ) + ];
      |                           ^
a.cc: In function 'int main()':
a.cc:51:16: error: 'dp' was not declared in this scope; did you mean 'dup'?
   51 |         memset(dp, 0x3f, sizeof(dp));
      |                ^~
      |                dup
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#define ll long long
using namespace std;
int main() {
	ll N, W, sum = 0,x=0;
	cin >> N >> W;
	vector<ll>w(N + 1, 0);
	vector<ll>v(N + 1, 0);
	vector<vector<ll>>dp(N + 1, vector<ll>(100001, LLONG_MAX));
	dp[0][0] = 0;
	for (ll i = 1; i <= N; i++) {
		cin >> w[i] >> v[i];
		dp[i][0] = 0;
	}
	
	for (ll i = 0; i < N; i++) {
		for (ll j = 0; j < 100001; j++) {
			dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
			if (j + v[i + 1] <= 100000&&dp[i][j]!=LLONG_MAX) {
				dp[i + 1][j + v[i + 1]] =
					min(dp[i + 1][j + v[i + 1]], dp[i][j] + w[i + 1]);
				
			}
			
		}
	}
	
	for (ll i = 100000; i >=0; i--) {
		if (dp[N][i] <= W) {
			cout << i << endl;
			break;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:56: error: 'LLONG_MAX' was not declared in this scope
   13 |         vector<vector<ll>>dp(N + 1, vector<ll>(100001, LLONG_MAX));
      |                                                        ^~~~~~~~~
a.cc:6:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include<cmath>
  +++ |+#include <climits>
    6 | #define ll long long
Language: C++

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


// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int               long long
#define endl              '\n'
#define ff                first
#define ss                second
#define pb                push_back
#define vii               vector<int> 
#define pii               pair<int,int>
#define loop(i,s,e)       for(int i=s;i<e;i++)
#define mset(a,f)         memset(a,f,sizeof(a))
#define fastio            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

const int N = 107, inf = 1e18;
int n, W;
pii arr[N];
int  dp[N][100007];

int getval(int it, int v)
{            
      if( v == 0 ) return 0;
      if( v < 0 || it == 0 ) return inf;  
      if( dp[it][v] != -1 ) return dp[it][v];
      int a = inf , b = inf;
      a = arr[it].ff + getval(it - 1, v - arr[it].ss);
      b = getval(it - 1, v);
      return dp[it][v] = min(a,b);
}

int32_t main() {
    fastio;
    
      cin >> n >> W;
      loop(i,1,n+1)  cin >> arr[i].ff >> arr[i].ss;
      mset(dp,-1);
      int ans = 0;
      rloop(v,100001,0) 
        if( getval(n,v) <= W ) {
				ans = v;
        		break;
     	 }
      cout << ans << endl; 

}


// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //















Compiler output:
a.cc: In function 'int32_t main()':
a.cc:42:13: error: 'v' was not declared in this scope
   42 |       rloop(v,100001,0)
      |             ^
a.cc:42:7: error: 'rloop' was not declared in this scope; did you mean 'loop'?
   42 |       rloop(v,100001,0)
      |       ^~~~~
      |       loop
Language: C++

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.valueOf(sc.next());
		int w = Integer.valueOf(sc.next());

		int[][] table = new int[n][2];
		for (int i = 0; i < table.length; i++) {
			for (int j = 0; j < table[i].length; j++) {
				table[i][j] = Integer.valueOf(sc.next());
			}
		}

		long[][] dp = new long[n][(int) Math.pow(10, 3) * 100 + 1];
		for (int i = 0; i < dp.length; i++) {
			for (int j = 0; j < dp[i].length; j++) {
				dp[i][j] = Long.MAX_VALUE;
			}
		}
		for (int i = 0; i <= table[0][1]; i++) {
			dp[0][i] = table[0][0];
		}
		dp[0][0] = 0;

		for (int i = 1; i < dp.length; i++) {
			for (int j = 0; j < dp[i].length && dp[i - 1][Integer.max(j - table[i][1], 0)] != Long.MAX_VALUE; j++) {
				dp[i][j] = Long.min(dp[i - 1][j], dp[i - 1][Integer.max(j - table[i][1], 0)] + table[i][0]);
			}
		}

		for (int i = dp[dp.length - 1].length - 1; i >= 0; i--) {
			if (dp[dp.length - 1][i] <= w) {
				System.out.println(i);
				break;
			}
		}

		sc.close();
	}

}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main {
      | ^~~~~~
Language: C++

#include<stdio.h>
#include<memory.h>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
    int N, W;
    //freopen("input.txt", "r", stdin);
    scanf("%d%d", &N, &W);
    vector<int>w(N);
    vector<int>v(N);
    for(int i=0; i<N; i++)
    {
        scanf("%d%d", &w[i], &v[i]);
    }
    vector<vector<long> > dp(N+1, vector<long>(N*1000+1, INT_MAX));
    dp[0][0] = 0;
    for(int i=0; i<N; i++)
    {
        for(int j=0; j<=N*1000; j++)
        {
            if(j>=v[i])dp[i+1][j] = min(dp[i][j], dp[i][j-v[i]]+w[i]);
            else dp[i+1][j] = dp[i][j];
        }
    }
    long ans = 0;
    for(long i=0; i<=N*1000; i++)
    {
       if(dp[N][i] <= W)ans = max(ans, i);
    }
    printf("%ld\n", ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:58: error: 'INT_MAX' was not declared in this scope
   17 |     vector<vector<long> > dp(N+1, vector<long>(N*1000+1, INT_MAX));
      |                                                          ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include<vector>
  +++ |+#include <climits>
    5 | using namespace std;
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define fl(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define endl '\n'
#define pb push_back
#define ff first
#define ss second
#define mod 1000000007
#define mx 200005
#define inf 2e9
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
ll dp[101][100005] ={0};
int main()
{
    fast;
    ll n,W;
    cin>>n>>W;
    vector<int >v,w;
    v.pb(0);
    w.pb(0);
    for(ll i=0;i<n;i++)
    {
        ll x,y;
        cin>>x>>y;
        w.pb(x);
        v.pb(y);
    }
    ll V=accumulate(v.begin(),v.end(),0);
    for(int i = 0; i <= n; i++){
        for(int j = 0; j < =100005; j++){
            dp[i][j] = 2000000000;
        }
    }
    dp[0][0] = 0;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=V;j++)
        {
            if(i==0 || j==0)
                dp[i][j]=0;
            else if(v[i]<=j)
            {
                dp[i][j]= min(dp[i-1][j],w[i]+dp[i-1][j-v[i]]);
            }
            else
                dp[i][j]=dp[i-1][j];
        }
    }
    ll ans=0;
    for(ll i=1;i<=n;i++)
    {
        for(ll j=1;j<=V;j++)
        {
            if(dp[i][j]<=W)
                ans= max(ans,j);
        }
    }
    cout<<ans;
    /*ll max_val=dp[n][V];
    cout<<dp[n][V]<<endl;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=V;j++)
        {
            if(dp[i][j]==max_val)
            {
                cout<<j;
                return 0;
            }
        }
    }*/
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:28: error: expected primary-expression before '=' token
   31 |         for(int j = 0; j < =100005; j++){
      |                            ^
Language: C++

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define mod 1000000007
#define fi first
#define se second
#define pii pair<int,int>
#define int long long
#define endl '\n'
#define pll pair<long long,long long>
#define LONGLONG_MAX 10000000000000000
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int dp[100005];


int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    for(int i=0;i<100005;i++){
    	dp[i]=1000000000000000;
    }
    dp[0]=0;
    int n,w;
    cin>>n>>w;
    int a[n],b[n];
    for(int i=0;i<n;i++){
    	cin>>a[i]>>b[i];
    }
    for(int i=0;i<n;i++){
    	for(int j=100000;j>=b[i];j--){
    		dp[j]=min(dp[j],dp[j-b[i]]+a[i]);
    	}
    }
    int ans=0;
    for(int i=0;i<100005;i++){
    	if(dp[i]<=w){
    		ans=max(ans,i);
    	}
    }
    cout<<i<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:47:11: error: 'i' was not declared in this scope
   47 |     cout<<i<<endl;
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
vector<int> w,v;
//vector<vector<int> > dpv(1000000001, vector<int> (2, 0));
/*long int dp(int W,int N)
{
	if(dpv[W][N])
		return dpv[W][N];
	if(W==0 || N==0)
		return 0;
	if(w[N]<=W)
		dpv[W][N]=max(dp(W-w[N],N-1)+v[N],dp(W,N-1));
	else
		dpv[W][N]=dp(W,N-1);
	return dpv[W][N];
}*/
long int dp(int W,int N)
{
  vector<vector<long int> > dpv(W+1, vector<long int> (2, 0));
	long int i,j;
	if(W==0 || N==0)
		return 0;
	for(j=1;j<=N;j++)
		for(i=1;i<=W;i++)
		{
			if(w[j]<=i)
				dpv[i][j%2]=max(dpv[i-w[j]][(j-1)%2]+v[j],dpv[i][(j-1)%2]);
			else
				dpv[i][j%2]=dpv[i][(j-1)%2];
		}
	j--;
	return dpv[W][N%2];
}
int main()
{
  	w.pb(0);v.pb(0);
	long int N,W,i,w1,v1;
	cin>>N>>W;
	for(i=1;i<=N;i++)
	{
		cin>>w1>>v1;
		w.pb(w1);
		v.pb(v1);
	}
  vector<vector<long int> > dpv(W+1, vector<long int> (2, 0));
	//long int i,j;
	if(W==0 || N==0)
		return 0;
	for(j=1;j<=N;j++)
		for(i=1;i<=W;i++)
		{
			if(w[j]<=i)
				dpv[i][j%2]=max(dpv[i-w[j]][(j-1)%2]+v[j],dpv[i][(j-1)%2]);
			else
				dpv[i][j%2]=dpv[i][(j-1)%2];
		}
	j--;
	cout<<dpv[W][N%2];
	//cout<<dp(W,N);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:13: error: 'j' was not declared in this scope
   50 |         for(j=1;j<=N;j++)
      |             ^
a.cc:58:9: error: 'j' was not declared in this scope
   58 |         j--;
      |         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
vector<int> w,v;
//vector<vector<int> > dpv(1000000001, vector<int> (2, 0));
/*long int dp(int W,int N)
{
	if(dpv[W][N])
		return dpv[W][N];
	if(W==0 || N==0)
		return 0;
	if(w[N]<=W)
		dpv[W][N]=max(dp(W-w[N],N-1)+v[N],dp(W,N-1));
	else
		dpv[W][N]=dp(W,N-1);
	return dpv[W][N];
}*/
long int dp(int W,int N)
{
  vector<vector<long int> > dpv(W+1, vector<long int> (2, 0));
	long int i,j;
	if(W==0 || N==0)
		return 0;
	for(j=1;j<=N;j++)
		for(i=1;i<=W;i++)
		{
			if(w[j]<=i)
				dpv[i][j%2]=max(dpv[i-w[j]][(j-1)%2]+v[j],dpv[i][(j-1)%2]);
			else
				dpv[i][j%2]=dpv[i][(j-1)%2];
		}
	j--;
	return dpv[W][N%2];
}
int main()
{
  	w.pb(0);v.pb(0);
	int N,W,i,w1,v1;
	cin>>N>>W;
	for(i=1;i<=N;i++)
	{
		cin>>w1>>v1;
		w.pb(w1);
		v.pb(v1);
	}
  vector<vector<long int> > dpv(W+1, vector<long int> (2, 0));
	long int i,j;
	if(W==0 || N==0)
		return 0;
	for(j=1;j<=N;j++)
		for(i=1;i<=W;i++)
		{
			if(w[j]<=i)
				dpv[i][j%2]=max(dpv[i-w[j]][(j-1)%2]+v[j],dpv[i][(j-1)%2]);
			else
				dpv[i][j%2]=dpv[i][(j-1)%2];
		}
	j--;
	cout<<dpv[W][N%2];
	//cout<<dp(W,N);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:18: error: conflicting declaration 'long int i'
   47 |         long int i,j;
      |                  ^
a.cc:38:17: note: previous declaration as 'int i'
   38 |         int N,W,i,w1,v1;
      |                 ^
Language: C++

#include <bits/stdc++.h>
#define ll long long int
#define MK2DV(v,row,col,val) vector<vector<ll>> v(row, vector<ll>(col,val))
MK2DV(dp,105,1e5 + 5);
#define INF 1e13
using namespace std;
int main()
{
    ll n, W;
    cin >> n >> W;
    vector<ll> w(n);
    vector<ll> v(n);
    for(ll i = 0; i < n; i++)
        cin >> w[i] >> v[i];
    
    return 0;
}


Compiler output:
a.cc:4:21: error: macro "MK2DV" requires 4 arguments, but only 3 given
    4 | MK2DV(dp,105,1e5 + 5);
      |                     ^
a.cc:3:9: note: macro "MK2DV" defined here
    3 | #define MK2DV(v,row,col,val) vector<vector<ll>> v(row, vector<ll>(col,val))
      |         ^~~~~
a.cc:4:1: error: 'MK2DV' does not name a type
    4 | MK2DV(dp,105,1e5 + 5);
      | ^~~~~
Language: C++

#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long LL;
typedef pair<int, int> pii;

template <typename T> inline int Chkmax (T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline int Chkmin (T &a, T b) { return a > b ? a = b, 1 : 0; }

template <typename T> inline T read(){
    T sum = 0;
    int fl = 1,ch = getchar();
    for(; !isdigit(ch); ch = getchar()) if(ch == '-') fl = -1;
    for(; isdigit(ch); ch = getchar()) sum = (sum << 3) + (sum << 1) + ch - '0';
    return sum * fl;
}

const int maxn = 1000000000 + 5;

int n,W;
int dp[maxn];

struct node{
	int w;
	int v;
}a[maxn];

inline void Solve (){
	for(int i = 1; i <= n; i++){
		for(int j = W; j >= a[i].w; j--){
			dp[j] = max(dp[j],dp[j - a[i].w] + a[i].v);	
		}	
	}
	printf("%lld\n",dp[W]);
}

inline void Input (){
	n = read<int>();
	W = read<int>();
	for(int i = 1; i <= n; i++){
		a[i].w = read<int>();
		a[i].v = read<int>();
	}
}

signed main(){
	Input();
	Solve();
	return 0;
}

Compiler output:
/tmp/cc0imYNg.o: in function `Solve()':
a.cc:(.text._Z5Solvev[_Z5Solvev]+0x33): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cc0imYNg.o
a.cc:(.text._Z5Solvev[_Z5Solvev]+0x5f): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cc0imYNg.o
a.cc:(.text._Z5Solvev[_Z5Solvev]+0xc0): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cc0imYNg.o
/tmp/cc0imYNg.o: in function `Input()':
a.cc:(.text._Z5Inputv[_Z5Inputv]+0x3d): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cc0imYNg.o
a.cc:(.text._Z5Inputv[_Z5Inputv]+0x58): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cc0imYNg.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
#define ll long long int
using namespace std;
 
int main(){
  int n, w;
  cin>>n>>w;
  vector<int> we(n);
  vector<int> v(n);
  for(int i =0; i<n; i++){
    int x, y;
    cin>>x>>y;
    we[i]=x;
    v[i]=y;
  }
  vector<vector<int>> dp(n, vector<int>(w+1, 0));
  
  for(int i =1; i<n; i++){
    for(int j = 1; j<=w; j++){
      if(i==0){
        dp[i][j]=(j>w[0])?v[0]:0;
        continue;
      }
      if(w[i]>j) dp[i][j] = dp[i-1][j];
      else{
        dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i]]+v[i]);
      }
    }
  }
  return dp[n-1][w]; 


}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:22: error: invalid types 'int[int]' for array subscript
   21 |         dp[i][j]=(j>w[0])?v[0]:0;
      |                      ^
a.cc:24:11: error: invalid types 'int[int]' for array subscript
   24 |       if(w[i]>j) dp[i][j] = dp[i-1][j];
      |           ^
a.cc:26:47: error: invalid types 'int[int]' for array subscript
   26 |         dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i]]+v[i]);
      |                                               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long
int main(){
	int n; //n=number of items 
	cin >> n;
	ll weight;
	cin >> weight; //weights of items
	ll w[1e10]; // array for item weight
	int v[n+1];	//array for values
	w[0]=v[0]=0;
	for(int i=1; i<=n; i++)
		cin>> w[i] >> v[i];
	ll result[n+1][weight+1];
	for(int i=0; i<=n; i++){
		for(int j=0; j<=weight; j++)
			result[i][j]=0;
	}
	for(int i=1; i<=n; i++){
		for(int j=0; j<=weight; j++){
			if(j<w[i]) result[i][j]=result[i-1][j];
			else result[i][j]=max(result[i-1][j],v[i]+result[i-1][j-w[i]]);
		}
	}
	cout << result[n][weight];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:14: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    9 |         ll w[1e10]; // array for item weight
      |              ^~~~
a.cc:9:14: error: could not convert '1.0e+10' from 'double' to 'long unsigned int'
    9 |         ll w[1e10]; // array for item weight
      |              ^~~~
      |              |
      |              double
a.cc:9:14: error: size of array 'w' has non-integral type 'double'
Language: C++

#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

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

  int V = 10 * 10 * 10 *N;


Compiler output:
a.cc: In function 'int main()':
a.cc:28:27: error: expected '}' at end of input
   28 |   int V = 10 * 10 * 10 *N;
      |                           ^
a.cc:24:12: note: to match this '{'
   24 | int main() {
      |            ^
Language: C++


  vector<ll> ws(N + 1), vs(N + 1);
  vector<vector<ll> > dp(N + 1, vector<ll>(V + 1, LONG_LONG_MAX/2));

  for (int i = 1; i <= N; i++) {
    cin >> ws[i] >> vs[i];
  }


  ll ans = 0;
  for (int i = 1; i <= N; i++) {
    for (int j = 0; j <= V; j++) {
      dp[i][j] = dp[i - 1][j];
      if (vs[i] <= j) {
        dp[i][j] = min(dp[i][j], dp[i - 1][j - vs[i]] + ws[i]);
      } 
      if (vs[i] >= j) {
        dp[i][j] = min(dp[i][j], ws[i]);
      }

      if (dp[i][j] <= W) ans = max(ans, (ll)j);
    }
  }

  cout << ans << endl;

  return 0;
}


Compiler output:
a.cc:2:3: error: 'vector' does not name a type
    2 |   vector<ll> ws(N + 1), vs(N + 1);
      |   ^~~~~~
a.cc:3:3: error: 'vector' does not name a type
    3 |   vector<vector<ll> > dp(N + 1, vector<ll>(V + 1, LONG_LONG_MAX/2));
      |   ^~~~~~
a.cc:5:3: error: expected unqualified-id before 'for'
    5 |   for (int i = 1; i <= N; i++) {
      |   ^~~
a.cc:5:19: error: 'i' does not name a type
    5 |   for (int i = 1; i <= N; i++) {
      |                   ^
a.cc:5:27: error: 'i' does not name a type
    5 |   for (int i = 1; i <= N; i++) {
      |                           ^
a.cc:10:3: error: 'll' does not name a type
   10 |   ll ans = 0;
      |   ^~
a.cc:11:3: error: expected unqualified-id before 'for'
   11 |   for (int i = 1; i <= N; i++) {
      |   ^~~
a.cc:11:19: error: 'i' does not name a type
   11 |   for (int i = 1; i <= N; i++) {
      |                   ^
a.cc:11:27: error: 'i' does not name a type
   11 |   for (int i = 1; i <= N; i++) {
      |                           ^
a.cc:25:3: error: 'cout' does not name a type
   25 |   cout << ans << endl;
      |   ^~~~
a.cc:27:3: error: expected unqualified-id before 'return'
   27 |   return 0;
      |   ^~~~~~
a.cc:28:1: error: expected declaration before '}' token
   28 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(int i=0;i<x;i++)
#define INF 100000000000
typedef long long ll;

int main(){
	ll N,W;
  cin>>N>>W;
  ll w[N],v[N];
  
  rep(i,N){
  	cin>>w[i]>>v[i];
  }
  
  ll dp[N+10][W+10];
  
  rep(i,W)dp[0][i]=0;
  
  for(int i=0;i<N;i++){
  	for(ll sub=0;sub<W+1;sub++){
    	if(sub-w[i]>=0){dp[i+1][sub]=max(dp[i][sub],dp[i][sub-w[i]]+v[i]);
        }
      else {dp[i+1][sub]=dp[i][sub]};
    }
  
  }
  cout<<dp[N][W];
  /*rep(i,N+1){
  	rep(u,W+1){
   		cout<<dp[i][u]<<" ";
    }
    cout<<endl;
  }
  */
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:36: error: expected ';' before '}' token
   24 |       else {dp[i+1][sub]=dp[i][sub]};
      |                                    ^
      |                                    ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(int i=0;i<x;i++)
#define INF 100000000000
typedef long long ll;

int main(){
	ll N,W;
  cin>>N>>W;
  ll w[N],v[N];
  
  rep(i,N){
  	cin>>w[i]>>v[i];
  }
  
  ll dp[N+10][W+10];
  
  rep(i,W)dp[0][i]=0;
  
  for(int i=0;i<N;i++){
  	for(ll sub=0;sub<W+1;sub++){
    	if(sub-w[i]>=0)dp[i+1][sub]=max(dp[i][sub],dp[i][sub-w[i]]+v[i]);{
        }
      else {dp[i+1][sub]=dp[i][sub]};
    }
  
  }
  cout<<dp[N][W];
  /*rep(i,N+1){
  	rep(u,W+1){
   		cout<<dp[i][u]<<" ";
    }
    cout<<endl;
  }
  */
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:7: error: 'else' without a previous 'if'
   24 |       else {dp[i+1][sub]=dp[i][sub]};
      |       ^~~~
a.cc:24:36: error: expected ';' before '}' token
   24 |       else {dp[i+1][sub]=dp[i][sub]};
      |                                    ^
      |                                    ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int f[100010];
int main()
{
	int n,w;
	scanf("%d %d",&n,&w);
	for(int i=1;i<=n*1000;i++) f[i]=1000000001;
	for(int i=1;i<=n;i++)
	{
		scanf("%d %d",&w,&v);
		for(int j=n*1000;j>=v;j++)
		{
			f[j]=min(f[j];f[j-v]+w);
		}
	}
	int ans=0;
	for(int i=0;i<=n*1000; i++)
	{
		if(f[i]<=w)
		{
			ans=i;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:35: error: 'v' was not declared in this scope
   11 |                 scanf("%d %d",&w,&v);
      |                                   ^
a.cc:14:38: error: expected ')' before ';' token
   14 |                         f[j]=min(f[j];f[j-v]+w);
      |                                 ~    ^
      |                                      )
Language: C++

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

int dp[1005];
pair<int, int> a[100005];

int main()
{
    int n, w;
    cin >> n >> w;
    for(int i = 0; i < n; ++i){
        cin >> a[i].first >> a[i].second;
    }
    for(int i = 0; i <= 1000; ++i){
        dp[j] = 999999999;
    }

    dp[a[0].second] = a[0].first;
    for(int i = 1; i < n; ++i){
        for(int j = 1000; j >= a[i].second; --j){
            dp[j] = min(dp[j], dp[j - a[i].second] + a[i].first);
        }
    }

    for(int i = 1000; i >= 0; --i){
        if(dp[i] <= w){
            cout << i << "\n";
            break;
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:12: error: 'j' was not declared in this scope
   15 |         dp[j] = 999999999;
      |            ^
Language: C++

#include<iostream>
#include<cstring>
#include<climits>
using namespace std;
int n,m;
const int N=1e9;
long long a[105],b[N+5],c[105];
int main(){
	cin>>n>>m;
	for(int i=1;i<=n;i++) cin>>a[i]>>c[i];
	for(int i=1;i<=n;i++){
		for(int j=m;j>=a[i];j--){
			b[j]=max(b[j-a[i]]+c[i],b[j]);
		}
	}
	cout<<b[m];
	return 0;
}

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

#include <stdio.h>

long min(long a,long b);
int main(){
	int i,j,n,w;
	long ans=0;
	scanf("%d %d",&n,&w);
	long dp[n+10][100010];//single,value->wight
	for(i=0;i<n+10;i++){
		for(j=0;j<100010;j++){
			if(i== 0 and j== 0){
				dp[i][j] = 0;
			}else{
				dp[i][j] = 1000000000000; 
			}
		}
	}
	int wight[n+10],value[n+10];
	for(i=1;i<=n;i++){
		scanf("%d %d",&wight[i],&value[i]);
		for(j=100000;j>=0;j--){
			dp[i][j] = min(dp[i-1][j], dp[i][j+1]);

			if(j >= value[i]){
				dp[i][j] = min(dp[i][j], dp[i-1][j-value[i]] + wight[i]);
			}else{
				dp[i][j] = min(dp[i][j], wight[i]);
			}
		
		}
	}
	for(i=0;i<=100002;i++){
		if(dp[n][i]  <= wight);
		ans=i;
	}
	printf("\n%ld\n",ans);

	return 0;
}
long min(long a,long b){
	if(a <b){
		return (a);
	}else{
		return (b);
	}
}

Compiler output:
main.c: In function 'main':
main.c:11:33: error: expected ')' before 'and'
   11 |                         if(i== 0 and j== 0){
      |                           ~     ^~~~
      |                                 )
main.c:33:30: warning: comparison between pointer and integer
   33 |                 if(dp[n][i]  <= wight);
      |                              ^~
Language: C++

#include <stdio.h>

long min(long a,long b);
int main(){
	int i,j,n,w;
	long ans=0;
	scanf("%d %d",&n,&w);
	long dp[n+10][100010];//single,value->wight
	for(i=0;i<n+10;i++){
		for(j=0;j<100010;j++){
			if(i== 0 and j== 0){
				dp[i][j] = 0;
			}else{
				dp[i][j] = 1000000000000; 
			}
		}
	}
	int wight[n+10],value[n+10];
	for(i=1;i<=n;i++){
		scanf("%d %d",&wight[i],&value[i]);
		for(j=100000;j>=0;j--){
			dp[i][j] = min(dp[i-1][j], dp[i][j+1]);

			if(j >= value[i]){
				dp[i][j] = min(dp[i][j], dp[i-1][j-value[i]] + wight[i]);
			}else{
				dp[i][j] = min(dp[i][j], wight[i]);
			}
		
		}
	}
	for(i=0;i<=100002;i++){
		if(dp[n][i]  <= wight);
		ans=i;
	}
	printf("\n%ld\n",ans);

	return 0;
}
long min(long a,long b){
	if(a <b){
		return (a);
	}else{
		return (b);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:30: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   33 |                 if(dp[n][i]  <= wight);
      |                    ~~~~~~~~~~^~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
const long long INF=1000000000;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < n;i++)
#define REP(i, n) for (int i = 0; i <= n;i++)
ll dp[105][100005];

int main(){
    ll n,W;
    cin>>n>>W;
    ll v[n],w[n],sum=0;
    rep(i,n){
        cin >> w[i] >> v[i];
        sum += v[i];
    }
    ll dp[sum];
    rep(i, sum) dp[i] = INF;
    dp[0]=0;
    rep(i,n){
        for(int j = sum - v[i]; j >= 0;j--){
            dp[j + v[i]] = min(dp[j + v[i]], dp[j] + w[i]);
        }
    }
    ll ans = 0;
    for (int i = sum; i >= 0;i--){
        if(dp[i]<=W){
            ans = max(i, ans);
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:22: error: no matching function for call to 'max(int&, ll&)'
   28 |             ans = max(i, ans);
      |                   ~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:28:22: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   28 |             ans = max(i, ans);
      |                   ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:28:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   28 |             ans = max(i, ans);
      |                   ~~~^~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
const long long INF=1000000000;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < n;i++)
#define REP(i, n) for (int i = 0; i <= n;i++)
ll dp[105][100005];

int main(){
    ll n,W;
    cin>>n>>W;
    ll v[n],w[n],sum=0;
    rep(i,n){
        cin >> w[i] >> v[i];
        sum += v[i];
    }
    ll dp[sum];
    rep(i, sum) dp[i] = INF;
    dp[0]=0;
    rep(i,n){
        rep(j = sum - v[i]; j >= ;j--){
            dp[j + v[i]] = min(dp[j + v[i]], dp[j] + w[i]);
        }
    }
    for (int i = sum; i >= 0;i--){
        if(dp[i]<=W){
            cout << i << endl;
            return 0;
        }
    }
}

Compiler output:
a.cc:21:38: error: macro "rep" requires 2 arguments, but only 1 given
   21 |         rep(j = sum - v[i]; j >= ;j--){
      |                                      ^
a.cc:5:9: note: macro "rep" defined here
    5 | #define rep(i, n) for(int i = 0; i < n;i++)
      |         ^~~
a.cc: In function 'int main()':
a.cc:21:9: error: 'rep' was not declared in this scope
   21 |         rep(j = sum - v[i]; j >= ;j--){
      |         ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
const long long INF=1000000000;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < n;i++)
#define REP(i, n) for (int i = 0; i <= n;i++)
ll dp[105][100005];

int main(){
    int n,W;
    cin >> n >> W;
    ll sina[n][2];
    REP(i,n)
        REP(j, 100003)
            dp[i][j] = -INF;
    rep(i, n){
         cin >> sina[i][0] >> sina[i][1];
         dp[i][0] = 0;
    }
    REP(i, 100003) dp[0][i] = 0;
    rep(i, n){
        REP(j, 100003){
            if (j < sina[i][1])
                dp[i + 1][j] = dp[i][j];
            else
                dp[i + 1][j] = max(dp[i][j], dp[i][j - sina[i][1]] + sina[i][0]);
        }
    }
    for (int i = 100001; i >= ;i++)
        if(dp[n][i]<=W){
            cout << dp[n][i] << endl;
            return 0;
        }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:31: error: expected primary-expression before ';' token
   29 |     for (int i = 100001; i >= ;i++)
      |                               ^
Language: Java

import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int w = sc.nextInt();
    int sum = 0;
    
    int wt[] = new int[n];
    int v[] = new int[n];
    for (int i=0; i<n; i++) {
      wt[i] = sc.nextInt();
      v[i] = sc.nextInt();
      sum += v[i];
    }
    long dp[] = new long[sum+1];
    long inf = 1234567890987;
    for (int i=1; i<=sum; i++) dp[i] = inf;
    dp[0] = 0;
    long ans = 0;
    for (int i=0; i<n; i++) {
      for (int W=sum; W-v[i]>=0; W--) {
        dp[W] = Math.min(dp[W], dp[W-v[i]] + wt[i]);
      }
    }
    for (int i=0; i<=sum; i++) {
      if (dp[i] <= w) {
        ans = Math.max(ans, i);
      }
    }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:18: error: integer number too large
    long inf = 1234567890987;
               ^
1 error
Language: Java

import java.util.HashMap;
import java.util.Scanner;

public class Main {

//    static long[][] dp;

    static Map<Data,Long> ddp = new TreeMap();

    static long max(long a, long b){
        if(a > b)
            return a;
        return b;
    }

    static long calculate(int[][] arr, int pos, int currentWeigth){
        Data data = new Data();
        data.size = pos;
        data.weight = currentWeigth;
        if(pos >= arr.length)
            return 0;
        if(arr[pos][0] <= currentWeigth){
            if(ddp.containsKey(data))
                return ddp.get(data);
            ddp.put(data, max(arr[pos][1]+calculate(arr,pos+1,currentWeigth-arr[pos][0]),
                    calculate(arr,pos+1,currentWeigth)));
            return ddp.get(data);
        }
        else{
            ddp.put(data,calculate(arr,pos+1,currentWeigth));
            return ddp.get(data);
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int w = sc.nextInt();

//        dp = new long[n][w+1];

        int[][] arr = new int[n][2];

        for(int i = 0; i < n; i++){
            arr[i][0] = sc.nextInt();
            arr[i][1] = sc.nextInt();
        }

//        for(int i = 0; i < n; i++){
//            for(int j = 0; j < w+1 ; j++){
//                dp[i][j] = -1;
//            }
//        }

        System.out.println(calculate(arr,0,w));
    }
}
class Data{
    int size,weight;
}

Compiler output:
Main.java:8: error: cannot find symbol
    static Map<Data,Long> ddp = new TreeMap();
           ^
  symbol:   class Map
  location: class Main
Main.java:8: error: cannot find symbol
    static Map<Data,Long> ddp = new TreeMap();
                                    ^
  symbol:   class TreeMap
  location: class Main
2 errors