Language: C++

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


int n, m, k;

void color_row(vector<string>& g, int r) {
  REP(j, m) g[r][j] = '.';
}

void color_col(vector<string>& g, int c) {
  REP(i, n) g[i][c] = '.';
}

int black(int rmask, int cmask, vector<string> g) {
  REP(i, n) if(rmask & (1 << i)) color_row(i);
  REP(j, m) if(cmask & (1 << j)) color_col(j);
  int res = 0;
  REP(i, n) REP(j, m) res += g[i][j] == '#';
  return res;
}

int main() {
  cin >> n >> m >> k;
  vector<string> g(n);
  REP(i, n) cin >> g[i];
  int ans = 0;
  REP(i, 1 << n) {
    REP(j, 1 << m) {
      if(black(i, j, g) == k) ++ans;
    }
  }
  cout << ans << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'void color_row(std::vector<std::__cxx11::basic_string<char> >&, int)':
a.cc:9:7: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
    9 |   REP(j, m) g[r][j] = '.';
      |       ^
a.cc:2:34: note: in definition of macro 'REP'
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                                  ^
a.cc:2:41: error: expected ';' before ':' token
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                                         ^
a.cc:9:3: note: in expansion of macro 'REP'
    9 |   REP(j, m) g[r][j] = '.';
      |   ^~~
a.cc:10:1: error: expected primary-expression before '}' token
   10 | }
      | ^
a.cc:9:27: error: expected ';' before '}' token
    9 |   REP(j, m) g[r][j] = '.';
      |                           ^
      |                           ;
   10 | }
      | ~                          
a.cc:10:1: error: expected primary-expression before '}' token
   10 | }
      | ^
a.cc:9:27: error: expected ')' before '}' token
    9 |   REP(j, m) g[r][j] = '.';
      |                           ^
      |                           )
   10 | }
      | ~                          
a.cc:2:22: note: to match this '('
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                      ^
a.cc:9:3: note: in expansion of macro 'REP'
    9 |   REP(j, m) g[r][j] = '.';
      |   ^~~
a.cc:10:1: error: expected primary-expression before '}' token
   10 | }
      | ^
a.cc: In function 'void color_col(std::vector<std::__cxx11::basic_string<char> >&, int)':
a.cc:13:7: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
   13 |   REP(i, n) g[i][c] = '.';
      |       ^
a.cc:2:34: note: in definition of macro 'REP'
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                                  ^
a.cc:2:41: error: expected ';' before ':' token
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                                         ^
a.cc:13:3: note: in expansion of macro 'REP'
   13 |   REP(i, n) g[i][c] = '.';
      |   ^~~
a.cc:14:1: error: expected primary-expression before '}' token
   14 | }
      | ^
a.cc:13:27: error: expected ';' before '}' token
   13 |   REP(i, n) g[i][c] = '.';
      |                           ^
      |                           ;
   14 | }
      | ~                          
a.cc:14:1: error: expected primary-expression before '}' token
   14 | }
      | ^
a.cc:13:27: error: expected ')' before '}' token
   13 |   REP(i, n) g[i][c] = '.';
      |                           ^
      |                           )
   14 | }
      | ~                          
a.cc:2:22: note: to match this '('
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                      ^
a.cc:13:3: note: in expansion of macro 'REP'
   13 |   REP(i, n) g[i][c] = '.';
      |   ^~~
a.cc:14:1: error: expected primary-expression before '}' token
   14 | }
      | ^
a.cc: In function 'int black(int, int, std::vector<std::__cxx11::basic_string<char> >)':
a.cc:17:7: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
   17 |   REP(i, n) if(rmask & (1 << i)) color_row(i);
      |       ^
a.cc:2:34: note: in definition of macro 'REP'
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                                  ^
a.cc:2:41: error: expected ';' before ':' token
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                                         ^
a.cc:17:3: note: in expansion of macro 'REP'
   17 |   REP(i, n) if(rmask & (1 << i)) color_row(i);
      |   ^~~
a.cc:2:19: error: expected primary-expression before 'for'
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                   ^~~
a.cc:18:3: note: in expansion of macro 'REP'
   18 |   REP(j, m) if(cmask & (1 << j)) color_col(j);
      |   ^~~
a.cc:17:47: error: expected ';' before 'for'
   17 |   REP(i, n) if(rmask & (1 << i)) color_row(i);
      |                                               ^
      |                                               ;
a.cc:2:19: error: expected primary-expression before 'for'
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                   ^~~
a.cc:18:3: note: in expansion of macro 'REP'
   18 |   REP(j, m) if(cmask & (1 << j)) color_col(j);
      |   ^~~
a.cc:17:47: error: expected ')' before 'for'
   17 |   REP(i, n) if(rmask & (1 << i)) color_row(i);
      |                                               ^
      |                                               )
a.cc:2:22: note: to match this '('
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                      ^
a.cc:17:3: note: in expansion of macro 'REP'
   17 |   REP(i, n) if(rmask & (1 << i)) color_row(i);
      |   ^~~
a.cc:18:7: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
   18 |   REP(j, m) if(cmask & (1 << j)) color_col(j);
      |       ^
a.cc:2:34: note: in definition of macro 'REP'
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                                  ^
a.cc:2:41: error: expected ';' before ':' token
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                                         ^
a.cc:18:3: note: in expansion of macro 'REP'
   18 |   REP(j, m) if(cmask & (1 << j)) color_col(j);
      |   ^~~
a.cc:2:19: error: expected primary-expression before 'for'
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                   ^~~
a.cc:20:3: note: in expansion of macro 'REP'
   20 |   REP(i, n) REP(j, m) res += g[i][j] == '#';
      |   ^~~
a.cc:19:15: error: expected ')' before 'for'
   19 |   int res = 0;
      |               ^
      |               )
a.cc:2:22: note: to match this '('
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                      ^
a.cc:18:3: note: in expansion of macro 'REP'
   18 |   REP(j, m) if(cmask & (1 << j)) color_col(j);
      |   ^~~
a.cc:20:7: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
   20 |   REP(i, n) REP(j, m) res += g[i][j] == '#';
      |       ^
a.cc:2:34: note: in definition of macro 'REP'
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                                  ^
a.cc:2:41: error: expected ';' before ':' token
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                                         ^
a.cc:20:3: note: in expansion of macro 'REP'
   20 |   REP(i, n) REP(j, m) res += g[i][j] == '#';
      |   ^~~
a.cc:2:41: error: expected ';' before ':' token
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                                         ^
a.cc:20:13: note: in expansion of macro 'REP'
   20 |   REP(i, n) REP(j, m) res += g[i][j] == '#';
      |             ^~~
a.cc:2:41: error: expected primary-expression before ':' token
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                                         ^
a.cc:20:13: note: in expansion of macro 'REP'
   20 |   REP(i, n) REP(j, m) res += g[i][j] == '#';
      |             ^~~
a.cc:2:41: error: expected ')' before ':' token
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                                         ^
a.cc:20:13: note: in expansion of macro 'REP'
   20 |   REP(i, n) REP(j, m) res += g[i][j] == '#';
      |             ^~~
a.cc:2:22: note: to match this '('
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                      ^
a.cc:20:3: note: in expansion of macro 'REP'
   20 |   REP(i, n) REP(j, m) res += g[i][j] == '#';
      |   ^~~
a.cc:2:41: error: expected primary-expression before ':' token
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                                         ^
a.cc:20:13: note: in expansion of macro 'REP'
   20 |   REP(i, n) REP(j, m) res += g[i][j] == '#';
      |             ^~~
a.cc:21:10: error: 'res' was not declared in this scope
   21 |   return res;
      |          ^~~
a.cc: In function 'int main()':
a.cc:27:7: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
   27 |   REP(i, n) cin >> g[i];
      |       ^
a.cc:2:34: note: in definition of macro 'REP'
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                                  ^
a.cc:2:41: error: expected ';' before ':' token
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                                         ^
a.cc:27:3: note: in expansion of macro 'REP'
   27 |   REP(i, n) cin >> g[i];
      |   ^~~
a.cc:2:19: error: expected primary-expression before 'for'
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                   ^~~
a.cc:29:3: note: in expansion of macro 'REP'
   29 |   REP(i, 1 << n) {
      |   ^~~
a.cc:28:15: error: expected ')' before 'for'
   28 |   int ans = 0;
      |               ^
      |               )
a.cc:2:22: note: to match this '('
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                      ^
a.cc:27:3: note: in expansion of macro 'REP'
   27 |   REP(i, n) cin >> g[i];
      |   ^~~
a.cc:29:7: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
   29 |   REP(i, 1 << n) {
      |       ^
a.cc:2:34: note: in definition of macro 'REP'
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                                  ^
a.cc:2:41: error: expected ';' before ':' token
    2 | #define REP(i, n) for(int i = 0; i < (n): ++i)
      |                                         ^
a.cc:29:3: note: in expansion of macro 'REP'
   29 |   REP(i, 1 << n) {
      |   ^~~
a.cc:36:3: error: expected primary-expression before 'return'
   36 |   return 0;
      |   ^~~~~~
a.cc:34:23: error: expected ')' before 'return'
   34 |   cout << ans << endl;
      |                       ^
      |                       )
   35 | 
   36 |   return 0;
      |