c solution
Code\n\nint cmp(const void*a,const void*b){\n    int* aa=*(int**)a;\n    int* bb=*(int**)b;\n    if(aa[0]==bb[0]) return aa[1]>bb[1];\n    return aa[0]>bb[0];\n
# Code\n```\nint cmp(const void*a,const void*b){\n    int* aa=*(int**)a;\n    int* bb=*(int**)b;\n    if(aa[0]==bb[0]) return aa[1]>bb[1];\n    return aa[0]>bb[0];\n}\nint countWays(int** ranges, int rangesSize, int* rangesColSize) {\n    qsort(ranges,rangesSize,sizeof(int*),cmp);\n    int res=1,mod=1e9+7,last=-1;\n    for(int i=0;i<rangesSize;i++){\n        if(last<ranges[i][0]){\n            res=(res*2)%mod;\n        }\n        last=fmax(last,ranges[i][1]);\n    }\n    return res;\n}\n```
['C']