If i is equal to r of any query store answer for that query in ans [ ]
while ( query_counter < q && queries [ query_counter ] . r == i ) { ans [ queries [ query_counter ] . idx ] = query ( queries [ query_counter ] . r + 1 , bit , n ) - query ( queries [ query_counter ] . l , bit , n ) ; query_counter ++ ; } }