Function to return the sum of values stored from O to idx index in the array using Fenwick Tree
int query ( int idx , vector < int > & bit ) { int res = 0 ; while ( idx > 0 ) { res += bit [ idx ] ; idx -= idx & ( - idx ) ; } return res ; }