#include #include using namespace atcoder; using namespace std; using ll=long long; using ld=long double; ld pie=3.141592653589793; ll mod=998244353; ll inf=10099999999999990; int main(){ ll n,m; cin >> n >> m; vectorl(n+1); l[0]=-inf; for (ll i = 0; i < n; i++) { cin >> l[i+1]; } l.push_back(inf); vectorf(m),b(m),w(m); for (ll i = 0; i < m; i++) { cin >> f[i] >> b[i] >> w[i]; } ll ans=0; for (ll i = 0; i < m; i++) { ll v=lower_bound(l.begin(),l.end(),f[i])-l.begin(); ll x=min(f[i]-l[v-1],l[v]-f[i]); if (b[i]+x