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

#include <iostream>
#include <vector>
using namespace std;
int main(void) {
  vector<int> t;
  int a;
  while (cin >> a) {
    if (a != 0) {
      t.push_back(a);
    } else if (a == 0) {
      cout << t.back() << endl;
      t.pop_back();
    }
  }
}


Error: -11

Fixed submission:

#include <iostream>
#include <vector>
using namespace std;
int main(void) {
  vector<int> t;
  int a;
  do {
    cin >> a;
    if (a != 0) {
      t.push_back(a);
    } else if (a == 0) {
      cout << t.back() << endl;
      t.pop_back();
    }
  } while (true);
}
Problem p00013 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int n;
  stack<int> stack;
  while (cin >> n) {
    if (n == 0) {
      cout << stack.top() << endl;
      stack.pop();
    } else {
      stack.push(n);
    }
  }
  return 0;
}

Error: -11

Fixed submission:

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

int main() {
  int n;
  while (cin >> n) {
    stack<int> stack;
    if (n > 0) {
      stack.push(n);
    } else {
      cout << stack.top() << endl;
      stack.pop();
    }
  }
  return 0;
}
Problem p00013 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <stack>

using namespace std;

int main() {
  int a;

  stack<int> syaryo;

  while (cin >> a) {

    if (a != 0) {
      syaryo.push(a);
    }

    else {
      cout << syaryo.top() << endl;
      syaryo.pop();
    }
  }

  return 0;
}

Error: WA

Fixed submission:

#include <iostream>
#include <stack>

using namespace std;

int main() {
  int a;

  stack<int> syaryo;

  while (cin >> a) {
    cin >> a;

    if (a != 0) {
      syaryo.push(a);
    }

    else {
      cout << syaryo.top() << endl;
      syaryo.pop();
    }
  }

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

#include <cstdio>
#include <stack>
using namespace std;
int main() {
  int n;
  stack<int> car;
  while (~scanf("%d", &n)) {
    if (n != 0)
      car.push(n);
    else {
      printf("%d\\n", car.top());
      car.pop();
    }
  }
  return 0;
}

Error: -11

Fixed submission:

#include <cstdio>
#include <stack>
using namespace std;
int main() {
  int n;
  stack<int> car;
  while (scanf("%d", &n)) {
    if (n != 0)
      car.push(n);
    else {
      printf("%d\\n", car.top());
      car.pop();
    }
  }
  return 0;
}
Problem p00013 (C++) — buggy submission, verdict: Runtime Error

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

stack<int> sta;

int main(void) {
  int a;
  while (scanf("%d", &a) != EOF) {
    if (a)
      sta.push(a);
    else {
      cout << sta.top() << endl;
      sta.pop();
    }
  }
  return 0;
}

Error: -11

Fixed submission:

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

stack<int> sta;

int main(void) {
  int a;
  while (1) {
    cin >> a;
    if (a)
      sta.push(a);
    else {
      cout << sta.top() << endl;
      sta.pop();
    }
  }
  return 0;
}
Problem p00013 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <stack>

using namespace std;

int main() {
  stack<int> stk;
  int c;
  while (cin >> c) {
    if (c == 0) {
      cout << stk.top() << endl;
      stk.pop();
    } else {
      stk.push(c);
    }
  }
  return 0;
}

Error: -11

Fixed submission:

#include <iostream>
#include <stack>

using namespace std;

int main() {
  stack<char> stk;
  char c;
  while (cin >> c) {
    if (c == '0') {
      cout << stk.top() << endl;
      stk.pop();
    } else {
      stk.push(c);
    }
  }
  return 0;
}
Problem p00013 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>

#include <string.h>

#include <stack>

#include <iostream>

using namespace std;

int main() {

  int input;
  stack<int> train;
  while (scanf("%d", &input) != EOF) {
    //        scanf("%d",&input);
    if (input != 0)
      train.push(input);
    else {
      printf("%d\\n", train.top());
      train.pop();
    }
  }
}
//        if(strcmp(c,pu) == 0){
//
//            scanf("%s",&color);
//
//            st.push(color);
//
//        }
//
//        if(strcmp(c,po) == 0){
//
//            cout<<st.top()<<endl;
//
//            st.pop();
//
//        }
//
//        if(strcmp(c,qu) == 0){
//
//            return 0;
//
//        }
//
//    }

//}

Error: -11

Fixed submission:

#include <stdio.h>

#include <string.h>

#include <stack>

#include <iostream>

using namespace std;

int main() {

  int input;
  stack<int> train;
  for (;;) {
    scanf("%d", &input);
    if (input != 0)
      train.push(input);
    else {
      printf("%d", train.top());
      train.pop();
    }
  }
}
//        if(strcmp(c,pu) == 0){
//
//            scanf("%s",&color);
//
//            st.push(color);
//
//        }
//
//        if(strcmp(c,po) == 0){
//
//            cout<<st.top()<<endl;
//
//            st.pop();
//
//        }
//
//        if(strcmp(c,qu) == 0){
//
//            return 0;
//
//        }
//
//    }

//}
Problem p00013 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

struct Stack {
  int data[100000];
  int idx;
  Stack() : idx(0) {}
  void push(int val) { data[idx++] = val; }
  int pop() { return data[--idx]; }
};

int main() {
  Stack s;
  int val;
  while (std::cin >> val) {
    if (val == 0)
      std::cout << s.pop() << std::endl;
    else
      s.push(val);
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

int main() {
  short stack[10] = {0};
  short *pstack = stack;
  while (1) {
    int num;
    cin >> num;
    if (num) {
      *pstack = num;
      pstack++;
    } else {
      pstack--;
      cout << *pstack << endl;
    }
  }
}
Problem p00013 (C++) — buggy submission, verdict: Runtime Error

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

int main(void) {
  stack<int> s;

  int buf;
  while (cin >> buf) {
    if (buf == 0) {
      cout << s.top() << endl;
      s.pop();
    } else {
      s.push(buf);
    }
  }
}

Error: -11

Fixed submission:

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

int main(void) {
  stack<int> s;

  int buf;
  while (1) {
    cin >> buf;
    if (buf == 0) {
      cout << s.top() << endl;
      s.pop();
    } else {
      s.push(buf);
    }
  }
}
Problem p00013 (C++) — buggy submission, verdict: Time Limit Exceeded

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

  int a[10], c = 0, num;

  while (scanf("%d", &num) != EOF) {

    if (num != 0) {
      a[c] = num;
      c++;
    } else {
      cout << a[c - 1] << endl;
      c--;
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

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

  int a[10], c = 0, num;

  while (1) {

    cin >> num;

    if (num >= 1 && num <= 10) {
      a[c] = num;
      c++;
    } else {
      cout << a[c - 1] << endl;
      c--;
    }
  }
  return 0;
}
Problem p00013 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <stdio.h>
#include <vector>
using namespace std;
int main() {
  int train[10], n, i;
  n = 0;
  int order[100], intrain[10];
  for (i = 1; i <= 10; i++) {
    train[i] = i;
  }
  for (i = 0; i < 100; i++)
    order[i] = 11;
  i = 0;
  while (scanf("%d", &order[i]) != EOF) {
    i++;
  }
  for (i = 0; order[i] != 11; i++) {
    if (order[i] != 0) {
      intrain[n] = order[i];
      n++;
    } else if (order[i] == 0) {
      n--;
      cout << intrain[n] << endl;
    }
  }
}


Error: 0

Fixed submission:

#include <iostream>
#include <stdio.h>
#include <vector>
using namespace std;
int main() {
  int train[10], n, i;
  n = 0;
  int order[30], intrain[10];
  for (i = 1; i <= 10; i++) {
    train[i] = i;
  }
  for (i = 0; i < 30; i++)
    order[i] = 11;
  i = 0;
  while (scanf("%d", &order[i]) != EOF) {
    i++;
  }
  for (i = 0; order[i] != 11; i++) {
    if (order[i] != 0) {
      intrain[n] = order[i];
      n++;
    } else if (order[i] == 0) {
      n--;
      cout << intrain[n] << endl;
    }
  }
}
Problem p00013 (C++) — buggy submission, verdict: Runtime Error

#include <cstdio>
#include <iostream>
#include <stack>
using namespace std;
int main() {
  stack<int> train;
  int a;
  while (scanf("%d", &a) != EOF) {
    if (a == 0) {
      cout << train.top() << endl;
      train.pop();
    } else {
      train.push(a);
    }
  }
}

Error: 0

Fixed submission:

#include <cstdio>
#include <iostream>
using namespace std;
int main() {
  int train[10];
  int by[10];
  int a, i = 0, j = 0;
  while (scanf("%d", &a) != EOF) {
    if (a == 0) {
      i--;
      by[j] = train[i];
      j++;
    } else {
      train[i] = a;
      i++;
    }
  }
  for (int i = 0; i < j; i++) {
    cout << by[i] << endl;
  }
}
Problem p00013 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int tmp, i = 0, j, k = 0, f[11];
  vector<int> ans;

  while (cin >> tmp) {
    if (tmp == 0) {
      ans.push_back(f[i - 1]);
      f[i - 1] = '\\0';
      i--;
      k++;
    } else {
      f[i] = tmp;
      i++;
    }
  }
  for (j = 0; j < k; j++) {
    cout << ans[j] << endl;
  }
  return 0;
}

Error: -11

Fixed submission:

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

int main() {
  int tmp, i = 0, j, k = 0, f[11];
  vector<int> ans;

  while (cin >> tmp) {
    if (tmp == 0) {
      ans[k] = f[i - 1];
      f[i - 1] = '\\0';
      i--;
      k++;
    } else {
      f[i] = tmp;
      i++;
    }
  }
  for (j = 0; j < k; j++) {
    cout << ans[j] << endl;
  }
  return 0;
}
Problem p00013 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int x;
  stack<int> st;
  while (cin >> x) {
    if (x) {
      st.push(x);
    } else {
      cout << st.top() << endl;
      st.pop();
    }
  }
  return 0;
}

Error: -11

Fixed submission:

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

int main() {
  int x;
  stack<int> st;
  while (true) {
    int n;
    cin >> n;
    if (n) {
      st.push(n);
    } else {
      cout << st.top() << endl;
      st.pop();
    }
  }
  return 0;
}
Problem p00013 (C++) — buggy submission, verdict: Runtime Error

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

  while (cin >> input) {
    if (input) {
      data.push(input);
    } else {
      cout << data.top() << endl;
      data.pop();
    }
  }
}

Error: -11

Fixed submission:

#include <stdio.h>

int data[10];
int sp = 0;
int read;

int top() { return data[sp - 1]; }

void pop() { sp--; }

void push(int v) {
  data[sp] = v;
  sp++;
}

int main() {
  while (1) {
    scanf("%d", &read);
    if (read == 0) {
      printf("%d\\n", top());
      pop();
    } else {
      push(read);
    }
  }
  return 0;
}
Problem p00013 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int x;
  stack<int> st;
  for (int n; cin >> n;) {
    if (n) {
      st.push(n);
    } else {
      cout << st.top() << endl;
      st.pop();
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  int x;
  stack<int> st;
  while (true) {
    cin >> x;
    if (x == 0 && !st.empty()) {
      cout << st.top() << endl;
      st.pop();
    } else {
      st.push(x);
    }
  }
  return 0;
}
Problem p00013 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int n;
  stack<int> s;
  while (cin >> n) {
    if (n > 0)
      s.push(n);
    else if (n == 0) {
      cout << s.top() << endl;
      s.pop();
    }
  }
}

Error: 0

Fixed submission:

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

int main() {
  int n, count = 0, a[11], i;
  stack<int> s;
  while (cin >> n) {
    if (n > 0)
      s.push(n);
    else if (n == 0) {
      a[count++] = s.top();
      s.pop();
    }
  }
  for (i = 0; i < count; i++) {
    cout << a[i] << endl;
  }
}
Problem p00013 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;

int main() {
  int n;
  vector<int> train;
  while (cin >> n) {
    if (n != 0) {
      train.emplace_back(n);
    } else {
      cout << train.back() << endl;
      train.pop_back();
    }
  }
  return 0;
}

Error: -8

Fixed submission:


#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;

int main() {
  int n;
  while (cin >> n) {
    int ans = 0;
    for (int i = 0; i < 600 / n; i++) {
      ans += 600 / n * i;
    }
    ans *= 600 / n;
    cout << ans << endl;
  }
}
Problem p00013 (C++) — buggy submission, verdict: Runtime Error

#include <cstdio>
#include <iostream>
#include <stack>
using namespace std;
int main() {
  int n;
  int i;
  stack<int> in;
  while (scanf("%d", &i) != EOF) {
    if (i != 0) {
      in.push(i);
    } else {
      cout << in.top() << endl;
      in.pop();
    }
  }
}

Error: 0

Fixed submission:

#include <cstdio>
#include <iostream>
using namespace std;
int main() {
  int in[10] = {0}, out[10];
  int n;
  int i = 0;
  int j = 0;
  while (scanf("%d", &n) != EOF) {
    if (n != 0) {
      in[i] = n;
      i++;
    } else {
      i--;
      out[j] = in[i];
      j++;
      in[i] = 0;
    }
  }

  for (int i = 0; i < j; i++) {
    cout << out[i] << endl;
  }
}
Problem p00013 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  vector<int> car;
  int n;

  while (cin >> n) {
    if (n) {
      car.push_back(n);
    } else {
      cout << car.back() << endl;
      car.pop_back();
    }
  }

  return 0;
}

Error: -11

Fixed submission:

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

int main() {
  vector<int> car;
  int n;

  while (1) {
    if (cin >> n, n) {
      car.push_back(n);
    } else {
      cout << car.back() << endl;
      car.pop_back();
    }
  }

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

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define fi first
#define se second
using namespace std;
bool value(int y, int x, int R, int C) {
  return 0 <= y && y < R && 0 <= x && x < C;
}
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<vi> vvi;
double pie = acos(-1);
int INF = 10000009;
int dx[4] = {0, -1, 0, 1};
int dy[4] = {-1, 0, 1, 0};
int main() {
  int d;
  while (cin >> d) {
    int S = 0;
    for (int i = 1; i * d <= 600 - d; i++) {
      int x = i * d;
      x = x * x;
      x *= d;
      S += x;
    }
    cout << S << endl;
    S = 0;
  }
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define fi first
#define se second
using namespace std;
bool value(int y, int x, int R, int C) {
  return 0 <= y && y < R && 0 <= x && x < C;
}
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<vi> vvi;
double pie = acos(-1);
int INF = 10000009;
int dx[4] = {0, -1, 0, 1};
int dy[4] = {-1, 0, 1, 0};
int main() {
  int d;
  while (true) {
    cin >> d;
    int S = 0;
    for (int i = 1; i * d <= 600 - d; i++) {
      int x = i * d;
      x = x * x;
      x *= d;
      S += x;
    }
    cout << S << endl;
    S = 0;
  }
}
Problem p00014 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#define WIDTH 600
using namespace std;

int func(int x, int d) { return x * x * d; }

int main() {
  int d;
  while (cin >> d) {
    unsigned int S = 0;
    for (int i = 0; i < WIDTH; i += d) {
      S += func(i, d);
    }
    cout << S << endl;
  }
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

double func(double d, double x) { return d * x * x; }

int main() {
  while (1) {
    double s = 0, d;
    cin >> d;
    for (double i = d; i < 600; i += d) {
      s += func(d, i);
    }
    cout << s;
  }
}
Problem p00014 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>

int main() {
  int d, i;
  while (scanf("%d", &d) != EOF) {
    if (d == 0)
      break;
    long int total = 0;
    for (i = d; i < 600; i += d) {
      total = total + i * i * d;
    }
    printf("%ld\\n", total);
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <stdio.h>

int main() {
  int d, i;
  while (scanf("%d", &d) != NULL) {
    if (d == 0)
      break;
    int tmp = d, total = 0;
    for (i = tmp; i < 600; i += d) {
      total = total + i * i * d;
    }
    printf("%d\\n", total);
  }
  return 0;
}
Problem p00014 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <math.h>

using namespace std;

double y(double x) {
  double y;
  y = x * x;
  return y;
}

int main() {
  int i, d, s;
  while (cin >> d) {
    s = 0;
    for (i = 0; i < 600; i += d) {
      s += d * y(i);
    }
    cout << s << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <math.h>

using namespace std;

double y(double x) {
  double y;
  y = x * x;
  return y;
}

int main() {
  int i, d, s;
  while (cin >> d) {
    s = 0;
    for (i = 0; i < 600; i += d) {
      s += d * y(i);
    }
    cout << s << endl;
  }
  while (1)
    ;
  return 0;
}
Problem p00014 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cstdlib>
#include <iostream>

inline int f(int x) { return x * x; }

int get_input(void) {
  int d;
  std::cin >> d;
  if (std::cin.fail()) {
    exit(0);
  }
  return d;
}

long long unsigned int solve(int d) {
  long long unsigned int acc = 0;
  for (int i = d; i <= 600 - d; i += d) {
    acc += f(i) * d;
  }
  return acc;
}

int main(void) {
  while (true) {
    std::cout << solve(get_input()) << std::endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>

inline int f(int x) { return x * x; }

int get_input(void) {
  int d;
  std::cin >> d;
  return d;
}

long long unsigned int solve(int d) {
  long long unsigned int acc = 0;
  for (int i = d; i <= 600 - d; i += d) {
    acc += f(i) * d;
  }
  return acc;
}

int main(void) {
  while (true) {
    std::cout << solve(get_input()) << std::endl;
  }
  return 0;
}
Problem p00014 (C++) — buggy submission, verdict: Runtime Error

#include <cstdio>
#include <iostream>
#define N 600
int f(int x) { return x * x; }

int main(void) {
  int d, i;
  int sum;
  while (std::cin >> d) {
    sum = 0;
    for (int i = d; i < N; i += d) {
      sum += f(i) * d;
    }
    std::cout << sum << std::endl;
  }
  return 0;
}

Error: -11

Fixed submission:

#include <cstdio>
#include <iostream>
#define N 600
double f(double x) { return x * x; }

int main(void) {
  int d, i;
  double sum;
  while (scanf("%d", d)) {
    sum = 0;
    for (int i = d; i < N; i += d) {
      sum += f(i);
    }
    std::cout << sum << std::endl;
  }
  return 0;
}
Problem p00014 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main(void) {
  int n;
  while (cin >> n) {
    long long res = 0;
    for (int i = 0; i < 600; i += n) {
      res += n * i * i;
    }
    cout << res << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main(void) {
  int n;
  while (cin >> n, n) {
    long long res = 0;
    for (int i = 0; i < 600; i += n) {
      res += n * i * i;
    }
    cout << res << endl;
  }
  return 0;
}
Problem p00014 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>
main() {
  int i, d, s;
  while (scanf("%d", &d) != EOF) {
    s = 0;
    for (i = 0; i < 600 / d; i++) {
      s += (d * ((d * i) * (d * i)));
    }
    printf("%d\\n", s);
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <stdio.h>

int f(int x);

int main(void) {
  int d;
  long s;

  while (scanf("%d", &d)) {
    s = 0;
    for (int i = 0; i < 600 / d; i++) {
      s += d * f(i * d);
    }
    printf("%ld\\n", s);
  }
  return 0;
}

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

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <set>
#include <string>
#include <valarray>
#include <vector>
typedef unsigned long long ull;
typedef long long ll;
#define fst first
#define snd second
#define rep(i, n) for (ull i = 0; i < (n); i++)
#define rep1(i, n) for (ull i = 1; i <= (n); i++)
#define revrep(i, n) for (ull i = (n - 1); i >= 0; i--)
#define all(n) (n).begin(), (n).end()
#define show(x) cout << "debug " << #x << ":" << x << endl;
#define showvec(x)                                                             \\
  cout << endl << "debug " << #x << ";" << endl;                               \\
  for (ull __i = 0; __i < x.size(); __i++) {                                   \\
    for (ull __j = 0; __j < x[0].size(); __j++) {                              \\
      cout << x[__i][__j] << " ";                                              \\
    }                                                                          \\
    cout << endl;                                                              \\
  }                                                                            \\
  cout << endl;
using namespace std;

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

int main() {
  int d;
  while (~scanf("%d\\n", &d)) {
    ll sum = 0;
    for (int x = d; x <= 600 - d; x += d) {
      sum += d * f(x);
    }
    cout << sum << endl;
  }
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <iostream>
#include <set>
#include <string>
#include <valarray>
#include <vector>
typedef unsigned long long ull;
typedef long long ll;
#define fst first
#define snd second
#define rep(i, n) for (ull i = 0; i < (n); i++)
#define rep1(i, n) for (ull i = 1; i <= (n); i++)
#define revrep(i, n) for (ull i = (n - 1); i >= 0; i--)
#define all(n) (n).begin(), (n).end()
#define show(x) cout << "debug " << #x << ":" << x << endl;
#define showvec(x)                                                             \\
  cout << endl << "debug " << #x << ";" << endl;                               \\
  for (ull __i = 0; __i < x.size(); __i++) {                                   \\
    for (ull __j = 0; __j < x[0].size(); __j++) {                              \\
      cout << x[__i][__j] << " ";                                              \\
    }                                                                          \\
    cout << endl;                                                              \\
  }                                                                            \\
  cout << endl;
using namespace std;

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

int main() {
  int d;
  while (true) {
    ll sum = 0;
    cin >> d;
    for (int x = d; x <= 600 - d; x += d) {
      sum += d * f(x);
    }
    cout << sum << endl;
  }
}
Problem p00014 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

using namespace std;

int f(int);

int main() {
  int d, i, s;

  while (cin >> d) {
    s = 0;
    for (i = 1; (i * d) != 600; i++) {
      s += f(i * d) * d;
    }
    cout << s << endl;
  }
}

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

Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

void integral();

int main() {

  while (1) {
    integral();
  }

  return 0;
}

void integral() {

  int i;
  double d, j, s = 0;
  i = 0;
  j = 1;
  cin >> d;

  while (i != 600 - d) {
    s += d * (j * d * j * d);
    i += d;
    j++;
  }

  cout << s << endl;
}