[C++] Simple Solution
\nclass Solution {\npublic:\n    vector<int> v;\n    vector<vector<int>> rects;\n    // I add the +1 here because in some inputs they contain lines also like \n
```\nclass Solution {\npublic:\n    vector<int> v;\n    vector<vector<int>> rects;\n    // I add the +1 here because in some inputs they contain lines also like \n\t// [ 1,2,1,3 ] ( rectangle with height 0 or width 0 but this also contains 2 points )\n\t// to also add these points I add +1.\n    int area(vector<int>& r) {\n        return (r[2] - r[0] + 1) * (r[3] - r[1] + 1);\n    }\n    \n    Solution(vector<vector<int>> rect) {\n        rects = rect;\n        int totalArea=0;\n        for (auto r: rects) {\n            totalArea+=area(r);\n            v.push_back(totalArea);\n        }\n    }\n    \n    vector<int> pick() {\n        // pick a random reactangle in rects\n        int rnd = rand() % v.back();\n        int idx = upper_bound(v.begin(), v.end(), rnd) - v.begin();\n        \n        // pick a random point in rects[idx]\n        auto r = rects[idx];\n        int x = rand() % (r[2] - r[0] + 1) + r[0];\n        int y = rand() % (r[3] - r[1] + 1) + r[1];\n        return { x, y };\n    }\n};\n```
['C', 'C++']