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

#include <iostream>

using namespace std;

int main() {
  int out[10005] = {};
  for (int x = 1; x < 100; x++) {
    for (int y = 1; y < 100; y++) {
      for (int z = 1; z < 100; z++) {
        int idx = (x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (z * x);
        if (10004 >= idx) {
          out[idx]++;
          /*
          if (out[idx]!=0) continue;
          if (x==y && y==z) out[idx] = 1;
          else if(x==y || y==z || z==x) out[idx] = 3;
          else out[idx] = 6;
          */
        }
      }
    }
  }
  int N;
  cin >> N;
  for (int i = 1; i <= N; i++)
    cout << out[i] << endl;

  return 0;
}


Error: TLE

Fixed submission:

#include <cmath>
#include <iostream>
#include <math.h>

using namespace std;

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

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define contains(v, t) (find(v.begin(), v.end(), t) != v.end())
#define MOD 1000000007
using ll = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;

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


Error: TLE

Fixed submission:

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define contains(v, t) (find(v.begin(), v.end(), t) != v.end())
#define MOD 1000000007
using ll = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;

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

#pragma warning(disable : 4996)
#include <cstdio>
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 1; i <= (n); i++)

int main() {
  int n, cntx = 0, cnty = 0, cntz = 0;
  cin >> n;
  int ans = 0;
  rep(i, n) {
    int t = 0;
    if (ans != 0 && cntx > 70) {
      if (cntx * cntx + cnty * cnty + cntz * cntz + cntx * cnty + cnty * cntz +
              cntz * cntx >
          i) {
        t = 1;
      }
    }
    cntx = 0;
    cnty = 0;
    cntz = 0;
    ans = 0;
    for (int x = 1; x < 102; x++) {
      if (t == 1)
        break;
      for (int y = x; y < 102; y++) {
        for (int z = y; z < 102; z++) {
          if (z * z > n)
            break;
          if (x * x + y * y + z * z + x * y + y * z + z * x == i) {

            if (x == y && y == z)
              ans++;
            else if (x == y && y != z)
              ans += 3;
            else if (x != y && y == z)
              ans += 3;
            else if (z == x && y != x)
              ans += 3;
            else
              ans += 6;
            cntx = x + 1;
            cnty = y;
            cntz = z;
          }
        }
      }
    }
    cout << ans << endl;
  }
}


Error: TLE

Fixed submission:

#pragma warning(disable : 4996)
#include <cstdio>
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 1; i <= (n); i++)

int main() {
  int n, cntx = 0, cnty = 0, cntz = 0;
  cin >> n;
  int ans = 0;
  rep(i, n) {
    if (ans != 0) {
      while (cntx * cntx + cnty * cnty + cntz * cntz + cntx * cnty +
                 cnty * cntz + cntz * cntx >
             i) {
        cout << '0' << endl;
        break;
      }
    }
    cntx = 0;
    cnty = 0;
    cntz = 0;
    ans = 0;
    for (int x = 1; x < 102; x++) {
      for (int y = x; y < 102; y++) {
        for (int z = y; z < 102; z++) {
          if (z * z > n)
            break;
          if (x * x + y * y + z * z + x * y + y * z + z * x == i) {

            if (x == y && y == z)
              ans++;
            else if (x == y && y != z)
              ans += 3;
            else if (x != y && y == z)
              ans += 3;
            else if (z == x && y != x)
              ans += 3;
            else
              ans += 6;
            cntx = x + 1;
            cnty = y;
            cntz - z;
          }
        }
      }
    }
    cout << ans << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

using namespace std;
using ll = long long;

int main() {
  ll N, ans;
  cin >> N;
  for (int n = 1; n <= N; ++n) {
    ans = 0;
    for (int x = 1; x * x < n; ++x) {
      int xx = x * x;
      for (int y = 1; xx + y * y < n; ++y) {
        int yy = y * y;
        for (int z = 1; xx + yy + z * z < n; ++z) {
          int f = xx + yy + z * z + x * y + y * z + z * x;
          if (f == n)
            ++ans;
          else if (f > n)
            break;
        }
      }
    }
    cout << ans << endl;
  }
}


Error: TLE

Fixed submission:

#include <iostream>

using namespace std;
using ll = long long;

int main() {
  ll N, ans;
  cin >> N;
  for (int n = 1; n <= N; ++n) {
    ans = 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)
            ++ans;
        }
      }
    }
    cout << ans << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
void xin() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}
int f[100005];

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

  int n;
  cin >> n;
  vector<int> v(n + 1);
  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      for (int k = 1; k <= 100; k++) {
        int temp = i * i + j * j + k * k + j * k + k * i + i * j;
        if (temp < n + 1)
          v[temp]++;
      }
    }
  }
  for (int i = 1; i <= n; i++)
    cout << v[i] << endl;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
void xin() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}
int f[100005];

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

  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int count = 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 x = ((j + k + l) * (j + k + l)) - j * k - k * l - l * j;
          if (x == i)
            count++;
        }
      }
    }
    cout << count << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)
#define fs first
#define sc second

template <class S> S sum(vector<S> &a) { return accumulate(all(a), S()); }
template <class S> S max(vector<S> &a) { return *max_element(all(a)); }
template <class S> S min(vector<S> &a) { return *min_element(all(a)); }
ll max(int a, ll b) { return max((ll)a, b); }
ll max(ll a, int b) { return max(a, (ll)b); }
ll min(int a, ll b) { return min((ll)a, b); }
ll min(ll a, int b) { return min(a, (ll)b); }
template <class S> void print(vector<S> &v) {
  for (ll i = 0; i < (ll)v.size(); i++) {
    cerr << v[i] << ' ';
  }
  cerr << endl;
}
template <class S> void print(vector<vector<S>> &v) {
  for (ll i = 0; i < (ll)v.size(); i++) {
    for (ll j = 0; j < (ll)v[i].size(); j++) {
      cerr << v[i][j] << ' ';
    }
    cerr << endl;
  }
}

int main() {
  int n;
  cin >> n;
  vector<int> ans(n + 1, 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; z++) {
        int p = x * x + y * y + z * z + x * y + y * z + z * x;
        if (p <= n)
          ans[p]++;
      }
    }
  }
  rep(i, n) cout << ans[i + 1] << endl;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)
#define fs first
#define sc second

template <class S> S sum(vector<S> &a) { return accumulate(all(a), S()); }
template <class S> S max(vector<S> &a) { return *max_element(all(a)); }
template <class S> S min(vector<S> &a) { return *min_element(all(a)); }
ll max(int a, ll b) { return max((ll)a, b); }
ll max(ll a, int b) { return max(a, (ll)b); }
ll min(int a, ll b) { return min((ll)a, b); }
ll min(ll a, int b) { return min(a, (ll)b); }
template <class S> void print(vector<S> &v) {
  for (ll i = 0; i < (ll)v.size(); i++) {
    cerr << v[i] << ' ';
  }
  cerr << endl;
}
template <class S> void print(vector<vector<S>> &v) {
  for (ll i = 0; i < (ll)v.size(); i++) {
    for (ll j = 0; j < (ll)v[i].size(); j++) {
      cerr << v[i][j] << ' ';
    }
    cerr << endl;
  }
}

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

#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int s[10005];
void trip() {
  for (int i = 1; i <= 10000; i++) {
    int x, y, z, num = 0;
    for (x = 1; x <= sqrt(i); x++) {
      if (x * x + 3 + 2 * x > i)
        break;
      for (y = 1; y <= sqrt(i); y++) {
        if (x * x + y * y + x * y + 1 + x + y > i)
          break;
        for (z = 1; z <= sqrt(i); z++) {
          if (x * x + y * y + z * z + x * y + y * z + x * z > i)
            break;
          if (x * x + y * y + z * z + x * y + y * z + x * z == i)
            num++;
        }
      }
    }
    s[i] = num;
  }
}

int main() {
  int n;
  trip();
  while (~scanf("%d", &n))
    for (int i = 1; i <= n; i++)
      printf("%d\\n", s[i]);
  return 0;
}


Error: TLE

Fixed submission:

#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
int main() {
  int n;
  cin >> n;
  int count = 0;
  for (int i = 1; i <= n; i++) {
    int x, y, z;
    for (x = 1; x * x < i; x++) {
      for (y = 1; y * y < i; y++) {
        for (z = 1; z * z < i; z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == i)
            count++;
        }
      }
    }
    cout << count << '\\n';
    count = 0;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  int ans;
  for (int i = 1; i <= n; i++) {
    ans = 0;
    for (int x = 1; x < sqrt(n); x++) {
      if (x * x + 1 + 1 + x + 1 + x > i) {
        break;
      }
      for (int y = 1; y < sqrt(n); y++) {
        if (x * x + y * y + 1 + x * y + y + x > i) {
          break;
        }
        for (int z = 1; z < sqrt(n); z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == i) {
            ans++;
          } else if (x * x + y * y + z * z + x * y + y * z + z * x > i) {
            break;
          }
        }
      }
    }
    cout << ans << endl;
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  int ans;
  for (int i = 1; i <= n; i++) {
    ans = 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++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == i) {
            ans++;
          } else if (x * x + y * y + z * z + x * y + y * z + z * x > i) {
            break;
          }
        }
      }
    }
    cout << ans << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int N, x, y, z, cnt;
  cin >> N;
  int C[10100] = {};

  for (x = 1; x <= 100; x++) {
    for (y = 1; y <= 100; y++) {
      for (z = 1; (x * x + y * y + z * z + x * y + x * z + y * z) <= 10010;
           z++) {
        C[x * x + y * y + z * z + x * y + x * z + y * z]++;
      }
    }
  }
  for (int i = 1; i <= N; i++) {
    cout << C[i] << endl;
  }

  return 0;
}


Error: TLE

Fixed submission:

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

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

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

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

struct node {
  ll data;
  node *left, *right;
  node(ll data) {
    this->data = data;
    left = right = NULL;
  }
};
unordered_map<ll, list<ll>> ma;

ll h(node *head) {
  if (head == NULL)
    return 0;
  else {
    ll lh = h(head->left);
    ll rh = h(head->right);
    return max(lh, rh) + 1;
  }
}
void spiral(node *root, ll level) {
  if (root == NULL)
    return;
  if (level & 1)
    ma[level].push_back(root->data);
  else
    ma[level].push_front(root->data);
  spiral(root->left, level + 1);
  spiral(root->right, level + 1);
}

typedef long long ll;

int main() {

  ios_base::sync_with_stdio(false);
  cin.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input1.txt", "r", stdin);
  freopen("output12.txt", "w", stdout);
#endif
  ll n;
  cin >> n;
  ll arr[n + 1];
  memset(arr, 0, sizeof(arr));
  for (ll i = 1; i * i <= n; i++) {
    for (ll j = 1; j * j <= n; j++) {
      for (ll k = 1; k * k <= n; 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]++;
      }
    }
  }
  for (ll i = 1; i <= n; i++)
    cout << arr[i] << "\\n";

  return 0;
}


Error: TLE

Fixed submission:

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

struct node {
  ll data;
  node *left, *right;
  node(ll data) {
    this->data = data;
    left = right = NULL;
  }
};
unordered_map<ll, list<ll>> ma;

ll h(node *head) {
  if (head == NULL)
    return 0;
  else {
    ll lh = h(head->left);
    ll rh = h(head->right);
    return max(lh, rh) + 1;
  }
}
void spiral(node *root, ll level) {
  if (root == NULL)
    return;
  if (level & 1)
    ma[level].push_back(root->data);
  else
    ma[level].push_front(root->data);
  spiral(root->left, level + 1);
  spiral(root->right, level + 1);
}

typedef long long ll;

ll solve(ll x) {
  ll sum = 0;
  ll cnt = 0;

  for (ll i = 1; (i * i) <= x; i++) {
    for (ll j = 1; (j * j) <= x - i * i; j++) {
      for (ll k = 1; (k * k) <= x - (i * i + j * j); k++) {
        sum = (i * i + j * j + k * k + i * j + j * k + i * k);
        // cout << sum << " " << x << "\\n";
        // cout << sum << " ";
        if (sum == x)
          cnt++;
      }
    }
  }
  return cnt;
}

int main() {

  ios_base::sync_with_stdio(false);
  cin.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input1.txt", "r", stdin);
  freopen("output12.txt", "w", stdout);
#endif
  ll n;
  cin >> n;
  for (ll i = 1; i <= n; i++) {

    cout << solve(i) << "\\n";
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(), A.end()
#define RALL(A) A.rbegin(), A.rend()
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
const ll LINF = 1LL << 60;
const int INF = 1 << 30;
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n + 5, 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++) {
        ll ans = x * x + y * y + z * z + x * y + y * z + z * x;
        if (ans <= n) {
          a[ans]++;
        }
      }
    }
  }

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

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(), A.end()
#define RALL(A) A.rbegin(), A.rend()
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
const ll LINF = 1LL << 60;
const int INF = 1 << 30;
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int ans = 0;
    for (int x = 1; x * x <= n; x++) {
      for (int y = x; y * y <= n; y++) {
        for (int z = y; z * z <= n; z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == i) {
            if (x == y == z)
              ans++;
            else if (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 <algorithm>
#include <iostream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

bool ok(int i, int x, int y, int z) {
  return x * x + y * y + z * z + x * y + y * z + z * x <= i;
}

int main() {
  int N;
  cin >> N;
  FOR(i, 1, N + 1) {
    int ans = 0;
    FOR(x, 1, 101) {
      if (x * x > i)
        break;
      FOR(y, 1, 101) {
        if (x * x + y * y > i)
          break;

        int l = 1, r = 101;
        while (l + 1 < r) {
          int mid = (l + r) / 2;
          if (ok(i, x, y, mid))
            l = mid;
          else
            r = mid;
        }
        if (x * x + y * y + l * l + x * y + y * l + l * x == i)
          ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <iostream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
  int N;
  cin >> N;
  FOR(i, 1, N + 1) {
    int ans = 0;
    FOR(x, 1, 101) {
      if (x * x > i)
        break;
      FOR(y, 1, 101) {
        if (x * x + y * y > i)
          break;
        FOR(z, 1, 101) {
          if (x * x + y * y + z * z + x * y + y * z + z * x > i)
            break;
          if (x * x + y * y + z * z + x * y + y * z + z * x == i)
            ans++;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int n;
  cin >> n;
  vector<int> cnt(n + 1, 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++) {
        int res = x * x + y * y + z * z + x * y + y * z + z * x;
        if (res > n)
          break;
        cnt[res]++;
      }
    }
  }
  for (int i = 1; i <= n; i++)
    cout << cnt[i] << endl;

  return 0;
}

Error: 0

Fixed submission:

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

int main() {
  int n;
  cin >> n;
  vector<int> cnt(n + 1, 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++) {
        int res = x * x + y * y + z * z + x * y + y * z + z * x;
        cnt[res]++;
      }
    }
  }
  for (int i = 1; i <= n; i++)
    cout << cnt[i] << endl;

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

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

#define froop1(a, n) for (int i = a; i < n; i++)
#define froop2(a, n) for (int i = a; i > n; i--)

#define ll long long

#define pq(name, type) priority_queue<type> name
#define vec(name, type, length, value) vector<type> name(length, value)
#define vec2(name, type, length, width, value)                                 \\
  vector<vector<type>> name(length, vector<type>(width, value));

int main() {
  int N;
  cin >> N;
  map<int, int> c;
  int n = sqrt(N);
  int count = 0;
  for (int j = 1; j < n; j++) {
    for (int k = 1; k < n; k++) {
      if (j * j + k * k + j * k > N)
        break;
      for (int l = 1; l < n; l++) {
        int cc = j * j + k * k + l * l + j * k + k * l + l * j;
        if (c.count(cc))
          c[cc]++;
        else
          c[cc] = 1;
      }
    }
  }
  froop1(1, N + 1) { cout << c[i] << endl; }
}

Error: TLE

Fixed submission:

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

#define froop1(a, n) for (int i = a; i < n; i++)
#define froop2(a, n) for (int i = a; i > n; i--)

#define ll long long

#define pq(name, type) priority_queue<type> name
#define vec(name, type, length, value) vector<type> name(length, value)
#define vec2(name, type, length, width, value)                                 \\
  vector<vector<type>> name(length, vector<type>(width, value));

int main() {
  int N;
  cin >> N;
  froop1(1, N + 1) {
    int n = sqrt(i);
    int count = 0;
    for (int j = 1; j < n; j++) {
      for (int k = 1; k < n; k++) {
        for (int l = 1; l < n; l++) {
          if (j * j + k * k + l * l + j * k + k * l + l * j == i)
            count++;
        }
      }
    }
    cout << count << endl;
  }
}