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

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:38:35: error: expected ';' before 'cout'
   38 |         reverse(p.begin(),p.end())
      |                                   ^
      |                                   ;
   39 |         cout << p << "\n";
      |         ~~~~
Language: C++

(defvar tl (list ""))
(defvar hd (nconc (concatenate 'list (read-line)) tl))
(defvar rev nil)

(loop repeat (read)
      do
      (if (= (read) 1)
          (setf rev (not rev))
          (if (eq (= (read) 1) rev) 
              (progn 
                (rplacd tl (list (read-char)))
                (setf tl (cdr tl)))
              (push (read-char) hd) )))

(if rev 
    (mapc #'princ (nreverse hd))
    (mapc #'princ hd))

Compiler output:
a.cc:2:32: warning: missing terminating ' character
    2 | (defvar hd (nconc (concatenate 'list (read-line)) tl))
      |                                ^
a.cc:2:32: error: missing terminating ' character
    2 | (defvar hd (nconc (concatenate 'list (read-line)) tl))
      |                                ^~~~~~~~~~~~~~~~~~~~~~~
a.cc:16:11: error: stray '#' in program
   16 |     (mapc #'princ (nreverse hd))
      |           ^
a.cc:16:12: warning: missing terminating ' character
   16 |     (mapc #'princ (nreverse hd))
      |            ^
a.cc:16:12: error: missing terminating ' character
   16 |     (mapc #'princ (nreverse hd))
      |            ^~~~~~~~~~~~~~~~~~~~~
a.cc:17:11: error: stray '#' in program
   17 |     (mapc #'princ hd))
      |           ^
a.cc:17:12: warning: missing terminating ' character
   17 |     (mapc #'princ hd))
      |            ^
a.cc:17:12: error: missing terminating ' character
   17 |     (mapc #'princ hd))
      |            ^~~~~~~~~~~
a.cc:1:8: error: expected ')' before 'tl'
    1 | (defvar tl (list ""))
      | ~      ^~~
      |        )
Language: C++

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

int main() {
    int n, p;
    cin >> n >> p;
    string s;
    cin >> s;
    if (10%p == 0) {
        ll ans = 0;
        rep(r, n) {
            if ((s[r]-'0') % p == 0){
                ans += r+1;
            }
        }
        cout << ans << endl;
        return 0;
    }

    vector<int> d(n+1);
    int ten = 1;
    for (int i = n-1; i >=0; --i){
        int a = (s[i]-'0') * ten % p;
        d[i] = (d[i+1]+a) % p;
        ten *= 10; ten %= p;
    }
    vector<int> cnt(p):
    for (int i = n; i >= 0; --i){
        ans += cnt[d[i]];
        cnt[d[i]]++;
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:23: error: expected ',' or ';' before ':' token
   29 |     vector<int> cnt(p):
      |                       ^
a.cc:30:21: error: 'i' was not declared in this scope
   30 |     for (int i = n; i >= 0; --i){
      |                     ^
a.cc:34:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   34 |     cout << ans << endl;
      |             ^~~
      |             abs
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>;

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

int main() {
    string s;
    cin >> s;
    deque<char> q;
    for (char c : s) q.push_back(c);
    bool flip = false;
    int Q;
    cin >> Q;
    rep(qi, Q) {
        int query_type;
        cin >> query_type;
        if (query_type == 1){
            flip = !flip;
        } else {
            int f; char c;
            cin >> f >> c;
            if (filp) f = 3 - f;
            if (f == 1) {
                q.push_front(c);
            } else {
                q.push_back(c);
            }
        }
    }
    if (flip) reverse(q.begin(), q.end());
    string ans;
    for (char c : q) ans += c;
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:17: error: 'filp' was not declared in this scope; did you mean 'flip'?
   51 |             if (filp) f = 3 - f;
      |                 ^~~~
      |                 flip
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;
    string t;
    rep(qi, q) {
        int ty;
        cin >> ty;
        if(ty == 1) {
            swap(s, t);
        } else {
            int f; char c;
            cin >> f >> c;
            if (f == 1) {
                t += c;
            } else {
                s += c;
            }
        }
    }
    reverse(t.begin(), t.end());
    t += s;
    cout << t << endl;
    return 0;
}

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

#include<bits/stdc++.h>
#define ll long long

using namespace std;

int main() {
	int Q;
	string s,t;
	cin >> s;
	cin >> Q;
	while (Q--) {
		int op;
		cin >> op;
		if (op == 1) {
			swap(s, t);
		}
		else {
			int f; char c;
			cin >> f >> c;
			if (f == 1)t.push_back(c);
			else s.push_back(c);

		}
	}
	reverse(t.begin,t.end);
	cout << t + s << endl;
}

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

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

int main()
{
	string s1;
	cin >> s1;
	int slen;
	slen=s1.length();
	int a,b,q,i;
	string s2;
	cin >> q;
	for(i=1;i<=q;i++)
	{
		cin >> a;
		if(a==1)
		{
			reverse(s1.begin(),s1.end());
		}
		if(a==2)
		{
			cin >> b;
			cin >> s2;
			if(b==1)
			{
				s1.insert(0,s2);
				slen++;
			}
			if(b==2)
			{
				s1.insert(slen,s2);
				slen++;
			}
		}
	}
	cout << s1 << endl;
	return 0;
}


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

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

int main()
{
	string s1;
	cin >> s1;
	int slen;
	slen=s1.length();
	int a,b,q,i;
	string s2;
	cin >> q;
	for(i=1;i<=q;i++)
	{
		cin >> a;
		if(a==1)
		{
			reverse(s1.begin(),s1.end());
		}
		if(a==2)
		{
			cin >> b;
			cin >> s2;
			if(b==1)
			{
				s1.insert(0,s2);
				slen++;
			}
			if(b==2)
			{
				s1.insert(slen,s2);
				slen++;
			}
		}
	}
	cout << s1 << endl;
	return 0;
}


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

#include<stdio.h>
#include<string.h>
char s[200005],c[200005];
int q,t,f; 
int main(){
	scanf("%s",s);
	scanf("%d",&q);
	while(q--){
	scanf("%d",&t);
	if(t==1)
		strrev(s);
	else{
		scanf("%d",&f);
		scanf("%s",c);
		if(f==2)
			strcat(s,c);
		else{
			strcat(c,s);
			strcpy(s,c);
		}
		}
	}
	printf("%s",s);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:11:17: error: implicit declaration of function 'strrev'; did you mean 'strsep'? [-Wimplicit-function-declaration]
   11 |                 strrev(s);
      |                 ^~~~~~
      |                 strsep
Language: C

#include<stdio.h>
#include<iostream>
#include<string.h>
using namespace std;
char s[200005],c[200005];
int q,t,f; 
int main(){
	scanf("%s",s);
	scanf("%d",&q);
	while(q--){
	scanf("%d",&t);
	if(t==1)
		strrev(s);
	else{
		scanf("%d",&f);
		scanf("%s",c);
		if(f==2)
			strcat(s,c);
		else{
			strcat(c,s);
			strcpy(s,c);
		}
		}
	}
	printf("%s",s);
	return 0;
}

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

#include<stdio.h>
#include<iostream>
#include<string.h>
using namespace std;
char s[200005],c[200005];
int q,t,f; 
int main(){
	cin>>s>>q;
	while(q--){
	cin>>t;
	if(t==1)
		strrev(s);
	else{
		cin>>f>>c;
		if(f==2)
			strcat(s,c);
		else{
			strcat(c,s);
			strcpy(s,c);
		}
		}
	}
	cout<<s;
	return 0;
}

Compiler output:
main.c:2:9: fatal error: iostream: No such file or directory
    2 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include<stdio.h>
#include<iostream>
#include<string.h>
using namespace std;
char s[200005],c[200005];
int q,t,f; 
int main(){
	cin>>s>>q;
	while(q--){
	cin>>t;
	if(t==1)
		strrev(s);
	else{
		cin>>f>>c;
		if(f==2)
			strcat(s,c);
		else{
			strcat(c,s);
			strcpy(s,c);
		}
		}
	}
	cout<<s;
	return 0;
}

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

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

int main () {
	string s;
  	int q;
  	cin >> s >> q;
  	for (int i = 0; i < q; i++) {
    int n;
      cin >> n;
    if (n == 1) {
    reverse(s.begin(), s.end());
    }
    else {
    int m;
    char w;
    cin >> m >> w;
    if (m == 1) {
    s = w + s;
    }
    else {
    s = s + w;
    }
    }
  cout << s << endl;
}


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

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

int main () {
	string s;
  	int q;
  	cin >> s >> q;
  	for (int i = 0; i < q; i++) {
    int n;
      cin >> n;
    if (n == 1) {
    reverse(s.begin(), s.end())
    }
    if (n == 2) {
    int m;
    char w;
    cin >> m >> w;
    if (m == 1) {
    s = w + s;
    }
    else if (m == 2) {
    s = s + w;
    }
    }
    }
  cout << "s" << endl;
}

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

#include<iostream>
using namespace std;
int main()
{
	int Q,T,F,i;
	string s;
	char c;
	int flag=0;
	cin>>s;
	cin>>Q;
	while(Q--)
	{
		cin>>T;
		if(T==1)flag++;
		else{
			cin>>F>>c;
			if(flag%2==0)
			{
				if(F==1)s.insert(s.begin(),c);
				else s.insert(s.end(),c);
			}
			else{
				if(F==1)s.insert(s.end(),c);
				else s.insert(s.begin(),c);
			}
		}
	}
	if(flag%2==1)reverse(s.begin(),s.end());
	cout<<s;
	return 0;
	
} 

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

#include<iostream>
using namespace std;
int main()
{
	int Q,T,F,i;
	string s;
	char c;
	int flag=0;
	cin>>s;
	cin>>Q;
	while(Q--)
	{
		cin>>T;
		if(T==1)flag++;
		else{
			cin>>F>>c;
			if(flag%2==0)
			{
				if(F==2)s.insert(s.begin(),c);
				else s.insert(s.end(),c);
			}
			else{
				if(F==1)s.insert(s.end(),c);
				else s.insert(s.begin(),c);
			}
		}
	}
	if(flag%2==1)reverse(s.begin(),s.end());
	cout<<s;
	return 0;
	
} 

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

int main()
{
	string S;
	S=read();
	ll Q;
	Q=read();
	
	int T;
	int F;
	string C;
	string temp;
	
	
	for(int i=0;i<Q;Q++){
		cin>>T;
		if(T==1){
			temp=S.begin();
			S[0]=S.end();
			S.end()=S.begin();
		}
		
		else if(T==2){
			cin>>F;
			cin>>C;
				if(F==1){
					S.push_front(C);
					
				}
				if(F==2)
				{
					
					S.push_back(C);
				}
		}
		
		
	}
	
	
	
	
	return 0;
}  

Compiler output:
a.cc: In function 'int main()':
a.cc:3:9: error: 'string' was not declared in this scope
    3 |         string S;
      |         ^~~~~~
a.cc:4:9: error: 'S' was not declared in this scope
    4 |         S=read();
      |         ^
a.cc:4:11: error: 'read' was not declared in this scope
    4 |         S=read();
      |           ^~~~
a.cc:5:9: error: 'll' was not declared in this scope
    5 |         ll Q;
      |         ^~
a.cc:6:9: error: 'Q' was not declared in this scope
    6 |         Q=read();
      |         ^
a.cc:10:15: error: expected ';' before 'C'
   10 |         string C;
      |               ^~
      |               ;
a.cc:11:15: error: expected ';' before 'temp'
   11 |         string temp;
      |               ^~~~~
      |               ;
a.cc:15:17: error: 'cin' was not declared in this scope
   15 |                 cin>>T;
      |                 ^~~
a.cc:17:25: error: 'temp' was not declared in this scope
   17 |                         temp=S.begin();
      |                         ^~~~
a.cc:24:30: error: 'C' was not declared in this scope
   24 |                         cin>>C;
      |                              ^
Language: C++

#include<cstring>
#include<iostream>
using namespace std;
int main()
{
	string str;
	int t,q,f;
	char c;
	cin>>str;
	cin>>q;
	while(q--)
	{
		scanf("%d",&t);
		if(t==1)reverse(str.begin() ,str.end());
		else
		{
			scanf("%d %c",&f,&c);
			if(f==1)str=c+str;
			else str=str+c;
		}
	}
	cout<<str<<endl;
	return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
string s;
string st,ed;
int q,t,f;
char c;
int main()
{
    cin>>s;
    scanf("%d",&q);
    bool cnt=0;
    while(q--)
    {
        scanf("%d",&t);
        if(t==1) cnt^=1;
        else
        {
            scanf("%d %c",&f,&c);
            if(f==1)
            {
                if(cnt) ed+=c;
                else st+=c;
            }
            else
            {
                if(cnt) st+=c;
                else ed+=c;
            }
        }
    }
    if(cnt)
    {
        reverse(s.begin(),s.end());
        reverse(es.begin(),ed.end());
        s=ed+s+st;
    }
    else
    {
        reverse(st.begin(),st.end());
        s=st+s+ed;
    }
    cout<<s<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:17: error: 'es' was not declared in this scope; did you mean 's'?
   34 |         reverse(es.begin(),ed.end());
      |                 ^~
      |                 s
Language: Java

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int p = 0;
 //   String s1 = "";
 //   String s2 = "";
    Deque<String> deque1 = new ArrayDeque<>();
    Deque<String> deque2 = new ArrayDeque<>();
    int q = sc.nextInt();
    for(int i = 0; i < q; i++) {
      int f = sc.nextInt();
      if(f == 1) {
        p = 1 - p;
      } else {
        int t = sc.nextInt();
        String c = sc.next();
        if(p == 0) {
          if(t == 1) {
            deque1.push(c);
          } else {
            deque2.push(c);
          }
        } else {
          if(t == 1) {
            deque2.push(c);
          } else {
            deque1.push(c);
          }          
        }
      }
    }
//    StringBuffer ss = new StringBuffer(s1);
//    String ans = ss.reverse().toString() + s + s2;
      StringBuilder sb1 = new StringBuilder();
      StringBuilder sb2 = new StringBuilder();
      for(String str : deque1) {
        sb1.append(str);
      }
      for(String str : deque2) {
        sb2.append(str);
      }
      String ans = "";
      String s1 = new String(sb1);
      String s2 = new String(sb2);
      StringBuffer ss = new StringBuffer(s1);
      String ans = ss.reverse().toString() + s + s2;
      if(p == 1) {
        StringBuffer str = new StringBuffer(ans);
        ans = str.reverse().toString();
      }
    System.out.println(ans);
  }
}

Compiler output:
Main.java:49: error: variable ans is already defined in method main(String[])
      String ans = ss.reverse().toString() + s + s2;
             ^
1 error
Language: Java

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int p = 0;
 //   String s1 = "";
 //   String s2 = "";
    Deque<String> deque1 = new ArrayDeque<>();
    Deque<String> deque2 = new ArrayDeque<>();
    int q = sc.nextInt();
    for(int i = 0; i < q; i++) {
      int f = sc.nextInt();
      if(f == 1) {
        p = 1 - p;
      } else {
        int t = sc.nextInt();
        String c = sc.next();
        if(p == 0) {
          if(t == 1) {
            deque1.push(c);
          } else {
            deque2.push(c);
          }
        } else {
          if(t == 1) {
            deque2.push(c);
          } else {
            deque1.push(c);
          }          
        }
      }
    }
//    StringBuffer ss = new StringBuffer(s1);
//    String ans = ss.reverse().toString() + s + s2;
      StringBuilder sb1 = "";
      StringBuilder sb2 = "";
      for(String str : deque1) {
        sb1.append(str);
      }
      for(String str : deque2) {
        sb2.append(str);
      }
      String ans = "";
      String s1 = new String(sb1);
      String s2 = new String(sb2);
//    if(p == 1) {
//      StringBuffer str = new StringBuffer(ans);
//      ans = str.reverse().toString();
//    }
    System.out.println(ans);
  }
}


Compiler output:
Main.java:37: error: incompatible types: String cannot be converted to StringBuilder
      StringBuilder sb1 = "";
                          ^
Main.java:38: error: incompatible types: String cannot be converted to StringBuilder
      StringBuilder sb2 = "";
                          ^
2 errors
Language: Java

import java.util.Scanner;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String qa = sc.nextLine();
    int q = Integer.parseInt(qa);
    String[] t = new String[q];
    
    for(int i = 0; i < q; i++) {
      t[i] = sc.nextLine();
      if(t[i].toCharArray()[0] == '1') {
        StringBuilder rev = new StringBuilder(s).reverse()
        s = rev.toString();
      } else {
        char letter = t[i].toCharArray()[4];
        if(t[i].toCharArray()[2] == '1') {
          s = letter + s;
        } else {
          s = s + letter;
        }
      }
    }
    System.out.println(s);  
  }
}

Compiler output:
Main.java:13: error: ';' expected
        StringBuilder rev = new StringBuilder(s).reverse()
                                                          ^
1 error
Language: Java

import java.util.Scanner;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String qa = sc.nextLine();
    int q = Integer.parseInt(qa);
    String[] t = new String[q];
    
    for(int i = 0; i < q; i++) {
      t[i] = sc.nextLine();
      if(t[i].toCharArray()[0] == '1') {
        StringBuilder rev = new StringBuilder(s).reverse().toString();
        s = "" + rev;
      } else {
        char letter = t[i].toCharArray()[4];
        if(t[i].toCharArray()[2] == '1') {
          s = letter + s;
        } else {
          s = s + letter;
        }
      }
    }
    System.out.println(s);  
  }
}

Compiler output:
Main.java:13: error: incompatible types: String cannot be converted to StringBuilder
        StringBuilder rev = new StringBuilder(s).reverse().toString();
                                                                   ^
1 error
Language: Java

import java.util.Scanner;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String qa = sc.nextLine();
    int q = Integer.parseInt(qa);
    String[] t = new String[q];
    
    for(int i = 0; i < q; i++) {
      t[i] = sc.nextLine();
      if(t[i].toCharArray()[0] == '1') {
        StringBuilder rev = new StringBuilder(s).reverse().toString();
        s = rev;
      } else {
        char letter = t[i].toCharArray()[4];
        if(t[i].toCharArray()[2] == '1') {
          s = letter + s;
        } else {
          s = s + letter;
        }
      }
    }
    System.out.println(s);  
  }
}

Compiler output:
Main.java:13: error: incompatible types: String cannot be converted to StringBuilder
        StringBuilder rev = new StringBuilder(s).reverse().toString();
                                                                   ^
Main.java:14: error: incompatible types: StringBuilder cannot be converted to String
        s = rev;
            ^
2 errors
Language: Java

import java.util.Scanner;
class Main {
  public static void(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    int q = sc.nextInt();
    String[] t = new String[q];
    
    for(int i = 0; i < q; i++) {
      if(t[i].toCharArray()[0] == '1') {
        String rev = "";
        for(int j = s.length()-1; j >= 0; j--) {
          rev = rev + s.charAt(j);
        }
        s = rev;
      } else {
        char letter = t[i].toCharArray()[4];
        if(t[i].toCharArray()[2] == '1') {
          s = letter + s;
        } else {
          s = s + letter;
        }
      }
    }
    System.out.println(s);  
    
  }
}

Compiler output:
Main.java:3: error: <identifier> expected
  public static void(String[] args) {
                    ^
1 error
Language: C

#include<stdio.h>
#include<string.h>
int main()
{
    char S[100001];
    gets(S);
    int Q;
    scanf("%d",&Q);
    while(Q--){
        int T,F,l,i;
        char C;
        scanf("%d",&T);
        if(T==1){
            strrev(S);
        }

        else{
            scanf("%d %c",&F,&C);
            if(F==1){
                l=strlen(S);

                for(i=l-1;i>=0;i--){
                    S[i+1]=S[i];
                }
                S[0]=C;
                S[l+1]='\0';
            }
            else{
                strncat(S,&C,1);
            }
        }
    }
    printf("%s",S);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:6:5: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
    6 |     gets(S);
      |     ^~~~
      |     fgets
main.c:14:13: error: implicit declaration of function 'strrev'; did you mean 'strsep'? [-Wimplicit-function-declaration]
   14 |             strrev(S);
      |             ^~~~~~
      |             strsep
Language: C

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
    char S[100001];
    gets(S);
    int Q;
    scanf("%d",&Q);
    getchar();
    while(Q--){
        int T,F,l,i;
        char C;
        scanf("%d",&T);
        if(T==1){
            strrev(S);
        }

        else{
            scanf("%d",&F);
            getchar();
            scanf("%c",&C);
            if(F==1){
                l=strlen(S);

                for(i=l-1;i>=0;i--){
                    S[i+1]=S[i];
                }
                S[0]=C;
                S[l+1]='\0';
            }
            else{
                strncat(S,&C,1);
            }
        }
    }
    printf("%s",S);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:7:5: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
    7 |     gets(S);
      |     ^~~~
      |     fgets
main.c:16:13: error: implicit declaration of function 'strrev'; did you mean 'strsep'? [-Wimplicit-function-declaration]
   16 |             strrev(S);
      |             ^~~~~~
      |             strsep
Language: C++

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
int main(){
    ios::base_sync_with_stdio(false);
    cin.tie(0);
    string s; cin >> s;
    int Q; cin >> Q;
    int cnt = 0;
    deque<string>str;
    str.push_back(s);
    for(int k = 0; k < Q; ++k){
        int query;  cin >> query;
        if(query == 1){
            ++cnt;
        } else {
            int f; cin >> f;
            string s_; cin >> s_;
            if(f == 1){
                if(cnt % 2 == 0)str.push_front(s_);
                else str.push_back(s_);
            } else {
                if(cnt % 2)str.push_front(s_);
                else str.push_back(s_);
            }
        }
    }
    string ans = accumulate(str.begin(), str.end(), ""s,[](string res,string t){return res += t;});
    if(cnt % 2)reverse(ans.begin(),ans.end());
    cout << ans  << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:10: error: 'base_sync_with_stdio' is not a member of 'std::ios' {aka 'std::basic_ios<char>'}
    5 |     ios::base_sync_with_stdio(false);
      |          ^~~~~~~~~~~~~~~~~~~~
Language: C++

https://atcoder.jp/contests/abc158/standings#include<bits/stdc++.h>
using namespace std;

template<typename T, typename U> bool chmin(T &a, const U &b) {
	return (a > b ? a = b, true : false);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
	return (a < b ? a = b, true : false);
}

typedef long long ll;

#define writeln(n) cout<<n<<"\n";

typedef pair<int, int> P;
typedef pair<string, int> Psi;

ll numct[210000];
ll k[210000];
ll cnb[210000];
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

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

	for(int i=0; i<q; i++){
		int t,f;string ss;
		cin>>t;

		if(t ==1){
			reverse(s.begin(),s.end());
		}else {
			cin>>f>>ss;
			if(f ==1){
				s.insert(0,ss);
			}else {
				s +=ss;
			}
		}

	/*	cout<<s<<endl;*/
	}

	cout<<s<<endl;
}


Compiler output:
a.cc:1:1: error: 'https' does not name a type
    1 | https://atcoder.jp/contests/abc158/standings#include<bits/stdc++.h>
      | ^~~~~
a.cc:15:9: error: 'pair' does not name a type
   15 | typedef pair<int, int> P;
      |         ^~~~
a.cc:16:9: error: 'pair' does not name a type
   16 | typedef pair<string, int> Psi;
      |         ^~~~
a.cc: In function 'int main()':
a.cc:22:9: error: 'cin' was not declared in this scope
   22 |         cin.tie(0);
      |         ^~~
a.cc:23:9: error: 'ios' has not been declared
   23 |         ios::sync_with_stdio(false);
      |         ^~~
a.cc:25:9: error: 'string' was not declared in this scope
   25 |         string s;
      |         ^~~~~~
a.cc:27:14: error: 's' was not declared in this scope
   27 |         cin>>s>>q;
      |              ^
a.cc:30:31: error: expected ';' before 'ss'
   30 |                 int t,f;string ss;
      |                               ^~~
      |                               ;
a.cc:34:25: error: 'reverse' was not declared in this scope
   34 |                         reverse(s.begin(),s.end());
      |                         ^~~~~~~
a.cc:36:33: error: 'ss' was not declared in this scope
   36 |                         cin>>f>>ss;
      |                                 ^~
a.cc:47:9: error: 'cout' was not declared in this scope
   47 |         cout<<s<<endl;
      |         ^~~~
a.cc:47:18: error: 'endl' was not declared in this scope
   47 |         cout<<s<<endl;
      |                  ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
string s,t,c;
int n,a,f;
int main(){
	cin>>s>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a;
		if(a==1) swap(s,T);
		if(a==2)
		{
			cin>>f>>c;
			if(f==1) t.push_back(c);
			if(f==2) s.push_back(c);
		}
	}
	reverse(t.begin(),t.end());
	cout<<t+s<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:33: error: 'T' was not declared in this scope
   10 |                 if(a==1) swap(s,T);
      |                                 ^
a.cc:14:46: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'char'
   14 |                         if(f==1) t.push_back(c);
      |                                              ^
      |                                              |
      |                                              std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1572:24: note:   initializing argument 1 of 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 1572 |       push_back(_CharT __c)
      |                 ~~~~~~~^~~
a.cc:15:46: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'char'
   15 |                         if(f==2) s.push_back(c);
      |                                              ^
      |                                              |
      |                                              std::string {aka std::__cxx11::basic_string<char>}
/usr/include/c++/14/bits/basic_string.h:1572:24: note:   initializing argument 1 of 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 1572 |       push_back(_CharT __c)
      |                 ~~~~~~~^~~
Language: Java

import java.util.Scanner;

public class Main
{
    private String reverse(String str) {
        String strRev = "";
            for (int j = str.length() - 1; j >= 0; j--) {
                strRev = strRev + str.charAt(j);
            }
            return strRev;
    }
public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
        String str = s.nextLine();
        int q = s.nextInt();
        for (int i = 0; i < q; i++) {
            int t = s.nextInt();
            if (t == 1) {str = reverse(str);} 
            else if (t == 2) {
                int f = s.nextInt();
                String c = s.next();
                if (f == 1) {str = c.concat(str);}
                else if (f == 2) str = str.concat(c);
            }
        }
        System.out.println(str);
	}
}

Compiler output:
Main.java:18: error: non-static method reverse(String) cannot be referenced from a static context
            if (t == 1) {str = reverse(str);} 
                               ^
1 error
Language: Java

import java.util.Scanner;
public class StringFormation 
{
	public static void main(String []args)
	{	
       Scanner sc = new Scanner(System.in);
       String res=sc.nextLine();
       int x=sc.nextShort();
        sc.nextLine();
       char arr[][]=new char[x][3];
        for(int i=0;i<x;i++)
        {
        	String temp=sc.nextLine();
        	arr[i][0]=temp.charAt(0);
        	if(arr[i][0] == '2')
        	{
        		arr[i][1]=temp.charAt(2);
        		arr[i][2]=temp.charAt(4);
        	}
        }
        stringForm(arr,res);
		
    }
	
 public static void stringForm(char arr[][],String result)
	{
		StringBuilder res=new StringBuilder (result); 
		for(int i=0;i<arr.length;i++)
		{
			if(arr[i][0]=='2')
			{
				if(arr[i][1]=='2')
				{
					res.append(arr[i][2]);
				}
				else
				{
					res.insert(0,arr[i][2]);
				}
			}
			else 
			{
				/*if((i+1<arr.length) && arr[i][0]==arr[i+1][0])
				{
					i++;
				}
				else
				{*/
				res.reverse();
				//}
			}
		}	
		System.out.print(res);
	}
	
}


Compiler output:
Main.java:2: error: class StringFormation is public, should be declared in a file named StringFormation.java
public class StringFormation 
       ^
1 error
Language: Java

import java.util.Scanner;
public class StringFormation 
{
	public static void main(String []args)
	{	
        Scanner sc = new Scanner(System.in);
       String res=sc.nextLine();
       short x=sc.nextShort();
        sc.nextLine();
       char arr[][]=new char[x][3];
        for(int i=0;i<x;i++)
        {
        	String temp=sc.nextLine();
        	arr[i][0]=temp.charAt(0);
        	if(arr[i][0] == '2')
        	{
        		arr[i][1]=temp.charAt(2);
        		arr[i][2]=temp.charAt(4);
        	}
        }
        stringForm(arr,res);
		
    }
	
 public static void stringForm(char arr[][],String result)
	{
		StringBuilder res=new StringBuilder (result); 
		for(int i=0;i<arr.length;i++)
		{
			if(arr[i][0]=='2')
			{
				if(arr[i][1]=='2')
				{
					res.append(arr[i][2]);
				}
				else
				{
					res.insert(0,arr[i][2]);
				}
			}
			else 
			{
				if((i+1<arr.length) && arr[i][0]==arr[i+1][0])
				{
					i++;
				}
				else
				{
				res.reverse();
				}
			}
		}
	
		System.out.print(res);
	}
	
	
}


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

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


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

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

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

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

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


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

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

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

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

use competitive::prelude::*;
use std::collections::VecDeque;
fn main() {
    input! {
        s : String,
        q : usize,
    }
    let mut s = s.chars().collect::<VecDeque<_>>();

    let mut flip = false;
    for _ in 0..q {
        input! { t : i32 }

        if t == 1 {
            flip = !flip;
        } else {
            input! { f : i32, c : char }

            if (f == 1 && flip) || (f == 2 && !flip) {
                s.push_back(c);
            } else {
                s.push_front(c);
            }
        }
    }

    if flip {
        for c in s.iter().rev() {
            print!("{}", c);
        }
    } else {
        for c in s {
            print!("{}", c);
        }
    }
}


Compiler output:
a.cc:11:14: error: too many decimal points in number
   11 |     for _ in 0..q {
      |              ^~~~
a.cc:1:1: error: 'use' does not name a type
    1 | use competitive::prelude::*;
      | ^~~
a.cc:2:1: error: 'use' does not name a type
    2 | use std::collections::VecDeque;
      | ^~~
a.cc:3:1: error: 'fn' does not name a type
    3 | fn main() {
      | ^~
Language: Java

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    StringBuilder s = new StringBuilder(sc.next());
    int q=sc.nextInt();
    int flag=1;
    int a=0,b=0;
    int ok=0;
    String c="",fore="",back="";
    
    for(int i=0;i<q;i++){
      a=sc.nextInt();
      if(a==2){
        ok=1;
      b=sc.nextInt();
      c=sc.next();
      if(b==1&&flag==1) fore+=c;
      else if(b==1&&flag==-1) back+=c;
      else if(b==2&&flag==1) back+=c;
      else if(b==2&&flag==-1) fore+=c;
      }
      if(a==1&&ok==1) flag*=-1;
    }
    if(flag==1){
      for(int i=fore.length()-1;i>=0;i--) System.out.print(fore.charAt(i));
      System.out.print(s);
      System.out.println(back);
    }
    else{
      for(int i=back.length()-1;i>=0;i--) System.out.print(back.charAt(i));
      System.out.print(s);
      System.out.println(fore);
    }
  }
}import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    StringBuilder s = new StringBuilder(sc.next());
    int q=sc.nextInt();
    int flag=1;
    int a=0,b=0;
    int ok=0;
    String c="",fore="",back="";
    
    for(int i=0;i<q;i++){
      a=sc.nextInt();
      if(a==2){
        ok=1;
      b=sc.nextInt();
      c=sc.next();
      if(b==1&&flag==1) fore+=c;
      else if(b==1&&flag==-1) back+=c;
      else if(b==2&&flag==1) back+=c;
      else if(b==2&&flag==-1) fore+=c;
      }
      if(a==1&&ok==1) flag*=-1;
    }
    if(flag==1){
      for(int i=fore.length()-1;i>=0;i--) System.out.print(fore.charAt(i));
      System.out.print(s);
      System.out.println(back);
    }
    else{
      for(int i=back.length()-1;i>=0;i--) System.out.print(back.charAt(i));
      System.out.print(s);
      System.out.println(fore);
    }
  }
}

Compiler output:
Main.java:36: error: class, interface, enum, or record expected
}import java.util.*;
 ^
1 error
Language: C++

s = list(input())
q = int(input())
for i in range(q):
  l = list(map(str, input().split()))
  if l[0] == '1':
    s = s[::-1]
  elif l[1] == '1':
    s.insert(0,l[2])
  else:
    s.insert(i+1,l[2])
print(''.join(s))

Compiler output:
a.cc:11:7: error: empty character constant
   11 | print(''.join(s))
      |       ^~
a.cc:1:1: error: 's' does not name a type
    1 | s = list(input())
      | ^
Language: C

#pragma GCC optimize("O3")
#pragma GCC target("avx")
#pragma GCC optimize("unroll-loops")
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define DB double
#define ST string
#define BS bitset
#define VE vector
#define VL vector<LL>
#define VP vector<pair<LL,LL>>
#define VVL vector<vector<LL>>
#define PQ priority_queue<LL>
#define PQS priority_queue<LL, vector<LL>, greater<LL>>
#define PB push_back
#define POB pop_back
#define PF push_front
#define POF pop_front
#define MP make_pair
#define TS to_string
#define TU to_ullong
#define FOR(i,a,n) for(i=a;i<n;i++)
#define rep(i,n) FOR(i,0,n)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define UB(a,n) *upper_bound(ALL(a),n)
#define LB(a,n) *lower_bound(ALL(a),n)
#define INF 1145141919810364364
#define PI 3.14159265358979
#define MOD 1000000007
//#define MOD 998244353
#define ERR 0.00000000000001
#define NUM 200010

void Yn(LL a){if(a)printf("Yes\n");else printf("No\n");}
void YN(LL a){if(a)printf("YES\n");else printf("NO\n");}
LL pwmn(LL a,LL n){LL ans=1;while(ans<a)ans*=n;return ans;}
LL GCD(LL a,LL b){LL c=1,tmp=max(a,b);b=min(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
LL LCM(LL a,LL b){return a*b/GCD(a,b);}
LL mod(LL a,LL m){if(a<0)return a%m+m;else return a%m;}
LL DIV(LL a,LL d){LL m=MOD,x=1,y=0,k;while(m){k=d/m;d-=k*m;swap(m,d);x-=k*y;swap(x,y);}return mod(a*mod(x,MOD),MOD);}
LL FAC(LL a){LL i,ans=1;FOR(i,1,a+1){ans*=i;if(MOD>0&&ans>MOD)ans%=MOD;}return ans;}
LL POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return ans;}
LL fact[NUM],finv[NUM],inv[NUM];
void comi(){LL i;fact[0]=fact[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fact[i]=fact[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
LL com(LL n,LL k){if(n<k||n<0||k<0)return 0;return fact[n]*(finv[k]*finv[n-k]%MOD)%MOD;}
template<typename T>bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

void ret(deque<char> a,ST s,deque<char> b){
  for(char i:a)cout<<i;
  cout<<s;
  for(char i:b)cout<<i;
  cout<<endl;
}

int main(){
  LL i,Q,f=0,q,F;
  char C;
  string S;
  deque<char> d,e;
  cin>>S>>Q;
  rep(i,Q){
    cin>>q;
    if(q==1)f=(f+1)%2;
    if(q==2){
      cin>>F>>C;
      if(F==1){
        if(f==0)d.PF(C);
        else e.PB(C);
      }else{
        if(f==0)e.PB(C);
        else d.PF(C);
      }
    }
  }
  if(f==0)ret(d,S,e);
  else{
    REV(d);REV(S);REV(e);
    ret(e,S,d);
  }
}


Compiler output:
main.c:5:10: fatal error: bits/stdc++.h: No such file or directory
    5 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: Java

import java.util.*;
public class main {
	public static void main (String[] args){
		Scanner in = new Scanner(System.in);
		String s = in.next();
		int n = in.nextInt();
		
		for(int i=0;i<n;i++){
			int a = in.nextInt();
			if(a!=1){
				int b = in.nextInt();
				if(b!=1)
					s = s + in.next();
				else
					s = in.next() + s;
			}
			else{
				String q = "";
				for(int j = 0;j < s.length();j++){
					q = s.charAt(j) + q;
				}
				s = q;
			}
		}
		System.out.println(s);
	}
}


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

import java.util.*;
public class A {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		int n = sc.nextInt();
		while(n-- > 0){
			int format = sc.nextInt();
			if(format == 1){
				s = reverse(s);
			}
			else{
				int pos = sc.nextInt();
				String add = sc.next();
				if(pos == 1){
					s = add + s;
				}
				else{
					s = s + add;
				}
			}
		}
		System.out.println(s);
	}
	public static String reverse(String s){
		String s2 = "";
		for(int i = s.length()-1 ; i>=0; i--){
			s2 += s.charAt(i);
		}
		return s2;
	}
}


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

import java.util.*;
public class A {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder(sc.next());
		
		int op, rev = 0, f;
		char c;
		
		int n = sc.nextInt();
		for(int i=0;i<n;i++) {
			op = sc.nextInt();
			if(op == 1)
				rev = 1-rev;
			else {
				f = sc.nextInt();
				c = sc.next().charAt(0);
				
				if(rev == 0 && f==1 || rev==1 && f==2) {
					sb.insert(0, c);
				}
				else {
					sb.append(c);
				}
			}
		}
		System.out.println(rev == 0 ? sb:sb.reverse());
		
	}
}


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

#include<iostream>
#include<string>
#include<deque>
#include<algorithm>
using namespace std;
int main (void)
{
 string S;
 int Q;
 cin >> S;
 cin >> Q;
 deque<char> Stmp (S.size ());
 for (int i = 0; i < S.size (); i++)
 	Stmp [i] = S.data () [i];
 int T, F;
 char C;
 int frontback = 0;
 for (int i = 0; i < Q; i++)
 {
	cin >> T;
	if (T == 1)
		fontback = 1 - frontback;
	else
	{
		cin >> F >> C;
		if (frontback == 0)
		{
			if (F == 1)
			  Stmp.emplace_front (C);
			else
		  	  Stmp.emplace_back (C);
		}
		else
		{
			if (F == 1)
			  Stmp.emplace_back (C);
			else
		  	  Stmp.emplace_front (C);
		}
	}
 }
 if (frontback == 1)
 	reverse(Stmp.begin(), Stmp.end ());
 for (auto &e: Stmp)
 	cout << e;
 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:17: error: 'fontback' was not declared in this scope; did you mean 'frontback'?
   22 |                 fontback = 1 - frontback;
      |                 ^~~~~~~~
      |                 frontback
Language: C++

#include <cstdio>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <cmath>
#include <iomanip>
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;
ll intpow(ll N, ll P){
    if(P==0) return 1;
    if(P%2==0){
        ll t = intpow(N, P/2);
        return t*t;
    }
    return N * intpow(N, P-1);
}
ll gcd(ll n,ll m){
    n = max(n,m);
    m = min(n,m);
    if(n%m == 0)return m;
    return gcd(m,n%m);
}
ll lcm(ll n,ll m){
    return n*m/gcd(n,m);
}
deque<char> deq;
int main(){
    string s;cin>>s;
    for(auto tmp : s){
        deq.push_back(tmp);
    }
    int q;cin >> q;
    int sw=0;
    rep(i,q){
        int qu;cin>>qu;
        if(qu==1)sw++;
        else{
            int f;char c;cin>>f>>c;
            if(sw%2 == 0){
                if(f == 1)deq.push_front(c);
                if(f == 2)deq.push_back(c);
            }
            if(sw%2 == 1){
                if(f == 1)deq.push_back(c);
                if(f == 2)deq.push_front(c);
            }
        }
    }
    string ans;
    for(auto tmp : deq)ans.push_back(tmp);
    if(sw%2 == 0){
       cout <<ans<< endl;
    }
    else{
        reverse(ans.begin(),ans.end());
        cout << ans <<endl;
    }
}

Compiler output:
a.cc:32:1: error: 'deque' does not name a type
   32 | deque<char> deq;
      | ^~~~~
a.cc: In function 'int main()':
a.cc:36:9: error: 'deq' was not declared in this scope
   36 |         deq.push_back(tmp);
      |         ^~~
a.cc:46:27: error: 'deq' was not declared in this scope
   46 |                 if(f == 1)deq.push_front(c);
      |                           ^~~
a.cc:47:27: error: 'deq' was not declared in this scope
   47 |                 if(f == 2)deq.push_back(c);
      |                           ^~~
a.cc:50:27: error: 'deq' was not declared in this scope
   50 |                 if(f == 1)deq.push_back(c);
      |                           ^~~
a.cc:51:27: error: 'deq' was not declared in this scope
   51 |                 if(f == 2)deq.push_front(c);
      |                           ^~~
a.cc:56:20: error: 'deq' was not declared in this scope
   56 |     for(auto tmp : deq)ans.push_back(tmp);
      |                    ^~~