#ifdef ONLINE_JUDGE
#define main _main
#include "grader.h"
#undef main
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
_main();
}
#endif
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename V>
using ordered_map = tree<T, V, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ordered_map<double,char>s;
ordered_set<double>z[200];
void Kezd(string S){
int n=S.size();
s[-1]=0;
for(int i=0;i<n;i++){
s[1e9*i/n]=S[i];
z[S[i]].insert(1e9*i/n);
}
s[1e9]=0;
}
void Beszur(int i,char x){
auto it=s.find_by_order(i);
double y=(it->first+next(it)->first)/2;
s[y]=x;
z[x].insert(y);
}
void Mutal(int i,char x){
auto it=s.find_by_order(i);
double y=it->first;
z[it->second].erase(y);
s[y]=x;
z[x].insert(y);
}
void Kivag(int i,int j){
auto it1=s.find_by_order(i);
auto it2=s.find_by_order(j+1);
while(it1!=it2){
z[it1->second].erase(it1->first);
it1=s.erase(it1);
}
}
int Szamlal(int i,int j,char x){
auto it1=s.find_by_order(i);
auto it2=s.find_by_order(j+1);
return z[x].order_of_key(it2->first)-z[x].order_of_key(it1->first);
}
string Eredmeny(){
string ans;
for(auto [_,x]:s){
if(x==0)continue;
ans+=x;
}
return ans;
}
#ifndef ONLINE_JUDGE
int main(){
freopen("be2.txt","r",stdin);
string S;
cin>>S;
Kezd(S);
while(true){
int o;
cin>>o;
if(o==0){
break;
}
if(o==1){
int i;
char x;
cin>>i>>x;
Beszur(i,x);
}
if(o==2){
int i;
char x;
cin>>i>>x;
Mutal(i,x);
}
if(o==3){
int i,j;
cin>>i>>j;
Kivag(i,j);
}
if(o==4){
int i,j;
char x;
cin>>i>>j>>x;
int res=Szamlal(i,j,x);
int ans;
cin>>ans;
ans--;
if(res!=ans){
cout<<"got "<<res<<'\n';
cout<<"exp "<<ans<<'\n';
return 1;
}
}
if(o==5){
string res=Eredmeny();
string ans;
cin>>ans;
ans.pop_back();
if(res!=ans){
cout<<"got "<<res<<'\n';
cout<<"exp "<<ans<<'\n';
return 1;
}
}
}
return 0;
}
#endif
Compilation error
exit status 1
main.cpp: In function 'int main()':
main.cpp:8:9: error: '_main' was not declared in this scope; did you mean 'main'?
8 | _main();
| ^~~~~
| main
Exited with error status 1