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

#include<cstdio>
#include <algorithm>
#include <iostream>
#include <functional>
#include<cmath>
#include<string.h>
#include<vector>
#include<queue>
#include<deque>

using namespace std;

int main(){
	int n,a,b,t=1;
	char c,s[1000000];
	queue<char> fr,bc;
	fr.reserve(300000);
	bc.reserve(300000);
	deque<char> ans;
	ans.reserve(300000);
	scanf("%s",s);
	for(int i=0;s[i]!='\0';i++){
		fr.push(s[i]);
	}
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a);
		if(a==1) t*=-1;
		else{
			scanf("%d %c",&b,&c);
			if(b==1){
				if(t==1)fr.push(c);
				else bc.push(c);
			}
			else {
				if(t==1)bc.push(c);
				else fr.push(c);
			}
		}
	}
	if(t==1){
		while(!fr.empty()){
			ans.push_front(fr.front());
			fr.pop();
		}
		while(!bc.empty()){
			ans.push_back(bc.front());
			bc.pop();
		}
		while(!ans.empty()){
			printf("%c",ans.front());
			ans.pop_front();
		}
		printf("\n");
	}
	else {
		while(!bc.empty()){
			ans.push_front(bc.front());
			bc.pop();
		}
		while(!fr.empty()){
			ans.push_back(fr.front());
			fr.pop();
		}
		while(!ans.empty()){
			printf("%c",ans.front());
			ans.pop_front();
		}
		printf("\n");
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:12: error: 'class std::queue<char>' has no member named 'reserve'
   17 |         fr.reserve(300000);
      |            ^~~~~~~
a.cc:18:12: error: 'class std::queue<char>' has no member named 'reserve'
   18 |         bc.reserve(300000);
      |            ^~~~~~~
a.cc:20:13: error: 'class std::deque<char, std::allocator<char> >' has no member named 'reserve'
   20 |         ans.reserve(300000);
      |             ^~~~~~~
Language: C++

#include<bits/stdc++.h>
char str[330000],ch;
int q,f,p;
int main() {
	scanf("%s",&str);
	scanf("%d",&q);
	for(int i=1;i<=q;++i) {
		scanf("%d",&f);
		if (f==1) strrev(str);
		else {
			scanf("%d %c",&p,&ch);
			if (p==1) {
				strrev(str);
				str[strlen(str)]=ch;
				strrev(str);
			} else str[strlen(str)]=ch;
		}
	}
	int l=strlen(str);
	for(int i=1;i<=l;++i)printf("%c",str[i-1]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:27: error: 'strrev' was not declared in this scope; did you mean 'strsep'?
    9 |                 if (f==1) strrev(str);
      |                           ^~~~~~
      |                           strsep
a.cc:13:33: error: 'strrev' was not declared in this scope; did you mean 'strsep'?
   13 |                                 strrev(str);
      |                                 ^~~~~~
      |                                 strsep
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<string.h>
using namespace std;
char s[300005];
void move(char x)
{
	for (int i = strlen(s); i >= 0; i--)
	{
		s[i + 1] = s[i];
	}
	s[0] = x;
	return;
}
int main()
{
	cin >> s;
	long int n;
	cin >> n;
	for (long int i = 1; i <= n; i++)
	{
		int a;
		cin >> a;
		if (a == 1)
			_strrev(s);
		else
		{
			int b;
			char c;
			cin >> b >> c;
			if (b == 1)
			{
				move(c);
			}
			else
			{
				s[strlen(s)] = c;
			}
		}
	}
	cout << s << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:25: error: '_strrev' was not declared in this scope
   28 |                         _strrev(s);
      |                         ^~~~~~~
Language: Java

import java.util.*;
import java.math.*;
class Main {
    //
    static final int MOD = 1_000_000_007; // 10^9+7
    //static final int MAX = 2_147_483_646; // intの最大値
    static final int INF = 1_000_000_000; // 10^9
    static final int MAX = 10_000_000;
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        StringBuffer mae = new StringBuffer("");
        StringBuffer usiro = new StringBuffer("");
        int n = sc.nextInt();
        boolean rev = false;
        for(int i = 0;i < n;i++){
            int t = sc.nextInt();
            if(t==1){
                if(rev){
                    rev = false;
                }else{
                    rev = true;
                }
            }else{
                int f = sc.nextInt();
                String c = sc.next();
                if(rev){
                    if(f==1){
                        usiro.apend(c);
                    }else{
                        mae.insert(0, c);
                    }
                }else{
                    if(f==1){
                        mae.insert(0, c);
                    }else{
                        usiro.apend(c);
                    }
                }
            }
        }
        if(rev){
            StringBuffer str = new StringBuffer(s);
            System.out.println(usiro.reverse().toString()+str.reverse().toString()+mae.reverse().toString());
        }else{
            System.out.println(mae.toString()+s+usiro.toString());
        }
    }
}



Compiler output:
Main.java:29: error: cannot find symbol
                        usiro.apend(c);
                             ^
  symbol:   method apend(String)
  location: variable usiro of type StringBuffer
Main.java:37: error: cannot find symbol
                        usiro.apend(c);
                             ^
  symbol:   method apend(String)
  location: variable usiro of type StringBuffer
2 errors
Language: C++

#include<cstdio>
#include<cstring>
char str[330000],ch;
int q,f,p;
int main() {
	scanf("%s",&str);
	scanf("%d",&q);
	for(int i=1;i<=q;++i) {
		scanf("%d",&f);
		if (f==1) strrev(str);
		else {
			scanf("%d %c",&p,&ch);
			if (p==1) {
				strrev(str);
				str[strlen(str)]=ch;
				strrev(str);
			} else str[strlen(str)]=ch;
		}
	}
	int l=strlen(str);
	for(int i=1;i<=l;++i)printf("%c",str[i-1]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:27: error: 'strrev' was not declared in this scope; did you mean 'strsep'?
   10 |                 if (f==1) strrev(str);
      |                           ^~~~~~
      |                           strsep
a.cc:14:33: error: 'strrev' was not declared in this scope; did you mean 'strsep'?
   14 |                                 strrev(str);
      |                                 ^~~~~~
      |                                 strsep
Language: Java

import java.util.*;
import java.math.*;
class Main {
    //
    static final int MOD = 1_000_000_007; // 10^9+7
    //static final int MAX = 2_147_483_646; // intの最大値
    static final int INF = 1_000_000_000; // 10^9
    static final int MAX = 10_000_000;
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        StringBuffer mae = new StringBuffer("");
        String usiro = new StringBuffer("");
        int n = sc.nextInt();
        boolean rev = false;
        for(int i = 0;i < n;i++){
            int t = sc.nextInt();
            if(t==1){
                if(rev){
                    rev = false;
                }else{
                    rev = true;
                }
            }else{
                int f = sc.nextInt();
                String c = sc.next();
                if(rev){
                    if(f==1){
                        usiro.apend(c);
                    }else{
                        mae.insert(0, c);
                    }
                }else{
                    if(f==1){
                        mae.insert(0, c);
                    }else{
                        usiro.apend(c);
                    }
                }
            }
        }
        if(rev){
            StringBuffer str = new StringBuffer(s);
            System.out.println(usiro.reverse().toString()+str.reverse().toString()+mae.reverse().toString());
        }else{
            System.out.println(mae.toString()+s+usiro.toString());
        }
    }
}



Compiler output:
Main.java:13: error: incompatible types: StringBuffer cannot be converted to String
        String usiro = new StringBuffer("");
                       ^
Main.java:29: error: cannot find symbol
                        usiro.apend(c);
                             ^
  symbol:   method apend(String)
  location: variable usiro of type String
Main.java:37: error: cannot find symbol
                        usiro.apend(c);
                             ^
  symbol:   method apend(String)
  location: variable usiro of type String
Main.java:44: error: cannot find symbol
            System.out.println(usiro.reverse().toString()+str.reverse().toString()+mae.reverse().toString());
                                    ^
  symbol:   method reverse()
  location: variable usiro of type String
4 errors
Language: Java

import java.util.*;
import java.math.*;
class Main {
    //
    static final int MOD = 1_000_000_007; // 10^9+7
    //static final int MAX = 2_147_483_646; // intの最大値
    static final int INF = 1_000_000_000; // 10^9
    static final int MAX = 10_000_000;
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        StringBuffer mae = new StringBuffer("");
        String usiro = new StringBuffer("");
        int n = sc.nextInt();
        boolean rev = false;
        for(int i = 0;i < n;i++){
            int t = sc.nextInt();
            if(t==1){
                if(rev){
                    rev = false;
                }else{
                    rev = true;
                }
            }else{
                int f = sc.nextInt();
                String c = sc.next();
                if(rev){
                    if(f==1){
                        usiro.apend(c);
                    }else{
                        mae.insert(0, c);
                    }
                }else{
                    if(f==1){
                        mae.insert(0, c);
                    }else{
                        usiro.apend(c);
                }
            }
        }
        if(rev){
            StringBuffer str = new StringBuffer(s);
            System.out.println(usiro.reverse().toString()+str.reverse().toString()+mae.reverse().toString());
        }else{
            System.out.println(mae.toString()+s+usiro.toString());
        }
    }
}



Compiler output:
Main.java:48: error: reached end of file while parsing
}
 ^
1 error
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
#include <string>

#define rep(i,x) for(int i = 0; i < x; i++)
#define rrep(i,x) for(int i = 1; i <= x; i++)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using ll = long long;
using namespace std;
const int INF = 1001001001;
const ll LINF = 1002003004005006007;

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


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

# -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 20:52:57 2020

@author: over-
"""


S=input()

R=''
L=len(S)
for i in range(L):
    R+=S[L-i-1]


Q=int(input())

for i in range(Q):
    q=input().split()
    if int(q[0])==1:
        t=S
        S=R
        R=t
    if int(q[0])==2:
        if int(q[1])==1:
            S=q[2]+S
            R=R+q[2]
        if int(q[1])==2:
            R=q[2]+R
            S=S+q[2]


print(S)




Compiler output:
a.cc:1:3: error: invalid preprocessing directive #-
    1 | # -*- coding: utf-8 -*-
      |   ^
a.cc:2:3: warning: missing terminating " character
    2 | """
      |   ^
a.cc:2:3: error: missing terminating " character
a.cc:5:1: error: stray '@' in program
    5 | @author: over-
      | ^
a.cc:6:3: warning: missing terminating " character
    6 | """
      |   ^
a.cc:6:3: error: missing terminating " character
a.cc:11:3: error: empty character constant
   11 | R=''
      |   ^~
a.cc:2:1: error: expected unqualified-id before string constant
    2 | """
      | ^~
Language: C++

#include<iostream>
#include<string.h>
using namespace std;
int main()
{
  char s[100],b[100];
  int 	q,t,f;
  int n=0;
  for(int j=0;s[j]!='\0';j++)
  {
  n++;
  }
  char c;
  for(j=0;s[j]1='\0';j++)
  {
  cin>>s[j];
  }
  cin>>q;
  cin>>t;
  for(int k=0;k<q;k++)
  {
  if(t==1)
  {
    for(int i=0;i<=n;i++)
    {
     b[i]=s[n-i];
    }
    strcpy(b,s);
  }
  if(t==2)
  {
    cin>>f;
    cin>>c;
    if(f==1)
      s=strcat(c,s);
    else
      s=strcat(s,c);
  }
  }
  for(i=0;s[i]1='\0';i++)
  {
  cout<<s[i];
  }
    

Compiler output:
a.cc: In function 'int main()':
a.cc:14:7: error: 'j' was not declared in this scope
   14 |   for(j=0;s[j]1='\0';j++)
      |       ^
a.cc:14:15: error: expected ';' before numeric constant
   14 |   for(j=0;s[j]1='\0';j++)
      |               ^
      |               ;
a.cc:14:15: error: lvalue required as left operand of assignment
a.cc:14:21: error: expected ')' before ';' token
   14 |   for(j=0;s[j]1='\0';j++)
      |      ~              ^
      |                     )
a.cc:14:22: error: 'j' was not declared in this scope
   14 |   for(j=0;s[j]1='\0';j++)
      |                      ^
a.cc:35:16: error: invalid conversion from 'char' to 'char*' [-fpermissive]
   35 |       s=strcat(c,s);
      |                ^
      |                |
      |                char
In file included 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:35:8: error: incompatible types in assignment of 'char*' to 'char [100]'
   35 |       s=strcat(c,s);
      |       ~^~~~~~~~~~~~
a.cc:37:18: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
   37 |       s=strcat(s,c);
      |                  ^
      |                  |
      |                  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)
      |                                               ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
a.cc:37:8: error: incompatible types in assignment of 'char*' to 'char [100]'
   37 |       s=strcat(s,c);
      |       ~^~~~~~~~~~~~
a.cc:40:7: error: 'i' was not declared in this scope
   40 |   for(i=0;s[i]1='\0';i++)
      |       ^
a.cc:40:15: error: expected ';' before numeric constant
   40 |   for(i=0;s[i]1='\0';i++)
      |               ^
      |               ;
a.cc:40:15: error: lvalue required as left operand of assignment
a.cc:40:21: error: expected ')' before ';' token
   40 |   for(i=0;s[i]1='\0';i++)
      |      ~              ^
      |                     )
a.cc:40:22: error: 'i' was not declared in this scope
   40 |   for(i=0;s[i]1='\0';i++)
      |                      ^
a.cc:43:4: error: expected '}' at end of input
   43 |   }
      |    ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {
    string S,E;
    char B,C;
    long long Q,A,D;
    cin >> S >> Q;

    for (long long i = 0;i < Q;i++) {
        cin >> A;
        if (A == 1) {
            B = S[0];
            C = S.back
            S[0] = C;
            S[S.size() - 1] = B;
        } else {
            cin >> D;
            cin >> E;
            if (D == 1) {
                S.insert(0,E);
            } else {
                S += E;
            }
        }
    }

    cout << S << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:19: error: cannot resolve overloaded function 'back' based on conversion to type 'char'
   15 |             C = S.back
      |                   ^~~~
Language: C++

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

int main() {
    string S, C;
    int Q, T, F;
    cin >> S >> Q;

    vector<vector<int>> vec(3, vector<int>(Q));

    for (int i = 0; i < Q; i++){
        cin >> T;
        if (T == 1){
            vec.at(i).at(0) = 1;
        } else {
            cin >> vec.at(i).at(1);
            cin >> vec.at(i).at(2);
        }
    }

    for (int j = 0; j < Q; j++) {
        if (vec.at(j).at(0) == 1) {
            reverse(S.begin(), S.end());
        } else {
            if (vec.at(j).at(1) == 1) {
                S.insert(0, vec.at(j).at(2););
            } else {
                S += vec.at(j).at(2);;
            }
        }
    }

    cout << S << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:44: error: expected ')' before ';' token
   26 |                 S.insert(0, vec.at(j).at(2););
      |                         ~                  ^
      |                                            )
a.cc:26:45: error: expected primary-expression before ')' token
   26 |                 S.insert(0, vec.at(j).at(2););
      |                                             ^
Language: C++

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

int main() {
    string S, C;
    int Q, T, F;
    cin >> S >> Q;

    vector<vector<int>> vec(3, vector<int>(Q));

    for (int i = 0; i < Q; i++){
        cin >> T;
        if (T == 1){
            vec.at(i).at(0) = 1;
        } else {
            cin >> vec.at(i).at(1);
            cin >> vec.at(i).at(2);
        }
    }

    for (int j = 0; j < Q; j++) {
        if (vec.at(j).at(0) == 1) {
            reverse(S.begin(), S.end());
        } else {
            if (vec.at(j).at(1) == 1) {
                S.insert(0, vec.at(i).at(2););
            } else {
                S += vec.at(i).at(2);;
            }
        }
    }

    cout << S << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:36: error: 'i' was not declared in this scope
   26 |                 S.insert(0, vec.at(i).at(2););
      |                                    ^
a.cc:26:45: error: expected primary-expression before ')' token
   26 |                 S.insert(0, vec.at(i).at(2););
      |                                             ^
a.cc:28:29: error: 'i' was not declared in this scope
   28 |                 S += vec.at(i).at(2);;
      |                             ^
Language: C

#include <iostream>
using namespace std;

void reverseStr(string &str)
{
    int n = str.length();

    // Swap character starting from two
    // corners
    for (int i = 0; i < n / 2; i++)
        swap(str[i], str[n - i - 1]);
}

int main()
{
    string s;
    int d;
    string q;
    cin >> s;
    cin >> d;
    for (int i = 0; i <= d; i++)
    {
        getline(cin, q);
        if (q[0] == '1')
        {
            reverseStr(s);
        }
        else if (q[0] == '2')
        {
            if (q[2] == '1')
            {
                s = q[4] + s;
            }
            else
            {
                s = s + q[4];
            }
        }
    }
    cout << s << endl;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: Java

	import java.util.*;
	
	import aaaa.stree2;
	
	import java.io.*;
	
	public class Main {
	
		static int n;
		static long memo[][];
		static int p;
		static int pl[][];
		static pair[] a;
		static int k;
	
		public static long dp(int msk, int idx) {
			if (idx == n)
				return 0;
			if (memo[msk][idx] != -1)
				return memo[msk][idx];
			long max = k - (idx - Integer.bitCount(msk)) > 0 ? dp(msk, idx + 1) + a[idx].x : dp(msk, idx + 1);
	
			for (int i = 0; i < p; i++) {
				if (((msk >> i) & 1) == 0) {
					max = Math.max(max, pl[a[idx].y][i] + dp(msk | 1 << i, idx + 1));
				}
			}
			return memo[msk][idx] = max;
	
		}
	
		public static void main(String[] args) throws NumberFormatException, IOException {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			PrintWriter pw = new PrintWriter(System.out);
			String s = br.readLine();
			int n = Integer.parseInt(br.readLine());
			int a[] = new int[n + 1];
			String[] b = new String[n];
			for (int i = 0; i < n; i++) {
				String w = br.readLine();
				int x = w.length();
				if (x == 1) {
					a[i + 1]++;
				}
				b[i] = w;
			}
			a[n] = a[n] % 2;
			for (int i = n - 1; i >= 0; i--) {
				a[i] += a[i + 1];
				a[i] = a[i] % 2;
			}
			if (a[0] == 1)
				s = new StringBuilder(s).reverse().toString();
			StringBuilder sb = new StringBuilder(s);
			Stack<String> v = new Stack<>();
			for (int i = 0; i < b.length; i++) {
				if (b[i].length() == 1)
					continue;
				int t = Integer.parseInt(b[i].charAt(0) + "");
				int w = (Integer.parseInt(b[i].charAt(2) + "") + a[i + 1]) % 2;
				String r = b[i].charAt(4) + "";
				if (w == 0)
					sb.append(r);
				else
					v.add(r);
			}
			while (!v.isEmpty())
				System.out.print(v.pop());
			System.out.println(sb.toString());
		}
	
		static int gcd(int a, int b) {
			if (b == 0)
				return a;
			return gcd(b, a % b);
		}
	
		static class pair {
			int x;
			int y;
	
			pair(int r, int t) {
				x = r;
				y = t;
			}
	
			public String toString() {
				return "(" + x + "," + y + ")";
			}
	
		}
	}

Compiler output:
Main.java:3: error: package aaaa does not exist
	import aaaa.stree2;
	           ^
1 error
Language: C++

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

using namespace std;

int main() {
	string s,ans,x;
	int q,qu;
	cin >> s >> q;
	ans = s;
	for (int i = 0; i < q; i++) {
		cin >> qu;
		if (qu == 1) {
			reverse(ans.begin(), ans.end());
		}
		else {
			cin >> qu;
			if (qu == 1) {
				cin >> x;
				x += ans;
				ans = x;
			}
			else {
				cin >> x;
				ans += x;
			}
		}
	}

	cout << ans << endl;

	return 0;
}

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

import java.util.*;

import aaaa.stree2;

import java.io.*;

public class Main {

	static int n;
	static long memo[][];
	static int p;
	static int pl[][];
	static pair[] a;
	static int k;

	public static long dp(int msk, int idx) {
		if (idx == n)
			return 0;
		if (memo[msk][idx] != -1)
			return memo[msk][idx];
		long max = k - (idx - Integer.bitCount(msk)) > 0 ? dp(msk, idx + 1) + a[idx].x : dp(msk, idx + 1);

		for (int i = 0; i < p; i++) {
			if (((msk >> i) & 1) == 0) {
				max = Math.max(max, pl[a[idx].y][i] + dp(msk | 1 << i, idx + 1));
			}
		}
		return memo[msk][idx] = max;

	}

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		String s = br.readLine();
		int n = Integer.parseInt(br.readLine());
		int a[] = new int[n + 1];
		String[] b = new String[n];
		for (int i = 0; i < n; i++) {
			String w = br.readLine();
			int x = w.length();
			if (x == 1) {
				a[i + 1]++;
			}
			b[i] = w;
		}
		a[n] = a[n] % 2;
		for (int i = n - 1; i >= 0; i--) {
			a[i] += a[i + 1];
			a[i] = a[i] % 2;
		}
		if (a[0] == 1)
			s = new StringBuilder(s).reverse().toString();
		StringBuilder sb = new StringBuilder(s);
		Stack<String> v = new Stack<>();
		for (int i = 0; i < b.length; i++) {
			if (b[i].length() == 1)
				continue;
			int t = Integer.parseInt(b[i].charAt(0) + "");
			int w = (Integer.parseInt(b[i].charAt(2) + "") + a[i + 1]) % 2;
			String r = b[i].charAt(4) + "";
			if (w == 0)
				sb.append(r);
			else
				v.add(r);
		}
		while (!v.isEmpty())
			System.out.print(v.pop());
		System.out.println(sb.toString());
	}

	static int gcd(int a, int b) {
		if (b == 0)
			return a;
		return gcd(b, a % b);
	}

	static class pair {
		int x;
		int y;

		pair(int r, int t) {
			x = r;
			y = t;
		}

		public String toString() {
			return "(" + x + "," + y + ")";
		}

	}
}

Compiler output:
Main.java:3: error: package aaaa does not exist
import aaaa.stree2;
           ^
1 error
Language: Java

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

public class Main{
    public static void main(String[] args)throws Exception{
        Scanner sc=new Scanner(System.in);
        StringBuffer s=new StringBuffer(sc.next());
        int q=sc.nextInt();
        boolean direction=true;
        for(int i=0;i<q;i++){
            int t=sc.nextInt();
            if(t==1){
                direction=!direction;
            }else{
                int f=sc.nextInt();
                char c=sc.next().charAt(0);
                if(direction==(f==1)){
                    s.insert(0,c);
                }else{
                    s.insert(s.toString().length(),c);
                }
            }
        }
        String str=s.toString();
        int l=str.length();
        for(int i=0;i<l;i++){
            System.out.print(str.charAt(direction?i:l-i-1);
        }
        System.out.println();
    }
}

Compiler output:
Main.java:27: error: ')' or ',' expected
            System.out.print(str.charAt(direction?i:l-i-1);
                                                          ^
1 error
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <string>
 
using namespace std;
typedef long long ll;

char Ans[400000];
	int Query[200001][3];

int main()
{
	char S[100001];
	int Q;
	
	scanf("%s", S);
	scanf("%d", &Q);
	
	for(int i = 0; i < Q; i++){
		scanf("%d", &Query[i][0]);
		
		if(Query[i][0] == 2){
			scanf("%d", &Query[i][1]);
		  char c[256];
			scanf("%s", c);
			Query[i][2] = (int)c[0];
		}
	}
	
	int len = strlen(S);
	string str = S;
	
	for(int i = 0; i < Q; i++){
		
		if(Query[i][0] == 1){
			for(int j = 0; j < (len)/2; j++){
				char temp = str[len - j-1];
				str[len - j-1] = str[j];
				str[j] = temp;
			}
		}else{
			if(Query[i][1] == 1){
				len++;
				str.insert(str.begin(), ((char)Query[i][2]));
			}else{
				len++;
				str += (char)Query[i][2];
			}
		}
	}
	
	printf("%s\n", str.c_str());
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:19: error: 'strlen' was not declared in this scope
   32 |         int len = strlen(S);
      |                   ^~~~~~
a.cc:6:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <string>
  +++ |+#include <cstring>
    6 |
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<string.h>
using namespace std;
char s[300005];
void move(char x)
{
	for (int i = strlen(s); i >= 0; i--)
	{
		s[i + 1] = s[i];
	}
	s[0] = x;
	return;
}
int main()
{
	cin >> s;
	long int n;
	cin >> n;
	for (long int i = 1; i <= n; i++)
	{
		int a;
		cin >> a;
		if (a == 1)
			strrev(s);
		else
		{
			int b;
			char c;
			cin >> b>>c;
			if (b == 1)
			{
				move(c);
			}
			else
			{
				s[strlen(s)] = c;
			}
		}
	}
	cout << s << endl;
	return 0;
}

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

#include <iostream>
#include <string>
#include <math.h>
using namespace std;
int main()
{
	string s, c;
	int q, t, f;
	cin >> s >> q;
	bool inv = false;
	int inv_num = 0;
	for (int i = 0; i < q; i++) {
		cin >> t;
		if (t == 1) {
			inv_num++;
			inv = !inv;
		}
		else {
			cin >> f >> c;
			if (f == 1) {
				if (!inv)	s = c + s;
				else {
					s = s + c;
				}
			}
			else {
				if (!inv)	s = s + c;
				else {
					s = c + s;
				}
			}
		}
	}

	if (inv) {
		reverse(s.begin(), s.end());
	}
	cout << s << endl;
	return 0;

}

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

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

int main()
{
    string s;
    cin >> s;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        int p;
        cin >> p;
        if (p == 1)
        {
            reverse(s.begin(), s.end());
        }
        else if(p == 2)
        {
            int p1;
            cin >> p1;
            string str;
            cin >> str;
            if (p1 == 1)
            {
                s = str + s;
            }
            else if(p1 == 2)
            {
                s = s + str;
            }
        }
    }
    cout << s << endl;
    return 0;
}


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

#include <iostream>
#include <vector>
#include <cmath>

int d()
{
    std::string s;
    std::cin >> s;
    
    int n;
    std::cin >> n;
    
    int direction = 0; // 0:順方向 1:逆方向
    for(int i = 0; i < n; i++)
    {
        int a, b = 0;
        std::cin >> a;
        std::string c;
        if(a == 2)
        {
            std::cin >> b >> c;
        }
        
        if(a == 1)
        {
            if(direction == 0)
            {
                direction = 1;
            }
            else
            {
                direction = 0;
            }
            continue;
        }
        
        if((b == 1 && direction == 0) || (b == 2 && direction == 1))
        {
            // 前に追加
            s = c + s;
        }
        else
        {
            // 後ろに追加
            s = s + c;
        }
    }
    
    if(direction == 0)
    {
        std::cout << s;
    }
    else
    {
        std::reverse(s.begin(), s.end());
        std::cout << s;
    }
    return 0;
}


int main(int argc, const char * argv[])
{
    d();
    return 0;
}

Compiler output:
a.cc: In function 'int d()':
a.cc:55:14: error: 'reverse' is not a member of 'std'
   55 |         std::reverse(s.begin(), s.end());
      |              ^~~~~~~
Language: C++

#include <iostream>
#include <string>

using namespace std;

int main()
{
    string S;
    int Q;

    cin >> S >> Q;

    // 反転世界のSを用意
    string RS = S;
    reverse(RS.begin(), RS.end());

    int reverseCounter = 0;

    int T, F;
    string C;

    for (int i = 0; i < Q; i++)
    {
        cin >> T;

        if (T == 1)
        {
            reverseCounter++;
        }
        else
        {
            cin >> F >> C;
            if (F == 1)
            {
                if (reverseCounter % 2 == 0)
                {
                    S = C + S;
                    RS = RS + C;
                }
                else
                {
                    S = S + C;
                    RS = C + RS;
                }
            }
            else
            {
                if (reverseCounter % 2 == 0)
                {
                    S = S + C;
                    RS = C + RS;
                }
                else
                {
                    S = C + S;
                    RS = RS + C;
                }
            }
            C.clear();
        }
    }

    string ans = reverseCounter % 2 == 0 ? S : RS;

    cout << ans << endl;

    return 0;
}

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

import java.util.*;

//update 2020/1/1 23:01

public class Main{

  static Scanner sc = new Scanner(System.in);

  public static void main(String[] args) {

    String S = next();
    int Q = nextInt();

    for(int i=0;i<Q;i++){
      int T = nextInt();
      if(T==1){
        S = reverse(S);
      }
      else{
        int F = nextInt();
        String C = next();
        if(F==1){
          S = C + S;
        }
        else{
          S = S + C;
        }
      }
    }


    System.out.println(sb.toString());

  }

  static String reverse(String s){
    StringBuilder sb = new StringBuilder();
    String[] ss = splitString(s);
    for(int i=(ss.length-1);i>=0;i--){
      sb.append(ss[i]);
    }
    return sb.toString();

  }



  static String toSmall(String s){
    return s.toLowerCase();
  }

  static String toBig(String s){
    return s.toUpperCase();
  }

  static String next(){
    return sc.next();
  }

  static int nextInt(){
    return Integer.parseInt(sc.next());
  }

  static long nextLong(){
    return Long.parseLong(sc.next());
  }

  static double nextDouble(){
    return Double.parseDouble(sc.next());
  }

  static String[] splitString(String s){
    return s.split("");
  }

  static char[] splitChar(String s){
    return s.toCharArray();
  }

  static int charToInt(char a){
    return a - 48;
  }

////////////////////////////////////////////
  public static int max(int[] a){
    int lng = a.length;
    int max = a[0];
    for(int i=1;i<lng;i++){
      max = Math.max(max,a[i]);
    }
    return max;
  }
  public static long max(long[] a){
    int lng = a.length;
    long max = a[0];
    for(int i=1;i<lng;i++){
      max = Math.max(max,a[i]);
    }
    return max;
  }
////////////////////////////////////////////

////////////////////////////////////////////
  public static int min(int[] a){
    int lng = a.length;
    int min = a[0];
    for(int i=1;i<lng;i++){
      min = Math.min(min,a[i]);
    }
    return min;
  }
  public static long min(long[] a){
    int lng = a.length;
    long min = a[0];
    for(int i=1;i<lng;i++){
      min = Math.min(min,a[i]);
    }
    return min;
  }
////////////////////////////////////////////

}


Compiler output:
Main.java:32: error: cannot find symbol
    System.out.println(sb.toString());
                       ^
  symbol:   variable sb
  location: class Main
1 error
Language: C++

#include <iostream>
#include <string>

using namespace std;


int main() {
	string s;
	int q;

	cin >> s;
	cin >> q;

	for (int i = 0; i < q; i++) {
		string query;
		cin >> query;
		if (query == "1") {
			reverse(s.begin(), s.end());
		}
		else {
			cin >> query;
			string s2;
			cin >> s2;
			if (query == "1") {
				s = s2 + s;
			}
			else {
				s = s + s2;
			}
		}
	}

	cout << s;



	return 0;
}

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

#include <iostream>
#include <vector>
#include <cmath>

int d()
{
    std::string s;
    std::cin >> s;
    
    int n;
    std::cin >> n;
    
    int direction = 0; // 0:順方向 1:逆方向
    for(int i = 0; i < n; i++)
    {
        int a, b = 0;
        std::cin >> a;
        std::string c;
        if(a == 2)
        {
            std::cin >> b >> c;
        }
        
        if(a == 1)
        {
            if(direction == 0)
            {
                direction = 1;
            }
            else
            {
                direction = 0;
            }
            continue;
        }
        
        if((b == 1 && direction == 0) || (b == 2 && direction == 1))
        {
            // 前に追加
            s = c + s;
        }
        else
        {
            // 後ろに追加
            s = s + c;
        }
    }
    
    if(direction == 0)
    {
        std::cout << s;
    }
    else
    {
        std::reverse(s.begin(), s.end());
        std::cout << s;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int d()':
a.cc:55:14: error: 'reverse' is not a member of 'std'
   55 |         std::reverse(s.begin(), s.end());
      |              ^~~~~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <list>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long llong;
typedef unsigned long long ullong;

using namespace std;

int main() {
	string s;
	cin >> s;
	int q;
	cin >> q;
	int t;
	int f;
	string c;

	string front, end;
	int hanten = 0;
	rep(i, q)
	{
		cin >> t;
		switch (t)
		{
		case 1:
			// 反転する
			++hanten;
			break;
		case 2:
			cin >> f >> c;
			switch (f)
			{
			case 1:
				// 先頭につける
				if(hanten%2 == 0)
					front = front + c;
				else
					end = end + c;
				break;
			case 2:
				// 末尾につける
				if (hanten % 2 == 0)
					end = end + c;
				else
					front = front + c;
				break;
			}
			break;
		}

	}

	if (hanten % 2 == 0)
	{
		std::reverse(front.begin(), front.end());
		s = front + s + end;
	}
	else
	{
		std::reverse(end.begin(), end.end());
		std::reverse(s.begin(), s.end());
		s = end + s + front;
	}
	
	cout << s;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:59:22: error: 'reverse' is not a member of 'std'
   59 |                 std::reverse(front.begin(), front.end());
      |                      ^~~~~~~
a.cc:64:22: error: 'reverse' is not a member of 'std'
   64 |                 std::reverse(end.begin(), end.end());
      |                      ^~~~~~~
a.cc:65:22: error: 'reverse' is not a member of 'std'
   65 |                 std::reverse(s.begin(), s.end());
      |                      ^~~~~~~
Language: C++

#include<iostream>
#define ll long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define vi vector<int>
#define vl vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define abu ios_base::sync_with_stdio(0)
#define said cin.tie(0)
using namespace std;

void yes(){
    cout<<"YES"<<endl;
}

void no(){
    cout<<"NO"<<endl;
}

void solve(){
    string s;
    cin>>s;
    int q;
    cin>>q;
    bool pw=true;
    for(int i=0;i<q;i++){
        int t;
        cin>>t;
        if(t==1){
            pw=!pw;
        }else{
            int f;
            char c;
            cin>>f>>c;
            if((f==1 && pw) || (f==2 && !pw)){
                s=c+s;
            }else{
                s=s+c;
            }
        }
    }
    if(pw){
        cout<<s<<endl;
    }else{
        for(int i=s.length()-1;i>=0;i--){
            cout<<s[i];
        }
        cout<<endl;
    }
}

int main(){
    abu;
    said;
    int t = 1;
    //cin>>t;
    string s;
    cin>>s;
    int q;
    cin>>q;
    int t;
    int f;
    char c;
    bool pw=true;
    for(int i=0;i<q;i++){
        cin>>t;
        if(t==1){
            pw=!pw;
        }else{
            
            cin>>f>>c;
            if((f==1 && pw) || (f==2 && !pw)){
                s=c+s;
            }else{
                s=s+c;
            }
        }
    }
    if(pw){
        cout<<s<<endl;
    }else{
        for(int i=s.length()-1;i>=0;i--){
            cout<<s[i];
        }
        cout<<endl;
    }
    

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:65:9: error: redeclaration of 'int t'
   65 |     int t;
      |         ^
a.cc:59:9: note: 'int t' previously declared here
   59 |     int t = 1;
      |         ^
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
char s[300005];
void move(char x)
{
	for (int i = strlen(s); i >= 0; i--)
	{
		s[i + 1] = s[i];
	}
	s[0] = x;
}
int main()
{
	cin >> s;
	long int n;
	cin >> n;
	for (long int i = 1; i <= n; i++)
	{
		int a;
		cin >> a;
		if (a == 1)
			strrev(s);
		else
		{
			int b;
			char c;
			cin >> b>>c;
			if (b == 1)
			{
				move(c);
			}
			else
			{
				s[strlen(s)] = c;
			}
		}
	}
	cout << s << endl;

}

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

#include <iostream>
#include<string>
#include<string.h>
using namespace std;
#include<stdlib.h>
#include<stdio.h>
int main(){
    int b,n,m;
    string a;
    char c;
    cin>>a;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>b;
        if(b==1){
            reverse(a.begin(), a.end());
        }
        else{
            cin>>b>>c;
            if(b==1){
                a=c+a;
            }
            else{
                a=a+c;
            }
        }
    }
    cout<<a<<"\n";
    return 0;
}


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

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
char s[300005];
void move(char x)
{
	for (int i = strlen(s); i >= 0; i--)
	{
		s[i + 1] = s[i];
	}
	s[0] = x;
}
int main()
{
	cin >> s;
	long int n;
	cin >> n;
	for (long int i = 1; i <= n; i++)
	{
		int a;
		cin >> a;
		if (a == 1)
			_strrev(s);
		else
		{
			int b;
			char c;
			cin >> b>>c;
			if (b == 1)
			{
				move(c);
			}
			else
			{
				s[strlen(s)] = c;
			}
		}
	}
	cout << s << endl;

}

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

#include <iostream>
using namespace std;
#include<stdlib.h>
#include<stdio.h>
int main(){
    int b,n,m;
    string a;
    char c;
    cin>>a;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>b;
        if(b==1){
            reverse(a.begin(), a.end());
        }
        else{
            cin>>b>>c;
            if(b==1){
                a=c+a;
            }
            else{
                a=a+c;
            }
        }
    }
    cout<<a<<"\n";
    return 0;
}


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

import java.util.Scanner;

public class Main {
    public static void debug(String str) {
        System.out.println(str);
    }

    public static void main(String[] args) {

        String S;
        long Q;
        StringBuilder sbFist = new StringBuilder();
        StringBuilder sbSecond = new StringBuilder();
        boolean traverse = false;

        try (Scanner sc = new Scanner(System.in)) {
            S = sc.next();
            Q = sc.nextLong();
            for(int i= 0;i < Q;i++){
                if(sc.nextInt() == 1){
                    //反転
                    traverse = !traverse;
                }else{
                    //文字列加える
                    if(!((sc.nextInt() == 1) ^ (!traverse))){
                        //前に
                        sbFist.append(sc.next());
                    }else{
                        sbSecond.append(sc.next());
                    }
                }
            }
        }
        String result;
        if(!traverse){
            result = sbFist.reverse().append(S).append(sbSecond).toString();
        }else {
            StringBuilder temp = new StringBuilder(S);
            result = sbSecond.reverse().append(temp.reverse()).append(sbFist).toString();
        }
        System.out.println(result);
        return;
    }
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main {
      | ^~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){

  string s; cin>>s;
  int n; cin>>n;
  int a_n[n], a[n];
  string A[n];

  for(int i=0; i<n; i++){
    cin>>a_n[i];
    if(a_n[i]==2) cin>>a[i]>>A[i];
  }

  for(int i=0; i<n; i++){
    if(a_n[i]==1) s=strrev(s);
    else if(a[i]==1) s=A[i] + s;
    else s=s + A[i];
  }

  cout<<s;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:21: error: 'strrev' was not declared in this scope; did you mean 'strsep'?
   18 |     if(a_n[i]==1) s=strrev(s);
      |                     ^~~~~~
      |                     strsep
Language: C++

#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <deque>
#ifdef e
    #include <bits/stdc++.h>
#endif
using namespace std;

struct Point {
    Point() {x=0,y=0;}
    Point(int _x,int _y){x  =_x,y=_y;}

    int x,y;
};

// 重载相应的比较运算符
bool operator < (Point a, Point b)
{
    return a.x == b.x ? a.y < b.y : a.x < b.x;
}
long long gcd(long a, long b) {
    return b ? gcd(b, a % b) : a;
}

int dx[] = {0,0,-1,1};
int dy[] = {-1,1,0,0};
char dc[] = {'R', 'L', 'D', 'U'};
char dcc[] = {'L', 'R', 'U', 'D'};

int k,n,m;

void solvee(){
    cin >> n >> m;
    vector<long long> c(n+1);
    vector<long long> res(n+1);
    vector<vector<long long> > nxt(n+1);
    for(int i = 1; i <= n; i++) scanf("%lld", &c[i]);
    for(int i = 0; i < m; i++) {
        int u,v;
        scanf("%d%d", &u,&v);
        res[u] += c[v];
        nxt[v].push_back(u);
    }
    long long ans = res[1];
    for(int i = 1; i <= n; i++) {

        for(int j = 1; j < (1<<nxt[i].size()); j++) {
            cout << i<< ' '<< j<<endl;
            long long sum = c[i];
            for(int k = 0; k < nxt[i].size(); k++) {
                if(j&(1<<k)) {
                    sum += res[nxt[i][k]]-c[i];
                }
            }
            cout << "sum = " <<sum<<endl;
            ans = gcd(ans, sum);
        }
    }

    cout << ans <<endl;
}

char s[1000000+10];

int main() {
    deque<char> s;
    string ss;
    cin >> ss;
    for(int i = 0; i < ss.size(); i++) {
        s.push_back(ss[i]);
    }

    int n;
    cin >> n;
    int fx = 1;
    while(n--) {
        int op;
        scanf("%d", &op);
        if(op == 1) {
            fx = 1-fx;
        } else {
            char c[10];
            scanf("%d%s", &op, c);
            if(fx == 1 && op == 1 || fx == 0 && op == 2) {
                s.push_front(c[0]);
            } else {
                s.push_back(c[0]);
            }
        }
    }
    if(fx == 0) {
        reverse(s.begin(), s.end());
    }

    for(auto c : s) {
        putchar(c);
    }
    puts("");
    return 0;
}




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

#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e5 + 10;
bool rev;
signed main() {
	char ch[N];
	char begin[N];
	int cnt = 0;
	int cnt2 = 0;
	char end[N];
	cin >> ch + 1;
	int q;
	cin >> q;
	for (int i = 1; i <= q; i++) {
		int op;
		cin >> op;
		if (op == 1) {
			rev = !rev;
		}
		else {
			int f;
			char c;
			cin >> f >> c;
			if (rev) {
				f = 3 - f;
			}
			if (f == 1) {
				begin[++cnt] = c;
			}
			else {
				end[++cnt2] = c;
			}
		}
	}
		if (rev) {
			for (int i = cnt2; i >= 1; i--) {
				cout << end[i];
			}
			for (int i = 1; i <= strlen(ch + 1); i++) {
				cout << ch[i];
			}
			for (int i = 1; i <= cnt; i++) {
				cout << begin[i];
			}
		}
		else {
			for (int i = cnt; i >= 1; i--) {
				cout << begin[i];
			}
			for (int i = strlen(ch + 1); i >= 1; i--) {
				cout << ch[i];
			}
			for (int i = 1; i <= cnt2; i++) {
				cout << end[i];
			}
		}
		cout << endl;
	}
	return 0;
}

Compiler output:
a.cc:60:9: error: expected unqualified-id before 'return'
   60 |         return 0;
      |         ^~~~~~
a.cc:61:1: error: expected declaration before '}' token
   61 | }
      | ^
Language: C++

#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<vector>
#include<map>
#define ll long long
#define fi first
#define se second
#define INIT() std::ios::sync_with_stdio(false)
using namespace std;
const int INF=0x7fffffff;
const double EPS=1e-6;
const int MAX_N=1000000+5;
string s,s1,s2;
int main (void)
{
    INIT();
    cin>>s;
    int n;
    cin>>n;
    while(n--)
    {
        int a;
        cin>>a
        if(a==1)
        {
            reverse(s.begin(),s.end());
        }
        else
        {
            int b;
            cin>>b>>s1;
            if(b==1)
                s=s1+s;
            else
                s=s+s1;

        }
    }
    cout<<s<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:15: error: expected ';' before 'if'
   30 |         cin>>a
      |               ^
      |               ;
   31 |         if(a==1)
      |         ~~     
a.cc:35:9: error: 'else' without a previous 'if'
   35 |         else
      |         ^~~~