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

mport java.util.Scanner;

public class Main {
    static Node[] list;
    public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
        int m= Integer.parseInt(sc.next());
        String s;
        int reg=0;
        int flag=1;
        int reg2;
        list=new Node[m];
        for(int i=0;i<m;i++) list[i] = new Node();
        
        for(int i=0;i<m;i++){
        	s=sc.next();
        	if(s.equals("insert")){
        		list[i].number=Integer.parseInt(sc.next());
        		if(flag==1){
        			reg=i;
        			flag=0;
        		}else{
        			insert(list[reg],list,i);
        		}
        	}else if(s.equals("print")){
        		naka(list,list[reg]);
        		System.out.print("\n");
        		mae(list,list[reg]);
        		System.out.print("\n");
            }else if(s.equals("find")){
            	reg2=sc.nextInt();
            	for(int j=0;j<i;j++){
            		if(list[j].number==reg2){
            			System.out.println("yes");
            			break;
            		}else if(j==i-1){
            			System.out.println("no");
            		}
            	}
            }
        }
    }
    static void insert(Node node,Node[] list,int i){
        if(list[i].number>node.number){
            if(node.right==null){
            	node.right=list[i];
            }else{
            	insert(node.right,list,i);
            }
        }else {
        	if(node.left==null){
        		node.left=list[i];
        	}else{
        		insert(node.left,list,i);
        	}
        }
    }
    static void mae(Node[] list, Node node){
    	System.out.print(" ");
    	System.out.print(node.number);
    	if(node.left!=null){
    		mae(list,node.left);
    	}
    	if(node.right!=null){
    		mae(list,node.right);
    	}
    }
    static void naka(Node[] list, Node node){
    	if(node.left!=null){
    		naka(list,node.left);
    	}
    	System.out.print(" ");
    	System.out.print(node.number);
    	if(node.right!=null){
    		naka(list,node.right);
    	}
    }
}

class Node{
	int number;
	Node left;
	Node right;
	Node(){
		number=-1;
		left=null;
		right=null;
	}
}


Compiler output:
Main.java:1: error: class, interface, enum, or record expected
mport java.util.Scanner;
^
1 error
Language: C

#include <stdio.h>
#include <stdlib.h>
struct tree{
  int key;
  struct tree *parent;
  struct tree *left;
  struct tree *right;
};
struct tree *T,*NIL;
void insert(struct tree *);
struct tree *find(int);
struct tree *getMin(struct tree *);
struct tree *getSuccessor(struct tree *);
void delete(int);
void inorder(struct tree *);
void preorder(struct tree *);
int main(){
  int n,k,i;
  char command[10],a;
  struct tree *A;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s%c",command,&a);
    if(!strcmp(command,"insert")){
      scanf("%d",&k);
      A=malloc(sizeof(struct tree));
      A->key=k;
      A->left=NIL;
      A->right=NIL;
      insert(A);
    }
    else if(!strcmp(command,"print")){
      inorder(T);
      printf("\n");
      preorder(T);
      printf("\n");
    }
    else if(!strcmp(command,"delete")){
      scanf("%d",&k);
      delete(k);
    }
       else if(!strcmp(command,"find")){
      scanf("%d",&k);
      A=find(k);
      if(A->key==k)printf("yes\n");
      else printf("no\n");
    }
  }
  return 0;
}

void insert(struct tree *z){
  struct tree *x,*y;
  x=T;
  y=NIL;
  while(x!=NIL){
    y=x;
    if(x->key>z->key) x=x->left;
    else x=x->right;
  }
  z->parent=y;
  if(y==NIL){
    T=z;
  }
  else {
    if(y->key<z->key)y->right=z;
    else y->left=z;
  }
}
void inorder(struct tree *A){
  if(A==NIL)return;
  inorder(A->left);
  printf(" %d",A->key);
  inorder(A->right);
}
void preorder(struct tree *A){
  if(A==NIL)return;
  printf(" %d",A->key);
  preorder(A->left);
  preorder(A->right);
}
struct tree *find(int k){
  struct tree *x=T;
  while(x!=NIL){
    if(x->key==k)return x;
    else if(k<x->key)x=x->left;
    else x=x->right;
  }
  return T;
}
struct tree *find(int k){
  struct tree *x=T;
  while(x!=NIL){
    if(x->key==k)return x;
    else if(k<x->key)x=x->left;
    else x=x->right;
  }
  return T;
}
void delete(int k){
  struct tree *x,*y,*z;
  z=find(k);
  if(z->left==NIL||z->right==NIL)y=z;
  else y=getSuccessor(z);
  if(y->left!=NIL)x=y->left;
  else x=y->right;
  if(x!=NIL)x->parent=y->parent;
  if(y->parent==NIL)T=x;
  else if(y==y->parent->left)y->parent->left=x;
  else y->parent->right=x;
  if(y!=z)z->key=y->key;
}
struct tree *getSuccessor(struct tree *z){
  struct tree *x,*y;
  if(z->right!=NIL)return getMin(z->right);
  y=x->parent;
  while(y!=NIL&x==y->right){
    x=y;
    y=y->parent;
  }
  return y;
}
struct tree *getMin(struct tree *z){
   while(z->left!=NIL){
    z=z->left;
  }
  return z;
}




Compiler output:
main.c: In function 'main':
main.c:24:9: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
   24 |     if(!strcmp(command,"insert")){
      |         ^~~~~~
main.c:3:1: note: include '<string.h>' or provide a declaration of 'strcmp'
    2 | #include <stdlib.h>
  +++ |+#include <string.h>
    3 | struct tree{
main.c: At top level:
main.c:91:14: error: redefinition of 'find'
   91 | struct tree *find(int k){
      |              ^~~~
main.c:82:14: note: previous definition of 'find' with type 'struct tree *(int)'
   82 | struct tree *find(int 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 treeMinimum(Node x){
  while(x->left != NIL)
    x = x->left;
  return x;

}

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

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

}

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

  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;
  
  z->parent = y;
  
  if(y != z)
    z->key = y->key;


}

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

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

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


  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");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



Compiler output:
main.c: In function 'treeSuccessor':
main.c:43:9: error: 'y' undeclared (first use in this function)
   43 |   while(y != NIL && x == y->right){
      |         ^
main.c:43:9: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'treeDelete':
main.c:61:7: error: 'y' is a pointer; did you mean to use '->'?
   61 |   if(y.left != NIL)
      |       ^
      |       ->
main.c:69:7: error: 'y' is a pointer; did you mean to use '->'?
   69 |   if(y.parent == NIL)
      |       ^
      |       ->
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 u;
if (k < u->key)
return treeSearch(u->left, k);
else
return treeSearch(u->right, k);


}

void treeDelete(Node z){
	 Node y; // node to be deleted
	 Node x; // child of y
	 if (z->left == NIL || z->right == NIL)
   y=z;
else y =treeSuccessor(z);
 if (y->left != NIL)
     x = y->left;
 else
   x = y->right;
   
   if (x != NIL)
      x->parent = y->parent;
      
      if( y->parent == NIL)
root = x;

else if( y == y->parent->left)
     y->parent->left = x;
     
   else
    y->parent->right = x;
    
     if( y != z)
   z->key = y->key;


}

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");
    }
     else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
  }

  return 0;
}
}


Compiler output:
main.c: In function 'treeDelete':
main.c:43:9: error: implicit declaration of function 'treeSuccessor' [-Wimplicit-function-declaration]
   43 | else y =treeSuccessor(z);
      |         ^~~~~~~~~~~~~
main.c:43:8: error: assignment to 'Node' {aka 'struct node *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
   43 | else y =treeSuccessor(z);
      |        ^
main.c: At top level:
main.c:67:6: error: conflicting types for 'treeSuccessor'; have 'struct node *(struct node *)'
   67 | Node treeSuccessor(Node x){
      |      ^~~~~~~~~~~~~
main.c:43:9: note: previous implicit declaration of 'treeSuccessor' with type 'int()'
   43 | else y =treeSuccessor(z);
      |         ^~~~~~~~~~~~~
Language: C

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

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

struct Node *root, *NIL;

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

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

struct Node * treeSuccessor(struct Node *x){
    if(x->right != NIL) return treeMinimum(x->right);
    struct Node *y = x->parent;
    while(y != NIL && x == y->right){
        x = y;
        y = y->parent;
    }

    return y;
}

void treeDelete(struct Node *z){
    struct Node *y;
    struct Node *x;

    if(z->left != NIL || z->right != NIL) y = z;
    else y = treeSuccessor(z); //どこに継ぎ足すか
    
    if(y->left != NIL){
        x = y->left;
    } else{
        x = y->right;
    }

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

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

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

    free(y);
}



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

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

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

    for(i = 0; i < n; i++){
        scanf("%s", com);
        if(com[0] == 'i'){
            scanf("%d", &x);
            insert(x);
        } else if(com[0] == 'f'){
            scanf("%d", &x);
            find(x);
        } else if(com[0] == 'd'){
            scanf("%d", &x);
            delete(x);
        } else{
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }

    return 0;
}




Compiler output:
main.c: In function 'main':
main.c:96:13: error: implicit declaration of function 'insert' [-Wimplicit-function-declaration]
   96 |             insert(x);
      |             ^~~~~~
main.c:99:18: error: passing argument 1 of 'find' makes pointer from integer without a cast [-Wint-conversion]
   99 |             find(x);
      |                  ^
      |                  |
      |                  int
main.c:18:33: note: expected 'struct Node *' but argument is of type 'int'
   18 | struct Node * find(struct Node *u, int k){
      |                    ~~~~~~~~~~~~~^
main.c:99:13: error: too few arguments to function 'find'
   99 |             find(x);
      |             ^~~~
main.c:18:15: note: declared here
   18 | struct Node * find(struct Node *u, int k){
      |               ^~~~
main.c:102:13: error: implicit declaration of function 'delete' [-Wimplicit-function-declaration]
  102 |             delete(x);
      |             ^~~~~~
Language: C

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

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

struct Node *root, *NIL;

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

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

struct Node * treeSuccessor(struct Node *x){
    if(x->right != NIL) return treeMinimum(x->right);
    struct Node *y = x->parent;
    while(y != NIL && x == y->right){
        x = y;
        y = y->parent;
    }

    return y;
}

void treeDelete(struct Node *z){
    struct Node *y;
    struct Node *x;

    if(z->left != NIL || z->right != NIL) y = z;
    else y = treeSuccessor(z); //どこに継ぎ足すか
    
    if(y->left != NIL){
        x = y->left;
    } else{
        x = y->right;
    }

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

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

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

    free(y);
}



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

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

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

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

    return 0;
}




Compiler output:
main.c: In function 'main':
main.c:96:13: error: implicit declaration of function 'insert' [-Wimplicit-function-declaration]
   96 |             insert(x);
      |             ^~~~~~
Language: C

#include<stdio.h>
#include<stdlib.h>
 struct node{
  struct node *left;
  struct node *right;
  struct node *parent;
  int key;
};
typedef struct node * NodePointer;

void insert(int);
void preorder(NodePointer);
void inorder(NodePointer);
NodePointer createNode(void);
NodePointer treeSearch(NodePointer, int);
void treeDelete(NodePointer);
NodePointer root = NULL;
NodePointer NIL = NULL;

main(){
  int m, i, k;
  char order[10];
  scanf("%d", &m);
  for(i = 0; i < m; i++){
    scanf(" %s", order);
if ( order[0] == 'f' ){
      scanf("%d", &k);
      NodePointer t = treeSearch(root, k);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
 }
    if(order[0]=='i'){
      scanf(" %d",&k);
      insert(k);
    }
    else if(order[0]=='p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
else if ( order[0] == 'd' ){
      scanf("%d", &k);
      treeDelete(treeSearch(root, k));
    }
  }
  return 0;
}


NodePointer createNode(){
  NodePointer node = malloc(sizeof(struct node));
  node->left = NULL;
  node->right = NULL;
  node->parent = NULL;
  node->key = 0;
  return node;
}


void insert(int key){
  NodePointer z = createNode();
  NodePointer x = root;
  NodePointer y = NIL;
  z->key = key;
  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 preorder(NodePointer p){
  printf(" %d", p->key);
  if(p->left != NULL) preorder(p->left);
  if(p->right != NULL) preorder(p->right);
}

void inorder(NodePointer p){
  if(p->left != NULL) inorder(p->left);
  printf(" %d", p->key);
  if(p->right != NULL) inorder(p->right);
}


NodePointer treeSearch(NodePointer p,int k){
  while(p != NULL){
    if(k == p->key){
      return p;
    }
    else if(k <= p->key){
      p = p->left;
    }
    else p = p->right;
  }
  return NIL;
}


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



}

Compiler output:
main.c:20:1: error: return type defaults to 'int' [-Wimplicit-int]
   20 | main(){
      | ^~~~
main.c: In function 'treeDelete':
main.c:106:3: error: unknown type name 'Node'
  106 |   Node y; // node to be deleted
      |   ^~~~
main.c:107:3: error: unknown type name 'Node'
  107 |   Node x; // child of y
      |   ^~~~
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 treeSearch(Node u, int k){
  while(u !=NIL){
    if(u->key == k)break;
    else if(u->key < k)u = u->right;
    else u = u->left;
  }
  return u;
}
 
Node treeSuccessor(Node x){
  Node y;
  if(x->right != NIL)return treeMinimum(x->right);
  y = x->parent;
  while(y!=NIL && x == y->right){
    x=y;
    y=y->parent;
  }
  return y;
}
 
void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
  if(z->left == NIL || z->right == NIL)y=z;
  else y = treeSuccessor(z);
  if(y->left!=NIL)x=y->left;
  else x = y->left;
  if(x != NIL)x->parent = y->parent;
  if(y->parent == NIL) root = x;

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

    else y->parent->right = x;

    if(y != z) z->key = y->key;
  }
 
}
 
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;
 
  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
   
  while(x != NIL){
    y=x;
    if(z->key < x->key)x = x->left;
    else x = x->right;
  }
  z->parent = y;
   if(y == NIL)
      root = z;
    else if(z->key < y->key)
        y->left = z;
    else
      y->right = z;
 
   
}
void inorder(Node u){
if(u != NIL){
    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");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }
 
  return 0;
}

Compiler output:
main.c:58:1: error: expected identifier or '(' before '}' token
   58 | }
      | ^
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 treeSearch(Node u, int k){
  while(u !=NIL){
    if(u->key == k)break;
    else if(u->key < k)u = u->right;
    else u = u->left;
  }
  return u;
}
 
Node treeSuccessor(Node x){
  Node y;
  if(x->right != NIL)return treeMinimum(x->right);
  y = x->parent;
  while(y!=NIL && x == y->right){
    x=y;
    y=y->parent;
  }
  return y;
}
 
void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
  if(z->left == NIL || z->right == NIL)y=z;
  else y = treeSuccessor(z);
  if(y->left!=NIL)x=y->left;
  else x = y->left;
  if(x != NIL)x->parent = y->parent;
  if(y->parent == NIL) root = x;

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

    else y->parent->right = x;

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

void inorder(Node u){
if(u != NIL){
    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");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }
 
  return 0;
}

Compiler output:
main.c:58:1: error: expected identifier or '(' before '}' token
   58 | }
      | ^
main.c: In function 'insert':
main.c:127:1: error: expected declaration or statement at end of input
  127 | }
      | ^
Language: C

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

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

typedef struct node * Node;

Node root;

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

  z=malloc(sizeof(struct node));
  z->key=v;
  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){
    inorder(u->l);
    printf(" %d",u->key);
    inorder(u->r);
  }
}

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

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

Node Min(Node a){
  while(a->l!=NIL){
    a=a->l;
  }
  return a;
}

Noe suc(Node a){
  if(a->r!=NIL) return Min(a->r);
  Node y=a->p;
  while(y!=NIL && a==y->r){
    a=y;
    y=y->p;
  }
  return y;
}

void delete(Node a){
  Node y;
  Node x;

  if(a->l==NIL || z->r==NIL) y=a;
  else y=suc(a);

  if(y->l!=NIL) x=y->l;
  else x=y->r;

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

  if(y->==NIL) root=x;
  else if(y==y->p->l) y->p->l=x;
  else y->p->r=x;

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


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 s=find(root,x);
    if(s!=NIL) printf("yes\n");
    else printf("no\n");
  }
  else if(str[0]=='d'){
    scanf("%d",&x);
    delete(find(root,x));
  }
  }
  return 0;
}

Compiler output:
main.c:69:1: error: unknown type name 'Noe'; did you mean 'Node'?
   69 | Noe suc(Node a){
      | ^~~
      | Node
main.c: In function 'suc':
main.c:70:24: error: returning 'Node' {aka 'struct node *'} from a function with return type 'int' makes integer from pointer without a cast [-Wint-conversion]
   70 |   if(a->r!=NIL) return Min(a->r);
      |                        ^~~~~~~~~
main.c:76:10: error: returning 'Node' {aka 'struct node *'} from a function with return type 'int' makes integer from pointer without a cast [-Wint-conversion]
   76 |   return y;
      |          ^
main.c: In function 'delete':
main.c:83:19: error: 'z' undeclared (first use in this function)
   83 |   if(a->l==NIL || z->r==NIL) y=a;
      |                   ^
main.c:83:19: note: each undeclared identifier is reported only once for each function it appears in
main.c:84:9: error: assignment to 'Node' {aka 'struct node *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
   84 |   else y=suc(a);
      |         ^
main.c:91:9: error: expected identifier before '==' token
   91 |   if(y->==NIL) root=x;
      |         ^~
main.c: In function 'main':
main.c:124:11: error: 'str' undeclared (first use in this function)
  124 |   else if(str[0]=='d'){
      |           ^~~
Language: C

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

struct node{
  struct node *ri;
  struct node *lf;
  struct node *prt;
  int key;
};
typedef struct node * Node;

 
Node root;

Node treeMinimum(Node x){
  while (x->lf != NIL) { 
    x = x->lf;
  }
  return x;
}
Node treeSearch(Node u, int k){
  if (u == NIL || k == u->key){
    return u;
  } 
  if(k < u->key) {
    return treeSearch(u->lf,k);
  }
  else return treeSearch(u->ri,k);
}

Node treeSuccessor(Node x){
  Node y;
  if(x->ri != NIL) {
    return treeMinimum(x->ri);
  }
  y = x->prt;
  while (y != NIL && x == y->ri){
    x = y;
    y = y->prt;
  }
    return y;
}
 
void treeDelete(Node z){
  Node y; 
  Node x; 
  if(z->lf == NIL || z->ri == NIL) {
    y = z; 
  }
  else y = treeSuccessor(z); 
  if(y->lf != NIL){
    x = y->lf;
  } 
  else x = y->ri;
  if(x != NIL) {
    x->prt = y->prt;
  }
  if(y->prt == NIL) {
    root = x;
  }  
  else if(y == y->prt->lf) {
    y->prt->lf = x; 
  }
  else y->prt->ri = x; /
  if(y != z){ 
    z->key = y->key; 
  }
}
 
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;
 
  z = malloc(sizeof(struct node));
  z->key = k;
  z->lf = NIL;
  z->ri = NIL;
 
  while(x != NIL) {
    y = x;
    if(z->key < x->key) {
      x = x->lf;
    }
    else x = x->ri;
    }
  z->prt = y;
  if(y == NIL) {
    root = z; 
  }
  else if(z->key < y->key){
    y->lf = z;
  } 
  else y->ri = z;
}
 
void inorder(Node u){
  if(u != NIL){
    inorder(u->lf);
    printf(" %d",u->key);
    inorder(u->ri);
  }
}
 
void preorder(Node u){
  if(u != NIL){
    printf(" %d",u->key);
    preorder(u->lf);
    preorder(u->ri);
  }
}
 
int main(){
  int n, i, x;
  char cm[20];
  scanf("%d", &n);
 
  for ( i = 0; i < n; i++ ){
    scanf("%s", cm);
    if ( cm[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( cm[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( cm[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( cm[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }
  return 0; 
}

Compiler output:
main.c: In function 'treeDelete':
main.c:65:24: error: expected expression before '/' token
   65 |   else y->prt->ri = x; /
      |                        ^
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 = NIL;

Node treeSearch(Node root, int k) {
	if (root == NIL) return NIL;
	if (root->key == k) return root;
	if (root->key > k) {
		if (root->left != NIL) return treeSearch(root->left, k);
		else return NIL;
	} else {
		if (root->right != NIL) return treeSearch(root->right, k);
		else return NIL;
	}
}

int find(Node root, int k) {
	if (root->key == k) return 1;
	if (root->key < k) {
		if (root->left != NIL) return find(root->left, k);
		else return 0;
	} else {
		if (root->right != NIL) return find(root->right, k);
		else return 0;
		
	}
}

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

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

Node getMinimum(Node u) {
	while (u->left != NIL) {
		u = u->left;
	}
	return u;
}

Node getSuccessor(Node u) {
	Node y;
	if (u->right != NIL) {
		return getMinimum(x->right);
	}
	
	y = u->parent;
	
	while (y != NIL && u == y->right) {
		u = y;
		u = y->parent;
	}
	return y;
}

void treeDelete(Node z) {
	Node y;
	Node x;
	if (z->left == NIL || z->right == NIL) {
		y = z;
	} else {
		y = getSuccessor(z);
	}

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

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

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

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

int main(void) {
	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:
main.c: In function 'getSuccessor':
main.c:96:35: error: 'x' undeclared (first use in this function)
   96 |                 return getMinimum(x->right);
      |                                   ^
main.c:96:35: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'treeDelete':
main.c:132:18: error: 'y' is a pointer; did you mean to use '->'?
  132 |                 y.parent.right = x;
      |                  ^
      |                  ->
Language: C

  if(z->left == NULL || z->right == NULL) y = z;
  else y = Successor(z);
  if(y->left != NULL) x = y->left;
  else x = y->right;
  if(x != NULL) x->parent = y->parent;
  if(y->parent == NULL) T = x;
  else if(y == y->parent->left) y->parent->left = x;
  else y->parent->right = x;
  if(y != z) z->key = y->key;
}
node* Successor(node* x){
  node *y;
  if(x->right != NULL) return Minimum(x->right);
  y = x->parent;
  while(y != NULL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y;
}
node* Minimum(node* x){
  while(x->left != NULL) x = x->left;
  return x;
}
node* Maximum(node* x){
  while(x->right != NULL) x = x->right;
  return x;
}

Compiler output:
main.c:1:3: error: expected identifier or '(' before 'if'
    1 |   if(z->left == NULL || z->right == NULL) y = z;
      |   ^~
main.c:2:3: error: expected identifier or '(' before 'else'
    2 |   else y = Successor(z);
      |   ^~~~
main.c:3:3: error: expected identifier or '(' before 'if'
    3 |   if(y->left != NULL) x = y->left;
      |   ^~
main.c:4:3: error: expected identifier or '(' before 'else'
    4 |   else x = y->right;
      |   ^~~~
main.c:5:3: error: expected identifier or '(' before 'if'
    5 |   if(x != NULL) x->parent = y->parent;
      |   ^~
main.c:6:3: error: expected identifier or '(' before 'if'
    6 |   if(y->parent == NULL) T = x;
      |   ^~
main.c:7:3: error: expected identifier or '(' before 'else'
    7 |   else if(y == y->parent->left) y->parent->left = x;
      |   ^~~~
main.c:8:3: error: expected identifier or '(' before 'else'
    8 |   else y->parent->right = x;
      |   ^~~~
main.c:9:3: error: expected identifier or '(' before 'if'
    9 |   if(y != z) z->key = y->key;
      |   ^~
main.c:10:1: error: expected identifier or '(' before '}' token
   10 | }
      | ^
main.c:11:1: error: unknown type name 'node'
   11 | node* Successor(node* x){
      | ^~~~
main.c:11:17: error: unknown type name 'node'
   11 | node* Successor(node* x){
      |                 ^~~~
main.c:21:1: error: unknown type name 'node'
   21 | node* Minimum(node* x){
      | ^~~~
main.c:21:15: error: unknown type name 'node'
   21 | node* Minimum(node* x){
      |               ^~~~
main.c:25:1: error: unknown type name 'node'
   25 | node* Maximum(node* x){
      | ^~~~
main.c:25:15: error: unknown type name 'node'
   25 | node* Maximum(node* x){
      |               ^~~~
Language: C

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

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

Node root, NIL;

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

int main(){
  
  int n, i, x;
  char com[10];
  
  scanf("%d", &n);
  
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);

    if ( strcmp(com, "insert") == 0 ){
      scanf("%d", &x);
      insert(x);
    }
    else if ( strcmp(com, "print") == 0 ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else if ( strcmp(com, "find") == 0 ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    }
     else if ( strcmp(com, "delete") == 0 ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }
  return 0;
}

void insert(int k){
  int H;
  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 x){
  if ( x == NIL ) return;
  inorder(x->left);
  printf(" %d", x->key);
  inorder(x->right);
}
    else if ( strcmp(com, "print") == 0 ){

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

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

Node treeMaximum(Node x){

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

Node treeMinimum(Node x){

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

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

Node treeDelete(Node z){
  Node x;
  Node 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 = x;
  else y->parent->right = x;
  
  if( y != z ) z->key = y->key;
  
  free(y);
}

Compiler output:
main.c: In function 'main':
main.c:33:10: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
   33 |     if ( strcmp(com, "insert") == 0 ){
      |          ^~~~~~
main.c:3:1: note: include '<string.h>' or provide a declaration of 'strcmp'
    2 | #include<stdlib.h>
  +++ |+#include <string.h>
    3 | 
main.c: At top level:
main.c:96:5: error: expected identifier or '(' before 'else'
   96 |     else if ( strcmp(com, "print") == 0 ){
      |     ^~~~
Language: C

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

typedef struct node * Node;
Node root;
Node find(Node u, int k);
void insert(int k);
void inorderTreeWalk(Node x);
void preorderTreeWalk(Node x);
Node treeMinimum(Node x);
Node treeSearch(Node x,int k);
Node treeSuccessor(Node x);
void treeDelete(Node z);
int main()
{
  char str[7];
  int m,i,x,key;
  scanf("%d",&m);
  for( i=0 ; i<m ; i++ ){
    scanf("%s",str);
    if(str[0]=='i'){
      scanf("%d",&x);
      insert(x);
    }
    else if(str[0]=='p'){
      inorderTreeWalk(root);
      printf("\n");
      preorderTreeWalk(root);
      printf("\n");
    }
    else if(str[0]=='d'){
      scanf("%d",&key);
      if( find(root,key)==NIL ){
	printf("no\n");
      }else{
	printf("yes\n");
      }   
    }
    else{
      scanf("%d",&x);
      treeDelete(treeSearch(root,x));
    }
  }
  return 0;
   
}

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

void insert(int k)
{
  Node x;
  Node y;
  Node z;
  y = NIL;
  x = root;
  z = (Node)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 inorderTreeWalk(Node x)
{
  if(x==NIL) return;
  inorderTreeWalk(x->l);
  printf(" %d",x->key);
  inorderTreeWalk(x->r);
}
 
void preorderTreeWalk(Node x)
{
  if(x==NIL) return;
    printf(" %d",x->key);
    preorderTreeWalk(x->l);
    preorderTreeWalk(x->r);
   
}
Node treeMinimum(Node x)
{
  while(x->l!=NIL) x = x->l;
  return x;
}
 
Node treeSearch(Node x,int k){
  if(x==NIL || k==x->key) return x;
  if(k<x->key) return treeSearch(x->l,k);
  
  else return treeSearch(x->r,k);
}
 
 
Node treeSuccessor(Node x)
{
  Node y;
  if(x->r!=NIL) return treeMinimum(x->r);
 
  y = x->parent;
  while(y!=NIL && x==y->r){
    x = y;
    y = y->p;
  }
  return y;
}
 
 
void treeDelete(Node z)
{
  Node x, y;
  if(z->l==NIL || z->r==NIL) y=z;
  
  else y =treeSuccessor(z);
  
  if(y->l!=NIL) x = y->l;
  
  else x = y->r;
 
  if(x!=NIL) x->p = y->p;
 
  if(y->p==NIL) root = x;
  
  else if(y==y->p->l) y->p->l = x;
  
  else y->p->r = x;
 
  if(y!=z) z->key = y->key;
}

Compiler output:
main.c: In function 'treeSuccessor':
main.c:125:8: error: 'struct node' has no member named 'parent'
  125 |   y = x->parent;
      |        ^~
Language: C

#include<stdio.h>
#include<stdlib.h>
 
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL
 
Node root;

Node treeSearch(Node u, int k){
  while(u != NIL && u->key != k){
  if( u->key > k)u = u->left;
  else u = u->right;
  }
  return u;
}
 
 
void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
 
  if(z->left==NIL || z->right==NIL) y=z;
  else y=treeSuccessor(z);
 
  if(y->left!=NIL) x=y->left;
  else x=y->right;
 
  if(x!=NIL) x->parent=y->parent;
 
  if(y->parent==NIL) root=x;
  else if(y==y->parent->left) y->parent->left=x;
  else y->parent->right=x;
 
  if(y!=z) z->key=y->key;
}
 
void insert(int k){
  Node a = NIL;
  Node b = root;
  Node c;
  c = malloc(sizeof(struct node));
 
  c->key = k;
  c->left = NIL;
  c->right = NIL;
   
 
  while(a!=NIL){
    b=a;
    if(c->key<a->key){
      a = a->left;
    }
    else a = a->right;
  }
    c->parent=b;
    if(b == NIL){
      root = c;
    }
    else if(c->key < b->key){
      b->left=c;
    }
    else b->right=c;
}
 
void inorder(Node n){
  if(n->left != NIL){
    inorder(n->left);
  }
  printf(" %d",n->key);
  if(n->right != NIL){
    inorder(n->right);
  }
  
}
 
void preorder(Node n){
  printf(" %d",n->key);
  if(n->left!= NIL){
    preorder(n->left);
  }
  if(n->right!= NIL){
    preorder(n->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:
main.c: In function 'treeDelete':
main.c:29:10: error: implicit declaration of function 'treeSuccessor' [-Wimplicit-function-declaration]
   29 |   else y=treeSuccessor(z);
      |          ^~~~~~~~~~~~~
main.c:29:9: error: assignment to 'Node' {aka 'struct node *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
   29 |   else y=treeSuccessor(z);
      |         ^
Language: C

#include <stdio.h>
#include <stdlib.h>
#define NIL NULL
#define DEBUG
 
typedef struct node{
  struct node* parent;
  struct node* left;
  struct node* right;
  int k;
}Node;
 
Node* tree;
 
void insert(int k){
  Node* y = NIL;
  Node* x = tree;
  Node* z;
  z=(Node *)malloc(sizeof(Node));
  z->k=k;
  z->left=NIL;
  z->right=NIL;
 
  while(x!=NIL){
    y=x;
    if(z->k < x->k ){
      x = x->left;
    }
    else{
      x = x->right;
    }
  }
  z->parent = y;
 
  if(y==NIL) tree=z;
  else if(z->k < y->k) y->left=z;
  else y->right=z;
  return;
}
 
void inorder(Node* tree){
  if(tree != NIL){
    inorder(tree->left);
    printf(" %d",tree->k);
    inorder(tree->right);
  }
  return;
}
 
void preorder(Node* tree){
  if(tree != NIL){
    printf(" %d",tree->k);
    preorder(tree->left);
    preorder(tree->right);
  }
  return;
}
 
Node* find(Node* tree,int f){
  if(tree != NIL){
    if(tree->k == f) return tree;
    if(tree->k > f) return find(tree->left,f);
    else return find(tree->right,f);
  }
  else return NIL;
}
 
void delete(Node* z){
  Node* y;
  Node* x;
 
  if(z->left == NIL || z->right == NIL) y=z;
  else y=Successor(z);
 
  if(y->left!=NIL) x = y->left;
  else x=y->right;
  if(x!=NIL) x->parent = y->parent;
 
  if(y->parent==NIL) tree=x;
  else if(y==y->parent->left) y->parent->left=x;
  else y->parent->right = x;
 
  if(y!=z){
    z->k = y->k;
  }
 
  return;
}
 
Node* Minimum(Node* x){
  while(x->left != NIL){
    x=x->left;
  }
  return x;
}
 
Node* Successor(Node* x){
  Node* y;
 
  if(x->right != NIL) return Minimum(x->right);
 
  y = x->parent;
  while(y!=NIL && x==y->right){
    x=y;
    y=y->parent;
  }
  return y;
}

int main(){
  int m,i,k;
  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);
    }
    else if(s[0]=='p'){
      inorder(tree);
      printf("\n");
      preorder(tree);
      printf("\n");
    }
    else if(s[0]=='f'){
      scanf("%d",&k);
      f=find(tree,k);
      if(f!=NIL) printf("yes\n");
      else printf("no\n");
    }
    else if(s[0]=='d'){
      scanf("%d",&k);
      if((f=find(tree,k))!=NIL) delete(f);
    }
  }
 
  return 0;
}

Compiler output:
main.c: In function 'delete':
main.c:73:10: error: implicit declaration of function 'Successor' [-Wimplicit-function-declaration]
   73 |   else y=Successor(z);
      |          ^~~~~~~~~
main.c:73:9: error: assignment to 'Node *' {aka 'struct node *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
   73 |   else y=Successor(z);
      |         ^
main.c: At top level:
main.c:97:7: error: conflicting types for 'Successor'; have 'Node *(Node *)' {aka 'struct node *(struct node *)'}
   97 | Node* Successor(Node* x){
      |       ^~~~~~~~~
main.c:73:10: note: previous implicit declaration of 'Successor' with type 'int()'
   73 |   else y=Successor(z);
      |          ^~~~~~~~~
Language: C

#include<stdio.h>
#include<stdlib.h>
 
struct node{
  struct node *right;
  struct node *left;
  struct node *p;
  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 treeSearch(Node u, int k){
  if( u == NIL || k == u->key){
    return u;
  }
  if( k < u->key ){
    return treeSearch( u->left, k);
  }else {
    return treeSearch( u->right, k);
  }
 
}
 
Node treeSuccessor(Node x){
  Node y;
  if( x->right != NIL ){
    return treeMinimum(x->right);
  }
 
  y = x->parent;
  while( y != NIL && x == y->right ){
    x = y;
    y = y->parent;
  }
  return y;
}
 
void treeDelete(Node z){
  Node y = NIL; 
  Node x = NIL; 
 
  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->p = y->p;
  }
  if( y->p == NIL ){
    root = x;
  }else if( y == y->p->left){
    y->p->left = x;
  }else {
    y->p->right = x;
  }
 
  if( y != z ){
    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->p = 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:
main.c: In function 'treeSuccessor':
main.c:40:8: error: 'struct node' has no member named 'parent'
   40 |   y = x->parent;
      |        ^~
main.c:43:10: error: 'struct node' has no member named 'parent'
   43 |     y = y->parent;
      |          ^~