simple C++ solution ,Comlexity:O(n^2)
class Solution {\n# public:\n    int countDistinct(vector& nums, int k, int p) {\n        set>s;\n       for(int i=0;i<nums.size();i++){\n           int count=0
class Solution {\n# public:\n    int countDistinct(vector<int>& nums, int k, int p) {\n        set<vector<int>>s;\n       for(int i=0;i<nums.size();i++){\n           int count=0;\n           for(int j=i;j<nums.size();j++){\n               if(nums[j]%p==0){\n                   count++;\n               } if(count>k){\n                   break;\n               }else{\n                   vector<int>v(nums.begin()+i,nums.begin()+j+1);\n                   s.insert(v);\n               }\n           }\n       }  \n        return s.size();\n    }\n};
['C', 'Ordered Set']