#include #include using namespace std; using namespace atcoder; using ll = long long; struct S{ ll sum; ll size; }; S op(S a, S b) { return {a.sum+b.sum, a.size+b.size}; } S e() {return {0, 0};} S mapping(ll f, S x) {return {x.sum + f, x.size};} ll composition(ll f, ll g) {return f + g;} ll id() {return 0;} int main() { int N, Q;cin >> N >> Q; vector A(N + 1, 0); for (int i = 1;i <= N;i++) cin >> A[i]; vector B(N + 1, {0, 1}); lazy_segtree seg(B); vector ans(N + 1, 0); while (Q--) { char c;cin >> c; if (c == 'A') { int x;ll y;cin >> x >> y; ans[x] += A[x] * seg.get(x).sum; seg.set(x, {0, 1}); A[x] += y; } else { int x, y;cin >> x >> y; seg.apply(x, y + 1, 1); } } for (int i = 1;i <= N;i++) { ans[i] += seg.get(i).sum * A[i]; cout << ans[i]<< " "; } cout << endl; }