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

##include<stdio.h>
int print( char x[], int a, int b ){
 
  int i;
   
  for ( i = a ; i <= b ; i++ ){
    printf("%c", x[i]);
  }
 
  printf("\n");
 
  return 0;
   
}
 
int reverse( char x[], int a, int b ){
 
  char y[1001];
  int i;
 
  for ( i = a ; i <= b ; i++ ){
    y[i] = x[i];
  }
 
  for ( i = a ; i <= b ; i++ ){
    x[i] = y[ a + b - i ];
  }
 
  return 0;
   
}
 
int replace( char x[], int a, int b, char y[] ){
 
  int i;
 
  for ( i = a ; i <= b ; i++ ){
    x[i] = y[ i - a ];
  }
 
  return 0;
 
}
 
int operate( char x[] ){
 
  char print[10] = "print";
  char reverse[10] = "reverse";
  char replace[10] = "replace";
 
  int i;
 
  for ( i = 0 ; i <= 5 ; i++ ){
    if ( i == 5 ) return 1;
    if ( x[i] != print[i] ) break;
  }
 
  for ( i = 0 ; i <= 7 ; i++ ){
    if ( i == 7 ) return 2;
    if ( x[i] != reverse[i] ) break;
  }
 
  for ( i = 0 ; i <= 7 ; i++ ){
    if ( i == 7 ) return 3;
    if ( x[i] != replace[i] ) break;
  }
 
  return 0;
 
}
 
int main(){
 
  char str[1001],op[10];
  scanf("%s", str );
   
  int q;
  scanf("%d", &q );
 
  int a,b,i,result;
  char p[1001];
   
  for ( i = 0 ; i < q ; i++ ){
    scanf("%s", op );
    result = operate( op );
 
    if ( result == 1 ) {
      scanf("%d %d", &a, &b);
      print( str, a, b );
    } else if ( result == 2 ) {
      scanf("%d %d", &a, &b);
      reverse( str, a, b );
    } else if ( result == 3 ) {
      scanf("%d %d", &a, &b);
      scanf("%s", p);
      replace( str, a, b, p );
    }
  }
 
  return 0;
 
}

Compiler output:
main.c:1:1: error: stray '##' in program
    1 | ##include<stdio.h>
      | ^~
main.c:1:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | ##include<stdio.h>
      |          ^
main.c: In function 'main':
main.c:75:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   75 |   scanf("%s", str );
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | ##include<stdio.h>
main.c:75:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   75 |   scanf("%s", str );
      |   ^~~~~
main.c:75:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:89:7: error: implicit declaration of function 'print' [-Wimplicit-function-declaration]
   89 |       print( str, a, b );
      |       ^~~~~
Language: C

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

Compiler output:
main.c: In function 'main':
main.c:10:27: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   10 |                 if(strcmp(c,"print") == 0){
      |                           ^
      |                           |
      |                           char
In file included from main.c:2:
/usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'char'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
main.c:16:32: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   16 |                 else if(strcmp(c,"reverse") == 0){
      |                                ^
      |                                |
      |                                char
/usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'char'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
main.c:17:26: error: assignment to expression with array type
   17 |                         p=str;
      |                          ^
main.c:24:32: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   24 |                 else if(strcmp(c,"replace") == 0){
      |                                ^
      |                                |
      |                                char
/usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'char'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
Language: C

#include <stdio.h>

void print(char str[],int a,int b)
{
  int i;
  for(i = a; i < b; i++) printf("%c",str[i]);
  printf("\n");
}

void reverse(char str[],int a,int b)
{
  char copy[1000];
  int i;
  for(i = a; i < b; i++) copy[i - a] = str[i];
  for(i = b; i > a; i--) str[i] = copy[b - i];
}

void replace(char str[],int a,int b,char p[])
{
  int i;
  for(i = a; i < b; i++) str[i] = p[i - a];
}

int main()
{
  char str[1000],com[7],p[1000];
  int q,p,i,a,b;

  scanf("%s",str);
  scanf("%d",&q);

  for(i = 0; i < q; i++)
  {
    scanf("%s %d %d",com,&a,&b);
    if(com[0] == 'p')
    {
      print(str,a,b);
    }
    else if(com[0] == 'r')
    {
      if(com[2] == 'v') reverse(str,a,b);
      else if(com[2] == 'p')
      {
        scanf("%s",p);
        replace(str,a,b,p);
      }
    }
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:27:9: error: conflicting types for 'p'; have 'int'
   27 |   int q,p,i,a,b;
      |         ^
main.c:26:25: note: previous declaration of 'p' with type 'char[1000]'
   26 |   char str[1000],com[7],p[1000];
      |                         ^
Language: C

            for(int j=a; j<=b; j++) moji[j] = tmp[j];



Compiler output:
main.c:1:13: error: expected identifier or '(' before 'for'
    1 |             for(int j=a; j<=b; j++) moji[j] = tmp[j];
      |             ^~~
main.c:1:27: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<=' token
    1 |             for(int j=a; j<=b; j++) moji[j] = tmp[j];
      |                           ^~
main.c:1:33: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    1 |             for(int j=a; j<=b; j++) moji[j] = tmp[j];
      |                                 ^~
Language: C

#include <cstdio>
#include <string>
char c[1001], rc[1001], s[111] = {};
char w[111] = {};
int main()
{
    int a, b, n;
    scanf("%s", c);
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < 111; j++)
        {
            s[j] = 0;
        }
        scanf("%s ", s);
        if (strcmp(s, "print") == 0)
        {
            scanf("%d %d", &a, &b);
            for (int i = a; i <= b; i++)
            {
                printf("%c", c[i]);
            }
        }
        else if (strcmp(s, "replace") == 0)
        {
            scanf("%d %d %s", &a, &b, rc);
            int j = 0;
            for (int i = a; i <= b; i++)
            {
                c[i] = rc[j];
                j++;
            }
        }
        else
        {
            scanf("%d %d", &a, &b);
            int j = b;
            strcpy(rc, c);
            for (int i = a; i <= b; i++)
            {
                c[i] = rc[j];
                j--;
            }
        }
    }
}



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

#include <cstdio>
#include <string>
char c[1001], rc[1001], s[111];
char w[111];
int main()
{
    int a, b, n;
    scanf("%s", c);
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%s ", s);
        if (strcmp(s, "print") == 0)
        {
            scanf("%d %d", &a, &b);
            for (int i = a; i <= b; i++)
            {
                printf("%c", c[i]);
            }
            printf("\n");
        }
        else if (strcmp(s, "replace") == 0)
        {
            scanf("%d %d %s", &a, &b, rc);
            int j = 0;
            for (int i = a; i <= b; i++)
            {
                c[i] = rc[j];
                j++;
            }
        }
        else
        {
            scanf("%d %d", &a, &b);
            int j = b;
            strcpy(rc, c);
            for (int i = a; i <= b; i++)
            {
                c[i] = rc[j];
                j--;
            }
        }
    }
}



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

#include <stdio.h>
#include <string.h>

int main(int argc, const char * argv[]) {
    int a,b,q;
    char str[1001];
    char order[10];
    char p[101];
    
    int i,j,k;//アクセス変数
    char tmp[1001];
    
    char ans[1001][1001]={'\n'};
    int x=0;
    
    scanf("%s",str);
    scanf("%d",&q);
    
    for(i=0;i<q;i++){
        //初期化
//        order[0]='\n';
//        tmp[0]='\n';
        
        scanf("%s %d %d",order,&a,&b);
        
        if(strcmp(order,"print")==0){
            strncpy(&ans[0][x],&str[a],b-a+1);
            printf("%s\n",&ans[0][x]);
            x++;
        }else if(strcmp(order,"reverse")==0){
            for(j=b,k=0;k<=b-a+1;j--,k++){
                tmp[k]=str[j];
            }
            strncpy(&str[a],tmp,b-a+1);
        }else if(strcmp(order,"replace")==0){
            scanf("%s",p);
            strncpy(&str[a],p,b-a+1);
        }
    }



Compiler output:
main.c: In function 'main':
main.c:39:5: error: expected declaration or statement at end of input
   39 |     }
      |     ^
Language: C

#include <stdio.h>
#include <string.h>

int main(int argc, const char * argv[]) {
    int a,b,q;
    char str[1001];
    char order[10];
    char p[101];
    
    int i,j,k;//アクセス変数
    char tmp[1001];
    

    scanf("%s",str);
    scanf("%d",&q);
    
    for(i=0;i<q;i++){
        //初期化
//        order[0]='\n';
//        tmp[0]='\n';
        
        scanf("%s",order);
        scanf("%d %d",&a,&b);
        
        if(strcmp(order,"print")==0){
            for(j=a;j<=b;j++){
                printf("%c",str[j]);
            }
            printf("\n")
            
        }else if(strcmp(order,"reverse")==0){
            for(j=b,k=0;k<=b-a+1;j--,k++){
                tmp[k]=str[j];
            }
            strncpy(&str[a],tmp,b-a+1);
        }else if(strcmp(order,"replace")==0){
            scanf("%s",p);
            strncpy(&str[a],p,b-a+1);
        }
    }
    return 0;
}



Compiler output:
main.c: In function 'main':
main.c:29:25: error: expected ';' before '}' token
   29 |             printf("\n")
      |                         ^
      |                         ;
   30 | 
   31 |         }else if(strcmp(order,"reverse")==0){
      |         ~
Language: C

 #include <stdio.h> 
char str[1005];
 char p[1005];
 int main() { 
int q, a, b;
 char op[10], *x, *y, c;
 scanf("%s%d", str, &q);
 while (q--) { scanf("%s%d%d", op, &a, &b);
 if (op[2] == 'i') {
 // print b++, c = *(str+b), *(str+b) = 0, puts(str+a), *(str+b) = c;
 }
 else if (op[2] == 'v') {
 // reverse x = str+a, y = str+b; while (x < y) {
 c = *x, *x = *y, *y = c;
 x++, y--; 
} 
} 
else { 
// replace scanf("%s", p);
 x = str+a, y = p; while (*y) *x++ = *y++; 
}
 }
 return 0;
 } 


Compiler output:
main.c: In function 'main':
main.c:18:1: error: 'else' without a previous 'if'
   18 | else {
      | ^~~~
main.c: At top level:
main.c:23:2: error: expected identifier or '(' before 'return'
   23 |  return 0;
      |  ^~~~~~
main.c:24:2: error: expected identifier or '(' before '}' token
   24 |  }
      |  ^
Language: C

#include <stdio.h>
#include <string.h>

int main()
{
  char input_str[1000];
  char order_str[7];
  char replace_str[1000];
  char temp;

  int order_num;
  int counter_i = 0, counter_j;
  int order_a, order_b;

  scanf("%s", input_str);
  scanf("%d", &order_num);

  for(counter_i = 0 ; counter_i < order_num ; counter_i++)
  {
    scanf("%s %d %d", order_str, &order_a, &order_b);
    if(strcmp(order_str, "print") == 0)
    {
      while(order_a <= order_b)
      {
        printf("%c", input_str[order_a]);
        order_a++;
      }
      printf("\n");
    }

    if(strcmp(order_str, "reverse") == 0)
    {
      while(order_a < order_b)
      {
        temp = input_str[order_a];
        input_str[order_a] = input_str[order_b];
        input_str[order_b] = temp;
        order_a++;
        order_b--;
      }
    }

    if(strcmp(order_str, "replace") == 0)
    {
      scanf("%s", replace_str);
      for(counter_j = 0 ; order_a <= order_b ; counter_j++, order_a++)
      {
        input_str[order_a] = replace_str[counter_j];
      }
    }
  }
}
ｖｖｖｖ


Compiler output:
main.c:53:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input
   53 | ｖｖｖｖ
      | ^~~~~~~~
Language: C++

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

using ll = long long;

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)
#define rep(i,n) for_(i,0,(n))
#define rrep(i,n) rfor_(i,0,(n))

char str[1002], cp[1002];

char p[1002];

int q;

char f[10];
int a, b;

int main(){
	cin.tie(0);
	
	cin>>str;
	cin>>q;
	
	const int l = strlen(str);
	
	rep(ii, q) {
	    cin>>f>>a>>b;
	    if(f[2]=='i') {
	        for_(i, a, b+1)cout<<str[i];
	        cout<<endl;
	    }else if(f[2]=='v') {
	        rep(i, l)cp[i] = str[i];
	        rep(i, b-a+1)cp[a+i] = str[b-i];
	        rep(i, l)str[i] = cp[i];
	    }else {
	        cin>>p;
	        rep(i, b-a+1)str[a+i] = p[i];
	    }
	}

	return 0;
}



Compiler output:
a.cc:2:2: error: invalid preprocessing directive #inclde; did you mean #include?
    2 | #inclde <string>
      |  ^~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:27:23: error: 'strlen' was not declared in this scope
   27 |         const int l = strlen(str);
      |                       ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | #inclde <string>
Language: C++

#include <iostream>
#inclde <cstring>
using namespace std;

using ll = long long;

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)
#define rep(i,n) for_(i,0,(n))
#define rrep(i,n) rfor_(i,0,(n))

char str[1002], cp[1002];

char p[1002];

int q;

char f[10];
int a, b;

int main(){
	cin.tie(0);
	
	cin>>str;
	cin>>q;
	
	const int l = strlen(str);
	
	rep(ii, q) {
	    cin>>f>>a>>b;
	    if(f[2]=='i') {
	        for_(i, a, b+1)cout<<str[i];
	        cout<<endl;
	    }else if(f[2]=='v') {
	        rep(i, l)cp[i] = str[i];
	        rep(i, b-a+1)cp[a+i] = str[b-i];
	        rep(i, l)str[i] = cp[i];
	    }else {
	        cin>>p;
	        rep(i, b-a+1)str[a+i] = p[i];
	    }
	}

	return 0;
}



Compiler output:
a.cc:2:2: error: invalid preprocessing directive #inclde; did you mean #include?
    2 | #inclde <cstring>
      |  ^~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:27:23: error: 'strlen' was not declared in this scope
   27 |         const int l = strlen(str);
      |                       ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | #inclde <cstring>
Language: C++

#include <iostream>
#inclde <cstring>
using namespace std;

using ll = long long;

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)
#define rep(i,n) for_(i,0,(n))
#define rrep(i,n) rfor_(i,0,(n))

char str[1002], cp[1002];

char p[1002];

int q;

char f[10];
int a, b;

int main(){
	cin.tie(0);
	
	cin>>str;
	cin>>q;
	
	int l = strlen(str);
	
	rep(ii, q) {
	    cin>>f>>a>>b;
	    if(f[2]=='i') {
	        for_(i, a, b+1)cout<<str[i];
	        cout<<endl;
	    }else if(f[2]=='v') {
	        rep(i, l)cp[i] = str[i];
	        rep(i, b-a+1)cp[a+i] = str[b-i];
	        rep(i, l)str[i] = cp[i];
	    }else {
	        cin>>p;
	        rep(i, b-a+1)str[a+i] = p[i];
	    }
	}

	return 0;
}



Compiler output:
a.cc:2:2: error: invalid preprocessing directive #inclde; did you mean #include?
    2 | #inclde <cstring>
      |  ^~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:27:17: error: 'strlen' was not declared in this scope
   27 |         int l = strlen(str);
      |                 ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | #inclde <cstring>
Language: C++

#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <string>
#include <stdio.h>
#include <sstream>


using namespace std;
void swap(int &a, int &b);

int main()
{

	string sInput;
	cin >> sInput;
	int numOfOrder;
	cin >> numOfOrder;

	for (int i = 0; i < numOfOrder; ++i)
	{
		string sOrder;
		cin >> sOrder;
		int a, b;
		cin >> a >> b;

		if (sOrder == "reverse")
		{
			
			reverse(sInput.begin() + a, sInput.begin() + b+1);
			//cout << sInput << endl;
		}
		else if (sOrder == "replace")
		{
			string srep;
			cin >> srep;
			int num = b - a + 1;
			sInput.replace(a, num, srep);
			//cout << sInput << endl;
		}
		else
		{
			cout << sInput.substr(a, b) << endl;
		}
	}

	return 0;
}






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

#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <string>
#include <stdio.h>
#include <sstream>


using namespace std;
void swap(int &a, int &b);

int main()
{

	string sInput;
	cin >> sInput;
	int numOfOrder;
	cin >> numOfOrder;

	for (int i = 0; i < numOfOrder; ++i)
	{
		string sOrder;
		cin >> sOrder;
		int a, b;
		cin >> a >> b;

		if (sOrder == "reverse")
		{
			
			std::reverse(sInput.begin() + a, sInput.begin() + b+1);
			//cout << sInput << endl;
		}
		else if (sOrder == "replace")
		{
			string srep;
			cin >> srep;
			int num = b - a + 1;
			sInput.replace(a, num, srep);
			//cout << sInput << endl;
		}
		else
		{
			cout << sInput.substr(a, b) << endl;
		}
	}

	return 0;
}






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

#include <iostream>
using namespace std;

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


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

//standard answer
#include<iostream>
#include<string>
using namespace std;

int main(){
  string str, com, p;
  int q, a, b;
  
  cin >> str >> q;
  for ( int t = 0; t < q; t++ ){
    cin >> com >> a >> b;
    if ( com == "print" ){
      cout << str.substr(a, b-a+1) << endl; //[a]~(b-a+1)個返す
    } else if ( com == "reverse" ){
      strint tmp = str.substr(a, b-a+1);
      int n = tmp.size();
      for ( int i = 0; i < n; i++ ) str[i+a] = tmp[n-i-1];
    } else if ( com == "replace" ){
      cin >> p; //replaceはもう1文字列ある
      str = str.replace(a, b-a+1, p);
    }
  }
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:7: error: 'strint' was not declared in this scope; did you mean 'stdin'?
   16 |       strint tmp = str.substr(a, b-a+1);
      |       ^~~~~~
      |       stdin
a.cc:17:15: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   17 |       int n = tmp.size();
      |               ^~~
      |               tm
Language: C++

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


int main(){

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

return 0;
}



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

#include <iostream>
#include <string>

using namespace std;

bool isPrime (unsigned long long n)
{
	for(unsigned long long i = 2; i*i <= n; ++i)
		if (n % i == 0)
			return false;

	return true;
}

int main(int, char**)
{
	unsigned long long s;
	unsigned long long n;

	std::cin >> s >> n;

    for (unsigned int i = 0; i < n; ++i) {
        string inst;
        unsigned int x, y;
        cin >> inst >> x >> y;
        if( inst.equal("print")) {
            cout << s.substr(x, y - x + 1) << endl;
        } else if (inst.equal("replace")) {
            string s2;
            cin >> s2;
            s.repace(x, y - x + 1, s2);
        } else {
            string s2 = s.substr(x, y - x +1);
            for (unsigned int i = x; i <= y; ++i)
                s2[i] = s[y - i];
            s.replace(x, y - x +1, s2);
        }
    }
    
	return 0;
}
  



Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:26:18: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'equal'
   26 |         if( inst.equal("print")) {
      |                  ^~~~~
a.cc:27:23: error: request for member 'substr' in 's', which is of non-class type 'long long unsigned int'
   27 |             cout << s.substr(x, y - x + 1) << endl;
      |                       ^~~~~~
a.cc:28:25: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'equal'
   28 |         } else if (inst.equal("replace")) {
      |                         ^~~~~
a.cc:31:15: error: request for member 'repace' in 's', which is of non-class type 'long long unsigned int'
   31 |             s.repace(x, y - x + 1, s2);
      |               ^~~~~~
a.cc:33:27: error: request for member 'substr' in 's', which is of non-class type 'long long unsigned int'
   33 |             string s2 = s.substr(x, y - x +1);
      |                           ^~~~~~
a.cc:35:26: error: invalid types 'long long unsigned int[unsigned int]' for array subscript
   35 |                 s2[i] = s[y - i];
      |                          ^
a.cc:36:15: error: request for member 'replace' in 's', which is of non-class type 'long long unsigned int'
   36 |             s.replace(x, y - x +1, s2);
      |               ^~~~~~~
Language: C++

#include <iostream>
#include <string>

using namespace std;

bool isPrime (unsigned long long n)
{
	for(unsigned long long i = 2; i*i <= n; ++i)
		if (n % i == 0)
			return false;

	return true;
}

int main(int, char**)
{
	unsigned long long s;
	unsigned long long n;

	std::cin >> s >> n;
    string pstr = "print";
    string prep = "replace";
    for (unsigned int i = 0; i < n; ++i) {
        string inst;
        unsigned int x, y;
        cin >> inst >> x >> y;
        if( inst == pstr) {
            cout << s.substr(x, y - x + 1) << endl;
        } else if (inst==prep) {
            string s2;
            cin >> s2;
            s.repace(x, y - x + 1, s2);
        } else {
            string s2 = s.substr(x, y - x +1);
            for (unsigned int i = x; i <= y; ++i)
                s2[i] = s[y - i];
            s.replace(x, y - x +1, s2);
        }
    }
    
	return 0;
}
  



Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:28:23: error: request for member 'substr' in 's', which is of non-class type 'long long unsigned int'
   28 |             cout << s.substr(x, y - x + 1) << endl;
      |                       ^~~~~~
a.cc:32:15: error: request for member 'repace' in 's', which is of non-class type 'long long unsigned int'
   32 |             s.repace(x, y - x + 1, s2);
      |               ^~~~~~
a.cc:34:27: error: request for member 'substr' in 's', which is of non-class type 'long long unsigned int'
   34 |             string s2 = s.substr(x, y - x +1);
      |                           ^~~~~~
a.cc:36:26: error: invalid types 'long long unsigned int[unsigned int]' for array subscript
   36 |                 s2[i] = s[y - i];
      |                          ^
a.cc:37:15: error: request for member 'replace' in 's', which is of non-class type 'long long unsigned int'
   37 |             s.replace(x, y - x +1, s2);
      |               ^~~~~~~
Language: C++

#include <iostream>
#include <string>

using namespace std;


int main(int, char**)
{
	string s;
	unsigned int n;

	std::cin >> s >> n;
    string pstr = "print";
    string prep = "replace";
    for (unsigned int i = 0; i < n; ++i) {
        string inst;
        unsigned int x, y;
        cin >> inst >> x >> y;
        if( inst == pstr) {
            cout << s.substr(x, y - x + 1) << endl;
        } else if (inst==prep) {
            string s2;
            cin >> s2;
            s.repace(x, y - x + 1, s2);
        } else {
            string s2 = s.substr(x, y - x +1);
            for (unsigned int i = x; i <= y; ++i)
                s2[i] = s[y - i];
            s.replace(x, y - x +1, s2);
        }
    }
    
	return 0;
}
  



Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:24:15: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'repace'; did you mean 'replace'?
   24 |             s.repace(x, y - x + 1, s2);
      |               ^~~~~~
      |               replace
Language: C++

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

int main(){
  int q, a, b;
  string str, ope, word, sub_word;

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

  return 0;
}



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

#include<iostream>
#include<stdio.h>
#include<math.h>
#include<cctype>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
int q , a, b;
string str  , Meirei , p ,s;
cin >> str >> q;
for(int i = 0; i < q; i++){
cin >> Meirei >> a >> b;
if(Meirei == "replace"){
  cin >> p;
}
if(Meirei == "print"){
  //str.copy(s ,b - a + 1,a);
  s = str.substr(a,b - a + 1);
  cout << s << endl;
}else if(Meirei == "reverse"){
  str. reverse(a, b);
}else if(Meirei == "replace"){
   str.replace(a, b - a + 1 , p);
}
}
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:8: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'reverse'; did you mean 'reserve'?
   24 |   str. reverse(a, b);
      |        ^~~~~~~
      |        reserve
Language: C++

#include<iostream>
#include<stdio.h>
#include<math.h>
#include<cctype>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
int q , a, b;
string str  , Meirei , p ,s ,s2;
cin >> str >> q;
for(int i = 0; i < q; i++){
cin >> Meirei >> a >> b;
if(Meirei == "replace"){
  cin >> p;
}
if(Meirei == "print"){
  //str.copy(s ,b - a + 1,a);
  s = str.substr(a,b - a + 1);
  cout << s << endl;
}else if(Meirei == "reverse"){
   str.reverse(a,b);
}else if(Meirei == "replace"){
   str.replace(a, b - a + 1 , p);
}
}
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:8: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'reverse'; did you mean 'reserve'?
   24 |    str.reverse(a,b);
      |        ^~~~~~~
      |        reserve
Language: C++

#include<iostream>
#include<stdio.h>
#include<math.h>
#include<cctype>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:24:8: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'reverse'; did you mean 'reserve'?
   24 |    str.reverse(str.begin()+a,str.begin()+b);
      |        ^~~~~~~
      |        reserve
Language: C++

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

int main(void) {
    string str;
    string order;
    int a, b;
    
    getline(cin, str);
    
    while(cin >> order) {
        if(strstr(order, "print")) {
            cin >> a >> b;
            for(int i = 0; i < b - a + 1; ++i) {
                cout << str[a + i];
            }
            cout << endl;
        } else if(strstr(order, "reverse")) {
            cin >> a >> b;
            char copy[1000];
            for(int i = 0; i < b - a + 1; ++i) {
                copy[b - a - i] = str[i];
                str.replace(a, b, copy);
            }
        } else if(strstr(order, "replace")) {
            char word[100];
            cin >> a >> b >> word;
            str.replace(a, b, word);
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:12: error: 'strstr' was not declared in this scope
   13 |         if(strstr(order, "print")) {
      |            ^~~~~~
a.cc:2:1: note: 'strstr' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | #include <string>
Language: C++

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

int main(){
    int n;
    string str, s1;
    char order;
    int a, b;
    cin >> str;
    cin >> n;
    
    for (int i = 0; i < n; i++) {
        cin >> order >> a >> b;
        if (order == "print") {
            for (int i = a; i <= b; i++) {
                cout << str[i] << endl;
            }
        } else if (order == "reverse") {
            for (int i = a, int j = b; i < j; i++, j--) swap(str[i], str[j]);
        } else if (order == "replace") {
            cin >> s1;
            str.replace(a, b, s1);
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   16 |         if (order == "print") {
      |             ~~~~~~^~~~~~~~~~
a.cc:20:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 |         } else if (order == "reverse") {
      |                    ~~~~~~^~~~~~~~~~~~
a.cc:21:29: error: expected unqualified-id before 'int'
   21 |             for (int i = a, int j = b; i < j; i++, j--) swap(str[i], str[j]);
      |                             ^~~
a.cc:21:28: error: expected ';' before 'int'
   21 |             for (int i = a, int j = b; i < j; i++, j--) swap(str[i], str[j]);
      |                            ^~~~
      |                            ;
a.cc:21:45: error: expected ')' before ';' token
   21 |             for (int i = a, int j = b; i < j; i++, j--) swap(str[i], str[j]);
      |                 ~                           ^
      |                                             )
a.cc:21:52: error: 'j' was not declared in this scope
   21 |             for (int i = a, int j = b; i < j; i++, j--) swap(str[i], str[j]);
      |                                                    ^
a.cc:22:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   22 |         } else if (order == "replace") {
      |                    ~~~~~~^~~~~~~~~~~~
Language: C++

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

int main(){
    int n;
    string str, s1;
    string order;
    int a, b;
    cin >> str;
    cin >> n;
    
    for (int i = 0; i < n; i++) {
        cin >> order >> a >> b;
        if (order == "print") {
            for (int i = a; i <= b; i++) {
                cout << str[i] << endl;
            }
        } else if (order == "reverse") {
            for (int i = a, int j = b; i < j; i++, j--) swap(str[i], str[j]);
        } else if (order == "replace") {
            cin >> s1;
            str.replace(a, b, s1);
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:29: error: expected unqualified-id before 'int'
   21 |             for (int i = a, int j = b; i < j; i++, j--) swap(str[i], str[j]);
      |                             ^~~
a.cc:21:28: error: expected ';' before 'int'
   21 |             for (int i = a, int j = b; i < j; i++, j--) swap(str[i], str[j]);
      |                            ^~~~
      |                            ;
a.cc:21:45: error: expected ')' before ';' token
   21 |             for (int i = a, int j = b; i < j; i++, j--) swap(str[i], str[j]);
      |                 ~                           ^
      |                                             )
a.cc:21:52: error: 'j' was not declared in this scope
   21 |             for (int i = a, int j = b; i < j; i++, j--) swap(str[i], str[j]);
      |                                                    ^
Language: C++

#include<iostream>
#include<string>

using namespace std;

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

void reverse() {
    int a, b;
    int str, STR;
    cin >> str >> a >> b;
    STR = str.substr(a, b-a+1);
    for (int i = 0; i < STR.size(); i++) {
        str[a+i] = STR[STR.size()-j-1];
    }
}

void replace() {
    int a, b;
    int str, p;
    cin >> str >> a >> b;
    cin >> p;
    str.replace(a, p.size(), p);
}

int main(){
    string str, com;
    int q, a, b;
    cin >> str >> q;
    for (int i = 0; i < q; i++) {
        cin >> com >> a >> b;
        if (com == "print") print(str, a, b);
        else if (com == "reverse") reverse(str, a, b);
        else if (com == "replace") replace(str, a, b);
    }
    return 0;
}


Compiler output:
a.cc: In function 'void print()':
a.cc:10:17: error: request for member 'substr' in 'str', which is of non-class type 'int'
   10 |     cout << str.substr(a, b-a+1) << endl;
      |                 ^~~~~~
a.cc: In function 'void reverse()':
a.cc:17:15: error: request for member 'substr' in 'str', which is of non-class type 'int'
   17 |     STR = str.substr(a, b-a+1);
      |               ^~~~~~
a.cc:18:29: error: request for member 'size' in 'STR', which is of non-class type 'int'
   18 |     for (int i = 0; i < STR.size(); i++) {
      |                             ^~~~
a.cc:19:12: error: invalid types 'int[int]' for array subscript
   19 |         str[a+i] = STR[STR.size()-j-1];
      |            ^
a.cc:19:28: error: request for member 'size' in 'STR', which is of non-class type 'int'
   19 |         str[a+i] = STR[STR.size()-j-1];
      |                            ^~~~
a.cc:19:35: error: 'j' was not declared in this scope
   19 |         str[a+i] = STR[STR.size()-j-1];
      |                                   ^
a.cc: In function 'void replace()':
a.cc:28:9: error: request for member 'replace' in 'str', which is of non-class type 'int'
   28 |     str.replace(a, p.size(), p);
      |         ^~~~~~~
a.cc:28:22: error: request for member 'size' in 'p', which is of non-class type 'int'
   28 |     str.replace(a, p.size(), p);
      |                      ^~~~
a.cc: In function 'int main()':
a.cc:37:34: error: too many arguments to function 'void print()'
   37 |         if (com == "print") print(str, a, b);
      |                             ~~~~~^~~~~~~~~~~
a.cc:6:6: note: declared here
    6 | void print() {
      |      ^~~~~
a.cc:38:43: error: too many arguments to function 'void reverse()'
   38 |         else if (com == "reverse") reverse(str, a, b);
      |                                    ~~~~~~~^~~~~~~~~~~
a.cc:13:6: note: declared here
   13 | void reverse() {
      |      ^~~~~~~
a.cc:39:43: error: too many arguments to function 'void replace()'
   39 |         else if (com == "replace") replace(str, a, b);
      |                                    ~~~~~~~^~~~~~~~~~~
a.cc:23:6: note: declared here
   23 | void replace() {
      |      ^~~~~~~
Language: C++

#include<iostream>
#include<string>

using namespace std;

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

void reverse() {
    int a, b;
    string str, STR;
    cin >> str >> a >> b;
    STR = str.substr(a, b-a+1);
    for (int i = 0; i < STR.size(); i++) {
        str[a+i] = STR[STR.size()-j-1];
    }
}

void replace() {
    int a, b;
    syring str, p;
    cin >> str >> a >> b;
    cin >> p;
    str.replace(a, p.size(), p);
}

int main(){
    string str, com;
    int q, a, b;
    cin >> str >> q;
    for (int i = 0; i < q; i++) {
        cin >> com >> a >> b;
        if (com == "print") print(str, a, b);
        else if (com == "reverse") reverse(str, a, b);
        else if (com == "replace") replace(str, a, b);
    }
    return 0;
}


Compiler output:
a.cc: In function 'void reverse()':
a.cc:19:35: error: 'j' was not declared in this scope
   19 |         str[a+i] = STR[STR.size()-j-1];
      |                                   ^
a.cc: In function 'void replace()':
a.cc:25:5: error: 'syring' was not declared in this scope
   25 |     syring str, p;
      |     ^~~~~~
a.cc:26:12: error: 'str' was not declared in this scope; did you mean 'std'?
   26 |     cin >> str >> a >> b;
      |            ^~~
      |            std
a.cc:27:12: error: 'p' was not declared in this scope
   27 |     cin >> p;
      |            ^
a.cc: In function 'int main()':
a.cc:37:34: error: too many arguments to function 'void print()'
   37 |         if (com == "print") print(str, a, b);
      |                             ~~~~~^~~~~~~~~~~
a.cc:6:6: note: declared here
    6 | void print() {
      |      ^~~~~
a.cc:38:43: error: too many arguments to function 'void reverse()'
   38 |         else if (com == "reverse") reverse(str, a, b);
      |                                    ~~~~~~~^~~~~~~~~~~
a.cc:13:6: note: declared here
   13 | void reverse() {
      |      ^~~~~~~
a.cc:39:43: error: too many arguments to function 'void replace()'
   39 |         else if (com == "replace") replace(str, a, b);
      |                                    ~~~~~~~^~~~~~~~~~~
a.cc:23:6: note: declared here
   23 | void replace() {
      |      ^~~~~~~
Language: C++

#include<iostream>
#include<string>

using namespace std;

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

void reverse() {
    int a, b;
    string str, STR;
    cin >> str >> a >> b;
    STR = str.substr(a, b-a+1);
    for (int i = 0; i < STR.size(); i++) {
        str[a+i] = STR[STR.size()-i-1];
    }
}

void replace() {
    int a, b;
    string str, p;
    cin >> str >> a >> b;
    cin >> p;
    str.replace(a, p.size(), p);
}

int main(){
    string str, com;
    int q, a, b;
    cin >> str >> q;
    for (int i = 0; i < q; i++) {
        cin >> com >> a >> b;
        if (com == "print") print(str, a, b);
        else if (com == "reverse") reverse(str, a, b);
        else if (com == "replace") replace(str, a, b);
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:34: error: too many arguments to function 'void print()'
   37 |         if (com == "print") print(str, a, b);
      |                             ~~~~~^~~~~~~~~~~
a.cc:6:6: note: declared here
    6 | void print() {
      |      ^~~~~
a.cc:38:43: error: too many arguments to function 'void reverse()'
   38 |         else if (com == "reverse") reverse(str, a, b);
      |                                    ~~~~~~~^~~~~~~~~~~
a.cc:13:6: note: declared here
   13 | void reverse() {
      |      ^~~~~~~
a.cc:39:43: error: too many arguments to function 'void replace()'
   39 |         else if (com == "replace") replace(str, a, b);
      |                                    ~~~~~~~^~~~~~~~~~~
a.cc:23:6: note: declared here
   23 | void replace() {
      |      ^~~~~~~
Language: C++

#include<iostream>
#include<string>

using namespace std;


int main(){
    string str, com, p, STR;
    int q, a, b;
    cin >> str >> q;
    for (int i = 0; i < q; i++) {
        cin >> com;
        if (com == "print") {
            cout << str.substr(a, b-a+1) << endl;
        };
        else if (com == "reverse") {
            STR = str.substr(a, b-a+1);
            for (int i = 0; i < STR.size(); i++) {
                str[a+i] = STR[STR.size()-i-1];
            }
        };
        else if (com == "replace") {
            str.replace(a, b-a+1, p);
        };
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'else' without a previous 'if'
   16 |         else if (com == "reverse") {
      |         ^~~~
a.cc:22:9: error: 'else' without a previous 'if'
   22 |         else if (com == "replace") {
      |         ^~~~
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
    string command,q,str,str1,str2="",p;
    int n,a,b,c,d;
    cin>>str;
    cin>>n;
    for(int i=0;i<n;i++){
        if(command=="print"){
            q=str.substr(a,b-a+1);
            cout<<q<<endl;
        }
        if(command=="reverse"){
            str1=str.substr(a,b-a+1);
            c=str1.size();
            for(int i=c;i>0;i--){
                str2+=str1[i];
            }
            str=str.replace(a,b-a+1,str2);
        }
        if(command=="replace"){
            cin>>p;
            str=str.replace(a,b-a+1,p)
            
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:39: error: expected ';' before '}' token
   24 |             str=str.replace(a,b-a+1,p)
      |                                       ^
      |                                       ;
   25 | 
   26 |         }
      |         ~
Language: C++

#include <iostream>
#include <string>
#include <stirng.h>
using namespace std;
int main(){
    string str1,str2;
    int n,a,b;
    cin>>str1>>n;
    for(int i=0;i<n;i++){
        if(str1=="print"){
            cin>>a>>b;
            cout<<str1.substr(a,b-a+1);
        }
        else if(str1=="replace"){
            cin>>a>>b>>str2;
            str1.replace(a,b-a+1,str2);
        }
        else if(str1=="reverse"){
            cin>>a>>b;
            str2=str1.substr(a,b-a+1);
            for(int j=0,int k=b;k>=a;k--){
                str1[i]=str2[c++];
            }
        }
    }
return 0;
}


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

#include <iostream>
#include <string>
#include <string.h>
using namespace std;
int main(){
    string str1,str2;
    int n,a,b;
    cin>>str1>>n;
    for(int i=0;i<n;i++){
        if(str1=="print"){
            cin>>a>>b;
            cout<<str1.substr(a,b-a+1);
        }
        else if(str1=="replace"){
            cin>>a>>b>>str2;
            str1.replace(a,b-a+1,str2);
        }
        else if(str1=="reverse"){
            cin>>a>>b;
            str2=str1.substr(a,b-a+1);
            for(int j=0,int k=b;k>=a;k--){
                str1[i]=str2[c++];
            }
        }
    }
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:25: error: expected unqualified-id before 'int'
   21 |             for(int j=0,int k=b;k>=a;k--){
      |                         ^~~
a.cc:21:25: error: expected ';' before 'int'
   21 |             for(int j=0,int k=b;k>=a;k--){
      |                         ^~~
      |                         ;
a.cc:21:37: error: expected ')' before ';' token
   21 |             for(int j=0,int k=b;k>=a;k--){
      |                ~                    ^
      |                                     )
a.cc:21:38: error: 'k' was not declared in this scope
   21 |             for(int j=0,int k=b;k>=a;k--){
      |                                      ^
Language: C++

#include <iostream>
#include <string>
#include <string.h>
using namespace std;
int main(){
    string str1,str2;
    int n,a,b,j,k;
    cin>>str1>>n;
    for(int i=0;i<n;i++){
        if(str1=="print"){
            cin>>a>>b;
            cout<<str1.substr(a,b-a+1);
        }
        else if(str1=="replace"){
            cin>>a>>b>>str2;
            str1.replace(a,b-a+1,str2);
        }
        else if(str1=="reverse"){
            cin>>a>>b;
            str2=str1.substr(a,b-a+1);
            for(j=0,k=b;k>=a;k--){
                str1[i]=str2[c++];
            }
        }
    }
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:30: error: 'c' was not declared in this scope
   22 |                 str1[i]=str2[c++];
      |                              ^
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main() {
	string str, m, p, k, k2, k3[1000];
	int a, b, q, l = 0, z = 0, j;
	cin >> str >> q;
	for (int i = 0; i < q; i++) {
		cin >> m >> a >> b;
		if (m == "replace") {
			cin >> p;
			str.replace(a, p.size(), p);
		}
		if (m == "reverse") {
			reverse(str.begin() + a, str.begin() + b + 1);
			}
		}
		if (m == "print") {
			k3[z] = str.substr(a, b + 1);
			z = z + 1;
		}
	}
	for (int w = 0; w < z; w++) {
		cout << k3[w] << endl;
	}
}



Compiler output:
a.cc: In function 'int main()':
a.cc:15:25: error: 'reverse' was not declared in this scope
   15 |                         reverse(str.begin() + a, str.begin() + b + 1);
      |                         ^~~~~~~
a.cc: At global scope:
a.cc:23:9: error: expected unqualified-id before 'for'
   23 |         for (int w = 0; w < z; w++) {
      |         ^~~
a.cc:23:25: error: 'w' does not name a type
   23 |         for (int w = 0; w < z; w++) {
      |                         ^
a.cc:23:32: error: 'w' does not name a type
   23 |         for (int w = 0; w < z; w++) {
      |                                ^
a.cc:26:1: error: expected declaration before '}' token
   26 | }
      | ^
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main() {
	string str, m, p, k, k2, k3[1000];
	int a, b, q, z = 0, j;
	cin >> str >> q;
	for (int i = 0; i < q; i++) {
		cin >> m >> a >> b;
		if (m == "replace") {
			cin >> p;
			str.replace(a, p.size(), p);
		}
		if (m == "reverse") {
			k = str.substr(a, b+1);
			k2 = k;
			l = 0;
			for (j = k.size() - 1; j >= 0; j--) {
				k2[l] = k[j]; l = l + 1;
			}
			str.replace(a, k2.size(), k2);
		}
		if (m == "print") {
			k3[z] = str.substr(a, b + 1);
			z = z + 1;
		}
	}
	for (int w = 0; w < z; w++) {
		cout << k3[w] << endl;
	}
}



Compiler output:
a.cc: In function 'int main()':
a.cc:17:25: error: 'l' was not declared in this scope
   17 |                         l = 0;
      |                         ^