Perform queries
for ( int i = 0 ; i < ( int ) Q . size ( ) ; i ++ ) { if ( Q [ i ] [ 0 ] == 1 ) cout << query ( Q [ i ] [ 1 ] , Q [ i ] [ 2 ] , 0 , N - 1 , 0 , tree ) << " ▁ " ; else update ( 0 , N - 1 , 0 , Q [ i ] [ 1 ] , Q [ i ] [ 2 ] , tree , arr ) ; } }