Python 3   ||   3 lines,  nC2 combinations   ||   T/S: 84% / 97%
\nclass Solution:\n    def countOfPairs(self, n: int, x: int, y: int) -> List[int]:\n        \n        ans=[0]*(n+1)\n\n        for rght,left in combinations(ra
```\nclass Solution:\n    def countOfPairs(self, n: int, x: int, y: int) -> List[int]:\n        \n        ans=[0]*(n+1)\n\n        for rght,left in combinations(range(1,n+1), 2):\n\n                ans[min(left - rght, abs(x-rght)+1+abs(y-left), \n                                     abs(y-rght)+1+abs(x-left))]+= 2  \n        return ans[1:]\n```\n[https://leetcode.com/problems/count-the-number-of-houses-at-a-certain-distance-i/submissions/1285494248/](https://leetcode.com/problems/count-the-number-of-houses-at-a-certain-distance-i/submissions/1285494248/)[]()\n\n\nI could be wrong, but I think that time complexity is *O*(*N*^2) and space complexity is *O*(*N*), in which *N* ~ `n`.
['Python3']