// #pragma GCC optimize("no-stack-protector") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") // #pragma vector temporal // #pragma simd // #pragma GCC diagnostic ignored "-W" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // #include // #include using namespace std; // using namespace __gnu_pbds; #define ll long long #define ld long double #define X first #define Y second #define pb push_back #define eb emplace_back #define pii pair #define vint vector #define SS stringstream #define PQ priority_queue #define MS(x,v) memset((x),(v),sizeof(x)) #define RZUNI(x) sort(x.begin(),x.end()), x.resize(unique(x.begin(),x.end())-x.begin()) #define FLH fflush(stdout) #define CPPinput ios_base::sync_with_stdio(0); cin.tie(0) #define FIN(fname) freopen(fname,"r",stdin) #define FOUT(fname) freopen(fname,"w",stdout) #define tm Ovuvuevuevue #define y1 Enyetuenwuevue #define left Ugbemugbem #define ws Osas #define dec tetteterette #define exp expexpexpexp #define expl explexplexpl #define YES cout<<"YES"<= 201103L #include #include #include #endif void JIZZ(string output=""){cout<>t; while(t--){ int n,q; cin>>n>>q; string s; cin>>s; struct node{ node *l,*r; struct data{ int t,c; data operator+(const data &b)const{ if(t==b.t)return data(t,c+b.c); else return t>1) function build=[&build,&s](node *now,int l,int r){ if(l==r){ now->v=node::data(s[l],1); } else build(now->l=new node(),l,mid),build(now->r=new node(),mid+1,r),now->v=now->l->v+now->r->v; }; function query=[&query](node *now,int l,int r,int ql,int qr){ if(qrv; return query(now->l,l,mid,ql,qr)+query(now->r,mid+1,r,ql,qr); }; function del=[&del](node *now){ if(!now)return; del(now->l); del(now->r); delete now; }; build(root,0,n-1); cout<<"Case #"<<(++k)<<":\n"; while(q--){ int l,r; cin>>l>>r; cout<