criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<iostream>
#include<list>
#include<string>
#include<sstream>
#include<stdio.h>
using namespace std;
int n;
list<int> l;
list<int>::iterator point(int a){
  for(list<int>::iterator itr = l.begin(); itr != l.end(); itr++) {
        if(*itr == a)return itr;
    }
    return l.end();
}
int main(){
  int n;
  cin >> n;
  for(int i = 0;i<n;i++){
    string s;
    int num;
    scanf("%s"s);
    if(s=="insert"){
      scanf("%d"num);
      l.push_front(num);
    }else if(s== "deleteFirst")l.pop_front();
    else if(s=="deleteLast")l.pop_back();
    else if(s == "delete"){
    scanf("%d"num);
    if(point(num)!=l.end())l.erase(point(num));
    }
  }
  list<int>::iterator enditr = l.end();
  enditr--;
  for(list<int>::iterator itr = l.begin(); itr != enditr; itr++) {
    cout << *itr<<" ";
    }
    cout << *enditr <<endl;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:21:11: error: cannot convert 'std::__cxx11::basic_string<char>' to 'const char*'
   21 |     scanf("%s"s);
      |           ^~~~~
      |           |
      |           std::__cxx11::basic_string<char>
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 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/stdio.h:428:42: note:   initializing argument 1 of 'int scanf(const char*, ...)'
  428 | extern int scanf (const char *__restrict __format, ...) __wur;
      |                   ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
a.cc:23:13: error: unable to find string literal operator 'operator""num' with 'const char [3]', 'long unsigned int' arguments
   23 |       scanf("%d"num);
      |             ^~~~~~~
a.cc:28:11: error: unable to find string literal operator 'operator""num' with 'const char [3]', 'long unsigned int' arguments
   28 |     scanf("%d"num);
      |           ^~~~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main()
{
  vector<int> a;
  int n,x;
  string str;
  cin>>n;
  for(int i=0;i<n;i++)｛
    cin>>str>>x;
    if(str="insert")a.push_back(x);
    if(str="delete")a.remove(x);
    if(str="deleteFirst")a.remove(a[a.size()-1])
    if(str="deleteLast")a.remove(0)
  ｝
  for(int i=0;i<a.size();i++)｛
    cout<<a[a.size()-1-i];
  ｝
return 0;
｝


Compiler output:
a.cc: In function 'int main()':
a.cc:10:23: error: '\U0000ff5b' was not declared in this scope
   10 |   for(int i=0;i<n;i++)｛
      |                       ^~
a.cc:12:11: error: could not convert 'str.std::__cxx11::basic_string<char>::operator=(((const char*)"insert"))' from 'std::__cxx11::basic_string<char>' to 'bool'
   12 |     if(str="insert")a.push_back(x);
      |        ~~~^~~~~~~~~
      |           |
      |           std::__cxx11::basic_string<char>
a.cc:13:11: error: could not convert 'str.std::__cxx11::basic_string<char>::operator=(((const char*)"delete"))' from 'std::__cxx11::basic_string<char>' to 'bool'
   13 |     if(str="delete")a.remove(x);
      |        ~~~^~~~~~~~~
      |           |
      |           std::__cxx11::basic_string<char>
a.cc:13:23: error: 'class std::vector<int>' has no member named 'remove'
   13 |     if(str="delete")a.remove(x);
      |                       ^~~~~~
a.cc:14:11: error: could not convert 'str.std::__cxx11::basic_string<char>::operator=(((const char*)"deleteFirst"))' from 'std::__cxx11::basic_string<char>' to 'bool'
   14 |     if(str="deleteFirst")a.remove(a[a.size()-1])
      |        ~~~^~~~~~~~~~~~~~
      |           |
      |           std::__cxx11::basic_string<char>
a.cc:14:28: error: 'class std::vector<int>' has no member named 'remove'
   14 |     if(str="deleteFirst")a.remove(a[a.size()-1])
      |                            ^~~~~~
a.cc:17:15: error: 'i' was not declared in this scope
   17 |   for(int i=0;i<a.size();i++)｛
      |               ^
a.cc:19:3: error: '\U0000ff5d' was not declared in this scope
   19 |   ｝
      |   ^~
a.cc:21:3: error: expected ';' at end of input
   21 | ｝
      |   ^
      |   ;
a.cc:21:3: error: expected '}' at end of input
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main()
{
  vector<int> a;
  int n,x;
  string str;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>str>>x;
    if(str="insert")a.push_back(x);
    if(str="delete")a.remove(x);
    if(str="deleteFirst")a.remove(a[a.size()-1]);
    if(str="deleteLast")a.remove(0);
  }
  for(int i=0;i<a.size();i++){
    cout<<a[a.size()-1-i];
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: could not convert 'str.std::__cxx11::basic_string<char>::operator=(((const char*)"insert"))' from 'std::__cxx11::basic_string<char>' to 'bool'
   12 |     if(str="insert")a.push_back(x);
      |        ~~~^~~~~~~~~
      |           |
      |           std::__cxx11::basic_string<char>
a.cc:13:11: error: could not convert 'str.std::__cxx11::basic_string<char>::operator=(((const char*)"delete"))' from 'std::__cxx11::basic_string<char>' to 'bool'
   13 |     if(str="delete")a.remove(x);
      |        ~~~^~~~~~~~~
      |           |
      |           std::__cxx11::basic_string<char>
a.cc:13:23: error: 'class std::vector<int>' has no member named 'remove'
   13 |     if(str="delete")a.remove(x);
      |                       ^~~~~~
a.cc:14:11: error: could not convert 'str.std::__cxx11::basic_string<char>::operator=(((const char*)"deleteFirst"))' from 'std::__cxx11::basic_string<char>' to 'bool'
   14 |     if(str="deleteFirst")a.remove(a[a.size()-1]);
      |        ~~~^~~~~~~~~~~~~~
      |           |
      |           std::__cxx11::basic_string<char>
a.cc:14:28: error: 'class std::vector<int>' has no member named 'remove'
   14 |     if(str="deleteFirst")a.remove(a[a.size()-1]);
      |                            ^~~~~~
a.cc:15:11: error: could not convert 'str.std::__cxx11::basic_string<char>::operator=(((const char*)"deleteLast"))' from 'std::__cxx11::basic_string<char>' to 'bool'
   15 |     if(str="deleteLast")a.remove(0);
      |        ~~~^~~~~~~~~~~~~
      |           |
      |           std::__cxx11::basic_string<char>
a.cc:15:27: error: 'class std::vector<int>' has no member named 'remove'
   15 |     if(str="deleteLast")a.remove(0);
      |                           ^~~~~~
Language: C++

#include <list>
#include <string>
using namespace std;
#define ll long long
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    string com;
    int key;
    list<ll> lst;
    list<ll>::iterator it,i=lst.end();
    while(n--){
        cin>>com;
        if(com=="insert"){
            cin>>key;
            lst.push_front(key);
        }
        else if(com=="delete"){
            cin>>key;
            for(it=lst.begin();it!=i;it++){
                if(*it==key){
                    lst.erase(it);
                    break;
                }
            }
        }
        else if(com=="deleteFirst") lst.pop_front();
        else                        lst.pop_back();
         
    }
    i--;
    for(it=lst.begin();it!=i;it++)  cout<<*it<<" ";
    cout<<*i<<"\n";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope
    6 |     cin.tie(0);
      |     ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <string>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:7:10: error: incomplete type 'std::ios' {aka 'std::basic_ios<char>'} used in nested name specifier
    7 |     ios::sync_with_stdio(false);
      |          ^~~~~~~~~~~~~~~
a.cc:34:37: error: 'cout' was not declared in this scope
   34 |     for(it=lst.begin();it!=i;it++)  cout<<*it<<" ";
      |                                     ^~~~
a.cc:34:37: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:35:5: error: 'cout' was not declared in this scope
   35 |     cout<<*i<<"\n";
      |     ^~~~
a.cc:35:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main()
{
  vector<int> a;
  int n,x;
  string str;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>str>>x;
    if(str=="insert")a.push_back(x);
    if(str=="delete")a.erase(remove(a.begin(),a.end(),x),a.end());
    if(str=="deleteFirst")a.erase(remove(a.begin(),a.end(),a[a.size()-1]),a.end());
    if(str=="deleteLast")a.erase(remove(a.begin(),a.end(),a[0]),a.end());
  }
  for(int i=0;i<a.size();i++){
    cout<<a[a.size()-1-i];
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:44: error: cannot convert 'std::vector<int>::iterator' to 'const char*'
   13 |     if(str=="delete")a.erase(remove(a.begin(),a.end(),x),a.end());
      |                                     ~~~~~~~^~
      |                                            |
      |                                            std::vector<int>::iterator
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 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/stdio.h:158:32: note:   initializing argument 1 of 'int remove(const char*)'
  158 | extern int remove (const char *__filename) __THROW;
      |                    ~~~~~~~~~~~~^~~~~~~~~~
a.cc:14:49: error: cannot convert 'std::vector<int>::iterator' to 'const char*'
   14 |     if(str=="deleteFirst")a.erase(remove(a.begin(),a.end(),a[a.size()-1]),a.end());
      |                                          ~~~~~~~^~
      |                                                 |
      |                                                 std::vector<int>::iterator
/usr/include/stdio.h:158:32: note:   initializing argument 1 of 'int remove(const char*)'
  158 | extern int remove (const char *__filename) __THROW;
      |                    ~~~~~~~~~~~~^~~~~~~~~~
a.cc:15:48: error: cannot convert 'std::vector<int>::iterator' to 'const char*'
   15 |     if(str=="deleteLast")a.erase(remove(a.begin(),a.end(),a[0]),a.end());
      |                                         ~~~~~~~^~
      |                                                |
      |                                                std::vector<int>::iterator
/usr/include/stdio.h:158:32: note:   initializing argument 1 of 'int remove(const char*)'
  158 | extern int remove (const char *__filename) __THROW;
      |                    ~~~~~~~~~~~~^~~~~~~~~~
Language: C++

lst=[]

n=int(input())
for i in range(n):
    ts=[x for x in input().split()]
    t=ts[0]
    if t=='insert' or t=='delete':
        s=int(ts[1]) 
        
    if t=='insert':
        lst.insert(0,s)
    elif t=='delete':
        try:
            lst.remove(s)      
        except ValueError:
            pass
        
    elif t=='deleteFirst':
        lst.pop(0)
    elif t=='deleteLast':
        lst.pop(-1)
            
for i in range(0,len(lst)):
    if i!=len(lst)-1:
        print(lst[i],end=' ')
    else: 
        print(lst[i])


Compiler output:
a.cc:7:11: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
    7 |     if t=='insert' or t=='delete':
      |           ^~~~~~~~
a.cc:7:26: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
    7 |     if t=='insert' or t=='delete':
      |                          ^~~~~~~~
a.cc:10:11: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   10 |     if t=='insert':
      |           ^~~~~~~~
a.cc:12:13: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   12 |     elif t=='delete':
      |             ^~~~~~~~
a.cc:18:13: warning: multi-character literal with 11 characters exceeds 'int' size of 4 bytes
   18 |     elif t=='deleteFirst':
      |             ^~~~~~~~~~~~~
a.cc:20:13: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
   20 |     elif t=='deleteLast':
      |             ^~~~~~~~~~~~
a.cc:1:1: error: 'lst' does not name a type
    1 | lst=[]
      | ^~~
Language: C++

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

int list[1000010] = {}, l = 0, i;

void insert(int x){
  list[l] = x;
  l += 1;
}

void del(int x){
  for(i=l-1;i>=0;i--)
    if(list[i] == x){
      for(int j=i;j<l;j++) list[j] = list[j+1];
      l -= 1;
      break;
    }
  }
}

void deleteLast(){
  for(int j=0;j<l;j++) list[j] = list[j+1];
  l -= 1;
}

void deleteFirst(){
  l -= 1;
  list[l] = 0;
}

int main(){
  int n, x;
  string command;
  cin>>n;
  while(n--){
    cin>>command;
    if(command=="insert"){
      cin>>x;
      insert(x);
    }else if(command=="delete"){
      cin>>x;
      del(x);
    }else if(command=="deleteFirst"){
      deleteFirst();
    }else if(command=="deleteLast"){
      deleteLast();
    }
  }
  for(i=l-1;i>=0;i--){
    cout<<list[i];
    if(i)cout<<" ";
  }
  cout<<endl;
  return 0;
}



Compiler output:
a.cc:20:1: error: expected declaration before '}' token
   20 | }
      | ^
Language: C++

#include<iostream>
using namespace std;

class Node{
public:
  Node* prev;
  Node* next;
  int data;
  Node(){
    prev=0;
    next=0;
    data=0;
  }
};

class List{
private:
  Node head;
public:
  List(){
    head.next=&head;
    head.prev=&head;
  }
  int insert(int a){
    Node* p = new Node();

    if(p==0){
      return -1;
    }

    Node* q = &head;
    Node* r = head.next;

    p->prev = q;
    p->next = r;
    p->data = a;

    q->next = p;
    r->prev = p;

    return 0;
  }

  int del(int a){
    Node* p;

    for(p=head.next;p!=&head;p=p->next){
      if(p->data==x){
        break;
      }
    }

    if(p==&head){
      return -2;
    }

    Node* q = p->prev;
    Node* r = p->next;

    q->next = r;
    r->prev = q;

    delete p;

    return 0;
  }

  int deleteFirst(){
    Node* p = head.next;

    if(p==&head){
      return -2;
    }

    Node* q = p->prev;
    Node* r = p->next;

    q->next = r;
    r->prev = q;

    delete p;

    return 0;
  }

  int deleteLast(){
    Node* p = head.prev;

    if(p==&head){
      return -2;
    }

    Node* q = p->prev;
    Node* r = p->next;

    q->next = r;
    r->prev = q;

    delete p;

    return 0;
  }

  void print(){
    for(Node* p=head.next;p!=&head;p=p->next){
      cout << p->data;

      if(p->next!=&head){
        cout << ' ';
      }else{
        cout << endl;
      }
    }
  }
};

int main(){
  List L;

  int n;
  cin >> n;

  for(int i=0;i<n;i++){
    char com[20];
    cin >> com;;

    if(com[0]=='i'){
      int x;
      cin >> x;

      L.insert(x);
    }else if(com[6]=='F'){
      L.deleteFirst();
    }else if(com[6]=='L'){
      L.deleteLast();
    }else{
      int x;
      cin >> x;

      L.del(x);
    }
  }

  L.print();

  return 0;
}



Compiler output:
a.cc: In member function 'int List::del(int)':
a.cc:48:19: error: 'x' was not declared in this scope
   48 |       if(p->data==x){
      |                   ^
Language: C++

#include<cstdio>
#include<stdlib>
#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;
  nix-<prev = nil;
}

void printlist() {
}

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;
  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:2:9: fatal error: stdlib: No such file or directory
    2 | #include<stdlib>
      |         ^~~~~~~~
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;
  nix-<prev = nil;
}

void printlist() {
}

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;
  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:10:6: error: expected initializer before '*' token
   10 | Node *nil;
      |      ^
a.cc: In function 'Node* listSearch(int)':
a.cc:13:15: error: 'nil' was not declared in this scope
   13 |   Node *cur = nil->next;
      |               ^~~
a.cc: In function 'void init()':
a.cc:21:3: error: 'nil' was not declared in this scope
   21 |   nil = (Node *)malloc(sizeof(Node));
      |   ^~~
a.cc:23:3: error: 'nix' was not declared in this scope; did you mean 'unix'?
   23 |   nix-<prev = nil;
      |   ^~~
      |   unix
a.cc:23:7: error: expected primary-expression before '<' token
   23 |   nix-<prev = nil;
      |       ^
a.cc:23:8: error: 'prev' was not declared in this scope
   23 |   nix-<prev = nil;
      |        ^~~~
a.cc: In function 'void deleteNode(Node*)':
a.cc:30:12: error: 'nil' was not declared in this scope
   30 |   if ( t== nil ) return;
      |            ^~~
a.cc: In function 'void deleteFirst()':
a.cc:37:14: error: 'nil' was not declared in this scope
   37 |   deleteNode(nil->next);
      |              ^~~
a.cc: In function 'void deleteLast()':
a.cc:41:14: error: 'nil' was not declared in this scope
   41 |   deleteNode(nil->prev);
      |              ^~~
a.cc: In function 'void insert(int)':
a.cc:51:13: error: 'nil' was not declared in this scope
   51 |   x->next = nil->next;
      |             ^~~
a.cc: In function 'int main()':
a.cc:64:24: error: expected primary-expression before '%' token
   64 |     scanf("%s%d", com, %key)
      |                        ^
a.cc:66:5: error: 'else' without a previous 'if'
   66 |     else if ( com[0] == 'd' ) {
      |     ^~~~
a.cc:77:3: error: 'printList' was not declared in this scope; did you mean 'printlist'?
   77 |   printList();
      |   ^~~~~~~~~
      |   printlist
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;
  nix->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(int key) {
  Node *x = (Node *)malloc(sizeof(Node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = 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 'void init()':
a.cc:23:3: error: 'nix' was not declared in this scope; did you mean 'nil'?
   23 |   nix->prev = nil;
      |   ^~~
      |   nil
a.cc: In function 'void printlist()':
a.cc:36:26: error: a function-definition is not allowed here before '{' token
   36 | void deleteNode(Node *t) {
      |                          ^
a.cc:43:19: error: a function-definition is not allowed here before '{' token
   43 | void deleteFirst(){
      |                   ^
a.cc:47:19: error: a function-definition is not allowed here before '{' token
   47 | void deleteLast() {
      |                   ^
a.cc:51:25: error: a function-definition is not allowed here before '{' token
   51 | void deleteKey(int key) {
      |                         ^
a.cc:55:22: error: a function-definition is not allowed here before '{' token
   55 | void insert(int key) {
      |                      ^
a.cc:63:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   63 | int main() {
      |         ^~
a.cc:63:9: note: remove parentheses to default-initialize a variable
   63 | int main() {
      |         ^~
      |         --
a.cc:63:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:63:12: error: a function-definition is not allowed here before '{' token
   63 | int main() {
      |            ^
a.cc:87:2: error: expected '}' at end of input
   87 | }
      |  ^
a.cc:26:18: note: to match this '{'
   26 | void printlist() {
      |                  ^
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(int key) {
  Node *x = (Node *)malloc(sizeof(Node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = 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 'void printlist()':
a.cc:36:26: error: a function-definition is not allowed here before '{' token
   36 | void deleteNode(Node *t) {
      |                          ^
a.cc:43:19: error: a function-definition is not allowed here before '{' token
   43 | void deleteFirst(){
      |                   ^
a.cc:47:19: error: a function-definition is not allowed here before '{' token
   47 | void deleteLast() {
      |                   ^
a.cc:51:25: error: a function-definition is not allowed here before '{' token
   51 | void deleteKey(int key) {
      |                         ^
a.cc:55:22: error: a function-definition is not allowed here before '{' token
   55 | void insert(int key) {
      |                      ^
a.cc:63:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   63 | int main() {
      |         ^~
a.cc:63:9: note: remove parentheses to default-initialize a variable
   63 | int main() {
      |         ^~
      |         --
a.cc:63:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:63:12: error: a function-definition is not allowed here before '{' token
   63 | int main() {
      |            ^
a.cc:87:2: error: expected '}' at end of input
   87 | }
      |  ^
a.cc:26:18: note: to match this '{'
   26 | void printlist() {
      |                  ^
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(int key) {
  Node *x = (Node *)malloc(sizeof(Node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = 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:24: error: expected primary-expression before '%' token
   72 |     scanf("%s%d", com, %key)
      |                        ^
a.cc:74:5: error: 'else' without a previous 'if'
   74 |     else if ( com[0] == 'd' ) {
      |     ^~~~
a.cc:85:3: error: 'printList' was not declared in this scope; did you mean 'printlist'?
   85 |   printList();
      |   ^~~~~~~~~
      |   printlist
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(int key) {
  Node *x = (Node *)malloc(sizeof(Node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = 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:29: error: expected ';' before 'if'
   72 |     scanf("%s%d", com, &key)
      |                             ^
      |                             ;
   73 |     if ( com[0] == 'i' ) { insert(key); np++; size++; }
      |     ~~                       
a.cc:74:5: error: 'else' without a previous 'if'
   74 |     else if ( com[0] == 'd' ) {
      |     ^~~~
a.cc:85:3: error: 'printList' was not declared in this scope; did you mean 'printlist'?
   85 |   printList();
      |   ^~~~~~~~~
      |   printlist
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(int key) {
  Node *x = (Node *)malloc(sizeof(Node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = 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:85:3: error: 'printList' was not declared in this scope; did you mean 'printlist'?
   85 |   printList();
      |   ^~~~~~~~~
      |   printlist
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:
a.cc: In function 'void printlist()':
a.cc:35:15: error: expected ';' before '}' token
   35 |   printf("\n")
      |               ^
      |               ;
   36 | }
      | ~
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 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;
}



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

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:79:33: error: expected ';' before 'if'
   79 |         scanf("%s%d", com, &key)
      |                                 ^
      |                                 ;
   80 |         if ( com[0] == 'i'){ insert(key); np++; size++; }
      |         ~~                       
a.cc:81:9: error: 'else' without a previous 'if'
   81 |         else if(com[0] == 'd'){
      |         ^~~~
Language: C++

#include<bits/stdc++.h>usingnamespacestd;typedefstructNode{intkey;Node*prev,*next;}Node;Node*nil;voidinit(){nil=(Node*)malloc(sizeof(Node));nil->next=nil->prev=nil;}voidinsertFirst(intkey){Node*x=(Node*)malloc(sizeof(Node));x->key=key;x->next=nil->next;x->prev=nil;nil->next->prev=nil->next=x;}Node*searchKey(intkey){Node*cur=nil->next;while(cur!=nil&&cur->key!=key)cur=cur->next;returncur;}voiddeleteNode(Node*l){if(l==nil)return;l->prev->next=l->next;l->next->prev=l->prev;free(l);}voiddeleteFirst(){deleteNode(nil->next);}voiddeleteLast(){deleteNode(nil->prev);}voiddeleteKey(intkey){deleteNode(searchKey(key));}intn,v;stringcom;intmain(){init();cin>>n;for(inti=0;i<n;++i){cin>>com;if(com.length()==6){cin>>v;if(com[0]=='i')insertFirst(v);elsedeleteKey(v);}else{if(com[6]=='F')deleteFirst();elsedeleteLast();}}for(Node*cur=nil->next;cur!=nil;cur=cur->next){if(cur!=nil->next)cout<<"";cout<<cur->key;}cout<<endl;}


Compiler output:
a.cc:1:41: warning: extra tokens at end of #include directive
    1 | #include<bits/stdc++.h>usingnamespacestd;typedefstructNode{intkey;Node*prev,*next;}Node;Node*nil;voidinit(){nil=(Node*)malloc(sizeof(Node));nil->next=nil->prev=nil;}voidinsertFirst(intkey){Node*x=(Node*)malloc(sizeof(Node));x->key=key;x->next=nil->next;x->prev=nil;nil->next->prev=nil->next=x;}Node*searchKey(intkey){Node*cur=nil->next;while(cur!=nil&&cur->key!=key)cur=cur->next;returncur;}voiddeleteNode(Node*l){if(l==nil)return;l->prev->next=l->next;l->next->prev=l->prev;free(l);}voiddeleteFirst(){deleteNode(nil->next);}voiddeleteLast(){deleteNode(nil->prev);}voiddeleteKey(intkey){deleteNode(searchKey(key));}intn,v;stringcom;intmain(){init();cin>>n;for(inti=0;i<n;++i){cin>>com;if(com.length()==6){cin>>v;if(com[0]=='i')insertFirst(v);elsedeleteKey(v);}else{if(com[6]=='F')deleteFirst();elsedeleteLast();}}for(Node*cur=nil->next;cur!=nil;cur=cur->next){if(cur!=nil->next)cout<<"";cout<<cur->key;}cout<<endl;}
      |                                         ^
a.cc:1:9: fatal error: bits/stdc++.h>usingnamespacest: No such file or directory
    1 | #include<bits/stdc++.h>usingnamespacestd;typedefstructNode{intkey;Node*prev,*next;}Node;Node*nil;voidinit(){nil=(Node*)malloc(sizeof(Node));nil->next=nil->prev=nil;}voidinsertFirst(intkey){Node*x=(Node*)malloc(sizeof(Node));x->key=key;x->next=nil->next;x->prev=nil;nil->next->prev=nil->next=x;}Node*searchKey(intkey){Node*cur=nil->next;while(cur!=nil&&cur->key!=key)cur=cur->next;returncur;}voiddeleteNode(Node*l){if(l==nil)return;l->prev->next=l->next;l->next->prev=l->prev;free(l);}voiddeleteFirst(){deleteNode(nil->next);}voiddeleteLast(){deleteNode(nil->prev);}voiddeleteKey(intkey){deleteNode(searchKey(key));}intn,v;stringcom;intmain(){init();cin>>n;for(inti=0;i<n;++i){cin>>com;if(com.length()==6){cin>>v;if(com[0]=='i')insertFirst(v);elsedeleteKey(v);}else{if(com[6]=='F')deleteFirst();elsedeleteLast();}}for(Node*cur=nil->next;cur!=nil;cur=cur->next){if(cur!=nil->next)cout<<"";cout<<cur->key;}cout<<endl;}
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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->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 deketeKey(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;
    x->prev = nil;
    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++) {
        scnaf("%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:76:9: error: 'scnaf' was not declared in this scope; did you mean 'scanf'?
   76 |         scnaf("%s%d", com, &key);
      |         ^~~~~
      |         scanf
a.cc:86:17: error: 'deleteKey' was not declared in this scope; did you mean 'deketeKey'?
   86 |                 deleteKey(key);
      |                 ^~~~~~~~~
      |                 deketeKey
Language: C++

#include <iostream>
using namespace std;

struct node {
    node *next, *prev;
    int val;
} ;

node nil1;
node nil2;

void insert(int i){
    node *n;
    node *nex;
    nex = nil1.next;
    n = new node;

    nil1.next = n;
    n->prev = &nil1;
    n->next = nex;
    nex->prev = n;
    n->val = i;
}

void deleteNode(int i){
    node *nowa = &nil1;

    while (nowa != &nil2 && nowa->val != i){
        nowa = (*nowa).next;
    }
    nowa->prev->next = nowa->next;
    nowa->next->prev = nowa->prev;
}


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

    for (int i = 0; i < n; ++i) {
        char cmd[100];
        int val;
        cin >> cmd >> val ;
        if(strcmp(cmd, "insert") == 0) {
            insert(val);
        } else if (strcmp(cmd, "delete") == 0) {
            deleteNode(val);
        }
    }

    node *nowa;
    nowa = nil1.next;

    while(nowa != &nil2) {
        cout << nowa->val;
        nowa++;
    }

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:44:12: error: 'strcmp' was not declared in this scope
   44 |         if(strcmp(cmd, "insert") == 0) {
      |            ^~~~~~
a.cc:2:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
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)break;
    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:52: error: type 'int' argument given to 'delete', expected pointer
   28 |         else if(!strcmp(command,"delete"))  delete(com);
      |                                                   ~^~~~
a.cc: At global scope:
a.cc:56:6: error: expected unqualified-id before 'delete'
   56 | void delete(int x){
      |      ^~~~~~
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:74:15: error: stray '`' in program
   74 |    if(com[0]==`i`){insert(key);np++;size++;}
      |               ^
a.cc:74:17: error: stray '`' in program
   74 |    if(com[0]==`i`){insert(key);np++;size++;}
      |                 ^
a.cc:75:20: error: stray '`' in program
   75 |    else if(com[0]==`d`){
      |                    ^
a.cc:75:22: error: stray '`' in program
   75 |    else if(com[0]==`d`){
      |                      ^
a.cc:77:19: error: stray '`' in program
   77 |        if(com[6]==`F`) deleteFirst();
      |                   ^
a.cc:77:21: error: stray '`' in program
   77 |        if(com[6]==`F`) deleteFirst();
      |                     ^
a.cc:78:24: error: stray '`' in program
   78 |        else if(com[6]==`L`) deletelast;
      |                        ^
a.cc:78:26: error: stray '`' in program
   78 |        else if(com[6]==`L`) deletelast;
      |                          ^
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(){
      |            ^