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

#include <math.h>
#include <stdio.h>

int main(void) {
  int n, s;
  double sum = 0.0;
  double sum2 = 0.0;

  while (true) {
    sum = sum2 = 0.0;
    scanf("%d", &n);
    if (n == 0)
      break;

    for (int i = 0; i < n; i++) {
      scanf("%d ", &s);
      sum += s;
      sum2 += s * s;
    }

    printf("%f\\n", sqrt(sum2 / n - (sum / n) * (sum / n)));
  }
  return 0;
}

Error: TLE

Fixed submission:


#include <math.h>
#include <stdio.h>

int main(void) {
  double n, s;
  double sum = 0;
  double sum2 = 0;

  while (true) {
    scanf("%d", &n);
    if (n == 0.0)
      break;

    for (int i = 0; i < n; i++) {
      scanf("%d ", &s);
      sum += s;
      sum2 += s * s;
    }

    printf("%f\\n", sqrt(sum2 / n - (sum / n) * (sum / n)));
  }
  return 0;
}
Problem p02381 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
const int inf = 0x7fffffff;
typedef long long int ll;
using namespace std;
const int N = 1000 + 5;
double A[N];
int main() {
  // #ifdef DEBUG
  //	freopen("in", "r", stdin);
  ////	freopen("out", "w", stdout);
  // #endif
  int n;
  while (scanf("%d", &n) != EOF && n) {
    double sum = 0;
    double ans = 0;
    for (int i = 0; i < n; i++) {
      scanf("%lf", &A[i]);
      sum += A[i];
    }
    sum /= n;
    //	cout<<sum<<endl;
    for (int i = 0; i < n; i++) {
      ans += (A[i] - sum) * (A[i] - sum);
    }
    ans = sqrt(ans / n);
    printf("%f\\n", ans);
  }
  // insert code above
  return 0;
}
// aoj1_10_c.cc

Error: WA

Fixed submission:

#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
const int inf = 0x7fffffff;
typedef long long int ll;
using namespace std;
const int N = 100 + 5;
double A[N];
int main() {
  // #ifdef DEBUG
  //	freopen("in", "r", stdin);
  ////	freopen("out", "w", stdout);
  // #endif
  int n;
  while (scanf("%d", &n) != EOF && n) {
    double sum = 0;
    double ans = 0;
    for (int i = 0; i < n; i++) {
      scanf("%lf", &A[i]);
      sum += A[i];
    }
    sum /= n;
    //	cout<<sum<<endl;
    for (int i = 0; i < n; i++) {
      ans += (A[i] - sum) * (A[i] - sum);
    }
    ans = sqrt(ans / n);
    printf("%f\\n", ans);
  }
  // insert code above
  return 0;
}
// aoj1_10_c.cc
Problem p02381 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int n;
  double m, sig;

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

    double s[1000] = {0}, sum = 0;
    for (int i = 0; i < n; i++) {
      cin >> s[i];
      sum += s[i];
    }

    m = sum / n;
    sum = 0;

    for (int i = 0; i < n; i++) {
      sum += (s[i] - m) * (s[i] - m);
    }

    sig = sqrt(sum / n);

    cout << fixed << sig << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  int n, sum = 0;
  double m, sig;

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

    int s[n];
    for (int i = 0; i < n; i++) {
      cin >> s[i];
      sum += s[i];
    }

    m = sum / n;
    sum = 0;

    for (int i = 0; i < n; i++) {
      sum += (s[i] - m) * (s[i] - m);
    }

    sig = sum / n;

    cout << fixed << sqrt(sig) << endl;
  }

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

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

int main() {
  double m, n, a, s[1000];
  for (int j = 0; j < 100; j++) {
    cin >> n;
    if (n == 0)
      break;
    m = 0;
    a = 0;
    for (int i = 0; i < n; i++) {
      cin >> s[i];
      m += s[i];
    }
    m /= n;
    for (int i = 0; i < n; i++) {
      a += pow(s[i] - m, 2);
    }
    a /= n;
    cout << sqrt(a) << endl;
  }
  return 0;
}

Error: WA

Fixed submission:

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

int main() {
  double m, n, a, s[100];
  for (int j = 0; j < 100; j++) {
    cin >> n;
    if (n == 0)
      break;
    m = 0;
    a = 0;
    for (int i = 0; i < n; i++) {
      cin >> s[i];
      m += s[i];
    }
    m /= n;
    for (int i = 0; i < n; i++) {
      a += pow(s[i] - m, 2);
    }
    a /= n;
    cout << sqrt(a) << endl;
  }
  return 0;
}
Problem p02381 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  double b, s[1000], n, x;
  while (1) {
    cin >> n;
    if (n == 0)
      break;
    x = 0;
    for (int i = 0; i < n; i++) {
      cin >> s[i];
      x += s[i];
    }
    double m = x / n;
    b = 0;
    for (int i = 0; i < n; i++) {
      b += (s[i] - m) * (s[i] - m);
    }
    printf("%.8lf\\n", sqrt(b / n));
  }
  return 0;
}


Error: 0

Fixed submission:

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

int main() {
  double b, s[100], n;
  long x;
  while (1) {
    cin >> n;
    if (n == 0)
      break;
    x = 0;
    for (int i = 0; i < n; i++) {
      cin >> s[i];
      x += s[i];
    }
    double m = x / n;
    b = 0;
    for (int i = 0; i < n; i++) {
      b += (s[i] - m) * (s[i] - m);
    }
    printf("%.8lf\\n", sqrt(b / n));
  }
  return 0;
}
Problem p02381 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iomanip>
#include <iostream>
#include <math.h>
using namespace std;

int main(void) {
  int n;
  int *score;
  double ave, S;

  while (true) {
    cin >> n;

    if (n == 0)
      break;

    score = new int[n];

    S = ave = 0.0;
    for (int i = 0; i < n; i++) {
      cin >> score[i];
      ave += score[i];
    }
    ave /= n;

    for (int i = 0; i < n; i++) {
      S += (score[i] - ave) * (score[i] - ave);
    }

    cout << fixed << setprecision(10) << sqrt(S / n) << "\\n";

    delete[] score;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <iomanip>
#include <iostream>
#include <math.h>
using namespace std;

int main(void) {
  int n;
  int *score;
  double ave, S;

  while (true) {
    cin >> n;

    score = new int[n];

    S = ave = 0.0;
    for (int i = 0; i < n; i++) {
      cin >> score[i];
      ave += score[i];
    }
    ave /= n;

    for (int i = 0; i < n; i++) {
      S += (score[i] - ave) * (score[i] - ave);
    }

    cout << fixed << setprecision(10) << sqrt(S / n) << "\\n";

    delete[] score;
  }

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

#include <cmath>
#include <iostream>
using namespace std;
int main() {
  int time;
  double m;
  int s[1000];
  double apow;
  while (true) {
    cin >> time;
    if (time == 0)
      break;
    apow = 0;
    m = 0;
    for (int i = 0; i < time; ++i) {
      cin >> s[i];
      m += s[i];
    }
    m /= (double)time;
    for (int i = 0; i < time; ++i) {
      apow += pow((double)s[i] - m, 2.0);
    }
    cout << sqrt(apow / (double)time) << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <cmath>
#include <iostream>
using namespace std;
int main() {
  int time;
  double m;
  int s[100];
  double apow;
  while (true) {
    cin >> time;
    if (time == 0)
      break;
    apow = 0;
    m = 0;
    for (int i = 0; i < time; ++i) {
      cin >> s[i];
      m += s[i];
    }
    m /= (double)time;
    for (int i = 0; i < time; ++i) {
      apow += pow((double)s[i] - m, 2.0);
    }
    cout << sqrt(apow / (double)time) << endl;
  }
  return 0;
}
Problem p02381 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <time.h>
#include <valarray>
#include <vector>

using namespace std;

int main(void) {
  long double s[1000], Hei, kari;

  long int n;

  for (long int A = 0; A < 1000; A++) {
    cin >> n;

    if (n == 0) {
      break;
    }

    for (long int i = 0; i < n; i++) {
      cin >> s[i];
      Hei += s[i];
    }

    for (long int i = 0; i < n; i++) {
      kari += (s[i] - Hei / n) * (s[i] - Hei / n);
    }

    cout << fixed << setprecision(8) << sqrt(kari / n) << endl;

    Hei = 0;
    kari = 0;
  }
}

Error: 0

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <time.h>
#include <valarray>
#include <vector>

using namespace std;

int main(void) {
  long double s[500], Hei, kari;

  long int n;

  for (long int A = 0; A < 1000; A++) {
    cin >> n;

    if (n == 0) {
      break;
    }

    for (long int i = 0; i < n; i++) {
      cin >> s[i];
      Hei += s[i];
    }

    for (long int i = 0; i < n; i++) {
      kari += (s[i] - Hei / n) * (s[i] - Hei / n);
    }

    cout << fixed << setprecision(8) << sqrt(kari / n) << endl;

    Hei = 0;
    kari = 0;
  }
}
Problem p02381 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <math.h>
#include <stdio.h>
int main() {
  int n, a[1000];
  double average;
  while (1) {
    scanf("%d", &n);
    if (n == 0)
      break;
    int sum = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
      sum = sum + a[i];
      average = 1.0 * sum / n;
    }

    double sum2 = 0.0;
    for (int i = 0; i < n; i++) {
      sum2 = sum2 + (average - a[i]) * (average - a[i]);
    }
    printf("%lf\\n", sqrt(sum2 / n));
  }
}

Error: TLE

Fixed submission:

#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
  int n, a[100];
  double average;
  while (1) {
    scanf("%d", &n);
    if (n == 0)
      break;
    int sum = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      sum = sum + a[i];
      average = 1.0 * sum / n;
    }

    double sum2 = 0.0;
    for (int i = 0; i < n; i++) {
      sum2 = sum2 + (average - a[i]) * (average - a[i]);
    }
    printf("%lf\\n", sqrt(sum2 / n));
  }
}
Problem p02381 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int s[1001];
  while (cin >> n) {
    if (n == 0)
      break;
    double m = 0, result = 0;
    for (int i = 0; i < n; i++) {
      cin >> s[i];
      m += s[i];
    }
    m /= n;
    for (int i = 0; i < n; i++) {
      result += pow((s[i] - m), 2);
    }
    cout << fixed << setprecision(8);
    cout << sqrt(result / n) << endl;
  }
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  while (1) {
    int n;
    double m = 0, result = 0;
    cin >> n;
    int s[n + 1];
    for (int i = 0; i < n; i++) {
      cin >> s[i];
      m += s[i];
    }
    m /= n;
    for (int i = 0; i < n; i++) {
      result += pow((s[i] - m), 2);
    }
    result = sqrt(result / n);
    cout << fixed << setprecision(8);
    cout << result << endl;
  }
}
Problem p02381 (C++) — buggy submission, verdict: Runtime Error

#include <iomanip>
#include <iostream>
#include <math.h>
using namespace std;
int main() {
  int n;
  double a[1001], s, e;
  do {
    cin >> n;
    if (n == 0)
      break;
    s = 0;
    e = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      s += (a[i] / n);
    }
    for (int i = 0; i < n; i++) {
      e += ((a[i] - s) * (a[i] - s)) / n;
    }
    cout << fixed;
    cout << setprecision(8) << sqrt(e) << endl;
  } while (true);
  return 0;
}

Error: 0

Fixed submission:

#include <iomanip>
#include <iostream>
#include <math.h>
using namespace std;
int main() {
  int n;
  double a[101], s, e;
  do {
    cin >> n;
    if (n == 0)
      break;
    s = 0;
    e = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      s += (a[i] / n);
    }
    for (int i = 0; i < n; i++) {
      e += ((a[i] - s) * (a[i] - s)) / n;
    }
    cout << fixed;
    cout << setprecision(8) << sqrt(e) << endl;
  } while (true);
  return 0;
}
Problem p02381 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  // int n,vol,s[100];
  double a, n, vol, s[1000], avg;
  while (true) {

    cin >> n;
    if (n == 0)
      break;
    vol = 0;
    a = 0;
    for (int i = 0; i < n; i++) {
      cin >> s[i];
      vol += s[i];
    }
    avg = vol / n;
    for (int i = 0; i < n; i++) {
      a += pow(s[i] - avg, 2.0);
    }
    a /= n;
    printf("%lf\\n", sqrt(a));
  }
  return 0;
}


Error: WA

Fixed submission:

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

int main() {
  // int n,vol,s[100];
  double a, n, vol, s[100], avg;
  while (true) {

    cin >> n;
    if (n == 0)
      break;
    vol = 0;
    a = 0;
    for (int i = 0; i < n; i++) {
      cin >> s[i];
      vol += s[i];
    }
    avg = vol / n;
    for (int i = 0; i < n; i++) {
      a += pow(s[i] - avg, 2.0);
    }
    a /= n;
    printf("%lf\\n", sqrt(a));
  }
  return 0;
}
Problem p02381 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int n;
  double s[1000], sum, dist, m;

  while (1) {
    cin >> n;
    sum = 0.0;
    dist = 0.0;
    if (n == 0)
      break;

    for (int i = 0; i < n; i++) {
      cin >> s[i];

      sum += s[i];
    }
    m = sum / n;

    for (int i = 0; i < n; i++) {
      dist += pow(s[i] - m, 2);
    }

    printf("%lf\\n", sqrt(dist / n));
  }

  return 0;
}

Error: WA

Fixed submission:

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

int main() {
  int n;
  double s[101], sum, dist, m;

  while (1) {
    cin >> n;
    sum = 0.0;
    dist = 0.0;
    if (n == 0)
      break;

    for (int i = 0; i < n; i++) {
      cin >> s[i];

      sum += s[i];
    }
    m = sum / n;

    for (int i = 0; i < n; i++) {
      dist += pow(s[i] - m, 2);
    }

    printf("%lf\\n", sqrt(dist / n));
  }

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

#include <stdio.h>
using namespace std;
int main() {
  int w = 0;
  scanf("%d", &w);
  printf("%d\\n", w * w * w);
  return 0;
}

Error: 8

Fixed submission:

#include <stdio.h>
using namespace std;
int main() {
  int w = 0;
  scanf("%d", &w);
  printf("%d\\n", w * w * w);
  return 8;
}
Problem p02388 (C++) — buggy submission, verdict: Runtime Error

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

Error: 8

Fixed submission:

#include <stdio.h>

using namespace std;

int main() {
  int w = 0;
  scanf("%d", &w);
  printf("%d\\n", w * w * w);

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

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

Error: -11

Fixed submission:

#include <stdio.h>
int main() {
  int x = 0;
  scanf("%d", x);
  printf("%d\\n", &x);
  return 0;
}
Problem p02388 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>

int main() {
  int x = 0;
  scanf("%d", &x);
  printf("%d\\n", x * x * x);
  return 0;
}


Error: -11

Fixed submission:

#include <stdio.h>

int main() {
  int x = 0;
  scanf("%d", x);
  printf("%d\\n", x * x * x);
  return 0;
}
Problem p02388 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>
int main() {
  int x, ans = 0;
  scanf("%d", &x);
  ans = x * x * x;
  printf("%d\\n", ans);
  return 0;
}

Error: -11

Fixed submission:

#include <stdio.h>
int main() {
  int x, ans = 0;
  scanf("%d", x);
  ans = x * x * x;
  printf("%d\\n", ans);
  return 0;
}
Problem p02388 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int x;
  cin >> x;
  cout << x * x * x << endl;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int x;
  do {
    cin >> x;
  } while (x >= 1 && x <= 100);
  cout << (x * x * x) << endl;
  return 0;
}
Problem p02388 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>

int main() {
  int x, ans;
  scanf("%d", &x);

  ans = x * x * x;

  printf("%d\\n", ans);

  return 0;
}

Error: -11

Fixed submission:

#include <stdio.h>

int main() {
  int x, ans;
  scanf("%d", x);

  ans = x * x * x;

  printf("%d\\n", ans);

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

#include <iostream>
using namespace std;

int main(void) {

  int x = 5;
  int sum = 1;
  cin >> x;

  for (int i = 0; i <= 2; i++) {
    sum *= x;
  }
  cout << sum << endl;

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main(void) {

  int x = 5;
  int sum = 1;
  do {
    cin >> x;
  } while (1 <= x && x <= 1000);

  for (int i = 0; i <= 2; i++) {
    sum *= x;
  }
  cout << sum << endl;

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

#include <stdio.h>

int main(void) {
  int x, y;
  scanf("%d", &x);
  y = x * x * x;
  printf("%d\\n", y);
  return 0;
}

Error: -11

Fixed submission:

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

#include <iostream>

#define OK 0;
using namespace std;

int main(void) {
  int x;

  // scanf
  cin >> x;

  // printf
  cout << x * x * x << endl;

  return OK;
}

Error: 1

Fixed submission:

#include <iostream>

#define OK 1;
using namespace std;

int main(void) {
  int x;

  // scanf
  cin >> x;

  // printf
  cout << x * x * x << endl;

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

#include <iostream>
using namespace std;

int main() {
  int x;
  cin >> x;
  cout << x * x * x << endl;
  return 0;
}
/*
int main(int arg, char *argv[])
{
    int n = stoi(argv[1]);
    int ans = n * n * n;
    cout << ans << endl;
    return 0;
}
*/

Error: -6
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string: construction from null is not valid


Fixed submission:

#include <iostream>
using namespace std;

int main(int arg, char *argv[]) {
  int n = stoi(argv[1]);
  int ans = n * n * n;
  cout << ans << endl;
  return 0;
}
Problem p02388 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>
int main() {
  int x;

  scanf("%d", &x);

  x = x * x * x;

  printf("%d\\n", x);

  return 0;
}

Error: -11

Fixed submission:

#include <stdio.h>
int main() {
  int x;

  scanf("%d", x);
  printf("%d", x * x * x);

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

#include <iostream>

int main() {
  int x, y;
  std::cin >> x;
  y = x * x * x;
  std::cout << y << std::endl;
  return 0;
}

Error: -11

Fixed submission:

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
  int x = atoi(argv[1]);
  int y = x * x * x;
  printf("%d\\n", y);
  return 0;
}
Problem p02388 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>

int main(void) {
  int a;
  scanf("%d\\n", &a);
  printf("%d\\n", a * a * a);
  return 0;
}


Error: -11

Fixed submission:

#include <stdio.h>

int main(void) {
  int x = 0;
  scanf("%d\\n", x);
  printf("x", x * x * x);
  return 0;
}
Problem p02388 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>

int main(void) {
  int x;

  scanf("%d", &x);
  printf("%d\\n", x * x * x);

  return 0;
}


Error: -11

Fixed submission:

#include <stdio.h>

int main(void) {
  int x;

  scanf("%d", x);
  printf("%d", x * x * x);

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

#include <stdio.h>
int main() {

  int x = 0;
  scanf("%d", &x);
  if (x >= 1 && x <= 100) {
    printf("%d\\n", x * x * x);
  } else {
  }

  return 0;
}


Error: -11

Fixed submission:

#include <stdio.h>
int main() {

  int x = 0;

  scanf("%d", x);
  if (x >= 1 && x <= 100) {
    printf("%d\\n", x * x * x);
  }

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

#include <stdio.h>

int main() {

  int x = 0;
  scanf("%d", &x);
  if (x >= 1 && x <= 100) {
    printf("%d\\n", x * x * x);
  } else {
    printf("範囲外\\n");
  }

  return 0;
}


Error: -11

Fixed submission:

#include <stdio.h>
int main() {

  int x = 0;

  scanf("%d", x);
  if (x > 0 && x < 100) {
    printf("%d\\n", x * x * x);
  }

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

#include <iostream>
using namespace std;

int main() {
  int x;
  cin >> x;
  cout << x * x * x << endl;

  return 0;
}

Error: -11

Fixed submission:

#include <stdio.h>

int main(void) {
  int x;
  scanf("%d", x);
  printf("%d", x * x * x);

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

#include <iostream>

using namespace std;

int Cubic(int x) { return (x * x * x); }

int main() {
  int x;

  cin >> x;

  x = Cubic(x);

  cout << x << endl;

  // while(1);

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

int Cubic(int x) { return (x * x * x); }

int main() {
  int x;

  cin >> x;

  x = Cubic(x);

  cout << x << endl;

  while (1)
    ;

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

#include <iostream>
using namespace std;

int main() {
  int x;
  cin >> x;
  cout << x * x * x << endl;
}

Error: 1

Fixed submission:

#include <iostream>
using namespace std;

int main(int x) { return x * x * x; }
Problem p02388 (C++) — buggy submission, verdict: Time Limit Exceeded

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

  int x; // 変数を宣言

  cin >> x;

  cout << x * x * x << endl;
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int n, x, cnt;
  int iniI, iniJ, inik;
  while (cin >> n >> x, n != 0 || x != 0) {
    cnt = 0;
    iniI = 1;
    for (int i = iniI; i <= n; i++) {
      iniI = i + 1;
      iniJ = i + 1;
      for (int j = iniJ; j <= n; j++) {
        iniJ = j + 1;
        inik = j + 1;
        for (int k = inik; k <= n; k++) {
          inik = k + 1;
          if ((i + j + k) == x) {
            cnt++;
            // cout<<"○"<<i<<"+"<<j<<"+"<<k<<"=="<<x<<endl;
          }
          /*else{
              cout<<"×"<<i<<"+"<<j<<"+"<<k<<"!="<<x<<endl;
          }*/
        }
      }
    }
    cout << cnt << endl;
  }

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

#include <iostream>
using namespace std;

int main() {
  int x;
  cin >> x;
  cout << x * x * x << endl;
  return 0;
}

Error: -11

Fixed submission:

#include <stdio.h>

int main(void) {
  int x;
  scanf("%d\\n", x);

  printf("%d\\n", x * x * x);

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

#include <iostream>

using namespace std;

int main() {
  int x;
  std::cin >> x;

  int result = x * x * x;
  cout << result << endl;

  return 0;
}


Error: -6
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string: construction from null is not valid


Fixed submission:

#include <cmath>
#include <iostream>
#include <string>

using namespace std;

int main(int argc, char *argv[]) {
  //   if(argc != 2)
  //        return 0;
  int arg = stoi(argv[1]);

  int result = arg * arg * arg;
  // print(result);
  cout << result << endl;
  return 0;
}
Problem p02388 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>
int main(void) {
  int x = 0;
  scanf("%d", &x);
  printf("%d\\n", x * x * x);
  return 0;
}

Error: -11

Fixed submission:

#include <stdio.h>
int main(void) {
  int x = 0;
  scanf("%d", x);
  printf("%d", x * x * x);
  return 0;
}
Problem p02388 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>

int main() {
  int x;

  scanf("%d", &x);
  x = x * x * x;
  printf("%d\\n", x);

  return 0;
}

Error: -11

Fixed submission:

#include <stdio.h>

int main() {
  int x = 0;

  scanf("%d", &x);
  x = x * x * x;
  printf("%n\\n", x);

  return 0;
}