Python |set| straight forward O(n^2)
Since the size is just 200, just iterate all the subarrays.\n\nclass Solution:\n    def countDistinct(self, nums: List[int], k: int, p: int) -> int:\n        n 
Since the size is just 200, just iterate all the subarrays.\n```\nclass Solution:\n    def countDistinct(self, nums: List[int], k: int, p: int) -> int:\n        n = len(nums)\n        res = set()\n        for i in range(n):\n            for j in range(i+1,n+1):\n                cnt = 0\n                for c in nums[i:j]:\n                    if c%p == 0:\n                        cnt += 1\n                if cnt <= k:\n                    res.add(tuple(nums[i:j]))\n        return len(res) \n```
[]