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

#include <bits/stdc++.h>
#include <algorithm>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
typedef long long ll;
 
 
int main() {
 
    string x;
    cin >> x;
    int q;
    cin >> q;
    vector<int> v(q);
    vector<int> f(q);
    vector<string> c(q);
    rep(i,q) {
        cin >> v[i];
        if(v[i]!=1) {
            cin >> f[i];
            cin >> c[i];
        }
    }
    vector<int> wa(q+1);
    wa[0]=0;
    for(int i=0;i<q;i++) {
        wa[i+1]=wa[i];
        if(v[i]==1) wa[i+1]+=1;
    }
    string s;
    rep(i,q) {
        if((wa[q]-wa[i])%2==0) {
            if(v[i]==1) ;
            else if(f[i]==1)    reverse(all(c[i]));
        }
        else {
            if(v[i]==1) ;
            else if(f[i]==1) {
                f[i]=2;
            }
            else if(f[i]==2) {
                reverse(all(c[i]);
                f[i]=1;
            }
        }
    }
    rep(i,q) {
        if(v[i]==1) {
            x+=s;
            s='0';
            s.erase(0.0);
        }
        else if(f[i]==1)    s+=c[i];
        else if(f[i]==2)    x+=c[i];
    }
 
    reverse(all(s));
    x.insert(0,s);

 
    cout<<x<<endl;
 
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:34: error: expected ')' before ';' token
   46 |                 reverse(all(c[i]);
      |                        ~         ^
Language: C++

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

int main()
{
  string S, c;
  int Q, t, f, tsum = 0;
  cin >> S >> Q;
  for (int i = 0; i < Q; i++)
  {
    scanf("%d", &t);
    if (t == 1)
    {
      tsum++;
    }
    else
    {
      scanf("%d", &f);
      cin >> c;
      if ((f == 1 && tsum % 2 == 0) || (f == 2 && tsum % 2 == 1))
      {
        S = c.append(S);
      }
      else
      {
        S.append(c);
      }
    }
  }
  if (tsum % 2 == 1)
  {
    reverse(S.begin(),S.end();
  }
  cout << S << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:30: error: expected ')' before ';' token
   32 |     reverse(S.begin(),S.end();
      |            ~                 ^
      |                              )
Language: C++

#include<bits/stdc++.h>
using namespace std;
char s[200005];
deque<char>q;
deque<char>::iterator it;
int main(){
	int st=0;//头
	cin>>s+1;
	int qq;
	int n=strlen(s+1);
	for(int i=1;i<=n;++i){
		q.push_back(s[i]);
	}
	cin>>qq;
	int t,f,c;
	while(qq--){
		cin>>t;
		if(t==1)st^=1;
		if(t==2){
			cin>>f;
			if(f==1){
				cin>>c;
				q.push_front(c);
			}
			else{
				cin>>c;
				q.push_back(c);
			}
		}
	}
	if(st==0){
		it=q.begin();
		while(!q.empty()){
			cout<<q.fornt();
			q.pop_front();
		}
	}
	else{
		while(!q.empty()){
			cout<<q.back();
			q.pop_back();
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:33: error: 'class std::deque<char>' has no member named 'fornt'; did you mean 'front'?
   34 |                         cout<<q.fornt();
      |                                 ^~~~~
      |                                 front
Language: C

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

int main(void)
{
  int i, j, k, Q, T, F, flag = 0;
  char S[200001], C, tmp;
  long long int size;
  
  scanf("%s", S);
  size = strlen(S);
  scanf("%d", &Q);
  
  for (i = 1; i <= Q; i++)
  {
    scanf("%d", &T);
    if (T == 1)
    {
      if (flag == 0)
      {
        flag = 1;
      }
      else
      {
        flag = 0;
      }
    }
    else
    {
      if (flag == 1)
      {
        for (j = 0, k = size - 1; j < size / 2; j++, k--)
        {
          tmp = S[i];
          S[i] = S[j];
          S[j] = tmp;
        }
      }
      scanf("%d %c", &F, &C);
      if (F == 1)
      {
        sprintf(S, "%s", %C, S);
      }
      else
      {
        sprintf(S, "%s", S, %C);
      }
    }
  }
  
  printf("%s\n", S);
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:43:26: error: expected expression before '%' token
   43 |         sprintf(S, "%s", %C, S);
      |                          ^
main.c:47:29: error: expected expression before '%' token
   47 |         sprintf(S, "%s", S, %C);
      |                             ^
Language: C++

#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <tuple>
#include <stack>
#include <bitset>

using namespace std;
typedef long long ll;

#define MAX_N 1000000
#define INF 1000000


int main() {

  // ---------------------
  // Input
  
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  string S;
  int Q;
  cin >> S;
  cin >> Q;


  int flag;
  //int F[Q];
  //char C[Q];

  int F;
  char C;
  
  // ---------------------
  //

  int rev_flag = 1;

  // 1: 前から
  // -1 : 後ろから
  
  for (int i = 0; i < Q; i++) {

    cin >> flag;
    
    if(flag == 1) {
      rev_flag *= -1;
    }

    else if (flag == 2){
      cin >> F >> C;
      
      if (F == 1) {
	if (rev_flag == 1) S = C + S;
	else S = S + C;
      }
      else if (F == 2) {
	if (rev_flag == 1) S = S + C;
	else S = C + S;
      }
    }
    
  }
  
  if(ref_flag == 1) {
  for(int i = 0; i < S.size(); i++) {
    cout << S[i];
  }
  cout << endl;

  }
  else{
    for(int i = S.size()-1; i > 0; i++) {
      cout << S[i];
    }
    cout << endl;
    
  }
  
  return 0;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:73:6: error: 'ref_flag' was not declared in this scope; did you mean 'rev_flag'?
   73 |   if(ref_flag == 1) {
      |      ^~~~~~~~
      |      rev_flag
Language: C

#include <stdio.h>
#include <stdlib.h>

int main(){
  char s[100001];
  int q;
  scanf("%s%d",s,&q);
  int t[q],f[q],k=0,tmp;
  char c;
  for(int i=0;i<q;i++){
    scanf("%d",&t[i]);
      if(t[i]==1){
      tmp=s[0];
      s[0]=s[q-1];
      s[q-1]=s[0];
      }
      else{
        if(f[i]==1){
          for(int j=1;j<q;j++){
            s[j]=s[j-1];
        }
        s[0]=c;
      }
      else{
        k=strlen(s);
        s[k]=c[i];
      }
      }
  }
    
    printf("%s",s);
    return 0;
}
        
      

Compiler output:
main.c: In function 'main':
main.c:25:11: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
   25 |         k=strlen(s);
      |           ^~~~~~
main.c:3:1: note: include '<string.h>' or provide a declaration of 'strlen'
    2 | #include <stdlib.h>
  +++ |+#include <string.h>
    3 | 
main.c:25:11: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
   25 |         k=strlen(s);
      |           ^~~~~~
main.c:25:11: note: include '<string.h>' or provide a declaration of 'strlen'
main.c:26:15: error: subscripted value is neither array nor pointer nor vector
   26 |         s[k]=c[i];
      |               ^
Language: Java

import java.util.*;
import java.io.PrintWriter;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		int ttt=sc.nextInt();
		ArrayDeque<String> q=new ArrayDeque<>();
		q.add(s);
		boolean ch=true;
		boolean sss=false;
		boolean kkk=false;
		for(int i=0; i<ttt; i++){
			int t=sc.nextInt();
			if(t==1){
				ch=!ch;
			}else{
				if(!kkk){
					kkk=true;
					sss=ch;
				}
				int f=sc.nextInt();
				String c=sc.next();
				if(f==1){
					if(ch){
						q.add(c);
					}else{
						q.addFirst(c);
						
					}
				}else{
					if(ch){
						
						q.addFirst(c);
					}else{
						q.add(c);
					}
				}
			}
		}
		StringBuilder ans=new StringBuilder();
		while(!q.isEmpty()){
			if(s){
				ans.append(q.pollLast());
			}else{
				ans.append(q.poll());
			}
		}
		System.out.println(ans);
	}
}


Compiler output:
Main.java:43: error: incompatible types: String cannot be converted to boolean
			if(s){
			   ^
1 error
Language: C++

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

int main() {
	string S;
	int Q, T, F;
	cin >> S >> Q;
	char C;
	int rev = 1;
	for (int i = 0; i < Q; i++) {
		cin >> T;
		if (T == 1) rev *= -1;
		else {
			cin >> F >> C;
			if (F == 1) {
				if (rev == 1) S = C + S;
				else S += C;
			}
			else {
				if (rev == 1) S += C;
				else S = C + S;
			}
		}
	}
	if (rev == 1) cout << S << endl;
	else {
		int N = S.size();
		int i, j;
		char tmp = { 0 };

		for (i = 0, j = size - 1; i < N / 2; i++, j--) {
			tmp = S[i];
			S[i] = S[j];
			S[j] = tmp;
		}
		cout << S << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:38: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator-'
   31 |                 for (i = 0, j = size - 1; i < N / 2; i++, j--) {
      |                                 ~~~~~^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
//#define all(v) v.begin(), v.end()
//bool chmin(ll & a, ll  b) { if (b < a) { a = b; return 1; } return 0; }
//bool chmax(ll & a, ll b) { if (b > a) { a = b; return 1; } return 0; }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
//const ll MAX_N=500010;
ll a, b, c, d, e, f, h, k, l, m, n, p, q, r, t, w, x, y, z, ans;
int main() {
  string S;
  char s;
  cin >> S >> q;
  a=0
  rep(i, q) {
    cin >> t;
    c = S.size();
    if(t == 1) {
      if(a==0) a=1;
      else a=0;
    }else if(t == 2) {
      cin >> f >> s;
      if ((f == 1 && a==0)||(f==2 && a==1)) {
        S = s+S;
      }else{
        S += s;
      }
    }
  }
  if(a==1) reverse(S.begin(), S.end());
  cout << S << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:6: error: expected ';' before 'for'
   18 |   a=0
      |      ^
      |      ;
a.cc:19:7: error: 'i' was not declared in this scope
   19 |   rep(i, q) {
      |       ^
a.cc:6:33: note: in definition of macro 'rep'
    6 | #define rep(i, n) for(ll i = 0; i < ll(n); i++)
      |                                 ^
Language: C

#include<stdio.h>

void StrRev(char*);
void StrNew(char*, char);

static long idx = 0;

int main(void) {
	char S[100000];
	char T, F, C;
	long Q, i;

	scanf("%s %ld", S, Q);

	while ('\0' != S[idx]) {
		idx++;
	}

	for (i = 0; Q > i; i++) {
		scanf("%c", &T);
		if (1 == T) {
			StrRev(S);
		}
		else if (2 == T) {
			scanf("%c %c", &F, &C);
			if (1 == F) {
				StrNew(S, C);
				idx++;
			}
			else if (2 == F) {
				S[idx] = C;
				idx++;
			}
		}
	}

	printf("%s\n", S);

	return 0;
}

void StrRev(char* Str[]) {
	char* pStr = Str;
	char temp;
	long IDX = 0;
	long i, idxMax;

	while ('\0' != *(pStr + IDX)) {
		IDX++;
	}

	idxMax = IDX;
	IDX /= 2;

	for (i = 0; IDX > i; i++) {
		temp = *pStr;
		*pStr = *(pStr + idxMax - 1 - i);
		*(pStr + idxMax - 1 - i) = temp;
	}
}

void StrNew(char* Str[], char C) {
	char* pStr = Str;
	long i;

	for (i = 0; idx > i; i++) {
		*(pStr + idx - i) = *(pStr + idx - 1 - i);
	}

	*pStr = C;

}

Compiler output:
main.c:42:6: error: conflicting types for 'StrRev'; have 'void(char **)'
   42 | void StrRev(char* Str[]) {
      |      ^~~~~~
main.c:3:6: note: previous declaration of 'StrRev' with type 'void(char *)'
    3 | void StrRev(char*);
      |      ^~~~~~
main.c: In function 'StrRev':
main.c:43:22: error: initialization of 'char *' from incompatible pointer type 'char **' [-Wincompatible-pointer-types]
   43 |         char* pStr = Str;
      |                      ^~~
main.c: At top level:
main.c:62:6: error: conflicting types for 'StrNew'; have 'void(char **, char)'
   62 | void StrNew(char* Str[], char C) {
      |      ^~~~~~
main.c:4:6: note: previous declaration of 'StrNew' with type 'void(char *, char)'
    4 | void StrNew(char*, char);
      |      ^~~~~~
main.c: In function 'StrNew':
main.c:63:22: error: initialization of 'char *' from incompatible pointer type 'char **' [-Wincompatible-pointer-types]
   63 |         char* pStr = Str;
      |                      ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  int Q;
  cin >> Q;
  vector<vector<int>> vec(Q,vector<int>(2,0));
  vector<string> k(0);
  for(int i=0; i<Q; i++){
    cin >> vec[i][0];
    if(vec[i][0] == 1){
    }
    else{
      cin >> vec[i][1];
      string p;
      cin >> p;
      k.push_back(p);
    }
  }
  int m = 0;
  for(int i=0; i<Q; i++){
      if(vec[i][0] == 1){
          reverse(S.begin(), S.end());
      }
      else{
          char t = k[m];
        m ++;
          if(vec[i][1] == 1){
              S = t + S;
          }
          else{
              S = S + t;
          }
      }
  }
  cout << S << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:23: 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' in initialization
   27 |           char t = k[m];
      |                       ^
Language: C++

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

int main(){
  string s;
  int q;
  cin >> s >> q;
  list<char> S;
  for(int i =0;i<s.size();i++){
    S.push_back(s[i]);
  }
  vector<int> Q(q);
  vector<int> F(q);
  vector<char> C(q);
  for(int i=0;i<q;i++){
    cin >> Q[i];
    if(Q[i]==2){
      cin >> F[i] >> C[i];
    }
  }
  int T = 1;
  for(int i=0;i<q;i++){
    if(q[i]==1){
      if(T==1){
        T=2;
      }else{
        T=1;
      }
    }else{
      if(T==1){
        if(F[i]==1){
          S.push_front(C[i]);
        }else{
          S.push_back(C[i]);
        }
      }else{
        if(F[i]==1){
          S.push_back(C[i]);
        }else{
          S.push_front(C[i]);
        }
      }
    }
  }
  string str = "";
  for(int i=0;i<S.size();i++){
    str += S[i]; 
  }
  if(T==2){
    reverse(s.begin(), s.end());
  }
  cout << str;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: invalid types 'int[int]' for array subscript
   25 |     if(q[i]==1){
      |         ^
a.cc:49:13: error: no match for 'operator[]' (operand types are 'std::__cxx11::list<char>' and 'int')
   49 |     str += S[i];
      |             ^
Language: C++

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

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

int main(void)
{
char S[500000], C;
long Q, MODE, F, pL, pR, index, flg;
  memset(S, 0, sizeof(S));
  flg = 1;
  pL = 250000;
  pR = 250000;
  scanf("%s", &S[pL]);
  scanf("%ld", &Q);
  //printf("S(%s) Q(%ld)\n", &S[pL], Q);
  for (index = 0; index < Q; ++index) {
    scanf("%ld", &MODE);
    //printf("%ld", MODE);
    if (MODE == 1) {
      flg *= -1;
      //printf("\n");
      continue;
    }
    scanf("%ld %c", &F, &C);
    //printf(" %ld %c", F, C);
    //printf("\n");
    
    if (F == 1 && flg == 1) {
      S[--pL] = C;
    } else if (F == 1 && flg == -1) {
      S[++pR] = C;
    } else if (F == 2 && flg == 1) {
      S[++pR] = C;
    } else if (F == 2 && flg == -1) {
      S[--pL] = C;
    }
    //printf("S(%s) flg(%ld)\n", &S[pL], flg);
  }
  if (flg == 1) {
    printf("S(%s) flg(%ld)\n", &S[pL], flg);
    return 0;
  }
  for (index = pR; index <= PL; --index) {
    printf("%c", S[index]);
  }
  printf("\n");

  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:29: error: 'PL' was not declared in this scope; did you mean 'pL'?
   47 |   for (index = pR; index <= PL; --index) {
      |                             ^~
      |                             pL
Language: Java

import java.util.*;
import java.io.PrintWriter;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		int ttt=sc.nextInt();
		ArrayDeque<String> q=new ArrayDeque<>();
		q.add(s);
		boolean ch=true;
		boolean s=false;
		boolean kkk=false;
		for(int i=0; i<ttt; i++){
			int t=sc.nextInt();
			if(t==1){
				ch=!ch;
			}else{
				if(!kkk){
					kkk=true;
					s=ch;
				}
				int f=sc.nextInt();
				String c=sc.next();
				if(f==1){
					if(ch){
						q.add(c);
					}else{
						q.addFirst(c);
						
					}
				}else{
					if(ch){
						
						q.addFirst(c);
					}else{
						q.add(c);
					}
				}
			}
		}
		StringBuilder ans=new StringBuilder();
		while(!q.isEmpty()){
			if(s){
				ans.append(q.pollLast());
			}else{
				ans.append(q.poll());
			}
		}
		System.out.println(ans);
	}
}


Compiler output:
Main.java:11: error: variable s is already defined in method main(String[])
		boolean s=false;
		        ^
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 P = pair<int, int>;

int main() {
    string s;
    cin >> s;
    int q;
    cin >> q;
    rep(i, q) {
        int flag;
        cin >> flag;
        if (flag == 1) {
            string top, end;
            top = s[0];
            end = s[s.size()-1];
            s[0] = top;
            s[s.size()-1] = end;
        } else if (flag == 2) {
            int flag_sub;
            cin >> flag_sub;
            if (flag_sub == 1) {
                string t;
                cin >> t;
                s.insert(0, "t");
            } else if (flag_sub == 2) {
                string t;
                cin >> t;
                s.insert(s.size()-1, "t");
            }
        }
    }
    cout << s << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:20: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} in assignment
   19 |             s[0] = top;
      |                    ^~~
      |                    |
      |                    std::string {aka std::__cxx11::basic_string<char>}
a.cc:20:29: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} in assignment
   20 |             s[s.size()-1] = end;
      |                             ^~~
      |                             |
      |                             std::string {aka std::__cxx11::basic_string<char>}
Language: Java

import java.util.*;

public class D {
    void run() {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String mid = "";
        if (s.length() >= 2) {
            mid = s.substring(1, s.length() - 1);
        }
        int q = sc.nextInt();
        StringBuffer sbHead = new StringBuffer(1000000);
        sbHead.append(s.charAt(0));
        StringBuffer sbLast = new StringBuffer(1000000);
        if (s.length() != 1) {
            sbLast.append(s.charAt(s.length() - 1));
        }
//        debug(sbHead, sbLast);
        boolean isHead = true;
        for (int i = 0; i < q; i++) {
//            debug(sbHead, sbLast);
            int t = sc.nextInt();
            if (t == 1) {
                isHead = !isHead;
                continue;
            }
            int f = sc.nextInt();
            char c = sc.next().charAt(0);
            if ((f == 1 && isHead) || (f == 2 && !isHead)) {
                sbHead.append(c);
            } else {
                sbLast.append(c);
            }
        }


        StringBuffer ans = sbHead.reverse().append(mid).append(sbLast);
        if (isHead) {
            System.out.println(ans.toString());
        } else {
            System.out.println(ans.reverse().toString());
        }
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new D().run();
    }
}


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

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

int main() {
  string s;
  int q;
  cin >> s >> q;
  
  string pre;
  string suf;
  
  bool reversed = false;
  
  for (int i = 0; i < q; i++) {
    int t,f;
    string cha;
    cin >> t >> f >> cha;
   
    if (t == 1) {
      reversed = !reversed;
    } else {
      if (f == 1) {
        if (reversed) {
          suf = suf + cha;
        } else {
          pre = cha + pre;
        }
      } else {
        if (reversed) {
          pre = cha + pre;
        } else {
          suf = suf + cha;
        }
      }
    }
  }
  
  s = pre + s + suf;
 
if (reversed) {
  cout << str::reverse(s.begin(), s.end()) << endl; // TODO reverse
} else {
  cout << s << endl;
}
 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:11: error: 'str' has not been declared
   42 |   cout << str::reverse(s.begin(), s.end()) << endl; // TODO reverse
      |           ^~~
Language: C++

#include<iostream>
#include<vector>
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){

double n=1,a,b,c,ans,d,e,left,right,count;
string s1,s;
cin >>s>>n;
for(int i=0;i<n;i++){
  cin>>a;
  if(a=1)reverse(s.begin(),s.end());
  else {
  cin>>b>>s1;
    if(b==1)s.insert(0,s1);
    else s.insert(s.lengtn(),s1);
  }
}
cout<<s<<endl;
return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:17:21: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'lengtn'; did you mean 'length'?
   17 |     else s.insert(s.lengtn(),s1);
      |                     ^~~~~~
      |                     length
Language: C++

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

int main() {
  string S;
  int Q;
  cin >> S >> Q;
  int turn = 0;
  rep(i, Q){
    int T;
    cin >> T;
    if(T == 1){
      turn += 1;
    }else{
      int F;
      string C;
      cin >> F >> C;
      if(F == 1 && turn%2==0 || F == 2 && turn%2 == 1){
        S = C + S; 
      }else{
        S = S + C;
      }
    }
  }
  if(turn%2==1){
    rep(i, S.size()){
      tmp += S.at(S.size()-1-i);
    }
  }
  cout << S << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:7: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   28 |       tmp += S.at(S.size()-1-i);
      |       ^~~
      |       tm
Language: C++

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

int main()
{
    std::string S;
    std::string a = "";
    int Q = 0;
    std::cin >> S >> Q;

    int T, F;
    char C;

    bool flip = false;

    for (int i = 0; i < Q; ++i) {
        std::cin >> T;
        if (T == 1) {
            flip = !flip;
        } else if (T == 2) {
            std::cin >> F >> C;
            if ((!flip && (F == 1)) || (flip && (F == 2))) {
                a += C;
            } else {
                b += C;
            }
        }
    }

    if (flip) {
        std::reverse(S.begin(), S.end());
        if (b != "") {
            std::reverse(b.begin(), b.end());
        }
        std::cout << (b + S + a);
    } else {
        if (a != "") {
            std::reverse(a.begin(), a.end());
        }
        std::cout << (a + S + b);
    }


    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:17: error: 'b' was not declared in this scope
   26 |                 b += C;
      |                 ^
a.cc:33:13: error: 'b' was not declared in this scope
   33 |         if (b != "") {
      |             ^
a.cc:36:23: error: 'b' was not declared in this scope
   36 |         std::cout << (b + S + a);
      |                       ^
a.cc:41:31: error: 'b' was not declared in this scope
   41 |         std::cout << (a + S + b);
      |                               ^
Language: C++

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

int main() {
  string s;
  int q;
  cin >> s >> q;
  
  string pre;
  string suf;
  
  bool reversed = false;
  
  for (int i = 0; i < q; i++) {
    int t,f;
    string cha;
    cin >> t >> f >> cha;
   
    if (t == 1) {
      reversed = !reversed;
    } else {
      if (f == 1) {
        if (reversed) {
          suf = suf + cha;
        } else {
          pre = cha + pre;
        }
      } else {
        if (reversed) {
          pre = cha + pre;
        } else {
          suf = suf + cha;
        }
      }
    }
  }
  
  s = pre + s + suf;
 
if (reversed) {
  cout << str::reverse(s.begin(), s.end()) << endl; // TODO reverse
} else {
  cout << s << endl;
}
 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:11: error: 'str' has not been declared
   41 |   cout << str::reverse(s.begin(), s.end()) << endl; // TODO reverse
      |           ^~~
Language: C++

#include <bits/stdc++.h>
#include <algorithm>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
typedef long long ll;
 
 
int main() {
 
    string x;
    cin >> x;
    int q;
    cin >> q;
    vector<int> v(q);
    vector<int> f(q);
    vector<string> c(q);
    rep(i,q) {
        cin >> v[i];
        if(v[i]!=1) {
            cin >> f[i];
            cin >> c[i];
        }
    }
    vector<int> wa(q+1);
    wa[0]=0;
    for(int i=0;i<q;i++) {
        wa[i+1]=wa[i];
        if(v[i]==1) wa[i+1]+=1;
    }
    string s;
    rep(i,q) {
        if((wa[q]-wa[i])%2==0) {
            if(v[i]==1) ;
            else if(f[i]==1)    reverse(all(c[i]));
        }
        else {
            if(v[i]==1) ;
            else if(f[i]==1) {
                f[i]=2;
            }
            else if(f[i]==2) {
                reverse(all(c[i]);
                f[i]=1;
        }
    }
    rep(i,q) {
        if(v[i]==1) {
            x+=s;
            s='0';
            s.erase(0.0);
        }
        else if(f[i]==1)    s+=c[i];
        else if(f[i]==2)    x+=c[i];
    }
 
    reverse(all(s));
    x.insert(0,s);

 
    cout<<x<<endl;
 
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:34: error: expected ')' before ';' token
   46 |                 reverse(all(c[i]);
      |                        ~         ^
a.cc:67:2: error: expected '}' at end of input
   67 | }
      |  ^
a.cc:12:12: note: to match this '{'
   12 | int main() {
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(void) {
  string S;
  int Q;
  cin >> S;
  cin >> Q;
  for (int i = 0; i < Q; ++i) {
    int T;
    cin >> T;
    if (T == 1) {
      reverse(S.bigin(), S.end());
    } else {
      int F;
      string C;
      if (F == 1) {
        S = C + S;
      } else {
        S += C;
      }
    }
  }
  cout << S << endl;
  return 0;
}

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

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

int main() {
  string s;
  cin >> s;
  int q;
  cin >> q;
  queue<char> que;
  que.push_front(s);
  int flag = 1;
  for(int i=0; i<q; i++) {
    int a;
    cin >> a;
    if(a == 1) flag *= -1;
    else {
      char x, y;
      cin >> x >> y;
      if(flag == 1){
        que.push_front(x);
        que.push_back(y);
      }
      else {
        que.push_front(y);
        que.push_back(x);
      }
    }
  }
  if(flag == -1) {
    //逆順
    for(auto it = que.rbegin(), it != que.rend(), it++)
      cout << *it << endl;
    cout << endl;
  }
  else {
    //正順
    for(auto it = que.begin(), it != que.end(), it++)
      cout << *it << endl;
    cout << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:7: error: 'class std::queue<char>' has no member named 'push_front'
   10 |   que.push_front(s);
      |       ^~~~~~~~~~
a.cc:20:13: error: 'class std::queue<char>' has no member named 'push_front'
   20 |         que.push_front(x);
      |             ^~~~~~~~~~
a.cc:21:13: error: 'class std::queue<char>' has no member named 'push_back'
   21 |         que.push_back(y);
      |             ^~~~~~~~~
a.cc:24:13: error: 'class std::queue<char>' has no member named 'push_front'
   24 |         que.push_front(y);
      |             ^~~~~~~~~~
a.cc:25:13: error: 'class std::queue<char>' has no member named 'push_back'
   25 |         que.push_back(x);
      |             ^~~~~~~~~
a.cc:31:23: error: 'class std::queue<char>' has no member named 'rbegin'
   31 |     for(auto it = que.rbegin(), it != que.rend(), it++)
      |                       ^~~~~~
a.cc:34:3: error: expected primary-expression before '}' token
   34 |   }
      |   ^
a.cc:33:18: error: expected ')' before '}' token
   33 |     cout << endl;
      |                  ^
      |                  )
   34 |   }
      |   ~               
a.cc:31:8: note: to match this '('
   31 |     for(auto it = que.rbegin(), it != que.rend(), it++)
      |        ^
a.cc:34:3: error: expected primary-expression before '}' token
   34 |   }
      |   ^
a.cc:37:23: error: 'class std::queue<char>' has no member named 'begin'
   37 |     for(auto it = que.begin(), it != que.end(), it++)
      |                       ^~~~~
a.cc:40:3: error: expected primary-expression before '}' token
   40 |   }
      |   ^
a.cc:39:18: error: expected ')' before '}' token
   39 |     cout << endl;
      |                  ^
      |                  )
   40 |   }
      |   ~               
a.cc:37:8: note: to match this '('
   37 |     for(auto it = que.begin(), it != que.end(), it++)
      |        ^
a.cc:40:3: error: expected primary-expression before '}' token
   40 |   }
      |   ^
Language: C

#include <stdio.h>
#include <stdlib.h>

void rev(char *s);
char *case_t2(char *s);

int main()
{
  int i, j;
  char *s;
  char c;
  int q;
  int t, t_next;
  int f;
  
  s = (char *)malloc(sizeof(char) * 100000);
  scanf("%s", s);
  
  for(i = 0; i < q; i++){
    scanf("%d", &t);
    if(t == 1){
      if(i == q - 1){
        break;
      }
      scanf("%d", &t_next);
      if(t_next == 1){	//2連続反転
        i++;
        continue;
      }else{
        rev(s);
        &s[0] = case_t2(s);//t=2の時の処理
        i++;
      }
    }else{
      &s[0] = case_t2(s);//t=2の時の処理
    }
  }
  printf("%s\n", s);
  return 0;
}

void rev(char *s)
{
  int n = sizeof(s)/sizeof(char);
  char tmp;
  for(int i = 0; i < n / 2; i++){
    tmp = s[i];
    s[i] = s[n - i - 1];
    s[n - i - 1] = tmp;
  }
}

char *case_t2(char *s)
{
  int i;
  int f;
  char c;
  int n = sizeof(s)/sizeof(char);
  char *new_s;
  new_s = (char *)malloc(sizeof(char) * (n + 1));
  scanf("%d%c", &f, &c);
  if(f == 1){
    new_s[0] = c;
    for(i = 0; i < n; i++){
      new_s[i + 1] = s[i];
    }
  }else{
    new_s[n + 1] = c;
    for(i = 0; i < n; i++){
      new_s[i] = s[i];
    }
  }
  
  return new_s;
}

Compiler output:
main.c: In function 'main':
main.c:31:15: error: lvalue required as left operand of assignment
   31 |         &s[0] = case_t2(s);//t=2の時の処理
      |               ^
main.c:35:13: error: lvalue required as left operand of assignment
   35 |       &s[0] = case_t2(s);//t=2の時の処理
      |             ^
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pll pair<ll,ll>
#define pint pll
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

ll beki[200020];
ll l[200020],r[200020];

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

Compiler output:
a.cc: In function 'int main()':
a.cc:42:13: error: expected unqualified-id before 'char'
   42 |       int f,char c;
      |             ^~~~
a.cc:43:19: error: 'c' was not declared in this scope
   43 |       cin >> f >> c;
      |                   ^
a.cc:52:11: error: 'temp' was not declared in this scope; did you mean 'tm'?
   52 |   cout << temp << endl;
      |           ^~~~
      |           tm
Language: C++

#include <iostream>
using namespace std;
#include <string>
int main(){
  string s,b;
  cin >> s;
  int q,an,bn;
  cin >> q;
  bn=0;
  an=s.size()-1;
  for(int i = 0; i < q; i++){
   	int t;
    cin >> t;
    if(t==1){
     if(bn>0){
       char temp=b[bn-1];
       b[bn-1]=s[an];
       s[an]=temp;
     }else{
       char temp=s[0];
       s[0]=s[an];
       s[an]=temp;
     }
    }
    if(t==2){
     int f;
      cin >> f;
      if(f==1){
        char temp;
        cin >> temp
      	b[bn]=temp;
      	bn++;
      }else{
        an++;
       	   char temp;
        cin >> temp;
        s[an]=temp;
      }
    }
  }
  string ans={};
  for(int i = 0; i < b.size(); i++){
    ans[i]=b[b.size()-1-i];
  }
  cout << ans+s << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:20: error: expected ';' before 'b'
   30 |         cin >> temp
      |                    ^
      |                    ;
   31 |         b[bn]=temp;
      |         ~
Language: C++

#include <iostream>
#define ll long long
#include <bits/stdc++.h>
 
using namespace std;
int main()
{
	char a[1001001];
	scanf("%s",&a);
	int n = strlen(a);
	int q; cin>>q;
	while(q--){
		int t; cin>>t;
		if(t== 1){
			reverse(a, a + n);
		}
		else{
			int f; char c; cin>>f>>c;
			if(f == 1){
				a.insert(0, c);
			}
			else{
				a.insert(n - 1, c);
			}
			n++;
		}
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:35: error: request for member 'insert' in 'a', which is of non-class type 'char [1001001]'
   20 |                                 a.insert(0, c);
      |                                   ^~~~~~
a.cc:23:35: error: request for member 'insert' in 'a', which is of non-class type 'char [1001001]'
   23 |                                 a.insert(n - 1, c);
      |                                   ^~~~~~
Language: C++

/*我是萌新*/
#include<bits/stdc++.h> 
typedef long long ll;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 5;
using namespace std;

int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    string s;
    cin >> s;

    int z = 0; //0正1反
    string s1, s2;
    int q;
    cin >> q;
    while (q--)
    {
        int t, f;
        string x;
        cin >> t;

        if (t == 1)
        {
            z = !z;
        }
        else
        {
            cin >> f >> x;
            if (f == 1)
            {
                if (z)
                {
                    s2 += x;
                }
                else s1 += x;
            }
            else
            {
                if (z)
                {
                    s1 += x;
                }
                else s2 += x;
            }
        }
    }

    reverse(INS(s1));
    s = s1 + s + s2;
    if (z)
    {
        for (int i = s.size() - 1; i >= 0; i--)
            cout << s[i];
    }
    else
        for (auto i : s)
            cout << i;

    
}



Compiler output:
a.cc: In function 'int main()':
a.cc:51:13: error: 'INS' was not declared in this scope
   51 |     reverse(INS(s1));
      |             ^~~
Language: C++

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

using namespace std;

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

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

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

#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using in6 = int64_t;
using ind = double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  string s;
  cin >> s;
  int q;
  cin >> q;
  int siz = s.size();
  vector<char> data(10 * q);
  int left = 5 * q;
  int right = left + size - 1;
  rep(i,siz) {
    data[left + i] = s[i];
  }
  rep(i,q) {
    int a;
    cin >> a;
    if(a == 1) {
      int n,m;
      n = right;
      m = left;
      right = m;
      left = n;
    }
    else {
      size++;
      int b;
      char c;
      cin >> b >> c;
      if(b == 1) {
        if(left <= right) {
          data[left - 1] = c;
          left--;
        }
        else {
          data[left + 1] = c;
          left++;
        }
      }
      else {
        if(left <= right) {
          data[right + 1] = c;
          right++;
        }
        else {
          data[right - 1] = c;
          right--;
        }
      }
    }
  }
  if(left <= right) {
    rep(i,size) {
      cout << data[left + i];
    }
  }
  else {
    rep(i,size) {
      cout << data[left - i];
    }
  }
  cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:20: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator+'
   17 |   int right = left + size - 1;
      |               ~~~~~^~~~~~
a.cc:32:11: error: no post-increment operator for type
   32 |       size++;
      |           ^~
a.cc:7:46: error: overloaded function with no contextual type information
    7 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                              ^
a.cc:59:5: note: in expansion of macro 'rep'
   59 |     rep(i,size) {
      |     ^~~
a.cc:7:46: error: overloaded function with no contextual type information
    7 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                              ^
a.cc:64:5: note: in expansion of macro 'rep'
   64 |     rep(i,size) {
      |     ^~~
Language: C++

#include <iostream>
using namespace std;
#include <string>
int main(){
  string s,b;
  cin >> s;
  int q,an,bn;
  cin >> q;
  bn=0;
  an=s.size()-1;
  for(int i = 0; i < q; i++){
   	int t;
    cin >> t;
    if(t==1){
     if(bn>0){
       char temp=b[bn-1];
       b[bn-1]=s[an];
       s[an]=temp;
     }else{
       char temp=s[0];
       s[0]=s[an];
       s[an]=temp;
     }
    }
    if(t==2){
     int f;
      cin >> f;
      if(f==1){
        char temp;
        cin >> temp
      	b[bn]=temp;
      	bn++;
      }else{
        an++
       	   char temp;
        cin >> temp;
        s[an]=temp;
      }
    }
  }
  string ans={};
  for(int i = 0; i < b.size(); i++){
    ans[i]=b[b.size-1-i];
  }
  cout << ans+s << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:20: error: expected ';' before 'b'
   30 |         cin >> temp
      |                    ^
      |                    ;
   31 |         b[bn]=temp;
      |         ~           
a.cc:34:13: error: expected ';' before 'char'
   34 |         an++
      |             ^
      |             ;
   35 |            char temp;
      |            ~~~~
a.cc:36:16: error: 'temp' was not declared in this scope; did you mean 'tm'?
   36 |         cin >> temp;
      |                ^~~~
      |                tm
a.cc:43:16: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   43 |     ans[i]=b[b.size-1-i];
      |              ~~^~~~
      |                    ()
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(void) {
  string S;
  int Q;
  cin >> S;
  cin >> Q;
  for (int i = 0; i < Q; ++i) {
    int T;
    cin >> T;
    if (T == 1) {
      reverse(S);
    } else {
      int F;
      string C;
      if (F == 1) {
        S = C + S;
      } else {
        S += C;
      }
    }
  }
  cout << S << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:14: error: no matching function for call to 'reverse(std::string&)'
   12 |       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 <algorithm>
#include <iostream>
#include <string>
using namespace std;

int main()
{
  string S;
  cin>>S;
  cout<<endl;
  int Q;
  cin>>Q;
  cout<<endl;
  
  for(int i=0; i<Q; ++i){
  	int order;
    cin>>order;
    if(order==1){
      	reverse(S.begin(),S.end());
      	continue;
    }
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;

int main()
{
  string S;
  cin>>S;
  cout<<endl;
  int Q;
  cin>>Q;
  cout<<endl;
  #include <algorithm>
#include <iostream>
#include <string>
using namespace std;

int main()
{
  string S;
  cin>>S;
  cout<<endl;
  int Q;
  cin>>Q;
  cout<<endl;
  #include <algorithm>
#include <iostream>
#include <string>
using namespace std;

int main()
{
  string S;
  cin>>S;
  cout<<endl;
  int Q;
  cin>>Q;
  cout<<endl;
  #include <algorithm>
#include <iostream>
#include <string>
using namespace std;

int main()
{
  string S;
  cin>>S;
  cout<<endl;
  int Q;
  cin>>Q;
  cout<<endl;
  string add;
  for(int i=0; i<Q; ++i){
  	int order;
    cin>>order;
    if(order==1){
      	reverse(S.begin(),S.end());
      	continue;
    }
    
    cin>>order;
    cin>>add;
    if(order==1){
      add +=S;
      S = add;
      continue;
    }
    else if(order==2){
      S +=add;
      continue;
    }
  }
  cout<<S<<endl;
  return 0;
}

  for(int i=0; i<Q; ++i){
  	int order;
    cin>>order;
    if(order==1){
      	reverse(S.begin(),S.end());
      	continue;
    }
    string add;
    cin>>order;
    cin>>add;
    if(order==1){
      add +=S;
      S = add;
      continue;
    }
    else if(order==2){
      S +=add;
      continue;
    }
  }
  cout<<S<<endl;
  return 0;
}

  for(int i=0; i<Q; ++i){
  	int order;
    cin>>order;
    if(order==1){
      	reverse(S.begin(),S.end());
      	continue;
    }
    string add;
    cin>>order;
    cin>>add;
    if(order==1){
      add +=S;
      S = add;
      continue;
    }
    else if(order==2){
      S +=add;
      continue;
    }
  }
  cout<<S<<endl;
  return 0;
}

  for(int i=0; i<Q; ++i){
  	int order;
    cin>>order;
    if(order==1){
      	reverse(S.begin(),S.end());
      	continue;
    }
    string add;
    cin>>order;
    cin>>add;
    if(order==1){
      add +=S;
      S = add;
      continue;
    }
    else if(order==2){
      S +=add;
      continue;
    }
  }
  cout<<S<<endl;
  return 0;
}

    cin>>order;
    cin>>add;
    if(order==1){
      add +=S;
      S = add;
      continue;
    }
    else if(order==2){
      S +=add;
      continue;
    }
  }
  cout<<S<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   27 | int main()
      |         ^~
a.cc:27:9: note: remove parentheses to default-initialize a variable
   27 | int main()
      |         ^~
      |         --
a.cc:27:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:28:1: error: a function-definition is not allowed here before '{' token
   28 | {
      | ^
a.cc:172:10: error: 'add' was not declared in this scope
  172 |     cin>>add;
      |          ^~~
Language: C++

#include<iostream>
#include<vector>
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){

double n=1,a,b,c,ans,d,e,left,right,count;
string s1,s;
cin >>s>>n;
for(int i=0;i<n;i++){
  cin>>a;
  if(a=1)reverse(s.begin(),s.end());
  else {
  cin>>b>>s1;
    if(b==1)s.insert(0,s1);
    else s.insert(s.length,s1);
  }
}
cout<<s<<endl;
return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:17:21: error: invalid use of non-static member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
   17 |     else s.insert(s.length,s1);
      |                   ~~^~~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1083:7: note: declared here
 1083 |       length() const _GLIBCXX_NOEXCEPT
      |       ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
cin.tie(0);
ios::sync_with_stdio(false);

int main(){
  string str;
  int q;
  cin >> str >> q;
  for(int i=0;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 str+=c;
    }
  }
  
  cout << str << endl;
}

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

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

using namespace std;

#define rep(i, a, n) for(int i = a; i < (n); ++i)

int main(){
    string S, FrontS = "", BackS = "";
    cin >> S;
    long long Q;
    cin >> Q;

    T1 = 0;

    int T, F;
    string C;
    rep(i, 0, Q)
    {
        cin >> T;
        if (T == 1) 
        {
            ++T1;
            S = FrontS + S + BackS;
            FrontS = "";
            BackS = "";
        }
        else
        {
            cin >> F >> C;
            if (T1 % 2 == 0)
            {
                if (F == 1) FrontS = C + FrontS;
                else BackS += C;
            }
            else
            {
                if (F == 1) BackS = C + BackS;
                else FrontS = C + FrontS;
            }
        }
    }
    if (!BackS.empty()) s += BackS;
    if (!FrontS.empty()) s = FrontS + S;

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

}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'T1' was not declared in this scope
   15 |     T1 = 0;
      |     ^~
a.cc:44:25: error: 's' was not declared in this scope
   44 |     if (!BackS.empty()) s += BackS;
      |                         ^
a.cc:45:26: error: 's' was not declared in this scope
   45 |     if (!FrontS.empty()) s = FrontS + S;
      |                          ^