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

#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define REP(i, j) for (int i = 0; i < j; i++)
#define FORN(i, j, k) for (int i = j; i < k; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define vpii vector<pii>
using namespace std;
int f(int n) {
  int ret = 0;
  for (int i = 1; i * i <= n; i++) {
    for (int j = i; j * j <= n; j++) {
      for (int k = j; k * k <= n; k++) {
        if ((i + j) * (i + j) + (i + k) * (i + k) + (j + k) * (j + k) ==
            2 * n) {
          if (i == j && j == k)
            ret++;
          else if (i != j && j != k && i != k)
            ret += 6;
          else
            ret += 3;
        }
      }
    }
  }
  return ret;
}
int main(void) {
  int n;
  cin >> n;
  FORN(i, 1, n + 1) { cout << f(i) << endl; }
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define REP(i, j) for (int i = 0; i < j; i++)
#define FORN(i, j, k) for (int i = j; i < k; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define vpii vector<pii>
using namespace std;
int f(int n) {
  int ret = 0;
  for (int i = 1; i * i <= n; i++) {
    for (int j = 1; j * j <= n; j++) {
      for (int k = 1; k * k <= n; k++) {
        if ((i + j) * (i + j) + (i + k) * (i + k) + (j + k) * (j + k) ==
            2 * n) {
          ret++;
        }
      }
    }
  }
  return ret;
}
int main(void) {
  int n;
  cin >> n;
  FORN(i, 1, n + 1) { cout << f(i) << endl; }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main(void) {
  int N;
  cin >> N;
  int f[10010] = {0};

  int x, y, z;

  for (int i = 1; i <= N; i++) {
    for (x = 1; x * x < i; x++) {
      for (y = 1; x * x + y * y + x * y < i; y++) {
        for (z = 1; x * x + y * y + z * z + x * y + y * z + z * x <= i; z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == i)
            f[i]++;
        }
      }
    }
  }

  for (int i = 1; i <= N; i++) {
    cout << f[i] << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

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

int main(void) {
  int N;
  cin >> N;
  int f[10010] = {0};

  int x, y, z;

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

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
const int INF = 1e9;
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
int a[10010];

int main() {
  cin >> N;

  rep2(i, 1, N / 3) rep2(j, 1, N / 3) rep2(k, 1, N / 3) {
    A = i * (i + j);
    B = j * (j + k);
    C = k * (k + i);

    A += B + C;
    if (A <= 10000)
      a[A]++;
    else
      break;
  }
  rep2(i, 1, N + 1) { cout << a[i] << endl; }
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
const int INF = 1e9;
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
int a[10010];

int main() {
  cin >> N;

  rep2(i, 1, N / 3) rep2(j, 1, N / 3) rep2(k, 1, N / 3) {
    A = i * (i + j);
    B = j * (j + k);
    C = k * (k + i);

    A += B + C;
    if (A <= 10000)
      a[A]++;
  }
  rep2(i, 1, N + 1) { cout << a[i] << endl; }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int n;
  cin >> n;
  int ans[10001] = {0};

  for (int i = 1; i < 105; i++) {
    for (int j = 1; j < 105; j++) {
      for (int k = 1; k < 105; k++) {
        int h = i * i + j * j + k * k + i * j + j * k + k * i;
        if (h <= 10000)
          ans[h]++;
      }
    }
  }
  for (int c = 0; c < n; c++) {
    cout << ans[c + 1] << endl;
  }

  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int n;
  cin >> n;
  int ans[n];

  for (int h = 0; h < n; h++) {
    ans[h] = 0;
    for (int i = 1; i < n; i++) {
      for (int j = 1; j < n; j++) {
        for (int k = 1; k < n; k++) {
          if (i * i + j * j + k * k + i * j + j * k + k * i == h + 1)
            ans[h] += 1;
        }
      }
    }
  }
  for (int c = 0; c < n; c++) {
    cout << ans[c] << endl;
  }

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

#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long double PI = acos(-1);
typedef long long int ll;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define fo(i, n) for (int i = 0; i < (int)n; i++)
#define fo1(i, n) for (int i = 1; i <= (int)n; i++)
#define deb(x) cout << #x << "=" << x << endl

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tc = 1;
  vector<int> x;
  int c = 0;
  fo1(i, 100) {
    fo1(j, 100) {
      fo1(k, 100) {
        c = (i * i + j * j + k * k + i * j + i * k + j * k);
        if (c <= 10000)
          x.push_back(c);
      }
    }
  }
  cin >> tc;
  fo1(t, tc) cout << count(all(x), t) << "\\n";
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long double PI = acos(-1);
typedef long long int ll;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define fo(i, n) for (int i = 0; i < (int)n; i++)
#define fo1(i, n) for (int i = 1; i <= (int)n; i++)
#define deb(x) cout << #x << "=" << x << endl

void solve(int n) {
  int c = 0;
  fo1(i, 100) {
    fo1(j, 100) {
      fo1(k, 100) {
        if ((i * i + j * j + k * k + i * j + i * k + j * k) == n)
          c++;
      }
    }
  }
  cout << c << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tc = 1;
  cin >> tc;
  fo1(t, tc) { solve(t); }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<int, int> p;
  for (int i = 1; i <= 99; i++) {
    for (int j = 1; j <= 99; j++) {
      for (int k = 1; k <= 99; k++) {
        int temp = i * i + j * j + k * k + i * j + i * k + j * k;
        if (temp <= n)
          p[temp]++;
      }
    }
  }
  for (int i = 1; i <= n; i++)
    cout << p[i] << endl;
}

Error: TLE

Fixed submission:

#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int ans = 0;
    for (int j = 1; j <= 99; j++) {
      for (int k = 1; k <= 99; k++) {
        for (int l = 1; l <= 99; l++) {
          if (j * j + k * k + l * l + j * k + j * l + k * l == i)
            ans++;
        }
      }
    }
    cout << ans << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007; // 998244353;

template <class _T> static void get(_T &a) { std::cin >> a; }
template <class _T> static void get(_T &a, _T &b) { std::cin >> a >> b; }
template <class _T> static void get(_T &a, _T &b, _T &c) {
  std::cin >> a >> b >> c;
}

static void C();

int main() {
  C();
  fflush(stdout);
  return 0;
}

static void C() {
  int N;
  get(N);

  std::vector<int> fn(N, 0);

  for (int x = 1; x < N; x++) {
    for (int y = 1; x * x + y * y < N; y++) {
      for (int z = 1; x * x + y * y + z * z + x * y + y * z + z * x <= N; z++) {
        int a = x * x + y * y + z * z + x * y + y * z + z * x;
        fn[a - 1]++;
      }
    }
  }

  for (int i = 0; i < N; i++) {
    printf("%d\\n", fn[i]);
  }
}


Error: TLE

Fixed submission:

#include <algorithm>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007; // 998244353;

template <class _T> static void get(_T &a) { std::cin >> a; }
template <class _T> static void get(_T &a, _T &b) { std::cin >> a >> b; }
template <class _T> static void get(_T &a, _T &b, _T &c) {
  std::cin >> a >> b >> c;
}

static void C();

int main() {
  C();
  fflush(stdout);
  return 0;
}

static void C() {
  int N;
  get(N);

  std::vector<int> fn(N, 0);
  for (int n = 1; n <= N; n++) {
    for (int x = 1; x < n; x++) {
      for (int y = 1; (x * x + y * y) < n; y++) {
        for (int z = 1; (z * z + x * x + y * y) < n; z++) {
          int a = x * x + y * y + z * z + x * y + y * z + z * x;
          if (a == n) {
            fn[n - 1]++;
          }
        }
      }
    }
  }
  for (int i = 0; i < N; i++) {
    printf("%d\\n", fn[i]);
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
#include <vector>
int main() {
  int n;
  cin >> n;
  vector<int> cnt(1e4 + 5);
  for (int x = 1; x <= 105; x++)
    for (int y = 1; y <= 105; y++)
      for (int z = 1; z <= 101; z++)
        if (x * x + y * y + z * z + x * y + y * z + z * x < 1e4 + 5)
          cnt[x * x + y * y + z * z + x * y + y * z + z * x]++;
  for (int i = 1; i <= n; i++) {
    cout << cnt[i] << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  ios::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(NULL);

  int n;
  cin >> n;
  int req[1000000];

  for (int x = 1; x <= n; ++x) {
    for (int y = 1; y <= n; ++y) {
      for (int z = 1; z <= n; ++z) {
        int l = x * x + y * y + z * z + x * y + y * z + z * x;

        if (l <= n)
          req[l]++;
      }
    }
  }

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

#include <bits/stdc++.h>
using namespace std;
#define lld long long int
#define mod 1000000007
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  lld n, i, j, i1, k, s;
  cin >> n;
  unordered_map<lld, lld> mp;
  for (i = 1; i <= 100; i++) {
    for (j = 1; j <= 100; j++) {
      for (k = 1; k <= 100; k++) {
        mp[(i * i + j * j + k * k + i * j + j * k + k * i)]++;
      }
    }
  }
  for (i = 1; i <= n; i++) {
    cout << mp[i] << "\\n";
  }
  return 0;
}


Error: -8

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define lld long long int
#define mod 1000000007
unsigned lld countSetBits(lld n) {
  unsigned lld count = 0;
  while (n) {
    n &= (n - 1);
    count++;
  }
  return count;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  lld n, i, z1, k = 0, l, z = 0, zz;
  cin >> n;
  string s;
  cin >> s;
  for (i = n - 1; i >= 0; i--) {
    if (s[i] == '1') {
      k++;
      z += (lld)pow(2, (n - 1) - i);
    }
  }
  for (i = 0; i < n; i++) {
    l = 0;
    zz = k;
    z1 = z;
    if (s[i] == '0') {
      zz++;
      z1 += (lld)pow(2, (n - 1 - i));
    } else {
      zz--;
      z1 -= (lld)pow(2, (n - 1 - i));
    }
    while (z1 > 0) {
      z1 = z1 % zz;
      zz = countSetBits(z1);
      l++;
    }
    cout << l << "\\n";
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll, lvector, greater<ll>>
#define P pair<ll, ll>
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  map<ll, ll> ans;
  for (ll x = 1; x < 101; x++)
    for (ll y = 1; y < 101; y++)
      for (ll z = 1; z < 101; z++)
        ans[x * x + y * y + z * z + x * y + y * z + z * x]++;
  rep(i, n) print(ans[i + 1]);
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll, lvector, greater<ll>>
#define P pair<ll, ll>
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n, ans;
  cin >> n;
  for (ll i = 1; i <= n; ++i) {
    ans = 0;
    for (ll x = 1; x < 101; x++)
      for (ll y = 1; y < 101; y++)
        for (ll z = 1; z < 101; z++)
          if (x * x + y * y + z * z + x * y + y * z + z * x == i)
            ans++;
    print(ans);
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cstdio>
int f(int n) {
  int count = 0;
  for (int x = 1; x * x < n; x++) {
    for (int y = 1; x * x + y * y + x * y < n; y++) {
      for (int z = 1; x * x + y * y + z * z + x * y + y * z + x * z <= n; z++) {
        if (x * x + y * y + z * z + x * y + y * z + x * z == n)
          count++;
      }
    }
  }
  return count;
}

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int ans = f(i);
    printf("%d\\n", ans);
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <math.h>
#include <stdio.h>
#include <string.h>
int f(int);
int main() {
  int n;
  while (~scanf("%d", &n)) {
    for (int i = 1; i <= n; i++) {
      printf("%d\\n", f(i));
    }
  }
  return 0;
}
int f(int x) {
  int count = 0;
  for (int i = 1; i <= sqrt(x); i++) {
    for (int j = 1; j <= sqrt(x); j++) {
      for (int z = 1; z <= sqrt(x); z++) {
        if (pow(i, 2) + pow(j, 2) + pow(z, 2) + i * j + j * z + z * i == x) {
          count++;
        }
      }
    }
  }
  return count;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define ll_MAX LONG_LONG_MAX
#define ll_MIN LONG_LONG_MIN
#define pi pair<int, int>
#define endl "\\n"
#define MAXN 100005
#define mod 1000000007
using namespace std;

void solve() {}
ll counter[120001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  ll n;
  cin >> n;
  if (n == 1) {
    cout << 0 << '\\n';
    return 0;
  }
  cout << 0 << '\\n';
  cout << 0 << '\\n';
  ll res = (ll)ceil(sqrt(n - 2));
  ll ans = 0;
  for (ll i = 1; i <= 100; i++) {
    for (ll j = 1; j <= 100; j++) {
      for (ll k = 1; k <= 100; k++) {
        ll sum = i * i + j * j + k * k + i * j + k * i + k * j;
        counter[sum]++;
      }
    }
  }
  for (ll i = 3; i <= n; i++) {
    cout << counter[i] << '\\n';
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define ll_MAX LONG_LONG_MAX
#define ll_MIN LONG_LONG_MIN
#define pi pair<int, int>
#define endl "\\n"
#define MAXN 100005
#define mod 1000000007
using namespace std;

void solve() {}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  ll n;
  cin >> n;
  if (n == 1) {
    cout << 0 << '\\n';
    return 0;
  }
  cout << 0 << '\\n';
  cout << 0 << '\\n';
  for (ll num = 3; num <= n; num++) {
    ll res = (ll)ceil(sqrt(n - 2));
    ll ans = 0;
    for (ll i = 1; i <= res; i++) {
      for (ll j = 1; j <= res; j++) {
        for (ll k = 1; k <= res; k++) {
          ll sum = (i + j) * (i + j) + (j + k) * (j + k) + (k + i) * (k + i);
          if (sum == 2 * num) {
            ans++;
          }
        }
      }
    }
    cout << ans << '\\n';
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int N;
  cin >> N;
  int ans[100000];

  for (int i = 1; i * i < N; i++) {
    for (int j = 1; j * j < N; j++) {
      for (int k = 1; k * k < N; k++) {
        int total = i * i + j * j + k * k + j * k + j * i + i * k;
        ans[total]++;
      }
    }
  }
  for (int i = 1; i <= N; i++) {
    cout << ans[i] << endl;
  }
}


Error: TLE

Fixed submission:

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

int main() {
  int N;
  cin >> N;
  int cnt;

  for (int h = 1; h <= N; h++) {
    cnt = 0;
    for (int i = 1; i * i < N / 2; i++) {
      for (int j = 1; j * j < N / 2; j++) {
        for (int k = 1; k * k < N / 2; k++) {
          int total = (i + j) * (i + j) + (j + k) * (k + j) + (i + k) * (i + k);
          if (total == 2 * h)
            cnt++;
        }
      }
    }
    cout << cnt << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int N;
  cin >> N;
  int f[N];
  int v;

  for (int i = 0; i < N; i++) {
    f[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++) {
        v = x * x + y * y + z * z + x * y + y * z + z * x;
        if (N >= v) {
          f[v - 1]++;
        }
      }
    }
  }

  for (int i = 0; i < N; i++) {
    cout << f[i] << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

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

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

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

int main() {
  int N;
  cin >> N;
  vector<long long> ans(N, 0);
  int x = 1;
  int y = 1;
  int z = 1;

  for (x = 1; x * x + y * y + z * z + x * y + y * z + z * x <= N; x++) {
    for (y = 1; x * x + y * y + z * z + x * y + y * z + z * x <= N; y++) {
      for (z = 1; x * x + y * y + z * z + x * y + y * z + z * x <= N; z++) {
        ans.at(x * x + y * y + z * z + x * y + y * z + z * x - 1)++;
      }
      z = 1;
    }
    y = 1;
  }
  x = 1;

  for (int i = 0; i < N; i++) {
    cout << ans.at(i) << endl;
  }
}


Error: TLE

Fixed submission:

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

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

  vector<long long> ans(N, 0);

  for (int i = 1; i <= N; i++) {
    for (int x = 1; x <= 100; x++) {
      if (x * x > 10001)
        break;
      for (int y = 1; y <= 100; y++) {
        if (x * x + y * y + x * y > 10001)
          break;
        for (int z = 1; z <= 100; z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x > 10001)
            break;
          if (x * x + y * y + z * z + x * y + y * z + z * x == i) {
            ans.at(i - 1)++;
          }
        }
      }
    }
  }

  for (int i = 0; i < N; i++) {
    cout << ans.at(i) << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
using namespace std;

void solve() {}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i * i <= n; i++) {
    for (int j = 1; j * j <= n; j++) {
      for (int k = 1; k * k <= n; k++) {
        int m = i * i + j * j + k * k + i * j + j * k + i * k;
        if (m <= n) {
          a[m]++;
        }
      }
    }
  }
  rep(i, n) { cout << a[i + 1] << endl; }

  return 0;
}

Error: 0

Fixed submission:

#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
using namespace std;

void solve() {}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i * i <= n; i++) {
    for (int j = 1; j * j <= n; j++) {
      for (int k = 1; k * k <= n; k++) {
        int m = i * i + j * j + k * k + i * j + j * k + i * k;
        a[m]++;
      }
    }
  }
  rep(i, n) { cout << a[i + 1] << endl; }

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

#include <bits/stdc++.h>

using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
// rep…「0からn-1まで」の繰り返し
#define rep2(i, s, n) for (long long i = s; i <= (long long)(n); i++)
// rep2…「sからnまで」の繰り返し
#define repr(i, s, n) for (long long i = s; i >= (long long)(n); i--)
// repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const int inf = 1e9 + 7;
const int mod = 1e9 + 7;

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

  vector<int> res(1000000);

  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      for (int k = 1; k <= 100; k++) {
        res[i * i + j * j + k * k + i * j + j * k + k * i]++;
      }
    }
  }

  rep2(i, 1, n) cout << res[i] << endl;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>

using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
// rep…「0からn-1まで」の繰り返し
#define rep2(i, s, n) for (long long i = s; i <= (long long)(n); i++)
// rep2…「sからnまで」の繰り返し
#define repr(i, s, n) for (long long i = s; i >= (long long)(n); i--)
// repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const int inf = 1e9 + 7;
const int mod = 1e9 + 7;

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

  vector<int> res(10001);

  for (int i = 1; i * i <= n; i++) {
    for (int j = 1; j * j <= n; j++) {
      for (int k = 1; k * k <= n; k++) {
        res[i * i + j * j + k * k + i * j + j * k + k * i]++;
      }
    }
  }

  rep2(i, 1, n) cout << res[i] << endl;
}