Easy solutions beats 92% runtime
Intuition\n\n\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- T
# Intuition\n![fastest_solution.png](https://assets.leetcode.com/users/images/ec1aa77a-2383-4fbb-bf49-7e7c7a05e3cf_1709994450.5346391.png)\n\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")\n\nclass Solution {\npublic:\n    int m,n;\n    int i,j;\n    Solution(int m, int n) {\n        cin.tie(nullptr); \n        cout.tie(nullptr); \n        ios_base::sync_with_stdio(false);\n        \n        this->m = m;\n        this->n = n;\n        i = j = 0;\n    }\n    \n    vector<int> flip() {\n        vector<int> res = {i,j};\n        j = (j + 1) % n;\n        i = (i + (j == 0)) % m;\n        return res;\n    }\n    \n    void reset() {\n    }\n#if 0 // not so efficient\n    int m,n;\n    set<pair<int,int>> index;\n    Solution(int m, int n) {\n        this->m = m;\n        this->n = n;\n    }\n    \n    vector<int> flip() {\n        int i = rand()%m;\n        int j = rand()%n;\n        while (index.count({i,j})) {\n            i = rand()%m;\n            j = rand()%n;\n        }\n        index.insert({i,j});\n        return {i,j};\n    }\n    \n    void reset() {\n        index.clear();\n    }\n#endif\n#if 0 // MLE\n    vector<vector<int>> indexes;\n    vector<vector<int>> copy;\n    Solution(int m, int n) {\n        for (int i = 0; i < m; ++i) {\n            for (int j = 0; j < n; ++i) {\n                indexes.push_back({i,j});\n            }\n        }\n        random_shuffle(indexes.begin(), indexes.end());\n        copy = indexes;\n    }\n    \n    vector<int> flip() {\n        vector<int> back = indexes.back();\n        indexes.pop_back();\n        return back;\n    }\n    \n    void reset() {\n        indexes = copy;\n        random_shuffle(indexes.begin(), indexes.end());\n        copy = indexes;\n    }\n#endif\n};\n\n/**\n * Your Solution object will be instantiated and called as such:\n * Solution* obj = new Solution(m, n);\n * vector<int> param_1 = obj->flip();\n * obj->reset();\n */\n```
['C++']