Python simple solution beats 95% python codes - O(n)
class RLEIterator(object): def __init__(self, A):     """     :type A: List[int]     """     self.inputList = A def next(self, n):     """     :type n: int     
class RLEIterator(object):

    def __init__(self, A):
        """
        :type A: List[int]
        """
        self.inputList = A

    def next(self, n):
        """
        :type n: int
        :rtype: int
        """
        index = 0
        while index < len(self.inputList):
            if self.inputList[index] == 0:
                self.inputList = self.inputList[index+2:]
            elif n <= self.inputList[index]:
                output = self.inputList[index+1]
                self.inputList[index] -= n
                return output
            else:
                n -= self.inputList[index]
                self.inputList = self.inputList[index+2:]
        if n > 0:
            return -1
[]