Language: C++

#include<iostream>
using namespase std;
#difine MAX 100005
#difine 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 << ", ";
	out << "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++)
	{
		printf(i);
	}
	return 0;
}

Compiler output:
a.cc:3:2: error: invalid preprocessing directive #difine; did you mean #define?
    3 | #difine MAX 100005
      |  ^~~~~~
      |  define
a.cc:4:2: error: invalid preprocessing directive #difine; did you mean #define?
    4 | #difine NIL -1
      |  ^~~~~~
      |  define
a.cc:2:7: error: expected nested-name-specifier before 'namespase'
    2 | using namespase std;
      |       ^~~~~~~~~
a.cc:11:8: error: 'MAX' was not declared in this scope
   11 | Node T[MAX];
      |        ^~~
a.cc:12:9: error: 'MAX' was not declared in this scope
   12 | int n,D[MAX];
      |         ^~~
a.cc: In function 'void print(int)':
a.cc:17:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   17 |         cout << "node" << u <<": ";
      |         ^~~~
      |         std::cout
In file included from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:18:31: error: 'T' was not declared in this scope
   18 |         cout << "parent= " << T[u].p << ", ";
      |                               ^
a.cc:19:9: error: 'out' was not declared in this scope
   19 |         out << "depth= " << D[u] << ", ";
      |         ^~~
a.cc:19:29: error: 'D' was not declared in this scope
   19 |         out << "depth= " << D[u] << ", ";
      |                             ^
a.cc:21:23: error: 'NIL' was not declared in this scope
   21 |         if (T[u].p == NIL)
      |                       ^~~
a.cc:36:40: error: 'NIL' was not declared in this scope
   36 |         for (int i = 0;c = T[u].l;c != NIL;i++, c =T[c].r)
      |                                        ^~~
a.cc:36:43: error: expected ')' before ';' token
   36 |         for (int i = 0;c = T[u].l;c != NIL;i++, c =T[c].r)
      |             ~                             ^
      |                                           )
a.cc:41:24: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   41 |         cout << "]" << endl;
      |                        ^~~~
      |                        std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc: In function 'int rec(int, int)':
a.cc:46:9: error: 'D' was not declared in this scope
   46 |         D[u]=p;
      |         ^
a.cc:47:12: error: 'T' was not declared in this scope
   47 |         if(T[u].r !=NIL) rec(T[u].r,p);
      |            ^
a.cc:47:21: error: 'NIL' was not declared in this scope
   47 |         if(T[u].r !=NIL) rec(T[u].r,p);
      |                     ^~~
a.cc:48:12: error: 'T' was not declared in this scope
   48 |         if(T[u].l !=NIL) rec(T[u].l,p+1);
      |            ^
a.cc:48:21: error: 'NIL' was not declared in this scope
   48 |         if(T[u].l !=NIL) rec(T[u].l,p+1);
      |                     ^~~
a.cc:49:1: warning: no return statement in function returning non-void [-Wreturn-type]
   49 | }
      | ^
a.cc: In function 'int main()':
a.cc:54:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   54 |         cin >> n;
      |         ^~~
      |         std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:57:17: error: 'T' was not declared in this scope
   57 |                 T[i].p= T[i].l=T[i].r=NIL;
      |                 ^
a.cc:57:39: error: 'NIL' was not declared in this scope
   57 |                 T[i].p= T[i].l=T[i].r=NIL;
      |                                       ^~~
a.cc:67:33: error: 't' was not declared in this scope
   67 |                                 t[v].l=c;
      |                                 ^
a.cc:71:33: error: 'T' was not declared in this scope
   71 |                                 T[l].r=c;
      |                                 ^
a.cc:74:25: error: 'T' was not declared in this scope
   74 |                         T[c].p=v;
      |                         ^
a.cc:79:20: error: 'T' was not declared in this scope
   79 |                 if(T[i].p == NIL)r=i;
      |                    ^
a.cc:79:30: error: 'NIL' was not declared in this scope
   79 |                 if(T[i].p == NIL)r=i;
      |                              ^~~
a.cc:86:24: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
   86 |                 printf(i);
      |                        ^
      |                        |
      |                        int
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40:
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~