Language: C

#include<stdio.h>
#define MAX 100000
#define NIL -1
  
typedef struct{
  int parent, left, right;
}Node;
  
Node Tree[MAX];
int n, Depth[MAX];
  
int getDepth(int);
void print(int);
  
int child[MAX];
  
int main(void){
  int i, j;
  int degree, vertex;
  
  scanf("%d", &n);
  
  for ( i = 0; i < n; i++ ) {
    Tree[i].parent = NIL;
    Tree[i].left = NIL;
    Tree[i].right = NIL;
  }
  
  for ( i = 0; i < n; i++ ){
    scanf("%d %d", &vertex, &degree);
    for ( j = 0; j < degree; j++ ){#include<stdio.h>

typedef struct{
  int parent, left, right;
}Node;
  
Node Tree[MAX];
int n, Depth[MAX];
  
int getDepth(int);
void print(int);
  
int child[MAX];
  
int main(void){
  int i, j;
  int degree, vertex;
  
  scanf("%d", &n);
  
  for ( i = 0; i < n; i++ ) {
    Tree[i].parent = NIL;
    Tree[i].left = NIL;
    Tree[i].right = NIL;
  }
  
  for ( i = 0; i < n; i++ ){
    scanf("%d %d", &vertex, &degree);
    for ( j = 0; j < degree; j++ ){
      scanf("%d", &child[j]);
  
      Tree[child[j]].parent = vertex;
        
     
      if(j == 0)
    Tree[vertex].left = child[0];
        
      else
    Tree[child[j - 1]].right = child[j];
    }
  }
    
  for ( i = 0; i < n; i++ )
    Depth[i] = getDepth(i);
    
  for ( i = 0; i < n; i++ )
    print(i);
    
  return 0;
}
  
int getDepth(int u){
  int d = 0;
  
  while(Tree[u].parent >= 0){
    u = Tree[u].parent;
    d++;
  }
  
  return d;
}
  
void print(int u){
  
  int i, cnt = 0;
  
  printf("node %d: parent = %d, depth = %d, ",u,Tree[u].parent,Depth[u]);
  
  if(Tree[u].parent == NIL)
    printf("root, [");
  
  else if(Tree[u].left == NIL)
    printf("leaf, [");
  
  else
    printf("internal node, [");
  
  u = Tree[u].left;
  while(u != NIL){
    if(cnt == 0)
      printf("%d",u);
  
    else
      printf(", %d",u);
    
    u = Tree[u].right;
    cnt++;
  
      
   
 }
  
  
    printf("]\n");
  
}
      scanf("%d", &child[j]);
  
      Tree[child[j]].parent = vertex;
        
     
      if(j == 0)
    Tree[vertex].left = child[0];
        
      else
    Tree[child[j - 1]].right = child[j];
    }
  }
    
  for ( i = 0; i < n; i++ )
    Depth[i] = getDepth(i);
    
  for ( i = 0; i < n; i++ )
    print(i);
    
  return 0;
}
  
int getDepth(int u){
  int d = 0;
  
  while(Tree[u].parent >= 0){
    u = Tree[u].parent;
    d++;
  }
  
  return d;
}
  
void print(int u){
  
  int i, cnt = 0;
  
  printf("node %d: parent = %d, depth = %d, ",u,Tree[u].parent,Depth[u]);
  
  if(Tree[u].parent == NIL)
    printf("root, [");
  
  else if(Tree[u].left == NIL)
    printf("leaf, [");
  
  else
    printf("internal node, [");
  
  u = Tree[u].left;
  while(u != NIL){
    if(cnt == 0)
      printf("%d",u);
  
    else
      printf(", %d",u);
    
    u = Tree[u].right;
    cnt++;
  
      
   
 }
  
  
    printf("]\n");
  
}

Compiler output:
main.c: In function 'main':
main.c:31:36: error: stray '#' in program
   31 |     for ( j = 0; j < degree; j++ ){#include<stdio.h>
      |                                    ^
main.c:31:37: error: 'include' undeclared (first use in this function)
   31 |     for ( j = 0; j < degree; j++ ){#include<stdio.h>
      |                                     ^~~~~~~
main.c:31:37: note: each undeclared identifier is reported only once for each function it appears in
main.c:31:45: error: 'stdio' undeclared (first use in this function); did you mean 'stdin'?
   31 |     for ( j = 0; j < degree; j++ ){#include<stdio.h>
      |                                             ^~~~~
      |                                             stdin
main.c:33:1: error: expected expression before 'typedef'
   33 | typedef struct{
      | ^~~~~~~
main.c:82:5: error: static declaration of 'getDepth' follows non-static declaration
   82 | int getDepth(int u){
      |     ^~~~~~~~
main.c:40:5: note: previous declaration of 'getDepth' with type 'int(int)'
   40 | int getDepth(int);
      |     ^~~~~~~~
main.c:93:6: error: static declaration of 'print' follows non-static declaration
   93 | void print(int u){
      |      ^~~~~
main.c:41:6: note: previous declaration of 'print' with type 'void(int)'
   41 | void print(int);
      |      ^~~~~