Problem p00660 (C++)

Buggy submission (status: Runtime Error):
#include "bits/stdc++.h"
#include <unordered_map>
#include <unordered_set>
#pragma warning(disable : 4996)
using namespace std;
using ld = long double;
template <class t> using table = vector<vector<t>>;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio
///2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual
///studio 2015\projects\programing_contest_c++\debug\b.txt"

vector<vector<vector<int>>> dices{
    {{0, 0, 0, 0, 0},
     {0, 0, 0, 1, 0},
     {0, 0, 0, 0, 0},
     {0, 0, 0, 1, 0},
     {0, 0, 1, 0, 0}},
    {{0, 0, 1, 0, 0},
     {0, 0, 0, 1, 0},
     {0, 0, 1, 0, 0},
     {0, 1, 0, 0, 0},
     {0, 0, 1, 0, 0}},
    {{0, 0, 1, 0, 0},
     {0, 0, 0, 1, 0},
     {0, 0, 1, 0, 0},
     {0, 0, 0, 1, 0},
     {0, 0, 1, 0, 0}},
    {{0, 0, 0, 0, 0},
     {0, 1, 0, 1, 0},
     {0, 0, 1, 0, 0},
     {0, 0, 0, 1, 0},
     {0, 0, 0, 0, 0}},
    {{0, 0, 1, 0, 0},
     {0, 1, 0, 0, 0},
     {0, 0, 1, 0, 0},
     {0, 0, 0, 1, 0},
     {0, 0, 1, 0, 0}},
    {{0, 0, 1, 0, 0},
     {0, 1, 0, 0, 0},
     {0, 0, 1, 0, 0},
     {0, 1, 0, 1, 0},
     {0, 0, 1, 0, 0}},
    {{0, 0, 1, 0, 0},
     {0, 0, 0, 1, 0},
     {0, 0, 0, 0, 0},
     {0, 0, 0, 1, 0},
     {0, 0, 0, 0, 0}},
    {{0, 0, 1, 0, 0},
     {0, 1, 0, 1, 0},
     {0, 0, 1, 0, 0},
     {0, 1, 0, 1, 0},
     {0, 0, 1, 0, 0}},

    {{0, 0, 1, 0, 0},
     {0, 1, 0, 1, 0},
     {0, 0, 1, 0, 0},
     {0, 0, 0, 1, 0},
     {0, 0, 1, 0, 0}},
};

int check(const vector<vector<int>> &field) {
  for (int i = 0; i < 9; ++i) {
    if (field == dices[i])
      return i + 1;
  }
  return 0;
}
vector<vector<int>> rotate_l(const vector<vector<int>> &field) {
  vector<vector<int>> nfield(field);
  for (int i = 0; i < 5; ++i) {
    for (int j = 0; j < 5; ++j) {
      nfield[i][j] = field[j][4 - i];
    }
  }
  return nfield;
}
vector<vector<int>> rev(const vector<vector<int>> &field, const bool isleft) {
  vector<vector<int>> nfield(field);
  for (int i = 0; i < 5; ++i) {
    for (int j = 0; j < 5; ++j) {
      if (isleft)
        nfield[i][j] = field[i][4 - j];
      else
        nfield[i][j] = field[4 - i][j];
    }
  }
  return nfield;
}
int getnum(vector<vector<int>> field, const int num) {
  if (num == 0)
    field = rev(field, true);
  else if (num == 1) {
    field = rev(field, true);
    field = rotate_l(field);
  } else if (num == 2) {
    field = rev(field, true);
  } else if (num == 3) {
    field = rev(field, true);
    for (int i = 0; i < 3; ++i)
      field = rotate_l(field);
  } else if (num == 4) {
    field = rev(field, true);
  } else if (num == 5) {
    field = rev(field, false);
    field = rev(field, true);
  }
  if (check(field))
    return check(field);

  assert(false);
  return -1;
}

bool getinput(vector<vector<int>> &adices) {
  vector<string> sts;
  string st;
  if (cin >> st) {
    sts.emplace_back(st);
    for (int i = 1; i < 21; ++i) {
      string st;
      cin >> st;
      sts.emplace_back(st);
    }
    vector<vector<pair<int, int>>> lu(2, vector<pair<int, int>>(6));
    lu[0][0] = make_pair(0, 7);
    lu[0][1] = make_pair(7, 0);
    lu[0][2] = make_pair(7, 7);
    lu[0][3] = make_pair(7, 14);
    lu[0][4] = make_pair(7, 21);
    lu[0][5] = make_pair(14, 7);
    for (int i = 0; i < 6; ++i) {
      lu[1][i] = make_pair(lu[0][i].first, lu[0][i].second + 29);
    }

    for (int i = 0; i < 2; ++i) {
      for (int j = 0; j < 6; ++j) {
        vector<vector<int>> field(5, vector<int>(5));
        for (int y = 0; y < 5; ++y) {
          for (int x = 0; x < 5; ++x) {
            field[y][x] =
                sts[lu[i][j].first + 1 + y][lu[i][j].second + 1 + x] != '.';
          }
        }
        adices[i][j] = getnum(field, j);
      }
    }

  } else {
    return false;
  }
}

int main() {
  vector<vector<int>> dices(2, vector<int>(6));
  while (getinput(dices)) {
    int high = 0;
    int low = 0;
    for (int i = 0; i < 6; ++i) {
      for (int j = 0; j < 6; ++j) {
        if (dices[0][i] > dices[1][j])
          high++;
        else if (dices[0][i] < dices[1][j])
          low++;
      }
    }
    if (high >= low)
      cout << "HIGH" << endl;
    else
      cout << "LOW" << endl;
  }
  return 0;
}

Fixed submission:
#include "bits/stdc++.h"
#include <unordered_map>
#include <unordered_set>
#pragma warning(disable : 4996)
using namespace std;
using ld = long double;
template <class t> using table = vector<vector<t>>;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio
///2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual
///studio 2015\projects\programing_contest_c++\debug\b.txt"

vector<vector<vector<int>>> dices{
    {{0, 0, 0, 0, 0},
     {0, 0, 0, 1, 0},
     {0, 0, 0, 0, 0},
     {0, 0, 0, 1, 0},
     {0, 0, 1, 0, 0}},
    {{0, 0, 1, 0, 0},
     {0, 0, 0, 1, 0},
     {0, 0, 1, 0, 0},
     {0, 1, 0, 0, 0},
     {0, 0, 1, 0, 0}},
    {{0, 0, 1, 0, 0},
     {0, 0, 0, 1, 0},
     {0, 0, 1, 0, 0},
     {0, 0, 0, 1, 0},
     {0, 0, 1, 0, 0}},
    {{0, 0, 0, 0, 0},
     {0, 1, 0, 1, 0},
     {0, 0, 1, 0, 0},
     {0, 0, 0, 1, 0},
     {0, 0, 0, 0, 0}},
    {{0, 0, 1, 0, 0},
     {0, 1, 0, 0, 0},
     {0, 0, 1, 0, 0},
     {0, 0, 0, 1, 0},
     {0, 0, 1, 0, 0}},
    {{0, 0, 1, 0, 0},
     {0, 1, 0, 0, 0},
     {0, 0, 1, 0, 0},
     {0, 1, 0, 1, 0},
     {0, 0, 1, 0, 0}},
    {{0, 0, 1, 0, 0},
     {0, 0, 0, 1, 0},
     {0, 0, 0, 0, 0},
     {0, 0, 0, 1, 0},
     {0, 0, 0, 0, 0}},
    {{0, 0, 1, 0, 0},
     {0, 1, 0, 1, 0},
     {0, 0, 1, 0, 0},
     {0, 1, 0, 1, 0},
     {0, 0, 1, 0, 0}},

    {{0, 0, 1, 0, 0},
     {0, 1, 0, 1, 0},
     {0, 0, 1, 0, 0},
     {0, 0, 0, 1, 0},
     {0, 0, 1, 0, 0}},
};

int check(const vector<vector<int>> &field) {
  for (int i = 0; i < 9; ++i) {
    if (field == dices[i])
      return i + 1;
  }
  return 0;
}
vector<vector<int>> rotate_l(const vector<vector<int>> &field) {
  vector<vector<int>> nfield(field);
  for (int i = 0; i < 5; ++i) {
    for (int j = 0; j < 5; ++j) {
      nfield[i][j] = field[j][4 - i];
    }
  }
  return nfield;
}
vector<vector<int>> rev(const vector<vector<int>> &field, const bool isleft) {
  vector<vector<int>> nfield(field);
  for (int i = 0; i < 5; ++i) {
    for (int j = 0; j < 5; ++j) {
      if (isleft)
        nfield[i][j] = field[i][4 - j];
      else
        nfield[i][j] = field[4 - i][j];
    }
  }
  return nfield;
}
int getnum(vector<vector<int>> field, const int num) {
  if (num == 0)
    field = rev(field, true);
  else if (num == 1) {
    field = rev(field, true);
    field = rotate_l(field);
  } else if (num == 2) {
    field = rev(field, true);
  } else if (num == 3) {
    field = rev(field, true);
    for (int i = 0; i < 3; ++i)
      field = rotate_l(field);
  } else if (num == 4) {
    field = rev(field, true);
  } else if (num == 5) {
    field = rev(field, false);
    field = rev(field, true);
  }
  if (check(field))
    return check(field);

  assert(false);
  return -1;
}

bool getinput(vector<vector<int>> &adices) {
  vector<string> sts;
  string st;
  if (cin >> st) {
    if (st == "0")
      return false;
    sts.emplace_back(st);
    for (int i = 1; i < 21; ++i) {
      string st;
      cin >> st;
      sts.emplace_back(st);
    }
    vector<vector<pair<int, int>>> lu(2, vector<pair<int, int>>(6));
    lu[0][0] = make_pair(0, 7);
    lu[0][1] = make_pair(7, 0);
    lu[0][2] = make_pair(7, 7);
    lu[0][3] = make_pair(7, 14);
    lu[0][4] = make_pair(7, 21);
    lu[0][5] = make_pair(14, 7);
    for (int i = 0; i < 6; ++i) {
      lu[1][i] = make_pair(lu[0][i].first, lu[0][i].second + 29);
    }

    for (int i = 0; i < 2; ++i) {
      for (int j = 0; j < 6; ++j) {
        vector<vector<int>> field(5, vector<int>(5));
        for (int y = 0; y < 5; ++y) {
          for (int x = 0; x < 5; ++x) {
            field[y][x] =
                sts[lu[i][j].first + 1 + y][lu[i][j].second + 1 + x] != '.';
          }
        }
        adices[i][j] = getnum(field, j);
      }
    }

  } else {
    return false;
  }
}

int main() {
  vector<vector<int>> dices(2, vector<int>(6));
  while (getinput(dices)) {
    int high = 0;
    int low = 0;
    for (int i = 0; i < 6; ++i) {
      for (int j = 0; j < 6; ++j) {
        if (dices[0][i] > dices[1][j])
          high++;
        else if (dices[0][i] < dices[1][j])
          low++;
      }
    }
    if (high >= low)
      cout << "HIGH" << endl;
    else
      cout << "LOW" << endl;
  }
  return 0;
}