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

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Maim {

	public static void main(String[] args) throws NumberFormatException, IOException {

		Scanner scanner = new Scanner(System.in);
		int num = scanner.nextInt();
		Node root = null;
		int findKey = 0;

		for (int i = 0; i < num; i++) {
			String element = scanner.next();
			if (element.equals("insert") ) {
				int key = scanner.nextInt();
				Node node = new Node(key);
				if (root == null) {
					root = node;
					continue;
				}
				treeInsert(root, node);
			} else if (element.equals("find")) {
					findKey = scanner.nextInt();
					if (root.inorderTreeWalk(findKey)) {
						System.out.println("yes");
					} else {
						System.out.println("no");
					}
			} else {
				StringBuilder stringBuilder = new StringBuilder();
				root.inorderTreeWalk(stringBuilder);
				System.out.println(stringBuilder);
				stringBuilder = new StringBuilder();
				root.preorderTreeWalk(stringBuilder);
				System.out.println(stringBuilder);
			}
		}

	}

	static void treeInsert(Node root, Node z) {
		Node y = null;
		Node x = root;
		while (x != null) {
			y = x;
			if (z.key < x.key) {
				x = x.leftChild;
			} else {
				x = x.rightChild;
			}
		}
		z.parent = y;

		if (y == null) {
			root = z;
		} else if (z.key < y.key) {
			y.leftChild = z;
		} else {
			y.rightChild = z;
		}
	}
	
}
 class Node {
	/** ????????????????????§??? */
	public Node parent;
	
	/** ???????????§??? */
	public Node rightChild;
	
	/** ???????????§??? */
	public Node leftChild;
	
	/** ?????????????????§??? */
	public int key;
	
	public Node(int key) {
		this.key = key;
	}
	
	/** ???????????????????????????  void */
	public void inorderTreeWalk(StringBuilder stringBuilder) {
		if (leftChild != null) {
			leftChild.inorderTreeWalk(stringBuilder);
		}
		stringBuilder.append(" " + String.valueOf(key));
		if (rightChild != null) {
			rightChild.inorderTreeWalk(stringBuilder);
		}
	}
	
	/** ??????????????????????????? */
	public void preorderTreeWalk(StringBuilder stringBuilder) {
		stringBuilder.append(" " + String.valueOf(key));
		if (leftChild != null) {
			leftChild.preorderTreeWalk(stringBuilder);
		}
		if (rightChild != null) {
			rightChild.preorderTreeWalk(stringBuilder);
		}
	}
	/** ???????????????????????? boolean */
	public boolean inorderTreeWalk(int findKey) {
		if (key == findKey) {
			return true;
		}
		if (leftChild == null) {
			return false;
		} else if (findKey < key){
			if (leftChild == null) {
				return false;
			} else {
				return leftChild.inorderTreeWalk(findKey);
			}
		} else {
			if (rightChild == null) {
				return false;
			} else {
				return rightChild.inorderTreeWalk(findKey);
			}
		}
	}
}

Compiler output:
Main.java:6: error: class Maim is public, should be declared in a file named Maim.java
public class Maim {
       ^
1 error
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 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 x;
if (k < u->key)
return treeSearch(u->left, k);
else
return treeSearch(u->right, k)
return u;

}

Node treeSuccessor(Node x){
	Node y;
if (x->right != NIL)
return treeMinimum(x->right); // case 1
y = x->parent;
while (y != NIL && x == y->right) {
x = y;
y = y->parent;
}
return y; // case 2

}


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");
    } 
  }

  return 0;
}



Compiler output:
main.c: In function 'treeSearch':
main.c:29:36: error: 'x' undeclared (first use in this function)
   29 | if(u == NIL || k == u->key) return x;
      |                                    ^
main.c:29:36: note: each undeclared identifier is reported only once for each function it appears in
main.c:33:31: error: expected ';' before 'return'
   33 | return treeSearch(u->right, k)
      |                               ^
      |                               ;
   34 | return u;
      | ~~~~~~
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 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 x;
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); // case 1
y = x->parent;
while (y != NIL && x == y->right) {
x = y;
y = y->parent;
}
return y; // case 2

}


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");
    } 
  }

  return 0;
}



Compiler output:
main.c: In function 'treeSearch':
main.c:29:36: error: 'x' undeclared (first use in this function)
   29 | if(u == NIL || k == u->key) return x;
      |                                    ^
main.c:29:36: note: each undeclared identifier is reported only once for each function it appears in
main.c:33:31: error: expected ';' before '}' token
   33 | return treeSearch(u->right, k)
      |                               ^
      |                               ;
......
   36 | }
      | ~
Language: C

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

struct node{
  struct node *r;
  struct node *l;
  struct node *par;
  int key;
};
typedef struct node * Node;
#define NIL NULL
Node treeSearch(Node,int);
Node root;

Node treeSearch(Node u, int k){
  if(u == NIL || u->key == k) return u;
  if(k<u->key){
    return treeSearch(u->l,k)
  }
  else if(k>u->key){
    return treeSearch(u->r,k);
  }
  return NIL;
}

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

  z = malloc(sizeof(struct 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->par = y;
  if(y==NIL) root = z;
  else if(z->key < y->key) y->l = z; // z を y の左の子にする
    else y->r = z; // z を y の右の子にする
}

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

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


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] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    }
  }

  return 0;
}


Compiler output:
main.c: In function 'treeSearch':
main.c:18:30: error: expected ';' before '}' token
   18 |     return treeSearch(u->l,k)
      |                              ^
      |                              ;
   19 |   }
      |   ~
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 inoder(Node *u){
  if(u == NIL)
    return;
  inoder(u->left);
  printf(" %d", u->key);
  inoder(u->right);
}

void preoder(Node *u){
  if(u == NIL)
    return;
  printf(" %d", u->key);
  preoder(u->left);
  preoder(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")
	{
	  inoder(root);
	  printf("\n");
	  preoder(root);
	  printf("\n");
	}
    }

  return 0;
}



Compiler output:
main.c:3:9: fatal error: string: No such file or directory
    3 | #include<string>
      |         ^~~~~~~~
compilation terminated.
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) {
    // ALDS1_8_A 解答例を参照してください。
     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) {
    // ALDS1_8_A 解答例を参照してください。
    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);
            printf("\n");
        }
            
        }
    return 0;
        
    }


Compiler output:
main.c:3:9: fatal error: string: No such file or directory
    3 | #include<string>
      |         ^~~~~~~~
compilation terminated.
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);
  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);
      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<stdio.h>
#include<stdlib.h>

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

typedef struct node * Node;

Node root, NIL;

Node treeSearch(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)
{
  int H;
  Node x,y,z;

  x = NIL;
  y = root;
  z = malloc(sizeof(struct 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,a;
  char C[20];

  scanf("%d",&n);

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

    if(C[0] == 'f'){
      scanf("%d",&x);

      Node t = treeSearch(root, a);

      if(t != NIL)
        printf("yes");
        printf("\n");
      else
        printf("no");
        printf("\n");
    }

    else if(C[0] == 'i'){
      scanf("%d",&a);
      insert(a);
    }

    else if(C[0] == 'p'){

      inorder(root);

      printf("\n");

      preorder(root);

     
    }

  }

  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:92:19: error: 'x' undeclared (first use in this function)
   92 |       scanf("%d",&x);
      |                   ^
main.c:92:19: note: each undeclared identifier is reported only once for each function it appears in
main.c:99:7: error: expected '}' before 'else'
   99 |       else
      |       ^~~~
main.c:104:5: error: 'else' without a previous 'if'
  104 |     else if(C[0] == 'i'){
      |     ^~~~
main.c: At top level:
main.c:122:3: error: expected identifier or '(' before 'return'
  122 |   return 0;
      |   ^~~~~~
main.c:123:1: error: expected identifier or '(' before '}' token
  123 | }
      | ^
Language: C


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


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

struct node *root,*NIL;


void insert(int k){
struct node *y=NIL;
struct node *x=root;
struct node *z;
z=malloc(sizeof(struct node));
z->key = k;

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

    else y->right=z;
    }
  }



void inorder(struct node *z){
  if(z==NIL)return;
  inorder(z->left);
  printf(" %d",z->key);
  inorder(z->right);
}
void preorder(struct node *z){
if(z==NIL) return;
printf(" %d",z->key);
preorder(z->left);
preorder(z->right);
}

int main(){
  int i,n,x;
  char str[10];
  struct node *t;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",str);
    if(str[0]=='f'){
      scanf("%d",&x);
      *t=search(root,x);
      if(t!=NIL)printf("yes\n");
      else printf("no\n");
      }
    else if(strcmp(str,"insert")==0){
        scanf("%d",&x);
        insert(x);
      }
    else if(strcmp(str,"print")==0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
return 0;
}



Compiler output:
main.c: In function 'main':
main.c:62:10: error: implicit declaration of function 'search'; did you mean 'bsearch'? [-Wimplicit-function-declaration]
   62 |       *t=search(root,x);
      |          ^~~~~~
      |          bsearch
main.c:62:10: error: incompatible types when assigning to type 'struct node' from type 'int'
Language: C

#include <iostream>
#include <vector>
#include <algorithm>
 
using namespace std;
 
struct node {
  int key;
  node *lp,*rp;
 
  node(){}
  node(int z):key(z),lp(NULL),rp(NULL){}
 
} *root;
 
void insert(node* z){
  node *x=root,*y=NULL;
 
  while(x){
    y = x;
    x = (z->key < x->key) ? x->lp : x->rp;
  }
 
  if(!y)root = z;
  else (z->key < y->key ? y->lp : y->rp) = z;
}
 
bool find(node *t, int v){
  if(!t)return false;
  if(t->key == v)return true;
  return find((v < t->key)?t->lp:t->rp,v);
}
 
vector<int> preorder, inorder;
 
int dfs(node *t = root){
  preorder.push_back(t->key);
  if(t->lp)dfs(t->lp);
  inorder.push_back(t->key);
  if(t->rp)dfs(t->rp);
}
 
int main(void) {
 
  root = NULL;
 
  int n,v;
  string s;
  cin >> n;
 
  for(int i=0,m=0;i<n;i++){
    cin >> s;
    if(s=="insert"){
      cin >> v;
      insert(new node(v));
      m++;
    } else if(s=="find"){
      cin >> v;
      cout << (find(root,v)?"yes":"no") << endl;
    } else {
      dfs();
      for(int j=0;j<m;j++)cout << " " << inorder[j];
      cout << endl;
      for(int j=0;j<m;j++)cout << " " << preorder[j];
      cout << endl;
 
      preorder.clear();
      inorder.clear();
    }
  }
 
  return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
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,int);
void insert(int);
void inorder(Node);
void preorder(Node);

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'){
      printf("in delete\n");
      scanf("%d",&x);

    }
  }
  return 0;
}


ode 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);
}

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

Compiler output:
main.c:51:1: error: unknown type name 'ode'; did you mean 'Node'?
   51 | ode treeSearch(Node u, int k){
      | ^~~
      | Node
main.c:51:5: error: conflicting types for 'treeSearch'; have 'int(struct node *, int)'
   51 | ode treeSearch(Node u, int k){
      |     ^~~~~~~~~~
main.c:15:6: note: previous declaration of 'treeSearch' with type 'struct node *(struct node *, int)'
   15 | Node treeSearch(Node,int);
      |      ^~~~~~~~~~
main.c: In function 'treeSearch':
main.c:52:37: error: returning 'Node' {aka 'struct node *'} from a function with return type 'int' makes integer from pointer without a cast [-Wint-conversion]
   52 |   if(u == NIL || k == u->key)return u;
      |                                     ^
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
#define A 20
 
Node root;
 
Node treeMinimum(Node 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){
 
 
}
 
void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
 
 
 
}
 
void insert(int j){
  Node y = NIL;
  Node x = root;
  Node z;
 
  z = malloc(sizeof(struct node));
  z->key = j;
  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;
    }
  }
 
 

 
int main(){
  int m, i, x;
  char com[A];
  scanf("%d", &n);
 
  for ( i = 0; i < m; 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;
}
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);
  }
}
 

Compiler output:
main.c: In function 'main':
main.c:83:16: error: 'n' undeclared (first use in this function)
   83 |   scanf("%d", &n);
      |                ^
main.c:83:16: note: each undeclared identifier is reported only once for each function it appears in
main.c:96:7: error: implicit declaration of function 'inorder' [-Wimplicit-function-declaration]
   96 |       inorder(root);
      |       ^~~~~~~
main.c:98:7: error: implicit declaration of function 'preorder' [-Wimplicit-function-declaration]
   98 |       preorder(root);
      |       ^~~~~~~~
main.c: At top level:
main.c:108:6: warning: conflicting types for 'inorder'; have 'void(struct node *)'
  108 | void inorder(Node u){
      |      ^~~~~~~
main.c:96:7: note: previous implicit declaration of 'inorder' with type 'void(struct node *)'
   96 |       inorder(root);
      |       ^~~~~~~
main.c:117:6: warning: conflicting types for 'preorder'; have 'void(struct node *)'
  117 | void preorder(Node u){
      |      ^~~~~~~~
main.c:98:7: note: previous implicit declaration of 'preorder' with type 'void(struct node *)'
   98 |       preorder(root);
      |       ^~~~~~~~
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){
  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 insert(int k){
  Node y = NIL; // parent of x
  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)
    {
      inorder(u->left);
      printf(" %d", u->key);
      inorder(u->right);
    }
}
 
void preorder(Node u){
  if(u != NIL)
    {
      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");
	}
    }
   
  return 0;
}

Compiler output:
main.c: In function 'treeSuccessor':
main.c:36:14: error: implicit declaration of function 'treeMinimum' [-Wimplicit-function-declaration]
   36 |       return treeMinimum(x->right);
      |              ^~~~~~~~~~~
main.c:36:14: error: returning 'int' from a function with return type 'Node' {aka 'struct node *'} makes pointer from integer without a cast [-Wint-conversion]
   36 |       return treeMinimum(x->right);
      |              ^~~~~~~~~~~~~~~~~~~~~
Language: C

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

#define NIL NULL

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

Node root;

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

int main(){
  int n, i, j, x,find[20000],count=0;
  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 )find[count]=1;
      else find[count]=0;
      count++;
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      for(j = 0;j < count; j++){
	if(find[j] == 1)printf("yes\n");
	else if(find[j] == 0)printf("no\n");
      }
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

Compiler output:
/usr/bin/ld: /tmp/cckoxdya.o: in function `main':
main.c:(.text+0x8d): undefined reference to `treeSearch'
/usr/bin/ld: main.c:(.text+0xf3): undefined reference to `insert'
/usr/bin/ld: main.c:(.text+0x16c): undefined reference to `inorder'
/usr/bin/ld: main.c:(.text+0x185): undefined reference to `preorder'
/usr/bin/ld: main.c:(.text+0x1cb): undefined reference to `treeSearch'
/usr/bin/ld: main.c:(.text+0x1d3): undefined reference to `treeDelete'
collect2: error: ld returned 1 exit status
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 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 find(Node u, int k){
  while( u != NIL && k != u->key ){
    if( k < u->key ) u = u->left;
    else u = u->right;
  }

  return u;
}

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

  Node 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 != x ) z->key = y->key;

  free(y);
}

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 = find(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:
main.c: In function 'main':
main.c:140:18: error: implicit declaration of function 'treeSearch' [-Wimplicit-function-declaration]
  140 |       treeDelete(treeSearch(root, x));
      |                  ^~~~~~~~~~
main.c:140:18: error: passing argument 1 of 'treeDelete' makes pointer from integer without a cast [-Wint-conversion]
  140 |       treeDelete(treeSearch(root, x));
      |                  ^~~~~~~~~~~~~~~~~~~
      |                  |
      |                  int
main.c:49:22: note: expected 'Node' {aka 'struct node *'} but argument is of type 'int'
   49 | void treeDelete(Node z){
      |                 ~~~~~^
Language: C

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

#define M 500000
#define P 10
#define NIL NULL

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

Node root;

void insert(int);
void inorder(Node);
void preorder(Node);
Node find(int,Node);


int main() {

  int m,k,i;
  char s[10];
  Node f;

  scanf("%d",&m);

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

    if(s[0]=='i'){
      scanf("%d",&k);
      insert(k);
    }
    if(s[0]=='f'){
      scanf("%d",&k);
      f=find(k,root);
      if(f==NIL) printf("no\n");
      else printf("yes\n");
    }

    else if(s[0]=='p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}

void insert(int k){
  Node x = root;
  Node y = NIL;
  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 r){
  if(r->left!=NIL) inorder(r->left);
  printf(" %d",r->key);
  if(r->right!=NIL)inorder(r->right);
}


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


Node find(int k,Node r){

  while(k!=r->key && r!=NIL){
    if(k < r-key) r = r->left;
    else r = r->right;
  }

  return r;
  
}

Compiler output:
main.c: In function 'find':
main.c:98:14: error: 'key' undeclared (first use in this function)
   98 |     if(k < r-key) r = r->left;
      |              ^~~
main.c:98:14: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
 
struct Node{
  int key;
 struct Node *r,*l,*p;
};
 
struct Node *root,*NIL;
 
void insert(int);
void inorder(struct Node *);
void preorder(struct Node *);
struct Node* find(struct Node *,int);
 
int main(){
  int n,i,x;
  char s[20];
 
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    scanf("%s",s);
    if(strcmp(s,"find")==0){
      scanf("%d",&x);
      struct Node *t = find(root,x);
      if(t != NIL)printf("yes\n");
      else printf("no\n");
    }
    else if(strcmp(s,"insert")==0){
      scanf("%d",&x);
      insert(x);
    }
    else if(strcmp(s,"print")==0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
 
  return 0;
}
 
void insert(int k){
  struct Node *y = NIL,*x = root,*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->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(struct Node *u){
 
  if(u == NIL)return;
  inorder(u->l);
  printf(" %d",u->key);
  inorder(u->r);
}
 
void preorder(struct Node *u){
 
  if(u == NIL)return;
  printf(" %d",u->key);
  preorder(u->l);
  preorder(u->r);
}
 
struct Node* find(struct Node *u,int k){
 
  while(u != NIL && k != u->key){
    if(k < u->key)u = u->l;
    else u = u->r;
  }
  return u;
}

Compiler output:
main.c: In function 'insert':
main.c:51:4: error: 'struct Node' has no member named 'left'
   51 |   z->left = NIL;
      |    ^~
main.c:52:4: error: 'struct Node' has no member named 'right'
   52 |   z->right = NIL;
      |    ^~
Language: C

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

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

struct Node *root,*NIL;

void insert(int);
void inorder(struct Node*);
void preorder(struct Node*);
struct Node* find(struct Node*,int);
int main(){
  int m,x;
  int i,j=0,c=0;
  char k[10];
  struct Node *a[50000];
  scanf("%d",&m);
  for(i=0; i < m; i++){
    scanf("%s",k);
    if(strcmp(k,"insert")==0){
      scanf("%d",&x);
      insert(x);
    }
   else if(strcmp(k,"find")==0){
      scanf("%d",&x);
      a[j]=find(root,x);
      j++;
      c++;
    }
    else if(strcmp(k,"print")==0){
      for(j=0; j < c; j++){
      if(a[j]!=NIL) printf("yes\n");
      else printf("no\n");
      }
      inorder(root);
      printf("\n");
      preorder(root);
     printf("\n");
    }
  }

  return 0;
}

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

  z=((struct Node *)malloc(sizeof(struct Node)));
  z->key=a;
 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(struct Node *x){
  if(x == NIL) return;
  inorder(x->l);
  printf(" %d",x->key);
  inorder(x->r);
}

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

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

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

Compiler output:
main.c:89:6: error: redefinition of 'preorder'
   89 | void preorder(struct Node *x){
      |      ^~~~~~~~
main.c:82:6: note: previous definition of 'preorder' with type 'void(struct Node *)'
   82 | void preorder(struct Node *x){
      |      ^~~~~~~~
Language: C

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

Compiler output:
main.c: In function 'find':
main.c:88:48: error: 'struct node' has no member named 'left'
   88 |         else if(k < root->key) return find(root->left,k);
      |                                                ^~
main.c:89:30: error: 'struct node' has no member named 'right'
   89 |         else return find(root->right,k);
      |                              ^~
main.c: In function 'main':
main.c:90:1: error: expected declaration or statement at end of input
   90 | }
      | ^
Language: C

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

Compiler output:
main.c: In function 'treeSearch':
main.c:88:54: error: 'struct node' has no member named 'left'
   88 |         else if(k < root->key) return treeSearch(root->left,k);
      |                                                      ^~
main.c:89:36: error: 'struct node' has no member named 'right'
   89 |         else return treeSearch(root->right,k);
      |                                    ^~
main.c: In function 'main':
main.c:90:1: error: expected declaration or statement at end of input
   90 | }
      | ^
Language: C

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

Compiler output:
main.c: In function 'main':
main.c:90:1: error: expected declaration or statement at end of input
   90 | }
      | ^
Language: C

#include<stdio.h>
#include <stdlib.h>
#define NIL NULL
struct Node{
  int key;
  struct Node *p,*l,*r;
};

 struct Node* root;

void insert(int);
void inorder(struct Node*);
void preorder(struct Node*);
struct Node* find(struct Node*,int);
int main(){
  int m,x;
  int i,j=0,c=0;
  char k[10];

  scanf("%d",&m);
  for(i=0; i < m; i++){
    scanf("%s",k);
     if(k[0]=='f'){
      scanf("%d",&x);
      if(find(root,x)!=NIL)
        printf("yes\n");
      else printf("no\n");
     }
     else if(k[0]=='i'){
      scanf("%d",&x);
      insert(x);
     }

     else if(k[0]=='p'){
      if(root !=NIL)
      inorder(root);
      printf("\n");
      if(root!=NIL)
      preorder(root);
      printf("\n");
       }
       }

  return 0;
  }


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

  z=malloc(sizeof(struct Node));
  z->key=a;
  z->l=NIL;
  z->r=NIL;

      if(find(root,x)!=NIL)
        printf("yes\n");
      else printf("no\n");
     }
     else if(k[0]=='i'){
      scanf("%d",&x);
      insert(x);
     }

     else if(k[0]=='p'){
      if(root !=NIL)
      inorder(root);
      printf("\n");
      if(root!=NIL)
    preorder(root);
      printf("\n");
       }
       }

  return 0;
  }


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

  z=malloc(sizeof(struct Node));
  z->key=a;
  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(struct Node *x){
  if(x == NIL) return;
  inorder(x->l);
  printf(" %d",x->key);
 inorder(x->r);
}

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

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

Compiler output:
main.c: In function 'insert':
main.c:58:20: error: passing argument 2 of 'find' makes integer from pointer without a cast [-Wint-conversion]
   58 |       if(find(root,x)!=NIL)
      |                    ^
      |                    |
      |                    struct Node *
main.c:14:32: note: expected 'int' but argument is of type 'struct Node *'
   14 | struct Node* find(struct Node*,int);
      |                                ^~~
main.c: At top level:
main.c:62:6: error: expected identifier or '(' before 'else'
   62 |      else if(k[0]=='i'){
      |      ^~~~
main.c:67:6: error: expected identifier or '(' before 'else'
   67 |      else if(k[0]=='p'){
      |      ^~~~
main.c:75:8: error: expected identifier or '(' before '}' token
   75 |        }
      |        ^
main.c:77:3: error: expected identifier or '(' before 'return'
   77 |   return 0;
      |   ^~~~~~
main.c:78:3: error: expected identifier or '(' before '}' token
   78 |   }
      |   ^
main.c:81:6: error: redefinition of 'insert'
   81 | void insert(int a){
      |      ^~~~~~
main.c:48:6: note: previous definition of 'insert' with type 'void(int)'
   48 | void insert(int a){
      |      ^~~~~~
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){
    if(u->key==x||u==NIL)
        return u;
    if(k<u->left)
        return treeSearch(u->left,k);
    else return treeSearch(u->right);
    
}




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:
main.c: In function 'treeSearch':
main.c:16:16: error: 'x' undeclared (first use in this function)
   16 |     if(u->key==x||u==NIL)
      |                ^
main.c:16:16: note: each undeclared identifier is reported only once for each function it appears in
main.c:18:9: warning: comparison between pointer and integer
   18 |     if(k<u->left)
      |         ^
main.c:20:17: error: too few arguments to function 'treeSearch'
   20 |     else return treeSearch(u->right);
      |                 ^~~~~~~~~~
main.c:15:6: note: declared here
   15 | Node treeSearch(Node u, int k){
      |      ^~~~~~~~~~