Language: C++

#include <bits/stdc++.h>
using namespace std;
#define MAX 100005;
#define NIL -1;

struct Node{int p, l, r;};
Node T[MAX];
int n, D[MAX];

void print(int u) {
  int i, c;
  cout << "node " << u << ": ";
  cout << "parent = " << T[u].p << ", ";
  cout << "depth = " << D[u] << ", ";

  if (T[u].p == NIL) cout << "root, ";
  else if (T[u].l == NIL) cout << "leaf, ";
  else cout << "internal node, ";

  cout << "[";

  for (int i = 0, c = T[u].l; c != NIL; i ++, c = T[c].r) {
    if (i) cout << ", ";
    cout << c;
  }
  cout << "]" << endl;
}

int rec(int u, int p) {
  D[u] = p;
  if (T[u].r != NIL) rec(T[u].r, p);
  if (T[u].l != NIL) rec(T[u].l, p + 1);
}

int main() {
  int i, j, d, v, c, l, r;
  cin >> n;
  for (i = 0; i < n; i ++) T[i].p = T[i].l = T[i].r = NIL;

  for (i = 0; i < n; i ++) {
    cin >> v >> d;
    for (j = 0; j < d; j ++) {
      cin >> c;
      if (j == 0) T[v].l = c;
      else T[l].r = c;
      l = c;
      T[c].p = v;
    }
  }
  for (i = 0; i < n; i ++) {
    if (T[i].p == NIL) r = i;
  }

  rec(r, 0);

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

  return 0;
}



Compiler output:
a.cc:3:19: error: expected ']' before ';' token
    3 | #define MAX 100005;
      |                   ^
a.cc:7:8: note: in expansion of macro 'MAX'
    7 | Node T[MAX];
      |        ^~~
a.cc:7:11: error: expected unqualified-id before ']' token
    7 | Node T[MAX];
      |           ^
a.cc:3:19: error: expected ']' before ';' token
    3 | #define MAX 100005;
      |                   ^
a.cc:8:10: note: in expansion of macro 'MAX'
    8 | int n, D[MAX];
      |          ^~~
a.cc:8:13: error: expected unqualified-id before ']' token
    8 | int n, D[MAX];
      |             ^
a.cc: In function 'void print(int)':
a.cc:13:26: error: 'T' was not declared in this scope
   13 |   cout << "parent = " << T[u].p << ", ";
      |                          ^
a.cc:14:25: error: 'D' was not declared in this scope
   14 |   cout << "depth = " << D[u] << ", ";
      |                         ^
a.cc:16:20: error: expected primary-expression before ')' token
   16 |   if (T[u].p == NIL) cout << "root, ";
      |                    ^
a.cc:17:25: error: expected primary-expression before ')' token
   17 |   else if (T[u].l == NIL) cout << "leaf, ";
      |                         ^
a.cc:22:39: error: expected primary-expression before ';' token
   22 |   for (int i = 0, c = T[u].l; c != NIL; i ++, c = T[c].r) {
      |                                       ^
a.cc:22:39: error: expected ')' before ';' token
   22 |   for (int i = 0, c = T[u].l; c != NIL; i ++, c = T[c].r) {
      |       ~                               ^
a.cc: In function 'int rec(int, int)':
a.cc:30:3: error: 'D' was not declared in this scope
   30 |   D[u] = p;
      |   ^
a.cc:31:7: error: 'T' was not declared in this scope
   31 |   if (T[u].r != NIL) rec(T[u].r, p);
      |       ^
a.cc:31:20: error: expected primary-expression before ')' token
   31 |   if (T[u].r != NIL) rec(T[u].r, p);
      |                    ^
a.cc:32:7: error: 'T' was not declared in this scope
   32 |   if (T[u].l != NIL) rec(T[u].l, p + 1);
      |       ^
a.cc:32:20: error: expected primary-expression before ')' token
   32 |   if (T[u].l != NIL) rec(T[u].l, p + 1);
      |                    ^
a.cc:33:1: warning: no return statement in function returning non-void [-Wreturn-type]
   33 | }
      | ^
a.cc: In function 'int main()':
a.cc:38:28: error: 'T' was not declared in this scope
   38 |   for (i = 0; i < n; i ++) T[i].p = T[i].l = T[i].r = NIL;
      |                            ^
a.cc:44:19: error: 'T' was not declared in this scope
   44 |       if (j == 0) T[v].l = c;
      |                   ^
a.cc:45:12: error: 'T' was not declared in this scope
   45 |       else T[l].r = c;
      |            ^
a.cc:47:7: error: 'T' was not declared in this scope
   47 |       T[c].p = v;
      |       ^
a.cc:51:9: error: 'T' was not declared in this scope
   51 |     if (T[i].p == NIL) r = i;
      |         ^
a.cc:51:22: error: expected primary-expression before ')' token
   51 |     if (T[i].p == NIL) r = i;
      |                      ^