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

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

typedef long long ll;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
// #define f(i,a,b) for(int (int)i = (int)a;i<b;i++)
// #define rf((i),(a),(b)) for(int (i) = b; (i)>(a);(i--))
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define mp make_pair

int main(void)
{
    ios_base::sync_with_stdio(false);
    ll n,w;
    cin >> n >> w;
    vector<pair<int,int>> val;
    for(int i = 0;i<n;i++)
    {
        int temp1,temp2;
        cin >> temp1 >> temp2;
        val.pb(mp(temp1,temp2));
    }
    vvi dp(n+1,vi(w+1,0));
    for(int i = 1;i<=n;i++)
        for(int j=1;j<=w;j++)
            if(val[i-1].first<=j)
                dp[i][j] = max((val[i-1].second + dp[i-1][j-val[i-1].first]),dp[i-1][j]);
            else
                dp[i][

Compiler output:
a.cc: In function 'int main()':
a.cc:36:23: error: expected primary-expression at end of input
   36 |                 dp[i][
      |                       ^
a.cc:36:23: error: expected ']' at end of input
   36 |                 dp[i][
      |                       ^
      |                       ]
a.cc:36:23: error: expected '}' at end of input
a.cc:19:1: note: to match this '{'
   19 | {
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
int main() {
	// your code goes here
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,W;
	cin>>n>>W;
	int w[n];
	long v[n];
	long dp[W+1];
	for(int i=0;i<n;i++)
	{
		cin>>w[i]>>v[i];
	}
	for(int i=0;i<=W;i++)
	{
		dp[i]=0;
	}
	for(int i=0;i<n;i++)
	{
		for(int j=W;j>=w[i];j--)
		{
			dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
		}
 
	}
 
	cout<<dp[W];
 
 


Compiler output:
a.cc: In function 'int main()':
a.cc:30:21: error: expected '}' at end of input
   30 |         cout<<dp[W];
      |                     ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

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

int main() {
	// your code goes here
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,W;
	cin>>n>>W;
	int w[n];
	long long int v[n];
	int dp[W+1];
	for(int i=0;i<n;i++)
	{
		cin>>w[i]>>v[i];
	}
/*	for(int i=0;i<n;i++)
	{
		cout<<w[i]<<" "<<v[i]<<"\n";
	}*/
	for(int i=0;i<=W;i++)
	{
		dp[i]=0;
	}
	for(int i=0;i<n;i++)
	{
		for(int j=W;j>=w[i];j--)
		{
			//cout<<"ok";
			dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
		//	cout<<j<<" "<<w[i]<<" "<<v[i]<<endl;
		//	cout<<dp[j]<<" ";
		
		}
		cout<<endl;
		
	}
/*	for(int i=0;i<=W;i++)
	{
	//	cout<<dp[i]<<" ";
	}*/
	cout<<dp[W];
	
	
	return 0;
}

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

#include<iostream>
using namespace std;

int main(){
  int n, W;
  cin >> n >> W;
  int w[n];
  int v[n];
  int dp[W+1];
  for(int i = 0;i < n;i++)
    cin >> w[i] >> v[i];
  for(int i = 0;i <= W;i++)
    dp[i]=0;
  for(int i = 0;i < n;i++){
    for(int j = W;j >= w[i];j--){
      dp[j] = max(dp[j], dp[j-w[i]]+v[i]);
    }
  }
  cout << dp[n][W] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:16: error: invalid types 'int[int]' for array subscript
   19 |   cout << dp[n][W] << endl;
      |                ^
Language: Java

import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String[] hiki = scan.nextLine().split(" ");
    int n = Integer.parseInt(hiki[0]);
    int w = Integer.parseInt(hiki[1]);
    int[] weight = new int[n];
    int[] value = new int[n];
    for(int i = 0;i < day;i ++){
      hiki = scan.nextLine().split(" ");
      weight[i] = Integer.parseInt(hiki[0]);
      value[i] = Integer.parseInt(hiki[1]);
    }
    long[][] dp = new long[n][w + 1];
    dp[0][weight[0]]=value[0];
    for(int i = 1;i < n;i ++){
      for(int j = 0;j <= w - weight[i];j ++){
        if(dp[i-1][j] > 0){
          dp[i][j] += dp[i-1][j];
          dp[i][j+weight[i]] += dp[i-1][j] + value[i];
        }
      }
    }
    long max = 0;
    for(int i = 0;i <= w;i ++){
      max = Math.max(max, dp[n-1][i]);
    }
    System.out.println(max);
  }
}


Compiler output:
Main.java:11: error: cannot find symbol
    for(int i = 0;i < day;i ++){
                      ^
  symbol:   variable day
  location: class Main
1 error
Language: C++

#include <iostream>

using namespace std;

long long maxi,n,W,i,gr,p[101],w[101],d[101][100010];

int main()
{
    cin>>n>>W;
    for(i=1;i<=n;i++)
    {
        cin>>w[i]>>p[i];
    }

    for(gr=0;gr<=W;gr++)
        d[1][gr]=INT_MIN/2;

    d[1][w[1]]=p[1];
    for(i=2;i<=n;i++)
    {
        for(gr=0;gr<=W;gr++)
        {
            d[i][gr]=d[i-1][gr];
            if(gr-w[i]>=0)d[i][gr]=max(d[i][gr],d[i-1][gr-w[i]]+p[i]);
        }
    }

    for(gr=0;gr<=W;gr++)
        maxi=max(maxi,d[n][gr]);

    cout<<maxi;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: 'INT_MIN' was not declared in this scope
   16 |         d[1][gr]=INT_MIN/2;
      |                  ^~~~~~~
a.cc:2:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 |
Language: Java

public class Main{

	public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
		
	    int n = Integer.parseInt(sc.next());
	    int w = Integer.parseInt(sc.next());
	    
	    long[][] matriz = new long[n+1][w+1];
	    int[] p = new int[n];
	    int[] v = new int[n];
	    
	    for(int i = 0; i <= n; i++) {
	      for(int j = 0; j <= w; j++) {
	        matriz[i][j] = 0;
	      }
	    }
	    
	    for(int i = 0; i < n; i++) {
	      p[i] = Integer.parseInt(sc.next());
	      v[i] = Integer.parseInt(sc.next());
	    }
	    
	    for(int i = 0; i < n; i++) {
	      for(int j = 0; j <= w; j++) {
	        matriz[i + 1][j] = matriz[i][j];
	        if(j >= p[i]) {
	          matriz[i+1][j] = Math.max(matriz[i + 1][j], matriz[i][j - p[i]] + v[i]);
	        }
	      }
	    }
	    
	    System.out.println(matriz[n][w]);

	}

}


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

public class Main{

	public static void main(String[] args) {
		//Lê as entradas do teclado
		Scanner sc = new Scanner(System.in);
		
	    int n = Integer.parseInt(sc.next());
	    int w = Integer.parseInt(sc.next());
	    
	    //Inicializa os parametros 
	    long[][] matriz = new long[n+1][w+1];
	    int[] p = new int[n];
	    int[] v = new int[n];
	    
	    //Inicializa a matriz com 0
	    for(int i = 0; i <= n; i++) {
	      for(int j = 0; j <= w; j++) {
	        matriz[i][j] = 0;
	      }
	    }
	    
	    //Lê as entradas de peso e valor
	    for(int i = 0; i < n; i++) {
	      p[i] = Integer.parseInt(sc.next());
	      v[i] = Integer.parseInt(sc.next());
	    }
	    
	    //Percorre a matriz buscando o valor que caiba na mochila
	    for(int i = 0; i < n; i++) {
	      for(int j = 0; j <= w; j++) {
	        matriz[i + 1][j] = matriz[i][j];
	        if(j >= p[i]) {
	          matriz[i+1][j] = Math.max(matriz[i + 1][j], matriz[i][j - p[i]] + v[i]);
	        }
	      }
	    }
	    
	    //Imprime a soma máxima possível dos valores dos itens que Taro leva para casa.
	    System.out.println(matriz[n][w]);

	}

}


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

import java.util.Scanner;

public class mochila {

	public static void main(String[] args) {
		//Lê as entradas do teclado
		Scanner sc = new Scanner(System.in);
		
	    int n = Integer.parseInt(sc.next());
	    int w = Integer.parseInt(sc.next());
	    
	    //Inicializa os parametros 
	    long[][] matriz = new long[n+1][w+1];
	    int[] p = new int[n];
	    int[] v = new int[n];
	    
	    //Inicializa a matriz com 0
	    for(int i = 0; i <= n; i++) {
	      for(int j = 0; j <= w; j++) {
	        matriz[i][j] = 0;
	      }
	    }
	    
	    //Lê as entradas de peso e valor
	    for(int i = 0; i < n; i++) {
	      p[i] = Integer.parseInt(sc.next());
	      v[i] = Integer.parseInt(sc.next());
	    }
	    
	    //Percorre a matriz buscando o valor que caiba na mochila
	    for(int i = 0; i < n; i++) {
	      for(int j = 0; j <= w; j++) {
	        matriz[i + 1][j] = matriz[i][j];
	        if(j >= p[i]) {
	          matriz[i+1][j] = Math.max(matriz[i + 1][j], matriz[i][j - p[i]] + v[i]);
	        }
	      }
	    }
	    
	    //Imprime a soma máxima possível dos valores dos itens que Taro leva para casa.
	    System.out.println(matriz[n][w]);

	}

}


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

package mochila;

import java.util.Scanner;

public class mochila {

	public static void main(String[] args) {
		//Lê as entradas do teclado
		Scanner sc = new Scanner(System.in);
		
	    int n = Integer.parseInt(sc.next());
	    int w = Integer.parseInt(sc.next());
	    
	    //Inicializa os parametros 
	    long[][] matriz = new long[n+1][w+1];
	    int[] p = new int[n];
	    int[] v = new int[n];
	    
	    //Inicializa a matriz com 0
	    for(int i = 0; i <= n; i++) {
	      for(int j = 0; j <= w; j++) {
	        matriz[i][j] = 0;
	      }
	    }
	    
	    //Lê as entradas de peso e valor
	    for(int i = 0; i < n; i++) {
	      p[i] = Integer.parseInt(sc.next());
	      v[i] = Integer.parseInt(sc.next());
	    }
	    
	    //Percorre a matriz buscando o valor que caiba na mochila
	    for(int i = 0; i < n; i++) {
	      for(int j = 0; j <= w; j++) {
	        matriz[i + 1][j] = matriz[i][j];
	        if(j >= p[i]) {
	          matriz[i+1][j] = Math.max(matriz[i + 1][j], matriz[i][j - p[i]] + v[i]);
	        }
	      }
	    }
	    
	    //Imprime a soma máxima possível dos valores dos itens que Taro leva para casa.
	    System.out.println(matriz[n][w]);

	}

}


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

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

int main()
{
    int n, limit;
    cin >> n >> limit;
    vector<ll> dp(limit+1);

    while (n--) {
        int w, p;
        cin >> w >> p;
        for (int x = limit; x >= w; x--) {
            dp[x] = max(dp[x], dp[x-w] + p);
        }
    }

    int ans = 0;
    for (int i = 1; i <= limit; i++) ans = max(ans, dp[i]);
    cout << ans << "\n";
}


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

#include <iostream>
#include <fstream>
#include <bits/stdc++.h>
#include <map>
#define pb push_back
#define ll long long
using namespace std;
int n,w,a,b;
int mem[100010];
typedef struct
{
    int w,v,q;
 }triplet;
vector<triplet> v;
int main()
{
    int i;
    cin>>n>>w;
    for(i=1;i<=n;i++)
    {
          cin>>a>>b;
            v.push_back({a,b});
     }
   sort(v.begin(),v.end))
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:8: error: no matching function for call to 'sort(std::vector<triplet>::iterator, <unresolved overloaded function type>)'
   24 |    sort(v.begin(),v.end))
      |    ~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<triplet*, vector<triplet> >]'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4762:63: note:   no known conversion for argument 2 from '<unresolved overloaded function type>' to '__gnu_cxx::__normal_iterator<triplet*, std::vector<triplet> >'
 4762 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |                                         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4793 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/14/bits/stl_algo.h:4793:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note:   candidate expects 4 arguments, 2 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include<stdio.h>
#include<string.h>
#define N 105
int n,lim;
int weight[N];
long long value[N];
long long dp[M];
void zeroOnePack(int weight,long long value)
{
	for (int i = lim; i >= weight; i--)
		dp[i] = (dp[i - weight] + value > dp[i]) ? dp[i - weight] + value : dp[i];
}
int main()
{
	while (scanf("%d %d", &n, &lim) != EOF)
	{
		for (int i = 1; i <= n; i++)
			scanf("%d %lld", &weight[i], &value[i]);
		memset(dp, 0, sizeof(dp));
		for (int i = 1; i <= n; i++)
			zeroOnePack(weight[i], value[i]);
		printf("%lld\n", dp[lim]);
	}
	return 0;
}

Compiler output:
a.cc:7:14: error: 'M' was not declared in this scope
    7 | long long dp[M];
      |              ^
a.cc: In function 'void zeroOnePack(int, long long int)':
a.cc:11:17: error: 'dp' was not declared in this scope
   11 |                 dp[i] = (dp[i - weight] + value > dp[i]) ? dp[i - weight] + value : dp[i];
      |                 ^~
a.cc: In function 'int main()':
a.cc:19:24: error: 'dp' was not declared in this scope
   19 |                 memset(dp, 0, sizeof(dp));
      |                        ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 1e18L + 5;
int32_t main()
{
 int n, W;
  cin>>n>>W;
  vector<int> weight(n);
  vector<int> value(n);
  int sum_value = 0;
  for(int i=0; i<n; i++){
    	cin>>weight[i]>>value[i];
    	sum_value += value[i];
  }
  vector<int> dp(sum_value + 1, INF);
  for(int item =0; item < n; item++){
    for(int j = sum_value; j>=value[item]; j--){
      dp[j] = min(dp[j], dp[j-value[item]] + weight[item]);
    }
  }
 int ans = 0;
 for(int x : dp){
   if( x <=W)
     	ans = max(ans, x);
   cout<<ans;
 }

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:27:3: error: expected '}' at end of input
   27 |  }
      |   ^
a.cc:6:1: note: to match this '{'
    6 | {
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 1e18L + 5;
int32_t main()
{
 int n, W;
  cin>>n>>W;
  vector<int> weight(n);
  vector<int> value(n);
  int sum_value = 0;
  for(int i=0; i<n; i++){
    	cin>>weight[i]>>value[i];
    	sum_value += value[i];
  }
  vector<int> dp(sum_value + 1, INF);
  for(int item =0; item < n; item++){
    for(int j = sum_value; j>=value[item]; j--){
      dp[j] = min(dp[j], dp[j-value[item]] + weight[item]);
 int ans = 0;
 for(int x : dp){
   if( x <=W)
     	ans = max(ans, x);
   cout<<ans;

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:24:14: error: expected '}' at end of input
   24 |    cout<<ans;
      |              ^
a.cc:21:17: note: to match this '{'
   21 |  for(int x : dp){
      |                 ^
a.cc:24:14: error: expected '}' at end of input
   24 |    cout<<ans;
      |              ^
a.cc:18:48: note: to match this '{'
   18 |     for(int j = sum_value; j>=value[item]; j--){
      |                                                ^
a.cc:24:14: error: expected '}' at end of input
   24 |    cout<<ans;
      |              ^
a.cc:17:37: note: to match this '{'
   17 |   for(int item =0; item < n; item++){
      |                                     ^
a.cc:24:14: error: expected '}' at end of input
   24 |    cout<<ans;
      |              ^
a.cc:6:1: note: to match this '{'
    6 | {
      | ^
Language: C++

#include <iostream>
using namespace std;
int main(){
  int n,w,i,j;
  cin>>n>>w;
  int data[n][2];
  for(i=0;i<n;i++){
    cin>>data[i][0]>>data[i][1];
  }
  int dp[n+1][w+1];
  for(i=0;i<=n;i++){
    for(j=0;j<=w;j++){
      if(i==0)dp[i][j]=0
      else if(j>=data[i+1][0])dp[i][j]=min(dp[i-1][j],dp[i-1][j-data[i+1][0]]+data[i+1][1]);
      else dp[i][j]=dp[i-1][j];
    }
  }
  cout<<dp[n][w];
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:25: error: expected ';' before 'else'
   13 |       if(i==0)dp[i][j]=0
      |                         ^
      |                         ;
   14 |       else if(j>=data[i+1][0])dp[i][j]=min(dp[i-1][j],dp[i-1][j-data[i+1][0]]+data[i+1][1]);
      |       ~~~~
Language: C++

#include<stdio.h>
#include<string.h>
#define N 105
	int n,lim;
	int weight[N];
	long long value[N];
	long long dp[N];
void zeroOnePack(int weight,long long value)
	{
		for (int i = lim; i >= weight; i--)
			dp[i] = (dp[i - weight] + value > dp[i]) ? dp[i - weight] + value : dp[i];
	}
int main()
{
	while (scanf_s("%d %d", &n, &lim) != EOF)
	{
		for (int i = 1; i <= n; i++)
			scanf_s("%d %lld", &weight[i], &value[i]);
		memset(dp, 0, sizeof(dp));
		for (int i = 1; i <= n; i++)
			zeroOnePack(weight[i], value[i]);
		printf("%lld\n", dp[lim]);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   15 |         while (scanf_s("%d %d", &n, &lim) != EOF)
      |                ^~~~~~~
      |                scanf
Language: Java

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

     public static void main(String []args){
        Scanner sc=new Scanner(System.in);
         int n=sc.nextInt();
         int w=sc.nextInt();
         int wi[]=new int[n];
         int v[]=new int [n];
         
          for(int i=0;i<n;i++)
          {
              wi[i]=sc.nextInt();
              v[i]=sc.nextInt();
          }
          
         long dp[][]=new long[n][w+1];
         
         for(int i=wi[0];i<=w;i++)
          {
              dp[0][i]=v[0];
          }
          for(int i=1;i<n;i++)
           {
             for(int j=0;j<=w;j++)
              {
                 
                 if(j<wi[i])
                  dp[i][j]=dp[i-1][j];
                  else
                  dp[i][j]=Math.max(dp[i-1][j] , v[i]+dp[i-1][j-wi[i]]);
               }
               
          }
         
         System.out.println(dp[n-1][w]);
            
             
           
          
       }
     
     
}

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

#include<stdio.h>
const int N=100;
const int W=1e5;
int B[N][W];
int w[1e5];
int v[1e9];

void knapsack()
{
	int k,c;
	for(k=1;k<N;k++) {
		for(c=1;c<W;c++) {
			if ( w[k]>c) {
				B[k][c] = B[k-1][c];
			}
			else {
				int value1 = B[k-1][c-w[k]]+v[k];
				int value2 = B[k-1][c];
				if (value1 > value2) {
					B[k][c] = value1;
				}
				else {
					B[k][c] = value2;
			  }
			}
		}
	}
}


int main()
{   
	scanf("%d %d",&N,&W);
	knapsack();
	printf("%d\n",B[N][W]);
	return 0;
}


Compiler output:
a.cc:5:7: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    5 | int w[1e5];
      |       ^~~
a.cc:5:7: error: could not convert '1.0e+5' from 'double' to 'long unsigned int'
    5 | int w[1e5];
      |       ^~~
      |       |
      |       double
a.cc:5:7: error: size of array 'w' has non-integral type 'double'
a.cc:6:7: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    6 | int v[1e9];
      |       ^~~
a.cc:6:7: error: could not convert '1.0e+9' from 'double' to 'long unsigned int'
    6 | int v[1e9];
      |       ^~~
      |       |
      |       double
a.cc:6:7: error: size of array 'v' has non-integral type 'double'
Language: C

#include<stdio.h>
const int N=100;
const int W=1e5;
int B[N][W];
int w[1e5];
int v[1e9];

void knapsack()
{
	int k,c;
	for(k=1;k<N;k++) {
		for(c=1;c<W;c++) {
			if ( w[k]>c) {
				B[k][c] = B[k-1][c];
			}
			else {
				int value1 = B[k-1][c-w[k]]+v[k];
				int value2 = B[k-1][c];
				if (value1 > value2) {
					B[k][c] = value1;
				}
				else {
					B[k][c] = value2;
			  }
			}
		}
	}
}


int main()
{   
	scanf("%d %d",&N,&W);
	knapsack();
	printf("%d\n",B[N][W]);
	return 0;
}


Compiler output:
main.c:4:5: error: variably modified 'B' at file scope
    4 | int B[N][W];
      |     ^
main.c:4:5: error: variably modified 'B' at file scope
main.c:5:5: error: size of array 'w' has non-integer type
    5 | int w[1e5];
      |     ^
main.c:6:5: error: size of array 'v' has non-integer type
    6 | int v[1e9];
      |     ^
Language: C++

// 動的計画法
// knapsack

#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <climits>
#include <cmath>
#include <functional>
#include <map>
#include <queue>
#include <set>
#include <stack>

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define size_t unsigned long long
#define ll long long
#define rep(i,a) for(int i=0;i<(a);i++)
#define repr(i,a) for(int i=(int)(a)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=a;i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const int MOD = 1e9 + 7;

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

const int n_max = 100 + 5, w_max = 1e5 + 5;

int n,W;
ll w[n_max], v[n_max];

ll dp[n_max][w_max]; //[i][j]---i番目の品物の中で、重さの総和がj以下の時の価値の最大値

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


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

#include<stdio.h>
int N=1e5, W=1e9;
int B[N][W];
int w[1005];
int v[1005];

void knapsack()
{
	int k,c;
	for(k=1;k<N;k++) {
		for(c=1;c<W;c++) {
			if ( w[k]>c) {
				B[k][c] = B[k-1][c];
			}
			else {
				int value1 = B[k-1][c-w[k]]+v[k];
				int value2 = B[k-1][c];
				if (value1 > value2) {
					B[k][c] = value1;
				}
				else {
					B[k][c] = value2;
			         }
			}
		}
	}
}


int main()
{   
	scanf("%d %d",&N,&W);
	knapsac();
	printf("%d\n",B[N][W]);
	return 0;
}


Compiler output:
main.c:3:5: error: variably modified 'B' at file scope
    3 | int B[N][W];
      |     ^
main.c:3:5: error: variably modified 'B' at file scope
main.c: In function 'main':
main.c:33:9: error: implicit declaration of function 'knapsac'; did you mean 'knapsack'? [-Wimplicit-function-declaration]
   33 |         knapsac();
      |         ^~~~~~~
      |         knapsack
Language: C++

#include<stdio.h>
int N=1e5, W=1e9;
int B[N][W];
int w[1005];
int v[1005];

void knapsack()
{
	int k,c;
	for(k=1;k<N;k++) {
		for(c=1;c<W;c++) {
			if ( w[k]>c) {
				B[k][c] = B[k-1][c];
			}
			else {
				int value1 = B[k-1][c-w[k]]+v[k];
				int value2 = B[k-1][c];
				if (value1 > value2) {
					B[k][c] = value1;
				}
				else {
					B[k][c] = value2;
			}
			}
		}
	}
}


int main()
{   
	scanf("%d %d",&N,&W);
	knapsac();
	printf("%d\n",B[N][W]);
	return 0;
}


Compiler output:
a.cc:3:10: error: size of array 'B' is not an integral constant-expression
    3 | int B[N][W];
      |          ^
a.cc:3:7: error: size of array 'B' is not an integral constant-expression
    3 | int B[N][W];
      |       ^
a.cc: In function 'int main()':
a.cc:33:9: error: 'knapsac' was not declared in this scope; did you mean 'knapsack'?
   33 |         knapsac();
      |         ^~~~~~~
      |         knapsack
Language: C++

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

int dp[102][100002], c, n, k, cisim[100][2];

int recursive(int konum, int agirlik){
	if(konum>n)return 0;
	if(agirlik>=c)return 0;
	if(dp[konum][agirlik])return dp[konum][agirlik];
	if(cisim[konum][0]>c-agirlik)dp[konum][agirlik]=recursive(konum+1,agirlik);
	else dp[konum][agirlik]=max(cisim[konum][1]+recursive(konum+1, agirlik+cisim[konum][0]), recursive(konum+1, agirlik));
	return dp[konum][agirlik];
}

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


Compiler output:
a.cc: In function 'int main()':
a.cc:20:15: error: expected primary-expression before ';' token
   20 |         cout<<;
      |               ^
Language: C++

#include <cstdio>
#include <cstdlib>
using namespace std;

long long dp[110][100010];
signed main(){
    cin.tie(0); 
    ios::sync_with_stdio(false);
    int n,w_allow;
    int w[110],v[110];
    cin >> n >> w_allow;
    for(int i=1;i<=n;i++){
        cin >> w[i] >> v[i];
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=w_allow;j++){
            if(w[i] <= j){
                dp[i][j] = max(dp[i-1][j],dp[i-1][j-w[i]] + v[i]);
            }else{
                dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    cout << dp[n][w_allow] << "\n";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope
    7 |     cin.tie(0);
      |     ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <cstdlib>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:8:5: error: 'ios' has not been declared
    8 |     ios::sync_with_stdio(false);
      |     ^~~
a.cc:18:28: error: 'max' was not declared in this scope
   18 |                 dp[i][j] = max(dp[i-1][j],dp[i-1][j-w[i]] + v[i]);
      |                            ^~~
a.cc:20:28: error: 'max' was not declared in this scope
   20 |                 dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
      |                            ^~~
a.cc:24:5: error: 'cout' was not declared in this scope
   24 |     cout << dp[n][w_allow] << "\n";
      |     ^~~~
a.cc:24:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <bits/stdc++.h>
#include <cstring>

using namespace std;

typedef long long ll;
const int Nmax = 105;
const ll INF = 1e12L + 5;

struct {
    int weight;
    ll cost;
} a[Nmax];

int N,W;
ll sum;

static inline ll Max(ll a, ll b) {
    return (a > b) ? a : b;
}
static inline ll Min(ll a, ll b) {
    return (a > b) ? b : a;
}

int main() {
    cin >> N >> W;
    for(int i = 1; i <= N; ++i) {
        cin >> a[i].weight >> a[i].cost;
        sum += a[i].cost;
    }
    vector<ll> dp(sum + 1,INF);
    dp[0] = 0;
    for(int i = 1; i <= N; ++i)
        for(int j = sum - a[i].cost; j >= 0; --j)
            dp[j + a[i].cost] = Min(dp[j + a[i].cost],dp[j] + a[i].weight);

    ll ans = 0;
    for(ll i = 0; i <= sum; ++i)
        if(dp[i] <= W)
            ans = max(i,ans);x`
    cout << ans;
    return 0;
}


Compiler output:
a.cc:40:31: error: stray '`' in program
   40 |             ans = max(i,ans);x`
      |                               ^
a.cc: In function 'int main()':
a.cc:40:30: error: 'x' was not declared in this scope
   40 |             ans = max(i,ans);x`
      |                              ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

const int Nmax = 101;
struct Rucsac
{
    int cost,weight;
};

Rucsac a[Nmax];
int N,W;

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

    for(int i = 1; i <= N; ++i)
        cin >> a[i].cost >> a[i].weight;
    vector <vector <int> > b(N + 1,vector<int> {W + 1,0});
    for(int i = 1; i <= N; ++i)
        for(int j = 1; j <= W; ++j)
        {
            if(a.weight[j] <= W)
                b[i][j] = max(b[i - 1][W - a.weight[j]],b[i - 1][j]);
            else b[i][j] = b[i - 1][j];
        }
    cout << b[N][W];
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:18: error: request for member 'weight' in 'a', which is of non-class type 'Rucsac [101]'
   24 |             if(a.weight[j] <= W)
      |                  ^~~~~~
a.cc:25:46: error: request for member 'weight' in 'a', which is of non-class type 'Rucsac [101]'
   25 |                 b[i][j] = max(b[i - 1][W - a.weight[j]],b[i - 1][j]);
      |                                              ^~~~~~
Language: C++

#include<bits/stdc++.h>
#define int long long
using namespace std;
 
signed main(){
  int n,W;
  cin>>n>>W;
  vector<pair<int,int>> v;
  for(int i=0;i<n;++i){
    int a,b;
    cin>>a>>b;
    v.push_back({a,b});
  }
  int dp[n+1][W+1];
  memset(dp,0,sizeof(dp));
  for(int i=1;i<=n;++i){
    for(int j=0;j<=W;++j){
      if(v[i].first>j)dp[i][j]=dp[i-1][j];
      else dp[i][j]=max(dp[i-1][j],v[i-1].second+dp[i-1][j-v[i-1].first]);
    }
  }
  int maxm=0;
  for(int k=0;k<=W;++k){
    maxm=max(maxm,dp[n][k];
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:27: error: expected ')' before ';' token
   24 |     maxm=max(maxm,dp[n][k];
      |             ~             ^
      |                           )
Language: C++

#include<bits/stdc++.h>
#define int long long
using namespace std;
 
signed main(){
  int n,W;
  cin>>n>>W;
  vector<pair<int,int>> v;
  for(int i=0;i<n;++i){
    int a,b;
    cin>>a>>b;
    v.push_back({a,b});
  }
  int dp[n+1][W+1];
  memset(dp,0,sizeof(dp));
  for(int i=1;i<=n;++i){
    for(int j=0;j<=W;++j){
      if(v[i].first>j)dp[i][j]=dp[i-1][j];
      else dp[i][j]=max(dp[i-1][j],v[i].second+dp[i-1][j-v[i].first]);
    }
  }
  int maxm=0;
  for(int k=0;k<=W;++k){
    maxm=max(maxm,dp[n][k];
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:27: error: expected ')' before ';' token
   24 |     maxm=max(maxm,dp[n][k];
      |             ~             ^
      |                           )
Language: C++

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

signed main(){
  int n,W;
  cin>>n>>W;
  vector<pair<int,int>> v;
  for(int i=0;i<n;++i){
    int a,b;
    cin>>a>>b;
    v.push_back({a,b});
  }
  int dp[n+1][W+1];
  meemset(dp,0,sizeof(dp));
  for(int i=1;i<=n;++i){
    for(int j=0;j<=W;++j){
      if(v[i].first>j)dp[i][j]=dp[i-1][j];
      else dp[i][j]=max(dp[i-1][j],v[i].second+dp[i-1][j-v[i].first]);
    }
  }
  cout<<dp[n][W];
  return 0;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: 'meemset' was not declared in this scope; did you mean 'memset'?
   15 |   meemset(dp,0,sizeof(dp));
      |   ^~~~~~~
      |   memset
Language: C++

#include <bits/stdc++.h>
using namespace std;
long long i,j,n,m,w[100010],f[10010][10010],v[100010];
int main()
    {
        cin>>n>>s;
        for (i=1;i<=n;i++) cin>>w[i]>>v[i];
        for (i=1;i<=n;i++)
            for (j=1;j<=s;j++)
        {
            if (j-w[i]>0) f[i][j]=max(f[i-1][j-w[i]]+v[i],f[i-1][j]);
            else f[i][j]=f[i-1][j];
        }
        cout<<f[n][s];
        return 0;
    }



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

#include <stdio.h>
//Nは荷物の数
//Wはナップサックの容量
//配列wは
//配列vは
long N, W, w[100] = {0}, v[100] = {0}, i, j, dp[100][100000] = {0}, count = 0;

void max(long *a, long b){
    if(*a < b){
        *a=b;
    }
}

int main() {


    scanf("%ld", &N);
    scanf("%ld", &W);

    for (i = 0; i < N; i++) {
        scanf("%ld", &w[i]);
        scanf("%ld", &v[i]);
    }
    


    for (i = 1; i <= N; i++) {
       
        for (j = 1; j <= W; j++) {

            if (j >= w[i]) {
                max(&dp[i + 1][j], dp[i][j - w[i]] + v[i]);
            }
            max(&dp[i + 1][j], dp[i][j]);
            

        }
        
    }
    printf("%ld\n", dp[N][W]);
    

Compiler output:
main.c: In function 'main':
main.c:40:5: error: expected declaration or statement at end of input
   40 |     printf("%ld\n", dp[N][W]);
      |     ^~~~~~
Language: C++

//knapsack 0-1
#include<bits/stdc++.h>
#define fastIO ios::sync_with_stdio(false);cin.tie(0);
#define ll long long
#define int ll
#define f(i, l, r) for(i = l; i < r; i++)
#define fd(i, l, r) for(i = l; i > r; i--)
#define mod 1000000007
#define pb push_back
using namespace std;
typedef pair <int, int> pi;

int main(){
	fastIO
    int test = 1;
    // cin >> test;
    while(test--){
        int n; cin >> n;
        int W, weight[n], value[n];
        cin >> W;
        int i;
        f(i,0,n)cin >> weight[i] >> value[i];
        int dp[n+1][W+1];
        int j;
        f(i,0,n+1){
            f(j,0,W+1){
                if(i == 0 || j == 0)
                    dp[i][j] =0;
                else if(j >= weight[i-1])
                    dp[i][j] = max(dp[i-1][j],value[i-1] + dp[i-1][j-weight[i-1]]);
                else dp[i][j] = dp[i-1][j];
            }
        }
        cout << dp[n][W];
    }
}

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

//knapsack 0-1
#include<bits/stdc++.h>
#define fastIO ios::sync_with_stdio(false);cin.tie(0);
#define ll long long
#define f(i, l, r) for(i = l; i < r; i++)
#define fd(i, l, r) for(i = l; i > r; i--)
#define mod 1000000007
#define pb push_back
using namespace std;
typedef pair <int, int> pi;

int main(){
	fastIO
    int test = 1;
    // cin >> test;
    while(test--){
        int n; cin >> n;
        int W, weight[n], value[n];
        cin >> W;
        int i;
        f(i,0,n)cin >> weight[i] >> value[i];
        int dp[n][W+1];
        int j;
        f(i,0,n){
            f(j,0,W+1){
                if(i == 0 || j == 0)
                    dp[i][j] =0;
                else if(j >= weight[i])
                    dp[i][j] = max(dp[i-1][j],value[i] dp[i-1][j-weight[i]]);
                else dp[i][j] = dp[i-1][j];
            }
        }
        cout << dp[n-1][W];
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:55: error: expected ')' before 'dp'
   29 |                     dp[i][j] = max(dp[i-1][j],value[i] dp[i-1][j-weight[i]]);
      |                                   ~                   ^~~
      |                                                       )
Language: C++

#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long   ll;
typedef unsigned long long   ull;
typedef long double ld;
typedef pair<ll, ll>    pll;
typedef pair<ull, ull>    pull;
typedef pair<ll, ll>  pii;
typedef pair<ld, ld>  pld;
ll n, w;
ll ans;
ll dp[100009];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    cin >> n >> w;
    
    for(ll i = 0; i < n; ++i){
        ll x, y;
        cin >> x >> y;
        for(ll j = 1e5; j >= x; --j){
            dp[j] = max(dp[j-x] + y, dp[j]);
            //cout << i << " " << j << " " << dp[j] << "\n";
        }
    }
    cout << dp[min(w, 1e5)] << "\n";
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:19: error: no matching function for call to 'min(ll&, double)'
   33 |     cout << dp[min(w, 1e5)] << "\n";
      |                ~~~^~~~~~~~
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:33:19: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'double')
   33 |     cout << dp[min(w, 1e5)] << "\n";
      |                ~~~^~~~~~~~
/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:33:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   33 |     cout << dp[min(w, 1e5)] << "\n";
      |                ~~~^~~~~~~~
Language: C++

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n, w;
  cin >> n >> w;
  int weights[n];
  int value[n];
  for(int i = 0;i<n;i++){
    cin >> weights[i] >> value[i];
  }
  
  int dp[n+1][w+1];
  for(int i = 0;i<=n;i++){
    dp[i][0] = 0;
  }
  for(int i = 0;i<=w;i++){
    dp[0][i] = 0;
  }
  
  for(int i = 1;i<=n;i++){
    for(int j = 1;j<=w;j++){
      if(weights[i] <= j){
        dp[i][j] = max(dp[i-1][j], value[i-1] + dp[i-1][j-weights[i]);
      }
      else{
        dp[i][j] = dp[i-1][j];
      }
    }
  }
  
  cout << dp[n][w] << "\n";
  return 0;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:69: error: expected ']' before ')' token
   24 |         dp[i][j] = max(dp[i-1][j], value[i-1] + dp[i-1][j-weights[i]);
      |                                                                     ^
      |                                                                     ]
Language: C++

#include<bits/stdc++.h>
using namespace std;
std::vector<int> wt;
std::vector<int> val;
std::vector<std::vector<int>> dp;
int w,n;


int helper(int currWt, int index){
	if(currWt > w)
		return INT_MIN;
	if(index == n)
		return 0;
	int res =0;
	if(dp[cwt][index] != -1)
		return dp[cwt][index];

	if(currWt+wt[index] <= w){
		res = max(helper(currWt+wt[index], index+1)+val[index], helper(currWt, index+1));
	}else
	    res = (helper(currWt, index+1));

	 dp[currWt][index] = res;

	 return res;
}

int main()
{
	cin>>n>>w;
	val.clear();
	val.resize(n);
	wt.clear();
	wt.resize(n);
	dp.clear();
	dp.resize(w+1,std::vector<int>(n+1,-1));
	for(int i =0; i<n; i++){
		cin>>wt[i]>>val[i];
	}
	cout<<helper(0,0);
	/* code */
	return 0;
}

Compiler output:
a.cc: In function 'int helper(int, int)':
a.cc:15:15: error: 'cwt' was not declared in this scope; did you mean 'wt'?
   15 |         if(dp[cwt][index] != -1)
      |               ^~~
      |               wt
Language: C++

#include<bits/stdc++.h>
using namespace std;
std::vector<int> wt;
std::vector<int> val;
std::vector<std::vector<int>> dp;
int w,n;


int helper(int currWt, int index){
	int res =0;

	if(currWt+wt[index] <= w){
		res = max(helper(currWt+wt[index], index+1)+val[index], helper(currWt, index+1));
	}else
	    res = (helper(currWt, index+1));

	 res = dp[currWt,index];

	 return res;
}

int main()
{
	cin>>n>>w;
	val.clear();
	val.resize(n);
	wt.clear();
	wt.resize(n);
	dp.clear();
	dp.resize(w+1,std::vector<int>(n+1,-1));
	for(int i =0; i<n; i++){
		cin>>wt[i]>>val[i];
	}
	cout<<helper(0,0);
	/* code */
	return 0;
}

Compiler output:
a.cc: In function 'int helper(int, int)':
a.cc:17:31: error: cannot convert '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'int' in assignment
   17 |          res = dp[currWt,index];
      |                               ^