Python3 simple solution - RLE Iterator
\nclass RLEIterator:\n\n    def __init__(self, A: List[int]):\n        self.A = A[::-1]\n\n    def next(self, n: int) -> int:\n        acc = 0\n        while ac
```\nclass RLEIterator:\n\n    def __init__(self, A: List[int]):\n        self.A = A[::-1]\n\n    def next(self, n: int) -> int:\n        acc = 0\n        while acc < n:\n            if not self.A:\n                return -1\n            times, num = self.A.pop(), self.A.pop()\n            acc += times\n        if acc > n:\n            self.A.append(num)\n            self.A.append(acc - n)\n        return num\n```
['Python', 'Python3']