#include using namespace std; using ll = long long; int main(){ int n,m,q; cin>>n>>m>>q; vector p(n); vector s(n); for(int i = 0;i>p[i]>>s[i]; } int mx = 2e5; const int B = 700; vector nnn(mx+1,0); vector now(mx+1,0); vector l(q),r(q); vector ccc(mx+1,0); vector cnc(n,0); vector nxt(n,-1); vector> is(mx+1); for(int i = 0;i=0;j--){ if(s[is[i][j]]=="AC"){ cnc[is[i][j]] = now; nxt[is[i][j]] = ni; now= 0; ni = is[i][j]; }else{ now++; } } } for(int i = 0;i>l[i]>>r[i]; l[i]--; } vector idx(q); for(int i = 0;i r[j]; return r[i] < r[j]; }); int ans = 0; int cnt = 0; int nl = 0; int nr = 1; vector> aa(q); if(s[0]=="AC"){ ans++; nnn[p[0]]++; now[p[0]]++; }else{ now[p[0]]++; } for(int i = 0;ir[ni]){ nr--; if(s[nr]=="AC"){ now[p[nr]]--; nnn[p[nr]]--; if(nnn[p[nr]]==0){ cnt -= ccc[p[nr]]; ccc[p[nr]] = 0; ans--; } }else{ now[p[nr]]--; } } aa[ni] = make_pair(ans,cnt); } for(int i = 0;i