#include #define rep(i,n) for(int i=0;i pp; const int INF = 1e9; const int MOD = 1000000007; /*1-indexedに注意!!!*/ struct BIT{ private: int n; vector bit; public: BIT(int m){ n = m; bit.resize(n+1); } ll sum(int i){ ll res = 0; while(i > 0){ res += bit.at(i); i -= i&-i; } return res; } void add(int i,ll val){ while(i <= n){ bit.at(i) += val; i += i&-i; } } }; int main() { int n,q; cin >> n >> q; vector a(n+1); rep(i,n) cin >> a[i+1]; vector> query; BIT bit(n+1); while(q--){ char c; ll x,y; cin >> c >> x >> y; if(c =='A'){ query.push_back({x,bit.sum(x),y}); }else{ bit.add(x,1); bit.add(y+1,-1); } } vector cnt(n+1); for(int i=1;i<=n;i++){ cnt[i] = bit.sum(i); } vector ans(n+1); for(int i=1;i<=n;i++){ ans[i] += a[i] * cnt[i]; } for(auto v:query){ ans[v[0]] += (cnt[v[0]] - v[1])*v[2]; } for(int i=1;i<=n;i++){ cout << ans[i] << " " ; } cout << endl; return 0; }