simple and shortest  using string | map
\nclass Solution {\npublic:\n    int countDistinct(vector<int>& arr, int k, int p) {\n        int n=arr.size();\n        int ans = 0 ,ct=0;\n        \n        u
```\nclass Solution {\npublic:\n    int countDistinct(vector<int>& arr, int k, int p) {\n        int n=arr.size();\n        int ans = 0 ,ct=0;\n        \n        unordered_map<string,int> mp;\n        \n        for(int i=0;i<n;i++){\n            int ct=0;\n            string s="";      // subarry represent into string format\n            \n            for(int j=i;j<n;j++){\n                \n                s = s + "$" + to_string(arr[j]);   // \'$\'  is used to make unique representaion of subarray\n                \n                if(arr[j]%p == 0) ct++;\n                \n                if(ct <= k) mp[s]++;      // stored in map to avoid duplicate\n            }  \n        }\n        \n        return mp.size();\n    }\n};\n```
['String', 'C']