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

import java.util.*;

class Node {
    public int key;
    public Node next, pre;
    Node(int key) {
        this.key = key;
        next = pre = null;
    }
}

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        Node head = new Node(0);
        Node last = new Node(0);
        head.next = last;
        last.pre = head;
        while(N-- > 0) {
            String ope = scan.next();
            if(ope.equals("insert")) {
                int num = scan.nextInt();
                Node node = new Node(num);
                node.pre = head;
                node.next = head.next;
                node.pre.next = node;
                node.next.pre = node;
            } else if(ope.equals("delete")) {
                int num = scan.nextInt();
                for(Node p = head.next; p != last; p = p.next) {
                    if(p.key == num) {
                        p.pre.next = p.next;
                        p.next.pre = p.pre;
                        break;
                    }
                }
            } else if(ope.equals("deleteFirst")) {
                head.next.next.pre = head;
                head.next = head.next.next;
            } else if(ope.equals("deleteLast")) {
                last.pre.pre.next = last;
                last.pre = last.pre.pre;
            }
        }
        for(Node p = head.next; p != last; p = p.next) {
            if(p != head.next) System.out.print(" ");
            System.out.print(p.key);
        }
        System.out.println();
    }
}
a

Compiler output:
Main.java:53: error: reached end of file while parsing
a
^
1 error
Language: Java

import java.util.Scanner;
class Node{
	Node prev;
	Node next;
	int n;
	Node(){
		prev=this;
		next=this;
	}
	Node(Node prev,Node next,int data){
		n=data;
		this.prev=prev;
		this.next=next;
	}
}
public class DoublyLinkedList {
	static Node head=new Node();
	static Node crnt=head;
	
	static void add(int x){
		Node tmp=new Node(crnt,crnt.next,x);
		crnt.next=crnt.next.prev=tmp;
		crnt=tmp;
	}
	
	static void insert(int x){
		crnt=head;
		add(x);
	}
	
	static boolean isEmpty(){
		return head.next==head;
	}
	
	static void removeCurrentNode(){
		if(!isEmpty()){
			crnt.prev.next=crnt.next;
			crnt.next.prev=crnt.prev;
			crnt=crnt.prev;
		}
	}
	
	static void deleteFirst(){//リストの先頭の要素を削除
		crnt=head.next;
		removeCurrentNode();
		
	}
	
	static void deleteLast(){
		crnt=head.prev;
		removeCurrentNode();
	}
	
	static void deleteX(int x){
		crnt=head.next;
		while(crnt!=head){
			if(crnt.n==x){
				removeCurrentNode();
				break;
			}
			crnt=crnt.next;
		}
	}
	
	static void output(){
		crnt=head.next;
		if(!isEmpty()){
			System.out.print(crnt.n);
			crnt=crnt.next;
			while(crnt!=head){
				System.out.print(" "+crnt.n);
				crnt=crnt.next;
			}
			System.out.println();
		}
	}
	
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		String s;
		int x;
		int n=scan.nextInt();
		for(int i=0;i<n;i++){
			s=scan.next();
			if(s.equals("insert")){
				x=scan.nextInt();
				insert(x);
			}else if(s.equals("delete")){
				x=scan.nextInt();
				deleteX(x);
			}else if(s.equals("deleteFirst")){
				deleteFirst();
			}else{
				deleteLast();
			}
		}
		output();
		scan.close();
	}

}

Compiler output:
Main.java:16: error: class DoublyLinkedList is public, should be declared in a file named DoublyLinkedList.java
public class DoublyLinkedList {
       ^
1 error
Language: Java

import java.util.Scanner;
import java.util.ArrayDeque;
public class DoublyLinkedListB {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		ArrayDeque<Integer> ad=new ArrayDeque<Integer>(2000000);
		
		int n=scan.nextInt();
		int key;
		String command;
		for(int i=0;i<n;i++){
			command=scan.next();
			if(command.equals("insert")){
				key=scan.nextInt();
				ad.addFirst(key);
			}else if(command.equals("delete")){
				key=scan.nextInt();
				ad.removeFirstOccurrence(key);
			}else if(command.equals("deleteFirst")){
				ad.removeFirst();
			}else{
				ad.removeLast();
			}
		}
		key=0;
		while(!ad.isEmpty()){
			if(key==0){
				System.out.print(ad.pollFirst());
				key++;
			}else{
				System.out.print(" "+ad.pollFirst());
			}
		}
		System.out.println();
		scan.close();
	}

}

Compiler output:
Main.java:3: error: class DoublyLinkedListB is public, should be declared in a file named DoublyLinkedListB.java
public class DoublyLinkedListB {
       ^
1 error
Language: C

#include<cstdio>  
#include<cstdlib>
#include<cstring>
 
struct Node{
int key;
Node *next,*prev;
};
 
Node *nil;
 
Node* listSearch(int key){
Node *cur=nil->next;
while(cur!=nil&&cur->key!=key){
cur=cur->next;
}
return cur;
}
 
void init(){
nil=(Node *)malloc(sizeof(Node));
nil->next=nil;
nil->prev=nil;
}
 
void printList(){
Node *cur=nil->next;
int isf=0;
while(1){
if(cur==nil) break;
if(isf++>0) printf(" ");
printf("%d",cur->key);
cur=cur->next;
}
printf("\n");
}
 
void deleteNode(Node *t){
if(t==nil) return;
t->prev->next=t->next;
t->next->prev=t->prev;
free(t);
}
 
void deleteFirst(){
deleteNode(nil->next);
}
 
void deleteLast(){
 deleteNode(nil->prev);
 }
  
 void deleteKey(int key){
  
 deleteNode(listSearch(key));
 }
  
 void insert(int key){
 Node *x=(Node *)malloc(sizeof(Node));
 x->key=key;
 x->next=nil->next;
 nil->next->prev=x;
 nil->next=x;
 x->prev=nil;
 }
  
 int main(){
 int key,n,i;
 int size=0;
 char com[20];
 int np=0,nd=0;
 scanf("%d",&n);
 init();
    for(i=0;i<n;i++){
 scanf("%s%d",com,&key);
 if(com[0]=='i'){ insert(key);np++;size++;
}
else if(com[0]=='d'){
if(strlen(com)>6){
if(com[6]=='F') deleteFirst();
else if(com[6]=='L') deleteLast();
}else{
deleteKey(key);nd++;
}
size--;
}
}
 
printList();
 
return 0;
}


Compiler output:
main.c:1:9: fatal error: cstdio: No such file or directory
    1 | #include<cstdio>
      |         ^~~~~~~~
compilation terminated.
Language: C

#include<cstdio>
#include<cstdlib>
#include<cstring>

struct Node{
	int key;
	Node *next,*prev;
};

Node *nil;

Node* listSearch(int key){
	Node *cur = nil->next;
	while(cur != nil && cur->key != key){
		cur = cur->next;
	}
	return cur;
}

void init(){
	nil = (Node *)malloc(sizeof(Node));
	nil->next = nil;
	nil->orev =nil;
}

void printlist(){
	Node *cur = nil->next;
	int isf = 0;
	while( 1 ){
		if(cur == nil)break;
		if(isf++ > 0)printf(" ");
		printf("%d",cur->key);
        cur = cur->next;
	}
	printf("\n");
}

void deleteNode(Node *t){
	if(t == nil)return;
	t->prev->next = t->next;
	t->next->prev = t->prev;
	free(t);
}

void deleteFirst(){
	deleteNode(nil->next);
}

void deleteLast(){
	deleteNode(nil->prev);
}

void deletekey(int key){
	
	deleteNode(listSearch(key));
}

void insert(int key){
	Node *x = (Node *)malloc(sizeof(Node));
	x->key = key;
	
	x->next = nil->next;
	nil->next->prev = x;
	nil->next = x;
	x->prev = nil;
}

int main(){
	int key,n,i;
	int size = 0;
	char com[20];
	int np = 0, nd = 0;
	scanf("%d",&n);
	init();
	for(i = 0; i < n; i++)
	scanf("%s%d",com,&key);
		if(com[0] == 'i'){ insert(key); np++; size++; }
	else if(com[0] =='d'){
		if(strlen(com) > 6){
			if(com[6] == 'F')deleteFirst();
				else if(com[6] == 'L')deleteLast();
}else{
	deletekey(key); nd++;
}
size--;
	}
}

prinList();

return 0;
}
	



Compiler output:
main.c:1:9: fatal error: cstdio: No such file or directory
    1 | #include<cstdio>
      |         ^~~~~~~~
compilation terminated.
Language: C

#include<cstdio>
#include<cstdlib>
#include<cstring>

struct Node{
	int key;
	Node *next,*prev;
};

Node *nil;

Node* listSearch(int key){
	Node *cur = nil->next;
	while(cur != nil && cur->key != key){
		cur = cur->next;
	}
	return cur;
}

void init(){
	nil = (Node *)malloc(sizeof(Node));
	nil->next = nil;
	nil->orev =nil;
}

void printlist(){
	Node *cur = nil->next;
	int isf = 0;
	while( 1 ){
		if(cur == nil)break;
		if(isf++ > 0)printf(" ");
		printf("%d",cur->key);
        cur = cur->next;
	}
	printf("\n");
}

void deleteNode(Node *t){
	if(t == nil)return;
	t->prev->next = t->next;
	t->next->prev = t->prev;
	free(t);
}

void deleteFirst(){
	deleteNode(nil->next);
}

void deleteLast(){
	deleteNode(nil->prev);
}

void deletekey(int key){
	
	deleteNode(listSearch(key));
}

void insert(int key){
	Node *x = (Node *)malloc(sizeof(Node));
	x->key = key;
	
	x->next = nil->next;
	nil->next->prev = x;
	nil->next = x;
	x->prev = nil;
}

int main(){
	int key,n,i;
	int size = 0;
	char com[20];
	int np = 0, nd = 0;
	scanf("%d",&n);
	init();
	for(i = 0; i < n; i++)
	scanf("%s%d",com,&key);
		if(com[0] == 'i'){ insert(key); np++; size++; }
	else if(com[0] =='d'){
		if(strlen(com) > 6){
			if(com[6] == 'F')deleteFirst();
				else if(com[6] == 'L')deleteLast();
}else{
	deletekey(key); nd++;
}
size--;
	}
}

printList();

return 0;
}
	



Compiler output:
main.c:1:9: fatal error: cstdio: No such file or directory
    1 | #include<cstdio>
      |         ^~~~~~~~
compilation terminated.
Language: C

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

#define LISTMAX 1000000

struct command {
	char str[20];
	int key;
};

class dlList {
private:
	int list[LISTMAX];
	int head, num;
public:
	dlList();
	void Ins(int);
	void Del(int);
	void DelFirst();
	void DelLast();
	void ShowList();
	void show();
};

dlList::dlList()
	:list()
	,head(0),
	num(0)
{}

void dlList::Ins(int x)
{
	this->head = (head + LISTMAX - 1) % LISTMAX;
	this->num++;
	this->list[head] = x;
	return;
}

void dlList::Del(int x)
{
	int flag = 0;
	for (int i = 0; i < this->num; i++)
		if (list[(head + i) % LISTMAX] == x && !flag)
			flag = 1;
		else if (flag)
			list[(head + i - 1 + LISTMAX) % LISTMAX] = list[(head + i) % LISTMAX];
	this->num -= flag;

	return;
}

void dlList::DelFirst()
{
	this->head = (this->head + 1) % LISTMAX;
	this->num--;
	return;
}

void dlList::DelLast()
{
	this->num--;
	return;
}

void dlList::ShowList()
{
	int tmp;
	tmp = this->head;
	for (int i = 0; i < this->num; i++)
	{
		if (i)
			cout << " ";
		cout << this->list[tmp];
		tmp = (tmp + 1) % LISTMAX;
	}
	cout << endl;
	return;
}

int main()
{
	int n;
	dlList dll;
	command tmp;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> tmp.str;
		if (!strcmp(tmp.str, "insert"))
		{
			cin >> tmp.key;
			dll.Ins(tmp.key);
		}
		else if (!strcmp(tmp.str, "delete"))
		{
			cin >> tmp.key;
			dll.Del(tmp.key);
		}
		else if (!strcmp(tmp.str, "deleteFirst"))
			dll.DelFirst();
		else
			dll.DelLast();
	}
	dll.ShowList();

	return 0;
}


Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

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

struct Node
{
	int data;
	Node* next;
	Node* prev;
};

class List
{
private:
	Node* mother;
public:
    List()
    {
    	mother = new Node;
    	mother->data = -1;
    	mother->next = this->mother;
    	mother->prev = this->mother;
    }

    ~List()
    {
    	Node *tmp;
    	tmp = mother->next;
    	while (1)
    	{
	    	tmp = tmp->next;
    		delete tmp->prev;
	    	if (tmp == mother)
	    		break;
	    }
	    delete mother;
    }

    void Ins(int x)
    {
	    Node *tmp;
    	tmp = this->mother->next;
    	this->mother->next = new Node;
	    this->mother->next->data = x;
    	this->mother->next->next = tmp;
	    this->mother->next->prev = mother;
    	tmp->prev = mother->next;
	
	    return;
    }

    void Del(int x)
    {
    	Node *tmp;
    	tmp = this->mother->next;
    	while (tmp != this->mother)
    	{
    		if (tmp->data == x)
    		{
    			tmp->prev->next = tmp->next;
    			tmp->next->prev = tmp->prev;
    			delete tmp;
    			break;
    		}
    		tmp = tmp->next;
    	}
    	return;
    }
    
    void DelFirst()
    {
    	Node *tmp;
    	tmp = this->mother->next;
    	tmp->next->prev = mother;
    	this->mother->next = tmp->next;
    	delete tmp;
    }

    void DelLast()
    {
    	Node *tmp;
    	tmp = this->mother->prev;
    	this->mother->prev = tmp->prev;
    	tmp->prev->next = mother;
    	delete tmp;
    }

    void Show()
    {
    	Node *tmp;
    	tmp = mother->next;
    	cout << tmp->data;
    	tmp = tmp->next;
    	while (tmp != mother)
    	{
    		cout << " " << tmp->data;
    		tmp = tmp->next;
    	}
    	cout << endl;
    	return;
    }
};


int main()
{
	int n, x;
	char command[20];
	List list;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> command;
		if (!strcmp(command, "insert"))
		{
			cin >> x;
			list.Ins(x);
		}
		else if (!strcmp(command, "delete"))
		{
			cin >> x;
			list.Del(x);
		}
		else if (!strcmp(command, "deleteFirst"))
			list.DelFirst();
		else
			list.DelLast();
	}
	list.Show();

	return 0;
}


Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

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

struct Node
{
	int data;
	Node* next;
	Node* prev;
};

class List
{
private:
	Node* mother;
public:
    List()
    {
    	mother = new Node;
    	mother->data = -1;
    	mother->next = this->mother;
    	mother->prev = this->mother;
    }

    ~List()
    {
    	Node *tmp;
    	tmp = mother->next;
    	while (1)
    	{
	    	tmp = tmp->next;
    		delete tmp->prev;
	    	if (tmp == mother)
	    		break;
	    }
	    delete mother;
    }

    void Ins(int x)
    {
	    Node *tmp;
    	tmp = this->mother->next;
    	this->mother->next = new Node;
	    this->mother->next->data = x;
    	this->mother->next->next = tmp;
	    this->mother->next->prev = mother;
    	tmp->prev = mother->next;
	
	    return;
    }

    void Del(int x)
    {
    	Node *tmp;
    	tmp = this->mother->next;
    	while (tmp != this->mother)
    	{
    		if (tmp->data == x)
    		{
    			tmp->prev->next = tmp->next;
    			tmp->next->prev = tmp->prev;
    			delete tmp;
    			break;
    		}
    		tmp = tmp->next;
    	}
    	return;
    }
    
    void DelFirst()
    {
    	Node *tmp;
    	tmp = this->mother->next;
    	tmp->next->prev = mother;
    	this->mother->next = tmp->next;
    	delete tmp;
    }

    void DelLast()
    {
    	Node *tmp;
    	tmp = this->mother->prev;
    	this->mother->prev = tmp->prev;
    	tmp->prev->next = mother;
    	delete tmp;
    }

    void Show()
    {
    	Node *tmp;
    	tmp = mother->next;
    	cout << tmp->data;
    	tmp = tmp->next;
    	while (tmp != mother)
    	{
    		cout << " " << tmp->data;
    		tmp = tmp->next;
    	}
    	cout << endl;
    	return;
    }
};


int main()
{
	int n, x;
	char command[20];
	List list;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> command;
		if (command[0] == 'i')
		{
			cin >> x;
			list.Ins(x);
		}
		else if (command[6] == '\0')
		{
			cin >> x;
			list.Del(x);
		}
		else if (command[6] == 'F')
			list.DelFirst();
		else
			list.DelLast();
	}
	list.Show();

	return 0;
}


Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

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

 struct node{
            int key;
            struct node *next;
            struct node *prev;
            };

 typedef struct node *NodePointer;
 NodePointer nil;

 NodePointer listSearch(int key){
       NodePointer i;
       for(i=nil;i->next!=nil;i=i->next){
             if(i->next->key==key)return i->next;
             }
       return NULL;
       }

 void init(){
       nil=malloc(sizeof(struct node));
       nil->next=nil;
       nil->prev=nil;
       }

 void printList(){
       NodePointer cur=nil->next;
       int isf=1;
       while(1){
          if(cur==nil)break;
          if(isf==0)printf(" ");
          printf("%d",cur->key);
          cur=cur->next;
          isf=0;
          }
       printf("\n");
       }

 void deleteNode(NodePointer t){
       t->next->prev=t->prev;
       t->prev->next=t->next;
       free(t);
       }

 void deleteFirst(){
       NodePointer t=nil->next;
       if(t==nil)return;
       deleteNode(t);
       }

 void deleteLast(){
       NodePointer i;
       i=nil->prev;
       deleteNode(i);
       }

 void delete(int key){
       NodePointer i;
       i=listSearch(Key);
       if(i!=NULL)deleteNode(i);
       }

 void insert(int key){
       NodePointer x;
       x=malloc(sizeof(struct node));
       x->key=key;
       x->next=nil->next;
       nil->next->prev=x;
       nil->next=x;
       x->prev=nil;
       }

 int main(){
       int key,n,i;
       int size=0;
       char com[20];
       int np=0,nd=0;scanf("%d",&n);
       init();
       for(i=0;i<n;i++){
            scanf(%s%d",com,&key);
            if(com[0]=='i'){
                 insert(key);
                 np++;
                 size++;
                 }
            else if(com[0]=='d'){
                 if(strlen(com)>6){
                      if(com[6]=='F')deleteFirst();
                      else if(com[6]=='L')deleteLast();    
                      }
                 else {delete(key);nd++}
                 size--;
                 }
            }
       printList();
       return 0;
       }







Compiler output:
main.c: In function 'delete':
main.c:61:21: error: 'Key' undeclared (first use in this function); did you mean 'key'?
   61 |        i=listSearch(Key);
      |                     ^~~
      |                     key
main.c:61:21: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:82:19: error: expected expression before '%' token
   82 |             scanf(%s%d",com,&key);
      |                   ^
main.c:82:23: warning: missing terminating " character
   82 |             scanf(%s%d",com,&key);
      |                       ^
main.c:82:23: error: missing terminating " character
   82 |             scanf(%s%d",com,&key);
      |                       ^~~~~~~~~~~~
main.c:95:19: error: expected ';' before '}' token
   95 |                  }
      |                   ^
      |                   ;
   96 |             }
      |             ~
Language: C

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

 struct node{
            int key;
            struct node *next;
            struct node *prev;
            };

 typedef struct node *NodePointer;
 NodePointer nil;

 NodePointer listSearch(int key){
       NodePointer i;
       for(i=nil;i->next!=nil;i=i->next){
             if(i->next->key==key)return i->next;
             }
       return NULL;
       }

 void init(){
       nil=malloc(sizeof(struct node));
       nil->next=nil;
       nil->prev=nil;
       }

 void printList(){
       NodePointer cur=nil->next;
       int isf=1;
       while(1){
          if(cur==nil)break;
          if(isf==0)printf(" ");
          printf("%d",cur->key);
          cur=cur->next;
          isf=0;
          }
       printf("\n");
       }

 void deleteNode(NodePointer t){
       t->next->prev=t->prev;
       t->prev->next=t->next;
       free(t);
       }

 void deleteFirst(){
       NodePointer t=nil->next;
       if(t==nil)return;
       deleteNode(t);
       }

 void deleteLast(){
       NodePointer i;
       i=nil->prev;
       deleteNode(i);
       }

 void delete(int key){
       NodePointer i;
       i=listSearch(key);
       if(i!=NULL)deleteNode(i);
       }

 void insert(int key){
       NodePointer x;
       x=malloc(sizeof(struct node));
       x->key=key;
       x->next=nil->next;
       nil->next->prev=x;
       nil->next=x;
       x->prev=nil;
       }

 int main(){
       int key,n,i;
       int size=0;
       char com[20];
       int np=0,nd=0;scanf("%d",&n);
       init();
       for(i=0;i<n;i++){
            scanf(%s%d",&com,&key);
            if(com[0]=='i'){
                 insert(key);
                 np++;
                 size++;
                 }
            else if(com[0]=='d'){
                 if(strlen(com)>6){
                      if(com[6]=='F')deleteFirst();
                      else if(com[6]=='L')deleteLast();    
                      }
                 else {delete(key);nd++}
                 size--;
                 }
            }
       printList();
       return 0;
       }







Compiler output:
main.c: In function 'main':
main.c:82:19: error: expected expression before '%' token
   82 |             scanf(%s%d",&com,&key);
      |                   ^
main.c:82:23: warning: missing terminating " character
   82 |             scanf(%s%d",&com,&key);
      |                       ^
main.c:82:23: error: missing terminating " character
   82 |             scanf(%s%d",&com,&key);
      |                       ^~~~~~~~~~~~~
main.c:95:19: error: expected ';' before '}' token
   95 |                  }
      |                   ^
      |                   ;
   96 |             }
      |             ~
Language: C

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

 struct node{
            int key;
            struct node *next;
            struct node *prev;
            };

 typedef struct node *NodePointer;
 NodePointer nil;

 NodePointer listSearch(int key){
       NodePointer i;
       for(i=nil;i->next!=nil;i=i->next){
             if(i->next->key==key)return i->next;
             }
       return NULL;
       }

 void init(){
       nil=malloc(sizeof(struct node));
       nil->next=nil;
       nil->prev=nil;
       }

 void printList(){
       NodePointer cur=nil->next;
       int isf=1;
       while(1){
          if(cur==nil)break;
          if(isf==0)printf(" ");
          printf("%d",cur->key);
          cur=cur->next;
          isf=0;
          }
       printf("\n");
       }

 void deleteNode(NodePointer t){
       t->next->prev=t->prev;
       t->prev->next=t->next;
       free(t);
       }

 void deleteFirst(){
       NodePointer t=nil->next;
       if(t==nil)return;
       deleteNode(t);
       }

 void deleteLast(){
       NodePointer i;
       i=nil->prev;
       deleteNode(i);
       }

 void delete(int key){
       NodePointer i;
       i=listSearch(key);
       if(i!=NULL)deleteNode(i);
       }

 void insert(int key){
       NodePointer x;
       x=malloc(sizeof(struct node));
       x->key=key;
       x->next=nil->next;
       nil->next->prev=x;
       nil->next=x;
       x->prev=nil;
       }

 int main(){
       int key,n,i;
       int size=0;
       char com[20];
       int np=0,nd=0;scanf("%d",&n);
       init();
       for(i=0;i<n;i++){
            scanf("%s%d",&com,&key);
            if(com[0]=='i'){
                 insert(key);
                 np++;
                 size++;
                 }
            else if(com[0]=='d'){
                 if(strlen(com)>6){
                      if(com[6]=='F')deleteFirst();
                      else if(com[6]=='L')deleteLast();    
                      }
                 else {delete(key);nd++};
                 size--;
                 }
            }
       printList();
       return 0;
       }







Compiler output:
main.c: In function 'main':
main.c:93:40: error: expected ';' before '}' token
   93 |                  else {delete(key);nd++};
      |                                        ^
      |                                        ;
Language: C

#include<stdio.h>
#include<strlib.h>

 struct Node{
           Node *prev;
           Node *next;
           int key;
           };

 Node *nil;

 void init(){
          nil=malloc(sizeof(Node));

          nil->prev=nil;
          nil->next=nil;
          }

 void printlist(){
          struct Node *ser=nil->next;
          int isf=0;

          while(1){
                 if(ser==nil)break;
                 if(isf++>0)printf(" ");
                 printf("%d",ser->key);
                 ser=ser->next;
                 }
          pritf("\n");
          }


 int insert(int key){
          struct Node *x=malloc(sizeof(Node));
          x->key=key;

          nil->next->prev=x;
          x->next=nil->next;
          nil->next=x;
          x->prev=nil;
          }

 struct Node *serch(int key){
          struct Node *ser=nil->next;
          while(ser != nil && ser->key != key){
                       ser=ser->next;
                       }
          return ser;
          }
          

 void delete(struct Node *x){
          if(x==nil)return;
          x->prev->next=x->next;
          x->next->prev=x->prev;
          free(x);
          }

 void deletefirst(){
          delete(nil->next);
          }

 int deletelast(){
          delete(nil->prev);
          }

 int deletekey(int key){
          delete(serch(key));
          }

 int main(){
       int i,n,k;
       char com[20];
       init();
       scanf("%d",&n);
       for(i=0;i<n;i++){
                 scanf("%s %d",&com,&k);
                 if(strlen(com)<=6){
                                 if(com[6]=='t'){insert(k);}
                                 else if(com[6]=='e'){deletekey(k);}
                 else if(com[7]=='F'){deletefirst();}
                 else if(com[7]=='L'){deletelast();}
                 }
       printlist();
       return 0:
       }







Compiler output:
main.c:2:9: fatal error: strlib.h: No such file or directory
    2 | #include<strlib.h>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

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

 struct Node{
           struct Node *prev;
           struct Node *next;
           int key;
           };

 typedef struct Node *Nodepointer;

 Nodepointer nil;

 void init(){
          nil=malloc(sizeof(struct Node));

          nil->prev=nil;
          nil->next=nil;
          }

 void printlist(){
          Nodepointer ser=nil->next;
          int isf=1;

          while(1){
                 if(ser==nil)break;
                 if(isf==0)printf(" ");
                 printf("%d",ser->key);
                 ser=ser->next;
                 isf=0;
                 }
          pritf("\n");
          }


 void insert(int key){
          Nodepointer x=malloc(sizeof(struct Node));
          x->key=key;

          nil->next->prev=x;
          x->next=nil->next;
          nil->next=x;
          x->prev=nil;
          }

 Nodepointer serch(int key){
          Nodepointer ser=nil->next;
          while(ser != nil && ser->key != key){
                       ser=ser->next;
                       }
          return ser;
          }
          

 void delete(Nodepointer x){
          if(x==nil)return;
          x->prev->next=x->next;
          x->next->prev=x->prev;
          free(x);
          }

 void deletefirst(){
          delete(nil->next);
          }

 int deletelast(){
          delete(nil->prev);
          }

 int deletekey(int key){
          delete(serch(key));
          }

 int main(){
       int i,n,k;
       char com[20];
       init();
       scanf("%d",&n);
       for(i=0;i<n;i++){
                 scanf("%s %d",&com,&k);
                 if(strlen(com)<=6){
                                 if(com[6]=='t'){insert(k);}
                                 else if(com[6]=='e'){deletekey(k);}
                 else if(com[7]=='F'){deletefirst();}
                 else if(com[7]=='L'){deletelast();}
                 }
       printlist();
       return 0:
       }







Compiler output:
main.c: In function 'printlist':
main.c:32:11: error: implicit declaration of function 'pritf'; did you mean 'printf'? [-Wimplicit-function-declaration]
   32 |           pritf("\n");
      |           ^~~~~
      |           printf
main.c: In function 'main':
main.c:81:21: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
   81 |                  if(strlen(com)<=6){
      |                     ^~~~~~
main.c:3:1: note: include '<string.h>' or provide a declaration of 'strlen'
    2 | #include<stdlib.h>
  +++ |+#include <string.h>
    3 | 
main.c:81:21: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
   81 |                  if(strlen(com)<=6){
      |                     ^~~~~~
main.c:81:21: note: include '<string.h>' or provide a declaration of 'strlen'
main.c:88:16: error: expected ';' before ':' token
   88 |        return 0:
      |                ^
      |                ;
main.c:89:8: error: expected declaration or statement at end of input
   89 |        }
      |        ^
Language: C

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

 struct Node{
           struct Node *prev;
           struct Node *next;
           int key;
           };

 typedef struct Node *Nodepointer;

 Nodepointer nil;

 void init(){
          nil=malloc(sizeof(struct Node));

          nil->prev=nil;
          nil->next=nil;
          }

 void printlist(){
          Nodepointer ser=nil->next;
          int isf=1;

          while(1){
                 if(ser==nil)break;
                 if(isf==0)printf(" ");
                 printf("%d",ser->key);
                 ser=ser->next;
                 isf=0;
                 }
          pritf("\n");
          }


 void insert(int key){
          Nodepointer x=malloc(sizeof(struct Node));
          x->key=key;

          nil->next->prev=x;
          x->next=nil->next;
          nil->next=x;
          x->prev=nil;
          }

 Nodepointer serch(int key){
          Nodepointer ser=nil->next;
          while(ser != nil && ser->key != key){
                       ser=ser->next;
                       }
          return ser;
          }
          

 void delete(Nodepointer x){
          if(x==nil)return;
          x->prev->next=x->next;
          x->next->prev=x->prev;
          free(x);
          }

 void deletefirst(){
          delete(nil->next);
          }

 int deletelast(){
          delete(nil->prev);
          }

 int deletekey(int key){
          delete(serch(key));
          }

 int main(){
       int i,n,k;
       char com[20];
       init();
       scanf("%d",&n);
       for(i=0;i<n;i++){
                 scanf("%s %d",&com,&k);
                 if(strlen(com)<=6){
                                 if(com[6]=='t'){insert(k);}
                                 else if(com[6]=='e'){deletekey(k);}
                                 }
                 else if(com[7]=='F'){deletefirst();}
                 else if(com[7]=='L'){deletelast();}
                 }
       printlist();
       return 0:
       }







Compiler output:
main.c: In function 'printlist':
main.c:32:11: error: implicit declaration of function 'pritf'; did you mean 'printf'? [-Wimplicit-function-declaration]
   32 |           pritf("\n");
      |           ^~~~~
      |           printf
main.c: In function 'main':
main.c:81:21: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
   81 |                  if(strlen(com)<=6){
      |                     ^~~~~~
main.c:3:1: note: include '<string.h>' or provide a declaration of 'strlen'
    2 | #include<stdlib.h>
  +++ |+#include <string.h>
    3 | 
main.c:81:21: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
   81 |                  if(strlen(com)<=6){
      |                     ^~~~~~
main.c:81:21: note: include '<string.h>' or provide a declaration of 'strlen'
main.c:89:16: error: expected ';' before ':' token
   89 |        return 0:
      |                ^
      |                ;
Language: C

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

 struct Node{
           struct Node *prev;
           struct Node *next;
           int key;
           };

 typedef struct Node *Nodepointer;

 Nodepointer nil;

 void init(){
          nil=malloc(sizeof(struct Node));

          nil->prev=nil;
          nil->next=nil;
          }

 void printlist(){
          Nodepointer ser=nil->next;
          int isf=1;

          while(1){
                 if(ser==nil)break;
                 if(isf==0)printf(" ");
                 printf("%d",ser->key);
                 ser=ser->next;
                 isf=0;
                 }
          pritf("\n");
          }


 void insert(int key){
          Nodepointer x=malloc(sizeof(struct Node));
          x->key=key;

          nil->next->prev=x;
          x->next=nil->next;
          nil->next=x;
          x->prev=nil;
          }

 Nodepointer serch(int key){
          Nodepointer ser=nil->next;
          while(ser != nil && ser->key != key){
                       ser=ser->next;
                       }
          return ser;
          }
          

 void delete(Nodepointer x){
          if(x==nil)return;
          x->prev->next=x->next;
          x->next->prev=x->prev;
          free(x);
          }

 void deletefirst(){
          delete(nil->next);
          }

 int deletelast(){
          delete(nil->prev);
          }

 int deletekey(int key){
          delete(serch(key));
          }

 int main(){
       int i,n,k;
       char com[20];
       init();
       scanf("%d",&n);
       for(i=0;i<n;i++){
                 scanf("%s %d",&com,&k);
                 if(strlen(com)<=6){
                                 if(com[6]=='t'){insert(k);}
                                 else if(com[6]=='e'){deletekey(k);}
                                 }
                 else if(com[7]=='F'){deletefirst();}
                 else if(com[7]=='L'){deletelast();}
                 }
       printlist();
       return 0;
       }







Compiler output:
main.c: In function 'printlist':
main.c:32:11: error: implicit declaration of function 'pritf'; did you mean 'printf'? [-Wimplicit-function-declaration]
   32 |           pritf("\n");
      |           ^~~~~
      |           printf
main.c: In function 'main':
main.c:81:21: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
   81 |                  if(strlen(com)<=6){
      |                     ^~~~~~
main.c:3:1: note: include '<string.h>' or provide a declaration of 'strlen'
    2 | #include<stdlib.h>
  +++ |+#include <string.h>
    3 | 
main.c:81:21: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
   81 |                  if(strlen(com)<=6){
      |                     ^~~~~~
main.c:81:21: note: include '<string.h>' or provide a declaration of 'strlen'
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
 
struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};
 
typedef struct node * NodePointer;
 
NodePointer nil;
 
NodePointer listSearch(int key){
  NodePointer t;
  for (t = nil->next; t != nil; t = t->next) {
    if (t->key == key) {
      return t;
    }
  }
  return nil;
}
 
void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}
 
void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}
 
void deleteNode(NodePointer t){
  NodePointer a_del = t->next, b_del = t->prev;
  if (a_del == nil) {
    nil->prev = b_del;
    b_del->next = nil;
  } else if (b_del == nil) {
    nil->next = a_del;
    a_del->prev = nil;
  } else {
    a_del->prev = b_del;
    b_del->next = a_del;
  }
  free(t);
}
 
void deleteFirst(){
  deleteNode(nil->next);
}
 
void deleteLast(){
  deleteNode(nil->prev);
}
 
void delete(int key){
  deleteNode(serch(key));
}
 
 
void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;
 
  if (nil->prev == NULL) {
    nil->prev = x;
  }
   
  if (nil->next == NULL) {
    nil->next = x;
    x->prev = nil;
    x->next = nil;
  } else {
    nil->next->prev = x;
    x->next = nil->next;
    x->prev = nil;
    nil->next = x;
  }  
}
 
int main(){
  int key, n, i;
  
  char com[20];
  
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); }
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
        if ( com[6] == 'F' ) deleteFirst();
        else if ( com[6] == 'L' ) deleteLast();
      } else {
        delete(key); 
      }
      
    }
  }
 
  printList();
  return 0;
}


Compiler output:
main.c: In function 'delete':
main.c:68:14: error: implicit declaration of function 'serch'; did you mean 'strchr'? [-Wimplicit-function-declaration]
   68 |   deleteNode(serch(key));
      |              ^~~~~
      |              strchr
main.c:68:14: error: passing argument 1 of 'deleteNode' makes pointer from integer without a cast [-Wint-conversion]
   68 |   deleteNode(serch(key));
      |              ^~~~~~~~~~
      |              |
      |              int
main.c:44:29: note: expected 'NodePointer' {aka 'struct node *'} but argument is of type 'int'
   44 | void deleteNode(NodePointer t){
      |                 ~~~~~~~~~~~~^
Language: C

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

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  /* your code */
  Node* cur = nil->next;
  while( cur != && cur -> key != key){
    cur = cur->next;
  }
  return cur;
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  /* your code */
  if ( t == nil ) return;
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast(){
  /* your code */
  NodePointer t = nil->prev;
  if ( t == nil ) return;
  deleteNode(t);
}

void delete(int key){
  /* your code */
  deleteNode(listSearch(key));
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;

  /* 

   your code 


  */
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	delete(key); nd++; 
      }
      size--;
    }
  }

  printList();
  return 0;
}



Compiler output:
main.c: In function 'listSearch':
main.c:17:3: error: unknown type name 'Node'
   17 |   Node* cur = nil->next;
      |   ^~~~
main.c:17:15: error: initialization of 'int *' from incompatible pointer type 'struct node *' [-Wincompatible-pointer-types]
   17 |   Node* cur = nil->next;
      |               ^~~
main.c:18:23: error: expected ')' before '->' token
   18 |   while( cur != && cur -> key != key){
      |        ~              ^~~
      |                       )
main.c:19:14: error: request for member 'next' in something not a structure or union
   19 |     cur = cur->next;
      |              ^~
main.c:21:10: error: returning 'int *' from a function with incompatible return type 'NodePointer' {aka 'struct node *'} [-Wincompatible-pointer-types]
   21 |   return cur;
      |          ^~~
main.c:18:3: error: label 'cur' used but not defined
   18 |   while( cur != && cur -> key != key){
      |   ^~~~~
Language: C

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

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  /* your code */
  NodePointer cur = nil->next;
  while( cur != && cur -> key != key){
    cur = cur->next;
  }
  return cur;
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  /* your code */
  if ( t == nil ) return;
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast(){
  /* your code */
  NodePointer t = nil->prev;
  if ( t == nil ) return;
  deleteNode(t);
}

void delete(int key){
  /* your code */
  deleteNode(listSearch(key));
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;

  /* 

   your code 


  */
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	delete(key); nd++; 
      }
      size--;
    }
  }

  printList();
  return 0;
}



Compiler output:
main.c: In function 'listSearch':
main.c:18:23: error: expected ')' before '->' token
   18 |   while( cur != && cur -> key != key){
      |        ~              ^~~
      |                       )
main.c:18:3: error: label 'cur' used but not defined
   18 |   while( cur != && cur -> key != key){
      |   ^~~~~
Language: C

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

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  /* your code */
  NodePointer cur = nil->next;
  while( cur != && cur->key != key){
    cur = cur->next;
  }
  return cur;
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  /* your code */
  if ( t == nil ) return;
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast(){
  /* your code */
  NodePointer t = nil->prev;
  if ( t == nil ) return;
  deleteNode(t);
}

void delete(int key){
  /* your code */
  deleteNode(listSearch(key));
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;

  /* 

   your code 


  */
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	delete(key); nd++; 
      }
      size--;
    }
  }

  printList();
  return 0;
}



Compiler output:
main.c: In function 'listSearch':
main.c:18:23: error: expected ')' before '->' token
   18 |   while( cur != && cur->key != key){
      |        ~              ^~
      |                       )
main.c:18:3: error: label 'cur' used but not defined
   18 |   while( cur != && cur->key != key){
      |   ^~~~~
Language: C

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

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;


NodePointer listSearch(int key)
{
  NodePointer x;
  for(x = nil->next;x != nil;x = x->next)
    {
      if(key == x->key)
	{
	  return x;
	}
    }
  return NULL;
}

void init()
{
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if( cur == nil)
      {
	break;
      }
    if(isf == 0)
      {
	printf(" ");
      }
    printf("%d",cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t)
{
  t->prev->next = t->next;
  t->next->prev = t->prev;
}

void deleteFirst()
{
  NodePointer t = nil->next;
  if(t == nil)
    {
      return;
    }
  deleteNode(t);
}

void deleteLast()
{
  NodePointer t = nil->prev;
  if(t == nil)
    {
      return;
    }
  deleteNode(t);
}

void delete(int key)
{
  NodePointer t;
  if(listserch(key) == NULL)
    {
      return;
    }
  t = listSearch(key);
  deleteNode(t);
}

void insert(int key)
{
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;

  x->next = nil ->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}


int main()
{
  int key,n,i;
  int size = 0;
  char com[20];
  int np = 0,nd = 0;
  scanf("%d",&n);
  init();
  for(i = 0;i < n;i++)
    {
      scanf("%s",com);
      if(com[0] == 'i')
	{
	  scanf("%d",&key);
	  insert(key);
	  np++;
	  size++;
	}
      else if (com[0] == 'd')
	{
	  if(strlen(com) > 6)
	    {
	      if(com[6] == 'F')
		{
		  deleteFirst();
		}
	      else if(com[6] == 'L')
		{
		  deleteLast();
		}
	    }
	  else
	    {
	      scanf("%d",&key);
	      delete(key);
	      nd++;
	    }
	  size--;
	}
    }
  printList();
  return 0;
}



Compiler output:
main.c: In function 'delete':
main.c:84:6: error: implicit declaration of function 'listserch'; did you mean 'listSearch'? [-Wimplicit-function-declaration]
   84 |   if(listserch(key) == NULL)
      |      ^~~~~~~~~
      |      listSearch
main.c:84:21: warning: comparison between pointer and integer
   84 |   if(listserch(key) == NULL)
      |                     ^~
Language: C

#include<cstdio>
#include<cstdlib>
#include<cstring>

struct Node{
  int key;
  Node *prev, *next;
};

Node *nil;

Node* listSearch(int key)
{
  Node* cur = nil->next;
  while(cur != nil && cur->key != key)
  {
    cur = cur->next;
  }
  return cur;
}

void init()
{
  nil = (Node*)malloc(sizeof(Node));
  nil->next = nil;
  nil->prev = nil;
}

void printList()
{
  Node *cur = nil->next;
  int i = 0;
  while(1)
  {
    if(cur == nil) break;
    if(i++ > 0) printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
  }
  printf("\n");
}

void deleteNode(Node *t)
{
  if(t == nil)
    return ;
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

void deleteFirst()
{
  deleteNode(nil->next);
}

void deleteLast()
{
  deleteNode(nil->prev);
}

void deleteKey(int key)
{
  deleteNode(listSearch(key));
}

void insert(int key)
{
  Node* x = (Node*)malloc(sizeof(Node));
  x->key = key;
  x->next = nil->next;
  x->prev = nil;
  nil->next->prev = x;
  nil->next = x;
}

int main()
{
  char com[20];
  int np=0, nd=0, n, key, i, size=0;
  scanf("%d", &n);
  init();
  for(i=0; i<n; i++)
  {
    scanf("%s", com);
    if(strlen(com) <= 6)
      scanf("%d", &key);
    if(com[0] == 'i')
    {
      insert(key); np++; size++;
    }
    else if(com[0] == 'd')
    {
      if(strlen(com) > 6)
      {
        if(com[6] == 'F') deleteFirst();
        else if(com[6] == 'L') deleteLast();
      }
      else
      {
        deleteKey(key); nd++;
      }
      size--;   //When key doesn't exist, this can cause size minus 1 by mistake.
    }
  }

  printList();
  return 0;
}



Compiler output:
main.c:1:9: fatal error: cstdio: No such file or directory
    1 | #include<cstdio>
      |         ^~~~~~~~
compilation terminated.