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

#include<iostream>
#include<algorithm>
using namespace std;
 
int main(){
    string s; 
    cin >> s;
    deque<char> ans;
    for(char a : s) ans.push_back(a);
    int q; cin>> q;
    bool rev = false;
    while(q--) {
        int t; cin >> t;
        if(t==1) {
            rev = !rev;
        } else {
            int f; cin>>f;
            char c; cin >> c;
            if((rev==false && f==1) || (rev==true && f==2)){
                ans.push_front(c);
            } else {
                ans.push_back(c);
            }
        }
    }
    string res;
    while(ans.size()) {
        res += ans.front();
        ans.pop_front();
    }
    if(rev) reverse(res.begin(), res.end());
    cout << res << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'deque' was not declared in this scope
    8 |     deque<char> ans;
      |     ^~~~~
a.cc:3:1: note: 'std::deque' is defined in header '<deque>'; this is probably fixable by adding '#include <deque>'
    2 | #include<algorithm>
  +++ |+#include <deque>
    3 | using namespace std;
a.cc:8:11: error: expected primary-expression before 'char'
    8 |     deque<char> ans;
      |           ^~~~
a.cc:9:21: error: 'ans' was not declared in this scope; did you mean 'abs'?
    9 |     for(char a : s) ans.push_back(a);
      |                     ^~~
      |                     abs
a.cc:20:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   20 |                 ans.push_front(c);
      |                 ^~~
      |                 abs
a.cc:22:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |                 ans.push_back(c);
      |                 ^~~
      |                 abs
a.cc:27:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   27 |     while(ans.size()) {
      |           ^~~
      |           abs
Language: C++

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

int main(){
    string s; 
    cin >> s;
    deque<char> ans;
    for(char a : s) ans.push_back(a);
    int q; cin>> q;
    bool rev = false;
    while(q--) {
        int t; cin >> t;
        if(t==1) {
            rev = !rev;
        } else {
            int f; cin>>f;
            char c; cin >> c;
            if((rev==false && f==1) || (rev==true && f==2)){
                ans.push_front(c);
            } else {
                ans.push_back(c);
            }
        }
    }
    string ans;
    while(ans.size()) {
        ans += ans.front();
        ans.pop_front();
    }
    if(rev) reverse(ans.begin(), ans.end());
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'deque' was not declared in this scope
    8 |     deque<char> ans;
      |     ^~~~~
a.cc:3:1: note: 'std::deque' is defined in header '<deque>'; this is probably fixable by adding '#include <deque>'
    2 | #include<algorithm>
  +++ |+#include <deque>
    3 | using namespace std;
a.cc:8:11: error: expected primary-expression before 'char'
    8 |     deque<char> ans;
      |           ^~~~
a.cc:9:21: error: 'ans' was not declared in this scope; did you mean 'abs'?
    9 |     for(char a : s) ans.push_back(a);
      |                     ^~~
      |                     abs
a.cc:20:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   20 |                 ans.push_front(c);
      |                 ^~~
      |                 abs
a.cc:22:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |                 ans.push_back(c);
      |                 ^~~
      |                 abs
a.cc:29:13: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pop_front'
   29 |         ans.pop_front();
      |             ^~~~~~~~~
Language: C++

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

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

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 9223372036854775807;
const ll half_inf = 0x3f3f3f3f;
const ll inf = 0x7fffffff;
const ll mod = 1e9 + 7;
const ll maxn = 200005;
const ll N = 500005;
char s[1000000],ch;
vector<char>va,vb; // va是反向存储的头部添加的串，vb是正向存储尾部添加的串 
int main(){ // 区别正反向存储是为了能够直接用 push_back操作 
	cin.tie(0); 
    ios::sync_with_stdio(false);
	scanf("%s",s);
	ll q,ti,fi,rev=0;
	scanf("%lld",&q);
	while(q--){
		scanf("%lld",&ti);
		if(ti==1) rev=!rev; // 串的翻转不影响添加方式，可以先记录状态最后再处理 
		else{
			scanf("%lld %c",&fi,&ch); // 输入格式控制可以避免繁琐的使用 getchar() 
			if(fi==1){ // insert效率太低会 TLE，因此用 push_back替代 
				if(rev1==1) va.push_back(ch);
				else vb.push_back(ch); 
			}
			else{
				if(rev1==1) vb.push_back(ch);
				else va.push_back(ch);
			}
		}
	}
	if(!rev){ // 最后处理串的翻转	
		for(ll i=va.size()-1;i>=0;i--) printf("%c",va[i]);
		printf("%s",s);
		for(ll i=0;i<vb.size();i++) printf("%c",vb[i]);
	}
	else{
		for(ll i=vb.size()-1;i>=0;i--) printf("%c",vb[i]);
		for(ll i=strlen(s)-1;i>=0;i--) printf("%c",s[i]);		
		for(ll i=0;i<va.size();i++) printf("%c",va[i]);
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:36: error: 'rev1' was not declared in this scope; did you mean 'rev'?
   24 |                                 if(rev1==1) va.push_back(ch);
      |                                    ^~~~
      |                                    rev
a.cc:28:36: error: 'rev1' was not declared in this scope; did you mean 'rev'?
   28 |                                 if(rev1==1) vb.push_back(ch);
      |                                    ^~~~
      |                                    rev
Language: C++

#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<string>
typedef long long ll;
#define inf 0x3f3f3f3f
using namespace std;
char s[600000],ch;
int main()
{
    int a,b,i,j,m,n,u,q,p,t,w=0,flag=1,r,l;
    gets(s+200005);
    l=200005;
    r=strlen(s+200005)+200005;
    cin>>t;
    while(t--)
    {
    cin>>q;
    	if(q==1)flag*=-1;
    	else 
    	{
    		cin>>u;
    		cin>>ch;
    		if(flag==1)
    		{
			if(u==1)
    		{
    			s[--l]=ch;
    			
    			
			}
			else
			{
				s[++r]=ch;
			 } 
		}
		else 
		{
			if(u==2)
    		{
    			s[--l]=ch;
    			
			}
			else
			{
				s[++r]=ch;
			 } 
		}
			
		}
		
	}
	if(flag==1)
	for(i=l;i<=r;i++)
	{
		cout<<s[i];
	}
	else 
	for(i=r;i>=l;i--)
	{
		cout<<s[i];
	}	
	
    return 0;
} 

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

#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<string>
typedef long long ll;
#define inf 0x3f3f3f3f
using namespace std;
char s[600000],ch;
int main()
{
    int a,b,i,j,m,n,u,q,p,t,w=0,flag=1,r,l;
    gets(s+200005);
    l=200005;
    r=strlen(s+200005)+200005;
    scanf("%d",&t);
    while(t--)
    {
    scanf("%d",&q);
    	if(q==1)flag*=-1;
    	else 
    	{
    		scanf("%d",&u);
    		cin>>ch;
    		if(flag==1)
    		{
			if(u==1)
    		{
    			s[--l]=ch;
    			
    			
			}
			else
			{
				s[++r]=ch;
			 } 
		}
		else 
		{
			if(u==2)
    		{
    			s[--l]=ch;
    			
			}
			else
			{
				s[++r]=ch;
			 } 
		}
			
		}
		
	}
	if(flag==1)
	for(i=0;i<=350000;i++)
	{
		if(s[i]!='\0')printf("%c",s[i]);
	}
	else 
	for(i=350000;i>=0;i--)
	{
		if(s[i]!='\0')printf("%c",s[i]);
	}	
	
    return 0;
} 

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

#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<string>
typedef long long ll;
#define inf 0x3f3f3f3f
using namespace std;
char s[1000000],ch;
int main()
{
    int a,b,i,j,m,n,u,q,p,t,w=0,flag=1,r,l;
    gets(s+200005);
    l=200005;
    r=strlen(s+200005)+200005;
    scanf("%d",&t);
    while(t--)
    {
    scanf("%d",&q);
    	if(q==1)flag*=-1;
    	else 
    	{
    		scanf("%d",&u);
    		cin>>ch;
    		if(flag==1)
    		{
			if(u==1)
    		{
    			s[--l]=ch;
    			
    			
			}
			else
			{
				s[++r]=ch;
			 } 
		}
		else 
		{
			if(u==2)
    		{
    			s[--l]=ch;
    			
			}
			else
			{
				s[++r]=ch;
			 } 
		}
			
		}
		
	}
	if(flag==1)
	for(i=0;i<=350000;i++)
	{
		if(s[i]!='\0')printf("%c",s[i]);
	}
	else 
	for(i=350000;i>=0;i--)
	{
		if(s[i]!='\0')printf("%c",s[i]);
	}	
	
    return 0;
} 

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

#include <iostream>
#include <string>
#include <vector>
#include <tuple>

using namespace std;

int
main()
{
    string s;
    int q;
    int type;
    int f;
    string c;
    vector<tuple<int, int, string>> v;
    
    cin >> s >> q;
    for(int i=0;i<q;i++){
        cin >> type;
        if(type == 1){
            f = 0;
            c = "-";            
        } else if(type == 2){
            cin >> f >> c;
        }
        tuple<int, int, string> t = make_tuple(type,f,c);
        v.push_back(t);
    }

    for(auto i : v) {
        int a1 = get<0>(i);
        int a2=0;
        string a3="-";
        if(a1==1) {
            reverse(s.begin(), s.end());
        } else if(a1==2) {
            a2 = get<1>(i);
            a3 = get<2>(i);            
            if(a2 == 1) {
                s = a3 + s;
            } else if(a2 == 2) {
                s.append(a3);
            }
        }
    }

    cout << s << endl;
    
    return 0;
}


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

#include <stdio.h>
#include <string.h>
int main(){
	char S[30001],a[6],c[2],ch;
	int i,j,Q,len,k;
	scanf("%s",S);
	len=strlen(S);
	scanf("%d",&Q);
	for (i=0;i<=Q;i++)
	{
		gets(a);
		c[0]=a[4];
		c[1]=a[5];
		if (a[0]=='1')
		{
			for (j=0,k=len-1;j<=k;j++,k--)
			{
				ch=S[j];
				S[j]=S[k];
				S[k]=ch;
			}
		}
		else if (a[0]=='2')
		{
			if (a[2]=='1')
			{
				strcpy(S,strcat(c,S));
				len++;
			}
			else if (a[2]=='2')
			{
				strcat(S,c);
				len++;
			}
		}
	}
	printf("%s",S);
	return 0;
}

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

#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
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;
				add(s, f, c);
			}
		}
		else if (!ans) {
			if (t == 1) ans = true;
			else if (t == 2) {
				int f;
				string c;
				cin >> f;
				cin >> c;
				add(s, f, 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;
	}
	*/
	int num = s.size();
	deque<char> str;
	for (int i = 0; i < num; i++) {
		str.push_back(s.at(i));
	}
	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;
				char c;
				cin >> f;
				cin >> c;
				if (f == 1) str.push_front(c);
				else if (f == 2) str.push_back(c);
			}
		}
		else if (!ans) {
			if (t == 1) ans = true;
			else if (t == 2) {
				int f;
				char c;
				cin >> f;
				cin >> c;
				if (f == 2) str.push_front(c);
				else if (f == 1) str.push_back(c);
			}
		}
	}

	if (!ans) reverse(str.begin(), str.end());
	int num_str = str.size();
	for (int i = 0; i < num_str; i++) {
		cout << str.at(i);
	}
	cout << endl;
	return 0;
}

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

#include <iostream>
#include <cfenv>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>

using namespace std;
using ll = long long;

int main(){
  bool reverse_flag = false;
  char s;
  cin >> s;

  deque<char> S;
  S.emplace_back(s);

  int Q;
  cin >> Q;

  for(int i = 0; i < Q; ++i){
    int T;
    cin >> T;
    if(T == 1){
      reverse_flag = !reverse_flag;
    } else if(T == 2){
      int F;
      char C;

      cin >> F >> C;

      if(reverse_flag){
        if(F == 1){
          S.emplace_back(C);
        }else if(F == 2){
          S.emplace_front(C);
        }
      } else{
        if(F == 1){
          S.emplace_front(C);
        }else if(F == 2){
          S.emplace_back(C);
        }
      }
    }
  }

  string ans = "";

  for_each(begin(S), end(S), [](char v) {
    ans += v;
  });

  if(reverse_flag){
    reverse(ans.begin(), ans.end());
  }
  
  cout << ans << endl;

  return 0;
}


Compiler output:
a.cc: In lambda function:
a.cc:53:5: error: 'ans' is not captured
   53 |     ans += v;
      |     ^~~
a.cc:52:31: note: the lambda has no capture-default
   52 |   for_each(begin(S), end(S), [](char v) {
      |                               ^
a.cc:50:10: note: 'std::string ans' declared here
   50 |   string ans = "";
      |          ^~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:4:9: error: 'string' was not declared in this scope
    4 |         string s,a,b;
      |         ^~~~~~
a.cc:5:9: error: 'cin' was not declared in this scope
    5 |         cin >> s >> q;
      |         ^~~
a.cc:5:16: error: 's' was not declared in this scope
    5 |         cin >> s >> q;
      |                ^
a.cc:15:44: error: 'b' was not declared in this scope
   15 |                         if(f ^ (flip % 2)) b.push_back(c);
      |                                            ^
a.cc:16:30: error: 'a' was not declared in this scope
   16 |                         else a.push_back(c);
      |                              ^
a.cc:19:21: error: 'a' was not declared in this scope
   19 |         reverse(all(a));
      |                     ^
a.cc:19:17: error: 'all' was not declared in this scope
   19 |         reverse(all(a));
      |                 ^~~
a.cc:19:9: error: 'reverse' was not declared in this scope
   19 |         reverse(all(a));
      |         ^~~~~~~
a.cc:20:21: error: 'b' was not declared in this scope
   20 |         s = a + s + b;
      |                     ^
a.cc:22:9: error: 'cout' was not declared in this scope
   22 |         cout << s << endl;
      |         ^~~~
a.cc:22:22: error: 'endl' was not declared in this scope
   22 |         cout << s << endl;
      |                      ^~~~
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:21:32: error: expected unqualified-id before 'char'
   21 |                         int f, char c;
      |                                ^~~~
a.cc:22:37: error: 'c' was not declared in this scope
   22 |                         cin >> f >> c;
      |                                     ^
Language: C++

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

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

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

signed main(){
  string s;
  cin>>s;
  int q;
  cin>>q;
  V<char> f,g;
  int rev=1;
  fo(i,q){
    int c;
    cin>>c;
    if(c==1)
      rev++;
    else{
      int d;
      cin>>d;
      char e;
      cin>>e;
      if((d==1&&rev%2==1)||(d==2&&rev%2==0))
        f.pb(e);
      else
        g.pb(e);
    }
  }
  if(rev%2==1){
    rev(f);
    fo(i,f.fize()){
      cout<<f[i];
    }
    cout<<s;
    fo(i,g.size()){
      cout<<g[i];
    }
    cout<<endl;
  }
  else{
    rev(s);
    rev(g);
    fo(i,g.size()){
      cout<<g[i];
    }
    cout<<s;
    fo(i,f.size()){
      cout<<f[i];
    }
    cout<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:12: error: 'class std::vector<char>' has no member named 'fize'; did you mean 'size'?
   48 |     fo(i,f.fize()){
      |            ^~~~
a.cc:8:31: note: in definition of macro 'fo'
    8 | #define fo(a,b) for(int a=0;a<b;a++)
      |                               ^
Language: Java

import java.io.*;
import java.util.*;

public class Main{
  public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	String S = sc.next();
    StringBuilder first = new StringBuilder();
    StringBuilder last = new StringBuilder();
	int Q = sc.nextInt();
	int revCount =0;
	
	//命令実行部
	for(int i=0; i<Q; i++) {
		int T = Integer.parseInt(sc.next());
		if( T == 1)
			revCount++;	    
	else {
	    int F = Integer.parseInt(sc.next());
	    char C = sc.next().charAt(0);
	    if (revCount%2 == 0 && F==1 || revCount%2==1 && F==2)
	    	first.append(C)
	    else
	    	last.append(C);
		}
		
	}
	
		if ( revCount %2 == 0) {
			first.reverse();
			System.out.println(first + S + last);
		}
		else {
			StringBuilder s = new StringBuilder();
			s.append(S);
			s.reverse();
			last.reverse();
			System.out.println(last + s.toString() + first);
		}

  }
}

Compiler output:
Main.java:22: error: ';' expected
	    	first.append(C)
	    	               ^
1 error
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <ctype.h>

using namespace std;

int main()
{
  #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output2.txt", "w", stdout);
#endif
  string str;
  int i = 0;
  getline(cin,str);
  int len = str.length();
  int j, f; char c;
  int q;
  int k;
  cin>>q;
  while((q--)!=0)
  {
    cin>>k;
    if(k==1)
    {
       reverse(str.begin(), str.end())
                     }else if(k==2)
                     {
                      cin>>f>>c;
                       if(f==1){
                         str = c+str;}
                       else if(f==2){
                         str = str+c;
                     }
                    }
                  }
                    puts(str);
                    cout<<"\n";
                    return 0;
                    }
                         
    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:29:39: error: expected ';' before '}' token
   29 |        reverse(str.begin(), str.end())
      |                                       ^
      |                                       ;
   30 |                      }else if(k==2)
      |                      ~                 
a.cc:40:26: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
   40 |                     puts(str);
      |                          ^~~
      |                          |
      |                          std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 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/stdio.h:714:30: note:   initializing argument 1 of 'int puts(const char*)'
  714 | extern int puts (const char *__s);
      |                  ~~~~~~~~~~~~^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
 
int main(){
    string s,a="",b="";
    char c;
    int q,i;
    int t,f,flag=1;
    s.reserve(1000000);
    cin>>s>>q;
    for(i=0;i<q;i++){
        cin>>t;
        if(t==1){
            flag*=-1;
        }else{
            cin>>f>>c;
            switch(f*flag){
                case 1: 
                    a+=c;
                    break;
                case -1:
                    b+=c;
                    break;
                case 2:
                    b+=c;
                    break;
                case -2:
                    a+=c;
                    break;
            }
        }
    }
    reverse(a.begin(),a.end())
    s=a+s+b;
    if(flag<0) reverse(s.begin(),s.end());
    cout<<s;
 
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:31: error: expected ';' before 's'
   34 |     reverse(a.begin(),a.end())
      |                               ^
      |                               ;
   35 |     s=a+s+b;
      |     ~
Language: Java

import java.util.Iterator;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Miain {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine().trim();
        LinkedList<Integer> list = s.chars().boxed().collect(Collectors.toCollection(LinkedList::new));
        boolean reversed  = false;
        int q = scanner.nextInt();
        for (int i = 0; i < q; i++) {
            String req = scanner.nextLine().trim();
            if(req.isEmpty()){
                i--;
                continue;
            }
            if(req.charAt(0)=='1'){
                reversed = !reversed;
            }else{
                String[] split = req.split(" +");
                int f = Integer.parseInt(split[1]);
                Integer c = (int) split[2].charAt(0);
                if((f==1) ^ reversed){
                    list.addFirst(c);
                }else{
                    list.addLast(c);
                }
            }
        }
        Iterator<Integer> iterator;
        if(reversed){
            iterator = list.descendingIterator();
        }else{
            iterator = list.iterator();
        }
        while (iterator.hasNext()){
            System.out.print((char)(int)iterator.next());
        }
    }
}

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



#define ll long long int

#include <bits/stdc++.h>
#include<vector>

using namespace std;

int main()
{
 string s;
  ll q;
  getline(cin,s);
  cin>>q;
 // for(ll i=0;i<s.size();i++){
 //  cout<<s[i];
//    }
 // cout<<s<<" "<<q<<" "<<s.size();
 ll len=s.size();
  vector<char>vec;
  for(ll i=0;i<len;i++){
   vec.push_back(s[i]);
    }
  // for(ll i=0;i<s.size();i++){
  // cout<<vec[i];
   // }


  for( ll i=0;i<q;i++){
   ll t;
    cin>>t;
    if(t==1)reverse(vec.begin(),vec.end());

    else {
     ll w;
      char c;
      cin>>w>>c;
      if(w==1){

        vec.insert(vec.begin(),c);

      }

      else {
       vec.insert(vec.begin()+vec.size(),c);}



      }





    }

ll ver=vec.size();

    for(ll z=0;z<ver;z++){
        cout<<vec[z];



    }













  return 0;

     }

  
 // for(ll i=0;i<s.size();i++){
 //  cout<<s[i];
//    }
 // cout<<s<<" "<<q<<" "<<s.size();
 ll len=s.size();
  vector<char>vec;
  for(ll i=0;i<len;i++){
   vec.push_back(s[i]);
    }
  // for(ll i=0;i<s.size();i++){
  // cout<<vec[i];
   // }


  for( ll i=0;i<q;i++){
   ll t;
    cin>>t;
    if(t==1)reverse(vec.begin(),vec.end());

    else {
     ll w;
      char c;
      cin>>w>>c;
      if(w==1){

        vec.insert(vec.begin(),c);

      }

      else {
       vec.insert(vec.begin()+vec.size(),c);}



      }





    }

ll ver=vec.size();

    for(ll z=0;z<ver;z++){
        cout<<vec[z];



    }













  return 0;

     }


Compiler output:
a.cc:88:9: error: 's' was not declared in this scope
   88 |  ll len=s.size();
      |         ^
a.cc:90:3: error: expected unqualified-id before 'for'
   90 |   for(ll i=0;i<len;i++){
      |   ^~~
a.cc:90:14: error: 'i' does not name a type
   90 |   for(ll i=0;i<len;i++){
      |              ^
a.cc:90:20: error: 'i' does not name a type
   90 |   for(ll i=0;i<len;i++){
      |                    ^
a.cc:98:3: error: expected unqualified-id before 'for'
   98 |   for( ll i=0;i<q;i++){
      |   ^~~
a.cc:98:15: error: 'i' does not name a type
   98 |   for( ll i=0;i<q;i++){
      |               ^
a.cc:98:19: error: 'i' does not name a type
   98 |   for( ll i=0;i<q;i++){
      |                   ^
a.cc:128:5: error: expected unqualified-id before 'for'
  128 |     for(ll z=0;z<ver;z++){
      |     ^~~
a.cc:128:16: error: 'z' does not name a type
  128 |     for(ll z=0;z<ver;z++){
      |                ^
a.cc:128:22: error: 'z' does not name a type
  128 |     for(ll z=0;z<ver;z++){
      |                      ^
a.cc:147:3: error: expected unqualified-id before 'return'
  147 |   return 0;
      |   ^~~~~~
a.cc:149:6: error: expected declaration before '}' token
  149 |      }
      |      ^
Language: C++

#include <iostream>
#include <cmath>
#include <algorithm>
#include <string> //文字列
#include <iomanip> //doubleの桁数指定
#include <list> //前後に数値を入れれる配列



#define REP(i,m,n) for(int i = (int) (m);i < (int) (n);i++) //forの短縮
#define rep(i,n) REP(i,0,n) //REPが0の時
#define ll long long int

using namespace std;

double PI = 3.141592653589793; //円周率

//常設関数↓

//最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

//最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}

//degree → radian
ll chg_DegRad(int deg) {
	return deg * PI / 180.0;
}

//radian → degree
ll chg_RadDeg(int rad) {
	return rad * 180.0 / PI;
}

//提出コード↓

string s;
list<string> S;
ll Q, T[1000000], F[1000000];
string c[1000000];
list<string>::iterator itr;
bool J = true;




int main() {
	cin >> s;
	S.push_back(s);
	cin >> Q;
	rep(i, Q) {
		cin >> T[i];
		if (T[i] == 1) {
			if (J) J = false;
			else J = true;
		}
		else {
			cin >> F[i];
			cin >> c[i];
			if (J) {
				if (F[i] == 1) {
					S.push_front(c[i]);
				}
				else {
					S.push_back(c[i]);
				}
			}
			else {
				if (F[i] == 0) {
					S.push_front(c[i]);
				}
				else {
					S.push_back(c[i]);
				}
			}
		}
	}
	if (!J) reverse(S.begin, S.end);
	for (itr = S.begin(); itr != S.end();itr++){
		cout << *itr;
		}
		cout << endl;




	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:84:24: error: no matching function for call to 'reverse(<unresolved overloaded function type>, <unresolved overloaded function type>)'
   84 |         if (!J) reverse(S.begin, S.end);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'template<class _BIter> void std::reverse(_BIter, _BIter)'
 1083 |     reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
      |     ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:5: note:   template argument deduction/substitution failed:
a.cc:84:24: note:   couldn't deduce template parameter '_BIter'
   84 |         if (!J) reverse(S.begin, S.end);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
  249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
      | ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note:   candidate expects 3 arguments, 2 provided
Language: C++

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

int main() {
	deque<string> s;
	string c, as;
	long q, i;
	int t, f, kai = 0;
	cin >> as >> q;
	s.push_front(as);
	for (i = 0; i < q; i++) {
		cin >> t;
		if (t == 1) {
			kai++;
		}
		else {
			cin >> f >> c;
			if (f == 1) {
				if (kai % 2 == 0) {
					s.push_front(c);
				}
				else {
					s.push_back(c);
				}
			}
			else {
				if (kai % 2 == 0) {
					s.push_back(c);
				}
				else {

					s.push_front(c);
				};
			}
		}
	}
	if (kai % 2 == 1) {
		reverse(s.begin(), s.end());
	}*
		for (auto as : s) {
	cout << as << endl;
}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:17: error: expected primary-expression before 'for'
   43 |                 for (auto as : s) {
      |                 ^~~
Language: Java

import java.util.*;
import java.math.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int Q = sc.nextInt();
    int[] T = new int[Q];
    int[] F = new int[Q];
    char[] C = new char[Q];
    for (int i = 0; i < Q; i++) {
      T[i] = sc.nextInt();
      if (T[i] == 2) {
        F[i] = sc.nextInt();
        C[i] = sc.next().charAt(0);
      }
    }
    sc.close();

    char[] pre = new char[Q];
    char[] suf = new char[Q];
    int preB = Q - 1;
    int sufE = 0;

    boolean rev = false;
    for (int i = 0; i < Q; i++) {
      if (T[i] == 1) {
        rev = !rev;
      } else {
        if (rev ^ F[i] == 1) {
          pre[preB--] = C[i];
        } else {
          suf[sufE++] = C[i];
        }
      }
    }

    StringBuilder ans = new StringBuilder()
        .append(pre, preB + 1, pre.length - preB - 1)
        .append(S)
        .append(suf, 0, sufE);
    if (rev) ans.reverse();
    System.out.println(ans;
  }
}


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

/********** BiSmIlLaHiR rAhMaNiR rAhIm ***********\
*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*
*$*                                             *$*
*$*    ||||||||  ||||||||  ||||||||  ||||||||   *$*
*$*    ||    ||  ||           ||     ||         *$*
*$*    ||||||||  ||||||||     ||     ||||||     *$*
*$*    ||    ||        ||     ||     ||         *$*
*$*    ||    ||  ||||||||  ||||||||  ||         *$*
*$*                                             *$*
*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*$*
\*************** DIIT(17th batch) ****************/

#include<bits/stdc++.h>
#define ll long long int
#define ul unsigned long long int
#define pf printf
#define sf scanf
#define endl "\n"
#define pb push_back
#define makep make_pair
#define MOD 1000000007
#define PI acos(-1.0)
#define PII pair<string , ll> 
#define SIZE 1000005
#define fio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
ll fx[]={1,0,-1,0,-1,-1,1,1};
ll fy[]={0,1,0,-1,-1,1,-1,1};

int main()
{
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/
    //fio();
    ll q,t,f,cnt=0;
    string s,s1;
    cin>>s;
    sf("%lld",&q);
    while(q--)
    {
        sf("%lld",&t);
        if(t==1)
        {
            cnt++;
        }
        else
        {
            sf("%lld",&f);
            cin>>s1;
            if(f==1){
                if(cnt%2==1){
                    s=s+s1;
                }
                else{
                    s=s1+s;
                }
            }
            else{
                if(cnt%2==1){
                    s=s1+s;
                }
                else{
                    s=s+s1;
                }
            }
        }
    }
    if(cnt%2==1){
        for(i=s.size()-1;i>=0;i--)
            cout<<s[i];
        cout<<endl;
    }
    else
        cout<<s<<endl;
    return 0;
}
// ! () &

Compiler output:
a.cc: In function 'int main()':
a.cc:71:13: error: 'i' was not declared in this scope
   71 |         for(i=s.size()-1;i>=0;i--)
      |             ^
Language: C++

#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(){
    string s;
    ll q;
    cin>>s>>q;
    bool flag=true;

    for(ll i=0;i<q;++i){
        ll t;
        cin>>t;
        if(t==1){
            if(flag){
                flag=false;
            }else{
                flag=true;
            }
            continue;
        }
        if(t==2){
        ll f;
        char c;
        cin>>f>>c;
        if(f==1){
            if(flag){
                s=c+s;
            }else{
                s=s+c;
            }
        }else{
            if(flag){
                s=s+c;
            }else{
                s=c+s;
            }
        }
    }
    if(flag){
        cout<<s<<endl;
    }else{
        for(ll j=0;j<s.size();++j){
            cout<<s[s.size()-j-1];
        }
        cout<<endl;
    }
}

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

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

int main() {
    deque<char> s;
    string c1;
    Int q;
    cin >> c1 >> q;
    for (auto z : ci) {
        s.push_back(z);
    }

    bool rev = false;
    for (Int i = 0; i < q; i++) {
        int t;
        cin >> t;

        if (t == 1) {
            rev = !rev;
        } else {
            int f;
            char c;
            cin >> f >> c;

            if (!rev) {
                if (f == 1) {
                    s.push_front(c);
                } else {
                    s.push_back(c);
                }
            } else {
                if (f == 1) {
                    s.push_back(c);
                } else {
                    s.push_front(c);
                }
            }
        }
    }

    if (rev) {
        reverse(s.begin(), s.end());
    }
    for (auto z : s) {
        cout << z;
    }
    cout << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:19: error: 'ci' was not declared in this scope; did you mean 'c1'?
   17 |     for (auto z : ci) {
      |                   ^~
      |                   c1
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;
  cin >> s;
  deque<char> dq;
  for (char c : s) dq.push_back(c); 
  bool reversed = false;
  int q;
  cin >> q;

  rep(i, q){
    int t;
    cin >> t;
    if(t == 1){
      reversed = !reversed;
    } else {
      int f; char c;
      cin >> f >> c;
      if(reversed) f = 3 - f;
      if(f == 1) {
        dq.push_front(c);
      } else {
        q.push_back(c);
      }
    }
  }
  if(reversed) reverse(dq.begin(), dq.end());
  string ans;
  for(char c: dq) ans += c;
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:11: error: request for member 'push_back' in 'q', which is of non-class type 'int'
   28 |         q.push_back(c);
      |           ^~~~~~~~~
Language: C++

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


int main(){
   cin.tie(0);
   ios::sync_with_stdio(false);

   deque<char> deq;
   string s;
   cin >> s;
   for(auto tmp :s){
    deq.push_back(tmp);
   }
   bool on = false;
   int q;
   cin >> q;
   while(q--){
    int t;
    cin >> t;
    if(t==1) on ^= true;
    else {
        int f;
        cin >> f;
        char c; 
        cin >> c;
        if(on^(f==1)) deq.push_front(c);
        else deq.push_back(c);
    }
   }
   string ans;
   for(auto tmp: deq) ans.push_back(tmp):
   if(on) reverse(ans.begin(), ans.end());
   cout << ans < <"\n"; 
}



Compiler output:
a.cc: In function 'int main()':
a.cc:33:41: error: expected ';' before ':' token
   33 |    for(auto tmp: deq) ans.push_back(tmp):
      |                                         ^
      |                                         ;
a.cc:35:18: error: expected primary-expression before '<' token
   35 |    cout << ans < <"\n";
      |                  ^
Language: C++

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

using ll = long long;
// #define int long long

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0

/***** MAIN *****/
signed main() {
  string s;
  cin >> s;
  int n;
  cin >> n;
  deque<char> dq(ALL(s));
  bool isReversed = false;
  REP(i,n) {
    int command;
    cin >> command;
    if(command == 1) {
      isReversed = !isReversed;
      continue;
    }
    int tmp;
    cin >> tmp;
    bool appnedAtHead = (tmp == 1);
    char c;
    cin >> c;
    if(appnedAtHead) {
      if(isReversed) dq.push_back(c);
      else dq.push_front(c);
    } else {
      if(isReversed) dq.push_front(c);
      else dq.push_back(c);
    }
  }
  if(isReversed) {
    REPR(i,dq.size()-1) cout << dq[i];
  } else {
    REP(i,dq.size()) cout << dq[i];
  }
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: 'ALL' was not declared in this scope
   16 |   deque<char> dq(ALL(s));
      |                  ^~~
Language: C++

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


int main(){
   cin.tie(0);
   ios::sync_with_stdio(false);

   deque<char> deq;
   string s;
   cin >> s;
   for(auto tmp :s){
    deq.push_back(tmp);
   }
   bool on = false;
   int q;
   cin >> q;
   while(q--){
    int t;
    cin >> t;
    if(t==1) on ^= true;
    else {
        int f;
        cin >> f;
        if(on^(f==1)) deq.push_front(c);
        else deq.push_back(c);
    }
   }
   string ans;
   for(auto tmp: deq) ans.push_back(tmp):
   if(on) reverse(ans.begin(), ans.end());
   cout << ans < <"\n"; 
}



Compiler output:
a.cc: In function 'int main()':
a.cc:26:38: error: 'c' was not declared in this scope
   26 |         if(on^(f==1)) deq.push_front(c);
      |                                      ^
a.cc:27:28: error: 'c' was not declared in this scope
   27 |         else deq.push_back(c);
      |                            ^
a.cc:31:41: error: expected ';' before ':' token
   31 |    for(auto tmp: deq) ans.push_back(tmp):
      |                                         ^
      |                                         ;
a.cc:33:18: error: expected primary-expression before '<' token
   33 |    cout << ans < <"\n";
      |                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(c, i, n) for (int i = c; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    string S;
    ll Q;
    cin >> S >> Q;
    deque<char> d;
    ll size = S.aize();
    rep(0, i, size)
    {
        d.push_back(S.at(i));
    }
    ll T, F;
    ll count = 0;
    char x;
    char y;
    rep(0, i, Q)
    {
        cin >> T;
        if (T == 1)
        {
            count++;
        }
        else
        {
            cin >> F;
            if (F == 1 + count % 2)
            {
                cin >> x;
                d.push_front(x);
            }
            else
            {
                cin >> y;
                d.push_back(y);
            }
        }
    }
    if (count % 2 == 1)
    {
        while (d.empty() != true)
        {
            cout << d.back();
            d.pop_back();
        }
    }
    else
    {
        while (d.empty() != true)
        {
            cout << d.front();
            d.pop_front();
        }
    }
    cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:17: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'aize'; did you mean 'size'?
   14 |     ll size = S.aize();
      |                 ^~~~
      |                 size
Language: C++

#include<bits/stdc++.h>
#define ll long long
#define Speeed  ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
using namespace std;
int main(){
    Speeed
  string s;
  cin>>s;
  ll q;
  cin>>q;
  while(q--){
      int t;
      cin>>t;
      if(t==1){
          reverse(s.begin(),s.end());
      }
      else{
          int f;
          string c;
          cin>>f>>c;
          if(f==1)s.insert(0,c);
          elses+=c;
        }
    }
    cout<<s;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:11: error: 'elses' was not declared in this scope
   22 |           elses+=c;
      |           ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  deque<string> S;
  bool reverse_ = false;
  int Q,F,T;
  string s;
  cin >> s; S.push_back(s);
  cin >> Q;
  for(int i = 0;i < Q;i++){
  	cin >> T;
    if(T == 1){
      reverse_ = !reverse_;
      continue;
    }else if(T == 2){
      cin >> F >> s;
      if(F == 1 && !reverse_ || F == 2 && reverse_){
      	S.push_front(s);
      }else if(F == 1 && reverse_ || F == 2 && !reverse_)){
      	S.push_back(s);
      }
    }
  }
  if(reverse_) reverse(S.begin(),S.end());
  
  for(string c:S){
  	cout << c;
  }
  cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:58: error: expected primary-expression before ')' token
   19 |       }else if(F == 1 && reverse_ || F == 2 && !reverse_)){
      |                                                          ^
Language: C++

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

int main() {
	string S;
	int Q, ;
	cin >> S >> Q;
	vector<int> T(Q), F(Q);
	vector<char> C(Q);
	int rev = 1;
	for (int i = 0; i < Q; i++) {
		cin >> T[i];
		if (T[i] == 1) rev *= -1;
		else cin >> F[i] >> C[i];
	}
	for (int i = 0; i < Q; i++) {
		if (T[i] == 1) rev *= -1;
		else {
			if (F[i] == 1) {
				if (rev == 1) S = C[i] + S;
				else S += C[i];
			}
			else {
				if (rev == 1) S += C[i];
				else S = C[i] + S;
			}
		}
	}
	cout << S << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:16: error: expected unqualified-id before ';' token
    6 |         int Q, ;
      |                ^
Language: C

#include <stdio.h>
int main(void){
	char s[200001],rev[200001];
	int q,i,j,d,len,rev=0;
	scanf("%s%d",s,&q);
	int f[q+1];
	char c[q+1];
	for(i=0;i<q+1;i++){
		f[i]=0;
		c[i]='0';
	}
	for(i=0;i<q;i++){
		scanf("%d",&d);
		for(j=0;s[j]!='\0';j++);
		j--;;
		len=j;
		if(d==1){
			if(rev==0) rev=1;
			else rev=0;
		}else{
			scanf("%d %c",&f[i],&c[i]);
			if(rev==0){
				if(f[i]==1){
					for(j=0;j<len+2;j++) rev[j+1]=s[j];
					s[0]=c[i];
					for(j=1;j<len+3;j++) s[j]=rev[j];
				}else{
					s[len+1]=c[i];
					s[len+2]='\0';
				}
			}else{
				if(f[i]==0){
					for(j=0;j<len+2;j++) rev[j+1]=s[j];
					s[0]=c[i];
					for(j=1;j<len+3;j++) s[j]=rev[j];
				}else{
					s[len+1]=c[i];
					s[len+2]='\0';
				}
			}
		}
	}
	if(rev==1){
		while(j>=0){
				rev[len-j]=s[j];
				j--;
			}
			rev[len+1]='\0';
			for(j=0;j<len+1;j++) s[j]=rev[j];
	}
	printf("%s",s);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:4:25: error: conflicting types for 'rev'; have 'int'
    4 |         int q,i,j,d,len,rev=0;
      |                         ^~~
main.c:3:24: note: previous declaration of 'rev' with type 'char[200001]'
    3 |         char s[200001],rev[200001];
      |                        ^~~
Language: C++

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

using namespace std;

int main() {
    char S[10 * 10 * 10 * 10 * 10];
    list<char> list;
    cin >> S;
    for (int i = 0; S[i] != '\0'; i++)
    {
        list.push_back(S[i]);
    }
    int Q;
    cin >> Q;
    int T, F;
    char c;
    bool reverse = false;
    for (int i = 0; i < Q; i++)
    {
        scanf_s("%d", &T);
        if (T == 1)
        {
            reverse = ~reverse;
        }
        else
        {
            scanf_s("%d %c", &F, &c);
            if (F == 1)
            {
                if (!reverse)
                {
                    list.push_front(c);
                }
                else
                {
                    list.push_back(c);
                }

            }
            else
            {
                if (!reverse)
                {
                    list.push_back(c);
                }
                else
                {
                    list.push_front(c);
                }
            }
        }

    }
    if (reverse)
    {
        list.reverse();
    }
    for (auto itr = list.begin(); itr != list.end(); itr++)
    {
        printf("%c", *itr);
    }
    printf("\n");

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   23 |         scanf_s("%d", &T);
      |         ^~~~~~~
      |         scanf