#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include 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; } const long long MAX = 5100000; const long long INF = 1LL << 60; const int inf = 1 << 28; const long long mod = 1000000007LL; //const long long mod = 998244353LL; using namespace std; typedef unsigned long long ull; typedef long long ll; template struct lazySegTree { using F = function; using G = function; using H = function; using P = function; F f; G g; H h; P p; T d1; E d0; int n; vector dat; vector lazy; lazySegTree() {} lazySegTree(int n_, F f_, G g_, H h_, T d1_, E d0_, P p_ = [](E a, int b) {return a; }) : f(f_), g(g_), h(h_), p(p_), d1(d1_), d0(d0_) { n = 1; while (n < n_) n *= 2; dat.assign(n * 2 - 1, d1); lazy.assign(n * 2 - 1, d0); } void build(vector v) { for (ll i = 0; i < v.size(); i++) dat[i + n - 1] = v[i]; for (int i = n - 2; i >= 0; --i) dat[i] = f(dat[i * 2 + 1], dat[i * 2 + 2]); } // 区間の幅がlenの節点kについて遅延評価 inline void eval(int len, int k) { if (lazy[k] == d0) return; if (k * 2 + 1 < n * 2 - 1) { lazy[2 * k + 1] = h(lazy[k * 2 + 1], lazy[k]); lazy[2 * k + 2] = h(lazy[k * 2 + 2], lazy[k]); } dat[k] = g(dat[k], p(lazy[k], len)); lazy[k] = d0; } // [a, b) T update(int a, int b, E x, int k, int l, int r) { eval(r - l, k); if (b <= l || r <= a) return dat[k]; if (a <= l && r <= b) { lazy[k] = h(lazy[k], x); return g(dat[k], p(lazy[k], r - l)); } return dat[k] = f(update(a, b, x, 2 * k + 1, l, (l + r) / 2), update(a, b, x, 2 * k + 2, (l + r) / 2, r)); } T update(int a, int b, E x) { return update(a, b, x, 0, 0, n); } // [a, b) T query(int a, int b, int k, int l, int r) { eval(r - l, k); if (a <= l && r <= b) return dat[k]; bool left = !((l + r) / 2 <= a || b <= l), right = !(r <= 1 || b <= (l + r) / 2); if (left && right) return f(query(a, b, 2 * k + 1, l, (l + r) / 2), query(a, b, 2 * k + 2, (l + r) / 2, r)); if (left) return query(a, b, 2 * k + 1, l, (l + r) / 2); return query(a, b, 2 * k + 2, (l + r) / 2, r); } T query(int a, int b) { return query(a, b, 0, 0, n); } }; ll f(ll a, ll b) { return min(a, b); } ll g(ll a, ll b) { return a + b; } int main() { /* cin.tie(nullptr); ios::sync_with_stdio(false); */ ll N, Q; scanf("%lld %lld", &N, &Q); vector a(N); for (ll i = 0; i < N; i++) scanf("%lld", &a[i]); vector b(N); lazySegTree lsg(N + 1, f, g, g, 0LL, 0LL); while (Q--) { char c; cin >> c; if (c == 'A') { ll x, y; scanf("%lld %lld", &x, &y); x--; ll t = lsg.query(x, x + 1); b[x] += a[x] * t; lsg.update(x, x + 1, -t); a[x] += y; } else { ll x, y; scanf("%lld %lld", &x, &y); x--; lsg.update(x, y, 1); } } for (ll i = 0; i < N; i++) { b[i] += lsg.query(i, i + 1) * a[i]; printf("%lld", b[i]); if (i == N - 1) puts(""); else printf(" "); } return 0; /* おまじないを使ったらscanfとprintf関連注意!!!!!!!!!!!! */ }