sort ^^
\nint countWays(vector<vector<int>>& r)\n{\n\tsort(begin(r), end(r));\n\tint out{1};\n\tfor(int M{INT_MIN}; const auto & r : r) \n\t{\n\t\tif(r[0]>M) p=2*p%1000
```\nint countWays(vector<vector<int>>& r)\n{\n\tsort(begin(r), end(r));\n\tint out{1};\n\tfor(int M{INT_MIN}; const auto & r : r) \n\t{\n\t\tif(r[0]>M) p=2*p%1000000007;\n\t\tM = max(M, r[1]);\n\t}\n\treturn out; \n}\n```
['C', 'C++']