Python3 code for queries for number of elements that lie in range [ l , r ] ( with updates )
from typing import Generic , List , TypeVar NEW_LINE T = TypeVar ( ' T ' ) NEW_LINE V = TypeVar ( ' V ' ) NEW_LINE class Pair ( Generic [ V , T ] ) : NEW_LINE INDENT def __init__ ( self , first : V , second : T ) -> None : NEW_LINE INDENT self . first = first NEW_LINE self . second = second NEW_LINE DEDENT DEDENT