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

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

int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    int i, j, k;
    int q;
    int f[10001];
    memset(f, 0, sizeof(f));
    q = sqrt(n);
    for (i = 1; i <= q; i++) {
      for (j = 1; j <= q; j++) {
        for (k = 1; k <= q; k++) {
          int d = i * i + j * j + k * k + i * j + j * k + i * k;
          if (d <= 10000) {
            f[d]++;
          }
        }
      }
    }
    for (i = 1; i <= n; i++) {
      printf("%d\\n", f[i]);
    }
    printf("\\n");
  }
  return (0);
}


Error: WA

Fixed submission:

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

int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    int i, j, k;
    int q;
    int f[10001];
    memset(f, 0, sizeof(f));
    q = sqrt(n);
    for (i = 1; i <= q; i++) {
      for (j = 1; j <= q; j++) {
        for (k = 1; k <= q; k++) {
          int d = i * i + j * j + k * k + i * j + j * k + i * k;
          f[d]++;
        }
      }
    }
    for (i = 1; i <= n; i++) {
      printf("%d\\n", f[i]);
    }
    printf("\\n");
  }
  return (0);
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int main() {
  int N, x, y, z, i;
  cin >> N;
  int count[1000000];
  for (i = 1; i <= N; i++) {
    count[i] = 0;
  }
  for (x = 1; x <= 100; ++x) {
    for (y = 1; y <= 100; ++y) {
      for (z = 1; z <= 100; ++z) {
        count[x * x + y * y + z * z + x * y + x * z + y * z]++;
      }
    }
  }
  for (i = 1; i <= N; ++i) {
    cout << count[i] << endl;
  }
  return 0;
}


Error: 0

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int N, x, y, z, i;
  cin >> N;
  int count[1000000];
  for (i = 1; i <= N; i++) {
    count[i] = 0;
  }
  for (x = 1; x <= N; ++x) {
    for (y = 1; y <= N; ++y) {
      for (z = 1; z <= N; ++z) {
        count[x * x + y * y + z * z + x * y + x * z + y * z]++;
      }
    }
  }
  for (i = 1; i <= N; ++i) {
    cout << count[i] << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); ++(i))

const int INF = 1001001001;

int main() {
  int n;
  cin >> n;
  vector<int> vec1(n);
  int temp;
  int count = 0;
  double sn = sqrt(n);
  for (int i = 1; i < sn; i++) {
    for (int j = i; j < sn; j++) {
      for (int k = j; k < sn; k++) {
        temp = i * i + j * j + k * k + i * j + j * k + i * k;
        if (i <= j && j <= k) {
          if (temp <= n) {
            if (i == j && j == k) {
              vec1[temp - 1]++;
            } else if (i == j || j == k || k == i) {
              vec1[temp - 1] += 3;
            } else {
              vec1[temp - 1] += 6;
            }
          }
        }
      }
    }
  }
  rep(i, n) cout << vec1[i] << endl;

  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); ++(i))

const int INF = 1001001001;

int main() {
  int n;
  cin >> n;
  vector<int> vec1(n);
  int temp;
  int count = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      for (int k = j; k <= n; k++) {
        temp = i * i + j * j + k * k + i * j + j * k + i * k;
        if (i <= j && j <= k) {
          if (temp <= n) {
            if (i == j && j == k) {
              vec1[temp - 1]++;
            } else if (i == j || j == k || k == i) {
              vec1[temp - 1] += 3;
            } else {
              vec1[temp - 1] += 6;
            }
          }
        }
      }
    }
  }
  rep(i, n) cout << vec1[i] << endl;

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

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

int main() {
  int N, b;
  cin >> N;
  b = pow(N, 1.0 / 2.0) / 1 + 1;
  vector<int> vec(N * 10000);
  for (int i = 1; i < b + 1; i++) {
    for (int j = 1; j < b + 1; j++) {
      for (int k = 1; k < b + 1; k++) {
        vec.at(i * i + j * j + k * k + i * j + j * k + k * i - 1)++;
      }
    }
  }
  vec.erase(vec.begin() + N, vec.begin() + N * 10000);
  for (int i = 0; i < N; i++) {
    cout << vec.at(i) << endl;
  }
}

Error: 0

Fixed submission:

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

int main() {
  int N, b;
  cin >> N;
  b = N / 3;
  vector<int> vec(N * 100);
  for (int i = 1; i < b + 1; i++) {
    for (int j = 1; j < b + 1; j++) {
      for (int k = 1; k < b + 1; k++) {
        vec.at(i * i + j * j + k * k + i * j + j * k + k * i - 1)++;
      }
    }
  }
  vec.erase(vec.begin() + N, vec.begin() + N * 100);
  for (int i = 0; i < N; i++) {
    cout << vec.at(i) << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int n;
  cin >> n;

  int x, y, z = 1;
  int count = 0;
  int x2 = 0;
  int y2 = 0;
  int xy = 0;

  for (int i = 1; i <= n; ++i) {
    while (true) {
      x2 = x * x;
      while (true) {
        y2 = y * y;
        xy = x * y;
        while (true) {
          int test = x2 + y2 + z * z + xy + x * z + y * z;
          if (test == i) {
            ++count;
            z = 1;
            break;
          } else if (test > i) {
            z = 1;
            break;
          }
          ++z;
        }
        if (y * y >= i) {
          y = 1;
          break;
        }
        ++y;
      }
      if (x * x >= i) {
        x = 1;
        break;
      }
      ++x;
    }
    cout << count << endl;
    count = 0;
  }
  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  int n;
  cin >> n;

  int x, y, z = 1;
  int count = 0;

  for (int i = 1; i <= n; ++i) {
    while (true) {
      while (true) {
        while (true) {
          int test = x * x + y * y + z * z + x * y + x * z + y * z;
          if (test == i) {
            ++count;
            z = 1;
            break;
          } else if (test > i) {
            z = 1;
            break;
          }
          ++z;
        }
        if (y * y >= i) {
          y = 1;
          break;
        }
        ++y;
      }
      if (x * x >= i) {
        x = 1;
        break;
      }
      ++x;
    }
    cout << count << endl;
    count = 0;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int i, n, k, j, u;
int a[10010];
int main() {
  cin >> n;
  for (i = 1; i < sqrt(n); i++) {
    for (j = 1; j < sqrt(n); j++) {
      for (k = 1; k < sqrt(n); k++) {
        u = pow(i, 2) + pow(j, 2) + pow(k, 2) + i * j + i * k + j * k;
        if (u <= n)
          a[u]++;
      }
    }
  }
  for (i = 1; i <= n; i++)
    cout << a[i] << endl;
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int i, n, k, j, u;
int a[1010];
int main() {
  cin >> n;
  for (i = 1; i < sqrt(n); i++) {
    for (j = 1; j < sqrt(n); j++) {
      for (k = 1; k < sqrt(n); k++) {
        u = pow(i, 2) + pow(j, 2) + pow(k, 2) + i * j + i * k + j * k;
        if (u <= n)
          a[u]++;
      }
    }
  }
  for (i = 1; i <= n; i++)
    cout << a[i] << endl;
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

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

using namespace std;
using ll = long long;
const ll INF = 100000000;

int main() {
  int n;
  cin >> n;
  int x, y, z;
  int res = 0;
  for (int i = 1; i <= n; ++i) {
    if (i < 6) {
      cout << 0 << endl;
      continue;
    }

    for (int j = 1; 2 < i - j * j - 2 * j; ++j) {
      for (int k = 1; k <= j; ++k) {
        for (int l = 1; l <= k; ++l) {
          if (i == (j + k + l) * (j + k + l) - (j * k + j * l + k * l)) {
            if (j == k && j == l && k == l) {
              res++;
            } else if (j == k || j == l || k == l) {
              res += 3;
            } else {
              res += 6;
            }
            break;
          }
        }
      }
    }
    cout << res << endl;
    res = 0;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>

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

using namespace std;
using ll = long long;
const ll INF = 100000000;

int main() {
  int n;
  cin >> n;
  int x, y, z;
  int res = 0;
  for (int i = 1; i <= n; ++i) {
    if (i < 6) {
      cout << 0 << endl;
      continue;
    }

    for (int j = 1; j < i; ++j) {
      for (int k = 1; k < i; ++k) {
        for (int l = 1; l < i; ++l) {
          if (i == (j + k + l) * (j + k + l) - (j * k + j * l + k * l)) {
            res++;
          }
        }
      }
    }
    cout << res << endl;
    res = 0;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
using namespace std;
int f[10010];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      for (int k = 1; k <= 100; k++) {
        long long sum = i * i + j * j + k * k + i * j + i * k + j * k;
        if (sum <= n)
          f[(int)sum]++;
      }
    }
  }
  for (int i = 1; i <= n; i++)
    printf("%d\\n", f[i]);
  return 0;
}

Error: 0

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
using namespace std;
int f[1010];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      for (int k = 1; k <= 100; k++) {
        long long sum = i * i + j * j + k * k + i * j + i * k + j * k;
        if (sum <= n)
          f[(int)sum]++;
      }
    }
  }
  for (int i = 1; i <= n; i++)
    printf("%d\\n", f[i]);
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define INF 1000000000000
#define MOD 10000007
typedef long long ll;
//

int main() {
  ll n;
  cin >> n;
  ll a = sqrt(n) - 1;

  FOR(t, 1, n) {
    ll ans = 0;
    FOR(i, 1, a) {
      FOR(j, 1, i) {
        FOR(k, 1, j) {
          if (i * i + j * j + k * k + i * j + j * k + k * i == t) {
            if (i == j && j == k && k == i)
              ans++;
            else if (i == j || j == k || k == i)
              ans += 3;
            else
              ans += 6;
          }
        }
      }
    }
    cout << ans << endl;
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define INF 1000000000000
#define MOD 10000007
typedef long long ll;
//

int main() {
  ll n;
  cin >> n;
  ll a = sqrt(n);

  FOR(t, 1, n) {
    ll ans = 0;
    FOR(i, 1, a) {
      FOR(j, 1, a) {
        FOR(k, 1, a) {
          if (i * i + j * j + k * k + i * j + j * k + k * i == t)
            ans++;
        }
      }
    }
    cout << ans << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long int;
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
ll mod = 1e9 + 7;

int f(int x, int y, int z) {
  return x * x + y * y + z * z + x * y + y * z + z * x;
}

int main() {
  int n;
  cin >> n;
  int a[100000] = {};
  for (int x = 1; x < 100; x++) {
    for (int y = 1; y < 100; y++) {
      for (int z = 1; z < 100; z++) {
        a[f(x, y, z)]++;
      }
    }
  }

  for (int i = 1; i <= n; i++) {
    cout << a[i] << endl;
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long int;
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
ll mod = 1e9 + 7;

int f(int x, int y, int z) {
  return x * x + y * y + z * z + x * y + y * z + z * x;
}

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int ans = 0;
    int d = (int)sqrt(n);
    for (int x = 1; x <= d; x++) {
      for (int y = 1; y <= d; y++) {
        for (int z = 1; z <= d; z++) {
          if (f(x, y, z) == i)
            ans++;
        }
      }
    }
    cout << ans << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww {
  cww() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  }
} star;
const long long INF = numeric_limits<long long>::max();
int main() {
  int N;
  cin >> N;
  // 愚直に探す
  // N<10000よりx<=y<=zとするとxは最高でも100

  int ans = 0;

  for (int i = 1; i <= N; i++) {
    ans = 0;
    for (int x = 1; x <= 100; x++) {
      for (int y = x; y <= 100; y++) {

        for (int z = y; z <= 100; z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == i) {
            if (x == y && y == z) {
              ans++;
            } else if (x != y && y == z) {
              ans += 3;
            } else if (x == y && y != z) {
              ans += 3;
            } else {
              ans += 6;
            }
          } else if (x * x + y * y + z * z + x * y + y * z + z * x > i) {
            break;
          }
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww {
  cww() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  }
} star;
const long long INF = numeric_limits<long long>::max();
int main() {
  int N;
  cin >> N;
  // 愚直に探す
  // N<10000よりx<=y<=zとするとxは最高でも100

  int ans = 0;

  for (int i = 1; i <= N; i++) {
    ans = 0;
    for (int x = 1; x <= 100; x++) {
      for (int y = x; y <= 100; y++) {

        for (int z = y; z <= 100; z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == i) {
            if (x == y && y == z) {
              ans++;
            } else if (x != y && y == z) {
              ans += 3;
            } else if (x == y && y != z) {
              ans += 3;
            } else {
              ans += 6;
            }
          } else if (x * x + y * y + z * z + x * y + y * z + z * x > i) {
            continue;
          }
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std; // std::の省略のため
using ll = long long;

int main() {

  ll n, a;
  int x, y, z;
  cin >> n;
  vector<int> f(n);

  int i = 0;

  while (i < n) {
    f[i] = 0;
    for (x = 1; x <= sqrt(i + 1); x++) {
      for (y = 1; y <= sqrt(i + 1); y++) {
        for (z = 1; z <= sqrt(i + 1); z++) {
          a = x * x + y * y + z * z + x * y + y * z + z * x;
          if (a == i + 1)
            f[i]++;
          if (a > i + 1)
            break;
        }
      }
    }

    cout << f[i] << endl;
    i++;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std; // std::の省略のため
using ll = long long;

int main() {

  ll n, a;
  int x, y, z;
  cin >> n;
  vector<int> f(n);

  int i = 0;

  while (i < n) {
    f[i] = 0;
    for (x = 1; x <= sqrt(i + 1); x++) {
      for (y = 1; y <= sqrt(i + 1); y++) {
        for (z = 1; z <= sqrt(i + 1); z++) {
          a = x * x + y * y + z * z + x * y + y * z + z * x;
          if (a == i + 1)
            f[i]++;
        }
      }
    }

    cout << f[i] << endl;
    i++;
  }

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

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

int main() {
  int n;
  cin >> n;
  int a[n + 1];
  for (int i = 1; i <= n; i++) {
    a[i] = 0;
  }
  for (int x = 1; x <= sqrt(n); x++) {
    for (int y = 1; y <= sqrt(n); y++) {
      for (int z = 1; z <= sqrt(n); z++) {
        int ans;
        ans = x * x + y * y + z * z + x * y + y * z + z * x;
        if (ans <= n)
          a[ans]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << a[i] << endl;
  }
  return 0;
}

Error: -11

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 1; i <= n; i++) {
    a[i] = 0;
  }
  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        a[x * x + y * y + z * z + x * y + y * z + z * x]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << a[i] << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(), x.end()
#define rep(i, j, n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
//(a+b-1)/b

signed main() {
  ll n;
  cin >> n;
  vl v(1e7);
  for (ll i = 1; i <= 100; i++) {
    for (ll j = 1; j <= 100; j++) {
      for (ll k = 1; k <= 100; k++) {
        ll h = (i + j + k);
        h *= h;
        h -= (i * j) + (j * k) + (i * k);
        if (h <= n)
          v[h]++;
      }
    }
  }
  rep(i, 1, n + 1) { cout << v[i] << endl; }

  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(), x.end()
#define rep(i, j, n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
//(a+b-1)/b

signed main() {
  ll n;
  cin >> n;
  vl v(1e7);
  for (ll i = 1; i <= n; i++) {
    for (ll j = 1; j <= n; j++) {
      for (ll k = 1; k <= n; k++) {
        ll h = (i + j + k);
        h *= h;
        h -= (i * j) + (j * k) + (i * k);
        if (h <= n)
          v[h]++;
      }
    }
  }
  rep(i, 1, n + 1) { cout << v[i] << endl; }

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

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

int n;
vector<int> ans;

void search() {
  for (int x = 1;; ++x) {
    if (x * x > n)
      break;
    for (int y = 1;; ++y) {
      if (x * x + y * y + x * y > n)
        break;
      for (int z = 1;; ++z) {
        int t = x * x + y * y + z * z + x * y + y * z + z * x;
        if (t > n)
          break;
        ++ans[t];
      }
    }
  }
}

int main() {
  cin >> n;
  ans.assign(n + 100, 0);

  search();

  for (int i = 0; i < n; ++i)
    cout << ans[i + 1] << endl;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int search(int n) {
  int res = 0;
  for (int i = 1; i <= 100; ++i) {
    if (i * i > n)
      break;
    for (int j = 1; j <= 100; ++j) {
      if (j * j > n)
        break;
      for (int k = 1; k <= 100; ++k) {
        if (k * k > n)
          break;
        if (i * i + j * j + k * k + i * j + j * k + k * i == n)
          ++res;
      }
    }
  }
  return res;
}

int main() {
  int n;
  cin >> n;

  for (int i = 1; i <= n; ++i) {
    int ans = search(i);
    cout << ans << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int N;
  cin >> N;
  vector<int64_t> f(N);
  for (int i = 0; i < N; i++) {
    f.at(i) = 0;
  }
  for (int j = 1; j < 101; j++) {
    for (int k = 1; k < 101; k++) {
      for (int l = 1; l < 101; l++) {
        if (j * j + k * k + l * l + j * k + k * l + l * j <= N) {
          f.at(j * j + k * k + l * l + j * k + k * l + l * j - 1) =
              f.at(j * j + k * k + l * l + j * k + k * l + l * j - 1) + 1;
        }
      }
    }
  }
  for (int n = 0; n < N; n++) {
    cout << f.at(n) << endl;
  }
}


Error: WA

Fixed submission:

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

int main() {
  int N;
  cin >> N;
  vector<int64_t> f(N);
  for (int i = 0; i < N; i++) {
    f.at(i) = 0;
  }
  for (int j = 1; j < 101; j++) {
    for (int k = 1; k < 101; k++) {
      for (int l = 1; l < 101; l++) {
        if (j * j + k * k + l * l + j * k + k * l + l * j <= N) {
          f.at(j * j + k * k + l * l + j * k + k * l + l * j) =
              f.at(j * j + k * k + l * l + j * k + k * l + l * j) + 1;
        }
      }
    }
  }
  for (int n = 0; n < N; n++) {
    cout << f.at(n) << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <iomanip>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> data(10019, 0);
  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      for (int k = 1; k <= 100; k++) {
        if (i * i + j * j + k * k + i * j + j * k + k * i <= 10007)
          data.at(i * i + j * j + k * k + i * j + j * k + k * i + 1) += 1;
      }
    }
  }
  for (int i = 0; i < N; i++) {
    cout << data.at(i + 2) << endl;
  }
}


Error: -6
terminate called after throwing an instance of 'std::out_of_range'
  what():  vector::_M_range_check: __n (which is 10009) >= this->size() (which is 10009)


Fixed submission:

#include <iomanip>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> data(10009, 0);
  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      for (int k = 1; k <= 100; k++) {
        if (i * i + j * j + k * k + i * j + j * k + k * i <= 10008)
          data.at(i * i + j * j + k * k + i * j + j * k + k * i + 1) += 1;
      }
    }
  }
  for (int i = 0; i < N; i++) {
    cout << data.at(i + 2) << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int64_t MOD = 1000000007;

int main() {
  vector<int> S(10050, 0);
  for (int i = 1; i * i < 10001; i++) {
    for (int j = 1; j * j < 10001; j++) {
      for (int k = 1; k * k < 10001; k++) {
        int64_t a = i * i + j * j + k * k + i * j + j * k + k * i;
        if (a > 10000)
          break;
        S.at(a)++;
      }
    }
  }
  int N;
  cin >> N;
  for (int i = 1; i <= N; i++)
    cout << S.at(i) << endl;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int64_t MOD = 1000000007;

int main() {
  vector<int> S(1050, 0);
  for (int i = 1; i * i < 1001; i++) {
    for (int j = 1; j * j < 1001; j++) {
      for (int k = 1; k * k < 1001; k++) {
        int64_t a = i * i + j * j + k * k + i * j + j * k + k * i;
        if (a > 1000)
          break;
        S.at(a)++;
      }
    }
  }
  int N;
  cin >> N;
  for (int i = 1; i <= N; i++)
    cout << S.at(i) << endl;
}