Language: Java

public class Main {
	
	static int []w,v;
	static int n,s;
	static int [][]dp;
	public static int dp(int index,int remw) {
		
		if(remw<0) 
			return -(int)1e9;
		
		if(index==n) 
			return 0;
		
		
		
		if(dp[index][remw]!=-1) 
			return dp[index][remw];
		
		int take=v[index]+dp(index+1,remw-w[index]);
		int  leave=dp(index+1,remw);
		return dp[index][remw]=Math.max(take,leave);
		
	}
	public static void main (String []args) throws IOException {
		
		Scanner sc=new Scanner (System.in);
		PrintWriter pw=new PrintWriter(System.out);
		
		n=sc.nextInt();
		s=sc.nextInt();
		w=sc.nextIntArr(n);
		v=sc.nextIntArr(n);
		dp=new int [n+1][s+1];
		for(int[]x:dp) {
			Arrays.fill(x,-1);
		}
		for (int i = n-1;i>0;i-=1000 ) {
			for(int j=0;j<s+1;j+=1000) {
				dp(i,j);
			}
		}
		pw.println(dp(0,s));
		pw.close();
		

	}
	static class Scanner {
		BufferedReader br;
		StringTokenizer st;
		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = Integer.parseInt(next());
			}
			return arr;
		}
	}
		
	}

Compiler output:
Main.java:24: error: cannot find symbol
	public static void main (String []args) throws IOException {
	                                               ^
  symbol:   class IOException
  location: class Main
Main.java:48: error: cannot find symbol
		BufferedReader br;
		^
  symbol:   class BufferedReader
  location: class Scanner
Main.java:49: error: cannot find symbol
		StringTokenizer st;
		^
  symbol:   class StringTokenizer
  location: class Scanner
Main.java:50: error: cannot find symbol
		public Scanner(InputStream s) {
		               ^
  symbol:   class InputStream
  location: class Scanner
Main.java:53: error: cannot find symbol
		public String next() throws IOException {
		                            ^
  symbol:   class IOException
  location: class Scanner
Main.java:58: error: cannot find symbol
		public int nextInt() throws IOException {
		                            ^
  symbol:   class IOException
  location: class Scanner
Main.java:61: error: cannot find symbol
		public long nextLong() throws IOException {
		                              ^
  symbol:   class IOException
  location: class Scanner
Main.java:64: error: cannot find symbol
		public double nextDouble() throws IOException {
		                                  ^
  symbol:   class IOException
  location: class Scanner
Main.java:67: error: cannot find symbol
		public int[] nextIntArr(int n) throws IOException {
		                                      ^
  symbol:   class IOException
  location: class Scanner
Main.java:27: error: cannot find symbol
		PrintWriter pw=new PrintWriter(System.out);
		^
  symbol:   class PrintWriter
  location: class Main
Main.java:27: error: cannot find symbol
		PrintWriter pw=new PrintWriter(System.out);
		                   ^
  symbol:   class PrintWriter
  location: class Main
Main.java:35: error: cannot find symbol
			Arrays.fill(x,-1);
			^
  symbol:   variable Arrays
  location: class Main
Main.java:51: error: cannot find symbol
			br = new BufferedReader(new InputStreamReader(s));
			         ^
  symbol:   class BufferedReader
  location: class Scanner
Main.java:51: error: cannot find symbol
			br = new BufferedReader(new InputStreamReader(s));
			                            ^
  symbol:   class InputStreamReader
  location: class Scanner
Main.java:55: error: cannot find symbol
				st = new StringTokenizer(br.readLine());
				         ^
  symbol:   class StringTokenizer
  location: class Scanner
15 errors