criyle/codenet-compile-errors huggingface dataset:
Language: Java

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

public class Main{
  public static void main(String[] args)throws Exception{
    Scanner sc = new Scanner(System.in);
    String S = sc.nextLine();
    Deque<String> deq = new ArrayDeque<>();
    deq.add(S);
    int N = Integer.parseInt(sc.nextLine());
    boolean f = true;
    for(int i = 0; i < N; i++){
      String[] T = sc.nextLine().split(" ");
      int order = Integer.parseInt(T[0]);
      if(order == 1){
        f = !f;
      }else{
        int o2 = Integer.parseInt(T[1]);
        if(o2 == 1){
          if(f){
            deq.addFirst(T[2]);
          }else{
            deq.addLast(T[2]);
          }
        }else{
          if(f){
            deq.addLast(T[2]);
          }else{
            deq.addFirst(T[2]);
          }
        }
      }
    }
    StringBuilder sb = new StringBuilder();
    for(String s : deq){
      sb.append(s);
    }
    System.out.println(f ? sb.toString() : sb.reverse().toString());
    }
  }
}


Compiler output:
Main.java:41: error: class, interface, enum, or record expected
}
^
1 error
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
  char S[1000000];
  vector<char> F_1,F_2;
  int Q;
  cin >> S >> Q;
  int S_size = strlen(S);
  int T,F;
  char C;
  int T1_count = 0;
  REP(i,Q) {
    cin >> T;
    if(T==1) {
      T1_count++;
    } else if(T==2) {
      cin >> F >> C;
      if((F+T1_count)%2==1) {
        F_2.push_back(C);
      } else {
        F_1.push_back(C);
      }
    }
  }
  ll F_1_size = F_1.size();
  ll F_2_size = F_2.size();
  if(T1_count%2==1) {
    for(int j = F_1_size-1;j>=0;j--) cout << F_1[j];
    REP(j,S_size) cout << S[j];
    REP(j,F_2_size) cout << F_2[j];
  } else {
    for(int j = F_2_size-1;j>=0;j--) cout << F_2[j];
    REP(i,S_size) cout << S[j];
    REP(j,F_1_size) cout << F_1[j];
  }
  cout << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:29: error: 'j' was not declared in this scope
   42 |     REP(i,S_size) cout << S[j];
      |                             ^
Language: C++

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

string s;
int q, t, f;
char c;
int main(){
  string pre, suf;
  bool back = false;
  cin >> s >> q;
  while (q--) {
    cin >> t;
    if (t==1) {
      back = !back;
      swap(pre, suf);
    } else {
      cin >> f >> c;
      if (f==1) pre += c;
      else suf += c;
    }
  }
  reverse(pre.begin(), pre.end());
  if (back) back(s.begin(), s.end());
  cout << pre << s << suf << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:17: error: 'back' cannot be used as a function
   23 |   if (back) back(s.begin(), s.end());
      |             ~~~~^~~~~~~~~~~~~~~~~~~~
Language: C++

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

void solve() 
{
    bool flag=0;
    string s;int q;
    cin>>s>>q;
    REP(i,q){
        int t;cin>>t;
        if(t==1)flag=!flag;
        if(t==2){
            int f;char c;
            cin>>f>>c;f--;
            if(flag^f)
                s.push_back(c);
            else
                s.insert(s.begin(),c);
        }
    }
    if(flag)
        for(int i=s.size()-1;i>=0;i--)cout<<s[i];
    else
        cout<<s;
    cout<<endl;
}

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

Compiler output:
a.cc: In function 'void solve()':
a.cc:3:25: error: 'll' was not declared in this scope
    3 | #define rep(i,a,b) for (ll i = (a); i < (b); i++)
      |                         ^~
a.cc:4:18: note: in expansion of macro 'rep'
    4 | #define REP(i,n) rep(i,0,n)
      |                  ^~~
a.cc:11:5: note: in expansion of macro 'REP'
   11 |     REP(i,q){
      |     ^~~
a.cc:11:9: error: 'i' was not declared in this scope
   11 |     REP(i,q){
      |         ^
a.cc:3:37: note: in definition of macro 'rep'
    3 | #define rep(i,a,b) for (ll i = (a); i < (b); i++)
      |                                     ^
a.cc:11:5: note: in expansion of macro 'REP'
   11 |     REP(i,q){
      |     ^~~
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:17:42: error: expected ';' before 'str'
   17 |       if((f==1&&ch%2==0)||(f==2&&ch%2==1)str = c+str;
      |                                          ^~~
      |                                          ;
a.cc:18:7: error: expected primary-expression before 'else'
   18 |       else str+=c;
      |       ^~~~
a.cc:17:54: error: expected ')' before 'else'
   17 |       if((f==1&&ch%2==0)||(f==2&&ch%2==1)str = c+str;
      |         ~                                            ^
      |                                                      )
   18 |       else str+=c;
      |       ~~~~
Language: C++

#include<cstdio>
#include<vector>
#include<algorithm>
#include<iostream>
#include<cstring> 
using namespace std;
vector<char> aa;
vector<char>::iterator it;
int main(){
    char n[100009];
    scanf("%s",n);
    int len=strlen(n);
    for(int i=0;i<len;i++){
    	aa.push_back(n[i]);
	}
    int m;
    scanf("%d",&m);
    int x;
    for (int i = 0; i < m;i++){
        scanf("%d", &x);
        if(x==1){
            reverse(aa.begin(), aa.end());
        }else if(x==2){
        	int k;
        	scanf("%d",&k);
        	if(k==1){
        		char t;
        		getchar();
            	scanf("%c", &t);
            	getchar();
            	aa.insert(aa.begin(), t);
			}else{
				char t;
				getchar();
            	scanf("%c", &t);
            	getchar();
            	aa.push_back(t);
			}
            
    	}
    }
    for (int j = 0; j <aa.size();j++){
        printf("%c",aa[i]);
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:24: error: 'i' was not declared in this scope
   43 |         printf("%c",aa[i]);
      |                        ^
Language: C++

#include<cstdio>
#include<vector>
#include<algorithm>
#include<iostream>
#include<cstring> 
using namespace std;
vector<char> aa;
vector<char>::iterator it;
int main(){
    char n[100009];
    scanf("%s",n);
    int len=strlen(n);
    for(int i=0;i<len;i++){
    	aa.push_back(n[i]);
	}
    int m;
    scanf("%d",&m);
    int x;
    for (int i = 0; i < m;i++){
        scanf("%d", &x);
        if(x==1){
            reverse(aa.begin(), aa.end());
        }else if(x==2){
        	int k;
        	scanf("%d",&k);
        	if(k==1){
        		char t;
        		getchar();
            	scanf("%c", &t);
            	getchar();
            	aa.insert(aa.begin(), t);
			}else{
				char t;
				getchar();
            	scanf("%c", &t);
            	getchar();
            	aa.push_back(t);
			}
            
    	}
    }
    for (int j = 0; j <aa.size();j++){
        printf("%c",a[i]);
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:21: error: 'a' was not declared in this scope
   43 |         printf("%c",a[i]);
      |                     ^
a.cc:43:23: error: 'i' was not declared in this scope
   43 |         printf("%c",a[i]);
      |                       ^
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
void main()
{
    string s;
    cin >> s;
    int q;
    cin >> q;
    for (auto i = 0; i < q; ++i)
    {
        char t;
        cin >> t;
        if (t == '1')
        {
            reverse(s.begin(), s.end());
        }
        else
        {
            char f, c;
            cin >> f >> c;
            if (f == '1')
            {
                s.insert(s.begin(), c);
            }
            else
            {
                s.push_back(c);
            }
        }
    }
    cout << s << endl;
}

Compiler output:
a.cc:4:1: error: '::main' must return 'int'
    4 | void main()
      | ^~~~
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 a = sc.nextInt();
        int b = 1;
        String t;
        int d,e;
        for(int i=0;i<a;i++){d = sc.nextInt();
                             if(d==1){b*=-1;
                                     }
                             else{e = sc.nextInt(); 
                                  t = sc.next();
                                  if(b==1){if(e==1){
                                          t+=s;
                                          s=t;                                          
                                 }
                                 else{s+=t;
                                     }
                                         }
                                  else{if(e==1){
                                    s+=t; 
                                  }
                                 else{ t+=s;
                                       s=t;  
                                     }
                                      }
                                s = sb2.toString(); }
                            }
         StringBuffer sb = new StringBuffer(s);
         if(b==-1){sb.reverse(); 
                   s = sb.toString();}
		System.out.println(s);
	}
}


Compiler output:
Main.java:29: error: cannot find symbol
                                s = sb2.toString(); }
                                    ^
  symbol:   variable sb2
  location: class Main
1 error
Language: C++

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

string s;
int q, t, f;
char c;
int main(){
  string pre, suf;
  bool reverse = false;
  cin >> s >> q;
  while (q--) {
    cin >> t;
    if (t==1) {
      reverse = !reverse;
      swap(pre, suf);
    } else {
      cin >> f >> c;
      if (f==1) pre += c;
      else suf += c;
    }
  }
  reverse(pre.begin(), pre.end());
  if (reverse) reverse(s.begin(), s.end());
  cout << pre << S << suf << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:10: error: 'reverse' cannot be used as a function
   22 |   reverse(pre.begin(), pre.end());
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
a.cc:23:23: error: 'reverse' cannot be used as a function
   23 |   if (reverse) reverse(s.begin(), s.end());
      |                ~~~~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:24:18: error: 'S' was not declared in this scope
   24 |   cout << pre << S << suf << endl;
      |                  ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int MAX = 1000000;
const int INF = 1e9;
const double pi=acos(-1);


int main(){
  string s;
  int q;
  cin >> s >> q;
  int sum=0;
  int forw=1;
  deque<string>deq;
  deq.push_front(s);
  rep(i,q){
    int x;
    cin >> x;
    if(x==1){
      if(forw==1)forw=2;
      else forw=1;
    }
    else{
      int f;
      string c;
      cin >> f >> c;
      if((f+forw)%2==0)deq.push_front(c);
      else deq.push_back(c);
    }
  }
  if(forw==1){
    while(!deq.empty()){
      string t=deq.front;
      deq.pop_front();
      cout <<t;
    }
  }
  else{
    while(!deq.empty()){
      string t=deq.back;
      deq.pop_back();
      if(s==t)reverse(t.begin(),t.end());
      cout <<t;
    }
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:20: error: conversion from '<unresolved overloaded function type>' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   36 |       string t=deq.front;
      |                ~~~~^~~~~
a.cc:43:20: error: conversion from '<unresolved overloaded function type>' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   43 |       string t=deq.back;
      |                ~~~~^~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int MAX = 1000000;
const int INF = 1e9;
const double pi=acos(-1);


int main(){
  string s;
  int q;
  cin >> s >> q;
  int sum=0;
  int forw=1;
  deque<string>deq;
  deq.push_front(s);
  rep(i,q){
    int x;
    cin >> x;
    if(x==1){
      if(forw==1)forw=2;
      else forw=1;
    }
    else{
      int f;
      string c;
      cin >> f >> c;
      if((f+forw)%2==0)deq.push_front(c);
      else deq.push_back(c);
    }
  }
  if(forw==1){
    while(!deq.empty()){
      string t=deq.pop_front();
      cout <<t;
    }
  }
  else{
    while(!deq.empty()){
      string t=deq.pop_back();
      if(s==t)reverse(t.begin(),t.end());
      cout <<t;
    }
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:29: error: conversion from 'void' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   36 |       string t=deq.pop_front();
      |                ~~~~~~~~~~~~~^~
a.cc:42:28: error: conversion from 'void' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   42 |       string t=deq.pop_back();
      |                ~~~~~~~~~~~~^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
const int maxn = 2e5 + 7;
const double pi = acos(-1);

int main(){
	string s;
	cin >> s;
	int q;
	scanf("%d",&q);
	int fl = 0;
	
	while(q--){
		int t;
		scanf("%d",&t);
		if(t == 1){
			fl = 1 - fl;
		}else{
			int f;
			scanf("%d",&f);
			getchar();
			char ch;
			if(f == 1){
				scanf("%c",&ch);
				if(!fl) s1 += ch;
				else s2 += ch;
			}else{
				scanf("%c",&ch);
				if(!fl) s2 += ch;
				else s1 += ch;
			}
		}
	}
	if(fl){
		for(int i = s2.size()-1;i >= 0;i--) printf("%c",s2[i]);
		for(int i = s.size()-1;i >= 0;i--) printf("%c",s[i]);
		for(int i = 0;i < s1.size();i++) printf("%c",s1[i]);
	}
	else{
		for(int i = s1.size()-1;i >= 0;i--) printf("%c",s1[i]);
		for(int i = 0;i < s.size();i++) printf("%c",s[i]);
		for(int i = 0;i < s2.size();i++) printf("%c",s2[i]);		
	}
	cout << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:41: error: 's1' was not declared in this scope; did you mean 's'?
   27 |                                 if(!fl) s1 += ch;
      |                                         ^~
      |                                         s
a.cc:28:38: error: 's2' was not declared in this scope; did you mean 's'?
   28 |                                 else s2 += ch;
      |                                      ^~
      |                                      s
a.cc:31:41: error: 's2' was not declared in this scope; did you mean 's'?
   31 |                                 if(!fl) s2 += ch;
      |                                         ^~
      |                                         s
a.cc:32:38: error: 's1' was not declared in this scope; did you mean 's'?
   32 |                                 else s1 += ch;
      |                                      ^~
      |                                      s
a.cc:37:29: error: 's2' was not declared in this scope; did you mean 's'?
   37 |                 for(int i = s2.size()-1;i >= 0;i--) printf("%c",s2[i]);
      |                             ^~
      |                             s
a.cc:39:35: error: 's1' was not declared in this scope; did you mean 's'?
   39 |                 for(int i = 0;i < s1.size();i++) printf("%c",s1[i]);
      |                                   ^~
      |                                   s
a.cc:42:29: error: 's1' was not declared in this scope; did you mean 's'?
   42 |                 for(int i = s1.size()-1;i >= 0;i--) printf("%c",s1[i]);
      |                             ^~
      |                             s
a.cc:44:35: error: 's2' was not declared in this scope; did you mean 's'?
   44 |                 for(int i = 0;i < s2.size();i++) printf("%c",s2[i]);
      |                                   ^~
      |                                   s
Language: C++

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

int main() {
  char s;
  cin >> s;
  deque<char> deq;
  deq.push_back(s);
  int q;
  cin >> q;
  bool total_rev = false;
  int t;
  int f;
  char c;
  rep(i, q) {
    cin >> t;
    if (t == 1) {
      total_rev = !total_rev;
    } else {
      cin >> f;
      cin >> c;
      if (total_rev) {
        if (f == 2) {
          deq.push_front(c);
        } else {
          deq.push_back(c);
        }
      } else {
        if (f == 1) {
          deq.push_front(c);
        } else {
          deq.push_back(c);
        }
      }
      
    }
  }
  if (total_rev) {
    reverse(s.begin(), s.end());
  }
  
  cout << s << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:15: error: request for member 'begin' in 's', which is of non-class type 'char'
   41 |     reverse(s.begin(), s.end());
      |               ^~~~~
a.cc:41:26: error: request for member 'end' in 's', which is of non-class type 'char'
   41 |     reverse(s.begin(), s.end());
      |                          ^~~
Language: C++

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

int main() {
  char s;
  cin >> s;
  deque<char> deq;
  deq.push_back(s);
  int q;
  cin >> q;
  bool total_rev = false;
  int t;
  int f;
  char c;
  rep(i, q) {
    cin >> t;
    if (t == 1) {
      total_rev = !total_rev;
    } else {
      cin >> f;
      cin >> c;
      if (total_rev) {
        if (f == 2) {
          deq.push_front(c)
        } else {
          deq.push_back(c)
        }
      } else {
        if (f == 1) {
          deq.push_front(c)
        } else {
          deq.push_back(c)
        }
      }
      
    }
  }
  if (total_rev) {
    reverse(s.begin(), s.end());
  }
  
  cout << s << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:28: error: expected ';' before '}' token
   26 |           deq.push_front(c)
      |                            ^
      |                            ;
   27 |         } else {
      |         ~                   
a.cc:28:27: error: expected ';' before '}' token
   28 |           deq.push_back(c)
      |                           ^
      |                           ;
   29 |         }
      |         ~                  
a.cc:32:28: error: expected ';' before '}' token
   32 |           deq.push_front(c)
      |                            ^
      |                            ;
   33 |         } else {
      |         ~                   
a.cc:34:27: error: expected ';' before '}' token
   34 |           deq.push_back(c)
      |                           ^
      |                           ;
   35 |         }
      |         ~                  
a.cc:41:15: error: request for member 'begin' in 's', which is of non-class type 'char'
   41 |     reverse(s.begin(), s.end());
      |               ^~~~~
a.cc:41:26: error: request for member 'end' in 's', which is of non-class type 'char'
   41 |     reverse(s.begin(), s.end());
      |                          ^~~
Language: C++

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

int main() {
  int n, i;
  std::string s, a, b, c;
  cin >> s;
  cin >> n;
  i = 0;
  while (i < n){
    cin >> a >> b >> c;
    if (a == "1"){
  	  std::reverse(s.begin(), str.end());
    }else{
      if (b == "1"){
        s = c + s;
      }else{
        s = s + c;
      }
    }
  }
  cout << s << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:35: error: 'str' was not declared in this scope; did you mean 'std'?
   16 |           std::reverse(s.begin(), str.end());
      |                                   ^~~
      |                                   std
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  string _s; int n;
  cin>>skipws>>_s>>n;
  deque<char> s(_s.begin(),_s.end());
  bool f=false;
  for (int i=0;i<n;i++){
    int t;cin>>t;
    if (t==1){
      f^=1;
    }else{
      int s;char c;
      cin>>s>>c;
      if ((s==1)^f){
        s.push_front(c);
      }else{
        s.push_back(c);
      }
    }
  }
  if (f) reverse(s.begin(),s.end());
  string a(s.begin(),s.end());
  cout<<a<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:11: error: request for member 'push_front' in 's', which is of non-class type 'int'
   16 |         s.push_front(c);
      |           ^~~~~~~~~~
a.cc:18:11: error: request for member 'push_back' in 's', which is of non-class type 'int'
   18 |         s.push_back(c);
      |           ^~~~~~~~~
Language: C++


function main(input) {
    const arr=input.split('\n')
    var s = arr[0].split('')
    const q = arr[1]
    arr.shift()
    arr.shift()
    console.log({arr})
    for (let index = 0; index < arr.length; index++) {
        // console.log(arr[index])
        if(arr[index]==1){
            s.reverse()   
        }
        else {
            const params = arr[index].split(' ')
            // console.log({params})
            if(params[1]==1){
                s.unshift(params[2])
            }
            else{
                s.push(params[2])
            }
        }
        
    }
    console.log(s.join(''))
}

// main('a\n4\n2 1 p\n1\n2 2 c\n1')
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Compiler output:
a.cc:4:26: error: empty character constant
    4 |     var s = arr[0].split('')
      |                          ^~
a.cc:26:24: error: empty character constant
   26 |     console.log(s.join(''))
      |                        ^~
a.cc:30:14: warning: multi-character character constant [-Wmultichar]
   30 | main(require('fs').readFileSync('/dev/stdin', 'utf8'));
      |              ^~~~
a.cc:30:33: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
   30 | main(require('fs').readFileSync('/dev/stdin', 'utf8'));
      |                                 ^~~~~~~~~~~~
a.cc:30:47: warning: multi-character character constant [-Wmultichar]
   30 | main(require('fs').readFileSync('/dev/stdin', 'utf8'));
      |                                               ^~~~~~
a.cc:2:1: error: 'function' does not name a type; did you mean 'union'?
    2 | function main(input) {
      | ^~~~~~~~
      | union
a.cc:30:5: error: expected constructor, destructor, or type conversion before '(' token
   30 | main(require('fs').readFileSync('/dev/stdin', 'utf8'));
      |     ^
Language: C++

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


int main() 
{
    string S;
	int Q;
    cin>>S;
  	cin>>Q;

  	bool order_flg=true;
  	for(int i=0;i<Q;i++){
      int Ti;
      cin>>Ti;
      if(Ti==1){
        if(order_flg==true)
  	      order_flg=false
        else
          order_flg=true;
        }else{
        int Fi;
        char Ci;
        cin>>Fi>>Ci;
        if(Fi==1){
          if(order_flg==true)
            S=Ci+S;
          else
            S.push_back(Ci);
        }
        else
          if(order_flg==true)
            S.push_back(Ci);
          else
            S=Ci+S;
      }
   
    }
  	  if(order_flg==false)
        S.reverse(S.begin(),S.end());
  
      cout<<S<<endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:30: error: expected ';' before 'else'
   20 |               order_flg=false
      |                              ^
      |                              ;
   21 |         else
      |         ~~~~                  
a.cc:42:11: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'reverse'; did you mean 'reserve'?
   42 |         S.reverse(S.begin(),S.end());
      |           ^~~~~~~
      |           reserve
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
typedef long long int ll;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

int main(){
  string s;
  ll q;
  int Q;
  cin >> s >> q;;
  while(q){
    cin >> Q;
    if(Q==1){
      reverse(s.begin(),s.end());
    }else{
      int f;
      string c;
      cin >> f >> c;
      if(f==1){
        s.insert(0,c);
      }else{
        s.push_back(c);
      }
    }
    q--;
  }
  cout << s ;
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:30:21: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'char'
   30 |         s.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)
      |                 ~~~~~~~^~~
Language: C++

/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  string s;
  int q,cnt=0;
  cin >> s >> q;
  while(q--) {
    int t;
    cin >> t;
    if(t==1) {
      cnt++;
    }
    else if(t==2) {
      int f;
      string c;
      cin >> f >> c;
      if(f==1) {
        if(cnt%2) {
          s.push_back(c);
        }
        else {
          s.insert(0,c);
        }
      }
      else {
        if(cnt%2) {
          s.insert(0,c);
        }
        else {
          s.push_back(c);
        }
      }
    }
  }
  if(cnt%2) {
    for(int i=s.size()-1; i>=0; i--) {
      cout << s[i];
    }
    cout << "\n";
    return 0;
  }
  cout << s << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:23: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'char'
   40 |           s.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/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:6:
/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:51:23: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'char'
   51 |           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: C++

from collections import deque
import sys
input = sys.stdin.readline

S_deque = list(input())
S_deque = deque(S_deque[:-1])
Q = int(input())

for _ in range(Q):
  item = list(input().split())
  if item[0] == '1':
    S_deque = deque(reversed(S_deque))

  else:
    if item[1] == '1':
      S_deque.appendleft(item[2])

    else:
      S_deque.append(item[2])

S = list(S_deque)
print(''.join(S))


Compiler output:
a.cc:22:7: error: empty character constant
   22 | print(''.join(S))
      |       ^~
a.cc:1:1: error: 'from' does not name a type
    1 | from collections import deque
      | ^~~~
Language: C++

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

int main() {
  string S;
  cin >> S;
  int size = S.size();
  vector<char> s(size);
  for (int i = 0; i < size; i++) {
    s.at(i) = S.at(i);
  }
  int N;
  cin >> N;
  bool f = true;
  for (int i = 0; i<N; i++) {
    int x;
    cin >> x;
    if (x == 1) {
      if(f) {
        f = 0;
      }
      else {
        f = 1;
      }
    }
    else {
      int y;
      cin >> y;
      if (y == 1) {
        if (f) {
          char c;
          cin >> c;
          s.insert(s.begin() + 0, c);
        }
        else {
          char c;
          cin >> c;
          s.push_back(c);
        }
      }
      else {
        if (f) {
        char c;
        cin >> c;
        s.push_back(c);
        }
        else {
          char c;
          cin >> c;
          s.insert(s.begin() + 0, c);
        }
      }
    }
  }
  int n = s.size();
  if (f) {
    for (int i = 0; i < n; i++) {
      cout << s.at(i);
    }
  }
  else {
    for (int i = 0; i < n; i++) {
      cout << s.at(n - i - 1);
    }
  }
  int n = s.size();
  for (int i = 0; i < n; i++) {
    cout << s.at(i);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:66:7: error: redeclaration of 'int n'
   66 |   int n = s.size();
      |       ^
a.cc:55:7: note: 'int n' previously declared here
   55 |   int n = s.size();
      |       ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:17:42: error: expected ';' before '{' token
   17 |       if((f==1&&ch%2==0)||(f==2&&ch%2==1){
      |                                          ^
      |                                          ;
a.cc:20:7: error: expected primary-expression before 'else'
   20 |       else str+=c;
      |       ^~~~
a.cc:19:8: error: expected ')' before 'else'
   19 |       }
      |        ^
      |        )
   20 |       else str+=c;
      |       ~~~~
a.cc:17:9: note: to match this '('
   17 |       if((f==1&&ch%2==0)||(f==2&&ch%2==1){
      |         ^
Language: C++

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

using namespace std;

int main()
{
	string S,T,Q;
	int q;
	getline(cin, S);
	getline(cin, Q);
	q = atoi(Q.c_str());
	for (int i = 0; i < q; i++)
	{
		getline(cin,T);
		if (T[0] - '0' == 1)
		{
			reverse(S.begin(),S.end());
		}
		else if(T[2] == '1')
		{
			S = T[4] + S;
		}
		else
		{
			S = S + T[4];
		}
	}
	cout << S << 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(S.begin(),S.end());
      |                         ^~~~~~~
Language: C++

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

int main() {
  string s;
  cin>>s;
  int q;
  cin>>q;
  vector<int>t(q,0);
  vector<int>f(q,0);
  vector<char>c(q,0);
  int count=0;
  bool rev=false;
  for(int i=0;i<q;i++){
    cin>>t.at(i);
    if(t.at(i)==2){
      cin>>f.at(i)>>c.at(i);
    }else{
      count++;
    }
  }
  if(count%2==1){
    reverse(s.begin(),s.end());
    rev=true;
  }
  for(int i=0;i<q;i++){
    if(rev==false){
      if(t.at(i)=1){
        rev=true;
      }else(
        if(t.at(i)==1){
          s.insert(s.begin(),c.at(i))
        }else{
          s.puse_back(c.at(i))
        }
      )
    }else{
            if(t.at(i)=1){
        rev=false;
      }else(
        if(t.at(i)==2){
          s.insert(s.begin(),c.at(i))
        }else{
          s.puse_back(c.at(i))
        }
      )


    }
  }  for(int i=0;i<s.size();i++){
    cout<<s.at(i);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:9: error: expected primary-expression before 'if'
   31 |         if(t.at(i)==1){
      |         ^~
a.cc:30:13: error: expected ')' before 'if'
   30 |       }else(
      |            ~^
      |             )
   31 |         if(t.at(i)==1){
      |         ~~   
a.cc:36:7: error: expected primary-expression before ')' token
   36 |       )
      |       ^
a.cc:41:9: error: expected primary-expression before 'if'
   41 |         if(t.at(i)==2){
      |         ^~
a.cc:40:13: error: expected ')' before 'if'
   40 |       }else(
      |            ~^
      |             )
   41 |         if(t.at(i)==2){
      |         ~~   
a.cc:46:7: error: expected primary-expression before ')' token
   46 |       )
      |       ^
a.cc:52:2: error: expected '}' at end of input
   52 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
 
int main(){
    string s; cin >> s;
    ll q; cin >> q;
    map<ll, string> mp;
    mp[0] = s;
    ll st = -1, last = 1;
    int f = 1;
    for(int i = 0; i < q; i++){
        int t; cin >> t;
        if(t == 1){
            f *= -1;
        }else{
            int c; cin >> c;
            string ss; cin >> ss;
            if(c == 1){
                if(f == 1){
                    mp[st] = ss;
                    st--;
                }else{
                    mp[last] = ss;
                    last++;
                }
            }else{
                if(f == 1){
                    mp[last] = ss;
                    last++;
                }else{
                    mp[st] = ss;
                    st--;
                }
            }
        }
    if(f == 1){
        for(ll i = st+1; i < last; i++){
            cout << mp[i];
        }
    }else{
        for(ll i = last-1; i > st; i--){
            cout << mp[i];
        }
    }
    cout << endl;
    }
    if(f == 1){
        for(ll i = st+1; i < last; i++){
            cout << mp[i];
        }
    }else{
        for(ll i = last-1; i > st; i--){
            if(i == 0){
                string t = mp[0];
                reverse(t.begin(), t.end())
                cout << t;
                continue;
            }
            cout << mp[i];
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:44: error: expected ';' before 'cout'
   56 |                 reverse(t.begin(), t.end())
      |                                            ^
      |                                            ;
   57 |                 cout << t;
      |                 ~~~~
Language: C++

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

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

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

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

#include <iostream>
using namespace std;

#define MAX 10000000001

#define rep(i, x) for(long long i=0;i<(x);i++)
char S[MAX];
int Q;
long long first, last;
// lastは-1する必要あり
int main() {
    first = 0;
    last = 0;
    cin >> S;
    //cout << S1.size() << endl;
    rep(i, MAX){
        if(S[i] == '\0') {
            break;
        }
        last++;
    }

    cin >> Q;
    
    rep(i, Q) {
        int T, F;
        char C;
        cin >> T;
        // T=1 文字列Sの前後を反転する。
        // T=2 整数Fと英小文字Cが与えられる
        //  F=1 Sの先頭にCiを追加
        //  F=2 Sの末尾にCiを追加
        if(T == 1) {
            char tmp = S[last-1];
            S[last-1] = S[first];
            S[first] = tmp;
        } else if(T == 2) {
            cin >> F >> C;
            if(F == 1) {
                if(first == 0) {
                    first = MAX;
                }
                first--;
                S[first] = C;
            } else if(F == 2) {
                S[last] = C;
                last++;
                if(last == MAX) {
                    last = 0;
                }
            }
        }
    }

    //cout << first << ":" << last << endl;

    if(first > last){
        for(long long i =first;i < MAX;i++){
            //cout << i << endl;
            cout << S[i];
        }
        for(long long i=0;i < last; i++){
            //cout << i << endl;
            cout << S[i];
        }
    } else {
        for(long long i=first;i< last;i++){
            //cout << i << endl;
            cout << S[i];
        }
    }
    cout << endl;
    return 0;
}

Compiler output:
/tmp/cckA5THe.o: in function `main':
a.cc:(.text+0xb): relocation truncated to fit: R_X86_64_PC32 against symbol `first' defined in .bss section in /tmp/cckA5THe.o
a.cc:(.text+0x16): relocation truncated to fit: R_X86_64_PC32 against symbol `last' defined in .bss section in /tmp/cckA5THe.o
a.cc:(.text+0x59): relocation truncated to fit: R_X86_64_PC32 against symbol `last' defined in .bss section in /tmp/cckA5THe.o
a.cc:(.text+0x64): relocation truncated to fit: R_X86_64_PC32 against symbol `last' defined in .bss section in /tmp/cckA5THe.o
a.cc:(.text+0x83): relocation truncated to fit: R_X86_64_PC32 against symbol `Q' defined in .bss section in /tmp/cckA5THe.o
a.cc:(.text+0xc7): relocation truncated to fit: R_X86_64_PC32 against symbol `last' defined in .bss section in /tmp/cckA5THe.o
a.cc:(.text+0xe0): relocation truncated to fit: R_X86_64_PC32 against symbol `first' defined in .bss section in /tmp/cckA5THe.o
a.cc:(.text+0xe7): relocation truncated to fit: R_X86_64_PC32 against symbol `last' defined in .bss section in /tmp/cckA5THe.o
a.cc:(.text+0x107): relocation truncated to fit: R_X86_64_PC32 against symbol `first' defined in .bss section in /tmp/cckA5THe.o
a.cc:(.text+0x15d): relocation truncated to fit: R_X86_64_PC32 against symbol `first' defined in .bss section in /tmp/cckA5THe.o
a.cc:(.text+0x173): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

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

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

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

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

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

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

    int Q;
    cin >> Q;
    int T, F;
    char C;

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

        if (T == 1){
            for (int j = 0; j < S.length()/2; j++){
                char temp = S[j];
                S[i] = str[S.length()-j-1];
                S[S.length()-j-1] = temp;
            }
        } else {
            cin >> F >> C;

            if (F == 1){
                S = C + S; 
            } else {
                S = S + C;
            }
        }
    }
    cout << S << endl;

}


Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:5:5: error: 'string' was not declared in this scope
    5 |     string S;
      |     ^~~~~~
a.cc:6:5: error: 'cin' was not declared in this scope
    6 |     cin >> S;
      |     ^~~
a.cc:6:12: error: 'S' was not declared in this scope
    6 |     cin >> S;
      |            ^
a.cc:19:24: error: 'str' was not declared in this scope; did you mean 'std'?
   19 |                 S[i] = str[S.length()-j-1];
      |                        ^~~
      |                        std
a.cc:32:5: error: 'cout' was not declared in this scope
   32 |     cout << S << endl;
      |     ^~~~
a.cc:32:18: error: 'endl' was not declared in this scope
   32 |     cout << S << endl;
      |                  ^~~~
Language: C++

#include <iostream>
using namespace std;

#define MAX 10000000001

#define rep(i, x) for(long long i=0;i<(x);i++)
char S[MAX];
int Q;
long long first, last;
// lastは-1する必要あり
int main() {
    first = 0;
    last = 0;
    cin >> S;
    //cout << S1.size() << endl;
    rep(i, MAX){
        if(S[i] == '\0') {
            break;
        }
        last++;
    }

    cin >> Q;
    
    rep(i, Q) {
        int T, F;
        char C;
        cin >> T;
        // T=1 文字列Sの前後を反転する。
        // T=2 整数Fと英小文字Cが与えられる
        //  F=1 Sの先頭にCiを追加
        //  F=2 Sの末尾にCiを追加
        if(T == 1) {
            char tmp = S[last-1];
            S[last-1] = S[first];
            S[first] = tmp;
        } else if(T == 2) {
            cin >> F >> C;
            if(F == 1) {
                if(first == 0) {
                    first = MAX;
                }
                first--;
                S[first] = C;
            } else if(F == 2) {
                S[last] = C;
                last++;
                if(last == MAX) {
                    last = 0;
                }
            }
        }
    }

    //cout << first << ":" << last << endl;

    if(first > last){
        for(long long i =first;i < MAX;i++){
            //cout << i << endl;
            cout << S[i];
        }
        for(long long i=0;i < last; i++){
            //cout << i << endl;
            cout << S[i];
        }
    } else {
        for(long long i=first;i< last;i++){
            //cout << i << endl;
            cout << S[i];
        }
    }
    cout << endl;
    return 0;
}

Compiler output:
/tmp/ccP3MfHf.o: in function `main':
a.cc:(.text+0xb): relocation truncated to fit: R_X86_64_PC32 against symbol `first' defined in .bss section in /tmp/ccP3MfHf.o
a.cc:(.text+0x16): relocation truncated to fit: R_X86_64_PC32 against symbol `last' defined in .bss section in /tmp/ccP3MfHf.o
a.cc:(.text+0x59): relocation truncated to fit: R_X86_64_PC32 against symbol `last' defined in .bss section in /tmp/ccP3MfHf.o
a.cc:(.text+0x64): relocation truncated to fit: R_X86_64_PC32 against symbol `last' defined in .bss section in /tmp/ccP3MfHf.o
a.cc:(.text+0x83): relocation truncated to fit: R_X86_64_PC32 against symbol `Q' defined in .bss section in /tmp/ccP3MfHf.o
a.cc:(.text+0xc7): relocation truncated to fit: R_X86_64_PC32 against symbol `last' defined in .bss section in /tmp/ccP3MfHf.o
a.cc:(.text+0xe0): relocation truncated to fit: R_X86_64_PC32 against symbol `first' defined in .bss section in /tmp/ccP3MfHf.o
a.cc:(.text+0xe7): relocation truncated to fit: R_X86_64_PC32 against symbol `last' defined in .bss section in /tmp/ccP3MfHf.o
a.cc:(.text+0x107): relocation truncated to fit: R_X86_64_PC32 against symbol `first' defined in .bss section in /tmp/ccP3MfHf.o
a.cc:(.text+0x15d): relocation truncated to fit: R_X86_64_PC32 against symbol `first' defined in .bss section in /tmp/ccP3MfHf.o
a.cc:(.text+0x173): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:18:18: error: no matching function for call to 'std::vector<char>::push_back(std::string&)'
   18 |       k.push_back(p);
      |       ~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = char; _Alloc = std::allocator<char>; value_type = char]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const std::vector<char>::value_type&' {aka 'const char&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = char; _Alloc = std::allocator<char>; value_type = char]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::vector<char>::value_type&&' {aka 'char&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~