func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long Mx = 512;   long long D[Mx][Mx];   int32_t main() {     long long n, m, mod, a = 0, b = 0;     cin >> n >> m >> mod;     vector<long long> C(n);     for (long long i = 0; i < m; i++)       for (long long j = 0; j < n; j++) {         char c;         cin >> c;         if (c ==  1 ) C[j]++;       }     for (long long i = 0; i < n; i++)       if (C[i] == 0)         a++;       else if (C[i] == 1)         b++;     D[0][0] = 1;     for (long long d = 1; d <= a + b; d++) {       for (long long i = 0; i <= d; i++) {         long long j = d - i;         D[i][j] =             (((i >= 2) ? ((i * (i - 1) / 2 % mod) * D[i - 2][j + 2] % mod) : 0) +              ((i >= 1) ? ((i * j % mod) * D[i - 1][j] % mod) : 0) +              ((j >= 2) ? ((j * (j - 1) / 2 % mod) * D[i][j - 2] % mod) : 0)) %             mod;       }     }     cout << D[a][b];   }   