Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int h, w, k;

int hashcount(vector<vector<char> > m) {
  int total = 0;
  rep(i, h) {
    rep(j, w) {
      if (m[i][j] == '#') total++;
    }
  }
  return total;
}

bool at_position(int num, int pos) {
  bool bit = num & (1 << pos);
  return bit;
}

int main() {
  cin >> h >> w >> k;

  vector<vector<char> > ma(h, {});

  rep(i, h) {
    rep(j, w) {
      char c;
      cin >> c;
      ma[i].push_back(c);
    }
  }

  int result = 0;

  for (int bh = 0; bh < (1 << h); bh++) {
    for (int bw = 0; bw < (1 << w); bw++) {
      vector<vector<char> > m(h, {});
      rep(hii, h) {
        rep(wii, w) { m[hii].push_back(ma[hii][wii]); }
      }

      rep(hi, h) {
        rep(wi, w) {
          if (at_position(bh, hi)) {
            m[hi] = vector<char>(w, '.');
          }
          if (at_position(bw, wi)) {
            rep(hii, h) { m[hii][wi] = '.'; }
          }
        }
      }
      if (hashcount(m) == k) result++;
    }
  }

  cout << result;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:33: error: call of overloaded 'vector(int&, <brace-enclosed initializer list>)' is ambiguous
   26 |   vector<vector<char> > ma(h, {});
      |                                 ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::vector<char>; _Alloc = std::allocator<std::vector<char> >; size_type = long unsigned int; value_type = std::vector<char>; allocator_type = std::allocator<std::vector<char> >]'
  569 |       vector(size_type __n, const value_type& __value,
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::vector<char>; _Alloc = std::allocator<std::vector<char> >; size_type = long unsigned int; allocator_type = std::allocator<std::vector<char> >]'
  556 |       vector(size_type __n, const allocator_type& __a = allocator_type())
      |       ^~~~~~
a.cc:40:36: error: call of overloaded 'vector(int&, <brace-enclosed initializer list>)' is ambiguous
   40 |       vector<vector<char> > m(h, {});
      |                                    ^
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::vector<char>; _Alloc = std::allocator<std::vector<char> >; size_type = long unsigned int; value_type = std::vector<char>; allocator_type = std::allocator<std::vector<char> >]'
  569 |       vector(size_type __n, const value_type& __value,
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::vector<char>; _Alloc = std::allocator<std::vector<char> >; size_type = long unsigned int; allocator_type = std::allocator<std::vector<char> >]'
  556 |       vector(size_type __n, const allocator_type& __a = allocator_type())
      |       ^~~~~~