Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define llong long long
#define IFY 2000000000
#define MAX 10000
#define NIL -1
struct Node {int parent,left,right;};
Node T[MAX]
int n,D[MAX],H[MAX];
void setdepth(int u,int d){
  if(u==NIL) return;
  D[u]=d;
  setdepth(T[u].left,d+1);
  setdepth(T[u].right,d+1);
}
int setheight(int u){
  int h1=0;h2=0;
  if(T[u].left!=NIL) h1=setheight(T[u].left)+1;
  if(T[u].right!=NIl) h2=setdepth(T[u].right)+1;
  return H[u]=(h1>h2?h1:h2);
}
int getsibling(int u){
  if(T[u].parent==NIL) return NIL;
  if(T[T[u].parent].left!=NIL&&T[T[u].parent].left!=u) return T[T[u].parent].left;
  if(T[T[u].parent].right!=NIL&&T[T[u].parent].right!=u) return T[T[u].parent].right;
  return NIL;
}
void print(int u){
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].parent);
  printf("sibling = %d, ",getsibling(u));
  int deg=0;
  if(T[u].left!=NIL) deg++;
  if(T[u].right!=NIL) deg++;
  printf("degree = %d, ",deg);
  printf("depth = %d, ",D[u]);
  printf("height = %d, ",H[u]);
  if(T[u].parent==NIL) printf("root\n");
  if(T[u].left==NIL&&T[u].right==NIL) printf("leaf\n");
  else printf("internal node\n");
}
int main(){
  int root=0,l,r
  scanf("%d",&n);
  REP(i,n) T[i].parent==NIL;
  REP(i,n){
    scanf("%d %d %d",&v,&l,&r);
    T[v].left=l;
    T[v].right=r;
    if(l!=NIL) T[l].parent=v;
    if(r!=NIL) T[r].parent=v;
  }
  REP(i,n) if(T[i].parent==NIL) root=i;
  setdepth(root,0);
  setheight(root);
  REP(i,n) print(i);
  return 0;
}

Compiler output:
a.cc:10:1: error: expected initializer before 'int'
   10 | int n,D[MAX],H[MAX];
      | ^~~
a.cc: In function 'void setdepth(int, int)':
a.cc:13:3: error: 'D' was not declared in this scope
   13 |   D[u]=d;
      |   ^
a.cc:14:12: error: 'T' was not declared in this scope
   14 |   setdepth(T[u].left,d+1);
      |            ^
a.cc: In function 'int setheight(int)':
a.cc:18:12: error: 'h2' was not declared in this scope; did you mean 'h1'?
   18 |   int h1=0;h2=0;
      |            ^~
      |            h1
a.cc:19:6: error: 'T' was not declared in this scope
   19 |   if(T[u].left!=NIL) h1=setheight(T[u].left)+1;
      |      ^
a.cc:20:6: error: 'T' was not declared in this scope
   20 |   if(T[u].right!=NIl) h2=setdepth(T[u].right)+1;
      |      ^
a.cc:20:18: error: 'NIl' was not declared in this scope; did you mean 'NIL'?
   20 |   if(T[u].right!=NIl) h2=setdepth(T[u].right)+1;
      |                  ^~~
      |                  NIL
a.cc:21:10: error: 'H' was not declared in this scope
   21 |   return H[u]=(h1>h2?h1:h2);
      |          ^
a.cc: In function 'int getsibling(int)':
a.cc:24:6: error: 'T' was not declared in this scope
   24 |   if(T[u].parent==NIL) return NIL;
      |      ^
a.cc:25:6: error: 'T' was not declared in this scope
   25 |   if(T[T[u].parent].left!=NIL&&T[T[u].parent].left!=u) return T[T[u].parent].left;
      |      ^
a.cc:26:6: error: 'T' was not declared in this scope
   26 |   if(T[T[u].parent].right!=NIL&&T[T[u].parent].right!=u) return T[T[u].parent].right;
      |      ^
a.cc: In function 'void print(int)':
a.cc:31:26: error: 'T' was not declared in this scope
   31 |   printf("parent = %d, ",T[u].parent);
      |                          ^
a.cc:37:25: error: 'D' was not declared in this scope
   37 |   printf("depth = %d, ",D[u]);
      |                         ^
a.cc:38:26: error: 'H' was not declared in this scope
   38 |   printf("height = %d, ",H[u]);
      |                          ^
a.cc: In function 'int main()':
a.cc:45:3: error: expected initializer before 'scanf'
   45 |   scanf("%d",&n);
      |   ^~~~~
a.cc:46:9: error: 'n' was not declared in this scope
   46 |   REP(i,n) T[i].parent==NIL;
      |         ^
a.cc:2:32: note: in definition of macro 'REP'
    2 | #define REP(i,n) for(int i=0;i<n;i++)
      |                                ^
a.cc:46:12: error: 'T' was not declared in this scope
   46 |   REP(i,n) T[i].parent==NIL;
      |            ^
a.cc:47:9: error: 'n' was not declared in this scope
   47 |   REP(i,n){
      |         ^
a.cc:2:32: note: in definition of macro 'REP'
    2 | #define REP(i,n) for(int i=0;i<n;i++)
      |                                ^
a.cc:48:23: error: 'v' was not declared in this scope
   48 |     scanf("%d %d %d",&v,&l,&r);
      |                       ^
a.cc:48:29: error: 'r' was not declared in this scope
   48 |     scanf("%d %d %d",&v,&l,&r);
      |                             ^
a.cc:49:5: error: 'T' was not declared in this scope
   49 |     T[v].left=l;
      |     ^
a.cc:54:9: error: 'n' was not declared in this scope
   54 |   REP(i,n) if(T[i].parent==NIL) root=i;
      |         ^
a.cc:2:32: note: in definition of macro 'REP'
    2 | #define REP(i,n) for(int i=0;i<n;i++)
      |                                ^
a.cc:54:15: error: 'T' was not declared in this scope
   54 |   REP(i,n) if(T[i].parent==NIL) root=i;
      |               ^
a.cc:57:9: error: 'n' was not declared in this scope
   57 |   REP(i,n) print(i);
      |         ^
a.cc:2:32: note: in definition of macro 'REP'
    2 | #define REP(i,n) for(int i=0;i<n;i++)
      |                                ^