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

#include <iostream>
#include <vector>
#include <string>
#include <limits>

using namespace std;

int count,minimum;

void pre(vector<vector<int> > &tree,int now)
{
	cout << " " << tree[now][0];
	for(int i=1;i<3;i++)
	{
		if(tree[now][i] != minimum)
		{
			pre(tree,tree[now][i]);
		}
	}
}

void ino(vector<vector<int> > &tree,int now)
{
	int size = tree[now].size();
	if(tree[now][1] == minimum && tree[now][2] == minimum)
	{
		cout << " " << tree[now][0];
	}
	else
	{
		if(tree[now][1]!=minimum)
		{
			ino(tree,tree[now][1]);
		}
		cout << " " << tree[now][0];
		if(tree[now][2]!=minimum)
		{
			ino(tree,tree[now][2]);
		}
	}
}

void print(vector<vector<int> > &tree)
{
	ino(tree,0);
	cout << endl;
	pre(tree,0);
	cout << endl;
}

void insert(vector<vector<int> > &tree,int key,int now)
{
	if(count == 0)					//root none
	{
		tree[0][0] = key;
	}
	else
	{
		if(tree[now][0] > key)		//left
		{
			if(tree[now][1] == minimum)	//child none
			{
				tree[now][1] = count;
				tree[count][0] = key;
			}
			else											//child exist
			{
				insert(tree,key,tree[now][1]);
			}
		}
		else						//right
		{
			if(tree[now][2] == minimum)	//child none
			{
				tree[now][2] = count;
				tree[count][0] = key;
			}
			else
			{
				insert(tree,key,tree[now][2]);
			}
		}
	}
}

void find(vector<vector<int> > &tree, int key)
{
	for(int i=0;i<count;i++)
	{
		if(tree[i][0] == key)
		{
			cout << "yes" << endl;
			return;
		}
	}
	cout << "no" << endl;
}

int main(void)
{
	count = 0;
	minimum = numeric_limits<int>::min();
    vector<vector<int> > tree;
	int n,num;
	string command;
	cin >> n;
    tree = vector<vector<int> >(n,vector<int>(3,minimum));

	for(int i=0;i<n;i++)
	{
		cin >> command;
		if(command == "insert")
		{
			cin >> num;		//input node num
			insert(tree,num,0);
			count++;
		}
		else if(command == "print")
		{
			print(tree);
		}
		else if(command == "find")
		{
			cin >> num;
			for(int j=0;j<count;j++)
			{
				if(tree[j][0] == num)
				{
					cout << "yes" << endl;
					return;
				}
			}
			cout << "no" << endl;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:130:41: error: return-statement with no value, in function returning 'int' [-fpermissive]
  130 |                                         return;
      |                                         ^~~~~~
Language: C++

#include <cstdio>
#include <cstdlib>
??
typedef struct node {
????????long v;
????????node *parent;
????????node *left;
????????node *right;
} Node;
??
typedef struct {
????????Node *root;
} Tree;
??
Tree T = {NULL};
??
void insertTree(Node *node) {
????????Node *y = NULL;
????????Node *x = T.root;
????????while (x != NULL) {
????????????????y = x;
????????????????if (node->v < x->v) {
????????????????????????x = x->left;
????????????????} else {
????????????????????????x = x->right;
????????????????}
????????}
????????node->parent = y;
????????if (y == NULL) {
????????????????T.root = node;
????????} else if (node->v < y->v) {
????????????????y->left = node;
????????} else {
????????????????y->right = node;
????????}
}
??
bool find(long v) {
????????Node *x = T.root;
????????while (x != NULL) {
????????????????if (x->v == v) return true;
????????????????else if (x->v < v) x = x->right;
????????????????else x = x->left;
????????}
????????return false;
}
??
void Preorder(Node *n) {
????????if (n != NULL) {
????????????????printf(" %ld", n->v);
????????????????Preorder(n->left);
????????????????Preorder(n->right);
????????}
}
??
void Inorder(Node *n) {
????????if (n != NULL) {
????????????????Inorder(n->left);
????????????????printf(" %ld", n->v);
????????????????Inorder(n->right);
????????}
}
??
int main () {
????????long n;
????????scanf("%ld", &n);
????????char command[10];
????????long value;
????????for (long i=0; i<n; i++) {
????????????????scanf(" %s %ld", command, &value);
????????????????if (command[0] == 'i') {
????????????????????????Node *node = (Node *)malloc(sizeof(Node));
????????????????????????node->v = value;
????????????????????????node->parent = NULL;
????????????????????????node->left = NULL;
????????????????????????node->right = NULL;
????????????????????????insertTree(node);
????????????????} else if (command[0] == 'f') {
????????????????????????bool found = find(value);
????????????????????????if (found) printf("yes\n");
????????????????????????else printf("no\n");
????????????????} else {
????????????????????????Inorder(T.root);
????????????????????????printf("\n");
????????????????????????Preorder(T.root);
????????????????????????printf("\n");
????????????????}
????????}
??
????????return 0;
}

Compiler output:
a.cc:3:1: error: expected unqualified-id before '?' token
    3 | ??
      | ^
a.cc:9:3: error: 'Node' does not name a type
    9 | } Node;
      |   ^~~~
a.cc:10:1: error: expected unqualified-id before '?' token
   10 | ??
      | ^
a.cc:13:3: error: 'Tree' does not name a type
   13 | } Tree;
      |   ^~~~
a.cc:14:1: error: expected unqualified-id before '?' token
   14 | ??
      | ^
a.cc:16:1: error: expected unqualified-id before '?' token
   16 | ??
      | ^
a.cc:37:1: error: expected unqualified-id before '?' token
   37 | ??
      | ^
a.cc:47:1: error: expected unqualified-id before '?' token
   47 | ??
      | ^
a.cc:55:1: error: expected unqualified-id before '?' token
   55 | ??
      | ^
a.cc:63:1: error: expected unqualified-id before '?' token
   63 | ??
      | ^
Language: C++

#include <cstdio>
using namespace std;
??
struct Node {
????????Node *parent;
????????Node *left;
????????Node *right;
????????int key;
};
??
Node *NIL = NULL;
??
void preorder(Node *v) {
????????if (v == NIL) return;
????????printf(" %d", v->key);
????????preorder(v->left);
????????preorder(v->right);
}
??
void inorder(Node* v) {
????????if (v == NIL) return;
????????inorder(v->left);
????????printf(" %d", v->key);
????????inorder(v->right);
}
??
void postorder(Node* v) {
????????if (v == NIL) return;
????????postorder(v->left);
????????postorder(v->right);
????????printf(" %d", v->key);
}
??
void insert(Node* &T, Node *z) {
????????Node *y = NIL;
????????Node *x = T;
????????while (x != NIL) {
????????????????y = x;
????????????????if (z->key < x->key)
????????????????????????x = x->left;
????????????????else
????????????????????????x = x->right;
????????}
????????z->parent = y;
??
????????if (y == NIL)
????????????????T = z;
????????else if (z->key < y->key)
????????????????y->left = z;
????????else
????????????????y->right = z;
}
??
bool find(Node* T, int key) {
????????Node *x = T;
????????if (x == NIL) return false;
????????if (x->key == key)
????????????????return true;
????????else if (key < x->key)
????????????????return find(x->left, key);
????????else
????????????????return find(x->right, key);
}
??
??
int main()
{
????????int n;
????????scanf("%d", &n);
??
????????Node *T = NIL;
????????for (int i = 0; i < n; ++i) {
????????????????char cmd[20];
????????????????int v;
????????????????scanf("%s", cmd);
????????????????if (cmd[0] == 'i') {
????????????????????????scanf("%d", &v);
????????????????????????Node *p = new Node;
????????????????????????p->key = v;
????????????????????????p->left = NIL;
????????????????????????p->right = NIL;
????????????????????????insert(T, p);
????????????????} else if (cmd[0] == 'f') {
????????????????????????scanf("%d", &v);
????????????????????????printf("%s\n", find(T, v) ? "yes" : "no");
????????????????} else if (cmd[0] == 'p') {
????????????????????????inorder(T);
????????????????????????printf("\n");
????????????????????????preorder(T);
????????????????????????printf("\n");
????????????????}
????????}
????????return 0;
}

Compiler output:
a.cc:3:1: error: expected unqualified-id before '?' token
    3 | ??
      | ^
a.cc:10:1: error: expected unqualified-id before '?' token
   10 | ??
      | ^
a.cc:12:1: error: expected unqualified-id before '?' token
   12 | ??
      | ^
a.cc:19:1: error: expected unqualified-id before '?' token
   19 | ??
      | ^
a.cc:26:1: error: expected unqualified-id before '?' token
   26 | ??
      | ^
a.cc:33:1: error: expected unqualified-id before '?' token
   33 | ??
      | ^
a.cc:53:1: error: expected unqualified-id before '?' token
   53 | ??
      | ^
a.cc:64:1: error: expected unqualified-id before '?' token
   64 | ??
      | ^
Language: C++

#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
using namespace std;

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

Node *root, *NIL;

Node *find(Node *u, int k) {
	while (u != NIL&&k != u->key) {
		if (k < u->key)u = u->left;
		else u = u->right;
	}
	return u;
}

void insert(int k) {
	Node *y = NIL;
	Node *x = root;
	Node *z;

	z = (Node*)malloc(sizeof(Node));
	z->key = k;
	z->left = NIL;
	z->right = NIL;

	while (x != NIL) {
		y = x;
		if (z->key < x->key) {
			x = x->left;
		}else{
			x = x->right;
		}
	}
	z->parent = y;

	if (y == NIL) {
		root = z;
	} else {
		if (z->key < y->key) {
			y->left = z;
		} else {
			y->right = z;
		}
	}
}

void inorder(Node *u) {
	if (u == NIL)return;
	inorder(u->left);
	cout << " " << u->key;
	inorder(u->right);
}
void preorder(Node *u) {
	if (u == NIL)return;
	cout << " " << u->key;
	preorder(u->left);
	preorder(u->right);
}

int main()
{
	int n, i, x;
	string com;

	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> com;
		if (com == "find") {
			cin >> x;
			Node *t == find(root, x);
			if (t != NIL) cout << "yes" << endl;
			else cout << "no" << endl;
		}else if (com == "insert") {
			cin >> x;
			insert(x);
		}else if(com=="print"){
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}
	}
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:33: error: expected initializer before '==' token
   76 |                         Node *t == find(root, x);
      |                                 ^~
a.cc:77:29: error: 't' was not declared in this scope
   77 |                         if (t != NIL) cout << "yes" << endl;
      |                             ^
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<iostream>
using namespace std;

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

Node *root,*NIL;
Node * find(Node *u,int k){
while(u != NIL && k!= u->key){
if(k < u->key)u = u->l;
else u = u->r;
}
return u;
}

void insert(int k){
Node *y=NIL;
Node *x=root;
Node *z;

z=(Node *)malloc(sizeof(Node));
z->key=k;
z->l=NIL;
z->r=NIL;

while(x != NIL){
y=x;
if(z->key < x->key){
x=x->l;
}else{
x=x->r;
}
}
z->p =y;
if(y==NIL){
root-z;
}else{
if(z->key < y->key){
y->l=z;
}else{
y->r=z;
}
}
}

void inorder(Node *u){
if(u==NIL)return;
inorder(u->l);
printf("%d",u->key);
inorder(u->r);
}

void preorder(Node *u){
if(u==NIL)return;
printf("%d",u->key);
preorder(u->l);
preorder(u->r);
}

int main(){
int n,i,x;
string com;

scanf("%d",&n);

for(i=0;i<n;i++){
cin >> com;
if(com[0] == 'f'){
scanf("%d",&x);
Node *t=find(root,x);
if(t != NIL)printf("yes\n);
else printf("no\n");
}else if(com == "insert"){
scanf("%d",&x);
insert(x);
}else if(com == "print"){
inorder(root);
printf("\n");
preorder(root);
printf("\n");
}
}

return 0;
}

Compiler output:
a.cc:76:20: warning: missing terminating " character
   76 | if(t != NIL)printf("yes\n);
      |                    ^
a.cc:76:20: error: missing terminating " character
   76 | if(t != NIL)printf("yes\n);
      |                    ^~~~~~~~
a.cc: In function 'int main()':
a.cc:77:1: error: expected primary-expression before 'else'
   77 | else printf("no\n");
      | ^~~~
Language: C++

#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node treeMinimum(Node);
Node treeMaximum(Node);
Node treeSearch(Node,int);
Node treeSuccessor(Node);
void treeDelete(Node);
void insert(int);
void inorder(Node);
void preorder(Node);

Node root;

Node treeMinimum(Node x){
  while(x->left != NIL){
    x = x->left;
  }
  return x;

}

Node treeMaximum(Node x){
  while(x->right != NIL){
    x = x->right;
  }
  return x;

}

Node treeSearch(Node u, int k){
  if(u == NIL || k == u->key) return u;

  if(k < u->key) return treeSearch(u->left, k);
  else return treeSearch(u->right,k);

}

Node treeSuccessor(Node x){
  Node y;
  
  if(x->right != NIL) return treeMinimum(x->right);

  y = x->parent;
  while(y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y;

}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y

  if(z->left == NIL || z->right == NIL) y = z;
  else y = treeSuccessor(z);

  if(y->left != NIL) x = y->left;
  else x = y->right;

  if(x != NIL) x->parent = y->parent;

  if(y->parent == NIL) root = x;
  else if(y == y->parent->left) y->parent->left = x;
  else y->parent->right = x;

  if(y != z) z->key = y->key;
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  
  while(x != NIL){
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->parent = y;

  if(y == NIL) root = z;
  else if(z->key < y->key) y->left = z;
  else y->right = z;

}

void inorder(Node u){  
  if(u == NIL) return;

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

  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n,i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

Compiler output:
a.cc: In function 'void insert(int)':
a.cc:86:13: error: invalid conversion from 'void*' to 'Node' {aka 'node*'} [-fpermissive]
   86 |   z = malloc(sizeof(struct node));
      |       ~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |             |
      |             void*
Language: C++

#include<stdio.h>
#include<stdlib.h>

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

typedef struct node *Node;
Node root;

Node find(Node x,int k){
  if(x  == NULL || k == x->key)return x;
  if(k < x->key)return find(x->left,k);
  else return find(x->right,k);
}




void insert(int k){
  Node y = NULL;//x??????
  Node x = root;//t????????£???
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NULL;
  z->right = NULL;

  while(x != NULL){
    y = x;
    if(z->key < x->key)x = x->left;
    else x = x->right;
  }

  z->parent = y;

  if( y == NULL )root = z;
  else if(z->key < y->key) y->left = z;
  else y->right = z;

}

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


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


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);

    if(com[0] =='f'){
      scanf("%d",&x);
      Node t = find(root,x);
      if( t ! = NULL )printf("yes\n");
      else printf("no\n");
    }

    else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    }
    else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'void insert(int)':
a.cc:28:13: error: invalid conversion from 'void*' to 'Node' {aka 'node*'} [-fpermissive]
   28 |   z = malloc(sizeof(struct node));
      |       ~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |             |
      |             void*
a.cc: In function 'int main()':
a.cc:74:12: error: expected ')' before '!' token
   74 |       if( t ! = NULL )printf("yes\n");
      |         ~  ^~
      |            )
Language: C++

#include<stdio.h>
#include<stdlib.h>

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

typedef struct node *Node;
Node root;

Node find(Node x,int k){
  if(x  == NULL || k == x->key)return x;
  if(k < x->key)return find(x->left,k);
  else return find(x->right,k);
}




void insert(int k){
  Node y = NULL;//x??????
  Node x = root;//t????????£???
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NULL;
  z->right = NULL;

  while(x != NULL){
    y = x;
    if(z->key < x->key)x = x->left;
    else x = x->right;
  }

  z->parent = y;

  if( y == NULL )root = z;
  else if(z->key < y->key) y->left = z;
  else y->right = z;

}

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


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


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);


    if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    }
    else if(com[0] =='f'){
      scanf("%d",&x);
      Node t = find(root,x);
      if( t!= NULL )printf("yes\n");
      else printf("no\n");
    }
    else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'void insert(int)':
a.cc:28:13: error: invalid conversion from 'void*' to 'Node' {aka 'node*'} [-fpermissive]
   28 |   z = malloc(sizeof(struct node));
      |       ~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |             |
      |             void*
Language: C++

#include<stdio.h>
#include<stdlib.h>
 
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL
 
Node root;
 
Node treeSearch(Node u, int k){
  while(u != NIL && u->key != k){
  if( u->key > k)u = u->left;
  else u = u->right;
  }
  return u;
}
 
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;
 
  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
 
  while(x != NIL){
    y = x;
    if(z->key < x->key){
      x = x->left;
    }
    else x = x->right;
  }
 
  z->parent = y;
  if(y == NIL) {
    root = z;  
  }
  else if(z->key < y->key){
    y->left = z;
  }
  else y->right = z;
}
 
 
void inorder(Node u){
  if(u->left != NIL){
    inorder(u->left);
  }
  printf(" %d",u->key);
  if(u->right != NIL){
    inorder(u->right);
  }
 
}
void preorder(Node u){
  printf(" %d",u->key);
  if(u->left!= NIL){
    preorder(u->left);
  }
  if(u->right!= NIL){
    preorder(u->right);
  }
}
 
int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);
 
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } 
  }
  return 0;
}

Compiler output:
a.cc: In function 'void insert(int)':
a.cc:28:13: error: invalid conversion from 'void*' to 'Node' {aka 'node*'} [-fpermissive]
   28 |   z = malloc(sizeof(struct node));
      |       ~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |             |
      |             void*
Language: C++

#include <stdio.h>
#include <stdlib.h>
#define NIL NULL

struct node {
  int key;
  struct node *right;
  struct node *left;
  struct node *parent;
};
typedef struct node * Node;
Node root;
void Insert(int );
void inorder(Node );
void preorder(Node );
Node search(Node, int);

int main()
{
  int i,j,k;
  char c[10];
  Node a;
  scanf("%d",&k);
  
  for(i=0;i<k;i++)
    {
      scanf("%s",&c[0]);
      if(c[0]=='f')
	{
	  scanf("%d",&j);
	  a=search(root,j);
	  if(a!=NIL) printf("yes\n");
	  else printf("no\n");
	}
      if(c[0]=='i')
	{
	  scanf("%d",&j);
	  Insert(j);
	}
      else if(c[0]=='p') 
	{
	  inorder(root);
	  printf("\n");
	  preorder(root);
	  printf("\n");
	}
    }
  return 0;
}

void Insert(int p)
{
  Node x=root;
  Node y=NIL;
  Node z;
  
  z=malloc(sizeof(struct node));
  z->key=p;
  z->left=NIL;
  z->right=NIL;
  
  while(x!=NIL)
    {
      y=x;
      if(z->key < x->key) x=x->left;
      else x=x->right;

      z->parent=y;
    }
  if(y==NIL) root=z;
  else if(z->key < y->key) y->left=z;
  else  y->right=z;
}

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

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

Node search(Node u,int k)
{
  while(u!=NIL && k!=u->key)
    {
      if(k < u->key) u=u->left;
      else u=u->right;
    }
  return u;
}

Compiler output:
a.cc: In function 'void Insert(int)':
a.cc:57:11: error: invalid conversion from 'void*' to 'Node' {aka 'node*'} [-fpermissive]
   57 |   z=malloc(sizeof(struct node));
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
Language: C++

#include <stdio.h>
#include <stdlib.h>
#define NIL NULL

struct node {
  int key;
  struct node *right;
  struct node *left;
  struct node *parent;
};
typedef struct node * Node;
Node root;
void Insert(int );
void inorder(Node );
void preorder(Node );
Node search(Node, int);

int main()
{
  int i,j,k;
  char c[10];
  
  scanf("%d",&k);
  
  for(i=0;i<k;i++)
    {
      scanf("%s",&c[0]);
      if(c[0]=='f')
	{
	  scanf("%d",&j);
	  Node a=search(root,j);
	  if(a!=NIL) printf("yes\n");
	  else printf("no\n");
	}
      if(c[0]=='i')
	{
	  scanf("%d",&j);
	  Insert(j);
	}
      else if(c[0]=='p') 
	{
	  inorder(root);
	  printf("\n");
	  preorder(root);
	  printf("\n");
	}
    }
  return 0;
}

void Insert(int p)
{
  Node x=root;
  Node y=NIL;
  Node z;
  
  z=malloc(sizeof(struct node));
  z->key=p;
  z->left=NIL;
  z->right=NIL;
  
  while(x!=NIL)
    {
      y=x;
      if(z->key < x->key) x=x->left;
      else x=x->right;

      z->parent=y;
    }
  if(y==NIL) root=z;
  else if(z->key < y->key) y->left=z;
  else  y->right=z;
}

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

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

Node search(Node u,int k)
{
  while(u!=NIL && k!=u->key)
    {
      if(k < u->key) u=u->left;
      else u=u->right;
    }
  return u;
}

Compiler output:
a.cc: In function 'void Insert(int)':
a.cc:57:11: error: invalid conversion from 'void*' to 'Node' {aka 'node*'} [-fpermissive]
   57 |   z=malloc(sizeof(struct node));
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
Language: C++

#include <stdio.h>
#include <stdlib.h>
#define NIL NULL

struct node {
  int key;
  struct node *right;
  struct node *left;
  struct node *parent;
};
typedef struct node * Node;
Node root;
void Insert(int );
void inorder(Node );
void preorder(Node );
Node search(Node, int);

int main()
{
  int i,j,k,yflag=0,nflag=0;
  char c[10];
  Node a;
  scanf("%d",&k);
  
  for(i=0;i<k;i++)
    {
      scanf("%s",&c[0]);
      if(c[0]=='f')
	{
	  scanf("%d",&j);
	  a=search(root,j);
	  if(a!=NIL) yflag++;
	  else nflag++;
	}
      if(c[0]=='i')
	{
	  scanf("%d",&j);
	  Insert(j);
	}
      else if(c[0]=='p') 
	{
	  while(yflag!=0)
	    {
	      printf("yes\n");
	      yflag--;
	    }
	  while(nflag!=0)
	    {
	      printf("no\n");
	      nflag--;
	    }
	  inorder(root);
	  printf("\n");
	  preorder(root);
	  printf("\n");
	}
    }
  return 0;
}

void Insert(int p)
{
  Node x=root;
  Node y=NIL;
  Node z;
  
  z=malloc(sizeof(struct node));
  z->key=p;
  z->left=NIL;
  z->right=NIL;
  
  while(x!=NIL)
    {
      y=x;
      if(z->key < x->key) x=x->left;
      else x=x->right;

      z->parent=y;
    }
  if(y==NIL) root=z;
  else if(z->key < y->key) y->left=z;
  else  y->right=z;
}

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

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

Node search(Node u,int k)
{
  while(u!=NIL && k!=u->key)
    {
      if(k < u->key) u=u->left;
      else u=u->right;
    }
  return u;
}

Compiler output:
a.cc: In function 'void Insert(int)':
a.cc:67:11: error: invalid conversion from 'void*' to 'Node' {aka 'node*'} [-fpermissive]
   67 |   z=malloc(sizeof(struct node));
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
Language: C++

#include <stdio.h>
#include <stdlib.h>
#define NIL NULL

struct node {
  int key;
  struct node *right;
  struct node *left;
  struct node *parent;
};
typedef struct node * Node;
Node root;
void Insert(int );
void inorder(Node );
void preorder(Node );
Node search(Node, int);

int main()
{
  int i,j,k,yflag=0,nflag=0;
  char c[10];
  Node a;
  scanf("%d",&k);
  
  for(i=0;i<k;i++)
    {
      scanf("%s",&c[0]);
      if(c[0]=='f')
	{
	  scanf("%d",&j);
	  a=search(root,j);
	  if(a!=NIL) yflag++;
	  else nflag++;
	}
      if(c[0]=='i')
	{
	  scanf("%d",&j);
	  Insert(j);
	}
      else if(c[0]=='p') 
	{
	  while(yflag!=0)
	    {
	      printf("yes\n");
	      yflag--;
	    }
	  while(nflag!=0)
	    {
	      printf("no\n");
	      nflag--;
	    }
	  inorder(root);
	  printf("\n");
	  preorder(root);
	  printf("\n");
	}
    }
  return 0;
}

void Insert(int p)
{
  Node x=root;
  Node y=NIL;
  Node z;
  
  *z=malloc(sizeof(struct node));
  z->key=p;
  z->left=NIL;
  z->right=NIL;
  
  while(x!=NIL)
    {
      y=x;
      if(z->key < x->key) x=x->left;
      else x=x->right;

      z->parent=y;
    }
  if(y==NIL) root=z;
  else if(z->key < y->key) y->left=z;
  else  y->right=z;
}

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

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

Node search(Node u,int k)
{
  while(u!=NIL && k!=u->key)
    {
      if(k < u->key) u=u->left;
      else u=u->right;
    }
  return u;
}

Compiler output:
a.cc: In function 'void Insert(int)':
a.cc:67:32: error: no match for 'operator=' (operand types are 'node' and 'void*')
   67 |   *z=malloc(sizeof(struct node));
      |                                ^
a.cc:5:8: note: candidate: 'constexpr node& node::operator=(const node&)'
    5 | struct node {
      |        ^~~~
a.cc:5:8: note:   no known conversion for argument 1 from 'void*' to 'const node&'
a.cc:5:8: note: candidate: 'constexpr node& node::operator=(node&&)'
a.cc:5:8: note:   no known conversion for argument 1 from 'void*' to 'node&&'
Language: C++

#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;

Node root;

void Insert(int k){
  Node y = NULL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NULL;
  z->right = NULL;

  while( x != NULL ){
    y = x;
    if( z->key < x->key ){
      x = x->left;
    }else{
      x = x->right;
    }
  }

  z->parent = y;

  if( y == NULL ){
    root = z;
  }else if( z->key < y->key ){
    y->left = z;
  }else{
    y->right = z;
  }

}

void Order1(Node u){
  if( u == NULL ){
    return;
  }
  Order1(u->left);
  printf(" %d" ,u->key);
  Order1(u->right);
}

void Order2(Node u){
  if( u == NULL ){
    return;
  }
  printf(" %d" ,u->key);
  Order2(u->left);
  Order2(u->right);
}

Node Search(Node u, int k){
  if( u == NULL || k == u->key){
    return u;
  }
  if( k < u->key ){
    return Search( u->left, k);
  }else {
    return Search( u->right, k);
  }
}



int main(){

  char c[20];
  int n, i, x;
  scanf("%d", &n);
  for ( i = 0; i < n; i++ ){
    scanf("%s", c);
    if ( c[0] == 'f' ){
      scanf("%d", &x);
      Node t = Search(root, x);
      if ( t != NULL ) printf("yes\n");
      else printf("no\n");
    } else if ( c[0] == 'i' ){
      scanf("%d", &x);
      Insert(x);
    } else if ( c[0] == 'p' ){
      Order1(root);
      printf("\n");
      Order2(root);
      printf("\n");
    }
  }

  return 0;
}

Compiler output:
a.cc: In function 'void Insert(int)':
a.cc:19:13: error: invalid conversion from 'void*' to 'Node' {aka 'node*'} [-fpermissive]
   19 |   z = malloc(sizeof(struct node));
      |       ~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |             |
      |             void*
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<iostream>
using namespace std;

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

Node *root, *NIL;

Node * find(Node *u, int k) {
	while (u != NIL && k != u->key)
	{
		if (k < u->key) u = u->left;
		else u = u->right;
	}
	return u;
}

void insert(int k) {
	Node *y = NIL;
	Node *x = root;
	Node *z;

	z = (Node *)malloc(sizeof(Node));
	z->key = k;
	z->left = NIL;
	z->right = NIL;

	while (x != NIL)
	{
		y = x;
		if (z->key < x->key)
		{
			x = x->left;
		}
		else
		{
			x = x->right;
		}
	}
	z->parent = y;
	if (y == NIL)
	{
		root = z;
	}
	else if (z->key < y->key)
	{
		y->left = z;
	}
	else
	{
		y->right = z;
	}
}

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

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

int main() {
	int n, i, x;
	string com;
	scanf ("%d", &n)
		for (i = 0; i < n; i++)
		{
			cin >> com;
			if (cim[0] == 'f')
			{
				scanf("%d", x);
				Node *t = find;
				if (t != NIL) printf("yes\n");
				else printf("%d", %n);
				{
			else if (com == insert);
				}
			}
			else if (com == "print")
			{
				inorder(root);
				printf("\n");
				preorder(root);
				preorder("\n");
			}
		}	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:78:25: error: expected ';' before 'for'
   78 |         scanf ("%d", &n)
      |                         ^
      |                         ;
   79 |                 for (i = 0; i < n; i++)
      |                 ~~~      
a.cc:79:39: error: expected ';' before ')' token
   79 |                 for (i = 0; i < n; i++)
      |                                       ^
      |                                       ;
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<iostream>
using namespace std;

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

Node *root, *NIL;

Node * find(Node *u, int k) {
	while (u != NIL && k != u->key)
	{
		if (k < u->key) u = u->left;
		else u = u->right;
	}
	return u;
}

void insert(int k) {
	Node *y = NIL;
	Node *x = root;
	Node *z;

	z = (Node *)malloc(sizeof(Node));
	z->key = k;
	z->left = NIL;
	z->right = NIL;

	while (x != NIL)
	{
		y = x;
		if (z->key < x->key)
		{
			x = x->left;
		}
		else
		{
			x = x->right;
		}
	}
	z->parent = y;
	if (y == NIL)
	{
		root = z;
	}
	else if (z->key < y->key)
	{
		y->left = z;
	}
	else
	{
		y->right = z;
	}
}

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

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

int main() {
	int n, i, x;
	string com;
	scanf ("%d", &n)
		for (i = 0; i < n; i++)
		{
			cin >> com;
			if (com[0] == 'f')
			{
			scanf("%d", x);
			Node *t = find(root, x);
			if (t != NIL) printf("yes\n");
			else printf("%d", %n);
			else if (com == "insert") {
				scanf("%d", &x);
				insert(x);
			}
			else if (com == "print")
			{
				inorder(root);
				printf("\n");
				preorder(root);
				preorder("\n");
			}
		}
		
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:78:25: error: expected ';' before 'for'
   78 |         scanf ("%d", &n)
      |                         ^
      |                         ;
   79 |                 for (i = 0; i < n; i++)
      |                 ~~~      
a.cc:79:39: error: expected ';' before ')' token
   79 |                 for (i = 0; i < n; i++)
      |                                       ^
      |                                       ;
a.cc:102:2: error: expected '}' at end of input
  102 | }
      |  ^
a.cc:75:12: note: to match this '{'
   75 | int main() {
      |            ^
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<iostream>
using namespace std;

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

Node *root, *NIL;

Node * find(Node *u, int k) {
	while (u != NIL && k != u->key)
	{
		if (k < u->key) u = u->left;
		else u = u->right;
	}
	return u;
}

void insert(int k) {
	Node *y = NIL;
	Node *x = root;
	Node *z;

	z = (Node *)malloc(sizeof(Node));
	z->key = k;
	z->left = NIL;
	z->right = NIL;

	while (x != NIL)
	{
		y = x;
		if (z->key < x->key)
		{
			x = x->left;
		}
		else
		{
			x = x->right;
		}
	}
	z->parent = y;
	if (y == NIL)
	{
		root = z;
	}
	else if (z->key < y->key)
	{
		y->left = z;
	}
	else
	{
		y->right = z;
	}
}

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

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

int main() {
	int n, i, x;
	string com;
	scanf ("%d", &n)
		for (i = 0; i < n; i++)
		{
			cin >> com;
			if (com[0] == 'f')
			{
				scanf("%d", x);
				Node *t = find(root, x);
			}
			if (t != NIL) printf("yes\n");
			else printf("%d", %n);
			else if (com == "insert") {
				scanf("%d", &x);
				insert(x);
			}
			else if (com == "print")
			{
				inorder(root);
				printf("\n");
				preorder(root);
				preorder("\n");
			}
		}
		
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:78:25: error: expected ';' before 'for'
   78 |         scanf ("%d", &n)
      |                         ^
      |                         ;
   79 |                 for (i = 0; i < n; i++)
      |                 ~~~      
a.cc:79:39: error: expected ';' before ')' token
   79 |                 for (i = 0; i < n; i++)
      |                                       ^
      |                                       ;
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<iostream>
using namespace std;

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

Node *root, *NIL;

Node * find(Node *u, int k) {
	while (u != NIL && k != u->key)
	{
		if (k < u->key) u = u->left;
		else u = u->right;
	}
	return u;
}

void insert(int k) {
	Node *y = NIL;
	Node *x = root;
	Node *z;

	z = (Node *)malloc(sizeof(Node));
	z->key = k;
	z->left = NIL;
	z->right = NIL;

	while (x != NIL)
	{
		y = x;
		if (z->key < x->key)
		{
			x = x->left;
		}
		else
		{
			x = x->right;
		}
	}
	z->parent = y;
	if (y == NIL)
	{
		root = z;
	}
	else if (z->key < y->key)
	{
		y->left = z;
	}
	else
	{
		y->right = z;
	}
}

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

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

int main() {
	int n, i, x;
	string com;
	scanf ("%d", &n)
		for (i = 0; i < n; i++)
		{
			cin >> com;
			if (com[0] == 'f')
			{
				scanf("%d", &x);
				Node *t = find(root, x);
			}
			if (t != NIL) printf("yes\n");
			else printf("%d", %n);
			else if (com == "insert") {
				scanf("%d", &x);
				insert(x);
			}
			else if (com == "print")
			{
				inorder(root);
				printf("\n");
				preorder(root);
				preorder("\n");
			}
		}
		
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:78:25: error: expected ';' before 'for'
   78 |         scanf ("%d", &n)
      |                         ^
      |                         ;
   79 |                 for (i = 0; i < n; i++)
      |                 ~~~      
a.cc:79:39: error: expected ';' before ')' token
   79 |                 for (i = 0; i < n; i++)
      |                                       ^
      |                                       ;
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<iostream>
using namespace std;

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

Node *root, *NIL;

Node * find(Node *u, int k) {
	while (u != NIL && k != u->key)
	{
		if (k < u->key) u = u->left;
		else u = u->right;
	}
	return u;
}

void insert(int k) {
	Node *y = NIL;
	Node *x = root;
	Node *z;

	z = (Node *)malloc(sizeof(Node));
	z->key = k;
	z->left = NIL;
	z->right = NIL;

	while (x != NIL)
	{
		y = x;
		if (z->key < x->key)
		{
			x = x->left;
		}
		else
		{
			x = x->right;
		}
	}
	z->parent = y;
	if (y == NIL)
	{
		root = z;
	}
	else if (z->key < y->key)
	{
		y->left = z;
	}
	else
	{
		y->right = z;
	}
}

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

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

int main() {
	int n, i, x;
	string com;
	scanf("%d", &n);
		for (i = 0; i < n; i++)
		{
			cin >> com;
			if (com[0] == 'f')
			{
				scanf("%d", &x);
				Node *t = find(root, x);
			}
			if (t != NIL) printf("yes\n");
			else printf("%d", %n);
			else if (com == "insert") {
				scanf("%d", &x);
				insert(x);
			}
			else if (com == "print")
			{
				inorder(root);
				printf("\n");
				preorder(root);
				preorder("\n");
			}
		}
		
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:87:29: error: 't' was not declared in this scope
   87 |                         if (t != NIL) printf("yes\n");
      |                             ^
a.cc:88:43: error: expected primary-expression before '%' token
   88 |                         else printf("%d", %n);
      |                                           ^
a.cc:89:25: error: 'else' without a previous 'if'
   89 |                         else if (com == "insert") {
      |                         ^~~~
a.cc:98:42: error: cannot convert 'const char*' to 'Node*'
   98 |                                 preorder("\n");
      |                                          ^~~~
      |                                          |
      |                                          const char*
a.cc:68:21: note:   initializing argument 1 of 'void preorder(Node*)'
   68 | void preorder(Node *u) {
      |               ~~~~~~^
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<iostream>
using namespace std;

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

Node *root, *NIL;

Node * find(Node *u, int k) {
	while (u != NIL && k != u->key)
	{
		if (k < u->key) u = u->left;
		else u = u->right;
	}
	return u;
}

void insert(int k) {
	Node *y = NIL;
	Node *x = root;
	Node *z;

	z = (Node *)malloc(sizeof(Node));
	z->key = k;
	z->left = NIL;
	z->right = NIL;

	while (x != NIL)
	{
		y = x;
		if (z->key < x->key)
		{
			x = x->left;
		}
		else
		{
			x = x->right;
		}
	}
	z->parent = y;
	if (y == NIL)
	{
		root = z;
	}
	else if (z->key < y->key)
	{
		y->left = z;
	}
	else
	{
		y->right = z;
	}
}

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

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

int main() {
	int n, i, x;
	string com;
	scanf("%d", &n);
		for (i = 0; i < n; i++)
		{
			cin >> com;
			if (com[0] == 'f')
			{
				scanf("%d", &x);
				Node *t = find(root, x);
			}
			if (t != NIL) printf("yes\n");
			else printf("no\n");
			else if (com == "insert") {
				scanf("%d", &x);
				insert(x);
			}
			else if (com == "print")
			{
				inorder(root);
				printf("\n");
				preorder(root);
				preorder("\n");
			}
		}
		
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:87:29: error: 't' was not declared in this scope
   87 |                         if (t != NIL) printf("yes\n");
      |                             ^
a.cc:89:25: error: 'else' without a previous 'if'
   89 |                         else if (com == "insert") {
      |                         ^~~~
a.cc:98:42: error: cannot convert 'const char*' to 'Node*'
   98 |                                 preorder("\n");
      |                                          ^~~~
      |                                          |
      |                                          const char*
a.cc:68:21: note:   initializing argument 1 of 'void preorder(Node*)'
   68 | void preorder(Node *u) {
      |               ~~~~~~^
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<iostream>
using namespace std;

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

Node *root, *NIL;

Node * find(Node *u, int k) {
	while (u != NIL && k != u->key)
	{
		if (k < u->key) u = u->left;
		else u = u->right;
	}
	return u;
}

void insert(int k) {
	Node *y = NIL;
	Node *x = root;
	Node *z;

	z = (Node *)malloc(sizeof(Node));
	z->key = k;
	z->left = NIL;
	z->right = NIL;

	while (x != NIL)
	{
		y = x;
		if (z->key < x->key)
		{
			x = x->left;
		}
		else
		{
			x = x->right;
		}
	}
	z->parent = y;
	if (y == NIL)
	{
		root = z;
	}
	else if (z->key < y->key)
	{
		y->left = z;
	}
	else
	{
		y->right = z;
	}
}

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

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

int main() {
	int n, i, x;
	string com;
	scanf("%d", &n);
		for (i = 0; i < n; i++)
		{
			cin >> com;
			if (com[0] == 'f')
			{
				scanf("%d", &x);
				Node *t = find(root, x);
				if (t != NIL) printf("yes\n");
				else printf("no\n");
			}
			else if (com == "insert") {
				scanf("%d", &x);
				insert(x);
			}
			else if (com == "print")
			{
				inorder(root);
				printf("\n");
				preorder(root);
				preorder("\n");
			}
		}
		
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:98:42: error: cannot convert 'const char*' to 'Node*'
   98 |                                 preorder("\n");
      |                                          ^~~~
      |                                          |
      |                                          const char*
a.cc:68:21: note:   initializing argument 1 of 'void preorder(Node*)'
   68 | void preorder(Node *u) {
      |               ~~~~~~^
Language: C++

#include <cstdio>
#include <cstdlib>
#include <iostream>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
struct Node {int key;Node *right,*left,*parent;};
Node *root,*NIL;
Node *find(Node *u,int k){
  while(u!=NIL&&k!=u->key){
    if(k<u-key) u=u->left;
    else u=u->right;
  }
  return u;
}
void insert(int k){
  Node *y=NIL,*x=root,*z;
  z=(Node *)malloc(sizeof(Node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;
  while(x!=NIL){
    y=x;
    if(z->key < x->key) x=x->left;
    else x=x->right;
  }
  z->parent=y;
  if(y==NIL) root=z;
  else {
    if(z->key < y->key) y->left=z;
    else y->right=z;
  }
}
void inorder(Node *u){
  if(u==NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node *u){
  if(u==NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}
int main(){
  int n,x;
  char com[6];
  scanf("%d",&n);
  REP(i,n){
    scanf("%s",com);
    if(com[0]=='i'){
      scanf("%d",&x);
      insert(x);
    } else if(com[0]=='p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if(com[0]=='f'){
      scanf("%d",&x);
      Node *t=find(root,x);
      if(t!=NIL) printf("yes\n");
      else printf("no\n");
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'Node* find(Node*, int)':
a.cc:10:12: error: 'key' was not declared in this scope
   10 |     if(k<u-key) u=u->left;
      |            ^~~
Language: C++

include <iostream>
#include <cstdio>
#include <cstdlib>
#pragma warning(disable:4996)
using namespace std;
 
struct Node {
    int key;
    int left;
    int right;
};
 
int n;
char command[7];
Node tree[500000];
int tree_num;
int root = -1;
 
inline int create_node(int key) {
    Node& node = tree[tree_num];
    node.key = key;
    node.left = -1;
    node.right = -1;
    return tree_num++;
}
 
inline void insert(int key) {
    if (root == -1) {
        root = create_node(key);
        return;
    }
    int node = root, parent = 0;
    while (node != -1) {
        parent = node;
        if (key < tree[node].key) {
            node = tree[node].left;
        }
        else {
            node = tree[node].right;
        }
    }
    int newnode = create_node(key);
    if (key < tree[parent].key) {
        tree[parent].left = newnode;
    }
    else {
        tree[parent].right = newnode;
    }
}
 
inline int find(int key) {
    int node = root;
    while (node != -1) {
        if (tree[node].key == key) {
            return node;
        }
        else if (tree[node].key > key) {
            node = tree[node].left;
        }
        else {
            node = tree[node].right;
        }
    }
    return -1;
}
 
void pre_order(int root) {
    Node& node = tree[root];
    printf(" %d", node.key);
    if (node.left != -1) {
        pre_order(node.left);
    }
    if (node.right != -1) {
        pre_order(node.right);
    }
}
 
void in_order(int root) {
    Node& node = tree[root];
    if (node.left != -1) {
        in_order(node.left);
    }
    printf(" %d", node.key);
    if (node.right != -1) {
        in_order(node.right);
    }
}
 
int main(void) {
    scanf("%d", &n);
    for (int i = 0, key; i < n; ++i) {
        scanf("%s", command);
        if (command[0] == 'i') {
            scanf("%d", &key);
            insert(key);
        }
        else if (command[0] == 'f') {
            scanf("%d", &key);
            int found = find(key);
            printf("%s\n", found != -1 ? "yes" : "no");
        }
        else {
            if (root == -1) { continue; }
            in_order(0);
            printf("\n");
            pre_order(0);
            printf("\n");
        }
    }
    return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <iostream>
      | ^~~~~~~