prithivMLmods/Coder-Stat huggingface dataset:
Problem p02393 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int main() {
  int a, b, c, temp;

  cin >> a >> b >> c;

  while (1) {
    if (a < b && b < c)
      break;
    else if (b < a) {
      temp = b;
      b = a;
      a = temp;
    } else if (c < b) {
      temp = c;
      c = b;
      b = temp;
    } else if (c < a) {
      temp = c;
      c = a;
      a = temp;
    }
  }
  cout << a << " " << b << " " << c << endl;
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;

int main() {
  int a, b, c, temp;

  cin >> a >> b >> c;

  while (1) {
    if ((a < b && b < c) || (a == b && b < c) || (a == b && b == c))
      break;
    else if (b < a) {
      temp = b;
      b = a;
      a = temp;
    } else if (c < b) {
      temp = c;
      c = b;
      b = temp;
    } else if (c < a) {
      temp = c;
      c = a;
      a = temp;
    }
  }
  cout << a << " " << b << " " << c << endl;
  return 0;
}
Problem p02393 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  vector<int> a;

  cin >> a[0] >> a[1] >> a[2];

  sort(a.begin(), a.end());

  cout << a[0] << " " << a[1] << " " << a[2] << endl;

  return 0;
}


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

int main() {
  vector<int> a(3);

  cin >> a[0] >> a[1] >> a[2];

  sort(a.begin(), a.end());

  cout << a[0] << " " << a[1] << " " << a[2] << endl;

  return 0;
}
Problem p02393 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
int main() {
  int a[3];
  for (int i = 0; i < 3; ++i) {
    std::cin >> a[i];
  }
  std::sort(a, a + 3);
  for (int i = 0; i < 3; --i) {
    std::cout << a[i] << std::endl;
  }
  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
int main() {
  int a[3];
  for (int i = 0; i < 3; ++i) {
    std::cin >> a[i];
  }
  std::sort(a, a + 3);
  std::cout << a[0] << " " << a[1] << " " << a[2] << std::endl;
  return 0;
}
Problem p02393 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int main() {
  int a, b, c;
  int temp;
  cin >> a >> b >> c;

  while (1) {
    if (a > b) {
      temp = a;
      a = b;
      b = temp;
    }
    if (b > c) {
      temp = b;
      b = c;
      c = temp;
    }
    if (a > b) {
      temp = a;
      a = b;
      b = temp;
    }

    if (a < b && b < c) {
      cout << a << " " << b << " " << c << endl;
      return 0;
    }
  }
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;

int main() {
  int a, b, c;
  int temp;
  cin >> a >> b >> c;

  while (1) {
    if (a > b) {
      temp = a;
      a = b;
      b = temp;
    }
    if (b > c) {
      temp = b;
      b = c;
      c = temp;
    }
    if (a > b) {
      temp = a;
      a = b;
      b = temp;
    }

    if (a <= b && b <= c) {
      cout << a << " " << b << " " << c << endl;
      return 0;
    }
  }
  return 0;
}
Problem p02393 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>

int main(void) {
  int i, j, a[3];

  scanf("%d %d %d", a[0], a[1], a[2]);

  for (i = 0; i < 2; i++) {
    for (j = 2; j > i; j--) {
      if (a[j - 1] > a[j]) {
        int temp = a[j];
        a[j] = a[j - 1];
        a[j - 1] = temp;
      }
    }
  }

  printf("%d %d %d\n", a[0], a[1], a[2]);
}

Fixed submission:
#include <stdio.h>

int main(void) {
  int i, j, a[3];

  scanf("%d %d %d", &a[0], &a[1], &a[2]);

  for (i = 0; i < 2; i++) {
    for (j = 2; j > i; j--) {
      if (a[j - 1] > a[j]) {
        int temp = a[j];
        a[j] = a[j - 1];
        a[j - 1] = temp;
      }
    }
  }

  printf("%d %d %d\n", a[0], a[1], a[2]);
}
Problem p02393 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <stdio.h>

int main() {

  int a, b, c, m;
  scanf("%d%d%d", &a, &b, &c);
  while (1) {
    if (a < b && b < c) {
      break;
    }
    if (a > b) {
      m = b;
      b = a;
      a = m;
    }
    if (b > c) {
      m = c;
      c = b;
      b = m;
    }
    if (a > c) {
      m = c;
      c = a;
      a = m;
    }
  }
  printf("%d %d %d\n", a, b, c);
  return 0;
}


Fixed submission:
#include <stdio.h>

int main() {

  int a, b, c, m;
  scanf("%d%d%d", &a, &b, &c);
  if (a > b) {
    m = b;
    b = a;
    a = m;
  }
  if (b > c) {
    m = c;
    c = b;
    b = m;
  }
  if (a > b) {
    m = b;
    b = a;
    a = m;
  }
  printf("%d %d %d\n", a, b, c);
  return 0;
}
Problem p02393 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PI;

int main() {
  int a[3];
  for (int i = 0; i < 3; i++)
    cin >> a[i];
  sort(a, a + 3);
  for (int e : a)
    cout << e << " ";
  cout << endl;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PI;

int main() {
  int a[3];
  for (int i = 0; i < 3; i++)
    cin >> a[i];
  sort(a, a + 3);
  cout << a[0] << " " << a[1] << " " << a[2] << endl;
  return 0;
}
Problem p02393 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int a, b, c, d;
  cin >> a >> b >> c;
  while (1) {
    if (a < b && b < c && a < c)
      break;
    if (a > b) {
      d = a;
      a = b;
      b = d;
    }
    if (b > c) {
      d = b;
      b = c;
      c = d;
    }
    if (a > c) {
      d = a;
      a = c;
      c = d;
    }
  }
  cout << a << ' ' << b << ' ' << c << endl;

  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int a, b, c, d;
  cin >> a >> b >> c;
  while (1) {
    if (a <= b && b <= c && a <= c)
      break;
    if (a > b) {
      d = a;
      a = b;
      b = d;
    }
    if (b > c) {
      d = b;
      b = c;
      c = d;
    }
    if (a > c) {
      d = a;
      a = c;
      c = d;
    }
  }
  cout << a << ' ' << b << ' ' << c << endl;

  return 0;
}
Problem p02393 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cctype>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
  int a, b, c, t;
  scanf("%d %d %d", &a, &b, &c);
  for (;;) {
    if (a < b && b < c) {
      break;
    }
    if (a > b) {
      t = a;
      a = b;
      b = t;
    }
    if (b > c) {
      t = b;
      b = c;
      c = t;
    }
  }
  printf("%d %d %d\n", a, b, c);
  return 0;
}

Fixed submission:
#include <algorithm>
#include <cctype>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
  int a, b, c, t;
  scanf("%d %d %d", &a, &b, &c);
  for (;;) {
    if (a <= b && b <= c) {
      break;
    }
    if (a > b) {
      t = a;
      a = b;
      b = t;
    }
    if (b > c) {
      t = b;
      b = c;
      c = t;
    }
  }
  printf("%d %d %d\n", a, b, c);
  return 0;
}
Problem p02393 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int main() {
  int a, b, c, x, y;
  cin >> a >> b >> c;
  while (!(a < b && b < c)) {
    if (a > b) {
      x = a;
      y = b;
      a = y;
      b = x;
    }
    if (b > c) {
      x = b;
      y = c;
      b = y;
      c = x;
    }
  }
  cout << a << " " << b << " " << c << endl;
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;

int main() {
  int a, b, c, x, y;
  cin >> a >> b >> c;
  while (!(a <= b && b <= c)) {
    if (a > b) {
      x = a;
      y = b;
      a = y;
      b = x;
    }
    if (b > c) {
      x = b;
      y = c;
      b = y;
      c = x;
    }
  }
  cout << a << " " << b << " " << c << endl;
  return 0;
}
Problem p02393 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>

using namespace std;

int main() {
  int a, b, c;
  int temp;
  cin >> a;
  cin >> b;
  cin >> c;
  while (!(a < b && b < c)) {
    if (a > b) {
      temp = a;
      a = b;
      b = temp;
    }
    if (b > c) {
      temp = b;
      b = c;
      c = temp;
    }
  }
  cout << a << " " << b << " " << c << endl;
  return 0;
}

Fixed submission:
#include <iostream>

using namespace std;

int main() {
  int a, b, c;
  int temp;
  cin >> a;
  cin >> b;
  cin >> c;
  while (!(a <= b && b <= c)) {
    if (a > b) {
      temp = a;
      a = b;
      b = temp;
    }
    if (b > c) {
      temp = b;
      b = c;
      c = temp;
    }
  }
  cout << a << " " << b << " " << c << endl;
  return 0;
}
Problem p02393 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>

int main(void) {

  int i, j;
  int a[3];
  int temp;

  scanf("%d %d %d", &a[0], &a[1], &a[2]);

  for (i = 0; i < 3; i++) {
    for (j = 2; j >= i; j--) {
      if (a[j] < a[j - 1]) {
        temp = a[j];
        a[j] = a[j - 1];
        a[j - 1] = temp;
      }
    }
  }

  printf("%d %d %d\n", a[0], a[1], a[2]);

  return 0;
}

Fixed submission:
#include <stdio.h>

int main(void) {

  int i, j;
  int a[3];
  int temp;

  scanf("%d %d %d", &a[0], &a[1], &a[2]);

  for (i = 0; i < 3; i++) {
    for (j = 2; j > i; j--) {
      if (a[j] < a[j - 1]) {
        temp = a[j];
        a[j] = a[j - 1];
        a[j - 1] = temp;
      }
    }
  }

  printf("%d %d %d\n", a[0], a[1], a[2]);

  return 0;
}
Problem p02393 (Python)

Buggy submission (status: Runtime Error):
data = [int(i) for i in input.split()]
out = " ".join([str(i) for i in sorted(data)])
print(out)


Fixed submission:
data = [int(i) for i in input().split()]
out = " ".join([str(i) for i in sorted(data)])
print(out)
Problem p02393 (Python)

Buggy submission (status: Runtime Error):
print(*sorted.map(int, input().split()))


Fixed submission:
print(*sorted(map(int, input().split())))
Problem p02393 (Python)

Buggy submission (status: Runtime Error):
num = list(map(int, input().split(" ")))
num.sort()
print(" ".join(map(int, num)))


Fixed submission:
num = list(map(int, input().split(" ")))
num.sort()
print(" ".join(map(str, num)))
Problem p02393 (Python)

Buggy submission (status: Runtime Error):
array = input().split().sort()

for i in array:
    print(i, end="")


Fixed submission:
l = list(map(int, input().split()))
l.sort()
print(l[0], l[1], l[2])
Problem p02393 (Python)

Buggy submission (status: Runtime Error):
a = list(map(int, input().split()))
[print(*i) for i in a.sort()]


Fixed submission:
a = list(map(int, input().split()))
a.sort()
print(" ".join(map(str, a)))
Problem p02393 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <cstdio>

int main() {
  int a, b, c, t;
  scanf("%d %d %d", &a, &b, &c);

  while (!(a < b && b < c)) {
    if (a > b) {
      t = a;
      a = b;
      b = t;
    }
    if (b > c) {
      t = b;
      b = c;
      c = t;
    }
  }

  printf("%d %d %d\n", a, b, c);
  return 0;
}

Fixed submission:
#include <cstdio>

int main() {
  int a, b, c, t;
  scanf("%d %d %d", &a, &b, &c);

  if (a > b) {
    t = a;
    a = b;
    b = t;
  }
  if (b > c) {
    t = b;
    b = c;
    c = t;
  }
  if (a > b) {
    t = a;
    a = b;
    b = t;
  }

  printf("%d %d %d\n", a, b, c);
  return 0;
}
Problem p02393 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>

int main(void) {
  int a, b, c, x;
  scanf("%d%d%d", a, b, c);
  if (a > b) {
    x = a;
    a = b;
    b = x;
  }
  if (b > c) {
    x = b;
    b = c;
    c = x;
  }
  if (a > b) {
    x = a;
    a = b;
    b = x;
  }
  printf("%d %d %d\n", a, b, c);
  return 0;
}

Fixed submission:
#include <iostream>

int main(void) {
  int a, b, c, x;
  scanf("%d%d%d", &a, &b, &c);
  if (a > b) {
    x = a;
    a = b;
    b = x;
  }
  if (b > c) {
    x = b;
    b = c;
    c = x;
  }
  if (a > b) {
    x = a;
    a = b;
    b = x;
  }
  printf("%d %d %d\n", a, b, c);
  return 0;
}
Problem p02393 (Python)

Buggy submission (status: Runtime Error):
num_sorted = list(map(int, input().split()))
print(
    "{} {} {}".format(num_sorted.sort()[0], num_sorted.sort()[1], num_sorted.sort()[2])
)


Fixed submission:
num_sorted = list(map(int, input().split()))
num_sorted.sort()
print("{} {} {}".format(num_sorted[0], num_sorted[1], num_sorted[2]))
Problem p02394 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;

int main(int argc, char *argv[]) {
  int w, h, x, y, r;
  if (w < 0 || h < 0 || r < 0)
    return -1;
  cin >> w >> h >> x >> y >> r;

  if ((x <= (w - r)) && (x >= r) && (y <= (h - r)) && (y >= r)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Fixed submission:
#include <iostream>
using namespace std;

int main(int argc, char *argv[]) {
  int w, h, x, y, r;
  // Junsang****if( w<0 || h<0 || r<0) return -1;
  cin >> w >> h >> x >> y >> r;

  if ((x <= (w - r)) && (x >= r) && (y <= (h - r)) && (y >= r)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}
Problem p02394 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int check(int a, int b, int r) {
  if (0 <= b - r && b + r <= a) {
    return 1;
  } else
    return 0;
}

int main() {
  int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;
  char flag = 0;
  flag = flag + check(W, x, r) + check(H, y, r);
  if (flag == 2) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  cout << endl;

  string hoge;
  while (hoge != "finir") {
    cin >> hoge;
  }
}


Fixed submission:
#include <iostream>
using namespace std;

int check(int a, int b, int r) {
  if (0 <= b - r && b + r <= a) {
    return 1;
  } else
    return 0;
}

int main() {
  int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;
  char flag = 0;
  flag = flag + check(W, x, r) + check(H, y, r);
  if (flag == 2) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  cout << endl;
}
Problem p02394 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
#include <stdio.h>
int main() {
  int u[100][100] = {0}, a[5] = {0}, i, o, j = 0;
  for (i = 0; i < 5; i++)
    cin >> a[i];
  for (i = 0; i < a[0]; i++) {
    for (o = 0; o < a[1]; o++) {
      u[i][o] = 1;
    }
  }
  for (i = a[2] - a[4]; i < a[2] + a[4]; i++) {
    for (o = a[3] - a[4]; o < a[3] + a[4]; o++) {
      u[i][o] += 1;
      if (u[i][o] == 1)
        j = 1;
    }
  }
  if (j == 1)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;
#include <stdio.h>
int main() {
  int u[100][100] = {0}, a[5] = {0}, i, o, j = 0;
  for (i = 0; i < 5; i++)
    cin >> a[i];
  if (a[0] < a[4] || a[1] < a[4]) {
    cout << "No" << endl;
    return 0;
  }
  for (i = 0; i < a[0]; i++) {
    for (o = 0; o < a[1]; o++) {
      u[i][o] = 1;
    }
  }
  for (i = a[2] - a[4]; i < a[2] + a[4]; i++) {
    for (o = a[3] - a[4]; o < a[3] + a[4]; o++) {
      u[i][o] += 1;
      if (u[i][o] == 1)
        j = 1;
    }
  }
  if (j == 1)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
  return 0;
}
Problem p02394 (C++)

Buggy submission (status: Runtime Error):
#include <cstdio>

int main() {
  int W, H, x, y, r;
  scanf("%d %d %d %d %d", W, H, x, y, r);
  if (W - r < x || H - r < y || x < r || y < r) {
    printf("No\n");
  } else {
    printf("Yes\n");
  }

  return 0;
}

Fixed submission:
#include <cstdio>

int main() {
  int W, H, x, y, r;
  scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
  if (W - r < x || H - r < y || x < r || y < r) {
    printf("No\n");
  } else {
    printf("Yes\n");
  }

  return 0;
}
Problem p02394 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>
int main() {
  int W, H, x, y, r;
  scanf("%d %d %d %d %d", W, H, x, y, r);
  if (0 <= x - r && W >= x + r && 0 <= y - r && H >= y + r) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}

Fixed submission:
#include <stdio.h>
int main() {
  int W, H, x, y, r;
  scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
  if (0 <= x - r && W >= x + r && 0 <= y - r && H >= y + r) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}
Problem p02394 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>

int main(void) {
  int W, H, x, y, r;
  scanf("%d %d %d %d %d", W, H, x, y, r);

  if (x - r < 0 || x + r > W || y - r < 0 || y + r > H) {
    printf("No\n");
  } else {
    printf("Yes\n");
  }
}

Fixed submission:
#include <stdio.h>

int main(void) {
  int W, H, x, y, r;
  scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);

  if (x - r < 0 || x + r > W || y - r < 0 || y + r > H) {
    printf("No\n");
  } else {
    printf("Yes\n");
  }
}
Problem p02394 (C++)

Buggy submission (status: Runtime Error):
#include <cmath>
#include <iostream>
using namespace std;

int main() {
  int nW, nH, nX, nY, nR;
  cin >> nW >> nH >> nX >> nY >> nR;
  if ((nX + nR <= nW) && (nX - nR >= 0) && (nY + nR <= nH) && (nY - nR >= 0)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  system("pause");
  return 0;
}

Fixed submission:
#include <cmath>
#include <iostream>
using namespace std;

int main() {
  int nW, nH, nX, nY, nR;
  cin >> nW >> nH >> nX >> nY >> nR;
  if ((nX + nR <= nW) && (nX - nR >= 0) && (nY + nR <= nH) && (nY - nR >= 0)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  /*system("pause");*/
  return 0;
}
Problem p02394 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>

using namespace std;

int W, H, x, y, r;

int main() {
  scanf("%d%d%d%d%d", W, H, x, y, r);
  if (x >= r && x <= W - r && y >= r && y <= H - r) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
}


Fixed submission:
#include <bits/stdc++.h>

using namespace std;

int W, H, x, y, r;

int main() {
  scanf("%d%d%d%d%d", &W, &H, &x, &y, &r);
  if (x >= r && x <= W - r && y >= r && y <= H - r) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
}
Problem p02396 (C++)

Buggy submission (status: Runtime Error):
#include "iostream"
#include "string"

int main() {
  int temp = 1;
  int Num[512];
  int i = 0;

  while (temp != 0) {
    std::cin >> temp;
    Num[i] = temp;
    i++;
  }

  i = 0;
  while (Num[i] != 0) {
    std::cout << "Case " << i + 1 << ": " << Num[i] << std::endl;
    i++;
  }
  return 0;
}

Fixed submission:
#include "iostream"
#include "string"

int main() {
  int temp = 1;
  int Num[10240];
  int i = 0;

  while (temp != 0) {
    std::cin >> temp;
    Num[i] = temp;
    i++;
  }

  i = 0;
  while (Num[i] != 0) {
    std::cout << "Case " << i + 1 << ": " << Num[i] << std::endl;
    i++;
  }
  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <stdio.h>

int main(void) {
  int i, x;
  for (i = 1;; i++) {
    scanf("%5d", &x);
    printf("Case%d;%d\n", i, x);
  }
}


Fixed submission:
#include <stdio.h>

int main(void) {
  int i, x;
  for (i = 1;; i++) {
    scanf("%5d", &x);
    if (x == 0) {
      break;
    }
    if (x > 1 && 10000 < x) {
      break;
    }
    printf("Case %d: %d\n", i, x);
  }
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>

using namespace std;

int main() {
  int i, in;
  i = 0;
  while (true) {
    i++;
    cin >> in;
    if (i == 0)
      break;
    printf("Case %d: %d\n", i, in);
  }

  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>

using namespace std;

int main() {
  int i, in;
  i = 0;
  while (true) {
    i++;
    cin >> in;
    if (in == 0)
      break;
    printf("Case %d: %d\n", i, in);
  }

  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>
int main(void) {
  int i, a[7];
  for (i = 0; i < 7; i++)
    scanf("%d", a[i]);
  for (i = 0; i < 7; i++)
    printf("Case %d: %d", i + 1, a[i]);

  return 0;
}

Fixed submission:
#include <stdio.h>
int main(void) {
  int i = 0, x;
  scanf("%d", &x);
  while (x != 0) {
    printf("Case %d: %d\n", i + 1, x);
    scanf("%d", &x);
    i++;
  }

  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main() {
  int i = 1, x;
  cin >> x;
  while (x != 0) {
    cout << "Case " << i << ": " << x << endl;
    i++;
  }
  return 0;
}


Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int i = 1, x;
  cin >> x;
  while (x != 0) {
    cout << "Case"
         << " " << i++ << ":"
         << " " << x << endl;
    cin >> x;
  }
  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  vector<int> x(10000);
  int idx = 0;
  while (true) {
    cin >> x.at(idx);
    if (x.at(idx) == 0)
      break;
    idx++;
  }
  idx = 0;
  while (x.at(idx) != 0) {
    cout << "Case " << idx + 1 << ": " << x.at(idx) << endl;
    idx++;
  }
}


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

int main() {
  vector<int> x(10001);
  int idx = 0;
  while (true) {
    cin >> x.at(idx);
    if (x.at(idx) == 0)
      break;
    idx++;
  }
  idx = 0;
  while (x.at(idx) != 0) {
    cout << "Case " << idx + 1 << ": " << x.at(idx) << endl;
    idx++;
  }
}
Problem p02396 (C++)

Buggy submission (status: Runtime Error):
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main(void) {
  int x[100], i = 0, j;

  while (1) {
    scanf("%d", &x[i]);
    if (x[i] == 0) {
      break;
    }
    i++;
  }

  for (j = 1; j < i + 1; j++) {
    printf("Case %d: %d\n", j, x[j - 1]);
  }

  return 0;
}

Fixed submission:
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main(void) {
  int x[10000], i = 0, j;

  while (1) {
    scanf("%d", &x[i]);
    if (x[i] == 0) {
      break;
    }
    i++;
  }

  for (j = 1; j < i + 1; j++) {
    printf("Case %d: %d\n", j, x[j - 1]);
  }

  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Runtime Error):
#include <cstdio>
int main() {
  int id, data;
  id = 1;
  while (true) {
    scanf("%d", data);
    if (data == 0)
      break;
    printf("Case %d: %d\n", id, data);
    ++id;
  }
  return 0;
};


Fixed submission:
#include <cstdio>
int main() {
  int id, data;
  id = 1;
  while (true) {
    scanf("%d", &data);
    if (data == 0)
      break;
    printf("Case %d: %d\n", id, data);
    ++id;
  }
  return 0;
};
Problem p02396 (Python)

Buggy submission (status: Runtime Error):
i = 1
while True:
    x = int(input)
    if x == 0:
        break
    print(f"Case {i}: {x}")
    i += 1


Fixed submission:
i = 1
while True:
    x = int(input())
    if x == 0:
        break
    print(f"Case {i}: {x}")
    i += 1
Problem p02396 (Python)

Buggy submission (status: Runtime Error):
c = 1
while True:
    print("Case {0}: {1}".format(c, input()))
    c += 1


Fixed submission:
c = 1
while True:
    x = int(input())
    if x == 0:
        break
    print("Case {0}: {1}".format(c, x))
    c += 1
Problem p02396 (Python)

Buggy submission (status: Runtime Error):
for i in range():
    inpu = int(input())
    if inpu == 0:
        break
    else:
        print("Case %d: %d" % (i, inpu))


Fixed submission:
for i in range(1, 10001):
    inpu = int(input())
    if inpu == 0:
        break
    else:
        print("Case %d: %d" % (i, inpu))
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>

#define CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

int main(void) {
  int x = 0;
  int i = 1;
  while (1) {
    CI x;
    CO "case " << i << ":" << x E++ i;
  }
}

Fixed submission:
#include <iostream>

#define CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

int main(void) {
  int x = 0;
  int i = 1;
  while (1) {
    CI x;
    if (x == 0) {
      return 0;
    }
    CO "Case " << i << ": " << x E++ i;
  }
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main() {
  int x, cnt = 0;
  while (1) {
    cin >> x;
    if (x = 0) {
      return 0;
    }
    cnt++;
    cout << "Case"
         << " " << cnt << ": " << x << endl;
  }
}


Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int x, cnt = 0;
  while (1) {
    cin >> x;
    if (x == 0) {
      return 0;
    }
    cnt++;
    cout << "Case"
         << " " << cnt << ": " << x << endl;
  }
}
Problem p02396 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
#include <vector>
using namespace std;

int main() {
  int a[10000];
  int total = 0;
  for (int i = 0; i <= 10000; i++) {
    int tmp;
    cin >> tmp;
    if (tmp < 0 || tmp >= 10000)
      return -1;
    if (tmp == 0) {
      break;
    }
    a[i] = tmp;
    total++;
  }

  for (int j = 0; j <= total - 1; j++)
    cout << "Case " << j + 1 << ": " << a[j] << endl;

  return 0;
}


Fixed submission:
#include <iostream>
#include <vector>
using namespace std;

int main() {
  int a[10000];
  int total = 0;
  for (int i = 0; i <= 10000; i++) {
    int tmp;
    cin >> tmp;
    //        if(tmp < 0 || tmp >= 10000) return -1;
    if (tmp == 0) {
      break;
    }
    a[i] = tmp;
    total++;
  }

  for (int j = 0; j <= total - 1; j++)
    cout << "Case " << j + 1 << ": " << a[j] << endl;

  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main() {
  int x;
  int i = 1;

  while (1) {
    cin >> x;
    if (x = 0)
      break;
    cout << "Case " << i << ": " << x << endl;
    i++;
  }
}


Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int x;
  int i = 1;

  while (1) {
    cin >> x;
    if (x == 0)
      break;
    cout << "Case " << i << ": " << x << endl;
    i++;
  }
}
Problem p02396 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int i = 0, Case[1000];
  Case[0] = 1;
  while (1) {
    cin >> Case[i];
    if (Case[i] == 0) {
      break;
    }
    i++;
  }
  for (int j = 0; j <= i - 1; j++) {
    cout << "Case " << j + 1 << ": " << Case[j] << endl;
  }
}


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

int main() {
  int i = 0, Case[10000];
  Case[0] = 1;
  while (1) {
    cin >> Case[i];
    if (Case[i] == 0) {
      break;
    }
    i++;
  }
  for (int j = 0; j <= i - 1; j++) {
    cout << "Case " << j + 1 << ": " << Case[j] << endl;
  }
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
// ConsoleApplication3.cpp : コンソール アプリケーションのエントリ
// ポイントを定義します。
//

// #include "stdafx.h"
#include <iostream>
using namespace std;
int main() {
  int a, b;
  b = 1;
  while (1) {
    cin >> a;
    cout << "Case " << b << ": " << a << endl;
    b++;
  }
  return 0;
}


Fixed submission:
// ConsoleApplication3.cpp : コンソール アプリケーションのエントリ
// ポイントを定義します。
//

// #include "stdafx.h"
#include <iostream>
using namespace std;
int main() {
  int a, b;
  b = 1;
  while (1) {
    cin >> a;
    if (a == 0) {
      break;
    } else {
      cout << "Case " << b << ": " << a << endl;
      b++;
    }
  }
  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define INF 100000000

#define MAX_N 10000
#define MAX_M 100

typedef long long int ll;
using namespace std;

int main() {

  int x;
  int i = 0;
  while (true) {

    scanf("%d", &x);
    if (x != 0) {
      i++;
      printf("Case %s: %d\n", i, x);
    } else
      break;
  }

  return 0;
}

Fixed submission:
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define INF 100000000

#define MAX_N 10000
#define MAX_M 100

typedef long long int ll;
using namespace std;

int main() {

  int x;
  int i = 0;
  while (true) {

    scanf("%d", &x);
    if (x != 0) {
      i++;
      printf("Case %d: %d\n", i, x);
    } else
      break;
  }

  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cstdio>

using namespace std;

int main() {
  int N[100];
  int i = 0;
  while (true) {
    scanf("%d", &N[i]);
    if (N[i] == 0)
      break;
    i++;
  }

  for (int j = 0; j < i; j++) {
    printf("Case %d: %d\n", j + 1, N[j]);
  }
  return 0;
}

Fixed submission:
#include <algorithm>
#include <cstdio>

using namespace std;

int main() {
  int N[65535];
  int i = 0;
  while (true) {
    scanf("%d", &N[i]);
    if (N[i] == 0)
      break;
    i++;
  }

  for (int j = 0; j < i; j++) {
    printf("Case %d: %d\n", j + 1, N[j]);
  }
  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
/*
 * taete.cpp
 *
 *  Created on: 2018/04/26
 *      Author: J01003
 */
#include <iostream>
using namespace std;

int main() {

  int s, t;
  s = 1;
  while (s > 0) {
    cin >> t;
    if (t = 0)
      break;
    cout << "Case"
         << " " << s << ": " << t << endl;
    s = s + 1;
  }

  return 0;
}


Fixed submission:
/*
 * taete.cpp
 *
 *  Created on: 2018/04/26
 *      Author: J01003
 */
#include <iostream>
using namespace std;

int main() {

  int s, t;
  s = 1;
  while (s > 0) {
    cin >> t;
    if (t == 0)
      break;
    cout << "Case"
         << " " << s << ": " << t << endl;
    s = s + 1;
  }

  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <cstdio>
#include <iostream>

using namespace std;

int main(void) {
  int x;
  int i = 0;
  while ((scanf("%d", &x)) != 0) {
    i++;
    printf("Case %d: %d\n", i, x);
  }
  return 0;
}

Fixed submission:
#include <cstdio>
#include <iostream>

using namespace std;

int main(void) {
  int x;
  int i = 0;
  while (cin >> x) {
    if (x == 0)
      break;
    i++;
    printf("Case %d: %d\n", i, x);
  }
  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <cstdio>
int main() {
  for (int i = 1;; i++) {
    int x;
    scanf("%d", &x);
    printf("Case %d: %d\n", i, x);
  };
  return 0;
}


Fixed submission:
#include <cstdio>
int main() {
  for (int i = 1;; i++) {
    int x;
    scanf("%d", &x);
    if (x == 0) {
      break;
    }
    printf("Case %d: %d\n", i, x);
  };
  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <stdio.h>
int main() {
  int a, b, c, d, i = 0;
  while (1) {
    scanf("%d", &a);
    i++;
    printf("Case %d: %d\n", i, a);
  }
}


Fixed submission:
#include <stdio.h>
int main() {
  int a, b, c, d, i = 0;
  while (1) {
    scanf("%d", &a);
    i++;
    if (a == 0)
      break;
    printf("Case %d: %d\n", i, a);
  }
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int main() {

  int x, i;
  while (true) {
    i++;
    cin >> x;

    if (x = 0)
      break;

    cout << "Case " << i << ": " << x << "\n";
  }
}

Fixed submission:
#include <iostream>
using namespace std;

int main() {

  int x, i;
  while (true) {
    i++;
    cin >> x;

    if (x == 0)
      break;

    cout << "Case " << i << ": " << x << "\n";
  }
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  int x = 0;
  while (1) {
    cin >> a;
    x = x + 1;
    if (a > 0) {
      cout << "Case " << x << ": " << a << endl;
    }
  }
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  int x = 0;
  while (1) {
    cin >> a;
    x = x + 1;
    if (a > 0) {
      cout << "Case " << x << ": " << a << endl;
    }
    if (a == 0) {
      break;
    }
  }
}
Problem p02396 (C++)

Buggy submission (status: Runtime Error):
// Copyright 2015 KanatoNagayama
#include <iostream>
#include <vector>
using std ::cin;
using std ::cout;
using std ::endl;
using std ::vector;
int main() {
  vector<int> v(1);
  int i = 0;
  while (true) {
    cin >> v[i];
    if (v[i] == 0)
      break;
    i++;
  }
  for (int k = 0; k < i; k++) {
    cout << "Case " << k + 1 << ": " << v[k] << endl;
  }
  return 0;
}

Fixed submission:
// Copyright 2015 KanatoNagayama
#include <iostream>
#include <vector>
using std ::cin;
using std ::cout;
using std ::endl;
using std ::vector;
int main() {
  vector<int> v(10000);
  int i = 0;
  while (true) {
    cin >> v[i];
    if (v[i] == 0)
      break;
    i++;
  }
  for (int k = 0; k < i; k++) {
    cout << "Case " << k + 1 << ": " << v[k] << endl;
  }
  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <cstdio>
int main() {
  int x;
  int i = 1;
  while (1) {
    scanf("%d", &x);
    if (x = 0)
      break;
    printf("Case %d: %d\n", i, x);
    i++;
  }
  return 0;
}


Fixed submission:
#include <cstdio>
int main() {
  int x;
  int i = 1;
  while (1) {
    scanf("%d", &x);
    if (x == 0)
      break;
    printf("Case %d: %d\n", i, x);
    i++;
  }
  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
using namespace std;

int main() {
  int suuji;
  int i = 1;
  while (true) {
    cin >> suuji;
    if (suuji != 0) {
      cout << "Case " << i << ": " << suuji;
    }
    i++;
  }
  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
using namespace std;

int main() {
  int suuji;
  int i = 1;
  while (true) {
    cin >> suuji;
    if (suuji == 0)
      break;
    cout << "Case " << i << ": " << suuji << endl;
    i++;
  }
  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;

int main() {
  int x[100] = {1};
  int i = 0;
  for (i = 0; i < 100; i++) {
    x[i] = 1;
  }
  i = 1;
  while (x[i - 1] != 0) {
    cin >> x[i];
    i++;
  }
  i = 1;
  while (x[i] != 0) {
    cout << "Case " << i << ": " << x[i] << endl;
    i++;
  }
}

Fixed submission:
#include <iostream>
using namespace std;

int main() {
  int x[25565];
  x[0] = 1;
  int i = 1;
  while (x[i - 1] != 0) {
    cin >> x[i];
    i++;
  }
  i = 1;
  while (x[i] != 0) {
    cout << "Case " << i << ": " << x[i] << endl;
    i++;
  }
}
Problem p02396 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;

int main() {
  int x[1000];
  x[0] = 1;
  for (int i = 1; x[i - 1] != 0; i++) {
    cin >> x[i];
    cout << "Case " << i << ": " << x[i] << endl;
  }
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;

int main() {
  int x;
  for (int i = 1;; i++) {
    cin >> x;
    if (x == 0)
      break;
    cout << "Case " << i << ": " << x << endl;
  }
  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main() {
  int x, i = 1;
  cin >> x;
  while (true) {
    cout << "Case"
         << " " << i << ":"
         << " " << x << endl;
    i = i + 1;
    if (x == 0)
      break;
  }
}


Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int x, i = 1;
  cin >> x;
  while (true) {
    cout << "Case"
         << " " << i << ":"
         << " " << x << endl;
    i = i + 1;
    cin >> x;
    if (x == 0)
      break;
  }
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int main() {
  int buffer, i = 1;
  cin >> buffer;
  while (buffer != 0) {
    cout << "Case " << i << ": " << buffer << endl;
    i++;
  }
  return 0;
}


Fixed submission:
#include <iostream>
using namespace std;

int main() {
  int buffer, i = 1;
  cin >> buffer;
  while (buffer != 0) {
    cout << "Case " << i << ": " << buffer << endl;
    cin >> buffer;
    i++;
  }
  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int main(void) {
  int x, i = 0;

  while (1) {
    cin >> x;
    if (x != 0) {
      cout << "Case " << ++i << ": " << x << endl;
    }
  }
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;

int main(void) {
  int x, i = 0;

  while (1) {
    cin >> x;
    if (x != 0) {
      cout << "Case " << ++i << ": " << x << endl;
    } else {
      break;
    }
  }
  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>

using namespace std;

int main() {

  for (int i = 1;; i++) {
    int x;
    cin >> x;

    cout << "Case " << i << ": " << x << endl;
  }
}

Fixed submission:
#include <iostream>

using namespace std;

int main() {

  for (int i = 1;; i++) {
    int x;
    cin >> x;
    if (x == 0)
      break;

    cout << "Case " << i << ": " << x << endl;
  }
}
Problem p02396 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;

int main() {
  int x[10000];

  int n = 0;
  while (true) {
    if (n > 9999)
      return -1;

    cin >> x[n];

    if (x[n] == 0)
      break;

    ++n;
  }

  for (int i = 0; i < n; ++i) {
    cout << "Case " << i + 1 << ": " << x[i] << endl;
  }

  return 0;
}


Fixed submission:
#include <iostream>
using namespace std;

int main() {
  int x[10000];

  int n = 0;
  while (true) {
    // if (n>9999) return -1;

    cin >> x[n];

    if (x[n] == 0)
      break;

    ++n;
  }

  for (int i = 0; i < n; ++i) {
    cout << "Case " << i + 1 << ": " << x[i] << endl;
  }

  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main() {

  int x[1000], i = 0;
  do {
    cin >> x[i];
  } while (x[i++] != 0);

  int k = 0;
  while (k < i - 1) {
    cout << "Case " << k + 1 << ": " << x[k] << endl;
    k++;
  }
}

Fixed submission:
#include <iostream>
using namespace std;
int main() {

  int x[10000], i = 0;
  do {
    cin >> x[i];
  } while (x[i++] != 0);

  int k = 0;
  while (k < i - 1) {
    cout << "Case " << k + 1 << ": " << x[k] << endl;
    k++;
  }
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main() {
  int x, i = 1;
  while (1) {
    cin >> x;
    cout << "Case"
         << " " << i << ":"
         << " " << x << endl;
    i++;
  }
  return 0;
}


Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int x, i = 1;
  while (1) {
    cin >> x;
    if (x == 0) {
      break;
    }
    cout << "Case"
         << " " << i << ":"
         << " " << x << endl;
    i++;
  }
  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main() {
  for (int x, i = 1;; i++) {
    cin >> x;
    cout << "Case " << i << ": " << x << endl;
  }
  return 0;
}


Fixed submission:
#include <iostream>
using namespace std;
int main() {
  for (int x, i = 1;; i++) {
    cin >> x;
    if (x == 0)
      break;
    cout << "Case " << i << ": " << x << endl;
  }
  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
  int i, x;

  for (i = 1;; i++) {
    cin >> x;
    if (x = 0)
      break;
    cout << "Case " << i << ": " << x << endl;
  }

  return 0;
}

Fixed submission:
#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
  int i, x;

  for (i = 1;; i++) {
    cin >> x;
    if (x == 0)
      break;
    cout << "Case " << i << ": " << x << endl;
  }

  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int main() {
  int x, i = 1;
  for (cin >> x; x > 0; i = i + 1) {
    cout << "case " << i << ": " << x << endl;
  }
}


Fixed submission:
#include <iostream>
using namespace std;

int main() {
  int x, i = 1;
  cin >> x;
  while (x > 0) {
    cout << "Case " << i << ": " << x << endl;
    i++;
    cin >> x;
  }
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main() {
  for (int count = 1;; ++count) {
    int input;
    cin >> input;
    cout << "Case " << count << ":"
         << " " << input << endl;
  }
  return 0;
}


Fixed submission:
#include <iostream>
using namespace std;
int main() {
  for (int count = 1;; ++count) {
    int input;
    cin >> input;
    if (input == 0) {
      break;
    }
    cout << "Case " << count << ":"
         << " " << input << endl;
  }
  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main() {
  for (int i = 1;; ++i) {
    int x;
    cin >> x;
    cout << "Case " << i << ": " << x;
  }
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;
int main() {
  for (int i = 1;; ++i) {
    int x;
    cin >> x;
    if (x == 0)
      break;
    cout << "Case " << i << ": " << x << endl;
  }
  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <stdio.h>

int main() {
  int i = 1;
  int x;
  while (1) {
    if (scanf("%d", &x) == 0)
      break;
    printf("Case %d: %d\n", i, x);
    i++;
  }
}


Fixed submission:
#include <stdio.h>

int main() {
  int i = 1;
  int x;
  while (1) {
    scanf("%d", &x);
    if (x == 0)
      break;
    printf("Case %d: %d\n", i, x);
    i++;
  }
}
Problem p02396 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>
int main() {
  int num[10000], n;
  n = 0;
  while (1) {
    scanf("%d", &num[n]);
    if (num[n] == 0)
      break;
    n = n + 1;
  }
  while (num[n] != 0, n++) {
    printf("Case %d: %d\n", n, num[n]);
  }
  return 0;
}

Fixed submission:
#include <stdio.h>
int main() {
  int num[10000], n;
  n = 0;
  while (1) {
    scanf("%d", &num[n]);
    if (num[n] == 0)
      break;
    n = n + 1;
  }
  n = 0;
  while (num[n] != 0) {
    printf("Case %d: %d\n", n + 1, num[n]);
    n = n + 1;
  }
  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int main() {
  int x;
  int count = 1;
  cin >> x;
  while (x != 0) {
    cout << "Case " << count << ":" << x << endl;
    count++;
  }
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;

int main() {
  int x;
  int count = 1;
  cin >> x;
  while (x != 0) {
    cout << "Case " << count << ": " << x << endl;
    cin >> x;
    count++;
  }
  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
  vector<int> x(1000);
  int i = 0;
  while (1) {
    int flag = 1;
    cin >> x[i];
    if (x[i] == 0) {
      break;
    }
    i++;
  }
  for (int t = 0; t < i; t++) {
    cout << "Case " << t + 1 << ": " << x[t] << endl;
  }
  return 0;
}


Fixed submission:
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
  vector<int> x(10000);
  int i = 0;
  while (1) {
    int flag = 1;
    cin >> x[i];
    if (x[i] == 0) {
      break;
    }
    i++;
  }
  for (int t = 0; t < i; t++) {
    cout << "Case " << t + 1 << ": " << x[t] << endl;
  }
  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>
int main() {
  int a[100], aa = 0, i;
  for (i = 0; aa < 1; i++) {
    scanf("%d", &a[i]);
    if (a[i] == 0) {
      aa = 2;
    }
  }
  for (int j = 1; j < i; j++) {
    printf("Case %d: %d\n", j, a[j - 1]);
  }
  return 0;
}

Fixed submission:
#include <stdio.h>
int main() {
  int a[1000000], aa = 0, i;
  for (i = 0; aa < 1; i++) {
    scanf("%d", &a[i]);
    if (a[i] == 0) {
      aa = 2;
    }
  }
  for (int j = 1; j < i; j++) {
    printf("Case %d: %d\n", j, a[j - 1]);
  }
  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>

using namespace std;

int main() {
  int x;
  cin >> x;
  int i = 1;
  while (x != 0) {
    cout << "Case " << i << ": " << x << endl;
    i++;
  }
  return 0;
}


Fixed submission:
#include <iostream>

using namespace std;

int main() {
  int x;
  cin >> x;
  int i = 1;
  while (x != 0) {
    cout << "Case " << i << ": " << x << endl;
    cin >> x;
    i++;
  }
  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int main() {

  int a = 1, b;

  while (true) {

    cin >> b;

    if (b = 0)
      break;

    cout << "Case " << a << ": " << b << endl;

    a++;
  }

  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;

int main() {

  int a = 1, b;

  while (true) {

    cin >> b;

    if (b == 0)
      break;

    cout << "Case " << a << ": " << b << endl;

    a++;
  }

  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int main() {
  int x, i = 1;
  cin >> x;
  while (x != 0) {
    cout << "Case" << i << ":" << x << "\n";
    i++;
  }
  return 0;
}


Fixed submission:
#include <iostream>
using namespace std;

int main() {
  int n;
  for (int i = 1; i >= 0; i++) {
    cin >> n;
    if (n == 0)
      break;
    cout << "Case " << i << ": " << n << "\n";
  }
  return 0;
}
Problem p02396 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

signed main() {
  int a;
  for (int b = 1; scanf("%d", &a); b++) {
    printf("Case %d: %d\n", b, a);
  }
}

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

signed main() {
  int a;
  for (int b = 1; scanf("%d", &a), a; b++) {
    printf("Case %d: %d\n", b, a);
  }
}
Problem p02396 (C++)

Buggy submission (status: Runtime Error):
// Copyright 2015 KanatoNagayama
#include <iostream>
#include <vector>
using std ::cin;
using std ::cout;
using std ::endl;
using std ::vector;
int main() {
  vector<int> v(5000);
  int i = 0;
  while (true) {
    cin >> v[i];
    if (v[i] == 0)
      break;
    i++;
  }
  for (int k = 0; k < i; k++) {
    cout << "Case " << k + 1 << ": " << v[k] << endl;
  }
  return 0;
}

Fixed submission:
// Copyright 2015 KanatoNagayama
#include <iostream>
#include <vector>
using std ::cin;
using std ::cout;
using std ::endl;
using std ::vector;
int main() {
  vector<int> v(100000);
  int i = 0;
  while (true) {
    cin >> v[i];
    if (v[i] == 0)
      break;
    i++;
  }
  for (int k = 0; k < i; k++) {
    cout << "Case " << k + 1 << ": " << v[k] << endl;
  }
  return 0;
}
Problem p02397 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
#include <math.h>
#include <sstream>
using namespace std;
int main() {
  while (1) {
    int i, j;
    cin >> i >> j;
    if (i <= j) {
      cout << i << " " << j << endl;
    } else {
      cout << j << " " << i << endl;
    }
  }
  return 0;
}


Fixed submission:
#include <algorithm>
#include <iostream>
#include <math.h>
#include <sstream>
using namespace std;
int main() {
  while (1) {
    int i, j;
    cin >> i >> j;
    if (i == 0 && j == 0) {
      break;
    } else if (i <= j) {
      cout << i << " " << j << endl;
    } else {
      cout << j << " " << i << endl;
    }
  }
  return 0;
}
Problem p02397 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int main(void) {
  int x, y, t;
  while (1) {
    cin >> x >> y;
    if (x > y) {
      t = x;
      x = y;
      y = t;
    }
    cout << x << " " << y << endl;
  }
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;

int main(void) {
  int x, y, t;
  while (1) {
    cin >> x >> y;
    if (x == 0 && y == 0) {
      break;
    } else if (x > y) {
      t = x;
      x = y;
      y = t;
    }
    cout << x << " " << y << endl;
  }
  return 0;
}
Problem p02397 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main() {
  int x;
  int y;
  int i = 0;

  while (i >= 0) {
    cin >> x >> y;
    if (x <= y) {
      cout << x << " " << y << endl;
    } else {
      cout << y << " " << x << endl;
    }

    i++;
  }
}


Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int x;
  int y;
  int i = 0;

  while (i >= 0) {
    cin >> x >> y;
    if ((x == 0) && (y == 0))
      break;
    if (x <= y) {
      cout << x << " " << y << endl;
    } else {
      cout << y << " " << x << endl;
    }

    i++;
  }
}
Problem p02397 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main() {
  int x, y;
  while (1) {
    cin >> x >> y;
    if (x = 0, y = 0) {
      break;
    } else if (x <= y) {
      cout << x << " " << y << endl;
    } else if (x > y) {
      cout << y << " " << x << endl;
    }
  }
  return 0;
}


Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int x, y;
  while (1) {
    cin >> x >> y;
    if (x == 0 && y == 0) {
      break;
    } else if (x <= y) {
      cout << x << " " << y << endl;
    } else if (x > y) {
      cout << y << " " << x << endl;
    }
  }
  return 0;
}