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

public class Main {?????????????????????????????????????????????????????????????????????//???FastScanner??£??????????????????
    private static FastScanner sc = new FastScanner();??????????????? //  ?????£??±Scanner??§????????????????????????
     
    public static void main(String[] args) {
        int N = sc.nextInt();
        int W = sc.nextInt();
        int[] v = new int[N];
        int[] w = new int[N];
        for(int i=0; i<N; i++) {
            v[i] = sc.nextInt();
            w[i] = sc.nextInt();
        }
         
        int[] dp = new int[W+1];
        for(int i=0; i<N; i++) {
            for(int j=W; j>=0; j--) {
                if(j-w[i] >= 0 && dp[j-w[i]] + v[i] > dp[j]) {
                    dp[j] = dp[j-w[i]] + v[i];
                }
            }
        }
         
        int max = 0;
        for(int j=0; j<=W; j++) {
            if(dp[j] > max) {
                max = dp[j];
            }
        }
        System.out.println(max);
    }
     
    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if(ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch(IOException e) {
                    e.printStackTrace();
                }
                if(buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}

Compiler output:
Main.java:1: error: illegal start of type
public class Main {?????????????????????????????????????????????????????????????????????//???FastScanner?????????????????????
                   ^
Main.java:2: error: illegal start of type
    private static FastScanner sc = new FastScanner();??????????????? //  ?????????Scanner???????????????????????????
                                                      ^
2 errors
Language: Java

public class Main {??????????????????????????????????????????????????????????????????
    private static FastScanner sc = new FastScanner();???????????????
     
    public static void main(String[] args) {
        int N = sc.nextInt();
        int W = sc.nextInt();
        int[] v = new int[N];
        int[] w = new int[N];
        for(int i=0; i<N; i++) {
            v[i] = sc.nextInt();
            w[i] = sc.nextInt();
        }
         
        int[] dp = new int[W+1];
        for(int i=0; i<N; i++) {
            for(int j=W; j>=0; j--) {
                if(j-w[i] >= 0 && dp[j-w[i]] + v[i] > dp[j]) {
                    dp[j] = dp[j-w[i]] + v[i];
                }
            }
        }
         
        int max = 0;
        for(int j=0; j<=W; j++) {
            if(dp[j] > max) {
                max = dp[j];
            }
        }
        System.out.println(max);
    }
     
    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if(ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch(IOException e) {
                    e.printStackTrace();
                }
                if(buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}

Compiler output:
Main.java:1: error: illegal start of type
public class Main {??????????????????????????????????????????????????????????????????
                   ^
Main.java:2: error: illegal start of type
    private static FastScanner sc = new FastScanner();???????????????
                                                      ^
2 errors
Language: Java

import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Main main=new Main();
		main.run();
	}

	void run() {

		Scanner sc=new Scanner(System.in);

		int n=sc.nextInt();
		int W=sc.nextInt();

		int[] value=new int[n];
		int[] weight=new int[n];

		for(int i=0;i<n;i++) {

			value[i]=sc.nextInt();
			weight[i]=sc.nextInt();

		}

		//重量は0からWまでだから要素数はW+1個だけある。

		int[][] dp=new int[n][W+1];

		//dp[i番目までの商品を使う][部分問題のリュックの容量]

		//初期条件
		//1個も入れなければ、価値は0のまま。
		for(int w=0;w<=W;++w) {
			dp[0][w]=0;
		}


		//DPループ

		//使えるアイテムの数を増やすループ
		for(int i=0;i<n;i++) {

			//リュックの容量を増やすループ
			for(int w=0;w<=W;++w) {

				//i番目の商品が、現在のリュックの容量より小さいか
				if(w>=weight[i]) {
			　　　　　　　　dp[i+1][w]=Math.max(dp[i][w-weight[i]]+value[i],dp[i][w]);
				}else {
					dp[i+1][w]=dp[i][w];
				}

			}
		}


		System.out.println(dp[n][W]);


	}

}






Compiler output:
Main.java:50: error: illegal character: '\u3000'
			????????dp[i+1][w]=Math.max(dp[i][w-weight[i]]+value[i],dp[i][w]);
			^
Main.java:50: error: illegal character: '\u3000'
			????????dp[i+1][w]=Math.max(dp[i][w-weight[i]]+value[i],dp[i][w]);
			 ^
Main.java:50: error: illegal character: '\u3000'
			????????dp[i+1][w]=Math.max(dp[i][w-weight[i]]+value[i],dp[i][w]);
			  ^
Main.java:50: error: illegal character: '\u3000'
			????????dp[i+1][w]=Math.max(dp[i][w-weight[i]]+value[i],dp[i][w]);
			   ^
Main.java:50: error: illegal character: '\u3000'
			????????dp[i+1][w]=Math.max(dp[i][w-weight[i]]+value[i],dp[i][w]);
			    ^
Main.java:50: error: illegal character: '\u3000'
			????????dp[i+1][w]=Math.max(dp[i][w-weight[i]]+value[i],dp[i][w]);
			     ^
Main.java:50: error: illegal character: '\u3000'
			????????dp[i+1][w]=Math.max(dp[i][w-weight[i]]+value[i],dp[i][w]);
			      ^
Main.java:50: error: illegal character: '\u3000'
			????????dp[i+1][w]=Math.max(dp[i][w-weight[i]]+value[i],dp[i][w]);
			       ^
8 errors
Language: Java

import java.util.Scanner;
public class NapSak{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int W= sc.nextInt();
        int[] w = new int[n];
        int[] v = new int[n];
        for(int i = 0;i < n;i++){
            v[i] = sc.nextInt();
            w[i] = sc.nextInt();
        }
        int[][] dp = new int[n+1][W+1];
        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(j - w[i-1] >= 0){
                    dp[i][j] = Math.max(dp[i-1][j-w[i-1]] + v[i-1],dp[i-1][j]);
                }
                else{
                    dp[i][j] = dp[i-1][j];
                }
            }
        }
        System.out.println(dp[n][W]);
    }
}



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

import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Scanner;

public class Main{
	static int[][] dp=new int[101][10001];
	static int N, W;
    static int[] w=new int[101];
    static int[] v=new int[101];
	static void dp() {
    	for(int i=0; i<=W; i++) {
    		dp[0][i]=0;
    	}
    	for(int i=0; i<N; i++) {
    		for(int j=0; j<=W; 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]);
    			}
    		}
    	}
    }
	
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        N=sc.nextInt();
        W=sc.nextInt();
        for(int i=0; i<N; i++) {
        	v[i]=sc.nextInt();
        	w[i]=sc.nextInt();
        }
        dp();
        System.out.println(dp[N][W]);
        
	}
}


Compiler output:
Main.java:20: error: cannot find symbol
    				dp[i+1][j]=max(dp[i][j], dp[i][j-w[i]]+v[i]);
    				           ^
  symbol:   method max(int,int)
  location: class Main
1 error
Language: Java

import java.util.Scanner;

import atcoder.Main;

public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {

    	Scanner sc=new Scanner(System.in);

    	int N=sc.nextInt();
    	int W=sc.nextInt();

    	int[] w=new int[N];
    	int[] v=new int[N];

    	int[] dp=new int[W+1];

    	for(int i=0;i<N;i++) {
    		v[i]=sc.nextInt();
    		w[i]=sc.nextInt();
    	}

    	//dp[i+1][j] i番目までのアイテムで容量jのリュックに詰めれる価値の最大値

    	//dp[0][j]=0;

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


    	for(int i=0;i<N;i++) {

    		for(int j=W;j>=0;j--) {

    			if(j-w[i]>=0) {
    				dp[j]=Math.max(dp[j],dp[j-w[i]]+v[i]);
    			}

    		}

    	}

//    	for(int i=0;i<N;i++) {
//    		for(int j=0;j<=W;j++) {
//    			if(j-w[i]<0) {
//    				dp[i+1][j]=dp[i][j];
//    			}else {
//    				dp[i+1][j]=Math.max(dp[i][j],dp[i][j-w[i]]+v[i]);
//    			}
//    		}
//    	}

    	System.out.println(dp[W]);

    }
}



Compiler output:
Main.java:3: error: package atcoder does not exist
import atcoder.Main;
              ^
1 error
Language: Java

import java.util.Scanner;

import atcoder.Main;

public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {

    	Scanner sc=new Scanner(System.in);

    	int N=sc.nextInt();
    	int W=sc.nextInt();

    	int[] w=new int[N];
    	int[] v=new int[N];

    	int[][] dp=new int[N+1][W+1];

    	for(int i=0;i<N;i++) {
    		v[i]=sc.nextInt();
    		w[i]=sc.nextInt();
    	}


    	for(int j=0;j<=W;j++) {
    		dp[N][j]=0;
    	}

    	for(int i=N-1;i>0;i--) {
    		for(int j=0;j<=W;j++) {
    			if(j-w[i]<0) {
    				dp[i-1][j]=dp[i][j];
    			}else {
    				dp[i-1][j]=Math.max(dp[i][j],dp[i][j-w[i]]+v[i]);
    			}
    		}
    	}


//    	for(int i=0;i<N;i++) {
//    		for(int j=0;j<=W;j++) {
//    			if(j-w[i]<0) {
//    				dp[i+1][j]=dp[i][j];
//    			}else {
//    				dp[i+1][j]=Math.max(dp[i][j],dp[i][j-w[i]]+v[i]);
//    			}
//    		}
//    	}

    	System.out.println(dp[0][W]);

    }
}



Compiler output:
Main.java:3: error: package atcoder does not exist
import atcoder.Main;
              ^
1 error
Language: Java

// ナップザック問題を解くプログラム
public class Solver{
    int num;
    int capacity, answer;
    int[] weight, value;
    int[][] dp;
    boolean[] knapsack;
    // コンストラクタ
    public Solver(int num, int[] weight, int[] value, int capacity) {
        this.num = num;
        this.weight = weight;
        this.value = value;
        this.capacity = capacity;
        dp = new int[num + 1][capacity + 1];
        knapsack = new boolean[num + 1];
    }
    int solve() {
        for (int i = 0; i < dp.length; i++) {
            for (int j = 0; j < dp[0].length; j++) {
                dp[i][j] = -1;
            }
        }
        if (weight[0] <= capacity) {
            dp[1][weight[0]] = value[0];
        }
        dp[1][0] = 0;
        dp[0][0] = 0;

        for (int i = 2; i <= num; i++) {
            for (int k = 0; k <= capacity; k++) {
                if (k < weight[i - 1]) {
                    dp[i][k] = dp[i - 1][k];
                }
                else {
                    dp[i][k] = Math.max(dp[i - 1][k], dp[i - 1][k - weight[i - 1]] + value[i - 1]);
                }
            }
        }
        int res = 0;
        for (int x : dp[num]) {
            res = Math.max(x, res);
        }

        return answer = res;
    }

    // 価値の総和がsumValueとなる組み合わせすべて出力する
    // [1, n]までの品物を出力する
    void showKnapsack(int sumValue, int n) {
        if (n < 1) {
            int cnt = 0;
            for (int i = 0; i < knapsack.length; i++) {
                if (knapsack[i]) {
                    System.out.print((cnt++ > 0 ? " " : "") + i);
                }
            }
            System.out.println();
            return;
        }
        for (int i = 0; i <= capacity; i++) {
            if (dp[n][i] == sumValue) {
                int sub = i - weight[n - 1];
                if (dp[n - 1][i] == sumValue) {
                    knapsack[n] = false;
                    showKnapsack(sumValue, n - 1);
                }
                if (sub >= 0 && dp[n - 1][sub] >= 0) {
                    knapsack[n] = true;
                    showKnapsack(sumValue - value[n - 1], n - 1);
                }
            }
        }
    }
}

// ナップザック問題を解くプログラム

import java.util.Scanner;

public class KP{
    public static void main(String[] arghs) {
        int num, capacity, answer;  //データ数
        int[] weight, value;
        // 入力
        Scanner stdIn = new Scanner(System.in);
        num = stdIn.nextInt();
        capacity = stdIn.nextInt();
        weight = new int[num];
        value = new int[num];
        for (int i = 0; i < num; i++) {
            weight[i] = stdIn.nextInt();
            value[i] = stdIn.nextInt();
        }

        Solver s = new Solver(num, weight, value, capacity);
        answer = s.solve();
        System.out.println(answer);
        // s.showKnapsack(answer, num);
    }
}



Compiler output:
Main.java:78: error: class, interface, enum, or record expected
import java.util.Scanner;
^
1 error
Language: Java

// ナップザック問題を解くプログラム
class Solver{
    int num;
    int capacity, answer;
    int[] weight, value;
    int[][] dp;
    boolean[] knapsack;
    // コンストラクタ
    public Solver(int num, int[] weight, int[] value, int capacity) {
        this.num = num;
        this.weight = weight;
        this.value = value;
        this.capacity = capacity;
        dp = new int[num + 1][capacity + 1];
        knapsack = new boolean[num + 1];
    }
    int solve() {
        for (int i = 0; i < dp.length; i++) {
            for (int j = 0; j < dp[0].length; j++) {
                dp[i][j] = -1;
            }
        }
        if (weight[0] <= capacity) {
            dp[1][weight[0]] = value[0];
        }
        dp[1][0] = 0;
        dp[0][0] = 0;
 
        for (int i = 2; i <= num; i++) {
            for (int k = 0; k <= capacity; k++) {
                if (k < weight[i - 1]) {
                    dp[i][k] = dp[i - 1][k];
                }
                else {
                    dp[i][k] = Math.max(dp[i - 1][k], dp[i - 1][k - weight[i - 1]] + value[i - 1]);
                }
            }
        }
        int res = 0;
        for (int x : dp[num]) {
            res = Math.max(x, res);
        }
 
        return answer = res;
    }
 
    // 価値の総和がsumValueとなる組み合わせすべて出力する
    // [1, n]までの品物を出力する
    void showKnapsack(int sumValue, int n) {
        if (n < 1) {
            int cnt = 0;
            for (int i = 0; i < knapsack.length; i++) {
                if (knapsack[i]) {
                    System.out.print((cnt++ > 0 ? " " : "") + i);
                }
            }
            System.out.println();
            return;
        }
        for (int i = 0; i <= capacity; i++) {
            if (dp[n][i] == sumValue) {
                int sub = i - weight[n - 1];
                if (dp[n - 1][i] == sumValue) {
                    knapsack[n] = false;
                    showKnapsack(sumValue, n - 1);
                }
                if (sub >= 0 && dp[n - 1][sub] >= 0) {
                    knapsack[n] = true;
                    showKnapsack(sumValue - value[n - 1], n - 1);
                }
            }
        }
    }
}
 
// ナップザック問題を解くプログラム
 
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args) {
        int num, capacity, answer;  //データ数
        int[] weight, value;
        // 入力
        Scanner stdIn = new Scanner(System.in);
        num = stdIn.nextInt();
        capacity = stdIn.nextInt();
        weight = new int[num];
        value = new int[num];
        for (int i = 0; i < num; i++) {
            weight[i] = stdIn.nextInt();
            value[i] = stdIn.nextInt();
        }
 
        Solver s = new Solver(num, weight, value, capacity);
        answer = s.solve();
        System.out.println(answer);
        // s.showKnapsack(answer, num);
    }
}


Compiler output:
Main.java:78: error: class, interface, enum, or record expected
import java.util.Scanner;
^
1 error
Language: C

#include <stdio.h>
int rec(int i, int j);
int mymax(int a, int b);
int w[100];//??°?????????????????°
int v[100];
int n;
int main(void)
{
	int W;
	int i, j = 1;
	printf("put number:n=?\n");//??\???
	scanf_s("%d", &n);
	for (i = 0; i<n; i++){
		printf("weight:w[%d]=?\n", j);
		scanf_s("%d", &w[i]);
		printf("value:v[%d]=?\n", j);
		scanf_s("%d", &v[i]);
		j++;
	}
	printf("limit weight:W=?\n");
	scanf_s("%d", &W);
	printf("max value=%d\n", rec(0, W));
}

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

	}
	return res;
}
//?????§????????????
int mymax(int a, int b){
	int max;
	max = a;
	if (max<b)max = b;
	return max;
}

Compiler output:
main.c: In function 'main':
main.c:12:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   12 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C

#include <stdio.h>
int rec(int i, int j);
int mymax(int a, int b);
int w[100];//??°?????????????????°
int v[100];
int n;
int main(void)
{
	int W;
	int i, j = 1;
	printf("put number:n=?\n");//??\???
	scanf_s("%d", &n);
	for (i = 0; i<n; i++){
		printf("weight:w[%d]=?\n", j);
		scanf("%d", &w[i]);
		printf("value:v[%d]=?\n", j);
		scanf("%d", &v[i]);
		j++;
	}
	printf("limit weight:W=?\n");
	scanf("%d", &W);
	printf("max value=%d\n", rec(0, W));
}

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

	}
	return res;
}
//?????§????????????
int mymax(int a, int b){
	int max;
	max = a;
	if (max<b)max = b;
	return max;
}

Compiler output:
main.c: In function 'main':
main.c:12:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   12 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C

#include <stdio.h>
#include <stdlib.h>

// ??????b??????????????????????????????0???n?????\??????????????????????????§???
int m(int b, int n, int *v, int *w) {
    int i;

    if( n < 0 ) return 0;
    if( b < w[n] ) return m(b, n - 1, v, w);

    return max(m(b, n - 1, v, w), m(b - w[n], n - 1, v, w) + v[n]);
}

int main(void) {
    int N, W;
    int *v, *w;
    int i;

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

    v = (int *)malloc(sizeof(int) * N);
    w = (int *)malloc(sizeof(int) * N);

    for( i = 0; i < N; i++ ) {
        scanf("%d %d", v + i, w + i);
    }

    printf("%d", m(W, N - 1, v, w));

    free(v);
    free(w);

    return 0;
}

Compiler output:
main.c: In function 'm':
main.c:11:12: error: implicit declaration of function 'max' [-Wimplicit-function-declaration]
   11 |     return max(m(b, n - 1, v, w), m(b - w[n], n - 1, v, w) + v[n]);
      |            ^~~
Language: C

#include<iostream>
#include<vector>
#define MAX 100
#define DIAGONAL 1
#define LEFT 0

using namespace std;
/**
* Target 624, 10130,
*
*/

struct Item{
    int value, weight;
};

int n;
Item items[MAX];
int C[MAX+1][MAX+1], G[MAX+1][MAX+1];
int weight;

void compute( int &maxValue, vector<int> &path ){
    for ( int w = 0; w <= weight; w++ ) {
        C[0][w] = 0;
        G[0][w] = DIAGONAL;
    }
    
    for ( int i = 1; i <= n; i++ ) C[i][0] = 0;
    
    for ( int i = 1; i <= n; i++ ){
        for ( int w = 1; w <= weight; w++ ){
            if ( items[i].weight <= w ){
                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];
                    G[i][w] = DIAGONAL;
                }else{
                    C[i][w] = C[i-1][w];
                    G[i][w] = LEFT;
                }
            }else {
                C[i][w] = C[i-1][w];
                G[i][w] = LEFT;
            }
        }
    }
    
    maxValue = C[n][weight];
    
    path.clear();
    int w = weight;
    
    for ( int i = n; i >=1; i-- ){
        if ( G[i][w] == DIAGONAL ){
            path.push_back( i );
            w -= items[i].weight;
        }
    }
    
    reverse( path.begin(), path.end() );
}

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

main(){
    int maxValue;
    vector<int> path;
    input();
    compute( maxValue, path);
    
    cout << "max " << maxValue << endl;
    for ( int i = 0; i < path.size(); i++ ) cout << path[i] << endl;
    
    for ( int i = 1; i <= n; i++ ){
        for ( int j = 1; j <= weight; j++ ) {
            printf("%5d", C[i][j]);
        }
        cout << endl;
    }
    
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include <stdio.h>
#include <iostream>
#include <algorithm>
 
using namespace std;
 
// ??\???????????????
const int MAX_N = 100;		// ????????°?????????
const int MAX_W = 10000;	// ????????????????????????
 
// ??\??????
int N; // ???????????°
int W; // ????????????????????¶?´??????¶???
int Weight[MAX_N];	// ??????n?????????
int Value[MAX_N];	// ??????n?????????
 
 
//---------- ???????????¢?´¢ ----------
int MaxValueEdakari;	// ??????????????§
void dfsEdakari(int n, int totalWeight, int totalValue)
{
	// ???????????????????????????????????§????¶?????????¨??????????????????
	if(totalWeight>W)
	{
		return;
	}
 
	// ????????????????????¨??¨??????????????¨??£?????¨??????????????????????????§?????´??°??§???????????¨??????????????§??????????????§?????????
 
	if(n==N)
	{
		// ??¨??¨???????????????????????§????????§???????????´??°
		MaxValueEdakari = max(MaxValueEdakari,totalValue);
		return;
	}
 
	dfsEdakari(n+1, totalWeight+Weight[n], totalValue+Value[n]); // ??????n?????????
	dfsEdakari(n+1, totalWeight, totalValue); // ??????n???????????????
}
 
//---------- ?????¢????????° ----------
int dp[MAX_N][MAX_W]; // dp[n][totalWeight=??????n???N-1?????????????¨??????????]=??????n???N-1???????????????????¨?????????§???
int dfsMemo(int n, int totalWeight)
{
	if(n==N)
	{
		// ?????????1??????????????§???????????§????????????0
		return 0;
	}
 
	int& memo = dp[n][totalWeight]; // ??¢??°?????\??????n,totalWeight???????????????????????????index???????????????????????????
 
	if(memo>=0)
	{
		// ?????§?????¢??°???????????????????¨???????????????¢????????????????????§??????return;
		return memo;
	}
 
	// ?????¢?????????
	memo=0;
 
	// ??????
	if(totalWeight+Weight[n]<=W) // ?????????????????§??????
	{
		memo = max(memo,dfsMemo(n+1, totalWeight+Weight[n])+Value[n]);
	}
 
	// ????????????
	memo = max(memo,dfsMemo(n+1, totalWeight));
 
	return memo;
}
 
 
int main()
{
	// ??\???
	cin >> N >> W;
	for (int n = 0; n < N; n++)
	{
		cin >> Weight[n] >> Value[n];
	}
 
	//---------- ???????????¢?´¢ ----------
	MaxValueEdakari = -1;
	dfsEdakari(0,0,0);
 
	//---------- ?????¢????????° ----------
	for (int n = 0; n < MAX_N; n++)
	{
		for (int w = 0; w < MAX_W; w++)
		{
			dp[n][w]=-1;
		}
	}
	const int MaxValueMemo = dfsMemo(0,0);
 
	// ??????
	cout << " MaxValueEdakari=" << MaxValueEdakari << " MaxValueMemo=" << MaxValueMemo << endl;
 
	return 0;
}

Compiler output:
main.c:2:10: fatal error: iostream: No such file or directory
    2 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

//============================================================================
// Name        : dpl_1b.cpp
// Author      : afterCmidday
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

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

int main() {
	int n, W, v[100], w[100], dp[10001];
	cin >> n >> W;
	for(int i = 0;i < n;i++){
		cin >> v[i] >> w[i];
	}
	fill(dp,dp + 10001,-1);
	dp[0] = 0;
	for(int i = 0;i < n;i++){
		for(int j = W;j >= 0;j--){
			if(j - w[i] >= 0 && dp[j - w[i]] != -1 && (dp[j] == -1 || dp[j] < dp[j - w[i]] + v[i])){
				dp[j] = dp[j - w[i]] + v[i];
			}
		}
	}
	int ans = 0;
	for(int i = 0;i <= W;i++){
		ans = max(ans,dp[i]);
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
main.c:9:10: fatal error: iostream: No such file or directory
    9 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

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

using namespace std;

int main(){
	ostringstream out;

	int N,W,v,w;
	while(cin >> N >> W, N|W){
		vector<int> list(W+1);
		for(int i=0;i<N;i++){
			cin >> v >> w;
			for(int j=list.size()-1;j>=0;j--)
				if(list[j]&&j+w<list.size())
					list[j+w]=max(list[j+w],list[j]+v);
			if(w<list.size())
				list[w]=max(list[w],v);
			for(int i=0;i<list.size();i++)
				cout << list[i] << " ";
			cout << endl;
		}
		for(int i=list.size()-1;i>=0;i--)
			if(list[i]){
				out << list[i] << endl;
				break;
			}
	}

	cout << out.str();
	return 0;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;
#define MAX_N 101
#define MAX_W 100001
long long dp[MAX_N][MAX_W];

int main()
{
    long long N;
    cin>>N;
    long long W;
    cin>>W;
    vector<vector<long long>>v(N,vector<long long>(2));
    for (long long i=0; i <N;i++)
    {
        cin>>v[i][0]>>v[i][1]
    }
    for(long long i=0; i<=W; i++)
    {
        dp[0][i]=0;
    }
    for(long long i=0; i<N;i++)
    {
        for(long long j=0; j<=W; j++)
        {
            if(j<v[i][1])
            {
                dp[i+1][j]=dp[i][j];
            }
            else
            {
                dp[i+1][j]=max(dp[i][j],dp[i][j-v[i][1]] +v[i][0]);
            }
        }
    }
    cout<<dp[N][W]<<endl;
    return 0;
    
                                              
                                            
   
    
            
      


Compiler output:
a.cc: In function 'int main()':
a.cc:18:30: error: expected ';' before '}' token
   18 |         cin>>v[i][0]>>v[i][1]
      |                              ^
      |                              ;
   19 |     }
      |     ~                         
a.cc:39:14: error: expected '}' at end of input
   39 |     return 0;
      |              ^
a.cc:10:1: note: to match this '{'
   10 | {
      | ^
Language: C++

#include<iostream>
using namespace std;

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

int rec(int i, int j){
  if(i==n)
    return 0;

  if(j<w[i])
    return rec(i+1, j);

  int res1 = rec(i+1,j);
  int res2 = rec(i+1, j-w[i])+v[i];
  if(res1>res2)
    return res1;
  else
    return res2;
}

int main(){
  cout << rec(0, W) << endl;

  return 0;
}



Compiler output:
a.cc:5:1: error: 'cin' does not name a type
    5 | cin >> N >> W;
      | ^~~
a.cc:6:7: error: size of array 'v' is not an integral constant-expression
    6 | int v[N];
      |       ^
a.cc:7:7: error: size of array 'w' is not an integral constant-expression
    7 | int w[N];
      |       ^
a.cc:8:1: error: expected unqualified-id before 'for'
    8 | for(int i=0; i<N; i++)
      | ^~~
a.cc:8:14: error: 'i' does not name a type
    8 | for(int i=0; i<N; i++)
      |              ^
a.cc:8:19: error: 'i' does not name a type
    8 | for(int i=0; i<N; i++)
      |                   ^
a.cc: In function 'int rec(int, int)':
a.cc:12:9: error: 'n' was not declared in this scope
   12 |   if(i==n)
      |         ^
Language: C++

#include<iostream>
using namespace std;

int main(){
  int n,W;
  cin>>n>>W;
  int w[n],v[n];
  int DP[n+1][W+1];
  for(int i=0;i<n;i++){
    cin>>v[i]>>w[i];
  }
  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:30:3: error: expected unqualified-id before 'return'
   30 |   return 0;
      |   ^~~~~~
a.cc:31:1: error: expected declaration before '}' token
   31 | }
      | ^
Language: C++


import java.util.*;

public class Main {

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

        int[] v = new int[N+1];
        int[] w = new int[W+1];

        for(int i=1; i<N+1; i++) {
            v[i] = sc.nextInt();
            w[i] = sc.nextInt();
        }

        int dp[][] = new int[N+1][W+1];
        for(int i=0; i<N+1; i++)
            Arrays.fill(dp[i], 0);

        for(int ni=1; ni<N+1; ni++) {
            for(int wi=1; wi<W+1; wi++) {
                dp[ni][wi] = dp[ni - 1][wi];
                if(wi-w[ni] >= 0)
                    dp[ni][wi] = Math.max(dp[ni][wi], dp[ni-1][wi-w[ni]] + v[ni]);
            }
         }

        System.out.println(dp[N][W]);
    }
}



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

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
int N,W;
int dp[110000][110000];
vector<int> v(11000);
vector<int> w(11000);
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;
}
int main()
{
	memset(dp, -1, sizeof(dp));
	cin >> N >> W;
	rep(i, N)
	{
		cin >> v[i] >> w[i];
	}
	cout << rec(0, W) << endl;
	return 0;
}
	


Compiler output:
/tmp/ccq5eiK2.o: in function `rec(int, int)':
a.cc:(.text+0x88): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccq5eiK2.o
a.cc:(.text+0xc2): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccq5eiK2.o
a.cc:(.text+0xf1): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccq5eiK2.o
/tmp/ccq5eiK2.o: in function `main':
a.cc:(.text+0x1f4): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccq5eiK2.o
a.cc:(.text+0x220): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccq5eiK2.o
/tmp/ccq5eiK2.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x2a8): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccq5eiK2.o
a.cc:(.text+0x2ce): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccq5eiK2.o
a.cc:(.text+0x2fd): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccq5eiK2.o
a.cc:(.text+0x323): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccq5eiK2.o
collect2: error: ld returned 1 exit status
Language: C++

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

int N,W;
int v[1000],w[1000];
int main(){

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

    vector<vector<int> > dp(N+1,vector(W+1,0));

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

    cout<<dp[N][W]<<endl;
}


Compiler output:
a.cc:17:5: error: expected unqualified-id before 'for'
   17 |     for(int i=0;i<N;i++){
      |     ^~~
a.cc:17:17: error: 'i' does not name a type
   17 |     for(int i=0;i<N;i++){
      |                 ^
a.cc:17:21: error: 'i' does not name a type
   17 |     for(int i=0;i<N;i++){
      |                     ^
a.cc:26:5: error: 'cout' does not name a type
   26 |     cout<<dp[N][W]<<endl;
      |     ^~~~
a.cc:27:1: error: expected declaration before '}' token
   27 | }
      | ^
Language: C++

#if 0

#endif

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

int N, W;
int v[110]; int w[110];
int V[110][10010];

int main() {
  cin >> N >> W;
  for (int i = 1; i <= N; i++)
    cin >> v[i] >> w[i];
  for (int i = 0; i <= N; i++) {
    for (int c = 0; c <= W; c++) {
      if (i == 0 || c == 0)
        V[i][c] = 0;
      else if (c-w[i] < 0)
        V[i][c] = V[i-1][c];
      else
        V[i][c] = max(v[i] + V[i-1][c-w[i]], V[i-1][c]);
      }
    }
  }
  cout << V[N][W] << endl;
}



Compiler output:
a.cc:28:3: error: 'cout' does not name a type
   28 |   cout << V[N][W] << endl;
      |   ^~~~
a.cc:29:1: error: expected declaration before '}' token
   29 | }
      | ^
Language: C++

#include <iostream>
#include <utility>
#include <vector>

using namespace std;
typedef pair<int, int> Pii;

int highestWorth(vector<Pii> item, int weight)
{
    int item_len = item.size();

    int dp[item_len][weight + 1];

    for (int i = 0; i < item_len; i++)
    {
        for (int j = 0; j <= weight; j++)
        {
            if (i == 0 || j == 0)
            {
                dp[i][j] = 0;
                continue;
            }

            // アイテムの重さが j 以内であるなら
            if (item[i].second <= j)
            {
                dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - item[i].second] + item[i].first);
            }
            else
            {
                dp[i][j] = dp[i - 1][j];
            }
        }
    }

    return dp[item_len - 1][weight];
}

int main()
{
    int N, W;
    vector<Pii> item;
    cin >> N >> W;

    item.push_back(make_pair(0, 0));

    for (int i = 0; i < N; i++)
    {
        int v_i, w_i;
        cin >> v_i >> w_i;

        item.push_back(make_pair(v_i, w_i));
    }

    cout << highestWorth(item, W) << endl;
}
    int item_len = item.size();

    int dp[item_len + 1][worth + 1];

    for (int i = 0; i <= item_len; i++)
    {
        for (int j = 0; j <= worth; j++)
        {
            if (i == 0 || j == 0)
            {
                dp[i][j] = 0;
                continue;
            }

            // アイテムの重さが j 以内であるなら
            if (item[i].second <= j)
            {
                dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - item[i].second] + item[i].first);
            }
            else
            {
                dp[i][j] = dp[i - 1][j];
            }
        }
    }

    return dp[item_len][worth];
}

int main()
{
    int N, W;
    vector<Pii> item(100);
    cin >> N >> W;
    for (int i = 0; i < N; i++)
    {
        int v_i, w_i;
        cin >> v_i >> w_i;
        item[i] = make_pair(v_i, w_i);
    }

    cout << highestWorth(item, W) << endl;
}


Compiler output:
a.cc:57:20: error: 'item' was not declared in this scope; did you mean 'tm'?
   57 |     int item_len = item.size();
      |                    ^~~~
      |                    tm
a.cc:59:26: error: 'worth' was not declared in this scope
   59 |     int dp[item_len + 1][worth + 1];
      |                          ^~~~~
a.cc:61:5: error: expected unqualified-id before 'for'
   61 |     for (int i = 0; i <= item_len; i++)
      |     ^~~
a.cc:61:21: error: 'i' does not name a type
   61 |     for (int i = 0; i <= item_len; i++)
      |                     ^
a.cc:61:36: error: 'i' does not name a type
   61 |     for (int i = 0; i <= item_len; i++)
      |                                    ^
a.cc:83:5: error: expected unqualified-id before 'return'
   83 |     return dp[item_len][worth];
      |     ^~~~~~
a.cc:84:1: error: expected declaration before '}' token
   84 | }
      | ^
a.cc:86:5: error: redefinition of 'int main()'
   86 | int main()
      |     ^~~~
a.cc:39:5: note: 'int main()' previously defined here
   39 | int main()
      |     ^~~~
Language: C++

#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
using namespace std;
typedef pair<int,int> product;

int main() {
    int n,w;
    cin > > n > > w;
    vector<product> products(n);    // <value,weight>
    for(int i=0;i<n;i++){
        cin >> products.at(i).first >> products.at(i).second;
    }

    vector<vector<int> > dp(n+1,vector<int>(w+1,0));
    for(int i=0;i<n;i++){
        for (int j=0;j<=w;j++){
            if (j < products[i].second){
                dp[i+1][j] = dp[i][j];
            }else{
                dp[i+1][j] = max(dp[i][j],dp[i][j-products[i].second] + products[i].first);
            }
        }
    }
    cout << dp[n][w] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:11: error: expected primary-expression before '>' token
   13 |     cin > > n > > w;
      |           ^
a.cc:13:17: error: expected primary-expression before '>' token
   13 |     cin > > n > > w;
      |                 ^
Language: C++

#include <stdio.h>
#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

int larger(int x, int y){
	if(x > y){
		return x;
	}
	else{
		return y;
	}
}

int main(){
	int N, W;
	cin >> N >> W;
	int values[N];
	int weight[N];
	for(int i = 0; i < N; i++){
		cin >> values[i] >> weight[i];
	}
	int dp[N+1][W+1];
	for(int i = 0; i < N+1; i++){
		for(int j = 0; j < W+1; j++){
			dp[i][j] = 0;
		}
	}
	for(int i = 0; i < N; i++){
		for(int j = 0; j < W; j++){
			if(j < weight[i]){
				dp[i+1][j] = dp[i][j]
			}
			else{
				dp[i+1][j] = larger(dp[i][j-weight[i]]+values[i], dp[i][j]);
			}
		}
	}
	cout << dp[N][W] << "\n";
}



Compiler output:
a.cc: In function 'int main()':
a.cc:34:54: error: expected ';' before '}' token
   34 |                                 dp[i+1][j] = dp[i][j]
      |                                                      ^
      |                                                      ;
   35 |                         }
      |                         ~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>//小数精度 	cout << fixed << setprecision(5) << tmp << endl;
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define All(X)      (X).begin(),(X).end()

int n,w;
int dp[101][100001];
int val[101];
int wei[101];
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<wei[i]){
		res = rec(i+1,j);
	}else{
		res = max(rec(i+1,j),rec(i+1,j-wei[i]) + val[i]);
	}
	return dp[i][j] = res;
}

int main(){

	cin >> n >> w;
	REP(i,n) cin >> val[i] >> wei[i];

	memset(dp,-1,sizeof(dp));
	cout << rec(0,w) <<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:9: error: 'memset' was not declared in this scope
   41 |         memset(dp,-1,sizeof(dp));
      |         ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   10 | #include <iomanip>//小数精度    cout << fixed << setprecision(5) << tmp << endl;
  +++ |+#include <cstring>
   11 | using namespace std;
Language: C++

#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <stack>
#include <algorithm>
using namespace std;

int dp[100][10000]; //i番目で、残りの容量がjの時の価値
int n, weight;
int v[100], w[100];

int rec(int i, int j) //i番目で、残りの容量がj
{
	if (dp[i][j] > 0)
	{
		return dp[i][j];
	}

	if (i == n)
	{
		return 0;
	}
	else if (j < w[i]) //次に入れる物の重さが容量を超えている時は「入れない」一択
	{
		dp[i][j] = rec(i + 1, j); //iは次に進み、残り容量はそのまま
	}
	else //入りそうな時は、「入れる」「入れない」を計算して、大きい方を選択
	{
		dp[i][j] = max(rec(i + 1, j), rec(i + 1, j - w[i]) + v[i]);
		//上のやつと、iは次に進み、残り容量を減らしたものに価値を足したものを比較
	}

	return dp[i][j];
}

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

	cout << rec(0, weight) << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:9: error: 'memset' was not declared in this scope
   44 |         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 <algorithm>
  +++ |+#include <cstring>
    7 | using namespace std;
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
	int N,W;
		v[100],w[100];
		int dp[1000][1000];
int dfs(int i,int omosa){
	//int a1=0,a2=0;
	//cout<<i<<" "<<omosa<<endl;
	if(dp[i][omosa]>=0)return dp[i][omosa];
	if(i==N){
	dp[i][omosa]=0;
	 return 0;//すべての商品を試したとき.
	}
	
	if(omosa<w[i])return dfs(i+1,omosa);
	

	int a1=dfs(i+1,omosa);
	int a2=dfs(i+1,omosa-w[i])+v[i];
	//cout<<a1<<"#"<<a2<<endl;
	dp[i][omosa]=max(a1,a2);
	return max(a1,a2);

}

int main(){
	cin>>N>>W;
	for(int i=0;i<N;i++)cin>>v[i]>>w[i];
	for(int i=0;i<N;i++)cout<<v[i]<<" "<<w[i]<<endl;
	for(int i=0;i<1000;i++){
		for(int j=0;j<1000;j++){
			dp[i][j]=-1;
		}
	}
	cout<<dfs(0,W)<<endl;
	
	return 0;
	}

Compiler output:
a.cc:5:17: error: 'v' does not name a type
    5 |                 v[100],w[100];
      |                 ^
a.cc: In function 'int dfs(int, int)':
a.cc:16:18: error: 'w' was not declared in this scope
   16 |         if(omosa<w[i])return dfs(i+1,omosa);
      |                  ^
a.cc:20:30: error: 'w' was not declared in this scope
   20 |         int a2=dfs(i+1,omosa-w[i])+v[i];
      |                              ^
a.cc:20:36: error: 'v' was not declared in this scope
   20 |         int a2=dfs(i+1,omosa-w[i])+v[i];
      |                                    ^
a.cc: In function 'int main()':
a.cc:29:34: error: 'v' was not declared in this scope
   29 |         for(int i=0;i<N;i++)cin>>v[i]>>w[i];
      |                                  ^
a.cc:29:40: error: 'w' was not declared in this scope
   29 |         for(int i=0;i<N;i++)cin>>v[i]>>w[i];
      |                                        ^
a.cc:30:35: error: 'v' was not declared in this scope
   30 |         for(int i=0;i<N;i++)cout<<v[i]<<" "<<w[i]<<endl;
      |                                   ^
a.cc:30:46: error: 'w' was not declared in this scope
   30 |         for(int i=0;i<N;i++)cout<<v[i]<<" "<<w[i]<<endl;
      |                                              ^
Language: C++

def solve_knapsack(w, v, q)

	n = w.length
	inf = 1e9.to_i
	ans = [-inf] * (q + 1)

	ans[0] = 0

	(w.zip(v)).each do |wi, vi|
		(0..(q-wi)).each do |kkk|
			k = (q-wi) - kkk
			ans[k+wi] = [ans[k+wi], ans[k] + vi].max
		end
	end

	ans[q]

end


if __FILE__ == $0

	n, q = gets().split().map(&:to_i)
	v, w = [], []
	n.times do |i|
		vi, wi = gets().split().map(&:to_i)
		v << vi
		w << wi
	end

	a = solve_knapsack(w, v, q)
	puts a

	#w = [3,2,4,1,3]
	#v = [2,3,3,2,6]
	#q = 10
	#a = solve_knapsack(w, v, q)
	#puts "ans: #{a}"

end

Compiler output:
a.cc:10:18: error: too many decimal points in number
   10 |                 (0..(q-wi)).each do |kkk|
      |                  ^~~
a.cc:34:10: error: invalid preprocessing directive #w
   34 |         #w = [3,2,4,1,3]
      |          ^
a.cc:35:10: error: invalid preprocessing directive #v
   35 |         #v = [2,3,3,2,6]
      |          ^
a.cc:36:10: error: invalid preprocessing directive #q
   36 |         #q = 10
      |          ^
a.cc:37:10: error: invalid preprocessing directive #a
   37 |         #a = solve_knapsack(w, v, q)
      |          ^
a.cc:38:10: error: invalid preprocessing directive #puts
   38 |         #puts "ans: #{a}"
      |          ^~~~
a.cc:1:1: error: 'def' does not name a type
    1 | def solve_knapsack(w, v, q)
      | ^~~
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>


using namespace std;



#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)


#define MAX_W 100
#define V 1000


int v[1000];
int w[1000];

int dp[1001][1001];

int N;
int W;

int dfs(int i,int j){


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



	if(i == N){
		return 0;
	}
	else if(j < w[i]){
		return dfs(i+1,j);
	}
	else if(dp[i][j] != -1){
		return dp[i][j];
	}
	else{

		return dp[i][j] = max(dfs(i+1,j),dfs(i+1,j-w[i]) + v[i]);
	}
}


int main(){

	cin >> N >> W;

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

	cout << dfs(0,W) << endl;

	return 0;

}

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