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

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

int main(){
	string s;
	cin >> s;
	list<char>str;
	string ans;
	int n, t, f, sw = 0;
	cin >> n;
	for(int i = 0;i < n ; i++){
		cin >> t;
		if(t == 1){
			sw = sw ^ 1;
		}
		else
		{
			char ch;
			cin >> f >> ch;
			if(sw) f = 3-f;
			if(f == 1) str.push_front(ch);
				else str.push_back(ch);
		}
	}
	if(sw)
		while(!str.empty()){
			char temp = str.back();
			str.pop_back();
			cout << temp;
		}
	else{
		while(!str.empty()){
			char temp = str.front();
			str.pop_font();
			cout << temp;
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:29: error: 'class std::__cxx11::list<char>' has no member named 'pop_font'; did you mean 'pop_front'?
   35 |                         str.pop_font();
      |                             ^~~~~~~~
      |                             pop_front
Language: C++

#include<bits/stdc++.h>
 
#define REP(i,s,N) for (int i=s;i<(N); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;


int main(){
	string S;
	cin >> S;
	deque<char> s;
	REP(i,0,strlen(S)){
		s.at(i) = S[i];
	}
	int Q;
	cin >> Q;
	REP(i,0,Q){
		int T;
		cin >> T;
		if(T==1){
			reverse(s.begin(),s.end());
			continue;
		}else{
			int F;
			char C;
			cin >> F;
			cin >> C;
			if(F==1){
				s.push_front(C);
			}else{
				s.push_back(C);
			}
			continue;
		}
	}
	

	
	
	REP(i,0,strlen(S)){
	cout << s[i] << endl;
	}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:24: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
   13 |         REP(i,0,strlen(S)){
      |                        ^
      |                        |
      |                        std::string {aka std::__cxx11::basic_string<char>}
a.cc:3:36: note: in definition of macro 'REP'
    3 | #define REP(i,s,N) for (int i=s;i<(N); ++i)
      |                                    ^
In file included from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/string.h:407:35: note:   initializing argument 1 of 'size_t strlen(const char*)'
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
a.cc:41:24: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
   41 |         REP(i,0,strlen(S)){
      |                        ^
      |                        |
      |                        std::string {aka std::__cxx11::basic_string<char>}
a.cc:3:36: note: in definition of macro 'REP'
    3 | #define REP(i,s,N) for (int i=s;i<(N); ++i)
      |                                    ^
/usr/include/string.h:407:35: note:   initializing argument 1 of 'size_t strlen(const char*)'
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
Language: C++

#include<bits/stdc++.h>
 
#define REP(i,s,N) for (int i=s;i<(N); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;


int main(){
	string S;
	cin >> S;
	int Q;
	cin >> Q;
	REP(i,0,Q){
		int T;
		cin >> T;
		if(T==1){
			reverse(S.begin(),S.end());
			continue;
		}else{
			int F;
			string C;
			cin >> F;
			cin >> C;
			if(F==1){
				S.insert(0,C);
			}else{
				S.push_back(C);
			}
			continue;
		}
	}
	

	
	
	
	cout << S << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:45: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'char'
   28 |                                 S.push_back(C);
      |                                             ^
      |                                             |
      |                                             std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1572:24: note:   initializing argument 1 of 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 1572 |       push_back(_CharT __c)
      |                 ~~~~~~~^~~
Language: C++

#include <bits/stdc++.h>
using namespace std; 
int main(){
	int q,flip = 0;
	string s,a,b;
	cin >> s >> q;
	for(int i = 0;i < q;i++){
		int t;
		cin >> t;
		if(t == 1){
			flip++;
		}else{
			int f;
			char c;
			cin >> f >> c; f--;
			if(f ^ (flip % 2)) b.push_back(c);
			else a.push_back(c);
		}
	}
	reverse(all(a));
	s = a + s + b;
	if(flip % 2) reverse(all(s));
	cout << s << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:17: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   20 |         reverse(all(a));
      |                 ^~~
      |                 std::filesystem::perms::all
In file included from /usr/include/c++/14/filesystem:51,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
                 from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::all' declared here
  158 |       all               =  0777,
      |       ^~~
Language: C++

#include<bits/stdc++.h>
 
#define REP(i,s,N) for (int i=s;i<(N); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;


int main(){
	string S;
	cin >> S;
	int Q;
	cin >> Q;
	REP(i,0,Q){
		int T;
		cin >> T;
		if(T==1){
			reverse(S.begin(),S.end());
			continue;
		}else{
			int F;
			char* C;
			cin >> F;
			cin >> C;
			if(F==1){
				S.insert(0,C);
			}else{
				S.push_back(C);
			}
			continue;
		}
	}
	

	
	
	
	cout << S << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:45: error: invalid conversion from 'char*' to 'char' [-fpermissive]
   28 |                                 S.push_back(C);
      |                                             ^
      |                                             |
      |                                             char*
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1572:24: note:   initializing argument 1 of 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 1572 |       push_back(_CharT __c)
      |                 ~~~~~~~^~~
Language: C++

#include<bits/stdc++.h>
 
#define REP(i,s,N) for (int i=s;i<(N); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;


int main(){
	string S;
	cin >> S;
	int Q;
	cin >> Q;
	REP(i,0,Q){
		int T;
		cin >> T;
		if(T==1){
			reverse(S.begin(),S.end());
			continue;
		}else{
			int F;
			char C;
			cin >> F >> C;
			if(F==1){
				S.insert(0,C[0]);
			}else{
				S.push_back(C[0]);
			}
			continue;
		}
	}
	

	
	
	
	cout << S << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:45: error: invalid types 'char[int]' for array subscript
   25 |                                 S.insert(0,C[0]);
      |                                             ^
a.cc:27:46: error: invalid types 'char[int]' for array subscript
   27 |                                 S.push_back(C[0]);
      |                                              ^
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String s = input.readLine();
        int q = Integer.parseInt(input.readLine());
        StringBuffer sb = new StringBuffer(s);
        boolean rvflag = false;

        for(int i=0;i<q;i++){
            String[] qn = input.readLine().split(" ");
            if(qn[0].equals("1")){
                rvflag = !rvflag;
            }else{
                if(qn[1].equals("1")){
                    if(rvflag){
                        sb.append(qn[2]);
                    }else{
                        sb.insert(0,qn[2]);
                    }
                }else if(qn[1].equals("2")){
                    if(rvflag){
                        sb.insert(0,qn[2]);
                    }else{
                        sb.append(qn[2]);
                    }
                }
            }
        
        }
        if(rvflag){
            sb.reverse();
        }
        System.out.println(sb.toString();
    }
}


Compiler output:
Main.java:40: error: ')' or ',' expected
        System.out.println(sb.toString();
                                        ^
1 error
Language: C++

#include<bits/stdc++.h>
 
#define REP(i,s,N) for (int i=s;i<(N); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;


int main(){
	string S;
	cin >> S;
	int Q;
	cin >> Q;
	REP(i,0,Q){
		int T;
		cin >> T;
		if(T==1){
			reverse(S.begin(),S.end());
			continue;
		}else{
			int F;
			char C;
			cin >> F >> C;
			if(F==1){
				S.insert(0,&C);
			}else{
				S.push_back(&C);
			}
			continue;
		}
	}
	

	
	
	
	cout << S << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:45: error: invalid conversion from 'char*' to 'char' [-fpermissive]
   27 |                                 S.push_back(&C);
      |                                             ^~
      |                                             |
      |                                             char*
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1572:24: note:   initializing argument 1 of 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 1572 |       push_back(_CharT __c)
      |                 ~~~~~~~^~~
Language: C++

#include<bits/stdc++.h>
 
#define REP(i,s,N) for (int i=s;i<(N); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;


int main(){
	string S;
	cin >> S;
	int Q;
	cin >> Q;
	REP(i,0,Q){
		int T;
		cin >> T;
		if(T==1){
			reverse(S.begin(),S.end());
			continue;
		}else{
			int F;
			char C;
			cin >> F >> C;
			if(F==1){
				S.push_front(C);
			}else{
				S.push_back(C);
			}
			continue;
		}
	}
	

	
	
	
	cout << S << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:35: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_front'
   25 |                                 S.push_front(C);
      |                                   ^~~~~~~~~~
Language: C

#include <stdio.h>
#include <string.h>
#define STRMAX 100000
void reverse(char *s){
    int len = strlen(s);
    char temp;
    for(int i = 0; i < (int)(len/2); i++){
        temp = s[i];
        s[i] = s[(len - 1) - i];
        s[len - 1 - i] = temp;
    }
}
void add(char *s, char c){
    char temp[strlen(s)+1];
    strcpy(temp, s);
    sprintf(s, "%c%s", c, temp);
    // printf("added: %s\n", s);
}
void push(char *s, char c){
    char temp[strlen(s)+1];
    strcpy(temp, s);
    sprintf(s, "%s%c", temp, c);
    // printf("pushed: %s\n", s);
}UINTMAX
int main(void){
    char s[STRMAX+1], c;
    scanf("%s", s);
    // printf("%s %d\n", s, strlen(s));
    int q, t, f;
    scanf("%d", &q);
    for(long i = 0; i < q; i++){
        scanf("%d", &t);
        if(t == 1){
            reverse(s);
        }
        else{ // t == 2
            scanf("%d", &f);
            getchar(); // 空白を飛ばすため
            scanf("%c", &c);
            if(f == 1){
                add(s, c);
            }
            else{ // f == 2
                push(s, c);
            }
        }
        // printf("%d %d %c\n", t, f, c);
    }
    printf("%s\n", s);
    return 0;
}

Compiler output:
main.c:24:9: error: expected ';' before 'int'
   24 | }UINTMAX
      |         ^
      |         ;
   25 | int main(void){
      | ~~~
Language: C++

#include "solve.h"
#include "gtest/gtest.h"

using namespace std::literals::string_literals;

int main(int argc, char **argv) {
    ::testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}

TEST(Test1, case1) {

  std::string in = R"(a
4
2 1 p
1
2 2 c
1)";
  std::string out = "cpa"s;

  std::ostringstream ost;
  std::istringstream ist(in + "\n");

  solve(ist, ost);
  std::string ostr = ost.str();

  EXPECT_EQ(ostr, out + "\n");
}

TEST(Test1, case2) {

  std::string in = R"(a
6
2 2 a
2 1 b
1
2 2 c
1
1)";
  std::string out = "aabc"s;

  std::ostringstream ost;
  std::istringstream ist(in + "\n");

  solve(ist, ost);
  std::string ostr = ost.str();

  EXPECT_EQ(ostr, out + "\n");
}

TEST(Test1, case3) {

  std::string in = R"(y
1
2 1 x)"s;
  std::string out = "xy"s;

  std::ostringstream ost;
  std::istringstream ist(in + "\n");

  solve(ist, ost);
  std::string ostr = ost.str();

  EXPECT_EQ(ostr, out + "\n");
}



Compiler output:
a.cc:1:10: fatal error: solve.h: No such file or directory
    1 | #include "solve.h"
      |          ^~~~~~~~~
compilation terminated.
Language: C++

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

deque<char> q;
string s;
bool f = true;

int main() {
	cin >> s;
	q.push_back(s);
	int T;
	cin >> T;
	
	while (T--) {
		int t;
		cin >> t;
		
		if (t == 1) {
			f = !f;
		}
		else {
			int p; char c;
			cin >> p >> c;
			
			if (f) {
				if (p == 1) {
					q.push_front(c);
				}
				else {
					q.push_back(c);
				}
			}
			else {
				if (f == 1) {
					q.push_back(c);
				}
				else {
					q.push_front(c);
				}
			}
		}
	}
	
	if (f) {
		while (!q.empty()) {
			cout << q.front();
			q.pop_front();
		}
	}
	else {
		while (!q.empty()) {
			cout << q.back();
			q.pop_back();
		}
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:20: error: no matching function for call to 'std::deque<char>::push_back(std::string&)'
   15 |         q.push_back(s);
      |         ~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/deque:66,
                 from a.cc:6:
/usr/include/c++/14/bits/stl_deque.h:1538:7: note: candidate: 'void std::deque<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = char; _Alloc = std::allocator<char>; value_type = char]'
 1538 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:1538:35: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const std::deque<char>::value_type&' {aka 'const char&'}
 1538 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_deque.h:1553:7: note: candidate: 'void std::deque<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = char; _Alloc = std::allocator<char>; value_type = char]'
 1553 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:1553:30: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::deque<char>::value_type&&' {aka 'char&&'}
 1553 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
Language: C++

#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(){
    string S,S_in;
    int Q,i,T,F,tmp=0;
    cin >> S >> Q;
    for(i=0;i<Q;i++){
        cin >> T;
        if(T == 1){
            tmp++;
        }else{
            cin >> F >> S_in;
            if((F + tmp) % 2 == 0){ //後ろに加える
                S.push_back(S_in);
            }else{
                S = S_in + S;
            }
        }
    }
    if(tmp % 2 == 1) reverse(S.begin(),S.end());
    cout << S;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:29: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'char'
   18 |                 S.push_back(S_in);
      |                             ^~~~
      |                             |
      |                             std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1572:24: note:   initializing argument 1 of 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 1572 |       push_back(_CharT __c)
      |                 ~~~~~~~^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  int q;
  cin >> q;
  string t;
  for(int i = qi; i < q; i++){
    int ty;
    cin >> ty;
    if(ty == 1){
      swap(s, t);
    }else{
      int f;
      char c;
      cin >> f >> c;
      if(f == 1){
        t = t + c;
      }else{
        s = s+c;
      }
    }
  }
  reverse(t.begin(), t.end());
  t = t + s;
  cout << t << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:15: error: 'qi' was not declared in this scope; did you mean 'i'?
   10 |   for(int i = qi; i < q; i++){
      |               ^~
      |               i
Language: C++

#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    string S;
    cin >> S;
    int Q;
    cin >> Q;
    bool reverse = false;
    string S1, S2;
    while(Q--)
    {
        int Ti;
        cin >> Ti;
        if(Ti == 1)
        {
            if(reverse) reverse = false;
            else reverse = true;
        }
        else if(Ti == 2)
        {
            int Fi;
            char Ci;
            cin >> Fi >> Ci;
            if(reverse){
                if(Fi == 1) S2 += Ci;
                else S1 += Ci;
            }
            else{
                if(Fi == 1) S1 += Ci;
                else S2 += Ci;
            }
        }
    }
    if(reverse)
    {
        reverse(S.begin(), S.end());
        reverse(S2.begin(), S2.end());
        cout << S2 + S + S1 << endl;
    }
    else
    {
        reverse(S1.begin(), S1.end());
        cout << S1 + S + S2 << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:16: error: 'reverse' cannot be used as a function
   41 |         reverse(S.begin(), S.end());
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:42:16: error: 'reverse' cannot be used as a function
   42 |         reverse(S2.begin(), S2.end());
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
a.cc:47:16: error: 'reverse' cannot be used as a function
   47 |         reverse(S1.begin(), S1.end());
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main() {
    string s;
    cin >> s;
    int q;
    cin >> q;
    int rev = 0;
    string front = "", back = "";
    for (int i = 0; i < q; i++) {
        int t, f;
        char c;
        cin >> t;
        if (t == 1) {
            rev++;
            continue;
        } else {
            cin >> f >> c;
            f--;
            if (rev % 2) f = 1 - f;
            if (f == 0) {
                front+= c;
            } else {
                back += c;
            }
        }
    }
    reverse(ans.begin(), ans.end());
    string ans = front + s + back;
    if (rev % 2) reverse(ans.begin(), ans.end());
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   30 |     reverse(ans.begin(), ans.end());
      |             ^~~
      |             abs
Language: C++

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

int main() {
  string S;
  int Q, T, F;
  char C;
  cin >> S >> Q;
  
  for (int i=0; i<Q; i++) {
    cin >> T;
    if (T==1) {
      reverse(S.begin(), S.end());
    }
    else if (T==2) {
      cin >> F >> C;
      if (F==1) {
        S=C+S;．
      }
      else if (F==2) {
        S=S+C;．
      }
    }
  }

    cout << S << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:15: error: '\U0000ff0e' was not declared in this scope
   18 |         S=C+S;．
      |               ^~
a.cc:21:15: error: '\U0000ff0e' was not declared in this scope
   21 |         S=S+C;．
      |               ^~
Language: C++

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

signed main() {            
	string s;
	cin >> s;

	int q;
	cin >> q;

	bool rev = false;
	deque<char> deq;
	for (auto u : s) deq.push_back(u);
	while (q--) {
		int t;
		cin >> t;
		if (t == 1) rev ^= 1;
		else {
		 	int f;
			cin >> f;
			char c;
			cin >> c;
			
			if (!rev) {
			 	if (f == 1) {      
					deq.push_front(c);	
				} else {                
					deq.push_back(с);
				}
			} else {
                              if (f == 2) {      
					deq.push_front(c);	
				} else {                
					deq.push_back(с);
				}
			}
		}
	}                                      
                          
	string ans;
	for (auto u : deq) ans.push_back(u);

	if (rev) reverse(ans.begin(), ans.end());
	cout << ans << '\n';	
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:55: error: '\U00000441' was not declared in this scope
   29 |                                         deq.push_back(с);
      |                                                       ^
a.cc:35:55: error: '\U00000441' was not declared in this scope
   35 |                                         deq.push_back(с);
      |                                                       ^
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;

int main() {
    string S;
    int Q;
    cin >> S >> Q;
    bool rev = false;
    deque<char> deq;
	for(auto e:S) deq.push_back(e);
    rep(i, Q) {
        int q = 0;
        cin >> q;
        if (q == 1) {
            rev = !rev;
            continue;
        }
        int F;
        char C;
        cin >> F >> C;
        if (!rev) {
            if (F == 1)
                deq.push_front(C);
            else
                deq.push_back(C);

        } else {
            if (F == 1)
                deq.push_back(C);
            else
                deq.push_front(C);
        }
    }

    if(!rev){
		for(auto e:deq) cout << e;
	} else {
		for(auto it = deq.rbegin();deq!=rend();--it){
			cout << *it;
		}
	}
	cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:53: error: no matching function for call to 'rend()'
   41 |                 for(auto it = deq.rbegin();deq!=rend();--it){
      |                                                 ~~~~^~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:172:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.rend()) std::rend(_Container&)'
  172 |     rend(_Container& __cont) -> decltype(__cont.rend())
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:172:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:183:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.rend()) std::rend(const _Container&)'
  183 |     rend(const _Container& __cont) -> decltype(__cont.rend())
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:183:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:205:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr std::reverse_iterator<_Tp*> std::rend(_Tp (&)[_Nm])'
  205 |     rend(_Tp (&__arr)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:205:5: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:227:5: note: candidate: 'template<class _Tp> constexpr std::reverse_iterator<const _Tp*> std::rend(initializer_list<_Tp>)'
  227 |     rend(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:227:5: note:   candidate expects 1 argument, 0 provided
Language: C++

#include <iostream>
#include <string>
using namespace std;
int main()
{
  string S;
  int Q;
  cin >> S >> Q;
  bool rev = false;
  for (int i = 0; i < Q; i++) {
    int T, F;
    char c;
    cin >> T;
    if (T==1) {
      rev = !rev;
    } else {
      cin >> F >> c;
      if (F==1) {
        if (rev) {
          S = S + c;
        } else {
          S = c + S;
        }
      } else {
        if (rev) {
          S = c + S;
        } else {
          S = S + c;
        }
      }
    }
  }
  if (rev) {
    reverse(S.begin(), S.end());
  }
  cout << S << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:5: error: 'reverse' was not declared in this scope
   34 |     reverse(S.begin(), S.end());
      |     ^~~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;

int main() {
    string S;
    int Q;
    cin >> S >> Q;
    bool rev = false;
    string f = "";
    string b = "";
    rep(i, Q) {
        int q = 0;
        cin >> q;
        if (q == 1) {
            rev = !rev;
            continue;
        }
        int F;
        char C;
        cin >> F >> C;
        if (!rev) {
            if (F == 1)
                f = f + C;
            else
                b = b + C;
        } else {
            if (F == 1)
                b = b + C;
            else
                f = f + C;
        }
    }

    string ans = "";
    if (!rev) {
        reverse(f);
		ans = f;
        ans = ans + S;
        ans = ans + b;
    } else {
		reverse(all(S));
    	reverse(all(b));
		ans = b;
		ans = ans + S;
		ans = ans + f;
        
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:16: error: no matching function for call to 'reverse(std::string&)'
   39 |         reverse(f);
      |         ~~~~~~~^~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'template<class _BIter> void std::reverse(_BIter, _BIter)'
 1083 |     reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
      |     ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:5: note:   candidate expects 2 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
  249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
      | ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note:   candidate expects 3 arguments, 1 provided
Language: C++

#include <iostream>
#include <string>
using namespace std;
int main()
{
  string S;
  int Q;
  cin >> S;
  bool rev = false;
  for (int i = 0; i < Q; i++) {
    int T, F;
    char c;
    cin >> T;
    if (T==1) {
      rev = ~rev;
    } else {
      cin >> F >> c;
      if (F==1) {
        if (rev) {
          S = S + c;
        } else {
          S = c + S;
        }
      } else {
        if (rev) {
          S = c + S;
        } else {
          S = S + c;
        }
      }
    }
  }
  if (rev) {
    reverse(S.begin(), S.end());
  }
  cout << S << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:5: error: 'reverse' was not declared in this scope
   34 |     reverse(S.begin(), S.end());
      |     ^~~~~~~
Language: C++

#include <iostraem>
#include <string>
using namespace std;
int main()
{
  string S;
  int Q;
  cin >> S;
  bool rev = false;
  for (int i = 0; i < Q; i++) {
    int T, F;
    char c;
    cin >> T;
    if (T==1) {
      rev = ~rev;
    } else {
      cin >> F >> c;
      if (F==1) {
        if (rev) {
          S = S + c;
        } else {
          S = c + S;
        }
      } else {
        if (rev) {
          S = c + S;
        } else {
          S = S + c;
        }
      }
    }
  }
  if (rev) {
    reverse(S.begin(), S.end());
  }
  cout << S << endl;
  return 0;
}

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

#include <string>
#include <iostream>

int main () {
  char s[300000];
  std::cin>>s;
  int ns = std::strlen(s);
  int Q;
  std::cin>>Q;
  for (int i = 0 ; i < Q ; ++i ) {
    int T;
    std::cin>>T;
    if (T == 1 ) {
      char tmp;
      for (int i = 0 ; i < ns/2; ++i ) {
        tmp =  s[i];
        s[i] = s[ns - 1 - i ];
        s[ns - 1 - i ] = tmp;
      }
    }
    else {
      int F;
      char C;
      std::cin>>F>>C;
      if ( F== 1 )  {
        for (int i = ns ; i > 0; --i ) {
          s[i] = s[i-1];
        }
        s[0] = C;
      }
      else {
        s[ns] = C;
      }
      ++ns;
    }
  }
  std::cout<<s;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:17: error: 'strlen' is not a member of 'std'; did you mean 'mbrlen'?
    7 |   int ns = std::strlen(s);
      |                 ^~~~~~
      |                 mbrlen
Language: C++

#include <string>
#include <iostream>

int main () {
  char s[300000];
  std::cin>>s;
  int ns = std::strlen(s);
  int Q;
  std::cin>>Q;
  for (int i = 0 ; i < Q ; ++i ) {
    int T;
    std::cin>>T;
    if (T == 1 ) {
      char tmp;
      for (int i = 0 ; i < ns/2; ++i ) {
        tmp =  s[i];
        s[i] = s[ns - 1 - i ];
        s[ns - 1 - i ] = tmp;
      }
    }
    else {
      int F;
      char C;
      std::cin>>F>>C;
      if ( F== 1 )  {
        for (int i = ns ; i > 0; --i ) {
          s[i] = s[i-1];
        }
        s[0] = C;
      }
      else {
        s[ns] = C;
      }
      ++ns;
    }                                            
  }
  std::cout<<s;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:17: error: 'strlen' is not a member of 'std'; did you mean 'mbrlen'?
    7 |   int ns = std::strlen(s);
      |                 ^~~~~~
      |                 mbrlen
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<math.h>
#include<numeric>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
//scanf("%d", &a); '\n'; cout << fixed << setprecision(10);

int main() {
	//ios::sync_with_stdio(false);
	//cin.tie(0);
	string s;
	int q;
	cin >> s >> q;
	bool flag= 0;
	rep(i, q) {
		;
		int a;
		scanf("%d", &a);
		if (a == 1) flag = !flag;
		else {
			int b; char c;
			scanf("%d %c", &b, &c);
			if (b == 1&&!flag) {
				s = c + s;
			}
			else if (b == 2 && flag) s = c + s;
			else s = s + c;
		}
	}
	if (flag) { for (int i = s.size() - 1; i >= 0; --i)cout << s[i]; };
	else cout << s;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:9: error: 'else' without a previous 'if'
   42 |         else cout << s;
      |         ^~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  string s, ss = "", head, tail;
  int q, t, f, l;
  char c;
  int flag = 0;
  cin >> s;
  cin >> q;
  rep(i,q) {
    cin >> t;
    if (t==1) flag = (flag+1) % 2;
    else if (t==2){
      cin >> f >> c;
      if ((flag+f)%2==1) head = c+head;
      else tail = tail+c;
    }
  }
  s = head + s + tail
  if (flag==1) {
    l = s.size();
    rep(i,l) ss += s[l-i-1];
    cout << ss << endl;
  } else cout << s << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:22: error: expected ';' before 'if'
   23 |   s = head + s + tail
      |                      ^
      |                      ;
   24 |   if (flag==1) {
      |   ~~                  
a.cc:28:5: error: 'else' without a previous 'if'
   28 |   } else cout << s << endl;
      |     ^~~~
Language: C++

//                                  _                 ______   ______   ______   ______
//                                 | |               |  __  | |  __  | |  __  | |____  |
//    __ _   ____    _____    _  _ | |____           | |__| | | |__| | | |__| |      | |
//  / _` | |  __| /  __  |  / _` | |  __  |          |____  | |____  | |____  |      | |
// | (_| | | |    | |  | | | (_| | | |__| |  ______   ____| |  ____| |  ____| |      | |
//  \__,_| |_|    |_|  |_|  \__,_| |______| |______| |______| |______| |______|      |_|

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

#define ll long long
#define endl '\n'
#define REP(i, n) for(int i=0; i<n; i++)
#define pb push_back
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const double PI = 3.141592653589793238460;
const ll mod = 1e9+7;

void FAST(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

int main(){
  // #ifndef ONLINE_JUDGE
  // freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// freopen("error.txt", "w", stderr);
  // #endif
  FAST();
  //Code goes past here:

  string str;
  int t, f;
  char ch;
  ll i, q;

  cin>>str>>q;

  bool todo = 0;
  vector<char> v[2];

  while(q--){
    cin>>t;

    if(t==1)
      todo = !todo;

    else if(t==2){
      cin>>f>>ch;
      --f;
      v[f^todo].push_back(ch);
    }
  }

  string ans;
  for(i = v[0].size()-1; ~i ; --i)   ans += v[0][i];
  ans += str;

  for(char c: v[1])   ans += c;

  if(todo)  reverse(abc.begin(), abc.end());

  cout<<ans<<endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:68:21: error: 'abc' was not declared in this scope; did you mean 'abs'?
   68 |   if(todo)  reverse(abc.begin(), abc.end());
      |                     ^~~
      |                     abs
Language: C++

#pragma GCC optimize ("O3", "unroll-loops")
#pragma GCC target ("avx")
#include <stdio.h>
#include <algorithm>

constexpr unsigned int N = 2e6;
char buffer[N];
char *ptr = buffer;
constexpr unsigned int S = 5e5;
char Out[2 * S];
char *left = Out + S, *right = Out + S;

int main(void){
    setbuf(stdout, NULL, _IONBF, S);
    fread(buffer, sizeof(char), N, stdin);
    while('a' <= *ptr) *(right++) = *(ptr++);
    unsigned int q = 0;
    while(*(++ptr) >= '0') q = 10 * q + *ptr - '0';
    bool flag = false;
    while(q--){
        if(*(++ptr) == '1') flag = not flag;
        else{
            if((*(ptr += 2) == '1') ^ flag) *(--left) = *(ptr += 2);
            else *(right++) = *(ptr += 2); 
        }
        ptr++;
    }
    if(flag) std::reverse(left, right);
    fwrite(left, sizeof(char), right - left, stdout);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:11: error: too many arguments to function 'void setbuf(FILE*, char*)'
   14 |     setbuf(stdout, NULL, _IONBF, S);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from a.cc:3:
/usr/include/stdio.h:334:13: note: declared here
  334 | extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW
      |             ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
  string s;
  cin>>s;
  long long q,c1=0,i;
  cin>>q;
  while(q--){
   string c;
    long long t,i;
    cin>>t;
    if(t==1)
    c1=!c1;
    else if(t==2){
      cin>>i>>c;
      if(i==1)
      s.append(c);
     else if(i==2) s=c.append(s);
    }
  }
  if(c)
  cout<<s;
  else {
  for(i=s.length()-1;i>=0;i--){
       cout<<s[i];         
    }
  }
  return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:6: error: 'c' was not declared in this scope
   23 |   if(c)
      |      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rip(a,b,c) for(int (a)=(c);(a)<(b);(a)++)
const long long INF= 1LL << 60;
int main(){
    //入力始まり
    string S;
    long long Q;
    cin >> S >> Q;
    vector<int>T(Q);
    vector<int>F(Q,0);
    vector<char>C(Q);
    for(long long i=0;i<Q;i++){
        cin >> T[i];
        if(T[i]==2){
            cin >> F[i];
            cin >> C[i];
        }
    }
    //入力終わり

    for(long long i=0;i<Q;i++){
    if(T[i]==1){
        reverse(S.begin(),S.end());
    }else{
        if(F[i]==1){
            S=C[i]+S;
        }else{
            S=S+C[i];
        }
    }}
    cout << S << endl;
    retun 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:33:5: error: 'retun' was not declared in this scope
   33 |     retun 0;
      |     ^~~~~
Language: C++

s = input()
q = int(input())
for i in range(q):
    query = list(input().split())
    if query[0] == "2":
        if query[1] == "1":
            s = query[2] + s
        else:
            s = s + query[2]
    else:
        temp = s[:]
        s = ""
        for j in range(len(temp)):
            s += temp[-1-j]
print(s)

Compiler output:
a.cc:1:1: error: 's' does not name a type
    1 | s = input()
      | ^
Language: C++

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

int main() {
  string s;
  int q, rev;
  deque<char> dq;
  cin >> s >> q;
  for (char x : s) {
    dq.push_back(x);
  ｝
  for (int i = 0; i < q; i++) {
    int temp, a;
    string b;
    cin >> temp;
    if (temp == 1) rev = !rev;
    else {
      cin >> a >> b;
      if (rev xor (a-1)) dq.push_back(b[0]);
      else dq.push_front(b[0]);
    ｝
  ｝
  while (!dq.empty()) {
    auto t = rev ? dq.back() : dq.front();
    cout << *t;
    dq.erase(t);
  ｝
  cout << endl;
｝


Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: '\U0000ff5d' was not declared in this scope
   11 |   ｝
      |   ^~
a.cc:12:19: error: 'i' was not declared in this scope
   12 |   for (int i = 0; i < q; i++) {
      |                   ^
a.cc:29:3: error: expected '}' at end of input
   29 | ｝
      |   ^
a.cc:9:20: note: to match this '{'
    9 |   for (char x : s) {
      |                    ^
a.cc:29:3: error: expected '}' at end of input
   29 | ｝
      |   ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

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

int main(){
  string s;
  int q, rev;
  deque<char> dq;
  cin >> s >> q;
  for (char x : s) ｛
    dq.push_back(x);
  ｝
  for (int i = 0; i < q; i++) ｛
    int temp, a;
    string b;
    cin >> temp;
    if (temp == 1) rev = !rev;
    else ｛
      cin >> a >> b;
      if (rev xor (a-1)) dq.push_back(b[0]);
      else dq.push_front(b[0]);
    ｝
  ｝
  while (!dq.empty()) {
    auto t = rev ? dq.back() : dq.front();
    cout << *t;
    dq.erase(t);
  ｝
  cout << endl;
｝

Compiler output:
a.cc: In function 'int main()':
a.cc:9:20: error: '\U0000ff5b' was not declared in this scope
    9 |   for (char x : s) ｛
      |                    ^~
a.cc:11:3: error: '\U0000ff5d' was not declared in this scope
   11 |   ｝
      |   ^~
a.cc:12:19: error: 'i' was not declared in this scope
   12 |   for (int i = 0; i < q; i++) ｛
      |                   ^
a.cc:15:12: error: 'temp' was not declared in this scope; did you mean 'tm'?
   15 |     cin >> temp;
      |            ^~~~
      |            tm
a.cc:17:10: error: '\U0000ff5b' was not declared in this scope
   17 |     else ｛
      |          ^~
a.cc:19:20: error: 'a' was not declared in this scope
   19 |       if (rev xor (a-1)) dq.push_back(b[0]);
      |                    ^
a.cc:21:7: error: expected ';' before '\U0000ff5d'
   21 |     ｝
      |       ^
      |       ;
   22 |   ｝
      |   ~~   
a.cc:29:3: error: expected '}' at end of input
   29 | ｝
      |   ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a[2000005];
deque < int > a2;
int d[2000005];
deque < int > d2;
char r[2000005];
deque < string > r2;
int main()
{
	string s,t,r;	
	int n;
	cin>>s>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		if(a[i]==2)
		{
			cin>>d[i]>>r[i];
		}
	}
	for(int i=0;i<n;i++)
	{
		if(i!=n-1&&a[i]==1&&a[i]==a[i+1])
		{
			i++;
			continue;
		}
		a2.push_back(a[i]);
		string s="";
		while(a[i]==2&&i<n-1&&d[i]==d[i]+1&&d[i]!=0)
		{
			s+=r[i];
			i++;
		}
		if(s!="")
		{
			if(d[i]==d[i-1]&&d[i]!=0)
			{
				s+=r[i];
			}
			else
			{
				i--;
			}
			r2.push_back(s);
		}
		else
		{
			r2.push_back(r[i]);
		}
		d2.push_back(d[i]);
	}
	int j=a2.size();
	int q=0;
	for(int i=0;i<j;i++)
	{
		if(a2[i]==1)
		{
			reverse(s.begin(),s.end());
		}	
		else
		{
			if(d2[q]==1)
			{
				s.insert(0,r2[q]);
			}
			else
			{
				s+=r2[q];
			}
			q++;
		}
	}
	cout<<s;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:37: error: no matching function for call to 'std::deque<std::__cxx11::basic_string<char> >::push_back(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
   50 |                         r2.push_back(r[i]);
      |                         ~~~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/deque:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:139,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_deque.h:1538:7: note: candidate: 'void std::deque<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; value_type = std::__cxx11::basic_string<char>]'
 1538 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:1538:35: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::deque<std::__cxx11::basic_string<char> >::value_type&' {aka 'const std::__cxx11::basic_string<char>&'}
 1538 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_deque.h:1553:7: note: candidate: 'void std::deque<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; value_type = std::__cxx11::basic_string<char>]'
 1553 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:1553:30: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'std::deque<std::__cxx11::basic_string<char> >::value_type&&' {aka 'std::__cxx11::basic_string<char>&&'}
 1553 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
Language: C++

#include<bits/stdc++.h>
#include<string>
#include<deque>
#include<iostream>
#include<algorithm>
using namespace std;
#define int long long
#define double long double
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define pp() pop_back()
#define V vector
#define P pair
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
#define Q queue
#define all(a)  (a).begin(),(a).end()
#define elif else if

signed main(){
  string s;
  cin>>s;
  int q;
  cin>>q;
  int a=0;
  deque<string> b;
  b.pb(s);
  fo(i,q){
    int c;
    cin>>c;
    if(c==1)
      a++;
    else{
      int d;
      cin>>d;
      string e;
      cin>>e;
      if((a%2==0&&d==1)||(a%2==1&d==2)){
        b.pf(e);
      }
      else
        b.pb(e);
    }
  }
  if(a%2==1){
    while(b.size()){
      string f=b.back();
      rev(f);
      cout<<f;
    }
    d.pp();
  }

  else{
    fo(i,b.size()){
      cout<<b[i];
    }
    cout<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:5: error: 'd' was not declared in this scope
   56 |     d.pp();
      |     ^
Language: C++

#include <iostream>
#include <string>
using namespace std;
 
int main(void){
  string S, front="", back="";
  int Q, D, F;
  char C;
  cin >> S;
  cin >> Q;
  bool rev = false;
  
  for(int i=0; i<Q; i++){
    cin >> D;
    if(D==1){
      rev = !rev;
    }else if(D==2){
      cin >> F >> C;
      if(rev){
        if(F==1){
          back = back+C;
        }else if(F==2){
          front = front+C;
        }
      }else if(!rev){
        if(F==1){
          front = front+C;
        }else if(F==2){
          back = back+C;
        }
      }
    }
      
  }
  reverse(front.begin(),front.end());
  S = front + S + back;
  if(rev)reverse(S.begin(), S.end());
 
  cout << S;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:3: error: 'reverse' was not declared in this scope
   35 |   reverse(front.begin(),front.end());
      |   ^~~~~~~
Language: C

#include <iostream>
#include <string>
using namespace std;
 
int main(void){
  string S, front="", back="";
  int Q, D, F;
  char C;
  cin >> S;
  cin >> Q;
  bool rev = false;
  
  for(int i=0; i<Q; i++){
    cin >> D;
    if(D==1){
      rev = !rev;
    }else if(D==2){
      cin >> F >> C;
      if(rev){
        if(F==1){
          back = back+C;
        }else if(F==2){
          front = front+C;
        }
      }else if(!rev){
        if(F==1){
          front = front+C;
        }else if(F==2){
          back = back+C;
        }
      }
    }
      
  }
  reverse(front.begin(),front.end());
  S = front + S + back;
  if(rev)reverse(S.begin(), S.end());
 
  cout << S;
  return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: Java

import java.util.Scanner;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    StringBuffer head = new StringBuffer();
    StringBuffer tail = new StringBuffer();
    int Q = Integer.parseInt(sc.next());
    int T, F;
    String C;
    boolean rev = false;
    for(int i=0; i<Q; i++){
      T = Integer.parseInt(sc.next());
      if(T==1){
        if(rev)rev=false;
        else rev=true;
      } else if(T==2){
        F = Integer.parseInt(sc.next());
        C = sc.next();
        if(F==1){
          if(rev) tail.append(C);
          else head.insert(0,C);
        } else if(F==2){
          if(rev) head.insert(0,C);
          else tail.append(C);
        }
      }
    }
    if(rev){
      head.reverse();
      tail.reverse();
    }
    head.append(S).append(tail)
    System.out.println(head);
  }
}

Compiler output:
Main.java:33: error: ';' expected
    head.append(S).append(tail)
                               ^
1 error