#include <bits/stdc++.h>
using namespace std;
#define lol long long
#define forin for(int i = 1; i <= n; i++)
#define forjn for(int j = 1; j <= n; j++)
#define forch(j, k) for(int i = j; i <= k; i++)
#define Yes cout << "YES" << endl
#define No cout << "NO" << endl
const lol N = 3e5+10;
lol t, n, q, a[N], c, l, r, sz;
void solve() {
    cin >> n >> q;
    forin cin >> a[i];
    forch(1, q) {
        cin >> c >> l >> r;
        sz = r-l+1;
        if(sz % 2 == 0) cout << sz << endl;
        else cout << sz-1 << endl;
    }
}
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    t = 1;
    //cin >> t;
    while(t--) solve();
}