Check all subsets of good people
\nclass Solution:\n    def maximumGood(self, statements: List[List[int]]) -> int:\n        n = len(statements)\n        masks = []\n        for i in range(n):\n
```\nclass Solution:\n    def maximumGood(self, statements: List[List[int]]) -> int:\n        n = len(statements)\n        masks = []\n        for i in range(n):\n            good = bad = 0\n            for j in range(n):\n                if statements[i][j] == 0:\n                    bad |= 1 << j\n                if statements[i][j] == 1:\n                    good |= 1 << j\n            masks.append((good, bad))\n        res = 0\n        for mask in range(1 << n):\n            bads = 0\n            goods = 0\n            for i in range(n):\n                if mask & (1 << i):\n                    goods |= masks[i][0]\n                    bads |= masks[i][1]\n            if goods | mask == mask and mask & bads == 0:\n                res = max(res, mask.bit_count())\n        return re\n```
['Python']