C++ concise
\nclass Solution {\npublic:\n    int maximumGood(vector<vector<int>>& ss) {\n        int n = ss.size(), res = 0;\n \n        for (int i = 1; i < (1 << n); i++) 
```\nclass Solution {\npublic:\n    int maximumGood(vector<vector<int>>& ss) {\n        int n = ss.size(), res = 0;\n \n        for (int i = 1; i < (1 << n); i++) {\n            bool valid = true;\n            for (int j = 0; valid && j < n; j++) {\n                if ((1 << j) & i) {\n                    for (int k = 0; k < n; k++) {\n                        if (ss[j][k] == 1 && ((1 << k) & ~i) ||\n                            !ss[j][k] && ((1 << k) & i))\n                            valid = false;\n                    }\n                }\n            }\n            \n            if (valid) {\n                res = max(res, __builtin_popcount(i));\n            } \n        }\n        return res;\n    }\n};\n```
[]