Language: C++

v#include<bits/stdc++.h>
using namespace std;
#define int long long

const int MOD = 1000000007;
struct modint {
  long long val;
  modint(long long val=0) : val((val % MOD + MOD) % MOD){}
  modint operator-() const { return modint(-val); }
  modint& operator+=(const modint a) { if ((val += a.val)     >= MOD) val -= MOD; return *this; }
  modint& operator-=(const modint a) { if ((val += MOD-a.val) >= MOD) val -= MOD; return *this; }
  modint& operator*=(const modint a) { (val *= a.val) %= MOD; return *this; }
  modint operator+(const modint a) const { return (modint)*this += a; }
  modint operator-(const modint a) const { return (modint)*this -= a; }
  modint operator*(const modint a) const { return (modint)*this *= a; }
  modint pow(long long n) const { modint r(1), m(val); while (n > 0) { if (n & 1) r *= m; m *= m; n >>= 1; } return r; }
  modint inv() const { return pow(MOD-2); }
  modint& operator/=(const modint a) { return (*this) *= a.inv(); }
  modint operator/(const modint a) const { return (modint)*this /= a; }
  bool operator==(const modint &p) const { return val == p.val; }
  bool operator!=(const modint &p) const { return val != p.val; }
  friend ostream &operator<<(ostream &os, const modint &p) { return os << p.val; }
  friend istream &operator>>(istream &is, modint &a) { long long t; is >> t; a = modint(t); return (is); }
};

int N;
bool a[21][21];
modint dp[1<<22];
bool flag[1<<22];

modint solve(bitset<21>f) {
  if(flag[f.to_ulong()]) return dp[f.to_ulong()];
  flag[f.to_ulong()] = true;
  if(f.count()==0) return dp[f.to_ulong()] = modint(1);

  modint ret(0);
  int mi = N-f.count();
  for(int fi=0; fi<21; fi++) {
    if(f[fi]==0) continue;
    if(!a[mi][fi]) continue;
    bitset<21> fnew = f;
    fnew[fi] = 0;
    ret += solve(fnew);
  }
  return dp[f.to_ulong()] = ret;
}

signed main() {
  cin >> N;
  for(int i=0; i<N; i++) for(int j=0; j<N; j++) cin >> a[i][j];
  bitset<21> f((1<<N)-1);
  cout << solve(f) << endl;
}

Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | v#include<bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'v' does not name a type
    1 | v#include<bits/stdc++.h>
      | ^
a.cc:22:10: error: 'ostream' does not name a type
   22 |   friend ostream &operator<<(ostream &os, const modint &p) { return os << p.val; }
      |          ^~~~~~~
a.cc:23:10: error: 'istream' does not name a type
   23 |   friend istream &operator>>(istream &is, modint &a) { long long t; is >> t; a = modint(t); return (is); }
      |          ^~~~~~~
a.cc:31:14: error: 'bitset' was not declared in this scope
   31 | modint solve(bitset<21>f) {
      |              ^~~~~~
a.cc:31:24: error: 'f' was not declared in this scope
   31 | modint solve(bitset<21>f) {
      |                        ^
a.cc:31:27: error: expected ',' or ';' before '{' token
   31 | modint solve(bitset<21>f) {
      |                           ^
a.cc: In function 'int main()':
a.cc:49:3: error: 'cin' was not declared in this scope
   49 |   cin >> N;
      |   ^~~
a.cc:51:3: error: 'bitset' was not declared in this scope
   51 |   bitset<21> f((1<<N)-1);
      |   ^~~~~~
a.cc:51:14: error: 'f' was not declared in this scope
   51 |   bitset<21> f((1<<N)-1);
      |              ^
a.cc:52:3: error: 'cout' was not declared in this scope
   52 |   cout << solve(f) << endl;
      |   ^~~~
a.cc:52:23: error: 'endl' was not declared in this scope
   52 |   cout << solve(f) << endl;
      |                       ^~~~