#include #define rep(i, n) for(int i=0;i<(int)(n);i++) #define pb push_back #define pob pop_back #define eb emplace_back #define nall(a) a.begin(),a.end() #define rall(a) a.rbegin(),a.rend() #define yesno(a) cout<<(a?"Yes\n":"No\n") #define lb lower_bound #define ub lower_bound #define yes cout<<"Yes\n" #define no cout<<"No\n" using namespace std; using ll = long long; using ull = unsigned long long; using pii = pair; using pll = pair; template using pq = priority_queue; template using pqg = priority_queue, greater>; template using vec = vector; template using vv = vector>; template using vvv = vector>; template using vvvv = vector>; template using vvvvv = vector>; void solve(); signed main(){ ios::sync_with_stdio(false); cin.tie(nullptr); unsigned T = 1; // cin >> T; cout << fixed << setprecision(20); while (T--) solve(); return 0; } void solve(){ int N, Q; cin >> N >> Q; vector S{0}; rep(i, N){ int x; cin >> x; S.pb(S[i]+x); } while (Q--){ int l, r, k; cin >> l >> r >> k; cout << S[r]-S[l-1] << endl; } }