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

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

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  NodePointer x = nil->next;
  while(x->key != key){
    if(x == nil) break;
    x = x->next;
  }
  return x;
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;  deleteNode(t);
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast(){
  NodePointer x = nil->prev;
  if(x == nil) return;
  deleteNode(x);
}

void delete(int key){
  NodePointer x;
  x = listSearch(key);
  if(x == nil) return;
  deleteNode(x);
}


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

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

  printList();
  return 0;
}

Compiler output:
main.c: In function 'init':
main.c:26:21: error: implicit declaration of function 'deleteNode' [-Wimplicit-function-declaration]
   26 |   nil->next = nil;  deleteNode(t);
      |                     ^~~~~~~~~~
main.c:26:32: error: 't' undeclared (first use in this function)
   26 |   nil->next = nil;  deleteNode(t);
      |                                ^
main.c:26:32: note: each undeclared identifier is reported only once for each function it appears in
main.c: At top level:
main.c:43:6: warning: conflicting types for 'deleteNode'; have 'void(struct node *)'
   43 | void deleteNode(NodePointer t){
      |      ^~~~~~~~~~
main.c:26:21: note: previous implicit declaration of 'deleteNode' with type 'void(struct node *)'
   26 |   nil->next = nil;  deleteNode(t);
      |                     ^~~~~~~~~~
Language: C

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

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  NodePointer x = nil->next;
  while(x->key != key){
    if(x == nil) break;
    x = x->next;
  }
  return x;
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;  deleteNode(t);
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast(){
  NodePointer x = nil->prev;
  if(x == nil) return;
  deleteNode(x);
}

void delete(int key){
  NodePointer x;
  x = listSearch(key);
  //  if(x == nil) return;
  deleteNode(x);
}


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

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

  printList();
  return 0;
}

Compiler output:
main.c: In function 'init':
main.c:26:21: error: implicit declaration of function 'deleteNode' [-Wimplicit-function-declaration]
   26 |   nil->next = nil;  deleteNode(t);
      |                     ^~~~~~~~~~
main.c:26:32: error: 't' undeclared (first use in this function)
   26 |   nil->next = nil;  deleteNode(t);
      |                                ^
main.c:26:32: note: each undeclared identifier is reported only once for each function it appears in
main.c: At top level:
main.c:43:6: warning: conflicting types for 'deleteNode'; have 'void(struct node *)'
   43 | void deleteNode(NodePointer t){
      |      ^~~~~~~~~~
main.c:26:21: note: previous implicit declaration of 'deleteNode' with type 'void(struct node *)'
   26 |   nil->next = nil;  deleteNode(t);
      |                     ^~~~~~~~~~
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
  
struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};
  
typedef struct node * NodePointer;
  
NodePointer nil;
  
NodePointer listSearch(int key){
  NodePointer a;
    
  a = nil->next;
    
  while(a!= nil && a->key != key)
    {
      a = a->next;
    }
  return a;
    
}
  
void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}
  
void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}
  
void deleteNode(NodePointer t){
  if ( t == nil ) return;
  t->prev->next = t->next;
  t->next->prev = t->prev;
  
}
  
void deleteFirst(){
  deleteNode(nil->next);
}
  
void deleteLast(){
  deleteNode(nil->prev);
}
  
void delete(int key){
  NodePointer a.;
  
  if((a = listSearch(key))!=NULL)
    {     
      deleteNode(a);
    } 
}
  
  
void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct 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 {
    delete(key); nd++; 
      }
      size--;
    }
  }
  
  printList();
  return 0;
}

Compiler output:
main.c: In function 'delete':
main.c:63:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
   63 |   NodePointer a.;
      |                ^
main.c:63:16: error: expected expression before '.' token
main.c:65:7: error: 'a' undeclared (first use in this function)
   65 |   if((a = listSearch(key))!=NULL)
      |       ^
main.c:65:7: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<st dio.h>
#include<stdlib.h>
#include<string.h>
  
struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};
  
typedef struct node * NodePointer;
  
NodePointer nil;
  
NodePointer listSearch(int key){
  NodePointer a;
    
  a = nil->next;
    
  while(a!= nil && a->key != key)
    {
      a = a->next;
    }
  return a;
    
}
  
void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}
  
void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}
  
void deleteNode(NodePointer t){
  if ( t == nil ) return;
  t->prev->next = t->next;
  t->next->prev = t->prev;
  
}
  
void deleteFirst(){
  deleteNode(nil->next);
}
  
void deleteLast(){
  deleteNode(nil->prev);
}
  
void delete(int key){
  NodePointer a;
  
  if((a = listSearch(key))!=NULL)
    {     
      deleteNode(a);
    } 
}
  
  
void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct 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 {
    delete(key); nd++; 
      }
      size--;
    }
  }
  
  printList();
  return 0;
}

Compiler output:
main.c:1:9: fatal error: st dio.h: No such file or directory
    1 | #include<st dio.h>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include<stdio>
#include<cstdlib>
#include<cstring>

struct Node{
	int key;
	Npde *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->orev =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--;
	}
}

prinList();

return 0;
}
	



Compiler output:
a.cc:1:9: fatal error: stdio: No such file or directory
    1 | #include<stdio>
      |         ^~~~~~~
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->orev =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 init()':
a.cc:23:14: error: 'struct Node' has no member named 'orev'; did you mean 'prev'?
   23 |         nil->orev =nil;
      |              ^~~~
      |              prev
a.cc: At global scope:
a.cc:89:12: error: expected constructor, destructor, or type conversion before ';' token
   89 | printList();
      |            ^
a.cc:91:1: error: expected unqualified-id before 'return'
   91 | return 0;
      | ^~~~~~
a.cc:92:1: error: expected declaration before '}' token
   92 | }
      | ^
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:89:12: error: expected constructor, destructor, or type conversion before ';' token
   89 | printList();
      |            ^
a.cc:91:1: error: expected unqualified-id before 'return'
   91 | return 0;
      | ^~~~~~
a.cc:92:1: error: expected declaration before '}' token
   92 | }
      | ^
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:89:13: error: expected constructor, destructor, or type conversion before ';' token
   89 |  printList();
      |             ^
a.cc:91:2: error: expected unqualified-id before 'return'
   91 |  return 0;
      |  ^~~~~~
a.cc:92:1: error: expected declaration before '}' token
   92 | }
      | ^
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:89:13: error: expected constructor, destructor, or type conversion before ';' token
   89 |  printList();
      |             ^
a.cc:91:2: error: expected unqualified-id before 'return'
   91 |  return 0;
      |  ^~~~~~
a.cc:92:1: error: expected declaration before '}' token
   92 | }
      | ^
Language: C++

list = []

count = int(input())

for ver in range(count):
	try:
		conditions,num = input().split()
	except ValueError:
		print(conditions) 
	if(conditions == "insert"):
		list.append(num)
	elif(conditions == "delete"):
		list.remove(num)
for ver in range(len(list)):
	print(list[ver],end=" ")
print('/n')



Compiler output:
a.cc:16:7: warning: multi-character character constant [-Wmultichar]
   16 | print('/n')
      |       ^~~~
a.cc:1:1: error: 'list' does not name a type
    1 | list = []
      | ^~~~
Language: C++

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

#define LEN (2000000)

static void insert_num(int k, vector<int> &v) {
    auto it = v.begin();
    it = v.insert(it, k);
}

static void delete_num(int k, vector<int> &v) {
    vector<int>::iterator it = find(v.begin(), v.end(), k);
    if (it != v.end()) {
        v.erase(it);
    }
}

static void deleteFirst(vector<int> &v) {
    v.erase(v.begin());
}

static void deleteLast(vector<int> &v) {
    v.pop_back();
}

int main()
{
    int n, k;
    cin >> n;
    vector<string> op(LEN);
    vector<int> v(0, 0);
    for (int i = 0; i < n; i++)
    {
        cin >> op[i];
        if (op[i] == "insert") {
            cin >> k;
            insert_num(k, v);
        }
        else if (op[i] == "delete") {
            cin >> k;
            delete_num(k, v);
        }
        else if (op[i] == "deleteFirst") {
            deleteFirst(v);
        }
        else if (op[i] == "deleteLast") {
            deleteLast(v);
        }
        else {
            cout << "no such operator" << endl;
            return -1;
        }
    }

    for (int x : v) {
        cout << x << " ";
    }
    cout << endl;

    return 0;
}



Compiler output:
a.cc: In function 'void delete_num(int, std::vector<int>&)':
a.cc:13:36: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
   13 |     vector<int>::iterator it = find(v.begin(), v.end(), k);
      |                                ~~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:13:36: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   13 |     vector<int>::iterator it = find(v.begin(), v.end(), k);
      |                                ~~~~^~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<cstdio>
#include<cstdlib>
#include<cstring>

using namespace std;

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

Node *nil;

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

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

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

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:83:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   83 |     if (com[0]=="i") {
      |         ~~~~~~^~~~~
a.cc:87:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   87 |     } else if (com[0]=="d") {
      |                ~~~~~~^~~~~
a.cc:89:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   89 |         if (com[6]=="F") {
      |             ~~~~~~^~~~~
a.cc:91:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   91 |         } else if (com[6]=="L") {
      |                    ~~~~~~^~~~~
Language: C++

include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>

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

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

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

void printList() {
  Node *cur = nil->next;
  for(int i = 0; cur != nil; i++) {
    if(i > 0) printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
  }
  printf("\n");
}

void deleteNode(Node *t) {
  if(t == nil) return;
  t->next->prev = t->prev;
  t->prev->next = t->next;
  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;
  nil->next = x;
}

int main() {
  int key, n, i, j = 0;
  char com[20];
  scanf("%d", &n);
  init();
  for(i = 0; i < n; i++) {
    scanf("%s%d", com, &key);
    if(strcmp(com, "insert") == 0) {
      insert(key);
    } else if(strcmp(com, "delete") == 0) {
      deleteKey(key);
    } else if(strcmp(com, "deleteFirst") == 0) {
      deleteFirst();
    }else if(strcmp(com, "deleteLast") == 0){
      deleteLast();
    }
  }
  printList();

  return 0;
}



Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<iostream>
      | ^~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int osikomi(int hai[],int n){
	for(int i = 0;i<n;i++){
		if(hai[i] == 0){
			hai[i] = hai[i+1];
			hai[i+1] = 0;
		}
	}
}
int main(){
	int n,b,f = 0;
	string mozi;
	cin>>n;
	int hai[n] ={};
	for(int i = 0;i<n;i++){
		cin>>mozi;
		if(mozi == "insert"||mozi == "delete"){
			cin>>b;
		}
		if(mozi == "insert"){
			hai[i] = b;
			f++;
			osikomi(hai,n);
		}
		else if(mozi == "delete"){
			for(int j = f;j>=0;j--){
				if(hai[j] == b){
					hai[j] = 0;
					f--;
					osikomi(hai,n);
					break;
				}
			}
		}
		else if(mozi == "deleteLast"){
			int v = 0;
			for(int j = 0;j<n;j++){
				if(hai[j] != 0){
					hai[j] = 0;
					v++;
					f--;
				osikomi(hai,n);
				break;
				}
			}
		}
		else if(mozi == "deleteFirst"){
			int v = 0;
			for(int j = f;j>0;j--){
				if(hai[j] != 0){
					hai[j] = 0;
					v++;
					f--;
					break;
				}
			}
		}
//	cout<<f<<endl;
	for(int i = f-1;i>0;i--){
		cout<<hai[i]<<" ";
	}
	cout<<hai[0]<<endl;

	

}


Compiler output:
a.cc: In function 'int osikomi(int*, int)':
a.cc:10:1: warning: no return statement in function returning non-void [-Wreturn-type]
   10 | }
      | ^
a.cc: In function 'int main()':
a.cc:67:2: error: expected '}' at end of input
   67 | }
      |  ^
a.cc:11:11: note: to match this '{'
   11 | int main(){
      |           ^
Language: C++

v#include<bits/stdc++.h>
using namespace std;
int osikomi(int hai[],int n){
	for(int i = 0;i<n;i++){
		if(hai[i] == 0){
			hai[i] = hai[i+1];
			hai[i+1] = 0;
		}
	}
}
int main(){
	int n,b,d = 0,f = 0,g = 0,fa = 0,l = 0;
	string mozi;
	cin>>n;
	int hai[n] ={};
	for(int i = 0;i<n-d;i++){
		cin>>mozi;
		if(mozi == "insert"||mozi == "delete"){
			cin>>b;
		}
		if(mozi == "insert"){
			hai[i] = b;
			f++;
			g++;
		}
		else if(mozi == "delete"){
			for(int j = n;j>=0;j--){
				if(hai[j] == b){
					hai[j] = 0;
					f--;
			                                                             	//	osikomi(hai,n);
					break;
				}
			}
		}
		else if(mozi == "deleteLast"){
			for(int j = 0;j<f;j++){
				if(hai[j] != 0){
					hai[j] = 0;
					f--;
					break;
				}
			}
		}
		else if(mozi == "deleteFirst"){
			for(int j = n-1;j>0;j--){
				if(hai[j] != 0){
					hai[j] = 0;
					f--;
					g--;
					i--;
					d++;
					break;
				}
			}
		}
		
		for(int i = n;i>=0;i--){
		//	cout<<hai[i]<<" ";
		}	
	}
	int hai2[f] ={};
    int j = 0;
    for(int i = 0 ;i<n;i++){
        if(hai[i] != 0){
            hai2[j] = hai[i];
            j++;
        }
    }
    for(int i = f-1;i>0;i--){
        cout<<hai2[i]<<" ";
    }
    cout<<hai2[0]<<endl;
}


Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | v#include<bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'v' does not name a type
    1 | v#include<bits/stdc++.h>
      | ^
a.cc: In function 'int osikomi(int*, int)':
a.cc:10:1: warning: no return statement in function returning non-void [-Wreturn-type]
   10 | }
      | ^
a.cc: In function 'int main()':
a.cc:13:9: error: 'string' was not declared in this scope
   13 |         string mozi;
      |         ^~~~~~
a.cc:14:9: error: 'cin' was not declared in this scope
   14 |         cin>>n;
      |         ^~~
a.cc:17:22: error: 'mozi' was not declared in this scope
   17 |                 cin>>mozi;
      |                      ^~~~
a.cc:71:9: error: 'cout' was not declared in this scope
   71 |         cout<<hai2[i]<<" ";
      |         ^~~~
a.cc:73:5: error: 'cout' was not declared in this scope
   73 |     cout<<hai2[0]<<endl;
      |     ^~~~
a.cc:73:20: error: 'endl' was not declared in this scope
   73 |     cout<<hai2[0]<<endl;
      |                    ^~~~
Language: C++

v#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,b,d = 0,f = 0,g = 0,fa = 0,l = 0;
	string mozi;
	cin>>n;
	int hai[n] ={};
	for(int i = 0;i<n-d;i++){
		cin>>mozi;
		if(mozi == "insert"||mozi == "delete"){
			cin>>b;
		}
		if(mozi == "insert"){
			hai[i] = b;
			f++;
			g++;
		}
		else if(mozi == "delete"){
			for(int j = n;j>=0;j--){
				if(hai[j] == b){
					hai[j] = 0;
					f--;
			                                                             	//	osikomi(hai,n);
					break;
				}
			}
		}
		else if(mozi == "deleteLast"){
			for(int j = 0;j<f;j++){
				if(hai[j] != 0){
					hai[j] = 0;
					f--;
					break;
				}
			}
		}
		else if(mozi == "deleteFirst"){
			for(int j = n-1;j>0;j--){
				if(hai[j] != 0){
					hai[j] = 0;
					f--;
					g--;
					i--;
					d++;
					break;
				}
			}
		}
		
		for(int i = n;i>=0;i--){
		//	cout<<hai[i]<<" ";
		}	
	}
	int hai2[f] ={};
    int j = 0;
    for(int i = 0 ;i<n;i++){
        if(hai[i] != 0){
            hai2[j] = hai[i];
            j++;
        }
    }
    for(int i = f-1;i>0;i--){
        cout<<hai2[i]<<" ";
    }
    cout<<hai2[0]<<endl;
}


Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | v#include<bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'v' does not name a type
    1 | v#include<bits/stdc++.h>
      | ^
a.cc: In function 'int main()':
a.cc:5:9: error: 'string' was not declared in this scope
    5 |         string mozi;
      |         ^~~~~~
a.cc:6:9: error: 'cin' was not declared in this scope
    6 |         cin>>n;
      |         ^~~
a.cc:9:22: error: 'mozi' was not declared in this scope
    9 |                 cin>>mozi;
      |                      ^~~~
a.cc:63:9: error: 'cout' was not declared in this scope
   63 |         cout<<hai2[i]<<" ";
      |         ^~~~
a.cc:65:5: error: 'cout' was not declared in this scope
   65 |     cout<<hai2[0]<<endl;
      |     ^~~~
a.cc:65:20: error: 'endl' was not declared in this scope
   65 |     cout<<hai2[0]<<endl;
      |                    ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,b,d = 0,f = 0,g = 0,fa = 0,l = 0;
	cin>>n;
	int hai[n] ={};
	for(int i = 0;i<n-d;i++){
		cin>>mozi;
		if(mozi == "insert"||mozi == "delete"){
			cin>>b;
		}
		if(mozi == "insert"){
			hai[i] = b;
			f++;
			g++;
		}
		else if(mozi == "delete"){
			for(int j = n;j>=0;j--){
				if(hai[j] == b){
					hai[j] = 0;
					f--;
			                                                             	//	osikomi(hai,n);
					break;
				}
			}
		}
		else if(mozi == "deleteLast"){
			for(int j = 0;j<f;j++){
				if(hai[j] != 0){
					hai[j] = 0;
					f--;
					break;
				}
			}
		}
		else if(mozi == "deleteFirst"){
			for(int j = n-1;j>0;j--){
				if(hai[j] != 0){
					hai[j] = 0;
					f--;
					g--;
					i--;
					d++;
					break;
				}
			}
		}
		
		for(int i = n;i>=0;i--){
		//	cout<<hai[i]<<" ";
		}	
	}
	int hai2[f] ={};
    int j = 0;
    for(int i = 0 ;i<n;i++){
        if(hai[i] != 0){
            hai2[j] = hai[i];
            j++;
        }
    }
    for(int i = f-1;i>0;i--){
        cout<<hai2[i]<<" ";
    }
    cout<<hai2[0]<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:22: error: 'mozi' was not declared in this scope
    8 |                 cin>>mozi;
      |                      ^~~~
Language: C++

v#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,b,d = 0,f = 0,g = 0,fa = 0,l = 0;
	cin>>n;
	string mozi;
	int hai[n] ={};
	for(int i = 0;i<n-d;i++){
		cin>>mozi;
		if(mozi == "insert"||mozi == "delete"){
			cin>>b;
		}
		if(mozi == "insert"){
			hai[i] = b;
			f++;
			g++;
		}
		else if(mozi == "delete"){
			for(int j = n;j>=0;j--){
				if(hai[j] == b){
					hai[j] = 0;
					f--;
			                                                             	//	osikomi(hai,n);
					break;
				}
			}
		}
		else if(mozi == "deleteLast"){
			for(int j = 0;j<f;j++){
				if(hai[j] != 0){
					hai[j] = 0;
					f--;
					break;
				}
			}
		}
		else if(mozi == "deleteFirst"){
			for(int j = n-1;j>0;j--){
				if(hai[j] != 0){
					hai[j] = 0;
					f--;
					g--;
					i--;
					d++;
					break;
				}
			}
		}
		
		for(int i = n;i>=0;i--){
		//	cout<<hai[i]<<" ";
		}	
	}
	int hai2[f] ={};
    int j = 0;
    for(int i = 0 ;i<n;i++){
        if(hai[i] != 0){
            hai2[j] = hai[i];
            j++;
        }
    }
    for(int i = f-1;i>0;i--){
        cout<<hai2[i]<<" ";
    }
    cout<<hai2[0]<<endl;
}


Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | v#include<bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'v' does not name a type
    1 | v#include<bits/stdc++.h>
      | ^
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope
    5 |         cin>>n;
      |         ^~~
a.cc:6:9: error: 'string' was not declared in this scope
    6 |         string mozi;
      |         ^~~~~~
a.cc:9:22: error: 'mozi' was not declared in this scope
    9 |                 cin>>mozi;
      |                      ^~~~
a.cc:63:9: error: 'cout' was not declared in this scope
   63 |         cout<<hai2[i]<<" ";
      |         ^~~~
a.cc:65:5: error: 'cout' was not declared in this scope
   65 |     cout<<hai2[0]<<endl;
      |     ^~~~
a.cc:65:20: error: 'endl' was not declared in this scope
   65 |     cout<<hai2[0]<<endl;
      |                    ^~~~
Language: C++

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

struct list{
	string num;
	list *left, *right;
};

list *nill;

list *tnew(void);
void insert(string);
void init(void);
void deleteList(string);
list *seachList(string);
void deleteFirst(void);
void deleteLast(void);

int main(void){
	string c;
	string n;
	int s;
	cin >> s;
	while(s){
		cin >> c;
		if(c == "insert"){
			cin >> n;
			insert(n);
		}
		else if(c == "delete"){
			cin >> n;
			deleteList(n);
		}
		else if(c == "deleteFirst"){
			deleteFirst();
		}
		else{
			deleteLast();
		}
	}
	list *y = nill->right;
	while(y != nill){
		cout << y->num << endl;
		y = y->right;
	}
	return 0;
}

list *tnew(void){
	return new list;
}

void insert(int nu){
	list *p;
	p = tnew();
	p->num = nu;

	p->right = nill->right;
	nill->right->left = p;
	nill->right = p;
	p->left = nill;
}

void init(void){
	nill = tnew();
	nill->right = nill;
	nill->left = nill; 
}

list *seachList(string sl){
	list *x = nill->right;
	while(x != nill && x->num != sl){
		x = x->right;
	}
	return x;
}

void deleteList(list *dl){
	dl->left->right = dl->right;
	dl->right->left = dl->left;
	delete dl;
}

void deleteFirst(void){
	deleteList(nill->right);
}

void deleteLast(void){
	deleteList(nill->left);
}



Compiler output:
/usr/bin/ld: /tmp/ccWicyJs.o: in function `main':
a.cc:(.text+0xac): undefined reference to `insert(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: a.cc:(.text+0x112): undefined reference to `deleteList(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
collect2: error: ld returned 1 exit status
Language: C++

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

struct list{
	int num;
	list *left, *right;
};

list *nill;

list *tnew(void);
void insert(int);
void init(void);
void deleteList(list *dl);
list *seachList(int);
void deleteFirst(void);
void deleteLast(void);

int main(void){
	char c[50];
	int n;
	int s;
	scanf("%d", &s);
	while(s){
		scanf("%s", c);
		if(c[0] == 'i'){
			scanf("%d", &n);
			insert(n);
		}
		else if(c[0] == 'd' && sizeof(c)/sizeof(char) == 6){
			scanf("%d", &n);
			deleteList(seachList(n));
		}
		else if(c[6] == 'F'){
			deleteFirst();
		}
		else{
			deleteLast();
		}
	}
	list *y = nill->right;
	while(y != nill){
		printf("%d\n", y->num);
		y = y->right;
	}
	printf("\n")
	return 0;
}

list *tnew(void){
	return new list;
}

void insert(int nu){
	list *p;
	p = tnew();
	p->num = nu;

	p->right = nill->right;
	nill->right->left = p;
	nill->right = p;
	p->left = nill;
}

void init(void){
	nill = tnew();
	nill->right = nill;
	nill->left = nill; 
}

list *seachList(int sl){
	list *x = nill->right;
	while(x != nill && x->num != sl){
		x = x->right;
	}
	return x;
}

void deleteList(list *dl){
	dl->left->right = dl->right;
	dl->right->left = dl->left;
	delete dl;
}

void deleteFirst(void){
	deleteList(nill->right);
}

void deleteLast(void){
	deleteList(nill->left);
}




Compiler output:
a.cc: In function 'int main()':
a.cc:47:21: error: expected ';' before 'return'
   47 |         printf("\n")
      |                     ^
      |                     ;
   48 |         return 0;
      |         ~~~~~~
Language: C++

#include<iostream>
#include<stdio.h>
#include<cstdlib.h>
using namespace std;

struct list{
	int num;
	list *left, *right;
};

list *nill;

list *tnew(void);
void insert(int);
void init(void);
void deleteList(list *dl);
list *seachList(int);
void deleteFirst(void);
void deleteLast(void);

int main(void){
	char c[50];
	int n;
	int s;
	scanf("%d", &s);
	init();
	while(s){
		scanf("%s", c);
		if(c[0] == 'i'){
			scanf("%d", &n);
			insert(n);
		}
		else if(c[0] == 'd' && sizeof(c)/sizeof(char) == 6){
			scanf("%d", &n);
			deleteList(seachList(n));
		}
		else if(c[6] == 'F'){
			deleteFirst();
		}
		else{
			deleteLast();
		}
	}
	list *y = nill->right;
	while(y != nill){
		printf("%d\n", y->num);
		y = y->right;
	}
	printf("\n");
	return 0;
}

list *tnew(void){
	return (list*)malloc(sizeof(list));
}

void insert(int nu){
	list *p;
	p = tnew();
	p->num = nu;

	p->right = nill->right;
	nill->right->left = p;
	nill->right = p;
	p->left = nill;
}

void init(void){
	nill = tnew();
	nill->right = nill;
	nill->left = nill; 
}

list *seachList(int sl){
	list *x = nill->right;
	while(x != nill && x->num != sl){
		x = x->right;
	}
	return x;
}

void deleteList(list *dl){
	dl->left->right = dl->right;
	dl->right->left = dl->left;
	free(dl);
}

void deleteFirst(void){
	deleteList(nill->right);
}

void deleteLast(void){
	deleteList(nill->left);
}



Compiler output:
a.cc:3:9: fatal error: cstdlib.h: No such file or directory
    3 | #include<cstdlib.h>
      |         ^~~~~~~~~~~
compilation terminated.
Language: C++

#include<iosteam>
#include<cstdio>
#include<list>

int main(int argc, char const *argv[])
{
    int q,x;
    char com[20];
    std::list<int> v;

    scanf("%s",com);
    
    if(com[0] == 'i'){
        scanf("%d",&x);
        v.push_front(x);
    }
    else if(com[6] == 'L'){
        v.pop_back();
    }
    else if(com[6] == 'F'){
        v.pop_front();
    }
    else if(com[0] == 'd'){
        scanf("%d",&x);
        for(std::list<int>::iterator it = v.begin();it != v.end();it++){
            if(*it == x){
                v.erase(it);
                break;
            }
        }
    }

    int i = 0;
    for(std::list<int>::iterator it = v.begin();it != v.end();it++){
        if(i++) printf(' ');
        printf("%d",*it);
    }
    printf('\n');

    return 0;
}



Compiler output:
a.cc:1:9: fatal error: iosteam: No such file or directory
    1 | #include<iosteam>
      |         ^~~~~~~~~
compilation terminated.
Language: C++

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


int main(){
    int n;
    cin>>n;
    list<int> V;
    
    for(int i=0;i<n;i++){
        char com[20];
        int t;
        scanf("%s",com);
        
        
        if(com[0]=='i'){
            scanf("%d",&t);
            V.push_front(t);
            
        }else{
            
                //deleteFirst
             if(com[6]=='F'){
                V.pop_front();
                //deleteLast
            }else if(com[6]=='D'){
                V.pop_back();
            }else {
                scanf("%d",&t);
                for(list<int>::iterator it = V.begin();it!=V.end();it++){
                    if(*it==t){
                        V.erase(it);
                        break;
                    }
                }
        }
        
    }
    int i=1;
    for(list<int>::iterator it = V.begin();it != V.end();it++){
        
        cout<<*it;
        if(i!=V.size()){
            cout<<' ';
            i++;
        }
        
    }
    cout<<endl;




return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:42:9: error: redeclaration of 'int i'
   42 |     int i=1;
      |         ^
a.cc:13:13: note: 'int i' previously declared here
   13 |     for(int i=0;i<n;i++){
      |             ^
a.cc:58:2: error: expected '}' at end of input
   58 | }
      |  ^
a.cc:8:11: note: to match this '{'
    8 | int main(){
      |           ^
Language: C++

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


int main(){
    int n;
    cin>>n;
    list<int> V;
    
    for(int i=0;i<n;i++){
        char com[20];
        int t;
        scanf("%s",com);
        
        
        if(com[0]=='i'){
            scanf("%d",&t);
            V.push_front(t);
            
        }else{
            
                //deleteFirst
             if(com[6]=='F'){
                V.pop_front();
                //deleteLast
            }else if(com[6]=='D'){
                V.pop_back();
            }else {
                scanf("%d",&t);
                for(list<int>::iterator it = V.begin();it!=V.end();it++){
                    if(*it==t){
                        V.erase(it);
                        break;
                    }
                }
        }
        
    }
    int i=1;
    for(list<int>::iterator it = V.begin();it != V.end();it++){
        
        cout<<*it;
        if(i!=V.size()){
            cout<<' ';
            i++;
        }
        
    }
    cout<<endl;




return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:43:9: error: redeclaration of 'int i'
   43 |     int i=1;
      |         ^
a.cc:14:13: note: 'int i' previously declared here
   14 |     for(int i=0;i<n;i++){
      |             ^
a.cc:59:2: error: expected '}' at end of input
   59 | }
      |  ^
a.cc:9:11: note: to match this '{'
    9 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;

namespace tom{
  class list{
  private:
    struct node{
      int key=0;
      node* next=NULL;
      node* prev=NULL;
    };

    node* _head=NULL;
    int _cnt=0;
    
  public:
    list(){
      _head = new node;
      _head->next = _head;
      _head->prev = _head;
    }
    ~list(){
      
    }

    bool insert(int input){
      ++_cnt;
      node* newnode = new node;
      if(newnode == NULL) return false;
      newnode->key = input;
      /*
      node* itr;
      for(itr = _head; itr->next != _head; itr = itr->next);
      itr->next = newnode;
      newnode->next = _head;
      newnode->prev = itr;
      _head->prev = newnode;
      */
      newnode->next = _head->next;
      newnode->prev = _head;
      _head->next->prev = newnode;
      _head->next = newnode;
      if(_cnt == 0){
	_head->prev = newnode;
      }
      return true;
    }
    
    bool deleteX(int key){
      node* itr;
      for(itr = _head->next; itr != _head; itr = itr->next){
	if(itr->key == key){
	  itr->prev->next = itr->next;
	  itr->next->prev = itr->prev;
	  delete itr;
	  --_cnt;
	  return true;
	}
      }
      return false;
    }

    
    bool deleteFirst(){
      node* itr = _head->next;
      if(itr != _head){
	itr->prev->next = itr->next;
	itr->next->prev = itr->prev;
	delete itr;
	--_cnt;
	return true;
      }
      
      return false;
      
    }
    bool deleteLast(){
      node* itr = _head->prev;
      if(itr != _head){
	itr->prev->next = itr->next;
	itr->next->prev = itr->prev;
	delete itr;
	--_cnt;
	return true;
      }
      return false;
    }

    ///*
    void showlist(){
      if(_cnt > 0){
	node* itr;
	for(itr = _head; itr->next != _head; itr = itr->next){
	  cout << itr->next->key;
	  if(itr->next->next != _head) cout << " ";
	}
      }
      //else
	//cout << "There is not node.";
      cout << endl;
    }
    //*/
  };
}


void order(string command,tom::list &list){
  if(command == "insert"){
    int in;
    //cin >> in;
    scanf("%d",&in);
    list.insert(in);
  }else   if(command == "delete"){
    int x;
    //cin >> x;
    scanf("%d",&x)
    list.deleteX(x);
  }else   if(command == "deleteFirst"){
    list.deleteFirst();
  }else   if(command == "deleteLast"){
    list.deleteLast();
  }else {
    cout << "Such a command does not exist.";
  }
}


int main(){
  tom::list _list;
  int n;
  //cin >> n;
  scanf("%d",&n);
  for(int i=0; i<n; ++i){
    string work;
    cin >> work;
    order(work,_list);
  }
  
  _list.showlist();
  
  return 0;
}



Compiler output:
a.cc: In function 'void order(std::string, tom::list&)':
a.cc:118:19: error: expected ';' before 'list'
  118 |     scanf("%d",&x)
      |                   ^
      |                   ;
  119 |     list.deleteX(x);
      |     ~~~~
Language: C++

#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<stdio.h>
#include<stack>
#include<stdlib.h>
#include<list>
#define LEN 100005
using namespace std;
//list実装

int main(){
    list<int> l;
    int n;
    scanf("%d",&n)
    for(int i=0;i<n;i++){
        string c;
        cin>>c;
        if(c[0]=='i'){
            int a;
            scanf("%d",&a);
            l.push_front(a);
        }else{
            if(c[6]=='F'){
                l.pop_front();
            }else if(c[6]=='L'){
                l.pop_back();
            }else{
                int a;
                scanf("%d",&a);
                for(list<int>::iterator itr=l.begin();itr!=l.end();itr++){
                    if(*itr==a){
                        l.erase(itr);
                        break;
                    }
                }
                
            }
        }
    }
    int i=0;
    for(list<int>::iterator itr=l.begin();itr!=l.end();itr++){
            if(i++)cout<<" ";
        printf("%d",*itr);
            
        }
    cout<<endl;
        
return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:17:19: error: expected ';' before 'for'
   17 |     scanf("%d",&n)
      |                   ^
      |                   ;
   18 |     for(int i=0;i<n;i++){
      |     ~~~            
a.cc:18:17: error: 'i' was not declared in this scope
   18 |     for(int i=0;i<n;i++){
      |                 ^
Language: C++

#include<cstdio>
#include<cstdlib>
#include<cstring>
struct Node
{
    int value;
    Node* pre;
    Node* next;
};
Node* nil;//申请指向首结点的指针
void initialize(void)
{
    nil=(Node*)malloc(sizeof(Node));
    nil->next=nil;
    nil->pre=nil;

}
void Insert(int key)//在链表开头添加元素x
{
    Node* x=(Node*)malloc(sizeof(Node));
    x->value=key;
    x->next=nil->next;
    nil->next->pre=x;
    nil->next=x;
    x->pre=nil;
}
void Delete(int key)
{
    Node* flag=nil;
    while(flag->next!=nil&&flag->next->value!=key)
    {
    flag=flag->next;
    }
    if(flag->next->value==key)
    {

    flag->next->next->pre=flag;
    flag->next=flag->next->next;
   // free(flag->next);
    }


}
void DeleteFirst(void)
{
    Node* flag=nil->next;
    nil->next=flag->next;
    flag->next->pre=nil;
    free(flag);
}
void DeleteLast(void)
{
    Node* flag=nil->pre;//指向最后一个元素
    flag->pre->next=flag->next;
    nil->pre=flag->pre;
}
void PRINT(void)
{
   /* Node* flag=nil;
    int i=1;
    while(flag->next!=nil)
    {
    flag=flag->next;

    if(i) printf("%d",flag->value);
    else
    printf(" %d",flag->value);
    i--;
    }
    printf("\n");*/
    Node* cur = nil->next;
    int isf=0;
    while{
    if(cur==nil)break;
    if(isf++>0)printf(" ");
    printf("%d",cur->value);
    cur=cur->next;}
}
int main()
{
    int n;
    initialize();
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        char order[20];
        int x;
        scanf("%s",order);
        scanf("%d",&x);
        if(strcmp(order,"insert")==0)
        {
        Insert(x);
        }
        else if(strcmp(order,"delete")==0)
        {
        Delete(x);
        }
        else if(strcmp(order,"deleteFirst")==0)
        {
        DeleteFirst();
        }
        else
        {
        DeleteLast();
        }
    }
    PRINT();
    return 0;
}



Compiler output:
a.cc: In function 'void PRINT()':
a.cc:73:10: error: expected '(' before '{' token
   73 |     while{
      |          ^
      |          (
a.cc:73:10: error: expected primary-expression before '{' token
a.cc:73:10: error: expected ')' before '{' token
   73 |     while{
      |          ^
      |          )