Language: C++

import java.io.*;
import static java.lang.Math.max;
import static java.lang.Integer.parseInt;

class Main {
   final static PrintWriter out = new PrintWriter( System.out );

   final static BufferedReader in =
         new BufferedReader( new InputStreamReader( System.in ) );

   final static StringBuilder sb = new StringBuilder("");

   static int lcs(char[] a, char[] b){
      final int alen = a.length;
      final int blen = b.length;
      int dp[][] = new int[alen+1][blen+1];

      for(int i=0; i<alen; ++i){
         for(int j=0; j<blen; ++j){
            if(a[i] == b[j])
               dp[i+1][j+1] = dp[i][j] + 1;
            else
               dp[i+1][j+1] = max( dp[i][j+1], dp[i+1][j] );
         }
      }
      return( dp[alen][blen] );
   }

   public static void main(String[] args) throws IOException {
      final int N = parseInt( in.readLine() );
      for(int i=0; i<N; ++i){
         char[] a = in.readLine().toCharArray();
         char[] b = in.readLine().toCharArray();
         sb.append( lcs(a,b) );
         sb.append('\n');
      }
      System.out.print(sb);
   }
}




Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.*;
      | ^~~~~~
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 static java.lang.Math.max;
      | ^~~~~~
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 static java.lang.Integer.parseInt;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:4: error: 'final' does not name a type
    6 |    final static PrintWriter out = new PrintWriter( System.out );
      |    ^~~~~
a.cc:8:4: error: 'final' does not name a type
    8 |    final static BufferedReader in =
      |    ^~~~~
a.cc:11:4: error: 'final' does not name a type
   11 |    final static StringBuilder sb = new StringBuilder("");
      |    ^~~~~
a.cc:13:26: error: expected ',' or '...' before 'a'
   13 |    static int lcs(char[] a, char[] b){
      |                          ^
a.cc:29:10: error: expected ':' before 'static'
   29 |    public static void main(String[] args) throws IOException {
      |          ^~~~~~~
      |          :
a.cc:29:28: error: 'String' has not been declared
   29 |    public static void main(String[] args) throws IOException {
      |                            ^~~~~~
a.cc:29:37: error: expected ',' or '...' before 'args'
   29 |    public static void main(String[] args) throws IOException {
      |                                     ^~~~
a.cc:29:41: error: expected ';' at end of member declaration
   29 |    public static void main(String[] args) throws IOException {
      |                                         ^
      |                                          ;
a.cc:29:43: error: 'throws' does not name a type
   29 |    public static void main(String[] args) throws IOException {
      |                                           ^~~~~~
a.cc:39:2: error: expected ';' after class definition
   39 | }
      |  ^
      |  ;
a.cc: In static member function 'static int Main::lcs(char*)':
a.cc:14:7: error: 'final' was not declared in this scope
   14 |       final int alen = a.length;
      |       ^~~~~
a.cc:15:13: error: expected ';' before 'int'
   15 |       final int blen = b.length;
      |             ^~~
a.cc:16:11: error: declaration of 'dp' as multidimensional array must have bounds for all dimensions except the first
   16 |       int dp[][] = new int[alen+1][blen+1];
      |           ^~
a.cc:16:28: error: 'alen' was not declared in this scope
   16 |       int dp[][] = new int[alen+1][blen+1];
      |                            ^~~~
a.cc:16:36: error: 'blen' was not declared in this scope
   16 |       int dp[][] = new int[alen+1][blen+1];
      |                                    ^~~~
a.cc:20:16: error: 'a' was not declared in this scope
   20 |             if(a[i] == b[j])
      |                ^
a.cc:20:24: error: 'b' was not declared in this scope
   20 |             if(a[i] == b[j])
      |                        ^
a.cc:21:16: error: 'dp' was not declared in this scope
   21 |                dp[i+1][j+1] = dp[i][j] + 1;
      |                ^~
a.cc:23:16: error: 'dp' was not declared in this scope
   23 |                dp[i+1][j+1] = max( dp[i][j+1], dp[i+1][j] );
      |                ^~
a.cc:23:31: error: 'max' was not declared in this scope
   23 |                dp[i+1][j+1] = max( dp[i][j+1], dp[i+1][j] );
      |                               ^~~
a.cc:26:15: error: 'dp' was not declared in this scope
   26 |       return( dp[alen][blen] );
      |               ^~