Language: C++

/**
 * ???????????£????????????
??\?????????????????????????????????????????£???????????????????£??????????????????????

insert x: ??£?????????????????????????????? x ?????????????´?????¶?????¶???????
delete x: ?????? x
??????????????????????´??????£????????????????????????????????????????????????????´?????????¨???????????´????????????????????????
deleteFirst: ?????????????????????????´???????????????????
deleteLast: ????????????????°????????´???????????????????
??\???
??\????????\????????¢?????§?????????????????????

n
command1
command2
...
commandn
???????????????????????° n ?????????????????????????¶???? n
??????????????????????????????????????????????¨?4?????????????????????????????§?????????????????´??°??¨????????????

??????
??¨??????????????????????????????????????£?????????????????????????????????????????????????????????????????£?¶???????????????????????????????????????§????????£??????????????????????????????

??¶?´?
????????°??? 2,000,000 ????¶?????????????
delete ??????????????°??? 20 ????¶?????????????
0 ??? ???????????? ??? 10^9???
?????????????¨???§????????????????´???°??? 106????¶?????????????
delete, deleteFirst, ????????? deleteLast
??????????????????????????¨?????????????????????????????\??????????´?????????¨????????? ??\?????? 1
7
insert 5
insert 2
insert 3
insert 1
delete 3
insert 6
delete 5
????????? 1
6 1 2
??\?????? 2
9
insert 5
insert 2
insert 3
insert 1
delete 3
insert 6
delete 5
deleteFirst
deleteLast
????????? 2
1

 */

#include <iostream>
#include <list>
#include <sstream>
#include <iterator>

void printList(const std::list<unsigned int> &l) {
  std::ostringstream oss;
  std::copy(l.begin(), --l.end(),
            std::ostream_iterator<unsigned int>(oss, " "));
  oss << l.back();
  std::cout << oss.str() << std::endl;
}

int main(int argc, char const *argv[]) {
  std::string Param;
  std::istringstream iss;
  std::list<unsigned int> List;
  unsigned int n;
  std::string Command;
  unsigned int x;
  getline(std::cin, Param);
  iss.str(Param);
  iss >> n;
  iss.clear();
  for (size_t i = 0; i < n; i++) {
    getline(std::cin, Param);
    iss.str(Param);
    iss >> Command >> x;
    iss.clear();
    if (Command == "insert") {
      List.push_front(x);
    } else if (Command == "delete") {
      auto itr = std::find(List.begin(), List.end(), x);
      List.erase(itr);
    } else if (Command == "deleteFirst") {
      List.pop_front();
    } else if (Command == "deleteLast") {
      List.pop_back();
    }
  }
  printList(List);

  return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:89:27: error: no matching function for call to 'find(std::__cxx11::list<unsigned int>::iterator, std::__cxx11::list<unsigned int>::iterator, unsigned int&)'
   89 |       auto itr = std::find(List.begin(), List.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:57:
/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:89:27: note:   'std::_List_iterator<unsigned int>' is not derived from 'std::istreambuf_iterator<_CharT>'
   89 |       auto itr = std::find(List.begin(), List.end(), x);
      |                  ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~