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

#include <iomanip>
#include <iostream>

int main() {
  double a, b, c, d, e, f;
  while (std::cin >> a >> b >> c >> d >> e >> f) {
    double x, y;
    x = (b * f - e * c) / (b * d - e * a);
    y = (c - a * x) / b;
    if (x == 0)
      x = 0.000;
    if (y == 0)
      y = 0.000;
    std::cout << std::fixed << std::setprecision(3) << x << " " << y
              << std::endl;
  }
  return 0;
}

Error: 0
2
4


Fixed submission:

#include <iomanip>
#include <iostream>

int main() {
  int a, b, c, d, e, f;
  while (std::cin >> a >> b >> c >> d >> e >> f) {
    double x, y;
    int p, q;
    p = a * e - d * b;
    q = c * e - f * b;
    x = double(q) / double(p);
    p = b * d - e * a;
    q = c * d - f * a;
    y = double(q) / double(p);
    std::cerr << y << std::endl;
    std::cout << std::fixed << std::setprecision(3) << x << " " << y
              << std::endl;
  }
  return 0;
}
Problem p00004 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
using namespace std;
#define F first
#define S second
const int INF = 100000000;

int main() {
  double a, b, c, d, e, f;
  while (cin >> a >> b >> c >> d >> e >> f) {
    double x, y;
    x = (c * e - b * f) / (e * a - b * d);
    y = (c * d - a * f) / (b * d - a * e);
    if (x == -0)
      x = 0;
    if (y == -0)
      y = 0;

    printf("%.3f %.3f\\n", x, y);
    // cout << setprecision(3)  << x << " " << y << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
using namespace std;
#define F first
#define S second
const int INF = 100000000;

int dp[50][3001];
const int mod = 100000;

int main() {
  while (1) {
    double n[6];
    double tmp[6];
    for (int i = 0; i < 6; ++i) {
      cin >> n[i];
      tmp[i] = n[i];
    }

    double p = n[1] / n[4];
    for (int i = 3; i < 6; ++i)
      tmp[i] = n[i] * p;
    double x = (tmp[2] - tmp[5]) / (tmp[0] - tmp[3]);

    double q = n[0] / n[3];
    for (int i = 3; i < 6; ++i)
      tmp[i] = n[i] * q;
    double y = (tmp[2] - tmp[5]) / (tmp[1] - tmp[4]);

    printf("%.3f %.3f\\n", x, y);
    // cout << setprecision(3)  << x << " " << y << endl;
  }
  return 0;
}
Problem p00004 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cstdio>

using namespace std;

int main() {
  double a, b, c, d, e, f;
  while (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != -1) {
    double x = (c * e - b * f) / (a * e - b * d);
    double y = (c * d - a * f) / (b * d - a * e);
    if (x == -0)
      x = 0;
    if (y == -0)
      y = 0;
    printf("%.3f %.3f\\n", x, y);
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <cstdio>

using namespace std;

int main() {
  double a, b, c, d, e, f;
  while (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f)) {
    printf("%.3f %.3f\\n", (c * e - b * f) / (a * e - b * d),
           (c * d - a * f) / (b * d - a * e));
  }

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

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

const double EPS = 1e-8;
typedef vector<double> Vec;
typedef vector<Vec> Mat;

void show(const Mat &m) {
  puts("====");
  for (int i = 0; i < m.size(); i++) {
    for (int j = 0; j < m[i].size(); j++) {
      printf("%f ", m[i][j]);
    }
    puts("");
  }
  puts("====");
}

Vec gauss_jordan(const Mat &A, const Vec &b) {
  int n = A.size();
  Mat B(n, Vec(n + 1));

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      B[i][j] = A[i][j];
    }
    B[i][n] = b[i];
  }

  for (int i = 0; i < n; i++) {
    int pivot = i;
    for (int j = i; j < n; j++) {
      if (abs(B[j][i]) > abs(B[pivot][i])) {
        pivot = j;
      }
    }
    swap(B[i], B[pivot]);

    if (abs(B[i][i]) < EPS)
      return Vec();

    for (int j = i + 1; j <= n; j++) {
      B[i][j] /= B[i][i];
    }
    for (int j = 0; j < n; j++) {
      if (i != j) {
        for (int k = i + 1; k <= n; k++) {
          B[j][k] -= B[j][i] * B[i][k];
        }
      }
    }

    // show(B);
  }

  Vec x(n);
  for (int i = 0; i < n; i++) {
    x[i] = B[i][n];
  }

  return x;
}

int main() {
  while (true) {
    Mat A(2, Vec(2));
    Vec b(2);

    for (int i = 0; i < 2; i++) {
      for (int j = 0; j < 2; j++) {
        if (scanf("%lf", &A[i][j]) == EOF)
          return 0;
      }
      scanf("%lf", &b[i]);
    }

    Vec res = gauss_jordan(A, b);
    printf("%.3f %.3f\\n", res[0], res[1]);
  }

  return 0;
}

Error: -11

Fixed submission:

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

const double EPS = 1e-8;
typedef vector<double> Vec;
typedef vector<Vec> Mat;

void show(const Mat &m) {
  puts("====");
  for (int i = 0; i < m.size(); i++) {
    for (int j = 0; j < m[i].size(); j++) {
      printf("%f ", m[i][j]);
    }
    puts("");
  }
  puts("====");
}

Vec gauss_jordan(const Mat &A, const Vec &b) {
  int n = A.size();
  Mat B(n, Vec(n + 1));

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      B[i][j] = A[i][j];
    }
    B[i][n] = b[i];
  }

  for (int i = 0; i < n; i++) {
    int pivot = i;
    for (int j = i; j < n; j++) {
      if (abs(B[j][i]) > abs(B[pivot][i])) {
        pivot = j;
      }
    }
    swap(B[i], B[pivot]);

    if (abs(B[i][i]) < EPS)
      return Vec();

    for (int j = i + 1; j <= n; j++) {
      B[i][j] /= B[i][i];
    }
    for (int j = 0; j < n; j++) {
      if (i != j) {
        for (int k = i + 1; k <= n; k++) {
          B[j][k] -= B[j][i] * B[i][k];
        }
      }
    }

    // show(B);
  }

  Vec x(n);
  for (int i = 0; i < n; i++) {
    x[i] = B[i][n];
  }

  return x;
}

int main() {
  while (true) {
    Mat A(2, Vec(2));
    Vec b(2);

    for (int i = 0; i < 2; i++) {
      for (int j = 0; j < 2; j++) {
        scanf("%lf", &A[i][j]);
      }
      scanf("%lf", &b[i]);
    }

    Vec res = gauss_jordan(A, b);
    printf("%.3f %.3f\\n", res[0], res[1]);
  }

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

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>

#define doubled(x) (x * x)

//?????????????¨????(2 * 2??£?????????)
int matrix_val(int a11, int a12, int a21, int a22);

//?????°?????°?????? (in:??´??° out:?????°)
int digit_count(int num);

using namespace std;

int main() {
  int a, b, c, d, e, f;

  cin >> a >> b >> c;
  cin >> d >> e >> f;
  do {
    int A_matrix_val = matrix_val(a, b, d, e);
    int elem_x = matrix_val(c, b, f, e);
    int elem_y = matrix_val(a, c, d, f);
    double ans_x, ans_y;

    if (elem_x == 0)
      ans_x = 0;
    else
      ans_x = (double)elem_x / A_matrix_val;

    if (elem_y == 0)
      ans_y = 0;
    else
      ans_y = (double)elem_y / A_matrix_val;

    printf("%.3f %.3f\\n", ans_x, ans_y);

  } while ((cin >> a >> b >> c >> d >> e >> f));

  return 0;
}

int matrix_val(int a11, int a12, int a21, int a22) {
  return ((a11 * a22) - (a12 * a21));
}

int digit_count(int num) {
  if (num < 0)
    num *= (-1);

  int count = 0;

  for (int i = 10; num != 0; i *= 10) {
    int diff = num % i;
    num -= diff;
    count++;
  }

  return count;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>

#define doubled(x) (x * x)

//?????????????¨????(2 * 2??£?????????)
int matrix_val(int a11, int a12, int a21, int a22);

//?????°?????°?????? (in:??´??° out:?????°)
int digit_count(int num);

using namespace std;

int main() {
  int a, b, c, d, e, f;

  while (1) {
    cin >> a >> b >> c;
    cin >> d >> e >> f;

    int ans_x = matrix_val(c, b, f, e) / matrix_val(a, b, d, e);
    int ans_y = matrix_val(a, c, d, f) / matrix_val(a, b, d, e);

    cout << ans_x << ans_y << endl;
  }
  return 0;
}

int matrix_val(int a11, int a12, int a21, int a22) {
  return ((a11 * a22) - (a12 * a21));
}

int digit_count(int num) {
  if (num < 0)
    num *= (-1);

  int count = 0;

  for (int i = 10; num != 0; i *= 10) {
    int diff = num % i;
    num -= diff;
    count++;
  }

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

#include <stdio.h>
int main() {
  double a, b, c, d, e, f;
  while (scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f) != -1) {
    printf("%.3lf %.3lf\\n",
           (c * e - f * b) == 0 ? 0 : (c * e - f * b) / (a * e - d * b),
           (c * d - a * f) == 0 ? 0 : (c * d - a * f) / (b * d - a * e));
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <stdio.h>
int main() {
  double a, b, c, d, e, f, x, y;
  while (scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f)) {
    x = ((c * e - f * b) / (a * e - d * b));
    y = ((c - a * x) / b);
    if (x > 0)
      x += 0.0005;
    else
      x -= 0.0005;
    if (y > 0)
      x += 0.0005;
    else
      y = -0.0005;
    printf("%.3ld %.3ld", x, y);
  }
  return 0;
}
Problem p00004 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
int GCM(int a, int b) {
  if (b == 0)
    return a;
  return GCM(b, a % b);
}

int main() {
  int a, b, c, d, e, f;
  std::cout.precision(3);
  std::cout.setf(std::ios::fixed);
  while (std::cin >> a >> b >> c >> d >> e >> f) {
    double x = 0.0, y = 0.0;
    double a_ = a, b_ = b, c_ = c, d_ = d, e_ = e, f_ = f;
    b_ *= d, c_ *= d;
    e_ *= a, f_ *= a;
    y = (c_ - f_) / (b_ - e_);
    x = (c - y * b) / a;
    std::cout << x << " " << y << std::endl;
  }
  return 0;
}

Error: WA

Fixed submission:

#include <iostream>
int GCM(int a, int b) {
  if (b == 0)
    return a;
  return GCM(b, a % b);
}

int main() {
  int a, b, c, d, e, f;
  while (std::cin >> a >> b >> c >> d >> e >> f) {
    float x = 0.000f, y = 0.000f;
    int a_ = a, b_ = b, c_ = c, d_ = d, e_ = e, f_ = f;
    b_ *= GCM(a, d) / a, c_ *= GCM(a, d) / a;
    e_ *= GCM(a, d) / d, f_ *= GCM(a, d) / d;
    y = (c_ - f_) / (b_ - e_);
    x = (c - y * b) / a;
    std::cout << x << " " << y << std::endl;
  }
  return 0;
}
Problem p00004 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <stdio.h>
#define swap(a, b)                                                             \\
  {                                                                            \\
    a = a + b;                                                                 \\
    b = a - b;                                                                 \\
    a = a - b;                                                                 \\
  }

using namespace std;

void q4() {
  double a, b, c, d, e, f;
  for (; cin >> a >> b >> c >> d >> e >> f;) {
    // cin >> a >> b >> c >> d >> e >> f;
    // scanf_s("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f);

    if (a == 0) {
      swap(a, d);
      swap(b, e);
      swap(c, f);
    }
    b /= a;
    c /= a;
    a = 1;

    e -= b * d;
    f -= c * d;
    d = 0;

    f = f / e;
    e = 1;

    c -= f * b;
    b = 0;

    printf("%.3f %.3f\\n", c, f);
  }
}

int main() {
  q4();
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <stdio.h>
#define swap(a, b)                                                             \\
  {                                                                            \\
    a = a + b;                                                                 \\
    b = a - b;                                                                 \\
    a = a - b;                                                                 \\
  }
using namespace std;

void q4() {
  double a, b, c, d, e, f;
  for (;;) {
    cin >> a >> b >> c >> d >> e >> f;
    // scanf_s("%lf %lf %lf %lf %lf %lf\\n", &a, &b, &c, &d, &e, &f);

    if (a == 0) {
      swap(a, d);
      swap(b, e);
      swap(c, f);
    }
    b /= a;
    c /= a;
    a = 1;

    e -= b * d;
    f -= c * d;
    d = 0;

    f = f / e;
    e = 1;

    c -= f * b;
    b = 0;

    printf("%4lf %4lf\\n", c, f);
  }
}

int main() {
  q4();
  return 0;
}
Problem p00004 (C++) — buggy submission, verdict: Time Limit Exceeded

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

double halfadjust(double x) {
  int tmp = static_cast<int>(x * 10000);
  double ans = static_cast<double>(tmp) / 10000;
  tmp = tmp % 10;
  if (tmp >= 5)
    ans += 0.001;
  return ans;
}

double a, b, c, d, e, f;

void solve() {
  double x = (c * e - b * f) / (a * e - b * d);
  double y = (c * d - a * f) / (b * d - a * e);
  cout << setprecision(3) << fixed << halfadjust(x) << ' ';
  cout << halfadjust(y) << std::endl;
  // cout << setprecision(6);
}

int main() {
  while (cin >> a && cin >> b && cin >> c && cin >> d && cin >> e && cin >> f) {
    if ((!a && !b) || (!d && !e))
      break;
    solve();
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iomanip>
#include <iostream>

double halfadjust(double x) {
  int tmp = (x * 10000);
  double ans = static_cast<double>(tmp) / 10000;
  tmp = tmp % 10;
  if (tmp >= 5)
    ans += 0.001;
  return ans;
}

double a, b, c, d, e, f;

void solve() {
  using namespace std;
  double x = (c * e - b * f) / (a * e - b * d);
  double y = (c * d - a * f) / (b * d - a * e);
  cout << setprecision(3) << fixed << halfadjust(x) << ' ';
  cout << halfadjust(y) << std::endl;
  // cout << setprecision(6);
}

int main() {
  while (true) {
    std::cin >> a >> b >> c >> d >> e >> f;
    if ((!a && !b) || (!d && !e))
      break;
    solve();
  }
  return 0;
}
Problem p00004 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iomanip>
#include <iostream>

using namespace std;

int main() {
  cout << setprecision(3) << setiosflags(ios::fixed);
  double a, b, c, d, e, f;

  while (cin >> a >> b >> c >> d >> e >> f) {
    cout << (c * e - f * b) / (a * e - d * b) + 0.000001 << " "
         << (c * d - f * a) / (b * d - a * e) + 0.000001 << '\\n';
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iomanip>
#include <iostream>

using namespace std;

int main() {
  cout << setprecision(3) << setiosflags(ios::fixed);
  while (1) {
    double a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;

    cout << (c * e - f * b) / (a * e - d * b) << " "
         << (c * d - f * a) / (b * d - a * e) << '\\n';
  }
  return 0;
}
Problem p00004 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iomanip>
#include <iostream>

double halfadjust(double x) {
  int tmp = (x * 10000);
  tmp = tmp % 10;
  double ans = static_cast<double>(static_cast<int>(x * 1000));
  ans = ans / 1000;
  if (tmp >= 5)
    ans += 0.001;
  if (tmp <= -5)
    ans -= 0.001;
  return ans;
}

double a, b, c, d, e, f;

void solve() {
  using namespace std;
  double x = (c * e - b * f) / (a * e - b * d);
  double y = (c * d - a * f) / (b * d - a * e);
  cout << setprecision(3) << fixed << halfadjust(x) << ' ';
  cout << halfadjust(y) << endl;
  cout << setprecision(6);
}

int main() {
  using std::cin;
  while (cin >> a && cin >> b && cin >> c && cin >> d && cin >> e && cin >> f) {
    solve();
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iomanip>
#include <iostream>

double halfadjust(double x) {
  int tmp = (x * 10000);
  tmp = tmp % 10;
  double ans = static_cast<double>(static_cast<int>(x * 1000));
  ans = ans / 1000;
  if (tmp >= 5)
    ans += 0.001;
  if (tmp <= -5)
    ans -= 0.001;
  return ans;
}

double a, b, c, d, e, f;

void solve() {
  using namespace std;
  double x = (c * e - b * f) / (a * e - b * d);
  double y = (c * d - a * f) / (b * d - a * e);
  cout << setprecision(3) << fixed << halfadjust(x) << ' ';
  cout << halfadjust(y) << endl;
  cout << setprecision(6);
}

int main() {
  while (true) {
    std::cin >> a >> b >> c >> d >> e >> f;
    if (!a && !b && !c && !d && !e && !f)
      break;
    solve();
  }
  return 0;
}
Problem p00004 (C++) — buggy submission, verdict: Runtime Error

#include <cstdio>

using namespace std;

int main() {
  double a, b, c, d, e, f;
  double _b, _c, _e, _f;
  double x, y;

  while (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF) {
    _b = b * d;
    _c = c * d;
    _e = e * a;
    _f = f * a;

    y = (_c - _f) / (_b - _e);
    x = (c - b * y) / a;

    printf("%.3f %.3f\\n", x, y);
  }

  return 0;
}

Error: 0

Fixed submission:

#include <cstdio>

#define MAX(a, b) ((a) < (b) ? (b) : (a))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

using namespace std;

int LCM(int x, int y) {
  int bigger = MAX(x, y);
  int smaller = MIN(x, y);
  int i = 2;
  int j = 2;

  if ((smaller * i) % bigger == 0)
    return bigger;

  while ((smaller * i) % bigger != 0) {
    if (bigger < (smaller * i)) {
      bigger *= j;

      j++;
    }

    i++;
  }

  return bigger;
}

int main() {
  int a, b, c, d, e, f;
  int _a, _b, _c, _d, _e, _f;
  double x, y;
  int _x, _y, _z;
  int multiTop, multiBottom;
  int common;

  while (scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) != EOF) {
    common = LCM(a, d);
    multiTop = common / a;
    multiBottom = common / d;

    _a = common;
    _b = b * multiTop;
    _c = c * multiTop;

    _d = common;
    _e = e * -multiBottom;
    _f = f * -multiBottom;

    _y = _b + _e;
    _z = _c + _f;

    y = (double)_z / (double)_y;

    _c = c - (b * y);

    x = (double)_c / (double)a;

    printf("%.3f %.3f\\n", x, y);
  }

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

#include <cstdio>
#include <iomanip>
#include <iostream>

int main() {
  double a, b, c, d, e, f;
  while (std::cin >> a >> b >> c >> d >> e >> f) {
    double x, y;
    y = (c * d - a * f) / (b * d - a * e);
    x = (c - b * y) / a;
    if (x == 0)
      x = 0.000;
    if (y == 0)
      y = 0.000;
    printf("%.3f %.3f\\n", x, y);
  }
  return 0;
}

Error: 0

Fixed submission:

#include <cstdio>
#include <iomanip>
#include <iostream>

int gcd(int a, int b) {
  if (a < b)
    b %= a;
  if (b == 0)
    return a;
  int c = b;
  b = a % b;
  a = c;
  return gcd(a, b);
}

int lcm(int a, int b) {
  int c = gcd(a, b);
  return c * (a / c) * (b / c);
}

int main() {
  int a, b, c, d, e, f;
  double x, y;
  while (std::cin >> a >> b >> c >> d >> e >> f) {
    int g = lcm(a, d);
    y = (c * g / a - f * g / d) / (b * g / a - e * g / d);
    x = (c - y * b) / a;
    printf("%.3f %.3f\\n", x, y);
  }
  return 0;
}
Problem p00004 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <complex>
#include <iomanip>
#include <iostream>
using namespace std;
int main() {
  double a, b, c, d, e, f, x, y;
  int t = 85000;
  for (int i = t; i; i--) {
    for (int j = i; j; j--) {
      if (i + j == 2)
        a = 0.0;
    }
  }
  while (cin >> a) {
    cin >> b >> c >> d >> e >> f;
    x = (c * e - b * f) / (a * e - b * d),
    y = (c * d - a * f) / (b * d - a * e);
    if (x == -0)
      x = 0;
    if (y == -0)
      y = 0;
    cout << fixed << setprecision(3) << x << " ";
    cout << fixed << setprecision(3) << y << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <complex>
#include <iomanip>
#include <iostream>
using namespace std;
int main() {
  double a, b, c, d, e, f;
  int t = 90000;
  for (int i = t; i; i--) {
    for (int j = i; j; j--) {
      if (i + j == 2)
        a = 0.0;
    }
  }
  while (cin >> a) {
    cin >> b >> c >> d >> e >> f;
    cout << fixed << setprecision(3) << abs((c * e - b * f) / (a * e - b * d))
         << " ";
    cout << fixed << setprecision(3) << abs((c * d - a * f) / (b * d - a * e))
         << endl;
  }
  return 0;
}
Problem p00004 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, const char *argv[]) {
  double a = 0.0;
  double b = 0.0;
  double c = 0.0;
  double d = 0.0;
  double e = 0.0;
  double f = 0.0;
  double x = 0.0;
  double y = 0.0;
  int end = 0;

  while (scanf("%d", &end) != EOF) {
    a = end;
    scanf("%lf", &b);
    scanf("%lf", &c);
    scanf("%lf", &d);
    scanf("%lf", &e);
    scanf("%lf", &f);

    y = (d * c - a * f) / (d * b - a * e);
    x = (c - b * y) / a;

    printf("%.3lf", x);
    printf(" ");
    printf("%.3lf\\n", y);
  }
}

Error: TLE

Fixed submission:

#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
double gcd(double m, double n);
double lcm(double m, double n);
int main(int argc, const char *argv[]) {
  double a = 0.0;
  double b = 0.0;
  double c = 0.0;
  double d = 0.0;
  double e = 0.0;
  double f = 0.0;
  double x = 0.0;
  double y = 0.0;
  int end = 0;

  while (scanf("%d", &end) != EOF) {
    a = end;
    scanf("%lf", &b);
    scanf("%lf", &c);
    scanf("%lf", &d);
    scanf("%lf", &e);
    scanf("%lf", &f);
    double ad = lcm(a, d);

    double a2 = ad / a;
    double b2 = b * a2;
    double c2 = c * a2;

    double d2 = ad / d;
    double e2 = e * d2;
    double f2 = f * d2;

    y = (c2 - f2) / (b2 - e2);
    x = (c - b * y) / a;

    printf("%.3lf", x);
    printf(" ");
    printf("%.3lf\\n", y);
  }
}
double gcd(double m, double n) {
  if ((0.0 == m) || (0.0 == n))
    return 0;
  while (m != n) {
    if (m > n)
      m = m - n;
    else
      n = n - m;
  }
  return m;
}

double lcm(double m, double n) {
  if ((0.0 == m) || (0.0 == n))
    return 0;

  return ((m / gcd(m, n)) * n);
}
Problem p00004 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

#define reps(i, f, n) for (int i = f; i < int(n); i++)
#define rep(i, n) reps(i, 0, n)

int main() {
  double a, b, c, d, e, f;
  while (scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f) != EOF) {

    if (d == 0) {
      swap(a, d);
      swap(b, e);
      swap(c, f);
    }

    double y;
    if (a == 0) {
      y = c / b;
    } else {
      double A = b / a - e / d;
      double B = c / a - f / d;

      y = B / A;
    }
    double x = f / d - e / d * y;

    if (x == fabs(x))
      x = fabs(x);
    if (y == fabs(y))
      y = fabs(y);

    printf("%.3lf %.3lf\\n", x, y);
  }
}

Error: WA

Fixed submission:

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

#define add push_back
#define inf 2147000000

#define rep(i, n) for (int i = 0; i < n; i++)

using namespace std;

int main(void) {
  float a, b, c, d, e, f, g, h, i, x, y;

  while (scanf("%lf", &a) != EOF) {
    scanf("%lf%lf%lf%lf%lf", &b, &c, &d, &e, &f);

    g = a / d;
    d *= g;
    e *= g;
    f *= g;

    h = b - e;
    i = c - f;

    x = i / h;
    h = a;
    i = c - b * x;
    y = i / h;

    printf("%.3lf %.3lf\\n", y, x);
  }
}
Problem p00004 (C++) — buggy submission, verdict: Runtime Error

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

int main(void) {
  double a, b, c, d, e, f;
  double x, y;
  while (cin >> a >> b >> c >> d >> e >> f) {
    y = ((a * f - d * c)) / (a * e - d * b);
    x = (c - (b * y)) / a;
    printf("%.3lf %.3lf\\n", x, y);
  }
  return 0;
}

Error: WA

Fixed submission:

#include <iostream>
using namespace std;

int main(void) {
  int a, b, c, d, e, f;
  double x, y;
  while (cin >> a >> b >> c >> d >> e >> f) {
    y = (f - c - e) / (a + b);
    x = (c - b * y) / a;
    cout << x << ' ' << y << endl;
  }
  return 0;
}