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

#include <bits/stdc++.h>
using namespace std;
int main(){
    string s, x, y;
    cin >> s;
    int q; cin >> q;
    int rev = 0;
    for(int i=0; i<q; ++q){
        int e; cin >> e;
        if(e==2){
            int e; char t;
            cin >> e >> t; e--;
            if(rev) e = 1 - e;
            if(e==0){x += c;}
            else{Y += c;}
        }
        else rev = 1 - rev;
    }
    reverse(x.begin(). x.end());
    string res = x + s + y;
    if(rev) reverse(res.begi(), res.end());
    cout << res << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:27: error: 'c' was not declared in this scope
   14 |             if(e==0){x += c;}
      |                           ^
a.cc:15:18: error: 'Y' was not declared in this scope
   15 |             else{Y += c;}
      |                  ^
a.cc:15:23: error: 'c' was not declared in this scope
   15 |             else{Y += c;}
      |                       ^
a.cc:19:24: error: 'std::__cxx11::basic_string<char>::iterator' has no member named 'x'
   19 |     reverse(x.begin(). x.end());
      |                        ^
a.cc:21:25: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'begi'; did you mean 'begin'?
   21 |     if(rev) reverse(res.begi(), res.end());
      |                         ^~~~
      |                         begin
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  string s;
  cin>>s;
  int q;
  cin>>q;
  rep(i,q){
    int t;
    cin>>t;
    string str;
    if(t==1) swap(str,s);
    else {
      int f;char c;
      cin>>f>>c;
      if(f==1) t+=c;
      else s+=c;
    }
  }
  reverse(all(t));
  cout<<s+t<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:15: error: 't' was not declared in this scope
   35 |   reverse(all(t));
      |               ^
a.cc:4:16: note: in definition of macro 'all'
    4 | #define all(v) v.begin(),v.end()
      |                ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  string s;
  cin>>s;
  int q;
  cin>>q;
  rep(i,q){
    int t,f;
    char c;
    cin>>t;
    if(t==1)
      reverse(s);
    else
      cin>>f>>c;
    if(f==1)
      s=c+s;
    if(f==2)
      s=s+c;
  }
  cout<<s<<endl;
}

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

#include <bits/stdc++.h>
using namespace std;
int main() {
    string S;
    int Q;
    cin >> S >> Q;
    vector<int>A(Q+1);
    vector<vector<char>>B(Q);
    for(int i = 1; i <= Q; i++) {
        char x;
        cin >> x;
        if(x == '1') {
            B[i-1].push_back(x);
            A[i]++;
        }
        else {
            char a,b;
            cin >> a >> b;
            B[i-1].push_back(x);
            B[i-1].push_back(a);
            B[i-1].push_back(b);
        }
        A[i] = A[i-1]+A[i];
    }
    vector<char>mae;
    string usiro = "";
    for(int i = 0; i < Q; i++) {
        if(B[i].size() == 1) {
            continue;
        }
        if(B[i][1] == '1') {
            if((1+(A[Q]-A[i]))%2 == 1) {
                mae.push_back(B[i][2]);
            }
            else {
                usiro+=B[i][2];
            }
        }
        else {
            if((1+(A[Q]-A[i]))%2 == 0) {
                mae.push_back(B[i][2]);
            }
            else {
                usiro+=B[i][2];
            }
        }
    }
    reverse(mae.begin(),mae.end());
    for(int i = 0; i < mae.size(); i++) {
        cout << mae[i];
    }
    if(A[Q]%2 == 0) {
        cout << S;
    }
    else {
        for(int i = s.size()-1; i >= 0; i--) {
            cout << S[i];
        }
    }
    cout << usiro << endl;
}


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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()

int main(){
    string S;
    cin>>S;
    ll Q;
    cin>>Q;
    ll T;
    rep(i,0,Q){
        cin>>T;
        if(T==1){reverse(ALL(S));continue;}
        else if(T==2){
            ll F; cin>>F;
            string C; cin>>C;
            if(F==1)S.push_front(C[0]);
            else if(F==2)S.push_back(C[0]);
        }
    }
    cout<<S<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:23: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_front'
   26 |             if(F==1)S.push_front(C[0]);
      |                       ^~~~~~~~~~
Language: C++

#include <iostream>
#include <iomanip>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    string s;
    cin >> s;
    int q;
    cin >> q;
    bool rev = false;
    repi(i, q, 0)
    {
        int t;
        cin >> t;
        if (t == 1)
        {
            rev = !rev;
        }
        else
        {
            int f;
            char c;
            cin >> f >> c;
            if (f == 1)
            {
                if (rev)
                {
                    s.insert(s.end(), c);
                }
                else
                {
                    s.insert(s.begin(), c);
                }
            }
            else
            {
                if (rev)
                {
                    s.insert(s.begin(), c);
                }
                else
                {
                    s.insert(s.end(), c);
                }
            }
        }
    }
    if(rev){
        reverse(s.begin(),s.end());
    }
    cout << s << endl;
    return 0;
}

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

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

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

    string s; cin >> s;
    deque<char> deq;
    for (char c : s) deq.push_back(c);

    bool flip = false;
    int q; cin >> q;

    REP(i, q) {
        int t; cin >> t;
        if (t == 1) flip = !flip;
        else {
            int f;
            char c;
            cin >> f >> c;
            if (flip) f = 3 - f;
            if (f == 1) deq.push_front(c);
            else deq.push_back(c);
        }
    }

    if (flip) reverse(deq.begin(), deq.end());
    string ans;
    for (char c : deq) ans += c;
    cout << ans << '\n';
    return 0;
}


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

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

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

    string s; cin >> s;
    int q; cin >> q;

    REP(i, q) {
        int t; cin >> t;
        if (t == 1) {
            reverse(s.begin(), s.end());
        } else {
            int f; cin >> f;
            char c; cin >> c;
            if (f == 1) {
                string tmp = c + s;
                s = tmp;
            }
            else {
                s.push_back(c);
            }
        }
    }

    cout << s << '\n';
    return 0;
}


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

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

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
using ll = long long;
using pint = pair<int, int>; 
using pll  = pair<ll, ll>;
using vint = vector<int>; 
using vll  = vector<ll>;
using vstr = vector<string>;

//　定数, 変数 *********************************************
const ll MOD=1e9+7;
const ll INF=1ll<<60;

string S;
int Q;

// *********************************************************


int main(){

    cin >> S;
    cin >> Q;

    int q, f;
    string c;
    string tmp;
    bool flag=true;

    S.reserve(S.size() + Q);
    for(int i=0; i<Q; ++i){
        cin >> q;
        if(q==1){
            flag = !flag;
        }else{
            cin >> f >> c;
            if(flag){//反転偶数回なのでそのまま演算
                if(f==1){
                    tmp = c + tmp;
                    //S = c + S;
                }else{
                    S += c;
                }
            }else{//反転奇数回なので逆に演算
                if(f==1){
                    S += c;
                }else{
                    tmp = c + tmp;
                    //S = c + S;
                }
            }
        }
    }
    S = tmp + S;
    if(!flag){
        reverse(S.begin(), S.end());
    }
    cout << S << endl;
    

Compiler output:
a.cc: In function 'int main()':
a.cc:61:23: error: expected '}' at end of input
   61 |     cout << S << endl;
      |                       ^
a.cc:23:11: note: to match this '{'
   23 | int main(){
      |           ^
Language: C++

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

int main()
{
    string s;
    int q;

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

    
    }

   cout<<s<<endl;

}

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

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

int main(){
	long N,t,f;
  int count = 0;
  string first;
  deque<char> s;
  deque<char> q;
  char  c1,c2;
  cin >> first >> N;
  for(int i = 0;i < first.size();i++){
    c1 = first[i];
    s.push_back(c1);
  }
  

  for(int i = 0;i < N;i++){
    cin >> t;
  if(t == 1){
    while(t != 1){
      count++;
      cin >> t;
    }
    if(t % 2 != 0){
   reverse(s.begin(),s.end());
    }
    count = 0;
  }else{
    cin >> f >> c1;
    if(f == 1){
      s.push_front(c1);
    }else{
      s.push_back(c1);
    }
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:36:4: error: expected '}' at end of input
   36 |   }
      |    ^
a.cc:18:27: note: to match this '{'
   18 |   for(int i = 0;i < N;i++){
      |                           ^
a.cc:36:4: error: expected '}' at end of input
   36 |   }
      |    ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:30:20: error: 'f' was not declared in this scope
   30 |                 if(f==2){
      |                    ^
Language: C++

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

int main()
{
	string s, p[2]; int r = 0;
	cin >> s;

	int n; cin >> n; while (n--){
		int o; cin >> o;
		if (o == 1) r = !r;
		else{
			int f; string c; cin >> f >> c;
			p[(r + f) % 2] += c;
		}
	}

	reverse(p[1].begin(), p[1].end());
	s = p[1] + s + p[0];
	if (r) reverse(s.begin(), s.end());
	cout << s << endl;

	return 0;
}#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int main()
{
	string s, p[2]; int r = 0;
	cin >> s;

	int n; cin >> n; while (n--){
		int o; cin >> o;
		if (o == 1) r = !r;
		else{
			int f; string c; cin >> f >> c;
			p[(r + f) % 2] += c;
		}
	}

	reverse(p[1].begin(), p[1].end());
	s = p[1] + s + p[0];
	if (r) reverse(s.begin(), s.end());
	cout << s << endl;

	return 0;
}

Compiler output:
a.cc:26:2: error: stray '#' in program
   26 | }#include <iostream>
      |  ^
a.cc:26:3: error: 'include' does not name a type
   26 | }#include <iostream>
      |   ^~~~~~~
a.cc:31:5: error: redefinition of 'int main()'
   31 | int main()
      |     ^~~~
a.cc:6:5: note: 'int main()' previously defined here
    6 | int main()
      |     ^~~~
Language: C++

#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main() {
	string S;
	int Q;
	cin >> S>>Q;
	for (int i = 0; i < Q; i++) {
		int t, f;
		char c;
		cin >> t;
		if (t == 1)reverse(S.begin(),S.end());
		else if (t == 2) {
			cin >> f>>c;
			if (f == 1) {
				reverse(S.begin(), S.end());
				S.push_back(c);
				reverse(S.begin(), S.end());
			}
			else if (f == 2) {
				S.push_back(c);
			}
		}
	}
	cout << S;
}

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

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n); i++) 
#define dunk(n) cout << n << endl
#define all(a) (a).begin(),(a).end()
typedef pair<int,int> P;
typedef long long ll;

int main() {
    string s;
    cin >> s;
    int q;
    cin >> q;
    bool top = true;
    rep(i,q){
        int t;
        cin >> t;
        if(t == 1){
            if(top) top = false;
            else top = true;
        }
        if(t == 2){
            int f;
            char c;
            cin >> f >> c;
            if((top && f == 1) || (!top && f == 2)){
                s = c + s;
            }
            if((top && f == 2) || (!top && f == 1)){
                s = s + c;
            }
        }
    }
    if(!top) reverse(all(top));
    dunk(s);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:20: error: request for member 'begin' in 'top', which is of non-class type 'bool'
    7 | #define all(a) (a).begin(),(a).end()
      |                    ^~~~~
a.cc:36:22: note: in expansion of macro 'all'
   36 |     if(!top) reverse(all(top));
      |                      ^~~
a.cc:7:32: error: request for member 'end' in 'top', which is of non-class type 'bool'
    7 | #define all(a) (a).begin(),(a).end()
      |                                ^~~
a.cc:36:22: note: in expansion of macro 'all'
   36 |     if(!top) reverse(all(top));
      |                      ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
char S[200001];
  int q;
  scanf("%s",S);
  cin>>q;
  
  bool x=true;
  for(int i=0;i<q;i++){
  int T;
    cin>>T;
    if(T==1)
      x=!x;
    else{
    int F; char C;
      cin>>F>>C;
      if((x && F==1)|| (!x&& F==2)){
      S=C+S;
      }else{
      S=S+C;
      }
    }
}if(x){
    printf("%s",S);
  cout<<endl;
  }
  else{
  reverse(S.begin(),S.end());
    printf("%s",S);
    cout<<endl;
  }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:8: error: incompatible types in assignment of 'char*' to 'char [200001]'
   19 |       S=C+S;
      |       ~^~~~
a.cc:21:8: error: incompatible types in assignment of 'char*' to 'char [200001]'
   21 |       S=S+C;
      |       ~^~~~
a.cc:29:13: error: request for member 'begin' in 'S', which is of non-class type 'char [200001]'
   29 |   reverse(S.begin(),S.end());
      |             ^~~~~
a.cc:29:23: error: request for member 'end' in 'S', which is of non-class type 'char [200001]'
   29 |   reverse(S.begin(),S.end());
      |                       ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
char S[];
  int q;
  scanf("%s",S);
  cin>>q;
  
  bool x=true;
  for(int i=0;i<q;i++){
  int T;
    cin>>T;
    if(T==1)
      x=!x;
    else{
    int F; char C;
      cin>>F>>C;
      if((x && F==1)|| (!x&& F==2)){
      S=C+S;
      }else{
      S=S+C;
      }
    }
}if(x){
    printf("%s",S);
  cout<<endl;
  }
  else{
  reverse(S.begin(),S.end());
    printf("%s",S);
    cout<<endl;
  }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:6: error: storage size of 'S' isn't known
    4 | char S[];
      |      ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
string S;
  int q;
  scanf("%s",S);
  cin>>q;
  
  bool x=true;
  for(int i=0;i<q;i++){
  int T;
    cin>>T;
    if(T==1)
      x=!x;
    else{
    int F; char C;
      cin>>F>>C;
      if((x && F==1)|| (!x&& F==2)){
      S=C+S;
      }else{
      S=S+C;
      }
    }
  }if(x)
    printf("%s",S);
  cout<<endl;
  else{
  reverse(S.begin(),S.end());
    printf("%s",S);
    cout<<endl;
  }
    return 0;
}


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

#include<bits/stdc++.h>
using namespace std;
int main(){
string S;
  int q;
  scanf("%s",&S);
  cin>>q;
  
  bool x=true;
  for(int i=0;i<q;i++){
  int T;
    cin>>T;
    if(T==1)
      x=!x;
    else{
    int F; char C;
      cin>>F>>C;
      if((x && F==1)|| (!x&& F==2)){
      S=C+S;
      }else{
      S=S+C;
      }
    }
  }if(x)
    printf("%s",S);
  cout<<endl
  else{
  reverse(S.begin(),S.end());
    printf("%s",S);
    cout<<endl;
  }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:13: error: expected ';' before 'else'
   26 |   cout<<endl
      |             ^
      |             ;
   27 |   else{
      |   ~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
  int q;
  cin>>s>>q;
  bool x=true;
  for(int i=0;i<q;i++){
  int T;
    cin>>T;
    if(T==1)
      x=!x;
    else{
    int F; char C;
      cin>>F>>C;
      if((x && F==1)|| (!x&& F==2)){
      s=C+s;
      }else{
      s=s+C;
      }
    }
  }if(x)
    cout<<s<<endl;
  else{
  reverse(s.bein(),s.end());
    cout<<s<<endl;
  }
    return 0;
}

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

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;(int) (n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
using namespace std;
cin.tie(0);
ios::sync_with_stdio(false);
int main(){

  string s,temp;
  int temp1,temp2,q;
  int rev=0;
  cin >> s >> q;
  while(q--){
    cin >> temp1;
    if(temp1==1){
      if(s.size()!=1)rev++;
    }
    else{
      cin >> temp2 >> temp;
      if((rev+temp2)%2==0) s=temp+s;
      else s=s+temp;
    }
  }
  if(rev%2==0) cout << s << endl;
  else{
    reverse(s.begin(),s.end());
    cout << s  << endl;
  }
  return 0;
}

Compiler output:
a.cc:9:1: error: 'cin' does not name a type
    9 | cin.tie(0);
      | ^~~
a.cc:10:1: error: specializing member 'std::basic_ios<char>::sync_with_stdio' requires 'template<>' syntax
   10 | ios::sync_with_stdio(false);
      | ^~~
Language: C++

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


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


int main() {
  string s,t;
  cin>>s;
  int q;
  cin>>q;
  while(q--) {
    int w1,w2;
    cin>>w1;
    if(w1==1) {
      swap(s,t);
    }else {
      char c;
      cin>>w2>>c;
      if(w2==1) {
        t+=c;
      }else {
        s+=c;
      }
    }
  }
  reverse(t.begin(),t.end());
  cout<<t<<s;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   32 | int main() {
      |         ^~
a.cc:32:9: note: remove parentheses to default-initialize a variable
   32 | int main() {
      |         ^~
      |         --
a.cc:32:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:32:12: error: a function-definition is not allowed here before '{' token
   32 | int main() {
      |            ^
a.cc:55:2: error: expected '}' at end of input
   55 | }
      |  ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++

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


int main() {
  string s,t;
  cin>>s;
  int q;
  cin>>q;
  while(q--) {
    int w1,w2;
    cin>>w1;
    if(w1==1) {
      swap(s,t);
    }else {
      char c;
      cin>>w2>>c;
      if(w2==1) {
        t+=c;
      }else {
        s+=c;
      }
  }
  reverse(t.begin(),t.end());
  cout<<t<<s;
  return 0;
}

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

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

int main()
{
    string str; cin >> str;
    int q; cin >> q;
    bool head = true; //trueなら頭, falseなら尻
    for(int i=1; i<=q; i++){
        int t;
        cin >> t;
        if(t==1) head = 1-head;
        else if(t==2){
            int f;
            string c;
            cin >> f >> c;
            if(f==1){
                if(head) str = c + str;
                else str = str + c;
            }
            else if(f==2){
                if(head) str = str + c;
                else str = c + str;
            }
        }
    }
    if(!head) reverse(str.begin(), str.end());

    cout << str << endl;

    return 0;
}

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

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

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

    cout << str << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:18: error: 'reverse' was not declared in this scope
   12 |         if(t==1) reverse(str.begin(), str.end());
      |                  ^~~~~~~
Language: C

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

struct DATA {
  int T;
  int F;
  char c;
};
void strrev(char *);
void Top(char , char *);
void Tail(char , char *);

int main (){
  char str[100000];
  scanf("%s",str);
  long long int Q;
  scanf("%lld",&Q);
  struct DATA data[Q];
  int i;
  for(i=0;Q>i;i++){
	scanf("%d",&data[i].T);
    if(1 == data[i].T){
	  data[i].F = 0;
      data[i].c ='\0';
      strrev(str);
    }else{
      scanf("%d %c",&data[i].F,&data[i].c);
      if(1 == data[i].F){
		Top(data[i].c,str);
      }
      else{
		Tail(data[[i].c,str);
      }
    }
  }
  printf("%s",str);
  return 0;
}
void strrev(char* pstr){
  char *pTop;
  char *pTail;
  char temp;
  int count=0;
  pTop = pstr;
  while('\0' != *pstr){
    count++;
    pstr++;
  }
  pTail = pstr -1;
  for(int i=0;count/2 > i;i++){
    temp = *pTop;
    *pTop = *pTail;
    *pTail = temp;
    pTop++;
    pTail--;
  }
}
void Top(char c,char *pstr){
  char *ptemp;
  char *pgomi;
  int count = 0;
  strncpy(ptemp,pstr,100000);
  pgomi = pstr;
  while('\0' != *pgomi){
    count++;
    pgomi++;
  }
  for(int i = 0;count > i;i++){
	if(i == 0){
      *pstr = c;
    }else{
      *pstr = *ptemp;
      ptemp++;
    }
    pstr++;
  }
  *pstr = '\0';
}
void Tail(char c,char *pstr){
  while('\0' != *pstr){
    pstr++;
  }
  *pstr = c;
  pstr++;
  *pstr = '\0';
}
  

Compiler output:
main.c: In function 'main':
main.c:32:27: error: expected expression before '[' token
   32 |                 Tail(data[[i].c,str);
      |                           ^
main.c:32:26: error: array subscript is not an integer
   32 |                 Tail(data[[i].c,str);
      |                          ^
main.c:32:17: error: too few arguments to function 'Tail'
   32 |                 Tail(data[[i].c,str);
      |                 ^~~~
main.c:11:6: note: declared here
   11 | void Tail(char , char *);
      |      ^~~~
Language: C

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

struct DATA {
  int T;
  int F;
  char c;
};
void strrev(char *);
void Top(char , char *);
void Tail(char , char *);

int main (){
  char str[100000];
  scanf("%s",&str);
  long long int Q;
  scanf("%lld",&Q);
  struct DATA data[Q];
  int i;
  for(i=0;Q>i;i++){
	scanf("%d",&data[i].T);
    if(1 == data[i].T){
	  data[i].F = 0;
      data[i].c ='\0';
      strrev(str);
    }else{
      scanf("%d %c",&data[i].F,&data[i].c);
      if(1 == data[i].F){
		Top(data[i].c,str);
      }
      else{
		Tail();
      }
    }
  }
  printf("%s",str);
  return 0;
}
void strrev(char* pstr){
  char *pTop;
  char *pTail;
  char temp;
  int count=0;
  pTop = pstr;
  while('\0' != *pstr){
    count++;
    pstr++;
  }
  pTail = pstr -1;
  for(int i=0;count/2 > i;i++){
    temp = *pTop;
    *pTop = *pTail;
    *pTail = temp;
    pTop++;
    pTail--;
  }
}
void Top(char c,char *pstr){
  char *ptemp;
  char *pgomi;
  int count = 0;
  strncpy(ptemp,pstr,100000);
  pgomi = pstr;
  while('\0' != *pgomi){
    count++;
    pgomi++;
  }
  for(int i = 0;count > i;i++){
	if(i == 0){
      *pstr = c;
    }else{
      *pstr = *ptemp;
      ptemp++;
    }
    pstr++;
  }
  *pstr = '\0';
}
void Tail(char c,char *pstr){
  while('\0' != *pstr){
    pstr++;
  }
  *pstr = c;
  pstr++;
  *pstr = '\0';
}
  
  
  

      
  
  
      
      
  

Compiler output:
main.c: In function 'main':
main.c:32:17: error: too few arguments to function 'Tail'
   32 |                 Tail();
      |                 ^~~~
main.c:11:6: note: declared here
   11 | void Tail(char , char *);
      |      ^~~~
Language: C++

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

int main(){
  string s;
  ll q,qty;
  std::cin >> s>>q;

  ll rvcnt=0;
  rep(i,q){
    std::cin >> qty;
    if(qty==1){
      rvcnt++;
    }else{
      if(rvcnt%2==0 && rvcnt!=0)
      int f;char c;
      std::cin >> f >>c;
      if(f==1){
        s=c+s;
      }else{
        s.push_back(c);
      }
    }
    rvcnt=0;
  }
  std::cout << s << '\n';
  return 0;
}


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

import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		StringBuffer sb = new StringBUffer(S);
		int Q = sc.nextInt();
		for(int i = 0;i < Q;i++){
			int T = sc.nextInt();
			if(T = 1){
				sb = sb.reverse();
			}else{
				int F = sc.nextInt();
				String C = sc.next();
				if(F = 1){
					sb = sb.insert(0,C);
				}else{
					sb = sb.append(C);
				}
			}
		}
		System.out.println(sb.toString());
	}
}

Compiler output:
Main.java:6: error: cannot find symbol
		StringBuffer sb = new StringBUffer(S);
		                      ^
  symbol:   class StringBUffer
  location: class Main
Main.java:10: error: incompatible types: int cannot be converted to boolean
			if(T = 1){
			     ^
Main.java:15: error: incompatible types: int cannot be converted to boolean
				if(F = 1){
				     ^
3 errors
Language: Java

import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		StringBuffer sb = new StringBUffer(S);
		int Q = sc.nextInt();
		for(int i = 0;i < Q;i++){
			T = sc.nextInt();
			if(T = 1){
				sb = sb.reverse();
			}else{
				F = sc.nextInt();
				String C = sc.next();
				if(F = 1){
					sb = sb.insert(0,C);
				}else{
					sb = sb.append(C);
				}
			}
		}
		System.out.println(sb.toString());
	}
}

Compiler output:
Main.java:6: error: cannot find symbol
		StringBuffer sb = new StringBUffer(S);
		                      ^
  symbol:   class StringBUffer
  location: class Main
Main.java:9: error: cannot find symbol
			T = sc.nextInt();
			^
  symbol:   variable T
  location: class Main
Main.java:10: error: cannot find symbol
			if(T = 1){
			   ^
  symbol:   variable T
  location: class Main
Main.java:13: error: cannot find symbol
				F = sc.nextInt();
				^
  symbol:   variable F
  location: class Main
Main.java:15: error: cannot find symbol
				if(F = 1){
				   ^
  symbol:   variable F
  location: class Main
5 errors
Language: Java

import java.util.*;
import java.math.*;
public class Solution {
	static int r; 
	static int c;
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s = in.nextLine();
		boolean flag = true;
		int q = Integer.parseInt(in.nextLine());
		List<String> ans = new ArrayList<>();
		for(int i = 0; i < s.length(); i++) {
			ans.add(s.substring(i, i + 1));
		}
		for(int i = 0; i < q; i++) {
			String cur = in.nextLine();
			if(cur.length() == 1) {
				flag = (flag == true) ? false : true;
			}else {
				String[] gt = cur.split(" ");
				if(gt[1].equals("1")) {
					if(flag == true) {
						ans.add(0, gt[2]);
					}else {
						ans.add(gt[2]);
					}
				}else {
					if(flag == true) {
						ans.add(gt[2]);
					}else {
						ans.add(0, gt[2]);
					}
				}
			}
		}
		if(flag == false) {
			for(int i = ans.size() - 1; i >= 0; i--) {
				System.out.print(ans.get(i));
			}
			System.out.print("\n");
		}else {
			for(int i = 0; i < ans.size(); i++) {
				System.out.print(ans.get(i));
			}
			System.out.print("\n");
		}
	}
} 


Compiler output:
Main.java:3: error: class Solution is public, should be declared in a file named Solution.java
public class Solution {
       ^
1 error
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 pii = pair<int,int>;
using pil = pair<pii,char>;

int main(){
    string s;
    cin >> s;
    int q;
    cin >> q;
    deque<char> que;
    rep(i,s.size()) que.push_back(s[i]);
    bool r = 0;
    rep(i,q){
        int a;
        cin >> a;
        if(a == 1){
            r = 1 - r;
        }
        else if(a == 2){
            int b;
            char c;
            cin >> b >> c;
            if(b == 1 && !r) que.push_front(c);
            if(b == 1 && r) que.push_back(c);
            if(b == 2 && !r) que.push_back(c);
            if(b == 2 && r) que.push_front(c);
        }
    }
    if(r) reverse(all(que));
    for(auto q : que){
        cout << q;
    }
    cout << endl;
}

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

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

int main(){
    string s;
    cin >> s;
    int q;
    cin >> q;
    deque<char> que;
    rep(i,s.size()) que.push_back(s[i]);
    bool r = 0;
    rep(i,q){
        int a;
        cin >> a;
        if(a == 1){
            r = 1 - r;
        }
        else if(a == 2){
            int b;
            char c;
            cin >> b >> c;
            if(b == 1 && !rev) que.push_front(c);
            if(b == 1 && rev) que.push_back(c);
            if(b == 2 && !rev) que.push_back(c);
            if(b == 2 && rev) que.push_front(c);
        }
    }
    if(r) reverse(all(que));
    for(auto q : que){
        cout << q;
    }
    cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:27: error: 'rev' was not declared in this scope; did you mean 'rep'?
   26 |             if(b == 1 && !rev) que.push_front(c);
      |                           ^~~
      |                           rep
a.cc:27:26: error: 'rev' was not declared in this scope; did you mean 'rep'?
   27 |             if(b == 1 && rev) que.push_back(c);
      |                          ^~~
      |                          rep
a.cc:28:27: error: 'rev' was not declared in this scope; did you mean 'rep'?
   28 |             if(b == 2 && !rev) que.push_back(c);
      |                           ^~~
      |                           rep
a.cc:29:26: error: 'rev' was not declared in this scope; did you mean 'rep'?
   29 |             if(b == 2 && rev) que.push_front(c);
      |                          ^~~
      |                          rep
a.cc:32:19: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   32 |     if(r) reverse(all(que));
      |                   ^~~
      |                   std::filesystem::perms::all
In file included from /usr/include/c++/14/filesystem:51,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
                 from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::all' declared here
  158 |       all               =  0777,
      |       ^~~
Language: C++

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

int main(){
    string s;
    cin >> s;
    int q;
    cin >> q;
    deque<char> que;
    rep(i,s.size()) que.push_back(s[i]);
    bool r = 0;
    rep(i,q){
        int a;
        cin >> a;
        if(a == 1){
            rev = 1 - rev;
        }
        else if(a == 2){
            int b;
            char c;
            cin >> b >> c;
            if(b == 1 && !rev) que.push_front(c);
            if(b == 1 && rev) que.push_back(c);
            if(b == 2 && !rev) que.push_back(c);
            if(b == 2 && rev) que.push_front(c);
        }
    }
    if(rev) reverse(all(que));
    for(auto q : que){
        cout << q;
    }
    cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:13: error: 'rev' was not declared in this scope; did you mean 'rep'?
   20 |             rev = 1 - rev;
      |             ^~~
      |             rep
a.cc:26:27: error: 'rev' was not declared in this scope; did you mean 'rep'?
   26 |             if(b == 1 && !rev) que.push_front(c);
      |                           ^~~
      |                           rep
a.cc:27:26: error: 'rev' was not declared in this scope; did you mean 'rep'?
   27 |             if(b == 1 && rev) que.push_back(c);
      |                          ^~~
      |                          rep
a.cc:28:27: error: 'rev' was not declared in this scope; did you mean 'rep'?
   28 |             if(b == 2 && !rev) que.push_back(c);
      |                           ^~~
      |                           rep
a.cc:29:26: error: 'rev' was not declared in this scope; did you mean 'rep'?
   29 |             if(b == 2 && rev) que.push_front(c);
      |                          ^~~
      |                          rep
a.cc:32:8: error: 'rev' was not declared in this scope; did you mean 'rep'?
   32 |     if(rev) reverse(all(que));
      |        ^~~
      |        rep
a.cc:32:21: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   32 |     if(rev) reverse(all(que));
      |                     ^~~
      |                     std::filesystem::perms::all
In file included from /usr/include/c++/14/filesystem:51,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
                 from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::all' declared here
  158 |       all               =  0777,
      |       ^~~
Language: C++

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

int main(){
    string s;
    cin >> s;
    int q;
    cin >> q;
    vector<pil> x(q);
    rep(i,q){
        int a,b;
        char c;
        cin >> a;
        if(a == 2){
            cin >> b >> c;
        }
        x[i].first.first = a;
        x[i].first.second = b;
        x[i].second = c;
    }
    rep(i,q){
        if(x[i].first.first == 1){
            reverse(s.begin(),s.end());
        }
        else{
            if(x[i].first.second == 1){
                s.push_front(x[i].second);
            }
            else{
                s.push_back(x[i].second);
            }
        }
    }
    cout << s << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:19: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_front'
   31 |                 s.push_front(x[i].second);
      |                   ^~~~~~~~~~
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:18:20: error: expected primary-expression before 'char'
   18 |         s.insert(0,char c);
      |                    ^~~~
a.cc:21:26: error: expected primary-expression before 'char'
   21 |         s.insert(s.end(),char c);
      |                          ^~~~
a.cc:25:2: error: expected '}' at end of input
   25 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

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

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

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

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

int main(){
  string s;
  int q;
  cin >> s >> q;
  int t,f;
  char c[];
  
  if (t==1){
    reverse(s.begin(),s.end());
  }
  if (t==2){
    if (f==1){
　　　　s.insert(0,c);
    }
    if (f==2){
      s.insert(s.end(),);
    }
  }
      cout << s << endl;
}
  

Compiler output:
a.cc:16:1: error: extended character 　 is not valid in an identifier
   16 | 　　　　s.insert(0,c);
      | ^
a.cc:16:1: error: extended character 　 is not valid in an identifier
a.cc:16:1: error: extended character 　 is not valid in an identifier
a.cc:16:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:9:8: error: storage size of 'c' isn't known
    9 |   char c[];
      |        ^
a.cc:16:1: error: '\U00003000\U00003000\U00003000\U00003000s' was not declared in this scope
   16 | 　　　　s.insert(0,c);
      | ^~~~~~~~~
a.cc:19:24: error: expected primary-expression before ')' token
   19 |       s.insert(s.end(),);
      |                        ^
Language: C

S = input()
Q = int(input())
Ss = S
for i in range(Q) :
    Query = input()
    q = Query.split(" ")
    if int(q[0]) == 1 :
        Ss = Ss[::-1]
    else:
        if int(q[1]) == 1 :
            Ss = str(q[2]) + Ss
        else:
            Ss = Ss + str(q[2])
print(Ss)

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | S = input()
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'S' [-Wimplicit-int]
main.c:1:5: error: implicit declaration of function 'input' [-Wimplicit-function-declaration]
    1 | S = input()
      |     ^~~~~
main.c:1:5: error: initializer element is not constant
main.c:2:1: error: expected ',' or ';' before 'Q'
    2 | Q = int(input())
      | ^
Language: C++

#include<iostream>
#include<cstring>
using namespace std;
int n,ans,i,t,f,k;
char a[100001],p;
int main()
{
    cin>>a>>n;
    n=strlen(a);
    while(n--){
        cin>>t;
        if(t==1) ans++;
        else {cin>>f>>p;n++;}
        if((f==1&&ans%2==0)||(f==2&&ans%2==1)) {
            strcat(p,a);
        }
        else strcat(a,p);
    }
    if(ans%2==0) cout<<a<<endl;
    else for(i=k-1;i>=0;i--) cout<<a[i]<<endl;
      return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:20: error: invalid conversion from 'char' to 'char*' [-fpermissive]
   15 |             strcat(p,a);
      |                    ^
      |                    |
      |                    char
In file included from /usr/include/c++/14/cstring:43,
                 from a.cc:2:
/usr/include/string.h:149:39: note:   initializing argument 1 of 'char* strcat(char*, const char*)'
  149 | extern char *strcat (char *__restrict __dest, const char *__restrict __src)
      |                      ~~~~~~~~~~~~~~~~~^~~~~~
a.cc:17:23: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   17 |         else strcat(a,p);
      |                       ^
      |                       |
      |                       char
/usr/include/string.h:149:70: note:   initializing argument 2 of 'char* strcat(char*, const char*)'
  149 | extern char *strcat (char *__restrict __dest, const char *__restrict __src)
      |                                               ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
Language: C++

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


int main() 
{
    string s;
    int q;
    cin >> s >> q;
    int cnt = 0;
    rep(i,q)
    {
        int a;
        cin >> a;
        if(a==1)
        {
            cnt += 1;
        }
        else
        {
            int b;
            string pul;
            cin >> b >> pul;
            if(cnt%2!=0)
            {
                if(b==1)
                    b = 2;
                else
                    b = 1;
            }
            if(b==1)
                s = pul + s;
            else
                //s = s + pul;
        }
    }

    if(cnt%2==0)
    {
        cout << s << endl;
    }
    else
    {
        reverse(s.begin(), s.end());
        cout << s << endl;
    }

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:37:9: error: expected primary-expression before '}' token
   37 |         }
      |         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    int A,t,q,g,counter=0;
    cin>>A;
    deque<int>a;
   for(int i=0;i<s.size();i++){
   a.push_back(s.at(i));}
   for(int i=0;i<A;i++){
   cin>>t;
   if(t==1){
   counter++;
   counter=counter%2;}
   else{
   cin>>t>>q>>g;
   if(q==1){
   if(counter%2==0){
   a.push_front(g);}
   else{
   a.push_back(g);}}
   else{
   if(counter%2==0){
   a.push_back(g);}
   else{
   a.push_front(g);}}}}
   if(counter%2==0){
   for(int i=0;i<a.size();i++){
   cout<<a.at(i);}}
   else{
   for(int i=a.size();i>0;i--){
   cout<<a.at();}}}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:14: error: no matching function for call to 'std::deque<int>::at()'
   33 |    cout<<a.at();}}}
      |          ~~~~^~
In file included from /usr/include/c++/14/deque:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:139,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_deque.h:1414:7: note: candidate: 'std::deque<_Tp, _Alloc>::reference std::deque<_Tp, _Alloc>::at(size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]'
 1414 |       at(size_type __n)
      |       ^~
/usr/include/c++/14/bits/stl_deque.h:1414:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_deque.h:1432:7: note: candidate: 'std::deque<_Tp, _Alloc>::const_reference std::deque<_Tp, _Alloc>::at(size_type) const [with _Tp = int; _Alloc = std::allocator<int>; const_reference = const int&; size_type = long unsigned int]'
 1432 |       at(size_type __n) const
      |       ^~
/usr/include/c++/14/bits/stl_deque.h:1432:7: note:   candidate expects 1 argument, 0 provided