Driver Code
if __name__ == " _ _ main _ _ " : NEW_LINE INDENT N = 5 NEW_LINE Q = 3 NEW_LINE queries = [ [ 0 for _ in range ( 2 ) ] for _ in range ( Q ) ] NEW_LINE queries [ 0 ] [ 0 ] = 1 NEW_LINE queries [ 0 ] [ 1 ] = 0 NEW_LINE queries [ 1 ] [ 0 ] = 3 NEW_LINE queries [ 1 ] [ 1 ] = 3 NEW_LINE queries [ 2 ] [ 0 ] = 2 NEW_LINE queries [ 2 ] [ 1 ] = 2 NEW_LINE solve ( N , Q , queries ) NEW_LINE DEDENT