Language: C++

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

class Main{

    public static void main(String[] args) {
        FastReader f = new FastReader();
        int n = ii(f);
        long w = il(f);
        int[] values = new int[n+1];
        int[] weights = new int[n+1];
        for(int i=1; i<=n; i++){
            weights[i] = ii(f);
            values[i] = ii(f);
        }
        int maxVal = (int)10e5;
        int[][] dp = new int[maxVal + 1][2];
        for(int[] x: dp)
            Arrays.fill(x, Integer.MAX_VALUE);
        dp[0][0] = 0;
        for(int i=1; i<=n; i++){
            for(int j=1; j<=maxVal; j++){
                if(j < values[i])
                    dp[j][1] = dp[j][0];
                else{
                    if(dp[j-values[i]][0] == Integer.MAX_VALUE){
                        dp[j][1] = dp[j][0];
                    }
                    else{
                        dp[j][1] = min(dp[j][0], dp[j-values[i]][0] + weights[i]);
                    }
                }
            }
            for(int j=1; j<=maxVal; j++)
                dp[j][0] = dp[j][1];
        }
        int m = 0;
        for(int i=1; i<=maxVal; ++i){
            if(dp[i][1] <= w)
                m = max(m, i);
        }
        System.out.println(m);
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static int ii(FastReader fr){
        return fr.nextInt();
    }

    static long il(FastReader fr){
        return fr.nextLong();
    }

    static double id(FastReader fr){
        return fr.nextDouble();
    }

    static void printArray(Object[] arr) {
        for (Object x : arr)
            print(x, " ");
        printn("");
    }

    static void print(Object s, String sep) {
        System.out.print(s + sep);
    }

    static void printn(Object s) {
        System.out.println(s);
    }

    static long[] inputArrL(int n, FastReader fr) {
        long[] arr = new long[n];
        for (int i = 0; i < n; i++)
            arr[i] = fr.nextLong();
        return arr;
    }

    static int[] inputArr(int n, FastReader fr) {
        int[] arr = new int[n];
        for (int i = 0; i < n; i++)
            arr[i] = fr.nextInt();
        return arr;
    }

    static int max(int... args) {
        int max = Integer.MIN_VALUE;
        for (int x : args) {
            max = Math.max(x, max);
        }
        return max;
    }

    static int min(int... args) {
        int min = Integer.MAX_VALUE;
        for (int x : args) {
            min = Math.min(x, min);
        }
        return min;
    }

    static long max(long... args) {
        long max = Integer.MIN_VALUE;
        for (long x : args) {
            max = Math.max(x, max);
        }
        return max;
    }

    static long min(long... args) {
        long min = Integer.MAX_VALUE;
        for (long x : args) {
            min = Math.min(x, min);
        }
        return min;
    }

    static int lenDigit(int d) {
        if (d == 0)
            return 1;
        int l = 0;
        while (d != 0) {
            l++;
            d /= 10;
        }
        return l;
    }

}



Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.BufferedReader;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.io.IOException;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.io.InputStreamReader;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.util.*;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:11: error: expected ':' before 'static'
    8 |     public static void main(String[] args) {
      |           ^~~~~~~
      |           :
a.cc:8:29: error: 'String' has not been declared
    8 |     public static void main(String[] args) {
      |                             ^~~~~~
a.cc:8:38: error: expected ',' or '...' before 'args'
    8 |     public static void main(String[] args) {
      |                                      ^~~~
a.cc:48:9: error: 'BufferedReader' does not name a type
   48 |         BufferedReader br;
      |         ^~~~~~~~~~~~~~
a.cc:49:9: error: 'StringTokenizer' does not name a type
   49 |         StringTokenizer st;
      |         ^~~~~~~~~~~~~~~
a.cc:51:15: error: expected ':' before 'FastReader'
   51 |         public FastReader() {
      |               ^~~~~~~~~~~
      |               :
a.cc:56:9: error: 'String' does not name a type
   56 |         String next() {
      |         ^~~~~~
a.cc:79:9: error: 'String' does not name a type
   79 |         String nextLine() {
      |         ^~~~~~
a.cc:88:6: error: expected ';' after class definition
   88 |     }
      |      ^
      |      ;
a.cc:47:5: error: a storage class can only be specified for objects and functions
   47 |     static class FastReader {
      |     ^~~~~~
a.cc:90:11: error: expected ':' before 'static'
   90 |     public static int ii(FastReader fr){
      |           ^~~~~~~
      |           :
a.cc:102:28: error: 'Object' has not been declared
  102 |     static void printArray(Object[] arr) {
      |                            ^~~~~~
a.cc:102:37: error: expected ',' or '...' before 'arr'
  102 |     static void printArray(Object[] arr) {
      |                                     ^~~
a.cc:108:23: error: 'Object' has not been declared
  108 |     static void print(Object s, String sep) {
      |                       ^~~~~~
a.cc:108:33: error: 'String' has not been declared
  108 |     static void print(Object s, String sep) {
      |                                 ^~~~~~
a.cc:112:24: error: 'Object' has not been declared
  112 |     static void printn(Object s) {
      |                        ^~~~~~
a.cc:116:16: error: expected unqualified-id before '[' token
  116 |     static long[] inputArrL(int n, FastReader fr) {
      |                ^
a.cc:123:15: error: expected unqualified-id before '[' token
  123 |     static int[] inputArr(int n, FastReader fr) {
      |               ^
a.cc:130:27: error: expansion pattern 'int' contains no parameter packs
  130 |     static int max(int... args) {
      |                           ^~~~
a.cc:138:27: error: expansion pattern 'int' contains no parameter packs
  138 |     static int min(int... args) {
      |                           ^~~~
a.cc:146:29: error: expansion pattern 'long int' contains no parameter packs
  146 |     static long max(long... args) {
      |                             ^~~~
a.cc:146:17: error: 'static long int Main::max(...)' cannot be overloaded with 'static int Main::max(...)'
  146 |     static long max(long... args) {
      |                 ^~~
a.cc:130:16: note: previous declaration 'static int Main::max(...)'
  130 |     static int max(int... args) {
      |                ^~~
a.cc:154:29: error: expansion pattern 'long int' contains no parameter packs
  154 |     static long min(long... args) {
      |                             ^~~~
a.cc:154:17: error: 'static long int Main::min(...)' cannot be overloaded with 'static int Main::min(...)'
  154 |     static long min(long... args) {
      |                 ^~~
a.cc:138:16: note: previous declaration 'static int Main::min(...)'
  138 |     static int min(int... args) {
      |                ^~~
a.cc:173:2: error: expected ';' after class definition
  173 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:9:24: error: conversion from 'Main::FastReader*' to non-scalar type 'Main::FastReader' requested
    9 |         FastReader f = new FastReader();
      |                        ^~~~~~~~~~~~~~~~
a.cc:12:12: error: structured binding declaration cannot have type 'int'
   12 |         int[] values = new int[n+1];
      |            ^~
a.cc:12:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:12:12: error: empty structured binding declaration
a.cc:12:15: error: expected initializer before 'values'
   12 |         int[] values = new int[n+1];
      |               ^~~~~~
a.cc:13:12: error: structured binding declaration cannot have type 'int'
   13 |         int[] weights = new int[n+1];
      |            ^~
a.cc:13:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:13:12: error: empty structured binding declaration
a.cc:13:15: error: expected initializer before 'weights'
   13 |         int[] weights = new int[n+1];
      |               ^~~~~~~
a.cc:15:13: error: 'weights' was not declared in this scope
   15 |             weights[i] = ii(f);
      |             ^~~~~~~
a.cc:16:13: error: 'values' was not declared in this scope
   16 |             values[i] = ii(f);
      |             ^~~~~~
a.cc:19:12: error: structured binding declaration cannot have type 'int'
   19 |         int[][] dp = new int[maxVal + 1][2];
      |            ^~
a.cc:19:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:19:12: error: empty structured binding declaration
a.cc:19:14: error: expected initializer before '[' token
   19 |         int[][] dp = new int[maxVal + 1][2];
      |              ^
a.cc:20:16: error: structured binding declaration cannot have type 'int'
   20 |         for(int[] x: dp)
      |                ^~
a.cc:20:16: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:20:16: error: empty structured binding declaration
a.cc:20:19: error: expected initializer before 'x'
   20 |         for(int[] x: dp)
      |                   ^
a.cc:20:19: error: expected ';' before 'x'
a.cc:20:20: error: found ':' in nested-name-specifier, expected '::'
   20 |         for(int[] x: dp)
      |                    ^
      |                    ::
a.cc:20:19: error: 'x' has not been declared
   20 |         for(int[] x: dp)
      |                   ^
a.cc:20:24: error: expected ';' before ')' token
   20 |         for(int[] x: dp)
      |                        ^
a.cc:21:13: error: 'Arrays' was not declared in this scope
   21 |             Arrays.fill(x, Integer.MAX_VALUE);
      |             ^~~~~~
a.cc:21:25: error: 'x' was not declared in this scope
   21 |             Arrays.fill(x, Integer.MAX_VALUE);
      |                         ^
a.cc:21:28: error: 'Integer' was not declared in this scope
   21 |             Arrays.fill(x, Integer.MAX_VALUE);
      |                            ^~~~~~~
a.cc:22:9: error: 'dp' was not declared in this scope
   22 |         dp[0][0] = 0;
      |         ^~
a.cc:25:24: error: 'values' was not declared in this scope
   25 |                 if(j < values[i])
      |                        ^~~~~~
a.cc:28:46: error: 'Integer' was not declared in this scope
   28 |                     if(dp[j-values[i]][0] == Integer.MAX_VALUE){
      |                                              ^~~~~~~
a.cc:32:71: error: 'weights' was not declared in this scope
   32 |                         dp[j][1] = min(dp[j][0], dp[j-values[i]][0] + weights[i]);
      |                                                                       ^~~~~~~
a.cc:44:9: error: 'System' was not declared in this scope
   44 |         System.out.println(m);
      |         ^~~~~~
a.cc: In constructor 'Main::FastReader::FastReader()':
a.cc:52:13: error: 'br' was not declared in this scope
   52 |             br = new BufferedReader(new
      |             ^~
a.cc:52:22: error: expected type-specifier before 'BufferedReader'
   52 |             br = new BufferedReader(new
      |                      ^~~~~~~~~~~~~~
a.cc: In member function 'int Main::FastReader::nextInt()':
a.cc:68:20: error: 'Integer' was not declared in this scope
   68 |             return Integer.parseInt(next());
      |                    ^~~~~~~
a.cc:68:37: error: 'next' was not declared in this scope; did you mean 'nextInt'?
   68 |             return Integer.parseInt(next());
      |                                     ^~~~
      |                                     nextInt
a.cc: In member function 'long int Main::FastReader::nextLong()':
a.cc:72:20: error: 'Long' was not declared in this scope; did you mean 'long'?
   72 |             return Long.parseLong(next());
      |                    ^~~~
      |                    long
a.cc:72:35: error: 'next' was not declared in this scope; did you mean 'nextInt'?
   72 |             return Long.parseLong(next());
      |                                   ^~~~
      |                                   nextInt
a.cc: In member function 'double Main::FastReader::nextDouble()':
a.cc:76:20: error: 'Double' was not declared in this scope; did you mean 'double'?
   76 |             return Double.parseDouble(next());
      |                    ^~~~~~
      |                    double
a.cc:76:39: error: 'next' was not declared in this scope; did you mean 'nextInt'?
   76 |             return Double.parseDouble(next());
      |                                       ^~~~
      |                                       nextInt
a.cc: In static member function 'static void Main::printArray(int*)':
a.cc:103:14: error: 'Object' was not declared in this scope
  103 |         for (Object x : arr)
      |