Language: C++

using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

struct Node {
    int value;
    Node *next;
    Node *prev;
};
Node *nil;

void init() {
    nil = new Node();
    nil->next = nil;
    nil->prev = nil;
}

void insert_node(int x) {
    Node *p = new Node;
    p->value = x;

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

Node* search_node(int x) {
    Node *cur = nil->next;
    while(cur != nil && cur->value != x) cur = cur->next;
    return cur;
}

void delete_node(Node *p) {
    if(p == nil) return;
    p->prev->next=p->next;
    p->next->prev=p->prev;
    delete p;
}
void delete_first_node() {
    delete_node(nil->next);
}
void delete_last_node() {
    delete_node(nil->prev);
}
void delete_key_node(int x) {
    delete_node(search_node(x));
}

int main() {
    ios::sync_with_stdio(false);
    init();
    int n;
    string q;
    cin>>n;
    while(n--) {
        int x;
        cin>>q;
        if(q=="insert") {
            cin>>x;
            insert_node(x);
        }
        else if(q=="delete") {
            cin>>x;
            delete_key_node(x);
        }
        else if(q=="deleteFirst") {
            delete_first_node();
        }
        else if(q=="deleteLast") {
            delete_last_node();
        }
    }
    int t=0;
    Node *cur = nil->next;
    while(cur != nil) {
        if(t++) cout<<" ";
        cout<<cur->value;
        cur=cur->next;
    }
    cout<<endl;
    
    return 0;
}

Compiler output:
a.cc:2:9: error: 'pair' does not name a type
    2 | typedef pair<int ,int > P;
      |         ^~~~
a.cc: In function 'int main()':
a.cc:51:5: error: 'ios' has not been declared
   51 |     ios::sync_with_stdio(false);
      |     ^~~
a.cc:54:5: error: 'string' was not declared in this scope
   54 |     string q;
      |     ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | using namespace std;
a.cc:55:5: error: 'cin' was not declared in this scope
   55 |     cin>>n;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:58:14: error: 'q' was not declared in this scope
   58 |         cin>>q;
      |              ^
a.cc:77:17: error: 'cout' was not declared in this scope
   77 |         if(t++) cout<<" ";
      |                 ^~~~
a.cc:77:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:78:9: error: 'cout' was not declared in this scope
   78 |         cout<<cur->value;
      |         ^~~~
a.cc:78:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:81:5: error: 'cout' was not declared in this scope
   81 |     cout<<endl;
      |     ^~~~
a.cc:81:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:81:11: error: 'endl' was not declared in this scope
   81 |     cout<<endl;
      |           ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;