Language: C++

#include<iostream>
using namespace std;
#define MAX 100005
#define NIL -1;

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

Node T[MAX];
int n,D[MAX];

int main(){
int i,j;
inT 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;
}

dep(r,0);

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

return 0;
}

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(i=0;c=T[u].l;c!=NIL;i++,c=T[c].r){
if(i)cout <<", ";
cout <<c;
}
cout <<"]"<<endl;
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:15:1: error: 'inT' was not declared in this scope; did you mean 'int'?
   15 | inT d,v,c,l,r;
      | ^~~
      | int
a.cc:20:6: error: 'v' was not declared in this scope
   20 | cin>>v>>d;
      |      ^
a.cc:20:9: error: 'd' was not declared in this scope
   20 | cin>>v>>d;
      |         ^
a.cc:22:6: error: 'c' was not declared in this scope
   22 | cin>>c;
      |      ^
a.cc:23:11: error: 'V' was not declared in this scope
   23 | if(j==0)T[V].l=c;
      |           ^
a.cc:24:8: error: 'l' was not declared in this scope
   24 | else T[l].r=c;
      |        ^
a.cc:25:1: error: 'l' was not declared in this scope
   25 | l=c;
      | ^
a.cc:30:15: error: expected primary-expression before ')' token
   30 | if(T[i].p==NIL)r=i;
      |               ^
a.cc:30:16: error: 'r' was not declared in this scope
   30 | if(T[i].p==NIL)r=i;
      |                ^
a.cc:33:5: error: 'r' was not declared in this scope
   33 | dep(r,0);
      |     ^
a.cc:33:1: error: 'dep' was not declared in this scope
   33 | dep(r,0);
      | ^~~
a.cc:35:17: error: 'print' was not declared in this scope; did you mean 'printf'?
   35 | for(i=0;i<n;i++)print(i);
      |                 ^~~~~
      |                 printf
a.cc: In function 'void print(int)':
a.cc:46:15: error: expected primary-expression before ')' token
   46 | if(T[u].p==NIL)cout <<"root, ";
      |               ^
a.cc:47:20: error: expected primary-expression before ')' token
   47 | else if(T[u].l==NIL)cout <<"leaf, ";
      |                    ^
a.cc:4:15: error: expected ')' before ';' token
    4 | #define NIL -1;
      |               ^
a.cc:52:21: note: in expansion of macro 'NIL'
   52 | for(i=0;c=T[u].l;c!=NIL;i++,c=T[c].r){
      |                     ^~~
a.cc:52:4: note: to match this '('
   52 | for(i=0;c=T[u].l;c!=NIL;i++,c=T[c].r){
      |    ^
a.cc:52:37: error: expected ';' before ')' token
   52 | for(i=0;c=T[u].l;c!=NIL;i++,c=T[c].r){
      |                                     ^
      |                                     ;
a.cc: In function 'int dep(int, int)':
a.cc:61:15: error: expected primary-expression before ')' token
   61 | if(T[u].r!=NIL)dep(T[u].r,p);
      |               ^
a.cc:62:15: error: expected primary-expression before ')' token
   62 | if(T[u].l!=NIL)dep(T[u].l,p+1);
      |               ^
a.cc:63:1: warning: no return statement in function returning non-void [-Wreturn-type]
   63 | }
      | ^