Store the queries from [ L + 1 , R - 1 ] .
queries [ j ] . l = left + 1 ; queries [ j ] . r = right - 1 ; queries [ j ] . x = minn ; queries [ j ] . index = j ; ++ j ; } int Fenwick [ n + 1 ] ; memset ( Fenwick , 0 , sizeof Fenwick ) ; int q = j - 1 ;