generating all substring O(n^2log(n))
\n``int countDistinct(vector<int>& nums, int k, int p) {\n        int n=nums.size();\n        set<vector<int>>s;\n        for(int i=0;i<n;i++)\n        {\n     
```\n``int countDistinct(vector<int>& nums, int k, int p) {\n        int n=nums.size();\n        set<vector<int>>s;\n        for(int i=0;i<n;i++)\n        {\n            int c=0;\n            vector<int>l;\n            for(int j=i;j<n;j++)\n            {\n                if(nums[j]%p==0)\n                    c++;\n                if(c>k)\n                    break;\n                l.push_back(nums[j]);\n                s.insert(l);\n            }\n        }\n        return s.size();\n    }\n```
['C']