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

#include <bits/stdc++.h>

int main() {

  int a, b;
  scanf("%d %d", &a, &b);

  printf("a %s b\\n", (a < b) ? "<" : (a == b) ? "==" : ">");
}


Error: -11

Fixed submission:

#include <bits/stdc++.h>

int main() {

  int a, b;
  scanf("%d %d", &a, &b);

  printf("a %s b\\n", a, (a < b) ? "<" : (a == b) ? "==" : ">", b);
}
Problem p02391 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int main() {

  int a, b;

  cin >> a >> b;

  if (a > b)
    cout << "a > b" << endl;
  else if (a < b)
    cout << "a < b" << endl;
  else
    cout << "a == b" << endl;

  return 0;
}

Error: 1

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  if (a > b)
    cout << "a>b";
  else if (a == b)
    cout << "a=b";
  else
    cout << "a<b";
  return 1;
}
Problem p02391 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>

main() {
  int a, b;
  scanf("%d %d\\n", &a, &b);

  if (a < b)
    printf("a < b\\n");
  else if (a > b)
    printf("a > b\\n");
  else
    printf("a == b\\n");
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int a, b, i = 0;
  while (i < 4) {
    cin >> a >> b;

    if (a > b)
      cout << "a>b" << endl;
    if (a < b)
      cout << "a<b" << endl;
    if (a == b)
      cout << "a=b" << endl;
  }
  return 0;
}
Problem p02391 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>
int main() {
  int a, b;
  scanf("%d %d", &a, &b);
  if (a > b) {
    printf("a > b\\n");
  } else if (a == b) {
    printf("a == b\\n");
  } else {
    printf("a < b\\n");
  }
  return 0;
}

Error: -11

Fixed submission:

#include <stdio.h>
int main() {
  int a, b;

  scanf("%d %d", &a, b);

  if (a > b) {
    printf("a>b\\n");
  } else if (a == b) {
    printf("a==b\\n");
  } else {
    printf("a<b\\n");
  }
  return 0;
}
Problem p02391 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  if (a < b) {
    cout << "a < b" << endl;
  } else if (a > b) {
    cout << "a > b" << endl;
  } else if (a == b) {
    cout << "a == b" << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int a, b;
  for (;;) {
    cin >> a >> b;
    if (a < b) {
      cout << "a < b" << endl;
    } else if (a > b) {
      cout << "a > b" << endl;
    } else if (a == b) {
      cout << "a == b" << endl;
    }
  }
  return 0;
}
Problem p02391 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>
int main(void) {
  int a, b;
  scanf("%d %d", &a, &b);
  if (a >= -1000 && a <= 1000 && b >= -1000 && b <= 1000) {
    if (a > b) {
      printf("a > b\\n");
    } else if (a < b) {
      printf("a < b\\n");
    } else {
      printf("a == b\\n");
    }
  }
  return 0;
}

Error: -11

Fixed submission:

#include <stdio.h>
int main(void) {
  int a, b;
  scanf("%d %d", a, b);
  if (a > b) {
    printf("a>b\\n");
  } else if (a < b) {
    printf("a<b\\n");
  } else {
    printf("a==b\\n");
  }
  return 0;
}
Problem p02391 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main(void) {
  int a, b;
  cin >> a >> b;
  if (a < b) {
    cout << "a < b" << endl;
  } else if (a == b) {
    cout << "a == b" << endl;
  } else {
    cout << "a > b" << endl;
  }
  return 0;
}


Error: 1

Fixed submission:

#include <iostream>
using namespace std;
int main(void) {
  int a;
  int b;
  cin >> a >> b;
  if (a >= -1000) {
    if (b >= 1000) {
      if (a > b) {
        cout << "a < b" << endl;
      } else if (a == b) {
        cout << "a == b" << endl;
      } else if (a < b) {
        cout << "a > b" << endl;
      }
    } else {
      return 1;
    }
  } else {
    return 1;
  }
  return 0;
}
Problem p02391 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>

int main() {
  int a, b;

  scanf("%d", &a);
  scanf("%d", &b);
  if (a < b)
    printf("a < b\\n");
  if (a > b)
    printf("a > b\\n");
  if (a == b)
    printf("a == b\\n");
  return 0;
}

Error: -11

Fixed submission:

#include <stdio.h>

int main() {
  int a, b;

  scanf("%d", &a);
  scanf("%d", b);
  if (a < b)
    printf("a < b\\n");
  if (a > b)
    printf("a > b\\n");
  if (a == b)
    printf("a == b\\n");
  return 0;
}
Problem p02391 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>
int main() {
  int a, b;
  scanf("%d %d", &a, &b);
  if ("%d %d", a < b)
    printf("a < b\\n");
  else if ("%d %d", a > b)
    printf("a > b\\n");
  else if ("%d %d", a == b)
    printf("a == b\\n");

  return 0;
}

Error: -11

Fixed submission:

#include <stdio.h>
int main() {
  int a, b;
  scanf("%d %d", &a, b);
  if ("%d %d", a < b)
    printf("a < b\\n");
  else if ("%d %d", a > b)
    printf("a > b\\n");
  else if ("%d %d", a == b)
    printf("a == b");
}
Problem p02391 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>

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

Error: -11

Fixed submission:

#include <stdio.h>

int main(void) {
  int a, b;
  scanf("%d %d", a, b);
  if (a < b) {
    printf("a < b\\n");
  } else {
    if (a > b) {
      printf("a > b\\n");
    } else {
      if (a == b) {
        printf("a == b\\n");
      }
    }
  }
  return 0;
}
Problem p02391 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  if (a < b) {
    cout << "a < b" << endl;
  } else if (a > b) {
    cout << "a > b" << endl;
  } else {
    cout << "a == b" << endl;
  }
}

Error: -11

Fixed submission:

#include <cstdio>
using namespace std;

int main() {
  int a, b;
  scanf("%d %d", a, b);
  char c;
  if (a < b) {
    c = '<';
  } else if (a > b) {
    c = '>';
  } else {
    c = '=';
  }
  printf("a %c b\\n", c);
}
Problem p02394 (C++) — buggy submission, verdict: 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 && y >= r && w >= x + r && h >= y + r) {
    printf("Yes\\n");
  } else {
    printf("No\\n");
  }
  return 0;
}

Error: -11

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 && y >= r && w >= x + r && h >= y + r) {
    printf("Yes\\n");
  } else {
    printf("No\\n");
  }

  return 0; /*0?????????*/
}
Problem p02394 (C++) — buggy submission, verdict: 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];
  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;
}

Error: 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];
  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, verdict: 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;
}

Error: -11

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, verdict: 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 <= 0 || y <= 0 || x + r > W || r + y > H) {
    printf("No\\n");
  } else {
    printf("Yes\\n");
  }
}

Error: -11

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 <= 0 || y <= 0 || x + r > W || x + y > H) {
    printf("NO\\n");
  } else {
    printf("YES\\n");
  }
}
Problem p02394 (C++) — buggy submission, verdict: 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");
  }
}

Error: -11

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, verdict: 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;
}

Error: 0
sh: 1: pause: not found


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, verdict: Runtime Error

#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;
}


Error: 255

Fixed submission:

#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;
}
Problem p02394 (C++) — buggy submission, verdict: Time Limit Exceeded

#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <math.h>
#include <stdio.h>

using namespace std;

#define FOR(i, init, n) for (int i = init; i < n; i++)
#define REP(i, n) FOR(i, 0, n)

int main() {
  // FILE* fin = freopen("input.txt", "r", stdin);
  // FILE* fout = freopen("output.txt", "w", stdout);
  while (1) {
    int w, h, x, y, r;
    int cleft, cright, ctop, cbottom;
    scanf("%d %d %d %d %d", &w, &h, &x, &y, &r);
    if (x < -100 || x > 100) {
      break;
    } else if (y < -100 || y > 100) {
      break;
    } else if (w <= 0 || w > 100) {
      break;
    } else if (h <= 0 || h > 100) {
      break;
    } else if (r <= 0 || r > 100) {
      break;
    }

    cleft = x - r;
    cright = x + r;
    ctop = y + r;
    cbottom = y - r;
    if (cleft < 0 || cright > w || ctop > h || cbottom < 0) {
      printf("No\\n");
      break;
    } else {
      printf("Yes\\n");
      break;
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <math.h>
#include <stdio.h>

using namespace std;

#define FOR(i, init, n) for (int i = init; i < n; i++)
#define REP(i, n) FOR(i, 0, n)

int main() {
  // FILE* fin = freopen("input.txt", "r", stdin);
  // FILE* fout = freopen("output.txt", "w", stdout);
  while (1) {
    int w, h, x, y, r;
    int cleft, cright, ctop, cbottom;
    scanf("%d %d %d %d %d", &w, &h, &x, &y, &r);
    if (x < -100 || x > 100) {
      break;
    } else if (y < -100 || y > 100) {
      break;
    } else if (w <= 0 || w > 100) {
      break;
    } else if (h <= 0 || h > 100) {
      break;
    } else if (r <= 0 || r > 100) {
      break;
    }

    cleft = x - r;
    cright = x + r;
    ctop = y + r;
    cbottom = y - r;
    if (cleft < 0 || cright > w || ctop > h || cbottom < 0) {
      printf("No\\n");
    } else {
      printf("Yes\\n");
    }
  }
  return 0;
}
Problem p02394 (C++) — buggy submission, verdict: 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");
  }
}


Error: -11

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 p02394 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <stdlib.h>
#define J -1
using namespace std;

int main() {
  int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;

  if (x - r < 0 || y - r < 0 || x + r > W || y + r > H)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
  return 0;
}

Error: 0

Fixed submission:

#include <iostream>
#include <stdlib.h>
#define J -1
using namespace std;

int main() {
  int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;
  int A[W][H];
  for (int i = 0; i < W; i++) {
    for (int j = 0; j < H; j++) {
      if (i == 0 || j == 0 || i == W - 1 || j == H - 1)
        A[i][j] = J;
      else
        A[i][j] = 1;
    }
  }
  if (x > W || y > H) {
    cout << "No" << endl;
    exit(1);
  }
  if (A[x][y] == J) {
    cout << "No" << endl;
    exit(2);
  }
  if (x - r > 0 && y - r > 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
Problem p02394 (C++) — buggy submission, verdict: 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;
}

Error: -11

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, verdict: Runtime Error

#include <iostream>

using namespace std;

int main() {
  int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;
  if (x < r || x > W - r || y < r || y > H - r)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
}

Error: -11

Fixed submission:

/*
 * main.c
 *
 *  Created on: 2016/12/23
 *      Author: stoneriver
 */

#include <stdio.h>

int main() {
  int W, H, x, y, r;
  scanf("%d %d %d %d %d", W, H, x, y, r);
  if ((x - r >= 0) && (y - r >= 0) && (x + r <= W) && (y + r <= H)) {
    printf("Yes\\n");
  } else {
    printf("No\\n");
  }
  return 0;
}
Problem p02394 (C++) — buggy submission, verdict: 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;
}


Error: TLE

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;

  string hoge;
  while (hoge != "finir") {
    cin >> hoge;
  }
}
Problem p02397 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

using namespace std;

bool data_end(int x, int y);
void print_asc(int x, int y);
int main() {
  int x, y;

  while (cin >> x >> y && !data_end(x, y)) {
    print_asc(x, y);
  }
  return 0;
}
bool data_end(int x, int y) {
  if (x == 0 && y == 0)
    return true;
  return false;
}
void print_asc(int x, int y) {
  if (x <= y)
    cout << x << ' ' << y << '\\n';
  else
    cout << y << ' ' << x << '\\n';
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

bool data_end(int x, int y);
void print_asc(int x, int y);

int main() {
  int x, y;

  while (cin >> x >> y || data_end(x, y)) {
    print_asc(x, y);
  }
  return 0;
}
bool data_end(int x, int y) {
  if (x == 0 && y == 0)
    return true;
  return false;
}
void print_asc(int x, int y) {
  if (x >= y)
    cout << x << ' ' << y << '\\n';
  else
    cout << y << ' ' << x << '\\n';
}
Problem p02397 (C++) — buggy submission, verdict: Time Limit Exceeded

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

void mini(int x, int y) { cout << min(x, y) << " " << max(x, y) << endl; }

int main() {
  int x, y;

  while (1) {
    cin >> x >> y;
    if (x == 0 && y == 0)
      break;
    mini(x, y);
  }
}

Error: TLE

Fixed submission:

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

void mini(int x, int y) { cout << min(x, y) << " " << max(x, y) << endl; }

int main() {
  int x, y;

  cin >> x >> y;
  while (1) {
    if (x == 0 && y == 0)
      break;
    mini(x, y);
  }
}
Problem p02397 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>
int main() {
  for (int i = 0;; i++) {
    int a, b, r;
    scanf("%d %d", &a, &b);
    if ((a == 0) && (b == 0))
      break;
    if (a > b) {
      r = a;
      a = b;
      b = r;
    }
    printf("%d %d\\n", a, b);
  }
}


Error: TLE

Fixed submission:

#include <stdio.h>
int main() {
  for (int i = 0;; i++) {
    int a, b, r;
    scanf("%d %d", &a, &b);
    if (a > b) {
      r = a;
      a = b;
      b = r;
    }
    printf("%d %d\\n", a, b);
  }
}
Problem p02397 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

using namespace std;

int main() {
  int in1, in2;

  cin >> in1 >> in2;

  while ((in1 != 0) || (in2 != 0)) {
    if (in1 < in2)
      cout << in1 << ' ' << in2 << endl;
    else
      cout << in2 << ' ' << in1 << endl;
    cin >> in1 >> in2;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

int main() {
  int in1, in2;

  cin >> in1 >> in2;

  while ((in1 != 0) || (in2 != 0)) {
    if (in1 < in2)
      cout << in1 << ' ' << in2 << endl;
    else
      cout << in2 << ' ' << in1 << endl;
    cin >> in1, in2;
  }
  return 0;
}
Problem p02397 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
int main() {
  int x, y;
  for (int i = 0;; i++) {
    cin >> x >> y;
    if (x == 0 && y == 0)
      break;
    if (x < y)
      cout << x << " " << y << endl;
    else
      cout << y << " " << x << endl;
  }
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int x, y;
  for (int i = 1;; i++) {
    cin >> x >> y;
    if (x < y)
      cout << x << " " << y << endl;
    else
      cout << y << " " << x << endl;
  }
}
Problem p02397 (C++) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int x, y;
  for (;;) {
    cin >> x >> y;
    if (x > y) {
      cout << y << " " << x << endl;
    } else if (x <= y) {
      cout << x << " " << y << endl;
    }
  }
}
Problem p02397 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>

int main(void) {
  int x, y;

  while (1) {
    scanf("%d%d", &x, &y);

    if (x == 0 && y == 0)
      break;

    if (x <= y)
      printf("%d %d\\n", x, y);
    else
      printf("%d %d\\n", y, x);
  }

  return (0);
}

Error: TLE

Fixed submission:

#include <stdio.h>

int main(void) {
  int x, y;

  do {
    scanf("%d%d", &x, &y);
    if (x >> y)
      printf("%d %d\\n", x, y);
    else if (x <= y)
      printf("%d %d\\n", y, x);
    else if (x == 0 && y == 0)
      break;
  } while (1);

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

#include <iostream>

int main(int argc, char const *argv[]) {
  int x, y;
  int flag = 1;

  while (flag) {
    std::cin >> x >> y;
    if (x == 0 && y == 0)
      flag = 0;
    else {
      if (x > y)
        std::cout << y << " " << x << std::endl;
      else if (x <= y)
        std::cout << x << " " << y << std::endl;
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>

int main(int argc, char const *argv[]) {
  int x, y;
  int flag = 1;
  while (flag) {
    std::cin >> x >> y;
    if (x > y)
      std::cout << y << " " << x << std::endl;
    else if (x <= y)
      std::cout << x << " " << y << std::endl;
    else if (x == 0 && y == 0)
      flag = 0;
  }
  return 0;
}
Problem p02397 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;

int main(void) {

  string input;
  int num[2];
  int counter = 0;
  istringstream stream(input);

  while (getline(cin, input)) {
    stream.str("");
    stream.clear(stringstream::goodbit);
    stream.str(input);
    stream >> num[0] >> num[1];
    if (num[0] == 0 && num[1] == 0)
      break;
    else if (num[0] <= num[1])
      cout << num[0] << " " << num[1] << "\\n";
    else
      cout << num[1] << " " << num[0] << "\\n";
  }
}

Error: 1

Fixed submission:

#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
using namespace std;

int main(void) {

  string input;
  int num[2];
  int counter = 0;
  istringstream stream(input);

  while (getline(cin, input)) {
    stream.str("");
    stream.clear(stringstream::goodbit);
    stream.str(input);
    stream >> num[0] >> num[1];
    if (num[0] == 0 && num[1] == 0)
      break;
    else if (num[0] <= num[1])
      cout << num[0] << " " << num[1] << "\\n";
    else
      cout << num[1] << " " << num[0] << "\\n";
  }

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

#include <stdio.h>
int main(void) {
  int x, y, z, i, j;
  while (1) {
    scanf("%d %d", &x, &y);
    if (x == 0 && y == 0)
      break;

    if (x >= y) {
      printf("%d %d\\n", y, x);
    } else {
      printf("%d %d\\n", x, y);
    }
  }

  return 0;
}


Error: TLE

Fixed submission:

#include <stdio.h>
int main(void) {
  int x, y, z, i, j;
  while (1) {
    scanf("%d %d", &x, &y);
    if (x == 0 && y == 0)
      ;

    printf("%d %d\\n", y, x);
  }
  return 0;
}