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

#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using str = string;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
const double PI = 3.141592653589793238;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = m; i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greator<>()
#define d20 std::setprecision(20)
#define veci vector<int>
#define vecll vector<long long int>
#define vecb vector<bool>
#define vecd vector<double>
template <typename T> T lcm(T a, T b) { return a / __gcd(a, b) * b; }

int main() {
  ll n;
  cin >> n;
  ll sqrt_n = sqrt(n + .1);
  vector<int> f(10050, 0);
  for (ll x = 1; x <= sqrt_n; x++) {
    for (ll y = 1; y <= sqrt_n; y++) {
      for (ll z = 1; z <= sqrt_n; z++) {
        ll tmp = x * x + y * y + z * z + x * y + y * z + z * x;
        if (tmp <= 10005) {
          f[tmp]++;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << f[i] << endl;
  }

  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using str = string;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
const double PI = 3.141592653589793238;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = m; i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greator<>()
#define d20 std::setprecision(20)
#define veci vector<int>
#define vecll vector<long long int>
#define vecb vector<bool>
#define vecd vector<double>
template <typename T> T lcm(T a, T b) { return a / __gcd(a, b) * b; }

int main() {
  ll n;
  cin >> n;
  ll sqrt_n = sqrt(n + .1);
  vector<int> f(n + 1, 0);
  for (ll x = 1; x <= sqrt_n; x++) {
    for (ll y = 1; y <= sqrt_n; y++) {
      for (ll z = 1; z <= sqrt_n; 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, verdict: Runtime Error

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

int main(void) {
  long n, x;
  long f[100000];
  cin >> n;
  for (int i = 0; i < n; i++) {
    f[i] = 0;
  }
  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      for (int k = 1; x <= n; k++) {
        x = i * i + j * j + k * k + i * j + j * k + k * i;
        // if(i==k && i==j && k==j)
        f[x]++;
        //                else
        //                {
        //                    f[x]++,f[x]++,f[x]++;
        //                }
        // cout << x << endl;
      }
      x = 1;
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << f[i] << endl;
  }
}

Error: 0

Fixed submission:

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

int main(void) {
  long n, x;
  long f[10000];
  cin >> n;
  for (int i = 0; i < n; i++) {
    f[i] = 0;
  }
  for (int i = 1; i * i + 2 * i <= n - 3; i++) {
    for (int j = 1; j * j + 2 * j <= n - 3; j++) {
      for (int k = 1; x <= n; k++) {
        x = i * i + j * j + k * k + i * j + j * k + k * i;
        // if(i==k && i==j && k==j)
        f[x]++;
        //                else
        //                {
        //                    f[x]++,f[x]++,f[x]++;
        //                }
        // cout << x << endl;
      }
      x = 1;
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << f[i] << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FILL0(x) memset(x, 0, sizeof(x))
#define FILL1(x) memset(x, -1, sizeof(x))

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20);

  int N;
  cin >> N;

  for (int i = 1; i <= N; i++) {
    int ans = 0;
    for (int j = 1; j * j <= i; j++) {
      for (int k = j; k * k <= i; k++) {
        for (int l = k; l * l <= i; l++) {
          int eq = l * l + j * j + k * k + j * k + k * l + l * j;

          if (eq == i) {
            if (l == j && j == k) {
              ans++;
            } else if (l == j || j == k || k == l) {
              ans += 3;
            } else {
              ans += 6;
            }
          }
        }
      }
    }
    cout << ans << endl;
  }

  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FILL0(x) memset(x, 0, sizeof(x))
#define FILL1(x) memset(x, -1, sizeof(x))

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20);

  int N;
  cin >> N;

  for (int i = 1; i <= N; i++) {
    int ans = 0;
    for (int j = 1; j * j <= i; j++) {
      for (int k = 1; k * k <= i; k++) {
        for (int l = 1; l * l <= i; l++) {
          int eq = l * l + j * j + k * k + j * k + k * l + l * j;

          if (eq == i) {
            ans++;
          }
        }
      }
    }
    cout << ans << endl;
  }

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

/**
 * The man who codes no bugs
 * McCheng is the man studying Maths in CUHK with IQ200
 * @author McCheng
 */

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

class CXYZTriplets {
public:
  static constexpr int kStressCount = 0;
  static void generateTest(ostream &test) {}
  void solve(istream &cin, ostream &cout) {
    int n;
    cin >> n;
    int s = sqrt(n);
    vector<int> c(n);

    for (int i = 1; i <= s; i++) {
      for (int j = 1; j <= s; j++) {
        for (int k = 1; k <= s; k++) {
          int tmp = i * i + j * j + k * k + i * j + j * k + k * i;
          if (tmp <= n)
            c[tmp - 1]++;
          else if (tmp > n)
            break;
        }
      }
    }
    for (auto &l : c) {
      cout << l << endl;
    }
    cout << "\\n";
  }
};

signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  istream &in(cin);
  ostream &out(cout);
  out << fixed;
  out.precision(20);
  CXYZTriplets solver;
  solver.solve(in, out);
}


Error: TLE

Fixed submission:

/**
 * The man who codes no bugs
 * McCheng is the man studying Maths in CUHK with IQ200
 * @author McCheng
 */

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

class CXYZTriplets {
public:
  static constexpr int kStressCount = 0;
  static void generateTest(ostream &test) {}
  void solve(istream &cin, ostream &cout) {
    int n;
    cin >> n;
    for (int l = 1; l <= n; l++) {
      int cnt = 0;
      for (int i = 1; i <= sqrt(n); i++) {
        for (int j = 1; j <= sqrt(n); j++) {
          for (int k = 1; k <= sqrt(n); k++) {
            int tmp = i * i + j * j + k * k + i * j + j * k + k * i;
            if (tmp == l)
              cnt++;
            else if (tmp > l)
              break;
          }
        }
      }
      cout << cnt << "\\n";
    }
  }
};

signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  istream &in(cin);
  ostream &out(cout);
  out << fixed;
  out.precision(20);
  CXYZTriplets solver;
  solver.solve(in, out);
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int N = 0;
  cin >> N;
  int ans = 0;
  // for (size_t p = 1; p < N+1; p++)
  //{
  // ans = 0;
  int c;
  vector<int> A(10001);
  for (size_t i = 1; i < 101; i++) {
    for (size_t j = 1; j < 101; j++) {
      for (size_t k = 1; k < 101; k++) {
        c = i * i + j * j + k * k + i * j + j * k + k * i;
        if (c <= 10000) {
          A.at(c)++;
        }
      }
    }
  }
  for (size_t i = 0; i < N; i++) {
    cout << A.at(i + 1) << endl;
  }

  // cout << ans << endl;
  // }
}

Error: TLE

Fixed submission:

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

int main() {
  int N = 0;
  cin >> N;
  int ans = 0;
  for (size_t p = 1; p < N + 1; p++) {
    ans = 0;
    for (size_t i = 1; i < 101; i++) {
      for (size_t j = 1; j < 101; j++) {
        for (size_t k = 1; k < 101; k++) {
          if ((i * i + j * j + k * k + i * j + j * k + k * i) == p) {
            ans++;
          }
        }
      }
    }
    cout << ans << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include "bits/stdc++.h"

using namespace std;

#define LOCAL
#define all(a) begin(a), end(a)
#define MOD 1000000007
#define PII pair<int, int>
#define REP(x, l, u) for (ll x = l; x < u; x++)
#define RED(x, l, u) for (ll x = l; x >= u; x--)
#define complete_unique(a) a.erase(unique(begin(a), end(a)), end(a))
#define mst(x, a) memset(x, a, sizeof(x))
typedef vector<int> VI;
typedef long long ll;

ll quick_pow(ll a, ll b) {
  long long res = 1;
  while (b) {
    if (b & 1) {
      res = a * res;
    }
    a = a * a;
    b >>= 1;
  }
  return res;
}

ll gcd(ll a, ll b) {
  a = abs(a), b = abs(b);
  while (b != 0) {
    a %= b;
    swap(a, b);
  }
  return a;
}

bool is_prime(int n) {
  if (n == 1)
    return false;
  if (n == 2)
    return true;
  if (n % 2 == 0)
    return false;
  int j = sqrt(n);
  for (int i = 2; i <= j; ++i) {
    if (n % i == 0)
      return false;
  }
  return true;
}

ll reverse_num(ll n) {
  ll x = 0, t = n;
  while (t != 0) {
    x = x * 10 + t % 10;
    t /= 10;
  }
  return x;
}

// TO-DO
// contest required
#ifdef LOCAL

void solve() {
  int n;
  cin >> n;
  int a[n + 1];
  mst(a, 0);
  for (int x = 1; x <= 100; ++x) {
    for (int y = 1; y <= 100; ++y) {
      for (int z = 1; z <= 100; ++z) {
        int cur = x * x + y * y + z * z + x * y + y * z + z * x;
        if (cur <= n)
          a[cur]++;
      }
    }
  }
  for (int i = 1; i <= n; i++)
    cout << a[i] << endl;
}

int main() {
  // 加速输入和输出
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  solve();
  return 0;
}

#endif

Error: TLE

Fixed submission:

#include "bits/stdc++.h"

using namespace std;

#define LOCAL
#define all(a) begin(a), end(a)
#define MOD 1000000007
#define PII pair<int, int>
#define REP(x, l, u) for (ll x = l; x < u; x++)
#define RED(x, l, u) for (ll x = l; x >= u; x--)
#define complete_unique(a) a.erase(unique(begin(a), end(a)), end(a))
#define mst(x, a) memset(x, a, sizeof(x))
typedef vector<int> VI;
typedef long long ll;

ll quick_pow(ll a, ll b) {
  long long res = 1;
  while (b) {
    if (b & 1) {
      res = a * res;
    }
    a = a * a;
    b >>= 1;
  }
  return res;
}

ll gcd(ll a, ll b) {
  a = abs(a), b = abs(b);
  while (b != 0) {
    a %= b;
    swap(a, b);
  }
  return a;
}

bool is_prime(int n) {
  if (n == 1)
    return false;
  if (n == 2)
    return true;
  if (n % 2 == 0)
    return false;
  int j = sqrt(n);
  for (int i = 2; i <= j; ++i) {
    if (n % i == 0)
      return false;
  }
  return true;
}

ll reverse_num(ll n) {
  ll x = 0, t = n;
  while (t != 0) {
    x = x * 10 + t % 10;
    t /= 10;
  }
  return x;
}

// TO-DO
// contest required
#ifdef LOCAL

void solve() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    int cnt = 0;
    for (int x = 1; x * x <= i; ++x) {
      for (int y = 1; y <= i; ++y) {
        for (int z = 1; z <= i; ++z) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == i)
            cnt++;
        }
      }
    }
    cout << cnt << endl;
  }
}

int main() {
  // 加速输入和输出
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  solve();
  return 0;
}

#endif
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define In_The_Name_Of_Allah_The_Merciful                                      \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
#define Alhamdulillah return 0;
#define all(v) v.begin(), v.end()
#define debug(n) cerr << "[" << #n << " = " << n << "]" << endl

int f(int a, int b, int c) {
  return a * a + b * b + c * c + a * b + a * c + b * c;
}

void Suhaib_Sawalha() {

  int num[10001] = {};
  for (int i = 1; i <= 100; ++i)
    for (int j = 1; j <= 100; ++j)
      for (int k = 1; k <= 100; ++k) {
        int ff = f(i, j, k);
        if (ff <= 10000)
          num[ff]++;
      }

  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i)
    cout << num[i] << '\\n';
}

int main() {
  In_The_Name_Of_Allah_The_Merciful /* بسم الله الرحمن الرحيم  */
#ifndef ONLINE_JUDGE
      freopen("SuhaibSawalha1.txt", "r", stdin);
#endif
  // int _;for(cin>>_;_;--_,cout<<'\\n')
  Suhaib_Sawalha();
  Alhamdulillah /* الحمد لله */
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define In_The_Name_Of_Allah_The_Merciful                                      \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
#define Alhamdulillah return 0;
#define all(v) v.begin(), v.end()
#define debug(n) cerr << "[" << #n << " = " << n << "]" << endl

int f(int a, int b, int c) {
  return a * a + b * b + c * c + a * b + a * c + b * c;
}

void Suhaib_Sawalha() {

  int num[1001] = {};
  for (int i = 1; i <= 100; ++i)
    for (int j = 1; j <= 100; ++j)
      for (int k = 1; k <= 100; ++k) {
        int ff = f(i, j, k);
        if (ff <= 1000)
          num[ff]++;
      }

  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i)
    cout << num[i] << '\\n';
}

int main() {
  In_The_Name_Of_Allah_The_Merciful /* بسم الله الرحمن الرحيم  */
#ifndef ONLINE_JUDGE
      freopen("SuhaibSawalha1.txt", "r", stdin);
#endif
  // int _;for(cin>>_;_;--_,cout<<'\\n')
  Suhaib_Sawalha();
  Alhamdulillah /* الحمد لله */
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, x, y, z, cnt;
  char str[50];
  scanf("%d", &n);
  for (int nl = 1; nl <= n; nl++) {
    cnt = 0;
    for (int x = 1; x < n; x++) {
      int y;
      for (y = 1; y < n; y++) {
        int xy = x * x + y * y + x * y;
        if (xy >= nl)
          break;
        int nlnew = nl - xy;
        int z;
        for (z = 1; z < n; z++) {
          //        int cal = (x*(x+y))+(y*(y+z))+(z*(z+x));
          int calz = z * (x + y + z);
          //        sprintf(str,"x[%d]y[%d]z[%d]:%d", x,y,z,cal);
          //        cout << str << endl;
          if (calz == nlnew)
            cnt++;
          if (calz >= nlnew)
            break;
        } // z
        if (z == 1)
          break;
      } // y
      if (y == 1)
        break;
    } // x
    cout << cnt << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, cnt;
  char str[50];
  scanf("%d", &n);
  for (int nl = 1; nl <= n; nl++) {
    cnt = 0;
    for (int x = 1; x < n; x++) {
      int y;
      for (y = 1; y < n; y++) {
        int z;
        for (z = 1; z < n; z++) {
          int cal = (x * (x + y)) + (y * (y + z)) + (z * (z + x));
          sprintf(str, "x[%d]y[%d]z[%d]:%d", x, y, z, cal);
          //        cout << str << endl;
          if (cal == nl)
            cnt++;
          if (cal >= nl)
            break;
        } // z
        if (z == 1)
          break;
      } // y
      if (y == 1)
        break;
    } // x
    cout << cnt << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#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++)
using ll = long long;
using vec = vector<int>;
using vec2 = vector<vector<int>>;
ll inf = pow(2, 62);
// x2 + y2 + z2 + xy+yz+zx = x2 + x(y + z) + zy + y2+z2
//(x + y)2 + (y + z)2 + (y + z)2 = 2n
int main() {
  ll n;
  cin >> n;
  for (int p = 1; p <= n; p++) {
    ll count = 0;
    for (int i = 1; i * i <= n; i++) {
      for (int j = i; j * j + i * i <= n; j++) {
        for (int k = j; k * k + i * i + j * j <= n; k++) {
          if (i * i + j * j + k * k + i * j + j * k + k * i == p) {
            if (i == j && j == k) {
              count++;
            } else if ((i == j && j != k) || (j == k && k != i) ||
                       (k == i && i != j)) {
              count += 3;
            } else {
              count += 6;
            }
          }
        }
      }
    }
    cout << count << endl;
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#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++)
using ll = long long;
using vec = vector<int>;
using vec2 = vector<vector<int>>;
ll inf = pow(2, 62);
// x2 + y2 + z2 + xy+yz+zx = x2 + x(y + z) + zy + y2+z2
//(x + y)2 + (y + z)2 + (y + z)2 = 2n
int main() {
  ll n;
  cin >> n;
  for (int p = 1; p <= n; p++) {
    ll count = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = i; j <= n; j++) {
        for (int k = j; k <= n; k++) {
          if (i * i + j * j + k * k + i * j + j * k + k * i == p) {
            if (i == j && j == k) {
              count++;
            } else if ((i == j && j != k) || (j == k && k != i) ||
                       (k == i && i != j)) {
              count += 3;
            } else {
              count += 6;
            }
          }
        }
      }
    }
    cout << count << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, n, j) for (int i = (j); i < (n); ++i)
#define rrep(i, n) for (int i = (n); i >= 0; --i)
#define ssort(n) sort((n).begin(), (n).end())
using ll = long long;
using ld = long double;
typedef pair<int, int> P;
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define INF 101010

int main() {
  int n;
  cin >> n;
  vector<int> f(INF);
  rep(i, n + 1) f[i] = 0;
  FOR(i, sqrt(n) + 1, 1) {
    FOR(j, sqrt(n) + 1, 1) {
      FOR(k, sqrt(n) + 1, 1) {
        f[i * i + j * j + k * k + i * j + j * k + k * i]++;
      }
    }
  }
  FOR(i, n + 1, 1) { cout << f[i] << endl; }
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, n, j) for (int i = (j); i < (n); ++i)
#define rrep(i, n) for (int i = (n); i >= 0; --i)
#define ssort(n) sort((n).begin(), (n).end())
using ll = long long;
using ld = long double;
typedef pair<int, int> P;
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define INF 10101010

int main() {
  int n;
  cin >> n;
  vector<int> f(n + 1);
  rep(i, n + 1) f[i] = 0;
  FOR(i, sqrt(n) + 1, 1) {
    FOR(j, sqrt(n) + 1, 1) {
      FOR(k, sqrt(n) + 1, 1) {
        f[i * i + j * j + k * k + i * j + j * k + k * i]++;
      }
    }
  }
  FOR(i, n + 1, 1) { cout << f[i] << endl; }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define INF INT_MAX
#define ll long long
#define ull unsigned long long
#define rep(i, n) for (ll i = 1; i <= n; ++i)
#define FOR(i, s, e) for (ll i = s; i < e; ++i)
#define MOD 1000000007
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> ans(N, 0);
  rep(x, sqrt(N)) {
    rep(y, sqrt(N)) {
      rep(z, sqrt(N)) {
        int tmp = x * x + y * y + z * z + x * y + y * z + z * x;
        if (tmp <= N) {
          ans[tmp - 1]++;
        }
      }
    }
  }
  for (int i : ans)
    cout << i << endl;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define INF INT_MAX
#define ll long long
#define ull unsigned long long
#define rep(i, n) for (ll i = 1; i <= n; ++i)
#define FOR(i, s, e) for (ll i = s; i < e; ++i)
#define MOD 1000000007
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  rep(n, N) {
    int cnt = 0;
    rep(x, sqrt(n)) {
      rep(y, sqrt(n)) {
        rep(z, sqrt(n)) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == n)
            ++cnt;
        }
      }
    }
    cout << cnt << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#include <unordered_map>

const double PI = acos(-1);

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define rep2(i, m, n) for (ll i = m; i < (ll)(n); i++)
#define rrep(i, n, m) for (ll i = n; i >= (ll)(m); i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000

bool func(ll n) {
  for (ll i = 1; i * i <= n; i++) {
    if (i * i == n) {
      return true;
    }
  }
  return false;
}

void solve_abc_c() {
  ll n, m;
  ll k;
  ll h, w;
  // ll x;
  // ll a;
  string s;
  string s_ans;
  ll l_ans = 0;
  double d_ans = 0;

  cin >> n;

  ll sum;
  ll b, c, d;
  V ans(1000000, 0);
  ll high = sqrt(n);
  rep1(x, high) {
    rep1(y, high) {
      rep1(z, high) {
        sum = x * x + y * y + z * z + x * y + y * z + z * x;
        ans[sum]++;
      }
    }
  }

  rep(i, n) { cout << ans[i + 1] << "\\n"; }
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  cout << setprecision(15);

  solve_abc_c();

  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <unordered_map>

const double PI = acos(-1);

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define rep2(i, m, n) for (ll i = m; i < (ll)(n); i++)
#define rrep(i, n, m) for (ll i = n; i >= (ll)(m); i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000

bool func(ll n) {
  for (ll i = 1; i * i <= n; i++) {
    if (i * i == n) {
      return true;
    }
  }
  return false;
}

void solve_abc_c() {
  ll n, m;
  ll k;
  ll h, w;
  // ll x;
  // ll a;
  string s;
  string s_ans;
  ll l_ans = 0;
  double d_ans = 0;

  cin >> n;

  ll high;
  ll b, c, d;
  rep1(i, n) {
    high = sqrt(i);
    l_ans = 0;
    rep1(x, high) {
      rep1(y, high) {
        b = x + y;
        c = x * x + y * y + x * y - i;
        d = b * b - 4 * c;
        if (d > 0 && func(d)) {
          if (((-b + (ll)sqrt(d)) % 2 == 0) && (-b + (ll)sqrt(d)) > 0) {
            l_ans++;
          }
        }
      }
    }
    cout << l_ans << "\\n";
  }
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  cout << setprecision(15);

  solve_abc_c();

  return 0;
}