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

#include <iostream>
#include <string>
#include <vector>

using namespace std;

struct DoubleLinkedList
{
  vector<int> l;
  void insertFront(int x)
  {
    l.insert(l.begin(), x);
  }
  void remove(int x)
  {
    auto itr = std::find(l.begin(), l.end(), x);
    if (itr == l.end())
      return;
    size_t pos = std::distance(l.begin(), itr);
    l.erase(l.begin() + pos);
  }
  void tail()
  {
    l.erase(l.begin());
  }
  void removeLast()
  {
    l.pop_back();
  }
  void print(string delim)
  {
    string s = "";
    for (int i = 0; i < l.size() - 1; i++)
      s += to_string(l[i]) + delim;
    s += to_string(l[l.size() - 1]) + "\n";
    cout << s;
  }
} list;

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

  for (int i = 0; i < n; i++)
  {
    string c;
    cin >> c;
    if (c == "insert")
    {
      int v;
      cin >> v;
      list.insertFront(v);
    }
    else if (c == "delete")
    {
      int v;
      cin >> v;
      list.remove(v);
    }
    else if (c == "deleteFirst")
      list.tail();
    else if (c == "deleteLast")
      list.removeLast();
    else
      cout << "input error" << endl;
  }

  list.print(" ");

  return 0;
}

Compiler output:
a.cc: In member function 'void DoubleLinkedList::remove(int)':
a.cc:16:25: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
   16 |     auto itr = std::find(l.begin(), l.end(), x);
      |                ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
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:16:25: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   16 |     auto itr = std::find(l.begin(), l.end(), x);
      |                ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>

using namespace std;

void printVec(vector<int> l, string delim)
{
  string s = "";
  for (int i = 0; i < l.size() - 1; i++)
    s += to_string(l[i]) + delim;
  s += to_string(l[l.size() - 1]) + "\n";
  cout << s;
}

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

  vector<int> l;

  for (int i = 0; i < n; i++)
  {
    string c;
    cin >> c;
    if (c == "insert")
    {
      int v;
      cin >> v;
      l.insert(l.begin(), v);
    }
    else if (c == "delete")
    {
      int v;
      cin >> v;
      auto itr = std::find(l.begin(), l.end(), v);
      if (itr == l.end())
        continue;
      size_t pos = distance(l.begin(), itr);
      l.erase(l.begin() + pos);
    }
    else if (c == "deleteFirst")
    {
      l.erase(l.begin());
    }
    else if (c == "deleteLast")
    {
      l.pop_back();
    }
    else
    {
      cout << "input error" << endl;
    }
  }

  printVec(l, " ");

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:27: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
   37 |       auto itr = std::find(l.begin(), l.end(), v);
      |                  ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
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:37:27: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   37 |       auto itr = std::find(l.begin(), l.end(), v);
      |                  ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

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

int main()
{
  int n, val;
  char order[12];
  scanf("%d", &n);

  list<int> seq;
  for (int i = 0;i<n;i++){
    scanf("%s", order);
    if (order[6] == 'F') seq.pop_front();
    else if (order[6] == 'L') seq.pop_back();
    else
    {
      scanf("%d", &val);
      if (order[0] == 'i') seq.push_front(val);
      else {
        auto itr = find(seq.begin(), seq.end(), val);
        if (itr == seq.end()) continue;
        seq.erase(itr);
      }
    }
  }

  printList(seq);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:20: error: 'find' was not declared in this scope
   30 |         auto itr = find(seq.begin(), seq.end(), val);
      |                    ^~~~
Language: C++

#include <vector>
#include <deque>
#include <list>
#include <forward_list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <tuple>
#include <functional>
#include <limits>
#include <utility>
#include <string>
#include <sstream>
#include <iostream>

#define DEBUG

using namespace std;

template <typename T>
class List
{
private:

	template <typename T>
	struct Node
	{
		Node(const T& value) : mValue(value), mNext(nullptr), mPrev(nullptr) {}

		T mValue;

		Node<T>* mNext;
		Node<T>* mPrev;
	};

	Node<T>* mFront;
	Node<T>* mBack;

public:

	List() : mFront(nullptr), mBack(nullptr) {}
	~List() { while (mFront) popFront(); }

	void pushFront(const T& val)
	{
		auto node(new Node<T>(val));

		if (mFront)
		{
			node->mNext = mFront;
			mFront->mPrev = node;

			mFront = node;
		}
		else
		{
			mFront = node;
			mBack = node;
		}
	}

	void pushBack(const T& val)
	{
		auto node(new Node<T>(val));

		if (mBack)
		{
			node->mPrev = mBack;
			mBack->mNext = node;

			mBack = node;
		}
		else
		{
			mFront = node;
			mBack = node;
		}
	}

	void popFront()
	{
		if (mFront)
		{
			auto next(mFront->mNext);
			delete mFront;

			if (next)
			{
				next->mPrev = nullptr;
				mFront = next;
			}
			else
			{
				mFront = mBack = nullptr;
			}
		}
	}

	void popBack()
	{
		if (mBack)
		{
			auto prev(mBack->mPrev);
			delete mBack;

			if (prev)
			{
				prev->mNext = nullptr;
				mBack = prev;
			}
			else
			{
				mFront = mBack = nullptr;
			}
		}
	}

	void erase(const T& val)
	{
		auto node(mFront);

		while (node)
		{
			if (node->mValue == val)
			{
				if (node->mPrev) node->mPrev->mNext = node->mNext;
				else mFront = node->mNext;

				if (node->mNext) node->mNext->mPrev = node->mPrev;
				else mBack = node->mPrev;

				delete node;

				break;
			}

			node = node->mNext;
		}
	}

	void print()
	{
		auto node(mFront);

		string delim("");

		while (node)
		{
			cout << delim << node->mValue;

			delim = " ";

			node = node->mNext;
		}

		cout << endl;
	}
};

int main()
{
	List<int> list;

	int n;
	cin >> n;

	for (size_t i(0); i < n; ++i)
	{
		string command;
		cin >> command;

		if (command == "insert")
		{
			int x;
			cin >> x;

			list.pushFront(x);
		}
		else if (command == "delete")
		{
			int x;
			cin >> x;

			list.erase(x);
		}
		else if (command == "deleteFirst")
		{
			list.popFront();
		}
		else if (command == "deleteLast")
		{
			list.popBack();
		}
	}

	list.print();

	return 0;
}

Compiler output:
a.cc:29:19: error: declaration of template parameter 'T' shadows template parameter
   29 |         template <typename T>
      |                   ^~~~~~~~
a.cc:24:11: note: template parameter 'T' declared here
   24 | template <typename T>
      |           ^~~~~~~~
Language: C++

#define _CRT_SECURE_NO_WARNINGS

#include <vector>
#include <deque>
#include <list>
#include <forward_list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <tuple>
#include <functional>
#include <limits>
#include <utility>
#include <string>
#include <sstream>
#include <iostream>
#include <cstdio>

// use printf, scanf instead of cout, cin.

using namespace std;

template <typename T>
struct Node
{
	Node(const T& value) : mValue(value), mNext(nullptr), mPrev(nullptr) {}

	T mValue;

	Node<T>* mNext;
	Node<T>* mPrev;
};

template <typename T>
class List
{
private:

	Node<T>* mFront;
	Node<T>* mBack;

public:

	List() : mFront(nullptr), mBack(nullptr) {}
	~List() { while (mFront) popFront(); }

	void pushFront(const T& val)
	{
		auto node(new Node<T>(val));

		if (mFront)
		{
			node->mNext = mFront;
			mFront->mPrev = node;

			mFront = node;
		}
		else
		{
			mFront = node;
			mBack = node;
		}
	}

	void pushBack(const T& val)
	{
		auto node(new Node<T>(val));

		if (mBack)
		{
			node->mPrev = mBack;
			mBack->mNext = node;

			mBack = node;
		}
		else
		{
			mFront = node;
			mBack = node;
		}
	}

	void popFront()
	{
		if (mFront)
		{
			auto next(mFront->mNext);
			delete mFront;

			if (next)
			{
				next->mPrev = nullptr;
				mFront = next;
			}
			else
			{
				mFront = mBack = nullptr;
			}
		}
	}

	void popBack()
	{
		if (mBack)
		{
			auto prev(mBack->mPrev);
			delete mBack;

			if (prev)
			{
				prev->mNext = nullptr;
				mBack = prev;
			}
			else
			{
				mFront = mBack = nullptr;
			}
		}
	}

	void erase(const T& val)
	{
		auto node(mFront);

		while (node)
		{
			if (node->mValue == val)
			{
				if (node->mPrev) node->mPrev->mNext = node->mNext;
				else mFront = node->mNext;

				if (node->mNext) node->mNext->mPrev = node->mPrev;
				else mBack = node->mPrev;

				delete node;

				break;
			}

			node = node->mNext;
		}
	}

	void print()
	{
		auto node(mFront);

		size_t i(0);
		while (node)
		{
			printf(i++ ? " %d" : "%d", node->mValue);

			node = node->mNext;
		}

		printf("\n");
	}
};

int main()
{
	List<int> list;

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

	for (size_t i(0); i < n; ++i)
	{
		char command[16];
		scanf("%s", command);

		if (!strcmp(command, "insert"))
		{
			int x;
			scanf("%d", &x);

			list.pushFront(x);
		}
		else if (!strcmp(command, "delete"))
		{
			int x;
			scanf("%d", &x);

			list.erase(x);
		}
		else if (!strcmp(command, "deleteFirst"))
		{
			list.popFront();
		}
		else if (!strcmp(command, "deleteLast"))
		{
			list.popBack();
		}
	}

	list.print();

	while(true){}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:176:22: error: 'strcmp' was not declared in this scope
  176 |                 if (!strcmp(command, "insert"))
      |                      ^~~~~~
a.cc:22:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   21 | #include <cstdio>
  +++ |+#include <cstring>
   22 |
Language: C++

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

typedef struct Node* NodePointer;//??¢?????¬???

typedef struct Node{
	int key;
	NodePointer next;
	NodePointer pre;
} Node;

NodePointer head;
NodePointer last;

void init(){
	head = malloc(sizeof(Node));
	last = malloc(sizeof(Node));
	head->next = last;
	last->pre = head;
}

NodePointer makeNode(int key){
	NodePointer tmp = malloc(sizeof(Node));
	tmp->next = tmp->pre = NULL;
	tmp->key = key;
	return tmp;
}

void insert(NodePointer ins, int key){
	NodePointer newnode = makeNode(key);
	NodePointer tmp = ins->next;
	ins->next = newnode;
	newnode->pre = ins;
	newnode->next = tmp;
	tmp->pre = newnode;

}
void delete(NodePointer p){
	NodePointer s = p->pre;
	NodePointer tmp = s->next;
	s->next = tmp;
	tmp->pre = s;
	free(p);
}





int main(){
	int n,i;
	int num;
	char command[100];
	NodePointer p;
	init();
	scanf(" %d ", &n);
	while(n--){
		scanf(" %s ", command);
		if (!strcmp(command,"insert")){
			scanf(" %d ", &num);
			insert(head,num);
		}else if (!strcmp(command, "delete")){
			scanf(" %d ", &num);
			for(p = head->next; p != last; p = p->next){
				if (p->key == num){//delete????????°???????????????????????????????????????
					delete(p);
					break;
				}
			}
		}else if (!strcmp(command, "deleteFirst")){
			delete(head->next);
		}else if (!strcmp(command, "deleteLast")){
			delete(last->pre);
		}

	}

	for (p = head->next; p != last; p = p->next){
			printf(p==head->next? "%d":" %d", p->key);
		}
		printf("\n");
	return 0;
}

Compiler output:
a.cc: In function 'void init()':
a.cc:17:22: error: invalid conversion from 'void*' to 'NodePointer' {aka 'Node*'} [-fpermissive]
   17 |         head = malloc(sizeof(Node));
      |                ~~~~~~^~~~~~~~~~~~~~
      |                      |
      |                      void*
a.cc:18:22: error: invalid conversion from 'void*' to 'NodePointer' {aka 'Node*'} [-fpermissive]
   18 |         last = malloc(sizeof(Node));
      |                ~~~~~~^~~~~~~~~~~~~~
      |                      |
      |                      void*
a.cc: In function 'Node* makeNode(int)':
a.cc:24:33: error: invalid conversion from 'void*' to 'NodePointer' {aka 'Node*'} [-fpermissive]
   24 |         NodePointer tmp = malloc(sizeof(Node));
      |                           ~~~~~~^~~~~~~~~~~~~~
      |                                 |
      |                                 void*
a.cc: At global scope:
a.cc:39:6: error: expected unqualified-id before 'delete'
   39 | void delete(NodePointer p){
      |      ^~~~~~
Language: C++

#include <cstdio>
#include <string>
 
class List
{
    int* data_;
    int begin_;
    int end_;
public:
    List()
    {
        data_  = new int[2000000];
        begin_ = 1999999;
        end_   = 1999999;
    }
    void Insert(int X)
    {
        --begin_;
        data_[begin_] = X;
    }
    void Delete(int X)
    {
        int Index = end_;
        for(int i = begin_; i < end_; ++i){
            if(X == data_[i]){
                Index = i;
                break;
            }
        }
        if(Index == end_) return;
        for(int i = Index; i < end_; ++i){
            data_[i] = data_[i+1];
        }
        end_--;
    }
    void DeleteFirst()
    {
        begin_++;
    }
    void DeleteLast()
    {
        end_--;
    }
    void Show()const
    {
        printf("%d", data_[begin_]);
        for(int i = begin_ + 1; i < end_; ++i){
            printf(" %d", data_[i]);
        }
        printf("\n");
    }
};
 
int main()
{
    List list;
    int n, X;
    std::scanf("%d\n", &n);
    char com[1024];
    for(int i = 0; i < n; ++i){
        std::fgets(com, 1024, stdin);
        if(com[6] == 'F'){
            list.DeleteFirst();
        }else
        if(com[6] == 'L'){
            list.DeleteLast();
        }else{
            int v = 0;
            
            int len = strlen(com) - 7;
            switch (len) {
                case 10: v += (cmd[len - 3] -  '0') * 1000000000;
                case 9:  v += (cmd[len - 2] -  '0') * 100000000;
                case 8:  v += (cmd[len - 1] -  '0') * 10000000;
                case 7:  v += (cmd[len    ] -  '0') * 1000000;
                case 6:  v += (cmd[len + 1] -  '0') * 100000;
                case 5:  v += (cmd[len + 2] -  '0') * 10000;
                case 4:  v += (cmd[len + 3] -  '0') * 1000;
                case 3:  v += (cmd[len + 4] -  '0') * 100;
                case 2:  v += (cmd[len + 5] -  '0') * 10;
                case 1:  v += (cmd[len + 6] -  '0');
            }
            // for(int j = 7; com[j] >= '0' && com[j] <= '9'; ++j){
            //     v = v*10 + (com[j] - '0');
            // }
            if(com[0] == 'i'){
                list.Insert(v);
            }else
            if(com[0] == 'd'){
                list.Delete(v);
            }
        }
    }
    list.Show();
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:70:23: error: 'strlen' was not declared in this scope
   70 |             int len = strlen(com) - 7;
      |                       ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <string>
  +++ |+#include <cstring>
    3 | 
a.cc:72:32: error: 'cmd' was not declared in this scope
   72 |                 case 10: v += (cmd[len - 3] -  '0') * 1000000000;
      |                                ^~~
Language: C++

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

using namespace std;

void print_list(list<int> &V)
{
		for(list<int>::iterator it = V.begin();
			it != V.end();it ++)
		{
			if(it ==  V.begin()){
				cout << *it;
			}
			else{
				cout << " " << *it;
			}
		}
	cout << endl;
}
int main(void)
{	
	list<int> V;
	
	int n;
	cin >> n;

	for(int i = 0; i < n; i++){
		string s;
		cin >> s;
		
		int x;
		if(s == "insert"){
			cin >> x;
			//V.(V.begin(), x);
			V.push_front();
		}
		else if(s == "delete"){
			cin >> x;
			for(list<int>::iterator it = V.begin();
				it != V.end();it ++)
			{	
				if(*it == x){
					V.erase(it);
					break;
				}
			}
		}
		else if(s == "deleteFirst"){
			V.pop_front();
		}
		else{
			V.pop_back();
		}
	}
	print_list(V);
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:37: error: no matching function for call to 'std::__cxx11::list<int>::push_front()'
   36 |                         V.push_front();
      |                         ~~~~~~~~~~~~^~
In file included from /usr/include/c++/14/list:65,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_list.h:1264:7: note: candidate: 'void std::__cxx11::list<_Tp, _Alloc>::push_front(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1264 |       push_front(const value_type& __x)
      |       ^~~~~~~~~~
/usr/include/c++/14/bits/stl_list.h:1264:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_list.h:1269:7: note: candidate: 'void std::__cxx11::list<_Tp, _Alloc>::push_front(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1269 |       push_front(value_type&& __x)
      |       ^~~~~~~~~~
/usr/include/c++/14/bits/stl_list.h:1269:7: note:   candidate expects 1 argument, 0 provided
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 ) returnl
  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 -> nest = 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++ 0) {
    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++l
      }
      size--;
    }
  }

  printList();

  return 0;
}



Compiler output:
a.cc: In function 'void init()':
a.cc:25:18: error: a function-definition is not allowed here before '{' token
   25 | void printList() {
      |                  ^
a.cc:37:26: error: a function-definition is not allowed here before '{' token
   37 | void deleteNode(Node *t) {
      |                          ^
a.cc:44:20: error: a function-definition is not allowed here before '{' token
   44 | void deleteFirst() {
      |                    ^
a.cc:48:19: error: a function-definition is not allowed here before '{' token
   48 | void deleteLast() {
      |                   ^
a.cc:52:25: error: a function-definition is not allowed here before '{' token
   52 | void deleteKey(int key) {
      |                         ^
a.cc:56:22: error: a function-definition is not allowed here before '{' token
   56 | void insert(int key) {
      |                      ^
a.cc:66:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   66 | int main() {
      |         ^~
a.cc:66:9: note: remove parentheses to default-initialize a variable
   66 | int main() {
      |         ^~
      |         --
a.cc:66:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:66:12: error: a function-definition is not allowed here before '{' token
   66 | int main() {
      |            ^
a.cc:90:2: error: expected '}' at end of input
   90 | }
      |  ^
a.cc:20:13: note: to match this '{'
   20 | void init() {
      |             ^
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 ) returnl
  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 -> nest = 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++ 0) {
    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++l
      }
      size--;
    }
  }
 
  printList();
 
  return 0;
}


Compiler output:
a.cc: In function 'void deleteNode(Node*)':
a.cc:39:19: error: 'returnl' was not declared in this scope
   39 |   if ( t == nil ) returnl
      |                   ^~~~~~~
a.cc: In function 'void insert(int)':
a.cc:61:8: error: 'struct Node' has no member named 'nest'; did you mean 'next'?
   61 |   x -> nest = nil -> next;
      |        ^~~~
      |        next
a.cc: In function 'int main()':
a.cc:74:26: error: expected ')' before numeric constant
   74 |   for ( i = 0; i < n; i++ 0) {
      |       ~                  ^~
      |                          )
a.cc:74:28: error: expected ';' before ')' token
   74 |   for ( i = 0; i < n; i++ 0) {
      |                            ^
      |                            ;
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++l
      }
      size--;
    }
  }
  
  printList();
  
  return 0;
}
		




Compiler output:
a.cc: In function 'int main()':
a.cc:82:27: error: expected ';' before 'l'
   82 |       deleteKey(key); nd++l
      |                           ^
      |                           ;
Language: C++

#include<cstdio>
#include<list>
#include<algorithm>

using namespace std;

int main(){
  int q, x;
  char com[20];

  list<int> v;
  scanf("%d", &q);
  for ( int i = 0; i < q; i++ ){
    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 ( list<int>::iterator it = v.begin(); it != v.end(); it++ ) {
        if ( *it == x ) {
          v.erase(it);
          break;
        }
      }
    }
  }
  int i = 0;
  for ( list<int>::iterator it = v.begin(); it != v.end(); it++ ) {
    if ( i++ ) printf(" ");
    printf("%d", *it);
  }
  printf('\n');

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:10: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   37 |   printf('\n');
      |          ^~~~
      |          |
      |          char
In file included from /usr/include/c++/14/cstdio:42,
                 from a.cc:1:
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
Language: C++

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


/*-----------構造体定義-----------------*/
typedef struct node{
 int num;
 struct node *left;
 struct node *right;
}node;
/*--------------------------------------*/


/*-----------------要素作成-------------*/
node* makenode(int x){
node* new;

new=(node*)malloc(sizeof(node));
new->num=x;
new->right=NULL;

return new;
}
/*-------------------------------------*/


int main(){
int n,i,x;
char com[13];
node* root;
node* p;
node** q;

root=NULL;

scanf("%d",&n);

for(i=0;i<n;i++){
 scanf("%s",&com);

 if(com[0]=='i'){
   scanf("%d",&x);
   p=makenode(x);
    if(root!=NULL){
        root->left=p;
        p->right=root;
        root=p;
    }else{root=p;}
 }else
 if(strcmp(com,"deleteFirst")==0){
   if(root->right==NULL){root=NULL;}
   else{root->right->left=NULL;
        root=root->right;}
  }else
  if(strcmp(com,"deleteLast")==0){
   if(root->right==NULL){root=NULL;}
   else{q=&(root->right);
    while((*q)!=NULL){
     if((*q)->right==NULL){(*q)=NULL;}
     else{q=&((*q)->right);}
    }
   }
  }else
  if(strcmp(com,"delete")==0){
   scanf("%d",&x);
   if(root->right==NULL){if(root->num==x){root=NULL;}}
   else{q=&(root->right);
    while((*q)!=NULL){
     if((*q)->num==x){
          (*q)->right->left=(*q)->left;
          (*q)=(*q)->right;
          (*q)->right=NULL;
          (*q)->left=NULL;
     }
     else{q=&((*q)->right);}
    }
   }
}
}

p=root;
while(p!=NULL){

if(p->right==NULL){printf("%d\n",p->num);}
else{printf("%d ",p->num);}
p=p->right;

}



return 0;
}






Compiler output:
a.cc: In function 'node* makenode(int)':
a.cc:17:7: error: expected unqualified-id before 'new'
   17 | node* new;
      |       ^~~
a.cc:19:4: error: expected type-specifier before '=' token
   19 | new=(node*)malloc(sizeof(node));
      |    ^
a.cc:20:4: error: expected type-specifier before '->' token
   20 | new->num=x;
      |    ^~
a.cc:21:4: error: expected type-specifier before '->' token
   21 | new->right=NULL;
      |    ^~
a.cc:23:11: error: expected type-specifier before ';' token
   23 | return new;
      |           ^
Language: C++

#include<iostream>
#include<stack>
#include<cstdlib>
#include<string>
#include <utility>
#include<queue>
#include<algorithm>
#include<list>

using namespace std;

void print_list(const list<int>& dlist){
  const list<int>::const_iterator itEnd = dlist.end();
  for(list<int>::const_iterator it =dlist.begin();it !=itEnd;++it){
    cout << *it << " ";
  }
  cout << it* <<endl;
}

//void delete_list(list<int> &dlist,int key){
 // list<int>::iterator find_ptr = find_list(dlist,key);

//}

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

  string command;
  int num;

  list<int> dlist;

  for(int i=0;i<n;i++){
   cin >> command ;
     if(command=="insert"){
        cin >> num;
        dlist.push_front(num);
     }
     else if(command =="delete"){
        cin >> num;
        //delete_list(dlist);
        list<int>::iterator find_ptr = find(dlist.begin(),dlist.end(),num);
        
        dlist.erase(find_ptr);
     }
     else if(command =="deleteFirst"){
      dlist.pop_front();
     }
     else{
     dlist.pop_back();
     } 

     
  }


  print_list(dlist);


  return 0;
}


Compiler output:
a.cc: In function 'void print_list(const std::__cxx11::list<int>&)':
a.cc:17:11: error: 'it' was not declared in this scope; did you mean 'int'?
   17 |   cout << it* <<endl;
      |           ^~
      |           int
a.cc:17:15: error: expected primary-expression before '<<' token
   17 |   cout << it* <<endl;
      |               ^~
Language: C++

#include<iostream>
#include<stack>
#include<cstdlib>
#include<string>
#include <utility>
#include<queue>
#include<algorithm>
#include<list>

using namespace std;

void print_list(const list<int>& dlist){
  const list<int>::const_iterator itEnd = dlist.end();
  for(list<int>::const_iterator it =dlist.begin();it !=itEnd;++it){
    cout << *it << " ";
  }
  cout << *it << endl;
}

//void delete_list(list<int> &dlist,int key){
 // list<int>::iterator find_ptr = find_list(dlist,key);

//}

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

  string command;
  int num;

  list<int> dlist;

  for(int i=0;i<n;i++){
   cin >> command ;
     if(command=="insert"){
        cin >> num;
        dlist.push_front(num);
     }
     else if(command =="delete"){
        cin >> num;
        //delete_list(dlist);
        list<int>::iterator find_ptr = find(dlist.begin(),dlist.end(),num);
        
        dlist.erase(find_ptr);
     }
     else if(command =="deleteFirst"){
      dlist.pop_front();
     }
     else{
     dlist.pop_back();
     } 

     
  }


  print_list(dlist);


  return 0;
}


Compiler output:
a.cc: In function 'void print_list(const std::__cxx11::list<int>&)':
a.cc:17:12: error: 'it' was not declared in this scope; did you mean 'int'?
   17 |   cout << *it << endl;
      |            ^~
      |            int
Language: C++

#include<iostream>
#include<stack>
#include<cstdlib>
#include<string>
#include <utility>
#include<queue>
#include<algorithm>
#include<list>

using namespace std;

void print_list(const list<int>& dlist){
  const list<int>::const_iterator itEnd = dlist.end();
  for(list<int>::const_iterator it =dlist.begin();it !=itEnd;++it){
    if(it!=dlist.begin())cout <<" ";
    cout << *it;
  }
  cout << endl;
}

//void delete_list(list<int> &dlist,int key){
 // list<int>::iterator find_ptr = find_list(dlist,key);

//}

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

  string command;
  int num;

  list<int> dlist;
  list<int>::iterator it;
  list<int>::iterator l;

  for(int i=0;i<n;i++){
   cin >> command ;
     if(command=="insert"){
        cin >> num;
        dlist.push_front(num);
     }
     else if(command =="delete"){
        cin >> num;
        //delete_list(dlist);
        //list<int>::iterator find_ptr = find(dlist.begin(),dlist.end(),num);
        //if()
        for(it=dlist.begin(),l=dlist.end();it!=l;++it){
          if(*it == num){
            dlist.erase(it);
            break;
          }
     }
     else if(command =="deleteFirst"){
      dlist.pop_front();
     }
     else{
     dlist.pop_back();
     } 

     
  }


  print_list(dlist);


  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:55:6: error: expected '}' before 'else'
   55 |      else if(command =="deleteFirst"){
      |      ^~~~
a.cc:44:33: note: to match this '{'
   44 |      else if(command =="delete"){
      |                                 ^
Language: C++

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

vector<int> myVector;
vector<int>::iterator it;

void deleteNorm(int a);

void insert(int a);

void deleteFirst();

void deleteLast();

int main() {
    int x, k;
    string y;
    cin >> x;
    for (int i = 0; i < x; i++) {
        cin >> y;
        if (y == "insert") {
            cin >> k;
            insert(k);
        } else if (y == "delete") {
            cin >> k;
            deleteNorm(k);
        } else if (y == "deleteFirst") {
            deleteFirst();
        } else if (y == "deleteLast") {
            deleteLast();
        }
    }

    for (it = myVector.begin(); it <= myVector.end(); it++){
if(it != myVector.end() {
        cout << *it << " ";
    } else {
cout << *it << endl;
}
}
    return 0;

}

void deleteFirst() {
    myVector.erase(myVector.begin());
}

void deleteLast() {
    myVector.pop_back();
}

void insert(int a) {
    myVector.insert(myVector.begin(), a);
}

void deleteNorm(int a) {
    myVector.erase(remove(myVector.begin(), myVector.end(), a), myVector.end());
    myVector.pop_back();
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:24: error: expected ')' before '{' token
   37 | if(it != myVector.end() {
      |   ~                    ^~
      |                        )
a.cc:42:1: error: expected primary-expression before '}' token
   42 | }
      | ^
Language: C++

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

vector<int> myVector;
vector<int>::iterator it;

void deleteNorm(int a);

void insert(int a);

void deleteFirst();

void deleteLast();

int main() {
    int x, k;
    string y;
    cin >> x;
    for (int i = 0; i < x; i++) {
        cin >> y;
        if (y == "insert") {
            cin >> k;
            insert(k);
        } else if (y == "delete") {
            cin >> k;
            deleteNorm(k);
        } else if (y == "deleteFirst") {
            deleteFirst();
        } else if (y == "deleteLast") {
            deleteLast();
        }
    }


        for (int j : myVector) {
            cout << j << " ";
        }
    return 0;

}

void deleteFirst() {
    myVector.erase(myVector.begin());
}

void deleteLast() {
    myVector.pop_back();
}

void insert(int a) {
    myVector.insert(myVector.begin(), a);
}

void deleteNorm(int a) {
    myVector.erase(remove(myVector.begin(), myVector.end(), a), myVector.end());
    myVector.pop_back();
}

void insert(int a) {
    myVector.insert(myVector.begin(), a);
}

void deleteNorm(int a) {
    myVector.erase(remove(myVector.begin(), myVector.end(), a), myVector.end());
    myVector.pop_back();
}


Compiler output:
a.cc:61:6: error: redefinition of 'void insert(int)'
   61 | void insert(int a) {
      |      ^~~~~~
a.cc:52:6: note: 'void insert(int)' previously defined here
   52 | void insert(int a) {
      |      ^~~~~~
a.cc:65:6: error: redefinition of 'void deleteNorm(int)'
   65 | void deleteNorm(int a) {
      |      ^~~~~~~~~~
a.cc:56:6: note: 'void deleteNorm(int)' previously defined here
   56 | void deleteNorm(int a) {
      |      ^~~~~~~~~~
Language: C++


import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		LinkedList<Integer> ll = new LinkedList<Integer>();
		Scanner sc = new Scanner(System.in);
		int size = sc.nextInt();
		
		for (int i=0; i<size; i++) {
			String ops = sc.next();
			if ("insert".equals(ops))
				ll.add(0, sc.nextInt());
			else if ("delete".equals(ops)) {
				int pos = ll.indexOf(sc.nextInt());
				if (pos>=0) ll.remove(pos);
			}
			else if ("deleteFirst".equals(ops))
				ll.removeFirst();
			else if ("deleteLast".equals(ops))
				ll.removeLast();
			
		}
		sc.close();
	
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        StringBuilder sb = new StringBuilder();
        sb.append(ll.poll());
        for (Integer s : ll) {
            sb.append(" ");
            sb.append(s);
        }
        bw.write(sb.toString());
        bw.newLine();
        bw.close();
		
	}

}



Compiler output:
a.cc:2:1: error: 'import' does not name a type
    2 | import java.io.BufferedWriter;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.io.IOException;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.io.OutputStreamWriter;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
    5 | import java.util.LinkedList;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
    6 | import java.util.Scanner;
      | ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:1: error: expected unqualified-id before 'public'
    8 | public class Main {
      | ^~~~~~
Language: C++

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

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

Node *nil;

Node* listSearch(int key) {
  Node *cur = nil->next;  // 番兵の次の要素から辿る
  while ( cur != nil && cur->key != key)
    cur = cur->next;
  return cur;
}

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

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

void deleteNode(Node *t) {
  if ( t == nil ) return;  // t が番兵の場合は処理しない
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}

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

void deleteLast() {
  deleteNode(nil->prev);
}

void deleteKey(int key) {
  // 検索したノードを削除
  deleteNode(listSearch(key));
}

void insert(int key) {
  Node *x = (Node *)malloc(sizeof(Node));
  x->key = key;
  // 番兵の直後に要素を追加
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}

int main() {
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ) {
    scanf("%s%d", com, &key);  // より高速な入力関数を使用
    if ( com[0] == 'i' ) { insert(key); np++; size++; }
    else if ( com[0] == 'd' ) {
      if ( strlen(com) > 6 ) {
        if ( com[6] == 'F' ) deleteFirst();
        else if ( com[6] == 'L') deleteLast();
      } else {
        deleteKey(key); nd++;
      }
      size--;
    }
  }

  printList();

  return 0;
}


Compiler output:
a.cc: In function 'void printList()':
a.cc:34:15: error: expected ';' before '}' token
   34 |   printf("\n")
      |               ^
      |               ;
   35 | }
      | ~
Language: C++

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

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

Node *nil;

Node* listSearch(int key);
void init();
void printList();
void deleteNode(Node *t):
void deleteFirst();
void deleteLast();
void deleteKey(int key);
void insert(int key);

int main() {
  int key, n, i;
  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 ( strlen(com) == 6 ) deleteKey(key);
    else if ( com[6] == 'F' ) deleteFirst();
    else deleteLast();
  }

  printList();

  return 0;
}

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


Compiler output:
a.cc: In function 'void deleteNode(Node*)':
a.cc:16:1: error: only constructors take member initializers
   16 | void deleteFirst();
      | ^~~~
a.cc:16:1: error: expected identifier before 'void'
a.cc:16:1: error: expected '{' before 'void'
a.cc: At global scope:
a.cc:64:6: error: redefinition of 'void deleteNode(Node*)'
   64 | void deleteNode(Node *t) {
      |      ^~~~~~~~~~
a.cc:15:6: note: 'void deleteNode(Node*)' previously defined here
   15 | void deleteNode(Node *t):
      |      ^~~~~~~~~~
Language: C++

#include <iostream>
#include <deque>

int main(int argc, char const *argv[]){
	
	int N;
	std::deque<int> que;
	std::cin >> N;

	for (int i = 0; i < N; ++i){
		std::string cmd;
		int key;
		std::cin >> cmd
		if(cmd=="insert"){
			std::cin >> key;
			que.push_front(key);
		}else if(cmd=="delete"){
			std::cin >> key;
			for (int j = 0; j < que.size(); ++j){
				if(que[j]==key){
					que.erase(que.begin()+j);
					break;
				}
			}
		}else if(cmd=="deleteFirst"){
			que.pop_front();
		}else if(cmd=="deleteLast"){
			que.pop_back();
		}else{
			// exception
		}
	}

	for (int i = 0; i < que.size(); ++i){
		std::cout << que[i];
		if(i<que.size()-1) std::cout << " ";
	}
		std::cout << std::endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:13:32: error: expected ';' before 'if'
   13 |                 std::cin >> cmd
      |                                ^
      |                                ;
   14 |                 if(cmd=="insert"){
      |                 ~~              
a.cc:17:18: error: 'else' without a previous 'if'
   17 |                 }else if(cmd=="delete"){
      |                  ^~~~
Language: C++

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

using namespace std;

enum COMMAND_TYPE {
  INSERT,
  DELETE,
  DELETE_FIRST,
  DELETE_LAST
};

static COMMAND_TYPE fetch(string& st) {
  const string CDF = "deleteFirst";
  const string CDL = "deleteLast";
  const string CD = "delete";
  const string CI = "insert";
  
  if (st.find(CI) != string::npos) {
    return INSERT;
  } else if (st.find(CDF) != string::npos) {
    return DELETE_FIRST;
  } else if (st.find(CDL) != string::npos) {
    return DELETE_LAST;
  } else {
    return DELETE;
  }
}

static void fetchCommand(list<int>& clist, int n) {
  COMMAND_TYPE type;
  string command;
  int number;
  list<int>::iterator p;
  char buf[50];
  for (int i = 0; i < n; i++) {
//    cin >> command  >> number;
    memset(buf, 50, 0);
    scanf("%s%d", buf, &number);
    command = buf;
    type = fetch(command);
//    cout << "type = " << type << endl;
    switch (type) {
      case INSERT:
        clist.push_front(number);
        break;
      case DELETE:
        p = find(clist.begin(), clist.end(), number);
        if (p != clist.end()) {
          clist.erase(p);
        }
        break;
      case DELETE_FIRST:
        clist.pop_front();
        break;
      case DELETE_LAST:
        clist.pop_back();
        break;
    }
   }
}

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

  list<int> commandList;
  fetchCommand(commandList, n);

  auto it = commandList.begin();
  it = commandList.begin();
  while (it != commandList.end()) {
    cout << *it << ' ';
    it++;
  }
  cout << endl;  

  return 0;
}



Compiler output:
a.cc: In function 'void fetchCommand(std::__cxx11::list<int>&, int)':
a.cc:41:5: error: 'memset' was not declared in this scope
   41 |     memset(buf, 50, 0);
      |     ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <cstdio>
  +++ |+#include <cstring>
    6 |
Language: C++

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

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

int size;

Node *head;

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

void insert(int x)
{
	Node* i=(Node*)malloc(sizeof(Node));
	i->key=x;
	i->next=head->next;
	head->next->prev=i;
	i->prev=head;
	head->next=i;
	size++;
}

void deleteNode(Node* node)
{
	node->next->prev=node->prev;
	node->prev->next=node->next;
	free(node);
	size--;
}

Node* search(int x)
{
	Node* p=head->next;
	while(p!=head)
	{
		if(p->key==x)
		{
			return p;
		}
		p=p->next;
	}
	return NULL;
}

void deleteFirstNode()
{
	deleteNode(head->next);
}

void deleteLastNode()
{
	deleteNode(head->prev);
}

void deleteKey(int key)
{
	Node* temp=search(key);
	deleteNode(temp);
}

void printList()
{
	int i=0;
	Node* p=head->next;
	while(true)
	{

		printf("%d", p->key);
		i++;
		if(i!=size){
			printf(" ");
		}
		if(p->next==head)
			break;
		p=p->next;
	}
	printf("\n");
}

int main()
{

	init();
	char comand[20];
	int n,k;
	scanf("%d",&n);

	for (int i = 0; i < n; ++i)
	{
		scanf("%s%d",comand,&k);
		if (comand[0]=='i')
		{
			insert(k);
		}
		else(comand[0]=='d')
		{
			if(strlen(comand)>6)
			{
				if(comand[6]=='F')
				{
					deleteFirstNode();
				}
				else
				{
					deleteLastNode();
				}
			}
			else
			{
				deleteKey(k);
			}

		}
	}
	printList();
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:106:37: error: expected ';' before '{' token
  106 |                 else(comand[0]=='d')
      |                                     ^
      |                                     ;
  107 |                 {
      |                 ~