#include using namespace std; #define REP(i, s) for (int i = 0; i < s; ++i) #define ALL(v) (v).begin(), (v).end() #define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl #define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i) #define DEBUG #define int long long #define INF 1e18 template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template ostream& operator << (ostream &s, pair P) { return s << '<' << P.first << ", " << P.second << '>'; } template ostream& operator << (ostream &s, vector P) { for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; } template ostream& operator << (ostream &s, vector > P) { for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; } template ostream& operator << (ostream &s, set P) { EACH(it, P) { s << "<" << *it << "> "; } return s << endl; } template ostream& operator << (ostream &s, map P) { EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; } templatevoid show(vectorv){for (int i = 0; i < v.size(); i++){cerr<>n>>q; vectora(n),b(n,0),c(n+1,0),x(q),y(q); vectorv,w; mapmp; REP(i,n) cin>>a[i]; for (int i = 0; i < q; i++) { char c; cin>>c; cin>>x[i]>>y[i]; x[i]--; if(c=='B'){ v.push_back(i); y[i]--; for(auto &u : mp){ //cerr<d; for (int i = 0; i < n; i++) { if(c[i]!=0){ d.push_back(i); } } // show(c); //cerr<