#include <bits/stdc++.h>
#define ll long long 
using namespace std;
ll a[500007];
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll n, q;
    cin >>n>>q;
    for(int i=0;i<n;i++)
    {
        cin >>a[i];
    }
    for (int i=0;i<q;i++)
    {
        ll x,y,z;
        cin >>x>>y>>z;
        if (x%2==0) x+=1;
        if (y%2==0) y-=1;
        cout <<y-x+1<<endl;
    }
}
