Language: C++

#include <iostream>
#include <deque>
#include <string>

void solve() {
  std::string str;
  std::deque d;
  int q;
  bool reverse = false;
  std::cin >> str >> q;
  for (int i = 0; i < str.size(); i++) d.push_back(str[i]);
  
  for (int i = 0; i < q; i++) {
    if (t == 0) reverse = (!reverse);
    else {
      int f;
      char c;
      std::cin >> f >> c;
      if (f == 1 && !reverse || f == 2 && reverse) d.push_front(c);
      else d.push_back(c);
    }
  }
  if (reverse)
    for (std::deque<char>::reverse_iterator i = d.rbegin(); i != d.rend(); i++)
      std::cout << *i;
  else
    for (std::deque<char>iterator i = d.begin(); i != d.end(); ++i)
      std::cout << *i;
}
int main() {
  solve();
  return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:7:14: error: class template argument deduction failed:
    7 |   std::deque d;
      |              ^
a.cc:7:14: error: no matching function for call to 'deque()'
In file included from /usr/include/c++/14/deque:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_deque.h:1003:9: note: candidate: 'template<class _Tp, class _Alloc, class _InputIterator, class> deque(_InputIterator, _InputIterator, const _Alloc&)-> std::deque<_Tp, _Alloc>'
 1003 |         deque(_InputIterator __first, _InputIterator __last,
      |         ^~~~~
/usr/include/c++/14/bits/stl_deque.h:1003:9: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_deque.h:976:7: note: candidate: 'template<class _Tp, class _Alloc> deque(std::initializer_list<_Tp>, const _Alloc&)-> std::deque<_Tp, _Alloc>'
  976 |       deque(initializer_list<value_type> __l,
      |       ^~~~~
/usr/include/c++/14/bits/stl_deque.h:976:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_deque.h:952:7: note: candidate: 'template<class _Tp, class _Alloc> deque(std::deque<_Tp, _Alloc>&&, const _Alloc&, std::false_type)-> std::deque<_Tp, _Alloc>'
  952 |       deque(deque&& __x, const allocator_type& __a, false_type)
      |       ^~~~~
/usr/include/c++/14/bits/stl_deque.h:952:7: note:   candidate expects 3 arguments, 0 provided
/usr/include/c++/14/bits/stl_deque.h:948:7: note: candidate: 'template<class _Tp, class _Alloc> deque(std::deque<_Tp, _Alloc>&&, const _Alloc&, std::true_type)-> std::deque<_Tp, _Alloc>'
  948 |       deque(deque&& __x, const allocator_type& __a, true_type)
      |       ^~~~~
/usr/include/c++/14/bits/stl_deque.h:948:7: note:   candidate expects 3 arguments, 0 provided
/usr/include/c++/14/bits/stl_deque.h:943:7: note: candidate: 'template<class _Tp, class _Alloc> deque(std::deque<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&)-> std::deque<_Tp, _Alloc>'
  943 |       deque(deque&& __x, const __type_identity_t<allocator_type>& __a)
      |       ^~~~~
/usr/include/c++/14/bits/stl_deque.h:943:7: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_deque.h:936:7: note: candidate: 'template<class _Tp, class _Alloc> deque(const std::deque<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&)-> std::deque<_Tp, _Alloc>'
  936 |       deque(const deque& __x, const __type_identity_t<allocator_type>& __a)
      |       ^~~~~
/usr/include/c++/14/bits/stl_deque.h:936:7: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_deque.h:933:7: note: candidate: 'template<class _Tp, class _Alloc> deque(std::deque<_Tp, _Alloc>&&)-> std::deque<_Tp, _Alloc>'
  933 |       deque(deque&&) = default;
      |       ^~~~~
/usr/include/c++/14/bits/stl_deque.h:933:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_deque.h:917:7: note: candidate: 'template<class _Tp, class _Alloc> deque(const std::deque<_Tp, _Alloc>&)-> std::deque<_Tp, _Alloc>'
  917 |       deque(const deque& __x)
      |       ^~~~~
/usr/include/c++/14/bits/stl_deque.h:917:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_deque.h:890:7: note: candidate: 'template<class _Tp, class _Alloc> deque(std::size_t, const _Tp&, const _Alloc&)-> std::deque<_Tp, _Alloc>'
  890 |       deque(size_type __n, const value_type& __value,
      |       ^~~~~
/usr/include/c++/14/bits/stl_deque.h:890:7: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/14/bits/stl_deque.h:878:7: note: candidate: 'template<class _Tp, class _Alloc> deque(std::size_t, const _Alloc&)-> std::deque<_Tp, _Alloc>'
  878 |       deque(size_type __n, const allocator_type& __a = allocator_type())
      |       ^~~~~
/usr/include/c++/14/bits/stl_deque.h:878:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_deque.h:865:7: note: candidate: 'template<class _Tp, class _Alloc> deque(const _Alloc&)-> std::deque<_Tp, _Alloc>'
  865 |       deque(const allocator_type& __a)
      |       ^~~~~
/usr/include/c++/14/bits/stl_deque.h:865:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_deque.h:855:7: note: candidate: 'template<class _Tp, class _Alloc> deque()-> std::deque<_Tp, _Alloc>'
  855 |       deque() = default;
      |       ^~~~~
/usr/include/c++/14/bits/stl_deque.h:855:7: note:   template argument deduction/substitution failed:
a.cc:7:14: note:   couldn't deduce template parameter '_Tp'
    7 |   std::deque d;
      |              ^
/usr/include/c++/14/bits/stl_deque.h:788:11: note: candidate: 'template<class _Tp, class _Alloc> deque(std::deque<_Tp, _Alloc>)-> std::deque<_Tp, _Alloc>'
  788 |     class deque : protected _Deque_base<_Tp, _Alloc>
      |           ^~~~~
/usr/include/c++/14/bits/stl_deque.h:788:11: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_deque.h:2277:5: note: candidate: 'template<class _InputIterator, class _ValT, class _Allocator, class, class> std::deque(_InputIterator, _InputIterator, _Allocator)-> deque<_ValT, _Allocator>'
 2277 |     deque(_InputIterator, _InputIterator, _Allocator = _Allocator())
      |     ^~~~~
/usr/include/c++/14/bits/stl_deque.h:2277:5: note:   candidate expects 2 arguments, 0 provided
a.cc:14:9: error: 't' was not declared in this scope
   14 |     if (t == 0) reverse = (!reverse);
      |         ^
a.cc:27:34: error: expected ';' before 'i'
   27 |     for (std::deque<char>iterator i = d.begin(); i != d.end(); ++i)
      |                                  ^~
      |                                  ;
a.cc:27:35: error: 'i' was not declared in this scope
   27 |     for (std::deque<char>iterator i = d.begin(); i != d.end(); ++i)
      |                                   ^
a.cc:27:62: error: expected ')' before ';' token
   27 |     for (std::deque<char>iterator i = d.begin(); i != d.end(); ++i)
      |         ~                                                    ^
      |                                                              )
a.cc:27:66: error: 'i' was not declared in this scope
   27 |     for (std::deque<char>iterator i = d.begin(); i != d.end(); ++i)
      |                                                                  ^