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

#include <bits/stdc++.h>

using namespace std;

inline int ctoi(char c) {
  if (c < '0' || '9' < c)
    throw invalid_argument("ctoi error");
  return c - '0';
}
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T> inline T gcd(T x, T y) {
  if (x <= 0 || y <= 0)
    throw invalid_argument("gcd error: x <= 0 or y <= 0");

  if (x < y)
    swap(x, y);
  T r = x % y;

  while (r != 0) {
    x = y;
    y = r;
    r = x % y;
  }

  return y;
}
template <typename T> inline T lcm(T x, T y) {
  if (x <= 0 || y <= 0)
    throw invalid_argument("lcm error: x <= 0 or y <= 0");

  return x * y / gcd(x, y);
}

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

  for (int i = 1; i <= n; i++) {
    int ans = 0;

    for (int x = 1; x <= (int)sqrt(n); x++) {
      for (int y = x; y <= (int)sqrt(n); y++) {
        if (i <= x * x + y * y + x * y)
          break;

        for (int z = (int)sqrt(n); y <= z; z--) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == i) {
            // cout << n << " : " << x << " " << y << " " << z << endl;
            if (x == y && y == z && z == x)
              ans++;
            else if (x == y && y != z && z != x || x != y && y == z && z != x ||
                     x != y && y != z && z == x)
              ans += 3;
            else
              ans += 6;

            break;
          } 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;

inline int ctoi(char c) {
  if (c < '0' || '9' < c)
    throw invalid_argument("ctoi error");
  return c - '0';
}
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T> inline T gcd(T x, T y) {
  if (x <= 0 || y <= 0)
    throw invalid_argument("gcd error: x <= 0 or y <= 0");

  if (x < y)
    swap(x, y);
  T r = x % y;

  while (r != 0) {
    x = y;
    y = r;
    r = x % y;
  }

  return y;
}
template <typename T> inline T lcm(T x, T y) {
  if (x <= 0 || y <= 0)
    throw invalid_argument("lcm error: x <= 0 or y <= 0");

  return x * y / gcd(x, y);
}

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

  for (int i = 1; i <= n; i++) {
    int ans = 0;

    for (int x = 1; x <= (int)sqrt(n); x++) {
      for (int y = x; y <= (int)sqrt(n); y++) {
        for (int z = y; z <= (int)sqrt(n); z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == i) {
            // cout << n << " : " << x << " " << y << " " << z << endl;
            if (x == y && y == z && z == x)
              ans++;
            else if (x == y && y != z && z != x || x != y && y == z && z != x ||
                     x != y && y != z && z == x)
              ans += 3;
            else
              ans += 6;
          }
        }
      }
    }

    cout << ans << endl;
  }

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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll e[10000000];
int main() {
  ll n;
  cin >> n;
  for (ll i = 1; i <= 100; i++)
    for (ll j = 1; j <= 100; j++)
      for (ll k = 1; k <= 100; k++)
        e[i * i + j * j + k * k + i * j + i * k + j * k]++;
  for (ll i = 1; i <= n; i++)
    cout << e[i] << endl;
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll e[105];
int main() {
  ll n, cnt;
  cin >> n;
  for (ll ii = 1; ii <= n; ii++) {
    cnt = 0;
    for (ll i = 2; i <= ii * 2; i++)
      for (ll j = i; j <= ii * 2 - i * i - 4; j++)
        for (ll k = j; k * k <= ii * 2 - i * i - j * j; k++) {
          if (i * i + j * j + k * k == ii * 2 && (i + j + k) != 2 * i &&
              (i + j + k) != 2 * j && (i + j + k) != 2 * k) {
            if (i == k)
              cnt += 1;
            else if (i == j)
              cnt += 3;
            else if (j == k)
              cnt += 3;
            else
              cnt += 6;
          }
        }
    cout << cnt << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#include <math.h>
#define ALL(a) a.begin(), a.end()
#define rep(i, K, N) for (long long int i = K; i < N; i++)
#define ll long long int
using namespace std;

int main() {
  ll N;
  cin >> N;
  map<ll, ll> P;

  rep(x, 1, N) {
    if (x * x >= N)
      break;
    rep(y, 1, N) {
      if (y * y >= N)
        break;
      rep(z, 1, N) {
        if (z * z >= N)
          break;
        P[x * x + y * y + z * z + x * y + y * z + x * z]++;
      }
    }
  }

  rep(i, 1, N + 1) cout << P[i] << endl;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <math.h>
#define ALL(a) a.begin(), a.end()
#define rep(i, K, N) for (int i = K; i < N; i++)
#define ll long long int
using namespace std;

int main() {
  ll N;
  cin >> N;
  map<ll, ll> P;
  rep(n, 0, N) {

    rep(x, 1, n) {
      if (x * x >= n)
        break;
      rep(y, 1, n) {
        if (x * x + y * y + x * y >= n)
          break;
        rep(z, 1, n) {

          if (x * x + y * y + z * z + x * y + x * z + y * z == n)
            P[n]++;
        }
      }
    }
  }

  rep(i, 1, N + 1) cout << P[i] << endl;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast                                                                   \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0)
#define pb push_back
#define bg begin()
#define end end()
#define sz size()
#define vi vector<int>
#define vl vector<long long int>
int main() {
  fast;
  ll n;
  cin >> n;
  ll arr[n] = {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 + i * k <= n)
          arr[i * i + j * j + k * k + i * j + j * k + i * k - 1]++;
        else
          break;
      }
  for (int i = 0; i < n; i++)
    cout << arr[i] << endl;
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
// #define f(i,a,n) for(ll i=a;i<n;i++)
#define fast                                                                   \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0)
ll isPrime(int n) {
  // Corner cases
  if (n <= 1)
    return 1;
  if (n <= 3)
    return 2;

  // This is checked so that we can skip
  // middle five numbers in below loop
  if (n % 2 == 0 || n % 3 == 0)
    return 1;

  for (int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0)
      return 1;

  return 2;
}

int main() {
  fast;
  ll t = 1;
  // cin>>t;
  while (t--) {
    ll n, k = 0;
    cin >> n;
    for (ll i = 1; i <= n; i++) {
      k = 0;
      for (ll x = 1; x <= 100; x++) {
        for (ll y = 1; y <= 100; y++) {
          for (ll z = 1; z <= 100; z++) {
            if (x * x + y * y + z * z + x * y + y * z + z * x == i)
              k++;
          }
        }
      }
    x:
      cout << k << 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<int> ans(N + 1);
  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        int tmp = x * x + y * y + z * z + x * y + y * z + z * x;
        if (tmp < N + 1)
          ans.at(tmp)++;
      }
    }
  }
  for (int i = 1; i < N + 1; i++) {
    cout << ans.at(i) << "\\n";
  }
}

Error: TLE

Fixed submission:

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

int main() {
  int N;
  cin >> N;
  for (int n = 1; n <= N; n++) {
    int cnt = 0;
    for (int x = 1; x * x < n; x++) {
      for (int y = 1; x * x + y * y < n; y++) {
        for (int z = 1; x * x + y * y + z * z < n; z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == n)
            cnt++;
        }
      }
    }
    cout << cnt << "\\n";
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

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

  // f(n)の個数を調べる
  for (int i = 1; i <= n; i++) {
    int count = 0;
    // x, y, z全探索してnと合致しているか調べる
    for (int j = 1; j <= 105; j++) {
      for (int k = 1; k <= 105; k++) {
        for (int l = 1; l <= 105; l++) {
          int a = j * j + k * k + l * l + j * k + k * l + l * j;
          if (a == i) {
            // cout << a << n << j << k << l << endl;
            count++;
          } else if (a > i)
            break;
        }
      }
    }
    cout << count << endl;
  }
}

Error: TLE

Fixed submission:

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

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

  // f(n)の個数を調べる
  for (int i = 1; i <= n; i++) {
    int count = 0;
    // x, y, z全探索してnと合致しているか調べる
    for (int j = 1; j <= i; j++) {
      for (int k = 1; k <= i; k++) {
        for (int l = 1; l <= i; l++) {
          int a = j * j + k * k + l * l + j * k + k * l + l * j;
          if (a == i) {
            // cout << a << n << j << k << l << endl;
            count++;
          } else if (a > i)
            break;
        }
      }
    }
    cout << count << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

#define FAST_INP                                                               \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL)

int main() {
  FAST_INP;
  int n;
  cin >> n;
  unordered_map<int, int> ans(n);
  for (int x = 1; x <= 105; x++) {
    for (int y = 1; y <= 105; y++) {
      for (int z = 1; z <= 105; z++) {
        int k = (x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (z * x);
        if (k < 10005) {
          ans[k]++;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << "\\n";
  }
  return 0;
}

Error: TLE

Fixed submission:

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

#define FAST_INP                                                               \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL)
int solve(int n) {
  unordered_map<int, int> ans(n);
  for (int x = 1; x <= 105; x++) {
    for (int y = 1; y <= 105; y++) {
      for (int z = 1; z <= 105; z++) {
        int k = (x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (z * x);
        if (k < 10005) {
          ans[k]++;
        }
      }
    }
  }
  return ans[n];
}

int main() {
  FAST_INP;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cout << solve(i) << "\\n";
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

// 10000以下の全てのnを出す(100 * 100 * 100 > 10000
// より、100ぐらいで十分網羅できる) そのあと指定された分だけ答えを出力する
#include <iostream>
#include <vector>

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

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

  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        int fi = (x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (z * x);
        if (fi <= N) {
          // printf("[%d:%d:%d]%d\\n", x, y, z, fi);
          ans[fi - 1]++;
        }
      }
    }
  }

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

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>

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

  for (int i = 1; i <= N; i++) {
    //        printf("---[%d]---\\n", i);
    int ans = 0;
    int fi = 0;
    for (int x = 1; x <= 100; x++) {
      //            printf("x");
      for (int y = 1; y <= 100; y++) {
        //              printf("y");
        for (int z = 1; z <= 100; z++) {
          fi = (x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (z * x);
          if (fi == i) {
            // printf("[%d:%d:%d]\\n", x, y, z);
            ans++;
            break;
          }
        }
      }
    }
    std::cout << ans << std::endl;
  }
  // printf("end");

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

#include <cmath>
#include <iostream>

using namespace std;

bool is_square(int n) {
  int x = (int)sqrt((double)n);
  return x * x == n;
}

bool z_ok(int n, int x, int y) {
  int b = x + y;
  int c = x * x + y * y + x * y - n;
  int D = b * b - 4 * c;

  if (D < 0) {
    return false;
  }
  if (!is_square(D)) {
    return false;
  }

  int D2 = (int)sqrt((double)D);

  if ((b % 2) != (D2 % 2)) {
    return false;
  }

  int z = -b + D2;

  return z >= 1;
}

int f(int n) {
  int ans = 0;
  for (int x = 1; x * x <= n; ++x) {
    for (int y = 1; x * x + y * y <= n; ++y) {
      if (z_ok(n, x, y)) {
        ++ans;
      }
    }
  }
  return ans;
}

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

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


Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

int f(int n) {
  int ans = 0;
  for (int x = 1; x * x <= n; ++x) {
    for (int y = 1; y * y <= n; ++y) {
      for (int z = 1; z * z <= n; ++z) {
        if (x * x + y * y + z * z + x * y + y * z + z * x == n) {
          ++ans;
        }
      }
    }
  }
  return ans;
}

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

  for (int i = 1; i <= N; ++i) {
    cout << f(i) << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

using namespace std;

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

  long int n;
  cin >> n;
  long int i, j, k, x, cnt = 0;
  long int h[100005] = {0};

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

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

  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

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

  long int n;
  cin >> n;
  long int i, j, k, x, cnt = 0;

  for (x = 1; x <= n; ++x) {
    cnt = 0;
    for (i = 1; i <= 100; ++i) {
      for (j = 1; j <= 100; ++j) {
        for (k = 1; k <= 100; ++k) {
          if (i * i + j * j + k * k + i * j + i * k + j * k == x) {
            cnt++;
          }
        }
      }
    }

    cout << cnt << endl;
  }

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

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

int main() {
  int x, y, z;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int counter = 0;

    for (x = 1; x <= 41; x++) {
      for (y = x; y < 100; y++) {
        for (z = y; z < 100; z++) {
          if (i == x * x + y * y + z * z + x * y + y * z + z * x && x == y &&
              y == z)
            counter = counter + 1;
          else if (i == x * x + y * y + z * z + x * y + y * z + z * x &&
                   x == y && y != z)
            counter = counter + 3;
          else if (i == x * x + y * y + z * z + x * y + y * z + z * x &&
                   x != y && y == z)
            counter = counter + 3;
          else if (i == x * x + y * y + z * z + x * y + y * z + z * x)
            counter = counter + 6;
        }
      }
    }
    cout << counter << endl;
  }
}


Error: TLE

Fixed submission:

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

int main() {
  int x, y, z;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int counter = 0;

    for (x = 1; x < 100; x++) {
      for (y = x; y < 100; y++) {
        for (z = y; z < 100; z++) {
          if (i == x * x + y * y + z * z + x * y + y * z + z * x && x == y &&
              y == z)
            counter = counter + 1;
          else if (i == x * x + y * y + z * z + x * y + y * z + z * x &&
                   x == y && y != z)
            counter = counter + 3;
          else if (i == x * x + y * y + z * z + x * y + y * z + z * x &&
                   x != y && y == z)
            counter = counter + 3;
          else if (i == x * x + y * y + z * z + x * y + y * z + z * x)
            counter = counter + 6;
        }
      }
    }
    cout << counter << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cstring>
#include <iostream>
#include <math.h>
#include <string.h>
#define ll long long
ll gcd(ll a, ll b) {
  ll s = 1, c;
  while (a && b) {
    if ((~a & 1) && (~b & 1))
      a >>= 1, b >>= 1, s <<= 1;
    else if (~a & 1)
      a >>= 1;
    else if (~b & 1)
      b >>= 1;
    else if (a > b)
      a = a - b;
    else
      c = b - a, b = a, a = c;
  }
  if (!a)
    return b * s;
  if (!b)
    return a * s;
}
using namespace std;
int main() {
  int a[10001] = {0};
  int x, y, z;
  for (x = 1; x <= 100; x++)
    for (y = 1; y <= 100; y++)
      for (z = 1; z <= 100; z++)
        if (x * x + y * y + z * z + x * y + x * z + y * z <= 10000)
          a[x * x + y * y + z * z + x * y + x * z + y * z]++;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++)
    cout << a[i] << endl;
  return 0;
}


Error: 0

Fixed submission:

#include <algorithm>
#include <cstring>
#include <iostream>
#include <math.h>
#include <string.h>
#define ll long long
ll gcd(ll a, ll b) {
  ll s = 1, c;
  while (a && b) {
    if ((~a & 1) && (~b & 1))
      a >>= 1, b >>= 1, s <<= 1;
    else if (~a & 1)
      a >>= 1;
    else if (~b & 1)
      b >>= 1;
    else if (a > b)
      a = a - b;
    else
      c = b - a, b = a, a = c;
  }
  if (!a)
    return b * s;
  if (!b)
    return a * s;
}
using namespace std;
int main() {
  int a[1001] = {0};
  int x, y, z;
  for (x = 1; x <= 31; x++)
    for (y = 1; y <= 31; y++)
      for (z = 1; z <= 31; z++)
        if (x * x + y * y + z * z + x * y + x * z + y * z <= 1000)
          a[x * x + y * y + z * z + x * y + x * z + y * z]++;
  int n;
  cin >> n;
  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>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, b, n) for (int i = b; i < (b) + (n); i++)
using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector<int> cnt(n + 1);
  for (int x = 1; x * x <= n; x++)
    for (int y = 1; y * y <= n; y++)
      for (int z = 1; z * z <= n; z++) {
        int t = x * x + y * y + z * z + x * y + y * z + z * x;
        if (t <= n)
          cnt[t]++;
      }
  REP(i, 1, n) { cout << cnt[i] << endl; }
}

Error: TLE

Fixed submission:

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

int f(int n) {
  int cnt = 0;
  for (int x = 1; x * x <= n; x++) {
    for (int y = 1; y * y <= n - x * x; y++) {
      for (int z = 1; z * z <= n - (x * x + y * y + x * y); z++) {
        if (x * x + y * y + z * z + x * y + y * z + z * x == n)
          cnt++;
      }
    }
  }
  return cnt;
}

int main() {
  int n;
  cin >> n;
  REP(i, 1, n) { cout << f(i) << endl; }
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define vlli vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vplli vector<pair<ll, ll>>
#define plli pair<ll, ll>
#define vps vector<pair<string, string>>
#define vpi vector<pair<int, int>>
#define all(x) x.begin(), x.end()
#define fast                                                                   \\
  ios::sync_with_stdio(false);                                                 \\
  cin.tie(0);                                                                  \\
  cout.tie(0)
#define forn(i, a, n) for (ll i = a; i < n; i++)
#define scan(arr, a, n)                                                        \\
  for (ll i = (a); i < (n); i++)                                               \\
    cin >> (arr)[i];
#define print(arr, a, n)                                                       \\
  for (ll i = (a); i < (n); i++)                                               \\
    cout << (arr)[i] << " ";

int main() {
  fast;
  ll ans = 0, n;
  cin >> n;
  ll a[n + 2] = {};
  forn(i, 1, 101) {
    forn(j, 1, 101) {
      forn(k, 1, 101) {
        ll z = i * i + j * j + k * k + i * j + j * k + k * i;
        if (z <= n) {
          a[z]++;
        }
      }
    }
  }
  forn(i, 1, n + 1) { cout << a[i] << endl; }
}

Error: -11

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define vlli vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vplli vector<pair<ll, ll>>
#define plli pair<ll, ll>
#define vps vector<pair<string, string>>
#define vpi vector<pair<int, int>>
#define all(x) x.begin(), x.end()
#define fast                                                                   \\
  ios::sync_with_stdio(false);                                                 \\
  cin.tie(0);                                                                  \\
  cout.tie(0)
#define forn(i, a, n) for (ll i = a; i < n; i++)
#define scan(arr, a, n)                                                        \\
  for (ll i = (a); i < (n); i++)                                               \\
    cin >> (arr)[i];
#define print(arr, a, n)                                                       \\
  for (ll i = (a); i < (n); i++)                                               \\
    cout << (arr)[i] << " ";

int main() {
  fast;
  ll ans = 0, n;
  cin >> n;
  ll a[10002] = {};
  forn(i, 1, 101) {
    forn(j, 1, 101) {
      forn(k, 1, 101) {
        ll z = i * i + j * j + k * k + i * j + j * k + k * i;
        a[z]++;
      }
    }
  }
  forn(i, 1, n + 1) { cout << a[i] << endl; }
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

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

int n, ans[10001];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  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 val = i * i + j * j + k * k + i * j + j * k + i * k;
        if (val <= n)
          ans[val]++;
      }
  for (int i = 1; i <= n; i++)
    cout << ans[i] << '\\n';
  return 0;
}


Error: 0

Fixed submission:

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

int n, ans[10001];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 1; i * i <= n; i++)
    for (int j = 1; j * j <= n; j++)
      for (int k = 1; k * k <= n; k++)
        ans[i * i + j * j + k * k + i * j + j * k + i * k]++;
  for (int i = 1; i <= n; i++)
    cout << ans[i] << '\\n';
  return 0;
}