alexjercan/bugnet huggingface dataset:
Problem p02614 (C++) — buggy submission, verdict: Runtime Error

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

#include <bits/stdc++.h>
using namespace std;

int main() {
  long long int H, W, K, res = 0;
  vector<vector<bool>> m, tmp0, tmp1;

  cin >> H >> W >> K;

  m.resize(H);
  rep(i, H) {
    string s;
    cin >> s;
    rep(j, W) { m[i].push_back((s[j] == '#')); }
  }

  for (int biti = 0; biti < (1 << H); ++biti) {
    tmp0 = m;
    for (int i = 0; i < H; ++i) {
      if (biti & (1 << i)) {
        rep(k, W) { tmp0[i][k] = false; }
      }
    }
    tmp1 = tmp0;
    for (int bitj = 0; bitj < (1 << W); ++bitj) {
      for (int j = 0; j < W; ++j) {
        if (bitj & (1 << j)) {
          rep(l, H) { tmp0[l][j] = false; }
        }
      }
      long long int count = 0;
      rep(p, H) {
        rep(q, W) {
          if (tmp0[p][q]) {
            count++;
          }
        }
      }
      if (count == K) {
        res++;
      }
      tmp0 = tmp1;
    }
  }

  cout << res;

  return 0;
}

Error: WA

Fixed submission:

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

#include <bits/stdc++.h>
using namespace std;

int main() {
  long long int H, W, K, res = 0;
  vector<vector<bool>> m, tmp0, tmp1;

  cin >> H >> W >> K;

  m.resize(H);
  rep(i, H) {
    string s;
    cin >> s;
    rep(j, W) { m[i].push_back((s[j] == '#')); }
  }
  rep(i, H) { m.resize(W); }

  for (int biti = 0; biti < (1 << H); ++biti) {
    tmp0 = m;
    for (int i = 0; i < H; ++i) {
      if (biti & (1 << i)) {
        rep(k, W) { tmp0[i][k] = false; }
      }
    }
    tmp1 = tmp0;
    for (int bitj = 0; bitj < (1 << W); ++bitj) {
      for (int j = 0; j < W; ++j) {
        if (bitj & (1 << j)) {
          rep(l, H) { tmp0[l][j] = false; }
        }
      }
      long long int count = 0;
      rep(p, H) {
        rep(q, W) {
          if (tmp0[p][q]) {
            count++;
          }
        }
      }
      if (count == K) {
        res++;
      }
      tmp0 = tmp1;
    }
  }

  cout << res;

  return 0;
}
Problem p02614 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int h, w, k, ans = 0;
vector<string> map;
vector<int> isRed;

void convert(int black) {
  vector<string> cur = map;
  for (int i = 0; i < h; i++) {
    if (isRed[i]) {
      for (int j = 0; j < w; j++) {
        if (cur[i][j] == '#') {
          black--;
          cur[i][j] = '.';
        }
      }
    }
  }
  for (int i = h; i < isRed.size(); i++) {
    if (isRed[i]) {
      for (int j = 0; j < h; j++) {
        if (cur[j][i - h] == '#') {
          black--;
          cur[j][i - h] = '.';
        }
      }
    }
  }
  if (black == k)
    ans++;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int black = 0;
  cin >> h >> w >> k;
  map = vector<string>(h);
  for (int i = 0; i < h; i++) {
    cin >> map[i];
    for (int j = 0; j < w; j++) {
      if (map[i][j] == '#')
        black++;
    }
  }
  for (int i = 0; i < h + w; i++) {
    isRed = vector<int>(h + w);
    for (int j = 0; j < i; j++)
      isRed[j] = 1;
    do {
      convert(black);
    } while (prev_permutation(isRed.begin(), isRed.end()));
  }
  cout << ans;
}

Error: WA

Fixed submission:

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int h, w, k, ans = 0;
vector<string> map;
vector<int> isRed;

void convert(int black) {
  vector<string> cur = map;
  for (int i = 0; i < h; i++) {
    if (isRed[i]) {
      for (int j = 0; j < w; j++) {
        if (cur[i][j] == '#') {
          black--;
          cur[i][j] = '.';
        }
      }
    }
  }
  for (int i = h; i < isRed.size(); i++) {
    if (isRed[i]) {
      for (int j = 0; j < h; j++) {
        if (cur[j][i - h] == '#') {
          black--;
          cur[j][i - h] = '.';
        }
      }
    }
  }
  if (black == k)
    ans++;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int black = 0;
  cin >> h >> w >> k;
  map = vector<string>(h);
  for (int i = 0; i < h; i++) {
    cin >> map[i];
    for (int j = 0; j < w; j++) {
      if (map[i][j] == '#')
        black++;
    }
  }
  for (int i = 0; i < h * w; i++) {
    isRed = vector<int>(h + w);
    for (int j = 0; j < i; j++)
      isRed[j] = 1;
    do {
      convert(black);
      /*
      for(int j=0;j<isRed.size();j++){
              cout<<isRed[j]<<' ';
      }cout<<ans<<'\\n';
      */
    } while (prev_permutation(isRed.begin(), isRed.end()));
  }
  cout << ans;
}
Problem p02614 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int main() {
  int w, h, k;
  cin >> h >> w >> k;
  char m[7][7];
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w; j++)
      cin >> m[i][j];
  long long ans = 0;
  for (int sr = 0; sr < (1 << h); sr++)
    for (int sc = 0; sc < (1 << w); sc++) {
      int count = 0;
      for (int i = 0; i < h; i++)
        for (int j = 0; j < w; j++)
          if (m[i][j] == '#' && (!(sr & (1 << i)) && !(sc & (1 << j))))
            count++;
      if (count == k)
        ans++;
    }
  cout << ans << '\\n';
}


Error: 0

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int w, h, k;
  cin >> h >> w >> k;
  char m[w][h];
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w; j++)
      cin >> m[i][j];
  long long ans = 0;
  for (int sr = 0; sr < (1 << h); sr++)
    for (int sc = 0; sc < (1 << w); sc++) {
      int count = 0;
      for (int i = 0; i < h; i++)
        for (int j = 0; j < w; j++)
          if (m[i][j] == '#' && !((sr & (1 << i)) || (sc & (1 << j))))
            count++;
      if (count == k)
        ans++;
    }
  cout << ans << '\\n';
}
Problem p02614 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for (int i = 0; i < int(N); ++i)
using ll = long long;
const int INF = 2147483647;
const ll MOD = 1000000007;
// const ll INF = 1000000000000000000LL;

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  char grid[h][w];
  rep(i, h) {
    rep(j, w) {
      char in;
      cin >> in;
      grid[i][j] = in;
    }
  }
  int n = h + w;
  int cnt = 0;
  //----- bit 全探索 ------
  // ここで2^n-1個のbit列を列挙
  for (int bit = 0; bit < (1 << n); ++bit) {
    vector<int> vec(n);
    char now_grid[h][w];
    rep(i, h) {
      rep(j, w) { now_grid[i][j] = grid[i][j]; }
    }
    // rep(i,h){
    //   rep(j,w){
    //     cout << now_grid[i][j];
    //   }
    //   cout << endl;
    // }
    // ここで、列の各位が1かをみる
    for (int i = 0; i < n; ++i) {
      if (bit & (1 << i)) {
        // もし1だったら何か処理
        // 今回はbit列を表示させる
        vec[i] = 1;
      }
    }
    // 0がえらばれた場所の#の数を数える
    //  行 0~h-1
    //  列 h~h+w
    rep(i, n) {
      if (vec[i] == 1) {
        if (i >= 0 && i < h) {
          // たて
          rep(j, w) { now_grid[i][j] = '.'; }
        }
        if (i >= h && i < n) {
          // よこ
          rep(j, h) { now_grid[j][i - h] = '.'; }
        }
      }
    }
    int c = 0;
    rep(i, h) {
      rep(j, w) {
        if (now_grid[i][j] == '#')
          c++;
      }
    }
    if (c == k)
      cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for (int i = 0; i < int(N); ++i)
using ll = long long;
const int INF = 2147483647;
const ll MOD = 1000000007;
// const ll INF = 1000000000000000000LL;

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> grid(w + 1);
  rep(i, h) {
    string in;
    cin >> in;
    grid[i] = in;
  }
  int n = h + w;
  int cnt = 0;
  //----- bit 全探索 ------
  // ここで2^n-1個のbit列を列挙
  for (int bit = 0; bit < (1 << n); ++bit) {
    vector<int> vec(n);
    auto now_grid = grid;
    // ここで、列の各位が1かをみる
    for (int i = 0; i < n; ++i) {
      if (bit & (1 << i)) {
        // もし1だったら何か処理
        // 今回はbit列を表示させる
        vec[i] = 1;
      }
    }
    // 0がえらばれた場所の#の数を数える
    //  行 0~h-1
    //  列 h~h+w
    rep(i, n) {
      if (vec[i] == 1) {
        if (i >= 0 && i < h) {
          // たて
          rep(j, w) { now_grid[i][j] = '.'; }
        }
        if (i >= h) {
          // よこ
          rep(j, h) { now_grid[j][i - h] = '.'; }
        }
      }
    }
    int c = 0;
    rep(i, h) {
      rep(j, w) {
        if (now_grid[i][j] == '#')
          c++;
      }
    }
    if (c == k)
      cnt++;
  }
  cout << cnt << endl;
  return 0;
}
Problem p02614 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
using namespace std;
using ll = unsigned long long;
using p = pair<int, int>;

int main() {
  int H, W, K;
  cin >> H >> W >> K;

  vector<vector<int>> m(H, vector<int>(W));

  const int black = 1;

  rep(y, 0, H) {
    string s;
    cin >> s;
    rep(x, 0, W) {
      char c = s[x];
      if (c == '#') {
        m[y][x] = black;
      }
    }
  }
  int ans = 0;
  rep(j, 0, 1 << H) {
    rep(i, 0, 1 << W) {
      int count = 0;
      rep(y, 0, H) {
        rep(x, 0, W) {
          if ((j >> y) & 1)
            continue;
          if ((i >> x) & 1)
            continue;

          if (m[y][x] == black)
            ++count;
        }
      }
      if (count == K) {
        ++ans;
      }
    }
  }

  cout << ans << endl;
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
using namespace std;
using ll = unsigned long long;
using p = pair<int, int>;

int main() {
  int H, W, K;
  cin >> H >> W >> K;

  vector<vector<int>> m(W, vector<int>(H));

  const int black = 1;

  rep(y, 0, H) {
    string s;
    cin >> s;
    rep(x, 0, W) {
      char c = s[x];
      if (c == '#') {
        m[y][x] = black;
      }
    }
  }
  int ans = 0;
  rep(j, 0, 1 << H) {
    rep(i, 0, 1 << W) {
      int count = 0;
      rep(y, 0, H) {
        rep(x, 0, W) {
          if ((j >> y) & 1)
            continue;
          if ((i >> x) & 1)
            continue;

          if (m[y][x] == black)
            ++count;
        }
      }
      if (count == K) {
        ++ans;
      }
    }
  }

  cout << ans << endl;
  return 0;
}
Problem p02614 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define endl '\\n'
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  int h, w, k;
  cin >> h >> w >> k;
  string grid[h];
  for (int i = 0; i < h; i++)
    cin >> grid[i];
  int res = 0;
  for (int mask = 0; mask < (1 << (h + w)); mask++) {
    int cnt = 0;
    for (int col = 0; col < w; col++) {
      for (int row = 0; row < h; row++) {
        if (grid[row][col] != '#')
          continue;
        if ((mask & ((1 << col) | (1 << (w + row)))) != 0)
          continue;
        cnt++;
      }
    }
    if (cnt == k)
      res++;
  }
  cout << res << endl;
}

Error: -11

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define endl '\\n'
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  int h, w, k;
  cin >> h >> w >> k;
  string grid[h];
  for (int i = 0; i < h; i++)
    cin >> grid[i];
  int res = 0;
  for (int mask = 0; mask < (1 << (h + w)); mask++) {
    int cnt = 0;
    for (int col = 0; col < w; col++) {
      for (int row = 0; row < h; row++) {
        if (grid[col][row] != '#')
          continue;
        if ((mask & ((1 << col) | (1 << (w + row)))) != 0)
          continue;
        cnt++;
      }
    }
    if (cnt == k)
      res++;
  }
  cout << res << endl;
}
Problem p02614 (C++) — buggy submission, verdict: Runtime Error

#include <bitset>
#include <iostream>

int main() {
  unsigned int H, W, K;
  std::cin >> H >> W >> K;
  char board[H][W];
  for (unsigned int i = 0; i < H; i++) {
    for (unsigned int j = 0; j < W; j++) {
      std::cin >> board[i][j];
    }
  }

  /*
  for(unsigned int i=0; i<H; i++){
      for(unsigned int j=0; j<W; j++){
          std::cout << board[i][j] << " ";
      }
      std::cout << std::endl;
  }
  */

  unsigned int black = 0, count = 0;

  for (int maskR = 0; maskR < (1 << H); maskR++) {
    for (int maskC = 0; maskC < (1 << W); maskC++) {

      black = 0;
      for (unsigned int i = 0; i < H; i++) {
        for (unsigned int j = 0; j < W; j++) {
          if (maskR & (1 << i) || maskC & (1 << j))
            continue;
          if (board[i][j] == '#')
            black++;
        }
      }
      if (black == K) {
        count++;
      }
    }
  }

  std::cout << count << std::endl;

  // int end;
  // std::cin >> end;
  return 0;
}

Error: WA

Fixed submission:

#include <bitset>
#include <iostream>

int main() {
  unsigned int H, W, K;
  std::cin >> H >> W >> K;
  std::string board[H][K];
  for (unsigned int i = 0; i < H; i++) {
    for (unsigned int j = 0; j < W; j++) {
      std::cin >> board[i][j];
    }
  }

  /*
  for(unsigned int i=0; i<H; i++){
      for(unsigned int j=0; j<W; j++){
          std::cout << board[i][j];
      }
      std::cout << std::endl;
  }
  */

  unsigned int black = 0, count = 0;

  for (int maskR = 0; maskR < (1 << H); maskR++) {
    for (int maskC = 0; maskC < (1 << W); maskC++) {

      black = 0;
      for (unsigned int i = 0; i < H; i++) {
        for (unsigned int j = 0; j < W; j++) {
          if (maskR & (1 << i) || maskC & (1 << j))
            continue;
          if (board[i][j] == "#")
            black++;
        }
      }
      if (black == K) {
        count++;
      }
    }
  }

  std::cout << count << std::endl;

  // int end;
  // std::cin >> end;
  return 0;
}
Problem p02614 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define boost                                                                  \\
  ios::sync_with_stdio(false);                                                 \\
  cin.tie(0)
#define ll long long int
#define ld long double
#define mk make_pair
#define pb push_back
#define f first
#define s second
#define fo(i, a, b) for (i = a; i < b; i++)
#define foe(i, a, b) for (i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
// #define vi               vector<int>
#define vl vector<long long int>
// #define pii          pair <int,int>
#define pll pair<long long int, long long int>
// #define vpii         vector< pair<int,int> >
#define vpll vector<pair<long long int, long long int>>
#define MOD 1000000007
using namespace std;
const int inf = INT_MAX;
const ll inf64 = LLONG_MAX;

char arr[6][6];
ll ans;
ll h, w, k;
void work(ll a, ll b) {
  char temp[h][w];
  ll i, j;
  fo(i, 0, h) { fo(j, 0, w) temp[i][j] = arr[i][j]; }
  fo(i, 0, h) {
    if (a & (1 << i)) {
      fo(j, 0, w) temp[i][j] = '.';
    }
  }
  fo(i, 0, w) {
    if (b & (1 << i)) {
      fo(j, 0, h) temp[j][i] = '.';
    }
  }
  ll cnt = 0;
  fo(i, 0, h) {
    fo(j, 0, w) {
      if (temp[i][j] == '#')
        cnt++;
    }
  }
  if (cnt == k)
    ans++;
}

int main() {
  boost;
  cin >> h >> w >> k;
  ll i, j;
  fo(i, 0, h) fo(j, 0, w) cin >> arr[i][j];
  fo(i, 0, (1 << h)) {
    fo(j, 0, (1 << w)) { work(i, j); }
  }
  cout << ans;
  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
#define boost                                                                  \\
  ios::sync_with_stdio(false);                                                 \\
  cin.tie(0)
#define ll long long int
#define ld long double
#define mk make_pair
#define pb push_back
#define f first
#define s second
#define fo(i, a, b) for (i = a; i < b; i++)
#define foe(i, a, b) for (i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
// #define vi               vector<int>
#define vl vector<long long int>
// #define pii          pair <int,int>
#define pll pair<long long int, long long int>
// #define vpii         vector< pair<int,int> >
#define vpll vector<pair<long long int, long long int>>
#define MOD 1000000007
using namespace std;
const int inf = INT_MAX;
const ll inf64 = LLONG_MAX;

char arr[6][6];
ll ans;
ll h, w, k;
ll work(ll a, ll b) {
  char temp[h][w];
  ll i, j;
  fo(i, 0, h) { fo(j, 0, w) temp[i][j] = arr[i][j]; }
  fo(i, 0, h) {
    if (a & (1 << i)) {
      fo(j, 0, w) temp[i][j] = '.';
    }
  }
  fo(i, 0, w) {
    if (b & (1 << i)) {
      fo(j, 0, h) temp[j][i] = '.';
    }
  }
  ll cnt = 0;
  fo(i, 0, h) {
    fo(j, 0, w) {
      if (temp[i][j] == '#')
        cnt++;
    }
  }
  if (cnt == k)
    ans++;
}

int main() {
  boost;
  cin >> h >> w >> k;
  ll i, j;
  fo(i, 0, h) fo(j, 0, w) cin >> arr[i][j];
  fo(i, 0, (1 << h)) {
    fo(j, 0, (1 << w)) { work(i, j); }
  }
  cout << ans;
  return 0;
}
Problem p02614 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, n, m, ans = 0, k, t, r, c;
  char ch;
  cin >> n >> m >> k;
  int a[n][m];
  memset(a, 0, sizeof(a));
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cin >> ch;
      if (ch == '#')
        a[i][j] = 1;
    }
  }
  for (r = 0; r < (1 << n); r++) {
    for (c = 0; c < (1 << m); c++) {
      t = 0;
      for (i = 0; i < n; i++) {
        for (j = 0; j < m; j++) {
          if ((1 << i) & r)
            continue;
          if ((1 << j) & c)
            continue;
          t += a[i][j];
        }
      }
      if (t == k)
        ans++;
    }
  }
  cout << ans;
  return 0;
}

Error: -11

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, n, m, ans = 0, k, t, r, c;
  char ch;
  cin >> n >> m >> k;
  int a[n][m];
  memset(a, 0, sizeof(a));
  for (i = 0; i < n; i++) {
    for (i = 0; i < m; i++) {
      cin >> ch;
      if (ch == '#')
        a[i][j] = 1;
    }
  }
  for (r = 0; r < (1 << n); r++) {
    for (c = 0; c < (1 << m); c++) {
      t = 0;
      for (i = 0; i < n; i++) {
        for (j = 0; j < m; j++) {
          if ((1 << i) & r)
            continue;
          if ((1 << j) & c)
            continue;
          t += a[i][j];
        }
      }
      if (t == k)
        ans++;
    }
  }
  cout << ans;
  return 0;
}
Problem p02614 (C++) — buggy submission, verdict: Runtime Error

///*Bismillahir Rahmanir Rahim***///
/***Stay_Home_Stay_Safe***/
///**Author Thasin Sheikh**///
#include <bits/stdc++.h>
using namespace std;
#define MAX 1e6 + 10
#define MOD 1000000007
#define PI 3.14159265359
#define makefast__ ios_base::sync_with_stdio(false);
using ll = long long int;
using dl = double;
const int N = 2e5 + 10;
ll aarray[200000 + 10];
ll magic[101][101];
vector<ll> primes;
bool prime[1000001];
char a[8][8], b[8][8];
ll n, m, k;
ll ans = 0;
void solve() {
  ll i, j;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      b[i][j] = a[i][j];
    }
  }
  return;
}
void color(ll i, ll j) {
  for (ll l = 0; l < n; l++) {
    if (i & (1 << l)) {
      for (ll y = 0; y < m; y++) {
        b[l][y] = 'k';
      }
    }
  }
  for (ll l = 0; l < m; l++) {
    if (j & (1 << l)) {
      for (ll y = 0; y < n; y++) {
        b[y][l] = 'k';
      }
    }
  }
  return;
}
bool check() {
  ll i, j, c = 0;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if (b[i][j] == '#')
        c++;
    }
  }
  if (c == k)
    return true;
  else
    return false;
}
int main() {
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  makefast__ string str;
  ll i, j, t;
  cin >> n >> m >> k;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  for (i = 0; i < (1 << n); i++) {
    for (j = 0; j < (1 << m); j++) {
      solve();
      color(i, j);
      if (check())
        ans++;
    }
  }
  cout << ans << endl;

  return 0;
}


Error: 0

Fixed submission:

///*Bismillahir Rahmanir Rahim***///
/***Stay_Home_Stay_Safe***/
///**Author Thasin Sheikh**///
#include <bits/stdc++.h>
using namespace std;
#define MAX 1e6 + 10
#define MOD 1000000007
#define PI 3.14159265359
#define makefast__ ios_base::sync_with_stdio(false);
using ll = long long int;
using dl = double;
const int N = 2e5 + 10;
ll aarray[200000 + 10];
ll magic[101][101];
vector<ll> primes;
bool prime[1000001];
char a[8][8], b[8][8];
ll n, m, k;
ll ans = 0;
ll solve() {
  ll i, j;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      b[i][j] = a[i][j];
    }
  }
}
void color(ll i, ll j) {
  for (ll l = 0; l < n; l++) {
    if (i & (1 << l)) {
      for (ll y = 0; y < m; y++) {
        b[l][y] = 'k';
      }
    }
  }
  for (ll l = 0; l < m; l++) {
    if (j & (1 << l)) {
      for (ll y = 0; y < n; y++) {
        b[y][l] = 'k';
      }
    }
  }
}
bool check() {
  ll i, j, c = 0;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if (b[i][j] == '#')
        c++;
    }
  }
  if (c == k)
    return true;
  else
    return false;
}
int main() {
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  makefast__ string str;
  ll i, j, t;
  cin >> n >> m >> k;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  for (i = 0; i < (1 << n); i++) {
    for (j = 0; j < (1 << m); j++) {
      solve();
      color(i, j);
      if (check())
        ans++;
    }
  }
  cout << ans << endl;

  return 0;
}
Problem p02614 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define FASTIO                                                                 \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(0);
#define rep(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
using namespace std;
using ii = pair<int, int>;
using ll = long long int;

int arr[10][10];

int main() {
  FASTIO;

  // freopen("./input.txt", "r", stdin);

  int h, w, k;
  cin >> h >> w >> k;

  rep(i, 0, h) {
    rep(j, 0, w) {
      char a;
      cin >> a;
      if (a == '.')
        arr[i][j] = 1;
      else if (a == '#')
        arr[i][j] = 2;
      else
        arr[i][j] = 0;
    }
  }

  int ans = 0;

  for (int i = 0; i < (1 << h); i++) {
    int row[10];
    memset(row, 0, sizeof(row));
    int ii = i, idx = 0;
    while (ii) {
      row[idx++] = ii % 2;
      ii /= 2;
    }

    rep(j, 0, (1 << w)) {
      int col[10];
      memset(col, 0, sizeof(col));
      int jj = j, jdx = 0;
      while (jj) {
        col[jdx++] = jj % 2;
        jj /= 2;
      }
      int rlt = 0;
      rep(id, 0, h) {
        if (!row[id])
          continue;
        rep(jd, 0, w) {
          if (!col[jd])
            continue;
          if (arr[id][jd] == 2) {
            rlt++;
          }
        }
        cout << endl;
      }
      if (rlt == k)
        ans++;
    }
    // cout << "----------:: " << i << endl;
  }

  cout << ans << endl;
  return 0;
}


Error: -7

Fixed submission:

#include <bits/stdc++.h>
#define FASTIO                                                                 \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(0);
#define rep(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
using namespace std;
using ii = pair<int, int>;
using ll = long long int;

int arr[10][10];

int main() {
  FASTIO;

  freopen("./input.txt", "r", stdin);

  int h, w, k;
  cin >> h >> w >> k;

  rep(i, 0, h) {
    rep(j, 0, w) {
      char a;
      cin >> a;
      if (a == '.')
        arr[i][j] = 1;
      else if (a == '#')
        arr[i][j] = 2;
      else
        arr[i][j] = 0;
    }
  }

  int ans = 0;

  for (int i = 0; i < (1 << h); i++) {
    int row[10];
    memset(row, 0, sizeof(row));
    int ii = i, idx = 0;
    while (ii) {
      row[idx++] = ii % 2;
      ii /= 2;
    }

    rep(j, 0, (1 << w)) {
      int col[10];
      memset(col, 0, sizeof(col));
      int jj = j, jdx = 0;
      while (jj) {
        col[jdx++] = jj % 2;
        jj /= 2;
      }
      int rlt = 0;
      rep(id, 0, h) {
        if (!row[id])
          continue;
        rep(jd, 0, w) {
          if (!col[jd])
            continue;
          if (arr[id][jd] == 2) {
            rlt++;
          }
        }
        cout << endl;
      }
      if (rlt == k)
        ans++;
    }
    cout << "----------:: " << i << endl;
  }

  cout << ans << endl;
  return 0;
}