Language: C++

#include <iostream>
using namespace std;

#define MAX 25
#define NIL -1

Node node[MAX];
int depth[MAX], height[MAX];

struct Node {
	int parent;
	int left, right;
};

int sibling(int i) {
	if (node[i].parent == NIL) {
		return NIL;
	}
	else {
		int ori = i;
		int l = node[node[i].parent].left;
		int r = node[node[i].parent].right;

		if (ori == l) { return r; }
		else { return l; }
	}
}

int degree(int i) {
	if (node[i].left != NIL && node[i].right != NIL) {
		return 2;
	}
	else if (node[i].left == NIL && node[i].right == NIL) {
		return 0;
	}
	else {
		return 1;
	}
}

void fdepth(int u, int value) {
	if (u == NIL) { return; }
	depth[u] = value;
	fdepth(node[u].left, value + 1);
	fdepth(node[u].right, value + 1);
}

int fheight(int u) {
	int h1 = 0, h2 = 0;
	if (node[u].left != NIL) { h1 = fheight(node[u].left) + 1; }
	if (node[u].right != NIL) { h2 = fheight(node[u].right) + 1; }
	return height[u] = (h1>h2 ? h1 : h2);
}
void type(int i) {
	if (node[i].parent == NIL) { cout << "root"; }
	else if (node[i].left == NIL && node[i].right == NIL) { cout << "leaf"; }
	else { cout << "internal node"; }
}

void output(int n) {
	for (int i = 0; i<n; i++) {
		cout << "node " << i << ": ";
		cout << "parent = " << node[i].parent << ", ";
		cout << "sibling = " << sibling(i) << ", ";
		cout << "degree = " << degree(i) << ", ";
		cout << "depth = " << depth[i] << ", ";
		cout << "height = " << fheight(i) << ", ";
		type(i);
		cout << "\n";
	}
}

int main() {
	for (int i = 0; i<MAX; i++) {
		depth[i] = NIL;
		node[i].parent = NIL;
	}

	int n;
	cin >> n;
	for (int i = 0; i<n; i++) {
		int id, left, right;
		cin >> id >> left >> right;

		node[id].left = left;
		node[id].right = right;
		if (left != -1) { node[left].parent = id; }
		if (right != -1) { node[right].parent = id; }
	}
	int u = 0;
	for (int i = 0; i<n; i++) {
		if (node[i].parent == NIL) {
			u = i;
		}
	}
	fdepth(u, 0);
	output(n);

	return 0;

Compiler output:
a.cc:7:1: error: 'Node' does not name a type
    7 | Node node[MAX];
      | ^~~~
a.cc: In function 'int sibling(int)':
a.cc:16:13: error: 'node' was not declared in this scope; did you mean 'Node'?
   16 |         if (node[i].parent == NIL) {
      |             ^~~~
      |             Node
a.cc: In function 'int degree(int)':
a.cc:30:13: error: 'node' was not declared in this scope; did you mean 'Node'?
   30 |         if (node[i].left != NIL && node[i].right != NIL) {
      |             ^~~~
      |             Node
a.cc: In function 'void fdepth(int, int)':
a.cc:44:16: error: 'node' was not declared in this scope; did you mean 'Node'?
   44 |         fdepth(node[u].left, value + 1);
      |                ^~~~
      |                Node
a.cc: In function 'int fheight(int)':
a.cc:50:13: error: 'node' was not declared in this scope; did you mean 'Node'?
   50 |         if (node[u].left != NIL) { h1 = fheight(node[u].left) + 1; }
      |             ^~~~
      |             Node
a.cc:51:13: error: 'node' was not declared in this scope; did you mean 'Node'?
   51 |         if (node[u].right != NIL) { h2 = fheight(node[u].right) + 1; }
      |             ^~~~
      |             Node
a.cc: In function 'void type(int)':
a.cc:55:13: error: 'node' was not declared in this scope; did you mean 'Node'?
   55 |         if (node[i].parent == NIL) { cout << "root"; }
      |             ^~~~
      |             Node
a.cc: In function 'void output(int)':
a.cc:63:40: error: 'node' was not declared in this scope; did you mean 'Node'?
   63 |                 cout << "parent = " << node[i].parent << ", ";
      |                                        ^~~~
      |                                        Node
a.cc: In function 'int main()':
a.cc:76:17: error: 'node' was not declared in this scope; did you mean 'Node'?
   76 |                 node[i].parent = NIL;
      |                 ^~~~
      |                 Node
a.cc:85:17: error: 'node' was not declared in this scope; did you mean 'Node'?
   85 |                 node[id].left = left;
      |                 ^~~~
      |                 Node
a.cc:92:21: error: 'node' was not declared in this scope; did you mean 'Node'?
   92 |                 if (node[i].parent == NIL) {
      |                     ^~~~
      |                     Node
a.cc:99:18: error: expected '}' at end of input
   99 |         return 0;
      |                  ^
a.cc:73:12: note: to match this '{'
   73 | int main() {
      |            ^
a.cc: In function 'int sibling(int)':
a.cc:27:1: warning: control reaches end of non-void function [-Wreturn-type]
   27 | }
      | ^
a.cc: In function 'int degree(int)':
a.cc:39:1: warning: control reaches end of non-void function [-Wreturn-type]
   39 | }
      | ^