Language: C

#include <stdio.h>
#include <ctype.h>
#include <string.h>
 
typedef struct _node {
    int key;
    struct _node *next;
    struct _node *prev;
} NODE, *PNODE;
 
PNODE root;
 
void init(void) {
    root = malloc(sizeof(NODE));
    root->next = root;
    root->prev = root;
}
 
void insert(key) {
    PNODE t = malloc(sizeof(NODE));
    t->key = key;
    t->next = root->next;
    t->prev = root;
    root->next->prev = t;
    root->next = t;
}
 
void deleteNode(PNODE node) {
    if (node == root) {
        return;
    }
    node->next->prev = node->prev;
    node->prev->next = node->next;
    free(node);
}
 
void delete(key) {
    PNODE cur = root->next;
    while (cur != root) {
        if (cur->key == key) {
            deleteNode(cur);
            return;
        }
        cur = cur->next;
    }
}
void deleteFirst(void) {
    deleteNode(root->next);
}
 
void deleteLast(void) {
    deleteNode(root->prev);
}
 
void printNodes(void) {
    PNODE cur = root->next;
    while (1) {
        printf("%d", cur->key);
        cur = cur->next;
        if (cur != root) {
            putchar(' ');
        } else {
            break;
        }
    }
    putchar('\n');
}
 
void release(void) {
    PNODE tmp, cur = root->next;
    while (cur != root) {
        tmp = cur;
        cur = cur->next;
        deleteNode(tmp);        
    }
    free(root);
}
int main(void) {
    char cmd[100];
    int n, i, f;
    int key;
     
    init(); 
     
    scanf("%d", &n);
     
    f = 0;
    while (scanf("%s", cmd) > 0) {
        if (cmd[0] == 'i') {
            f = 1;
        } else if (cmd[0] == 'd') {
            switch (cmd[6]) {
            case '\0':
                f = 2;
                break;
            case 'F':
                deleteFirst();
                break;
            case 'L':
                deleteLast();
                break;
            }
        } else {
            key = atoi(cmd);
            if (f == 1) {
                insert(key);
            } else if (f == 2) {
                delete(key);
            }
        }
    }
     
    printNodes();
     
    release();
     
    return

Compiler output:
main.c: In function 'init':
main.c:14:12: error: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
   14 |     root = malloc(sizeof(NODE));
      |            ^~~~~~
main.c:4:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
    3 | #include <string.h>
  +++ |+#include <stdlib.h>
    4 | 
main.c:14:12: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
   14 |     root = malloc(sizeof(NODE));
      |            ^~~~~~
main.c:14:12: note: include '<stdlib.h>' or provide a declaration of 'malloc'
main.c: In function 'insert':
main.c:19:6: error: type of 'key' defaults to 'int' [-Wimplicit-int]
   19 | void insert(key) {
      |      ^~~~~~
main.c:20:15: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
   20 |     PNODE t = malloc(sizeof(NODE));
      |               ^~~~~~
main.c:20:15: note: include '<stdlib.h>' or provide a declaration of 'malloc'
main.c: In function 'deleteNode':
main.c:34:5: error: implicit declaration of function 'free' [-Wimplicit-function-declaration]
   34 |     free(node);
      |     ^~~~
main.c:34:5: note: include '<stdlib.h>' or provide a declaration of 'free'
main.c:34:5: warning: incompatible implicit declaration of built-in function 'free' [-Wbuiltin-declaration-mismatch]
main.c:34:5: note: include '<stdlib.h>' or provide a declaration of 'free'
main.c: In function 'delete':
main.c:37:6: error: type of 'key' defaults to 'int' [-Wimplicit-int]
   37 | void delete(key) {
      |      ^~~~~~
main.c: In function 'release':
main.c:76:5: warning: incompatible implicit declaration of built-in function 'free' [-Wbuiltin-declaration-mismatch]
   76 |     free(root);
      |     ^~~~
main.c:76:5: note: include '<stdlib.h>' or provide a declaration of 'free'
main.c: In function 'main':
main.c:104:19: error: implicit declaration of function 'atoi' [-Wimplicit-function-declaration]
  104 |             key = atoi(cmd);
      |                   ^~~~
main.c:117:5: error: expected expression at end of input
  117 |     return
      |     ^~~~~~
main.c:117:5: error: expected declaration or statement at end of input