very easy to understand || must see
Code\n\nstatic int fast_io = []() \n{ \n    std::ios::sync_with_stdio(false); \n    cin.tie(nullptr); \n    cout.tie(nullptr); \n    return 0; \n}();\n\n#ifdef 
# Code\n```\nstatic int fast_io = []() \n{ \n    std::ios::sync_with_stdio(false); \n    cin.tie(nullptr); \n    cout.tie(nullptr); \n    return 0; \n}();\n\n#ifdef LOCAL\n    freopen("input.txt", "r" , stdin);\n    freopen("output.txt", "w", stdout);\n#endif\n\nclass RLEIterator {\npublic:\n    int idx;\n    vector<int>v;\n    RLEIterator(vector<int>& encoding) \n    {\n        idx = 0;\n        v = encoding;\n    }\n    \n    int next(int n) \n    {\n        while(idx < v.size()-1 and (v[idx] == 0 or v[idx] < n))\n        {\n            n = n - v[idx];\n            idx = idx + 2;\n        }  \n\n        if(idx >= v.size()-1)\n        return -1;\n\n        if(idx < v.size()-1 and v[idx] > n)\n        {\n            v[idx] = v[idx] - n;\n            return v[idx+1];\n        }\n        else if(idx < v.size()-1 and v[idx] == n)\n        {\n            int ele = v[idx+1];\n            v[idx] = v[idx] - n;\n            idx = idx + 2;\n            return ele;\n        }\n        return -1;\n    }\n};\n\n/**\n * Your RLEIterator object will be instantiated and called as such:\n * RLEIterator* obj = new RLEIterator(encoding);\n * int param_1 = obj->next(n);\n */\n```
['Array', 'Design', 'Counting', 'Iterator', 'C++']