alexjercan/bugnet huggingface dataset:
Problem p00616 (C++) — buggy submission, verdict: Memory Limit Exceeded

// 35
#include <algorithm>
#include <iostream>
#include <set>
#include <string>
#include <utility>

using namespace std;

int main() {
  for (int n, h; cin >> n >> h, n | h;) {
    set<pair<pair<int, int>, int>> s;
    for (int i = 0; i < h; i++) {
      string c;
      cin >> c;
      int tp[3] = {};
      int d[3] = {};
      if (c == "xy") {
        cin >> tp[0] >> tp[1];
        d[2] = 1;
      } else if (c == "yz") {
        cin >> tp[1] >> tp[2];
        d[0] = 1;
      } else {
        cin >> tp[0] >> tp[2];
        d[1] = 1;
      }
      for (int i = 1; i <= n; i++) {
        s.insert(make_pair(make_pair(tp[0] + d[0] * i, tp[1] + d[1] * i),
                           tp[2] + d[2] * i));
      }
    }
    cout << n * n * n - s.size() << endl;
  }
  return 0;
}

Error: MLE

Fixed submission:

// 35
#include <algorithm>
#include <iostream>
#include <string>

using namespace std;

int main() {
  for (int n, h; cin >> n >> h, n | h;) {
    static bool cb[501][501][501];
    fill_n(cb[0][0], 501 * 501 * 501, true);
    for (int i = 0; i < h; i++) {
      string c;
      cin >> c;
      int tp[3] = {};
      int d[3] = {};
      if (c == "xy") {
        cin >> tp[0] >> tp[1];
        d[2] = 1;
      } else if (c == "yz") {
        cin >> tp[1] >> tp[2];
        d[0] = 1;
      } else {
        cin >> tp[0] >> tp[2];
        d[1] = 1;
      }
      for (int i = 1; i <= n; i++) {
        cb[tp[0] + d[0] * i][tp[1] + d[1] * i][tp[2] + d[2] * i] = false;
      }
    }
    int ans = 0;
    for (int x = 1; x <= n; x++) {
      for (int y = 1; y <= n; y++) {
        for (int z = 1; z <= n; z++) {
          ans += cb[x][y][z];
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
Problem p00616 (C++) — buggy submission, verdict: Memory Limit Exceeded

#include <iostream>
#include <set>
#include <string>
using namespace std;
int tonum(int x, int y, int z) { return x + y * 500 + z * 500 * 500; }

int main() {
  int N, H;
  while (cin >> N >> H, N || H) {
    string t;
    int a, b;
    set<int> ans;
    for (int l = 0; l < H; l++) {
      cin >> t >> a >> b;
      --a;
      --b;
      if (t == "xy") {
        for (int i = 0; i < N; i++) {
          ans.insert(tonum(a, b, i));
        }
      } else if (t == "xz") {
        for (int i = 0; i < N; i++) {
          ans.insert(tonum(a, i, b));
        }
      } else if ("yz" == t) {
        for (int i = 0; i < N; i++) {
          ans.insert(tonum(i, a, b));
        }
      }
    }
    /*int sum=0;
    for(int i=0;i<N;i++){
         for(int j=0;j<N;j++){
              for(int k=0;k<N;k++){
                   if(!map[i][j][k])++sum;
                   //cout<<map[i][j][k];
              }
              //cout<<endl;
         }
         //cout<<endl<<endl;
         }*/
    cout << N * N * N - ans.size() << endl;
  }
  return 0;
}

Error: MLE

Fixed submission:

#include <iostream>
#include <string>
using namespace std;
bool map[500][500][500];
int main() {
  int N, H;
  while (cin >> N >> H, N || H) {
    string t;
    int a, b;
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        for (int k = 0; k < N; k++) {
          map[i][j][k] = false;
        }
      }
    }
    for (int l = 0; l < H; l++) {
      cin >> t >> a >> b;
      --a;
      --b;
      if (t == "xy") {
        for (int i = 0; i < N; i++) {
          map[a][b][i] = true;
        }
      } else if (t == "xz") {
        for (int i = 0; i < N; i++) {
          map[a][i][b] = true;
        }
      } else if ("yz" == t) {
        for (int i = 0; i < N; i++) {
          map[i][a][b] = true;
        }
      }
    }
    int sum = 0;
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        for (int k = 0; k < N; k++) {
          if (!map[i][j][k])
            ++sum;
          // cout<<map[i][j][k];
        }
        // cout<<endl;
      }
      // cout<<endl<<endl;
    }
    cout << sum << endl;
  }
  return 0;
}
Problem p00616 (C++) — buggy submission, verdict: Memory Limit Exceeded

#include <bits/stdc++.h>

using namespace std;

#define MAX 500
typedef pair<int, int> P;
typedef pair<int, P> Q;

int main() {
  int N, H, a, b;
  string str;

  while (cin >> N >> H, (N | H)) {
    set<Q> st;
    for (int i = 0; i < H; i++) {
      cin >> str >> a >> b;
      a--, b--;
      if (str == "xy") {
        for (int j = 0; j < N; j++) {
          st.insert(Q(a, P(b, j)));
        }
      } else if (str == "yz") {
        for (int j = 0; j < N; j++) {
          st.insert(Q(j, P(a, b)));
        }
      } else {
        for (int j = 0; j < N; j++) {
          st.insert(Q(a, P(j, b)));
        }
      }
    }
    cout << N * N * N - st.size() << endl;
  }

  return 0;
}

Error: MLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

#define MAX 501
bool arr[MAX][MAX][MAX];

int main() {
  int N, H, a, b;
  string str;

  while (cin >> N >> H, (N | H)) {
    memset(arr, false, sizeof(arr));
    for (int i = 0; i < H; i++) {
      cin >> str >> a >> b;
      a--, b--;
      if (str == "xy") {
        for (int j = 0; j < N; j++) {
          arr[a][b][j] = true;
        }
      } else if (str == "yz") {
        for (int j = 0; j < N; j++) {
          arr[j][a][b] = true;
        }
      } else {
        for (int j = 0; j < N; j++) {
          arr[a][j][b] = true;
        }
      }
    }

    int ans = 0;
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        for (int k = 0; k < N; k++) {
          if (!arr[i][j][k])
            ans++;
        }
      }
    }
    cout << ans << endl;
  }

  return 0;
}
Problem p00616 (C++) — buggy submission, verdict: Memory Limit Exceeded

#include <iostream>
#include <set>
#include <sstream>
#include <string>

using namespace std;

int main(int argc, char *argv[]) {
  int n, h, s, t;
  string sur;
  while (true) {
    cin >> n >> h;
    if (n == 0 && h == 0)
      break;

    set<string> points;
    long long cube = n * n * n;
    for (int i = 0; i < h; i++) {
      cin >> sur >> s >> t;
      ostringstream os;
      string emptystr = "";
      if (sur == "xy")
        for (int j = 0; j < n; j++) {
          os << s << ' ' << t << ' ' << 1 + j;
          string hoge = os.str();
          os.str(emptystr);
          os.clear();
          if (points.find(hoge) == points.end()) {
            cube--;
            points.insert(hoge);
          }
        }
      else if (sur == "xz")
        for (int j = 0; j < n; j++) {
          os << s << ' ' << 1 + j << ' ' << t;
          string hoge = os.str();
          os.str(emptystr);
          os.clear();
          if (points.find(hoge) == points.end()) {
            cube--;
            points.insert(hoge);
          }
        }
      else if (sur == "yz")
        for (int j = 0; j < n; j++) {
          os << 1 + j << ' ' << s << ' ' << t;
          string hoge = os.str();
          os.str(emptystr);
          os.clear();
          if (points.find(hoge) == points.end()) {
            cube--;
            points.insert(hoge);
          }
        }
    }

    cout << cube << endl;
  }
  return 0;
}

Error: MLE

Fixed submission:

#include <cstring>
#include <iostream>
#include <string>

using namespace std;

int main(int argc, char *argv[]) {
  int n, h, s, t;
  bool ***cube = new bool **[500];
  for (int i = 0; i < 500; i++) {
    cube[i] = new bool *[500];
    for (int j = 0; j < 500; j++)
      cube[i][j] = new bool[500];
  }
  string sur;

  while (true) {
    cin >> n >> h;
    if (n == 0 && h == 0)
      break;

    for (int i = 0; i < h; i++) {
      cin >> sur >> s >> t;
      if (sur == "xy")
        for (int j = 0; j < n; j++)
          cube[s - 1][t - 1][j] = true;
      else if (sur == "xz")
        for (int j = 0; j < n; j++)
          cube[s - 1][j][t - 1] = true;
      else if (sur == "yz")
        for (int j = 0; j < n; j++)
          cube[j][s - 1][t - 1] = true;
    }
    int without = 0;
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++)
        for (int k = 0; k < n; k++)
          without += (cube[i][j][k] ? 0 : 1);

    cout << without << endl;
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++)
        memset(cube[i][j], false, sizeof(bool) * n);
  }
  return 0;
}
Problem p00616 (C++) — buggy submission, verdict: Runtime Error

#include <bitset>
#include <stdio.h>
#include <string.h>
int main() {
  static std::bitset<500> c[500][500]; //[x][y][z]
  int i, j, k, n, h, s, a, b;
  char _[9];
  while (scanf("%d%d", &n, &h), n) {
    for (i = 0; i < n; ++i)
      for (j = 0; j < n; ++j)
        c[i][j].reset();
    while (h--) {
      scanf("%s%d%d", _, &a, &b), a--, b--;
      if (!strcmp(_, "xy"))
        for (i = 0; i < n; ++i)
          c[a][b][i] = 1;
      else if (!strcmp(_, "xz"))
        for (i = 0; i < n; ++i)
          c[a][i][b] = 1;
      else if (!strcmp(_, "yz"))
        for (i = 0; i < n; ++i)
          c[i][a][b] = 1;
    }
    for (s = i = 0; i < n; ++i)
      for (j = 0; j < n; ++j)
        s += n - c[i][j].count();
    printf("%d\\n", s);
  }
  return 0;
}

Error: WA

Fixed submission:

#include <bitset>
#include <stdio.h>
#include <string.h>
int main() {
  static std::bitset<500> c[500][500];
  int i, j, k, n, h, s, a, b;
  char _[9];
  while (scanf("%d%d", &n, &h), n) {
    for (i = 0; i < n; ++i)
      for (j = 0; j < n; ++j)
        c[i][j].reset();
    while (h--) {
      scanf("%s%d%d", _, &a, &b);
      if (!strcmp(_, "xy"))
        for (i = 0; i < n; ++i)
          c[a][b][i] = 1;
      else if (!strcmp(_, "xz"))
        for (i = 0; i < n; ++i)
          c[a][i][b] = 1;
      else if (!strcmp(_, "yz"))
        for (i = 0; i < n; ++i)
          c[i][a][b] = 1;
    }
    for (s = i = 0; i < n; ++i)
      for (j = 0; j < n; ++j)
        s += n - c[i][j].count();
    printf("%d\\n", s);
  }
  return 0;
}
Problem p00616 (C++) — buggy submission, verdict: Memory Limit Exceeded

#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <vector>
using namespace std;

typedef pair<int, int> P;
typedef pair<P, int> P2;

int main() {
  int n, h, a, b;
  string op;

  while (cin >> n >> h) {
    map<P2, bool> cube; // x y z
    if (n == 0 && h == 0)
      break;
    for (int i = 0; i < h; i++) {
      cin >> op >> a >> b;

      if (op == "xy") {
        for (int i = 1; i < n + 1; i++) {
          if (!cube[P2(P(a, b), i)]) {
            cube[P2(P(a, b), i)] = true;
          }
        }
      }
      if (op == "yz") {
        for (int i = 1; i < n + 1; i++) {
          if (!cube[P2(P(i, a), b)]) {
            cube[P2(P(i, a), b)] = true;
          }
        }
      }
      if (op == "xz") {
        for (int i = 1; i < n + 1; i++) {
          if (!cube[P2(P(a, i), b)]) {
            cube[P2(P(a, i), b)] = true;
          }
        }
      }
    }
    cout << n * n * n - cube.size() << endl;
  }
  return 0;
}

Error: MLE

Fixed submission:

#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;

int n;
bool flag[501][501][501];

void XY(int x, int y) {
  for (int z = 1; z <= n; z++) {
    flag[x][y][z] = false;
  }
}

void XZ(int x, int z) {
  for (int y = 1; y <= n; y++) {
    flag[x][y][z] = false;
  }
}

void YZ(int y, int z) {
  for (int x = 1; x <= n; x++) {
    flag[x][y][z] = false;
  }
}

int main() {
  int h;
  while (cin >> n >> h) {
    if (n == 0 && h == 0)
      break;
    memset(flag, true, sizeof(flag));
    string op;
    int a, b;
    while (h--) {
      cin >> op >> a >> b;
      if (op == "xy")
        XY(a, b);
      if (op == "xz")
        XZ(a, b);
      if (op == "yz")
        YZ(a, b);
    }

    int ans = 0;
    for (int x = 1; x <= n; x++) {
      for (int y = 1; y <= n; y++) {
        for (int z = 1; z <= n; z++) {
          ans += flag[x][y][z];
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
Problem p00616 (C++) — buggy submission, verdict: Memory Limit Exceeded

#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int n, q, x, y, a[20000000];
string c;
int main() {
  while (cin >> n >> q, n + q) {
    fill(a, a + n * n * n / 32 + 1, 0);
    for (int i = 0; i < q; i++) {
      cin >> c >> x >> y;
      x--, y--;
      if (c == "xy") {
        for (int j = 0; j < n; j++) {
          int w = x * n * n + y * n + j;
          a[w >> 5] |= (1 << (w & 31));
        }
      }
      if (c == "xz") {
        for (int j = 0; j < n; j++) {
          int w = x * n * n + j * n + y;
          a[w >> 5] |= (1 << (w & 31));
        }
      }
      if (c == "yz") {
        for (int j = 0; j < n; j++) {
          int w = j * n * n + x * n + y;
          a[w >> 5] |= (1 << (w & 31));
        }
      }
    }
    int ret = 0;
    for (int i = 0; i <= n * n * n / 32; i++)
      ret += __builtin_popcount(a[i]);
    cout << n * n * n - ret << endl;
  }
}

Error: MLE

Fixed submission:

#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int n, q, x, y;
string c;
bool a[125000009];
int main() {
  while (cin >> n >> q, n + q) {
    fill(a, a + n * n * n, false);
    for (int i = 0; i < q; i++) {
      cin >> c >> x >> y;
      x--, y--;
      if (c == "xy")
        for (int j = 0; j < n; j++)
          a[x * n * n + y * n + j] = true;
      if (c == "xz")
        for (int j = 0; j < n; j++)
          a[x * n * n + j * n + y] = true;
      if (c == "yz")
        for (int j = 0; j < n; j++)
          a[j * n * n + x * n + y] = true;
    }
    int ret = 0;
    for (int i = 0; i < n * n * n; i++) {
      if (!a[i])
        ret++;
    }
    cout << ret << endl;
  }
}
Problem p00616 (C++) — buggy submission, verdict: Memory Limit Exceeded

#include <iostream>
#include <set>
#include <string>
#include <tuple>

int main() {
  int n, h;
  while (std::cin >> n >> h, n, h) {
    std::set<std::tuple<int, int, int>> data;
    std::tuple<int, int, int> tup = std::tuple<int, int, int>(0, 0, 0);
    std::string str;
    int a, b;
    for (int i = 0; i < h; i++) {
      std::cin >> str >> a >> b;
      for (int j = 0; j < n; j++) {
        if (str == "xy")
          tup = std::tuple<int, int, int>(a - 1, b - 1, j);
        else if (str == "xz")
          tup = std::tuple<int, int, int>(a - 1, j, b - 1);
        else if (str == "yz")
          tup = std::tuple<int, int, int>(j, a - 1, b - 1);
        data.insert(tup);
      }
    }
    std::cout << n * n * n - data.size() << std::endl;
  }
  return 0;
}

Error: MLE

Fixed submission:

#include <cstring>
#include <iostream>

bool data[500][500][500];

int main() {
  int n, h;
  while (std::cin >> n >> h, n, h) {
    memset(data, 0, sizeof(data));
    int count = 0;
    for (int i = 0; i < h; i++) {
      char c1, c2;
      int a, b;
      std::cin >> c1 >> c2 >> a >> b;
      if (c1 == 'x' && c2 == 'y') {
        for (int j = 0; j < n; j++)
          data[a - 1][b - 1][j] = true;
      } else if (c1 == 'x' && c2 == 'z') {
        for (int j = 0; j < n; j++)
          data[a - 1][j][b - 1] = true;
      } else if (c1 == 'y' && c2 == 'z') {
        for (int j = 0; j < n; j++)
          data[j][a - 1][b - 1] = true;
      }
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        for (int k = 0; k < n; k++) {
          if (!data[i][j][k])
            count++;
        }
      }
    }
    std::cout << count << std::endl;
  }
  return 0;
}
Problem p00616 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define r(i, n) for (int i = 0; i < n; i++)
using namespace std;
bool t[3][500][500];
int n, h, x, y;
string s;
int main() {
  while (cin >> n >> h && n + h) {
    int c, a = 0;
    r(i, 3) r(j, n) r(k, n) t[i][j][k] = 0;
    r(u, h) {
      cin >> s >> x >> y;
      x--, y--;
      if (s == "xy") {
        t[0][x][y] = 1;
        r(i, n) {
          c = 0;
          if (t[1][x][i])
            c++;
          if (t[2][y][i])
            c++;
          if (c == 2)
            c--;
          a += c;
        }
      }
      if (s == "xz") {
        t[1][x][y] = 1;
        r(i, n) {
          c = 0;
          if (t[0][x][i])
            c++;
          if (t[2][i][y])
            c++;
          if (c == 2)
            c--;
          a += c;
        }
      }
      if (s == "yz") {
        t[2][x][y] = 1;
        r(i, n) {
          c = 0;
          if (t[0][i][x])
            c++;
          if (t[1][i][y])
            c++;
          if (c == 2)
            c--;
          a += c;
        }
      }
    }
    cout << n * (n * n - h) + a << endl;
  }
  return 0;
}

Error: WA

Fixed submission:

#include <iostream>
#include <string>
using namespace std;
int x[201], y[201], z[201];
int check[201][3];
int main() {
  int n, h;
  while (true) {
    cin >> n >> h;
    if (n == 0 && h == 0)
      break;
    int ans = n * n * n;
    string a;
    int top = 0;
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < 3; j++)
        check[i][j] = true;
      ans -= n;
      cin >> a;
      if (a == "xy") {
        cin >> x[i] >> y[i];
        z[i] = -i - 1;
      }
      if (a == "xz") {
        cin >> x[i] >> z[i];
        y[i] = -i - 1;
      }
      if (a == "yz") {
        cin >> y[i] >> z[i];
        x[i] = -i - 1;
      }
      for (int j = 0; j < i; j++) {
        if (x[i] == x[j] || y[i] == y[j] || z[i] == z[j]) {
          bool t = true;
          for (int k = 0; k < top; k++)
            if (max(x[i], x[j]) == check[k][0] &&
                max(y[i], y[j]) == check[k][1] &&
                max(z[i], z[j]) == check[k][2])
              t = false;
          if (t == false)
            ans++;
          if (t == true) {
            check[top][0] = max(x[i], x[j]);
            check[top][1] = max(y[i], y[j]);
            check[top][2] = max(z[i], z[j]);
            top++;
            ans++;
            cout << max(x[i], x[j]) << " " << max(y[i], y[j]) << " "
                 << max(z[i], z[j]) << endl;
          }
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
Problem p00616 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <set>
#include <string>
using namespace std;

class Point {
public:
  int x, y, z;
  Point(int x = 0, int y = 0, int z = 0) : x(x), y(y), z(z) {}
  bool operator<(const Point &p) const {
    if (z != p.z)
      return z < p.z;
    if (y != p.y)
      return y < p.y;
    if (x != p.x)
      return x < p.x;
    return false;
  }
};

int main() {
  while (1) {
    int n, h;
    cin >> n >> h;
    if (n == 0 && h == 0)
      break;

    set<Point> hole;
    for (int i = 0; i < h; i++) {
      string str;
      int a, b;
      cin >> str >> a >> b;
      if (str == "xy") {
        for (int j = 1; j <= n; j++) {
          hole.insert(Point(a, b, j));
        }
      } else if (str == "xz") {
        for (int j = 1; j <= n; j++) {
          hole.insert(Point(a, j, b));
        }
      } else if (str == "yz") {
        for (int j = 1; j <= n; j++) {
          hole.insert(Point(j, a, b));
        }
      }
    }

    cout << n * n * n - hole.size() << endl;
  }

  return 0;
}

Error: 0

Fixed submission:

#include <iostream>
#include <string>
using namespace std;

int main() {
  while (1) {
    int n, h;
    cin >> n >> h;
    if (n == 0 && h == 0)
      break;
    int cube[n][n][n];
    for (int z = 0; z < n; z++) {
      for (int y = 0; y < n; y++) {
        for (int x = 0; x < n; x++) {
          cube[z][y][x] = 1;
        }
      }
    }
    for (int i = 0; i < h; i++) {
      string str;
      int a, b;
      cin >> str >> a >> b;
      a--;
      b--;
      if (str == "xy") {
        for (int j = 0; j < n; j++) {
          cube[j][b][a] = 0;
        }
      } else if (str == "xz") {
        for (int j = 0; j < n; j++) {
          cube[b][j][a] = 0;
        }
      } else if (str == "yz") {
        for (int j = 0; j < n; j++) {
          cube[b][a][j] = 0;
        }
      }
    }

    int cnt = 0;
    for (int z = 0; z < n; z++) {
      for (int y = 0; y < n; y++) {
        for (int x = 0; x < n; x++) {
          cnt += cube[z][y][x];
        }
      }
    }
    cout << cnt << endl;
  }
  return 0;
}
Problem p00616 (C++) — buggy submission, verdict: Runtime Error

#include <cstring>
#include <iostream>
#include <set>
#include <string>
using namespace std;

int main() {
  int n, h;
  while (cin >> n >> h, n + h) {
    set<int> cube;

    for (int i = 0; i < h; i++) {
      string s;
      int a, b;
      cin >> s;
      cin >> a >> b;
      a--;
      b--;
      if (s == "xy") {
        for (int j = 0; j < n; j++) {
          cube.insert(a * 500 * 500 + b * 500 + j);
        }
      } else if (s == "xz") {
        for (int j = 0; j < n; j++) {
          cube.insert(a * 500 * 500 + j * 500 + b);
        }
      } else {
        for (int j = 0; j < n; j++) {
          cube.insert(j * 500 * 500 + a * 500 + b);
        }
      }
    }
    cout << n * n * n - cube.size() << endl;
  }
}

Error: 0

Fixed submission:

#include <cstring>
#include <iostream>
#include <string>
using namespace std;

int main() {
  int n, h;
  while (cin >> n >> h, n + h) {
    int cube[n][n][n];
    memset(cube, 0, sizeof(cube));
    for (int i = 0; i < h; i++) {
      string s;
      int a, b;
      cin >> s;
      cin >> a >> b;
      //      a--;b--;
      if (a >= n)
        a = n - 1;
      if (b >= n)
        b = n - 1;
      if (s == "xy") {
        for (int j = 0; j < n; j++) {
          cube[a][b][j] = 1;
        }
      } else if (s == "xz") {
        for (int j = 0; j < n; j++) {
          cube[a][j][b] = 1;
        }
      } else {
        for (int j = 0; j < n; j++) {
          cube[j][a][b] = 1;
        }
      }
    }
    int ans = 0;
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++)
        for (int k = 0; k < n; k++)
          if (cube[i][j][k] == 0)
            ans++;
    cout << ans << endl;
  }
}