prithivMLmods/Coder-Stat huggingface dataset:
Problem p02608 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
#include <stdio.h>
#include <vector>

using ll = long long int;
const int INF = (1 << 30);
const ll INFLL = (1ll << 60);
const ll MOD = (ll)(1e9 + 7);

#define l_ength size

void mul_mod(ll &a, ll b) {
  a *= b;
  a %= MOD;
}

void add_mod(ll &a, ll b) {
  a = (a < MOD) ? a : (a - MOD);
  b = (b < MOD) ? b : (b - MOD);
  a += b;
  a = (a < MOD) ? a : (a - MOD);
}

ll ans[1111];

int main(void) {
  ll n, x, y, z, i;
  std::cin >> n;
  for (x = 1ll; x <= 200ll; ++x) {
    for (y = 1ll; y <= 200ll; ++y) {
      for (z = 1ll; z <= 200ll; ++z) {
        i = x * x + y * y + z * z + x * y + y * z + z * x;
        if (i <= n) {
          ++ans[i];
        }
      }
    }
  }
  for (i = 1ll; i <= n; ++i) {
    std::cout << ans[i] << std::endl;
  }
  return 0;
}


Fixed submission:
#include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
#include <stdio.h>
#include <vector>

using ll = long long int;
const int INF = (1 << 30);
const ll INFLL = (1ll << 60);
const ll MOD = (ll)(1e9 + 7);

#define l_ength size

void mul_mod(ll &a, ll b) {
  a *= b;
  a %= MOD;
}

void add_mod(ll &a, ll b) {
  a = (a < MOD) ? a : (a - MOD);
  b = (b < MOD) ? b : (b - MOD);
  a += b;
  a = (a < MOD) ? a : (a - MOD);
}

ll ans[11111];

int main(void) {
  ll n, x, y, z, i;
  std::cin >> n;
  for (x = 1ll; x <= 200ll; ++x) {
    for (y = 1ll; y <= 200ll; ++y) {
      for (z = 1ll; z <= 200ll; ++z) {
        i = x * x + y * y + z * z + x * y + y * z + z * x;
        if (i <= n) {
          ++ans[i];
        }
      }
    }
  }
  for (i = 1ll; i <= n; ++i) {
    std::cout << ans[i] << std::endl;
  }
  return 0;
}
Problem p02608 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <assert.h>
#include <climits>
#include <cmath>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
constexpr int64_t MOD = 1e9 + 7;

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);

  int32_t x, y, z;
  int32_t N;
  cin >> N;
  vector<int32_t> cnt(N, 0);
  for (x = 1; x * x < N; x++) {
    if (x * x + x + 4 > N)
      continue;
    for (y = 1; y * y < N; y++) {
      if (x * x + y * y + x + y + x * y + 1 > N)
        continue;
      for (z = 1; z * z < N; z++) {
        int32_t sum = x * x + y * y + z * z + x * y + y * z + z * x;
        cnt[sum - 1]++;
      }
    }
  }
  for (auto c : cnt) {
    cout << c << endl;
  }
  return 0;
}


Fixed submission:
#include <algorithm>
#include <assert.h>
#include <climits>
#include <cmath>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
constexpr int64_t MOD = 1e9 + 7;

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);

  int32_t x, y, z;
  int32_t N;
  cin >> N;
  vector<int32_t> cnt(N, 0);
  for (x = 1; x * x < N; x++) {
    if (x * x + x + 4 > N)
      continue;
    for (y = 1; y * y < N; y++) {
      if (x * x + y * y + x + y + x * y + 1 > N)
        continue;
      for (z = 1; z * z < N; z++) {
        int32_t sum = x * x + y * y + z * z + x * y + y * z + z * x;
        if (sum > N)
          continue;
        cnt[sum - 1]++;
      }
    }
  }
  for (auto c : cnt) {
    cout << c << endl;
  }
  return 0;
}
Problem p02608 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  for (int n = 1; n <= N; ++n) {
    int ans = 0;
    for (int x = 1; x <= N; ++x) {
      if (x * x > n)
        break;
      for (int y = 1; y <= N; ++y) {
        if (y * y > n)
          break;
        for (int z = 1; z <= N; ++z) {
          if (z * z > n)
            break;
          int64_t a = x * x + y * y + z * z + x * y + y * z + z * x;
          if (a == n)
            ans++;
        }
      }
    }
    cout << ans << '\n';
  }
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  for (int n = 1; n <= N; ++n) {
    int ans = 0;
    for (int x = 1; x <= N; ++x) {
      if (x * x > n)
        break;
      for (int y = 1; y <= N; ++y) {
        if (y * y > n)
          break;
        int b = x + y;
        int c = x * x + y * y + x * y - n;
        double z = (-b + sqrt((b * b) - 4 * c)) / 2.0;
        if (z < 1)
          continue;
        if (floor(z) == z)
          ans++;
      }
    }
    cout << ans << '\n';
  }
  return 0;
}
Problem p02608 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
// #include <vector>
// #include <string>
// #include <algorithm>
// #include <math.h>
// #include <queue>
// #include <stack>
// #include <iomanip>

// sometimes used
// #include <set>
// #include <map>
// #include <numeric>
// #include <list>
// #include <deque>
// #include <unordered_map>

typedef long long LL;
// typedef long double LD;
using namespace std;

// #define MOD 1000000007
// #define MAX 100100
// #define NIL -1

int main() {
  LL n;
  cin >> n;
  for (LL i = 1; i <= n; i++) {
    LL ans = 0;
    for (LL x = 1; x < i; x++) {
      for (LL y = 1; y < i - x; y++) {
        for (LL z = 1; z < i - y; z++) {
          LL tmp = x * x + y * y + z * z + x * y + y * z + z * x;
          if (tmp == i) {
            ans++;
          }
        }
      }
    }
    cout << ans << endl;
  }

  return 0;
}


Fixed submission:
#include <iostream>
// #include <vector>
// #include <string>
// #include <algorithm>
// #include <math.h>
// #include <queue>
// #include <stack>
// #include <iomanip>

// sometimes used
// #include <set>
// #include <map>
// #include <numeric>
// #include <list>
// #include <deque>
// #include <unordered_map>

typedef long long LL;
// typedef long double LD;
using namespace std;

// #define MOD 1000000007
// #define MAX 100100
// #define NIL -1

int main() {
  LL n;
  cin >> n;
  for (LL i = 1; i <= n; i++) {
    LL ans = 0;
    for (LL x = 1; x < i; x++) {
      LL tmp0 = x * x;
      for (LL y = 1; tmp0 + x * y + y * y < i; y++) {
        LL tmp1 = tmp0 + x * y + y * y;
        for (LL z = 1; tmp1 + y * z + z * z + z * x <= i; z++) {
          LL tmp2 = tmp1 + y * z + z * z + z * x;
          if (tmp2 == i) {
            ans++;
          }
        }
      }
    }
    cout << ans << endl;
  }

  return 0;
}
Problem p02608 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int a[10010];

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      for (int k = 1; k <= n; ++k) {
        a[i * i + j * j + k * k + i * j + j * k + k * i]++;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    cout << a[i] << endl;
  }
}

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int a[10010];

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= 300; ++i) {
    for (int j = 1; j <= 300; ++j) {
      for (int k = 1; k <= 300; ++k) {
        if (i * i + j * j + k * k + i * j + j * k + k * i > 10005)
          continue;
        a[i * i + j * j + k * k + i * j + j * k + k * i]++;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    cout << a[i] << endl;
  }
}
Problem p02608 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;
using namespace std;

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 x = 1; x <= n; x++) {
    int cnt = 0;
    for (int i = 1; i < sqrt(n); i++) {
      if (f(i, 1, 1) > x)
        break;
      for (int j = 1; j < sqrt(n); j++) {
        if (f(i, j, 1) > x)
          break;
        for (int k = 1; k < sqrt(n); k++) {
          if (f(i, j, k) == x)
            cnt++;
          if (f(i, j, k) >= x)
            break;
        }
      }
    }
    cout << cnt << endl;
  }
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;
using namespace std;

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 x = 1; x <= n; x++) {
    int cnt = 0;
    for (int i = 1; i < sqrt(n); i++) {
      if (f(i, 1, 1) > x)
        break;
      for (int j = 1; j < sqrt(n); j++) {
        if (f(i, j, 1) > x)
          break;
        for (int k = 1; j < sqrt(n); k++) {
          if (f(i, j, k) == x)
            cnt++;
          if (f(i, j, k) >= x)
            break;
        }
      }
    }
    cout << cnt << endl;
  }
}
Problem p02608 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define N (1000000000 + 7)
#define M 998244353
#define INF 1e16
typedef long long ll;
typedef pair<int, int> P;

const int inf = (int)1e9;

ll A(ll x) {
  if (x >= 0)
    return x;
  else
    return -x;
}

ll gcd(ll a, ll b) {
  if (b > a) {
    ll tmp = b;
    b = a;
    a = tmp;
  }
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}

ll cnt[10010];

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

Fixed submission:
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define N (1000000000 + 7)
#define M 998244353
#define INF 1e16
typedef long long ll;
typedef pair<int, int> P;

const int inf = (int)1e9;

ll A(ll x) {
  if (x >= 0)
    return x;
  else
    return -x;
}

ll gcd(ll a, ll b) {
  if (b > a) {
    ll tmp = b;
    b = a;
    a = tmp;
  }
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}

ll cnt[10010];

int main(void) {
  int n;
  cin >> n;
  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 > 10000)
          continue;
        cnt[x * x + y * y + z * z + x * y + y * z + z * x]++;
        // cout<<x*x+y*y+z*z+x*y+y*z+z*x<<endl;
        // if(x*x+y*y+z*z+x*y+y*z+z*x==n)ans++;
      }
    }
  }
  for (int i = 1; i <= n; i++)
    cout << cnt[i] << endl;
  return 0;
}
Problem p02608 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  map<int, int> ans;
  for (int x = 1; x <= n; x++) {
    for (int y = 1; y <= n; y++) {
      for (int z = 1; z <= n; z++) {
        int n = x * x + y * y + z * z + x * y + y * z + z * x;
        ans[n]++;
      }
    }
  }

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


Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  map<int, int> ans;
  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        int n = x * x + y * y + z * z + x * y + y * z + z * x;
        ans[n]++;
      }
    }
  }

  for (int i = 1; i <= n; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}
Problem p02608 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int x = 1; x < 10000; x++) {
    if (x * x > n)
      break;
    for (int y = 1; y < 10000; y++) {
      if (y * y > n)
        break;
      for (int z = 1; z < 10000; z++) {
        if (z * z > n)
          break;
        a[x * x + y * y + z * z + x * y + y * z + z * x - 1]++;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    cout << a[i] << endl;
  }

  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int x = 1; x < 10000; x++) {
    if (x * x > n)
      break;
    for (int y = 1; y < 10000; y++) {
      if (y * y > n)
        break;
      for (int z = 1; z < 10000; z++) {
        if (z * z > n)
          break;
        if (x * x + y * y + z * z + x * y + y * z + z * x <= n)
          a[x * x + y * y + z * z + x * y + y * z + z * x - 1]++;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    cout << a[i] << endl;
  }

  return 0;
}
Problem p02608 (C++)

Buggy submission (status: Memory Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for (int i = 0; i < (N); i++)

int main() {

  int N;
  cin >> N;

  vector<int> ans(6 * pow(N + 1, 2));
  for (int x = 1; x <= ceil(sqrt(N)); x++) {
    for (int y = 1; y <= ceil(sqrt(N)); y++) {
      for (int z = 1; z <= ceil(sqrt(N)); z++) {
        int n = pow(x + y, 2) / 2 + pow(y + z, 2) / 2 + pow(z + x, 2) / 2;
        ans[n - 1]++;
      }
    }
  }

  rep(i, N) cout << ans[i] << endl;

  return 0;
}

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

int main() {

  int N;
  cin >> N;

  vector<int> ans(60001);
  for (int x = 1; x <= ceil(sqrt(N)); x++) {
    for (int y = 1; y <= ceil(sqrt(N)); y++) {
      for (int z = 1; z <= ceil(sqrt(N)); z++) {
        int n = pow(x + y, 2) / 2 + pow(y + z, 2) / 2 + pow(z + x, 2) / 2;
        ans[n - 1]++;
      }
    }
  }

  rep(i, N) cout << ans[i] << endl;

  return 0;
}
Problem p02608 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

#define PI 3.14159265359

int main() {
  int N;
  cin >> N;
  for (int i = 1; i < N + 1; i++) {
    int ans = 0;
    for (int j = 1; j < 100; j++) {
      for (int k = j; k < 100; k++) {
        for (int l = k; l < 100; l++) {
          if (j * j + k * k + l * l + j * k + k * l + l * j == i) {
            if (j == k && k == l)
              ans++;
            else if (j == k || k == l || l == j)
              ans += 3;
            else
              ans += 6;
          }
        }
      }
    }
    cout << ans << endl;
  }
}


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

#define PI 3.14159265359

int main() {
  int N;
  cin >> N;
  for (int i = 1; i < N + 1; i++) {
    int ans = 0;
    for (int j = 1; j < 59; j++) {
      for (int k = j; k < 71; k++) {
        for (int l = k; l < 100; l++) {
          if (j * j + k * k + l * l + j * k + k * l + l * j == i) {
            if (j == k && k == l)
              ans++;
            else if (j == k || k == l || l == j)
              ans += 3;
            else
              ans += 6;
          }
        }
      }
    }
    cout << ans << endl;
  }
}
Problem p02608 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n;
  cin >> n;
  vector<int> f(10101);
  for (int x = 1; x <= 100; ++x) {
    for (int y = 1; y <= 100; ++y) {
      for (int z = 1; z <= 100; ++z) {
        f[x * x + y * y + z * z + x * y + y * z + z * x]++;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    cout << f[i] << endl;
  }
  return 0;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n;
  cin >> n;
  vector<int> f(1000000);
  for (int x = 1; x <= 100; ++x) {
    for (int y = 1; y <= 100; ++y) {
      for (int z = 1; z <= 100; ++z) {
        f[x * x + y * y + z * z + x * y + y * z + z * x]++;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    cout << f[i] << endl;
  }
  return 0;
}
Problem p02608 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll, ll> pll;
const ll mod = 1e9 + 7;
// const ll mod=998244353;
const ll inf = 1LL << 61;

int main() {
  ll n;
  cin >> n;
  for (ll i = 1; i <= n; i++) {
    ll ans = 0;
    for (ll j = 1; j * j <= i; j++) {
      for (ll k = 1; k * k <= i; k++) {
        for (ll l = 1; l * l <= i; l++) {
          if (j * j + k * k + l * l + j * k + k * l + l * j == i)
            ans++;
        }
      }
    }
    cout << ans << endl;
  }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll, ll> pll;
const ll mod = 1e9 + 7;
// const ll mod=998244353;
const ll inf = 1LL << 61;

int main() {
  ll n;
  cin >> n;
  for (ll i = 1; i <= n; i++) {
    ll ans = 0;
    for (ll j = 1; 6 * j * j <= i; j++) {
      for (ll k = j; j * j + k * k + 2 * j * k + 2 * k * k <= i; k++) {
        for (ll l = k; j * j + k * k + l * l + j * k + k * l + l * j <= i;
             l++) {
          if (j * j + k * k + l * l + j * k + k * l + l * j == i) {
            if (j == l)
              ans++;
            else if (j == k || k == l) {
              ans += 3;
            } else {
              ans += 6;
            }
          }
        }
      }
    }
    cout << ans << endl;
  }
}
Problem p02608 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

  int n;
  cin >> n;

  vector<int> cnt(n + 10, 0);
  for (int x = 1; x <= 110; ++x) {
    for (int y = 1; y <= 110; ++y) {
      for (int z = 1; z <= 110; ++z) {
        int s = x * x + y * y + z * z + x * y + y * z + z * x;
        cnt[s]++;
      }
    }
  }

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

Fixed submission:
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

  int n;
  cin >> n;

  vector<int> cnt(n + 10, 0);
  for (int x = 1; x <= 110; ++x) {
    for (int y = 1; y <= 110; ++y) {
      for (int z = 1; z <= 110; ++z) {
        int s = x * x + y * y + z * z + x * y + y * z + z * x;
        if (s <= n) {
          cnt[s]++;
        }
      }
    }
  }

  for (int i = 1; i <= n; ++i) {
    cout << cnt[i] << endl;
  }
}
Problem p02608 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = int64_t;
using pint = pair<int, int>;

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

  vector<int> ans(n + 1, 0);
  for (int x = 1; x <= sqrt(n); ++x) {
    int x2 = x * x;
    for (int y = 1; y <= sqrt(n); ++y) {
      int y2 = y * y;
      for (int z = 1; z <= sqrt(n); ++z) {
        ans[x2 + y2 + z * z + x * y + y * z + z * x]++;
      }
    }
  }
  for (int i = 1; i <= n; ++i)
    cout << ans[i] << endl;
}

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = int64_t;
using pint = pair<int, int>;

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

  vector<int> ans(n + 1, 0);
  for (int x = 1; x <= sqrt(n); ++x) {
    int x2 = x * x;
    for (int y = 1; y <= sqrt(n); ++y) {
      int y2 = y * y;
      for (int z = 1; z <= sqrt(n); ++z) {
        if (x2 + y2 + z * z + x * y + y * z + z * x <= n)
          ans[x2 + y2 + z * z + x * y + y * z + z * x]++;
      }
    }
  }
  for (int i = 1; i <= n; ++i)
    cout << ans[i] << endl;
}
Problem p02608 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

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

  vector<int> res(N, 0);
  for (int x = 1; x < N / 2; x++) {
    for (int y = 1; y < N / 2; y++) {
      for (int z = 1; z < N / 2; z++) {
        int n = x * x + y * y + z * z + x * y + y * z + x * z;
        if (n <= N) {
          res.at(n - 1)++;
        }
      }
    }
  }

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

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

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

  vector<int> res(N, 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 n = x * x + y * y + z * z + x * y + y * z + x * z;
        if (n <= N) {
          res.at(n - 1)++;
        }
      }
    }
  }

  for (int i = 0; i < N; i++) {
    cout << res.at(i) << endl;
  }
}
Problem p02608 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;

int main() {
  int N;
  cin >> N;
  vi f(N + 1, 0);

  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= 120; j++) {
      for (int k = 1; k <= 120 - j; k++) {
        for (int l = 1; l <= 120 - j - k; l++) {
          if (j * j + k * k + l * l + j * k + k * l + l * j == i) {
            f[i]++;
          }
        }
      }
    }
  }

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

  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;

int main() {
  int N;
  cin >> N;
  vi f(N + 1, 0);
  int v = 1000;
  for (int j = 1; j <= v; j++) {
    for (int k = 1; k <= v - j; k++) {
      for (int l = 1; l <= v - j - k; l++) {
        int c = j * j + k * k + l * l + j * k + k * l + l * j;
        if (c <= N) {
          f[c]++;
        }
      }
    }
  }

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

  return 0;
}
Problem p02608 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define ll long long
#define MAX 100000
#define INF 1000000
#define M 1000000007
#define fast_io                                                                \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);
using namespace std;
int main() {
  fast_io ll n;
  cin >> n;
  map<ll, ll> mp;
  for (ll x = 1; x <= n; x++) {
    for (ll y = 1; y <= n; y++) {
      for (ll z = 1; z <= n; z++) {
        ll r = pow(x, 2) + pow(y, 2) + pow(z, 2) + (x * y) + (y * z) + (z * x);
        mp[r]++;
      }
    }
  }
  for (ll i = 1; i <= n; i++) {
    cout << mp[i] << endl;
  }
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define ll long long
#define MAX 100000
#define INF 1000000
#define M 1000000007
#define fast_io                                                                \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);
using namespace std;
int main() {
  fast_io ll n;
  cin >> n;
  map<ll, ll> mp;
  for (ll x = 1; x <= 100; x++) {
    for (ll y = 1; y <= 100; y++) {
      for (ll z = 1; z <= 100; z++) {
        ll r = pow(x, 2) + pow(y, 2) + pow(z, 2) + (x * y) + (y * z) + (z * x);
        mp[r]++;
      }
    }
  }
  for (ll i = 1; i <= n; i++) {
    cout << mp[i] << endl;
  }
  return 0;
}
Problem p02608 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
int main() {
  vector<int> a(1000000000);
  int n;
  cin >> n;
  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;
  }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
int main() {
  vector<int> a(1000000);
  int n;
  cin >> n;
  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;
  }
}
Problem p02608 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;

// int func(int x, int y, int n){
//     double sq = sqrt( (x+y)*(x+y) - 4 * (x*x + y*y + x*y - n));
//     if(ceil(sq) != floor(sq) || sq <= 0){
//         return -1;
//     }
//     else{
//         return (-(x + y) + int(sq)) / 2;
//     }
// }

int judge(int x, int y, int z) {
  if (x == y && y == z) {
    return 1;
  } else if (x != y && y != z && z != x) {
    return 6;
  } else {
    return 3;
  }
}

int main() {

  int N;
  cin >> N;
  int x, y, z;
  int tmp;
  vector<int> count(N + 1);

  for (x = 1; x <= N; x++) {
    for (y = 1; y <= N; y++) {
      for (z = 1; z <= N; z++) {
        tmp = x * x + y * y + z * z + x * y + y * z + z * x;
        if (tmp <= N) {
          count.at(tmp)++;
        }
      }
    }
  }

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

  return 0;
}


Fixed submission:
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;

// int func(int x, int y, int n){
//     double sq = sqrt( (x+y)*(x+y) - 4 * (x*x + y*y + x*y - n));
//     if(ceil(sq) != floor(sq) || sq <= 0){
//         return -1;
//     }
//     else{
//         return (-(x + y) + int(sq)) / 2;
//     }
// }

int judge(int x, int y, int z) {
  if (x == y && y == z) {
    return 1;
  } else if (x != y && y != z && z != x) {
    return 6;
  } else {
    return 3;
  }
}

int main() {

  int N;
  cin >> N;
  int x, y, z;
  int tmp;
  vector<int> count(N + 1);

  for (x = 1; x <= 100; x++) {
    for (y = 1; y <= 100; y++) {
      for (z = 1; z <= 100; z++) {
        tmp = x * x + y * y + z * z + x * y + y * z + z * x;
        if (tmp <= N) {
          count.at(tmp)++;
        }
      }
    }
  }

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

  return 0;
}
Problem p02608 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
// T+N
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")
#define endl "\n"
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template <class T, class T2> inline bool chkmax(T &x, const T2 &y) {
  return x < y ? x = y, 1 : 0;
}
template <class T, class T2> inline bool chkmin(T &x, const T2 &y) {
  return x > y ? x = y, 1 : 0;
}
const ll mod = 1e9 + 7;
template <class T> inline void fix(T &x) {
  if (x >= mod | x <= -mod) {
    x %= mod;
  }
  if (x < 0) {
    x += mod;
  }
}
#define out(x) cout << __LINE__ << ": " << (#x) << " = " << (x) << endl

const int MAX_N = 101;
ll cnt[MAX_N];

signed main() {
  // ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  int n;
  cin >> n;
  for (ll x = 1; x <= MAX_N; x++) {
    for (ll y = 1; y <= MAX_N; y++) {
      for (ll z = 1; z <= MAX_N; z++) {
        ll now = x * x + y * y + z * z + x * y + z * x + y * z;
        if (now <= n) {
          cnt[now]++;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << cnt[i] << endl;
  }
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
// T+N
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")
#define endl "\n"
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template <class T, class T2> inline bool chkmax(T &x, const T2 &y) {
  return x < y ? x = y, 1 : 0;
}
template <class T, class T2> inline bool chkmin(T &x, const T2 &y) {
  return x > y ? x = y, 1 : 0;
}
const ll mod = 1e9 + 7;
template <class T> inline void fix(T &x) {
  if (x >= mod | x <= -mod) {
    x %= mod;
  }
  if (x < 0) {
    x += mod;
  }
}
#define out(x) cout << __LINE__ << ": " << (#x) << " = " << (x) << endl

const int MAX_N = 101;
ll cnt[MAX_N * MAX_N];

signed main() {
  // ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  int n;
  cin >> n;
  for (ll x = 1; x <= MAX_N; x++) {
    for (ll y = 1; y <= MAX_N; y++) {
      for (ll z = 1; z <= MAX_N; z++) {
        ll now = x * x + y * y + z * z + x * y + z * x + y * z;
        if (now <= n) {
          cnt[now]++;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << cnt[i] << endl;
  }
  return 0;
}
Problem p02608 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ll long long
using namespace std;

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

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

  for (int n = 1; n <= N; n++) {
    int ans = 0;
    int intn = (int)sqrt(n) + 1;
    for (int x = 1; x <= intn; x++) {
      for (int y = 1; y <= x; y++) {
        for (int z = 1; z <= y; z++) {
          if (f(x, y, z) == n) {
            // cout<<"x "<<x<<" y "<<y<<" z "<<z<<endl;
            if (x == y && y == z)
              ans++;
            else if ((x == y) || (y == z))
              ans += 3;
            else
              ans += 6;
          }
        }
      }
    }
    cout << ans << endl;
  }

  return 0;
}

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

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

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

  for (int n = 1; n <= N; n++) {
    int ans = 0;
    int intn = (int)sqrt(n) + 1;
    for (int x = 1; x <= intn; x++) {
      for (int y = 1; y <= x && f(x, y, 1) <= n; y++) {
        for (int z = 1; z <= y && f(x, y, z) <= n; z++) {
          if (f(x, y, z) == n) {
            // cout<<"x "<<x<<" y "<<y<<" z "<<z<<endl;
            if (x == y && y == z)
              ans++;
            else if ((x == y) || (y == z))
              ans += 3;
            else
              ans += 6;
          }
        }
      }
    }
    cout << ans << endl;
  }

  return 0;
}
Problem p02608 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define rep(i, n) for (i = 1; i <= n; ++i)
#define rrep(xyz, n) for (xyz = 1; xyz < n; ++xyz)
using namespace std;
int main(void) {
  int N;
  cin >> N;
  int i, score, n, x, y, z;
  rep(i, N) {
    score = 0;
    rrep(x, i) rrep(y, i) rrep(z, i) {
      n = (x * x + y * y + z * z + x * y + y * z + z * x);
      if (n == i) {
        ++score;
        break;
      } else if (n > i)
        break;
    }
    cout << score << endl;
  }

  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (i = 1; i <= n; ++i)
#define rrep(xyz, n) for (xyz = 1; xyz * xyz < n; ++xyz)
using namespace std;
int main(void) {
  int N;
  cin >> N;
  int i, score, n, x, y, z;
  rep(i, N) {
    score = 0;
    rrep(x, i) rrep(y, i) rrep(z, i) {
      n = (x * x + y * y + z * z + x * y + y * z + z * x);
      if (n == i) {
        ++score;
        break;
      } else if (n > i)
        break;
    }
    cout << score << endl;
  }

  return 0;
}
Problem p02608 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr ll INF = 3000000000000000000;

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

  vector<int> ans(n + 1, 0);
  for (ll x = 1; x * x <= n; ++x) {
    for (ll y = 1; y * y <= n; ++y) {
      for (ll z = 1; z * z <= n; ++z) {
        ans[x * x + y * y + z * z + x * y + y * z + z * x]++;
      }
    }
  }
  for (int i = 1; i <= n; ++i)
    cout << ans[i] << "\n";
  return 0;
}


Fixed submission:
#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr ll INF = 3000000000000000000;

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

  vector<int> ans(n + 1, 0);
  for (ll x = 1; x * x <= n; ++x) {
    for (ll y = 1; y * y <= n; ++y) {
      for (ll z = 1; z * z <= n; ++z) {
        if (x * x + y * y + z * z + x * y + y * z + z * x <= n) {
          ans[x * x + y * y + z * z + x * y + y * z + z * x]++;
        }
      }
    }
  }
  for (int i = 1; i <= n; ++i)
    cout << ans[i] << "\n";
  return 0;
}
Problem p02608 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main() {
  int N;
  cin >> N;
  int ans[10100];
  for (int i = 1; i <= N; i++) {
    ans[i] = 0;
  }
  int l = 0;
  for (int i = 0; i <= N; i++) {
    l = i;
  }

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


Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int N;
  cin >> N;
  int ans[10100];
  for (int i = 1; i <= N; i++) {
    ans[i] = 0;
  }
  for (int x = 1; x <= 105; x++) {
    for (int y = 1; y <= 105; y++) {
      for (int z = 1; z <= 105; z++) {
        if ((x * x + y * y + z * z + x * y + y * z + z * x) <= N) {
          ans[x * x + y * y + z * z + x * y + y * z + z * x]++;
        }
      }
    }
  }
  for (int i = 1; i <= N; i++) {
    cout << ans[i] << endl;
  }
}
Problem p02608 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> A(N + 1, 0);
  for (int X = 1; X <= 100; X++) {
    for (int Y = 1; Y <= 100; Y++) {
      for (int Z = 1; Z <= 100; Z++) {
        if (X * X + Y * Y + Z * Z + X * Y + Y * Z + Z + X <= N) {
          A.at(X * X + Y * Y + Z * Z + X * Y + Y * Z + Z * X)++;
        }
      }
    }
  }
  for (int i = 1; i <= N; i++)
    cout << A.at(i) << endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N + 1, 0);
  for (int X = 1; X <= 100; X++) {
    for (int Y = 1; Y <= 100; Y++) {
      for (int Z = 1; Z <= 100; Z++) {
        if (X * X + Y * Y + Z * Z + X * Y + Y * Z + Z * X <= N) {
          A.at(X * X + Y * Y + Z * Z + X * Y + Y * Z + Z * X)++;
        }
      }
    }
  }
  for (int i = 1; i <= N; i++)
    cout << A.at(i) << endl;
}
Problem p02608 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>

using namespace std;

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

  vector<int> ans(n + 1, 0);

  int nn = sqrt(n);

  for (int x = 1; x <= nn; ++x) {
    for (int y = 1; y <= nn; ++y) {
      for (int z = 1; z <= nn; ++z) {
        int f = x * x + y * y + z * z + x * y + y * z + z * x;
        ans[f]++;
      }
    }
  }

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

  return 0;
}

Fixed submission:
#include <bits/stdc++.h>

using namespace std;

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

  vector<int> ans(n + 1, 0);

  int nn = sqrt(n);

  for (int x = 1; x <= nn; ++x) {
    for (int y = 1; y <= nn; ++y) {
      for (int z = 1; z <= nn; ++z) {
        int f = x * x + y * y + z * z + x * y + y * z + z * x;
        if (f <= n) {
          ans[f]++;
        }
      }
    }
  }

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

  return 0;
}
Problem p02608 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int A[40000] = {0};

int main() {
  int N;
  cin >> N;
  for (int i = 1; i < 110; ++i) {
    for (int j = 1; j < 110; ++j) {
      for (int k = 1; k < 110; ++k) {

        int temp = i * i + j * j + k * k + i * j + j * k + k * i;
        ++A[temp];
        // cout << temp << " " << i << j << k << endl;
      }
    }
  }
  for (int i = 1; i <= N; ++i) {
    cout << A[i] << endl;
  }
}


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

typedef long long ll;

int A[40000] = {0};

int main() {
  int N;
  cin >> N;
  for (int i = 1; i < 110; ++i) {
    for (int j = 1; j < 110; ++j) {
      for (int k = 1; k < 110; ++k) {

        int temp = i * i + j * j + k * k + i * j + j * k + k * i;
        if (temp <= 10010) {
          ++A[temp];
        }
        // cout << temp << " " << i << j << k << endl;
      }
    }
  }
  for (int i = 1; i <= N; ++i) {
    cout << A[i] << endl;
  }
}
Problem p02608 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  ll n;
  cin >> n;
  int ans = 0;
  rep(i, 0, n) {
    ans = 0;
    for (ll x = 1; x * x <= i + 1; x++) {
      for (ll y = 1; x * x + y * y <= i + 1; y++) {
        for (ll z = 1; x * x + y * y + z * z <= i + 1; z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == i + 1)
            ans++;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  ll n;
  cin >> n;
  int ans = 0;
  rep(i, 0, n) {
    ans = 0;
    for (ll x = 1; x * x <= i + 1; x++) {
      for (ll y = 1; x * x + y * y + x * y <= i + 1; y++) {
        for (ll z = 1; x * x + y * y + z * z + x * y + y * z + z * x <= i + 1;
             z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == i + 1)
            ans++;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
Problem p02608 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define ll long long
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> ans(n + 1);
  for (int i = 1; i <= n; i++) {
    int sn = sqrt(i);
    for (int x = 1; x < sn; x++) {
      for (int y = 1; y <= sn; y++) {
        if (x * x + y * y >= i)
          continue;
        for (int z = 1; z <= sn; z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == i)
            ans[i]++;
        }
      }
    }
  }

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


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

int main() {
  int n;
  cin >> n;
  vector<int> ans(n + 5);

  int sn = sqrt(n);
  for (int x = 1; x < sn; x++) {
    for (int y = 1; y <= sn; y++) {
      for (int z = 1; z <= sn; z++) {
        ll tmp = x * x + y * y + z * z + x * y + y * z + z * x;
        if (tmp <= n)
          ans[tmp]++;
      }
    }
  }

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

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#include <iostream>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, n) for (int i = n - 1; i >= 0; --i)
#define yesno(flg)                                                             \
  if (flg) {                                                                   \
    cout << "YES" << endl;                                                     \
  } else {                                                                     \
    cout << "NO" << endl;                                                      \
  }
#define MAX_N 1002
#define i197 1000000007

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P1;
typedef pair<int, int> Pi;
typedef pair<double, Pi> Pdi;
typedef pair<ll, int> Pli;
typedef pair<P1, ll> P2;
typedef pair<string, string> Ps;
const ll INF = 1000000000000000001;
struct edge {
  int to, cost;
};
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
struct Road {
  double cost;
  int a, b;
};
struct pos {
  // 1 変数を入れる;
  int x, y, sx, sy, cost;
};
int f[101] = {};

int main() {

  int n;
  cin >> n;
  for (int i = 1; i < 101; i++) {
    for (int j = 1; j < 101; j++) {
      for (int k = 1; k < 101; k++) {
        ll t = i * i + j * j + k * k + i * j + j * k + k * i;
        if (t > n)
          break;
        f[t]++;
      }
    }
  }
  rep(i, n) cout << f[i + 1] << endl;

  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#include <iostream>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, n) for (int i = n - 1; i >= 0; --i)
#define yesno(flg)                                                             \
  if (flg) {                                                                   \
    cout << "YES" << endl;                                                     \
  } else {                                                                     \
    cout << "NO" << endl;                                                      \
  }
#define MAX_N 1002
#define i197 1000000007

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P1;
typedef pair<int, int> Pi;
typedef pair<double, Pi> Pdi;
typedef pair<ll, int> Pli;
typedef pair<P1, ll> P2;
typedef pair<string, string> Ps;
const ll INF = 1000000000000000001;
struct edge {
  int to, cost;
};
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
struct Road {
  double cost;
  int a, b;
};
struct pos {
  // 1 変数を入れる;
  int x, y, sx, sy, cost;
};
int f[10001] = {};

int main() {

  int n;
  cin >> n;
  for (int i = 1; i < 101; i++) {
    for (int j = 1; j < 101; j++) {
      for (int k = 1; k < 101; k++) {
        ll t = i * i + j * j + k * k + i * j + j * k + k * i;
        if (t > n)
          break;
        f[t]++;
      }
    }
  }
  rep(i, n) cout << f[i + 1] << endl;

  return 0;
}
Problem p02608 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  int N;
  cin >> N;
  int m = floor(sqrt((4 * N + 1) - 1) / 2);
  for (int n = 1; n <= N; n++) {
    int cnt = 0;
    for (int x = 1; x <= m; x++) {
      for (int y = 1; y <= m; y++) {
        for (int z = 1; z <= m; z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == n)
            cnt++;
        }
      }
    }
    cout << cnt << endl;
  }
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  int N;
  cin >> N;
  int m = floor(sqrt((4 * N + 1) - 1) / 2);
  for (int n = 1; n <= N; n++) {
    int cnt = 0;
    for (int x = 1; x <= m; x++) {
      for (int y = 1; y <= x; y++) {
        for (int z = 1; z <= y; z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == n) {
            if (x == y && y == z) {
              cnt++;
            } else if (x != y && y != z && z != x) {
              cnt += 6;
            } else {
              cnt += 3;
            }
          }
        }
      }
    }
    cout << cnt << endl;
  }
}
Problem p02608 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(a) (a).begin(), (a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for (ll i = 0; i < (n); i++)
#define rep2(i, n) for (ll i = 0; i < (n); i++)
#define rep3(i, a, b) for (ll i = (a); i < (b); i++)
#define rep4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for (ll i = (n)-1; i >= 0; i--)
#define rrep2(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rrep3(i, a, b) for (ll i = (a)-1; i >= (b); i--)
#define rrep4(i, a, b, c) for (ll i = (a)-1; i >= (b); i -= (c))
#define rrep(...)                                                              \
  overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
const ll INF = 1e18, MOD = 1e9 + 7;
const int iINF = 1e9;

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

  int n;
  cin >> n;

  //(x+y+z)^2 - (xy+yz+zx) == n
  rep(i, 1, n + 1) {

    int ans = 0;
    int sq = sqrt(i);
    rep(a, 1, sq + 1) rep(b, 1, sq + 1) rep(c, 1, sq + 1) {
      if ((pow(a + b + c, 2) - (a * b + b * c + c * a)) == i)
        ans++;
    }
    cout << ans << endl;
  }

  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(a) (a).begin(), (a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for (ll i = 0; i < (n); i++)
#define rep2(i, n) for (ll i = 0; i < (n); i++)
#define rep3(i, a, b) for (ll i = (a); i < (b); i++)
#define rep4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for (ll i = (n)-1; i >= 0; i--)
#define rrep2(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rrep3(i, a, b) for (ll i = (a)-1; i >= (b); i--)
#define rrep4(i, a, b, c) for (ll i = (a)-1; i >= (b); i -= (c))
#define rrep(...)                                                              \
  overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
const ll INF = 1e18, MOD = 1e9 + 7;
const int iINF = 1e9;

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

  int n;
  cin >> n;

  //(x+y+z)^2 - (xy+yz+zx) == n
  rep(i, 1, n + 1) {

    int ans = 0;
    int sq = sqrt(i);
    rep(a, 1, sq + 1) rep(b, 1, a + 1) rep(c, 1, b + 1) {
      if ((pow(a + b + c, 2) - (a * b + b * c + c * a)) == i) {
        if (a == b && b == c)
          ans++;
        else if (a == b || b == c || c == a)
          ans += 3;
        else
          ans += 6;
      }
    }
    cout << ans << endl;
  }

  return 0;
}