criyle/codenet-compile-errors huggingface dataset:
Language: Java

#include <stdio.h>
#include <stdlib.h>
#define N 100005
#define NIL -1
typedef struct node{
  int parent;
  int right;
  int left;
}Node;

Node T[N];
int n,D[N];

void print(int);

int main()
{
  int i,j,d,v,c,l,r;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].parent = T[i].right = T[i].left = NIL;
  }

  for(i=0;i<n;i++){
    scanf("%d%d",&v,&d);
    for(j=0;j<d;j++){
      scanf("%d",&c);
      if(j==0){
	T[v].left=c;
      }
      else T[l].right=c;
      l=c;
      T[c].parent=v;
    }
  }

  for(i=0;i<n;i++){
    if(T[i].parent==NIL){
      r=i;
    }
  }

  rec(r,0);

  for(i=0;i<n;i++){
    print(i);
  }
 
  return 0;
  
}

void print(int a){
  int i,c;
  printf("node %d: ",a);
  printf("parent = %d,  ",T[a].parent);
  printf("depth = %d,  ",D[a]);

  if(T[a].parent==NIL) printf("root, ");
  else if(T[a].left==NIL) printf("leaf, ");
  else printf("internal node, ");

  printf("[");
  for(i=0, c=T[a].left; c != NIL; i++, c=T[c].right){
    if(i) printf(", ");
    printf("%d",c);
  }

  printf("]\n");
  
}

int rec(int u,int p){
  D[u] = p;
  if(T[u].right != NIL) rec(T[u].right,p);
  if(T[u].left != NIL) rec(T[u].left,p+1);
}





Compiler output:
Main.java:1: error: illegal character: '#'
#include <stdio.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <stdio.h>
         ^
Main.java:2: error: illegal character: '#'
#include <stdlib.h>
^
Main.java:3: error: illegal character: '#'
#define N 100005
^
Main.java:4: error: illegal character: '#'
#define NIL -1
^
Main.java:7: error: unnamed classes are a preview feature and are disabled by default.
  int right;
  ^
  (use --enable-preview to enable unnamed classes)
Main.java:9: error: class, interface, enum, or record expected
}Node;
^
Main.java:11: error: class, interface, enum, or record expected
Node T[N];
^
Main.java:12: error: class, interface, enum, or record expected
int n,D[N];
^
Main.java:14: error: <identifier> expected
void print(int);
              ^
Main.java:20: error: illegal start of expression
  scanf("%d",&n);
             ^
Main.java:26: error: illegal start of expression
    scanf("%d%d",&v,&d);
                 ^
Main.java:26: error: illegal start of expression
    scanf("%d%d",&v,&d);
                    ^
Main.java:28: error: illegal start of expression
      scanf("%d",&c);
                 ^
14 errors
Language: Java

import java.util.Scanner;
public class A {
static Scanner s = new Scanner(System.in);
public static void main(String[] args) {
	int n = s.nextInt();
	Node[] nodes = new Node[n];
	StringBuilder sb = new StringBuilder();

	for(int i = 0;i < n;i++) {
		nodes[i] = new Node(i);
	}
	for(int i = 0;i < n;i++) {
		Node node = nodes[s.nextInt()];
		int k = s.nextInt();
		if(k > 0) {
			Node[] c = new Node[k];
			for(int j = 0;j < k;j++) {
				c[j] = nodes[s.nextInt()];
			}
			node.setCP(c);
		}
	}

	Node root = null;
	for(int i = 0;i < n;i++) {
	if(nodes[i].parent == null) {
		root = nodes[i];
		break;
	}
	}
	root.setDepth(0);
	for(int i = 0;i < n;i++) {
	sb.append("node " + i + ": parent = ");
	if(nodes[i].parent == null) {
		sb.append(-1);
	}else {
		sb.append(nodes[i].parent.id);
	}
	sb.append(", depth = " + nodes[i].dep + ", ");
	if(nodes[i].parent == null) {
		sb.append("root");
	}else {
		if(nodes[i].children == null) {
			sb.append("leaf");
		}else {
			sb.append("internal node");
		}
	}
	sb.append(", [");
	if(nodes[i].children != null) {
		for(int j = 0;j < nodes[i].children.length;j++) {
			sb.append(nodes[i].children[j].id);
			if(j == nodes[i].children.length-1) {
			sb.append("]");
			}else {
				sb.append(",");
			}
		}
	}else {
		sb.append("]");
	}
	sb.append("\n\r");
	}

	System.out.println(sb.toString());
	}
}

class Node{
	public int id;
	public int dep;
	public Node parent;
	public Node[] children;

	public Node(int id) {
	this.id = id;
	}

	void setCP(Node[] child) {
		this.children = child;
		for(int i = 0;i < children.length;i++) {
		this.children[i].parent = this;
		}
	}
	void setDepth(int d) {
		this.dep = d;
		if(this.children != null) {
		for(int i = 0;i < children.length;i++) {
			this.children[i].setDepth(d + 1);
		}
		}
	}


}


Compiler output:
Main.java:2: error: class A is public, should be declared in a file named A.java
public class A {
       ^
1 error
Language: Java

# coding=utf-8
def setDepth(index, Tree):
    if Tree[index][1] == -1:
        Tree[index][2] = 0
    else :
        Tree[index][2] = 1 + Tree[ Tree[index][1] ][2]
    for i in Tree[index][4]:
        setDepth(i, Tree)

def main():
    # データ入力
    n = int( input() )
    Tree = [] # 0=>n-1まで, [id, parent, depth, type, [child]]
    for i in range(n):
        Tree.append([0, -1, 0, "root", []])

    tmp = []
    for i in range(n):
        tmp = [int(x) for x in input().split()] # [Node, num, 子1, 子2, ...]
        Tree[tmp[0]][0] = tmp[0]
        Tree[tmp[0]][4] = tmp[2: 2+tmp[1] ]

    for i in range(n):
        for j in Tree[i][4]:
            Tree[j][1] = j # parentを代入

    # typeを求める
    for i in range(n):
        if Tree[i][1] == -1:
            root = i
            Tree[i][3] = "root"
        elif Tree[i][4] == []:
            Tree[i][3] = "leaf"
        else :
            Tree[i][3] = "internal node"

    setDepth(root, Tree)

    for i in range(n):
        print("node :" + str( Tree[i][0] ), end = " " )
        print("parent = " + str( Tree[i][1] ), end = ", " )
        print("depth = " + str( Tree[i][2] ), end = ", " )
        print( Tree[i][3], end = ", " )
        print("[", end="")
        length = len( Tree[i][4] )
        for j in Tree[i][4][0: length - 1]:
            print(str(j), end=", ")
        if length > 0:
            print( str(Tree[i][4][length-1]) , end="")
        print("]")

if __name__ == '__main__':
    main()



Compiler output:
Main.java:1: error: illegal character: '#'
# coding=utf-8
^
Main.java:1: error: class, interface, enum, or record expected
# coding=utf-8
        ^
Main.java:11: error: illegal character: '#'
    # ?????
    ^
Main.java:13: error: illegal character: '#'
    Tree = [] # 0=>n-1??, [id, parent, depth, type, [child]]
              ^
Main.java:19: error: illegal character: '#'
        tmp = [int(x) for x in input().split()] # [Node, num, ?1, ?2, ...]
                                                ^
Main.java:25: error: illegal character: '#'
            Tree[j][1] = j # parent???
                           ^
Main.java:27: error: illegal character: '#'
    # type????
    ^
Main.java:52: error: unclosed character literal
if __name__ == '__main__':
               ^
Main.java:52: error: unclosed character literal
if __name__ == '__main__':
                        ^
9 errors
Language: Java


import java.util.*;

/**
 * A_
 */
public class A_ {

    public static void main(String[] args) {
        run();
    }

    public static void run() {
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        //node set
        Node[] node = new Node[n];
        boolean[] root = new boolean[n];

        Arrays.fill(root, true);

        for(int i=0; i<n; i++) {

            int id = sc.nextInt();
            int k = sc.nextInt();
            int[] c = new int[k];

            for(int j=0; j<k; j++) {

                c[j] = sc.nextInt();
                root[c[j]] = false;

            }

            node[id] = new Node(c);

        }

        for(int i=0; i<n; i++) {

            if(root[i]) {
                make(node, i, -1, 0);
            }

        }

        export(node, n);
        sc.close();

    }

    public static void make(Node[] nodes, int id, int parent, int depth) {

        StringBuilder sb = new StringBuilder();

        sb.append("node ").append(id).append(": parent = ").append(parent).append(", depth = ").append(depth).append(", ");
        if(parent == -1) {
            sb.append("root");
        } else if(nodes[id].c.length == 0) {
            sb.append("leaf");
        } else {
            sb.append("internal node");
        }
        sb.append(", [");
        for(int i=0; i < nodes[id].c.length; i++) {

            sb.append(nodes[id].c[i]);
            if(i != nodes[id].c.length-1) {
                sb.append(", ");
            }
            make(nodes, nodes[id].c[i], id, depth+1);

        }
        sb.append("]");
        nodes[id].tree = sb.toString();

    }

    public static void export(Node[] node, int n) {

        StringBuilder sb = new StringBuilder();
        for(int i=0; i<n; i++) {
            sb.append(node[i].tree).append("\n");
            if(i == n-1) {
                sb.append(node[i].tree)
            }
        }
        System.out.println(sb);

    }

}

class Node {

    public int[] c;
    public String tree; //retain tree information
    public Node(int[] c) {
        this.c = c;
    }

}



Compiler output:
Main.java:87: error: ';' expected
                sb.append(node[i].tree)
                                       ^
1 error
Language: Java


import java.util.*;

/**
 * A_
 */
public class Main {

    public static void main(String[] args) {
        run();
    }

    public static void run() {
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        //node set
        Node[] node = new Node[n];
        boolean[] root = new boolean[n];

        Arrays.fill(root, true);

        for(int i=0; i<n; i++) {

            int id = sc.nextInt();
            int k = sc.nextInt();
            int[] c = new int[k];

            for(int j=0; j<k; j++) {

                c[j] = sc.nextInt();
                root[c[j]] = false;

            }

            node[id] = new Node(c);

        }

        for(int i=0; i<n; i++) {

            if(root[i]) {
                make(node, i, -1, 0);
            }

        }

        export(node, n);
        sc.close();

    }

    public static void make(Node[] nodes, int id, int parent, int depth) {

        StringBuilder sb = new StringBuilder();

        sb.append("node ").append(id).append(": parent = ").append(parent).append(", depth = ").append(depth).append(", ");
        if(parent == -1) {
            sb.append("root");
        } else if(nodes[id].c.length == 0) {
            sb.append("leaf");
        } else {
            sb.append("internal node");
        }
        sb.append(", [");
        for(int i=0; i < nodes[id].c.length; i++) {

            sb.append(nodes[id].c[i]);
            if(i != nodes[id].c.length-1) {
                sb.append(", ");
            }
            make(nodes, nodes[id].c[i], id, depth+1);

        }
        sb.append("]");
        nodes[id].tree = sb.toString();

    }

    public static void export(Node[] node, int n) {

        StringBuilder sb = new StringBuilder();
        for(int i=0; i<n; i++) {
            sb.append(node[i].tree).append("\n");
            if(i == n-1) {
                sb.append(node[i].tree)
            }
        }
        System.out.println(sb);

    }

}

class Node {

    public int[] c;
    public String tree; //retain tree information
    public Node(int[] c) {
        this.c = c;
    }

}



Compiler output:
Main.java:87: error: ';' expected
                sb.append(node[i].tree)
                                       ^
1 error
Language: Java

import java.util.NoSuchElementException;
import java.util.Scanner;
import java.util.stream.Stream;

public class RootedTrees{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            int n = Integer.parseInt(sc.nextLine());
            Node[] ns = new Node[n];
            for (int i = 0; i < n; i++) {
                ns[i] = new Node();
            }
            while (sc.hasNext()) {
                int[] id_k_cs = Stream.of(sc.nextLine().split(" "))
                        .mapToInt(Integer::parseInt)
                        .toArray();
                int id = id_k_cs[0];
                if (id_k_cs.length > 2) {
                    ns[id].left = id_k_cs[2];
                }
                for (int j = 2; j < id_k_cs.length; j++) {
                    ns[id_k_cs[j]].parent = id_k_cs[0];
                    if (j != id_k_cs.length - 1) {
                        ns[id_k_cs[j]].right = id_k_cs[j + 1];
                    }
                }
            }
            for (int i = 0; i < ns.length; i++) {
                int parent = ns[i].parent == null ? -1 : ns[i].parent;
                int depth = getDepth(ns, i);
                String type = getType(ns[i]);
                String cs = getChildren(ns, i);
                System.out.printf(
                        "node %d: parent = %d, depth = %d, %s, %s\n",
                        i,
                        parent,
                        depth,
                        type,
                        cs);
            }
        } catch (NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        }
    }

    private static class Node {
        Node() {}
        Integer parent;
        Integer left;
        Integer right;
    }

    private static int getDepth(Node[] ns, int id) {
        int depth = 0;
        Node node = ns[id];
        while (node.parent != null) {
            depth++;
            node = ns[node.parent];
        }
        return depth;
    }

    private static String getType(Node n) {
        if (n.parent == null) {
            return "root";
        }
        if (n.left == null) {
            return "leaf";
        }
        return "internal node";
    }

    private static String getChildren(Node[] ns, int id) {
//        StringJoiner sj = new StringJoiner(", ", "[", "]");
        String children = "[";
        Integer cid = ns[id].left;
        if (cid == null) {
            children += "]";
//            return sj.toString();
            return children;
        }
        Node c = ns[ns[id].left];
//        sj.add(cid.toString());
        children += cid.toString();
        while (c.right != null) {
//            sj.add(c.right.toString());
            children += ", " + c.right.toString();
            c = ns[c.right];
        }
        children += "]";
        return children;
    }
}



Compiler output:
Main.java:5: error: class RootedTrees is public, should be declared in a file named RootedTrees.java
public class RootedTrees{
       ^
1 error
Language: Java


import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

import lombok.Data;

public class Main {

	public static void main(String[] args) {
		new Main().run();
	}

	private void run() {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		Node[] T = new Node[n];

		for (int i = 0; i < n; i++) {
			T[i] = new Node();
		}
		int l = 0;
		for (int i = 0; i < n; i++) {
			int v = scanner.nextInt();
			T[v].id = v;
			int d = scanner.nextInt();
			for (int j = 0; j < d; j++) {
				int c = scanner.nextInt();

				if (j == 0) {
					T[v].l = c;
				} else {
					T[l].r = c;
				}
				l = c;
				T[c].p = v;
			}
		}
		int r = -1;
		for (int i = 0; i < n; i++) {
			if (T[i].p == -1) {
				r = i;
				break;
			}
		}
		int[] D = new int[n];
		rec(r, 0, D, T);
		StringBuilder builder = new StringBuilder();
		for (int i = 0; i < n; i++) {
			print(i, T, D, builder);
		}
		System.out.print(builder);
	}

	private void print(int u, Node[] T, int[] D, StringBuilder builder) {
		builder.append("node ").append(u).append(": parent = ").append(T[u].p)
				.append(", depth = ").append(D[u]).append(", ");
		if (T[u].p == -1)
			builder.append("root, ");
		else if (T[u].l == -1)
			builder.append("leaf, ");
		else
			builder.append("internal node, ");
		builder.append("[");
		for (int i = 0, c = T[u].l; c != -1; i++, c = T[c].r) {
			if (i != 0)
				builder.append(", ");
			builder.append(c);
		}
		builder.append("]\n");
	}

	private void rec(int u, int p, int[] D, Node[] T) {
		Deque<Node> deque = new ArrayDeque<Node>();
		deque.offer(T[u]);
		while (!deque.isEmpty()) {
			int t = deque.size();
			for (int i = 0; i < t; i++) {
				Node node = deque.poll();
				D[node.id] = p;
				if (node.l != -1) {
					node = T[node.l];
					while (true) {
						deque.offer(T[node.id]);
						if (node.r != -1) {
							node = T[node.r];
						} else {
							break;
						}
					}
				}
			}
			p++;
		}
	}

	
	class Node {
		int id = -1;
		int p = -1;
		int l = -1;
		int r = -1;
	}
}

Compiler output:
Main.java:6: error: package lombok does not exist
import lombok.Data;
             ^
1 error
Language: Java

import java.io*;
import java.util.Arrays;
import java.util.StringTokenizer;

class Main{

static final PrintWriter out=new PrintWriter(System.out);
static boolean[] hasParent;

static class Node{
int id;
int p;
int rank;
int k;
int[] c;
String type;
Node(int id){
this.id=id; this.p=-1; this.rank=-1; this.type="";
}
}

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputSreamReader(System.in));
int n=Integer.parseInt(br.readLine());
Node[] ns=new Node[n];
hasParent=new boolean[n];
for(int i=0;i<n;i++){
ns[i]=new Node(i);
}
for(int i=0;i<n;i++){
StringTokenizer st=new StringTokenizer(br.readLine());
int id=Integer.parseInt(st.nextToken());
Node n=ns[id];
int k=Integer.parseInt(st.nextToken());
n.k=k;
if(k==0) n.type="leaf";
else{
n.c=new int[k];
for(int i=0;i<k;i++){
int c=Integer.parseInt(st.nextToken());
n.c[i]=c;
ns[c].p=id;
hasParent[c]=true;
if(!"leaf".equals(ns[c].type)) ns[now].type="internal node";
}
Arrays.sort(ns.c);
}
}
for(int i=0;i<n;i++){
if(ns[i].rank<0) ns[i].rank=setRank(i,ns);
}
for(int i=0;i<n;i++){
Node an=ns[i];
StringBuilder sb=new StringBuider();
sb.append("node ");
sb.append(i);
sb.append(": parent = ");
sb.append(an.p);
sb.append(", depth = ");
sb.append(an.rank);
sb.append(", root, [");
if(an.k!=0){
for(int j=0;j<an.k;j++) sb.append((j==an.k-1)?an.c[j]:an.c[j]+",");
sb.append("]");
sb.append(System.getProperty("line.separator"));
out.println(sb);
}
out.flush();
}

privte static int setRank(int now,Node[] ns){
if(!hasParent[now]){
ns[now].type="root";
return ns[now].rank=0;
}
return ns[now].rank=setRank(ns[now].p,ns)+1;
}
}

Compiler output:
Main.java:1: error: ';' expected
import java.io*;
              ^
Main.java:71: error: not a statement
privte static int setRank(int now,Node[] ns){
^
Main.java:71: error: ';' expected
privte static int setRank(int now,Node[] ns){
      ^
Main.java:71: error: illegal start of expression
privte static int setRank(int now,Node[] ns){
       ^
4 errors
Language: Java

import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

class Main{

static final PrintWriter out=new PrintWriter(System.out);
static boolean[] hasParent;

static class Node{
int id;
int p;
int rank;
int k;
int[] c;
String type;
Node(int id){
this.id=id; this.p=-1; this.rank=-1; this.type="";
}
}

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputSreamReader(System.in));
int n=Integer.parseInt(br.readLine());
Node[] ns=new Node[n];
hasParent=new boolean[n];
for(int i=0;i<n;i++){
ns[i]=new Node(i);
}
for(int i=0;i<n;i++){
StringTokenizer st=new StringTokenizer(br.readLine());
int id=Integer.parseInt(st.nextToken());
Node n=ns[id];
int k=Integer.parseInt(st.nextToken());
n.k=k;
if(k==0) n.type="leaf";
else{
n.c=new int[k];
for(int j=0;j<k;j++){
int c=Integer.parseInt(st.nextToken());
n.c[j]=c;
ns[c].p=id;
hasParent[c]=true;
if(!"leaf".equals(ns[c].type)) ns[now].type="internal node";
}
Arrays.sort(ns.c);
}
}
for(int i=0;i<n;i++){
if(ns[i].rank<0) ns[i].rank=setRank(i,ns);
}
for(int i=0;i<n;i++){
Node an=ns[i];
StringBuilder sb=new StringBuider();
sb.append("node ");
sb.append(i);
sb.append(": parent = ");
sb.append(an.p);
sb.append(", depth = ");
sb.append(an.rank);
sb.append(", root, [");
if(an.k!=0){
for(int j=0;j<an.k;j++) sb.append((j==an.k-1)?an.c[j]:an.c[j]+",");
}
sb.append("]");
sb.append(System.getProperty("line.separator"));
out.println(sb);
}
out.flush();
}

private static int setRank(int now,Node[] ns){
if(!hasParent[now]){
ns[now].type="root";
return ns[now].rank=0;
}
return ns[now].rank=setRank(ns[now].p,ns)+1;
}
}

Compiler output:
Main.java:23: error: cannot find symbol
BufferedReader br=new BufferedReader(new InputSreamReader(System.in));
                                         ^
  symbol:   class InputSreamReader
  location: class Main
Main.java:33: error: variable n is already defined in method main(String[])
Node n=ns[id];
     ^
Main.java:44: error: cannot find symbol
if(!"leaf".equals(ns[c].type)) ns[now].type="internal node";
                                  ^
  symbol:   variable now
  location: class Main
Main.java:46: error: cannot find symbol
Arrays.sort(ns.c);
              ^
  symbol:   variable c
  location: variable ns of type Node[]
Main.java:54: error: cannot find symbol
StringBuilder sb=new StringBuider();
                     ^
  symbol:   class StringBuider
  location: class Main
5 errors
Language: Java

import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

class Main{

static final PrintWriter out=new PrintWriter(System.out);
static boolean[] hasParent;

static class Node{
int id;
int p;
int rank;
int k;
int[] c;
String type;
Node(int id){
this.id=id; this.p=-1; this.rank=-1; this.type="";
}
}

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int num=Integer.parseInt(br.readLine());
Node[] ns=new Node[num];
hasParent=new boolean[num];
for(int i=0;i<num;i++){
ns[i]=new Node(i);
}
for(int i=0;i<num;i++){
StringTokenizer st=new StringTokenizer(br.readLine());
int id=Integer.parseInt(st.nextToken());
Node n=ns[id];
int k=Integer.parseInt(st.nextToken());
n.k=k;
if(k==0) n.type="leaf";
else{
n.c=new int[k];
for(int j=0;j<k;j++){
int c=Integer.parseInt(st.nextToken());
n.c[j]=c;
ns[c].p=id;
hasParent[c]=true;
if(!"leaf".equals(ns[c].type)) ns[c].type="internal node";
}
Arrays.sort(ns.c);
}
}
for(int i=0;i<num;i++){
if(ns[i].rank<0) ns[i].rank=setRank(i,ns);
}
for(int i=0;i<num;i++){
Node an=ns[i];
StringBuilder sb=new StringBuider();
sb.append("node ");
sb.append(i);
sb.append(": parent = ");
sb.append(an.p);
sb.append(", depth = ");
sb.append(an.rank);
sb.append(", root, [");
if(an.k!=0){
for(int j=0;j<an.k;j++) sb.append((j==an.k-1)?an.c[j]:an.c[j]+",");
}
sb.append("]");
sb.append(System.getProperty("line.separator"));
out.println(sb);
}
out.flush();
}

private static int setRank(int now,Node[] ns){
if(!hasParent[now]){
ns[now].type="root";
return ns[now].rank=0;
}
return ns[now].rank=setRank(ns[now].p,ns)+1;
}
}

Compiler output:
Main.java:46: error: cannot find symbol
Arrays.sort(ns.c);
              ^
  symbol:   variable c
  location: variable ns of type Node[]
Main.java:54: error: cannot find symbol
StringBuilder sb=new StringBuider();
                     ^
  symbol:   class StringBuider
  location: class Main
2 errors
Language: Java

import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		new Main.solve();
	}

	void solve() {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();// the number of nodes
		Rooted_tree rt = new Rooted_tree(n);
		for (int i = 0; i < n; i++) {
			int id = sc.nextInt();
			int k = sc.nextInt();
			int l = -1;
			for (int j = 0; j < k; j++) {
				if (j == 0) {
					rt.T[id].left = sc.nextInt();
					l = rt.T[id].left;
					rt.T[l].parent = id;
				} else {
					rt.T[l].right = sc.nextInt();
					l = rt.T[l].right;
					rt.T[l].parent = id;
				}
			}
		}
		int root = -1;
		for (int i = 0; i < n; i++) {
			if (rt.T[i].parent == -1)
				root = i;
		}
		rt.setDepth(root, 0);
		for (int i = 0; i < n; i++) {
			System.out.print("node " + i + ": parent = " + rt.T[i].parent + ", depth = " + rt.D[i] + ", ");
			if (rt.T[i].parent == -1)
				System.out.print("root,");
			else if (rt.T[i].left == -1)
				System.out.print("leaf,");
			else
				System.out.print("internal node,");
			System.out.print(" [");
			int u = rt.T[i].left;
			while (u != -1) {
				System.out.print(u);
				u = rt.T[u].right;
				if (u != -1) {
					System.out.print(", ");
				}
			}
			System.out.println("]");
		}
	}

	class Rooted_tree {
		int NIL = -1;
		Node[] T;
		int[] D;

		// n is the number of vertex
		Rooted_tree(int n) {
			T = new Node[n];
			for (int i = 0; i < n; i++) {
				T[i] = new Node();
			}
			D = new int[n];
		}

		// ????????\????????±???????±??????????
		int getDepth(int u) {
			int d = 0;
			while (T[u].parent != NIL) {
				u = T[u].parent;
				d++;
			}
			return d;
		}

		// ??¨?????¨????????\????????±???????±??????????
		// u???root
		void setDepth(int u, int p) {
			D[u] = p;
			if (T[u].right != NIL) {
				setDepth(T[u].right, p);
			}
			if (T[u].left != NIL) {
				setDepth(T[u].left, p + 1);
			}
		}

		// ????????????????????¨??????
		void printChildren(int u) {
			int c = T[u].left;
			while (c != NIL) {
				System.out.println(c);
				c = T[c].right;
			}
		}

		class Node {
			int parent = NIL, left = NIL, right = NIL;

			Node() {
			}

			Node(int parent, int left, int right) {
				this.parent = parent;
				this.left = left;
				this.right = right;
			}
		}
	}
}

Compiler output:
Main.java:5: error: cannot find symbol
		new Main.solve();
		        ^
  symbol:   class solve
  location: class Main
1 error
Language: Java

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class RootedTrees {

	Node[] nodes;

	private static class Node{

		int parent;
		int childSize;
		int[] children;
	}

	public void solve() {
		int n = nextInt();

		nodes = new Node[n];

		for(int i = 0;i < n;i++){
			nodes[i] = new Node();
			nodes[i].parent = -1;
		}

		for(int i = 0;i < n;i++){
			int id = nextInt();
			int k = nextInt();

			nodes[id].childSize = k;

			nodes[id].children = new int[k];

			for(int j = 0;j < k;j++){
				int c = nextInt();
				nodes[id].children[j] = c;
				nodes[c].parent = id;
			}
		}

		for(int i = 0;i < n;i++){
			out.print("node " + i + ": ");
			out.print("parent = " + nodes[i].parent + ", ");
			int depth = 0;
			int parent = nodes[i].parent;
			while(parent != -1){
				parent = nodes[parent].parent;
				depth++;
			}

			out.print("depth = " + depth + ", ");

			if(nodes[i].parent == - 1){
				out.print("root, ");
			}else if(nodes[i].childSize == 0){
				out.print("leaf, ");
			}else{
				out.print("internal node, ");
			}

			out.print("[");
			for(int c = 0;c < nodes[i].childSize;c++){
				if(c != 0)out.print(", ");
				out.print(nodes[i].children[c]);
			}
			out.println("]");
		}

		out.println();

	}

	public static void main(String[] args) {
		out.flush();
		new RootedTrees().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

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

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

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

Compiler output:
Main.java:6: error: class RootedTrees is public, should be declared in a file named RootedTrees.java
public class RootedTrees {
       ^
1 error
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

public class Main2 {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuffer sb = new StringBuffer();
		int n = Integer.parseInt(br.readLine());
		//?????¨????????¢???????????????????????§????????????
		//Map<?????????????????????, ?????????????????????> ????????????????????????????????§?????????????????????????????¨??????
		Map<Integer, Integer> parentMap = new HashMap<Integer, Integer>();
		Map<Integer, Integer> depthMap = new HashMap<Integer, Integer>();
		int depth = 0;
		
		for(int i = 0; i < n; i++){
			String[] str = br.readLine().split(" ");
			//root?????????
			if(i == 0){
				int node = Integer.parseInt(str[0]);
				int m = Integer.parseInt(str[1]);
				int k = 2;
				sb.append("node " + node + ": parent = -1" + ", depth = 0" + ", root, [");
				for(int j = 0; j < m; j++){
					parentMap.put(Integer.parseInt(str[k]), node);
					depthMap.put(Integer.parseInt(str[k]), (depth + 1));
					if(j == m - 1){
						sb.append(Integer.parseInt(str[k]) + "]" + "\n");
						break;
					}
					sb.append(Integer.parseInt(str[k]) + ",");
					k++;
				}
			} else if(str.length != 2){
				int node = Integer.parseInt(str[0]);
				int m = Integer.parseInt(str[1]);
				int k = 2;
				sb.append("node " + node + ": parent = " +  parentMap.get(node) +  ", depth = " + depthMap.get(node) + ", internal node, [");
				for(int j = 0; j < m; j++){
					parentMap.put(Integer.parseInt(str[k]), node);
					depthMap.put(Integer.parseInt(str[k]), (depthMap.get(node) + 1));
					if(j == m - 1){
						sb.append(Integer.parseInt(str[k]) + "]" + "\n");
						break;
					}
					sb.append(Integer.parseInt(str[k]) + ",");
					k++;
				}
			} else{
				int node = Integer.parseInt(str[0]);
				sb.append("node " + node + ": parent = " +  parentMap.get(node) +  ", depth = " + depthMap.get(node) + ", leaf, []" + "\n");
			}
		}
		System.out.print(sb.toString());
	}
}
 

Compiler output:
Main.java:7: error: class Main2 is public, should be declared in a file named Main2.java
public class Main2 {
       ^
1 error
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

import org.junit.Test;

//Main????????????test????°?????????????????????????????????£????????????version
//main?????§??????????????£??????????????????????????????(method)??????????????????????????????(StringBuffer)?????????????????????????????£

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuffer ans = method(br);
		System.out.print(ans);
	}

	@Test
	public static StringBuffer method(BufferedReader br) throws IOException {

		int n = Integer.parseInt(br.readLine());
		StringBuffer ans = new StringBuffer();

		Map<Integer, Integer> parentMap = new HashMap<Integer, Integer>();
		Map<Integer, Integer> depthMap = new HashMap<Integer, Integer>();
		Map<Integer, StringBuffer> stringMap = new HashMap<Integer, StringBuffer>();

		int depth = 0;

		for (int i = 0; i < n; i++) {
			String[] str = br.readLine().split(" ");
			if (i == 0) {
				if (n == 1) {
					ans.append("node " + 0 + ": parent = " + -1 + ", depth = " + 0 + ", root, []" + "\n");
					break;
				}
				StringBuffer sb = new StringBuffer();
				int node = Integer.parseInt(str[0]);
				int m = Integer.parseInt(str[1]);
				int k = 2;
				sb.append("node " + node + ": parent = " + -1 + ", depth = " + 0 + ", root, [");

				for (int j = 0; j < m; j++) {
					parentMap.put(Integer.parseInt(str[k]), node);
					depthMap.put(Integer.parseInt(str[k]), (depth + 1));
					if (j == m - 1) {
						sb.append(Integer.parseInt(str[k]) + "]" + "\n");
						stringMap.put(node, sb);
						break;
					}
					sb.append(Integer.parseInt(str[k]) + ", ");
					k++;
				}
			} else if (str.length != 2) {
				StringBuffer sb = new StringBuffer();
				int node = Integer.parseInt(str[0]);
				int m = Integer.parseInt(str[1]);
				int k = 2;
				sb.append("node " + node + ": parent = " + parentMap.get(node) + ", depth = " + depthMap.get(node)
						+ ", internal node, [");
				for (int j = 0; j < m; j++) {
					parentMap.put(Integer.parseInt(str[k]), node);
					depthMap.put(Integer.parseInt(str[k]), (depthMap.get(node) + 1));
					if (j == m - 1) {
						sb.append(Integer.parseInt(str[k]) + "]" + "\n");
						stringMap.put(node, sb);
						break;
					}
					sb.append(Integer.parseInt(str[k]) + ", ");
					k++;
				}
			} else {
				StringBuffer sb = new StringBuffer();
				int node = Integer.parseInt(str[0]);
				sb.append("node " + node + ": parent = " + parentMap.get(node) + ", depth = " + depthMap.get(node)
						+ ", leaf, []" + "\n");
				stringMap.put(node, sb);
			}
		}
		if (n != 1) {
			for (int i = 0; i < n; i++) {
				ans.append(stringMap.get(i));
			}
		}
		return ans;
	}
}

Compiler output:
Main.java:7: error: package org.junit does not exist
import org.junit.Test;
                ^
Main.java:19: error: cannot find symbol
	@Test
	 ^
  symbol:   class Test
  location: class Main
2 errors
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

import org.junit.Test;

//Main????????????test????°?????????????????????????????????£????????????version
//main?????§??????????????£??????????????????????????????(method)??????????????????????????????(StringBuffer)?????????????????????????????£

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuffer ans = method(br);
		System.out.print(ans);
	}


	public static StringBuffer method(BufferedReader br) throws IOException {

		int n = Integer.parseInt(br.readLine());
		StringBuffer ans = new StringBuffer();

		Map<Integer, Integer> parentMap = new HashMap<Integer, Integer>();
		Map<Integer, Integer> depthMap = new HashMap<Integer, Integer>();
		Map<Integer, StringBuffer> stringMap = new HashMap<Integer, StringBuffer>();

		int depth = 0;

		for (int i = 0; i < n; i++) {
			String[] str = br.readLine().split(" ");
			if (i == 0) {
				if (n == 1) {
					ans.append("node " + 0 + ": parent = " + -1 + ", depth = " + 0 + ", root, []" + "\n");
					break;
				}
				StringBuffer sb = new StringBuffer();
				int node = Integer.parseInt(str[0]);
				int m = Integer.parseInt(str[1]);
				int k = 2;
				sb.append("node " + node + ": parent = " + -1 + ", depth = " + 0 + ", root, [");

				for (int j = 0; j < m; j++) {
					parentMap.put(Integer.parseInt(str[k]), node);
					depthMap.put(Integer.parseInt(str[k]), (depth + 1));
					if (j == m - 1) {
						sb.append(Integer.parseInt(str[k]) + "]" + "\n");
						stringMap.put(node, sb);
						break;
					}
					sb.append(Integer.parseInt(str[k]) + ", ");
					k++;
				}
			} else if (str.length != 2) {
				StringBuffer sb = new StringBuffer();
				int node = Integer.parseInt(str[0]);
				int m = Integer.parseInt(str[1]);
				int k = 2;
				sb.append("node " + node + ": parent = " + parentMap.get(node) + ", depth = " + depthMap.get(node)
						+ ", internal node, [");
				for (int j = 0; j < m; j++) {
					parentMap.put(Integer.parseInt(str[k]), node);
					depthMap.put(Integer.parseInt(str[k]), (depthMap.get(node) + 1));
					if (j == m - 1) {
						sb.append(Integer.parseInt(str[k]) + "]" + "\n");
						stringMap.put(node, sb);
						break;
					}
					sb.append(Integer.parseInt(str[k]) + ", ");
					k++;
				}
			} else {
				StringBuffer sb = new StringBuffer();
				int node = Integer.parseInt(str[0]);
				sb.append("node " + node + ": parent = " + parentMap.get(node) + ", depth = " + depthMap.get(node)
						+ ", leaf, []" + "\n");
				stringMap.put(node, sb);
			}
		}
		if (n != 1) {
			for (int i = 0; i < n; i++) {
				ans.append(stringMap.get(i));
			}
		}
		return ans;
	}
}

Compiler output:
Main.java:7: error: package org.junit does not exist
import org.junit.Test;
                ^
1 error
Language: Java


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

import org.junit.Test;

//Main????????????test????°?????????????????????????????????£????????????version
//main?????§??????????????£??????????????????????????????(method)??????????????????????????????(StringBuffer)?????????????????????????????£

public class Main {
	
	public static void main(String[] args) throws IOException {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuffer ans = method(br);
		System.out.print(ans);
	}

	
	public static StringBuffer method(BufferedReader br) throws IOException {

		int n = Integer.parseInt(br.readLine());
		StringBuffer ans = new StringBuffer();

		Map<Integer, Integer> parentMap = new HashMap<Integer, Integer>();
		Map<Integer, Integer> depthMap = new HashMap<Integer, Integer>();
		Map<Integer, StringBuffer> stringMap = new HashMap<Integer, StringBuffer>();

		int depth = 0;

		for (int i = 0; i < n; i++) {
			String[] str = br.readLine().split(" ");
			if (i == 0) {
				if (n == 1) {
					ans.append("node " + 0 + ": parent = " + -1 + ", depth = " + 0 + ", root, []" + "\n");
					break;
				}
				StringBuffer sb = new StringBuffer();
				int node = Integer.parseInt(str[0]);
				int m = Integer.parseInt(str[1]);
				int k = 2;
				sb.append("node " + node + ": parent = " + -1 + ", depth = " + 0 + ", root, [");

				for (int j = 0; j < m; j++) {
					parentMap.put(Integer.parseInt(str[k]), node);
					depthMap.put(Integer.parseInt(str[k]), (depth + 1));
					if (j == m - 1) {
						sb.append(Integer.parseInt(str[k]) + "]" + "\n");
						stringMap.put(node, sb);
						break;
					}
					sb.append(Integer.parseInt(str[k]) + ", ");
					k++;
				}
			} else if (str.length != 2) {
				StringBuffer sb = new StringBuffer();
				int node = Integer.parseInt(str[0]);
				int m = Integer.parseInt(str[1]);
				int k = 2;
				sb.append("node " + node + ": parent = " + parentMap.get(node) + ", depth = " + depthMap.get(node)
						+ ", internal node, [");
				for (int j = 0; j < m; j++) {
					parentMap.put(Integer.parseInt(str[k]), node);
					depthMap.put(Integer.parseInt(str[k]), (depthMap.get(node) + 1));
					if (j == m - 1) {
						sb.append(Integer.parseInt(str[k]) + "]" + "\n");
						stringMap.put(node, sb);
						break;
					}
					sb.append(Integer.parseInt(str[k]) + ", ");
					k++;
				}
			} else {
				StringBuffer sb = new StringBuffer();
				int node = Integer.parseInt(str[0]);
				sb.append("node " + node + ": parent = " + parentMap.get(node) + ", depth = " + depthMap.get(node)
						+ ", leaf, []" + "\n");
				stringMap.put(node, sb);
			}
		}
		if (n != 1) {
			for (int i = 0; i < n; i++) {
				ans.append(stringMap.get(i));
			}
		}
		return ans;
	}
}

Compiler output:
Main.java:8: error: package org.junit does not exist
import org.junit.Test;
                ^
1 error
Language: Java

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

public class Main{

    public static void main(String[] args)throws IOException{
        Node[] node = input();
        print(node);
    }

    public static Node[] input() throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        Node[] node = new Node[n];
        for(int i = 0; i < n; i++){
            node[i] = new Node(i);
        }
        for(int i = 0; i < n; i++){
            String[] t = br.readLine().split(" ");
            int id = Integer.parseInt(t[0]);
            int k = Integer.parseInt(t[1]);
            for(int j = 0; j < k; j++){
                int c = Integer.parseInt(t[j + 2]);
                node[id].child.add(node[c]);
                node[c].parent = node[id];
            }
        }
        return node;//return sequence of node                                      
    }
  public static void print(Node[] node){
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < node.length; i++){
            sb.append("node " + node[i].id);
            sb.append(": parent = " + node[i].parent.id);
            sb.append(", depth = " + node[i].getDepth());
            sb.append(", [");
            int c = node[i].child.size();
            for(int j = 0; j < c; j++){
                if(j != 0){
                    sb.append(", ");
                }
                sb.append(node[i].child.get(j).id);
            }
            sb.append("]\n");
        }
        System.out.println(sb);
    }
}
class Node{
    public int id;
    public Node parent;
    public ArrayList<Node> child = new ArrayList<Node>();
    public Node(int id){
        this.id = id;
        if(id != -1){
            parent = new Node(-1);
        }
    }

    public int getDepth(){
        if(parent.id == -1){
            return 0;
        }else{
            return parent.getDepth() + 1;
        }
    }
public int getDepth(){
        if(parent.id == -1){
            return 0;
        }else{
            return parent.getDepth() + 1;
        }
    }

    public String getType(){
        if(parent.id == -1){
            return "root";
        }else if(child.size() == 0){
            return "leaf";
        }else{
            return "internal node";
        }
    }

}

Compiler output:
Main.java:69: error: method getDepth() is already defined in class Node
public int getDepth(){
           ^
1 error
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		Node[] nodes = input();
		StringBuilder stringBuilder = new StringBuilder();
		for (Node node : nodes) {
			stringBuilder.append("node " + node.getId());
			stringBuilder.append(": parent = " + node.getParent().getId());
			stringBuilder.append(", depth = " + node.getDepth());
			stringBuilder.append(", " + node.getType());
			stringBuilder.append(", [");
			for (int j = 0; j < node.getChildren().size(); j++) {
				if (j != 0) {
					stringBuilder.append(", ");
				}
				stringBuilder.append(node.getChildren().get(j).getId());
			}
			stringBuilder.append("]\n");
		}
		System.out.println(stringBuilder);
		
	}
	
	public static Node[] input() throws NumberFormatException, IOException {
		BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
		int num = Integer.parseInt(bufferedReader.readLine());
		Node[] nodes = new Node[num];
		for (int i = 0; i < num; i++) {
			nodes[i] = new Node(i);
		}
		for (int i = 0; i < num; i++) {
			String[] elements = bufferedReader.readLine().split(" ");
			int id = Integer.parseInt(elements[0]);
			int nextNum = Integer.parseInt(elements[1]);
			nodes[id].setId(id);
			List<Node> children = new ArrayList<>();
			for (int j = 0; j < nextNum; j++) {
				int element = Integer.parseInt(elements[j + 2]);
				children.add(nodes[element]);
				nodes[element].setParent(nodes[id]);
			}
			nodes[id].setChildren(children);
		}
		return nodes;
	}
}

public class Node {
	/** ??????????????§??? */
	private int id = -1;
	/** ????????????????????§??? */
	private Node parent;
	/** ?????????????????????????????§??? */
	private List<Node> children = new ArrayList<>();
	public Node(int id) {
		this.id = id;
		if (id != -1) {
			parent = new Node(-1);
		}
	}
	
	public int getDepth() {
		if (id == -1) {
			return 0;
		} else {
			return parent.getDepth() + 1;
		}
	}
	
	public String getType() {
		if (parent.getId() == -1) {
			return "root";
		} else if (children.isEmpty()) {
			return "leaf";
		} else {
			return "internal node";
		}
	}

	/**
	 * ????????????????????????
	 * @return id
	 */
	public int getId() {
		return id;
	}

	/**
	 * ???????????????????????????
	 * @param id ??????????????? id
	 */
	public void setId(int id) {
		this.id = id;
	}

	/**
	 * ?????????????????????
	 * @return parent
	 */
	public Node getParent() {
		return parent;
	}

	/**
	 * ????????????????????????
	 * @param parent ??????????????? parent
	 */
	public void setParent(Node parent) {
		this.parent = parent;
	}

	/**
	 * ??????????????????????????????
	 * @return children
	 */
	public List<Node> getChildren() {
		return children;
	}

	/**
	 * ????????????????????????
	 * @param children ??????????????? children
	 */
	public void setChildren(List<Node> children) {
		this.children = children;
	}

}

Compiler output:
Main.java:54: error: class Node is public, should be declared in a file named Node.java
public class Node {
       ^
1 error
Language: Java

#include<stdio.h>
#define N 100000
#define NIL -1
 
struct Node{
  int p, l, r;
};
 
struct Node T[N];
int n, H, D[N];
 
int getDepth(int);
void print(int);
 
int main(){
  int i, j, d, v, c, l;
   
  scanf("%d", &n);
   
  for ( i = 0; i < n; i++ ){
    T[i].p = NIL;
    T[i].l = NIL;
    T[i].r = NIL;
  }
  for ( i = 0; i < n; i++ ){
    scanf("%d %d", &v, &d);
    for ( j = 0; j < d; j++ ){
      scanf("%d", &c);
      if ( j == 0 ){
    T[v].l = c;
      }
      else{
    T[l].r = c;
      }
      l = c;
      T[c].p = v;      
    }
  }
   
  H = 0;
  for ( i = 0; i < n; i++ ){
    D[i] = getDepth(i);
    if ( D[i] > H ){
      H = D[i];
    }
  }  
  for ( i = 0; i < n; i++ ){
    print(i);
  }
  return 0;
}
 
int getDepth(int u){
  int d = 0;
  while(1){
    u = T[u].p;
    if ( u == NIL ) break;
    d++;
  }
  return d;
}
 
 
void print(int u){
  int i, c;
  printf("node %d: ", u);
  printf("parent = %d, ", T[u].p);
  printf("depth = %d, ", D[u]);
 
  if ( T[u].p == NIL ){
    printf("root, ");
  }
  else if ( T[u].l == NIL ){
    printf("leaf, ");
  }
  else{
    printf("internal node, ");
  }
 
  printf("[");
  for(i = 0, c = T[u].l; c != NIL; i++, c = T[c].r){
    if (i) printf(", ");
    printf("%d", c);
  }
  printf("]\n");
}

Compiler output:
Main.java:1: error: illegal character: '#'
#include<stdio.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include<stdio.h>
        ^
Main.java:2: error: illegal character: '#'
#define N 100000
^
Main.java:3: error: illegal character: '#'
#define NIL -1
^
Main.java:7: error: class, interface, enum, or record expected
};
^
Main.java:9: error: class, interface, enum, or record expected
struct Node T[N];
^
Main.java:10: error: class, interface, enum, or record expected
int n, H, D[N];
^
Main.java:12: error: unnamed classes are a preview feature and are disabled by default.
int getDepth(int);
^
  (use --enable-preview to enable unnamed classes)
Main.java:12: error: <identifier> expected
int getDepth(int);
                ^
Main.java:13: error: <identifier> expected
void print(int);
              ^
Main.java:18: error: illegal start of expression
  scanf("%d", &n);
              ^
Main.java:26: error: illegal start of expression
    scanf("%d %d", &v, &d);
                   ^
Main.java:26: error: illegal start of expression
    scanf("%d %d", &v, &d);
                       ^
Main.java:28: error: illegal start of expression
      scanf("%d", &c);
                  ^
14 errors