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

#include<iostream>
#include<string>
using namespace std;
struct node{
	int x;
	node* pre;
	node* next;
};
void init(node *x) {
	x->pre = x->next = NULL;
}
void Insert(node* head,int x) {
	node *n = new node;
	init(n);
	n->x = x;
	if (head->next == NULL) {
		n->pre = head;
		head->next = n;
	}
	else {
		node* nn = new node;
		nn = head->next;
		n->pre = head;
		head->next = n;
		n->next = nn;
		nn->pre = n;
	}
}
int Delete(node* head, int x) {
	node* n = new node;
	n = head->next;
	for (; n->next != NULL; n = n->next) {
		if (n->x == x) {
			n->pre->next = n->next;
			n->next->pre = n->pre;
			delete n;
			return 0;
		}
	}
	if (n->x == x) {
		n->pre->next = NULL;
		delete n;
		return 0;
	}
	return 1;
}
int DeleteFirst(node* head) {
	if (head->next == NULL)
		return 0;
	else {
		head->next = head->next->next;
	}
	return 1;
}
int DeleteLast(node* head) {
	node* n = new node;
	n = head;
	while (n->next != NULL) {
		n = n->next;
	}
	n->pre->next = NULL;
	delete n;
	return 1;
}
void Print(node *head) {
	node *n = new node;
	n = head->next;
	node *pre = new node;
	while (n->next != NULL) {
		cout << n->x << " ";
		n = n->next;
		pre = n;
	}
	cout << pre->x << endl;
}
void main() {
	node* head=new node;
	init(head);
	string s;
	int x,a;
	cin >> x;
	for (int i = 0; i < x; i++) {
		cin >> s;
		if (s == "insert") {
			cin >> a;
			Insert(head, a);
		}
		else if (s == "delete") {
			cin >> a;
			Delete(head, a);
		}
		else if (s == "deleteFirst"){
			DeleteFirst(head);
		}
		else if (s == "deleteLast") {
			DeleteLast(head);
		}
	}
	Print(head);
}


Compiler output:
a.cc:76:1: error: '::main' must return 'int'
   76 | void main() {
      | ^~~~
Language: C++

#include<iostream>
#include<string>
using namespace std;
struct node{
	int x;
	node* pre;
	node* next;
};
void init(node *x) {
	x->pre = x->next = NULL;
}
void Insert(node* head,int x) {
	node *n = new node;
	init(n);
	n->x = x;
	if (head->next == NULL) {
		n->pre = head;
		head->next = n;
	}
	else {
		node* nn = new node;
		nn = head->next;
		n->pre = head;
		head->next = n;
		n->next = nn;
		nn->pre = n;
	}
}
int Delete(node* head, int x) {
	node* n = new node;
	n = head->next;
	for (; n->next != NULL; n = n->next) {
		if (n->x == x) {
			n->pre->next = n->next;
			n->next->pre = n->pre;
			delete n;
			return 0;
		}
	}
	if (n->x == x) {
		n->pre->next = NULL;
		delete n;
		return 0;
	}
	return 1;
}
int DeleteFirst(node* head) {
	if (head->next == NULL)
		return 0;
	else {
		head->next = head->next->next;
	}
	return 1;
}
int DeleteLast(node* head) {
	node* n = new node;
	n = head;
	while (n->next != NULL) {
		n = n->next;
	}
	n->pre->next = NULL;
	delete n;
	return 1;
}
void Print(node *head) {
	node *n = new node;
	n = head->next;
	node *pre = new node;
	pre = n;
	while (n->next != NULL) {
		cout << n->x << " ";
		n = n->next;
		pre = n;
	}
	cout << pre->x << endl;
}
int main() {
	node* head=new node;
	init(head);
	string s;
	int x,a;
	cin >> x;
	for (int i = 0; i < x; i++) {
		//cin >> s;
		scanf_s("%s", &s);
		if (s == "insert") {
			cin >> a;
			Insert(head, a);
		}
		else if (s == "delete") {
			cin >> a;
			Delete(head, a);
		}
		else if (s == "deleteFirst"){
			DeleteFirst(head);
		}
		else if (s == "deleteLast") {
			DeleteLast(head);
		}
	}
	Print(head);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:85:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   85 |                 scanf_s("%s", &s);
      |                 ^~~~~~~
      |                 scanf
Language: C++

#include<iostream>
#include<stdio.h>
#include<string>
using namespace std;
struct node{
	int x;
	node* pre;
	node* next;
};
void init(node *x) {
	x->pre = x->next = NULL;
}
void Insert(node* head,int x) {
	node *n = new node;
	init(n);
	n->x = x;
	if (head->next == NULL) {
		n->pre = head;
		head->next = n;
	}
	else {
		node* nn = new node;
		nn = head->next;
		n->pre = head;
		head->next = n;
		n->next = nn;
		nn->pre = n;
	}
}
int Delete(node* head, int x) {
	node* n = new node;
	n = head->next;
	for (; n->next != NULL; n = n->next) {
		if (n->x == x) {
			n->pre->next = n->next;
			n->next->pre = n->pre;
			delete n;
			return 0;
		}
	}
	if (n->x == x) {
		n->pre->next = NULL;
		delete n;
		return 0;
	}
	return 1;
}
int DeleteFirst(node* head) {
	if (head->next == NULL)
		return 0;
	else {
		head->next = head->next->next;
	}
	return 1;
}
int DeleteLast(node* head) {
	node* n = new node;
	n = head;
	while (n->next != NULL) {
		n = n->next;
	}
	n->pre->next = NULL;
	delete n;
	return 1;
}
void Print(node *head) {
	node *n = new node;
	n = head->next;
	node *pre = new node;
	pre = n;
	while (n->next != NULL) {
		cout << n->x << " ";
		n = n->next;
		pre = n;
	}
	cout << pre->x << endl;
}
int main() {
	node* head=new node;
	init(head);
	string s;
	int x,a;
	cin >> x;
	for (int i = 0; i < x; i++) {
		//cin >> s;
		scanf_s("%s", &s);
		if (s == "insert") {
			cin >> a;
			Insert(head, a);
		}
		else if (s == "delete") {
			cin >> a;
			Delete(head, a);
		}
		else if (s == "deleteFirst"){
			DeleteFirst(head);
		}
		else if (s == "deleteLast") {
			DeleteLast(head);
		}
	}
	Print(head);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:86:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   86 |                 scanf_s("%s", &s);
      |                 ^~~~~~~
      |                 scanf
Language: C++

#include<iostream>
#include<stdio.h>
#include<string>
using namespace std;
struct node{
	int x;
	node* pre;
	node* next;
};
void init(node *x) {
	x->pre = x->next = NULL;
}
void Insert(node* head,int x) {
	node *n = new node;
	init(n);
	n->x = x;
	if (head->next == NULL) {
		n->pre = head;
		head->next = n;
	}
	else {
		node* nn = new node;
		nn = head->next;
		n->pre = head;
		head->next = n;
		n->next = nn;
		nn->pre = n;
	}
}
int Delete(node* head, int x) {
	node* n = new node;
	n = head->next;
	for (; n->next != NULL; n = n->next) {
		if (n->x == x) {
			n->pre->next = n->next;
			n->next->pre = n->pre;
			delete n;
			return 0;
		}
	}
	if (n->x == x) {
		n->pre->next = NULL;
		delete n;
		return 0;
	}
	return 1;
}
int DeleteFirst(node* head) {
	if (head->next == NULL)
		return 0;
	else {
		head->next = head->next->next;
	}
	return 1;
}
int DeleteLast(node* head) {
	node* n = new node;
	n = head;
	while (n->next != NULL) {
		n = n->next;
	}
	n->pre->next = NULL;
	delete n;
	return 1;
}
void Print(node *head) {
	node *n = new node;
	n = head->next;
	node *pre = new node;
	pre = n;
	while (n->next != NULL) {
		cout << n->x << " ";
		n = n->next;
		pre = n;
	}
	cout << pre->x << endl;
}
int main() {
	node* head=new node;
	init(head);
	string s;
	int x,a;
	cin >> x;
	for (int i = 0; i < x; i++) {
		//cin >> s;
		scanf_s("%s", s);
		if (s == "insert") {
			cin >> a;
			Insert(head, a);
		}
		else if (s == "delete") {
			cin >> a;
			Delete(head, a);
		}
		else if (s == "deleteFirst"){
			DeleteFirst(head);
		}
		else if (s == "deleteLast") {
			DeleteLast(head);
		}
	}
	Print(head);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:86:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   86 |                 scanf_s("%s", s);
      |                 ^~~~~~~
      |                 scanf
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;

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 inint(){
  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 n,i,key;
  char com[20];
  int size = 0;
  int np = 0, nd = 0;
  
  inint();
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    scanf("%s%d", com, &key);
    if(com[0] == 'i'){
      insert(key);
    }else if(com[0] == 'd'){
      if(strlen(com) > 6){
        if(com[6] == 'F'){
          deleteFirst();
        }else if(com[6] == 'L'){
          deleteLast();
        }else{
          deleteKey(key);
        }
      }
    }
  }

  printlist();

  return 0;
}


      


Compiler output:
a.cc: In function 'int main()':
a.cc:84:10: error: 'strlen' was not declared in this scope
   84 |       if(strlen(com) > 6){
      |          ^~~~~~
a.cc:5:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <algorithm>
  +++ |+#include <cstring>
    5 | using namespace std;
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;

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 inint(){
  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 n,i,key;
  char com[20];
  int size = 0;
  int np = 0, nd = 0;
  
  inint();
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    scanf("%s%d", com, &key);
    if(com[0] == 'i'){
      insert(key);
    }else if(com[0] == 'd'){
      if(strlen(com) > 6){
        if(com[6] == 'F'){
          deleteFirst();
        }else if(com[6] == 'L'){
          deleteLast();
        }else{
          deleteKey(key);
        }
      }
    }
  }

  printlist();

  return 0;
}


      



Compiler output:
a.cc: In function 'int main()':
a.cc:84:10: error: 'strlen' was not declared in this scope
   84 |       if(strlen(com) > 6){
      |          ^~~~~~
a.cc:5:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <algorithm>
  +++ |+#include <cstring>
    5 | using namespace std;
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;

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 inint(){
  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 n,i,key;
  char com[20];
  int size = 0;
  int np = 0, nd = 0;
  
  inint();
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    scanf("%s%d", com, &key);
    if(com[0] == 'i'){
      insert(key);
    }else if(com[0] == 'd'){
      if(std::strlen(com) > 6){
        if(com[6] == 'F'){
          deleteFirst();
        }else if(com[6] == 'L'){
          deleteLast();
        }else{
          deleteKey(key);
        }
      }
    }
  }

  printlist();

  return 0;
}


      



Compiler output:
a.cc: In function 'int main()':
a.cc:84:15: error: 'strlen' is not a member of 'std'; did you mean 'mbrlen'?
   84 |       if(std::strlen(com) > 6){
      |               ^~~~~~
      |               mbrlen
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 = nil;
}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  scanf("%d", &n);
  init();
  for(i = 0; i < n; i++){
    scanf("%s%d", com, &key);
    if( com[0] == 'i') {insert(key);}
    else if(com[0] == 'd'){
      if(strlen(com) > 6){
        if(com[6] == 'F') deleteFirst();
        else if(com[6] == 'L') deleteLast();
      }else{
        deleteKey(key);
      }
    }
  }
  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: In function 'void printlist()':
a.cc:27:15: error: 'nil' was not declared in this scope
   27 |   Node *cur = nil->next;
      |               ^~~
a.cc: In function 'void deleteNode(Node*)':
a.cc:39:11: error: 'nil' was not declared in this scope
   39 |   if(t == nil) return;
      |           ^~~
a.cc: In function 'void deleteFirst()':
a.cc:46:14: error: 'nil' was not declared in this scope
   46 |   deleteNode(nil->next);
      |              ^~~
a.cc: In function 'void deleteLast()':
a.cc:50:14: error: 'nil' was not declared in this scope
   50 |   deleteNode(nil->prev);
      |              ^~~
a.cc: In function 'void insert(int)':
a.cc:60:13: error: 'nil' was not declared in this scope
   60 |   x->next = nil->next;
      |             ^~~
Language: C++


import sys
#import numpy as np
import copy

N = int(input())
list = []

for i in range(N):
    # insert, delete, deleteFirst, deleteLast
    line = input().rstrip().split(' ')
    if line[0]=='insert':
        list.append((int)(line[1]))
    elif line[0]=='delete':
        for j in range(len(list)):
            if list[j]==(int)(line[1]):
                list.pop(j)
                break
    elif line[0]=='deleteFirst':
        list.pop(0)
    elif line[0]=='deleteLast':
        list.pop(len(list)-1)

for i in range(len(list)):
    print( (str)(list[i]), end="")
    if i != len(list)-1:
        print(" ",end="")
print()



Compiler output:
a.cc:3:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
    3 | #import numpy as np
      |  ^~~~~~
a.cc:3:9: error: #import expects "FILENAME" or <FILENAME>
    3 | #import numpy as np
      |         ^~~~~
a.cc:10:7: error: invalid preprocessing directive #insert; did you mean #assert?
   10 |     # insert, delete, deleteFirst, deleteLast
      |       ^~~~~~
      |       assert
a.cc:12:17: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   12 |     if line[0]=='insert':
      |                 ^~~~~~~~
a.cc:14:19: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   14 |     elif line[0]=='delete':
      |                   ^~~~~~~~
a.cc:19:19: warning: multi-character literal with 11 characters exceeds 'int' size of 4 bytes
   19 |     elif line[0]=='deleteFirst':
      |                   ^~~~~~~~~~~~~
a.cc:21:19: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
   21 |     elif line[0]=='deleteLast':
      |                   ^~~~~~~~~~~~
a.cc:2:1: error: 'import' does not name a type
    2 | import sys
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

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

typedef struct node Node;
struct node {
    int data;
    Node *next;
    Node *prev;
};
 Node *create_node(int item,Node *next,Node *prev){
 Node *new_node=(Node *)mallloc(sizeof(Node));

 new_node->data=item;
 new_node->next=next;
 new_node->prev=prev;
 return new_node;

 }
 Node *prepend(Node *head,int item){
     Node *new_node = create_node(item,head,NULL);
     new_node->next->prev=new_node;
     return new_node;
     }
 Node *Delete(Node *head,Node *node){
    if(node==head){
     head=Node->next;
     head->prev=NULL;
     free(node);
     return head;
    }
    Node *previous_node=node->prev;
    Node *next_node=node->next;

    previous_node->next=next_node;
    next_node->prev=previous_node;

    free(node);
    return head;
 }
 int main()
  {
       Node *n1,*head;
       int t,i,x;
       string a;
       cin>>t;
       for(i=1;i<=t;i++){
          cin>>a, cin>>x;
          if(a[0]=='i'){
             head=prepend(&head,x);
          }
       }
  }



Compiler output:
a.cc: In function 'Node* create_node(int, Node*, Node*)':
a.cc:11:25: error: 'mallloc' was not declared in this scope; did you mean 'malloc'?
   11 |  Node *new_node=(Node *)mallloc(sizeof(Node));
      |                         ^~~~~~~
      |                         malloc
a.cc: In function 'Node* Delete(Node*, Node*)':
a.cc:26:15: error: expected primary-expression before '->' token
   26 |      head=Node->next;
      |               ^~
a.cc: In function 'int main()':
a.cc:49:27: error: cannot convert 'Node**' {aka 'node**'} to 'Node*' {aka 'node*'}
   49 |              head=prepend(&head,x);
      |                           ^~~~~
      |                           |
      |                           Node** {aka node**}
a.cc:19:22: note:   initializing argument 1 of 'Node* prepend(Node*, int)'
   19 |  Node *prepend(Node *head,int item){
      |                ~~~~~~^~~~
Language: C++

import Control.Monad
import Control.Monad.State
import Data.Foldable

data DLList a = Null | DLL (DLList a) a (DLList a) deriving (Eq)

main = do
        n <- readLn
        result <- execStateT (query n) Null
        putStrLn.unwords.map show.toList $ (result :: DLList Int)


dlLeft Null = Null
dlLeft (DLL l a r) = l

dlRight Null = Null
dlRight (DLL l a r) = r

dlElem (DLL l a r) = a

isNull Null = True
isNull _    = False

infixr <>
x <> dllist = insert x dllist

instance Show a => Show (DLList a) where
        show Null = "|N|"
        show (DLL Null a Null) = "[" ++ show a ++ "]"
        show (DLL Null a r) = "[" ++ show a ++ "," ++ show r
        show (DLL _ a Null) = show a ++ "]"
        show (DLL l a r) = show a ++ "," ++ show r

instance Foldable DLList where
    foldr f e Null = e
    foldr f e (DLL l a r) = f a (foldr f e r)

insert x Null = DLL Null x Null
insert x (DLL l a r)
    | isNull l = null1
    | otherwise = insert x l
    where null1 = DLL Null x null2
          null2 = DLL null1 a r

delete x Null = Null
delete x (DLL l a Null)
  | x == a = Null
  | x /= a = DLL (delete x l) a Null

delete x (DLL Null a r)
  | x == a = Null
  | x /= a = DLL Null a (delete x r)
delete x (DLL l a r)
  | x == a = DLL l (dlElem r) (dlRight r)
  | x /= a = DLL l a (delete x r)

deleteFirst Null = Null
deleteFirst (DLL Null a r) = Null
deleteFirst (DLL l a r) = DLL (deleteFirst l) a r

deleteLast Null = Null
deleteLast (DLL l a Null) = Null
deleteLast (DLL l a r)    = DLL l a (deleteLast r)

toList :: DLList a -> [a]
toList = foldr (:) []

type Query a = StateT (DLList a) IO ()

query :: (Show a, Read a, Eq a) => Int -> Query a
query 0 = return ()
query n = do
        dll <- get
        com <- liftIO $ getLine
        let func = getCommand com
        liftIO $ print $ func dll
        put $ func dll
        query (n-1)

getCommand :: (Show a, Read a, Eq a) => String -> (DLList a -> DLList a)
getCommand str
    | (length.words $ str) == 2 = insOrDel str
    | otherwise                 = del1stOrdelLast str

insOrDel str
    | com == "insert" = insert x
    | com == "delete" = delete x
    where [com,x'] = words str
          x = read x'

del1stOrdelLast str
    | str == "deleteFirst" = deleteFirst
    | str == "deleteLast"  = deleteLast



Compiler output:
a.cc:88:17: warning: missing terminating ' character
   88 |     where [com,x'] = words str
      |                 ^
a.cc:88:17: error: missing terminating ' character
   88 |     where [com,x'] = words str
      |                 ^~~~~~~~~~~~~~
a.cc:89:21: warning: missing terminating ' character
   89 |           x = read x'
      |                     ^
a.cc:89:21: error: missing terminating ' character
a.cc:1:1: error: 'import' does not name a type
    1 | import Control.Monad
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

import Control.Monad
import Control.Monad.State
import Data.Foldable

data DLList a = Null | DLL (DLList a) a (DLList a) deriving (Eq)

main = do
        n <- readLn
        result <- execStateT (query n) Null
        putStrLn.unwords.map show.toList $ (result :: DLList Int)


dlLeft Null = Null
dlLeft (DLL l a r) = l

dlRight Null = Null
dlRight (DLL l a r) = r

dlElem (DLL l a r) = a

isNull Null = True
isNull _    = False

infixr <>
x <> dllist = insert x dllist

instance Show a => Show (DLList a) where
        show Null = "|N|"
        show (DLL Null a Null) = "[" ++ show a ++ "]"
        show (DLL Null a r) = "[" ++ show a ++ "," ++ show r
        show (DLL _ a Null) = show a ++ "]"
        show (DLL l a r) = show a ++ "," ++ show r

instance Foldable DLList where
    foldr f e Null = e
    foldr f e (DLL l a r) = f a (foldr f e r)

insert x Null = DLL Null x Null
insert x (DLL l a r)
    | isNull l = null1
    | otherwise = insert x l
    where null1 = DLL Null x null2
          null2 = DLL null1 a r

delete x Null = Null
delete x (DLL l a Null)
  | x == a = Null
  | x /= a = DLL (delete x l) a Null

delete x (DLL Null a r)
  | x == a = Null
  | x /= a = DLL Null a (delete x r)
delete x (DLL l a r)
  | x == a = DLL l (dlElem r) (dlRight r)
  | x /= a = DLL l a (delete x r)

deleteFirst Null = Null
deleteFirst (DLL Null a r) = Null
deleteFirst (DLL l a r) = DLL (deleteFirst l) a r

deleteLast Null = Null
deleteLast (DLL l a Null) = Null
deleteLast (DLL l a r)    = DLL l a (deleteLast r)

type Query a = StateT (DLList a) IO ()

query :: (Show a, Read a, Eq a) => Int -> Query a
query 0 = return ()
query n = do
        dll <- get
        com <- liftIO $ getLine
        let func = getCommand com
        liftIO $ print $ func dll
        put $ func dll
        query (n-1)

getCommand :: (Show a, Read a, Eq a) => String -> (DLList a -> DLList a)
getCommand str
    | (length.words $ str) == 2 = insOrDel str
    | otherwise                 = del1stOrdelLast str

insOrDel str
    | com == "insert" = insert x
    | com == "delete" = delete x
    where [com,x'] = words str
          x = read x'

del1stOrdelLast str
    | str == "deleteFirst" = deleteFirst
    | str == "deleteLast"  = deleteLast



Compiler output:
a.cc:85:17: warning: missing terminating ' character
   85 |     where [com,x'] = words str
      |                 ^
a.cc:85:17: error: missing terminating ' character
   85 |     where [com,x'] = words str
      |                 ^~~~~~~~~~~~~~
a.cc:86:21: warning: missing terminating ' character
   86 |           x = read x'
      |                     ^
a.cc:86:21: error: missing terminating ' character
a.cc:1:1: error: 'import' does not name a type
    1 | import Control.Monad
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
struct list {
	int val;
	list* next;
	list* prev;
};
list*  head;
void init() {
	head = (list*)malloc(sizeof(list));
	head->next = head;
	head->prev = head;
}
int main() {
	int len,key;
	cin >> len;
	char str[12];
	init();
	for (int i = 0; i < len;i++) {
		scanf("%s", str);
		if (str[0] == 'i') {
			list* add = new list;
			scanf("%d", &key);
			add->val = key;
			add->next = head->next;		
			head->next->prev = add;
			head->next = add;
			add->prev = head;
		}
		else if (strlen(str)>6 && str[6] == 'F') {
			if (head->next != head) {
				head->next->next->prev = head;
				list* minus = head->next;
				head->next = head->next->next;
				delete minus;
			}
		}
		else if (strlen(str)>6 && str[6] == 'L') {
			if (head->prev != head) {
				list* minus = head->prev;
				minus->prev->next =minus->next;
				minus->next->prev = minus->prev;
				delete minus;
			}
		}
		else {
			scanf("%d", &key);
			list* search = head->next;
			while (search != head && search->val != key) {
				search = search->next;
			}
			search->prev->next = search->next;
			search->next->prev = search->prev;
			delete search;
		}
	}
	list* show = head->next;
	while (show != head) {
		printf("%d", show->val);
		printf(" ");
		show = show->next;
		delete show->prev;
	}
	delete head;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:26: error: 'strlen' was not declared in this scope
   31 |                 else if (strlen(str)>6 && str[6] == 'F') {
      |                          ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<cstdio>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include<iostream>
#include<cstdio>
struct list {
	int val;
	list* next;
	list* prev;
};
list*  head;
void init() {
	head = (list*)malloc(sizeof(list));
	head->next = head;
	head->prev = head;
}
int main() {
	using namespace std;
	int len,key;
	cin >> len;
	char str[12];
	init();
	for (int i = 0; i < len;i++) {
		scanf("%s", str);
		if (str[0] == 'i') {
			list* add = new list;
			scanf("%d", &key);
			add->val = key;
			add->next = head->next;		
			head->next->prev = add;
			head->next = add;
			add->prev = head;
		}
		else if (strlen(str)>6 && str[6] == 'F') {
			if (head->next != head) {
				head->next->next->prev = head;
				list* minus = head->next;
				head->next = head->next->next;
				delete minus;
			}
		}
		else if (strlen(str)>6 && str[6] == 'L') {
			if (head->prev != head) {
				list* minus = head->prev;
				minus->prev->next =minus->next;
				minus->next->prev = minus->prev;
				delete minus;
			}
		}
		else {
			scanf("%d", &key);
			list* search = head->next;
			while (search != head && search->val != key) {
				search = search->next;
			}
			search->prev->next = search->next;
			search->next->prev = search->prev;
			delete search;
		}
	}
	list* show = head->next;
	while (show != head) {
		printf("%d", show->val);
		printf(" ");
		show = show->next;
		delete show->prev;
	}
	delete head;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:26: error: 'strlen' was not declared in this scope
   31 |                 else if (strlen(str)>6 && str[6] == 'F') {
      |                          ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<cstdio>
  +++ |+#include <cstring>
    3 | struct list {
Language: C++

#include<iostream>
#include<cstdio>

using namespace std;


struct Node
{
	int key;
	Node *pre, *next;
};

Node *nil;

void init()
{
	nil = (Node*)malloc(sizeof(Node));
	nil->pre = nil;
	nil->next = nil;
}

void insert(int key)
{
	Node *x = (Node*)malloc(sizeof(Node));
	x->key = key;
	x->next = nil->next;
	nil->next->pre = x;
	nil->next = x;
	x->pre = nil;
}

Node *findlist(int key)
{
	Node *cur = nil->next;
	while (cur->key != key&&cur != nil)
	{
		cur = cur->next;
	}
	return cur;
}

void deleteNode(Node *node)
{
	if (node == nil) return;
	node->next->pre = node->pre;
	node->pre->next = node->next;
	free(node);
}

void deletekey(int key)
{
	deleteNode(findlist(key));
}

void deletefirst()
{
	deleteNode(nil->next);
}

void deletelast()
{
	deleteNode(nil->pre);
}

void printNode()
{
	int sum = 0;
	while (nil->next != nil)
	{
		if (sum++ > 0)
			cout << ' ';
		cout << nil->next->key;
		deleteNode(nil->next);
	}
	cout << endl;
}

int main()
{
	int N, key;
	char A[100];
	cin >> N;
	init();
	for (int i = 0; i < N; i++)
	{
		//scanf("%s%d",A, &key);
		scanf("%s", A);
		if (A[0] == 'i')
		{
			scanf("%d", &key);
			insert(key);
		}
		else if (A[0] == 'd')
		{
			if (strlen(A)>6&&A[6] == 'F')
			{
				deletefirst();
			}
			else if (strlen(A)>6 && A[6] == 'L')
			{
				deletelast();
			}
			else
			{
				scanf("%d", &key);
				deletekey(key);
			}
		}
	}
	printNode();
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:95:29: error: 'strlen' was not declared in this scope
   95 |                         if (strlen(A)>6&&A[6] == 'F')
      |                             ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<cstdio>
  +++ |+#include <cstring>
    3 |
Language: C++

#include<iostream>
#include<cstdio>

using namespace std;


struct Node
{
	int key;
	Node *pre, *next;
};

Node *nil;

void init()
{
	nil = (Node*)malloc(sizeof(Node));
	nil->pre = nil;
	nil->next = nil;
}

void insert(int key)
{
	Node *x = (Node*)malloc(sizeof(Node));
	x->key = key;
	x->next = nil->next;
	nil->next->pre = x;
	nil->next = x;
	x->pre = nil;
}

Node *findlist(int key)
{
	Node *cur = nil->next;
	while (cur->key != key&&cur != nil)
	{
		cur = cur->next;
	}
	return cur;
}

void deleteNode(Node *node)
{
	if (node == nil) return;
	node->next->pre = node->pre;
	node->pre->next = node->next;
	free(node);
}

void deletekey(int key)
{
	deleteNode(findlist(key));
}

void deletefirst()
{
	deleteNode(nil->next);
}

void deletelast()
{
	deleteNode(nil->pre);
}

void printNode()
{
	int sum = 0;
	while (nil->next != nil)
	{
		if (sum++ > 0)
			cout << ' ';
		cout << nil->next->key;
		deleteNode(nil->next);
	}
	cout << endl;
}

int main()
{
	int N, key;
	char A[100];
	cin >> N;
	init();
	for (int i = 0; i < N; i++)
	{
		scanf("%s", A);
		if (A[0] == 'i')
		{
			scanf("%d", &key);
			insert(key);
		}
		else if (A[0] == 'd')
		{
			if (strlen(A)>6&&A[6] == 'F')
			{
				deletefirst();
			}
			else if (strlen(A)>6 && A[6] == 'L')
			{
				deletelast();
			}
			else
			{
				scanf("%d", &key);
				deletekey(key);
			}
		}
	}
	printNode();
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:94:29: error: 'strlen' was not declared in this scope
   94 |                         if (strlen(A)>6&&A[6] == 'F')
      |                             ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<cstdio>
  +++ |+#include <cstring>
    3 |
Language: C++

#include<iostream>
#include<cstdio>
#include<string>

using namespace std;


struct Node
{
	int key;
	Node *pre, *next;
};

Node *nil;

void init()
{
	nil = (Node*)malloc(sizeof(Node));
	nil->pre = nil;
	nil->next = nil;
}

void insert(int key)
{
	Node *x = (Node*)malloc(sizeof(Node));
	x->key = key;
	x->next = nil->next;
	nil->next->pre = x;
	nil->next = x;
	x->pre = nil;
}

Node *findlist(int key)
{
	Node *cur = nil->next;
	while (cur->key != key&&cur != nil)
	{
		cur = cur->next;
	}
	return cur;
}

void deleteNode(Node *node)
{
	if (node == nil) return;
	node->next->pre = node->pre;
	node->pre->next = node->next;
	free(node);
}

void deletekey(int key)
{
	deleteNode(findlist(key));
}

void deletefirst()
{
	deleteNode(nil->next);
}

void deletelast()
{
	deleteNode(nil->pre);
}

void printNode()
{
	int sum = 0;
	while (nil->next != nil)
	{
		if (sum++ > 0)
			cout << ' ';
		cout << nil->next->key;
		deleteNode(nil->next);
	}
	cout << endl;
}

int main()
{
	int N, key;
	char A[100];
	cin >> N;
	init();
	for (int i = 0; i < N; i++)
	{
		scanf("%s", A);
		if (A[0] == 'i')
		{
			scanf("%d", &key);
			insert(key);
		}
		else if (A[0] == 'd')
		{
			if (strlen(A)>6&&A[6] == 'F')
			{
				deletefirst();
			}
			else if (strlen(A)>6 && A[6] == 'L')
			{
				deletelast();
			}
			else
			{
				scanf("%d", &key);
				deletekey(key);
			}
		}
	}
	printNode();
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:95:29: error: 'strlen' was not declared in this scope
   95 |                         if (strlen(A)>6&&A[6] == 'F')
      |                             ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<cstdio>
  +++ |+#include <cstring>
    3 | #include<string>
Language: C++

#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <vector>

using namespace std;

class List {
public:
	class Node {
	public:
		Node(int value = 0) :value(value), next(nullptr), back(nullptr) {};

		// 自分が消されるとき
		~Node() {
			if (back != nullptr) {
				back->setNext(next); // 自分の後ろのポインタに次の相手を伝える
			}
			if (next != nullptr) {
				next->setBack(back); // 自分の先のポインタに、後ろの相手を伝える
			}
		};


		int value;

		void setNext(Node* ptr) { next = ptr; };
		void setBack(Node* ptr) { back = ptr; };
		Node* getNext() { return next; }
		Node* getBack() { return back; }
	private:
		Node * next;
		Node* back;
	};

	List() : first(nullptr), last(nullptr) {};

	// 片付ける
	~List() {
		Node* current = first;
		while (current != nullptr) {
			Node* target = current;
			current = current->getNext();
			delete(target);
		}
	}

	// 全ての要素を削除する
	void clear() {

	}

	// 先頭に要素を追加する
	void insert(int x) {
		Node* t = first;

		first = new Node(x); // 新しいノードを追加する
		first->setNext(t); // 次ノードにさっきまでの先頭を指定

		if (t != nullptr) {
			t->setBack(first); // 旧先頭ノードの後ろに新しく追加したノードを指定
		}
		// これが最初の追加
		else {
			last = first;
		}
	}

	// 最初に見つかった要素を削除する
	void remove(int x) {

		Node* current = first;
		// 同値のものを探す
		while (current != nullptr) {

			// 見つかった
			if (current->value == x) break;

			current = current->getNext(); // 次のポインタを取得
		}

		if (current == nullptr) return; // 見つからなかった

		// 見つかった要素の削除
		if (current == first) {
			removeFirst();
		}
		else if (current == last) {
			removeLast(); // ラストに移譲する
		}
		else {
			delete(current);
		}
	}

	// 最初の要素を削除する
	void removeFirst() {
		Node* second = first->getNext();

		// 先頭の削除
		delete(first);

		// 旧2番手を先頭に設定
		first = second;
	};

	// 最後の要素を削除する
	void removeLast() {
		Node* booby = last->getBack();

		// 最後尾の削除
		delete(last);

		// 旧ブービーを末尾に設定
		last = booby;
	};

	// 入っている全ての要素を出力する
	void dump() {
		Node* current = first;
		int cnt = 0;
		while (current != nullptr) {
			if (cnt != 0) printf(" ");
			printf("%d", current->value);
			current = current->getNext();
			cnt++;
		}
		printf("\n");
	}

private:
	Node* first;
	Node* last;
};



int N;
int main() {
	List list;

	cin >> N;

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

		scanf_s("%s%d", command, 20, &n);

		if (command[0] == 'i') {
			list.insert(n);
		}
		else if (strlen(command) > 6) {
			if (command[6] == 'F') {
				list.removeFirst();
			}
			else if (command[6] == 'L') {
				list.removeLast();
			}
		}
		else {
			list.remove(n);
		}

	}

	list.dump();
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:149:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
  149 |                 scanf_s("%s%d", command, 20, &n);
      |                 ^~~~~~~
      |                 scanf
Language: C++

#include <iostream>
#include <cstdlib>
#include <list>
using namespace std;
 
int main() {
    list<int>l; int n, x; char s[15];
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> s;
        if (s[0] == 'i')cin >> x,  l.push_front(x);
        else if (s[6] == 'F')l.pop_front();
        else if (s[6] == 'l')l.pop_back();
        else {
            cin >> x;
            for (list<int>::iterator it = l.begin(); it != l.end(); it++)
                if (*it == x) {
                    L.erase(it); break;
                }
        }
         
    }
    n = 0;
    for (list<int>::iterator it = l.begin(); it != l.end(); it++) {
        if (n++)cout << " ";
        cout << *it;
    }
    cout << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:21: error: 'L' was not declared in this scope
   18 |                     L.erase(it); break;
      |                     ^
Language: C++

#include <iostream>
#include <string>
#include <sstream>
#include <cstdlib>
#define MAX 1000000
using namespace std;

struct List{
    int data[MAX];
    int next[MAX];
    int head;
    int tail;
    int inew;

    void initialize(){
        head = -1;
        tail = -1;
        inew = 0;
    }
    void insert_x(int x){
        data[inew] = x;
        next[inew] = head;
        head = inew;
        inew++;
        if(tail == -1){
            tail = head;
        }
    }
    void delete_x(int x){
        int pnt = head;
        while(pnt >= 0){
            if(data[head] == x){
                head = next[head];
                break;
            }
            else{
                int pnt_next = next[pnt];
                if(pnt_next>=0 && data[pnt_next]==x){
                    next[pnt] = next[pnt_next];
                    if(next[pnt] == -1){
                        tail = pnt;
                    }
                    break;
                }
                else{
                    pnt = next[pnt];
                }
            }
        }
    }
    void deleteFirst(){
        head = next[head];
    }
    void deleteLast(){
        int pnt = head;
        while(pnt >= 0){
            int pnt_next = next[pnt];
            if(next[pnt_next] == -1){
                tail = pnt;
                next[tail] = -1;
            }
            else{
                pnt = next[pnt];
            }
        }
    }
    void print_list(){
        int pnt = head;
        while(pnt >= 0){
            cout << data[pnt] << " ";
            pnt = next[pnt];
        }
        cout << '\n';
    }
};

int main(){
    List list;
    string str;
    int x;
    int n;

    list.initialize();

    cin >> n;
    for(int i=0; i<n; i++){
        cin >> str;
        if(str == "insert"){
              cin >> x;
              list.insert_x(x);
        }
        else if(str == "delete"){
            cin >> x;
            list.delete_x(x);
        }
        else if(str == "deleteFirst"){
            list.deleteFirst();
        }
        else if(str == "delereLast"){
            list.deleteLast();
        }
    }

    list.print_list();

    return 0;



Compiler output:
a.cc: In function 'int main()':
a.cc:106:14: error: expected '}' at end of input
  106 |     return 0;
      |              ^
a.cc:77:11: note: to match this '{'
   77 | int main(){
      |           ^
Language: C++

#include <cstdio>
#include <string>
#include <list>
using namespace std;

void Execute(list<int> &ls, char cmd[]) {
    if (strcmp(cmd, "insert") == 0) {
        int val;
        scanf("%d", &val);
        ls.push_front(val);
    } else if (strcmp(cmd, "delete") == 0) {
        int val;
        scanf("%d", &val);
        for (list<int>::iterator it = ls.begin(); it != ls.end(); it++) {
            if (*it == val) {
                ls.erase(it);
                break;
            }
        }
    } else if (strcmp(cmd, "deleteFirst") == 0) {
        ls.pop_front();
    } else if (strcmp(cmd, "deleteLast") == 0) {
        ls.pop_back();
    }
}

int main() {
    int n;
    scanf("%d", &n);

    list<int> ls;
    char cmd[12];
    for (int i = 0; i < n; i++) {
        scanf("%s", cmd);
        Execute(ls, cmd);
    }
    int i = 0;
    for (list<int>::iterator it = ls.begin(); it != ls.end(); it++) {
        if (i++) printf(" ");
        printf("%d", *it);
    }
    printf("\n");
    return 0;
}


Compiler output:
a.cc: In function 'void Execute(std::__cxx11::list<int>&, char*)':
a.cc:7:9: error: 'strcmp' was not declared in this scope
    7 |     if (strcmp(cmd, "insert") == 0) {
      |         ^~~~~~
a.cc:4:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <list>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include <cstdio>
#include <cstdlib>
#include <list>
using namespace std;

void Execute(list<int> &ls, char cmd[]) {
    if (strcmp(cmd, "insert") == 0) {
        int val;
        scanf("%d", &val);
        ls.push_front(val);
    } else if (strcmp(cmd, "delete") == 0) {
        int val;
        scanf("%d", &val);
        for (list<int>::iterator it = ls.begin(); it != ls.end(); it++) {
            if (*it == val) {
                ls.erase(it);
                break;
            }
        }
    } else if (strcmp(cmd, "deleteFirst") == 0) {
        ls.pop_front();
    } else if (strcmp(cmd, "deleteLast") == 0) {
        ls.pop_back();
    }
}

int main() {
    int n;
    scanf("%d", &n);

    list<int> ls;
    char cmd[12];
    for (int i = 0; i < n; i++) {
        scanf("%s", cmd);
        Execute(ls, cmd);
    }
    int i = 0;
    for (list<int>::iterator it = ls.begin(); it != ls.end(); it++) {
        if (i++) printf(" ");
        printf("%d", *it);
    }
    printf("\n");
    return 0;
}


Compiler output:
a.cc: In function 'void Execute(std::__cxx11::list<int>&, char*)':
a.cc:7:9: error: 'strcmp' was not declared in this scope
    7 |     if (strcmp(cmd, "insert") == 0) {
      |         ^~~~~~
a.cc:4:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <list>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include <iostream>
#include <string>

struct List{
    int value[1000000];
    int next[1000000];
    int prev[1000000];
    int head = -1;
    int tail = -1;
    int idx = 0;
    
    void insertion(int x){
        next[idx] = head;
        prev[head] = idx;
        if(tail==-1){
            tail = idx;
        }
        value[idx] = x;
        head = idx;
        idx++;
    }

    int serch(int x){
        int j = head;
        while(j!=-1){
            if(value[j]==x){
                return j;
            }
            j = next[j];
        }
        return -1;
    }

    void deleteFirst(){
        if(next[head]==-1){
            head = -1;
            tail = -1:
        }else{
            head = next[head];
            prev[head] = -1;
        }
    }

    void deleteLast(){
        if(prev[tile]==-1){
            head = -1;
            tail = -1;
        }else{
            tail = prev[tail];
            next[tail] = -1;
        }
    }

    void del(int x){
        int s = serch(x);
        if(s!=-1){
            if(s==head){
                deleteFirst();
            }else if(s==tail){
                deleteLast();
            }else{
                int n = next[s];
                int p = prev[s];
                next[p] = n;
                prev[n] = p;
            }
        }
    }

    void command(std::string str){
        if(str=="insert"){
            int x;
            std::cin >> x;
            insertion(x);
        }
        if(str=="delete"){
            int x;
            std::cin >> x;
            del(x);
        }
        if(str=="deleteFirst"){
            deleteFirst();
        }
        if(str=="deleteLast"){
            deleteLast();
        }
    }

    void print(){
        int k = head;
        while(k!=-1){
            std::cout << value[k];
            k = next[k];
            if(k!=-1){
                std::cout << " ";
            }
        }
        std::cout << "\n";
    }
};


int main(){
    List lst;
    int n;
    std::cin >> n;
    for(int i=0;i<n;i++){
        std::string str;
        std::cin >> str;
        lst.command(str);
    }
    lst.print();
    return 0;
}


Compiler output:
a.cc: In member function 'void List::deleteFirst()':
a.cc:37:22: error: expected ';' before ':' token
   37 |             tail = -1:
      |                      ^
a.cc: In member function 'void List::deleteLast()':
a.cc:45:17: error: 'tile' was not declared in this scope; did you mean 'time'?
   45 |         if(prev[tile]==-1){
      |                 ^~~~
      |                 time
Language: C++

#include<iostream>
#include<list>
#include<string>
#include<sstream>
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;
    cin >> s;
    if(s=="insert"){
      cin >> num;
      l.push_front(num);
    }else if(s== "deleteFirst")l.pop_front();
    else if(s=="deleteLast")l.pop_back();
  }else if(s == "delete"){
    cin >> 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:26:4: error: 'else' without a previous 'if'
   26 |   }else if(s == "delete"){
      |    ^~~~
a.cc:26:12: error: 's' was not declared in this scope
   26 |   }else if(s == "delete"){
      |            ^
a.cc:27:12: error: 'num' was not declared in this scope; did you mean 'enum'?
   27 |     cin >> num;
      |            ^~~
      |            enum
Language: C++

#include<iostream>
#include<list>
#include<string>
#include<sstream>
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:20:11: error: cannot convert 'std::__cxx11::basic_string<char>' to 'const char*'
   20 |     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:22:13: error: unable to find string literal operator 'operator""num' with 'const char [3]', 'long unsigned int' arguments
   22 |       scanf("%d"num);
      |             ^~~~~~~
a.cc:27:11: error: unable to find string literal operator 'operator""num' with 'const char [3]', 'long unsigned int' arguments
   27 |     scanf("%d"num);
      |           ^~~~~~~