C++ coordinate compression
\nclass Solution {\npublic:\n    vector<int> fallingSquares(vector<vector<int>>& ps) {\n        set<int> sx;\n        for (auto &p : ps) sx.emplace(p[0]), sx.em
```\nclass Solution {\npublic:\n    vector<int> fallingSquares(vector<vector<int>>& ps) {\n        set<int> sx;\n        for (auto &p : ps) sx.emplace(p[0]), sx.emplace(p[0] + p[1]);\n        vector<int> x(sx.begin(), sx.end()), hs(x.size()), ans;\n        unordered_map<int, int> idx;\n        for (int i = 0; auto t : x) idx[t] = i++;\n        for (int mh = 0; auto &p : ps) {\n            int l = idx[p[0]], r = idx[p[0] + p[1]];\n            int mx = *max_element(hs.begin() + l, hs.begin() + r);\n            for (int i = l; i < r; i++) hs[i] = p[1] + mx;\n            mh = max(mh, hs[l]);\n            ans.emplace_back(mh);\n        }\n        return ans;\n    }\n};\n```
[]