Language: C

include <stdio.h>
#define N 100000

typedef struct{
  int id,parent,dep,deg,s,height,left,right,type;
  int jisu[50];
}Node;

int hhh = 0;

Node tree[N];

void jisu(int);

main(){

  int j,i,nodeb,n;

  scanf("%d",&n);

  for(i = 0 ; i < n; i++){
    tree[i].parent = -1;
    tree[i].dep = 0;
    tree[i].height = 1;
    tree[i].s = -1;
  }

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

    scanf("%d",&nodeb);

    tree[nodeb].id = nodeb;

    scanf("%d %d",&tree[nodeb].left,&tree[nodeb].right);
    //                                                                                                                                                                                            
    tree[tree[nodeb].left].parent = nodeb;
    tree[tree[nodeb].left].s = tree[nodeb].right;
    //                                                                                                                                                                                            
    tree[tree[nodeb].right].parent = nodeb;
    tree[tree[nodeb].right].s =  tree[nodeb].left;

    jisu(nodeb);

  }

  for(i = n - 1 ; i >= 0; i--){

    if(tree[i].deg != 0 && tree[tree[i].right].height > tree[tree[i].left].height) tree[i].height = tree[tree[i].right].height + 1;
    else if(tree[i].deg != 0 && tree[tree[i].left].height > tree[tree[i].right].height) tree[i].height = tree[tree[i].left].height + 1;

  }

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

    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",tree[i].id,tree[i].parent,tree[i].s,tree[i].deg,tree[i].dep,tree[i].height);
    if(tree[i].height == 0) printf("leaf\n");
    else if(tree[i].dep == 0) printf("root\n");
    else printf("internal node\n");
  }

  return 0;

}


void jisu(int now){

  if(tree[now].right != -1) tree[now].deg = 2;
  else {tree[now].deg = 0;
    tree[now].height = 0;
  }

  if(tree[now].parent != -1) tree[now].dep = tree[tree[now].parent].dep + 1;

  if(hhh <= tree[now].dep) hhh = tree[now].dep;

}

Compiler output:
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include <stdio.h>
      |         ^
main.c:7:2: warning: data definition has no type or storage class
    7 | }Node;
      |  ^~~~
main.c:7:2: error: type defaults to 'int' in declaration of 'Node' [-Wimplicit-int]
main.c:11:1: error: unknown type name 'Node'
   11 | Node tree[N];
      | ^~~~
main.c:15:1: error: return type defaults to 'int' [-Wimplicit-int]
   15 | main(){
      | ^~~~
main.c: In function 'main':
main.c:19:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   19 |   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:19:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   19 |   scanf("%d",&n);
      |   ^~~~~
main.c:19:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:22:12: error: request for member 'parent' in something not a structure or union
   22 |     tree[i].parent = -1;
      |            ^
main.c:23:12: error: request for member 'dep' in something not a structure or union
   23 |     tree[i].dep = 0;
      |            ^
main.c:24:12: error: request for member 'height' in something not a structure or union
   24 |     tree[i].height = 1;
      |            ^
main.c:25:12: error: request for member 's' in something not a structure or union
   25 |     tree[i].s = -1;
      |            ^
main.c:32:16: error: request for member 'id' in something not a structure or union
   32 |     tree[nodeb].id = nodeb;
      |                ^
main.c:34:31: error: request for member 'left' in something not a structure or union
   34 |     scanf("%d %d",&tree[nodeb].left,&tree[nodeb].right);
      |                               ^
main.c:34:49: error: request for member 'right' in something not a structure or union
   34 |     scanf("%d %d",&tree[nodeb].left,&tree[nodeb].right);
      |                                                 ^
main.c:36:21: error: request for member 'left' in something not a structure or union
   36 |     tree[tree[nodeb].left].parent = nodeb;
      |                     ^
main.c:37:21: error: request for member 'left' in something not a structure or union
   37 |     tree[tree[nodeb].left].s = tree[nodeb].right;
      |                     ^
main.c:37:43: error: request for member 'right' in something not a structure or union
   37 |     tree[tree[nodeb].left].s = tree[nodeb].right;
      |                                           ^
main.c:39:21: error: request for member 'right' in something not a structure or union
   39 |     tree[tree[nodeb].right].parent = nodeb;
      |                     ^
main.c:40:21: error: request for member 'right' in something not a structure or union
   40 |     tree[tree[nodeb].right].s =  tree[nodeb].left;
      |                     ^
main.c:40:45: error: request for member 'left' in something not a structure or union
   40 |     tree[tree[nodeb].right].s =  tree[nodeb].left;
      |                                             ^
main.c:48:15: error: request for member 'deg' in something not a structure or union
   48 |     if(tree[i].deg != 0 && tree[tree[i].right].height > tree[tree[i].left].height) tree[i].height = tree[tree[i].right].height + 1;
      |               ^
main.c:48:40: error: request for member 'right' in something not a structure or union
   48 |     if(tree[i].deg != 0 && tree[tree[i].right].height > tree[tree[i].left].height) tree[i].height = tree[tree[i].right].height + 1;
      |                                        ^
main.c:48:69: error: request for member 'left' in something not a structure or union
   48 |     if(tree[i].deg != 0 && tree[tree[i].right].height > tree[tree[i].left].height) tree[i].height = tree[tree[i].right].height + 1;
      |                                                                     ^
main.c:48:91: error: request for member 'height' in something not a structure or union
   48 |     if(tree[i].deg != 0 && tree[tree[i].right].height > tree[tree[i].left].height) tree[i].height = tree[tree[i].right].height + 1;
      |                                                                                           ^
main.c:48:113: error: request for member 'right' in something not a structure or union
   48 |     if(tree[i].deg != 0 && tree[tree[i].right].height > tree[tree[i].left].height) tree[i].height = tree[tree[i].right].height + 1;
      |                                                                                                                 ^
main.c:49:20: error: request for member 'deg' in something not a structure or union
   49 |     else if(tree[i].deg != 0 && tree[tree[i].left].height > tree[tree[i].right].height) tree[i].height = tree[tree[i].left].height + 1;
      |                    ^
main.c:49:45: error: request for member 'left' in something not a structure or union
   49 |     else if(tree[i].deg != 0 && tree[tree[i].left].height > tree[tree[i].right].height) tree[i].height = tree[tree[i].left].height + 1;
      |                                             ^
main.c:49:73: error: request for member 'right' in something not a structure or union
   49 |     else if(tree[i].deg != 0 && tree[tree[i].left].height > tree[tree[i].right].height) tree[i].height = tree[tree[i].left].height + 1;
      |                                                                         ^
main.c:49:96: error: request for member 'height' in something not a structure or union
   49 |     else if(tree[i].deg != 0 && tree[tree[i].left].height > tree[tree[i].right].height) tree[i].height = tree[tree[i].left].height + 1;
      |                                                                                                ^
main.c:49:118: error: request for member 'left' in something not a structure or union
   49 |     else if(tree[i].deg != 0 && tree[tree[i].left].height > tree[tree[i].right].height) tree[i].height = tree[tree[i].left].height + 1;
      |                                                                                                                      ^
main.c:55:5: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   55 |     printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",tree[i].id,tree[i].parent,tree[i].s,tree[i].deg,tree[i].dep,tree[i].height);
      |     ^~~~~~
main.c:55:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:55:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:55:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:55:96: error: request for member 'id' in something not a structure or union
   55 |     printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",tree[i].id,tree[i].parent,tree[i].s,tree[i].deg,tree[i].dep,tree[i].height);
      |                                                                                                ^
main.c:55:107: error: request for member 'parent' in something not a structure or union
   55 |     printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",tree[i].id,tree[i].parent,tree[i].s,tree[i].deg,tree[i].dep,tree[i].height);
      |                                                                                                           ^
main.c:55:122: error: request for member 's' in something not a structure or union
   55 |     printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",tree[i].id,tree[i].parent,tree[i].s,tree[i].deg,tree[i].dep,tree[i].height);
      |                                                                                                                          ^
main.c:55:132: error: request for member 'deg' in something not a structure or union
   55 |     printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",tree[i].id,tree[i].parent,tree[i].s,tree[i].deg,tree[i].dep,tree[i].height);
      |                                                                                                                                    ^
main.c:55:144: error: request for member 'dep' in something not a structure or union
   55 |     printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",tree[i].id,tree[i].parent,tree[i].s,tree[i].deg,tree[i].dep,tree[i].height);
      |                                                                                                                                                ^
main.c:55:156: error: request for member 'height' in something not a structure or union
   55 |     printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",tree[i].id,tree[i].parent,tree[i].s,tree[i].deg,tree[i].dep,tree[i].height);
      |                                                                                                                                                            ^
main.c:56:15: error: request for member 'height' in something not a structure or union
   56 |     if(tree[i].height == 0) printf("leaf\n");
      |               ^
main.c:57:20: error: request for member 'dep' in something not a structure or union
   57 |     else if(tree[i].dep == 0) printf("root\n");
      |                    ^
main.c: In function 'jisu':
main.c:68:15: error: request for member 'right' in something not a structure or union
   68 |   if(tree[now].right != -1) tree[now].deg = 2;
      |               ^
main.c:68:38: error: request for member 'deg' in something not a structure or union
   68 |   if(tree[now].right != -1) tree[now].deg = 2;
      |                                      ^
main.c:69:18: error: request for member 'deg' in something not a structure or union
   69 |   else {tree[now].deg = 0;
      |                  ^
main.c:70:14: error: request for member 'height' in something not a structure or union
   70 |     tree[now].height = 0;
      |              ^
main.c:73:15: error: request for member 'parent' in something not a structure or union
   73 |