Language: C

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define ORDER 500000
  
struct NODE{
  int key,nil;
  struct NODE *left,*right,*parent;
};
  
typedef struct NODE Node;
  
Node *head;
    
void insert(Node *z){
  Node *y,*x;
  
 z->left = NULL;
  z->right = NULL;
  y = NULL;
  x = head;
  
  while(x != NULL){
    y = x;
    if(z->key < x->key)  x = x->left;
    else x = x->right;
  }
  z->parent = y;
  
  if(y == NULL) head = z;
  else if(z->key < y->key) y->left = z;
  else y->right = z;
}
  
  
  
void print1(Node *node){
  if(node == NULL){
    return;
  }
  
  print1(node->left);
  printf(" %d",node->key);
  print1(node->right);
  return ;
}
  
  
  
void print2(Node *node){
  if(node == NULL){
    return;
  }
  printf(" %d",node->key);
  print2(node->left);
  print2(node->right);
  return;
}
  
  
  
int find(Node *node,int num){
  int found=0;
  if(node == NULL){
    return 0;
  }
  if(node->key == num) found=1;
  if(node->key > num) found = find(node->left,num);
  if(node->key < num) found = find(node->right,num);
  
  return found;
}
  
  
  
void delete(Node *node){
  Node *x,*y;
  if(node->left == NULL || node->right == NULL) y = node;
  else y = successor(node);
  
  if(y->left != NULL) x = y->left;
  else x = y->right;
  
  if(x != NULL) x->parent = y->parent;
  
  if(y->parent == NULL) head = x;
  else if(y == y->parent->left) y->parent->left = x;
  else y->parent->right = x;
  
  if(y != node) node->key = y->key;
}
  
  
  
Node* successor(Node *node){
  Node *y,*x;
  if(node->right != NULL) return mini(node->right);
  x = node;
  y = x->parent;
  while(y != NULL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y;
}
  
  
Node* mini(Node *node){
  while(node->left != NULL){
    node = node->left;
  }
  return node;
}
  
  
Node* search(Node *node,int num){
  Node *found;
  if(node == NULL){
    return 0;
  }
  if(node->key == num){
    found = node;
  }
  if(node->key > num) found = search(node->left,num);
  if(node->key < num) found = search(node->right,num);
  
  return found;
}

int main(){
  int i,num;
  Node *n;
  char order[ORDER][10];
  Node tmp;
  
  scanf("%d",&num);
  
  n = (Node *)malloc(sizeof(Node) * num);
  
for(i=0; i<num; i++){
    scanf("%s",order[i]);
    if(strcmp(order[i],"print")!=0)scanf("%d",&n[i].key);
  }
  
  for(i=0; i<num; i++){
    if(strcmp(order[i],"insert")==0) insert(&n[i]);
    if(strcmp(order[i],"print")==0){
      print1(head);
      printf("\n");
      print2(head);
      printf("\n");
    }
    if(strcmp(order[i],"find")==0){
      if(find(head,n[i].key)==1) printf("yes\n");
      else printf("no\n");
    }
    if(strcmp(order[i],"delete")==0)
 delete(search(head,n[i].key));
  }
  
  return 0;
}

Compiler output:
main.c: In function 'delete':
main.c:79:12: error: implicit declaration of function 'successor' [-Wimplicit-function-declaration]
   79 |   else y = successor(node);
      |            ^~~~~~~~~
main.c:79:10: error: assignment to 'Node *' {aka 'struct NODE *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
   79 |   else y = successor(node);
      |          ^
main.c: At top level:
main.c:95:7: error: conflicting types for 'successor'; have 'Node *(Node *)' {aka 'struct NODE *(struct NODE *)'}
   95 | Node* successor(Node *node){
      |       ^~~~~~~~~
main.c:79:12: note: previous implicit declaration of 'successor' with type 'int()'
   79 |   else y = successor(node);
      |            ^~~~~~~~~
main.c: In function 'successor':
main.c:97:34: error: implicit declaration of function 'mini' [-Wimplicit-function-declaration]
   97 |   if(node->right != NULL) return mini(node->right);
      |                                  ^~~~
main.c:97:34: error: returning 'int' from a function with return type 'Node *' {aka 'struct NODE *'} makes pointer from integer without a cast [-Wint-conversion]
   97 |   if(node->right != NULL) return mini(node->right);
      |                                  ^~~~~~~~~~~~~~~~~
main.c: At top level:
main.c:108:7: error: conflicting types for 'mini'; have 'Node *(Node *)' {aka 'struct NODE *(struct NODE *)'}
  108 | Node* mini(Node *node){
      |       ^~~~
main.c:97:34: note: previous implicit declaration of 'mini' with type 'int()'
   97 |   if(node->right != NULL) return mini(node->right);
      |                                  ^~~~