Function to solve each query
void SolveQuery ( int arr [ ] , int n , vector < pair < int , pair < int , int > > > Q ) { int x ; for ( int i = 0 ; i < Q . size ( ) ; i ++ ) { if ( Q [ i ] . first == 1 ) { x = getCount ( arr , n , Q [ i ] . second . first , Q [ i ] . second . second ) ; cout << x << " ▁ " ; } else { setElement ( arr , n , Q [ i ] . second . first , Q [ i ] . second . second ) ; } } }