C++ solutions
\nclass Solution {\npublic:\n    vector<vector<int>> rects;\n    \n    Solution(vector<vector<int>> rects) : rects(rects) {\n    }\n    \n    vector<int> pick()
```\nclass Solution {\npublic:\n    vector<vector<int>> rects;\n    \n    Solution(vector<vector<int>> rects) : rects(rects) {\n    }\n    \n    vector<int> pick() {\n        int sum_area = 0;\n        vector<int> selected;\n        \n        /* Step 1 - select a random rectangle considering the area of it. */\n        for (auto r : rects) {\n            /*\n             * What we need to be aware of here is that the input may contain\n             * lines that are not rectangles. For example, [1, 2, 1, 5], [3, 2, 3, -2].\n             * \n             * So, we work around it by adding +1 here. It does not affect\n             * the final result of reservoir sampling.\n             */\n            int area = (r[2] - r[0] + 1) * (r[3] - r[1] + 1);\n            sum_area += area;\n            \n            if (rand() % sum_area < area)\n                selected = r;\n        }\n        \n        /* Step 2 - select a random (x, y) coordinate within the selected rectangle. */\n        int x = rand() % (selected[2] - selected[0] + 1) + selected[0];\n        int y = rand() % (selected[3] - selected[1] + 1) + selected[1];\n        \n        return { x, y };\n    }\n};\n```
['C', 'C++']