Query of l and r
qq = [ ( 2 , 3 ) , ( 5 , 5 ) ] NEW_LINE n = len ( qq ) NEW_LINE for i in range ( n ) : NEW_LINE INDENT l , r = qq [ i ] [ 0 ] , qq [ i ] [ 1 ] NEW_LINE l -= 1 NEW_LINE r -= 1 NEW_LINE a [ l ] += 1 NEW_LINE DEDENT