Determine whether bitwise-OR of sub-array is odd
Code

#pragma GCC optimize(&quot;O2&quot;)


Normally we just pass that as a compiler flag, so we don't get &quot;unrecognised pragma&quot; warnings from other compilers.

    long int c,d,j,N,Q;


These are poor names - they tell us very little about what they are used for.
The number of array elements and the number of queries can't be negative.  I suggest size_t (from &lt;stdint.h&gt;) would be better than long for these.  Also consider what range is required for the other values (the challenge should state these bounds).  You might want to use the int_fastX_t and int_leastX_t families to ensure the required range.

    scanf(&quot;%ld %ld\n&quot;,&amp;N,&amp;Q);


Don't throw away the return value from scanf() like that.  It's important to know how many conversions were successfully performed before attempting to use the assigned values.
Algorithm
This is on average, much less computation than the naive brute-force algorithm, since we stop examining the array once we find an odd number.
Something to consider, especially for programming challenges, is that we often talk of average-case complexity using big-O notation, but it can be more helpful to think like an adversary: &quot;What's the worst-case input this algorithm could be given?&quot;.  The test cases are likely to include some arrays which are all odd or all even - the former being very expensive for this algorithm.
If we have many queries, we can spend a little time creating a structure to make each query constant-time.  The way I would approach this is probably to have an array of size_t that stores the running count of odd numbers.  Then, given a query Q(m,n), look at odd_count[n]; if it's equal to odd_count[m], we have only even numbers in the range, else we have at least one odd number.  Note that we don't need to actually store the input array, as we'll only use the running total.  Obviously, adjust m and n before lookup if these are inclusive in the challenge (it's a little unclear in your summary, but I assume more rigorously defined in the original).