criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define llong long long
#define IFY 2000000000
#define MAX 100005
#define NIL -1
using namespace std;
struct Node {int p,l,r};
Node T[MAX];
int n,D[MAX];
int j,c;
void print(int u){
  printf("node %d:",u);
  printf("parent = %d,",T[u].p);
  printf("depth = %d,",D[u]);
  if(T[u].p==NIL)printf("root, ");
  else if(T[u].l==NIL)printf("leaf, ");
  else printf("internal node, ");
  printf("[");
  for(j=0,c=T[u].l;c!=NIL;j++,c=T[c].r){
    if(j) printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}
int rec(int u,int p){
  D[u]=p;
  if(T[u].l!=NIL) rec(T[u].l,p+1);
  if(T[u].r!=NIL) rec(T[u].r,p);
}
int main(){
  scanf("%d",&n);
  REP(i,n){
    scanf("%d %d",&v,&d);
    REP(i,d){
      scanf("%d",c);
      if(j==0) T[v].l=c;
      else T[l].r=c;
      l=c;
      T[c].p=v;
    }
  }
  REP(i,n){
    if(T[i].p==NIL) r=i;
  }
  rec(r,0);
  REP(i,n) print(i);
  return 0;
}

Compiler output:
a.cc:9:22: error: expected ';' at end of member declaration
    9 | struct Node {int p,l,r};
      |                      ^
      |                       ;
a.cc: In function 'int rec(int, int)':
a.cc:31:1: warning: no return statement in function returning non-void [-Wreturn-type]
   31 | }
      | ^
a.cc: In function 'int main()':
a.cc:35:20: error: 'v' was not declared in this scope
   35 |     scanf("%d %d",&v,&d);
      |                    ^
a.cc:35:23: error: 'd' was not declared in this scope
   35 |     scanf("%d %d",&v,&d);
      |                       ^
a.cc:39:14: error: 'l' was not declared in this scope
   39 |       else T[l].r=c;
      |              ^
a.cc:40:7: error: 'l' was not declared in this scope
   40 |       l=c;
      |       ^
a.cc:45:21: error: 'r' was not declared in this scope
   45 |     if(T[i].p==NIL) r=i;
      |                     ^
a.cc:47:7: error: 'r' was not declared in this scope
   47 |   rec(r,0);
      |       ^
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define llong long long
#define IFY 2000000000
#define MAX 100005
#define NIL -1
using namespace std;
struct Node {int p,l,r;};
Node T[MAX];
int D[MAX];
void print(int u){
  printf("node %d:",u);
  printf("parent = %d,",T[u].p);
  printf("depth = %d,",D[u]);
  if(T[u].p==NIL)printf("root, ");
  else if(T[u].l==NIL)printf("leaf, ");
  else printf("internal node, ");
  printf("[");
  for(int j=0,int c=T[u].l;c!=NIL;j++,c=T[c].r){
    if(j) printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}
int rec(int u,int p){
  D[u]=p;
  if(T[u].l!=NIL) rec(T[u].l,p+1);
  if(T[u].r!=NIL) rec(T[u].r,p);
}
int main(){
  int n,v,d,c,l,r;
  scanf("%d",&n);
  REP(i,n){
    scanf("%d %d",&v,&d);
    REP(i,d){
      scanf("%d",c);
      if(j==0) T[v].l=c;
      else T[l].r=c;
      l=c;
      T[c].p=v;
    }
  }
  REP(i,n){
    if(T[i].p==NIL) r=i;
  }
  rec(r,0);
  REP(i,n) print(i);
  return 0;
}

Compiler output:
a.cc: In function 'void print(int)':
a.cc:20:15: error: expected unqualified-id before 'int'
   20 |   for(int j=0,int c=T[u].l;c!=NIL;j++,c=T[c].r){
      |               ^~~
a.cc:20:15: error: expected ';' before 'int'
   20 |   for(int j=0,int c=T[u].l;c!=NIL;j++,c=T[c].r){
      |               ^~~
      |               ;
a.cc:20:34: error: expected ')' before ';' token
   20 |   for(int j=0,int c=T[u].l;c!=NIL;j++,c=T[c].r){
      |      ~                           ^
a.cc:20:35: error: 'j' was not declared in this scope
   20 |   for(int j=0,int c=T[u].l;c!=NIL;j++,c=T[c].r){
      |                                   ^
a.cc:20:39: error: 'c' was not declared in this scope
   20 |   for(int j=0,int c=T[u].l;c!=NIL;j++,c=T[c].r){
      |                                       ^
a.cc: In function 'int rec(int, int)':
a.cc:30:1: warning: no return statement in function returning non-void [-Wreturn-type]
   30 | }
      | ^
a.cc: In function 'int main()':
a.cc:38:10: error: 'j' was not declared in this scope
   38 |       if(j==0) T[v].l=c;
      |          ^
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define llong long long
#define IFY 2000000000
#define MAX 100005
#define NIL -1
using namespace std;
struct Node {int p,l,r;};
Node T[MAX];
int D[MAX];
void print(int u){
  int j,c;
  printf("node %d:",u);
  printf("parent = %d,",T[u].p);
  printf("depth = %d,",D[u]);
  if(T[u].p==NIL)printf("root, ");
  else if(T[u].l==NIL)printf("leaf, ");
  else printf("internal node, ");
  printf("[");
  for(j=0,c=T[u].l;c!=NIL;j++,c=T[c].r){
    if(j) printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}
int rec(int u,int p){
  D[u]=p;
  if(T[u].l!=NIL) rec(T[u].l,p+1);
  if(T[u].r!=NIL) rec(T[u].r,p);
}
int main(){
  int n,v,d,c,l,r;
  scanf("%d",&n);
  REP(i,n){
    scanf("%d %d",&v,&d);
    REP(i,d){
      scanf("%d",c);
      if(j==0) T[v].l=c;
      else T[l].r=c;
      l=c;
      T[c].p=v;
    }
  }
  REP(i,n){
    if(T[i].p==NIL) r=i;
  }
  rec(r,0);
  REP(i,n) print(i);
  return 0;
}

Compiler output:
a.cc: In function 'int rec(int, int)':
a.cc:31:1: warning: no return statement in function returning non-void [-Wreturn-type]
   31 | }
      | ^
a.cc: In function 'int main()':
a.cc:39:10: error: 'j' was not declared in this scope
   39 |       if(j==0) T[v].l=c;
      |          ^
Language: C++

#include <iosteream>
#define MAX 100005
#define NIL -1

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

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

void print(int u){
  int c;
  std::cout << "node " << u << ": ";
  std::cout << "parent = " << T[u].p << ", ";
  std::cout << "depth = " << D[u] << ", " ;
  
  if(T[u].p == NIL)std::cout << "root, ";
  else if(T[u].l == NIL) std::cout << "leaf, ";
  else std::cout << "internal node, ";
  
  std::cout << "[";
  
  for(int i = 0,c=T[u].l;c!=NIL;++i,c=T[c].r){
    if(i)std::cout<<", ";
    std::cout << c;
  }
  
  std::cout  << "]" <<std::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 v,d,c,l,r;
  std::cin >> n;
  for(int i=0;i<n;++i){
    T[i].p = T[i].l = T[i].r = NIL;
  }
  
  for(int i=0;i<n;++i){
    std::cin >> v >> d;
    for(int j=0;j<d;++j){
      std::cin >> c;
      if(j==0)T[v].l = c;
      else T[l].r =c;
      l=c;
      T[c].p = v;
    }
  }
  
  for(int i=0;i<n;++i){
    if(T[i].p == NIL) r=i;
  }
  
  rec(r,0);
  
  for(int i=0;i<n;++i){
    print(i);
  }
  
  return 0;
  
}

Compiler output:
a.cc:1:10: fatal error: iosteream: No such file or directory
    1 | #include <iosteream>
      |          ^~~~~~~~~~~
compilation terminated.
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];

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 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: In function 'void print(int)':
a.cc:36:39: error: expected ')' before ';' token
   36 |         for (i = 0;c = T[u].l;c != NIL;i++, c =T[c].r)
      |             ~                         ^
a.cc:36:54: error: expected ';' before ')' token
   36 |         for (i = 0;c = T[u].l;c != NIL;i++, c =T[c].r)
      |                                                      ^
      |                                                      ;
a.cc: In function 'int rec(int, int)':
a.cc:49:1: warning: no return statement in function returning non-void [-Wreturn-type]
   49 | }
      | ^
a.cc: In function 'int main()':
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,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
Language: C++

#include <iostream>
#define MAX 100005
#define NIL -1

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

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

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

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

 std::cout << "[";

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

 std::cout?? << "]" <<std::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 v,d,c,l,r;
 std::cin >> n;
 for(int i=0;i<n;++i){
  T[i].p = T[i].l = T[i].r = NIL;
 }

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

  for(int i=0;i<n;++i){
   if(T[i].p == NIL) r=i;
  }

rec(r,0);

for(int i=0;i<n;++i){
print(i);
}

return 0;


}

Compiler output:
a.cc: In function 'void print(int)':
a.cc:27:12: error: expected primary-expression before '?' token
   27 |  std::cout?? << "]" <<std::endl;
      |            ^
a.cc:27:14: error: expected primary-expression before '<<' token
   27 |  std::cout?? << "]" <<std::endl;
      |              ^~
a.cc:27:32: error: expected ':' before ';' token
   27 |  std::cout?? << "]" <<std::endl;
      |                                ^
      |                                :
a.cc:27:32: error: expected primary-expression before ';' token
a.cc:27:32: error: expected ':' before ';' token
   27 |  std::cout?? << "]" <<std::endl;
      |                                ^
      |                                :
a.cc:27:32: error: expected primary-expression before ';' token
a.cc: In function 'int rec(int, int)':
a.cc:34:1: warning: no return statement in function returning non-void [-Wreturn-type]
   34 | }
      | ^
Language: C++

#include<iostream>
using namespace std;
????
#define INF 10000000
#define NIL -1
????
struct Node{int parent,left,right;};
Node T[INF];
int n,D[INF];
????
void print(int u){
????int i,c;
????cout << "node " << u << ": ";
????cout << "parent = " << T[u].parent << ", ";
????cout << "depth = " << D[u] << ", ";
????
????if(T[u].parent==NIL) cout << "root, ";
????else if(T[u].left == NIL) cout << "leaf, ";
????else cout << "internal node, ";
????
????cout << "[";
????for(i=0,c=T[u].left;c!=NIL;i++,c=T[c].right){
????????if(i) cout << ", ";
????????cout << c;
????}
????cout << "]" << endl;
}
????
void rec(int u,int p){
????D[u] = p;
????if(T[u].right != NIL) rec(T[u].right,p);
????if(T[u].left != NIL) rec(T[u].left,p+1);?? 
}
????
int main(void){
????int i,j,d,v,c,left,right;
????
????cin >> n;
????for(i=0;i<n;i++) T[i].parent = T[i].left = T[i].right = NIL;
????
????for(i=0;i<n;i++){
????????cin >> v >> d;
????????for(j=0;j<d;j++){
????????????cin >> c;
????????????if(j==0) T[v].left = c;
????????????else T[left].right = c;
????????????left = c;
????????????T[c].parent = v;
????????}
????}
????
????for(i=0;i<n;i++) if(T[i].parent==NIL) right = i;
????rec(right,0);
????
????for(i=0;i<n;i++) print(i);
}

Compiler output:
a.cc:3:1: error: expected unqualified-id before '?' token
    3 | ????
      | ^
a.cc:8:1: error: 'Node' does not name a type
    8 | Node T[INF];
      | ^~~~
a.cc:10:1: error: expected unqualified-id before '?' token
   10 | ????
      | ^
a.cc:28:1: error: expected unqualified-id before '?' token
   28 | ????
      | ^
a.cc:34:1: error: expected unqualified-id before '?' token
   34 | ????
      | ^
Language: C++

#include<iostream>
using namespace std;

#define INF 10000000
#define NIL -1

struct Node{int parent,left,right;};
Node T[INF];
int n,D[INF];

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

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

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

void rec(int u,int p){
D[u] = p;
if(T[u].right != NIL) rec(T[u].right,p);
if(T[u].left != NIL) rec(T[u].left,p+1);?? 
}

int main(void){
int i,j,d,v,c,left,right;

cin >> n;
for(i=0;i<n;i++) T[i].parent = T[i].left = T[i].right = NIL;

for(i=0;i<n;i++){
cin >> v >> d;
for(j=0;j<d;j++){
cin >> c;
if(j==0) T[v].left = c;
else T[left].right = c;
left = c;
T[c].parent = v;
}
}

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

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

Compiler output:
a.cc: In function 'void rec(int, int)':
a.cc:32:41: error: expected primary-expression before '?' token
   32 | if(T[u].left != NIL) rec(T[u].left,p+1);??
      |                                         ^
a.cc:32:42: error: expected primary-expression before '?' token
   32 | if(T[u].left != NIL) rec(T[u].left,p+1);??
      |                                          ^
a.cc:33:1: error: expected primary-expression before '}' token
   33 | }
      | ^
a.cc:32:43: error: expected ':' before '}' token
   32 | if(T[u].left != NIL) rec(T[u].left,p+1);??
      |                                           ^
      |                                           :
   33 | }
      | ~                                          
a.cc:33:1: error: expected primary-expression before '}' token
   33 | }
      | ^
a.cc:32:43: error: expected ':' before '}' token
   32 | if(T[u].left != NIL) rec(T[u].left,p+1);??
      |                                           ^
      |                                           :
   33 | }
      | ~                                          
a.cc:33:1: error: expected primary-expression before '}' token
   33 | }
      | ^
Language: C++

#include<iostream>
using namespace std;

#define INF 10000000
#define NIL -1

struct Node{int parent,left,right;};
Node T[INF];
int n,D[INF];

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

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

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

void rec(int u,int p){
D[u] = p;
if(T[u].right != NIL) rec(T[u].right,p);
if(T[u].left != NIL) rec(T[u].left,p+1);?? 
}

int main(void){
int i,j,d,v,c,left,right;

cin >> n;
for(i=0;i<n;i++) T[i].parent = T[i].left = T[i].right = NIL;

for(i=0;i<n;i++){
cin >> v >> d;
for(j=0;j<d;j++){
cin >> c;
if(j==0) T[v].left = c;
else T[left].right = c;
left = c;
T[c].parent = v;
}
}

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

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

return 0;
}

Compiler output:
a.cc: In function 'void rec(int, int)':
a.cc:32:41: error: expected primary-expression before '?' token
   32 | if(T[u].left != NIL) rec(T[u].left,p+1);??
      |                                         ^
a.cc:32:42: error: expected primary-expression before '?' token
   32 | if(T[u].left != NIL) rec(T[u].left,p+1);??
      |                                          ^
a.cc:33:1: error: expected primary-expression before '}' token
   33 | }
      | ^
a.cc:32:43: error: expected ':' before '}' token
   32 | if(T[u].left != NIL) rec(T[u].left,p+1);??
      |                                           ^
      |                                           :
   33 | }
      | ~                                          
a.cc:33:1: error: expected primary-expression before '}' token
   33 | }
      | ^
a.cc:32:43: error: expected ':' before '}' token
   32 | if(T[u].left != NIL) rec(T[u].left,p+1);??
      |                                           ^
      |                                           :
   33 | }
      | ~                                          
a.cc:33:1: error: expected primary-expression before '}' token
   33 | }
      | ^
a.cc: At global scope:
a.cc:58:1: error: expected unqualified-id before 'return'
   58 | return 0;
      | ^~~~~~
a.cc:59:1: error: expected declaration before '}' token
   59 | }
      | ^
Language: C++

#include <iostream>
#define MAX 100005
#define NIL -1
??
struct Node{int p,l,r;};
??
Node T[MAX];
int n,D[MAX];
??
void print(int u){
????int c;
????std::cout << "node " << u << ": ";
????std::cout << "parent = " << T[u].p << ", ";
????std::cout << "depth = " << D[u] << ", " ;
??????
????if(T[u].p == NIL)std::cout << "root, ";
????else if(T[u].l == NIL) std::cout << "leaf, ";
????else std::cout << "internal node, ";
??????
????std::cout << "[";
??????
????for(int i = 0,c=T[u].l;c!=NIL;++i,c=T[c].r){
????????if(i)std::cout<<", ";
????????std::cout << c;
????}
??????
????std::cout?? << "]" <<std::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 v,d,c,l,r;
????std::cin >> n;
????for(int i=0;i<n;++i){
????????T[i].p = T[i].l = T[i].r = NIL;
????}
??????
????for(int i=0;i<n;++i){
????????std::cin >> v >> d;
????????for(int j=0;j<d;++j){
????????????std::cin >> c;
????????????if(j==0)T[v].l = c;
????????????else T[l].r =c;
????????????l=c;
????????????T[c].p = v;
????????}
????}
??????
????for(int i=0;i<n;++i){
????????if(T[i].p == NIL) r=i;
????}
??????
????rec(r,0);
??????
????for(int i=0;i<n;++i){
????????print(i);
????}
??????
????return 0;
??????
}

Compiler output:
a.cc:4:1: error: expected unqualified-id before '?' token
    4 | ??
      | ^
a.cc:6:1: error: expected unqualified-id before '?' token
    6 | ??
      | ^
a.cc:9:1: error: expected unqualified-id before '?' token
    9 | ??
      | ^
a.cc:29:1: error: expected unqualified-id before '?' token
   29 | ??
      | ^
a.cc:35:1: error: expected unqualified-id before '?' token
   35 | ??
      | ^
Language: C++

#include <iostream>
#define MAX 100005
#define NIL -1

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

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

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

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

std::cout << "[";

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

std::cout?? << "]" <<std::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 v,d,c,l,r;
std::cin >> n;
for(int i=0;i<n;++i){
T[i].p = T[i].l = T[i].r = NIL;
}

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

for(int i=0;i<n;++i){
if(T[i].p == NIL) r=i;
}

rec(r,0);

for(int i=0;i<n;++i){
print(i);
}

return 0;

}

Compiler output:
a.cc: In function 'void print(int)':
a.cc:27:11: error: expected primary-expression before '?' token
   27 | std::cout?? << "]" <<std::endl;
      |           ^
a.cc:27:13: error: expected primary-expression before '<<' token
   27 | std::cout?? << "]" <<std::endl;
      |             ^~
a.cc:27:31: error: expected ':' before ';' token
   27 | std::cout?? << "]" <<std::endl;
      |                               ^
      |                               :
a.cc:27:31: error: expected primary-expression before ';' token
a.cc:27:31: error: expected ':' before ';' token
   27 | std::cout?? << "]" <<std::endl;
      |                               ^
      |                               :
a.cc:27:31: error: expected primary-expression before ';' token
a.cc: In function 'int rec(int, int)':
a.cc:34:1: warning: no return statement in function returning non-void [-Wreturn-type]
   34 | }
      | ^
Language: C++

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

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

Node T[MAX];
init 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(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:9:1: error: 'init' does not name a type; did you mean 'int'?
    9 | init n,D[MAX];
      | ^~~~
      | int
a.cc: In function 'void print(int)':
a.cc:15:17: error: 'D' was not declared in this scope
   15 | cout<<"depth="<<D[u]<<",";
      |                 ^
a.cc: In function 'int rec(int, int)':
a.cc:31:1: error: 'D' was not declared in this scope
   31 | D[u]=p;
      | ^
a.cc:34:1: warning: no return statement in function returning non-void [-Wreturn-type]
   34 | }
      | ^
a.cc: In function 'int main()':
a.cc:38:6: error: 'n' was not declared in this scope
   38 | cin>>n;
      |      ^
a.cc:41:18: error: expected primary-expression before '?' token
   41 | for(i=0;i<n;i++){???
      |                  ^
a.cc:41:19: error: expected primary-expression before '?' token
   41 | for(i=0;i<n;i++){???
      |                   ^
a.cc:41:20: error: expected primary-expression before '?' token
   41 | for(i=0;i<n;i++){???
      |                    ^
a.cc:42:10: error: expected ':' before ';' token
   42 | cin>>v>>d;
      |          ^
      |          :
a.cc:42:10: error: expected primary-expression before ';' token
a.cc:42:10: error: expected ':' before ';' token
   42 | cin>>v>>d;
      |          ^
      |          :
a.cc:42:10: error: expected primary-expression before ';' token
a.cc:42:10: error: expected ':' before ';' token
   42 | cin>>v>>d;
      |          ^
      |          :
a.cc:42:10: error: expected primary-expression before ';' token
Language: C++

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

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

Node T[MAX];
init 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(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:9:1: error: 'init' does not name a type; did you mean 'int'?
    9 | init n, D[MAX];
      | ^~~~
      | int
a.cc: In function 'void print(int)':
a.cc:15:21: error: 'D' was not declared in this scope
   15 | cout << "depth=" << D[u] << ", ";
      |                     ^
a.cc: In function 'int rec(int, int)':
a.cc:31:1: error: 'D' was not declared in this scope
   31 | D[u]=p;
      | ^
a.cc:34:1: warning: no return statement in function returning non-void [-Wreturn-type]
   34 | }
      | ^
a.cc: In function 'int main()':
a.cc:38:6: error: 'n' was not declared in this scope
   38 | cin>>n;
      |      ^
a.cc:41:18: error: expected primary-expression before '?' token
   41 | for(i=0;i<n;i++){???
      |                  ^
a.cc:41:19: error: expected primary-expression before '?' token
   41 | for(i=0;i<n;i++){???
      |                   ^
a.cc:41:20: error: expected primary-expression before '?' token
   41 | for(i=0;i<n;i++){???
      |                    ^
a.cc:42:10: error: expected ':' before ';' token
   42 | cin>>v>>d;
      |          ^
      |          :
a.cc:42:10: error: expected primary-expression before ';' token
a.cc:42:10: error: expected ':' before ';' token
   42 | cin>>v>>d;
      |          ^
      |          :
a.cc:42:10: error: expected primary-expression before ';' token
a.cc:42:10: error: expected ':' before ';' token
   42 | cin>>v>>d;
      |          ^
      |          :
a.cc:42:10: error: expected primary-expression before ';' token
Language: C++

#include<iostream>
using namespace std;
#define MAX 1000005
#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 (i = 0; c = T[u].l; c != NIL; i++, c = T[c].r) {
		if (i)cout << ",";
		cout << c;
	}
	cout << "j" << 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: In function 'void print(int)':
a.cc:23:41: error: expected ')' before ';' token
   23 |         for (i = 0; c = T[u].l; c != NIL; i++, c = T[c].r) {
      |             ~                           ^
a.cc:23:58: error: expected ';' before ')' token
   23 |         for (i = 0; c = T[u].l; c != NIL; i++, c = T[c].r) {
      |                                                          ^
      |                                                          ;
a.cc: In function 'int rec(int, int)':
a.cc:34:1: warning: no return statement in function returning non-void [-Wreturn-type]
   34 | }
      | ^
Language: C++

#include<bits/stdc++.h><font></font>
using namespace std;<font></font>
<font></font>
struct tree{<font></font>
  int p;<font></font>
  int l;<font></font>
  int r;<font></font>
  int d;<font></font>
};<font></font>
<font></font>
tree t[100000];<font></font>
<font></font>
void dfs(int n,int d){<font></font>
  if(n==-1)return;<font></font>
  t[n].d=d;<font></font>
  dfs(t[n].r,d),dfs(t[n].l,d+1);<font></font>
}<font></font>
<font></font>
int main(){<font></font>
  int n,a,b,c,tmp;<font></font>
  cin>>n;<font></font>
  for(int i=0;i<n;i++)t[i].l=-1,t[i].p=-1,t[i].r=-1,t[i].d=0;<font></font>
  for(int i=0;i<n;i++){<font></font>
    scanf("%d %d",&a,&b);<font></font>
    for(int j=0;j<b;j++){<font></font>
      scanf("%d",&c);<font></font>
      t[c].p=a;<font></font>
      if(j)t[tmp].r=c;<font></font>
      tmp=c;<font></font>
      if(j==0)t[a].l=c;<font></font>
    }<font></font>
  }<font></font>
  for(int i=0;i<n;i++)if(t[i].p==-1)dfs(i,0);<font></font>
  for(int i=0;i<n;i++){<font></font>
    printf("node %d: parent = %d, depth = %d, ",i,t[i].p,t[i].d);<font></font>
    if(t[i].l==-1){<font></font>
      if(t[i].p==-1)printf("root, []\n");<font></font>
      else printf("leaf, []\n");<font></font>
    }<font></font>
    else{<font></font>
      if(t[i].p==-1)printf("root, [");<font></font>
      else printf("internal node, [");<font></font>
      tmp=t[i].l;<font></font>
      while(1){<font></font>
    if(t[tmp].r==-1){<font></font>
      printf("%d]\n",tmp);<font></font>
      break;<font></font>
    }<font></font>
    printf("%d, ",tmp);<font></font>
    tmp=t[tmp].r;<font></font>
      }<font></font>
    }<font></font>
  }<font></font>
  return 0;<font></font>
}<font></font>
<font></font>
<font></font>

Compiler output:
a.cc:1:24: warning: extra tokens at end of #include directive
    1 | #include<bits/stdc++.h><font></font>
      |                        ^~~~~~
a.cc:2:21: error: expected unqualified-id before '<' token
    2 | using namespace std;<font></font>
      |                     ^
a.cc:9:3: error: expected unqualified-id before '<' token
    9 | };<font></font>
      |   ^
a.cc:11:16: error: expected unqualified-id before '<' token
   11 | tree t[100000];<font></font>
      |                ^
a.cc:17:2: error: expected unqualified-id before '<' token
   17 | }<font></font>
      |  ^
a.cc:55:2: error: expected unqualified-id before '<' token
   55 | }<font></font>
      |  ^
Language: C++

#include<iostream>
#include<string>
using namespace std;
typedef struct{
  int p,r,l;
}node;
node tree[100001];
int n,d[100001];

//出力する関数
int print(int u){
  int i,c;
  cout<<"node "<<u<<": ";
  cout<<"parent = "<<tree[u].p<<", ";
  cout<<"depth = "<<d[u]<<", ";
  if(tree[u].p==-1) cout<<"root, ";
    else if(tree[u].l==-1) cout<<"leaf, ";
    else cout<<"internal node, ";
  cout<<"[";
  for(i=0,c=tree[u].l;c!=-1;++i,c=tree[c].r){
    if(i) cout<<", ";
    cout<<c;
  }
  cout<<"]"<<endl;
}

//深さを求める
int rec(int u,int p){
  d[u]=p;
  if(tree[u].r!=-1) rec(tree[u].r,p);
  if(tree[u].l!=-1) rec(tree[u].l,p+1);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int i,j,d,v,c,l,r;
  cin>>n;
  memset(tree,-1,sizeof(tree));

  //ノードの情報を入力
  for(int i=0;i<n;++i){
    cin>>v>>d;    //v=ノードの番号(親ではない),d=次数
    for(int j=0;j<d;++j){
      cin>>c;
      if(j==0) tree[v].l=c;
      else tree[l].r=c;
      l=c;
      tree[c].p=v;
    }
  }

  //
  for(int i=0;i<n;++i){
    if(tree[i].p==-1) r=i;
  }
  //
  rec(r,0);
  
  //出力
  for(i=0;i<n;++i) print(i);
  
  return 0;
}

Compiler output:
a.cc: In function 'int print(int)':
a.cc:25:1: warning: no return statement in function returning non-void [-Wreturn-type]
   25 | }
      | ^
a.cc: In function 'int rec(int, int)':
a.cc:32:1: warning: no return statement in function returning non-void [-Wreturn-type]
   32 | }
      | ^
a.cc: In function 'int main()':
a.cc:39:3: error: 'memset' was not declared in this scope
   39 |   memset(tree,-1,sizeof(tree));
      |   ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | #include<string>
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
typedef struct{
  int parent,child,brother;
}node;
node tree[100001];
int depth(int x,int sum);
int children(int x);
int main(){
  int n;
  memset(tree,-1,sizeof(tree));
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    int id,k;
    scanf("%d%d",&id,&k);
    if(k>0){
      scanf("%d",&tree[id].child);
      int p=tree[id].child;
      tree[p].parent=id;
      for(int j=0;j<k-1;j++){
	scanf("%d",&tree[p].brother);
	p=tree[p].brother;
	tree[p].parent=id;
      }
    }
  }
  for(int i=0;i<n;i++){
    printf("node %d: parent = %d, ",i,tree[i].parent);
    printf("depth = %d, ",depth(tree[i].parent,0));
    if(tree[i].parent==-1) printf("root, ");
    else if(tree[i].child==-1) printf("leaf, ");
    else printf("internal node, ");
    printf("[");
    if(tree[i].child==-1) printf("]\n");
    else{
      printf("%d",tree[i].child);
      int p=tree[i].child;
      children(tree[p].brother);
      printf("]\n");
    }
  }
    return 0;
}
int depth(int x,int sum){
  if(x==-1) return sum;
  return depth(tree[x].parent,sum+1);
}
int children(int x){
  if(x==-1) return 0;
  else{
    printf(", %d",x);
    return children(tree[x].brother);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'memset' was not declared in this scope
   12 |   memset(tree,-1,sizeof(tree));
      |   ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<cstdio>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
typedef struct{
  int parent,child,brother;
}node;
node tree[100001];
int depth(int x,int sum);
int children(int x);
int main(){
  int n;
  memset(tree,-1,sizeof(tree));
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    int id,k;
    scanf("%d%d",&id,&k);
    if(k>0){
      scanf("%d",&tree[id].child);
      int p=tree[id].child;
      tree[p].parent=id;
      for(int j=0;j<k-1;j++){
	scanf("%d",&tree[p].brother);
	p=tree[p].brother;
	tree[p].parent=id;
      }
    }
  }
  for(int i=0;i<n;i++){
    printf("node %d: parent = %d, ",i,tree[i].parent);
    printf("depth = %d, ",depth(tree[i].parent,0));
    if(tree[i].parent==-1) printf("root, ");
    else if(tree[i].child==-1) printf("leaf, ");
    else printf("internal node, ");
    printf("[");
    if(tree[i].child==-1) printf("]\n");
    else{
      printf("%d",tree[i].child);
      int p=tree[i].child;
      children(tree[p].brother);
      printf("]\n");
    }
  }
    return 0;
}
int depth(int x,int sum){
  if(x==-1) return sum;
  return depth(tree[x].parent,sum+1);
}
int children(int x){
  if(x==-1) return 0;
  else{
    printf(", %d",x);
    return children(tree[x].brother);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:3: error: 'memset' was not declared in this scope
   13 |   memset(tree,-1,sizeof(tree));
      |   ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<cstdio>
  +++ |+#include <cstring>
    3 | #include<string>
Language: C++

#include <stdio.h>

#define MAX 100005
#define NIL -1

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

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

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

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

  printf("[");

  for(i=0, c=T[u].l; c != NIL; i++, c=T[c].r) {
    if(i) printf(", ");
    prinf("%d",c);
  }
  printf("]\n");
}

void 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(void) {
  int i,j,d,v,c,l,r;
  scanf("%d",&n);
  for(i=0;i<n;i++) T[i].p = T[i].l = T[i].r = NIL;
  for(i=0;i<n;i++) {
    scanf("%d %d",&v,&d);
    for(j=0;j<d;j++) {
      scanf("%d",&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: In function 'void print(int)':
a.cc:25:5: error: 'prinf' was not declared in this scope; did you mean 'printf'?
   25 |     prinf("%d",c);
      |     ^~~~~
      |     printf
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];
 
void print(int u) {
	int i,c;
	count << "node "<<u<<": ";
	count << "parent = " <<T[u].p << ", ";
	count << "depth = " << D[u] << "leaf, ";
	else if ( T[u].l == NIL) cout << "leaf, ";
	else cout << "internal node, ";
	
	cout << "[";

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

void 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(void) {
  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:6:21: error: expected ';' at end of member declaration
    6 | struct Node { int p,l.r;}
      |                     ^
      |                      ;
a.cc:6:22: error: expected unqualified-id before '.' token
    6 | struct Node { int p,l.r;}
      |                      ^
a.cc:7:7: error: expected initializer before 'T'
    7 |  Node T[MAX];
      |       ^
a.cc: In function 'void print(int)':
a.cc:12:9: error: 'count' was not declared in this scope
   12 |         count << "node "<<u<<": ";
      |         ^~~~~
a.cc:13:32: error: 'T' was not declared in this scope
   13 |         count << "parent = " <<T[u].p << ", ";
      |                                ^
a.cc:15:9: error: 'else' without a previous 'if'
   15 |         else if ( T[u].l == NIL) cout << "leaf, ";
      |         ^~~~
a.cc:20:41: error: expected primary-expression before ',' token
   20 |         for (i=0, c = T[u].l;c != NIL;++, c = T[c].r){
      |                                         ^
a.cc: In function 'void rec(int, int)':
a.cc:29:6: error: 'T' was not declared in this scope
   29 |   if(T[u].r != NIL) rec(T[u].r,p);
      |      ^
a.cc:30:6: error: 'T' was not declared in this scope
   30 |   if(T[u].l != NIL) rec(T[u].l,p+1);
      |      ^
a.cc: In function 'int main()':
a.cc:36:20: error: 'T' was not declared in this scope
   36 |   for(i=0;i<n;i++) T[i].p = T[i].l = T[i].r = NIL;
      |                    ^
a.cc:41:16: error: 'T' was not declared in this scope
   41 |       if(j==0) T[v].l=c;
      |                ^
a.cc:42:12: error: 'T' was not declared in this scope
   42 |       else T[l].r =c;
      |            ^
a.cc:44:7: error: 'T' was not declared in this scope
   44 |       T[c].p = v;
      |       ^
a.cc:48:8: error: 'T' was not declared in this scope
   48 |     if(T[i].p == NIL) r = i;
      |        ^
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];

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 << 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:6:25: error: expected ';' at end of member declaration
    6 | struct Node { int p, l, r };
      |                         ^
      |                          ;
a.cc: In function 'void print(int)':
a.cc:17:19: error: 'p' was not declared in this scope
   17 |         if ( T[u],p == nil ) cout << "root, ";
      |                   ^
a.cc:18:24: error: 'l' was not declared in this scope
   18 |         else if ( T[u],l == nil ) cout << "leaf, ";
      |                        ^
a.cc:24:24: error: expected primary-expression before '<<' token
   24 |                 if (i) << ", ";
      |                        ^~
a.cc: In function 'int rec(int, int)':
a.cc:34:1: warning: no return statement in function returning non-void [-Wreturn-type]
   34 | }
      | ^
a.cc: In function 'int main()':
a.cc:57:42: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
   57 |         for ( i = 0; i < n; i++ ) 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,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;

int n;

const int NIL = -1;
struct Node {
  int parent, left, right;
};
vector<Node> T;

int getDepth(int u) {
  int d = 0;
  while (T[u].parent != NIL) {
    u = T[u].parent;
    ++d;
  }
  return d;
}

void printChildren(int u) {
  int c = T[u].left;
  int times = 0;
  while (c != NIL) {
    if (times != 0) cout << ", ";
    cout << c;
    c = T[c].right;
    ++times;
  }
}

string getType(int u) {
  if (T[u].parent == NIL) return "root";
  else if (T[u].left != NIL) return "internal node";
  else return "leaf";
}

int main() {
  cin >> n;
  T.reserve(n);
  for (int i = 0; i < n; ++i) {
    T[i].parent = NIL;
    T[i].left = NIL;
    T[i].right = NIL;
  }
  for (int i = 0; i < n; ++i) {
    cin.ignore(numeric_limits<std::streamsize>::max(), ' ');
    int k;
    cin >> k;
    int prev_child;
    for (int j = 0; j < k; ++j) {
      int child;
      cin >> child;
      if (j == 0) T[i].left = child;
      T[child].parent = i;
      if (j != 0) T[prev_child].right = child;
      prev_child = child;
    }
  }

  for (int i = 0; i < n; ++i) {
    cout << "node " << i << ": parent = " << T[i].parent << ", depth = " << getDepth(i) << ", "
    << getType(i) << ", [";
    printChildren(i);
    cout << "]" << endl;
  }
}



Compiler output:
a.cc: In function 'int main()':
a.cc:48:16: error: 'numeric_limits' was not declared in this scope
   48 |     cin.ignore(numeric_limits<std::streamsize>::max(), ' ');
      |                ^~~~~~~~~~~~~~
a.cc:48:46: error: expected primary-expression before '>' token
   48 |     cin.ignore(numeric_limits<std::streamsize>::max(), ' ');
      |                                              ^
a.cc:48:52: error: no matching function for call to 'max()'
   48 |     cin.ignore(numeric_limits<std::streamsize>::max(), ' ');
      |                                               ~~~~~^~
In file included from /usr/include/c++/14/string:51,
                 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,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 0 provided
Language: C++

#include<iostream>
using namespace std;
#define MAX 10005
#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 ==)cout<<"reaf,";
else cout << "internal node,";

cout<<"";

for(i=0,c=T[u].l==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].r,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++){
			
			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<0;i++)print(i);
	
	return 0;
}


Compiler output:
a.cc:17:29: warning: missing terminating " character
   17 | if(T[u].p == NIL)cout<<root,";
      |                             ^
a.cc:17:29: error: missing terminating " character
   17 | if(T[u].p == NIL)cout<<root,";
      |                             ^~
a.cc:6:20: error: expected ';' at end of member declaration
    6 | struct Node {int p,l.r;};
      |                    ^
      |                     ;
a.cc:6:21: error: expected unqualified-id before '.' token
    6 | struct Node {int p,l.r;};
      |                     ^
a.cc: In function 'void print(int)':
a.cc:17:24: error: 'root' was not declared in this scope
   17 | if(T[u].p == NIL)cout<<root,";
      |                        ^~~~
a.cc:18:1: error: expected primary-expression before 'else'
   18 | else if(T[u].l ==)cout<<"reaf,";
      | ^~~~
a.cc:23:28: error: 'C' was not declared in this scope
   23 | for(i=0,c=T[u].l==NIL; i++,C = T[c].r ){
      |                            ^
a.cc:23:37: error: 'struct Node' has no member named 'r'
   23 | for(i=0,c=T[u].l==NIL; i++,C = T[c].r ){
      |                                     ^
a.cc:23:38: error: expected ';' before ')' token
   23 | for(i=0,c=T[u].l==NIL; i++,C = T[c].r ){
      |                                      ^~
      |                                      ;
a.cc: In function 'int rec(int, int)':
a.cc:33:17: error: 'struct Node' has no member named 'r'
   33 |         if(T[u].r != NIL )rec(T[u].r,p);
      |                 ^
a.cc:33:36: error: 'struct Node' has no member named 'r'
   33 |         if(T[u].r != NIL )rec(T[u].r,p);
      |                                    ^
a.cc:34:32: error: 'struct Node' has no member named 'r'
   34 |     if(T[u].l != NIL )rec(T[u].r,p+1);
      |                                ^
a.cc:35:1: warning: no return statement in function returning non-void [-Wreturn-type]
   35 | }
      | ^
a.cc: In function 'int main()':
a.cc:40:48: error: 'struct Node' has no member named 'r'
   40 |         for(i=0;i<n;i++)T[i].p = T[i].l = T[i].r = NIL;
      |                                                ^
a.cc:47:35: error: 'struct Node' has no member named 'r'
   47 |                         else T[l].r = c;
      |                                   ^