Function to solve each query
def SolveQuery ( arr : List [ int ] , n : int , Q : List [ Pair [ int , Pair [ int , int ] ] ] ) : NEW_LINE INDENT x = 0 NEW_LINE for i in range ( len ( Q ) ) : NEW_LINE INDENT if ( Q [ i ] . first == 1 ) : NEW_LINE INDENT x = getCount ( arr , n , Q [ i ] . second . first , Q [ i ] . second . second ) NEW_LINE print ( x , end = " ▁ " ) NEW_LINE DEDENT else : NEW_LINE INDENT setElement ( arr , n , Q [ i ] . second . first , Q [ i ] . second . second ) NEW_LINE DEDENT DEDENT DEDENT