Language: C++

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

const int MAX_ARGENT = 1000000;

class DoublyLinkedListInteger{
	private:
		int* array;
		int currFirst;
		int currLast;
	public:
		DoublyLinkedListInteger() : currFirst(0),currLast(0),array(new int[MAX_ARGENT]){}
		void insert(int);
		void deleteKey(int);
		void deleteFirst();
		void deleteLast();
		void printArray();
	private:
		int toI(int,bool);
};

void DoublyLinkedListInteger::insert(int x){
	if(toI(currFirst,true) == currLast)
		return;
	array[currFirst] = x;
	currFirst = toI(currFirst,true);
}

void DoublyLinkedListInteger::deleteKey(int x){
	if(currFirst == currLast)
		return;
	int i;
	bool isFounded = false;
	for(i = currFirst - 1; i != toI(currLast,false); i = toI(i,false)){
		if(x == array[i]){
			isFounded = true;
			break;
		}
	}

	if(!isFounded)
		return;

	for(;i != toI(currLast,false);i = toI(i,false)){
		array[i] = array[i - 1];
	}
	currLast = toI(currLast,true);
}

void DoublyLinkedListInteger::deleteFirst(){
	if(currFirst == currLast)
		return;
	currFirst = toI(currFirst,false);
}

void DoublyLinkedListInteger::deleteLast(){
	if(currFirst == currLast)
		return;
	currLast = toI(currLast,true);
}

int DoublyLinkedListInteger::toI(int i,bool isPositive){
	if(isPositive && i == MAX_ARGENT - 1)
		return 0;
	if(!isPositive && i == 0)
		return MAX_ARGENT - 1;

	return (isPositive) ? i + 1 : i - 1;
}

void DoublyLinkedListInteger::printArray(){
	for(int i = currFirst - 1;i != toI(currLast,false);i = toI(i,false)){
		cout << array[i] << ((toI(i,false) != toI(currLast,false)) ? " " : "")  << flush;
	}
	cout << endl;
}

int main(){
	int n;
	cin >> n;
	DoublyLinkedListInteger dl;
	for(int i = 0; i < n;i++){
		char sRaw[256];
		scanf("%s",sRaw);
		string s(sRaw);
		if(s == "insert"){
			int val;
			scanf("%d",&val);
			dl.insert(val);
		}else if(s == "delete"){
			int val;
			scanf("%d",&val);
			dl.deleteKey(val);
		}else if(s == "deleteFirst"){
			dl.deleteFirst();
		}else if(s == "deleteLast"){
			dl.deleteLast();
		}
	}

	dl.printArray();
}

Press ENTER or type command to continue
#include"bits/stdc++.h"
using namespace std;

const int MAX_ARGENT = 1000000;

class DoublyLinkedListInteger{
	private:
		int* array;
		int currFirst;
		int currLast;
	public:
		DoublyLinkedListInteger() : currFirst(0),currLast(0),array(new int[MAX_ARGENT]){}
		void insert(int);
		void deleteKey(int);
		void deleteFirst();
		void deleteLast();
		void printArray();
	private:
		int toI(int,bool);
};

void DoublyLinkedListInteger::insert(int x){
	if(toI(currFirst,true) == currLast)
		return;
	array[currFirst] = x;
	currFirst = toI(currFirst,true);
}

void DoublyLinkedListInteger::deleteKey(int x){
	if(currFirst == currLast)
		return;
	int i;
	bool isFounded = false;
	for(i = toI(currFirst,false);i != toI(currLast,false); i = toI(i,false)){
		if(x == array[i]){
			isFounded = true;
			break;
		}
	}

	if(!isFounded)
		return;

	for(;i != toI(currLast,false);i = toI(i,false)){
		array[i] = array[toI(i,false)];
	}
	currLast = toI(currLast,true);
}

void DoublyLinkedListInteger::deleteFirst(){
	if(currFirst == currLast)
		return;
	currFirst = toI(currFirst,false);
}

void DoublyLinkedListInteger::deleteLast(){
	if(currFirst == currLast)
		return;
	currLast = toI(currLast,true);
}

int DoublyLinkedListInteger::toI(int i,bool isPositive){
	if(isPositive && i == MAX_ARGENT - 1)
		return 0;
	if(!isPositive && i == 0)
		return MAX_ARGENT - 1;

	return (isPositive) ? i + 1 : i - 1;
}

void DoublyLinkedListInteger::printArray(){
	for(int i = toI(currFirst,false);i != toI(currLast,false);i = toI(i,false)){
		cout << array[i] << ((toI(i,false) != toI(currLast,false)) ? " " : "")  << flush;
	}
	cout << endl;
}

int main(){
	int n;
	cin >> n;
	DoublyLinkedListInteger dl;
	for(int i = 0; i < n;i++){
		char sRaw[256];
		scanf("%s",sRaw);
		string s(sRaw);
		if(s == "insert"){
			int val;
			scanf("%d",&val);
			dl.insert(val);
		}else if(s == "delete"){
			int val;
			scanf("%d",&val);
			dl.deleteKey(val);
		}else if(s == "deleteFirst"){
			dl.deleteFirst();
		}else if(s == "deleteLast"){
			dl.deleteLast();
		}
	}

	dl.printArray();
}


Compiler output:
a.cc:104:1: error: 'Press' does not name a type
  104 | Press ENTER or type command to continue
      | ^~~~~
a.cc:108:11: error: redefinition of 'const int MAX_ARGENT'
  108 | const int MAX_ARGENT = 1000000;
      |           ^~~~~~~~~~
a.cc:4:11: note: 'const int MAX_ARGENT' previously defined here
    4 | const int MAX_ARGENT = 1000000;
      |           ^~~~~~~~~~
a.cc:110:7: error: redefinition of 'class DoublyLinkedListInteger'
  110 | class DoublyLinkedListInteger{
      |       ^~~~~~~~~~~~~~~~~~~~~~~
a.cc:6:7: note: previous definition of 'class DoublyLinkedListInteger'
    6 | class DoublyLinkedListInteger{
      |       ^~~~~~~~~~~~~~~~~~~~~~~
a.cc:126:6: error: redefinition of 'void DoublyLinkedListInteger::insert(int)'
  126 | void DoublyLinkedListInteger::insert(int x){
      |      ^~~~~~~~~~~~~~~~~~~~~~~
a.cc:22:6: note: 'void DoublyLinkedListInteger::insert(int)' previously defined here
   22 | void DoublyLinkedListInteger::insert(int x){
      |      ^~~~~~~~~~~~~~~~~~~~~~~
a.cc:133:6: error: redefinition of 'void DoublyLinkedListInteger::deleteKey(int)'
  133 | void DoublyLinkedListInteger::deleteKey(int x){
      |      ^~~~~~~~~~~~~~~~~~~~~~~
a.cc:29:6: note: 'void DoublyLinkedListInteger::deleteKey(int)' previously defined here
   29 | void DoublyLinkedListInteger::deleteKey(int x){
      |      ^~~~~~~~~~~~~~~~~~~~~~~
a.cc:154:6: error: redefinition of 'void DoublyLinkedListInteger::deleteFirst()'
  154 | void DoublyLinkedListInteger::deleteFirst(){
      |      ^~~~~~~~~~~~~~~~~~~~~~~
a.cc:50:6: note: 'void DoublyLinkedListInteger::deleteFirst()' previously defined here
   50 | void DoublyLinkedListInteger::deleteFirst(){
      |      ^~~~~~~~~~~~~~~~~~~~~~~
a.cc:160:6: error: redefinition of 'void DoublyLinkedListInteger::deleteLast()'
  160 | void DoublyLinkedListInteger::deleteLast(){
      |      ^~~~~~~~~~~~~~~~~~~~~~~
a.cc:56:6: note: 'void DoublyLinkedListInteger::deleteLast()' previously defined here
   56 | void DoublyLinkedListInteger::deleteLast(){
      |      ^~~~~~~~~~~~~~~~~~~~~~~
a.cc:166:5: error: redefinition of 'int DoublyLinkedListInteger::toI(int, bool)'
  166 | int DoublyLinkedListInteger::toI(int i,bool isPositive){
      |     ^~~~~~~~~~~~~~~~~~~~~~~
a.cc:62:5: note: 'int DoublyLinkedListInteger::toI(int, bool)' previously defined here
   62 | int DoublyLinkedListInteger::toI(int i,bool isPositive){
      |     ^~~~~~~~~~~~~~~~~~~~~~~
a.cc:175:6: error: redefinition of 'void DoublyLinkedListInteger::printArray()'
  175 | void DoublyLinkedListInteger::printArray(){
      |      ^~~~~~~~~~~~~~~~~~~~~~~
a.cc:71:6: note: 'void DoublyLinkedListInteger::printArray()' previously defined here
   71 | void DoublyLinkedListInteger::printArray(){
      |      ^~~~~~~~~~~~~~~~~~~~~~~
a.cc:182:5: error: redefinition of 'int main()'
  182 | int main(){
      |     ^~~~
a.cc:78:5: note: 'int main()' previously defined here
   78 | int main(){
      |     ^~~~