alexjercan/bugnet huggingface dataset:
Problem p02397 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

using namespace std;

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

Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

int main() {
  for (int x, y, t = 1, s;; t++) {
    cin >> x, y;
    if (x == 0 && y == 0)
      break;
    if (x > y) {
      s = y, y = x, x = s;
    }
    cout << x << " " << y << endl;
  }
  return 0;
}
Problem p02397 (C++) — buggy submission, verdict: Runtime Error

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

  return 0;
}

Error: -11

Fixed submission:

#include <cstdio>

int main() {
  int x, y;
  while (1) {
    scanf("%d %d", x, y);
    if ((x == 0) && (y == 0))
      break;
    if (x <= y) {
      printf("%d %d", x, y);
    }
    if (x > y) {
      printf("%d %d", y, x);
    }
  }
  return 0;
}
Problem p02397 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>

int main(void) {
  int x[3000], y[3000], i = 0, temp;
  do {
    scanf("%d %d", &x[i], &y[i]);
    if (x[i] > y[i]) {
      temp = x[i];
      x[i] = y[i];
      y[i] = temp;
    }
    i++;
  } while (x[i - 1] != 0 || y[i - 1] != 0);

  i = 0;

  while (x[i] != 0 || y[i] != 0) {
    printf("%d %d\\n", x[i], y[i]);
    i++;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <stdio.h>

int main(void) {
  int x[3000], y[3000], i = 0, temp;
  do {
    scanf("%d %d", &x[i], &y[i]);
    if (x[i] > y[i]) {
      temp = x[i];
      x[i] = y[i];
      y[i] = temp;
    }
    ++i;
  } while (x[i - 1] != 0 || y[i - 1] != 0);

  i = 0;

  while (x[i] != 0 || y[i] != 0)
    ;
  {
    printf("%d %d\\n", x[i], y[i]);
    ++i;
  }

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

#include <iostream>
using namespace std;

int main(void) {

  int x, y, temp;
  int testX[3000];
  int testY[3000];

  for (int i = 1; i < 3000; i++) {

    cin >> x >> y;
    testX[i] = x;
    testY[i] = y;

    if (testX[i] > testY[i]) {

      temp = testX[i];
      testX[i] = testY[i];
      testY[i] = temp;
    }
    if (testX[i] == 0 && testY[i] == 0)
      break;

    cout << testX[i] << " " << testY[i] << endl;
  }
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main(void) {

  int x, y, temp;
  int testX[3000];
  int testY[3000];

  for (int i = 1; i <= 3000; i++) {

    cin >> x >> y;
    testX[i] = x;
    testY[i] = y;

    if (testX[i] > testY[i]) {

      temp = testX[i];
      testX[i] = testY[i];
      testY[i] = temp;
    }

    cout << testX[i] << " : " << testY[i] << endl;
  }
}
Problem p02397 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

int main() {
  int x, y;
  while (std::cin >> x >> y, x || y) {
    if (x <= y) {
      std::cout << x << " " << y << '\\n';
    } else {
      std::cout << y << " " << x << '\\n';
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  int x, y;
  pair<int, int> dataset;
  vector<pair<int, int>> datasets;
  while (cin >> x >> y, x || y) {
    if (x <= y) {
      dataset.first = x;
      dataset.second = y;
    } else {
      dataset.first = y;
      dataset.second = x;
    }
    datasets.push_back(dataset);
  }
  for (pair<int, int> dataset : datasets) {
    cout << dataset.first << " " << dataset.second << '\\n';
  }
  return 0;
}
Problem p02397 (C++) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  while (true) {
  }
  return 0;
}
Problem p02397 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int x, y;

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

    if (x <= y) {
      cout << x << " " << y << "\\n";
    } else {
      cout << y << " " << x << "\\n";
    }
  }
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int x, y;
  cin >> x >> y;
  while (1) {

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

    if (x < y) {
      cout << x << " " << y << "\\n";
    } else {
      cout << y << " " << x << "\\n";
    }
  }
}
Problem p02397 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

using namespace std;

int main() {
  int a, b;

  cin >> a >> b;
  while (a != 0 || b != 0) {
    if (b < a) {
      int tmp = a;
      a = b;
      b = tmp;
    }
    cout << a << ' ' << b << endl;
    cin >> a >> b;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  while (a != 0 || b != 0) {
    if (b < a) {
      int tmp = a;
      a = b;
      b = tmp;
    }
    cout << a << ' ' << b;
  }
  return 0;
}
Problem p02397 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>

int main() {
  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);
    if (y < x)
      printf("%d %d\\n", y, x);
    if (x == y)
      printf("%d %d\\n", x, y);
  }

  return 0;
}

Error: -11

Fixed submission:

#include <stdio.h>

int main() {
  int a, b;

  while (1) {
    {
      scanf("%d%d\\n", a, b);

      if (a < b)
        printf("%d%d\\n", a, b);
      if (b < a)
        printf("%d%d\\n", b, a);
      if (a == b)
        printf("%d%d\\n", a, b);
    }
    if (a == 0 && b == 0)
      break;
  }
  return 0;
}
Problem p02397 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

using namespace std;

int main() {
  int a, b, a_nums[3000], b_nums[3000];
  for (int i = 0; i < 10000; i++) {
    cin >> a >> b;
    if (a == 0 && b == 0) {
      break;
    }
    if (a > b) {
      cout << b << " " << a << endl;
    }
    if (b >= a) {
      cout << a << " " << b << endl;
    }
  }
}


Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

int main() {
  int x, y;
  for (int i = 0; i < 300000; i = i + 1) {
    cin >> x;
    cin >> y;
    if (x < y && x != 0 && y != 0) {
      cout << x << " " << y << endl;
    }
    if (x > y && x != 0 && y != 0) {
      cout << y << " " << x << endl;
    } else {

      i = 300;
    }
  }
}
Problem p02397 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cstdio>

int main() {
  // 入力
  int x, y;

  for (int i = 0; i < 3000; i++) {
    scanf("%d %d", &x, &y);
    if (x == 0 && y == 0)
      break;

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

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

    printf("\\n");
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <cstdio>

int main() {
  // 入力
  int x, y;

  std::scanf("%d %d", &x, &y);

  for (int x = 0; 0 <= x; x++) {
    for (int y = 0; y <= 10000; y++) {

      if (x < y)
        std::printf("%d %d", x, y);

      else if (y < x)
        std::printf("%d %d", y, x);

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

      std::printf("\\n");
    }
  }
  return 0;
}
Problem p02397 (C++) — buggy submission, verdict: Time Limit Exceeded

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

using namespace std;

int main() {
  int x = -1, y = -1, tmp;
  while (1) {
    cin >> x;
    cin >> y;
    if (x == 0 && y == 0) {
      break;
    }
    if (x <= y) {
      tmp = y;
      y = x;
      x = tmp;
    }
    cout << y << " " << x << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

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

using namespace std;

int main() {
  int x = -1, y = -1;
  while (x != 0 || y != 0) {
    cin >> x;
    cin >> y;
    cout << y << " " << x << endl;
  }

  while (1) {
  }

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

#include <iostream>
using namespace std;
int main() {
  int x, y;
  int i = 1;

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

  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int x, y;

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

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

#include <iostream>
using namespace std;

int main() {
  int x, y;

  while (1) {

    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;
  cin >> x >> y;

  while (1) {

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

    if (x < y) {
      cout << x << ' ' << y;
    }

    else {
      cout << y << ' ' << x;
    }
  }
}
Problem p02397 (C++) — buggy submission, verdict: Time Limit Exceeded

#define _GRIBCXX_DEBUG
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <string>
#include <utility>
#include <vector>
using namespace std;

// ?????¬???????????¬??????
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define FOR(i, c)                                                              \\
  for (__typeof((c).begin()) != (c).begin(); i != (c).end(); ++i)
#define ALL(c) (c).begin(), c.end()

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<double> vd;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<long, long> pil;

// ??°?????????????????¬??????
typedef int Weight;

struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) : src(src), dst(dst), weight(weight) {}
};

bool operator<(const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight
         : e.src != f.src     ? e.src < f.src
                              : e.dst < f.dst;
}

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;

int main() {
  int a, b;
  while (true) {
    scanf("%d %d", &a, &b);
    if (a == 0 && b == 0)
      break;
    else
      printf("%d %d\\n", min(a, b), max(a, b));
  }
  return 0;
}

Error: TLE

Fixed submission:

#define _GRIBCXX_DEBUG
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <string>
#include <utility>
#include <vector>
using namespace std;

// ?????¬???????????¬??????
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define FOR(i, c)                                                              \\
  for (__typeof((c).begin()) != (c).begin(); i != (c).end(); ++i)
#define ALL(c) (c).begin(), c.end()

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<double> vd;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<long, long> pil;

// ??°?????????????????¬??????
typedef int Weight;

struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) : src(src), dst(dst), weight(weight) {}
};

bool operator<(const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight
         : e.src != f.src     ? e.src < f.src
                              : e.dst < f.dst;
}

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;

int main() {
  int a, b;
  while (scanf("%d %d", &a, &b)) {
    printf("%d %d\\n", min(a, b), max(a, b));
  }
  return 0;
}
Problem p02397 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int x, y;

  for (cin >> x >> y; x | y; cin >> x >> y) {
    if (x < y)
      cout << x << " " << y << endl;
    else
      cout << y << " " << x << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int x, y;

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

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

#include <iostream>
using namespace std;
int main() {
  int x, y;

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

    if (y < x) {
      cout << y << " " << x << endl;

    } else {
      cout << x << " " << y << endl;
    }
  }

  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int x, y;
  cin >> x >> y;

  int i = 1;
  while (1) {
    if (x == 0 && y == 0)
      break;

    if (y < x) {
      x = y;
      y = x;
    }
    cout << x << " " << endl;

    i++;
  }
  return 0;
}
Problem p02397 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>

int main() {
  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: WA

Fixed submission:

#include <stdio.h>

int main() {
  int a = 1, b = 1, i = 0, j = 0;
  int x[10], y[10];
  while (a != 0 || b != 0) {
    scanf("%d %d", &a, &b);
    x[i] = a;
    y[i] = b;
    i++;
  }

  printf("\\n");

  for (j = 0; j < i; j++) {
    if (x[j] > y[j])
      printf("%d %d\\n", y[j], x[j]);
    else
      printf("%d %d\\n", x[j], y[j]);
  }

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

#include <algorithm>
#include <iostream>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

int main() {
  while (true) {
    int x, y;
    cin >> x;
    cin >> y;

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

    int small, large;

    if (x < y) {
      small = x;
      large = y;

    } else {
      small = y;
      large = x;
    }

    cout << small << " " << large << endl;
  }
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <iostream>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

int main() {
  while (true) {
    int x, y;
    cin >> x;
    cin >> y;

    int small, large;

    if (x < y) {
      small = x;
      large = y;

    } else {
      small = y;
      large = x;
    }

    cout << small << " " << large << endl;
  }
}
Problem p02397 (C++) — buggy submission, verdict: Time Limit Exceeded

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


Error: TLE

Fixed submission:

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

#include <cstdio>

int main() {
  for (;;) {
    int x, y;
    scanf("%d %d", &x, &y);
    if (x == 0 && y == 0) {
      break;
    } else if (x <= y) {
      printf("%d %d\\n", x, y);
    } else if (x >= y) {
      printf("%d %d\\n", y, x);
    }
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <cstdio>

int main() {
  for (;;) {
    int x, y;
    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;
    }
  }
  return 0;
}
Problem p02397 (C++) — buggy submission, verdict: 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
      cout << y << " " << x << endl;
  }
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main(void) {
  int i = 0;
  int x[4000], y[4000];

  while (1) {
    cin >> x[i] >> y[i];
    if (x == 0 && y == 0)
      break;
    else
      ++i;
  }
  for (int n = 0; n <= i; ++n) {
    if (x[n] <= y[n])
      cout << x[n] << " " << y[n];
    else
      cout << y[n] << " " << x[n];
  }
}
Problem p02397 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {

  while (true) {

    int x, y;
    cin >> x >> y;

    if (x == 0 && y == 0)
      break;
    else if (x <= y)
      cout << x << " " << y << endl;
    else
      cout << y << " " << x << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int x, y;
  cin >> x >> y;

  while (true) {
    if (x == 0 && y == 0)
      break;
    else if (x >= y) {
      cout << y << " " << x << endl;
    } else
      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;
    } else if (x < y) {
      printf("%d %d\\n", x, y);
    } else {
      printf("%d %d\\n", y, x);
    }
  }
}

Error: TLE

Fixed submission:

#include <stdio.h>

int main(void) {
  int i, j;
  while (1) {
    scanf("%d %d", &i, &j);
    if (i <= j) {
      printf("%d %d\\n", i, j);
    } else {
      printf("%d %d\\n", j, i);
    }
  }
  return 0;
}
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 > y) {
      swap(x, y);
    }
    if (x == 0 && y == 0)
      break;
    cout << x << " " << y << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

int main() {

  int x, y;
  cin >> x >> y;
  for (;;) {
    if (x > y) {
      swap(x, y);
    }
    if (x == 0 && y == 0)
      break;
    cout << x << y << endl;
  }
  return 0;
}
Problem p02397 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
#define REP(i, k, n) for (int i = k; i < n; i++)
#define rep(i, j) for (int i = 0; i < j; i++)

int main(void) {
  int a, b;

  while (1) {

    cin >> a >> b;
    if (a == 0 && b == 0)
      break;

    if (a < b) {
      cout << a << " " << b << endl;
    } else {
      cout << b << " " << a << endl;
    }
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
#define REP(i, k, n) for (int i = k; i < n; i++)
#define rep(i, j) for (int i = 0; i < j; i++)

int main(void) {
  int a, b;
  cin >> a >> b;

  while (1) {
    if (a == 0 && b == 0)
      break;

    if (a < b) {
      cout << a << " " << b << endl;
    } else {
      cout << b << " " << a << endl;
    }
  }

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

#include <stdio.h>

int main(void) {
  int x, y;

  scanf("%d%d", &x, &y);
  while (x != 0 || y != 0) {
    printf("%d %d\\n", x < y ? x : y, x < y ? y : x);
    scanf("%d%d", &x, &y);
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <stdio.h>

int main(void) {
  int x, y;

  scanf("%d%d", &x, &y);
  while (x != 0 || y != 0) {
    printf("%d %d\\n", x < y ? x : y, x < y ? y : x);
  }
  return 0;
}
Problem p02397 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>

int main() {
  int a[3000], b[3000];
  int i = 0;
  while (1) {
    scanf("%d %d", &a[i], &b[i]);
    if (a[i] == 0 && b[i] == 0)
      break;
    if (b[i] < a[i]) {
      int tmp = a[i];
      a[i] = b[i];
      b[i] = tmp;
    }
    printf("%d %d\\n", a[i], b[i]);
    i = i + 1;
  }
  return 0;
}

Error: -11

Fixed submission:

#include <stdio.h>

int main() {
  int a[3000], b[3000];
  int i = 0;
  while (1) {
    scanf("%d %d", &a[i], &b[i]);
    if (a == 0 && b == 0)
      break;
    if (b < a) {
      int tmp = a[i];
      a[i] = b[i];
      b[i] = tmp;
    }
    printf("%d %d\\n", a[i], b[i]);
    i = i + 1;
  }
  return 0;
}
Problem p02397 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
  int x[3000], y[3000];
  int i = 0;
  int swap;
  for (i = 0; i < 100000; ++i) {
    scanf("%d%d", &x[i], &y[i]);
    if (x[i] == 0 && y[i] == 0)
      break;
    if (x[i] > y[i]) {
      swap = x[i];
      x[i] = y[i];
      y[i] = swap;
    }
  }
  for (int j = 0; j < i; ++j)
    cout << x[j] << " " << y[j] << endl;
  return 0;
}

Error: -11

Fixed submission:

#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
  int x[3000], y[3000];
  int i = 0;
  int swap;
  for (i = 0; i < 100000; ++i) {
    scanf("%d%d", x[i], y[i]);
    if (x[i] == 0 && y[i] == 0)
      break;
    if (x[i] > y[i]) {
      swap = x[i];
      x[i] = y[i];
      y[i] = swap;
    }
  }
  for (int j = 0; j < i; ++j)
    cout << x[j] << " " << y[j] << endl;
  return 0;
}
Problem p02397 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {

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

    if (x > y)
      swap(x, y);
    cout << x << " " << y << endl;
  }

  return 0;
}


Error: TLE

Fixed submission:

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

int main() {

  while (1) {
    int x, y;
    cin >> x >> y;
    if (x > y)
      swap(x, y);
    cout << x << " " << y << endl;
  }

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

#include <stdio.h>

using namespace std;

int main() {
  int a, b;
  while (true) {
    scanf("%d %d", &a, &b);
    if (a == 0 && b == 0)
      break;
    if (a > b)
      printf("%d %d\\n", b, a);
    else {
      printf("%d %d\\n", a, b);
    }
  }
}


Error: TLE

Fixed submission:

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

#include <iostream>
using namespace std;

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

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

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