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

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

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

 cin >> str >> q;

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

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:33: error: 's' was not declared in this scope
   14 |   else if(op=="reverse")reverse(s.begin()+1,s.begin()+b+1);
      |                                 ^
a.cc:14:25: error: 'reverse' was not declared in this scope
   14 |   else if(op=="reverse")reverse(s.begin()+1,s.begin()+b+1);
      |                         ^~~~~~~
a.cc:17:4: error: 's' was not declared in this scope
   17 |    s=s.substr(0,a)+p+s.substr(b+1,s.length()-b-1);
      |    ^
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

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

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

 cin >> str >> q;

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

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:33: error: 's' was not declared in this scope
   14 |   else if(op=="reverse")reverse(s.begin()+a,s.begin()+b+1);
      |                                 ^
a.cc:14:25: error: 'reverse' was not declared in this scope
   14 |   else if(op=="reverse")reverse(s.begin()+a,s.begin()+b+1);
      |                         ^~~~~~~
a.cc:17:4: error: 's' was not declared in this scope
   17 |    s=s.substr(0,a)+p+s.substr(b+1,s.length()-b-1);
      |    ^
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

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

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

 cin >> str >> q;

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

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:25: error: 'reverse' was not declared in this scope
   14 |   else if(op=="reverse")reverse(str.begin()+a,str.begin()+b+1);
      |                         ^~~~~~~
a.cc:17:4: error: 's' was not declared in this scope
   17 |    s=str.substr(0,a)+p+str.substr(b+1,s.length()-b-1);
      |    ^
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

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

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

 cin >> str >> q;

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

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:25: error: 'reverse' was not declared in this scope
   14 |   else if(op=="reverse")reverse(str.begin()+a,str.begin()+b+1);
      |                         ^~~~~~~
a.cc:17:4: error: 's' was not declared in this scope
   17 |    s=str.substr(0,a)+p+str.substr(b+1,str.length()-b-1);
      |    ^
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

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

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

 cin >> str >> q;

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

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:25: error: 'reverse' was not declared in this scope
   14 |   else if(op=="reverse")reverse(str.begin()+a,str.begin()+b+1);
      |                         ^~~~~~~
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

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

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

 cin >> str >> q;

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

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:25: error: 'reverse' was not declared in this scope
   14 |   else if(op=="reverse")reverse(str.begin()+a,str.begin()+b+1);
      |                         ^~~~~~~
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

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

int main(){
 string s,p,op;
 int a,b,q;

 cin >> s >> q;

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

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:25: error: 'reverse' was not declared in this scope
   14 |   else if(op=="reverse")reverse(s.begin()+a,s.begin()+b+1);
      |                         ^~~~~~~
a.cc:17:6: error: 'str' was not declared in this scope; did you mean 'std'?
   17 |    s=str.substr(0,a)+p+s.substr(b+1,s.length()-b-1);
      |      ^~~
      |      std
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

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

int main(){
 string s,p,op;
 int a,b,q;

 cin >> s >> q;

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

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:25: error: 'reverse' was not declared in this scope
   14 |   else if(op=="reverse")reverse(s.begin()+a,s.begin()+b+1);
      |                         ^~~~~~~
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

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

int main(){
 string s,p,op;
 int a,b,q;

 cin >> s >> q;

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

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:25: error: 'reverse' was not declared in this scope
   15 |   else if(op=="reverse")reverse(s.begin()+a,s.begin()+b+1);
      |                         ^~~~~~~
a.cc:22:2: error: expected '}' at end of input
   22 | }
      |  ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

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

int main(){
 string s,p,op;
 int a,b,q;

 cin >> s >> q;

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

 return 0;
}

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

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

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

#include <string.h>
int main(){
  int i,j,q,x,y;
  char str[1000],str2[1000],w[1000],r;
  scanf("%s,%d",str,&q);
  for(i=0;i<q;i++){
    scanf("%s",str2);
    if(strcmp(str2,"replace")==0){
      scanf("%d %d %s",&x,&y,w);
      for(j=x;j<y;j++){
        str[j]=w[j-x];
      }
    }
    else if(strcmp(str2,"reverse")==0){
      scanf("%d %d",&x,&y);
      while(x<y){
        r=str[x];
        str[x]=str[y];
        str[y]=r;
        x++;
        y--;
      }
    }
    else if(strcmp(str2,"printf")==0){
      scanf("%d %d",&x,&y){
        for(j=x;j<x;j++){
          printf("%c",str[j])
        }
        printf("\n");
      }
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'scanf' was not declared in this scope
    5 |   scanf("%s,%d",str,&q);
      |   ^~~~~
Language: C++

#include <string.h>
#include <stdio.h>
int main(){
  int i,j,q,x,y;
  char str[1000],str2[1000],w[1000],r;
  scanf("%s %d",str,&q);
  for(i=0;i<q;i++){
    scanf("%s",str2);
    if(strcmp(str2,"replace")==0){
      scanf("%d %d %s",&x,&y,w);
      for(j=x;j<y;j++){
        str[j]=w[j-x];
      }
    }
    else if(strcmp(str2,"reverse")==0){
      scanf("%d %d",&x,&y);
      while(x<y){
        r=str[x];
        str[x]=str[y];
        str[y]=r;
        x++;
        y--;
      }
    }
    else if(strcmp(str2,"printf")==0){
      scanf("%d %d",&x,&y){
        for(j=x;j<x;j++){
          printf("%c",str[j])
        }
        printf("\n");
      }
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:27: error: expected ';' before '{' token
   26 |       scanf("%d %d",&x,&y){
      |                           ^
      |                           ;
Language: C++

#include <string.h>
#include <stdio.h>
int main(){
  int i,j,q,x,y;
  char str[1000],str2[1000],w[1000],r;
  scanf("%s %d",str,&q);
  for(i=0;i<q;i++){
    scanf("%s",str2);
    if(strcmp(str2,"replace")==0){
      scanf("%d %d %s",&x,&y,w);
      for(j=x;j<y;j++){
        str[j]=w[j-x];
      }
    }
    else if(strcmp(str2,"reverse")==0){
      scanf("%d %d",&x,&y);
      while(x<y){
        r=str[x];
        str[x]=str[y];
        str[y]=r;
        x++;
        y--;
      }
    }
    else if(strcmp(str2,"printf")==0){
      scanf("%d %d",&x,&y);
        for(j=x;j<x;j++){
          printf("%c",str[j])
        printf("\n");
      }
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:30: error: expected ';' before 'printf'
   28 |           printf("%c",str[j])
      |                              ^
      |                              ;
   29 |         printf("\n");
      |         ~~~~~~
Language: C++

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


int main()
{
	string str, order, repStr;
	cin >> str;

	int n = 0;
	cin >> n;
	int ord1 = 0, ord2 = 0;
	while (n--) {
		cin >> order;
		cin >> ord1 >> ord2;

		if (order == "replace") {
			cin >> repStr;
			str.replace(ord1, ord2 - ord1 + 1, repStr);
		}else if (order == "reverse"){
			
			repStr = str.substr(ord1, ord2+1);
			reverse(repStr.begin(), repStr.end());
			str.replace(ord1, ord2 - ord1 + 1, repStr);
		}
		else if (order == "print") {
			cout << str.substr(ord1, ord2+1) << endl;
		}
	}
    return 0;
}

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

#include <iostream>
#include <string>
#include <sstream>

int main() {
  std::string str;
  std::cin >> str;

  int n;
  std::cin >> n;

  std::stringstream ss;
  std::string command;
  int a, b;
  for(int i = 0; i < n; ++i) {
    std::cin >> command >> a >> b;
    if(command == "replace") {
      std::string replace
      std::cin >> replace;
      int idx = 0;
      for(int j = a; j < b; ++j) {
        str[i] = replace[idx];
        idx++;
      }
    }
    else if(command == "reverse") {
      std::string rev = str.substr(a, b);
      int idx = b - 1;
      for(int j = a; j < b; ++j) {
        str[a] = rev[idx];
        idx--;
      }
    }
    else if(command == "print") {
      for(int j = a; j < b; ++j) {
        std::cout << str[j];
      }
      std::cout << std::endl;
    }
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:7: error: expected initializer before 'std'
   19 |       std::cin >> replace;
      |       ^~~
a.cc:22:18: error: 'replace' was not declared in this scope
   22 |         str[i] = replace[idx];
      |                  ^~~~~~~
Language: C++

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

int main()
{
	string strInput, strTemp;
	int nCount;
	int i, j;
	cin >> strInput;
	cin >> nCount;
	while (nCount--)
	{
		cin >> strTemp >> i >> j;
		if ("reverse" == strTemp)
		{
			reverse(strInput.begin() + i, strInput.begin() + j + 1); //j+1
		}
		else if ("replace" == strTemp)
		{
			cin >> strTemp;
			strInput = strInput.replace(i, j, strTemp);
			cout << strInput << endl;
		}
		else
		{
			cout << strInput.substr(i, j + 1) << endl;
		}
	}
	//system("pause");
	return 0;
}

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

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

int main()
{
	string strInput, strTemp;
	int nCount;
	int i, j;
	cin >> strInput;
	cin >> nCount;
	while (nCount--)
	{
		cin >> strTemp >> i >> j;
		if ("reverse" == strTemp)
		{
			reverse(strInput.begin() + i, strInput.begin() + j + 1); //j+1
		}
		else if ("replace" == strTemp)
		{
			cin >> strTemp;
			strInput = strInput.replace(i, j, strTemp);
			cout << strInput << endl;
		}
		else
		{
			cout << strInput.substr(i, j + 1) << endl;
		}
	}
	//system("pause");
	return 0;
}

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

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

int main()
{
	string str;
	cin >> str;
	int n;
	cin >> n;
	string buf;
	for( int i = 0; i < n; i++ ) {
		cin >> buf;
		if( buf == "replace" ) {
			int a, b;
			string ptn;
			cin >> a >> b >> ptn;
			str.replace( a, b, ptn );
		}
		if( buf == "reverse" ) {
			int a, b;
			cin >> a >> b;
			auto itr = str.begin();
			reverse( itr + a, itr + b + 1 );
		}
		if( buf == "print" ) {
			int a, b;
			cin >> a >> b;
			cout << str.substr( a, b + 1 ) << endl;
		}
	}
	return 0;
}

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

#include <iostream>
#include <string>

using namespace std;

int main()
{
  string str, order;
  int n;
  cin >> str >> n;

  for (int i = 0; i < n; i++)
  {
    int a, b;
    cin >> order >> a >> b;
    if (order == "print")
      cout << str.substr(a, b - a + 1) << endl;
    else if (order == "reverse")
      reverse(&str[a], &str[b + 1]);
    else
    {
      string s;
      cin >> s;
      str.replace(a, b - a + 1, s);
    }
  }

  return 0;
}

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

import scala.io.Source

object Main {

  def transform(target: String, cmd: Array[String]) = cmd(0) match {
    case "print" => { println(target.slice(cmd(1).toInt, cmd(2).toInt+1)); target }
    case "reverse" => target.take(cmd(1).toInt) + target.slice(cmd(1).toInt, cmd(2).toInt+1).reverse + target.drop(cmd(2).toInt+1)
    case "replace" => target.take(cmd(1).toInt) + cmd(3) + target.drop(cmd(2).toInt+1)
  }

  def main(args: Array[String]): Unit = {
    val src = Source.stdin.getLines
    val target = src.next
    src.next
    src.map(_.split(" ")).foldLeft(target)(transform)
  }

}

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

#include<iostream>
#include<string>

using namespace std;

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


		}



	}










	return 0;
}

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

#include<iostream>
#include<string>

using namespace std;

int main(){

	


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


		}



	}


	







	return 0;
}

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

#include<iostream>
#include<string>

using namespace std;

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

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

#include<iostream>
#include<string>

using namespace std;

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

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

#include<iostream>
#include<string>

using namespace std;

int main(){
	int n;
	int a = 0;
	int b = 0;
	string str;
	string com;
	
	cin >> str;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> com;
		if (com=="print")
		{
			cin >> a >> b;
			string sub = str.substr(a, b+1);
			cout << sub << endl;
		}
		if (com=="replace")
		{
			cin >> a >> b;
			string sub;
			cin >> sub;
			str.replace(a, b, sub);
		}
		if (com=="reverse")
		{
			cin >> a >> b;
			string sub = str.substr(a, b-a+1);
			reverse(sub.begin(),sub.end());
			str.replace(a, b - a + 1, sub);
		}
	}
	return 0;
}

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

#include<iostream>
#include<string>

using namespace std;

int main(){
	int n;
	int a = 0;
	int b = 0;
	string str;
	string com;
	
	cin >> str;
	cin >> n;
	for (int i = 0; i < n; i++)
	{

		cin >> com;

cin >> a >> b;

		if (com=="print")
		{
			
			string sub = str.substr(a, b+1);
			cout << sub << endl;
		}
		if (com=="replace")
		{
			//cin >> a >> b;
			string sub;
			cin >> sub;
			str.replace(a, b, sub);
		}
		if (com=="reverse")
		{
			//cin >> a >> b;
			string sub = str.substr(a, b-a+1);
			reverse(sub.begin(),sub.end());
			str.replace(a, b - a + 1, sub);
		}
	}
	return 0;
}

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

#include<iostream>
#include<string>

using namespace std;

int main(){
	int n;
	int a = 0;
	int b = 0;
	string str;
	string com;
	string sub;

	cin >> str;
	cin >> n;
	for (int i = 0; i < n; i++)
	{

		cin >> com;

cin >> sub >>a >> b;

		if (com=="print")
		{
			
			/*string*/sub = str.substr(a, b+1);
			cout << sub << endl;
		}
		if (com=="replace")
		{
			//cin >> a >> b;
			/*string sub;
			cin >> sub;*/
			str.replace(a, b, sub);
		}
		if (com=="reverse")
		{
			//cin >> a >> b;
			/*string*/ sub = str.substr(a, b-a+1);
			reverse(sub.begin(),sub.end());
			str.replace(a, b - a + 1, sub);
		}
	}
	return 0;
}

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

#include<iostream>
#include<string>

using namespace std;

int main(){
	int n;
	int a = 0;
	int b = 0;
	string str;
	string com;
	
	cin >> str;
	cin >> n;
	for (int i = 0; i < n; i++)
	{

		cin >> com;



		if (com=="print")
		{
			cin >> a >> b;
			string sub = str.substr(a, b+1);
			cout << sub << endl;
		}
		if (com=="replace")
		{
			cin >> a >> b;
			string sub;
			cin >> sub;
			str.replace(a, b, sub);
		}
		if (com=="reverse")
		{
			cin >> a >> b;
			string sub = str.substr(a, b-a+1);
			reverse(sub.begin(),sub.end());
			str.replace(a, b - a + 1, sub);
		}
	}
	return 0;
}

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

#include<iostream>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstdlib>

using namespace std;
int main(){

  string str;
  int n;
  cin >> str >> n;

  for(int i=0;i<n;i++){
    string cmd;
    cin >> cmd;

    if(cmd.compare("print") == 0){
      int a,b;
      cin >> a >> b;
      for(int j=a;j<=b;j++){
        cout << str[j];
      }
      cout << endl;
    }else if(cmd.compare("reverse") == 0){
      int a,b;
      cin >> a >> b;
      string tmp = str.substr(a,(b-a+1));
      for(int j=0,l=tmp.size();j<l;j++){
        str[j+a] = tmp[(l-1)-j-];
      }
    }else if(cmd.compare("replace" ) == 0) {
      int a,b;
      cin >> a >> b;
      string p;
      cin >> p;
      for(int j=0;j<p.size();j++){
        str[j+a] = p[j];
      }
    }
  }


}





Compiler output:
a.cc: In function 'int main()':
a.cc:32:32: error: expected primary-expression before ']' token
   32 |         str[j+a] = tmp[(l-1)-j-];
      |                                ^
Language: C++

#include <iostream>

using namespace std;
int main(int argc, char *argv[])
{
    int n, a, b;
    string str, command, buff;
    cin >> str >> n;
    while (n--)
    {
        cin >> command >> a >> b;
        if (command == "print")
        {
            cout << str.substr(a, b - a + 1) << endl;
        }
        else if (command == "reverse")
        {
            reverse(str.begin() + a, str.begin() + b + 1);
        }
        else if (command == "replace")
        {
            cin >> buff;
            str.replace(a, b - a + 1, buff);
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
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>

using namespace std;
int main(int argc, char *argv[])
{
    int n, a, b;
    string str, command, buff;
    cin >> str >> n;
    while (n--)
    {
        cin >> command >> a >> b;
        if (command == "print")
        {
            cout << str.substr(a, b - a + 1) << endl;
        }
        else if (command == "reverse")
        {
            reverse(str.begin() + a, str.begin() + b + 1);
        }
        else if (command == "replace")
        {
            cin >> buff;
            str.replace(a, b - a + 1, buff);
        }
    }
    return 0;
}


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

#include <iostream>
#include <string>

using namespace std;
int main(int argc, char *argv[])
{
    int n, a, b;
    string str, command, buff;
    cin >> str >> n;
    while (n--)
    {
        cin >> command >> a >> b;
        if (command == "print")
        {
            cout << str.substr(a, b - a + 1) << endl;
        }
        else if (command == "reverse")
        {
            std::reverse(str.begin() + a, str.begin() + b + 1);
        }
        else if (command == "replace")
        {
            cin >> buff;
            str.replace(a, b - a + 1, buff);
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:19:18: error: 'reverse' is not a member of 'std'
   19 |             std::reverse(str.begin() + a, str.begin() + b + 1);
      |                  ^~~~~~~
Language: C++

#include <iostream>
#include <string>

using namespace std;
int main(int argc, char *argv[])
{
    int n, a, b;
    string str, command, buff;
    cin >> str >> n;
    while (n--)
    {
        cin >> command >> a >> b;
        if (command == "print")
        {
            cout << str.substr(a, b - a + 1) << endl;
        }
        else if (command == "reverse")
        {
            std::reverse(str.begin() + a, str.begin() + (b - a + 1));
        }
        else if (command == "replace")
        {
            cin >> buff;
            str.replace(a, b - a + 1, buff);
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:19:18: error: 'reverse' is not a member of 'std'
   19 |             std::reverse(str.begin() + a, str.begin() + (b - a + 1));
      |                  ^~~~~~~
Language: C++

#include <iostream>
#include <string>

using namespace std;
int main(int argc, char *argv[])
{
    int n, a, b;
    string str, command, buff;
    cin >> str >> n;
    while (n--)
    {
        cin >> command >> a >> b;
        if (command == "print")
        {
            cout << str.substr(a, b - a + 1) << endl;
        }
        else if (command == "reverse")
        {
            string sub = str.substr(a, b - a + 1);
            reverse(sub.begin(), sub.end());
            for (int i = a; i < b - a + 1; i++)
            {
                str[i] = sub[i];
            }
        }
        else if (command == "replace")
        {
            cin >> buff;
            str.replace(a, b - a + 1, buff);
        }
    }
    return 0;
}


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

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

int main(){
	string str;
	int q;

	cin>>str>>q;
	int len=str.size();
	//cout<<str.substr(0,-1);

	for(int i=0; i<q; i++){
		string od, p, tmp;
		int a,b;
		cin>>od;
		if(od=="print"){
			cin>>a>>b;
			cout<<str.substr(a,b-a+1)<<endl;
		}else if(od=="reverse"){
			cin>>a>>b;
			//cout<<"reverse done"<<endl;
			string rev=str.substr(a,b-a+1);
			//cout<<rev<<endl;
			//cout<<"aaa"<<endl;
			//int l=b-a+1;
			int l=b-a+1;
			//cout<<l<<endl;
			for(int i=0; i<l; i++){
				tmp[i]=rev[l-1-i];
				//cout<<tmp[i];
				tmp+=tmp[i];
			}
			//cout<<tmp<<endl;
			if(a==0){
				//cout<<"inside if"<<endl;
				//cout<<tmp<<endl;
				//cout<<str.substr(b+1, len-b-1);
				str=tmp+str.substr(b+1, len-b-1);
			}else{
				//cout<<"inside else"<<endl;
				str=str.substr(0,a-1)+tmp+str.substr(b+1,len-b-1);
			}
			//cout<<str<<endl;
		}else if(od=="replace"){
			string p;
			cin>>a>>b>>p;
			if(a==0){
				str=p+str.substr(b+1,len-b-1);
			}
			else{
				str=str.substr(0,a)+p+str.substr(b+1,len-b-1);
			}
			//cout<<str<<endl;
		}
		
	}
	
	return 0;
}


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

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

int main(){
	string str;
	int q;

	scanf("%s %d", str, &q)
	//cin>>str>>q;
	int len=str.size();
	//cout<<str.substr(0,-1);

	for(int i=0; i<q; i++){
		string od, p, tmp;
		int a,b;
		scanf("%s", od);
		//cin>>od;
		if(od=="print"){
			scanf("%d %d", &a, &b);
			//cin>>a>>b;
			printf("%s\n", str.substr(a,b-a+1))
			//cout<<str.substr(a,b-a+1)<<endl;
		}else if(od=="reverse"){
			scanf("%d %d", &a, &b);
			//cin>>a>>b;
			//cout<<"reverse done"<<endl;
			string rev=str.substr(a,b-a+1);
			//cout<<rev<<endl;
			//cout<<"aaa"<<endl;
			//int l=b-a+1;
			int l=b-a+1;
			//cout<<l<<endl;
			for(int i=0; i<l; i++){
				tmp[i]=rev[l-1-i];
				//cout<<tmp[i];
				tmp+=tmp[i];
			}
			//cout<<tmp<<endl;
			if(a==0){
				//cout<<"inside if"<<endl;
				//cout<<tmp<<endl;
				//cout<<str.substr(b+1, len-b-1);
				str=tmp+str.substr(b+1, len-b-1);
			}else{
				//cout<<"inside else"<<endl;
				str=str.substr(0,a-1)+tmp+str.substr(b+1,len-b-1);
			}
			//cout<<str<<endl;
		}else if(od=="replace"){
			string p;
			scanf("%d %d %s", &a, &b, p);
			//cin>>a>>b>>p;
			if(a==0){
				str=p+str.substr(b+1,len-b-1);
			}
			else{
				str=str.substr(0,a)+p+str.substr(b+1,len-b-1);
			}
			//cout<<str<<endl;
		}
		
	}
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:32: error: expected ';' before 'int'
   11 |         scanf("%s %d", str, &q)
      |                                ^
      |                                ;
   12 |         //cin>>str>>q;
   13 |         int len=str.size();
      |         ~~~                     
a.cc:24:60: error: expected ';' before '}' token
   24 |                         printf("%s\n", str.substr(a,b-a+1))
      |                                                            ^
      |                                                            ;
   25 |                         //cout<<str.substr(a,b-a+1)<<endl;
   26 |                 }else if(od=="reverse"){
      |                 ~                                           
a.cc:46:57: error: 'len' was not declared in this scope
   46 |                                 str=tmp+str.substr(b+1, len-b-1);
      |                                                         ^~~
a.cc:49:74: error: 'len' was not declared in this scope
   49 |                                 str=str.substr(0,a-1)+tmp+str.substr(b+1,len-b-1);
      |                                                                          ^~~
a.cc:57:54: error: 'len' was not declared in this scope; did you mean 'mblen'?
   57 |                                 str=p+str.substr(b+1,len-b-1);
      |                                                      ^~~
      |                                                      mblen
a.cc:60:70: error: 'len' was not declared in this scope; did you mean 'mblen'?
   60 |                                 str=str.substr(0,a)+p+str.substr(b+1,len-b-1);
      |                                                                      ^~~
      |                                                                      mblen
Language: C++

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

int main(){
	string str;
	int q;

	cin>>str>>q;
	int len=str.size();

	for(int i=0; i<q; i++){
		string od, p, tmp;
		int a,b;
		cin>>od;
		if(od=="print"){
			cin>>a>>b;
			cout<<str.substr(a,b-a+1)<<endl;
		}else if(od=="reverse"){
			cin>>a>>b;
			reverse(str.begin()+a, str.begin()+b+1);
			/*
			string rev=str.substr(a,b-a+1);
			int l=b-a+1;
			//cout<<l<<endl;
			for(int i=0; i<l; i++){
				tmp[i]=rev[l-1-i];
				//cout<<tmp[i];
				tmp+=tmp[i];
			}
			if(a==0){
				str=tmp+str.substr(b+1, len-b-1);
			}else{				//cout<<"inside else"<<endl;
				str=str.substr(0,a-1)+tmp+str.substr(b+1,len-b-1);
			}			//cout<<str<<endl;
			*/
		}else if(od=="replace"){
			string p;
			cin>>a>>b>>p;
			if(a==0){
				str=p+str.substr(b+1,len-b-1);
			}
			else{
				str=str.substr(0,a)+p+str.substr(b+1,len-b-1);
			}
		}
		
	}

	
	return 0;
}


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

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

int main(){
	string str;
	int q;

	cin>>str>>q;
	int len=str.size();

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

	
	return 0;
}


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

    int n;
    int a, b;
    cin>>n;
    for(int i=0; i<n; ++i)
    {
        cin>>s;
        if(s=="print")
        {
            cin>>a>>b;
            for(int e=a; e<=b; ++e)
                cout<<word[e];
            cout<<"\n";
        }
        else if(s=="replace")
        {
            cin>>a>>b>>s;
            int counter=0;
            for(int e=a; e<=b; ++e)
            {
                word[e]=s[counter];
                counter++;
            }
        }
        else
        {
            cin>>a>>b;
            while(a<b)
            {
                int temp=word[a];
                word[a]=word[b];
                word[b]=temp;
                a++;
                b--;
            }
        }
    }
    return 0;
}



Compiler output:
a.cc:3:5: error: 'cin' does not name a type
    3 |     cin>>n;
      |     ^~~
a.cc:4:5: error: expected unqualified-id before 'for'
    4 |     for(int i=0; i<n; ++i)
      |     ^~~
a.cc:4:18: error: 'i' does not name a type
    4 |     for(int i=0; i<n; ++i)
      |                  ^
a.cc:4:23: error: expected unqualified-id before '++' token
    4 |     for(int i=0; i<n; ++i)
      |                       ^~
a.cc:37:5: error: expected unqualified-id before 'return'
   37 |     return 0;
      |     ^~~~~~
a.cc:38:1: error: expected declaration before '}' token
   38 | }
      | ^
Language: C++

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

using namespace std;

int main() {
	
	string A;
	int x, y;
	
	while( cin >> A ) {
	
	int n;
	cin >> n;
	
	string Action;
	
	for(int i=0;i<n;i++) {
		
		cin >> Action;
		if( Action == "replace") {
			
			string replaces;
			cin >> x >> y >> replaces;
			A.replace(x, y , replaces);
		}
		else if( Action == "reverse") {
						
			cin >> x >> y ;
			
			reverse(x, y+1);
		
		}
		else /*if( Action == "print" )*/{
			
			cin >> x >> y;
			
			cout << A.substr(x,y-x+1) << "\n";
		}
	}
	
}
	return 0;
}


Compiler output:
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::reverse(_BIter, _BIter) [with _BIter = int]':
a.cc:32:11:   required from here
   32 |                         reverse(x, y+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_iterator_base_funcs.h:66,
                 from /usr/include/c++/14/string:47,
                 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/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:32:11:   required from here
   32 |                         reverse(x, y+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<string>
#include<iostream>

void print(std::string str,int a,int b){
    std::cout<<str.substr(a,b-a+1)<<std::endl;
}

void reverse(std::string& str,int a,int b){
    std::reverse(str.begin()+a,str.begin()+b+1);
}

int main(void){
    std::string str,instruction;
    int a,b,q;
    std::cin>>str;
    std::cin>>q;
    while(q-->0){
        std::cin>>instruction>>a>>b;
        switch(instruction){
            case "print":
                print(str,a,b);
                break;
            case "reverse":
                reverse(str,a,b);
                break;
            case "replace":
                str::string p;
                std::cin>>p;
                str.replace(a,b,p);
                break;
        }
    }
    

    return 0;
}


Compiler output:
a.cc: In function 'void reverse(std::string&, int, int)':
a.cc:9:10: error: 'reverse' is not a member of 'std'; did you mean 'reverse'?
    9 |     std::reverse(str.begin()+a,str.begin()+b+1);
      |          ^~~~~~~
a.cc:8:6: note: 'reverse' declared here
    8 | void reverse(std::string& str,int a,int b){
      |      ^~~~~~~
a.cc: In function 'int main()':
a.cc:19:16: error: switch quantity not an integer
   19 |         switch(instruction){
      |                ^~~~~~~~~~~
a.cc:27:17: error: 'str' is not a class, namespace, or enumeration
   27 |                 str::string p;
      |                 ^~~
a.cc:28:27: error: 'p' was not declared in this scope
   28 |                 std::cin>>p;
      |                           ^
Language: C++

#include<string>
#include<iostream>

void print(std::string str,int a,int b){
    std::cout<<str.substr(a,b-a+1)<<std::endl;
}

void reverse(std::string& str,int a,int b){
    std::reverse(str.begin()+a,str.begin()+b+1);
}

int main(void){
    std::string str,instruction;
    int a,b,q;
    std::cin>>str;
    std::cin>>q;
    while(q-->0){
        std::cin>>instruction>>a>>b;
        switch(instruction){
            case "print":
                print(str,a,b);
                break;
            case "reverse":
                reverse(str,a,b);
                break;
            case "replace":
                str::string p;
                std::cin>>p;
                str.replace(a,b-a+1,p);
                break;
        }
    }
    

    return 0;
}


Compiler output:
a.cc: In function 'void reverse(std::string&, int, int)':
a.cc:9:10: error: 'reverse' is not a member of 'std'; did you mean 'reverse'?
    9 |     std::reverse(str.begin()+a,str.begin()+b+1);
      |          ^~~~~~~
a.cc:8:6: note: 'reverse' declared here
    8 | void reverse(std::string& str,int a,int b){
      |      ^~~~~~~
a.cc: In function 'int main()':
a.cc:19:16: error: switch quantity not an integer
   19 |         switch(instruction){
      |                ^~~~~~~~~~~
a.cc:27:17: error: 'str' is not a class, namespace, or enumeration
   27 |                 str::string p;
      |                 ^~~
a.cc:28:27: error: 'p' was not declared in this scope
   28 |                 std::cin>>p;
      |                           ^
Language: C++

#include<string>
#include<iostream>

void print(std::string str,int a,int b){
    std::cout<<str.substr(a,b-a+1)<<std::endl;
}

int main(void){
    std::string str,instruction;
    int a,b,q;
    std::cin>>str;
    std::cin>>q;
    while(q-->0){
        std::cin>>instruction>>a>>b;
        switch(instruction){
            case "print":
                print(str,a,b);
                break;
            case "reverse":
                std::reverse(str.begin()+a,str.begin()+b+1);
                break;
            case "replace":
                str::string p;
                std::cin>>p;
                str.replace(a,b-a+1,p);
                break;
        }
    }
    

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:16: error: switch quantity not an integer
   15 |         switch(instruction){
      |                ^~~~~~~~~~~
a.cc:20:22: error: 'reverse' is not a member of 'std'
   20 |                 std::reverse(str.begin()+a,str.begin()+b+1);
      |                      ^~~~~~~
a.cc:23:17: error: 'str' is not a class, namespace, or enumeration
   23 |                 str::string p;
      |                 ^~~
a.cc:24:27: error: 'p' was not declared in this scope
   24 |                 std::cin>>p;
      |                           ^
Language: C++

#include<string>
#include<iostream>

void print(std::string str,int a,int b){
    std::cout<<str.substr(a,b-a+1)<<std::endl;
}

int main(void){
    std::string str,instruction;
    int a,b,q;
    std::cin>>str;
    std::cin>>q;
    while(q-->0){
        std::cin>>instruction>>a>>b;
        switch(instruction[2]){
            case "i":
                print(str,a,b);
                break;
            case "v":
                std::reverse(str.begin()+a,str.begin()+b+1);
                break;
            case "p":
                std::string p;
                std::cin>>p;
                std.replace(a,b-a+1,p);
                break;
        }
    }
    

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: conversion from 'const char*' to 'int' in a converted constant expression
   16 |             case "i":
      |                  ^~~
a.cc:16:18: error: could not convert '"i"' from 'const char [2]' to 'int'
   16 |             case "i":
      |                  ^~~
      |                  |
      |                  const char [2]
a.cc:19:18: error: conversion from 'const char*' to 'int' in a converted constant expression
   19 |             case "v":
      |                  ^~~
a.cc:19:18: error: could not convert '"v"' from 'const char [2]' to 'int'
   19 |             case "v":
      |                  ^~~
      |                  |
      |                  const char [2]
a.cc:20:22: error: 'reverse' is not a member of 'std'
   20 |                 std::reverse(str.begin()+a,str.begin()+b+1);
      |                      ^~~~~~~
a.cc:22:18: error: conversion from 'const char*' to 'int' in a converted constant expression
   22 |             case "p":
      |                  ^~~
a.cc:22:18: error: could not convert '"p"' from 'const char [2]' to 'int'
   22 |             case "p":
      |                  ^~~
      |                  |
      |                  const char [2]
a.cc:25:20: error: expected primary-expression before '.' token
   25 |                 std.replace(a,b-a+1,p);
      |                    ^
Language: C++

#include<string>
#include<iostream>

void print(std::string str,int a,int b){
    std::cout<<str.substr(a,b-a+1)<<std::endl;
}

int main(void){
    std::string str,instruction;
    int a,b,q;
    std::cin>>str;
    std::cin>>q;
    while(q-->0){
        std::cin>>instruction>>a>>b;
        switch(instruction[2]){
            case 'i':
                print(str,a,b);
                break;
            case 'v':
                std::reverse(str.begin()+a,str.begin()+b+1);
                break;
            case 'p':
                std::string p;
                std::cin>>p;
                std.replace(a,b-a+1,p);
                break;
        }
    }
    

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:22: error: 'reverse' is not a member of 'std'
   20 |                 std::reverse(str.begin()+a,str.begin()+b+1);
      |                      ^~~~~~~
a.cc:25:20: error: expected primary-expression before '.' token
   25 |                 std.replace(a,b-a+1,p);
      |                    ^
Language: C++

#include<string>
#include<iostream>

void print(std::string str,int a,int b){
    std::cout<<str.substr(a,b-a+1)<<std::endl;
}

int main(void){
    std::string str,instruction;
    int a,b,q;
    std::cin>>str;
    std::cin>>q;
    while(q-->0){
        std::cin>>instruction>>a>>b;
        switch(instruction[2]){
            case 'i':
                print(str,a,b);
                break;
            case 'v':
                std::reverse(str.begin()+a,str.begin()+b+1);
                break;
            case 'p':
                std::string p;
                std::cin>>p;
                str.replace(a,b-a+1,p);
                break;
        }
    }
    

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:22: error: 'reverse' is not a member of 'std'
   20 |                 std::reverse(str.begin()+a,str.begin()+b+1);
      |                      ^~~~~~~