Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
using namespace std;
map <int ,int> mpa,mpb;
#define MAX 100005
#define NIL -1

struct Node {int p,l,r;};

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);
}

void setHigh(int u){
  int h1=0, h2=0;
  if(T[u].left != NIL) h1=setHigh(T[u].left)+1;
  if(T[u].right != NIL) h1=setHigh(T[u].right)+1;

  return H[u]=(h1>h2?h1:h2);
}

int getSibling(int u){
  if(T[u].parent==NIL) retrun NIL;
  if(T[T[u].parent].left !=u && T[T[u].parent].left !=NIL)
    return T[T[u].parent].left;
  if(T[T[u].parent].right !=u && T[T[u].parent].right !=NIL)
    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");
  }else if(T[u].left==NIL && T[u].right==NIL ){
    printf("leaf\n");
  else{
    printf("internal node\n");
  }
}

int main(){
  int v,l,r,root=0;
  scanf("%d",&n);

  for(i=0;i<n;i++) T[i].parent=NIL;//初期化

  for(i=0;i<n;i++){
  scanf("%d %d %d",&v,%l,&r);
  T[v].left=l;
  T[v].right=r;
  if(l !=NIL) T[l].paretn=v;
  if(r !=NIL) T[r].paretn=v;
  }

  for(i=0;i<n;i++) if(T[i].parent==NIL) root=i;

  setDepth(root,0);
  setHight(root);

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

  return 0;
}



Compiler output:
a.cc: In function 'void setDepth(int, int)':
a.cc:24:17: error: 'struct Node' has no member named 'left'
   24 |   setDepth(T[u].left,d+1);
      |                 ^~~~
a.cc:25:17: error: 'struct Node' has no member named 'right'
   25 |   setDepth(T[u].right,d+1);
      |                 ^~~~~
a.cc: In function 'void setHigh(int)':
a.cc:30:11: error: 'struct Node' has no member named 'left'
   30 |   if(T[u].left != NIL) h1=setHigh(T[u].left)+1;
      |           ^~~~
a.cc:30:40: error: 'struct Node' has no member named 'left'
   30 |   if(T[u].left != NIL) h1=setHigh(T[u].left)+1;
      |                                        ^~~~
a.cc:31:11: error: 'struct Node' has no member named 'right'
   31 |   if(T[u].right != NIL) h1=setHigh(T[u].right)+1;
      |           ^~~~~
a.cc:31:41: error: 'struct Node' has no member named 'right'
   31 |   if(T[u].right != NIL) h1=setHigh(T[u].right)+1;
      |                                         ^~~~~
a.cc:33:14: error: return-statement with a value, in function returning 'void' [-fpermissive]
   33 |   return H[u]=(h1>h2?h1:h2);
      |          ~~~~^~~~~~~~~~~~~~
a.cc: In function 'int getSibling(int)':
a.cc:37:11: error: 'struct Node' has no member named 'parent'
   37 |   if(T[u].parent==NIL) retrun NIL;
      |           ^~~~~~
a.cc:37:24: error: 'retrun' was not declared in this scope
   37 |   if(T[u].parent==NIL) retrun NIL;
      |                        ^~~~~~
a.cc:38:13: error: 'struct Node' has no member named 'parent'
   38 |   if(T[T[u].parent].left !=u && T[T[u].parent].left !=NIL)
      |             ^~~~~~
a.cc:38:40: error: 'struct Node' has no member named 'parent'
   38 |   if(T[T[u].parent].left !=u && T[T[u].parent].left !=NIL)
      |                                        ^~~~~~
a.cc:39:19: error: 'struct Node' has no member named 'parent'
   39 |     return T[T[u].parent].left;
      |                   ^~~~~~
a.cc:40:13: error: 'struct Node' has no member named 'parent'
   40 |   if(T[T[u].parent].right !=u && T[T[u].parent].right !=NIL)
      |             ^~~~~~
a.cc:40:41: error: 'struct Node' has no member named 'parent'
   40 |   if(T[T[u].parent].right !=u && T[T[u].parent].right !=NIL)
      |                                         ^~~~~~
a.cc:41:19: error: 'struct Node' has no member named 'parent'
   41 |     return T[T[u].parent].right;
      |                   ^~~~~~
a.cc: In function 'void print(int)':
a.cc:47:32: error: 'struct Node' has no member named 'parent'
   47 |   printf("parent = %d: ", T[u].parent);
      |                                ^~~~~~
a.cc:50:11: error: 'struct Node' has no member named 'left'
   50 |   if(T[u].left!=NIL) deg++;
      |           ^~~~
a.cc:51:11: error: 'struct Node' has no member named 'right'
   51 |   if(T[u].right!=NIL) deg++;
      |           ^~~~~
a.cc:56:11: error: 'struct Node' has no member named 'parent'
   56 |   if(T[u].parent==NIL){
      |           ^~~~~~
a.cc:58:17: error: 'struct Node' has no member named 'left'
   58 |   }else if(T[u].left==NIL && T[u].right==NIL ){
      |                 ^~~~
a.cc:58:35: error: 'struct Node' has no member named 'right'
   58 |   }else if(T[u].left==NIL && T[u].right==NIL ){
      |                                   ^~~~~
a.cc:60:3: error: expected '}' before 'else'
   60 |   else{
      |   ^~~~
a.cc:58:47: note: to match this '{'
   58 |   }else if(T[u].left==NIL && T[u].right==NIL ){
      |                                               ^
a.cc: In function 'int main()':
a.cc:69:7: error: 'i' was not declared in this scope
   69 |   for(i=0;i<n;i++) T[i].parent=NIL;//初期化
      |       ^
a.cc:71:7: error: 'i' was not declared in this scope
   71 |   for(i=0;i<n;i++){
      |       ^
a.cc:72:23: error: expected primary-expression before '%' token
   72 |   scanf("%d %d %d",&v,%l,&r);
      |                       ^
a.cc:73:8: error: 'struct Node' has no member named 'left'
   73 |   T[v].left=l;
      |        ^~~~
a.cc:74:8: error: 'struct Node' has no member named 'right'
   74 |   T[v].right=r;
      |        ^~~~~
a.cc:75:20: error: 'struct Node' has no member named 'paretn'
   75 |   if(l !=NIL) T[l].paretn=v;
      |                    ^~~~~~
a.cc:76:20: error: 'struct Node' has no member named 'paretn'
   76 |   if(r !=NIL) T[r].paretn=v;
      |                    ^~~~~~
a.cc:79:7: error: 'i' was not declared in this scope
   79 |   for(i=0;i<n;i++) if(T[i].parent==NIL) root=i;
      |       ^
a.cc:82:3: error: 'setHight' was not declared in this scope; did you mean 'setHigh'?
   82 |   setHight(root);
      |   ^~~~~~~~
      |   setHigh
a.cc:84:7: error: 'i' was not declared in this scope
   84 |   for(i=0;i<n;i++) print(i);
      |       ^