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

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(key){
    Node *x = (Node*)malloc(sizeof(Node));
    x->key = key;
    x->next = nil->key;
    x->prev = nil;
    nil->next->prev = x;
    nil->next = x;
}

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:
a.cc:10:6: error: expected initializer before '*' token
   10 | Node *nil;
      |      ^
a.cc: In function 'Node* listSearch(int)':
a.cc:13:17: error: 'nil' was not declared in this scope
   13 |     Node *cur = nil->next;
      |                 ^~~
a.cc: In function 'void init()':
a.cc:21:5: error: 'nil' was not declared in this scope
   21 |     nil = (Node *)malloc(sizeof(Node));
      |     ^~~
a.cc: In function 'void printList()':
a.cc:27:17: error: 'nil' was not declared in this scope
   27 |     Node *cur = nil->next;
      |                 ^~~
a.cc: In function 'void deleteNode(Node*)':
a.cc:38:13: error: 'nil' was not declared in this scope
   38 |     if(t == nil){
      |             ^~~
a.cc: In function 'void deleteFirst()':
a.cc:47:16: error: 'nil' was not declared in this scope
   47 |     deleteNode(nil->next);
      |                ^~~
a.cc: In function 'void deleteLast()':
a.cc:51:16: error: 'nil' was not declared in this scope
   51 |     deleteNode(nil->prev);
      |                ^~~
a.cc: At global scope:
a.cc:58:6: error: variable or field 'insert' declared void
   58 | void insert(key){
      |      ^~~~~~
a.cc:58:13: error: 'key' was not declared in this scope; did you mean 'key_t'?
   58 | void insert(key){
      |             ^~~
      |             key_t
a.cc: In function 'int main()':
a.cc:77:13: error: 'insert' was not declared in this scope
   77 |             insert(key);
      |             ^~~~~~
a.cc:90:31: error: 'Key' was not declared in this scope; did you mean 'key'?
   90 |                     deleteKey(Key);nd++
      |                               ^~~
      |                               key
a.cc:90:40: error: expected ';' before '}' token
   90 |                     deleteKey(Key);nd++
      |                                        ^
      |                                        ;
   91 |                 }
      |                 ~