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

#include <iostream>
using namespace std;

int main() { 
    string S;
    cin >> S;
    int Q;
    cin >> Q;
    for (int q_i = 0; q_i < Q; q_i++) {
        int T;
        cin >> T;
        if (T == 1) {
            reverse(S.begin(),S.end());
        } else if (T == 2){
            int F;
            string C;
            cin >> F >> C;
            if (F == 1) {
                S = C + S;
            } else if (F == 2) {
                S = S + C;
            }
        }
    }
    cout << S << endl;
    return 0; 
}

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

#include <bits/stdc++.h>
using namespace std;
int main() {
  	bool rev = 0;
	deque<char> s;
  	string init; cin >> init;
  	for (int i = 0; i < init.length(); i++) s.push_back(init[i]);
  	int q; cin >> q;
  	while (q--) {
    	 int t; cin >> t;
      	 if (t == 1) rev = !rev;
      	 else {
         	int front;
            char ins; 
           	cin >> front >> ins;
           	if (front == 1) {
            	if (rev) s.push_back(ins);
              	else s.push_front(int);
            }
           	else {
              if (!rev) s.push_back(ins);
              	else s.push_front(int);
            }
         }
    }
  	if (!rev) {
    	for (auto it = s.begin(); it != s.end(); ++it) {
        	cout << *it; 
        }
    }
  	else {
      for (auto it = s.rbegin(); it != s.rend(); ++it) {
        	cout << *it; 
        }
    }
  	cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:35: error: expected primary-expression before 'int'
   18 |                 else s.push_front(int);
      |                                   ^~~
a.cc:22:35: error: expected primary-expression before 'int'
   22 |                 else s.push_front(int);
      |                                   ^~~
Language: C++

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

int main(){
  string s;
  int q;
  cin >> s >> q;
  bool order=true;
  for(int i=0; i<q; i++){
    int t,f;
    string c;
    
    cin >> t;
    if(t==1){
      if(order)
        order=false;
      else
        order=true;
    }
    if(t==2){
      cin >> f >> c;
      if(f==1){
        if(order)
          s = c+s;
        else
          s = s+c;
      }
      if(f==2){
        if(order)
          s = s+c;
        else
          s = c+s;
    }
  }
  if(order)
  cout << s << endl;
  else
    reverse(s.begin(),s.end());
  return 0;
}
    


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


import java.util.Scanner;

public class Main {
	
	static StringBuilder sb = new StringBuilder();
  
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		
		dp = new char [n][10];
		sb.append('a');
		
		dfs(1,'1',n);
		
		

	}
	
	static void dfs(int cnt,int now ,int n) {
		
		if(sb.length() == n) {
			System.out.println(sb.toString());
			return;
		}
		boolean flag = false;
		
		for(char i = 'a' ; i <= 'a' + now - '0' ;i++)  {
			if(i == 'a' + now - '0') {
				now++;
				flag = true;
			}
			sb.append(i);
			dfs(cnt ,now , n);
			if(flag) {
				now--;
			}
			sb.deleteCharAt(sb.length()-1);
			
		}
		
	}

}


Compiler output:
Main.java:13: error: cannot find symbol
		dp = new char [n][10];
		^
  symbol:   variable dp
  location: class Main
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a;i<n;i++)
#define ve vector
#define ss second 
#define ff first
#define pf pop_front
#define pob pop_back
#define psf push_front
#define res(x) cout<<x<<'\n'
#define read(t) ll t;cin>>t

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
    string s;cin>>s;
    int q;cin>>q;
    int rev=0;
    while(q--){
        int t;
        cin>>t;
        if(t==1){
            rev++;
        }
        else{
            int f;
            string temp;
            cin>>f>>temp;
            if(rev%2==0){
                if(f==1) s=temp+s;
                else s=s+temp;
            }
            else{
                if(f==1){ s=s+temp;
                else   s=temp+s;
            }
        }
    }

        if(rev%2==0){
            cout<<s<<endl;
        }
        else{
            f(i,0,s.length()){
                cout<<s[s.length()-1-i];
            }
        }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:17: error: expected '}' before 'else'
   40 |                 else   s=temp+s;
      |                 ^~~~
a.cc:39:25: note: to match this '{'
   39 |                 if(f==1){ s=s+temp;
      |                         ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main()
{
	string S, C;
	int Q;
	char str[500001];
	int front, rear;
	int com1, com2;
	int reverse = 0;

	cin >> S;

	// strの中央らへんに突っ込む
	int mid = 200001;
	for(int i = mid, j = 0; i < mid + moji_count; i++, j++)
		str[i] = S[j];
	front = mid - 1;
	rear = mid + S.length;

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

		if(com1 == 1){
		// 反転
			if(reverse)
				reverse = 0;
			else
				reverse = 1;
		}else if(com1 == 2){
		// 追加
			cin >> com2 >> C;

			if(com2 == 1){
			// 先頭に追加
				if(reverse)
					str[rear++] = C[0];
				else
					str[front--] = C[0];
			}else if(com2 == 2){
			// 末尾に追加
				if(reverse)
					str[front--] = C[0];
				else
					str[rear++] = C[0];
			}
		}
	}

	// print
	if(reverse){
		for(int i = rear - 1; i > front; i--)
			printf("%c", str[i]);
		printf("\n");
	}else{
		for(int i = front + 1; i < rear; i++)
			printf("%c", str[i]);
		printf("\n");
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:43: error: 'moji_count' was not declared in this scope
   18 |         for(int i = mid, j = 0; i < mid + moji_count; i++, j++)
      |                                           ^~~~~~~~~~
a.cc:21:24: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   21 |         rear = mid + S.length;
      |                      ~~^~~~~~
      |                              ()
Language: C++

//
//  main.cpp
//  ABC158D
//
#include <iostream>
#include<string>
using namespace std;
int main(int argc, const char * argv[]) {
    string S,TMP;
    string L;
    string R;
    cin>>S;
    int Q;
    cin >> Q;
    int T;
    int F;
    string C;
    int direction=0;
    int num=0;
    for (int i=0; i<Q; i++) {
        cin>>T;
        if (T==1) {
            direction++;
            direction=direction%2;
            num++;
        }
        if (T==2) {
            cin>>F;
            cin>>C;
            if (direction==1) {
                TMP=L;
                L=R;
                R=TMP;
            }
            if (F==1) {
                L=L+C;
            }
            if(F==2){
                R=R+C;
            }
        }
    }
    reverse(L.begin(),L.end());
    if (num==0) {
        cout<<L<<S<<R<<endl;
        return 0;
    }
    if (num%2==0) {
        for (unsigned long i=R.length(); i>0; i--) {
            cout<<R.at(i-1);
        }
        cout<<S<<L<<endl;
    }else{
        cout<<L;
        for (unsigned long i=S.length(); i>0; i--) {
            cout<<S.at(i-1);
        }
        cout<<R<<endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:43:5: error: 'reverse' was not declared in this scope
   43 |     reverse(L.begin(),L.end());
      |     ^~~~~~~
Language: C++

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

int main(){
    string s; cin >> s;
    int q; cin >> q;
    string t;
    rep(i,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;
}


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

#include <bits/stdc++.h> 

using namespace std; 

string s; 
char c;
int q, t,f; 
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); 
	
	cin >> s; 
	cin >> q; 
	
	bool rev = false;
	
	while (q--) {
		cin >> t; 
		if (t==1) {
			rev = !rev;			
		}
		else {
			cin >> f >> c; 
			
			if ((f==1 && !rev) || (f==2 && rev)) {
				s.push_front(c);
			}
			else {
				s.push_back(c);
			}
		}
	}
	if (rev) reverse(s.begin(), s.end());	
	cout << s << "\n";	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:35: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_front'
   26 |                                 s.push_front(c);
      |                                   ^~~~~~~~~~
Language: C++

#include <bits/stdc++.h> 

using namespace std; 

string s; 
char c;
int q, t,f; 
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); 
	
	cin >> s; 
	cin >> q; 
	
	bool rev = false;
	
	while (q--) {
		cin >> t; 
		if (t==1) {
			rev = !rev;			
		}
		else {
			cin >> f >> c; 
			
			if (f==1 && !rev) || (f==2 && rev)) {
				s.push_front(c);
			}
			else {
				s.push_back(c);
			}
		}
	}
	if (rev) reverse(s.begin(), s.end());	
	cout << s << "\n";	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:43: error: expected primary-expression before '||' token
   25 |                         if (f==1 && !rev) || (f==2 && rev)) {
      |                                           ^~
Language: C++

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

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



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

#include <bits/stdc++.h> 

using namespace std; 

string s; 
char c;
int q, t,f; 
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); 
	
	cin >> s; 
	cin >> q; 
	
	while (q--) {
		cin >> t; 
		if (t==1) {
			reverse(s.begin(), s.end());
		}
		else {
			cin >> f >> c; 
			if (f==1) {
				//s = c + s; 
				s.push_front(c);
			}
			else {				
				s.push_back(c);
			}
		}
	}
	
	cout << s << "\n";	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:35: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'push_front'
   24 |                                 s.push_front(c);
      |                                   ^~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;
typedef ll = long long;

int main(void)
{
  string s, t="";
  int q, flag=0;
  cin >> s >> q;
  REP(i,q) {
    int cmd;
    cin >> cmd;
    if(cmd==1) {
      ++flag;
    } else {
      int choice;
      string sc;
      cin >> choice >> sc;
      if((flag+choice)&1) t.push_back(sc[0]);
      else s.push_back(sc[0]);
    }
  }
  if(flag & 1) swap(s,t);
  cout << s << string(t.rbegin(),t.rend()) << endl;
  return 0;
}



Compiler output:
a.cc:6:9: error: 'll' does not name a type
    6 | typedef ll = long long;
      |         ^~
a.cc: In function 'int main()':
a.cc:2:24: error: 'll' was not declared in this scope
    2 | #define FOR(i,a,b) for(ll i=(a);i<(b);++i)
      |                        ^~
a.cc:3:18: note: in expansion of macro 'FOR'
    3 | #define REP(i,n) FOR(i,0,n)
      |                  ^~~
a.cc:13:3: note: in expansion of macro 'REP'
   13 |   REP(i,q) {
      |   ^~~
a.cc:13:7: error: 'i' was not declared in this scope
   13 |   REP(i,q) {
      |       ^
a.cc:2:33: note: in definition of macro 'FOR'
    2 | #define FOR(i,a,b) for(ll i=(a);i<(b);++i)
      |                                 ^
a.cc:13:3: note: in expansion of macro 'REP'
   13 |   REP(i,q) {
      |   ^~~
Language: C++

#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;

int main(void)
{
  string s, t="";
  int q, flag=0;
  cin >> s >> q;
  REP(i,q) {
    int cmd;
    cin >> cmd;
    if(cmd==1) {
      ++flag;
    } else {
      int choice;
      string sc;
      cin >> choice >> sc;
      if((flag+choice)&1) t.push_back(sc[0]);
      else s.push_back(sc[0]);
    }
  }
  if(flag & 1) swap(s,t);
  cout << s << string(t.rbegin(),t.rend()) << endl;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:2:24: error: 'll' was not declared in this scope
    2 | #define FOR(i,a,b) for(ll i=(a);i<(b);++i)
      |                        ^~
a.cc:3:18: note: in expansion of macro 'FOR'
    3 | #define REP(i,n) FOR(i,0,n)
      |                  ^~~
a.cc:12:3: note: in expansion of macro 'REP'
   12 |   REP(i,q) {
      |   ^~~
a.cc:12:7: error: 'i' was not declared in this scope
   12 |   REP(i,q) {
      |       ^
a.cc:2:33: note: in definition of macro 'FOR'
    2 | #define FOR(i,a,b) for(ll i=(a);i<(b);++i)
      |                                 ^
a.cc:12:3: note: in expansion of macro 'REP'
   12 |   REP(i,q) {
      |   ^~~
Language: C++

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

using namespace std;

int main(void){
  string s;
  
  cin>>s;
  string front="";
  string back=s;


  int q;
  cin>>q;

  int t;
  int f;
  bool revflag=false;
  string c;
  for(int i=0;i<q;i++){
    cin>>t;
    switch(t){
      case 1:
        revflag=!revflag;
        break;
      case 2:
        cin>>f>>c;
        switch (f) {
          case 1:
            if(revflag){
              back+=c;
            }
            else{
              front+=c;
            }
            break;
          case 2:
            if(revflag){
              frpnt+=c;
            }
            else{
              back+=c;
            }
            break;
        }
        break;
    }
  }
  if(revflag){
    reverse(back.begin(), back.end());
    cout<<back+front;
  }
  else{
    reverse(front.begin(), front.end());
    cout<<front+back;
  }  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:15: error: 'frpnt' was not declared in this scope; did you mean 'front'?
   41 |               frpnt+=c;
      |               ^~~~~
      |               front
Language: C++

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

using namespace std;

int main(void){
  string s;
  
  cin>>s;
  string front=s;
  string back="";


  int q;
  cin>>q;

  int t;
  int f;
  bool revflag=false;
  string c;
  for(int i=0;i<q;i++){
    cin>>t;
    switch(t){
      case 1:
        revflag=!revflag;
        break;
      case 2:
        cin>>f>>c;
        switch (f) {
          case 1:
            if(!revflag){
              front+=c
            }
            else{
              back+=c;
            }
            break;
          case 2:
            if(!revflag){
              back+=c;
            }
            else{
              front+=c;
            }
            break;
        }
        break;
    }
  }
  if(revflag){
    reverse(front.begin(), front.end());
    cout<<back+front;
  }
  else{
    reverse(back.begin(), back.end());
    cout<<front+back;
  }  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:23: error: expected ';' before '}' token
   33 |               front+=c
      |                       ^
      |                       ;
   34 |             }
      |             ~
Language: C++

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

using namespace std;

int main(void){
  string s;
  
  cin>>s;
  string front=s;
  string back="";


  int q;
  cin>>q;

  int t;
  int f;
  bool revflag=false;
  string c;
  for(int i=0;i<q;i++){
    cin>>t;
    switch(t){
      case 1:
        revflag=!revflag;
        break;
      case 2:
        cin>>f>>c;
        switch (f) {
          case 1:
            if(!revflag){
              front+=c
            }
            else{
              back+=c;
            }
            break;
          case 2:
            if(!revflag){
              back+=c;
            }
            else{
              front+=c;
            }
            break;
        }
        break;
    }
  }
  if(revflag){
    reverse(front.begin(), front.end());
  }
  else{
    reverse(back.begin(), back.end());
  }


  cout<<front+back;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:23: error: expected ';' before '}' token
   33 |               front+=c
      |                       ^
      |                       ;
   34 |             }
      |             ~
Language: C++

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

using namespace std;

int main(void){
  string s;
  string back=null;
  string front=null;
  back
  cin>>s;

  int q;
  cin>>q;

  int t;
  int f;
  bool revflag=false;
  string c;
  for(int i=0;i<q;i++){
    cin>>t;
    switch(t){
      case 1:
        revflag=!revflag;
        break;
      case 2:
        cin>>f>>c;
        switch (f) {
          case 1:
            if(!revflag){
              front+=c;
            }
            else{
              back+=c;
            }
            break;
          case 2:
            if(!revflag){
              back+=c;
            }
            else{
              front+=c;
            }
            break;
        }
        break;
    }
  }
  s=front+s+back;
  if(revflag){
    reverse(s.begin(), s.end());
  }

  cout<<s;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:15: error: 'null' was not declared in this scope
    9 |   string back=null;
      |               ^~~~
a.cc:11:7: error: expected ';' before 'cin'
   11 |   back
      |       ^
      |       ;
   12 |   cin>>s;
      |   ~~~
Language: C++

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

using namespace std;

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

  int q;
  cin>>q;

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

  cout<<s;
}

Compiler output:
a.cc:7:1: error: expected declaration before '}' token
    7 | }
      | ^
Language: C++

#include <iostream>
#include <stdio.h>
#include <vector>
#include <deque>

using namespace std;

int main(){

    deque<string> s;
    string first_s;
    int n;
    cin >> first_s >> n;

    s.push_front(first_s);

    bool reverse_flag = true;

    int t, f;
    string c;
    for(int i = 0; i < n; i++){
        cin >> t;
        if(t == 1){ reverse_flag = not reverse_flag;}
        else{
            cin >> f >> c;
            if(reverse_flag){
                if(f == 1){s.push_front(c);} //c + s
                else{s.push_back(c);}//s + c
            } else {
                if(f == 1){s.push_back(c);}
                else{s.push_front(c);}
            }
        }
    }

    string ans;
    for(int i = 0; i<s.size(); i++){
        ans += s[i];
    }

    if(not reverse_flag){reverse(ans.begin(), ans.end());}

	cout << ans << endl;

    return 0;
}


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

#include <iostream>
#include <stdio.h>
#include <vector>
#include <deque>

using namespace std;

int main(){

    deque<string> s;
    string first_s;
    int n;
    cin >> first_s >> n;

    s.push_front(first_s);

    bool reverse_flag = true;

    int t, f;
    string c;
    for(int i = 0; i < n; i++){
        cin >> t;
        if(t == 1){ reverse_flag = not reverse_flag;}
        else{
            cin >> f >> c;
            if(reverse_flag){
                if(f == 1){s.push_front(c);} //c + s
                else{s.push_back(c);}//s + c
            } else {
                if(f == 1){s.push_back(c);}
                else{s.push_front(c);}
            }
        }
    }

    string ans;
    for(int = 0; i<s.size(); i++){
        ans += s[i];
    }

    if(not reverse_flag){reverse(ans.begin(), ans.end());}

	cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:13: error: expected unqualified-id before '=' token
   37 |     for(int = 0; i<s.size(); i++){
      |             ^
a.cc:37:12: error: expected ';' before '=' token
   37 |     for(int = 0; i<s.size(); i++){
      |            ^~
      |            ;
a.cc:37:13: error: expected primary-expression before '=' token
   37 |     for(int = 0; i<s.size(); i++){
      |             ^
a.cc:37:18: error: 'i' was not declared in this scope
   37 |     for(int = 0; i<s.size(); i++){
      |                  ^
a.cc:37:28: error: expected ')' before ';' token
   37 |     for(int = 0; i<s.size(); i++){
      |        ~                   ^
      |                            )
a.cc:37:30: error: 'i' was not declared in this scope
   37 |     for(int = 0; i<s.size(); i++){
      |                              ^
a.cc:41:26: error: 'reverse' was not declared in this scope
   41 |     if(not reverse_flag){reverse(ans.begin(), ans.end());}
      |                          ^~~~~~~
Language: C

#include<stdio.h>
#include<string.h>
main()
{
  char S[300005],C,*ptr;
  long int Q,T,F;
  gets(S);
  scanf("%ld",&Q);
  while(Q!=0)
  {
    scanf("%ld",&T);
    if(T==1)
      strrev(S);
    else
    {
      scanf("%ld%c",&F,&C);
      if(F==1)
        ptr=strcat(C,S);
      else
        ptr=strcat(S,C);
    }
  }
  printf("%s",ptr);
}

Compiler output:
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
    3 | main()
      | ^~~~
main.c: In function 'main':
main.c:7:3: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
    7 |   gets(S);
      |   ^~~~
      |   fgets
main.c:13:7: error: implicit declaration of function 'strrev'; did you mean 'strsep'? [-Wimplicit-function-declaration]
   13 |       strrev(S);
      |       ^~~~~~
      |       strsep
main.c:18:20: error: passing argument 1 of 'strcat' makes pointer from integer without a cast [-Wint-conversion]
   18 |         ptr=strcat(C,S);
      |                    ^
      |                    |
      |                    char
In file included from main.c:2:
/usr/include/string.h:149:39: note: expected 'char * restrict' but argument is of type 'char'
  149 | extern char *strcat (char *__restrict __dest, const char *__restrict __src)
      |                      ~~~~~~~~~~~~~~~~~^~~~~~
main.c:20:22: error: passing argument 2 of 'strcat' makes pointer from integer without a cast [-Wint-conversion]
   20 |         ptr=strcat(S,C);
      |                      ^
      |                      |
      |                      char
/usr/include/string.h:149:70: note: expected 'const char * restrict' but argument is of type 'char'
  149 | extern char *strcat (char *__restrict __dest, const char *__restrict __src)
      |                                               ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
Language: C++

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

int main(){
  vector<char> ans(1);
  char s;
  int q;
  cin >> s >> q;
  
  ans[0] = s;
  
  for(int i = 0; i < q; i++){
    int t;
    cin >> t;
    if(t == 1){
      reverse(ans.begin(), ans.end());
    }else{
      int f, c;
      cin >> f >> c;
      if(f == 1){
        reverse(ans.begin(), ans.end());
        ans.push_back(c);
        reverse(ans.begin(), ans.end());
      }else{
        ans.push_back(c)
      }
    }
  }
  
  for(auto x; ans){
    cout << x;
  }
    
}
        
        


Compiler output:
a.cc: In function 'int main()':
a.cc:25:25: error: expected ';' before '}' token
   25 |         ans.push_back(c)
      |                         ^
      |                         ;
   26 |       }
      |       ~                  
a.cc:30:7: error: declaration of 'auto x' has no initializer
   30 |   for(auto x; ans){
      |       ^~~~
a.cc:30:15: error: could not convert 'ans' from 'std::vector<char>' to 'bool'
   30 |   for(auto x; ans){
      |               ^~~
      |               |
      |               std::vector<char>
a.cc:30:18: error: expected ';' before ')' token
   30 |   for(auto x; ans){
      |                  ^
      |                  ;
Language: C++

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

int main(){
  vector<char> ans(1);
  char s;
  int q;
  cin >> s >> q;
  
  ans[0] = s;
  
  for(int i = 0; i < q; i++){
    int t;
    cin >> t;
    if(t == 1){
      reverse(ans.begin(), ans.end());
    }else{
      int f, c;
      cin >> f >> c;
      if(f == 1){
        reverse(ans.begin(), ans.end());
        ans.push_back(c);
        reverse(ans.begin(), ans.end());
      }else{
        ans.push_back(c)
      }
    }
  }
}
        
        


Compiler output:
a.cc: In function 'int main()':
a.cc:25:25: error: expected ';' before '}' token
   25 |         ans.push_back(c)
      |                         ^
      |                         ;
   26 |       }
      |       ~
Language: C++

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

int main(){
  string s;
  long long i,q,t,f;
  char c;
  cin>>s;
  cin>>q;
  
  vector<char> vec;
  
  for(i=0;i<s.length();i++){
   	vec.push_back(s[i]);
  }
  
  for(i=0;i<q;i++){
   	 cin>>t;
    if(t==1)
      vec.reverse();
    else{
     	cin>>f;
      	cin>>c;
      	if(f==1){
         	 vec.insert(vec.begin(),c);
        }else{
         	vec.push_back(c); 
        }
    }
  }
  
  vector<char>::iterator ptr;
  
  for(ptr=vec.begin();ptr<vec.end();ptr++){
   	cout<<*ptr; 
  }
  
  cout<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:11: error: 'class std::vector<char>' has no member named 'reverse'; did you mean 'reserve'?
   20 |       vec.reverse();
      |           ^~~~~~~
      |           reserve
Language: C++

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

 
	string S;
	int Q;
	cin >> S;
	cin >> Q;
	int T;
	int F;
	string C;
 
	bool revearsed = false;
 
	for(int i=0;i<Q;i++){
		cin >> T;
		if(T==1){
			revearsed = !revearsed;
		}else{
			cin >> F;
			cin >> C;
			if(revearsed==true){
				reverse(C.begin(),C.end());
			}
			if(F==1){
				if(revearsed==false){
					S.insert(0,C);
				}else{
					S.append(C);
				}
			}else{
				if(revearsed==false){
					S.append(C);
				}else{
					S.insert(0,C);
				}
			}
		}
	}
	if(revearsed==true){
		reverse(S.begin(),S.end());
	}
	cout << S << endl;
 
    return 0;
}

Compiler output:
a.cc:9:9: error: 'cin' does not name a type
    9 |         cin >> S;
      |         ^~~
a.cc:10:9: error: 'cin' does not name a type
   10 |         cin >> Q;
      |         ^~~
a.cc:17:9: error: expected unqualified-id before 'for'
   17 |         for(int i=0;i<Q;i++){
      |         ^~~
a.cc:17:21: error: 'i' does not name a type
   17 |         for(int i=0;i<Q;i++){
      |                     ^
a.cc:17:25: error: 'i' does not name a type
   17 |         for(int i=0;i<Q;i++){
      |                         ^
a.cc:42:9: error: expected unqualified-id before 'if'
   42 |         if(revearsed==true){
      |         ^~
a.cc:45:9: error: 'cout' does not name a type
   45 |         cout << S << endl;
      |         ^~~~
a.cc:47:5: error: expected unqualified-id before 'return'
   47 |     return 0;
      |     ^~~~~~
a.cc:48:1: error: expected declaration before '}' token
   48 | }
      | ^
Language: C++

s = input()
q = int(input())

for i in q:
    a, b, c = map(int, input().split()) 
    if a == 1:
        s = s[::-1] 
    else:
        if b == 1:
            s = c + s
        else:
            s = s + c


Compiler output:
a.cc:1:1: error: 's' does not name a type
    1 | s = input()
      | ^
Language: C++

#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 k;
    cin>>k;
    if(k==1){
      reverse(s.begin(),s.end())
    }
    else {
      int t;
      cin>>t;
      char c;
      cin>>c;
      if(t==1){
        s=c+s;
      }
      else s+=c;
    }
  }
  cout<<s<<endl;
}


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

#include <iostream>
#include <vector>
#include <queue>
#include <string>
#define ll long long
#define MOD_P 1000000007
using namespace std;

int main()
{
	string str;
	vector<char> v;
	int q;
	int mode, type;
	int rev = 1;
	char c;

	cin >> str;
	int len = str.size();
	for (int i = 0; i < len; i++) {
		v.emplace_back(str[i]);
	}
	cin >> q;
	for (int i = 0; i < q; i++) {
		cin >> mode;
		if (mode == 1) {
			rev *= -1;
		} else {
			cin >> type;
			cin >> c;
			type = type * 2 - 3;
			if (rev * type > 0) {
				v.emplace_back(c);
			} else {
				v.insert(v.begin(), c);
			}
		}
	}

	len = v.size();

	if (rev == -1) {
		reverse(v.begin(), v.end());
	}

	for (int i = 0; i < len; i++) {
		printf("%c", v[i]);
	}

	return 0;
}

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

#include<bits/stdc++.h>
 
#define REP(i,s,N) for (int i=s;i<(N); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;


int main(){
	string S;
	cin >> S;
	int Q;
	cin >> Q;
	
	string AA,BB;
	REP(i,0,Q){
		int T;
		cin >> T;
		if(T==1){
			reverse(S.begin(),S.end());
			reverse(AA.begin(),AA.end());
			reverse(BB.begin(),BB.end());
		}else{
			int F;
			char C;
			cin >> F;
			cin >> C;
			if(F==1){
				AA += C;
			}else{
				BB += C;
			}
		}
	}
	
	cout << reverse(AA) + S + BB<< endl;
	

}

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

#include<bits/stdc++.h>
 
#define REP(i,s,N) for (int i=s;i<(N); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;


int main(){
	string S;
	cin >> S;
	int Q;
	cin >> Q;
	
	REP(i,0,Q){
		int T;
		cin >> T;
		if(T==1){
			reverse(S.begin(),S.end());
		}else{
			int F;
			char C;
			cin >> F;
			cin >> C;
			if(F==1){
				S = C + S;
			}else{
				S = S + C;
			}
		}
	}
	
	cout << S << endl;
	}

}

Compiler output:
a.cc:36:1: error: expected declaration before '}' token
   36 | }
      | ^
Language: Java

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    boolean isReverse = false;//反転中フラグ
    String s = sc.next();
    StringBuilder sb = new StringBuilder(s);
    int Q = sc.nextInt();
    int tmp = 0;
    String tmpS;
    for(int i = 0;i<Q;i++){
      if(sc.nextInt()==1){
        isReverse = !isReverse;
      }else{
        tmp=sc.nextInt();
        tmpS=sc.next();
        if(isReverse&&tmp==1){
          sb.append(tmpS);
        }else if(isReverse&&tmp==2){
          sb.insert(0,tmpS);
        }else if(!isReverse&&tmp==1){
          sb.insert(0,tmpS);
        }else{
          sb.append(tmpS);
        }
      }
    }
    
    if(!isReverse){
    System.out.println(sb);
    }else{
     System.out.println(sb.reverse());
    }
  }
  
  public static StringBuilder build(StringBuilder sb , boolean isReverse,int tmp , String tmpS){
    if(isReverse&&tmp==1){
      sb.append(tmpS);
    }else if(isReverse&&tmp==2){
      sb.insert(0,tmpS);
    }else if(!isReverse&&tmp==1){
      sb.insert(0,tmpS);
    }else{
      sb.append(tmpS);
    }
    return buil;
  }
      
  

  
}


Compiler output:
Main.java:46: error: cannot find symbol
    return buil;
           ^
  symbol:   variable buil
  location: class Main
1 error
Language: Java

import java.lang.*; 
import java.io.*; 
import java.util.*; 
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;


public class atcoder_158_D {
	static class FastReader{
		BufferedReader br;
		StringTokenizer st;
		public FastReader() {
			br =  new BufferedReader(new InputStreamReader(System.in));
		}
		String next() {
			while(st==null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
					
				}
				catch(IOException e) {
					e.printStackTrace();
				}
				
			}
			return st.nextToken();
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}
	static String add_string(String s1,String s2) {
		return s1+s2;
	}
	public static void main(String[] args) {
		FastReader ob = new FastReader();
		String s = ob.next();
		boolean r =false;
		int q = ob.nextInt();
		for(int i=0;i<q;i++) {
			int t = ob.nextInt();
			if(t==1) {
				r=!r;
			}
			else {
				int f =ob.nextInt();
				String s1=ob.next();
				if(r) {
					if(f==2) {
						s=s1+s;
					}
					else {
						s=s+s1;
					}
				}
				else {
					if(f==2) {
						s=s+s1;
					}
					else {
						s=s1+s;
					}
					
				}
			}
		}
		char arr[] = s.toCharArray();
		if(r) {
			for (int i = arr.length-1; i >-1; i--) {
				System.out.print(arr[i]);
			}
		}
		else {
			System.out.println(s);
		}
	}

}


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

#include"bits/stdc++.h"
using namespace std;
typedef unsigned long long ll;


using Graph=vector<vector<int>>;//グラフ型
void dfs(const Graph &G,int v/*根*/,vector<bool> &seen){
    seen[v]=true;  //vを訪問済にする
    for(auto next_v:G[v]){ //訪問済にしたvとつながっている場所を順番に探す
        if(seen[next_v]) continue; //もし探索済みならスルー
        dfs(G,next_v,seen); //再帰的に探索
    }
}

void bfs(const Graph &G,queue<int> &que/*発見したが訪問はしていない*/,vector<int> &dist/*開始地点からの距離*/){
    while(!que.empty()){
        int v=que.front();//queのうち先頭のものからスタート
        que.pop();//先頭を削除

        for(int nv :G[v]){//vとつながっている点を列挙
            if(dist[nv]!=-1) continue;//発見済(=距離が格納されている)であればスルー
            dist[nv]=dist[v]+1;//vとつながっている点に距離の情報を追加
            que.push(nv);//vとつながっている点を発見済にする
        }
    }
}

string swap_s(string &s){
    for(int i=0;i<s.length()/2;++i){
        swap(s[i],s[s.length()-i-1]);
    }
    return s;
}

int main(void){
    string s,c;
    int q,t,f;
    bool turn=false;
    cin>>s>>q;
    for(int i=0;i<q;++i){
        cin>>t;
        if(t==1){
            turn=!turn;
        }
        else{
            cin>>f>>c;
            if(f==1){
                if(turn)s=s+c;
                else s=c+s;
            }
            else{
                if(turn)s=c+s;
                else s=s+c;
            }
        }
    }
    
    if(turn){
        for(i=s.length()-1;i>=0;--i){
            cout<<s[i];
        }
    }
    else{
        cout<<s;
    }
}


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

package beginner158;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class D {

	public static void main(String[] args) throws IOException{
		InputStreamReader in = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(in);
		StringBuilder preSb = new StringBuilder();
		StringBuilder sb = new StringBuilder(br.readLine());
		int q = Integer.parseInt(br.readLine());
		
		boolean reverseFlg = false;
		String line = null;
		for(int i=0;i<q;i++) {
			line = br.readLine();
			char[] arr = line.toCharArray();
			if(arr[0]=='1') {
				reverseFlg = !reverseFlg;
			}else {
				if((arr[2]=='1' && !reverseFlg) || (arr[2]=='2' && reverseFlg)) {
//					sb.insert(0, arr[4]);
					preSb.append(arr[4]);
				} 
				else {
					sb.append(arr[4]);
				}
				
			}
		}
		br.close();
		preSb.reverse();
		sb.append(preSb);
		if(reverseFlg) {
			sb.reverse();
		}
		System.out.println(sb.toString());
		
	}
	
	

}


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

package beginner158;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class D {

	public static void main(String[] args) throws IOException{
		InputStreamReader in = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(in);
		
		StringBuilder sb = new StringBuilder(br.readLine());
//		sb.append(br.readLine());
		int q = Integer.parseInt(br.readLine());
		
		String line = null;
		for(int i=0;i<q;i++) {
			line = br.readLine();
			String[] arr = line.split(" ");
			if(arr[0].equals("1")) {
				sb.reverse();
			}else {
				if(arr[1].equals("1")) {
					sb.insert(0, arr[2]);
				} else {
					sb.append(arr[2]);
				}
			}
		}
		br.close();
		
		System.out.println(sb.toString());
		
	}
	
	

}


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

#include<bits/stdc++.h>

using namespace std;

int main() {
  string s;
  cin >> s;
  deque<char> dq(s.begin(), s.end());
  bool flipped(false);
  int q, t, f;
  char c;
  cin >> q;
  while (q--) {
    cin >> t;
    if (t == 1) flipped = !flipped;
    else {
      cin >> f >> c;
      flipped ^ (f - 1) ? dq.push_back(c) : dq.push_front(c);
    }
  }
  //while
  if (flipped) reverse(dq.begin(), dq.end());
  //cout << flipped << endl;
  for (char x: dq) {
    cout << x;
  }

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

#include <bits/stdc++.h>

void solve() {
  std::string str;
  int q;
  std::string e;
  std::cin >> str >> q;
  for (int i = 0; i < q; i++) {
    int t;
    std::cin >> t;
    if (t == 1) swap(str, e);
    else {
      int f;
      char c;
      std::cin >> f >> c;
      if (f == 1) str += c;
      else str += e;
    }
  }
  e +=std::reverse(str);
  std::cout << e;
  
}

int main() {
  solve();
  return 0;
}

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

#include <string>

void solve() {
  std::string str;
  int q;
  std::string e;
  std::cin >> str >> q;
  for (int i = 0; i < q; i++) {
    int t;
    std::cin >> t;
    if (t == 1) swap(str, e);
    else {
      int f;
      char c;
      std::cin >> f >> c;
      if (f == 1) str += c;
      else str += e;
    }
  }
  e +=std::reverse(str);
  std::cout << e;
  
}

int main() {
  solve();
  return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:7:8: error: 'cin' is not a member of 'std'
    7 |   std::cin >> str >> q;
      |        ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <string>
  +++ |+#include <iostream>
    2 | 
a.cc:10:10: error: 'cin' is not a member of 'std'
   10 |     std::cin >> t;
      |          ^~~
a.cc:10:10: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:15:12: error: 'cin' is not a member of 'std'
   15 |       std::cin >> f >> c;
      |            ^~~
a.cc:15:12: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:20:12: error: 'reverse' is not a member of 'std'
   20 |   e +=std::reverse(str);
      |            ^~~~~~~
a.cc:21:8: error: 'cout' is not a member of 'std'
   21 |   std::cout << e;
      |        ^~~~
a.cc:21:8: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <string>

void solve() {
  std::string str;
  std::string e;
  std::cin >> str >> q;
  for (int i = 0; i < q; i++) {
    int t;
    std::cin >> t;
    if (t == 1) swap(str, e);
    else {
      int f;
      char c;
      std::cin >> f >> c;
      if (f == 1) str += c;
      else str += e;
    }
  }
  e +=std::reverse(str);
  std::cout << e;
  
}

int main() {
  solve();
  return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:6:8: error: 'cin' is not a member of 'std'
    6 |   std::cin >> str >> q;
      |        ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <string>
  +++ |+#include <iostream>
    2 | 
a.cc:6:22: error: 'q' was not declared in this scope
    6 |   std::cin >> str >> q;
      |                      ^
a.cc:9:10: error: 'cin' is not a member of 'std'
    9 |     std::cin >> t;
      |          ^~~
a.cc:9:10: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:14:12: error: 'cin' is not a member of 'std'
   14 |       std::cin >> f >> c;
      |            ^~~
a.cc:14:12: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:19:12: error: 'reverse' is not a member of 'std'
   19 |   e +=std::reverse(str);
      |            ^~~~~~~
a.cc:20:8: error: 'cout' is not a member of 'std'
   20 |   std::cout << e;
      |        ^~~~
a.cc:20:8: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <iostream>
#include <deque>
#include <string>

void solve() {
  std::string str;
  std::deque<char> d;
  int q;
  bool reverse = false;
  std::cin >> str >> q;
  for (int i = 0; i < str.size(); i++) d.push_back(str[i]);
  
  for (int i = 0; i < q; i++) {
    int t;
    if (t == 1) reverse = (!reverse);
    else {
      int f;
      char c;
      std::cin >> f >> c;
      if (f == 1 && !reverse || f == 2 && reverse) d.push_front(c);
      else d.push_back(c);
    }
  }
  if (reverse)
    for (std::deque<char>::reverse_iterator i = d.rbegin(); i != d.rend(); i++)
      std::cout << *i;
  else
    for (std::deque<char>iterator i = d.begin(); i != d.end(); ++i)
      std::cout << *i;
}
int main() {
  solve();
  return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:28:34: error: expected ';' before 'i'
   28 |     for (std::deque<char>iterator i = d.begin(); i != d.end(); ++i)
      |                                  ^~
      |                                  ;
a.cc:28:35: error: 'i' was not declared in this scope
   28 |     for (std::deque<char>iterator i = d.begin(); i != d.end(); ++i)
      |                                   ^
a.cc:28:62: error: expected ')' before ';' token
   28 |     for (std::deque<char>iterator i = d.begin(); i != d.end(); ++i)
      |         ~                                                    ^
      |                                                              )
a.cc:28:66: error: 'i' was not declared in this scope
   28 |     for (std::deque<char>iterator i = d.begin(); i != d.end(); ++i)
      |                                                                  ^
Language: C++

#include <iostream>
#include <deque>
#include <string>

void solve() {
  std::string str;
  std::deque<char> d;
  int q;
  bool reverse = false;
  std::cin >> str >> q;
  for (int i = 0; i < str.size(); i++) d.push_back(str[i]);
  
  for (int i = 0; i < q; i++) {
    if (t == 0) reverse = (!reverse);
    else {
      int f;
      char c;
      std::cin >> f >> c;
      if (f == 1 && !reverse || f == 2 && reverse) d.push_front(c);
      else d.push_back(c);
    }
  }
  if (reverse)
    for (std::deque<char>::reverse_iterator i = d.rbegin(); i != d.rend(); i++)
      std::cout << *i;
  else
    for (std::deque<char>iterator i = d.begin(); i != d.end(); ++i)
      std::cout << *i;
}
int main() {
  solve();
  return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:14:9: error: 't' was not declared in this scope
   14 |     if (t == 0) reverse = (!reverse);
      |         ^
a.cc:27:34: error: expected ';' before 'i'
   27 |     for (std::deque<char>iterator i = d.begin(); i != d.end(); ++i)
      |                                  ^~
      |                                  ;
a.cc:27:35: error: 'i' was not declared in this scope
   27 |     for (std::deque<char>iterator i = d.begin(); i != d.end(); ++i)
      |                                   ^
a.cc:27:62: error: expected ')' before ';' token
   27 |     for (std::deque<char>iterator i = d.begin(); i != d.end(); ++i)
      |         ~                                                    ^
      |                                                              )
a.cc:27:66: error: 'i' was not declared in this scope
   27 |     for (std::deque<char>iterator i = d.begin(); i != d.end(); ++i)
      |                                                                  ^