Language: C++

import java.util.Scanner;
  
class Recursion {
    static int[] aArrays = new int[20];
    public static int gIndex = 0;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            aArrays[i] = sc.nextInt();
            gIndex++;
        }
        int q = sc.nextInt();
        int[] mArrays = new int[200];
        int index = 0;
        for (int i = 0; i < q; i++) {
            mArrays[i] = sc.nextInt();
            index++;
        }
          
        for (int i = 0; i < index; i++) {
            if (isMatch(0, 0, mArrays[i])) {
                System.out.println("yes");
            } else {
                System.out.println("no");
            }
        }
          
    }
      
    public static boolean isMatch(int j, int S, int T) {
            if (S == T) {
                return true;
            }
            for (int i = j; i < gIndex; i++) {
                if (isMatch(i + 1, S + aArrays[i], T)) {
                    return true;
                }
            }
            return false;
        }
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:15: error: expected unqualified-id before '[' token
    4 |     static int[] aArrays = new int[20];
      |               ^
a.cc:5:11: error: expected ':' before 'static'
    5 |     public static int gIndex = 0;
      |           ^~~~~~~
      |           :
a.cc:5:23: error: ISO C++ forbids in-class initialization of non-const static member 'Recursion::gIndex'
    5 |     public static int gIndex = 0;
      |                       ^~~~~~
a.cc:6:11: error: expected ':' before 'static'
    6 |     public static void main(String[] args) {
      |           ^~~~~~~
      |           :
a.cc:6:29: error: 'String' has not been declared
    6 |     public static void main(String[] args) {
      |                             ^~~~~~
a.cc:6:38: error: expected ',' or '...' before 'args'
    6 |     public static void main(String[] args) {
      |                                      ^~~~
a.cc:31:11: error: expected ':' before 'static'
   31 |     public static boolean isMatch(int j, int S, int T) {
      |           ^~~~~~~
      |           :
a.cc:31:19: error: 'boolean' does not name a type; did you mean 'bool'?
   31 |     public static boolean isMatch(int j, int S, int T) {
      |                   ^~~~~~~
      |                   bool
a.cc:42:2: error: expected ';' after class definition
   42 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Recursion::main(int*)':
a.cc:7:9: error: 'Scanner' was not declared in this scope
    7 |         Scanner sc = new Scanner(System.in);
      |         ^~~~~~~
a.cc:8:17: error: 'sc' was not declared in this scope
    8 |         int n = sc.nextInt();
      |                 ^~
a.cc:10:13: error: 'aArrays' was not declared in this scope
   10 |             aArrays[i] = sc.nextInt();
      |             ^~~~~~~
a.cc:14:12: error: structured binding declaration cannot have type 'int'
   14 |         int[] mArrays = new int[200];
      |            ^~
a.cc:14:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:14:12: error: empty structured binding declaration
a.cc:14:15: error: expected initializer before 'mArrays'
   14 |         int[] mArrays = new int[200];
      |               ^~~~~~~
a.cc:17:13: error: 'mArrays' was not declared in this scope
   17 |             mArrays[i] = sc.nextInt();
      |             ^~~~~~~
a.cc:22:31: error: 'mArrays' was not declared in this scope
   22 |             if (isMatch(0, 0, mArrays[i])) {
      |                               ^~~~~~~
a.cc:22:17: error: 'isMatch' was not declared in this scope
   22 |             if (isMatch(0, 0, mArrays[i])) {
      |                 ^~~~~~~
a.cc:23:17: error: 'System' was not declared in this scope
   23 |                 System.out.println("yes");
      |                 ^~~~~~
a.cc:25:17: error: 'System' was not declared in this scope
   25 |                 System.out.println("no");
      |                 ^~~~~~