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

#include <stdio.h>

#define MAX 10000
#define NIL -1

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

/* 先行順巡回 */
void preParse(int u) {
  if(u == NIL) return;
  printf(" %d",u);
  preParse(T[u].l);
  preParse(T[u].r);
}

/* 中間順巡回 */
void inParse(int u) {
  if(u == NIL) return;
  preParse(T[u].l);
  printf(" %d",u);
  preParse(T[u].r);
}

/* 後方順巡回 */
void inParse(int u) {
  if(u == NIL) return;
  preParse(T[u].l);
  preParse(T[u].r);
  printf(" %d",u);
}

int main(void) {
  int i, v, l, r, root;
  scanf("%d",&n);
  for(i=0; i<n; i++) {
    T[i].p = NIL;
  }
  
  for(i=0; i<n; i++) {
    scanf("%d %d %d",&v,&l,&r);
    T[v].l = l;
    T[v].r = r;
    if(l != NIL) T[l].p = v;
    if(r != NIL) T[r].p = v;
  }
  
  for(i=0;i<n;i++) if(T[i].p == NIL) root = i;
  
  printf("Preorder\n");
  preParse(root);
  printf("\n");

  printf("Ireorder\n");
  inParse(root);
  printf("\n");

  printf("Postorder\n");
  postParse(root);
  printf("\n");

  return 0;
}


Compiler output:
main.c:6:25: warning: no semicolon at end of struct or union
    6 | struct Node {int p, l, r};
      |                         ^
main.c:27:6: error: redefinition of 'inParse'
   27 | void inParse(int u) {
      |      ^~~~~~~
main.c:19:6: note: previous definition of 'inParse' with type 'void(int)'
   19 | void inParse(int u) {
      |      ^~~~~~~
main.c: In function 'main':
main.c:60:3: error: implicit declaration of function 'postParse'; did you mean 'preParse'? [-Wimplicit-function-declaration]
   60 |   postParse(root);
      |   ^~~~~~~~~
      |   preParse
Language: C

#include <stdio.h>

#define MAX 10000
#define NIL -1

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


void preParse(int u) {
  if(u == NIL) return;
  printf(" %d",u);
  preParse(T[u].l);
  preParse(T[u].r);
}


void inParse(int u) {
  if(u == NIL) return;
  preParse(T[u].l);
  printf(" %d",u);
  preParse(T[u].r);
}

void inParse(int u) {
  if(u == NIL) return;
  preParse(T[u].l);
  preParse(T[u].r);
  printf(" %d",u);
}

int main(void) {
  int i, v, l, r, root;
  scanf("%d",&n);
  for(i=0; i<n; i++) {
    T[i].p = NIL;
  }
  
  for(i=0; i<n; i++) {
    scanf("%d %d %d",&v,&l,&r);
    T[v].l = l;
    T[v].r = r;
    if(l != NIL) T[l].p = v;
    if(r != NIL) T[r].p = v;
  }
  
  for(i=0;i<n;i++) if(T[i].p == NIL) root = i;
  
  printf("Preorder\n");
  preParse(root);
  printf("\n");

  printf("Ireorder\n");
  inParse(root);
  printf("\n");

  printf("Postorder\n");
  postParse(root);
  printf("\n");

  return 0;
}


Compiler output:
main.c:6:25: warning: no semicolon at end of struct or union
    6 | struct Node {int p, l, r};
      |                         ^
main.c:26:6: error: redefinition of 'inParse'
   26 | void inParse(int u) {
      |      ^~~~~~~
main.c:19:6: note: previous definition of 'inParse' with type 'void(int)'
   19 | void inParse(int u) {
      |      ^~~~~~~
main.c: In function 'main':
main.c:59:3: error: implicit declaration of function 'postParse'; did you mean 'preParse'? [-Wimplicit-function-declaration]
   59 |   postParse(root);
      |   ^~~~~~~~~
      |   preParse
Language: C

#include <stdio.h>
#define MAX 10000
#define NIL -1

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

void preParse(int u){
	if ( u == NIL ) return;
	prinf("%d",u);
	preParse(T[u].l);
	preParse(T[u].r);
}

void inParse(int u){
	if ( u == NIL ) return;
	preParse(T[u].l);
	prinf("%d",u);
	preParse(T[u].r);
}

void postParse(int u){
	if ( u == NIL ) return;
	preParse(T[u].l);
	preParse(T[u].r);
	prinf("%d",u);
}

int main(void){
	int i, v, l, r, root;
	
	sanf("%d",&n);
	for( i = 0; i < n: i++ ){
		T[i].p = NIL;
	}
	
	for( i = 0; i < n: i++ ){
		scanf("%d %d %d", &v, &l, &r);
		T[v].l = l;
		T[v].r = r;
		if( l != NIL ) T[l].p = v;
		if( r != NIL ) T[r].p = v;
	}
	
	for ( i = 0; i < n; i++ ) if ( T[i].p == NIL ) root = i;
	
	printf("Preorder\n");
	preParse(root);
	printf("\n");
	printf("Inorder\n");
	inParse(root);
	printf("\n");
	printf("Postorder\n");
	postParse(root);
	printf("\n");
	
	return 0;
}


Compiler output:
main.c: In function 'preParse':
main.c:11:9: error: implicit declaration of function 'prinf'; did you mean 'printf'? [-Wimplicit-function-declaration]
   11 |         prinf("%d",u);
      |         ^~~~~
      |         printf
main.c: In function 'main':
main.c:33:9: error: implicit declaration of function 'sanf'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   33 |         sanf("%d",&n);
      |         ^~~~
      |         scanf
main.c:34:26: error: expected ';' before ':' token
   34 |         for( i = 0; i < n: i++ ){
      |                          ^
      |                          ;
main.c:38:26: error: expected ';' before ':' token
   38 |         for( i = 0; i < n: i++ ){
      |                          ^
      |                          ;
Language: C

#include <stdio.h>
#define MAX 10000
#define NIL -1

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

void preParse(int u){
	if ( u == NIL ) return;
	prinf("%d",u);
	preParse(T[u].l);
	preParse(T[u].r);
}

void inParse(int u){
	if ( u == NIL ) return;
	preParse(T[u].l);
	prinf("%d",u);
	preParse(T[u].r);
}

void postParse(int u){
	if ( u == NIL ) return;
	preParse(T[u].l);
	preParse(T[u].r);
	prinf("%d",u);
}

int main(void){
	int i, v, l, r, root;
	
	sanf("%d",&n);
	for( i = 0; i < n; i++ ){
		T[i].p = NIL;
	}
	
	for( i = 0; i < n: i++ ){
		scanf("%d %d %d", &v, &l, &r);
		T[v].l = l;
		T[v].r = r;
		if( l != NIL ) T[l].p = v;
		if( r != NIL ) T[r].p = v;
	}
	
	for ( i = 0; i < n; i++ ) if ( T[i].p == NIL ) root = i;
	
	printf("Preorder\n");
	preParse(root);
	printf("\n");
	printf("Inorder\n");
	inParse(root);
	printf("\n");
	printf("Postorder\n");
	postParse(root);
	printf("\n");
	
	return 0;
}


Compiler output:
main.c: In function 'preParse':
main.c:11:9: error: implicit declaration of function 'prinf'; did you mean 'printf'? [-Wimplicit-function-declaration]
   11 |         prinf("%d",u);
      |         ^~~~~
      |         printf
main.c: In function 'main':
main.c:33:9: error: implicit declaration of function 'sanf'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   33 |         sanf("%d",&n);
      |         ^~~~
      |         scanf
main.c:38:26: error: expected ';' before ':' token
   38 |         for( i = 0; i < n: i++ ){
      |                          ^
      |                          ;
Language: C

#include <stdio.h>
#define MAX 10000
#define NIL -1

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

void preParse(int u){
	if ( u == NIL ) return;
	prinf("%d",u);
	preParse(T[u].l);
	preParse(T[u].r);
}

void inParse(int u){
	if ( u == NIL ) return;
	preParse(T[u].l);
	prinf("%d",u);
	preParse(T[u].r);
}

void postParse(int u){
	if ( u == NIL ) return;
	preParse(T[u].l);
	preParse(T[u].r);
	prinf("%d",u);
}

int main(void){
	int i, v, l, r, root;
	
	sanf("%d",&n);
	for( i = 0; i < n; i++ ){
		T[i].p = NIL;
	}
	
	for( i = 0; i < n; i++ ){
		scanf("%d %d %d", &v, &l, &r);
		T[v].l = l;
		T[v].r = r;
		if( l != NIL ) T[l].p = v;
		if( r != NIL ) T[r].p = v;
	}
	
	for ( i = 0; i < n; i++ ) if ( T[i].p == NIL ) root = i;
	
	printf("Preorder\n");
	preParse(root);
	printf("\n");
	printf("Inorder\n");
	inParse(root);
	printf("\n");
	printf("Postorder\n");
	postParse(root);
	printf("\n");
	
	return 0;
}


Compiler output:
main.c: In function 'preParse':
main.c:11:9: error: implicit declaration of function 'prinf'; did you mean 'printf'? [-Wimplicit-function-declaration]
   11 |         prinf("%d",u);
      |         ^~~~~
      |         printf
main.c: In function 'main':
main.c:33:9: error: implicit declaration of function 'sanf'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   33 |         sanf("%d",&n);
      |         ^~~~
      |         scanf
Language: C

#include <stdio.h>
#define MAX 10000
#define NIL -1

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

void preParse(int u){
	if ( u == NIL ) return;
	prinf("%d",u);
	preParse(T[u].l);
	preParse(T[u].r);
}

void inParse(int u){
	if ( u == NIL ) return;
	inParse(T[u].l);
	prinf("%d",u);
	inParse(T[u].r);
}

void postParse(int u){
	if ( u == NIL ) return;
	postParse(T[u].l);
	postParse(T[u].r);
	prinf("%d",u);
}

int main(void){
	int i, v, l, r, root;
	
	sanf("%d",&n);
	for( i = 0; i < n; i++ ){
		T[i].p = NIL;
	}
	
	for( i = 0; i < n; i++ ){
		scanf("%d %d %d", &v, &l, &r);
		T[v].l = l;
		T[v].r = r;
		if( l != NIL ) T[l].p = v;
		if( r != NIL ) T[r].p = v;
	}
	
	for ( i = 0; i < n; i++ ) if ( T[i].p == NIL ) root = i;
	
	printf("Preorder\n");
	preParse(root);
	printf("\n");
	printf("Inorder\n");
	inParse(root);
	printf("\n");
	printf("Postorder\n");
	postParse(root);
	printf("\n");
	
	return 0;
}


Compiler output:
main.c: In function 'preParse':
main.c:11:9: error: implicit declaration of function 'prinf'; did you mean 'printf'? [-Wimplicit-function-declaration]
   11 |         prinf("%d",u);
      |         ^~~~~
      |         printf
main.c: In function 'main':
main.c:33:9: error: implicit declaration of function 'sanf'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   33 |         sanf("%d",&n);
      |         ^~~~
      |         scanf
Language: C

#include <stdio.h>
#define MAX 10000
#define NIL -1

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

void preParse(int u){
	if ( u == NIL ) return;
	printf("%d",u);
	preParse(T[u].l);
	preParse(T[u].r);
}

void inParse(int u){
	if ( u == NIL ) return;
	inParse(T[u].l);
	printf("%d",u);
	inParse(T[u].r);
}

void postParse(int u){
	if ( u == NIL ) return;
	postParse(T[u].l);
	postParse(T[u].r);
	printf("%d",u);
}

int main(void){
	int i, v, l, r, root;
	
	sanf("%d",&n);
	for( i = 0; i < n; i++ ){
		T[i].p = NIL;
	}
	
	for( i = 0; i < n; i++ ){
		scanf("%d %d %d", &v, &l, &r);
		T[v].l = l;
		T[v].r = r;
		if( l != NIL ) T[l].p = v;
		if( r != NIL ) T[r].p = v;
	}
	
	for ( i = 0; i < n; i++ ) if ( T[i].p == NIL ) root = i;
	
	printf("Preorder\n");
	preParse(root);
	printf("\n");
	printf("Inorder\n");
	inParse(root);
	printf("\n");
	printf("Postorder\n");
	postParse(root);
	printf("\n");
	
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:33:9: error: implicit declaration of function 'sanf'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   33 |         sanf("%d",&n);
      |         ^~~~
      |         scanf
Language: C

#include<cstdio>
#include<cstring>
#include<cstdlib>

struct node{
	int data;
	node* lchild;
	node* rchild;
}root[300000];

void preorder(node *root)
{
	if(root == NULL)
		return;
	printf(" %d",root->data);
	preorder(root->lchild);
	preorder(root->rchild);
}

void inorde(node *root)
{
	if(root == NULL)
		return;
	inorde(root->lchild);
	printf(" %d",root->data);
	inorde(root->rchild);
}

void postorder(node *root)
{
	if(root == NULL)
		return;
	postorder(root->lchild);
	postorder(root->rchild);
	printf(" %d",root->data);
}

node* create(node* root1,int n,struct node root[])
{
	if(root1==NULL)
		return NULL;
	for(int i = 0;i < n;i ++)
	{
		if(root1->lchild!=NULL&&root1->lchild->data==root[i].data)
		{
			root1->lchild = &root[i];
			create(&root[i],n,root);
		}
		if(root1->lchild!=NULL&&root1->rchild->data==root[i].data)
		{
			root1->rchild = &root[i];
			create(&root[i],n,root);
		}
	}
}

int main()
{
	int n;
	while(scanf("%d",&n)!=EOF)
	{
		int a[n];
		int b[n][3];
		int p,q,l;
		memset(a,0,sizeof(a));
		for(int i = 0;i < n;i ++)
		{
			scanf("%d %d %d",&b[i][0],&b[i][1],&b[i][2]);
			root[i].data = b[i][0];
			if(b[i][1]!=-1)
			{
				root[i].lchild = (node*)malloc(sizeof(node));
				root[i].lchild->data = b[i][1];
			}else{
				root[i].lchild = NULL;
			}
			if(b[i][2]!=-1)
			{
				root[i].rchild = (node*)malloc(sizeof(node));
				root[i].rchild->data = b[i][2];
			}else{
				root[i].rchild = NULL;
			}
		}
		for(int i = 0;i < n;i ++)
		{
			for(int j = 0;j < n;j ++)
			{
				if(b[i][0]==b[j][1]||b[i][0]==b[j][2])
				{
					a[i] = 1;
					break;	
				}
			}
		}
		node* root1 = (node*)malloc(sizeof(node));
		/*for(int i = 0;i < n;i ++)
			printf("%d ",a[i]);
		printf("\n");*/
		for(int i = 0;i < n;i ++)
		{
			if(a[i] == 0)
			{
				root1 = &root[i];
				break;
			}
		}
		create(root1,n,root);
		printf("Preorder\n");
		preorder(root1);
		printf("\nInorder\n");
		inorde(root1);
		printf("\nPostorder\n");
		postorder(root1);
		printf("\n");
	}
	return 0;
}


Compiler output:
main.c:1:9: fatal error: cstdio: No such file or directory
    1 | #include<cstdio>
      |         ^~~~~~~~
compilation terminated.
Language: C

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
struct tree{
    int left;
    int key;
    int right;
}tr[30];
void preorder(tree t,int tt);
void inorder(tree t,int tt);
void postorder(tree t,int tt);
int pre[30],ino[30],pos[30];
int j,k,l;
int main(){
    int n;
    while(~scanf("%d",&n)){
        int i;
        for(i=0;i<n;i++)
            scanf("%d %d %d",&tr[i].key,&tr[i].left,&tr[i].right);
        j=0;k=0;l=0;
        preorder(tr[0],tr[0].left);
        inorder(tr[0],tr[0].left);
        postorder(tr[0],tr[0].left);
        printf("Preorder\n");
        for(i=0;i<j;i++)
            printf("%d ",pre[i]);
        printf("\nInorder\n");
        for(i=0;i<k;i++)
            printf("%d ",ino[i]);
        printf("\nPostorder\n");
        for(i=0;i<l;i++)
            printf("%d ",pos[i]);
        printf("\n");
    }
}
void preorder(tree t,int tt){
    if(t.key!=-1){
        pre[j++]=t.key;
        if(t.left!=-1)
            preorder(tr[t.left],tr[t.left].left);
        if(t.right!=-1)
            preorder(tr[t.right],tr[t.right].right);
    }
    else return;
}
void inorder(tree t,int tt){
    if(t.key!=-1){
        if(t.left!=-1)
            inorder(tr[t.left],tr[t.left].left);
        ino[k++]=t.key;
        if(t.right!=-1)
            inorder(tr[t.right],tr[t.right].right);
    }
    else return;
}
void postorder(tree t,int tt){
    if(t.key!=-1){
        if(t.left!=-1)
            postorder(tr[t.left],tr[t.left].left);
        if(t.right!=-1)
            postorder(tr[t.right],tr[t.right].right);
        pos[l++]=t.key;
    }
    else return;
}






Compiler output:
main.c:1:10: fatal error: cstdio: No such file or directory
    1 | #include <cstdio>
      |          ^~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
#define MAX 100005
#define NIL -1

struct Node{ int p, l, r;};
struct Node T[MAX];
int n,pre[MAX],in[MAX],pos[MAX];

void getPreorder(int u){

  if(T[u].l == NIL)
  getPreorder(T[u].l);

  getPreorder(T[u].r);

}

void getInorder(int u){

  if(T[u].l == NIL) return ;
  getInorder(T[u].l);
  getInorder(T[u].r);

}

void getPostorder(int u){

  if(T[u].r == NIL) return;
  getPostorder(T[u].l);
  getPostorder(T[u].r);

}

void print(int u){
  int i;

  printf("Preorder\n");
  for(i = 0; i < n; i++){
    printf(" %d",pre[i]);
  }
  printf("\nInorder\n");
  for(i=0; i<n; i++){
    printf(" %d",in[i]);
  }
  printf("\nPostorder\n");
  for(i=0; i<n; i++){
    printf(" %d",pos[i]);
  }
  printf("\n");
}


main(){
  int i, j, d, v, l;
  int pre;
  
  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",&v);
    scanf("%d %d",&T[v].l,&T[v].r);
    T[T[v].l].p = v;
    T[T[v].r].p = v;
  }
   
  for( i = 0; i < n;){
    pre[i] = getPreorder(i);
    in[i] = getInorder(i);
    pos[i] = getPostorder(i);
  }
 
  for ( i = 0; i < n; i++ ) print(i);
  return 0;
}

Compiler output:
main.c:53:1: error: return type defaults to 'int' [-Wimplicit-int]
   53 | main(){
      | ^~~~
main.c: In function 'main':
main.c:71:8: error: subscripted value is neither array nor pointer nor vector
   71 |     pre[i] = getPreorder(i);
      |        ^
main.c:72:11: error: void value not ignored as it ought to be
   72 |     in[i] = getInorder(i);
      |           ^
main.c:73:12: error: void value not ignored as it ought to be
   73 |     pos[i] = getPostorder(i);
      |            ^
Language: C



void inorder(Node u){
  if(u != NIL) {
    if(u->left != NIL) inorder(u->left);
    printf(" %d",u->key);
    if(u->right != NIL) inorder(u->right);
  }
}
void preorder(Node u){
  if(u != NIL) {
    printf(" %d",u->key);
    if(u->left != NIL) preorder(u->left);
    if(u->right != NIL) preorder(u->right);
  }
}

Compiler output:
main.c:3:14: error: unknown type name 'Node'
    3 | void inorder(Node u){
      |              ^~~~
main.c:10:15: error: unknown type name 'Node'
   10 | void preorder(Node u){
      |               ^~~~
Language: C

#include <stdio.h>
#define NIL -1
#define N 100



struct Node{
  int p,l,r;
};
struct Node A[N];


main()
{

  int i,j;
  int n,id,e,c;

  scanf("%d",&n);
  
  for(i = 0; i < n; i++){
   A[i].p = NIL;
   A[i].l = NIL;
   A[i].r = NIL;
  }
  for(i = 0; i < n; i++){
    scanf("%d%d%d",&id,&e,&c);
    
    A[e].p = id;
    A[c].p = id;
    A[id].l = e;
    A[id].r = c;
  
  }
  for(i = 0; i < n; i++){
    if(A[i].p == NIL){
      break;
    }
  }
  printf("Preorder\n");
  Pre(i);
  printf("\n");
   
  printf("Inorder\n");
  In(i);
  printf("\n");
   
  printf("Postorder\n");
  Post(i);
  printf("\n");

  return 0;
}

int Pre(int s)
{

 printf(" %d",s);
 
 if(s != NIL){
   if(A[s].l!=NIL)Pre(A[s].l);
   
    if(A[s].r!=NIL)Pre(A[s].r);
 }
}

int In(int s){
  
  if(s != NIL){
   
    if(A[s].l != NIL){
      
      In(A[s].l);
    }
    printf(" %d",s);
     
    if(T[s].r != NIL){
      In(A[s].r);
    }
  }
}
 
int Post(int s){
  
  if(s != NIL){
    
    if(A[s].l!=NIL)Post(T[s].l);
   
    if(A[s].r!=NIL)Post(A[s].r);
    
  }

  printf(" %d",s);
}

Compiler output:
main.c:13:1: error: return type defaults to 'int' [-Wimplicit-int]
   13 | main()
      | ^~~~
main.c: In function 'main':
main.c:41:3: error: implicit declaration of function 'Pre' [-Wimplicit-function-declaration]
   41 |   Pre(i);
      |   ^~~
main.c:45:3: error: implicit declaration of function 'In' [-Wimplicit-function-declaration]
   45 |   In(i);
      |   ^~
main.c:49:3: error: implicit declaration of function 'Post' [-Wimplicit-function-declaration]
   49 |   Post(i);
      |   ^~~~
main.c: In function 'In':
main.c:77:8: error: 'T' undeclared (first use in this function)
   77 |     if(T[s].r != NIL){
      |        ^
main.c:77:8: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'Post':
main.c:87:25: error: 'T' undeclared (first use in this function)
   87 |     if(A[s].l!=NIL)Post(T[s].l);
      |                         ^
Language: C

#include<stdio.h>
#define MAX 100005
#define NIL -1

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

void maketree(int id, int l, int r){
  if( l != -1 ){
    T[id].l = l;
    T[l].p = id;
    T[l].sibling = r;
  }
  if( r != -1 ){
    T[id].r = r;
    T[r].p = id;
    T[r].sibling = l;
  }
  T[id].nid = id;
}

void pre_search(int i){
  printf("%d ",i);
  if(T[i].l != -1){
    pre_search(T[i].l);
  }
  if(T[i].r != -1){
    pre_search(T[i].r);
  }
}

void in_search(int i){
  if(T[i].l != -1){
    in_search(T[i].l);
  }
  printf("%d ", T[i].nid);
  if(T[i].r != -1){
    in_search(T[i].r);
  }
}

void pos_search(int i){
  if(T[i].l != -1){
    pos_search(T[i].l);
  }
  if(T[i].r != -1){
    pos_search(T[i].r);
  }
  printf("%d ", T[i].nid);
}

void print(){
  int i = 0;
  while(1){
    if(T[i].p == -1)
      break;
    i++;
  }
  pre_search(i);
  printf("\n");
  in_search(i);
  printf("\n");
  pos_search(i);
}

int main(){
  int n, l, r, id;
  int i;

  scanf("%d", &n);
  for(i=0; i<n; i++){
    T[i].r = T[i].l = T[i].p = NIL;
  }
  for(i=0; i<n; i++){
    scanf("%d%d%d", &id, &l, &r);
    maketree(id, l, r);
  }
  print();
  return 0;
}

Compiler output:
main.c: In function 'maketree':
main.c:12:9: error: 'struct Node' has no member named 'sibling'
   12 |     T[l].sibling = r;
      |         ^
main.c:17:9: error: 'struct Node' has no member named 'sibling'
   17 |     T[r].sibling = l;
      |         ^
Language: C

#include<stdio.h>
#define MAX 100005
#define NIL -1

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

void maketree(int id, int l, int r){
  if( l != -1 ){
    T[id].l = l;
    T[l].p = id;
  }
  if( r != -1 ){
    T[id].r = r;
    T[r].p = id;
  }
  T[id].nid = id;
}

void pre_search(int i){
  printf(" %d", i);
  if(T[i].l != -1){
    pre_search(T[i].l);
  }
  if(T[i].r != -1){
    pre_search(T[i].r);
  }
}

void in_search(int i){
  if(T[i].l != -1){
    in_search(T[i].l);
  }
  printf(" %d", T[i].nid);
  if(T[i].r != -1){
    in_search(T[i].r);
  }
}

void pos_search(int i){
  if(T[i].l != -1){    
    pos_search(T[i].l);
  }
  if(T[i].r != -1){
    pos_search(T[i].r);
  }
  printf(" %d", T[i].nid);
}

void print(){
  int i = 0;
  while(1){
    if(T[i].p == -1)
      break;
    i++;
  }
  printf("Preorder\n");
  count = 0;
  pre_search(i);
  printf("\n");
  printf("Inorder\n");
  count = 0;
  in_search(i);
  printf("\n");
  printf("Postorder\n");
  count = 0;
  pos_search(i);
  printf("\n");
}

int main(){
  int n, l, r, id;
  int i;

  scanf("%d", &n);
  for(i=0; i<n; i++){
    T[i].r = T[i].l = T[i].p = NIL;
  }
  for(i=0; i<n; i++){
    scanf("%d%d%d", &id, &l, &r);
    maketree(id, l, r);
  }
  print();
  return 0;
}

Compiler output:
main.c: In function 'print':
main.c:58:3: error: 'count' undeclared (first use in this function)
   58 |   count = 0;
      |   ^~~~~
main.c:58:3: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
typedef struct{
    int p, l, r;
} node;
node t[25];
void Preoder(int root){
    printf(" %d", root);
    if(t[root].l != -1) Preoder(t[root].l);
    if(t[root].r != -1) Preoder(t[root].r);
}
void Inorder(int root){
    if(t[root].l != -1) Inorder(t[root].l);
    printf(" %d", root);
    if(t[root].r != -1) Inorder(t[root].r);
}
void Postorder(int root){
    if(t[root].l != -1) Postorder(t[root].l);
    if(t[root].r != -1) Postorder(t[root].r);
    printf(" %d", root);}
int main(){
    int i, n, id;
    scanf("%d", &n);
    for(i = 0; i < n; i++){
        t[i].p = -1;
        t[i].l = -1;
        t[i].r = -1;
    }
    for(i = 0; i < n; i++){
        scanf("%d", &id);
        scanf("%d%d", &t[id].l, &t[id].r);
        if(t[id].l != -1){
        t[t[i].l].p = id;
        t[t[i].r].p = id;
        }
    }
    printf("Preorder\n");
    for(i = 0; i < n; i++){
        if(t[i].p == -1){
            Preoder(i);
            printf("\nInorder\n");
            Inorder(i);
            printf("\nPostorder\n");
            Postorder(i);
             printf("\n");
        }
   
    }
return 0;

Compiler output:
main.c: In function 'main':
main.c:48:1: error: expected declaration or statement at end of input
   48 | return 0;
      | ^~~~~~
Language: C++

#include<iostream>
#include<map>
using namespace std;
typedef struct node{
    int id;
    node *left, *right;
    node(int id):id(id),left(NULL),right(NULL){}
} Node;
class Solution{
private:
       map<int,Node*> hashMapping;
       Node* createNode(int ID){
           if(ID!=-1){
             if(hashMapping.find(ID) == hashMapping.end()){
                    hashMapping[ID] = new Node(ID);   
              } 
              return hashMapping[ID];
           }else{
              return NULL; 
           }
       }
       void preorder(Node* root){
          if(root==NULL){
             return;
          }else{
             cout<<" "<<root->id;
             preorder(root->left);
             preorder(root->right);
          }
       }
       void inorder(Node* root){
          if(root==NULL){
             return;
          }else{           
             inorder(root->left);
             cout<<" "<<root->id;
             inorder(root->right);
          }
       }
       void postorder(Node* root){
          if(root==NULL){
             return;
          }else{             
             postorder(root->left);
             postorder(root->right);
             cout<<" "<<root->id;
          }
       }
public:
    node* buildTree(){
           hashMapping.clear();
           int num,rootID;
           cin>>num;
           while(num--){
                 int ID,leftID,rightID;
                 cin>>ID>>leftID>>rightID;
                 createNode(ID)->left = createNode(leftID); 
                 createNode(ID)->right = createNode(rightID); 
           }
           return hashMapping[0];
    }
    void printPreOrder(node *root){
         cout<<"Preorder"<<endl;
         preorder(root);
         cout<<endl;
     }
void printPreOrder(node *root){
         cout<<"Preorder"<<endl;
         preorder(root);
         cout<<endl;
     }
void printInOrder(node *root){
         cout<<"Inorder"<<endl;
         inorder(root);
         cout<<endl;
     }
void printPostOrder(node *root){
         cout<<"Postorder"<<endl;
         postorder(root);
         cout<<endl;
     }
} sln;
int main(int argc,char* argv[]){
     ios::sync_with_stdio(false);
     node *root = sln.buildTree(); 
     sln.printPreOrder(root);
     sln.printInOrder(root);
     sln.printPostOrder(root);
     return 0;
}

Compiler output:
a.cc:67:6: error: 'void Solution::printPreOrder(node*)' cannot be overloaded with 'void Solution::printPreOrder(node*)'
   67 | void printPreOrder(node *root){
      |      ^~~~~~~~~~~~~
a.cc:62:10: note: previous declaration 'void Solution::printPreOrder(node*)'
   62 |     void printPreOrder(node *root){
      |          ^~~~~~~~~~~~~
Language: C++

#include<iostream>
#include<map>
using namespace std;
typedef struct node{
    int id;
    node *left, *right;
    node(int id):id(id),left(NULL),right(NULL){}
} Node;
class Solution{
private:
       map<int,Node*> hashMapping;
       set<Node*> rootCandidates;
       Node* createNode(int ID){
              if(ID!=-1){
               if(hashMapping.find(ID) == hashMapping.end()){
                    hashMapping[ID] = new Node(ID);
              } 
              return hashMapping[ID];
           }else{
              return NULL; 
           }
       }
       void preorder(Node* root){
         if(root==NULL){
             return;
         }else{
             cout<<" "<<root->id;
             preorder(root->left);
             preorder(root->right);
         }
       }
       void inorder(Node* root){
          if(root==NULL){
             return;
          }else{
             inorder(root->left);
             cout<<" "<<root->id;
             inorder(root->right);
          }
       }
       void postorder(Node* root){
          if(root==NULL){
             return;
          }else{
             postorder(root->left);
             postorder(root->right);
             cout<<" "<<root->id;
         }
       }
public:
     node* buildTree(){
           hashMapping.clear();
           rootCandidates.clear();
           int num,rootID=-1;
           cin>>num;
           while(num--){
                 int ID,leftID,rightID;
                 cin>>ID>>leftID>>rightID;
                 rootCandidates.insert(ID);
                 rootCandidates.erase(leftID);
                 rootCandidates.erase(rightID);
                 createNode(ID)->left = createNode(leftID); 
                 createNode(ID)->right = createNode(rightID); 
           }
           return hashMapping[*rootCandidates.begin()];
     }
void printPreOrder(node *root){
         cout<<"Preorder"<<endl;
         preorder(root);
         cout<<endl;
     }
void printInOrder(node *root){
         cout<<"Inorder"<<endl;
         inorder(root);
         cout<<endl;
     }
void printPostOrder(node *root){
         cout<<"Postorder"<<endl;
         postorder(root);
         cout<<endl;
    }
} sln;
int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
    node *root = sln.buildTree(); 
    sln.printPreOrder(root);
    sln.printInOrder(root);
    sln.printPostOrder(root);
    return 0;
}

Compiler output:
a.cc:12:8: error: 'set' does not name a type
   12 |        set<Node*> rootCandidates;
      |        ^~~
a.cc: In member function 'node* Solution::buildTree()':
a.cc:53:12: error: 'rootCandidates' was not declared in this scope
   53 |            rootCandidates.clear();
      |            ^~~~~~~~~~~~~~
Language: C++

#include<iostream>
#include<map>
using namespace std;
typedef struct node{
    int id;
    node *left, *right;
    node(int id):id(id),left(NULL),right(NULL){}
} Node;
class Solution{
private:
       map<int,Node*> hashMapping;
       set<int> rootCandidates, nonRootNodes;

       Node* createNode(int ID){
              if(ID!=-1){
               if(hashMapping.find(ID) == hashMapping.end()){
                    hashMapping[ID] = new Node(ID);
              } 
              return hashMapping[ID];
           }else{
              return NULL; 
           }
       }
       void preorder(Node* root){
         if(root==NULL){
             return;
         }else{
             cout<<" "<<root->id;
             preorder(root->left);
             preorder(root->right);
         }
       }
       void inorder(Node* root){
          if(root==NULL){
             return;
          }else{
             inorder(root->left);
             cout<<" "<<root->id;
             inorder(root->right);
          }
       }
       void postorder(Node* root){
          if(root==NULL){
             return;
          }else{
             postorder(root->left);
             postorder(root->right);
             cout<<" "<<root->id;
         }
       }
public:
     node* buildTree(){
           hashMapping.clear();
           rootCandidates.clear();
           nonRootNodes.clear();
           int num,rootID=-1;
           cin>>num;
           while(num--){
                 int ID,leftID,rightID;
                 cin>>ID>>leftID>>rightID;
                 if(nonRootNodes.find(ID) == nonRootNodes.end()){
                    rootCandidates.insert(ID);
                 }
                 nonRootNodes.insert(leftID);
                 rootCandidates.erase(leftID);
                 nonRootNodes.insert(rightID);
                 rootCandidates.erase(rightID);
                 createNode(ID)->left = createNode(leftID); 
                 createNode(ID)->right = createNode(rightID); 
           }
           return hashMapping[*rootCandidates.begin()];
     }
void printPreOrder(node *root){
         cout<<"Preorder"<<endl;
         preorder(root);
         cout<<endl;
     }
void printInOrder(node *root){
         cout<<"Inorder"<<endl;
         inorder(root);
         cout<<endl;
     }
void printPostOrder(node *root){
         cout<<"Postorder"<<endl;
         postorder(root);
         cout<<endl;
    }
} sln;
int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
    node *root = sln.buildTree(); 
    sln.printPreOrder(root);
    sln.printInOrder(root);
    sln.printPostOrder(root);
    return 0;
}

Compiler output:
a.cc:12:8: error: 'set' does not name a type
   12 |        set<int> rootCandidates, nonRootNodes;
      |        ^~~
a.cc: In member function 'node* Solution::buildTree()':
a.cc:54:12: error: 'rootCandidates' was not declared in this scope
   54 |            rootCandidates.clear();
      |            ^~~~~~~~~~~~~~
a.cc:55:12: error: 'nonRootNodes' was not declared in this scope
   55 |            nonRootNodes.clear();
      |            ^~~~~~~~~~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <typeinfo>
#define PI 3.14159265359
#define INF 99999999;
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)
#define EPS 1e-10
typedef long long ll;
using namespace std;
typedef pair<int, int> P;

double distanceAB(double xa, double ya, double xb, double yb);
void trace(int A[], int N);

/*
class Target
{
public:
	vector <string> draw(int n)
	{

	}
};
*/


#define MAX 10000
#define NIL -1

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

void preParse(int u)
{
	if (u == NIL) return;
	printf(" %d", u);
	preParse(T[u].l);
	preParse(T[u].r);
}

void inParse(int u)
{
	if (u == NIL) return;
	inParse(T[u].l);
	printf(" %d", u);
	inParse(T[u].r);
}

void postParse(int u)
{
	if (u == NIL) return;
	postParse(T[u].l);
	postParse(T[u].r);
	printf(" %d", u);
}


int main()
{
	int i, v, l, r, root;
	
	cin >> n;
	REP(n) T[i].p = NIL;
	REP(n)
	{
		cin >> v >> l >> r;
		T[v].l = l;
		T[v].r = r;
		if (l != NIL) T[l].p = v;
		if (r != NIL) T[r].p = v;
	}
	
	REP(n) if (T[i].p == NIL) root = i;
	
	printf("Preorder\n");
	preParse(root);
	printf("\n");
	printf("Inorder\n");
	inParse(root);
	printf("\n");
	printf("Postorder\n");
	postParse(root);
	printf("\n");
	
	return 0;
}


void trace(int A[], int N)
{
	REP(N)
	{
		if (i > 0) cout << " ";
		cout << A[i];
	}
	cout << endl;
}


double distanceAB(double xa, double ya, double xb, double yb)
{
	return sqrt((xb-xa)*(xb-xa) + (yb-ya)*(yb-ya));
}

Compiler output:
a.cc:41:24: error: expected ';' at end of member declaration
   41 | struct Node {int p, l, r};
      |                        ^
      |                         ;
Language: C++

#include <iostream>
#include <string>
#include <stdio.h>
#include <vector>
#include <stack>
#include <queue>
#define N 100
using namespace std;

typedef struct{
	int parent;
	int right;
	int left;
} Node;
Node node[N];
int d[N],h[N],deg[N];

void in(int);
void pos(int);
void pre(int);
void swap(int *,int *);

int main(){
	int n,id,l,r;
	cin>>n;
	for(int i=0;i<n;i++){
		node[i].parent=-1; //???????´¢??¨
		d[i]=-1;
		deg[i]=0;
		h[i]=-1;
	}
	for(int i=0;i<n;i++){
		cin>>id>>l>>r;
		node[id].left=l;
		if(l!=-1) deg[id]++;
		node[id].right=r;
		if(r!=-1) deg[id]++;
		node[l].parent=id;
		node[r].parent=id;
	}
	int z;
	printf("Preorder\n");
	for(z=0;z<n;z++){
		if(node[z].parent==-1){
			pre(z);
			break;
		}
	}
	printf("\nInorder\n");
	in(z);
	printf("\nPostorder\n");
	pos(z);7
	printf("\n");
	return 0;
}

void pre(int i){
	printf(" %d",i);
	int l=node[i].left;
	int r=node[i].right;
	if(l!=-1) pre(l);
	if(r!=-1) pre(r);
}
void in(int i){
	int l=node[i].left;
	int r=node[i].right;
	if(l!=-1) in(l);
	printf(" %d",i);
	if(r!=-1) in(r);
}
void pos(int i){
	int l=node[i].left;
	int r=node[i].right;
	if(l!=-1) pos(l);
	if(r!=-1) pos(r);
	printf(" %d",i);
}
void swap(int *a,int *b){
	int w=*a;
	*a=*b;
	*b=w;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:17: error: expected ';' before 'printf'
   52 |         pos(z);7
      |                 ^
      |                 ;
   53 |         printf("\n");
      |         ~~~~~~
Language: C++

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

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

//???????????????
void preParse(int u){
  if(u == NIL)
    return;
  printf(" %d", u);
  preParse(T[u].l);
  preParse(T[u].r);
}

//???????????????
void inParse(int u){
  if(u == NIL)
    return;
  inParse(T[u].l);
  printf(" %d", u);
  inParse(T[u].r);
}

//???????????????
void postParse(int u){
  if(u == NIL)
    return;
  inParse(T[u].l);
  inParse(T[u].r);
  printf(" %d", u);
}

int main(){
  int i, v, l, r, root;
  scanf("%d", &n);
  for(i = 0; i < n; i++){
    T[i].p = NIL;
  }

  for(i = 0; i < n; i++){
    scanf("%d %d %d", &v, &l, &r);
    T[v].l = l;
    T[v].r = r;
    if(l != NIL) T[l].p = v;
    if(r != NIL) T[r].p = v;
  }

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

  printf("Preorder\n");
  preParse(root);
  printf("\n");
  printf("Inorder\n");
  inParse(root);
  printf("\n");
  printf("Postorder\n");
  postParse(root);
  printf("\n");

  return 0;
}

Compiler output:
a.cc:2:9: fatal error: cstudio: No such file or directory
    2 | #include<cstudio>
      |         ^~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
using namespace std;

const int nil = -1;
struct Node {int p, l, r;};
Node T[1000];
int n;

void preParse(int u) {
    cout << " " << u;
    if (T[u].l != nil) preParse(T[u].l);
    if (T[u].r != nil) preParse(T[u].r);
}

void inParse(int u) {
    if (T[u].l != nil) inParse(T[u].l);
    cout << " " << u;
    if (T[u].r != nil) inParse(T[u].r);
}

void postParse(int u) {
    if (T[u].l != nil) postParse(T[u].l);
    if (T[u].r != nil) postParse(T[u].r);
    cout << " " << u;
}

int main(void) {
    int p, l, r, root;
    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++) {
        cin >> p >> l >> r;
        T[p].l = l;
        T[p].r = r;
        if (l != nil) T[l].p = p;
        if (r != nil) T[r].p = p;
    }

    for (int i = 0; i < n; i++)
        if (T[i].p == nil) root = i;

    cout << "Preorder" << endl;
    preParse(root);
    cout << endl << "Inorder" << endl;
    inParse(root);
    cout << endl << "Postorder" << endl;
    postParse(root);
    cout << endl;

    return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:50:14: error: expected '}' at end of input
   50 |     return 0;
      |              ^
a.cc:27:16: note: to match this '{'
   27 | int main(void) {
      |                ^
Language: C++

#include<stdio.h>
#define NIL -1

void Preorder(int);
void Inorder(int);
void Postorder(int);


typedef struct{
  int parent;
  int left;
  int right;
}vertex;

int D[25],n;
int ver[25];
vertex Tree[25];

int main(){
  
  int i,l,r;
  
  scanf("%d",&n);
  
  for( i=0 ; i<n ; i++){
    Tree[i].parent = Tree[i].left = Tree[i].right = NIL;
  }
  for( i=0 ; i<n ; i++){
    scanf("%d",&ver[i]);
    
    if(i == 0){
      Tree[ ver[i] ] .parent= NIL;
    }

    scanf("%d",&Tree[ver[i]].left);
    scanf("%d",&Tree[ver[i]].right);
    
    l = Tree[ver[i]].left;
    r = Tree[ver[i]].right;
    Tree[l].parent = Tree[r].parent = ver[i];
  }

  for( i=0 ; i<n ; i++){
    Preorder(i);
    Inorder(i);
    Postorder(i);
  }
 
  return 0;
}

void Preorder(int i){

  printf("Preorder\n");
  printf(" %d",Tree[i].right);
  if(Tree[i].left != NIL) Preorder(Tree[i].left);
    if(Tree[i].right != NIL) Preorder(Tree[i].right);
}

void Inorder(int i){

  printf("Inorder\n");
    if(Tree[i].left != NIL) Inorder(Tree[i].left);
    printf(" %d", Tree[i].right);
    if(Tree[i].right != NIL) Inorder(Tree[i].right);
}  

void Postorder(int i);

  printf("postorder\n");
 if(Tree[i].left != NIL) Postorder(Tree[i].left);
    if(Tree[i].right != NIL) Postorder(Tree[i].right);
    printf(" %d", Tree[i].right);
}

Compiler output:
a.cc:70:9: error: expected constructor, destructor, or type conversion before '(' token
   70 |   printf("postorder\n");
      |         ^
a.cc:71:2: error: expected unqualified-id before 'if'
   71 |  if(Tree[i].left != NIL) Postorder(Tree[i].left);
      |  ^~
a.cc:72:5: error: expected unqualified-id before 'if'
   72 |     if(Tree[i].right != NIL) Postorder(Tree[i].right);
      |     ^~
a.cc:73:11: error: expected constructor, destructor, or type conversion before '(' token
   73 |     printf(" %d", Tree[i].right);
      |           ^
a.cc:74:1: error: expected declaration before '}' token
   74 | }
      | ^
Language: C++

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

int x[25][7]//0=left,1=right,2=parent,3=sibling;

void S1(int u){
	if(u==-1){
		return;
	}
	cout<<' '<<u;
	S1(x[u][0]);
	S1(x[u][1]);
}

void S2(int u){
	if(u==-1){
		return;
	}
	S2(x[u][0]);
	cout<<' '<<u;
	S2(x[u][1]);
}

void S3(int u){
	if(u==-1){
		return;
	}
	S3(x[u][0]);
	S3(x[u][1]);
	cout<<' '<<u;
}

int main(){
	memset(x,-1,sizeof(x));
	int n,a,c;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a;
		cin>>x[i][0]>>x[i][1];
		x[x[i][0]][2]=a;
		x[x[i][0]][3]=x[i][1];
		x[x[i][1]][3]=x[i][0];
	}
	cout<<"Preorder"<<endl;
	for(int i=0;i<n;i++){
		if(x[c][2]==-1){
			c=i;
			break;
		}
	}
	S1(c);cout<<endl;
	cout<<"Inorder"<<endl;
	S2(c);cout<<endl;
	cout<<"Postorder"<<endl;
	S3(c);cout<<endl;
	return 0;
}

Compiler output:
a.cc:7:1: error: expected initializer before 'void'
    7 | void S1(int u){
      | ^~~~
a.cc: In function 'void S2(int)':
a.cc:20:12: error: 'x' was not declared in this scope
   20 |         S2(x[u][0]);
      |            ^
a.cc: In function 'void S3(int)':
a.cc:29:12: error: 'x' was not declared in this scope
   29 |         S3(x[u][0]);
      |            ^
a.cc: In function 'int main()':
a.cc:35:16: error: 'x' was not declared in this scope
   35 |         memset(x,-1,sizeof(x));
      |                ^
a.cc:52:9: error: 'S1' was not declared in this scope; did you mean 'S3'?
   52 |         S1(c);cout<<endl;
      |         ^~
      |         S3
Language: C++

#include <iostream>
#include <algorithm>
#include <stack>
#include <string>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <list>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

struct node{ int parent, left, right;};
node t[100];
int n, NIL = -1;

void Preorder(int u) {
	if( u == NIL) return;
	printf(" %d", u);
	Preorder(t[u].left);
	Preorder(t[u].right);
}

int Inorder(int u) {
	if( u == NIL) return;
	Inorder(t[u].left);
	printf(" %d", u);
	Inorder(t[u].right);
}

int Postorder(int u) {
	if( u == NIL) return;
	Postorder(t[u].left);
	Postorder(t[u].right);
	printf(" %d", u);
}

int main(){
	int v, c, l, r;
	int n; cin >> n;
	for( int i = 0; i < n; i++) t[i].parent = NIL;
	for( int i = 0; i < n; i++) {
		cin >> v;
		for( int j = 0; j < 2; j++) {
			cin >> c;
			if( j == 0) t[v].left = c;
			else t[v].right = c;
			if( c != NIL) t[c].parent = v;
		}
	}
	for( int i = 0; i < n; i++) {
		if( t[i].parent == NIL) r = i;
	}

	cout << "Preorder" <<endl;
	Preorder(r);
	cout << endl;
	cout << "Inorder" <<endl;
	Preorder(r);
	cout << endl;
	cout << "Postorder" <<endl;
	Preorder(r);
	cout << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int Inorder(int)':
a.cc:28:23: error: return-statement with no value, in function returning 'int' [-fpermissive]
   28 |         if( u == NIL) return;
      |                       ^~~~~~
a.cc: In function 'int Postorder(int)':
a.cc:35:23: error: return-statement with no value, in function returning 'int' [-fpermissive]
   35 |         if( u == NIL) return;
      |                       ^~~~~~
a.cc: In function 'int Inorder(int)':
a.cc:31:16: warning: control reaches end of non-void function [-Wreturn-type]
   31 |         Inorder(t[u].right);
      |         ~~~~~~~^~~~~~~~~~~~
a.cc: In function 'int Postorder(int)':
a.cc:38:15: warning: control reaches end of non-void function [-Wreturn-type]
   38 |         printf(" %d", u);
      |         ~~~~~~^~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;
const MAX = 10000;
const NIL = -1;

struct node{
    int parent;
    int right;
    int left;
};

node T[MAX];

void preParse(int u){
    if(u == NIL) return;
    cout << u << " " << endl;
    preParse(T[u].left);
    preParse(T[u].right);
}

void inParse(int u){
    if (u == NIL) return;
    inParse(T[u].left);
    cout << u;
    inParse(T[u].right);
}

void postParse(int u){
    if (u == NIL) return;
    postParse(T[u].left);
    postParse(T[u].right);
    cout << u;
}

int main(){
    int n;
    cin >> n;
    for (int i = 0; i < n ; ++i) {
        cin >> T[i].parent >> T[i].left >> T[i].right;
    }

    //root???????????????
    for (int i = 0; i < n ; ++i) {
        int root;
        if(T[i].parent == NIL) i = root;
    }

    //preParse
    cout << "Preorder" << endl;
    preParse(root);

    //inParse
    cout << "Inorder" << endl;
    inParse(root);

    //postParse
    cout << "Postorder" << endl;
    postParse(root);

    return 0;
}

Compiler output:
a.cc:3:7: error: 'MAX' does not name a type
    3 | const MAX = 10000;
      |       ^~~
a.cc:4:7: error: 'NIL' does not name a type
    4 | const NIL = -1;
      |       ^~~
a.cc:12:8: error: 'MAX' was not declared in this scope
   12 | node T[MAX];
      |        ^~~
a.cc: In function 'void preParse(int)':
a.cc:15:13: error: 'NIL' was not declared in this scope
   15 |     if(u == NIL) return;
      |             ^~~
a.cc:17:14: error: 'T' was not declared in this scope
   17 |     preParse(T[u].left);
      |              ^
a.cc: In function 'void inParse(int)':
a.cc:22:14: error: 'NIL' was not declared in this scope
   22 |     if (u == NIL) return;
      |              ^~~
a.cc:23:13: error: 'T' was not declared in this scope
   23 |     inParse(T[u].left);
      |             ^
a.cc: In function 'void postParse(int)':
a.cc:29:14: error: 'NIL' was not declared in this scope
   29 |     if (u == NIL) return;
      |              ^~~
a.cc:30:15: error: 'T' was not declared in this scope
   30 |     postParse(T[u].left);
      |               ^
a.cc: In function 'int main()':
a.cc:39:16: error: 'T' was not declared in this scope
   39 |         cin >> T[i].parent >> T[i].left >> T[i].right;
      |                ^
a.cc:45:12: error: 'T' was not declared in this scope
   45 |         if(T[i].parent == NIL) i = root;
      |            ^
a.cc:45:27: error: 'NIL' was not declared in this scope
   45 |         if(T[i].parent == NIL) i = root;
      |                           ^~~
a.cc:50:14: error: 'root' was not declared in this scope
   50 |     preParse(root);
      |              ^~~~
Language: C++

#include <iostream>
using namespace std;
const int MAX = 10000;
const int NIL = -1;
???
struct node{
    int parent;
    int right;
    int left;
};
???
node T[MAX];
???
void preParse(int u){
    if(u == NIL) return;
    cout << u << " " ;
    preParse(T[u].left);
    preParse(T[u].right);
}
???
void inParse(int u){
    if (u == NIL) return;
    inParse(T[u].left);
    cout << u << " ";
    inParse(T[u].right);
}
???
void postParse(int u){
    if (u == NIL) return;
    postParse(T[u].left);
    postParse(T[u].right);
    cout << u << " ";
}
???
int main(){
    int n;
    int root;
    cin >> n;
    for (int i = 0; i < n ; ++i) {
        T[i].parent = NIL;
    }
    for (int i = 0; i < n ; ++i) {
        cin >> T[i].parent >> T[i].left >> T[i].right;
    }
???
    //root???????????????
    for (int i = 0; i < n ; ++i) {
        if(T[i].parent == NIL) i = root;
    }
???
    //preParse
    cout << "Preorder" << endl;
    preParse(root);
    cout << endl;
???
    //inParse
    cout << "Inorder" << endl;
    inParse(root);
    cout << endl;
???
    //postParse
    cout << "Postorder" << endl;
    postParse(root);
    cout << endl;
???
    return 0;
}

Compiler output:
a.cc:5:1: error: expected unqualified-id before '?' token
    5 | ???
      | ^
a.cc:11:1: error: expected unqualified-id before '?' token
   11 | ???
      | ^
a.cc:13:1: error: expected unqualified-id before '?' token
   13 | ???
      | ^
a.cc:20:1: error: expected unqualified-id before '?' token
   20 | ???
      | ^
a.cc:27:1: error: expected unqualified-id before '?' token
   27 | ???
      | ^
a.cc:34:1: error: expected unqualified-id before '?' token
   34 | ???
      | ^
Language: C++

#include <iostream>
using namespace std;
int n, v, a[25][2], r; bool f[25];
void p1(int u) { if(u == -1) return; cout << ' ' << u << endl, p1(u), p2(u); }
void p2(int u) { if(u == -1) return; p1(u), cout << ' ' << u << endl, p2(u); }
void p3(int u) { if(u == -1) return; p1(u), p2(u), cout << ' ' << u << endl; }
int main() {
	cin >> n;
	for(int i = 0; i < n; i++) cin >> v, cin >> a[v][0] >> a[v][1], f[a[v][0]] = f[a[v][1]] = true;
	for(int i = 0; i < n; i++) if(!f[i]) r = i;
	cout << "Preorder" << endl; p1(r);
	cout << "Inorder" << endl; p2(r);
	cout << "Postorder" << endl; p3(r);
}

Compiler output:
a.cc: In function 'void p1(int)':
a.cc:4:71: error: 'p2' was not declared in this scope; did you mean 'p1'?
    4 | void p1(int u) { if(u == -1) return; cout << ' ' << u << endl, p1(u), p2(u); }
      |                                                                       ^~
      |                                                                       p1
Language: C++

#include <stdio.h>
int n, v, a[25][2], r; bool f[25];
void p1(int u) { if(~u) return; printf(" %d", u), p1(a[u][0]), p1(a[u][1]); }
void p2(int u) { if(~u) return; p2(a[u][0]), printf(" %d", u), p2(a[u][1]); }
void p3(int u) { if(~u) return; p3(a[u][0]), p3(a[u][1]), printf(" %d", u); }
int main() {
	cin >> n;
	for(int i = 0; i < n; i++) scanf("%d", &v), scanf("%d%d", a[v], a[v] + 1), f[a[v][0]] = f[a[v][1]] = true;
	for(int i = 0; i < n; i++) if(!f[i]) r = i;
	cout << "Preorder" << endl; p1(r); cout << endl;
	cout << "Inorder" << endl; p2(r); cout << endl;
	cout << "Postorder" << endl; p3(r); cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin >> n;
      |         ^~~
a.cc:10:9: error: 'cout' was not declared in this scope
   10 |         cout << "Preorder" << endl; p1(r); cout << endl;
      |         ^~~~
a.cc:10:31: error: 'endl' was not declared in this scope
   10 |         cout << "Preorder" << endl; p1(r); cout << endl;
      |                               ^~~~