Language: C++

class Main{
    //directed graph
    List<Integer> adg[];
    Main(int n){
        adg = new LinkedList[n+1];
        for(int i = 0; i<=n; i++){
            adg[i] = new LinkedList<>();
        }
    }
    void addEdge(int index, int vertex){
        adg[index].add(vertex);
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        Maingraph = new Main(n);
        for(int i = 0; i<n; i++){
            int index = in.nextInt();
            int m = in.nextInt();
            for(int j = 0; j<m; j++){
                int temp = in.nextInt();
                graph.addEdge(index,temp);
            }
        }
        //change to matrix
        int[][] matrix = new int[n+1][n+1];
        for(int i = 1; i<=n; i++){
            if(graph.adg[i].size()!=0) {
                for (int c : graph.adg[i]) {
                    matrix[i][c] = 1;
                }
            }
        }
        for(int i = 1; i<=n; i++){
            for(int j = 1; j<=n; j++){
                if(j!=n) System.out.print(matrix[i][j]+ " ");
                else System.out.print(matrix[i][j]);
            }
            System.out.println();
        }

    }
}


Compiler output:
a.cc:3:5: error: 'List' does not name a type
    3 |     List<Integer> adg[];
      |     ^~~~
a.cc:14:11: error: expected ':' before 'static'
   14 |     public static void main(String[] args) {
      |           ^~~~~~~
      |           :
a.cc:14:29: error: 'String' has not been declared
   14 |     public static void main(String[] args) {
      |                             ^~~~~~
a.cc:14:38: error: expected ',' or '...' before 'args'
   14 |     public static void main(String[] args) {
      |                                      ^~~~
a.cc:44:2: error: expected ';' after class definition
   44 | }
      |  ^
      |  ;
a.cc: In constructor 'Main::Main(int)':
a.cc:5:9: error: 'adg' was not declared in this scope
    5 |         adg = new LinkedList[n+1];
      |         ^~~
a.cc:5:19: error: 'LinkedList' does not name a type
    5 |         adg = new LinkedList[n+1];
      |                   ^~~~~~~~~~
a.cc:7:26: error: 'LinkedList' does not name a type
    7 |             adg[i] = new LinkedList<>();
      |                          ^~~~~~~~~~
a.cc:7:37: error: expected primary-expression before '>' token
    7 |             adg[i] = new LinkedList<>();
      |                                     ^
a.cc:7:39: error: expected primary-expression before ')' token
    7 |             adg[i] = new LinkedList<>();
      |                                       ^
a.cc: In member function 'void Main::addEdge(int, int)':
a.cc:11:9: error: 'adg' was not declared in this scope
   11 |         adg[index].add(vertex);
      |         ^~~
a.cc: In static member function 'static void Main::main(int*)':
a.cc:15:9: error: 'Scanner' was not declared in this scope
   15 |         Scanner in = new Scanner(System.in);
      |         ^~~~~~~
a.cc:16:17: error: 'in' was not declared in this scope; did you mean 'int'?
   16 |         int n = in.nextInt();
      |                 ^~
      |                 int
a.cc:17:9: error: 'Maingraph' was not declared in this scope
   17 |         Maingraph = new Main(n);
      |         ^~~~~~~~~
a.cc:23:17: error: 'graph' was not declared in this scope
   23 |                 graph.addEdge(index,temp);
      |                 ^~~~~
a.cc:27:12: error: structured binding declaration cannot have type 'int'
   27 |         int[][] matrix = new int[n+1][n+1];
      |            ^~
a.cc:27:12: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:27:12: error: empty structured binding declaration
a.cc:27:14: error: expected initializer before '[' token
   27 |         int[][] matrix = new int[n+1][n+1];
      |              ^
a.cc:29:16: error: 'graph' was not declared in this scope
   29 |             if(graph.adg[i].size()!=0) {
      |                ^~~~~
a.cc:31:21: error: 'matrix' was not declared in this scope
   31 |                     matrix[i][c] = 1;
      |                     ^~~~~~
a.cc:37:26: error: 'System' was not declared in this scope
   37 |                 if(j!=n) System.out.print(matrix[i][j]+ " ");
      |                          ^~~~~~
a.cc:37:43: error: 'matrix' was not declared in this scope
   37 |                 if(j!=n) System.out.print(matrix[i][j]+ " ");
      |                                           ^~~~~~
a.cc:38:22: error: 'System' was not declared in this scope
   38 |                 else System.out.print(matrix[i][j]);
      |                      ^~~~~~
a.cc:38:39: error: 'matrix' was not declared in this scope
   38 |                 else System.out.print(matrix[i][j]);
      |                                       ^~~~~~
a.cc:40:13: error: 'System' was not declared in this scope
   40 |             System.out.println();
      |             ^~~~~~