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

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N + 1);

  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      for (int k = 1; k <= 100; k++) {
        int b = i * i + j * j + k * k + i * j + j * k + k * i;
        if (b <= N) {
          a.at(b)++;
        }
      }
    }
  }

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

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


Fixed submission:

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);

  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      for (int k = 1; k <= 100; k++) {
        int b = i * i + j * j + k * k + i * j + j * k + k * i;
        if (b <= N) {
          a.at(b)++;
        }
      }
    }
  }

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

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

int fun(int N) {
  int count = 0;
  int m = int(sqrt(N)) + 1;
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= i; j++) {
      for (int k = 1; k <= j; k++) {
        int A = i + j + k;
        if (A * A - i * j - j * k - k * i == N) {
          int t = 0;
          if (i == j) {
            t += 1;
          }
          if (i == k) {
            t += 1;
          }
          if (j == k) {
            t += 1;
          }
          if (t == 0) {
            count += 6;
          } else if (t == 1) {
            count += 3;
          } else {
            count += 1;
          }
        }
      }
    }
  }
  return count;
}

int main() {
  int N;
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cout << fun(i) << endl;
  }
}

Error: TLE

Fixed submission:

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

int fun(int N) {
  int count = 0;
  int m = N / 2;
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= i; j++) {
      for (int k = 1; k <= j; k++) {
        int A = i + j + k;
        if (A * A - i * j - j * k - k * i == N) {
          int t = 0;
          if (i == j) {
            t += 1;
          }
          if (i == k) {
            t += 1;
          }
          if (j == k) {
            t += 1;
          }
          if (t == 0) {
            count += 6;
          } else if (t == 1) {
            count += 3;
          } else {
            count += 1;
          }
        }
      }
    }
  }
  return count;
}

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

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

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

Error: TLE

Fixed submission:

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

int main() {
  int n, t, y = 1, z = 1;
  cin >> n;
  vector<int> cnt(n, 0);
  t = sqrt(n);
  for (int i = 0; i < n; i++) {
    for (int x = 1; x < t; x++) {
      for (y = 1; y < sqrt(n - x * x); y++) {
        for (z = 1; z < sqrt(n - x * x - y * y - x * y); z++) {
          if (x * x + y * y + z * z + x * y + x * z + y * z == i + 1) {
            cnt.at(i)++;
          }
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    cout << cnt.at(i) << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <cstdio>

using namespace std;
int n, tmp, Ans[10010];
int main() {
  scanf("%d", &n);
  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        int k = (x * x) + (y * y) + (z * z) + (x * y) + (x * z) + (y * z);
        if (k <= n)
          Ans[k]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    printf("%d\\n", Ans[i]);
  }
  return 0;
}

Error: 0

Fixed submission:

#include <cstdio>

using namespace std;
int n, tmp, Ans[1010];
int main() {
  scanf("%d", &n);
  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        int k = (x * x) + (y * y) + (z * z) + (x * y) + (x * z) + (y * z);
        if (k <= n)
          Ans[k]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    printf("%d\\n", Ans[i]);
  }
  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)
using namespace std;
#define pri(str) cout << str << endl
using ll = long long;
using P = pair<int, int>;

const ll MX = 1e18;
const long double PI = acos(-1);

int main() {
  int n;
  cin >> n;
  vector<int> count(10005);
  int a = sqrt(n);

  for (int i = 1; i < a; ++i) {
    for (int j = 1; j < a; ++j) {
      for (int k = 1; k < a; ++k) {
        int s = i * i + j * j + k * k + i * j + j * k + k * i;
        if (s < 10005)
          count[s - 1] += 1;
      }
    }
  }

  if (n == 0)
    pri(0);
  else {
    rep(i, n) pri(count[i]);
  }
  return 0;
}


Error: -6
malloc(): corrupted top size


Fixed submission:

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

const ll MX = 1e18;
const long double PI = acos(-1);

int main() {
  int n;
  cin >> n;
  vector<int> count(n);
  if (n == 0) {
    pri(0);
    return 0;
  }
  int a = sqrt(n) + 1;
  for (int i = 1; i < a; ++i) {
    for (int j = 1; j < a; ++j) {
      for (int k = 1; k < a; ++k) {
        int s = i * i + j * j + k * k + i * j + j * k + k * i;
        count[s - 1] += 1;
      }
    }
  }

  rep(i, n) pri(count[i]);
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

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

using namespace std;

int main(void) {
  int N, ans[10001] = {};
  cin >> N;
  for (int i = 1; i <= sqrt(N); i++) {
    for (int j = 1; j <= sqrt(N); j++) {
      for (int k = 1; k <= sqrt(N); k++) {
        if (i * i + j * j + k * k + i * j + j * k + k * i <= 10000) {
          ans[i * i + j * j + k * k + i * j + j * k + k * i]++;
        }
      }
    }
  }

  for (int i = 0; i < N; i++) {
    printf("%d\\n", ans[i + 1]);
  }
  return 0;
}

Error: -11

Fixed submission:

#include <cmath>
#include <iostream>
#include <stdio.h>
#include <vector>

using namespace std;

int func(int n) {
  int ans = 0;
  for (int i = 1; i <= round(sqrt(n)); i++) {
    for (int j = 1; j <= round(sqrt(n)); j++) {
      for (int k = 1; k <= round(sqrt(n)); k++) {
        if (i * i + j * j + k * k + i * j + j * k + k * i == n)
          ++ans;
      }
    }
  }
  return ans;
}

int main(void) {
  int N;
  vector<int> memo;
  cin >> N;

  memo[0] = 0;
  for (int i = 1; i <= N; i++) {
    memo.at(i) = func(i);
  }

  for (auto x : memo) {
    cout << x << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
const long long INF = 1LL << 60;

typedef pair<ll, ll> Pair;

int main() {

  ll N;

  cin >> N;

  vector<ll> cnt(N, 0);

  ll limit = (sqrt(N) + 0.5);

  for (ll x = 1; x < limit; ++x) {
    for (ll y = 1; y < limit; ++y) {
      for (ll z = 1; z < limit; ++z) {

        ll index = (x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (z * x);

        if (index > cnt.size())
          continue;
        cnt[index]++;
      }
    }
  }

  for (ll i = 1; i <= N; ++i)
    cout << cnt[i] << endl;

  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
const long long INF = 1LL << 60;

typedef pair<ll, ll> Pair;

int main() {

  ll N;

  cin >> N;

  vector<ll> cnt(N, 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 index = (x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (z * x);

        cnt[index]++;
      }
    }
  }

  for (ll 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;
using pll = pair<long long, long long>;

int main() {
  int N;
  cin >> N;
  for (int i = 1; i <= N; i++) {
    long long ans = 0;
    map<tuple<int, int, int>, int> mp;
    for (int x = 1; x * x < i; x++) {
      for (int y = x; x * x + y * y + x * y <= i; y++) {
        for (int z = y; x * x + y * y + z * z + x * y + y * z + z * x <= i;
             z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == i) {
            /// cout <<i <<" "<< x <<" "<<  y <<" "<< z << endl;
            if (mp[make_tuple(x, y, z)] == 1)
              continue;
            mp[make_tuple(x, y, z)] = 1;
            mp[make_tuple(x, z, y)] = 1;
            mp[make_tuple(y, x, z)] = 1;
            mp[make_tuple(y, z, x)] = 1;
            mp[make_tuple(z, x, y)] = 1;
            mp[make_tuple(z, y, x)] = 1;

            if (x == y && y == z)
              ans++;
            else if (x == y || y == z || z == x)
              ans += 3;
            else
              ans += 6;
          }
        }
      }
    }
    cout << ans << endl;
  }
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
using pll = pair<long long, long long>;

int main() {
  int N;
  cin >> N;
  for (int i = 1; i <= N; i++) {
    long long ans = 0;
    map<tuple<int, int, int>, int> mp;
    for (int x = 1; x < i * i; x++) {
      for (int y = x; y < i * i; y++) {
        for (int z = y; z < i * i; z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == i) {
            // cout <<i <<" "<< x <<" "<<  y <<" "<< z << endl;
            if (mp[make_tuple(x, y, z)] == 1)
              continue;
            mp[make_tuple(x, y, z)] = 1;
            mp[make_tuple(x, z, y)] = 1;
            mp[make_tuple(y, x, z)] = 1;
            mp[make_tuple(y, z, x)] = 1;
            mp[make_tuple(z, x, y)] = 1;
            mp[make_tuple(z, y, x)] = 1;

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

#include <bits/stdc++.h>

using namespace std;

using usize = ::std::size_t;
using u64 = ::std::uint_least64_t;

static constexpr u64 Inf = ::std::numeric_limits<u64>::max() / 2;

u64 N;

#define v(x, y, z) pow(x, 2) + pow(y, 2) + pow(z, 2) + x *y + y *z + z *x

map<u64, u64> fac = {{0, 6}, {1, 3}, {3, 1}};

int main(int argc, char *argv[]) {

  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> N;
  vector<u64> cnt(10010, 0);

  for (u64 x = 1; x <= 100; x++) {
    for (u64 y = x; y <= 100; y++) {
      for (u64 z = y; z <= 100; z++) {
        if (v(x, y, z) > 10000) {
          continue;
        }
        u64 overlapped = 0;
        overlapped += (u64)(x == y);
        overlapped += (u64)(y == z);
        overlapped += (u64)(x == z);
        cnt[v(x, y, z)] += fac[overlapped];
        // cout << x << " " << y << " " << z << endl;
      }
    }
  }

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

  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

using usize = ::std::size_t;
using u64 = ::std::uint_least64_t;

static constexpr u64 Inf = ::std::numeric_limits<u64>::max() / 2;

u64 N;

#define v(x, y, z) pow(x, 2) + pow(y, 2) + pow(z, 2) + x *y + y *z + z *x

map<u64, u64> fac = {{0, 6}, {1, 3}, {3, 1}};

int main(int argc, char *argv[]) {

  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> N;

  for (u64 n = 1; n <= N; n++) {
    u64 f = 0;
    for (u64 x = 1; x <= sqrt(n); x++) {
      for (u64 y = x; y <= sqrt(n); y++) {
        for (u64 z = y; z <= sqrt(n); z++) {
          if (v(x, y, z) != n) {
            continue;
          }
          u64 overlapped = 0;
          overlapped += (u64)(x == y);
          overlapped += (u64)(y == z);
          overlapped += (u64)(x == z);
          f += fac[overlapped];
          // cout << x << " " << y << " " << z << endl;
        }
      }
    }
    cout << f << 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<long> mem(N + 1, 0);

  for (int i = 1; i < 110; i++) {
    for (int j = 1; j < 110; j++) {
      for (int k = 1; k < 110; k++) {
        long v = i * i + j * j + k * k + i * j + j * k + k * i;
        if (v <= N)
          mem[v]++;
      }
    }
  }
  for (int i = 1; i <= N; i++) {
    cout << mem[i] << endl;
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

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

  vector<int> mem(N + 1, 0);

  for (int i = 1; i <= N; i++) {
    for (int x = 1; x < N; x++) {
      if (x > i)
        break;
      for (int y = 1; y < N; y++) {
        if (y > i)
          break;
        for (int z = 1; z < N; z++) {
          if (z > i)
            break;
          if (x * x + y * y + z * z + x * y + y * z + z * x == i) {
            // printf("i:%d, x:%d,y:%d,x:%d\\n", i,x,y,z);
            mem.at(i)++;
          }
        }
      }
    }

    cout << mem.at(i) << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

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

  ll ans = 0;

  rep(i, n) {
    rep(x, sqrt(i)) {
      rep(y, x) {
        rep(z, y) {
          if ((x + y + z) * (x + y + z) - (x * y + y * z + z * x) == i) {
            if (x == y && y == z) {
              ans++;
            } else if (x == y || y == z || z == x) {
              ans += 3;
            } else {
              ans += 6;
            }
          }
        }
      }
    }
    cout << ans << endl;
    ans = 0;
  }
}


Error: TLE

Fixed submission:

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

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

  ll ans = 0;

  rep(i, n) {
    rep(x, sqrt(i)) {
      if ((x * x + 3 + 2 * x) > i) {
        break;
      }
      rep(y, sqrt(i)) {
        if ((x * x + y * y + 1 + x * y + y + x) > i) {
          break;
        }
        rep(z, sqrt(i)) {
          ll a = (x * x + y * y + z * z + x * y + y * z + z * x);
          if (a == i) {
            ans++;
          } else if (a > n) {
            break;
          }
        }
      }
    }
    cout << ans << endl;
    ;
    ans = 0;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(obj) (obj).begin(), (obj).end()
using namespace std;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x % y) : x; }

int main() {
  int N;
  cin >> N;
  vector<int> ans(N);
  for (int i = 1; i < N; ++i) {
    for (int j = 1; j < sqrt(N); ++j) {
      for (int k = 1; k < sqrt(N); ++k) {
        int n = pow(i, 2) + pow(j, 2) + pow(k, 2) + i * j + j * k + k * i;
        if (n <= N)
          ans[n - 1]++;
      }
    }
  }
  for (auto a : ans) {
    cout << a << endl;
  }
  return 0;
}


Error: -6
malloc(): corrupted top size


Fixed submission:


#include <algorithm>
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(obj) (obj).begin(), (obj).end()
using namespace std;
typedef long long ll;
long long GCD(long long x, long long y) { return y ? GCD(y, x % y) : x; }

int main() {
  int N;
  cin >> N;
  vector<int> ans(N + 1);
  for (int i = 1; i < N; ++i) {
    for (int j = 1; j < (N + 1 - i); ++j) {
      for (int k = 1; k < (N + 1 - i - j); ++k) {
        int n = pow(i, 2) + pow(j, 2) + pow(k, 2) + i * j + j * k + k * i;
        ans[n - 1]++;
      }
    }
  }
  for (auto a : ans) {
    cout << a << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define reps(i, n) for (ll i = 1; i <= (n); ++i)
#define _rep(i, n) for (ll i = (n)-1; i >= 0; --i)
#define _reps(i, n) for (ll i = n; i > 0; --i)
#define all(x) (x).begin(), (x).end()
#define _all(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

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

  reps(i, n) {
    ll cnt = 0;
    for (ll x = 1; x * x < i; x++) {
      for (ll y = 1; ((x * x) + (y * y) + (x * y)) < i; y++) {

        for (ll z = 1;
             ((x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (z * x)) <= i;
             z++) {
          if (((x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (z * x)) ==
              i) {
            cnt++;
          }
        }
      }
    }
    cout << cnt << endl;
  }

  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define reps(i, n) for (ll i = 1; i <= (n); ++i)
#define _rep(i, n) for (ll i = (n)-1; i >= 0; --i)
#define _reps(i, n) for (ll i = n; i > 0; --i)
#define all(x) (x).begin(), (x).end()
#define _all(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

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

  reps(i, n) {
    ll cnt = 0;
    for (ll x = 1; x * x < i; x++) {
      for (ll y = 1; ((x * x) + (y * y)) < i; y++) {
        for (ll z = 1; ((x * x) + (y * y) + (z * z)) < i; z++) {
          if (((x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (z * x)) ==
              i) {
            cnt++;
          }
        }
      }
    }
    cout << cnt << 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++)
#define FOR(i, a, b) for (int i = a; i < (b + a); i++)
#define W1 while (1)
#define COUT(x) cout << x << endl
using namespace std;
using ll = long long;
using ld = long double;
#define ALL(x) x.begin(), x.end()
#define P pair<int, int>
#define mod 1000000007
#define PB push_back
#define F first
#define S second

int main() {
  int n;
  cin >> n;
  vector<int> f(n + 1, 0);
  for (int i = 1; i * i <= n; i++) {
    for (int j = 1; j * j <= n; j++) {
      for (int k = 1; k * k <= n; k++) {
        int num = i * i + j * j + k * k + i * j + j * k + k * i;
        if (f.size() - 1 < num)
          continue;
        f[num]++;
      }
    }
  }
  FOR(i, 1, n) { COUT(f[i]); }

  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = a; i < (b + a); i++)
#define W1 while (1)
#define COUT(x) cout << x << endl
using namespace std;
using ll = long long;
using ld = long double;
#define ALL(x) x.begin(), x.end()
#define P pair<int, int>
#define mod 1000000007
#define PB push_back
#define F first
#define S second

int main() {
  int n;
  cin >> n;
  vector<int> f(n + 1, 0);
  for (int i = 1; i * i <= n; i++) {
    for (int j = 1; j * j <= n; j++) {
      for (int k = 1; k * k <= n; k++) {
        int num = i * i + j * j + k * k + i * j + j * k + k * i;
        f[num]++;
      }
    }
  }
  FOR(i, 1, n) { COUT(f[i]); }

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

#include <cmath>    //sin, cos, tan
#include <iostream> // cout, endl, cin
#include <map>      // map

using namespace std;
typedef long long ll;

int main(void) {
  ll n;
  cin >> n;
  map<ll, ll> ans;
  for (ll i = 1; i <= sqrt(n); i++) {
    for (ll j = 1; j <= sqrt(n); j++) {
      for (ll k = 1; k <= sqrt(n); k++) {
        ans[i * i + j * j + k * k + i * j + j * k + i * k]++;
      }
    }
  }
  // output
  for (ll i = 0; i < n; i++) {
    cout << ans[i + 1] << endl;
  }
}

Error: TLE

Fixed submission:

#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <deque>     // deque
#include <iomanip>   //setprecsion
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <utility>   // pair, make_pair
#include <vector>    // vector

#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>  //sin, cos, tan

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T> void fin(T a) {
  cout << a << endl;
  exit(0);
}

void Main() {
  ll n;
  cin >> n;
  rep(N, n) {
    ll ans = 0;
    for (ll i = 1; i <= N + 1; i++) {
      for (ll j = i; j <= N + 1 - i * i; j++) {
        for (ll k = j; k <= N + 1 - i * i - j * j - i * j; k++) {
          if (i * i + j * j + k * k + i * j + j * k + i * k == N + 1) {
            if (i != j && j != k)
              ans += 6;
            else if (i != j || j != k)
              ans += 3;
            else
              ans++;
          }
        }
      }
    }
    cout << ans << endl;
  }
}

// 前処理
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(4); // 高精度少数表示
  Main();
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

using namespace std;

int main() {

  ios_base::sync_with_stdio(0);
  cin.tie(NULL);

  int n;
  cin >> n;

  vector<int> ar(10005);

  for (int i = 1; i <= 110; i++) {
    for (int j = 1; j <= 110; j++) {
      for (int z = 1; z <= 110; z++) {
        int calc = i * i + j * j + z * z + i * j + j * z + i * z;
        if (calc <= 10005)
          ar[calc - 1]++;
      }
    }
  }
  for (int x = 0; x < n; x++) {
    cout << ar[x] << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

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

using namespace std;

int main() {

  int n;
  cin >> n;
  int x = 1, y = 1, z = 1, num, count = 0;

  for (int i = 1; i <= n; i++) {
    x = y = z = 1;
    while (y != 100 || x != 100 || z != 100) {
      if (((x * x) + (y * y) + (z * z) + (x * y) + (x * z) + (y * z)) == i) {
        count++;
      }

      if (x == 100 && y != 100) {
        y++;
        x = 1;
      }

      else if (y == 100 && x == 100) {
        z++;
        x = 1;
        y = 1;
      } else {
        x++;
      }
    }
    cout << count << endl;
    count = 0;
  }

  return 0;
}