2151. Maximum Good People Based on Statements.cpp
Code\n\nclass Solution {\npublic:\n    int maximumGood(vector<vector<int>>& statements) {\n        int ans = 0, n = statements.size(); \n        for (int m = (1
**Code**\n```\nclass Solution {\npublic:\n    int maximumGood(vector<vector<int>>& statements) {\n        int ans = 0, n = statements.size(); \n        for (int m = (1<<n)-1; m >= 0; --m) {\n            bool cand = true; \n            for (int i = 0; i < n; ++i) \n                if ((m & (1<<i)) && cand) \n                    for (int j = 0; j < n; ++j) \n                        if ((statements[i][j]==1 && !(m & 1<<j)) || (statements[i][j]==0 && (m & 1<<j))) {\n                            cand = false; \n                            break; \n                        }\n            if (cand) ans = max(ans, __builtin_popcount(m)); \n        }\n        return ans; \n    }\n};\n```
['C']