criyle/codenet-compile-errors huggingface dataset:
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->next);
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:
a.cc: In function 'int main()':
a.cc:72:6: error: expected primary-expression before ')' token
   72 |  for(){i=0;i<n;i++){
      |      ^
a.cc:87:3: error: expected primary-expression at end of input
   87 |  }
      |   ^
a.cc:87:3: error: expected ';' at end of input
   87 |  }
      |   ^
      |   ;
a.cc:87:3: error: expected primary-expression at end of input
a.cc:87:3: error: expected ')' at end of input
   87 |  }
      |   ^
      |   )
a.cc:72:5: note: to match this '('
   72 |  for(){i=0;i<n;i++){
      |     ^
a.cc:87:3: error: expected statement at end of input
   87 |  }
      |   ^
a.cc:87:3: error: expected '}' at end of input
a.cc:65:12: note: to match this '{'
   65 |  int main(){
      |            ^
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) {
      printf("\n");
      break;
    }
    if(isf++>0) printf(" ");
    printf("%d",cur->next);
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(){



Compiler output:
a.cc: In function 'int main()':
a.cc:75:6: error: expected primary-expression before ')' token
   75 |  for(){
      |      ^
a.cc:75:8: error: expected primary-expression at end of input
   75 |  for(){
      |        ^
a.cc:75:8: error: expected ';' at end of input
   75 |  for(){
      |        ^
      |        ;
a.cc:75:8: error: expected primary-expression at end of input
a.cc:75:8: error: expected ')' at end of input
   75 |  for(){
      |     ~  ^
      |        )
a.cc:75:8: error: expected statement at end of input
a.cc:75:8: error: expected '}' at end of input
a.cc:68:12: note: to match this '{'
   68 |  int main(){
      |            ^
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct list{
  struct list *next;
  struct list *prev;
  int n;
};
struct list *ls;
void init();
void insert(int);
void delete(int);
void print();
void deleteFirst();
void deleteLast();
int main(){
  int n,i,com;
  char command[13];
  init();
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",command);
    if(!strcmp(command,"deleteFirst"))deleteFirst();
    else if(!strcmp(command,"deleteLast"))deleteLast();
    else{
      scanf("%d",&com);
      if(!strcmp(command,"insert")) insert(com);
      else if(!strcmp(command,"delete"))  delete(com);
    }
  }
  print();
  
  return 0;
}
void init(){
  ls=(struct list *)malloc(sizeof(struct list));
  ls->next=ls;
  ls->prev=ls;
}
void insert(int com){
  struct list *array;
  array=(struct list *)malloc(sizeof(struct list));
  array->n=com;
  ls->next->prev=array;
  array->next=ls->next;
  array->prev=ls;
  ls->next=array;
}
void print(){
  struct list *a=ls->next;
  while(1){
    printf("%d\n",a->n);
    if(a->next==ls)break;
    a=a->next;
  }
}
void delete(int x){
  struct list *a=ls->next;
  while(1){
    if(a==ls)return;
    if(a->n==x){
      a->prev->next=a->next;
      a->next->prev=a->prev;
      free(a);
    }
    a=a->next;
  }
}

void deleteFirst(){
  ls->next=ls->next->next;
  ls->next->prev=ls;
}
void deleteLast(){
  struct list *a;
  for(a=ls->next;a->next!=ls;a=a->next){
  }
  a->prev->next=ls;
  free(a);
}



Compiler output:
a.cc:12:6: error: expected unqualified-id before 'delete'
   12 | void delete(int);
      |      ^~~~~~
a.cc: In function 'int main()':
a.cc:28:50: error: type 'int' argument given to 'delete', expected pointer
   28 |       else if(!strcmp(command,"delete"))  delete(com);
      |                                                 ~^~~~
a.cc: At global scope:
a.cc:57:6: error: expected unqualified-id before 'delete'
   57 | void delete(int x){
      |      ^~~~~~
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct list{
  struct list *next;
  struct list *prev;
  int n;
};
struct list *ls;
void init();
void insert(int,int);
void delete(int);
void print();
void deleteFirst();
void deleteLast();
int main(){
  int n,i,com;
  char command[13];
  init();
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",command);
    if(!strcmp(command,"deleteFirst"))deleteFirst();
    else if(!strcmp(command,"deleteLast"))deleteLast();
    else{
      scanf("%d",&com);
      if(!strcmp(command,"insert")) insert(com,i);
      else if(!strcmp(command,"delete"))  delete(com);
    }
  }
  print();
  
  return 0;
}
void init(){
  ls=(struct list *)malloc(sizeof(struct list));
  ls->next=ls;
  ls->prev=ls;
}
void insert(int com,int i){
  struct list *array;
  array=(struct list *)malloc(sizeof(struct list));
  array->n=com;
  ls->next->prev=array;
  array->next=ls->next;
  array->prev=ls;
  ls->next=array;
  if(i==0)ls->prev=array;
}
void print(){
  struct list *a=ls->next;
  while(1){
    printf("%d\n",a->n);
    if(a->next==ls)break;
    a=a->next;
    free(a->prev);
  }
}
void delete(int x){
  struct list *a=ls->next;
  while(1){
    if(a==ls)return;
    if(a->n==x){
      a->prev->next=a->next;
      a->next->prev=a->prev;
      free(a);
    }
    a=a->next;
  }
}

void deleteFirst(){
  struct list *a=ls->next;
  ls->next=ls->next->next;
  ls->next->prev=ls;
  free(a);
}
void deleteLast(){
  struct list *a;
  for(a=ls->next;a->next!=ls;a=a->next){
  }
  a->prev->next=ls;
  free(a);
}



Compiler output:
a.cc:12:6: error: expected unqualified-id before 'delete'
   12 | void delete(int);
      |      ^~~~~~
a.cc: In function 'int main()':
a.cc:28:50: error: type 'int' argument given to 'delete', expected pointer
   28 |       else if(!strcmp(command,"delete"))  delete(com);
      |                                                 ~^~~~
a.cc: At global scope:
a.cc:59:6: error: expected unqualified-id before 'delete'
   59 | void delete(int x){
      |      ^~~~~~
Language: C++

#include <iostream>
#include <sstream>
#include <cstdio>
#include <stdlib.h>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
struct node{
  int key;
  struct node *next,*prev;
};
node *Nordepointer;


void insert(int key){
  node *temp=(node *)malloc(sizeof(node));
  temp->key=key;
  temp->next=Nordepointer->next;
  Nordepointer->next->prev=temp;
  Nordepointer->next =temp;
  temp->prev = Nordepointer;
}

void freenode(node *temp){
  temp->prev->next=temp->next;
  temp->next->prev=temp->prev;
  free(temp);
}
void searchdelete(int key){
  node *temp;
  bool flag=0;
  for(temp=Nordepointer->next;temp!=Nordepointer;temp=temp->next){
    if(key==temp->key){
      flag=1;
      break;
    }
    //cout<<temp->key<<endl;
  }
  if(flag){
    freenode(temp);
  }
}

void deleteFirst(){
  freenode(Nordepointer->next);
}
void deleteLast(){
  freenode(Nordepointer->prev);

}
int main(){
  int n,key;
  char c[20];
  node *temp;
  Nordepointer =(node *)malloc(sizeof(node));
  Nordepointer->next = Nordepointer;
  Nordepointer->prev = Nordepointer;
  cin>>n;
  for(int i=0;i<n;i++){
    scanf("%s%d",c,&key);
    if(strcmp(c,"insert")==0){
      insert(key);
    }
    else if(strcmp(c,"delete")==0){
      searchdelete(key);
    }
    else if(strcmp(c,"deleteFirst")==0){
      deleteFirst();
    }
    else if(strcmp(c,"deleteLast")==0){
      deleteLast();
    }
  }
  for(temp=Nordepointer->next;temp!=Nordepointer->prev;temp=temp->next){  
    cout<<temp->key<<" ";
  }
  cout<<temp->key;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:64:8: error: 'strcmp' was not declared in this scope
   64 |     if(strcmp(c,"insert")==0){
      |        ^~~~~~
a.cc:9:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    8 | #include <algorithm>
  +++ |+#include <cstring>
    9 | #include <string>
Language: C++

/* 
 * File:   main.c
 * Author: Ivan
 *
 * Created on June 25, 2018, 7:45 PM
 */

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

struct Item {
    int key;
    Item *next, *prev;
};
//typedef struct{
//    int key;
//    Item *next;
//    Item *prev;
//}Item;

Item *null;

Item search(int key);

void init();

void print();

void deleteItem(Item *m);

void insert(int key);

/*
 * 
 */

int main(int argc, char** argv) {
    int key, n;
    char command[50];
    
    scanf("%d", &n);
    
    null = (Item *)malloc(sizeof(Item));
    null->next = null;
    null->prev = null;
    
    for (int i = 0; i < n; ++i)
    {
        scanf("%s%d", command, &key);
        if (command == "insert") { insert(key); }
        else if ( command == "deleteFirst") deleteItem(null->next);
        else if ( command == "deleteLast") deleteItem(null->prev);
        else { deleteItem(search(key)); }
    }
    
    print();
    
    return (EXIT_SUCCESS);
}

Item *search(int key)
{
    Item *current = null->next;
    while ( current != null && current->key != key)
    {
        current = current->next;
    }
    return current;
}

void print()
{
    Item *current = null->next;
    print("%d", current->key);
    while (1)
    {
        if (current == null) break;
        printf(" ");
        printf("%d", current->key);
        current = current->next;
    }
    printf("\n");
}

void deleteItem(Item *m)
{
    if (m == null) return;
    m->prev->next = m->next;
    m->next->prev = m->prev;
    free(m);
}

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



Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:53:33: error: cannot convert 'Item' to 'Item*'
   53 |         else { deleteItem(search(key)); }
      |                           ~~~~~~^~~~~
      |                                 |
      |                                 Item
a.cc:29:23: note:   initializing argument 1 of 'void deleteItem(Item*)'
   29 | void deleteItem(Item *m);
      |                 ~~~~~~^
a.cc: At global scope:
a.cc:61:7: error: ambiguating new declaration of 'Item* search(int)'
   61 | Item *search(int key)
      |       ^~~~~~
a.cc:23:6: note: old declaration 'Item search(int)'
   23 | Item search(int key);
      |      ^~~~~~
a.cc: In function 'void print()':
a.cc:74:10: error: too many arguments to function 'void print()'
   74 |     print("%d", current->key);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:71:6: note: declared here
   71 | void print()
      |      ^~~~~
Language: C++

/* 
 * File:   main.c
 * Author: Ivan
 *
 * Created on June 25, 2018, 7:45 PM
 */

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

struct Item {
    int key;
    Item *next, *prev;
};
//typedef struct{
//    int key;
//    Item *next;
//    Item *prev;
//}Item;

Item *null;

Item search(int key);

void init();

void print();

void deleteItem(Item *m);

void insert(int key);

/*
 * 
 */

//int main(int argc, char** argv) {
int main() {
    int key, n;
    char command[50];
    
    scanf("%d", &n);
    
    null = (Item *)malloc(sizeof(Item));
    null->next = null;
    null->prev = null;
    
    for (int i = 0; i < n; ++i)
    {
        scanf("%s%d", command, &key);
        if (command == "insert") { insert(key); }
        else if ( command == "deleteFirst") deleteItem(null->next);
        else if ( command == "deleteLast") deleteItem(null->prev);
        else { deleteItem(search(key)); }
    }
    
    print();
    
    return (EXIT_SUCCESS);
}

Item *search(int key)
{
    Item *current = null->next;
    while ( current != null && current->key != key)
    {
        current = current->next;
    }
    return current;
}

void print()
{
    Item *current = null->next;
    print("%d", current->key);
    while (1)
    {
        if (current == null) break;
        printf(" ");
        printf("%d", current->key);
        current = current->next;
    }
    printf("\n");
}

void deleteItem(Item *m)
{
    if (m == null) return;
    m->prev->next = m->next;
    m->next->prev = m->prev;
    free(m);
}

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



Compiler output:
a.cc: In function 'int main()':
a.cc:54:33: error: cannot convert 'Item' to 'Item*'
   54 |         else { deleteItem(search(key)); }
      |                           ~~~~~~^~~~~
      |                                 |
      |                                 Item
a.cc:29:23: note:   initializing argument 1 of 'void deleteItem(Item*)'
   29 | void deleteItem(Item *m);
      |                 ~~~~~~^
a.cc: At global scope:
a.cc:62:7: error: ambiguating new declaration of 'Item* search(int)'
   62 | Item *search(int key)
      |       ^~~~~~
a.cc:23:6: note: old declaration 'Item search(int)'
   23 | Item search(int key);
      |      ^~~~~~
a.cc: In function 'void print()':
a.cc:75:10: error: too many arguments to function 'void print()'
   75 |     print("%d", current->key);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:72:6: note: declared here
   72 | void print()
      |      ^~~~~
Language: C++

/* 
 * File:   main.c
 * Author: Ivan
 *
 * Created on June 25, 2018, 7:45 PM
 */

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

struct Item {
    int key;
    Item *next, *prev;
};
//typedef struct{
//    int key;
//    Item *next;
//    Item *prev;
//}Item;

Item *null;

Item *search(int key);

void init();

void print();

void deleteItem(Item *m);

void insert(int key);

/*
 * 
 */

//int main(int argc, char** argv) {
int main() {
    int key, n;
    char command[50];
    
    scanf("%d", &n);
    
    null = (Item *)malloc(sizeof(Item));
    null->next = null;
    null->prev = null;
    
    for (int i = 0; i < n; ++i)
    {
        scanf("%s%d", command, &key);
        if (command == "insert") { insert(key); }
        else if ( command == "deleteFirst") deleteItem(null->next);
        else if ( command == "deleteLast") deleteItem(null->prev);
        else { deleteItem(search(key)); }
    }
    
    print();
    
    return (EXIT_SUCCESS);
}

Item *search(int key)
{
    Item *current = null->next;
    while ( current != null && current->key != key)
    {
        current = current->next;
    }
    return current;
}

void print()
{
    Item *current = null->next;
    print("%d", current->key);
    while (1)
    {
        if (current == null) break;
        printf(" ");
        printf("%d", current->key);
        current = current->next;
    }
    printf("\n");
}

void deleteItem(Item *m)
{
    if (m == null) return;
    m->prev->next = m->next;
    m->next->prev = m->prev;
    free(m);
}

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



Compiler output:
a.cc: In function 'void print()':
a.cc:75:10: error: too many arguments to function 'void print()'
   75 |     print("%d", current->key);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:72:6: note: declared here
   72 | void print()
      |      ^~~~~
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);
}



Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;

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

Node *nil;

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

void insert(int key){
  Node *in;
  in = (Node*)malloc(sizeof(Node));

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

void delFirst(void){
  nil->next=nil->next->next;
  nil->next->prev=nil;
}

void delLast(void){
  Node* i;
  
  for(i=nil; i->next!=nil; i=i->next);
  i->prev->next=nil;
}

void del(int key){
  Node* i;

  for(i=nil->next; i!=nil; i=i->next){
    if(i->key == key){
      i->next->prev=i->prev;
      i->prev->next=i->next;
      break;
    }
  }
}

void print(void){
  for(Node* i=nil; i->next!=nil; i=i->next){
    if(i==nil) printf("%d", i->next->key);
    else printf(" %d", i->next->key);
  }
  printf("\n");
}

int main(void){
  int  n, num;
  char com[12];

  initialize();
  
  scanf("%d", &n);
  for(int i=0; i<n; i++){
    scanf("%s %d", com, &num);
    if(strcmp(com, "insert") == 0) insert(num);
    else if(strcmp(com, "deleteFirst") == 0) delFirst();
    else if(strcmp(com, "deleteLast") == 0) delLast();
    else(strcmp(com, "delete") == 0) del(num); 
  }
  print();

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:73:37: error: expected ';' before 'del'
   73 |     else(strcmp(com, "delete") == 0) del(num);
      |                                     ^~~~
      |                                     ;
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);
}



Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++


#include <iostream>

using std::cout;
using std::cin;
using std::endl;
using std::ostream;

#include <string>

using std::string;

#include <map>
using std::map;

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

ostream &operator<<(ostream &, node *);

struct DLL {
    node *N;

    DLL() : N(new node) {
        N->data = -1;
        N->prev = N;
        N->next = N;
    }

    ~DLL() {}

    node *_insert(int x) {
        node *tmp = new node;
        tmp->data = x;
        tmp->next = N->next;
        tmp->prev = N;

        N->next->prev = tmp;
        N->next = tmp;

        return N;
    }

    node *_delete(int x) {
        for (node *current = N->next; current->data != -1; current = current->next) {
            if (current->data == x) {
                current->prev->next = current->next;
                current->next->prev = current->prev;
                break;
            }
        }
        return N;
    }

    node *_deleteFirst() {
        N->next->next->prev = N;
        N->next = N->next->next;
        return N;
    }

    node *_deleteLast() {
        N->prev->prev->next = N;
        N->prev = N->prev->prev;
        return N;
    }

    void print() {
        bool flag=false;
        for (node *current = N->next; current->data != -1; current = current->next) {
            if(flag){
                cout << " ";
            }
            else{
                flag = true;
            }

            cout << current;
        }
        cout << endl;
    }
};

ostream &operator<<(ostream &out, node *N) {
    return out << N->data;
}

int main() {
    int n;
    cin >> n;

    DLL *list = new DLL;

    map<string, int> op_dict{
            {"insert",      1},
            {"delete",      2},
            {"deleteFirst", 3},
            {"deleteLast",  4}
    };

    for (int i = 0; i < n; ++i) {
        string operation;
        int x;

        cin >> operation;

        switch (op_dict[operation]) {
            case 1:
                cin >> x;
                list->_insert(x);
                break;
            case 2:
                cin >> x;
                list->_delete(x);
                break;
            case 3:
                list->_deleteFirst();
                break;
            case 4:
                list->_deleteLast();
                break;
            default:
        }
    }

    list->print();

}



Compiler output:
a.cc: In function 'int main()':
a.cc:125:9: error: expected primary-expression before '}' token
  125 |         }
      |         ^
Language: C++


#include <iostream>

using std::cout;
using std::cin;
using std::endl;
using std::ostream;

#include <string>
using std::string;

#include <map>
using std::map;

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

struct DLL {
    node *N;

    DLL() : N(new node) {
        N->data = -1;
        N->prev = N;
        N->next = N;
    }

    ~DLL() {}

    node *_insert(int x) {
        node *tmp = new node;
        tmp->data = x;
        tmp->next = N->next;
        tmp->prev = N;

        N->next->prev = tmp;
        N->next = tmp;

        return N;
    }

    node *_delete(int x) {
        for (node *current = N->next; current->data != -1; current = current->next) {
            if (current->data == x) {
                current->prev->next = current->next;
                current->next->prev = current->prev;
                break;
            }
        }
        return N;
    }

    node *_deleteFirst() {
        N->next->next->prev = N;
        N->next = N->next->next;
        return N;
    }

    node *_deleteLast() {
        N->prev->prev->next = N;
        N->prev = N->prev->prev;
        return N;
    }

    void print() {
        bool flag=false;
        for (node *current = N->next; current->data != -1; current = current->next) {
            if(flag){
                cout << " ";
            }
            else{
                flag = true;
            }

            cout << current->data;
        }
        cout << endl;
    }
};

int main() {
    int n;
    cin >> n;

    DLL *list = new DLL;

    for (int i = 0; i < n; ++i) {
        char op[20];
        int x;

        cin >> op;

        if(op[0] == 'i'){
            cin >> x;
            list->_insert(x);
        }else if(op[0] =='d'){
            if (strlen(op) > 6){
                if (op[6] == 'F') list->_deleteFirst();
                else if (op[6] == 'L') list->_deleteLast();
            }
            else{
                cin >> x;
                list->_delete(x);
            }
        }
    }

    list->print();

}



Compiler output:
a.cc: In function 'int main()':
a.cc:99:17: error: 'strlen' was not declared in this scope
   99 |             if (strlen(op) > 6){
      |                 ^~~~~~
a.cc:13:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   12 | #include <map>
  +++ |+#include <cstring>
   13 | using std::map;
Language: C++


#include <iostream>
using std::cout;
using std::cin;
using std::endl;
using std::ostream;

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

struct DLL {
    node *N;

    DLL() : N(new node) {
        N->data = -1;
        N->prev = N;
        N->next = N;
    }

    ~DLL() {}

    node *_insert(int x) {
        node *tmp = new node;
        tmp->data = x;
        tmp->next = N->next;
        tmp->prev = N;

        N->next->prev = tmp;
        N->next = tmp;

        return N;
    }

    node *_delete(int x) {
        for (node *current = N->next; current->data != -1; current = current->next) {
            if (current->data == x) {
                current->prev->next = current->next;
                current->next->prev = current->prev;
                break;
            }
        }
        return N;
    }

    node *_deleteFirst() {
        N->next->next->prev = N;
        N->next = N->next->next;
        return N;
    }

    node *_deleteLast() {
        N->prev->prev->next = N;
        N->prev = N->prev->prev;
        return N;
    }

    void print() {
        bool flag=false;
        for (node *current = N->next; current->data != -1; current = current->next) {
            if(flag){
                cout << " ";
            }
            else{
                flag = true;
            }

            cout << current->data;
        }
        cout << endl;
    }
};

int main() {
    int n;
    cin >> n;

    DLL *list = new DLL;

    for (int i = 0; i < n; ++i) {
        char op[20];
        int x;

        cin >> op;

        if(op[0] == 'i'){
            cin >> x;
            list->_insert(x);
        }else if(op[0] =='d'){
            if (strlen(op) > 6){
                if (op[6] == 'F') list->_deleteFirst();
                else if (op[6] == 'L') list->_deleteLast();
            }
            else{
                cin >> x;
                list->_delete(x);
            }
        }
    }

    list->print();

}



Compiler output:
a.cc: In function 'int main()':
a.cc:92:17: error: 'strlen' was not declared in this scope
   92 |             if (strlen(op) > 6){
      |                 ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <iostream>
  +++ |+#include <cstring>
    3 | using std::cout;
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[0] == 'F' ) deleteFirst():
	  else if ( com[6] == 'L' ) deleteLast();
      } else {
	deleteKey(key); nd++;
      }
      size--;
    }
  }

  printList();

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:78:43: error: expected ';' before ':' token
   78 |         if ( com[0] == 'F' ) deleteFirst():
      |                                           ^
      |                                           ;
Language: C++

#include<iostream>
#include<string>
#include <algorithm>
#include <list>
#include <fstream>
#include <sstream>
using namespace std;
int main(){
	int n;
	std::istream & c_in = cin;

	string s;
	getline(c_in,s);
	sscanf(s.c_str(),"%d",&n);

	std::list<long> dq;
	for(int i=0;i<n;++i){
		getline(c_in,s);

		int value;
		if (s[0] == 'i') {				//"insert"
			sscanf(s.substr(6).c_str(),"%d",&value);
			dq.push_front(value);
		} else if (s[0] == 'd') {		//deletexx
			if (s[6] == ' ') {			//delete
				sscanf(s.substr(6).c_str(),"%d",&value);
				std::list<long>::iterator it = find(dq.begin(),dq.end(),value);
				if (it != dq.end()) {
					dq.erase(it);
				}
			} else if (s[6] == 'F') {	//"deleteFirst"
				if (!dq.empty()) {
					dq.pop_front();
				}
			} else if (s[6] == 'L') {	//"deleteLast"
				if (!dq.empty()) {
					dq.pop_back();
				}
			}
		}
	}
	if (!dq.empty()) {
		std::list<long>::iterator it = dq.begin();
		cout << *it;
		it++;
		char buf[32];
		for(;it != dq.end();++it) {
			//cout << " " << *it;
			sprintf_s(buf,32," %d",*it);
			cout << buf;
		}
	}
	cout << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:25: error: 'sprintf_s' was not declared in this scope; did you mean 'sprintf'?
   49 |                         sprintf_s(buf,32," %d",*it);
      |                         ^~~~~~~~~
      |                         sprintf
Language: C++

#include<iostream>
#include<string>
#include <algorithm>
#include <list>
#include <fstream>
#include <sstream>
using namespace std;
int main(){
	int n;
/*
/*/
	std::istream & c_in = cin;
//*/
	string s;
	getline(c_in,s);
	sscanf(s.c_str(),"%d",&n);

	std::list<long> dq;
	for(int i=0;i<n;++i){
		getline(c_in,s);

		int value;
		if (s[0] == 'i') {				//"insert"
			sscanf(s.substr(6).c_str(),"%d",&value);
			dq.push_front(value);
		} else if (s[0] == 'd') {		//deletexx
			if (s[6] == ' ') {			//delete
				sscanf(s.substr(6).c_str(),"%d",&value);
				std::list<long>::iterator it = find(dq.begin(),dq.end(),value);
				if (it != dq.end()) {
					dq.erase(it);
				}
			} else if (s[6] == 'F') {	//"deleteFirst"
				if (!dq.empty()) {
					dq.pop_front();
				}
			} else if (s[6] == 'L') {	//"deleteLast"
				if (!dq.empty()) {
					dq.pop_back();
				}
			}
		}
	}
	if (!dq.empty()) {
		std::list<long>::iterator it = dq.begin();
		cout << *it;
		it++;
		char buf[32];
		for(;it != dq.end();++it) {
			//cout << " " << *it;
			sprintf_s(buf,32," %d",*it);
			cout << buf;
		}
	}
	cout << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:25: error: 'sprintf_s' was not declared in this scope; did you mean 'sprintf'?
   51 |                         sprintf_s(buf,32," %d",*it);
      |                         ^~~~~~~~~
      |                         sprintf
Language: C++

#include<iostream>
#include<string>
#include <algorithm>
#include <list>
using namespace std;
int main(){
	int n;
	std::istream & c_in = cin;
	string s;
	getline(c_in,s);
	sscanf(s.c_str(),"%d",&n);

	std::list<long> dq;
	for(int i=0;i<n;++i){
		getline(c_in,s);

		int value;
		if (s[0] == 'i') {				//"insert"
			sscanf(s.substr(6).c_str(),"%d",&value);
			dq.push_front(value);
		} else if (s[0] == 'd') {		//deletexx
			if (s[6] == ' ') {			//delete
				sscanf(s.substr(6).c_str(),"%d",&value);
				std::list<long>::iterator it = find(dq.begin(),dq.end(),value);
				if (it != dq.end()) {
					dq.erase(it);
				}
			} else if (s[6] == 'F') {	//"deleteFirst"
				if (!dq.empty()) {
					dq.pop_front();
				}
			} else if (s[6] == 'L') {	//"deleteLast"
				if (!dq.empty()) {
					dq.pop_back();
				}
			}
		}
	}
	if (!dq.empty()) {
		std::list<long>::iterator it = dq.begin();
		cout << *it;
		it++;
		char buf[32];
		for(;it != dq.end();++it) {
			sprintf_s(buf,32," %d",*it);
			cout << buf;
		}
	}
	cout << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:25: error: 'sprintf_s' was not declared in this scope; did you mean 'sprintf'?
   45 |                         sprintf_s(buf,32," %d",*it);
      |                         ^~~~~~~~~
      |                         sprintf
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 cur = nil->next;
	while(1){
		if ( cur == nil ) break;
		if (cur->key == key) return cur;
		cur = cur->next;
	}
	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){
	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(){
	NodePointer t = nil->prev;
	if ( t == nil ) return;
	deleteNode(t);
}

void delete(int key){
	NodePointer t = listSearch(key);
	deleteNode(t);
}


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

	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 {
				delete(key); nd++; 
			}
			size--;
		}
	}
	printList();
	return 0;
}

Compiler output:
a.cc: In function 'void init()':
a.cc:26:21: error: invalid conversion from 'void*' to 'NodePointer' {aka 'node*'} [-fpermissive]
   26 |         nil = malloc(sizeof(struct node));
      |               ~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |                     |
      |                     void*
a.cc: At global scope:
a.cc:63:6: error: expected unqualified-id before 'delete'
   63 | void delete(int key){
      |      ^~~~~~
a.cc: In function 'void insert(int)':
a.cc:71:19: error: invalid conversion from 'void*' to 'NodePointer' {aka 'node*'} [-fpermissive]
   71 |         x = malloc(sizeof(struct node));
      |             ~~~~~~^~~~~~~~~~~~~~~~~~~~~
      |                   |
      |                   void*
a.cc: In function 'int main()':
a.cc:98:40: error: type 'int' argument given to 'delete', expected pointer
   98 |                                 delete(key); nd++;
      |                                       ~^~~~
Language: C++

#include <iostream>
#include <deque>
#include <string>
#include <vector>
using namespace std;
typedef vector <string> svector;
typedef vector <int> ivector;
typedef deque <string> sdeque;

int split(svector &tokens, const string &text, char delim=' '){
	int start = 0, end = 0;
	while ((end = text.find(delim, start)) != string::npos){
		tokens.push_back(text.substr(start, end - start));
		start = end + 1;
	}
	tokens.push_back(text.substr(start));
	return 0;
}

int sdeque_out(sdeque &A){
    int n=A.size();
    for (int i=0; i<n; i++){
        cout << A[i];
        if (i!= n-1) cout<<" ";
        else cout<<endl;
    }
    return 0;
}

int main(void){
	int n;
	string text = "";
	svector strs;
	sdeque que;
	sdeque::iterator pos;
	
	cin >> n;
	getline(cin, text);

	for (int i=0; i<n; i++){
		getline(cin, text);
		strs.clear();
		split(strs, text);

		if (strs[0]== "insert")
			que.push_front(strs[1]);
		else if (strs[0] == "delete"){
			pos = find( que.begin(), que.end(), strs[1] );
			if (pos != que.end()) que.erase(pos);
		}else if (strs[0] == "deleteFirst")
			que.pop_front();
		else if (strs[0] == "deleteLast")
			que.pop_back();
	}

	sdeque_out(que);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:35: error: no matching function for call to 'find(std::deque<std::__cxx11::basic_string<char> >::iterator, std::deque<std::__cxx11::basic_string<char> >::iterator, __gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type&)'
   48 |                         pos = find( que.begin(), que.end(), strs[1] );
      |                               ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:48:35: note:   'std::_Deque_iterator<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char>&, std::__cxx11::basic_string<char>*>' is not derived from 'std::istreambuf_iterator<_CharT>'
   48 |                         pos = find( que.begin(), que.end(), strs[1] );
      |                               ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <cstdlib>
#include <deque>
#include <string>
#include <vector>
using namespace std;
typedef vector <string> svector;
typedef vector <int> ivector;
typedef deque <string> sdeque;

int split(svector &tokens, const string &text, char delim=' '){
	int start = 0, end = 0;
	while ((end = text.find(delim, start)) != string::npos){
		tokens.push_back(text.substr(start, end - start));
		start = end + 1;
	}
	tokens.push_back(text.substr(start));
	return 0;
}

int sdeque_out(sdeque &A){
    int n=A.size();
    for (int i=0; i<n; i++){
        cout << A[i];
        if (i!= n-1) cout<<" ";
        else cout<<endl;
    }
    return 0;
}

int main(void){
	int n;
	string text = "";
	svector strs;
	sdeque que;
	sdeque::iterator pos;
	
	cin >> n;
	getline(cin, text);

	for (int i=0; i<n; i++){
		getline(cin, text);
		strs.clear();
		split(strs, text);

		if (strs[0]== "insert")
			que.push_front(strs[1]);
		else if (strs[0] == "delete"){
			pos = find( que.begin(), que.end(), strs[1] );
			if (pos != que.end()) que.erase(pos);
		}else if (strs[0] == "deleteFirst")
			que.pop_front();
		else if (strs[0] == "deleteLast")
			que.pop_back();
	}

	sdeque_out(que);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:35: error: no matching function for call to 'find(std::deque<std::__cxx11::basic_string<char> >::iterator, std::deque<std::__cxx11::basic_string<char> >::iterator, __gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type&)'
   49 |                         pos = find( que.begin(), que.end(), strs[1] );
      |                               ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:49:35: note:   'std::_Deque_iterator<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char>&, std::__cxx11::basic_string<char>*>' is not derived from 'std::istreambuf_iterator<_CharT>'
   49 |                         pos = find( que.begin(), que.end(), strs[1] );
      |                               ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <deque>
#include <string>
#include <vector>
using namespace std;
typedef vector <string> svector;
typedef vector <int> ivector;
typedef deque <string> sdeque;

int split(svector &tokens, const string &text, char delim=' '){
	int start = 0, end = 0;
	for (int i=0; i<text.size(); i++)
		if (text[i] == delim){
			end = i;
			tokens.push_back(text.substr(start, end - start));
			start = end + 1;
		}
	tokens.push_back(text.substr(start));
	return 0;
}

int sdeque_out(sdeque &A){
    int n=A.size();
    for (int i=0; i<n; i++){
        cout << A[i];
        if (i!= n-1) cout<<" ";
        else cout<<endl;
    }
    return 0;
}

int main(void){
	int n;
	string text = "";
	svector strs;
	sdeque que;
	sdeque::iterator pos;
	
	cin >> n;
	getline(cin, text);

	for (int i=0; i<n; i++){
		getline(cin, text);
		strs.clear();
		split(strs, text);

		if (strs[0]== "insert")
			que.push_front(strs[1]);
		else if (strs[0] == "delete"){
			pos = find( que.begin(), que.end(), strs[1] );
			if (pos != que.end()) que.erase(pos);
		}else if (strs[0] == "deleteFirst")
			que.pop_front();
		else if (strs[0] == "deleteLast")
			que.pop_back();
	}

	sdeque_out(que);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:35: error: no matching function for call to 'find(std::deque<std::__cxx11::basic_string<char> >::iterator, std::deque<std::__cxx11::basic_string<char> >::iterator, __gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type&)'
   50 |                         pos = find( que.begin(), que.end(), strs[1] );
      |                               ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:50:35: note:   'std::_Deque_iterator<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char>&, std::__cxx11::basic_string<char>*>' is not derived from 'std::istreambuf_iterator<_CharT>'
   50 |                         pos = find( que.begin(), que.end(), strs[1] );
      |                               ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <deque>
#include <string>
#include <vector>
using namespace std;
typedef vector <string> svector;
typedef vector <int> ivector;
typedef deque <string> sdeque;

int split(svector &tokens, const string &text, char delim=' '){
	int start = 0, end = 0;
	for (int i=0; i<text.size(); i++)
		if (text[i] == delim){
			end = i;
			tokens.push_back(text.substr(start, end - start));
			start = end + 1;
		}
	tokens.push_back(text.substr(start));
	return 0;
}

int sdeque_out(sdeque &A){
    int n=A.size();
    for (int i=0; i<n; i++){
        cout << A[i];
        if (i!= n-1) cout<<" ";
        else cout<<endl;
    }
    return 0;
}

int main(void){
	int n;
	string text = "";
	svector strs;
	sdeque que;
	
	cin >> n;
	getline(cin, text);

	for (int i=0; i<n; i++){
		getline(cin, text);
		strs.clear();
		split(strs, text);

		if (strs[0]== "insert")
			que.push_front(strs[1]);
		else if (strs[0] == "delete")
			for (int i=0; i<que.size();i++)
				if (que[i] == strs[1]){
					que.erase[i];
					break;
				}
		else if (strs[0] == "deleteFirst")
			que.pop_front();
		else if (strs[0] == "deleteLast")
			que.pop_back();
	}

	sdeque_out(que);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:50: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   51 |                                         que.erase[i];
      |                                                  ^
Language: C++

#include <iostream>
#include <string>
#include <list>
#include <algorithm>

using namespace std;

int main()
{
	int N,n;
	string str;
	list<int> l;
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>str;
		if(str=="deleteFirst"){
			l.erase(l.begin());
		}else if(str=="deleteLast"){
			l.erase(l.end()-1);
		}else if(str=="delete"){
			cin>>n;
			auto it = find(l.begin(),l.end(),n);
			if(it!=l.end()){
				l.erase(it);
			}
		}else{
			cin>>n;
			l.push_front(n);
		}
	}
	cout<<*(l.begin());
	for(auto it = ++l.begin();it!=l.end();it++){
		cout<<' '<<*it;
	}
	cout<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:40: error: no match for 'operator-' (operand types are 'std::__cxx11::list<int>::iterator' and 'int')
   19 |                         l.erase(l.end()-1);
      |                                 ~~~~~~~^~
      |                                      |  |
      |                                      |  int
      |                                      std::__cxx11::list<int>::iterator
In file included from /usr/include/c++/14/string:48,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  618 |     operator-(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note:   template argument deduction/substitution failed:
a.cc:19:41: note:   'std::__cxx11::list<int>::iterator' is not derived from 'const std::reverse_iterator<_Iterator>'
   19 |                         l.erase(l.end()-1);
      |                                         ^
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1790 |     operator-(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note:   template argument deduction/substitution failed:
a.cc:19:41: note:   'std::__cxx11::list<int>::iterator' is not derived from 'const std::move_iterator<_IteratorL>'
   19 |                         l.erase(l.end()-1);
      |                                         ^