Short C++ code | using set stl
```\nint countDistinct(vector& nums, int k, int p) {\n       int ans = 0 , n = nums.size() ;\n       set st ;\n       for(int i=0;i<n;i++){\n           int temp
```\nint countDistinct(vector<int>& nums, int k, int p) {\n       int ans = 0 , n = nums.size() ;\n       set<string> st ;\n       for(int i=0;i<n;i++){\n           int temp = 0 ;\n           string t = "" ;\n           for(int j=i;j<n;j++){\n               if(nums[j]%p==0) temp++ ;\n               if(temp>k) break ;\n               t += to_string(nums[j]) ;\n               t+= " " ;\n               if(st.count(t)==0)ans++ ;\n               st.insert(t) ;\n           }\n       }\n     return ans ;\n    }
[]