If query is of type 2 then function call to update with BITree
for ( int i = m ; i >= 1 ; i -- ) if ( q [ i ] [ 0 ] == 2 ) update ( BITree , q [ i ] [ 1 ] - 1 , q [ i ] [ 2 ] - 1 , m , 1 ) ; for ( int i = m ; i >= 1 ; i -- ) { if ( q [ i ] [ 0 ] == 2 ) { long int val = getSum ( BITree , i - 1 ) ; update ( BITree , q [ i ] [ 1 ] - 1 , q [ i ] [ 2 ] - 1 , m , val ) ; } }