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

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
using ll = long long;
char s[300010];
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int b = 100001, e;
	cin >> s + b;
	int len = strlen(s + b);
	e = b + len;
	int n;
	int query, f;
	char c;
	int flag = 0;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> query;
		if (query == 1) flag ^= 1;
		else {
			cin >> f >> c;
			f--;
			if (f == flag) {
				b--;
				s[b] = c;
			}
			else{
				s[e] = c;
				e++;
			}
		}
	}
	if (!flag)
		cout << s + b << endl;
	else {
		for (int i = e - 1; s[i] != '\0'; --i)
			cout << s[i];
		cout << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:19: error: 'strlen' was not declared in this scope
   13 |         int len = strlen(s + b);
      |                   ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<algorithm>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

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


int main(){
	string s;
	cin >> s;
	int q;
	cin >> q;
	vector<int> t(q);
	vector<pair<int,string>> fc(q);
	rep(i,q){
		cin >> t[i];
		if(t[i] == 2) cin >> fc[i].first >> fc[i].second;
	}

	bool rev = false;
	rep(i,q){
		if(t[i] == 1) rev = !rev;
		if(t[i] == 2){
			//先頭に追加
			if(fc[i].first == 1){
				if(rev) s += fc[i].second;  
				else s = fc[i].second + s;
			}
			//末尾に追加
			else{
				if(rev) s = fc[i].second + s; 
				else s += fc[i].second;
			}
		}
	}
	if(rev) reverse(s.begin(), s.end());
	cout << s << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: 'i' was not declared in this scope
   12 |         rep(i,q){
      |             ^
a.cc:12:9: error: 'rep' was not declared in this scope
   12 |         rep(i,q){
      |         ^~~
Language: C++

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

int main() {
	stringbuffer s;
	cin >> s;
	int q;
	cin >> q;
	bool ans = true;
	
	for (int i = 0; i < q; i++) {
		int t;
		cin >> t;
		if (ans) {
			if (t == 1) ans = false;
			else if (t == 2) {
				int f;
				string c;
				cin >> f;
				cin >> c;
				if (f == 1) s = c + s;
				if (f == 2) s = s + c;
			}
		}
		else if (!ans) {
			if (t == 1) ans = true;
			else if (t == 2) {
				int f;
				string c;
				cin >> f;
				cin >> c;
				if (f == 2) s = c + s;
				if (f == 1) s = s + c;
			}
		}
		// cout << s <<ans<< endl;
	}

	if (ans) cout << s << endl;
	else if (!ans) {
		int num = s.size();
		vector<char> str(num);
		for (int i = 0; i < num; i++) {
			str.at(i) = s.at(i);
		}
		reverse(str.begin(), str.end());
		for (int i = 0; i < num; i++) {
			cout << str.at(i);
		}
		cout << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: 'stringbuffer' was not declared in this scope
    5 |         stringbuffer s;
      |         ^~~~~~~~~~~~
a.cc:6:16: error: 's' was not declared in this scope
    6 |         cin >> s;
      |                ^
Language: C++

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

}


Compiler output:
a.cc:39:5: error: 'cout' does not name a type
   39 |     cout << s.at(q) << endl;
      |     ^~~~
a.cc:41:1: error: expected declaration before '}' token
   41 | }
      | ^
Language: C++

#include <iostream>
#include <string>
using namespace std;
int main() {
    string s;
    cin >> s;
    int cnt = 0;
    int q;
    cin >> q;
    while(q--){
        int t;
        cin >> t;
        if(t == 1){
            cnt++;
        }
        else{
            cin >> t;
            char x;
            cin >> x;
            if(t == 1) {
                if(cnt % 2 == 0) s.insert(s.begin(), x);
                else s += x;
            }
            else{
                if(cnt % 2 == 1) s.insert(s.begin(), x);
                else s += x;
            }
        }
    }
    if(cnt % 2 == 1) reverse(s.begin(), s.end());
    cout << s;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:22: error: 'reverse' was not declared in this scope
   30 |     if(cnt % 2 == 1) reverse(s.begin(), s.end());
      |                      ^~~~~~~
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;
  int q, t, f;
  char c;
  cin >> s;
  cin >> q;
  int flag = 0;
  rep(i,n) {
    cin >> t >> f >> c;
    if (t==1) flag = (flag+1) % 2;
    else {
      if ((flag+f)%2==1) s = c+s;
      else s = s+c;
    }
  }
  if (flag==1) {
    string ss;
    l = s.size();
    rep(i,l) ss[i] = s[l-i-1];
    cout << ss;
  } else s;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'n' was not declared in this scope
   14 |   rep(i,n) {
      |         ^
a.cc:2:39: note: in definition of macro 'rep'
    2 | #define rep(i,n) for (int i = 0; i < (n); ++i)
      |                                       ^
a.cc:24:5: error: 'l' was not declared in this scope
   24 |     l = s.size();
      |     ^
Language: C++

#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;
int main()
{
 int a,b,q;
//    char s[1000100];
    // 整数の入力
  //  scanf("%s", &s);
    string s;
    cin >> s;

    scanf("%d",&q);
    char c;

    int type, f;

    for (int i = 0; i < q; i++) {
        scanf("%d %d %s", &type, &f, &c);

        if (type == 1) {
            std::reverse(s.begin(), s.end());
        } else {
            if (f == 1) {
                s = c + $s;
            } else {
                s = s + c;
            }
        }
    }
printf("%s", s);


    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:18: error: 'reverse' is not a member of 'std'
   23 |             std::reverse(s.begin(), s.end());
      |                  ^~~~~~~
a.cc:26:25: error: '$s' was not declared in this scope; did you mean 's'?
   26 |                 s = c + $s;
      |                         ^~
      |                         s
Language: C++

#include <bits/stdc++.h>
using namespace std;
inline int read(){
	int f=1,n=0;char c=getchaer();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){n=n*10+(c-'0');c=getchar();}
	return f*n;
}
int main(){
	string s;
	cin>>s;
	int q=read();
	bool flag=false;
	for(int i=1;i<=q;i++){
		int t=read();
		if(t==1){flag=(flag)?flag=false:flag=true;continue;}
		char c;
		cin>>c;
		if(t==1){
			if(!flag){s=c+s;continue;}
			s+=c;continue;
		}
		if(!flag){s+=c;continue;}
		s=c+s;
	}
	if(!flag){cout<<s<<endl;return 0;}
	for(int i=s.size()-1;i>=0;i--) cout<<s[i];
	return 0;
}

Compiler output:
a.cc: In function 'int read()':
a.cc:4:28: error: 'getchaer' was not declared in this scope; did you mean 'getchar'?
    4 |         int f=1,n=0;char c=getchaer();
      |                            ^~~~~~~~
      |                            getchar
Language: C++

#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;
int main()
{
 int a,b,q;
//    char s[1000100];
    // 整数の入力
  //  scanf("%s", &s);
    string s, c;
    cin >> s;

    scanf("%d",&q);

    int type, f;

    for (int i = 0; i < q; i++) {
        scanf("%d %d %s", &type, &f, &c);

        if (type == 1) {
            std::reverse(s.begin(), s.end());
        } else {
            if (f == 1) {
                s = c + $s;
            } else {
                s = s + c;
            }
        }
    }
printf("%s", s);


    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:18: error: 'reverse' is not a member of 'std'
   22 |             std::reverse(s.begin(), s.end());
      |                  ^~~~~~~
a.cc:25:25: error: '$s' was not declared in this scope; did you mean 's'?
   25 |                 s = c + $s;
      |                         ^~
      |                         s
Language: C++

#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;
int main()
{
 int a,b,q;
//    char s[1000100];
    // 整数の入力
  //  scanf("%s", &s);
    string s, c;
    cin >> s;

    scanf("%d",&q);

    int type, f,c;

    for (int i = 0; i < q; i++) {
        scanf("%d %d %s", &type, &f, &c);

        if (type == 1) {
            std::reverse(s.begin(), s.end());
        } else {
            if (f == 1) {
                s = c + $s;
            } else {
                s = s + c;
            }
        }
    }
printf("%s", s);


    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: conflicting declaration 'int c'
   16 |     int type, f,c;
      |                 ^
a.cc:11:15: note: previous declaration as 'std::string c'
   11 |     string s, c;
      |               ^
a.cc:22:18: error: 'reverse' is not a member of 'std'
   22 |             std::reverse(s.begin(), s.end());
      |                  ^~~~~~~
a.cc:25:25: error: '$s' was not declared in this scope; did you mean 's'?
   25 |                 s = c + $s;
      |                         ^~
      |                         s
Language: C

#include<stdio.h>
#include<string.h>


const int N = 1e5 + 5;
char s[N],c,rec[7];
int count_,n,t,f;

int main() {
	scanf("%s", s);
	scanf("%d", &n);
	count_ = strlen(s);
	c = getchar();
	for(int i=0;i<n;++i){
		gets(rec);
		if (rec[0] == '1') {
			int len = count_;
			for (int i = 0; i < len; ++i, --len) {
				char t = s[i];
				s[i] = s[len - 1];
				s[len - 1] = t;
			}
		}
			
		else {
			count_++;
			if (rec[2] == '2') 
				s[count_-1] = rec[4];
			else {
				for (int i = count_;i > 0; --i) {
					s[i] = s[i - 1];
				}
				s[0] = rec[4];
			}
		}
	}
	printf("%s", s);
	return 0;
}

Compiler output:
main.c:6:6: error: variably modified 's' at file scope
    6 | char s[N],c,rec[7];
      |      ^
main.c: In function 'main':
main.c:15:17: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
   15 |                 gets(rec);
      |                 ^~~~
      |                 fgets
Language: C++

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

 
int main() {
   string S, T;
   char mi;
   cin >> S;
   int Q, t, f, l;
   cin >>Q;
   l=S.size();
   T=S;
   for(int i=0;i<Q;i++){
       cin >>t;
        if(t==1){
        for(int j=0;j<l;j++){
               T.at(j) = S.at(l-1-j);
           }
           S=T;
       } 
       else{
           l++;
           T = T+'a';
           cin >>f;
           cin >>mi;
           if(f==1) S= mi + S;
           else S= S + mi
           
       }

       }
        
cout << S << endl;
           
       }
   


Compiler output:
a.cc: In function 'int main()':
a.cc:27:26: error: expected ';' before '}' token
   27 |            else S= S + mi
      |                          ^
      |                          ;
   28 | 
   29 |        }
      |        ~
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
typedef long long int ll;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

int main(){
  string s;
  ll q;
  int Q;
  cin >> s >> q;;
  while(q>0){
    cin >> Q;
    if(Q==1){
      reverse(s.begin(),s.end());
    }else if(Q==2){
      int f;
      string c;
      cin >>a f >> c;
      if(f==1){
        s.insert(0,c);
      }else if(f==2){
        s += c;
      }
    }
    q--;
  }
  cout << s ;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:26:13: error: 'a' was not declared in this scope
   26 |       cin >>a f >> c;
      |             ^
Language: C++

#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
using namespace std;

int main() {
  string s;
  cin >> s;
  string a = "";
  string b = "";
  bool isreverse = false;

  int Q;
  cin >> Q;
  for (int loop = 0; loop < Q; ++loop) {
    int t;
    cin >> t;
    if (t == 1) {
      isreverse = !isreverse;
    } else {
      int f;
      char t;
      cin >> f >> t;
      if (f == 1 && !isreverse) a = a + t;
      else if (f == 1 && isreverse) b = b + t;
      else if (f == 2 && !isreverse) b = b + t;
      else if (f == 2 && isreverse) a = a + t;
    }
  }
  string ans = "";
  if (!isreverse) {
    reverse(a.begin(), a.end());
    ans = a + s + b;
  } else {
    reverse(b.begin(), b.end());
    reverse(s.begin(), s.ene());
    ans = b + s + a;
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:26: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'ene'; did you mean 'end'?
   39 |     reverse(s.begin(), s.ene());
      |                          ^~~
      |                          end
Language: Java

import java.util.Scanner;
public class Main1 {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		String s = scan.next();
		String ans ="";
		int q = scan.nextInt();
		boolean con = true;
		
		for(int i=0;i<q;i++) {
			int t = scan.nextInt();
			if(t==1) {
				int count = 1;
				while(con) {
					i += 1;
					int x = scan.nextInt();
					if(x==1) {
						count += 1;
						if(i==q-1) {
							con = false;
							if(count%2==0) {
								continue;
							}else {
								for(int j=s.length()-1;j>=0;j--) {
									ans += s.charAt(j);
								}
								s = ans;
								ans = "";
							}
							
							int f = scan.nextInt();
							if(f==1) {
								ans += scan.next();
								ans += s;
								s=ans;
								ans ="";
							}else if(f==2){
								s += scan.next();
							}
						}
						
					}else {
						con = false;
						if(count%2==0) {
							continue;
						}else {
							for(int j=s.length()-1;j>=0;j--) {
								ans += s.charAt(j);
							}
							s = ans;
							ans = "";
						}
						
						int f = scan.nextInt();
						if(f==1) {
							ans += scan.next();
							ans += s;
							s=ans;
							ans ="";
						}else if(f==2){
							s += scan.next();
						}
					}
				}
							
			}else if(t==2) {
				int f = scan.nextInt();
				if(f==1) {
					ans += scan.next();
					ans += s;
					s=ans;
					ans ="";
				}else if(f==2){
					s += scan.next();
				}
			}
		}
		
		System.out.println(s);
		
	}	
}


Compiler output:
Main.java:2: error: class Main1 is public, should be declared in a file named Main1.java
public class Main1 {
       ^
1 error
Language: C++

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

 
int main() {
   string S, T;
   char mi;
   cin >> S;
   int Q, t, f, l;
   cin >>Q;
   l=S.size();
   T="";
   for(int i=0;i<l;i++) T = T+'a';
   for(int i=0;i<Q;i++){
       cin >>t;
        if(t==1){
        for(int j=0;j<l;j++){
               T.at(j) = S.at(l-1-j);
           }
           S=T;
       } 
       else{
           l++;
           T = T+'a';
           cin >>f;
           cin >>mi;
           if(f==1) S= mi + S;
           else S= S + mi
           
       }

       }
        
cout << S << endl;
           
       }
   

   
   
   


    


Compiler output:
a.cc: In function 'int main()':
a.cc:28:26: error: expected ';' before '}' token
   28 |            else S= S + mi
      |                          ^
      |                          ;
   29 | 
   30 |        }
      |        ~
Language: C++

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

 
int main() {
   string S, T;
   char mi;
   cin >> S;
   int Q, t, f, l;
   cin >>Q;
   l=S.size();
   for(int i=0;i<l;i++) T +='a';
   for(int i=0;i<Q;i++){
       cin >>t;
        if(t==1){
        for(int j=0;j<l;j++){
               T.at(j) = S.at(l-1-j);
           }
           S=T;
       } 
       else{
           l++;
           T = T+'a';
           cin >>f;
           cin >>mi;
           if(f==1) S= mi + S;
           else S= S + mi
           
       }

       }
        
cout << S << endl;
           
       }
   

Compiler output:
a.cc: In function 'int main()':
a.cc:27:26: error: expected ';' before '}' token
   27 |            else S= S + mi
      |                          ^
      |                          ;
   28 | 
   29 |        }
      |        ~
Language: C++

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

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

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:23: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'begun'; did you mean 'begin'?
   11 |             reverse(S.begun(),S.end());
      |                       ^~~~~
      |                       begin
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>

using namespace std;

const int N = 1e5 + 5;
char s[N],c,rec[7];
int count_,n,t,f;

int main() {
	scanf("%s", s);
	scanf("%d", &n);
	count_ = strlen(s);
	c = getchar();
	for(int i=0;i<n;++i){
		gets(rec);
		if (rec[0] == '1') {
			int len = count_;
			for (int i = 0; i < len; ++i, --len) {
				char t = s[i];
				s[i] = s[len - 1];
				s[len - 1] = t;
			}
		}
			
		else {
			count_++;
			if (rec[2] == '2') 
				s[count_-1] = rec[4];
			else {
				for (int i = count_;i > 0; --i) {
					s[i] = s[i - 1];
				}
				s[0] = rec[4];
			}
		}
	}
	printf("%s", s);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: 'gets' was not declared in this scope; did you mean 'getw'?
   17 |                 gets(rec);
      |                 ^~~~
      |                 getw
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>

using namespace std;

const int N = 1e5 + 5;
char s[N],c,rec[7];
int count_,n,t,f;

int main() {
	scanf("%s", s);
	scanf("%d", &n);
	count_ = strlen(s);
	c = getchar();
	for(int i=0;i<n;++i){
		gets_s(rec);
		if (rec[0] == '1') {
			int len = count_;
			for (int i = 0; i < len; ++i, --len) {
				char t = s[i];
				s[i] = s[len - 1];
				s[len - 1] = t;
			}
		}
			
		else {
			count_++;
			if (rec[2] == '2') 
				s[count_-1] = rec[4];
			else {
				for (int i = count_;i > 0; --i) {
					s[i] = s[i - 1];
				}
				s[0] = rec[4];
			}
		}
	}
	printf("%s", s);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: 'gets_s' was not declared in this scope
   17 |                 gets_s(rec);
      |                 ^~~~~~
Language: C++

#include <iostream>

using namespace std;

int main() {
	char s[10000];
	int start = 0;
	int end = 0;
	bool reverse = false;
	cin >> s;
	end = strlen(s);
	int Q;
	cin >> Q;
	for (int i = 0; i < Q; i++) {
		int T;
		cin >> T;
		if (T == 1) {
			reverse = !reverse;
		}
		else if (T == 2) {
			int F;
			char C;
			cin >> F >> C;
			if (F == 1) {
				if (reverse) {
					s[end] = C;
					end = (end + 1) % 10000;
				}
				else {
					start = (start + 9999) % 10000;
					s[start] = C;
				}
			}
			else if (F == 2) {
				if (reverse) {
					start = (start + 9999) % 10000;
					s[start] = C;
				}
				else {
					s[end] = C;
					end = (end + 1) % 10000;
				}
			}
		}
	}
	if (reverse) {
		start = (start + 9999) % 10000;
		end = (end + 9999) % 10000;
		for (int i = end; i != start;) {
			cout << s[i];
			i = (i + 9999) % 10000;
		}
	}
	else {
		for (int i = start; i != end;) {
			cout << s[i];
			i = (i + 1) % 10000;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:15: error: 'strlen' was not declared in this scope
   11 |         end = strlen(s);
      |               ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 |
Language: C++

#include<iostream>
using namespace std;
int main() {
    int Q;
    string s;
    cin >> s >> Q;
    int c = 0;
    for(int i = 0; i < Q; i++) {
        int a;
        cin >> a;
        if(a == 1) c = (c+1) % 2;
        else {
            int b;
            cin >> b;
            char x;
            cin >> x;
            if(c == 0) {
                if(b == 1) s = x + s;
                else s = s + x;
            } else {
                if(b == 1) s = s + x;
                else s = x + s;
            }
        }
    }

    if(c == 1) reverse(s.begin(), s.end());
    cout << s << endl;
    return 0;
}


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

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

int main()
{
	string S;
	int Q;
	cin >> S >> Q;
	cin.ignore( numeric_limits<streamsize>::max(), '\n' );

	int rev = 0;
	for( int i = 0; i < Q; i++ ) {
		char s[16];
		gets( s );
		if( s[0] == '1' ) {
			rev  = 1 - rev;
		}
		else {
			int cmd;
			int f;
			char c;
			sscanf( s, "%d %d %c", &cmd, &f, &c );
			if( f == 1 ) {
				if( rev == 0 ) S = c + S;
				else S = S + c;
			}
			else {
				if( rev ) S = c + S;
				else S = S + c;
			}
		}
	}
	if( rev ) reverse( S.begin(), S.end() );

	cout << S << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: 'gets' was not declared in this scope; did you mean 'getw'?
   15 |                 gets( s );
      |                 ^~~~
      |                 getw
Language: C++

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

int main()
{
	string S;
	int Q;
	cin >> S >> Q;
	cin.ignore( numeric_limits<streamsize>::max(), '\n' );

	int rev = 0;
	for( int i = 0; i < Q; i++ ) {
		char s[16];
		gets( s );
		if( s[0] == '1' ) {
			rev  = 1 - rev;
		}
		else {
			int cmd;
			int f;
			char c;
			sscanf( s, "%d %d %c", &cmd, &f, &c );
			if( f == 1 ) {
				if( rev == 0 ) S = c + S;
				else S = S + c;
			}
			else {
				if( rev ) S = c + S;
				else S = S + c;
			}
		}
	}
	if( rev ) reverse( S.begin(), S.end() );

	cout << S << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: 'gets' was not declared in this scope; did you mean 'getw'?
   15 |                 gets( s );
      |                 ^~~~
      |                 getw
Language: C++

#include<bits/stdc++.h>
using namespace std;
string dao(string s)
{
	for(int i=0;i<s.size()/2;i++)
	{
		char c=s[s.size()-1-i];
		s[s.size()-1-i]=s[i];
		s[i]=c;
	}
	return s;
}
int main()
{
	string s;
	cin>>s;
	int n;
	cin>>n;
	int cou=0;
	for(int i=1;i<=n;i++)
	{
		int m;
		cin>>m;
		if(m==1)
			cou++;	
		else
		{
			if(cou%2==1)
				s=dao();
			cou=0;
			int t;
			string h;
			cin>>t>>h;
			if(t==2)
				s=s+h;
			else
				s=h+s;
		}
	}
	cout<<s<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:38: error: too few arguments to function 'std::string dao(std::string)'
   29 |                                 s=dao();
      |                                   ~~~^~
a.cc:3:8: note: declared here
    3 | string dao(string s)
      |        ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push
#define fi first
#define front top
#define se second
#define mp make_pair
int32_t main()
{
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin>>s;
    
    int rev =0 ;
    int q;
    cin>>q;
    stack< pair< string , int > >qf;
    
    stack< pair< string , int > >qb;
    
    for(int i  = 0 ; i < q ; i++)
    {
        int n;
        cin>>n;
        if(n == 1)
            rev = 1-rev;
        else
            {
                
                int x;
                cin>>x;
                string p;
                cin>>p;
               
               
                if(rev == 1)
                    {   
                        if(x==1)
                            {
                                qb.push(mp(p,rev));
                                
                            }
                        else
                               qf.pb(mp(p,rev));
                    }
                else
                    {
                        if(x==2)
                            {
                                qb.pb(mp(p,rev));
                                
                            }
                        else
                               qf.pb(mp(p,rev));
                    }
            
                
            }
        
        
            
            
    }
    string res="";
    // if(rev == 0){
    while(qf.size())    
    {
        
        string p = qf.front().fi;
        int val = qf.front().se;
        qf.pop();
        
        // if(rev == 1)
            // val = rev - val ;
            
            
        if(val == 1)
            for(int j = p.size() -1; j >=0; j--)
                res+=p[j];
        else
            for(int j = 0; j <p.size() ; j++)
                res+=p[j];
            
        
    }
    // cout<<res<<endl;
        //  cout<<s<<" s\n";
        //  if(rev == 1){
        //     // {   cout<<"hi\n";
        //          for(int j = s.size() -1; j >=0; j--)
        //         res+=s[j];   
        //     }
        //  else
         for(int j = 0; j < s.size(); j++)
                res+=s[j];
    
    // cout<<res<<endl;
     while(qb.size())    
    {
        
        string p = qb.front().fi;
        int val = qb.front().se;
        qb.pop();
        
        //  if(rev == 1)
        //     val = rev - val ;
            
            
        if(val == 1)
            for(int j = p.size() -1; j >=0; j--)
               res+=p[j];
        else
            for(int j = 0; j <p.size() ; j++)
               res+=p[j];
            
        
    }
    // cout<<res<<endl;
    if(rev == 1)
        reverse(res.begin(),res.end());
        
    cout<<res<<endl;    
    
   
    
    
    
    

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:126:21: error: expected '}' at end of input
  126 |     cout<<res<<endl;
      |                     ^
a.cc:10:1: note: to match this '{'
   10 | {
      | ^
Language: C++

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

int main(){
    string X,S;
    cin >> X;
    S = "S";
    int n;
    cin >> n;
    int cnt = 0;
    for (int i = 0; i < n; i++){
        int t;
        cin >> t;
        if (t == 1){
            reverse(S.begin(), S.end());
            cnt++;
        }
        else{
            int f;
            cin >> f;
            string c;
            cin >> c;
            if(f == 1){
                S = c + S;
            }
            else{
                S += c;
            }
        }
    }
    if(cnt % 2 == 1){
        reverse(X.begin(), X.end());
    }
    S.insert(S.find("S"),X);
    S.erase(S.find("S"),1)
    cout << S << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:27: error: expected ';' before 'cout'
   35 |     S.erase(S.find("S"),1)
      |                           ^
      |                           ;
   36 |     cout << S << endl;
      |     ~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define re(i,n) for(ll i=0;i<n;++i)
#define ocut cout
#define ouct cout
#define itn int
struct Union{
  vector<int> par;
  Union(int a){
  par=vector<int>(a,-1);
  }
  int find(int a){
    if(par[a]<0){
      return a;
    }
    else{
      return par[a]=find(par[a]);
    }
  }
  bool same(int a,int b){
    return (find(a)==find(b));
  }
  int size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    int c=find(a),d=find(b);
    if(c==d)
      return;
    if(size(c)<size(d)){
      swap(c,d);
    }
    par[c]+=par[d];
    par[d]=c;
  }
};
void rev_string(char str[])
{
    int len = strlen(str);
    for (int i = 0; i < len / 2; i++) {
        char temp = str[i];
        str[i] = str[len-i-1];
        str[len-i-1] = temp;
    }
}
int main(void){
  char s[200000];
  int q,m;
  cin >> s >> q;
  int t[q],f[q];
  char d[q];
  char c[q][2];
  for(int i=0;i<q;i++){
    cin >> t[i];
    if(t[i]==2){
      cin >> f[i] >> c[i];
      if((w==false&&f[i]==1)||(w==true&&f[i]==2)){
        strcat(c[i],s);
        strcpy(s,c[i]);
      }
      else{
        strcat(s,c[i]);
      }
    }
    else{
      if(w==false)w=true;
      else w=false;
    }
  }
  if(w==true)rev_string(s);
  cout << s;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:59:11: error: 'w' was not declared in this scope
   59 |       if((w==false&&f[i]==1)||(w==true&&f[i]==2)){
      |           ^
a.cc:68:10: error: 'w' was not declared in this scope
   68 |       if(w==false)w=true;
      |          ^
a.cc:72:6: error: 'w' was not declared in this scope
   72 |   if(w==true)rev_string(s);
      |      ^
Language: C++

#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdlong long> // long long64_t, long long*_t
#include <cstdio> // prlong longf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip> //setprecision
#include <limits>
using namespace std;

int main(){
  string s;
  long long q;
  cin >> s >> q;
  vector<vector<long long>> t(q,vector<long long>(2,0));
  vector<string> c(q);
  for(long long i = 0; i < q; i++){
    cin >> t[i][0];
    if(t[i][0]== 2){
      cin >> t[i][1] >> c[i];
    }
  }
  long long jyunjyo =0;
  for(long long i = 0; i < q; i++){
    if(t[i][0]==1){
      jyunjyo++;
    }
    else{
      if(jyunjyo%2==0){
        if(t[i][1]==1){
          s = c[i]+s;
        }
        else{
          s = s + c[i];
        }
      }
      else{
        if(t[i][1]==2){
          s = c[i]+s;
        }
        else{
          s = s + c[i];
        }
      }
    }
  }
  if(jyunjyo %2 ==1){
    reverse(s.begin(),s.end());
  }
    cout << s << endl;

}

Compiler output:
a.cc:7:10: fatal error: cstdlong long: No such file or directory
    7 | #include <cstdlong long> // long long64_t, long long*_t
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
#define max(a,b) (a>b?a:b)
#define min(a,b) (a>b?b:a)
#define lowbit(x) (x&-x)
#define F first
#define S second 
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f; 
const int maxn=2e5+10;
struct node{
	int t,f;
	char a;
}p[maxn];
int main()
{
	int q,x,y;
	char a[maxn];
	int t[maxn];
	string s;
	string ft="",bk="";
	cin>>s>>q;
	int dir=0;
	for(int i=1;i<=q;i++){
		cin>>p[i].t;
		if(p[i].t==2)
		cin>>p[i].f>>p[i].a;	
	}
	for(int i=q;i>=1;i--){
		if(p[i].t==1) dir=!dir;
		else{
			if(p[i].f==1){
				if(dir==0){
					ft=ft+p[i].a;
				}else bk=p[i].a+bk;
			}else if(p[i].f==2){
				if(dir==0) bk=p[i].a+bk;
				else ft=p[i].a+ft;
			}
		}
	}
	if(dir==0)
	cout<<ft;
	cout<<s;
	cout<<bk;
	else{
		reverse(s.begin(),s.end());
		cout<<ft;
		cout<<s;
		cout<<bk;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:9: error: 'else' without a previous 'if'
   47 |         else{
      |         ^~~~
Language: C++

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

int main() {
	string s;
	cin >> s;
	int q;
	cin >> q;
	bool ans = true;
	
	for (int i = 0; i < q; i++) {
		int t;
		cin >> t;
		if (ans) {
			if (t == 1) ans = false;
			else if (t == 2) {
				int f;
				string c;
				cin >> f;
				cin >> c;
				if (f == 1) s = c + s;
				if (f == 2) s = s + c;
			}
		}
		else if (!ans) {
			if (t == 1) ans = true;
			else if (t == 2) {
				int f;
				string c;
				cin >> f;
				cin >> c;
				if (f == 2) s = c + s;
				if (f == 1) s = s + c;
			}
		}
		// cout << s <<ans<< endl;
	}

	if (ans) cout << s << endl;
	else if (!ans) {
		int num = s.size();
		vector<char> str(num);
		for (int i = 0; i < num; i++) {
			str.at(i) = s.at(i);
		}
		reverse(str.begin(), str.end());
		for (int i = 0; i < num; i++) {
			cout << str.at(i);
		}
		cout << endl;
	}
	return 0;
}

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

#include<iostream>
#include <sstream>
#include<vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
ll q;
string s;
int main() {
    cin >> s;
    cin >> q;
    int t, f;
    string c;
    bool r = false;
    for (int i = 0; i < q; i++) {
        cin >> t;
        if (t == 1) {
            r = !r;
        } else {
            cin >> f;
            cin >> c;
            if ((f == 1 && !r) || (f == 2 && r)) {
                s = c + s;
            } else {
                s = s + c;
            }
        }
    }
    if (r) {
        reverse(s.begin(), s.end());
        cout << s << endl;
    } else {
        cout << s << endl;
    }
}


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

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

int main() {
	string s;
	cin >> s;
	int q;
	cin >> q;
	bool ans = true;
	
	for (int i = 0; i < q; i++) {
		int t;
		cin >> t;
		if (ans) {
			if (t == 1) ans = false;
			else if (t == 2) {
				int f;
				string c;
				cin >> f;
				cin >> c;
				if (f == 1) s = c + s;
				if (f == 2) s = s + c;
			}
		}
		else if (!ans) {
			if (t == 1) ans = true;
			else if (t == 2) {
				int f;
				string c;
				cin >> f;
				cin >> c;
				if (f == 2) s = c + s;
				if (f == 1) s = s + c;
			}
		}
		cout << s <<ans<< endl;
	}

	if (ans) cout << s << endl;
	else if (!ans) {
		int num = s.size();
		vector<char> str(num);
		for (int i = 0; i < num; i++) {
			str.at(i) = s.at(i);
		}
		reverse(str.begin(), str.end());
		for (int i = 0; i < num; i++) {
			cout << str.at(i);
		}
		cout << endl;
	}
	return 0;
}

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

#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <unordered_map>
#include <cmath>
#include <algorithm>

using namespace std;

typedef long long ll;

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

	std::list<char> chars(s.begin(), s.end());

	vector<short> t(q), f(q);
	vector<char> c(q);

	for (int i = 0; i < q; i++)
	{
		cin >> t[i];
		if (t[i] == 2)
		{
			cin >> f[i] >> c[i];
		}
	}

	for (int i = 0; i < q; i++)
	{
		if (t[i] == 1)
		{
			char front, back;
			front = chars.front();
			back = chars.back();

			if (chars.size() > 1) {
				chars.pop_front();
				chars.pop_back();
				swap(front, back);
				chars.push_front(front);
				chars.push_back(back);
			}
		}
		else
		{
			if (f[i] == 1)
			{
				chars.push_front(c[i]);
			}
			else {
				chars.push_back(c[i]);
			}
		}

	for (auto itr = chars.begin(); itr != chars.end(); ++itr) {
		std::cout << *itr;
	}
	cout << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:67:2: error: expected '}' at end of input
   67 | }
      |  ^
a.cc:14:1: note: to match this '{'
   14 | {
      | ^
Language: C++

#include <iostream>
#include <cstdio>
#include <string>

#define REP(i,n) for(int i = 0; i < n; ++i)

using namespace std;

int main(void){
    string s;
    cin >> s;
    int q;
    scanf("%d", &q);
    int a = 0;
    REP(i,q){
        int number;
        scanf("%d", &number);
        if(number == 1){
            a ++;
        } else if(number == 2){
            int f;
            char c;
            scanf("%d %c", &f, &c);
            if((f + a) % 2 == 1){
                s = c + s;
            } else if((f + a) % 2 == 0){
                s += c;
            }  
        }
    }
    if(a % 2 == 1) reverse(s.begin(), s.end());
    cout << s;
   
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:20: error: 'reverse' was not declared in this scope
   31 |     if(a % 2 == 1) reverse(s.begin(), s.end());
      |                    ^~~~~~~
Language: C++

#include<iostream>
#include<string>
using namespace std;
using ll = long long;
string s;
int main() {
	int n;
	cin >> s;
	cin >> n;
	int query, f;
	char c;
	int flag = 0;
	for (int i = 0; i < n; ++i) {
		cin >> query;
		if (query == 1) flag ^= 1;
		else {
			cin >> f >> c;
			f--;
			if (f == flag)
				s = c + s;
			else
				s = s + c;
		}
	}
	if (flag)
		reverse(s.begin(), s.end());
	cout << s << endl;
	return 0;
}

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

#include <iostream>
#include <algorithm>
using namespace std;
 
int main() {
  bool order = true;
  
  string S;
  int Q;
  cin >> S;
  cin >> Q;
  
  int T = 0;
  int F = 0;
  char C = '';
  for(int i=0; i<Q; i++) {
    cin >> T;
    // Ti = 1の時
    if(T==1) {
      order = !order;
      continue;
    }
    // Ti = 2の時
    cin >> F >> C;
    if((F==1 && order==true) || (F==2 && order==false)) {
      S = C + S;
    } else {
      S = S + C;
    }
  }
  
  if(order) {
    cout << S;
  } else {
    reverse(S.begin(), S.end());
    cout << S; 
  }
  
  return 0;
}

Compiler output:
a.cc:15:12: error: empty character constant
   15 |   char C = '';
      |            ^~
Language: C++

#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <unordered_map>
#include <cmath>
using namespace std;

typedef long long llong;
typedef unsigned long long ullong;
// -2.1e-9 <= int <= 2.1e9
// 0 <= unsigned int <= 4.2e9

int main()
{
    string S; cin >> S;
    int Q; cin >> Q;

    int numReverse = 0;
    string first(""), last("");
    for (int q=0; q<Q; q++) {
        int T; cin >> T;
        if (T == 1) {
            // reverse(S.begin(), S.end());
            numReverse++;
        }
        else if (T == 2) {
            int F; cin >> F;
            string C; cin >> C;
            if (F == 1) {
                if ((numReverse % 2) == 0)
                    first = C + first; // default
                else
                    last = last + C;
            }
            else if (F == 2) {
                if ((numReverse % 2) == 0)
                    last = last + C; // default
                else
                    first = C + first; // default
            }
        }
    }
    S = first + S + last;
    if ((numReverse % 2) != 0)
        reverse(S.begin(), S.end());
    //S = first + S + last;
    cout << S << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:15: error: 'cin' was not declared in this scope
   16 |     string S; cin >> S;
      |               ^~~
a.cc:7:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    6 | #include <cmath>
  +++ |+#include <iostream>
    7 | using namespace std;
a.cc:48:5: error: 'cout' was not declared in this scope
   48 |     cout << S << endl;
      |     ^~~~
a.cc:48:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:48:18: error: 'endl' was not declared in this scope
   48 |     cout << S << endl;
      |                  ^~~~
a.cc:7:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    6 | #include <cmath>
  +++ |+#include <ostream>
    7 | using namespace std;
Language: C

#include<stdio.h>

int main()
{
  int Q,Ti=1 or 2,Fi=1 or 2,i;
  char S[5],Ci;
  printf("enter the value of Q \n");
  printf("enter the string S \n");
  printf("enter Ti ,Fi \n");
  if(Ti==1)
  {
    strrev(S);
    printf("reverse of string:%s \n",S);
  }
  else if(Ti==2)
  {
   if(Fi==1)
   {
     printf("enter char %c \n",Ci);
     strncat(&Ci,S,1);
     printf("appended string : %s \n", S);
   }
   else if(Fi==2) 
   {
     printf("enter char %c \n",Ci);
     strncat(S,&Ci,1);
     printf("appended string : %s \n", S);
   }
  else
  {
    printf("invalid detail");
  }
 return 0;
}
    
    

Compiler output:
main.c: In function 'main':
main.c:5:14: error: expected ',' or ';' before 'or'
    5 |   int Q,Ti=1 or 2,Fi=1 or 2,i;
      |              ^~
main.c:12:5: error: implicit declaration of function 'strrev' [-Wimplicit-function-declaration]
   12 |     strrev(S);
      |     ^~~~~~
main.c:17:7: error: 'Fi' undeclared (first use in this function); did you mean 'Ci'?
   17 |    if(Fi==1)
      |       ^~
      |       Ci
main.c:17:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:20:6: error: implicit declaration of function 'strncat' [-Wimplicit-function-declaration]
   20 |      strncat(&Ci,S,1);
      |      ^~~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'strncat'
    1 | #include<stdio.h>
  +++ |+#include <string.h>
    2 | 
main.c:20:6: warning: incompatible implicit declaration of built-in function 'strncat' [-Wbuiltin-declaration-mismatch]
   20 |      strncat(&Ci,S,1);
      |      ^~~~~~~
main.c:20:6: note: include '<string.h>' or provide a declaration of 'strncat'
main.c:26:6: warning: incompatible implicit declaration of built-in function 'strncat' [-Wbuiltin-declaration-mismatch]
   26 |      strncat(S,&Ci,1);
      |      ^~~~~~~
main.c:26:6: note: include '<string.h>' or provide a declaration of 'strncat'
main.c:34:1: error: expected declaration or statement at end of input
   34 | }
      | ^
Language: C++

#include <iostream>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;

int main()
{
	int q,inv=0,t,f;
	string s;
	char c;
	cin>>s>>q;
	s.reserve(400000);
	rep(i,q){
	    cin>>t;
	    if(t==1)inv++;
	    if(t==2){
	        cin>>f>>c;
	        if((f+inv)%2)s.push_front(c);
	        else s.push_back(c);
	    }
	}
	if(inv%2){
	    int k=s.size();
	    rep(i,k){
	        cout<<s[k-1-i];
	    }
	}
	else cout<<s;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:32: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_front'
   17 |                 if((f+inv)%2)s.push_front(c);
      |                                ^~~~~~~~~~
Language: C++

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

int main()
{
    string S;
    int Q;
    cin >> S >> Q;
    int T,F;
    string C;
    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.insert(0,C);
            }else if (F == 2)
            {
                S.push_back(C);
            }
        }
    }
    cout << S;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:29: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'char'
   26 |                 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: Java

import java.util.*;
class Naman
{
  public static void main(String[] args)
  {
    Scanner sc=new Scanner(System.in);
    String S=sc.next();
    int l=S.length();
    int Q=sc.nextInt();
    String str="";
    for(int i=0;i<Q;i++)
    {
      int T=sc.nextInt();
      if(T==1)
      {
        for(int j=l-1;j>=0;j--)
        {
          str=str+S.charAt(j);
        }
      }
      if(T==2)
      {
        int F=sc.nextInt();
        String C=sc.next();
        if(F=1)
        {
          str=C+S;
        }
        else
        {
          str=S+C;
        }
      }
    }
    System.out.println(str);
  }
}
      
      
      
      
      
      
      
      
      

Compiler output:
Main.java:25: error: incompatible types: int cannot be converted to boolean
        if(F=1)
            ^
1 error
Language: Java

import java.util.Scanner;
public class Main1 {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		String s = scan.next();
		String ans ="";
		int q = scan.nextInt();
		
		for(int i=0;i<q;i++) {
			int t = scan.nextInt();
			if(t==1) {
				for(int j=s.length()-1;j>=0;j--) {
					ans += s.charAt(j);
				}
				s = ans;
				ans = "";			
			}else if(t==2) {
				int f = scan.nextInt();
				if(f==1) {
					ans += scan.next();
					ans += s;
					s=ans;
					ans ="";
				}else if(f==2){
					s += scan.next();
				}
			}
		}
		
		System.out.println(s);
		
	}	
}


Compiler output:
Main.java:2: error: class Main1 is public, should be declared in a file named Main1.java
public class Main1 {
       ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		int a;
		cin>>a;
		if(a==1)
		{
			reverse(s.begin(),s.end());
		}
		else
		{
			int d;
			string t;
			cin>>d>>t;
			if(d==1)
			{
				s.insert(0,t);
			}
			else
			{
				int u=s.size()
				s.insert(u,t);
			}
		}
	}
	cout<<s;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:33: error: expected ',' or ';' before 's'
   29 |                                 s.insert(u,t);
      |                                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
string a,p;
ios::sync_with_stdio(false);
int main()
{
	int n;
	cin>>a>>n;
	while(n--)
	{
		int t,y;
		cin>>t;
		if(t==1)
		{
			reverse(a.begin(),a.end());
		}
		if(t==2)
		{
			cin>>y>>p;
			if(y==1)
			a=p+a;
			else
			a=a+p;
		}
	}
	cout<<a;
}

Compiler output:
a.cc:4:1: error: specializing member 'std::basic_ios<char>::sync_with_stdio' requires 'template<>' syntax
    4 | ios::sync_with_stdio(false);
      | ^~~
Language: C++

S = input()
Q = int(input())
Query = []
kaisu = 0
for i in range(Q):
    Query.append(input().split())

for i in Query:
    if int(i[0]) == 1:
        kaisu = kaisu + 1
    elif int(i[0]) == 2:
        if kaisu % 2 == 0:
            if int(i[1]) == 1:
                S = i[2] + S
            else:
                S = S + i[2]
        else:
            if int(i[1]) == 2:
                S = i[2] + S
            else:
                S = S + i[2]

if kaisu % 2 == 0:
    print(S)
else:
    print(''.join(list(reversed(S))))

Compiler output:
a.cc:26:11: error: empty character constant
   26 |     print(''.join(list(reversed(S))))
      |           ^~
a.cc:1:1: error: 'S' does not name a type
    1 | S = input()
      | ^