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

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
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;
}

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll << 61;
double pi = 3.141592653589793238;

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

  vector<ll> ans(n);

  reps1(x, ll(sqrt(n))) {
    reps1(y, ll(sqrt(n))) {
      reps1(z, ll(sqrt(n))) {
        ll tmp = x * x + y * y + z * z + x * y + y * z + z * x;
        if (tmp > n)
          continue;
        ans[tmp]++;
      }
    }
  }

  reps1(i, n + 1) cout << ans[i] << endl;

  /*

  reps1(i, n+1) {
    ll ans = 0;
    reps1(x, ll(sqrt(i))) {
      reps1(y, ll(sqrt(i))) {
        ll judge = (x+y)*(x+y) - 4 * (x*x + y*y + x*y - i);
        // cout << i << " " << x << " " << y << " " << judge << endl;
        if (ll(sqrt(judge)) * ll(sqrt(judge)) != judge) continue;
        // cout << "a";
        if (-(x+y)*(x+y) + judge <= 0) continue;
        // cout << "b";
        // cout << -(x+y)*(x+y) + judge << endl;
        if ((-(x+y)*(x+y) + judge) % 2 != 0) continue;
        // cout << "c" << endl;
        ans++;

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

  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
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;
}

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll << 61;
double pi = 3.141592653589793238;

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

  vector<ll> ans(n);

  reps1(x, ll(sqrt(n))) {
    reps1(y, ll(sqrt(n))) {
      reps1(z, ll(sqrt(n))) {
        ans[x * x + y * y + z * z + x * y + y * z + z * x]++;
      }
    }
  }

  reps1(i, n + 1) cout << ans[i] << endl;

  /*

  reps1(i, n+1) {
    ll ans = 0;
    reps1(x, ll(sqrt(i))) {
      reps1(y, ll(sqrt(i))) {
        ll judge = (x+y)*(x+y) - 4 * (x*x + y*y + x*y - i);
        // cout << i << " " << x << " " << y << " " << judge << endl;
        if (ll(sqrt(judge)) * ll(sqrt(judge)) != judge) continue;
        // cout << "a";
        if (-(x+y)*(x+y) + judge <= 0) continue;
        // cout << "b";
        // cout << -(x+y)*(x+y) + judge << endl;
        if ((-(x+y)*(x+y) + judge) % 2 != 0) continue;
        // cout << "c" << endl;
        ans++;

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

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

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

int main() {
  int N;
  cin >> N;
  vector<int> A(100000);
  for (int i = 1; i < 200; i++) {
    for (int j = 1; j < 200; j++) {
      for (int k = 1; k < 200; k++) {
        int ans = i * i + j * j + k * k + i * j + j * k + k * i;
        if (ans < 100000) {
          A.at(ans - 1)++;
        }
      }
    }
  }
  for (int i = 0; i < N; i++) {
    cout << A.at(i) << endl;
  }
}


Error: TLE

Fixed submission:

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

int main() {
  int N;
  cin >> N;
  for (int i = 1; i <= N; i++) {
    int cnt = 0;
    for (int j = 1; j < sqrt(N / 6); j++) {
      int p = j;
      for (int k = j; k < sqrt(N); k++) {
        int q = k;
        for (int l = k; l < sqrt(N); l++) {
          int ans = (p + q) * (p + q) + (q + l) * (q + l) + (l + p) * (l + p);
          if (ans == 2 * i) {
            if (p == q && q == l) {
              cnt += 1;
            } else if (p == q || q == l || l == p) {
              cnt += 3;
            } else {
              cnt += 6;
            }
          }
        }
      }
    }
    cout << cnt << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
int n, arr[200001], ans;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        long long cur = x * x;
        cur += y * y;
        cur += z * z;
        cur += x * y;
        cur += y * z;
        cur += x * z;
        arr[cur]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << arr[i] << '\\n';
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
int n, arr[200001], ans;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int num = 0;
    for (int x = 1; x * x <= i; x++) {
      for (int y = 1; y * y + x * x + x * y <= i; y++) {
        for (int z = 1; z * z + x * x + y * y <= i; z++) {
          long long cur = x * x;
          cur += y * y;
          cur += z * z;
          cur += x * y;
          cur += y * z;
          cur += x * z;
          if (cur > i)
            break;
          if (cur == i)
            num++;
        }
      }
    }
    cout << num << '\\n';
  }
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int MOD = (int)1e9 + 7;
const double PI = 3.14159265358979323846;

int main(void) {
  ll n;
  cin >> n;
  vector<ll> f(n + 1, 0);
  for (ll x = 1; x * x <= 2 * n; x++) {
    for (ll y = 1; y * y <= 2 * n; y++) {
      for (ll z = 1; z * z <= 2 * n; z++) {
        ll val = (x + y + z) * (x + y + z) + x * x + y * y + z * z;
        // if (val == 2 * n) f[n]++;
        if (val % 2 == 0 && val / 2 <= n) {
          f[val / 2]++;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++)
    cout << f[i] << endl;
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int MOD = (int)1e9 + 7;
const double PI = 3.14159265358979323846;

int main(void) {
  int n;
  cin >> n;
  vector<int> f(n + 1, 0);
  for (int x = 1; x * x <= 2 * n; x++) {
    for (int y = 1; y * y <= 2 * n; y++) {
      for (int z = 1; z * z <= 2 * n; z++) {
        int val = (x + y + z) * (x + y + z) + x * x + y * y + z * z;
        // if (val == 2 * n) f[n]++;
        if (val % 2 == 0) {
          f[val / 2]++;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++)
    cout << f[i] << endl;
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define pp pair<int, int>
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define rep2(i, m, n) for (int(i) = (m); (i) < (n); (i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(), (a).end()
#define mk make_pair
ll mod = 998244353;
int inf = 1000001000;
ll INF = 1e18 + 5;
ll MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  rep2(i, 1, n + 1) {
    int ans = 0;
    int m = ceil(sqrt(i));
    rep2(x, 1, m) {
      rep2(y, 1, m) {
        double z =
            (-x - y + sqrt(-3 * x * x - 3 * y * y - 2 * x * y + 4 * i)) / 2;
        if (z >= 1 && z == floor(z))
          ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define pp pair<int, int>
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define rep2(i, m, n) for (int(i) = (m); (i) < (n); (i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(), (a).end()
#define mk make_pair
ll mod = 998244353;
int inf = 1000001000;
ll INF = 1e18 + 5;
ll MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  rep2(i, 1, n + 1) {
    int ans = 0;
    int m = ceil(sqrt(i)) + 1;
    rep2(x, 1, m) {
      rep2(y, 1, m) {
        rep2(z, 1, m) {
          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: Time Limit Exceeded

#include <bits/stdc++.h>
#define ll long long int

using namespace std;

int main() {
  ll t, n, item, temp = 1, h, flag1 = 0, flag2 = 0, cost = 100000000000,
                 sum = 0, k, avg = 0, x, y, z;
  vector<ll> v1;
  vector<ll> v2;
  map<ll, ll> mp;
  ll L, R, d;
  cin >> n;
  for (ll i = 1; i <= 105; i++) {
    sum = 0;

    for (ll j = 1; j <= 105; j++) {
      for (ll k = 1; k <= 105; k++) {

        sum = i * i + j * j + k * k + i * j + j * k + k * i;
        mp[sum]++;
      }
    }
  }
  for (int i = 1; i <= n; i++)
    cout << mp[i] << endl;

  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define ll long long int

using namespace std;

int main() {
  ll t, n, item, temp = 1, h, flag1 = 0, flag2 = 0, cost = 100000000000,
                 sum = 0, k, avg = 0, x, y, z;
  vector<ll> v1;
  vector<ll> v2;
  map<ll, ll> mp;
  ll L, R, d;
  cin >> n;
  for (ll i = 1; i <= n; i++) {
    sum = 0;

    for (ll j = 1; j <= n; j++) {
      for (ll k = 1; k <= n; k++) {

        sum = i * i + j * j + k * k + i * j + j * k + k * i;
        mp[sum]++;
      }
    }
  }
  for (int i = 1; i <= n; i++)
    cout << mp[i] << endl;

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

#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
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;
}
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Pl = pair<long long, long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

vecl f(10001);

int main() {
  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++) {
        ll ret = x * x + y * y + z * z + x * y + y * z + x * z;
        if (ret <= 10000)
          f[ret]++;
      }
    }
  }
  for (int i = 1; i <= N; i++)
    cout << f[i] << endl;
}

Error: -6
corrupted size vs. prev_size


Fixed submission:

#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); ++i)
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;
}
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Pl = pair<long long, long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

vecl f(10001);

int main() {
  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++) {
        ll ret = x * x + y * y + z * z + x * y + y * z + x * z;
        if (ret <= 10001)
          f[ret]++;
      }
    }
  }
  for (int i = 1; i <= N; i++)
    cout << f[i] << endl;
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define optimize_cin()                                                         \\
  cin.tie(0);                                                                  \\
  ios::sync_with_stdio(false)
using namespace std;
using ll = long long;
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() {
  int n;
  cin >> n;
  vector<int> v(n + 1, 0);

  reps(i, 100) {
    reps(j, 100) {
      reps(k, 100) {
        int s = i * i + j * j + k * k + i * j + j * k + k * i - 1;
        if (s + 1 > n)
          continue;
        v[s]++;
      }
    }
  }

  rep(i, n) { cout << v[i] << endl; }
}


Error: -11

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define optimize_cin()                                                         \\
  cin.tie(0);                                                                  \\
  ios::sync_with_stdio(false)
using namespace std;
using ll = long long;
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() {
  int n;
  cin >> n;
  vector<int> v(n, 0);

  reps(i, 100) {
    reps(j, 100) {
      reps(k, 100) {
        int s = i * i + j * j + k * k + i * j + j * k + k * i;
        v[s - 1]++;
      }
    }
  }

  rep(i, n) { cout << v[i] << endl; }
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
typedef long long int64;
typedef vector<int> vec;
typedef vector<int64> vec64;
#define db(x) cout << "> " << #x << ": " << x << "\\n";
#define ss cout << " ";
#define ct(x) cout << x;
#define nn cout << "\\n";
#define cts(x) cout << x << " ";
#define ctn(x) cout << x << "\\n";
#define qr queries();
void solve();
void YN(bool b) {
  if (b) {
    ctn("YES");
  } else {
    ctn("NO");
  }
};
void yn(bool b) {
  if (b) {
    ctn("Yes");
  } else {
    ctn("No");
  }
};
void queries() {
  int n;
  cin >> n;
  while (n--)
    solve();
}
// // // // // // // // // // // // // // // // // // // // // //
/*                  TEMPLATE - VANILLA                         */
// // // // // // // // // // // // // // // // // // // // // //
int64 q, n;

void solve() { return; }

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vec arr(100500);
  for (int i = 1; i <= 110; i++) {
    for (int j = 1; j <= 110; j++) {
      for (int k = 1; k <= 110; k++) {
        int64 l = i * i + j * j + k * k + i * j + j * k + k * i;
        if (l <= 10100) {
          arr[l]++;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    ctn(arr[i]);
  }
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long int64;
typedef vector<int> vec;
typedef vector<int64> vec64;
#define db(x) cout << "> " << #x << ": " << x << "\\n";
#define ss cout << " ";
#define ct(x) cout << x;
#define nn cout << "\\n";
#define cts(x) cout << x << " ";
#define ctn(x) cout << x << "\\n";
#define qr queries();
void solve();
void YN(bool b) {
  if (b) {
    ctn("YES");
  } else {
    ctn("NO");
  }
};
void yn(bool b) {
  if (b) {
    ctn("Yes");
  } else {
    ctn("No");
  }
};
void queries() {
  int n;
  cin >> n;
  while (n--)
    solve();
}
// // // // // // // // // // // // // // // // // // // // // //
/*                  TEMPLATE - VANILLA                         */
// // // // // // // // // // // // // // // // // // // // // //
int64 q, n;

void solve() { return; }

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vec arr(n);
  for (int i = 1; i <= 110; i++) {
    for (int j = 1; j <= 110; j++) {
      for (int k = 1; k <= 110; k++) {
        int64 l = i * i + j * j + k * k + i * j + j * k + k * i;
        if (l <= 10100) {
          arr[l]++;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    ctn(arr[i]);
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <stdio.h>
#include <string>
#include <vector>

int main(void) {
  int n;
  long long s;
  std::cin >> n;
  std::vector<int> f(1000500);
  for (int x = 1; x <= 102; x++) {
    for (int y = 1; y <= 102; y++) {
      for (int z = 1; z <= 102; z++) {
        s = x * x + y * y + z * z + x * y + y * z + z * x;
        f.at(s - 1) += 1;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    std::cout << f.at(i) << std::endl;
  }
  return 0;
}

Error: -6
terminate called after throwing an instance of 'std::out_of_range'
  what():  vector::_M_range_check: __n (which is 10202) >= this->size() (which is 10100)


Fixed submission:

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <stdio.h>
#include <string>
#include <vector>

int main(void) {
  int n;
  long long s;
  std::cin >> n;
  std::vector<int> f(10100);
  for (int x = 1; x <= 110; x++) {
    for (int y = 1; y <= 110; y++) {
      for (int z = 1; z <= 110; z++) {
        s = x * x + y * y + z * z + x * y + y * z + z * x;
        f.at(s - 1) += 1;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    std::cout << f.at(i) << std::endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
  ll n, error = 0;
  cin >> n;
  ll f[10005];
  memset(f, 0, sizeof(f));
  for (ll i = 1; i <= 100; i++) {
    for (ll j = 1; j <= 100; j++) {
      for (ll k = 1; k <= 100; k++) {
        ll x = i * i + j * j + k * k + i * j + i * k + j * k;
        if (x <= 10000) {
          f[x]++;
        }
      }
    }
  }
  for (ll i = 1; i <= n; i++) {
    cout << f[i] << endl;
  }
}

Error: -11

Fixed submission:

#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
  ll n, error = 0;
  cin >> n;
  ll f[n + 5];
  memset(f, 0, sizeof(f));
  bool udh = false;
  for (ll i = 1; i <= n; i++) {
    for (ll j = 1; j <= i; j++) {
      for (ll k = 1; k <= j; k++) {
        ll x = i * i + j * j + k * k + i * j + i * k + j * k;
        if (i == j && j == k) {
          f[x]++;
        } else if (i == j && j != k) {
          f[x] += 3;
        } else if (i != k && j == k) {
          f[x] += 3;
        } else {
          f[x] += 6;
        }
        if (x > n) {
          error++;
          if (error == 100) {
            udh = true;
            break;
          }
        } else if (x <= 2) {
          error = 0;
        }
      }
      if (udh) {
        break;
      }
    }
    if (udh) {
      break;
    }
  }
  for (ll i = 1; i <= n; i++) {
    cout << f[i] << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
#include <bits/stdc++.h>
#include <cmath>
int operation(int x, int y, int z) {
  int val = (x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (x * z);
  return val;
}
int main() {
  int n;
  cin >> n;
  int counter = 0;
  for (int i = 1; i <= n; i++) {
    for (int x = 1; x < 100; x++) {
      for (int y = 1; y < 100; y++) {
        for (int z = 1; z < 100; z++) {
          if (i == operation(x, y, z)) {
            counter++;
          } else if (i < operation(x, y, z))
            break;
        }
      }
    }

    cout << counter << endl;
    counter = 0;
  }

  return 0;
}

Error: 0

Fixed submission:


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

int req[1000000];
int main() {

  int n;
  cin >> n;

  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;
        req[n]++;
      }
    }
  }

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

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

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

int main() {
  vector<int> a(60000);
  for (int x = 1; x <= 100; x++) {
    for (int y = x; y <= 100; y++) {
      for (int z = y; z <= 100; z++) {
        int k = x * x + y * y + z * z + x * y + y * z + z * x - 1;
        if (x == y && y == z)
          a[k]++;
        else if (x != y && y != z && z != x)
          a[k] += 6;
        else
          a[k] += 3;
      }
    }
  }

  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cout << a[i] << endl;
  }
}

Error: TLE

Fixed submission:

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

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int ans = 0;
    for (int x = 1; x <= i / 6 + 1; x++) {
      for (int y = 1; y <= i / 6 + 1; y++) {
        for (int z = 1; z <= i / 6 + 1; 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

#include <iostream>
using namespace std;
int main() {
  int a[10005] = {0};
  int x = 1, y = 1, z = 1, n;
  cin >> n;

  for (int x = 1; x <= 100; x++)
    for (int y = 1; y <= 100; y++)
      for (int z = 1; z <= 100; z++) {
        int s = x * x + y * y + z * z + x * z + x * y + z * y;
        if (s <= 10000)
          a[s]++;
      }
  for (int i = 1; i <= n; i++)
    cout << a[i] << endl;

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int x = 1, y = 1, z = 1, n;
  cin >> n;

  for (int i = 1; i <= n; i++) {
    int s = 0;
    for (x = 1; x <= 80; x++)
      for (y = 1; y <= 80; y++)
        for (z = 1; z <= 80; z++) {
          if (x * x + y * y + z * z + x * z + x * y + y * z == i)
            s++;
        }
    cout << s << endl;
  }

  return 0;
}