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

#include <iostream>
using namespace std;
int x[5000000], day[13][32], day2[13][32], cnt, a, b, c, d, e, f, daya1, daya2;
int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int days2[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main() {
  for (int i = 1; i < 5000000; i++) {
    if ((i % 4 == 0 && i % 100 > 0) || i % 400 == 0) {
      x[i] = x[i - 1] + 366;
    } else {
      x[i] = x[i - 1] + 365;
    }
  }
  for (int i = 1; i <= 12; i++) {
    for (int j = 1; j <= days[i]; j++) {
      day[i][j] = cnt;
      cnt++;
    }
  }
  cnt = 0;
  for (int i = 1; i <= 12; i++) {
    for (int j = 1; j <= days2[i]; j++) {
      day2[i][j] = cnt;
      cnt++;
    }
  }
  while (true) {
    cin >> a >> b >> c >> d >> e >> f;
    if (a < 0) {
      break;
    }
    if (b < 0) {
      break;
    }
    if (c < 0) {
      break;
    }
    if (d < 0) {
      break;
    }
    if (e < 0) {
      break;
    }
    if (f < 0) {
      break;
    }
    daya1 = 0;
    daya2 = 0;
    daya1 += x[a - 1];
    daya2 += x[d - 1];
    if ((a % 4 == 0 && a % 100 > 0) || a % 400 == 0) {
      daya1 += day2[b][c];
    } else {
      daya1 += day[b][c];
    }
    if ((d % 4 == 0 && d % 100 > 0) || d % 400 == 0) {
      daya2 += day2[e][f];
    } else {
      daya2 += day[e][f];
    }
    cout << daya2 - daya1 << endl;
  }
}

Error: -11

Fixed submission:

#include <iostream>
using namespace std;
unsigned int x[10000000], day[13][32], day2[13][32], cnt, a, b, c, d, e, f,
    daya1, daya2;
int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int days2[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main() {
  for (int i = 1; i < 10000000; i++) {
    if ((i % 4 == 0 && i % 100 > 0) || i % 400 == 0) {
      x[i] = x[i - 1] + 366;
    } else {
      x[i] = x[i - 1] + 365;
    }
  }
  for (int i = 1; i <= 12; i++) {
    for (int j = 1; j <= days[i]; j++) {
      day[i][j] = cnt;
      cnt++;
    }
  }
  cnt = 0;
  for (int i = 1; i <= 12; i++) {
    for (int j = 1; j <= days2[i]; j++) {
      day2[i][j] = cnt;
      cnt++;
    }
  }
  while (true) {
    cin >> a >> b >> c >> d >> e >> f;
    if (a < 0) {
      break;
    }
    if (b < 0) {
      break;
    }
    if (c < 0) {
      break;
    }
    if (d < 0) {
      break;
    }
    if (e < 0) {
      break;
    }
    if (f < 0) {
      break;
    }
    daya1 = 0;
    daya2 = 0;
    daya1 += x[a - 1];
    daya2 += x[d - 1];
    if (a % 4 == 0) {
      daya1 += day2[b][c];
    } else {
      daya1 += day[b][c];
    }
    if (d % 4 == 0) {
      daya2 += day2[e][f];
    } else {
      daya2 += day[e][f];
    }
    cout << daya2 - daya1 << endl;
  }
}
Problem p00126 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cstdio>
using namespace std;

int main() {
  int N;
  for (scanf("%d", &N); N--;) {
    char pz[9][12] = {};
    char res[9][12] = {};
    for (int i = 0; i < 9; i++) {
      for (int j = 0; j < 9; j++) {
        scanf(" %c", &pz[i][j]);
      }
    }
    for (int i = 0; i < 9; i++) {
      for (int j = 0; j < 9; j++) {
        bool flg = true;
        for (int k = 0; k < 9; k++) {
          if (i == k)
            continue;
          if (pz[i][j] == pz[k][j])
            flg = 0;
        }
        for (int k = 0; k < 9; k++) {
          if (j == k)
            continue;
          if (pz[i][j] == pz[i][k])
            flg = 0;
        }
        int r = i / 3 * 3, c = j / 3 * 3;
        for (int k = 0; k < 3; k++) {
          for (int l = 0; l < 3; l++) {
            if (r + k == i && c + l == j)
              continue;
            if (pz[i][j] == pz[r + k][c + l])
              flg = 0;
          }
        }
        if (flg) {
          res[i][j] = ' ';
        } else {
          res[i][j] = '*';
        }
      }
    }
    for (int i = 0; i < 9; i++) {
      for (int j = 0; j < 9; j++) {
        printf("%c", res[i][j]);
        printf("%c", pz[i][j]);
      }
      puts("");
    }
    if (N >= 1)
      puts("");
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <cstdio>
using namespace std;

int main() {
  int N;
  for (scanf("%d", &N); N--;) {
    char pz[9][12] = {};
    char res[9][12] = {};
    for (int i = 0; i < 9; i++) {
      for (int j = 0; j < 9; j++) {
        scanf(" %c", &pz[i][j]);
      }
    }
    for (int i = 0; i < 9; i++) {
      for (int j = 0; j < 9; j++) {
        bool flg = true;
        for (int k = 0; k < 9; k++) {
          if (i == k)
            continue;
          if (pz[i][j] == pz[k][j])
            flg = 0;
        }
        for (int k = 0; k < 9; k++) {
          if (j == k)
            continue;
          if (pz[i][j] == pz[i][k])
            flg = 0;
        }
        int r = i / 3, c = j / 3;
        for (int k = 0; k < 3; k++) {
          for (int l = 0; k < 3; l++) {
            if (r + k == i && c + l == j)
              continue;
            if (pz[i][j] == pz[r + k][c + l])
              flg = 0;
          }
        }
        if (flg) {
          res[i][j] = ' ';
        } else {
          res[i][j] = '*';
        }
      }
    }
    for (int i = 0; i < 9; i++) {
      for (int j = 0; j < 9; j++) {
        printf("%c", res[i][j]);
        printf("%c", pz[i][j]);
      }
      puts("");
    }
    if (N >= 1)
      puts("");
  }
  return 0;
}
Problem p00126 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int n;
  int p[9][9];
  char map[9][9];
  int check[10];

  cin >> n;
  while (n) {
    n--;

    for (int i = 0; i < 9; i++) {
      for (int j = 0; j < 9; j++) {
        cin >> p[i][j];
        map[i][j] = ' ';
      }
    }

    for (int i = 0; i < 9; i++) {
      for (int j = 1; j < 10; j++)
        check[j] = 0;
      for (int j = 0; j < 9; j++)
        check[p[i][j]]++;
      for (int j = 0; j < 9; j++) {
        if (check[p[i][j]] > 1)
          map[i][j] = '*';
      }
    }

    for (int i = 0; i < 9; i++) {
      for (int j = 1; j < 10; j++)
        check[j] = 0;
      for (int j = 0; j < 9; j++)
        check[p[j][i]]++;
      for (int j = 0; j < 9; j++) {
        if (check[p[j][i]] > 1)
          map[j][i] = '*';
      }
    }

    for (int i = 0; i < 9; i += 3) {
      for (int j = 0; j < 9; j += 3) {
        for (int k = 1; k < 10; k++)
          check[k] = 0;
        for (int k = i; k < i + 3; k++) {
          for (int l = j; l < j + 3; l++)
            check[p[k][l]]++;
        }
        for (int k = i; k < i + 3; k++) {
          for (int l = j; l < j + 3; l++) {
            if (check[p[k][l]] > 1)
              map[k][l] = '*';
          }
        }
      }
    }

    for (int i = 0; i < 9; i++) {
      for (int j = 0; j < 9; j++) {
        cout << map[i][j] << p[i][j];
      }
      cout << endl;
    }
    if (n)
      cout << endl;
  }
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int n;
  int p[9][9];
  char map[9][9];
  int check[9];

  cin >> n;
  while (n) {
    n--;

    for (int i = 0; i < 9; i++) {
      for (int j = 0; j < 9; j++) {
        cin >> p[i][j];
        map[i][j] = ' ';
      }
    }

    for (int i = 0; i < 9; i++) {
      for (int j = 1; j < 10; j++)
        check[j] = 0;
      for (int j = 0; j < 9; j++)
        check[p[i][j]]++;
      for (int j = 0; j < 9; j++) {
        if (check[p[i][j]] > 1)
          map[i][j] = '*';
      }
    }

    for (int i = 0; i < 9; i++) {
      for (int j = 1; j < 10; j++)
        check[j] = 0;
      for (int j = 0; j < 9; j++)
        check[p[j][i]]++;
      for (int j = 0; j < 9; j++) {
        if (check[p[j][i]] > 1)
          map[j][i] = '*';
      }
    }

    for (int i = 0; i < 9; i += 3) {
      for (int j = 0; j < 9; j += 3) {
        for (int k = 1; k < 10; k++)
          check[k] = 0;
        for (int k = i; k < i + 3; k++) {
          for (int l = j; l < j + 3; l++)
            check[p[k][l]]++;
        }
        for (int k = i; k < i + 3; k++) {
          for (int l = j; l < j + 3; l++) {
            if (check[p[k][l]] > 1)
              map[k][l] = '*';
          }
        }
      }
    }

    for (int i = 0; i < 9; i++) {
      for (int j = 0; j < 9; j++) {
        cout << map[i][j] << p[i][j];
      }
      cout << endl;
    }
    cout << endl;
  }
}
Problem p00127 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <iostream>
#include <string>

using namespace std;

int main(void) {
  string str;

  string hyo[] = {"abcde", "fghij", "klmno", "pqrst", "uvwxy", "z.?! "};

  while (cin >> str) {
    if (str.size() % 2) {
      cout << "NA" << endl;
      continue;
    }

    string out = "";

    for (int i = 0, len = str.size(); i < len; i += 2) {
      int x, y;

      y = str[i] - '1';
      x = str[i + 1] - '1';

      if (0 > x || x > 4 || 0 > y || y > 5) {
        out = "NA";
        break;
      }

      out += hyo[y][x];
    }

    cout << out << endl;
  }

  return 0;
}

Error: 0

Fixed submission:

#include <algorithm>
#include <iostream>
#include <string>

using namespace std;

int main(void) {
  string str;

  string hyo[] = {"abcde", "fghij", "klmno", "pqrst", "uvwxy", "z.?! "};

  while (cin >> str) {
    if (str.size() % 2) {
      cout << "NA" << endl;
      continue;
    }

    string out = "";

    for (int i = 0, len = str.size(); i < len; i += 2) {
      int x, y;

      y = str[i] - '1';
      x = str[i + 1] - '1';

      out += hyo[y][x];
    }

    cout << out << endl;
  }

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

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

int main() {
  string line;
  while (cin >> line) {
    if (line.size() % 2 != 0) {
      cout << "NA" << endl;
      continue;
    }
    string result;
    while (line.empty() != true) {
      if (line[0] < '1' || '6' < line[0] || line[1] < '1' || '5' < line[1]) {
        result = "NA";
        break;
      }
      char ch[3], add;
      ch[0] = line[0];
      ch[1] = line[1];
      if (ch[0] != '6') {
        add = 'a' + (line[0] - '1') * 5 + (line[1] - '1');
      } else {
        switch (ch[1]) {
        case '1':
          add = 'z';
          break;
        case '2':
          add = '.';
          break;
        case '3':
          add = '?';
          break;
        case '4':
          add = '!';
          break;
        case '5':
          add = ' ';
          break;
        default:
          break;
        }
      }
      result += add;
      line.erase(0, 2);
    }
    cout << result << endl;
  }
}

Error: TLE

Fixed submission:

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

int main() {
  string input;
  while (cin >> input) {
    if ((int)input.length() % 2 != 0) {
      cout << "NA" << endl;
      continue;
    }
    bool NAFlag = false;
    string output;
    while (input.length() > 0) {
      switch (input[0]) {
      case '1':
        output += 'a' + (input[1] - '0') - 1;
        break;
      case '2':
        output += 'f' + (input[1] - '0') - 1;
        break;
      case '3':
        output += 'k' + (input[1] - '0') - 1;
        break;
      case '4':
        output += 'p' + (input[1] - '0') - 1;
        break;
      case '5':
        output += 'u' + (input[1] - '0') - 1;
        break;
      case '6':
        switch (input[1]) {
        case '1':
          output += 'z';
          break;
        case '2':
          output += '.';
          break;
        case '3':
          output += '?';
          break;
        case '4':
          output += '!';
          break;
        case '5':
          output += ' ';
          break;
        default:
          NAFlag = true;
          break;
        }
        break;
      default:
        NAFlag = true;
        break;
      }
      if (NAFlag) {
        cout << "NA" << endl;
        continue;
      }
      input.erase(0, 2);
    }
    cout << output << endl;
  }
}
Problem p00127 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int main() {
  string str[6] = {"afkpuz", "bglqv.", "chmrw?", "dinsx!", "ejoty "};
  string str2;
  while (cin >> str2) {
    if (str2.size() % 2 == 1)
      cout << "NA" << endl;
    else {
      string ans = "";
      for (int i = 0; i < str2.size(); i += 2) {
        if (str2[i + 1] - '0' <= 5 && str2[i] - '0' <= 6 &&
            str2[i + 1] - '0' > 0 && str2[i] - '0' > 0) {
          ans += str[str2[i + 1] - '0' - 1][str2[i] - '0' - 1];
        } else {
          ans = "NA";
          break;
        }
      }
      cout << ans << endl;
    }
  }
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  string str[6] = {"", "aafkpuz", "abglqv.", "achmrw?", "adinsx!", "aejoty "};
  string str2;
  while (cin >> str2) {
    if (str2.size() % 2 == 1)
      cout << "NA" << endl;
    else {
      for (int i = 0; i < str2.size(); i += 2) {
        cout << str[str2[i + 1] - '0'][str2[i] - '0'];
      }
      cout << endl;
    }
  }
  return 0;
}
Problem p00127 (C++) — buggy submission, verdict: Runtime Error

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

char table[6][5] = {{'a', 'b', 'c', 'd', 'e'}, {'f', 'g', 'h', 'i', 'j'},
                    {'k', 'l', 'm', 'n', 'o'}, {'p', 'q', 'r', 's', 't'},
                    {'u', 'v', 'w', 'x', 'y'}, {'z', '.', '?', '!', ' '}};

int main() {
  string s;
  while (cin >> s) {
    string ans;
    if (s.size() % 2) {
      cout << "NA" << endl;
    } else {
      bool flag = false;
      for (int i = 1; i < s.size(); i += 2) {
        int y = s[i - 1] - '0' - 1;
        int x = s[i] - '0' - 1;
        if (y < 0 || x < 0 || y >= 6 || x >= 5) {
          flag = true;
          break;
        }
        ans += table[y][x];
      }
      if (flag)
        cout << "NA" << endl;
      else
        cout << ans << endl;
    }
  }
}

Error: 0

Fixed submission:

#include <cstdio>
#include <iostream>
#include <string.h>
using namespace std;

char change(char a, char b) {
  char ans;
  if (a == '1' && b == '1')
    ans = 'a';
  if (a == '1' && b == '2')
    ans = 'b';
  if (a == '1' && b == '3')
    ans = 'c';
  if (a == '1' && b == '4')
    ans = 'd';
  if (a == '1' && b == '5')
    ans = 'e';
  if (a == '2' && b == '1')
    ans = 'f';
  if (a == '2' && b == '2')
    ans = 'g';
  if (a == '2' && b == '3')
    ans = 'h';
  if (a == '2' && b == '4')
    ans = 'i';
  if (a == '2' && b == '5')
    ans = 'j';
  if (a == '3' && b == '1')
    ans = 'k';
  if (a == '3' && b == '2')
    ans = 'l';
  if (a == '3' && b == '3')
    ans = 'm';
  if (a == '3' && b == '4')
    ans = 'n';
  if (a == '3' && b == '5')
    ans = 'o';
  if (a == '4' && b == '1')
    ans = 'p';
  if (a == '4' && b == '2')
    ans = 'q';
  if (a == '4' && b == '3')
    ans = 'r';
  if (a == '4' && b == '4')
    ans = 's';
  if (a == '4' && b == '5')
    ans = 't';
  if (a == '5' && b == '1')
    ans = 'u';
  if (a == '5' && b == '2')
    ans = 'v';
  if (a == '5' && b == '3')
    ans = 'w';
  if (a == '5' && b == '4')
    ans = 'x';
  if (a == '5' && b == '5')
    ans = 'y';
  if (a == '6' && b == '1')
    ans = 'z';
  if (a == '6' && b == '2')
    ans = '.';
  if (a == '6' && b == '3')
    ans = '?';
  if (a == '6' && b == '4')
    ans = '!';
  if (a == '6' && b == '5')
    ans = ' ';
  return ans;
}

int main(void) {
  char c[200];
  char ans[100];
  int len = 0;
  while (scanf("%s", c) != EOF) {
    int cnt = 0;
    len = strlen(c);
    for (int i = 0; i < len; i += 2) {
      ans[i] = change(c[i], c[i + 1]);
    }
    if (len % 2 == 0) {
      for (int i = 0; i < len; i += 2) {
        cout << ans[i];
      }
      cout << endl;
    } else
      cout << "NA" << endl;
  }
  return 0;
}
Problem p00127 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <string>
using namespace std;
int main(void) {
  const char *table[] = {"afkpuz", "bglqv.", "chmrw?", "dinsx!", "ejoty "};

  while (true) {
    bool bNA = false;
    string s;

    cin >> s;

    if (cin.eof())
      break;

    if (s.length() % 2 == 1) {
      bNA = true;
      goto NA;
    }
    for (unsigned int l = 0; l < s.length(); l += 2) {
      int i = s[l + 1] - '0' - 1;
      int j = s[l] - '0' - 1;
      if (!(0 <= i && i <= 4) || !(0 <= j && j <= 5)) {
        bNA = true;
        goto NA;
      }
    }
  NA:;
    if (bNA) {
      cout << "NA\\n";
      continue;
    }

    for (unsigned int l = 0; l < s.length(); l += 2) {
      int i = s[l + 1] - '0' - 1;
      int j = s[l] - '0' - 1;
      cout << table[i][j];
    }
    cout << '\\n';
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <string>
using namespace std;
int main(void) {
  const char *table[] = {"afkpuz", "bglqv.", "chmrw\\?", "dinsx!", "ejoty "};

  int n;
  cin >> n;
  for (int D = 0; D < n; ++D) {
    bool bNA = false;
    string s;

    cin >> s;
    if (s.length() % 2 == 1) {
      bNA = true;
      goto NA;
    }
    for (unsigned int l = 0; l < s.length(); l += 2) {
      int i = s[l + 1] - '0' - 1;
      int j = s[l] - '0' - 1;
      if (!(0 <= i && i <= 5) || !(0 <= j && j <= 5)) {
        bNA = true;
        goto NA;
      }
    }
  NA:;
    if (bNA) {
      cout << "NA\\n";
      continue;
    }

    for (unsigned int l = 0; l < s.length(); l += 2) {
      int i = s[l + 1] - '0' - 1;
      int j = s[l] - '0' - 1;
      cout << table[i][j];
    }
    cout << '\\n';
  }

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

#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define vi vector<int>
#define vvi vector<vector<int>>
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i, n) for (int i = 0; i < n; i++)
#define loop(i, s, n) for (int i = s; i < n; i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int> pii;
#define MAX 99999999
int main() {
  char u[6][5] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
                  'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
                  'u', 'v', 'w', 'x', 'y', 'z', '.', '?', '!', ' '};
  string s;
  while (cin >> s) {
    bool flag = true;
    if (s.length() % 2) {
      cout << "NA" << endl;
      flag = false;
    }
    if (flag) {
      vector<pii> v(1000);
      rep(i, s.length() / 2) {
        v[i] = pii(s[2 * i] - 48, s[2 * i + 1] - 48);
        if (v[i].first > 6 || v[i].second > 5 || v[i].first <= 0 ||
            v[i].second <= 0) {
          cout << "NA" << endl;
          goto E;
        }
      }
      rep(i, s.length() / 2) cout << u[v[i].first - 1][v[i].second - 1];
      cout << endl;
    }
  E:;
    s.clear();
  }
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define vi vector<int>
#define vvi vector<vector<int>>
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i, n) for (int i = 0; i < n; i++)
#define loop(i, s, n) for (int i = s; i < n; i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int> pii;
#define MAX 99999999
int main() {
  char u[6][5] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
                  'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
                  'u', 'v', 'w', 'x', 'y', 'z', '.', '?', '!', ' '};
  string s;
  while (cin >> s, 1) {
    bool flag = true;
    if (s.length() % 2) {
      cout << "NA" << endl;
      flag = false;
    }
    if (flag) {
      vector<pii> v(1000);
      rep(i, s.length() / 2) {
        v[i] = pii(s[2 * i] - 48, s[2 * i + 1] - 48);
        if (v[i].first >= 7 || v[i].second >= 6) {
          goto E;
        }
      }
      rep(i, s.length() / 2) cout << u[v[i].first - 1][v[i].second - 1];
      cout << endl;
    }
  E:;
  }
}
Problem p00127 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <string>

using namespace std;

string str[6];

void make() {
  str[1] = "afkpuz";
  str[2] = "bglqv.";
  str[3] = "chmrw?";
  str[4] = "dinsx!";
  str[5] = "ejoty ";
}
int main() {
  make();
  string in;
  while (cin >> in) {
    string out;
    if (in.length() % 2) {
      cout << "NA" << endl;
      continue;
    }
    int status = 0;
    for (int i = 0; i < in.length(); i++) {
      if (in[i] < '1' || in[i] > '7')
        status = 1;
    }
    if (status) {
      cout << "NA" << endl;
      continue;
    }
    for (int i = 0; i < in.length() - 1; i += 2) {
      if (in[i + 1] - '0' >= 6) {
        status = 1;
        break;
      }
      out += str[in[i + 1] - '0'][in[i] - '0' - 1];
    }
    if (status)
      cout << "NA" << endl;
    else
      cout << out << endl;
  }
  return 0;
}

Error: 0

Fixed submission:

#include <iostream>
#include <string>

using namespace std;

string str[6];

void make() {
  str[1] = "afkpuz";
  str[2] = "bglqv.";
  str[3] = "chmrw?";
  str[4] = "dinsx!";
  str[5] = "ejoty ";
}
int main() {
  make();
  string in;
  while (cin >> in) {
    if (in.length() % 2) {
      cout << "NA" << endl;
      continue;
    }
    int status = 0;
    for (int i = 0; i < in.length(); i++) {
      if (in[i] < '1' || in[i] > '9')
        status = 1;
    }
    if (status) {
      cout << "NA" << endl;
      continue;
    }
    for (int i = 0; i < in.length() - 1; i += 2) {
      cout << str[in[i + 1] - '0'][in[i] - '0' - 1];
    }
    cout << endl;
  }
  return 0;
}
Problem p00127 (C++) — buggy submission, verdict: Runtime Error

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

const string hyou[] = {"afkpuz", "bglqv.", "chmrw?", "dinsx!", "ejoty "};
int main() {
  string in;
  while (cin >> in) {
    cin.ignore();
    if (in.size() % 2 == 1) {
      cout << "NA" << endl;
      continue;
    }
    bool flag = true;
    string ans = "";
    for (int i = 0; i < in.size() - 1; i += 2) {
      if (!('1' <= in[i + 1] && in[i + 1] <= '5') ||
          !('1' <= in[i] && in[i] <= '6')) {
        flag = false;
        break;
      }
      ans += hyou[in[i + 1] - '0' - 1][in[i] - '0' - 1];
    }
    if (flag)
      cout << ans << endl;
    else
      cout << "NA" << endl;
  }
  return 0;
}

Error: WA

Fixed submission:

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

const string hyou[] = {"afkpuz", "bglqv.", "chmrw?", "dinsx!", "ejoty "};
int main() {
  string in;
  while (cin >> in) {
    cin.ignore();
    if (in.size() % 2 == 1) {
      cout << "NA" << endl;
      continue;
    }
    bool flag = true;
    string ans = "";
    for (int i = 0; i < in.size() - 1; i += 2) {
      if (!('1' <= in[i + 1] && in[i + 1] <= '6') ||
          !('1' <= in[i] && in[i] <= '5')) {
        flag = false;
        break;
      }
      ans += hyou[in[i + 1] - '0' - 1][in[i] - '0' - 1];
    }
    if (flag)
      cout << ans << endl;
    else
      cout << "NA" << endl;
  }
  return 0;
}