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

#include <cstdio>
#include <string>
using namespace std;
int main(){
  char str[1000], cmd[7], p[1000];
  int a, b, q;
  scanf("%s", str);
  string STR = str;
  scanf("%d", &q);
  for(int i = 0; i < q; i++){
    scanf("%s %d %d", cmd, &a, &b);
    string CMD = cmd;
    if(CMD == "replace"){
      scanf("%s", p);
      string P = p;
      STR.replace(a, b, P);
    }
    else if(CMD == "reverse"){
      string R;
      for(int j = b; j <= a; j--){
	R += STR[j];
      }
      STR.replace(a, b - a + 1, R);
    }
    else if(CMD == "print"){
      strcpy(str, STR.c_str());
      for(int k = a; k <= b; k++){
	printf("%c", str[k]);
      }
      printf("\n");
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:7: error: 'strcpy' was not declared in this scope
   26 |       strcpy(str, STR.c_str());
      |       ^~~~~~
a.cc:3:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <string>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include <cstdio>
#include <cstring>
using namespace std;
int main(){
  char str[1000], cmd[7], p[1000];
  int a, b, q;
  scanf("%s", str);
  string STR = str;
  scanf("%d", &q);
  for(int i = 0; i < q; i++){
    scanf("%s %d %d", cmd, &a, &b);
    string CMD = cmd;
    if(CMD == "replace"){
      scanf("%s", p);
      string P = p;
      STR.replace(a, b, P);
    }
    else if(CMD == "reverse"){
      string R;
      for(int j = b; j <= a; j--){
	R += STR[j];
      }
      STR.replace(a, b - a + 1, R);
    }
    else if(CMD == "print"){
      strcpy(str, STR.c_str());
      for(int k = a; k <= b; k++){
	printf("%c", str[k]);
      }
      printf("\n");
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'string' was not declared in this scope
    8 |   string STR = str;
      |   ^~~~~~
a.cc:3:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    2 | #include <cstring>
  +++ |+#include <string>
    3 | using namespace std;
a.cc:12:11: error: expected ';' before 'CMD'
   12 |     string CMD = cmd;
      |           ^~~~
      |           ;
a.cc:13:8: error: 'CMD' was not declared in this scope
   13 |     if(CMD == "replace"){
      |        ^~~
a.cc:15:13: error: expected ';' before 'P'
   15 |       string P = p;
      |             ^~
      |             ;
a.cc:16:7: error: 'STR' was not declared in this scope
   16 |       STR.replace(a, b, P);
      |       ^~~
a.cc:16:25: error: 'P' was not declared in this scope
   16 |       STR.replace(a, b, P);
      |                         ^
a.cc:19:13: error: expected ';' before 'R'
   19 |       string R;
      |             ^~
      |             ;
a.cc:21:9: error: 'R' was not declared in this scope
   21 |         R += STR[j];
      |         ^
a.cc:21:14: error: 'STR' was not declared in this scope
   21 |         R += STR[j];
      |              ^~~
a.cc:23:7: error: 'STR' was not declared in this scope
   23 |       STR.replace(a, b - a + 1, R);
      |       ^~~
a.cc:23:33: error: 'R' was not declared in this scope
   23 |       STR.replace(a, b - a + 1, R);
      |                                 ^
a.cc:26:19: error: 'STR' was not declared in this scope
   26 |       strcpy(str, STR.c_str());
      |                   ^~~
Language: C++

#include <cstdio>
#include <string>
using namespace std;
int main(){
  char str[1000], cmd[7], p[1000];
  int a, b, q;
  string OUT;
  scanf("%s", str);
  string STR = str;
  scanf("%d", &q);
  for(int i = 0; i < q; i++){
    scanf("%s %d %d", cmd, &a, &b);
    string CMD = cmd;
    if(CMD == "replace"){
      scanf("%s", p);
      string P = p;
      STR.replace(a, b, P);
    }
    else if(CMD == "reverse"){
      string R;
      for(int j = b; j >= a; j--){
	R += STR[j];
      }
      STR.replace(a, b - a + 1, R);
    }
    else if(CMD == "print"){
      for(int k = a; k <= b; k++){
	OUT += STR[k]
      }
      OUT += "\n"
    }
  }
  char* out;
  out = (char*)malloc(strlen(OUT.c_str()) + 1);
  sprintf(out, "%s", OUT.c_str());
  printf("%s", out);
  free(out);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:22: error: expected ';' before '}' token
   28 |         OUT += STR[k]
      |                      ^
      |                      ;
   29 |       }
      |       ~               
a.cc:30:18: error: expected ';' before '}' token
   30 |       OUT += "\n"
      |                  ^
      |                  ;
   31 |     }
      |     ~             
a.cc:34:23: error: 'strlen' was not declared in this scope
   34 |   out = (char*)malloc(strlen(OUT.c_str()) + 1);
      |                       ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <string>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include <cstdio>
#include <string>
using namespace std;
int main(){
  char str[1000], cmd[7], p[1000];
  int a, b, q;
  string OUT;
  scanf("%s", str);
  string STR = str;
  scanf("%d", &q);
  for(int i = 0; i < q; i++){
    scanf("%s %d %d", cmd, &a, &b);
    string CMD = cmd;
    if(CMD == "replace"){
      scanf("%s", p);
      string P = p;
      STR.replace(a, b, P);
    }
    else if(CMD == "reverse"){
      string R;
      for(int j = b; j >= a; j--){
	R += STR[j];
      }
      STR.replace(a, b - a + 1, R);
    }
    else if(CMD == "print"){
      for(int k = a; k <= b; k++){
	OUT += STR[k];
      }
      OUT += "\n"
    }
  }
  char* out;
  out = (char*)malloc(strlen(OUT.c_str()) + 1);
  sprintf(out, "%s", OUT.c_str());
  printf("%s", out);
  free(out);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:18: error: expected ';' before '}' token
   30 |       OUT += "\n"
      |                  ^
      |                  ;
   31 |     }
      |     ~             
a.cc:34:23: error: 'strlen' was not declared in this scope
   34 |   out = (char*)malloc(strlen(OUT.c_str()) + 1);
      |                       ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <string>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include <cstdio>
#include <string>
using namespace std;
int main(){
  char str[1000], cmd[7], p[1000];
  int a, b, q;
  string OUT;
  scanf("%s", str);
  string STR = str;
  scanf("%d", &q);
  for(int i = 0; i < q; i++){
    scanf("%s %d %d", cmd, &a, &b);
    string CMD = cmd;
    if(CMD == "replace"){
      scanf("%s", p);
      string P = p;
      STR.replace(a, b, P);
    }
    else if(CMD == "reverse"){
      string R;
      for(int j = b; j >= a; j--){
	R += STR[j];
      }
      STR.replace(a, b - a + 1, R);
    }
    else if(CMD == "print"){
      for(int k = a; k <= b; k++){
	OUT += STR[k];
      }
      OUT += "\n";
    }
  }
  char* out;
  out = (char*)malloc(strlen(OUT.c_str()) + 1);
  sprintf(out, "%s", OUT.c_str());
  printf("%s", out);
  free(out);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:23: error: 'strlen' was not declared in this scope
   34 |   out = (char*)malloc(strlen(OUT.c_str()) + 1);
      |                       ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <string>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include <cstdio>
#include <cstdlib>
#include <string>
using namespace std;
int main(){
  char str[1000], cmd[7], p[1000];
  int a, b, q;
  string OUT;
  scanf("%s", str);
  string STR = str;
  scanf("%d", &q);
  for(int i = 0; i < q; i++){
    scanf("%s %d %d", cmd, &a, &b);
    string CMD = cmd;
    if(CMD == "replace"){
      scanf("%s", p);
      string P = p;
      STR.replace(a, b, P);
    }
    else if(CMD == "reverse"){
      string R;
      for(int j = b; j >= a; j--){
	R += STR[j];
      }
      STR.replace(a, b - a + 1, R);
    }
    else if(CMD == "print"){
      for(int k = a; k <= b; k++){
	OUT += STR[k];
      }
      OUT += "\n";
    }
  }
  char* out;
  out = (char*)malloc(strlen(OUT.c_str()) + 1);
  sprintf(out, "%s", OUT.c_str());
  printf("%s", out);
  free(out);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:23: error: 'strlen' was not declared in this scope
   35 |   out = (char*)malloc(strlen(OUT.c_str()) + 1);
      |                       ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <string>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main(){
	int q,i,a,b,j;
	string str,m_str,t_str;
	string a_str,b_str;
	string c;

	cin>>str;
	cin>>q;
	for(i = 0;i < q;i++){
		cin>>m_str;
		cin>>a>>b;
		if(m_str == "print")
			cout<<str.substr(a,b-a+1)<<endl;
		else if(m_str == "reverse"){
			reverse(a-1,b);
		}
		else if(m_str == "replace"){
			cin>>t_str;
			str.replace(a-1,t_str.length(),t_str);
		}
	}
	return 0;
}

Compiler output:
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: In instantiation of 'void std::reverse(_BIter, _BIter) [with _BIter = int]':
a.cc:19:11:   required from here
   19 |                         reverse(a-1,b);
      |                         ~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1089:63: error: no matching function for call to '__iterator_category(int&)'
 1089 |       std::__reverse(__first, __last, std::__iterator_category(__first));
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:65,
                 from /usr/include/c++/14/algorithm:60:
/usr/include/c++/14/bits/stl_iterator_base_types.h:239:5: note: candidate: 'template<class _Iter> constexpr typename std::iterator_traits< <template-parameter-1-1> >::iterator_category std::__iterator_category(const _Iter&)'
  239 |     __iterator_category(const _Iter&)
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:239:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_iterator_base_types.h: In substitution of 'template<class _Iter> constexpr typename std::iterator_traits< <template-parameter-1-1> >::iterator_category std::__iterator_category(const _Iter&) [with _Iter = int]':
/usr/include/c++/14/bits/stl_algo.h:1089:63:   required from 'void std::reverse(_BIter, _BIter) [with _BIter = int]'
 1089 |       std::__reverse(__first, __last, std::__iterator_category(__first));
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
a.cc:19:11:   required from here
   19 |                         reverse(a-1,b);
      |                         ~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:239:5: error: no type named 'iterator_category' in 'struct std::iterator_traits<int>'
  239 |     __iterator_category(const _Iter&)
      |     ^~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){
	int q,i,a,b,j;
	string str,m_str,t_str;
	string a_str,b_str;
	string c;

	cin>>str;
	cin>>q;
	for(i = 0;i < q;i++){
		cin>>m_str;
		cin>>a>>b;
		if(m_str == "print")
			cout<<str.substr(a,b-a+1)<<endl;
		else if(m_str == "reverse"){
			reverse(a,b+1);
		}
		else if(m_str == "replace"){
			cin>>t_str;
			str.replace(a,b+1,t_str);
		}
	}
	return 0;
}

Compiler output:
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: In instantiation of 'void std::reverse(_BIter, _BIter) [with _BIter = int]':
a.cc:19:11:   required from here
   19 |                         reverse(a,b+1);
      |                         ~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1089:63: error: no matching function for call to '__iterator_category(int&)'
 1089 |       std::__reverse(__first, __last, std::__iterator_category(__first));
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:65,
                 from /usr/include/c++/14/algorithm:60:
/usr/include/c++/14/bits/stl_iterator_base_types.h:239:5: note: candidate: 'template<class _Iter> constexpr typename std::iterator_traits< <template-parameter-1-1> >::iterator_category std::__iterator_category(const _Iter&)'
  239 |     __iterator_category(const _Iter&)
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:239:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_iterator_base_types.h: In substitution of 'template<class _Iter> constexpr typename std::iterator_traits< <template-parameter-1-1> >::iterator_category std::__iterator_category(const _Iter&) [with _Iter = int]':
/usr/include/c++/14/bits/stl_algo.h:1089:63:   required from 'void std::reverse(_BIter, _BIter) [with _BIter = int]'
 1089 |       std::__reverse(__first, __last, std::__iterator_category(__first));
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
a.cc:19:11:   required from here
   19 |                         reverse(a,b+1);
      |                         ~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:239:5: error: no type named 'iterator_category' in 'struct std::iterator_traits<int>'
  239 |     __iterator_category(const _Iter&)
      |     ^~~~~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;

int main() {
  string str, order, addedStr, tmp;
  int roop, a, b;
  cin >> str;
  cin >> roop;

  for (int i = 0; i < roop; i++) {
    cin >> order;
    cin >> a >> b;
    if (order == "print") {
      cout << str.substr(a, b-(a-1)) << endl;
    }
    else if (order == "reverse") {
      for (int j = b; j >= a; j--) {
        tmp += str.at(j);
      }
      str.replace(a, b-(a-1), tmp);
      tmp = "";
      }
    }
    else {
      cin >> addedStr;
      str.replace(a, b-(a-1), addedStr);
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:5: error: 'else' without a previous 'if'
   24 |     else {
      |     ^~~~
a.cc: At global scope:
a.cc:29:3: error: expected unqualified-id before 'return'
   29 |   return 0;
      |   ^~~~~~
a.cc:30:1: error: expected declaration before '}' token
   30 | }
      | ^
Language: C++

/* ITP1_9_D: Transformation */

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

int main() {
    std::ios::sync_with_stdio(false);

    string str;
    int n_commands;
    std::cin >> str;
    std::cin >> n_commands;

    string command;
    int pos_begin, pos_end;
    for (int i = 0; i < n_commands; i++) {
        std::cin >> command >> pos_begin >> pos_end;
        string::iterator s_begin = str.begin();

        if (command == "print") {
            int length = pos_end - pos_begin + 1;
            std::cout << str.substr(pos_begin, length) << "\n";
        }
        else if (command == "reverse") {
            reverse(s_begin + pos_begin, s_begin + pos_end + 1);
        }
        else if (command == "replace") {
            string rep_str;
            std::cin >> rep_str;
            str.replace(s_begin + pos_begin, s_begin + pos_end + 1, rep_str);
        }
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:13: error: 'reverse' was not declared in this scope
   26 |             reverse(s_begin + pos_begin, s_begin + pos_end + 1);
      |             ^~~~~~~
Language: C++

/* ITP1_9_D: Transformation */

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

int main() {
    std::ios::sync_with_stdio(false);

    string str;
    int n_commands;
    std::cin >> str;
    std::cin >> n_commands;

    string command;
    int pos_begin, pos_end;
    for (int i = 0; i < n_commands; i++) {
        std::cin >> command >> pos_begin >> pos_end;
        string::iterator s_begin = str.begin();

        if (command == "print") {
            int length = pos_end - pos_begin + 1;
            std::cout << str.substr(pos_begin, length) << "\n";
        }
        else if (command == "reverse") {
            std::reverse(s_begin + pos_begin, s_begin + pos_end + 1);
        }
        else if (command == "replace") {
            string rep_str;
            std::cin >> rep_str;
            str.replace(s_begin + pos_begin, s_begin + pos_end + 1, rep_str);
        }
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:18: error: 'reverse' is not a member of 'std'
   26 |             std::reverse(s_begin + pos_begin, s_begin + pos_end + 1);
      |                  ^~~~~~~
Language: C++

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)

int main(){
	string str,W,p;
	long long int q,a,b;
	cin >> str >> q;
	REP(i,q){
		cin >> W >> a >> b;
		if (W == "print"){
			string c(str, a, b - a + 1);
			cout << c << "\n";
		}
		else if (W == "reverse"){
			reverse(str.begin()+a, str.begin()+b+1);
			/*REP(i, (b - a) / 2){
				string k;
				k = str[a+i];
				str[b - i + 1] = k;
				str[a + i] = str[b - i + 1];
			}*/
			cout << str << "\n";
		}
		else if (W == "replace"){
			cin >> p;
			str.replace(a, b, p);
			cout << str << "\n";
		}
	}
	return 0;
}

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

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

int main(){
 int q,a,b;
 string str,com,rep,temp;

 cin >> str >> q;

 for(int i = 0; i < q; i++){
  cin >> com >> a >> b;

  if(com == "print"){
   cout << str.substr(a, b-a+1);
  } else if(com == "reverse") {
   while(a < b){
    temp = str[a];
    str[a] = str[b];
    str[b] = temp;
   
    a++;
    b--;
   }
  } else if(com == "replace"){
   cin >> rep;

   str = str.replace(a, b-a+1, rep);
  }
 }

 cout << str << endl;

 return 0;
}

Compiler output:
a.cc:1:9: fatal error: iosteam: No such file or directory
    1 | #include<iosteam>
      |         ^~~~~~~~~
compilation terminated.
Language: C++

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

int main(){
 int q,a,b;
 string str,com,rep,temp;

 cin >> str >> q;

 for(int i = 0; i < q; i++){
  cin >> com >> a >> b;

  if(com == "print"){
   cout << str.substr(a, b-a+1);
  } else if(com == "reverse") {
   while(a < b){
    temp = str[a];
    str[a] = str[b];
    str[b] = temp;
   
    a++;
    b--;
   }
  } else if(com == "replace"){
   cin >> rep;

   str = str.replace(a, b-a+1, rep);
  }
 }

 cout << str << endl;

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:14: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} in assignment
   20 |     str[b] = temp;
      |              ^~~~
      |              |
      |              std::string {aka std::__cxx11::basic_string<char>}
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <stdio.h>
#include <cstring>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <numeric>
#include <regex>
#include <locale>
#include <fstream>
#include <stdlib.h>
#include <cctype>

//#include <map>

using namespace std;

class cFunc{
public:
	string sfunc;
	int arg1;
	int arg2;
	string arg3;

	cFunc(string s)
	{
		istringstream iss;
		iss.str(s);
		iss >> sfunc >> arg1 >> arg2 >> arg3;
	}
};


int main()
{
	string str;
	vector<string> vf;
	int q;

	cin >> str;
	cin >> q;
	cin.ignore();
	for (int i = 0; i < q; i++)
	{
		string temp;
		getline(cin, temp);
		vf.push_back(temp);
	}

	for (int i = 0; i < q; i++)
	{
		cFunc cf(vf.at(i));
		if (cf.sfunc == "replace")
		{
			str.replace(cf.arg1,cf.arg2 - cf.arg1 + 1,cf.arg3);
		}
		else if (cf.sfunc == "reverse")
		{
			reverse(str.begin() + cf.arg1, str.begin() + cf.arg2 + 1);
		}
		else if (cf.sfunc == "print")
		{
			string temp;
			temp = str.substr(cf.arg1, cf.arg2 - cf.arg1 + 1);
			cout << temp << endl;
		}
	}
	return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:72:18: error: expected '}' at end of input
   72 |         return 0;
      |                  ^
a.cc:39:1: note: to match this '{'
   39 | {
      | ^
Language: C++

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

int main(){
	string str;
	cin >> str;
	long q;
	cin >> q;
	for (long i = 0; i < q; i++){
		long a = 0, b = 0, p = 0;
		string order;
		cin >> order;
		if (order == "print"){
			cin >> a >> b;
			str.substr(a, b - a);
			cout << str << endl;
		}
		else if (order == "reverse"){
			cin >> a >> b;
			reverse(str.begin(), str.end());
		}
		else if (order == "replace"){
			cin >> a >> b >> p;
			str.replace(a, b - a, "p" * (b - a + 1));
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:35: warning: ignoring return value of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::substr(size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
   17 |                         str.substr(a, b - a);
      |                         ~~~~~~~~~~^~~~~~~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:3208:7: note: declared here
 3208 |       substr(size_type __pos = 0, size_type __n = npos) const
      |       ^~~~~~
a.cc:26:51: error: invalid operands of types 'const char [2]' and 'long int' to binary 'operator*'
   26 |                         str.replace(a, b - a, "p" * (b - a + 1));
      |                                               ~~~ ^ ~~~~~~~~~~~
      |                                               |            |
      |                                               |            long int
      |                                               const char [2]
Language: C++

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

int main(){
	string str;
	cin >> str;
	long q;
	cin >> q;
	for (long i = 0; i < q; i++){
		long a = 0, b = 0;
		string p;
		string order;
		cin >> order;
		if (order == "print"){
			cin >> a >> b;
			str.substr(a, b - a + 1);
			cout << str << endl;
		}
		else if (order == "reverse"){
			cin >> a >> b;
			string str2;
			str2 = str;
			str2.substr(a, b - a + 1);
			reverse(str2.begin(), str2.end());
			str.replace(a, b - a + 1, str2)
		}
		else if (order == "replace"){
			cin >> a >> b >> p;
			str.replace(a, b - a + 1, p);
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:35: warning: ignoring return value of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::substr(size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
   18 |                         str.substr(a, b - a + 1);
      |                         ~~~~~~~~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:3208:7: note: declared here
 3208 |       substr(size_type __pos = 0, size_type __n = npos) const
      |       ^~~~~~
a.cc:25:36: warning: ignoring return value of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::substr(size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
   25 |                         str2.substr(a, b - a + 1);
      |                         ~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3208:7: note: declared here
 3208 |       substr(size_type __pos = 0, size_type __n = npos) const
      |       ^~~~~~
a.cc:27:56: error: expected ';' before '}' token
   27 |                         str.replace(a, b - a + 1, str2)
      |                                                        ^
      |                                                        ;
   28 |                 }
      |                 ~
Language: C++

import scala.io.StdIn._

object Main {
  def transformation(s: String, n: Int, l: List[String] = Nil): List[String] = {
    if (n > 0) {
      val transformType = readLine().split(" ")
      val start = transformType(1).toInt
      val end = transformType(2).toInt + 1
      val to = transformType(2).toInt - start + 1
      transformType(0) match {
        case "print"   => transformation(s, n - 1, l :+ s.slice(start, end))
        case "replace" => transformation(s.patch(start, transformType(3), to), n - 1, l)
        case "reverse" =>
          val reverseText = s.slice(start, end).reverse
          val sReverse = s.patch(start, reverseText, to)
          transformation(sReverse, n - 1, l)
      }
    } else l
  }

  def main(args: Array[String]): Unit = {
    val originText = readLine()
    val transformNum = readInt()
    transformation(originText, transformNum).foreach(println)
  }
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import scala.io.StdIn._
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <iostream>
using namespace std;

#include <stdio.h>

#include <string>
/********
*	???????????????
*********/	
/*********??¢?????´?????????
*	(1)??????????????\???
*	(2)????????????????????????
*********/

int main(void)
{
	string str;
	string command;
	string print   ="print";		//strstr ??? a??????????????? b??????????????§??????????????????
	string replace ="replace";		//strstr ??? a??????????????? b??????????????§??? p?????????????????????
	string reverse ="reverse";		//strstr ??? a??????????????? b??????????????§?????????????????????
	string p ;
	int a , b;
	int q ;
	string rrr;
	int s;
	
	
	cin >> str;
	cin >> q;

	s = str.length();
	
	for(int i =0; i < q ; i++){
		
		cin >> command >> a >> b;
		
		if(command == print ){
			cout << str.substr(a, b+1) << endl;
		}
		else if(command == replace){
			cin >> p ;
			str  = str.replace(a, b, p).c_str();//.c_str()???????????????
//			cout << str << endl;
		}
		else if(command == reverse ){
			rrr = str.substr(a, b+1);
//			cout << rrr<< endl;
			std::reverse(rrr.begin(), rrr.end());
			str = str.substr(0,a)+ rrr +  str.substr(b+1,s);
		}
		else {
			//??????????????\??????
		}
//		cout << str << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:30: error: 'reverse' is not a member of 'std'
   49 |                         std::reverse(rrr.begin(), rrr.end());
      |                              ^~~~~~~
Language: C++

#include <iostream>
using namespace std;

#include <stdio.h>
#include<vector>
#include <string>
/********
*	???????????????
*********/	
/*********??¢?????´?????????
*	(1)??????????????\???
*	(2)????????????????????????
*********/

int main(void)
{
	string str;
	string command;
	string print   ="print";		//strstr ??? a??????????????? b??????????????§??????????????????
	string replace ="replace";		//strstr ??? a??????????????? b??????????????§??? p?????????????????????
	string reverse ="reverse";		//strstr ??? a??????????????? b??????????????§?????????????????????
	string p ;
	int a , b;
	int q ;
	string rrr;
	int s;
	
	
	cin >> str;
	cin >> q;

	s = str.length();
	
	for(int i =0; i < q ; i++){
		
		cin >> command >> a >> b;
		
		if(command == print ){
			cout << str.substr(a, b+1) << endl;
		}
		else if(command == replace){
			cin >> p ;
			str  = str.replace(a, b, p).c_str();//.c_str()???????????????
//			cout << str << endl;
		}
		else if(command == reverse ){
			rrr = str.substr(a, b+1);
//			cout << rrr<< endl;
			std::reverse(rrr.begin(), rrr.end());
			str = str.substr(0,a)+ rrr +  str.substr(b+1,s);
		}
		else {
			//??????????????\??????
		}
//		cout << str << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:30: error: 'reverse' is not a member of 'std'
   49 |                         std::reverse(rrr.begin(), rrr.end());
      |                              ^~~~~~~
Language: C++

#include <iostream>
using namespace std;
 
#include <stdio.h>
#include <string>
/********
*   文字列変換
*********/ 
 
int main(void)
{
	string str;
	string command;
	string print   ="print";        //str の a 文字目から b 文字目までを出力する。
	string replace ="replace";      //str の a 文字目から b 文字目までを逆順にする。
	string reverse ="reverse";      //str の a 文字目から b 文字目までを p に置き換える。
	string p ;
	int a , b;
	int q ;
	string rrr;
	int s;
	 
	 
	cin >> str;
	cin >> q;
	
	s = str.length();
	 
	for(int i =0; i < q ; i++){
	     
	    cin >> command >> a >> b;
	     
	    if(command == print ){
	        cout << str.substr(a, b+1) << endl;
	    }
	    else if(command == replace){
	        cin >> p ;
	        str  = str.replace(a, b, p).c_str();
	    }
	    else if(command == reverse ){
			rrr = str.substr(a, b+1);
	        std::reverse(rrr.begin(), rrr.end());
	        str = str.substr(0,a)+ rrr +  str.substr(b+1,s);
	    }
	    else {
	    	//
	    }

	}
	return 0;
}

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

#include <iostream>
#include <string>
using namespace std;
int main() {
	string s, t, r;
	int n, a, b;
	cin >> s >> n;
	for (int i = 0; i < n; i++) {
		cin >> t >> a >> b;
		if (t == "print")
			cout << s.substr(a, b - a + 1) << endl;
		else if (t == "reverse")
			reverse(s.begin() + a, s.begin() + b + 1);
		else {
			cin >> r;
			s.replace(a, b - a + 1, r);
		}
	}
}

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

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

int main() {
    string str, order;
    int q, a, b;
    cin >> str;
    cin >> q;
    while(q--){
        cin >> order >> a >> b;
        if(order=="replace"){
            cin >> order;
            str.replace(str.begin()+a, str.begin()+b+1, order);
        }
        else if(order=="reverse"){
            reverse(str.begin()+a, str.begin()+b+1);
        }
        else{
            cout << str.substr(a, b-a+1) << endl;
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin >> str;
      |     ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <cctype>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:17:13: error: 'reverse' was not declared in this scope
   17 |             reverse(str.begin()+a, str.begin()+b+1);
      |             ^~~~~~~
a.cc:20:13: error: 'cout' was not declared in this scope
   20 |             cout << str.substr(a, b-a+1) << endl;
      |             ^~~~
a.cc:20:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:20:45: error: 'endl' was not declared in this scope
   20 |             cout << str.substr(a, b-a+1) << endl;
      |                                             ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include <cctype>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

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

int main() {
    string str, order;
    int q, a, b;
    cin >> str;
    cin >> q;
    while(q--){
        cin >> order >> a >> b;
        if(order=="replace"){
            cin >> order;
            str.replace(str.begin()+a, str.begin()+b+1, order);
        }
        else if(order=="reverse"){
            reverse(str.begin()+a, str.begin()+b+1);
        }
        else{
            cout << str.substr(a, b-a+1) << endl;
        }
    }
    return 0;
}

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

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

int main() {
    string str, order;
    int q, a, b;
    cin >> str;
    cin >> q;
    while(q--){
        cin >> order >> a >> b;
        if(order=="replace"){
            cin >> order;
            str.replace(str.begin()+a, str.begin()+b+1, order);
        }
        else if(order=="reverse"){
            reverse(str.begin()+a, str.begin()+b+1);
        }
        else{
            cout << str.substr(a, b-a+1) << endl;
        }
    }
    return 0;
}
}

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

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <boost/algorithm/string.hpp>
using namespace std;

class string19d {
private:
  string target;
public:
  string19d(string tar) {
    target = tar;
  }
  void print(int a, int b) {
    for (int i = a; i <= b; i++) {
      cout << target[i];
    }
    cout << endl;
  }
  void reverse19d(int a, int b) {
    reverse(target.begin()+a, target.begin()+b+1);
  }
  void replace19d(int a, int b, string p) {
    int c = b-a+1;
    target.replace(a, c, p);
  }
};

int main() {
  string target;
  cin >> target;
  string19d str(target);
  int num;
  cin >> num;
  num += 1;
  while (num) {
    string command;
    getline(cin,command);
    //    cout << "command is " << command;
    vector<string> list_string;
    string delim(" ");
    boost::split(list_string, command, boost::is_any_of(delim));
    int a = atoi(list_string[1].c_str());
    int b = atoi(list_string[2].c_str());
    if (list_string[0] == "print") {
      str.print(a, b);
    } else if (list_string[0] == "reverse") {
      str.reverse19d(a, b);
    } else if (list_string[0] == "replace") {
      str.replace19d(a, b, list_string[3]);
    }
    num--;
  }
  return 0;
}

Compiler output:
a.cc:5:10: fatal error: boost/algorithm/string.hpp: No such file or directory
    5 | #include <boost/algorithm/string.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#def area###############################
def pr(s,a,b):
	print s[int(a):int(b)+1]

def rv(s,a,b):
	tmp=s[::-1]
	news=s[:int(a)]+tmp[len(tmp)-int(b)-1:len(tmp)-int(a)]+s[int(b)+1:]
	return news
def rp(s,a,b,p):
	news=s[:int(a)]+p+s[int(b)+1:]
	return news
########################################


I=raw_input()
n=int(input())
for i in range(n):
	k=raw_input().split(" ")
	if k[0]=="replace":
		I=rp(I,k[1],k[2],k[3])
	elif k[0]=="reverse":
		I=rv(I,k[1],k[2])
	elif k[0]=="print":
		pr(I,k[1],k[2])

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #def; did you mean #ifdef?
    1 | #def area###############################
      |  ^~~
      |  ifdef
a.cc:12:1: error: stray '##' in program
   12 | ########################################
      | ^~
a.cc:12:3: error: stray '##' in program
   12 | ########################################
      |   ^~
a.cc:12:5: error: stray '##' in program
   12 | ########################################
      |     ^~
a.cc:12:7: error: stray '##' in program
   12 | ########################################
      |       ^~
a.cc:12:9: error: stray '##' in program
   12 | ########################################
      |         ^~
a.cc:12:11: error: stray '##' in program
   12 | ########################################
      |           ^~
a.cc:12:13: error: stray '##' in program
   12 | ########################################
      |             ^~
a.cc:12:15: error: stray '##' in program
   12 | ########################################
      |               ^~
a.cc:12:17: error: stray '##' in program
   12 | ########################################
      |                 ^~
a.cc:12:19: error: stray '##' in program
   12 | ########################################
      |                   ^~
a.cc:12:21: error: stray '##' in program
   12 | ########################################
      |                     ^~
a.cc:12:23: error: stray '##' in program
   12 | ########################################
      |                       ^~
a.cc:12:25: error: stray '##' in program
   12 | ########################################
      |                         ^~
a.cc:12:27: error: stray '##' in program
   12 | ########################################
      |                           ^~
a.cc:12:29: error: stray '##' in program
   12 | ########################################
      |                             ^~
a.cc:12:31: error: stray '##' in program
   12 | ########################################
      |                               ^~
a.cc:12:33: error: stray '##' in program
   12 | ########################################
      |                                 ^~
a.cc:12:35: error: stray '##' in program
   12 | ########################################
      |                                   ^~
a.cc:12:37: error: stray '##' in program
   12 | ########################################
      |                                     ^~
a.cc:12:39: error: stray '##' in program
   12 | ########################################
      |                                       ^~
a.cc:2:1: error: 'def' does not name a type
    2 | def pr(s,a,b):
      | ^~~
Language: C++

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

int main() {
  string str;
  int q;
  string order, p;
  int a, b;
  string substr;

  cin >> str >> q;
  for (int i = 0; i < q; i++) {
    cin >> order >> a >> b;
    if (order == "print") {
      cout << str.substr(a, b - a + 1) << endl;
    } else if (order == "reverse") {
      substr = str.substr(a, b - a + 1);
      reverse(substr.begin(), substr.end());
      str = str.replace(a, b - a + 1, substr);
    } else {
      cin >> p;
      str = str.replace(a, b - a + 1, p);
    }
  }

  return 0;
}

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

#include<iostream>
#include <cstdio>
#include<cctype>
#include <algorithm>
#include<string>

using namespace std;

int main(){
	int cnt = 0,a = 0,b = 0;
	string str;
	
	cin >> str;
	cin >> cnt;
	
	while(cnt--){
		cin >> cmd >> a >> b;
		switch(cmd){
			case "print":
				cout << str.substr(a,b-a+1) << endl;
				break;
			case "reverse":
				for(int i = b; i = a; i--){
					swap(str[i],str[a+(b-i)]);
				}
				break;
			case "replace":
				cin >> p;
				for(int i = a; i = b; i++){
					str.substr(0,a-1) + p + str.substr(b+1,str.length());
				}
				break;
		}
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:24: error: 'cmd' was not declared in this scope
   17 |                 cin >> cmd >> a >> b;
      |                        ^~~
a.cc:28:40: error: 'p' was not declared in this scope
   28 |                                 cin >> p;
      |                                        ^
Language: C++

#include<iostream>
#include <cstdio>
#include<cctype>
#include <algorithm>
#include<string>

using namespace std;

int main(){
	int cnt = 0,a = 0,b = 0;
	string str, cmd , p;
	
	cin >> str;
	cin >> cnt;
	
	while(cnt--){
		cin >> cmd >> a >> b;
		switch(cmd){
			case "print":
				cout << str.substr(a,b-a+1) << endl;
				break;
			case "reverse":
				for(int i = b; i = a; i--){
					swap(str[i],str[a+(b-i)]);
				}
				break;
			case "replace":
				cin >> p;
				for(int i = a; i = b; i++){
					str.substr(0,a-1) + p + str.substr(b+1,str.length());
				}
				break;
		}
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:24: error: switch quantity not an integer
   18 |                 switch(cmd){
      |                        ^~~
a.cc:30:92: warning: ignoring return value of 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&) [with _CharT = char; _Traits = char_traits<char>; _Alloc = allocator<char>]', declared with attribute 'nodiscard' [-Wunused-result]
   30 |                                         str.substr(0,a-1) + p + str.substr(b+1,str.length());
      |                                                                                            ^
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:3696:5: note: declared here
 3696 |     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
      |     ^~~~~~~~
Language: C++

#include<iostream>
#include <cstdio>
#include<cctype>
#include <algorithm>
#include<string>

using namespace std;

int main(){
	int cnt = 0,a = 0,b = 0;
	string str, cmd , p;
	
	cin >> str;
	cin >> cnt;
	
	for(int x = 0; x < cnt; x++){
		cin >> cmd >> a >> b;
	
		if (cmd == "print"){
			cout << str.substr(a,b-a+1) << endl;
		}
		else if (cmd == "reverse"){
			reverse(str.begin()+a,str.begin()+b+1);
		}
		else if (cmd == "replace"){
			cin >> p;
			replace(a,p.length(),p);
		}
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:32: error: no matching function for call to 'replace(int&, std::__cxx11::basic_string<char>::size_type, std::string&)'
   27 |                         replace(a,p.length(),p);
      |                         ~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: candidate: 'template<class _FIter, class _Tp> void std::replace(_FIter, _FIter, const _Tp&, const _Tp&)'
 4280 |     replace(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note:   candidate expects 4 arguments, 3 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::replace(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&, const _Tp&)'
  174 | replace(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value,
      | ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note:   candidate expects 5 arguments, 3 provided
Language: C++

#include<iostream>
#include <cstdio>
#include<cctype>
#include <algorithm>
#include<string>

using namespace std;

int main(){
	int cnt = 0,a = 0,b = 0;
	string str, cmd , p;
	
	cin >> str;
	cin >> cnt;
	
	for(int x = 0; x < cnt; x++){
		cin >> cmd >> a >> b;
	
		if (cmd == "print"){
			cout << str.substr(a,b-a+1) << endl;
		}
		else if (cmd == "reverse"){
			str.reverse(str.begin()+a,str.begin()+b+1);
		}
		else if (cmd == "replace"){
			cin >> p;
			replace(a,p.length(),p);
		}
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:29: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'reverse'; did you mean 'reserve'?
   23 |                         str.reverse(str.begin()+a,str.begin()+b+1);
      |                             ^~~~~~~
      |                             reserve
a.cc:27:32: error: no matching function for call to 'replace(int&, std::__cxx11::basic_string<char>::size_type, std::string&)'
   27 |                         replace(a,p.length(),p);
      |                         ~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:4280:5: note: candidate: 'template<class _FIter, class _Tp> void std::replace(_FIter, _FIter, const _Tp&, const _Tp&)'
 4280 |     replace(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4280:5: note:   candidate expects 4 arguments, 3 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::replace(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&, const _Tp&)'
  174 | replace(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __old_value,
      | ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:174:1: note:   candidate expects 5 arguments, 3 provided
Language: C++

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

int main(){
  string str, p, order;
  int q, a, b;

  cin >> str;
  cin >> q;

  for(int i = 0; i < q; i++){
    cin >> order >> a >> b;
    if(order == "replace") {
      cin >> p;
      str.replace(a, b - a + 1, p);
    }
    else if(order == "reverse") reverse(str.begin(), str.end());
    else cout << str.substr(a, b) << endl;
  }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:33: error: 'reverse' was not declared in this scope
   18 |     else if(order == "reverse") reverse(str.begin(), str.end());
      |                                 ^~~~~~~
Language: C++

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

int main(){
  string str, p, order;
  int q, a, b;

  cin >> str;
  cin >> q;

  for(int i = 0; i < q; i++){
    cin >> order >> a >> b;
    if(order == "replace") {
      cin >> p;
      str.replace(a, b - a + 1, p);
    }
    else if(order == "reverse") reverse(str.begin(), str.end());
    else cout << str.substr(a, b) << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:33: error: 'reverse' was not declared in this scope
   18 |     else if(order == "reverse") reverse(str.begin(), str.end());
      |                                 ^~~~~~~
Language: C++

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

int main(){
  string str, p, order;
  int q, a, b;

  cin >> str;
  cin >> q;

  for(int i = 0; i < q; i++){
    cin >> order >> a >> b;
    if(order == "replace") {
      cin >> p;
      str.replace(a, b - a + 1, p);
    }
    else if(order == "reverse") reverse(str.begin(), str.end());
    else cout << str.substr(a, b) << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:33: error: 'reverse' was not declared in this scope
   18 |     else if(order == "reverse") reverse(str.begin(), str.end());
      |                                 ^~~~~~~