Language: C

struct Node T[MAX];
int n, H, D[MAX]; 

int getDepth(int u){
  int d = 0;
  int i = 0;
  while(1){
    if(T[u].p == NIL) break;
    d++;
    u = T[u].p;
  }
  return d;
}

void print(int u){
  
  if(T[u].p == NIL){
    printf("node %d: parent = %d, depth = %d,root, [",u,T[u].p,D[u]);
    printf("%d,",T[u].l);
    u = T[u].l;
     while(T[u].r != NIL){
       printf("%d,",T[u].r);
      u = T[u].r;
      }
    printf("]\n");
  }
  
  else if(T[u].l == NIL){
    printf("node %d: parent = %d, depth = %d, leaf, []\n",u,T[u].p,D[u]);
    }
  
  else{
    printf("node %d: parent = %d, depth = %d, internal node[",u,T[u].p,D[u]);
    printf("%d,",T[u].l);
    u = T[u].l;
    while(T[u].r != NIL){
      printf("%d,",T[u].r);
      u = T[u].r;
    }
    printf("]\n");
  }
  
}

main(){
  int i, j, d, v, c, l;
  int pre;
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ) {
    T[i].p = T[i].l = 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;
	T[c].p = v;
	pre = c; 
      }
      else if(j != 0){
	T[pre].r = c;
	T[c].p = v;
	pre = c;
      }
    }
  }

  for ( i = 0; i < n; i++ ){
    D[i] = getDepth(i);
  }

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

Compiler output:
main.c:1:15: error: 'MAX' undeclared here (not in a function)
    1 | struct Node T[MAX];
      |               ^~~
main.c: In function 'getDepth':
main.c:8:18: error: 'NIL' undeclared (first use in this function)
    8 |     if(T[u].p == NIL) break;
      |                  ^~~
main.c:8:18: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'print':
main.c:17:16: error: 'NIL' undeclared (first use in this function)
   17 |   if(T[u].p == NIL){
      |                ^~~
main.c:18:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   18 |     printf("node %d: parent = %d, depth = %d,root, [",u,T[u].p,D[u]);
      |     ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | struct Node T[MAX];
main.c:18:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   18 |     printf("node %d: parent = %d, depth = %d,root, [",u,T[u].p,D[u]);
      |     ^~~~~~
main.c:18:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:29:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   29 |     printf("node %d: parent = %d, depth = %d, leaf, []\n",u,T[u].p,D[u]);
      |     ^~~~~~
main.c:29:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:33:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   33 |     printf("node %d: parent = %d, depth = %d, internal node[",u,T[u].p,D[u]);
      |     ^~~~~~
main.c:33:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:45:1: error: return type defaults to 'int' [-Wimplicit-int]
   45 | main(){
      | ^~~~
main.c: In function 'main':
main.c:48:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   48 |   scanf("%d", &n);
      |   ^~~~~
main.c:48:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:48:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
main.c:48:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:51:32: error: 'NIL' undeclared (first use in this function)
   51 |     T[i].p = T[i].l = T[i].r = NIL;
      |                                ^~~