Language: C

#include<stdio.h>
#define null -1

 struct Node{
         int parent;
         int left;
         int right;
         };

 struct Node node[100001];
 D[100001];

 void print(int i){
         int j,c;
         printf("node %d: ",i);
         if(node[i].parent==null)printf("parent -1, ",i);
         else printf("parent %d, ",node[i].parent);
         printf("depth %d, ",D[i]);
         if(node[i].parent==null)printf("root, "); 
         else if(node[i].left==null)printf("leaf, ");
         else printf("internal node, ");

         c=node[i].left;
         printf("[");
         for(j=0;c!=null;j++){
                  if(j)printf(", );
                  printf("%d",c);
                  c=node[c].right;
                 }
         printf("[");
         }
         
         


 void deep(root,u){
         D[root]=u;
         if(D[root].left!=null)deep(root,u+1);
         if(D[root].right!=null)deep(root,u);
         }

 int main(){
         int i,n,c,j,root,v,C,left;
         scanf("%d",&n);
         for(i=0;i<n;i++){node[i].right=node[i].left=node[i].parent=null;}
         for(i=0;i<n;i++){
                   scanf("%d%d",&v,&c);
                   for(j=0;j<c;j++){
                             scanf("%d",&C);
                             if(j==0)node[v].left=C;
                             else node[left].right=C;
                             left=C;
                             node[C].parent=v;
                             }
                   }

         for(i=0;i<n;i++){if(node[i].parent==null)root=i;}
         deep(root,0);
         for(i=0;i<n;i++){print(i);}
         return 0;
         }












Compiler output:
main.c:11:2: warning: data definition has no type or storage class
   11 |  D[100001];
      |  ^
main.c:11:2: error: type defaults to 'int' in declaration of 'D' [-Wimplicit-int]
main.c: In function 'print':
main.c:26:31: warning: missing terminating " character
   26 |                   if(j)printf(", );
      |                               ^
main.c:26:31: error: missing terminating " character
   26 |                   if(j)printf(", );
      |                               ^~~~~
main.c:27:33: error: expected ')' before ';' token
   27 |                   printf("%d",c);
      |                                 ^
      |                                 )
main.c:26:30: note: to match this '('
   26 |                   if(j)printf(", );
      |                              ^
main.c:27:19: error: passing argument 1 of 'printf' makes pointer from integer without a cast [-Wint-conversion]
   27 |                   printf("%d",c);
      |                   ^~~~~~~~~~~~~~
      |                   |
      |                   int
In file included from main.c:1:
/usr/include/stdio.h:363:43: note: expected 'const char * restrict' but argument is of type 'int'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
main.c:28:35: error: expected ';' before '}' token
   28 |                   c=node[c].right;
      |                                   ^
      |                                   ;
   29 |                  }
      |                  ~                 
main.c: In function 'deep':
main.c:36:7: error: type of 'root' defaults to 'int' [-Wimplicit-int]
   36 |  void deep(root,u){
      |       ^~~~
main.c:36:7: error: type of 'u' defaults to 'int' [-Wimplicit-int]
main.c:38:20: error: request for member 'left' in something not a structure or union
   38 |          if(D[root].left!=null)deep(root,u+1);
      |                    ^
main.c:39:20: error: request for member 'right' in something not a structure or union
   39 |          if(D[root].right!=null)deep(root,u);
      |                    ^