差分模板。

#include<bits/stdc++.h>
#define int long long
#define double long double
#define x first
#define y second
using namespace std;
typedef long long LL;
typedef long long ll;
typedef pair<int, int> PII;
const int N = 3e5 + 10;
const int M = 1e3 + 10;
int mod = 1e9 + 7;
int a[N], b[N];

void solve() {
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) cin >> b[i];
    while (m--) {
        int l, r, k;
        cin >> l >> r >> k;
        a[l] += k, a[r + 1] -= k;
    }
    for (int i = 1; i <= n; i++) {
        a[i] += a[i - 1];
        cout << a[i] + b[i] << " ";
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int _;
    _ = 1;
    //cin>>_;
    while (_--) {
        solve();
    }
}