#include #include using namespace std; int main() { int N, M; cin >> N >> M; vector> S(N, vector(M)); for (int n = 0; n < N; ++n) { for (int m = 0; m < M; ++m) { cin >> S[n][m]; } } vector dp(1 << M, 0); dp[0] = 1; for (int bit = 0; bit < (1 << M); ++bit) { vector idx; for (int n = 0; n < N; ++n) { bool valid = true; for (int m = 0; m < M; ++m) { if ((bit & (1 << m)) && !S[n][m]) { valid = false; break; } } if (valid) { idx.push_back(n); } } for (int m = 0; m < M; ++m) { if (bit & (1 << m)) { continue; } int sum = 0; for (int n : idx) { sum += S[n][m]; } if (sum * 2 >= static_cast(idx.size())) { dp[bit | (1 << m)] += dp[bit]; } } } int ans = dp[(1 << M) - 1]; cout << ans << endl; return 0; }