Language: C

include <stdio.h>

typedef struct{
  int id;
  int parent;
  int depth;
  int k;
  int child[100000];
} node;

node tree[100000];


int main(){

  int n,i,j,count,k,m;
  scanf("%d",&n);

 for(i=0;i<n;i++){
   tree[i].parent = -1;
   tree[i].depth = 0;
 }
 
 for(i=0;i<n;i++){
   scanf("%d",&m);
   tree[m].id = m;
   scanf("%d",&tree[m].k);
   for(j=0;j<tree[m].k;j++){
     scanf("%d",&tree[m].child[j]);
     tree[tree[m].child[j]].parent = tree[m].id;
   }
 }

 for(i=0;i<n;i++){
   j=i;
   count = 0;
   while(tree[j].parent != -1){
     j = tree[j].parent;
     count++;
   }
   tree[i].depth = count;
 }

 
 for(i=0;i<n;i++){
   printf("node %d: parent = %d, depth = %d, ",tree[i].id,tree[i].parent,tree[i].depth);
   if(tree[i].depth == 0) printf("root, [");
   else if(tree[i].k == 0) printf("leaf, [");
   else printf("internal node, [");
   for(k=0;k<tree[i].k;k++){
     printf("%d",tree[i].child[k]);
     if(k != tree[i].k - 1) printf(", ");
   }
   printf("]\n");
 }
 
 return 0;
}
    
    

Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
main.c:9:3: warning: data definition has no type or storage class
    9 | } node;
      |   ^~~~
main.c:9:3: error: type defaults to 'int' in declaration of 'node' [-Wimplicit-int]
main.c:11:1: error: unknown type name 'node'
   11 | node tree[100000];
      | ^~~~
main.c: In function 'main':
main.c:17:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   17 |   scanf("%d",&n);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | include <stdio.h>
main.c:17:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   17 |   scanf("%d",&n);
      |   ^~~~~
main.c:17:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:20:11: error: request for member 'parent' in something not a structure or union
   20 |    tree[i].parent = -1;
      |           ^
main.c:21:11: error: request for member 'depth' in something not a structure or union
   21 |    tree[i].depth = 0;
      |           ^
main.c:26:11: error: request for member 'id' in something not a structure or union
   26 |    tree[m].id = m;
      |           ^
main.c:27:23: error: request for member 'k' in something not a structure or union
   27 |    scanf("%d",&tree[m].k);
      |                       ^
main.c:28:21: error: request for member 'k' in something not a structure or union
   28 |    for(j=0;j<tree[m].k;j++){
      |                     ^
main.c:29:25: error: request for member 'child' in something not a structure or union
   29 |      scanf("%d",&tree[m].child[j]);
      |                         ^
main.c:30:18: error: request for member 'child' in something not a structure or union
   30 |      tree[tree[m].child[j]].parent = tree[m].id;
      |                  ^
main.c:30:45: error: request for member 'id' in something not a structure or union
   30 |      tree[tree[m].child[j]].parent = tree[m].id;
      |                                             ^
main.c:37:17: error: request for member 'parent' in something not a structure or union
   37 |    while(tree[j].parent != -1){
      |                 ^
main.c:38:17: error: request for member 'parent' in something not a structure or union
   38 |      j = tree[j].parent;
      |                 ^
main.c:41:11: error: request for member 'depth' in something not a structure or union
   41 |    tree[i].depth = count;
      |           ^
main.c:46:4: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   46 |    printf("node %d: parent = %d, depth = %d, ",tree[i].id,tree[i].parent,tree[i].depth);
      |    ^~~~~~
main.c:46:4: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:46:4: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:46:4: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:46:55: error: request for member 'id' in something not a structure or union
   46 |    printf("node %d: parent = %d, depth = %d, ",tree[i].id,tree[i].parent,tree[i].depth);
      |                                                       ^
main.c:46:66: error: request for member 'parent' in something not a structure or union
   46 |    printf("node %d: parent = %d, depth = %d, ",tree[i].id,tree[i].parent,tree[i].depth);
      |                                                                  ^
main.c:46:81: error: request for member 'depth' in something not a structure or union
   46 |    printf("node %d: parent = %d, depth = %d, ",tree[i].id,tree[i].parent,tree[i].depth);
      |                                                                                 ^
main.c:47:14: error: request for member 'depth' in something not a structure or union
   47 |    if(tree[i].depth == 0) printf("root, [");
      |              ^
main.c:48:19: error: request for member 'k' in something not a structure or union
   48 |    else if(tree[i].k == 0) printf("leaf, [");
      |                   ^
main.c:50:21: error: request for member 'k' in something not a structure or union
   50 |    for(k=0;k<tree[i].k;k++){
      |                     ^
main.c:51:25: error: request for member 'child' in something not a structure or union
   51 |      printf("%d",tree[i].child[k]);
      |                         ^
main.c:52:21: error: request for member 'k' in something not a structure or union
   52 |      if(k != tree[i].k - 1) printf(", ");
      |                     ^