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

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

#define WMAX 100005
#define NMAX 100005
#define DIAGONAL 1
#define TOP 0


struct Item
{
    int value, weight;
};

Item items[NMAX];
int C[NMAX][WMAX], G[NMAX][WMAX];
int N, W;

int compute(){
    for (int i = 0; i < W; ++i)
    {
        C[0][i] = 0;
    }

    for (int i = 0; i < N; ++i)
    {
        C[i][0] = 0;
    }

    for (int i = 1; i <= N; ++i)
    {
        for (int j = 1; j <= W; ++j)
        {
            C[i][j] = C[i-1][j];
            if (j < items[j].weight) continue;//?????????<=??????????????????????????§??????????????????????????? 
            if (C[i-1][j-items[i].weight] + items[i].value >= C[i-1][j]) {
                C[i][j] = C[i-1][j-items[i].weight] + items[i].value;
            }
        }
    }
    return C[N][W];
}

void input(){
    cin >> N >> W;
    for (int i = 0; i < N; ++i)
    {
        cin >> items[i+1].value >> items[i+1].weight;
    }
}

int main(){
    input();
    cout << compute() << endl;
}

Compiler output:
/tmp/ccURHQTb.o: in function `compute()':
a.cc:(.text+0x2e): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccURHQTb.o
a.cc:(.text+0x60): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccURHQTb.o
a.cc:(.text+0x211): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccURHQTb.o
a.cc:(.text+0x224): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccURHQTb.o
a.cc:(.text+0x233): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccURHQTb.o
a.cc:(.text+0x239): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccURHQTb.o
/tmp/ccURHQTb.o: in function `input()':
a.cc:(.text+0x26b): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccURHQTb.o
a.cc:(.text+0x287): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccURHQTb.o
a.cc:(.text+0x2fd): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccURHQTb.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

#define WMAX 100005
#define NMAX 100005
#define DIAGONAL 1
#define TOP 0


struct Item
{
    int value, weight;
};

Item items[NMAX];
int C[NMAX][WMAX], G[NMAX][WMAX];
int N, W;

int compute(){
    for (int i = 0; i < W; ++i)
    {
        C[0][i] = 0;
    }

    for (int i = 0; i < N; ++i)
    {
        C[i][0] = 0;
    }

    for (int i = 1; i <= N; ++i)
    {
        for (int j = 1; j <= W; ++j)
        {
            C[i][j] = C[i-1][j];
            if (j < items[j].weight) continue;//?????????<=??????????????????????????§??????????????????????????? 
            if (C[i-1][j-items[i].weight] + items[i].value >= C[i-1][j]) {
                C[i][j] = C[i-1][j-items[i].weight] + items[i].value;
            }
        }
    }
    return C[N][W];
}

void input(){
    cin >> N >> W;
    for (int i = 0; i < N; ++i)
    {
        cin >> items[i+1].value >> items[i+1].weight;
    }
}

int main(){
    input();
    cout << compute() << endl;
}

Compiler output:
/tmp/ccNnQzaQ.o: in function `compute()':
a.cc:(.text+0x2e): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccNnQzaQ.o
a.cc:(.text+0x60): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccNnQzaQ.o
a.cc:(.text+0x211): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccNnQzaQ.o
a.cc:(.text+0x224): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccNnQzaQ.o
a.cc:(.text+0x233): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccNnQzaQ.o
a.cc:(.text+0x239): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccNnQzaQ.o
/tmp/ccNnQzaQ.o: in function `input()':
a.cc:(.text+0x26b): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccNnQzaQ.o
a.cc:(.text+0x287): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccNnQzaQ.o
a.cc:(.text+0x2fd): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccNnQzaQ.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

#define WMAX 100005
#define NMAX 100005
#define DIAGONAL 1
#define TOP 0


struct Item
{
    int value, weight;
};

Item items[NMAX];
int C[NMAX][WMAX], G[NMAX][WMAX];
int N, W;

int compute(){
    for (int i = 0; i < W; ++i)
    {
        C[0][i] = 0;
    }

    for (int i = 0; i < N; ++i)
    {
        C[i][0] = 0;
    }

    for (int i = 1; i <= N; ++i)
    {
        for (int j = 1; j <= W; ++j)
        {
            C[i][j] = C[i-1][j];
            if (j < items[j].weight) continue;//?????????<=??????????????????????????§??????????????????????????? 
            if (C[i-1][j-items[i].weight] + items[i].value >= C[i-1][j]) {
                C[i][j] = C[i-1][j-items[i].weight] + items[i].value;
            }
        }
    }
    return C[N][W];
}

void input(){
    cin >> N >> W;
    for (int i = 0; i < N; ++i)
    {
        cin >> items[i+1].value >> items[i+1].weight;
    }
}

int main(){
    input();
    cout << compute() << endl;
}

Compiler output:
/tmp/cc0NWSkS.o: in function `compute()':
a.cc:(.text+0x2e): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/cc0NWSkS.o
a.cc:(.text+0x60): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cc0NWSkS.o
a.cc:(.text+0x211): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/cc0NWSkS.o
a.cc:(.text+0x224): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cc0NWSkS.o
a.cc:(.text+0x233): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cc0NWSkS.o
a.cc:(.text+0x239): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/cc0NWSkS.o
/tmp/cc0NWSkS.o: in function `input()':
a.cc:(.text+0x26b): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cc0NWSkS.o
a.cc:(.text+0x287): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/cc0NWSkS.o
a.cc:(.text+0x2fd): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/cc0NWSkS.o
collect2: error: ld returned 1 exit status
Language: C++

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
#include<vector>
#include<stack>
#include<queue>
#include<iostream>
#define M -1
using namespace std;
int dp[1001][1001];
int value[1001],weight[1001];
int main(void)
{
	int n,w;
	cin>>n>>w;
	for(i=0;i<n;i++) cin>>value[i]>>weight[i];
	for(i=0;i<n;i++) {
		for(j=0;j<=w;j++) dp[i][j]=M;
	}
	dp[0][0]=0;
	for(i=0;i<n;i++) {
		for(j=0;j<=w;j++) {
			if(dp[i][j]!=M) {
				dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
				if(j+weight[i]<=w) {
					dp[i+1][j+weight[i]]=max(dp[i][j]+value[i],dp[i+1][j+weight[i]]);
				}
			}
		}
	}
	int mx=-1;
	for(i=0;i<=w;i++) if(mx<dp[n][i]) mx=dp[n][i];
	cout << mx << endl;
	exit(0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:13: error: 'i' was not declared in this scope
   17 |         for(i=0;i<n;i++) cin>>value[i]>>weight[i];
      |             ^
a.cc:18:13: error: 'i' was not declared in this scope
   18 |         for(i=0;i<n;i++) {
      |             ^
a.cc:19:21: error: 'j' was not declared in this scope
   19 |                 for(j=0;j<=w;j++) dp[i][j]=M;
      |                     ^
a.cc:22:13: error: 'i' was not declared in this scope
   22 |         for(i=0;i<n;i++) {
      |             ^
a.cc:23:21: error: 'j' was not declared in this scope
   23 |                 for(j=0;j<=w;j++) {
      |                     ^
a.cc:33:13: error: 'i' was not declared in this scope
   33 |         for(i=0;i<=w;i++) if(mx<dp[n][i]) mx=dp[n][i];
      |             ^
Language: C++

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

int main(){
  int n, m;
  cin >> n >> m;
  int v[n];
  int t[n];
  for(int i = 0; i < n; i++){
    scanf("%d %d", &v[i], &w[i]);
  }
  int dp[110][10010];
  memset(dp, 0, sizeof(dp));
  for(int i = 0; i < n; i++){
    for(int j = 0; j <= 500; j++){
      if(j < w[i]){
        dp[i + 1][j] = dp[i][j];
      }else{
        dp[i + 1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i]);
      }
    }
  }
  cout << dp[n][m] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:28: error: 'w' was not declared in this scope
   10 |     scanf("%d %d", &v[i], &w[i]);
      |                            ^
a.cc:16:14: error: 'w' was not declared in this scope
   16 |       if(j < w[i]){
      |              ^
Language: C++

20 1000
23 23
50 68
22 13
65 38
40 58
62 83
20 19
4 3
38 51
19 9
55 57
2 2
21 11
2 2
5 5
38 27
9 5
79 63
55 45
73 90

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 20 1000
      | ^~
Language: C++

#include<iostream>
using namespace std;
int v[101],w[101];
int value(i,c)
{
    if(i<=0||c<=0)
        return 0;
    else if((c-w[i])<0)
        return value(i-1,c);
    else
        return max(v[i]+value(i-1,c-w[i]),value(i-1,c));
};

int main()
{
    int N,W;
    cin>>N>>W;
    v[0]=0;
    w[0]=0;
    for(int i=1;i<N;i++)
    {
        cin>>v[i]>>w[i];
    }
    
    cout<<value(N,W)<<endl;
}

Compiler output:
a.cc:4:11: error: 'i' was not declared in this scope
    4 | int value(i,c)
      |           ^
a.cc:4:13: error: 'c' was not declared in this scope
    4 | int value(i,c)
      |             ^
a.cc:4:14: error: expression list treated as compound expression in initializer [-fpermissive]
    4 | int value(i,c)
      |              ^
a.cc: In function 'int main()':
a.cc:25:16: error: 'value' cannot be used as a function
   25 |     cout<<value(N,W)<<endl;
      |           ~~~~~^~~~~
Language: C++

#include<vector>
using namespace std;

int main()
{
	int n=0;
	cin>>n;
	for (int i = 0; i < n; ++i)
	{
		vector<string> a;
		vector<string> a;
		cin>>a;
		cin>>b;

	}


	return(0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin>>n;
      |         ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<vector>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:10:24: error: 'string' was not declared in this scope
   10 |                 vector<string> a;
      |                        ^~~~~~
a.cc:2:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    1 | #include<vector>
  +++ |+#include <string>
    2 | using namespace std;
a.cc:10:30: error: template argument 1 is invalid
   10 |                 vector<string> a;
      |                              ^
a.cc:10:30: error: template argument 2 is invalid
a.cc:11:30: error: template argument 2 is invalid
   11 |                 vector<string> a;
      |                              ^
a.cc:11:32: error: redeclaration of 'int a'
   11 |                 vector<string> a;
      |                                ^
a.cc:10:32: note: 'int a' previously declared here
   10 |                 vector<string> a;
      |                                ^
a.cc:13:22: error: 'b' was not declared in this scope
   13 |                 cin>>b;
      |                      ^
Language: C++

#include <iostream>
#include <algorithm>
#include <cstdint>

using namespace std;

uint64_t N,W,v[100],w[100],dp[100][10000];

int _dp(int _d,int _w)
{
	if(_d < 0 || _w < 0 || _d >= N, _w >= W)
		return 0;
	else
		return dp[_d][_w];
}

int main(void)
{
	cin >> N >> W;
	for(int i = 0;i < N;i++)
	{
		cin >> v[i] >> w[i];
	}
	for(int i = N - 1;i >= 0;i--)
	{
		for(int ii = 0;ii < W;ii++)
		{
			uint64_t t = 0;
			if(ii + 1 >= w[i])
			{
				t = _dp(i + 1,ii - w[i]) + v[i];
			}
			dp[i][ii] = max(_dp(i + 1,ii),t);
		}
	}
	uint64_t result = dp[0][W - 1];
	cout << result << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:40: error: no matching function for call to 'max(int, uint64_t&)'
   33 |                         dp[i][ii] = max(_dp(i + 1,ii),t);
      |                                     ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 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:33:40: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'uint64_t' {aka 'long unsigned int'})
   33 |                         dp[i][ii] = max(_dp(i + 1,ii),t);
      |                                     ~~~^~~~~~~~~~~~~~~~~
/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,
                 from a.cc:2:
/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:33:40: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   33 |                         dp[i][ii] = max(_dp(i + 1,ii),t);
      |                                     ~~~^~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
 
using namespace std;
typedef unsigned int ui;
//using ui = unsigned int;
 
int main(void)
{
    string line;
    ui max_n, max_w;
    cin >> max_n >> max_w;
    ui v, w;
 
    vector<ui> table(max_w+1, 0);
    
    for(int i = 1; i <= max_n; ++i){
        cin >> v >> w;
        for(int nn = 0; n < max_w / w; nn++)
        for(int j = max_w-w; j >= 1; --j){
            if(table[j] != 0 && table[w+j] < table[j] + v)
                table[w+j] = table[j] + v;
        }
        if(w <= max_w && table[w] < v)
            table[w] = v;
    }
    cout << *(max_element(begin(table), end(table))) << endl;
 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:25: error: 'n' was not declared in this scope; did you mean 'nn'?
   21 |         for(int nn = 0; n < max_w / w; nn++)
      |                         ^
      |                         nn
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
 
using namespace std;
typedef unsigned int ui;
//using ui = unsigned int;
 
int main(void)
{
    string line;
    ui max_n, max_w;
    cin >> max_n >> max_w;
    ui v, w;
 
    vector<ui> table(max_w+1, 0);
    
    for(int i = 1; i <= max_n; ++i){
        cin >> v >> w;
        ui vv = v, ww = w;
        for(w <= max_w; v += vv, w += ww){
        for(int j = max_w-w; j >= 1; --j){
            if(table[j] != 0 && table[w+j] < table[j] + v)
                table[w+j] = table[j] + v;
        }
        if(w <= max_w && table[w] < v)
            table[w] = v;
    }
}
    cout << *(max_element(begin(table), end(table))) << endl;
 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:41: error: expected ';' before ')' token
   22 |         for(w <= max_w; v += vv, w += ww){
      |                                         ^
      |                                         ;
Language: C++

#include <iostream>
#include <algorithm>
#define MAX_INT  100005
#define MAX_N  100
using namespace std;


//??\???
int N, W;
int w[MAX_N], v[MAX_N];


// i: i????????\?????? item ?????????
// rw: ?????????????????? w ??\???
// return: ???????????????????????§???
int rec(int i, int rw) {

  if(i == N) {
    return 0;
  }

  if ( rw < w[i] ) {
    // ??\?????????
    return rec(i+1, rw);
  } else {
    // ??\???????????¨????????????
    // ??\????????´?????¨??\???????????´??????????????????
    return max( rec(i + 1, rw), rec(i + 1, rw - w[i]) + v[i] );
  }

}



int main() {

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

  cout << rec(0, W) << enl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:24: error: 'enl' was not declared in this scope
   42 |   cout << rec(0, W) << enl;
      |                        ^~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int knapsack(int n, int wei,int W,vector<int>&v,vector<int>& w,vector<vector<int>>& dp) {
	if (wei > W) return -INT_MAX;
	if (n == v.size()) return 0;
	if (dp[n][wei] >= 0) return dp[n][wei];
	return dp[n][wei] = max(knapsack(n + 1, wei, W, v, w, dp), knapsack(n + 1, wei + w[n], W, v, w, dp) + v[n]);
}

int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int N, W; cin >> N >> W;
	vector<int> v(N), w(N);
	for (int i = 0; i < N;i++) {
		cin >> v[i] >> w[i];
	} 
	/* dp */
	/*
	vector<vector<int>> dp(N + 1, vector<int>(W + 1, 0));
	for (int i = 0; i < N; i++) {
		for (int j = 1; j <= W;j++) {
			if (j - w[i] < 0) { dp[i + 1][j] = dp[i][j]; }
			else { dp[i + 1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i]); }
		}
	}
	cout << dp[N][W] << endl;
	*/

	/* dps + memo */
	vector<vector<int>> dp(N + 1, vector<int>(W + 1, -INT_MAX));
	cout << knapsack(0, 0, W, v, w, dp) << endl;
}

Compiler output:
a.cc: In function 'int knapsack(int, int, int, std::vector<int>&, std::vector<int>&, std::vector<std::vector<int> >&)':
a.cc:7:30: error: 'INT_MAX' was not declared in this scope
    7 |         if (wei > W) return -INT_MAX;
      |                              ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <algorithm>
  +++ |+#include <climits>
    4 | using namespace std;
a.cc: In function 'int main()':
a.cc:33:59: error: 'INT_MAX' was not declared in this scope
   33 |         vector<vector<int>> dp(N + 1, vector<int>(W + 1, -INT_MAX));
      |                                                           ^~~~~~~
a.cc:33:59: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

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

using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;

#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)

#define vint(v, n) vector<int> v(n); REP(i,n) cin >> v[i];
#define vvint(v, w, n) vector<int> v(n); vector<int> w(n); REP(i,n) cin >> v[i] >> w[i];
#define vlint(v, n) vector<ll int> v(n); REP(i,n) cin >> v[i];
#define vdouble(v, n) vector<double> v(n); REP(i,n) cin >> v[i];
#define vvdoube(v, n1, n2) vector<vector<double> > v(n1, vector<double>(n2, 0)); REP(i,n1) REP(j,n1) cin >> v[i][j];
#define string(x) string x; cin >> x;
#define vstring(v, n) vector<string> v(n); REP(i,n){string a; std::cin >> a; v.push_back(a); }

#define all(v) (v).begin(), (v).end()
#define rall(v) (v).begin(), (v).end(), std::greater<int>()
#define len(v) (v).length()

static const string abet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
static const long long int MOD = 1000000007;
static const double PI=3.1415926535897932;
static const int INF = 0x3f3f3f3f;
static const int INFTY = (1 << 29);
static const long long LINFTY = (1LL << 32);

static const int dy4[]={0, 0, 1, -1};
static const int dx4[]={1, -1, 0, 0};
static const int dx8[] = {1, 1, 1, 0, 0, -1, -1, -1};
static const int dy8[] = {-1, 0, 1, -1, 1, -1, 0, 1};

int Knapsack_01(int N,int W,vector<int> v,vector<int> w) {

  int dp[N+1][W+1];
//std::vector<std::vector<int> > dp(N + 1, std::vector<int>(W + 1, 0));
  for (int i = 0; i <= N; i++) dp[i][0] = 0;
  for (int j = 0; j <= W; j++) dp[0][j] = 0;

  REPS(i, N) REPS(j, 1, W+1){
      if (j < w[i]) dp[i+1][j] = dp[i][j];
      else dp[i+1][j] = max(dp[i][j], dp[i - 1][j - w[i]] + v[i]);
  }
  return dp[N][W];
}

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

  int N, W;
  cin >> N >> W;
  vvint(v, w, N);

  cout << Knapsack_01(N, W, v, w) << endl;

}

Compiler output:
a.cc:47:12: error: macro "REPS" requires 3 arguments, but only 2 given
   47 |   REPS(i, N) REPS(j, 1, W+1){
      |            ^
a.cc:10:9: note: macro "REPS" defined here
   10 | #define REPS(i, a, n) for (int i = (a); i < (n); ++i)
      |         ^~~~
a.cc: In function 'int Knapsack_01(int, int, std::vector<int>, std::vector<int>)':
a.cc:47:3: error: 'REPS' was not declared in this scope
   47 |   REPS(i, N) REPS(j, 1, W+1){
      |   ^~~~
a.cc:47:19: error: 'j' was not declared in this scope
   47 |   REPS(i, N) REPS(j, 1, W+1){
      |                   ^
a.cc:10:41: note: in definition of macro 'REPS'
   10 | #define REPS(i, a, n) for (int i = (a); i < (n); ++i)
      |                                         ^
Language: C++

#include <iostream>

#include <vector>

using namespace std;

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

int main(int argc, char *argv[])
{
    int N;
    int W;
    cin >> N;
    cin >> W;
    int vs[N + 1];
    int ws[N + 1];
    for (int i = 0; i < N; i++) {
        cin >> vs[i];
        cin >> ws[i];
    }
    // cout << "N=" << N << endl;
    // cout << "W=" << W << endl;

    int dp[N + 1][W + 1];
    //  0???????´????????????°??????
    for (int j = 0; j < N + 1; j++) {
        dp[j][0] = 0;
    }
    for (int i = 0; i < W + 1; i++) {
        dp[0][i] = 0;
    }

    for (int j = 1; j < N + 1; j++) {
        //  ???????????????????????£
        int v = vs[j - 1];
        int w = ws[j - 1];
        for (int i = 1; i < W + 1; i++) {
            if (i - w >= 0) {
                dp[j][i] = max(dp[j - 1][i], dp[j - 1][i - w] + v);
            }
            else {
                dp[j][i] = dp[j - 1][i];
            }
        }
    }

    // //  for debug
    // for (int j = 0; j < N + 1; j++) {
    //     for (int i = 0; i < W + 1; i++) {
    //         cout << dp[j][i];
    //         cout << ", ";
    //     }
    //     cout << endl;
    // }

    int maxVal = *max_element(&dp[N][0], &dp[N][W + 1]);
    cout << maxVal << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:57:19: error: 'max_element' was not declared in this scope
   57 |     int maxVal = *max_element(&dp[N][0], &dp[N][W + 1]);
      |                   ^~~~~~~~~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<string>


int main() {
	int N, W;
	std::cin >> N >> W;
	int dp[100][10000];
	memset(dp + 0, 0, 1000000);
	std::vector<int> Wi, Vi;
	int a, b;
	for (int i = 0; i < N; i++) {
		std::cin >> a >> b;
		Wi.emplace_back(a);
		Vi.emplace_back(b);
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < W; j++) {
			if (Wi[i] <= j) {
				if (Vi[i] + dp[i - 1][j - Wi[i]]) {
					dp[i][j] = Vi[i] + dp[i - 1][j - Wi[i]];
				}
				else {
					dp[i][j] = dp[i - 1][j];
				}
			}
			else {
				dp[i][j] = dp[i - 1][j];
			}
		}
	}
	std::cout << dp[N - 1][W - 1] << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'memset' was not declared in this scope
   12 |         memset(dp + 0, 0, 1000000);
      |         ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include<set>
  +++ |+#include <cstring>
    5 | #include<string>
Language: C++

include <iostream>

using namespace std;

int value[100],weight[100];
//table[i][w] ?????????i????????§???????????´??????w??\?????????????????????????????§???
int table[101][10001];
int main(){
  int N,W;
  cin>>N>>W;
  for(int i=0;i<N;++i){
    cin>>value[i]>>weight[i];
  }

  for(int i=1;i<=N;++i){
    for(int w=1;w<=W;++w){
      if(w<weight[i-1]){
        table[i][w] = table[i-1][w];
      }else{
        table[i][w] = max(table[i-1][w],table[i-1][w-weight[i-1]]+value[i-1]);
      }
    }
  }
  cout<<table[N][W]<<endl;
  return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <iostream>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:10:3: error: 'cin' was not declared in this scope
   10 |   cin>>N>>W;
      |   ^~~
a.cc:20:23: error: 'max' was not declared in this scope
   20 |         table[i][w] = max(table[i-1][w],table[i-1][w-weight[i-1]]+value[i-1]);
      |                       ^~~
a.cc:24:3: error: 'cout' was not declared in this scope
   24 |   cout<<table[N][W]<<endl;
      |   ^~~~
a.cc:24:22: error: 'endl' was not declared in this scope
   24 |   cout<<table[N][W]<<endl;
      |                      ^~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<cstdlib>
#include<cmath>

using namespace std;
int dp[105][10005];
int n,W;
int v[1005],w[1005];
int rec(int i,int j){
    if(dp[i][j]>=0)return dp[i][j];
    int res;
    if(i==n){
        res=0;
    }else if(j<w[i]){
        res=rec(i+1,j);
    }else {
        res=max(rec(i+1,j),rec(i+1,j-w[i])+v[i]);
    }
    return dp[i][j]=res;
}
void solve(){
    memset(dp,-1,sizeof(dp));
    cout<<rec(0,W)<<endl;
}
int main(){
    
    cin>>n;
    
    for(int i=0; i<n; i++){
        cin>>w[i]>>v[i];
    }
    cin>>W;
    solve();
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:25:5: error: 'memset' was not declared in this scope
   25 |     memset(dp,-1,sizeof(dp));
      |     ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include<cmath>
  +++ |+#include <cstring>
    7 |
Language: C++

#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<cstdlib>
#include<cmath>

using namespace std;
int dp[105][10005];
int n,W;
int v[1005],w[1005];
int rec(int i,int j){
    if(dp[i][j]>=0)return dp[i][j];
    int res;
    if(i==n){
        res=0;
    }else if(j<w[i]){
        res=rec(i+1,j);
    }else {
        res=max(rec(i+1,j),rec(i+1,j-w[i])+v[i]);
    }
    return dp[i][j]=res;
}
void solve(){
    memset(dp,-1,sizeof(dp));
    cout<<rec(0,W)<<endl;
}
int main(){
    
    cin>>n;
    cin>>W;
    for(int i=0; i<n; i++){
        cin>>v[i]>>w[i];
    }
    
    solve();
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:25:5: error: 'memset' was not declared in this scope
   25 |     memset(dp,-1,sizeof(dp));
      |     ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include<cmath>
  +++ |+#include <cstring>
    7 |
Language: C++

#include<iostream>
#include<algorithm>

using namespace std;
int dp[105][10005];
int n,W;
int v[1005],w[1005];
int rec(int i,int j){
    if(dp[i][j]>=0)return dp[i][j];
    int res;
    if(i==n){
        res=0;
    }else if(j<w[i]){
        res=rec(i+1,j);
    }else {
        res=max(rec(i+1,j),rec(i+1,j-w[i])+v[i]);
    }
    return dp[i][j]=res;
}
void solve(){
    memset(dp,-1,sizeof(dp));
    cout<<rec(0,W)<<endl;
}
int main(){
    cin>>n;
    cin>>W;
    for(int i=0; i<n; i++){
        cin>>v[i]>>w[i];
    }
    
    solve();
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:21:5: error: 'memset' was not declared in this scope
   21 |     memset(dp,-1,sizeof(dp));
      |     ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<algorithm>
  +++ |+#include <cstring>
    3 |
Language: C++

#include <cstdio>

#define TRUE    1
#define FALSE   0

int n, W;
int p[100];
int w[100];
int include[100];
int bestSet[100];
int numBest;
int maxProfit;

void input();
void output();
void knapsack(int i, int profit, int weight);
int promising(int i, int profit, int weight);

int main(void) {
    input();
    knapsack(0, 0, 0);
    output();
    
    return 0;
}

void input() {
    int i;
    
    scanf("%d %d", &n, &W);
    
    for(i=1; i<=n; i++)
        scanf("%d %d", &p[i], &w[i]);
}

void output() {
    int i;
    
    printf("%d\n", maxProfit);
    
//        for(i=1; i<=n; i++)
//            printf("%d\n", bestSet[i]);
}

void knapsack(int i, int profit, int weight) {
    int j;
    
    if(weight <= W && profit > maxProfit) {
        maxProfit = profit;
        numBest = i;
        
        for(j=0; j<=n; j++)
            bestSet[j] = include[j];
    }
    
    if(promising(i, profit, weight)) {
        include[i + 1] = 1;
        knapsack(i+1, profit + p[i+1], weight + w[i+1]);
        include[i + 1] = 0;
        knapsack(i+1, profit, weight);
    }
}

int promising(int i, int profit, int weight) {
    int j, k;
    float bound;
    int totalWeight;
    
    if(weight >= W) {
        return FALSE;
    } else {
        j = i + 1;
        bound = (float)profit;
        totalWeight = weight;
        
        while(j <= n && totalWeight + w[j] <= W) {
            totalWeight += w[j];
            bound += p[j];3
            j++;
        }
        
        k = j;
        
        if(k <= n)
            bound = bound + (W - totalWeight) * (p[k] / w[k]);
        
        if(bound > maxProfit)
            return TRUE;
        else
            return FALSE;
    }
}

Compiler output:
a.cc: In function 'int promising(int, int, int)':
a.cc:78:28: error: expected ';' before 'j'
   78 |             bound += p[j];3
      |                            ^
      |                            ;
   79 |             j++;
      |             ~
Language: C++

#include<iostream>
#include<climits>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<functional>
#include<stack>
#include<list>
#include<string>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define PII pair<int,int>
#define PIC pair<int,char>
#define MP make_pair
#define DEBUG(x) cout<<#x<<": "<<x<<endl
???
int dp[10001];
PII p[101];
int main()
{
	int N, W;
	cin >> N >> W;
	REP(i, N)cin >> p[i].first >> p[i].second;
	REP(i, W+1)dp[i] = -1;
	dp[0] = 0;
	for (int i = 0; i < N; i++)
	{
		bool IsDone[10001] = { false };
		for (int j = 0; j <= W; j++)
		{
			if (dp[j] != -1 && j + p[i].second <= W&&IsDone[j]==false)
			{
				int notin = dp[dp[j + p[i].second]];
				int in = dp[j] + p[i].first;
				if (in > notin)
				{
					dp[j + p[i].second] = in;
					IsDone[j + p[i].second] = true;
				}
				else
				{
					dp[j + p[i].second] = notin;
					IsDone[j + p[i].second] = true;

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

Compiler output:
a.cc:20:1: error: expected unqualified-id before '?' token
   20 | ???
      | ^
a.cc: In function 'int main()':
a.cc:28:20: error: 'dp' was not declared in this scope; did you mean 'p'?
   28 |         REP(i, W+1)dp[i] = -1;
      |                    ^~
      |                    p
a.cc:29:9: error: 'dp' was not declared in this scope; did you mean 'p'?
   29 |         dp[0] = 0;
      |         ^~
      |         p
Language: C++

#include<iostream>
#include<climits>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<functional>
#include<stack>
#include<list>
#include<string>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define PII pair<int,int>
#define PIC pair<int,char>
#define MP make_pair
#define DEBUG(x) cout<<#x<<": "<<x<<endl
???
int dp[100][10001];
PII p[101];
int main()
{
	int N, W;
	cin >> N >> W;
	REP(i, N)cin >> p[i].first >> p[i].second;
	REP(i, N+1)REP(j,W+1)dp[i][j] = -1;
	REP(i,N)dp[i][0] = 0;
	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j <= W; j++)
		{
			if (dp[i][j] != -1 && j + p[i].second <= W)
			{
				if(j>=p[i].second)dp[i + 1][j] = max(dp[i][j], p[i].first);
				else dp[i + 1][j] = dp[i][j];
				dp[i+1][j + p[i].second] = max(dp[i][j + p[i].second], dp[i][j] + p[i].first);
			}
		}
	}
	for (int i = W; i >= 0; i--)
	{
		if (dp[N][i] > 0)
		{
			cout << dp[N][i] << endl;
			break;
		}
	}
	return 0;
}

Compiler output:
a.cc:20:1: error: expected unqualified-id before '?' token
   20 | ???
      | ^
a.cc: In function 'int main()':
a.cc:28:30: error: 'dp' was not declared in this scope; did you mean 'p'?
   28 |         REP(i, N+1)REP(j,W+1)dp[i][j] = -1;
      |                              ^~
      |                              p
a.cc:29:17: error: 'dp' was not declared in this scope; did you mean 'p'?
   29 |         REP(i,N)dp[i][0] = 0;
      |                 ^~
      |                 p
a.cc:34:29: error: 'dp' was not declared in this scope; did you mean 'p'?
   34 |                         if (dp[i][j] != -1 && j + p[i].second <= W)
      |                             ^~
      |                             p
a.cc:44:21: error: 'dp' was not declared in this scope; did you mean 'p'?
   44 |                 if (dp[N][i] > 0)
      |                     ^~
      |                     p
Language: C++

#include<iostream>
#include<vector>

using namespace std;

int dp[10001];

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

    for(int i = 1; i <= w; i++)
    {
        dp[i] = -10;
    }

    dp[0] = 0;

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

        for(int j = W - w; j >= 0; j--)
        {
            if(dp[j] != -10 && j + w <= W)
            {
                dp[j + w] = max(dp[j + w], dp[j] + v);
            }
        }
    }

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

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:25: error: 'w' was not declared in this scope
   13 |     for(int i = 1; i <= w; i++)
      |                         ^
Language: C++

#include<iostream>
using namespace std;

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

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

	int DP[101][10001];
	for(int j=0;j<=W;j++)
		DP[0][j]=0;

	for(int i=1;i<=N;i++){
		for(int j=0;j<=W;j++){
			if(j<w[i-1])
				DP[i][j]=DP[i-1][j];
			else{
				if(DP[i-1][j]>DP[i-1][j-w[i-1]]+v[i-1])
					DP[i][j]=DP[i-1][j];
				else
					DP[i][j]=DP[i-1][j-w[i-1]]+v[i-1];
			}
		}
	}
	a
	cout<<DP[N][W]<<endl;
	
	return 0;
}

	

Compiler output:
a.cc: In function 'int main()':
a.cc:28:9: error: 'a' was not declared in this scope
   28 |         a
      |         ^
Language: C++

#include<iostream>
using namespace std;
 
int main(){
 int N,W;
 cin>>N>>W;
 
 int v[N],w[n];
 
 for(int i=0;i<N;i++){
    cin>>v[i]>>w[i];
 }
 
 int DP[N+1][W+1];
 
 for(int j=0;j<=W;j++){
    DP[0][j]=0;
 }
 
 for(int i=1;i<=N;i++){
    for(int j=0;j<=W;j++){
        if(j<w[i-1]){
            DP[i][j]=DP[i-1][j];
        }else{
            if(DP[i-1][j]>DP[i-1][j-w[i-1]]+v[i-1]){
                DP[i][j]=DP[i-1][j];
            }else{
                DP[i][j]=DP[i-1][j-w[i-1]]+v[i-1];
            }
        }
    }
 }
 cout<<DP[N][W]<<endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: 'n' was not declared in this scope
    8 |  int v[N],w[n];
      |             ^
a.cc:11:16: error: 'w' was not declared in this scope
   11 |     cin>>v[i]>>w[i];
      |                ^
a.cc:22:14: error: 'w' was not declared in this scope
   22 |         if(j<w[i-1]){
      |              ^
Language: C++

#include <iostream>
#include <string>
#include <vector>


using namespace std;
const int infty = static_cast <int> (pow(256, sizeof(int)) / 2 - 1);

int knapsack(int n, int w, vector<int> &vv, vector<int> &vw)
{
	vector<vector<int>> vvc;
	vvc = vector<vector<int>>(vv.size(),vector<int>(w+1,0));

	for(int i = 0; i <= w; ++i)
	{
		vvc[0][i] = 0;
	}

	for(int i = 0; i <= n; ++i)
	{
		vvc[0][i] = 0;
	}

	for(int i = 1; i <= n; ++i)
	{
		for(int j = 1; j <= w; ++j)
		{ 
			if(vw[i] <= j)
			{
				if((vv[i] + vvc[i-1][j-vw[i]]) > vvc[i-1][j])
					vvc[i][j] = vv[i] + vvc[i - 1][j - vw[i]];
				else
					vvc[i][j] = vvc[i - 1][j];
			}
			else
				vvc[i][j] = vvc[i - 1][j];
		}
	}
	return vvc[n][w];
}

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

	int n, w;
	cin >> n >> m;
	cin.ignore();

	int a, b;
	vector<int> vv,vw;

	vv.push_back(0);
	vw.push_back(0);

	for (int i = 0; i < n; ++i)
	{
		cin >> a >> b;
		vv.push_back(a);
		vw.push_back(b);
	}

	cout << knapsack(n,w,vv,vw) << endl;

	return 0;
}

Compiler output:
a.cc:7:38: error: 'pow' was not declared in this scope
    7 | const int infty = static_cast <int> (pow(256, sizeof(int)) / 2 - 1);
      |                                      ^~~
a.cc: In function 'int main()':
a.cc:48:21: error: 'm' was not declared in this scope
   48 |         cin >> n >> m;
      |                     ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
const int infty = static_cast <int> (pow(256, sizeof(int)) / 2 - 1);

int knapsack(int n, int w, vector<int> &vv, vector<int> &vw)
{
	vector<vector<int>> vvc;
	vvc = vector<vector<int>>(vv.size(),vector<int>(w+1,0));

	for(int i = 0; i <= w; ++i)
	{
		vvc[0][i] = 0;
	}

	for(int i = 0; i <= n; ++i)
	{
		vvc[0][i] = 0;
	}

	for(int i = 1; i <= n; ++i)
	{
		for(int j = 1; j <= w; ++j)
		{ 
			if(vw[i] <= j)
			{
				if((vv[i] + vvc[i-1][j-vw[i]]) > vvc[i-1][j])
					vvc[i][j] = vv[i] + vvc[i - 1][j - vw[i]];
				else
					vvc[i][j] = vvc[i - 1][j];
			}
			else
				vvc[i][j] = vvc[i - 1][j];
		}
	}
	return vvc[n][w];
}

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

	int n, w;
	cin >> n >> m;
	cin.ignore();

	int a, b;
	vector<int> vv,vw;

	vv.push_back(0);
	vw.push_back(0);

	for (int i = 0; i < n; ++i)
	{
		cin >> a >> b;
		vv.push_back(a);
		vw.push_back(b);
	}

	cout << knapsack(n,w,vv,vw) << endl;

	return 0;
}

Compiler output:
a.cc:7:38: error: 'pow' was not declared in this scope
    7 | const int infty = static_cast <int> (pow(256, sizeof(int)) / 2 - 1);
      |                                      ^~~
a.cc: In function 'int main()':
a.cc:48:21: error: 'm' was not declared in this scope
   48 |         cin >> n >> m;
      |                     ^
Language: C++

#include <iostream>
//#include <algorithm>
#include <vector>
#define NMAX 105
#define WMAX 10005
//#define SELECTED 1
//#define UNSELECTED 0

using namespace std;

struct Item {
    int value,weight;
};

int N,W;
Item items[NMAX+1]; // ??°????¬¬i???????????????????????????
int C[NMAX+1][WMAX+1]; // C[i][w]??¨??????i??????????£???\?????????W???????????¶?????????????????§???
//int G[NMAX+1][WMAX+1]; // G[i][w]??°?????¨?????????w????????????????????????????¢??????????

void compute(int &maxValue
//            , vector<int> &selection
            ) {
    //????????§?°?w???0?????????????????°i???0??¶?????????????????????0?????????C???w=0???i=0????????????????´??????¨??¨????§???????0.
    for(int w=0;w<=W;w++)
        C[0][w]=0;
    for(int i=1;i<=N;i++)
        C[i][0]=0;

    for(int i=1;i<=N;i++) {
        for(int w=1;w<=W;w++) {
            C[i][w]=C[i-1][w];// C[i][w]????°??????\??§???C[i-1][w]?????§?°?
//            G[i][w]=UNSELECTED;
            if(items[i].weight>w) // ???????¬¬i???????????????????¶???????w?????£??????????????????????????????????????????????????????
                continue;// ?????¢C[i-1][w-items[i].weight]????¶????
            if(items[i].value+C[i-1][w-items[i].weight]>C[i-1][w]){// ?????????????????¶??????
                C[i][w]=items[i].value+C[i-1][w-items[i].weight];// ??´?????¨???????????????w????????????????¬¬i??¶???????????\???
//                G[i][w]=SELECTED;
            } else
                
        }
    }
    maxValue=C[N][W];
//    selection.clear();
//    for(int i=N,w=W;i>=1;i--) {
//        if(G[i][w]==SELECTED) {
//            selection.push_back(items[i].value);
//            w-=items[i].weight;
//        }
//    }
//    reverse(selection.begin(), selection.end());
}

void input() {
    cin>>N>>W;
    for(int i=1;i<=N;i++)
        cin>>items[i].value>>items[i].weight;
}

int main() {
    int maxValue;
    vector<int> selection;
    input();
    compute(maxValue
//            ,selection
    );

    cout<<maxValue<<endl;

    /*cout<<endl;
    for(int n=0;n<=N;n++)
    {
        for(int m=0;m<=W;m++)
        cout<<G[n][m]<<" ";
        cout<<endl;
    }*/
    /*cout<<"??????????????????????????????";
    for(int i=0;i<selection.size();i++)cout<<selection[i]<<" ";*/

}

Compiler output:
a.cc: In function 'void compute(int&)':
a.cc:40:9: error: expected primary-expression before '}' token
   40 |         }
      |         ^
Language: C++

#include <iostream>
//#include <algorithm>
#include <vector>
#define NMAX 105
#define WMAX 10005
//#define SELECTED 1
//#define UNSELECTED 0

using namespace std;

struct Item {
    int value,weight;
};

int N,W;
Item items[NMAX+1]; // ??°????¬¬i???????????????????????????
int C[NMAX+1][WMAX+1]; // C[i][w]??¨??????i??????????£???\?????????W???????????¶?????????????????§???
//int G[NMAX+1][WMAX+1]; // G[i][w]??°?????¨?????????w????????????????????????????¢??????????

void compute(int &maxValue
//            , vector<int> &selection
            ) {
    //????????§?°?w???0?????????????????°i???0??¶?????????????????????0?????????C???w=0???i=0????????????????´??????¨??¨????§???????0.
    for(int w=0;w<=W;w++)
        C[0][w]=0;
    for(int i=1;i<=N;i++)
        C[i][0]=0;

    for(int i=1;i<=N;i++) {
        for(int w=1;w<=W;w++) {
            C[i][w]=C[i-1][w];// C[i][w]????°??????\??§???C[i-1][w]?????§?°?
//            G[i][w]=UNSELECTED;
            if(items[i].weight>w) // ???????¬¬i???????????????????¶???????w?????£??????????????????????????????????????????????????????
                continue;// ?????¢C[i-1][w-items[i].weight]????¶????
            if(items[i].value+C[i-1][w-items[i].weight]>C[i-1][w]){// ?????????????????¶??????
                C[i][w]=items[i].value+C[i-1][w-items[i].weight];// ??´?????¨???????????????w????????????????¬¬i??¶???????????\???
//                G[i][w]=SELECTED;
            } else

        }
    }
    maxValue=C[N][W];
//    selection.clear();
//    for(int i=N,w=W;i>=1;i--) {
//        if(G[i][w]==SELECTED) {
//            selection.push_back(items[i].value);
//            w-=items[i].weight;
//        }
//    }
//    reverse(selection.begin(), selection.end());
}

void input() {
    cin>>N>>W;
    for(int i=1;i<=N;i++)
        cin>>items[i].value>>items[i].weight;
}

int main() {
    int maxValue;
    vector<int> selection;
    input();
    compute(maxValue
//            ,selection
    );

    cout<<maxValue<<endl;

    /*cout<<endl;
    for(int n=0;n<=N;n++)
    {
        for(int m=0;m<=W;m++)
        cout<<G[n][m]<<" ";
        cout<<endl;
    }*/
    /*cout<<"??????????????????????????????";
    for(int i=0;i<selection.size();i++)cout<<selection[i]<<" ";*/

}

Compiler output:
a.cc: In function 'void compute(int&)':
a.cc:40:9: error: expected primary-expression before '}' token
   40 |         }
      |         ^
Language: C++

#include <iostream>
using namespace std;

int n,W;
int v[100],w[100];
int dp[101][101];

int func(int i,int j){
    if (dp[i][j]>=0) {
        return dp[i][j];
    }
    
    int res;
    if(i==n){
        res=0;
    }
    else if (j<w[i]){
        res=func(i+1, j);
    }
    else{
        res=max(func(i+1, j), func(i+1, j-w[i])+v[i]);
    }
    return dp[i][j]=res;
}

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

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

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

int main(){
	int N,W,v[101],w[101],dp[101][101];
	cin>>N>>W;
	for(int i=1;i<=N;i++)cin>>v[i]>>w[i];
	for(int i=0;i<=max(N,W);i++){
		dp[i][0]=0;
		dp[0][i]=0:
	}
	for(int i=1;i<=N;i++)for(int j=1;j<=W;j++){
		if(j<w[i])dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i]]+v[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:11:27: error: expected ';' before ':' token
   11 |                 dp[0][i]=0:
      |                           ^
      |                           ;
Language: C++


#include <iostream>
#include <string>
#include<vector>
#include<cmath>
#define NMAX 100000
#define KMAX 10000
using namespace std;

int n, k;
struct Item {
  int value, weight;
};

Item items[NMAX];
int C[NMAX][KMAX];
int maxValue;

void compute(){
  for(int w = 0; w <= k; w++) {
    C[0][w] = 0;
  }

  for(int i = 1; i <= n; i++){
    C[i][0] = 0;
  }

  for(int i = 1; i <=n; i++){
    for(int w = 1; w <= k; w++){
      C[i][w] = C[i-1][w];
      if(items[i].weight > w) continue;
      if (items[i].value + C[i-1][w - items[i].weight] > C[i-1][w]){
        C[i][w] = items[i].value + C[i-1][w - items[i].weight];
      }
    }
  }

  maxValue = C[n][k];

}

int main() {
  cin >> n >> k;
  for(int i = 1; i <= n; i++){
    cin >> items[i].value >> items[i].weight;
  }

  

  compute();
  
  cout << maxValue << endl;

  return 0;
}

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

const int MAX_N = 25; // n????????§???

// ??\???
int n, W;
int w[MAX_N], v[MAX_N];

// i????????\?????????????????????????????????j??\?????????????????????????????¨?????????
// ???????????????????????????????????§??????????????¢??°
int rec(int i, int j) {
  int res;
  if (i == n) {
    // ????????????????????£??????????????¨?????????????????????????????§??????0??§?¢????
    res = 0;
  } else if (j < w[i]) {
    // ???????????????????¶?????????????i?????\????????????????????§?????\?????????????????????????????????
    // i+1 ??\??????????????????????????£?????¨???????????§??????????????????????????´???????????§????????????
    res = rec(i + 1, j);
  } else {
    // ??????i?????\???????????\??????????????????????????§???????????????????????????????????§?????????????????¶
    res = max(
        rec(i + 1, j),
        rec(i + 1, j - w[i]) + v[i]
    );
  }
  return res;
}

void solve() {
  // 0????????\?????§??????W??\????????´?????????????????¨?????????
  cout << rec(0, W) << endl;
}

Compiler output:
a.cc: In function 'int rec(int, int)':
a.cc:20:11: error: 'max' was not declared in this scope
   20 |     res = max(
      |           ^~~
a.cc: In function 'void solve()':
a.cc:30:3: error: 'cout' was not declared in this scope
   30 |   cout << rec(0, W) << endl;
      |   ^~~~
a.cc:30:24: error: 'endl' was not declared in this scope
   30 |   cout << rec(0, W) << endl;
      |                        ^~~~