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

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

int main() {
  int n;
  string operation;
  int sum;
  int current_num;
  while (cin >> n) {
    if (n == 0)
      return 0;
    sum = 1;
    current_num = 1;
    int deme[] = {2, 5, 4, 3};
    for (int i = 0; i < n; i++) {
      cin >> operation;
      if (operation == "North") {
        int d = deme[0];
        sum += deme[0];
        deme[0] = 7 - current_num;
        deme[1] = current_num;
        current_num = d;
      } else if (operation == "South") {

        int d = deme[1];
        sum += deme[1];
        deme[0] = current_num;
        deme[1] = 7 - current_num;
        current_num = d;
      } else if (operation == "East") {
        int d = deme[2];
        sum += deme[2];
        deme[2] = 7 - current_num;
        deme[3] = current_num;
        current_num = d;
      } else if (operation == "West") {
        int d = deme[3];
        sum += deme[3];
        deme[2] = current_num;
        deme[3] = 7 - current_num;
        current_num = d;
      } else if (operation == "Right") {
        int swap_n = deme[0];
        int swap_s = deme[1];
        deme[0] = deme[3];
        deme[1] = deme[2];
        deme[2] = swap_n;
        deme[3] = swap_s;
        sum += current_num;
      } else if (operation == "Left") {
        int swap_n = deme[0];
        int swap_s = deme[1];
        deme[0] = deme[2];
        deme[1] = deme[3];
        deme[2] = swap_s;
        deme[3] = swap_n;
        sum += current_num;
      }
    }
    cout << sum << endl;
  }
  return 0;
}

Error: -11

Fixed submission:

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

int main() {
  int n;
  char *operation;
  int sum;
  int current_num;
  while (cin >> n) {
    if (n == 0)
      return 0;
    sum = 1;
    current_num = 1;
    int deme[] = {2, 5, 4, 3};
    for (int i = 0; i < n; i++) {
      cin >> operation;
      if (operation[0] == 'N') {
        int d = deme[0];
        sum += deme[0];
        deme[0] = 7 - current_num;
        deme[1] = current_num;
        current_num = d;
      } else if (operation[0] == 'S') {

        int d = deme[1];
        sum += deme[1];
        deme[0] = current_num;
        deme[1] = 7 - current_num;
        current_num = d;
      } else if (operation[0] == 'E') {
        int d = deme[2];
        sum += deme[2];
        deme[2] = 7 - current_num;
        deme[3] = current_num;
        current_num = d;
      } else if (operation[0] == 'W') {
        int d = deme[3];
        sum += deme[3];
        deme[2] = current_num;
        deme[3] = 7 - current_num;
        current_num = d;
      } else if (operation[0] == 'R') {
        int swap_n = deme[0];
        int swap_s = deme[1];
        deme[0] = deme[3];
        deme[1] = deme[2];
        deme[2] = swap_n;
        deme[3] = swap_s;
        sum += current_num;
      } else if (operation[0] == 'L') {
        int swap_n = deme[0];
        int swap_s = deme[1];
        deme[0] = deme[2];
        deme[1] = deme[3];
        deme[2] = swap_s;
        deme[3] = swap_n;
        sum += current_num;
      }
    }
    cout << sum << endl;
  }
  return 0;
}
Problem p00425 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int n;
  string s;
  string f[6] = {"North", "East", "West", "South", "Right", "Left"};
  int cf[6][3] = {{1, 5, 2}, {4, 1, 0}, {2, 1, 5},
                  {3, 0, 2}, {0, 2, 3}, {0, 4, 1}};
  int sum = 1;
  int a = 0;
  int me[6] = {1, 2, 3, 5, 4, 6};
  int ne[3];
  while (cin >> n) {
    sum = 1;
    int me[6] = {1, 2, 3, 5, 4, 6};
    if (n == 0)
      break;
    a = 0;
    for (int i = 0; i < n; i++) {
      cin >> s;
      for (int j = 0; j < 6; j++) {
        if (s == f[j]) {
          for (int k = 0; k < 3; k++) {
            ne[k] = me[cf[j][k]];
          }
          for (int k = 0; k < 3; k++) {
            me[k] = ne[k];
          }
          me[3] = 7 - me[1];
          me[4] = 7 - me[2];
          me[5] = 7 - me[0];
          break;
        }
      }
      sum += me[0];
    }
    cout << sum << endl;
  }
}

Error: -11

Fixed submission:

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

int main() {
  FILE *infile, *outfile;
  infile = fopen("in5.txt", "r");
  outfile = fopen("out5.txt", "w");
  int n;
  char x[10];
  string s = "";
  string f[6] = {"North", "East", "West", "South", "Right", "Left"};
  int cf[6][3] = {{1, 5, 2}, {4, 1, 0}, {2, 1, 5},
                  {3, 0, 2}, {0, 2, 3}, {0, 4, 1}};
  int sum = 1;
  int a = 0;
  int me[6] = {1, 2, 3, 5, 4, 6};
  int ne[3];
  fscanf(infile, "%d\\n", &n);
  for (int i = 0; i < n; i++) {
    s = "";
    for (int j = 0; j < 10; j++) {
      x[j] = '\\0';
    }
    fscanf(infile, "%s\\n", &x);
    for (int j = 0; j < 10; j++) {
      if (x[j] == '\\0')
        break;
      s += x[j];
    }

    for (int j = 0; j < 6; j++) {
      if (s == f[j]) {
        for (int k = 0; k < 3; k++) {
          ne[k] = me[cf[j][k]];
        }
        for (int k = 0; k < 3; k++) {
          me[k] = ne[k];
        }
        me[3] = 7 - me[1];
        me[4] = 7 - me[2];
        me[5] = 7 - me[0];
        break;
      }
    }
    sum += me[0];
  }
  fprintf(outfile, "%d\\n", sum);
  fclose(infile);
  fclose(outfile);
}
Problem p00425 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
int main() {
  int a[10001][7];
  for (int i = 0; i < 7; i++)
    a[0][i] = i;
  int n;
  while (cin >> n) {
    if (n == 0)
      return 0;
    string in;
    for (int i = 1; i <= n; i++) {
      cin >> in;
      for (int j = 1; j < 7; j++) {
        a[i][j] = a[i - 1][j];
      }
      if (in == "North") {
        a[i][1] = a[i - 1][2];
        a[i][2] = a[i - 1][6];
        a[i][5] = a[i - 1][1];
        a[i][6] = a[i - 1][5];
      }
      if (in == "East") {
        a[i][1] = a[i - 1][4];
        a[i][3] = a[i - 1][1];
        a[i][4] = a[i - 1][6];
        a[i][6] = a[i - 1][3];
      }
      if (in == "West") {
        a[i][1] = a[i - 1][3];
        a[i][3] = a[i - 1][6];
        a[i][4] = a[i - 1][1];
        a[i][6] = a[i - 1][4];
      }
      if (in == "South") {
        a[i][1] = a[i - 1][5];
        a[i][2] = a[i - 1][1];
        a[i][5] = a[i - 1][6];
        a[i][6] = a[i - 1][2];
      }
      if (in == "Right") {
        a[i][2] = a[i - 1][3];
        a[i][3] = a[i - 1][5];
        a[i][4] = a[i - 1][2];
        a[i][5] = a[i - 1][4];
      }
      if (in == "Left") {
        a[i][2] = a[i - 1][4];
        a[i][3] = a[i - 1][2];
        a[i][4] = a[i - 1][5];
        a[i][5] = a[i - 1][3];
      }
    }
    int sum = 0;
    for (int i = 0; i <= n; i++) {
      sum += a[i][1];
    }
    cout << sum << endl;
  }
}

Error: -11

Fixed submission:

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

int main() {
  int n;
  char *operation;
  int sum;
  int current_num;
  while (cin >> n) {
    if (n == 0)
      return 0;
    sum = 1;
    current_num = 1;
    int deme[] = {2, 5, 4, 3};
    for (int i = 0; i < n; i++) {
      cin >> operation;
      // printf ("%s", operation);
      if (operation[0] == 'N') {
        // North
        int d = deme[0];
        sum += deme[0];
        deme[0] = 7 - current_num;
        deme[1] = current_num;
        current_num = d;
      } else if (operation[0] == 'S') {
        // South
        int d = deme[1];
        sum += deme[1];
        deme[0] = current_num;
        deme[1] = 7 - current_num;
        current_num = d;
      } else if (operation[0] == 'E') {
        // East
        int d = deme[2];
        sum += deme[2];
        deme[2] = 7 - current_num;
        deme[3] = current_num;
        current_num = d;
      } else if (operation[0] == 'W') {
        // west
        int d = deme[3];
        sum += deme[3];
        deme[2] = current_num;
        deme[3] = 7 - current_num;
        current_num = d;
      } else if (operation[0] == 'R') {
        // Right
        int swap_n = deme[0];
        int swap_s = deme[1];
        deme[0] = deme[3];
        deme[1] = deme[2];
        deme[2] = swap_n;
        deme[3] = swap_s;
        sum += current_num;
      } else if (operation[0] == 'L') {
        // Left
        int swap_n = deme[0];
        int swap_s = deme[1];
        deme[0] = deme[2];
        deme[1] = deme[3];
        deme[2] = swap_s;
        deme[3] = swap_n;
        sum += current_num;
      }
    }
    cout << sum << endl;
  }
  return 0;
}
Problem p00425 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <string>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    if (n == 0)
      return 0;
    int e;
    int d, a, c, f;
    int b;
    //??????????±???????
    a = 1;
    b = 2;
    c = 3;
    d = 4;
    e = 5;
    f = 6;
    int sum = a;
    for (int i = 0; i < n; i++) {
      string s;
      cin >> s;
      int tmp;
      if (s == "North") {
        tmp = a;
        a = b;
        b = f;
        f = e;
        e = tmp;
      } else if (s == "East") {
        tmp = a;
        a = d;
        d = f;
        f = c;
        c = tmp;
      } else if (s == "West") {
        tmp = a;
        a = c;
        c = f;
        f = d;
        d = tmp;
      } else if (s == "South") {
        tmp = a;
        a = e;
        e = f;
        f = b;
        b = tmp;
      } else if (s == "Right") {
        tmp = b;
        b = c;
        c = e;
        e = d;
        d = tmp;
      } else if (s == "Left") {
        tmp = b;
        b = d;
        d = e;
        e = c;
        c = tmp;
      }
      sum += a;
    }
    cout << sum << endl;
  }
}

Error: TLE

Fixed submission:

#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
  int a, b, c, d, e, f, g, n, sum;
  string s;
  vector<int> l;
  a = 1;
  b = 2;
  c = 3;
  d = 4;
  e = 5;
  f = 6;
  while (cin >> n) {
    sum = 1;
    for (int i = 0; i < n; i++) {
      cin >> s;
      if (s == "North") {
        g = a;
        a = b;
        b = f;
        f = e;
        e = g;
      } else if (s == "South") {
        g = a;
        a = e;
        e = f;
        f = b;
        b = g;
      } else if (s == "East") {
        g = a;
        a = d;
        d = f;
        f = c;
        c = g;
      } else if (s == "West") {
        g = a;
        a = c;
        c = f;
        f = d;
        d = g;
      } else if (s == "Right") {
        g = b;
        b = c;
        c = e;
        e = f;
        f = g;
      } else if (s == "Left") {
        g = b;
        b = d;
        d = e;
        e = c;
        c = g;
      }
      sum += a;
    }
    l.push_back(sum);
  }
  for (int i : l) {
    cout << i << endl;
  }
}
Problem p00425 (C++) — buggy submission, verdict: Runtime Error

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

#define DUMP(x) cerr << #x << " = " << (x) << endl;

void rotate(int *a, int *b, int *c, int *d) {
  int temp;

  temp = *d;
  *d = *c;
  *c = *b;
  *b = *a;
  *a = temp;
}

int main(int argc, char const *argv[]) {
  int i, n, total;
  string input;

  int up = 1, bottom = 6, left = 4, right = 3, front = 2, back = 5;

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

    up = 1;
    bottom = 6;
    left = 4;
    right = 3;
    front = 2;
    back = 5;
    total = 1;

    for (i = 0; i < n; i++) {
      cin >> input;

      if (input == "North") {
        rotate(&up, &back, &bottom, &front);
      } else if (input == "East") {
        rotate(&up, &right, &bottom, &left);
      } else if (input == "West") {
        rotate(&up, &left, &bottom, &right);
      } else if (input == "South") {
        rotate(&up, &front, &bottom, &back);
      } else if (input == "Right") {
        rotate(&front, &left, &back, &right);
      } else if (input == "Left") {
        rotate(&front, &right, &back, &left);
      }

      total += up;
    }

    cout << total << endl;
  }
  return 0;
}

Error: 0
up = 2
total = 3
up = 6
total = 9
up = 4
total = 13
up = 2
total = 15
up = 6
total = 21
up = 3
total = 4
up = 2
total = 6
up = 2
total = 8
up = 6
total = 14
up = 6
total = 20
up = 4
total = 24
up = 4
total = 28
up = 6
total = 34


Fixed submission:

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

#define DUMP(x) cerr << #x << " = " << (x) << endl;

void rotate(int *a, int *b, int *c, int *d) {
  int temp;

  temp = *d;
  *d = *c;
  *c = *b;
  *b = *a;
  *a = temp;
}

int main(int argc, char const *argv[]) {
  int i, n, total;
  string input;

  int up = 1, bottom = 6, left = 4, right = 3, front = 2, back = 5;

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

    up = 1;
    bottom = 6;
    left = 4;
    right = 3;
    front = 2;
    back = 5;
    total = 1;

    for (i = 0; i < n; i++) {
      cin >> input;

      if (input == "North") {
        rotate(&up, &back, &bottom, &front);
      } else if (input == "East") {
        rotate(&up, &right, &bottom, &left);
      } else if (input == "West") {
        rotate(&up, &left, &bottom, &right);
      } else if (input == "South") {
        rotate(&up, &front, &bottom, &back);
      } else if (input == "Right") {
        rotate(&front, &left, &back, &right);
      } else if (input == "Left") {
        rotate(&front, &right, &back, &left);
      }

      total += up;
      DUMP(up);
      DUMP(total);
    }

    cout << total << endl;
  }
  return 0;
}
Problem p00425 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cstdio>

char opr[10];
int top = 1, front = 2, right = 3, n = 0, sum = 1, swap;

int dice(int n) {
  // scanf("%d",&n);
  for (int i = 0; i < n; i++) {
    scanf("%s", opr);
    switch (opr[0]) {
    case 'N':
      swap = top;
      top = front;
      front = (7 - swap);
      break;
    case 'E':
      swap = right;
      right = top;
      top = (7 - swap);
      break;
    case 'W':
      swap = top;
      top = right;
      right = (7 - swap);
      break;
    case 'S':
      swap = front;
      front = top;
      top = (7 - swap);
      break;
    case 'R':
      swap = front;
      front = right;
      right = (7 - swap);
      break;
    case 'L':
      swap = right;
      right = front;
      front = (7 - swap);
      break;
    }
    sum += top;
  }
  if (n != 0)
    printf("%d\\n", sum);
  // int top=1,front=2,right=3,sum=1,swap;
  return 0;
}

int main() {
  while (1) {
    scanf("%d", &n);
    dice(n);
    top = 1, front = 2, right = 3, sum = 1, swap;
    if (n == 0)
      break;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <cstdio>

char opr[10];
int top = 1, front = 2, right = 3, n = 0, sum = 1, swap;
int dice(int n) {
  scanf("%d", &n);
  if (n == 0)
    return 0;
  for (int i = 0; i < n; i++) {

    scanf("%s", opr);
    switch (opr[0]) {
    case 'N':
      swap = top;
      top = front;
      front = (7 - swap);
      break;
    case 'E':
      swap = right;
      right = top;
      top = (7 - swap);
      break;
    case 'W':
      swap = top;
      top = right;
      right = (7 - swap);
      break;
    case 'S':
      swap = front;
      front = top;
      top = (7 - swap);
      break;
    case 'R':
      swap = front;
      front = right;
      right = (7 - swap);
      break;
    case 'L':
      swap = right;
      right = front;
      front = (7 - swap);
      break;
    }
    sum += top;
  }
  printf("%d\\n", sum);
  int top = 1, front = 2, right = 3, sum = 1, swap;
}

int main() {
  while (n == 0)
    dice(n);
  return 0;
}
Problem p00425 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>

typedef struct {
  int U, W, E, S, N, D;
} dice_t;

int t;

void shoki(dice_t *dice) { // ダイスの初期位置
  dice->U = 1;
  dice->W = 4;
  dice->E = 3;
  dice->S = 2;
  dice->N = 5;
  dice->D = 6;
}

void N(dice_t *dice) {
  t = dice->U;
  dice->U = dice->S;
  dice->S = dice->D;
  dice->D = dice->N;
  dice->N = t;
}

void E(dice_t *dice) {
  t = dice->U;
  dice->U = dice->W;
  dice->W = dice->D;
  dice->D = dice->E;
  dice->E = t;
}

void W(dice_t *dice) {
  t = dice->U;
  dice->U = dice->E;
  dice->E = dice->D;
  dice->D = dice->W;
  dice->W = t;
}

void S(dice_t *dice) {
  t = dice->U;
  dice->U = dice->N;
  dice->N = dice->D;
  dice->D = dice->S;
  dice->S = t;
}

void R(dice_t *dice) {
  t = dice->S;
  dice->S = dice->E;
  dice->E = dice->N;
  dice->N = dice->W;
  dice->W = t;
}

void L(dice_t *dice) {
  t = dice->S;
  dice->S = dice->W;
  dice->W = dice->N;
  dice->N = dice->E;
  dice->E = t;
}

int main(void) {
  char sousa[10];
  int i, n, s;
  dice_t dice;
  while (0 == 0) {
    scanf("%d", &n);
    if (n == 0)
      break;
    shoki(&dice);
    s = 1;
    for (i = 0; i < n; i++) {
      scanf("%s", sousa);
      switch (sousa[0]) {
      case 'N':
        N(&dice);
        break;
      case 'E':
        E(&dice);
        break;
      case 'W':
        W(&dice);
        break;
      case 'S':
        S(&dice);
        break;
      case 'R':
        R(&dice);
        break;
      case 'L':
        L(&dice);
        break;
      }
      s += dice.U;
    }
    printf("%d\\n", s);
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <stdio.h>

typedef struct {
  int U, W, E, S, N, D;
} dice_t;

int t;

void shoki(dice_t *dice) { // ダイスの初期位置
  dice->U = 1;
  dice->W = 4;
  dice->E = 3;
  dice->S = 2;
  dice->N = 5;
  dice->D = 6;
}

void N(dice_t *dice) {
  t = dice->U;
  dice->U = dice->S;
  dice->S = dice->D;
  dice->D = dice->N;
  dice->N = t;
}

void E(dice_t *dice) {
  t = dice->U;
  dice->U = dice->W;
  dice->W = dice->D;
  dice->D = dice->E;
  dice->E = t;
}

void W(dice_t *dice) {
  t = dice->U;
  dice->U = dice->E;
  dice->E = dice->D;
  dice->D = dice->W;
  dice->W = t;
}

void S(dice_t *dice) {
  t = dice->U;
  dice->U = dice->N;
  dice->N = dice->D;
  dice->D = dice->S;
  dice->S = t;
}

void R(dice_t *dice) {
  t = dice->S;
  dice->S = dice->E;
  dice->E = dice->N;
  dice->N = dice->W;
  dice->W = t;
}

void L(dice_t *dice) {
  t = dice->S;
  dice->S = dice->W;
  dice->W = dice->N;
  dice->N = dice->E;
  dice->E = t;
}

int main(void) {
  char sousa[10];
  int i, n, s;
  dice_t dice;
  while (0 == 0) {
    scanf("%d", &n);
    if (n == 0)
      break;
    shoki(&dice);
    s = 1;
    for (i = 0; i < n; i++) {
      scanf("%d", sousa);
      switch (sousa[0]) {
      case 'N':
        N(&dice);
        break;
      case 'E':
        E(&dice);
        break;
      case 'W':
        W(&dice);
        break;
      case 'S':
        S(&dice);
        break;
      case 'R':
        R(&dice);
        break;
      case 'L':
        L(&dice);
        break;
      }
      s += dice.U;
    }
    printf("%d\\n", s);
  }
  return 0;
}
Problem p00425 (C++) — buggy submission, verdict: Time Limit Exceeded

#import <cstdio>
int main() {
  for (int n, a, c, r, t; c = r = scanf("%d", &n), n; printf("%d\\n", r))
    for (char d[] = "123546", s[9]; n--; r += *d - 48)
      scanf("%s", s), *s % 6 - 4 ? a = *s % 5 + *s % 2 * 2 + c & 3, t = *d,
                                   *d = d[++a], d[++a - 1] = d[5],
                                   d[5] = d[a % 4 + 1],
                                   d[a % 4 + 1] = t : c += *s + 3;
}

Error: TLE

Fixed submission:

#import <cstdio>
int main() {
  for (int n, a, t, c, r; c = r = scanf("%d", &n), n; printf("%d\\n", r))
    for (char d[] = "123456"; n--; r += *d - 48)
      scanf("%s", &t), t %= 256,
          t % 6 - 4 ? a = t % 5 + t % 2 * 2 + c & 3, t = *d,
                      *d = d[a += a / 2 ? 2 - a % 2 * 2 : 1], d[a] = d[5],
                      d[5] = d[5 - a], d[5 - a] = t : c += t + 3;
}
Problem p00425 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <string.h>
using namespace std;
int main() {
  int n, cou = 0, N = 5, E = 3, W = 4, S = 2, U = 1, D = 6, A = 0;
  char c[30] = {0};
  while (1) {
    N = 5, E = 3, W = 4, S = 2, U = 1, D = 6;
    cou = 1;
    cin >> n;
    if (n == 0) {
      break;
    }
    for (int i = 0; i < n; i++) {
      cin >> c;
      A = 0;
      if (c[0] == 'N') {
        A = N;
        N = U;
        U = S;
        S = D;
        D = A;
        cou = cou + U;
      } else if (c[0] == 'E') {
        A = E;
        E = U;
        U = W;
        W = D;
        D = A;
        cou = cou + U;
      } else if (c[0] == 'W') {
        A = W;
        W = U;
        U = E;
        E = D;
        D = A;
        cou = cou + U;
      } else if (c[0] == 'S') {
        A = S;
        S = U;
        U = N;
        N = D;
        D = A;
        cou = cou + U;
      } else if (c[0] == 'L') {
        A = E;
        E = S;
        S = W;
        W = N;
        N = A;
        cou = cou + U;
      } else if (c[0] == 'R') {
        A = S;
        S = E;
        E = N;
        N = W;
        W = A;
        cou = cou + U;
      }
    }
    cout << cou << endl;
  }
  return 0;
}

Error: -11

Fixed submission:

#include <iostream>
#include <string.h>
using namespace std;
int main() {
  int n, cou = 0, N = 5, E = 3, W = 4, S = 2, U = 1, D = 6;
  char *c;
  char *s1 = "North";
  char *s2 = "East";
  char *s3 = "West";
  char *s4 = "South";
  char *s5 = "Right";
  char *s6 = "Left";
  while (1) {
    cou = 0;
    cin >> n;
    if (n == 0) {
      break;
    }
    for (int i = 0; i < n; i++) {
      cin >> c;
      if (strcmp(s1, c) == 0) {
        N = U;
        U = S;
        S = D;
        D = N;
        cou = cou + U;
      } else if (strcmp(s2, c) == 0) {
        E = U;
        U = W;
        W = D;
        D = E;
        cou = cou + U;
      } else if (strcmp(s3, c) == 0) {
        W = U;
        U = E;
        E = D;
        D = W;
        cou = cou + U;
      } else if (strcmp(s4, c) == 0) {
        S = U;
        U = N;
        N = D;
        D = S;
        cou = cou + U;
      } else if (strcmp(s5, c) == 0) {
        E = S;
        S = W;
        W = N;
        N = E;
        cou = cou + U;
      } else if (strcmp(s6, c) == 0) {
        S = E;
        E = N;
        N = W;
        W = S;
        cou = cou + U;
      }
    }
    cout << cou << endl;
  }
  return 0;
}
Problem p00425 (C++) — buggy submission, verdict: Runtime Error

#import <cstdio>
int main() {
  int a, c = 1, r = 0, t;
  for (char d[] = "123546", s[9]; t = scanf("%s", s), *s > 60; r += *d % 8)
    *s % 6 - 4 ? a = *s % 5 + *s % 2 * 2 + c & 3, t = *d, *d = d[++a],
                 d[a] = d[5], d[5] = d[a = ++a % 4 + 1], d[a] = t : c += *s + 3;
  r &&printf("%d\\n", r + 1);
  ~t ? main() : 0;
}

Error: -11

Fixed submission:

#import <cstdio>
int main() {
  int n, a, c = 1, r = 0, t;
  for (char d[] = "123546", s[9]; ~scanf("%s", s) && *s > 60; r += *d % 8)
    *s % 6 - 4 ? a = *s % 5 + *s % 2 * 2 + c & 3, t = *d, *d = d[++a],
                 d[a] = d[5], d[5] = d[a = ++a % 4 + 1], d[a] = t : c += *s + 3;
  r &&printf("%d\\n", r + 1);
  main();
}