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

#include<iostream>
#include<vector>
#include<array>
using namespace std;
int main(){
string s;
int q;
cin>>s>>q;
bool st=0;
vector<char> v[2];
while(q--){
   int qt;
   cin>>qt;
   if(qt==1){
      st=!st;
   }
   else{
   
      int f;
	  char c;
	  cin>>f>>c;
	  v[f^st].push_back(c);
   }

}
string t;
for(int i=(int)v[0].size();~i;--i)
  t+=v[0][i];
t+=s;
for(char c: v[1])
	t+=c;
if(st)
	reverse(t.begin(),t.end());
cout<<t<<endl;
}



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

#include<iostream>
#include<array>
using namespace std;
int main(){
string s;
int q;
cin>>s>>q;
bool st=0;
vector<char> v[2];
while(q--){
   int qt;
   cin>>qt;
   if(qt==1){
      st=!st;
   }
   else{
   
      int f;
	  char c;
	  cin>>f>>c;
	  v[f^st].push_back(c);
   }

}
string t;
for(int i=(int)v[0].size();~i;--i)
  t+=v[0][i];
t+=s;
for(char c: v[1])
	t+=c;
if(st)
	reverse(t.begin(),t.end());
cout<<t<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:9:1: error: 'vector' was not declared in this scope
    9 | vector<char> v[2];
      | ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include<array>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:9:8: error: expected primary-expression before 'char'
    9 | vector<char> v[2];
      |        ^~~~
a.cc:21:11: error: 'v' was not declared in this scope
   21 |           v[f^st].push_back(c);
      |           ^
a.cc:26:16: error: 'v' was not declared in this scope
   26 | for(int i=(int)v[0].size();~i;--i)
      |                ^
a.cc:29:13: error: 'v' was not declared in this scope
   29 | for(char c: v[1])
      |             ^
a.cc:32:9: error: 'reverse' was not declared in this scope
   32 |         reverse(t.begin(),t.end());
      |         ^~~~~~~
Language: C++

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
   string s,c;
   cin>>s;
   int q,t,f,co;
   co=0;
   cin>>q;
   for(int i=0; i<q; i++){
      cin>>t;
      if(t==1){co=co+1}
      if(t==2){
         cin>>f;
         cin>>c;
         if(f==1&&co%2==0){s=c+s;}
         if(f==2&&co%2==0){s=s+c;}
         if(f==1&&co%2==1){s=s+c;}
         if(f==2&&co%2==1){s=c+s;}
      }
   }
   if(co%2==1){reverse(s.begin(),s.end());}
   cout<<s<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:23: error: expected ';' before '}' token
   18 |       if(t==1){co=co+1}
      |                       ^
      |                       ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
	string str;
  	cin >> str;
  	int q;
  	cin >> q;
  	int r = 0;
  
  	vector<char> ch;
  	vector<int> par;
  	vector<int> rev;
  
  	while (q-- > 0) {
      int t;
      cin >> t;
      if (t == 2) {
        char s; int p;
        cin >> p >> s;
        ch.push_back(s);
        par.push_back(p - 1);
        rev.push_back(r);
      } else {
        r++;
        r%=2;
      }
    }
  	dequeu<char> dq;
  	dq.push_back(str[0]);
  	for (int i = 0; i < ch.size(); i++) {
      if ((par[i] + r - rev[i] + 2) % 2) dq.push_back(ch[i]);
      else dq.push_front(ch[i]);
    }
  	str = "";
  	for (int i = 0; i < dq.size(); i++) str = str + dq.pop_front();
  	cout << str << endl;
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:9: error: 'dequeu' was not declared in this scope
   28 |         dequeu<char> dq;
      |         ^~~~~~
a.cc:28:16: error: expected primary-expression before 'char'
   28 |         dequeu<char> dq;
      |                ^~~~
a.cc:29:9: error: 'dq' was not declared in this scope; did you mean 'q'?
   29 |         dq.push_back(str[0]);
      |         ^~
      |         q
Language: C++

	#include<iostream>
	#include<string>
	int min(int a, int b);
	using namespace std;
	int main() {

		//A
		/*string str;
		cin >> str;

		if ((str == "AAA") || (str == "BBB")) {
			cout << "No";
		}else{
			cout << "Yes";
		}*/

		//B
		/*long long int n, a, b;
		cin >> n;
		cin >> a;
		cin >> b;

		cout << (long long int)(n / (a + b))* a + min(n % (a + b), a);
		*/

		//C
		/*
		int a, b;
		cin >> a;
		cin >> b;
		int i;
		for (i = 1; i <= 10000; i++) {
			if (((int)(i * 0.08) == a) && ((int)(i * 0.1) == b)) {
				cout << i;
				return 0;
			}
		}
		cout << -1;
		*/

		string str,c;
		cin >> str;
		int q;
		cin >> q;
		int i,t,f;
		for (i = 0; i < q; i++) {
			cin >> t;
			if (t == 1) {
				reverse(str.begin(), str.end());

			}
			else {
				cin >> f; cin >> c;
				if (f == 1) {
					str = c + str;
				}
				else {
					str = str + c;

				}
				
			}
		}
		cout << str;

	}

	int min(int a, int b) {
		if (a < b) {
			return a;
		}
		else {
			return b;
		}
	}

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

#include <bits/stdc++.h>
using namespace std;
int main() {
	string str;
  	cin >> str;
  	int q;
  	cin >> q;
  	int r = 0;
  
  	vector<char> ch;
  	vector<int> par;
  	vector<int> rev;
  
  	while (q-- > 0) {
      int t;
      cin >> t;
      if (t == 2) {
        char s; int p;
        cin >> p >> s;
        ch.push_back(s);
        par.push_back(p - 1);
        rev.push_back(r);
      } else {
        r++;
        r%=2;
      }
    }
  	dequeu<char> dq;
  	dq.push_back(str[0]);
  	for (int i = 0; i < ch.size(); i++) {
      if ((par[i] + r - rev[i] + 2) % 2) dq.push_back(ch[i]);
      else dq.push_front(ch[i]);
    }
  	str = "";
  	for (int i = 0; i < dq.size(); i++) str += dq.pop_front();
  	cout << str << endl;
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:9: error: 'dequeu' was not declared in this scope
   28 |         dequeu<char> dq;
      |         ^~~~~~
a.cc:28:16: error: expected primary-expression before 'char'
   28 |         dequeu<char> dq;
      |                ^~~~
a.cc:29:9: error: 'dq' was not declared in this scope; did you mean 'q'?
   29 |         dq.push_back(str[0]);
      |         ^~
      |         q
Language: C++

	#include<iostream>
	#include<string.h>
	int min(int a, int b);
	using namespace std;
	int main() {

		//A
		/*string str;
		cin >> str;

		if ((str == "AAA") || (str == "BBB")) {
			cout << "No";
		}else{
			cout << "Yes";
		}*/

		//B
		/*long long int n, a, b;
		cin >> n;
		cin >> a;
		cin >> b;

		cout << (long long int)(n / (a + b))* a + min(n % (a + b), a);
		*/

		//C
		/*
		int a, b;
		cin >> a;
		cin >> b;
		int i;
		for (i = 1; i <= 10000; i++) {
			if (((int)(i * 0.08) == a) && ((int)(i * 0.1) == b)) {
				cout << i;
				return 0;
			}
		}
		cout << -1;
		*/

		string str,c;
		cin >> str;
		int q;
		cin >> q;
		int i,t,f;
		for (i = 0; i < q; i++) {
			cin >> t;
			if (t == 1) {
				reverse(str.begin(), str.end());

			}
			else {
				cin >> f; cin >> c;
				if (f == 1) {
					str = c + str;
				}
				else {
					str = str + c;

				}
				
			}
		}
		cout << str;

	}

	int min(int a, int b) {
		if (a < b) {
			return a;
		}
		else {
			return b;
		}
	}

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

#include <bits/stdc++.h>
using namespace std;
int main() {
	string str;
  	cin >> str;
  	int q;
  	cin >> q;
  	int r = 0;
  
  	vector<char> ch;
  	vector<int> par;
  	vector<int> rev;
  
  	while (q-- > 0) {
      int t;
      cin >> t;
      if (t == 2) {
        char s; int p;
        cin >> s >> p;
        ch.push_back(s);
        par.push_back(p - 1);
        rev.push_back(r);
      } else {
        r++;
      }
    }
  
  	for (int i = 0; i < ch.size(); i++) {
      if ((par[i] + r - rev[i]) % 2) s = s + ch[i];
      else s = ch[i] + s;
    }
  	cout << s << endl;
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:38: error: 's' was not declared in this scope
   29 |       if ((par[i] + r - rev[i]) % 2) s = s + ch[i];
      |                                      ^
a.cc:30:12: error: 's' was not declared in this scope
   30 |       else s = ch[i] + s;
      |            ^
a.cc:32:17: error: 's' was not declared in this scope
   32 |         cout << s << endl;
      |                 ^
Language: C++

#include<iostream>
#include<algorithm>
void Func(std::string& S, int& Q)
{
    std::vector<std::string> vect {};
    for(int i = 1; i <= Q; ++i)
    {
        std::string ss;
        std::cin >> ss;
        if(ss.at(0) == '1')
            std::reverse(S.begin(), S.end());
        else
        {
            if(ss.at(1) == '1')
                S.insert(S.begin(), ss.at(2));
            else if(ss.at(1) == '2')
                S.insert(S.end(), ss.at(2));
        }
    }
    std::cout << S;
}
int main()
{
    int Q{};
    std::string S;
    std::cin >> S >> Q;
    Func(S,Q);
}


Compiler output:
a.cc: In function 'void Func(std::string&, int&)':
a.cc:5:10: error: 'vector' is not a member of 'std'
    5 |     std::vector<std::string> vect {};
      |          ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include<algorithm>
  +++ |+#include <vector>
    3 | void Func(std::string& S, int& Q)
a.cc:5:28: error: expected primary-expression before '>' token
    5 |     std::vector<std::string> vect {};
      |                            ^
a.cc:5:30: error: 'vect' was not declared in this scope
    5 |     std::vector<std::string> vect {};
      |                              ^~~~
Language: C++

void Func(std::string& S, int& Q)
{
    std::vector<std::string> vect {};
    for(int i = 1; i <= Q; ++i)
    {
        //std::getline(std::cin,vect.emplace_back());
        std::string ss;
        std::cin >> ss;
        if(ss.at(0) == '1')
            std::reverse(S.begin(), S.end());
        else
        {
            if(ss.at(1) == '1')
                S.insert(S.begin(), ss.at(2));
            else if(ss.at(1) == '2')
                S.insert(S.end(), ss.at(2));
        }
    }
    std::cout << S;
        
}
int main()
{
    int Q{};
    std::string S;
    std::cin >> S >> Q;
    Func(S,Q);
}

Compiler output:
a.cc:1:6: error: variable or field 'Func' declared void
    1 | void Func(std::string& S, int& Q)
      |      ^~~~
a.cc:1:16: error: 'string' is not a member of 'std'
    1 | void Func(std::string& S, int& Q)
      |                ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | void Func(std::string& S, int& Q)
a.cc:1:24: error: 'S' was not declared in this scope
    1 | void Func(std::string& S, int& Q)
      |                        ^
a.cc:1:27: error: expected primary-expression before 'int'
    1 | void Func(std::string& S, int& Q)
      |                           ^~~
a.cc: In function 'int main()':
a.cc:25:10: error: 'string' is not a member of 'std'
   25 |     std::string S;
      |          ^~~~~~
a.cc:25:10: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:26:10: error: 'cin' is not a member of 'std'
   26 |     std::cin >> S >> Q;
      |          ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | void Func(std::string& S, int& Q)
a.cc:26:17: error: 'S' was not declared in this scope
   26 |     std::cin >> S >> Q;
      |                 ^
a.cc:27:5: error: 'Func' was not declared in this scope
   27 |     Func(S,Q);
      |     ^~~~
Language: C++

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

using namespace std;

int main()
{
  string s;
  int Q;
  bool isReverse = false;
  cin >> s >> Q;
  for(int i = 1 ; i <= Q;i++){
    int T;
    cin >> T;
    if(T == 1){
        isReverse = !isReverse;
    }
    else if(T == 2){
      string ss;
      int F;
      cin >> F >> ss;
      if(F == 1){
          if(isReverse) s = s + ss;
          else s = ss + s;
      }
      else if(F == 2){
         if(isReverse) s = ss + s;
         else s = s + ss;
      }
    }
  }
  if(!isReverse) cout << s << endl;
  else{
     // for (size_t i = 0; i < s.size();i++){
        cout << s[s.size()-1 -i];
     // }
     // cout << "\n";
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:31: error: 'i' was not declared in this scope
   36 |         cout << s[s.size()-1 -i];
      |                               ^
Language: C++

#include <iostream>
using namespace std;
using ll = long long;
#include <string>
#include <vector>
#include<list>
#include <algorithm>
#include <bits/stdc++.h>

int main() {
	string s;
	cin >> s;
	int q;
	cin >> q;
	vector<int> vec(q);
	for (int i = 0; i < q; i++) {
		cin >> vec.at(i);
		if (vec.at(i) == 1)reverse(s.begin(), s.end());
		else {
		 int f;
		 char w;
		 cin >> f>>w;
		 if (f == 2)s.push_back(w);
		 else {
			
			 s.push_front(w);
			

		 }
		}

	}
	cout << s << endl;
}

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

#include <iostream>
using namespace std;
using ll = long long;
#include <string>
#include <vector>
#include <algorithm>
#include <bits/stdc++.h>

int main() {
	string s;
	cin >> s;
	int q;
	cin >> q;
	vector<int> vec(q);
	for (int i = 0; i < q; i++) {
		cin >> vec.at(i);
		if (vec.at(i) == 1)reverse(s.begin(), s.end());
		else {
		 int f;
		 char w;
		 cin >> f>>w;
		 if (f == 2)s.push_back(w);
		 else {
			reverse(s.begin(), s.end());
			 s.puch_back(w);
			reverse(s.begin(), s.end());

		 }
		}

	}
	cout << s << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:28: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'puch_back'; did you mean 'push_back'?
   25 |                          s.puch_back(w);
      |                            ^~~~~~~~~
      |                            push_back
Language: C++

#include <iostream>
using namespace std;
using ll = long long;
#include <string>
#include <vector>
#include <algorithm>

int main() {
	string s;
	cin >> s;
	int q;
	cin >> q;
	vector<int> vec(q);
	for (int i = 0; i < q; i++) {
		cin >> vec.at(i);
		if (vec.at(i) == 1)reverse(s.begin(), s.end());
		else {
		 int f;
		 char w;
		 cin >> f>>w;
		 if (f == 2)s.push_back(w);
		 else {
			
			 s.vector::insert(w);
			

		 }
		}

	}
	cout << s << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:28: error: 'template<class _Tp, class _Alloc> class std::vector' used without template arguments
   24 |                          s.vector::insert(w);
      |                            ^~~~~~
Language: C++

int main(){
    string str;
    int Q;
    cin>>str;
    cin>>Q;
    bool r_flag= false;
    queue<char> q;
    stack<char> s;
    while(Q--){
      int Ti;
      cin>>Ti;
      if(Ti == 1){
        r_flag = !r_flag;
      }
      else{
          int Fi; char ch;
          cin>>Fi>>ch;
          if(Fi == 1 && !r_flag){
              s.push(ch);
          }
          if(Fi == 1 && r_flag){
              q.push(ch);
          }
          if(Fi == 2 && !r_flag){
              q.push(ch);
          }
          if(Fi == 2 && r_flag){
              s.push(ch);
          }
      }
    }
   string temp = "";
   while(s.size() > 0){ char c =s.top(); s.pop(); temp += c;}
   
    temp += str;
    while(q.size() > 0){ char c = q.front(); q.pop(); temp += c;}   
   
   if(r_flag)  reverse(temp.begin(), temp.end());
     
    cout<<temp<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:5: error: 'string' was not declared in this scope
    2 |     string str;
      |     ^~~~~~
a.cc:4:5: error: 'cin' was not declared in this scope
    4 |     cin>>str;
      |     ^~~
a.cc:4:10: error: 'str' was not declared in this scope; did you mean 'std'?
    4 |     cin>>str;
      |          ^~~
      |          std
a.cc:7:5: error: 'queue' was not declared in this scope
    7 |     queue<char> q;
      |     ^~~~~
a.cc:7:11: error: expected primary-expression before 'char'
    7 |     queue<char> q;
      |           ^~~~
a.cc:8:5: error: 'stack' was not declared in this scope
    8 |     stack<char> s;
      |     ^~~~~
a.cc:8:11: error: expected primary-expression before 'char'
    8 |     stack<char> s;
      |           ^~~~
a.cc:19:15: error: 's' was not declared in this scope
   19 |               s.push(ch);
      |               ^
a.cc:22:15: error: 'q' was not declared in this scope
   22 |               q.push(ch);
      |               ^
a.cc:25:15: error: 'q' was not declared in this scope
   25 |               q.push(ch);
      |               ^
a.cc:28:15: error: 's' was not declared in this scope
   28 |               s.push(ch);
      |               ^
a.cc:32:10: error: expected ';' before 'temp'
   32 |    string temp = "";
      |          ^~~~~
      |          ;
a.cc:33:10: error: 's' was not declared in this scope
   33 |    while(s.size() > 0){ char c =s.top(); s.pop(); temp += c;}
      |          ^
a.cc:33:51: error: 'temp' was not declared in this scope
   33 |    while(s.size() > 0){ char c =s.top(); s.pop(); temp += c;}
      |                                                   ^~~~
a.cc:35:5: error: 'temp' was not declared in this scope
   35 |     temp += str;
      |     ^~~~
a.cc:36:11: error: 'q' was not declared in this scope
   36 |     while(q.size() > 0){ char c = q.front(); q.pop(); temp += c;}
      |           ^
a.cc:38:16: error: 'reverse' was not declared in this scope
   38 |    if(r_flag)  reverse(temp.begin(), temp.end());
      |                ^~~~~~~
a.cc:40:5: error: 'cout' was not declared in this scope
   40 |     cout<<temp<<endl;
      |     ^~~~
a.cc:40:17: error: 'endl' was not declared in this scope
   40 |     cout<<temp<<endl;
      |                 ^~~~
Language: C++

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

int main(){
  string s;
  cin >> s;
  int q;
  cin >> q ;
  string t;
  rep(qi,q){
 	int ty;
    cin >>ty ;
    if(ty = 1){
    	swap(s,t);
    }
    else{
    	int f;char c;
    	cin >> f >>c;
    }
    if (f==1){
      t += c;
      else{
      s+=c;
      }
    }
  }
  reverse(t.begin(),t.end());
  	t+=s;
  cout <<t<<endl;
  
  
  return 0;
}  	
    


Compiler output:
a.cc: In function 'int main()':
a.cc:21:9: error: 'f' was not declared in this scope
   21 |     if (f==1){
      |         ^
a.cc:22:12: error: 'c' was not declared in this scope
   22 |       t += c;
      |            ^
a.cc:23:7: error: expected '}' before 'else'
   23 |       else{
      |       ^~~~
a.cc:21:14: note: to match this '{'
   21 |     if (f==1){
      |              ^
a.cc:24:10: error: 'c' was not declared in this scope
   24 |       s+=c;
      |          ^
a.cc: At global scope:
a.cc:28:10: error: expected constructor, destructor, or type conversion before '(' token
   28 |   reverse(t.begin(),t.end());
      |          ^
a.cc:29:9: error: 't' does not name a type; did you mean 'tm'?
   29 |         t+=s;
      |         ^
      |         tm
a.cc:30:3: error: 'cout' does not name a type
   30 |   cout <<t<<endl;
      |   ^~~~
a.cc:33:3: error: expected unqualified-id before 'return'
   33 |   return 0;
      |   ^~~~~~
a.cc:34:1: error: expected declaration before '}' token
   34 | }
      | ^
Language: Java

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int q = sc.nextInt();
		boolean hanten = false;
		StringBuffer sb = new StringBuffer(s);

		String mae = "";
		String ato = "";

		for (int i = 0; i < q; i++) {
			int t = sc.nextInt();
			if (t == 1) {
				hanten = !hanten;
			} else {
				if (!hanten) {
					sb = sb.insert(0, mae).append(ato);
					sb = sb.reverse();
				}

				int f = sc.nextInt();
				String c = sc.next();
				if (f == 1) {
					mae = c + mae;
				} else {
					ato = ato + c;
				}
				hanten = false;
			}
		}
		sb = sb.insert(0, mae).append(ato);
		if (!hanten) {
			sb = sb.reverse();
		}
		System.out.println(sb.toString());
		sc.close();
	}
}


Compiler output:
Main.java:4: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:4: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

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

int main() {
    int op;
    string start = "";
    cin>>start>>endl;
    cin>>op>>endl;
    string t = "";
    while(op) {
       cin>>t>>endl;
       if(t[0] == '2') {
            
            if(t[2] == '2') {
               start += t[4];
             }
             else {
               string s = "";
               s += t[4];
               s+= start;
               start = s;
             }
         
       }else {
          reverse(start.begin(), start.end()); 
       }
      
    op--;  
    }
  
      
    return 0; 
}


Compiler output:
a.cc:2:9: fatal error: stdio: No such file or directory
    2 | #include<stdio>
      |         ^~~~~~~
compilation terminated.
Language: C

#include <stdio.h>
int main(void)
{
  char s[2][300001], c;
  int q, t, f, i, j flg;

  scanf("%s", s[0]);                // 標準入力からの値取得
  scanf("%d", &q);                  // 標準入力からの値取得

  flg = 0;
  for (i = 0; i < q; i++) {
    scanf("%d %d %c", &t, &f, &c);  // 標準入力からの値取得
    if (t == 1) {
      for (i = 0; s[flg][i] != '\0'; i++)
        ;
      j = i;
      s[~flg][j--] = '\0';
      for (i = 0; s[flg][i] =!'\0'; i++) {
        s[~flg][j--] = s[flg][i];
      }
    } else {
      if (f == 1) {
        j = 0;
        s[~flg][j++] = c;
        for (i = 0; s[flg] != '\0'; i++) {
          s[~flg][j++] = s[flg][i];
        }
        s[~flg][j] = '\0';
      } else {
        for (i = 0, j = 0; s[~flg][i] != '\0'; i++, j++) {
          s[~flg][j] = s[flg][i];
        }
        s[~flg][j++] = c;
        s[~flg][j] = '\0';
      }
    }
    flg = ~flg;
    printf("%s\n", s[flg]);            // 出力
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:21: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'flg'
    5 |   int q, t, f, i, j flg;
      |                     ^~~
main.c:10:3: error: 'flg' undeclared (first use in this function)
   10 |   flg = 0;
      |   ^~~
main.c:10:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:7: error: 'j' undeclared (first use in this function)
   16 |       j = i;
      |       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    string s;
    ll q;
    cin >> s;
    cin >> q;
    string k;
    string h;
    ll flag = 0;
    for (ll i = 0; i < q; i++)
    {
        int p;
        cin >> p;
        if (p == 1)
        {              //このとき反転させられる。→どっち向きになったのかの情報を持っておく。
            flag += 1; //これが奇数の時には反転している。
        }
        else if (p == 2)
        {
            int y;
            cin >> y;
            char f;
            cin >> f;
            if ((y + flag) % 2 == 1)
            {
                k= f + k; //これは本来の文字列の向きの先頭につける者。
            }
            else
            {
                h = h + f;
            }
        }
    }
    if (flag % 2 == 1)
    {
        reverse(s.begin(), s.end());
        reverse(k.begin(),k.end());
		reverse(h.begin(),h.end());
        cout << h+s+k << endl;
        return 0;
    }
    cout << k+s+h << endl;
}
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    string s;
    ll q;
    cin >> s;
    cin >> q;
    string k;
    string h;
    ll flag = 0;
    for (ll i = 0; i < q; i++)
    {
        int p;
        cin >> p;
        if (p == 1)
        {              //このとき反転させられる。→どっち向きになったのかの情報を持っておく。
            flag += 1; //これが奇数の時には反転している。
        }
        else if (p == 2)
        {
            int y;
            cin >> y;
            char f;
            cin >> f;
            if ((y + flag) % 2 == 1)
            {
                k= f + k; //これは本来の文字列の向きの先頭につける者。
            }
            else
            {
                h = h + f;
            }
        }
    }
    if (flag % 2 == 1)
    {
        reverse(s.begin(), s.end());
        reverse(k.begin(),k.end());
		reverse(h.begin(),h.end());
        cout << h+s+k << endl;
        return 0;
    }
    cout << k+s+h << endl;
}


Compiler output:
a.cc:50:5: error: redefinition of 'int main()'
   50 | int main()
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main()
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vstring vector<string>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 100000000


int main(){
  string s;
  cin >> s;
  ll q;
  cin >> q;
  //sから見て左の箱と右の箱を用意
  string left = '';
  string right = '';
  rep(i,q){
    int a;
    cin >> a;
    if(a == 1){
      //もし反転するのなら左の箱と右の箱をそれぞれ反転したものを交換
      reverse(left.begin(),left.end());
      reverse(right.begin(),right.end());
      swap(left,right);
    }
    else{
      int b;
      cin >> b;
      char f;
      cin >> f;
      if(b == 1){
        //
        left = f + left;
      }
      else{
        right.push_back(f);
      }
    }
    //cout << left << " " << right << endl;
    //cout << left << s << right << endl;
  }
  cout << left << s << right;
}


Compiler output:
a.cc:21:17: error: empty character constant
   21 |   string left = '';
      |                 ^~
a.cc:22:18: error: empty character constant
   22 |   string right = '';
      |                  ^~
a.cc: In function 'int main()':
a.cc:21:17: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   21 |   string left = '';
      |                 ^~
a.cc:22:18: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   22 |   string right = '';
      |                  ^~
Language: C++

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

Compiler output:
a.cc:25:2: error: expected unqualified-id before '/' token
   25 | }/
      |  ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:14:7: error: 'reserve' was not declared in this scope
   14 |       reserve(s.begin(),s.end());
      |       ^~~~~~~
Language: C++

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

int main()
{
  list<char> S;
  int Q;
  char c;
  cin >> c;
  S.push_back(c);
  cin >> Q;
  
  
  
  int a,b,h,p;
  h=1;
  p=0;
  
  while(S.size()>1)
  {
    p++;
    cin >> a;
    if(a==2)
    {
      cin >> b >> c;
      
        if(b==1)
        {
          S.push_front(c);
        }
        else
        {
          S.push_back(c);
        }
        
     }
  }
  
  for(int i=0; i < Q-p; i++)
  {
    cin >> a;
    if(a==2)
    {
      cin >> b >> c;
      if(h==-1)
      {
        if(b==1)
        {
          S.push_front(c);
        }
        else
        {
          S.push_back(c);
        }
      }
      else
      {
        if(b==1)
        {
          S.push_front(c);
        }
        else
        {
          S.push_back(c);
        }
        
      }

    }
    else
    {
      h*=-1;
    }
    
  }
  
  if(h=-1)
  {
    for(int i=Q-1;i>=0;i--)
    {
      cout << S[i];
    }
	
  }else
  {
    for(int i=0;i< Q;i++)
    {
      cout << S[i];
    }
    
  }
   
  
  
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:81:16: error: no match for 'operator[]' (operand types are 'std::__cxx11::list<char>' and 'int')
   81 |       cout << S[i];
      |                ^
a.cc:88:16: error: no match for 'operator[]' (operand types are 'std::__cxx11::list<char>' and 'int')
   88 |       cout << S[i];
      |                ^
Language: C++

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

int main()
{
  list<char> S;
  int Q;
  char c;
  cin >> c;
  S.push_back(c);
  cin >> Q;
  
  
  
  int a,b,h,p;
  h=1;
  p=0;
  
  while(S.size()>1)
  {
    p++;
    cin >> a;
    if(a==2)
    {
      cin >> b >> c;
      
        if(b==1)
        {
          S.push_front(c);
        }
        else
        {
          S.push_back(c);
        }
        
     }
  }
  
  for(int i=0; i < Q-p; i++)
  {
    cin >> a;
    if(a==2)
    {
      cin >> b >> c;
      if(h==-1)
      {
        if(b==1)
        {
          S.push_front(c);
        }
        else
        {
          S.push_back(c);
        }
      }
      else
      {
        if(b==1)
        {
          S.push_front(c);
        }
        else
        {
          S.push_back(c);
        }
        
      }

    }
    else
    {
      h*=-1;
    }
    
  }
  
  if(h=-1)
  {
    for(i=Q-1;i>=0;i--)
    {
      cout << S[i];
    }
	
  }else
  {
    for(i=0;i< Q;i++)
    {
      cout << S[i];
    }
    
  }
   
  
  
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:79:9: error: 'i' was not declared in this scope
   79 |     for(i=Q-1;i>=0;i--)
      |         ^
a.cc:86:9: error: 'i' was not declared in this scope
   86 |     for(i=0;i< Q;i++)
      |         ^
Language: C++

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

int main()
{
  vector<char> S;
  int Q;
  char c;
  cin >> c;
  S.push_back(c);
  cin >> Q;
  
  
  
  int a,b,h,p;
  h=1;
  p=0;
  
  while(S.size()>1)
  {
    p++;
    cin >> a;
    if(a==2)
    {
      cin >> b >> c;
      
        if(b==1)
        {
          S.push_front(c);
        }
        else
        {
          S.push_back(c);
        }
        
     }
  }
  
  for(int i=0; i < Q-p; i++)
  {
    cin >> a;
    if(a==2)
    {
      cin >> b >> c;
      if(h==-1)
      {
        if(b==1)
        {
          S.push_front(c);
        }
        else
        {
          S.push_back(c);
        }
      }
      else
      {
        if(b==1)
        {
          S.push_front(c);
        }
        else
        {
          S.push_back(c);
        }
        
      }

    }
    else
    {
      h*=-1;
    }
    
  }
  
  if(h=-1)
  {
    for(i=Q-1;i>=0;i--)
    {
      cout << S[i];
    }
	
  }else
  {
    for(i=0;i< Q;i++)
    {
      cout << S[i];
    }
    
  }
   
  
  
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:13: error: 'class std::vector<char>' has no member named 'push_front'
   29 |           S.push_front(c);
      |             ^~~~~~~~~~
a.cc:49:13: error: 'class std::vector<char>' has no member named 'push_front'
   49 |           S.push_front(c);
      |             ^~~~~~~~~~
a.cc:60:13: error: 'class std::vector<char>' has no member named 'push_front'
   60 |           S.push_front(c);
      |             ^~~~~~~~~~
a.cc:79:9: error: 'i' was not declared in this scope
   79 |     for(i=Q-1;i>=0;i--)
      |         ^
a.cc:86:9: error: 'i' was not declared in this scope
   86 |     for(i=0;i< Q;i++)
      |         ^
Language: C++

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

int main()
{
  vecotor<char> S;
  int Q;
  char c;
  cin >> c;
  S.push_back(c);
  cin >> Q;
  
  
  
  int a,b,h,p;
  h=1;
  p=0;
  
  while(S.size()>1)
  {
    p++;
    cin >> a;
    if(a==2)
    {
      cin >> b >> c;
      
        if(b==1)
        {
          S.push_front(c);
        }
        else
        {
          S.push_back(c);
        }
        
     }
  }
  
  for(int i=0; i < Q-p; i++)
  {
    cin >> a;
    if(a==2)
    {
      cin >> b >> c;
      if(h==-1)
      {
        if(b==1)
        {
          S.push_front(c);
        }
        else
        {
          S.push_back(c);
        }
      }
      else
      {
        if(b==1)
        {
          S.push_front(c);
        }
        else
        {
          S.push_back(c);
        }
        
      }

    }
    else
    {
      h*=-1;
    }
    
  }
  
  if(h=-1)
  {
    for(i=Q-1;i>=0;i--)
    {
      cout << S[i];
    }
	
  }else
  {
    for(i=0;i< Q;i++)
    {
      cout << S[i];
    }
    
  }
   
  
  
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'vecotor' was not declared in this scope
    6 |   vecotor<char> S;
      |   ^~~~~~~
a.cc:6:11: error: expected primary-expression before 'char'
    6 |   vecotor<char> S;
      |           ^~~~
a.cc:10:3: error: 'S' was not declared in this scope
   10 |   S.push_back(c);
      |   ^
a.cc:79:9: error: 'i' was not declared in this scope
   79 |     for(i=Q-1;i>=0;i--)
      |         ^
a.cc:86:9: error: 'i' was not declared in this scope
   86 |     for(i=0;i< Q;i++)
      |         ^
Language: C++

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

int main()
{
  vecotor<char> S;
  int Q;
  
  cin >> S;
  cin >> Q;
  
  
  
  int a,b,h,p;
  h=1;
  p=0;
  char c;
  while(S.size()>1)
  {
    p++;
    cin >> a;
    if(a==2)
    {
      cin >> b >> c;
      
        if(b==1)
        {
          S.push_front(c);
        }
        else
        {
          S.push_back(c);
        }
        
     }
  }
  
  for(int i=0; i < Q-p; i++)
  {
    cin >> a;
    if(a==2)
    {
      cin >> b >> c;
      if(h==-1)
      {
        if(b==1)
        {
          S.push_front(c);
        }
        else
        {
          S.push_back(c);
        }
      }
      else
      {
        if(b==1)
        {
          S.push_front(c);
        }
        else
        {
          S.push_back(c);
        }
        
      }

    }
    else
    {
      h*=-1;
    }
    
  }
  
  if(h=-1)
  {
    for(i=Q-1;i=>0;i--)
    {
      cout << S[i];
    }
	
  }else
  {
    for(i=0;i< Q;i++)
    {
      cout << S[i];
    }
    
  }
   
  
  
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'vecotor' was not declared in this scope
    6 |   vecotor<char> S;
      |   ^~~~~~~
a.cc:6:11: error: expected primary-expression before 'char'
    6 |   vecotor<char> S;
      |           ^~~~
a.cc:9:10: error: 'S' was not declared in this scope
    9 |   cin >> S;
      |          ^
a.cc:78:9: error: 'i' was not declared in this scope
   78 |     for(i=Q-1;i=>0;i--)
      |         ^
a.cc:78:17: error: expected primary-expression before '>' token
   78 |     for(i=Q-1;i=>0;i--)
      |                 ^
a.cc:85:9: error: 'i' was not declared in this scope
   85 |     for(i=0;i< Q;i++)
      |         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for( int i = 0 ; i < n ; i++ )
typedef long long ll ;
int main() {
  string S ;
  cin >> S ;
  int N    ;
  cin >> N ;
  bool frag = false ;
  string T , U ;
  rep(i,N){
      int E ;
      cin >> E ;
      if( E == 1 ){
          if(frag) frag = false ;
          else frag = true      ;
          swap(T,U) ;
      }
      else{
          int F ;
          cin >> F ;
          string C ;
          cin >> C ;
          if( F == 1 ) T += C ;
          else U += C ; 
      }
      reverse(T.begin(),T.end()) ;
      if(frag) reverse(S.begin(),S.end()) ;
      cout << T << S << U <<endl;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:31:4: error: expected '}' at end of input
   31 |   }
      |    ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++

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

int main() {
	vector<string> s(1);
	cin >> s.at(0);
	int q;
	cin >> q;
	for (int i = 0; i < q; ++i) {
		int t, f;
		string c;
		cin >> t;
		if (t == 1) {
			reverse(s.begin(), s.end());
		}
		else {
			cin >> f >> c;
			if (f == 1) {
				s.insert(s.begin(), c);
			}
			else {
				s.push_back(c);
			}
		}
	}

	for (auto t : s) {
		cout << t;
	}
	cout << endl;

	return 0;
}

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

#include <bits/stdc++.h>
#include <stdio.h>
#include <vector>
#include <algorithm> // sort
#include <map>
using namespace std;

int main(){
    string s;
    int q;
    cin>>s>>q;

    int t;
    char p,e;
    int f;
    string c;
    int count=0;

    for(int i=0;i<q;i++){
        cin>>t;
        if(t==1){
            count=(count+1)%2;
        }else{
            cin>>f>>c;
            size++;
            if(f==count){
                s=c+s;
            }else{
                s=s+c;
            }
        }
    }
    if(count==0){
        cout<<s<<endl;
    }else{
        for(int i=0;i<s.size();i++){
            cout<<s.at(s.size()-i-1);
        }
        cout<<endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:17: error: no post-increment operator for type
   25 |             size++;
      |                 ^~
Language: C++

#include <iostream>
using namespace std;
string S;
int Q;
 
int main() {
  cin >> S; cin >> Q;
  string current;
  while(Q--) {
    int x;
    cin >> x;
    if(x==2) {
      string a; int b;
      cin >> b >> a;
     current = b == 1 ? a + current : current + a;
    } else {
      reverse(curr.begin(), curr.end());    
    }
 
  }  
}

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

#include <iostream>
using namespace std;
string S;
int Q;

int main() {
  cin >> S; cin >> Q;
  string curr;
  while(Q--) {
    int x;
    cin >> x;
    if(x==2) {
      string a; int b;
      cin >> b >> a;
     current = b == 1 ? a + current : current + a;
    } else {
      reverse(curr.begin(), curr.end());    
    }

  }  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:6: error: 'current' was not declared in this scope; did you mean 'curr'?
   15 |      current = b == 1 ? a + current : current + a;
      |      ^~~~~~~
      |      curr
a.cc:17:7: error: 'reverse' was not declared in this scope
   17 |       reverse(curr.begin(), curr.end());
      |       ^~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'

typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL<<60;
 t    s  <実際> 
[] [ab] <ab>　<=先頭c 
[c] [ab] <cab> <=末尾a
[c] [aba] <caba> <= reverse
[aba] [c] <abac> <=末尾d
[aba] [cd] <abacd> <= reverse
[cd] [aba] <dcaba> 

int main(){
    string s;cin >> s;
    int q;cin >> q;
    string t;
    rep(qi,q){
        int ty;cin >> ty;
        if(ty == 1){
            swap(s,t);
        }else{
            int f;char c;
            cin >> f >> c;
            if(f == 1){
                t += c;
            }else{
                s += c;
            }
        }
    }
    reverse(t.begin(),t.end());
    t += s;
    cout << t << endl;
    return 0;
}

Compiler output:
a.cc:17:13: error: extended character 　 is not valid in an identifier
   17 | [] [ab] <ab>　<=先頭c
      |             ^
a.cc:16:2: error: 't' does not name a type; did you mean 'tm'?
   16 |  t    s  <実際>
      |  ^
      |  tm
Language: C++

#include<bits/stdc++.h>
using namespace std;
int m, p;
int ans, res, x;
int n, q, k;
string s, t;
int op;
int cnt;
char c;
int main()
{
    cin >> s;
    sd(q);
    cnt = 0;
    while (q--)
    {
        sd(op);
        if (op == 1)
        {
            cnt++;
        }
        else
        {
            sd(k);
            cin>>c;
            if (cnt & 1)
            {
                if (k == 1)
                    s.insert(s.end(), c);
                else
                    s.insert(s.begin(), c);
            }
            else
            {
                if (k == 1)
                    s.insert(s.begin(), c);
                else
                    s.insert(s.end(), c);
            }
        }
    }
    if (cnt & 1)
        reverse(s.begin(), s.end());
    cout << s;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'sd' was not declared in this scope; did you mean 'std'?
   13 |     sd(q);
      |     ^~
      |     std
Language: C++

int m, p;
int ans, res, x;
int n, q, k;
string s, t;
int op;
int cnt;
char c;
int main()
{
    cin >> s;
    sd(q);
    cnt = 0;
    while (q--)
    {
        sd(op);
        if (op == 1)
        {
            cnt++;
        }
        else
        {
            sd(k);
            cin>>c;
            if (cnt & 1)
            {
                if (k == 1)
                    s.insert(s.end(), c);
                else
                    s.insert(s.begin(), c);
            }
            else
            {
                if (k == 1)
                    s.insert(s.begin(), c);
                else
                    s.insert(s.end(), c);
            }
        }
    }
    if (cnt & 1)
        reverse(s.begin(), s.end());
    cout << s;
    return 0;
}


Compiler output:
a.cc:4:1: error: 'string' does not name a type
    4 | string s, t;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:10:5: error: 'cin' was not declared in this scope
   10 |     cin >> s;
      |     ^~~
a.cc:10:12: error: 's' was not declared in this scope
   10 |     cin >> s;
      |            ^
a.cc:11:5: error: 'sd' was not declared in this scope; did you mean 'std'?
   11 |     sd(q);
      |     ^~
      |     std
a.cc:41:9: error: 'reverse' was not declared in this scope
   41 |         reverse(s.begin(), s.end());
      |         ^~~~~~~
a.cc:42:5: error: 'cout' was not declared in this scope
   42 |     cout << s;
      |     ^~~~
Language: C++

#include <bits/sdtc++.h>

using namespace std;

int main() {
  string s;
  cin >> s;
  int qq;
  cin >> qq;
  vector<int> cmd(qq), pos(qq);
  vector<char> add(qq);
  int cnt = 0;
  for (int i = 0; i < qq; ++i) {
    cin >> cmd[i];
    cnt += cmd[i] == 1;
    if (cmd[i] == 1) continue;
    cin >> pos[i] >> add[i];
  }
  string t;
  int cur = 0;
  for (int i = 0; i < qq; ++i) {
    if (cmd[i] == 1) {
      ++cur; continue;
    }
    int after = cnt - cur;
    if (pos[i] + after & 1) t += add[i];
  }
  if (cnt & 1) reverse(s.begin(), s.end());
  for (char c : s) t += c;
  cur = 0;
  for (int i = 0; i < qq; ++i) {
    if (cmd[i] == 1) {
      ++cur; continue;
    }
    int after = cnt - cur;
    if (!(pos[i] + after & 1)) t += add[i];
  }
  cout << t << '\n';
  return 0;
}

Compiler output:
a.cc:1:10: fatal error: bits/sdtc++.h: No such file or directory
    1 | #include <bits/sdtc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: Java

import java.util.Scanner;

class Main{
	
	public static void main(String args[]){
      
	  Scanner scanner = new Scanner(System.in);
      String input = scanner.nextLine();
      
	  String nums[] = input.split(" ");
	  
	  // double eight = 8 / 100;
	  // double ten = 10 / 100;
	  
	  // long A = Long.parseLong(nums[0]);
	  // long B = Long.parseLong(nums[1]);
	  // long sum = Long.parseLong(nums[2]);
	  // int A = Integer.parseInt(nums[0]);
	  // int B = Integer.parseInt(nums[1]);
	  
	  StringBuilder S = new StringBuilder(nums[0]);
	  int Q = Integer.parseInt(nums[1]);
	  String Query;

	  for(int i = 0; i < Q;i++){
		  
		  Query = nums[i+2];
		  if(Query.subtring(0,1).equals("1")){
		  	S = S.reverse();
		  }else{
		    String Qs[] = Query.input.split(" ");
			if(Qs[1].equals("1")){
			  S = S.append(Qs[2]);
		    }else{
			  S = new StringBuilder(Qs[2] + S.toString());
			}
		}
	  }
	  
	      System.out.println(S.toString());
	  
	}
}


Compiler output:
Main.java:28: error: cannot find symbol
		  if(Query.subtring(0,1).equals("1")){
		          ^
  symbol:   method subtring(int,int)
  location: variable Query of type String
Main.java:31: error: cannot find symbol
		    String Qs[] = Query.input.split(" ");
		                       ^
  symbol:   variable input
  location: variable Query of type String
2 errors
Language: Java

import java.util.Scanner;

class Main{
	
	public static void main(String args[]){
      
	  Scanner scanner = new Scanner(System.in);
      String input = scanner.nextLine();
      
	  String nums[] = input.split(" ");
	  
	  // double eight = 8 / 100;
	  // double ten = 10 / 100;
	  
	  // long A = Long.parseLong(nums[0]);
	  // long B = Long.parseLong(nums[1]);
	  // long sum = Long.parseLong(nums[2]);
	  // int A = Integer.parseInt(nums[0]);
	  // int B = Integer.parseInt(nums[1]);
	  
	  StringBuilder S = new StringBuilder(nums[0]);
	  int Q = Integer.parseInt(nums[1]);
	  String Query;

	  for(int i = 0; i < Q;i++){
		  
		  Query = nums[i+2];
		  if(Query.subtring(0,1).equals("1")){
		  	S = S.reverse();
		  }else{
		    String Qs[] = Query.input.split(" ");
			if(Qs[1].equals("1")){
			  S = S.append(Qs[2]);
		    }else{
			  S = new StringBuilder(Qs[2] + S.toString());
			  }
	  }
	  
	      System.out.println(S.toString());
	  
	}
}


Compiler output:
Main.java:42: error: reached end of file while parsing
}
 ^
1 error
Language: Java

import java.util.Scanner;

class Main{
	
	public static void main(String args[]){
      
	  Scanner scanner = new Scanner(System.in);
      String input = scanner.nextLine();
      
	  String nums[] = input.split(" ");
	  
	  // double eight = 8 / 100;
	  // double ten = 10 / 100;
	  
	  // long A = Long.parseLong(nums[0]);
	  // long B = Long.parseLong(nums[1]);
	  // long sum = Long.parseLong(nums[2]);
	  // int A = Integer.parseInt(nums[0]);
	  // int B = Integer.parseInt(nums[1]);
	  
	  StringBuilder S = new StringBuilder(nums[0]);
	  int Q = Integer.parseInt(nums[1]);
	  String Query;

	  for(int i = 0; i < Q;i++){
		  
		  Query = nums[i+2];
		  if(Query.subtring(0,1).equals("1")){
		  	S = S.reverse();
		  }else{
		    String Qs[] = Query.input.split(" ");
			if(Qs[1].equals("1"){
			  S = S.append(Qs[2]);
		    }else{
			  S = new StringBuilder(Qs[2] + S.toString());
			  }
	  }
	  
	      System.out.println(S.toString());
	  
	}
}


Compiler output:
Main.java:32: error: ')' expected
			if(Qs[1].equals("1"){
			                    ^
Main.java:42: error: reached end of file while parsing
}
 ^
2 errors
Language: C++

#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
int a;
int b;
char c;
string str,str;
int main(){
	int ans=0;
	cin>>str;
	int q;
	cin>>q;
	for(int i=0;i<q;i++){
		cin>>a;
		if(a==1){
			ans++;continue;
		}
		cin>>b>>c;
		if(ans%2==0){
			if(b==1) str=c+str;
			else str=str+c;
		}
		else{
			if(b==1) str=str+c;
			else str=c+str;
		}

	}
	if(ans%2==0) cout<<str;
	else{
		for(int i=str.length()-1;i>=0;i--)
			cout<<str[i];
	}
	return 0;
}

Compiler output:
a.cc:9:12: error: redefinition of 'std::string str'
    9 | string str,str;
      |            ^~~
a.cc:9:8: note: 'std::string str' previously declared here
    9 | string str,str;
      |        ^~~