Java super easy O(n) time O(1) space solution! Clean code!
```\nclass RLEIterator {\n    int index=0;\n    long sum=0, cur=0;\n    int[] nums;\n    public RLEIterator(int[] A) {\n        nums=A;\n        sum=A[0];\n    
```\nclass RLEIterator {\n    int index=0;\n    long sum=0, cur=0;\n    int[] nums;\n    public RLEIterator(int[] A) {\n        nums=A;\n        sum=A[0];\n    }\n    \n    public int next(int n) {\n        if(index>=nums.length) return -1;\n        cur+=n;\n        while(cur>sum&&index<nums.length) {\n            index+=2;\n            if(index<nums.length) sum+=nums[index];\n        } \n        if(index<nums.length) return nums[index+1];\n        else return -1;\n    }\n}
[]