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

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

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 *x = root,*y = NIL, *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);
  preoder(u->l);
  preoder(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:5:17: error: 'atd' is not a namespace-name
    5 | using namespace atd;
      |                 ^~~
a.cc: In function 'void preorder(Node*)':
a.cc:65:3: error: 'preoder' was not declared in this scope; did you mean 'preorder'?
   65 |   preoder(u->l);
      |   ^~~~~~~
      |   preorder
a.cc: In function 'int main()':
a.cc:71:3: error: 'string' was not declared in this scope
   71 |   string com;
      |   ^~~~~~
a.cc:71:3: note: suggested alternatives:
In file included from /usr/include/c++/14/string:41,
                 from a.cc:3:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:76:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   76 |     cin >> com;
      |     ^~~
      |     std::cin
In file included from a.cc:4:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:76:12: error: 'com' was not declared in this scope
   76 |     cin >> com;
      |            ^~~
Language: C++

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

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 *x = root,*y = NIL, *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:5:17: error: 'atd' is not a namespace-name
    5 | using namespace atd;
      |                 ^~~
a.cc: In function 'int main()':
a.cc:71:3: error: 'string' was not declared in this scope
   71 |   string com;
      |   ^~~~~~
a.cc:71:3: note: suggested alternatives:
In file included from /usr/include/c++/14/string:41,
                 from a.cc:3:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:76:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   76 |     cin >> com;
      |     ^~~
      |     std::cin
In file included from a.cc:4:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:76:12: error: 'com' was not declared in this scope
   76 |     cin >> com;
      |            ^~~
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;
            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: In function 'Node* find(Node*, int)':
a.cc:16:19: error: 'K' was not declared in this scope
   16 |     while(u!=NIL&&K!=u->key){
      |                   ^
a.cc: In function 'void insert(int)':
a.cc:61:22: error: a function-definition is not allowed here before '{' token
   61 | void inorder(Node *u){
      |                      ^
a.cc:67:24: error: a function-definition is not allowed here before '{' token
   67 |  void preorder(Node *u){
      |                        ^
a.cc:74:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   74 | int main(){
      |         ^~
a.cc:74:9: note: remove parentheses to default-initialize a variable
   74 | int main(){
      |         ^~
      |         --
a.cc:74:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:74:11: error: a function-definition is not allowed here before '{' token
   74 | int main(){
      |           ^
a.cc:104:2: error: expected '}' at end of input
  104 | }
      |  ^
a.cc:25:19: note: to match this '{'
   25 | void insert(int k){
      |                   ^
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;
            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: In function 'void insert(int)':
a.cc:61:22: error: a function-definition is not allowed here before '{' token
   61 | void inorder(Node *u){
      |                      ^
a.cc:67:24: error: a function-definition is not allowed here before '{' token
   67 |  void preorder(Node *u){
      |                        ^
a.cc:74:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   74 | int main(){
      |         ^~
a.cc:74:9: note: remove parentheses to default-initialize a variable
   74 | int main(){
      |         ^~
      |         --
a.cc:74:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:74:11: error: a function-definition is not allowed here before '{' token
   74 | int main(){
      |           ^
a.cc:102:2: error: expected '}' at end of input
  102 | }
      |  ^
a.cc:25:19: note: to match this '{'
   25 | void insert(int k){
      |                   ^
Language: C++

n = gets.chomp.to_i
Node = Struct.new(:num, :parent, :left, :right)

class BinSearchTree
  attr_accessor :root
  def initialize
    @root = nil
  end

  def inorder(r, order)
    if r.nil?.!
      inorder(r.left, order)
      order << r.num
      inorder(r.right, order)
    end
  end
  
  def preorder(r, order)
    if r.nil?.!
      order << r.num
      preorder(r.left, order)
      preorder(r.right, order)
    end
  end
  
  def find(k)
    x = @root
    y = nil
    flag = false
    until x.nil?
       y = x
      if k == x.num
        flag = true
        break
      elsif k < x.num
        x = x.left
      elsif x.num < k
        x = x.right      
      end
    end
    ans = flag ? "yes" : "no"
    puts ans
  end

  def insert(k)
    x = @root
    y = nil
    z = Node.new
    z.num = k
    until x.nil?
      y = x
      if z.num < x.num
        x = x.left
      else
        x = x.right
      end
    end
    z.parent = y
    if y.nil?
      @root = z
    else
      if z.num < y.num
        y.left = z
      else
        y.right = z
      end
    end
  end
end

bst = BinSearchTree.new

n.times do
  cmd, i = gets.chomp.split.map{|t| t.match?(/\d/) ? t.to_i : t}
  case cmd
  when "insert"
    bst.insert(i)
  when "print"
    root = bst.root
    in_res, pre_res = [], []
    bst.inorder(root, in_res)
    puts " " + in_res.map(&:to_s).join(' ')
    bst.preorder(root, pre_res)
    puts " " + pre_res.map(&:to_s).join(' ')
  when "find"
    bst.find(i)
  end
end


Compiler output:
a.cc:7:5: error: stray '@' in program
    7 |     @root = nil
      |     ^
a.cc:27:9: error: stray '@' in program
   27 |     x = @root
      |         ^
a.cc:46:9: error: stray '@' in program
   46 |     x = @root
      |         ^
a.cc:60:7: error: stray '@' in program
   60 |       @root = z
      |       ^
a.cc:74:47: error: stray '\' in program
   74 |   cmd, i = gets.chomp.split.map{|t| t.match?(/\d/) ? t.to_i : t}
      |                                               ^
a.cc:1:1: error: 'n' does not name a type
    1 | n = gets.chomp.to_i
      | ^
a.cc:75:3: error: expected unqualified-id before 'case'
   75 |   case cmd
      |   ^~~~
Language: C++

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

#define MAX 500000

struct node {
	int key;
	int parent, left, right;
} T[MAX];
int root;

void PrePrint(int t) {
	if (t == -1) return;
	printf(" %d", T[t].key);
	PrePrint(T[t].left);
	PrePrint(T[t].right);
}

void InPrint(int t) {
	if (t == -1) return;
	InPrint(T[t].left);
	printf(" %d", T[t].key);
	InPrint(T[t].right);
}

void initNode(int n) {
	root = -1;
	for (int i = 0; i < n; i++) {
		T[i].key = -1;
		T[i].parent = -1;
		T[i].left = -1;
		T[i].right = -1;
	}
}

void insert(int z) {
	int y = -1; // xの親
	int x = root;
	while (x != -1) {
		y = x;
		if (T[z].key < T[x].key) x = T[x].left;
		else x = T[x].right;
	}
	T[z].parent = y;

	if (y == -1) root = z;
	else if (T[z].key < T[y].key) T[y].left = z;
	else T[y].right = z;
}

bool find(int k) {
	int x = root;
	while (x != -1) {
		if (T[x].key == k) return true;
		if (T[x].key > k) x = T[x].right;
		else x = T[x].left;
	}
	return false;
}

int main() {
	int n = 0;
	scanf_s("%d", &n);
	initNode(n);
	for (int i = 0; i < n; i++) {
		std::string com;
		std::cin >> com;
		if (com[0] == 'i') {
			int k = 0;
			scanf_s("%d", &k);
			T[i].key = k;
			insert(i);
		}
		else if (com[0] == 'p') {
			InPrint(root);
			printf("\n");
			PrePrint(root);
			printf("\n");
		}
		else if (com[0] == 'f') {
			int k = 0;
			scanf_s("%d", &k);
			if (find(k)) {
				printf("yes\n");
			}
			else {
				printf("no\n");
			}
		}
	}
}



Compiler output:
a.cc: In function 'int main()':
a.cc:64:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   64 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C++

#include<stdio>
#include<iostream>
#include<string>

#define MAX 500000

struct node {
	int key;
	int parent, left, right;
} T[MAX];
int root;

void PrePrint(int t) {
	if (t == -1) return;
	printf(" %d", T[t].key);
	PrePrint(T[t].left);
	PrePrint(T[t].right);
}

void InPrint(int t) {
	if (t == -1) return;
	InPrint(T[t].left);
	printf(" %d", T[t].key);
	InPrint(T[t].right);
}

void initNode(int n) {
	root = -1;
	for (int i = 0; i < n; i++) {
		T[i].key = -1;
		T[i].parent = -1;
		T[i].left = -1;
		T[i].right = -1;
	}
}

void insert(int z) {
	int y = -1; // xの親
	int x = root;
	while (x != -1) {
		y = x;
		if (T[z].key < T[x].key) x = T[x].left;
		else x = T[x].right;
	}
	T[z].parent = y;

	if (y == -1) root = z;
	else if (T[z].key < T[y].key) T[y].left = z;
	else T[y].right = z;
}

bool find(int k) {
	int x = root;
	while (x != -1) {
		if (T[x].key == k) return true;
		if (T[x].key > k) x = T[x].right;
		else x = T[x].left;
	}
	return false;
}

int main() {
	int n = 0;
	scanf_s("%d", &n);
	initNode(n);
	for (int i = 0; i < n; i++) {
		std::string com;
		std::cin >> com;
		if (com[0] == 'i') {
			int k = 0;
			scanf_s("%d", &k);
			T[i].key = k;
			insert(i);
		}
		else if (com[0] == 'p') {
			InPrint(root);
			printf("\n");
			PrePrint(root);
			printf("\n");
		}
		else if (com[0] == 'f') {
			int k = 0;
			scanf_s("%d", &k);
			if (find(k)) {
				printf("yes\n");
			}
			else {
				printf("no\n");
			}
		}
	}
}



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

#include<iostream>
#include<string>
#define NIL -1

using namespace std;

int x=NIL, root_id=NIL;
struct Node{int parent=-1, left=-1, right=-1;};

Node T[500009];

void inorder(int id){
    if(id==-1)return;
    inorder(T[id].left);
    cout <<" "<< id ;
    inorder(T[id].right);
}

void preorder(int id){
    if(id==-1)return;
    cout << " " << id;
    preorder(T[id].left);
    preorder(T[id].right);
}

void print(int root_id){
    inorder(root_id);
    cout << endl;
    preorder(root_id);
    cout << endl;
}

void insert(int z){
    int y=NIL;
    x=root_id;
    while(x!=NIL){
        y=x;
        if(z < x)x=T[x].left;
        else x=T[x].right;
    }
    T[z].parent=y;

    if(y==NIL)root_id=z;
    else if(z<y)T[y].left=z;
    else T[y].right=z;
}

void find(int id){
    x=root_id;
    while(1){
        if(x==id){
            cout << "yes" << endl;
            break;
        }
        if(x==NIL){
            cout << "no" << endl;
        }
        else if (id>x){
            x = T[x].right;
        }
        else if (id<x){
            x = T[x].left;
        }
    }
}


int main(){
    int n, ins_num;
    string ope;
    cin >> n;
    for(int i=0;i<=n-1;i++){
        cin >> ope;
        if(ope=="print")print(root_id);
        else if(ope=="insert"){
            cin >> ins_num;
            insert(ins_num);
        else if(ope=="find"){
            cin >> ins_num;
            find(ins_num);
        }
        } 
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:78:9: error: expected '}' before 'else'
   78 |         else if(ope=="find"){
      |         ^~~~
a.cc:75:31: note: to match this '{'
   75 |         else if(ope=="insert"){
      |                               ^
a.cc: At global scope:
a.cc:84:1: error: expected declaration before '}' token
   84 | }
      | ^
Language: C++

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

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

Node *NIL, *root;

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

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

    z = new 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;
        }
    }
}

Node *find(int k) {
    Node *x = root;
    while (x!=NIL) {
        if (x->key == k) return x;
        if (x->key > k) {
            x = x->left;
        } else {
            x = x->right;
        }
    }
    return NIL;
}

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

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

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:82:23: error: no match for 'operator=' (operand types are 'Node' and 'Node*')
   82 |             t = find(x)
      |                       ^
a.cc:7:16: note: candidate: 'constexpr Node& Node::operator=(const Node&)'
    7 | typedef struct Node {
      |                ^~~~
a.cc:7:16: note:   no known conversion for argument 1 from 'Node*' to 'const Node&'
a.cc:7:16: note: candidate: 'constexpr Node& Node::operator=(Node&&)'
a.cc:7:16: note:   no known conversion for argument 1 from 'Node*' to 'Node&&'
a.cc:84:13: error: expected '}' before 'else'
   84 |             else printf("no\n");
      |             ^~~~
a.cc:80:33: note: to match this '{'
   80 |         } else if (com=="find") {
      |                                 ^
a.cc:85:11: error: 'else' without a previous 'if'
   85 |         } else if (com=="print") {
      |           ^~~~
a.cc: At global scope:
a.cc:93:5: error: expected unqualified-id before 'return'
   93 |     return 0;
      |     ^~~~~~
a.cc:94:1: error: expected declaration before '}' token
   94 | }
      | ^
Language: C++

#include<iostream>
#include<string>
#include<stdlib.h>
using namespace  std;
struct NodeB
{
	int key;
	NodeB *left;
	NodeB *right;
};
NodeA *head = NULL;
void insert(int key)
{
	NodeB *next = head;
	NodeB *prev = NULL;
	bool isLeft = true;
	while (next != NULL)
	{
		prev = next;
		if ((*next).key >= key)
		{
			next = (*next).left;
			isLeft = true;
		}
		else if ((*next).key <= key)
		{
			next = (*next).right;
			isLeft = false;
		}
	}
	if (prev == NULL)
	{
		head = (NodeB *)malloc(sizeof(NodeB));
		(*head).key = key;
		(*head).left = NULL;
		(*head).right = NULL;
		return;
	}
	if (isLeft)
	{
		(*prev).left = (NodeB *)malloc(sizeof(NodeB));
		(*(*prev).left).key = key;
		(*(*prev).left).left = NULL;
		(*(*prev).left).right = NULL;
	}
	else
	{
		(*prev).right = (NodeB *)malloc(sizeof(NodeB));
		(*(*prev).right).key = key;
		(*(*prev).right).left = NULL;
		(*(*prev).right).right = NULL;
	}
	
}
void inOrder(NodeB *h)
{
	if (h == NULL)return;
	inOrder((*h).left);
	cout << " " << (*h).key;
	inOrder((*h).right);
}
void preOrder(NodeB *h)
{
	if (h == NULL)return;
	cout << " " << (*h).key;
	preOrder((*h).left);
	preOrder((*h).right);
}
void print()
{
	inOrder(head);
	cout << endl;
	preOrder(head);
	cout << endl;
}
bool find(int key)
{
	NodeB *next = head;
	while (next != NULL)
	{
		if ((*next).key == key)
		{
			return true;
		}
		else if ((*next).key < key)
		{
			next = (*next).right;
		}
		else if ((*next).key > key)
		{
			next = (*next).left;
		}
	}
	return false;
}
int main()
{
	int m;
	cin >> m;
	for (int i = 0; i < m; i++)
	{
		string inst;
		cin >> inst;
		if (inst.compare("insert") == 0)
		{
			int key;
			cin >> key;
			insert(key);
		}
		else if (inst.compare("print") == 0)
		{
			print();
		}
		else if (inst.compare("find") == 0)
		{
			int key;
			cin >> key;
			if (find(key))
			{
				cout << "yes" << endl;
			}
			else
			{
				cout << "no" << endl;
			}
		}
	}
	return 0;
}

Compiler output:
a.cc:11:1: error: 'NodeA' does not name a type; did you mean 'NodeB'?
   11 | NodeA *head = NULL;
      | ^~~~~
      | NodeB
a.cc: In function 'void insert(int)':
a.cc:14:23: error: 'head' was not declared in this scope
   14 |         NodeB *next = head;
      |                       ^~~~
a.cc: In function 'void print()':
a.cc:71:17: error: 'head' was not declared in this scope
   71 |         inOrder(head);
      |                 ^~~~
a.cc: In function 'bool find(int)':
a.cc:78:23: error: 'head' was not declared in this scope
   78 |         NodeB *next = head;
      |                       ^~~~
Language: C++

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>

using namespace std;

const long NIL = -1;
struct Node {
    long left ;
    long right ;
};

Node T[500000];
long root = NIL;


void PRINTInOrder(long i) {
    if (i == NIL) {
        return;
    }
    PRINTInOrder(T[i].left);
    PRINTf(" %d", i);
    PRINTInOrder(T[i].right);
}

void PRINTPreOrder(long i) {
    if (i == NIL) {
        return;
    }
    PRINTf(" %d", i);
    PRINTPreOrder(T[i].left);
    PRINTPreOrder(T[i].right);
}

bool find(long i){
    if(T[i].right == 0 && T[i].left == 0) return false;
    else return true;
}

void insert(long i) {
    //??°???????????\???????????????????????????NIL
    T[i].left = T[i].right = NIL;
    //??????????????£???
    if (root == NIL) {
        root = i;
        return;
    }
    //x??§dig??????
    long y;
    long x = root;
    while (x != NIL) {
        y = x;
        if (i < x) {
            x = T[x].left;
        }
        else {
            x = T[x].right;
        }
    }
    if (i < y) {
        T[y].left = i;
    }
    else {
        T[y].right = i;
    }
}

int main() {
    long n;
    cin >> n;

    string com;
    long key;
    for (long i = 0; i < n; i++) {
        cin >> com;
        if (com == "insert") {
            cin >> key;
            insert(key);
        }else if(com == "find"){
            cin >> key;
            if(find(key)) cout << "yes" << endl;
            else cout << "no" << endl;
        }
        else {
            PRINTInOrder(root);
            PRINTf("\n");
            PRINTPreOrder(root);
            PRINTf("\n");
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'void PRINTInOrder(long int)':
a.cc:23:5: error: 'PRINTf' was not declared in this scope
   23 |     PRINTf(" %d", i);
      |     ^~~~~~
a.cc: In function 'void PRINTPreOrder(long int)':
a.cc:31:5: error: 'PRINTf' was not declared in this scope
   31 |     PRINTf(" %d", i);
      |     ^~~~~~
a.cc: In function 'int main()':
a.cc:87:13: error: 'PRINTf' was not declared in this scope
   87 |             PRINTf("\n");
      |             ^~~~~~
Language: C++

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

struct Vertex{
	int key;
	int parent;
	int left;
	int right;
};

vector<Vertex> V;
int root=-1;

void Preorder(int r){
	cout <<" "<< V[r].key;
	if(V[r].left!=-1) Preorder(V[r].left);
	if(V[r].right!=-1) Preorder(V[r].right);
	return;
}

void Inorder(int r){
	if(V[r].left!=-1) Inorder(V[r].left);
	cout <<" "<< V[r].key;
	if(V[r].right!=-1) Inorder(V[r].right);
	return;
}

void Postorder(int r){
	if(V[r].left!=-1) Postorder(V[r].left);
	if(V[r].right!=-1) Postorder(V[r].right);
	cout <<" "<< V[r].key;
	return;
}

void insert(int k){
	Vertex z;
	z.key=k;
	z.left=-1;
	z.right=-1;
	
	int y=-1;
	int x=root;
	while(x!=-1){
		y=x;
		if (z.key<V[x].key){
			x=V[x].left;
		}else{
			x=V[x].right;
		}
	}
	z.parent=y;
	V.push_back(z);
	
	if(y==-1){
		root = 0;
	}else if(z.key < V[y].key){
		V[y].left=V.size()-1;
	}else{
		V[y].right=V.size()-1;
	}
}

void printVertex(int i){
	cout << V[i].key <<" " <<V[i].parent <<" " << V[i].left << " " << V[i].right <<endl;
}

void print(){
	Inorder(root);
	cout <<endl;
	Preorder(root);
	cout <<endl;
}

bool find(int k){
	int v=root;
	while(1){
		cout << v <<endl; 
		if(k == V[v].key){
			return true;
		}else if(k < V[v].key){
			if(V[v].left==-1){
				return false;
			}else{
				v=V[v].left;
			}
		}else{
			if(V[v].right==-1){
				return false;
			}else{
				v=V[v].right;
			}
		}
	}
}

void delete(int k){
	
}

int main(){
	int n,k;
	string s;
	cin >> n;
	for (int i=0;i<n;i++){
		cin >> s;
		if(s=="insert"){
			cin >> k;
			insert(k);
		}else if(s=="find"){
			cin >> k;
			if(find(k)){
				cout <<"yes"<<endl;
			}else{
				cout << "no" <<endl;
			}
		}else if(s=="delete"){
			cin >> k;
			delete(k);
		}else{
			print();
		}
	}
	/*
	for(int i=0;i<n;i++){
		printVertex(i);
		cout <<endl;
	}
	*/
	return 0;
}

Compiler output:
a.cc:97:6: error: expected unqualified-id before 'delete'
   97 | void delete(int k){
      |      ^~~~~~
a.cc: In function 'int main()':
a.cc:119:32: error: type 'int' argument given to 'delete', expected pointer
  119 |                         delete(k);
      |                               ~^~
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); 

}



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

}


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

    
   
  }

  return 0;
}

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

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

using namespace std;

typedef struct BiTNode{
public:
  int key;
  struct BiTNode *parent;
  struct BiTNode *left;
  struct BiTNode *right;

  BiTNode(int key){
    this->key = key;
    this->parent = NULL;
    this->left = NULL;
    this->right = NULL;
  }
} BiTNode;

typedef struct BiT{
public:
  struct BiTNode *root;
  BiT(){
    this->root = NULL;
  }
}BiT;

void insert(BiT *T,int key){

  BiTNode *y;
  BiTNode *x;
  BiTNode *z;

  y = NULL;
  x = T->root;
  z = new BiTNode(key);

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

  z->parent = y;

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

BiTNode* find(BiTNode *node,int key){

  if(node == NULL || k == node->key){
    return node;
  }
  if(k < node->key){
    return find(node->left,k);
  }
  return find(node->right,k);
}

void inorderTreeWalk(BiTNode *node){

  if(node != NULL){
    inorderTreeWalk(node->left);
    cout << " " << node->key;
    inorderTreeWalk(node->right);
  }
}

void preorderTreeWalk(BiTNode *node){

  if(node != NULL){
    cout << " " << node->key;
    preorderTreeWalk(node->left);
    preorderTreeWalk(node->right);
  }
}

void print(BiT T){

  inorderTreeWalk(T.root);
  cout << endl;
  preorderTreeWalk(T.root);
  cout << endl;
}

int main(){

  int i;
  int n;
  int k;
  BiT T;
  char order[10];
  char dummy;

  cin >> n;

  for(i = 0;i < n;i++){
    cin >> order;
    if(strcmp(order,"insert") == 0){
      cin >> k;
      insert(&T,k);
    }
    else if(strcmp(order,"find") == 0){
      cin >> k;
      if(find(T.root,k) != NULL){
	cout << "yes" << endl;
      }
      else {
	cout << "no" << endl;
      }
    }
    else if(strcmp(order,"print") == 0){
      print(T);
    }
  }

  return 0;
}

Compiler output:
a.cc: In function 'BiTNode* find(BiTNode*, int)':
a.cc:68:22: error: 'k' was not declared in this scope
   68 |   if(node == NULL || k == node->key){
      |                      ^
a.cc:71:6: error: 'k' was not declared in this scope
   71 |   if(k < node->key){
      |      ^
a.cc:74:27: error: 'k' was not declared in this scope
   74 |   return find(node->right,k);
      |                           ^
Language: C++

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

using namespace std;

typedef struct BiTNode{
public:
  int key;
  struct BiTNode *parent;
  struct BiTNode *left;
  struct BiTNode *right;

  BiTNode(int key){
    this->key = key;
    this->parent = NULL;
    this->left = NULL;
    this->right = NULL;
  }
} BiTNode;

typedef struct BiT{
public:
  struct BiTNode *root;
  BiT(){
    this->root = NULL;
  }
}BiT;

void insert(BiT *T,int key){

  BiTNode *y;
  BiTNode *x;
  BiTNode *z;

  y = NULL;
  x = T->root;
  z = new BiTNode(key);

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

  z->parent = y;

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

BiTNode* find(BiTNode *node,int key){

  if(node == NULL || k == node->key){
    return node;
  }
  if(k < node->key){
    return find(node->left,key);
  }
  return find(node->right,key);
}

void inorderTreeWalk(BiTNode *node){

  if(node != NULL){
    inorderTreeWalk(node->left);
    cout << " " << node->key;
    inorderTreeWalk(node->right);
  }
}

void preorderTreeWalk(BiTNode *node){

  if(node != NULL){
    cout << " " << node->key;
    preorderTreeWalk(node->left);
    preorderTreeWalk(node->right);
  }
}

void print(BiT T){

  inorderTreeWalk(T.root);
  cout << endl;
  preorderTreeWalk(T.root);
  cout << endl;
}

int main(){

  int i;
  int n;
  int k;
  BiT T;
  char order[10];
  char dummy;

  cin >> n;

  for(i = 0;i < n;i++){
    cin >> order;
    if(strcmp(order,"insert") == 0){
      cin >> k;
      insert(&T,k);
    }
    else if(strcmp(order,"find") == 0){
      cin >> k;
      if(find(T.root,k) != NULL){
	cout << "yes" << endl;
      }
      else {
	cout << "no" << endl;
      }
    }
    else if(strcmp(order,"print") == 0){
      print(T);
    }
  }

  return 0;
}

Compiler output:
a.cc: In function 'BiTNode* find(BiTNode*, int)':
a.cc:68:22: error: 'k' was not declared in this scope
   68 |   if(node == NULL || k == node->key){
      |                      ^
a.cc:71:6: error: 'k' was not declared in this scope
   71 |   if(k < node->key){
      |      ^
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){
  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 = 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:75:13: error: invalid conversion from 'void*' to 'Node' {aka 'node*'} [-fpermissive]
   75 |   z = malloc(sizeof(struct node));
      |       ~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |             |
      |             void*
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:
a.cc: In function 'void insert(int)':
a.cc:49:13: error: invalid conversion from 'void*' to 'Node*' [-fpermissive]
   49 |   z = malloc(sizeof(struct Node));
      |       ~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |             |
      |             void*
a.cc:51:6: error: 'struct Node' has no member named 'left'
   51 |   z->left = NIL;
      |      ^~~~
a.cc:52:6: error: 'struct Node' has no member named 'right'
   52 |   z->right = NIL;
      |      ^~~~~
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 500000

typedef struct _n{
  int number;
  struct _n *parent;
  struct _n *successor;
  struct _n *left;
  struct _n *right;

}Node;

int count;

Node root;

void insert(int);
void output(Node *);
void out(Node *);
int cmp(Node *, int);

int main(){

  int i;
  int n, number;
  char order[7];

  scanf("%d", &n);

  for(i = 0; i < n; i++){
    scanf("%s", order);
    if(strcmp(order, "insert") == 0){
      scanf("%d", &number);
      insert(number);
    }

    else if(strcmp(order, "print") == 0){
      output(&root);
      printf("\n");
      out(&root);
      printf("\n");

    }

    else if(strcmp(order, "find") == 0){
      count = 0;
      cmp(&root, number);
      if(count == 1) printf("yes\n");
	else printf("no\n");
    }

  }

  return 0;
}

void insert(int number){
  
  int i;
  Node *p, *q;
  Node *set;  

  if(root.number == 0){
    root.number = number;
    root.left = NULL;
    root.right = NULL;
  }
  else{
    set = (Node *)malloc(sizeof(Node));
    set->number = number;
    set->left = NULL;
    set->right = NULL;
    
    q = NULL;
    p = &root;
    
    while(p != NULL){
      q = p;
      
      if(set->number < p->number) p = p->left;
      else p = p->right;
      
    }
    
    set->parent = q;

    if(set->number < q->number) q->left = set;
    else q->right = set;

  }


}


void output(Node *a){

  if(a == NULL) return;

  output(a->left);
  printf(" %d", a->number);
  output(a->right);
  
}

void out(Node *a){
  if(a == NULL) return;
  printf(" %d", a->number);
  out(a->left);
  out(a->right);

}

int cmp(Node *a, int num){
  if(a == NULL) return;
  if(a->number == num) count = 1;
     cmp(a->left, num);
     cmp(a->right, num);

}

Compiler output:
a.cc: In function 'int cmp(Node*, int)':
a.cc:117:17: error: return-statement with no value, in function returning 'int' [-fpermissive]
  117 |   if(a == NULL) return;
      |                 ^~~~~~
a.cc:120:9: warning: control reaches end of non-void function [-Wreturn-type]
  120 |      cmp(a->right, num);
      |      ~~~^~~~~~~~~~~~~~~
Language: C++

//#define scanf_s scanf
#include <string>
#include <stdio.h>
#include <math.h>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <iostream>
using namespace std;

#define MAX 500000
#define MAX_  2000000000
struct tree
{
	long long int key = MAX_ + 1;
	tree *left = NULL, *right = NULL, *p = NULL;
};
void insert(tree &T,tree &z)
{
	tree *y = NULL , *x = &T;
	while (x->key != MAX_ + 1) {
		y = x;
		if (z.key < x->key) { x = x->left; }
		else { x = x->right; }
		if (x == NULL) break;
	}
	z.p = y;
	if (y == NULL) { 
		T = z; 
	}
	else if (z.key < y->key) { 
		y->left = &z; 
	}
	else { 
		y->right = &z; 
	}
}
void print_1(tree *T) {
	if (T != NULL) {
		printf(" %lld", T->key);
		print_1(T->left);
		print_1(T->right);
	}
}
void print_2(tree *T) {
	if (T != NULL) {
		print_2(T->left);
		printf(" %lld", T->key);
		print_2(T->right);
	}
}
int find_(tree *T,long long int n){
	if (T == NULL) { return 0; }
	if (T->key == n) { return 1; }

	if (T->key < n) {
		return (find_(T->right, n));
	}
	else {
		return (find_(T->left, n));
	}
}
int main() {
	int m, cou = 0;
	long long int k;
	string s;
	tree t, id[MAX];
	scanf_s("%d", &m);
	for (int i = 0; i < m; ++i) {
		cin >> s;
		if (s == "insert") {
			scanf_s("%lld", &id[cou].key);
			insert(t, id[cou]);
			++cou;
		}
		else if(s == "print"){
			print_2(&t);
			printf("\n");
			print_1(&t);
			printf("\n");
		}
		else {
			scanf_s("%lld", &k);
			if (find_(&t, k)) printf("yes\n");
			else printf("no\n");
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   69 |         scanf_s("%d", &m);
      |         ^~~~~~~
      |         scanf
Language: C++

#include <iostream>
using namespace  std;

struct StNode
{
  StNode* m_poParnt;
  StNode* m_poLeft;
  StNode* m_poRigt;
  int m_nKey;

  StNode(int nNo) :
    m_poParnt(nullptr), m_poLeft(nullptr), m_poRigt(nullptr), m_nKey(nNo)
  { }
};

void fnPreOrder(StNode* poNode)
{
  if (poNode == nullptr)  return;

  cout << " " << poNode->m_nKey;
  fnPreOrder(poNode->m_poLeft);
  fnPreOrder(poNode->m_poRigt);
}

void fnInOrder(StNode* poNode)
{
  if (poNode == nullptr)  return;

  fnInOrder(poNode->m_poLeft);
  cout << " " << poNode->m_nKey;
  fnInOrder(poNode->m_poRigt);
}

int fnFind(StNode* poRoot, int nNo)
{
  StNode* poNode = poRoot;
  while (poNode != nullptr)
    if (nNo == poNode->m_nKey)
      return 1;
    else if (nNo < poNode->m_nKey)
      poNode = poNode->m_poLeft;
    else
      poNode = poNode->m_poRigt;

  return 0;
}

void fnInsert(StNode*& rpoRoot, StNode* poNewNod)
{
  StNode* poParnt = nullptr;
  StNode* poNode = rpoRoot;

  while (poNode != nullptr)
  {
    poParnt = poNode;
    if (poNewNod->m_nKey < poNode->m_nKey)
      poNode = poNode->m_poLeft;
    else
      poNode = poNode->m_poRigt;
  }

  poNewNod->m_poParnt = poParnt;
  if (poParnt == nullptr)
    rpoRoot = poNewNod;
  else if (poNewNod->m_nKey < poParnt->m_nKey)
    poParnt->m_poLeft = poNewNod;
  else
    poParnt->m_poRigt = poNewNod;
}

void fnBinSchTree(StNode*& rpoRoot)
{
  int nMaxSiz;
  cin >> nMaxSiz;

  for (int i = 0; i < nMaxSiz; ++i)
  {
    string sCmd;
    cin >> sCmd;
    if (sCmd[0] == 'i')
    {
      int nNo;
      cin >> nNo;
      StNode* poNewNod = new StNode(nNo);
      fnInsert(rpoRoot, poNewNod);
    }
    if (sCmd[0] == 'f')
    {
      int nNo;
      cin >> nNo;
      if (fnFind(StNode* rpoRoot, nNo))
        cout << "yes" << endl;
      else
        cout << "no" << endl;
    }
    if (sCmd[0] == 'p')
    {
      fnInOrder(rpoRoot);
      cout << endl;
      fnPreOrder(rpoRoot);
      cout << endl;
    }
  }
}

void fnPstOrder(StNode* poNode)
{
  if (poNode == nullptr)  return;

  fnPstOrder(poNode->m_poLeft);
  fnPstOrder(poNode->m_poRigt);
  delete poNode;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  StNode* poRoot = nullptr;

  fnBinSchTree(poRoot);
  fnPstOrder(poRoot);
  return 0;
}

Compiler output:
a.cc: In function 'void fnBinSchTree(StNode*&)':
a.cc:91:24: error: expected primary-expression before '*' token
   91 |       if (fnFind(StNode* rpoRoot, nNo))
      |                        ^
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] == key)
				{
					cout << "yes" << endl;
					return;
				}
			}
			cout << "no" << endl;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:127:50: error: 'key' was not declared in this scope; did you mean 'key_t'?
  127 |                                 if(tree[j][0] == key)
      |                                                  ^~~
      |                                                  key_t
a.cc:130:41: error: return-statement with no value, in function returning 'int' [-fpermissive]
  130 |                                         return;
      |                                         ^~~~~~