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

#include <cmath>
#include <iostream>

int main() {

  int n;
  std::cin >> n;

  const int max = std::sqrt(n);

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

    for (int x = 1; x < max; ++x) {
      int f_x = i;
      f_x -= x * x;
      if (f_x <= 0)
        break;

      for (int y = 1; y < max; ++y) {
        int f_y = f_x;
        f_y -= y * y;
        f_y -= x * y;
        if (f_y < 0)
          break;

        for (int z = 1; z < max; ++z) {
          int f_z = f_y;
          f_z -= z * z;
          f_z -= y * z;
          f_z -= z * x;
          if (f_z < 0)
            break;
          if (f_z == 0) {
            count++;
          }
        }
      }
    }

    std::cout << count << std::endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <cmath>
#include <iostream>

int main() {

  int n;
  std::cin >> n;

  const int max = std::sqrt(n);

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

    for (int x = 1; x < max; ++x) {
      int f_x = x * x;
      if (f_x >= i)
        break;

      for (int y = 1; y < max; ++y) {
        int f_y = f_x;
        f_y += y * y;
        f_y += x * y;
        if (f_y >= i)
          break;

        for (int z = 1; z < max; ++z) {
          int f_z = f_y;
          f_z += z * z;
          f_z += y * z;
          f_z += z * x;
          if (f_y > i)
            break;
          if (f_z == i) {
            count++;
          }
        }
      }
    }

    std::cout << count << std::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)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int a[10010];

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

Error: 0

Fixed submission:

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

int a[10010];

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

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

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

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

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

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

  return 0;
}


Error: TLE

Fixed submission:

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

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

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

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

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

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

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

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


Error: TLE

Fixed submission:

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

int main() {
  int N;
  cin >> N;
  for (int n = 1; n <= N; ++n) {
    int ans = 0;
    for (int x = 1; x <= N; ++x) {
      if (x * x > n)
        break;
      for (int y = 1; y <= N; ++y) {
        if (y * y > n)
          break;
        for (int z = 1; z <= N; ++z) {
          if (z * z > n)
            break;
          int64_t a = x * x + y * y + z * z + x * y + y * z + z * x;
          if (a == n)
            ans++;
        }
      }
    }
    cout << ans << '\\n';
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll arr[10005] = {0};
int main() {
  ll num;
  cin >> num;
  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      for (int k = 1; k <= 100; k++) {
        ll ans = i * i + j * j + k * k + i * j + i * k + j * k;
        if (ans <= 10000)
          arr[ans]++;
      }
    }
  }
  for (int i = 1; i <= num; i++) {
    cout << arr[i] << endl;
  }
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll arr[1005] = {0};
int main() {
  ll num;
  cin >> num;
  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      for (int k = 1; k <= 100; k++) {
        ll ans = i * i + j * j + k * k + i * j + i * k + j * k;
        if (ans <= 1000)
          arr[ans]++;
      }
    }
  }
  for (int i = 1; i <= num; i++) {
    cout << arr[i] << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long

using namespace std;

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

  for (int n = 1; n <= N; ++n) {
    ll ans = 0;
    for (ll x = 1; x * x <= n; ++x) {
      for (ll y = x; y * y <= n - x * x; ++y) {
        for (ll z = y; z * z <= n - x * x - y * y; ++z) {
          ll val = x * x + y * y + z * z + x * y + y * z + z * x;
          if (val == n) {
            if ((x == y) && (y == z) && (z == x)) {
              ans += 1;
            } else if ((x != y) && (y != z) && (z != x)) {
              ans += 6;
            } else {
              ans += 3;
            }
          }
        }
      }
    }

    cout << ans << "\\n";
  }

  return 0;
}


Error: TLE

Fixed submission:

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long

using namespace std;

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

  for (int n = 1; n <= N; ++n) {
    ll ans = 0;
    for (ll x = 1; x * x <= n; ++x) {
      for (ll y = 1; y * y <= n - x * x; ++y) {
        for (ll z = 1; z * z <= n - x * x - y * y; ++z) {
          ll val = x * x + y * y + z * z + x * y + y * z + z * x;
          if (val == n) {
            ans++;
          }
        }
      }
    }

    cout << ans << "\\n";
  }

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

#include <bits/stdc++.h>
#include <cstdint>
#include <vector>
#define FOR(i, l, r) for (int i = (l); i < (r); ++i)
#define RFOR(i, l, r) for (int i = (l); i >= (int)(r); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n - 1, 0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e9;
const int mod = 1e9 + 7;
#define ll long long
int a[10003];

signed main() {
  int n;
  cin >> n;
  FOR(i, 1, 100) {
    FOR(j, 1, 100) {
      FOR(k, 1, 100) {
        int tmp = i * i + j * j + k * k + i * j + j * k + k * i;
        if (tmp <= n)
          a[tmp]++;
      }
    }
  }

  FOR(i, 1, n + 1) cout << a[i] << endl;

  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
#include <cstdint>
#include <vector>
#define FOR(i, l, r) for (int i = (l); i < (r); ++i)
#define RFOR(i, l, r) for (int i = (l); i >= (int)(r); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n - 1, 0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e9;
const int mod = 1e9 + 7;
#define ll long long
int a[1003];

signed main() {
  int n;
  cin >> n;
  FOR(i, 1, 100) {
    FOR(j, 1, 100) {
      FOR(k, 1, 100) {
        int tmp = i * i + j * j + k * k + i * j + j * k + k * i;
        if (tmp <= n)
          a[tmp]++;
      }
    }
  }

  rep(i, n + 1) cout << a[i] << endl;

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

#include <bits/stdc++.h>
#include <cmath>
#include <math.h>
#include <stdio.h>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll = long long;
using ull = unsigned long long;
const ll INF = 1001001001;
const double PI = 3.14159265358979323846;
// 10億7。　　　100000007

// 最大公約数
ll gcd(ll a, ll b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}
// 最小公倍数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

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

  ll N;
  cin >> N;
  // cout<<sqrt(N)<<endl;
  for (int i = 1; i < N + 1; i++) {
    int counter = 0;
    for (int j = 1; j < sqrt(i) + 3; j++) {
      for (int k = j; k < sqrt(i) + 3; k++) {
        for (int l = k; l < sqrt(i) + 3; l++) {
          if (j * j + k * k + l * l + j * k + k * l + l * j == i) {
            if (j == k && k == l) {
              counter++;
            } else if (j != k && k != l && l != j) {
              counter++;
              counter++;
              counter++;
              counter++;
              counter++;
              counter++;
            } else {
              counter++;
              counter++;
              counter++;
            }
          }
        }
      }
    }
    cout << counter << endl;
  }
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <cmath>
#include <math.h>
#include <stdio.h>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll = long long;
using ull = unsigned long long;
const ll INF = 1001001001;
const double PI = 3.14159265358979323846;
// 10億7。　　　100000007

// 最大公約数
ll gcd(ll a, ll b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}
// 最小公倍数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

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

  ll N;
  cin >> N;
  // cout<<sqrt(N)<<endl;
  for (int i = 1; i < N + 1; i++) {
    int counter = 0;
    for (int j = 1; j < sqrt(i) + 20; j++) {
      for (int k = j; k < sqrt(i) + 20; k++) {
        for (int l = k; l < sqrt(i) + 20; l++) {
          if (j * j + k * k + l * l + j * k + k * l + l * j == i) {
            if (j == k && k == l) {
              counter++;
            } else {
              counter++;
              counter++;
              counter++;
            }
          }
        }
      }
    }
    cout << counter << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define mod 1000000007
#define ten5 100005
#define ten52 200005
#define ten6 1000005
#define PI 3.1415926
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define mkpr(x1, x2) make_pair(x1, x2)
typedef long long int ll;

// stack<char> stk;
// set<ll> sll;
set<pair<ll, ll>> spll;
// map<string,ll> mp;
// map<pair<ll,ll>,ll>::iterator iter;
// map<ll,ll> mp;
// deque<ll> deq;
// vector<ll> vll;
ll num[ten5];
// priority_queue<ll> pq;          //decreasing

int main(void) {
  long long int m, n, i, j, k, sum = 0, l, r;
  cin >> n;
  for (i = 1; i <= n; i++) {
    if (i * i > 1e4)
      break;
    for (j = 1; j <= n; j++) {
      if (j * j > 1e4)
        break;
      for (k = 1; k <= n; k++) {
        if (k * k > 1e4)
          break;
        m = i * i + j * j + k * k + i * j + i * k + j * k;
        if (m > 1e4)
          break;
        num[m]++;
      }
    }
  }
  for (i = 1; i <= n; i++) {
    cout << num[i] << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define mod 1000000007
#define ten5 100005
#define ten52 200005
#define ten6 1000005
#define PI 3.1415926
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define mkpr(x1, x2) make_pair(x1, x2)
typedef long long int ll;

// stack<char> stk;
// set<ll> sll;
set<pair<ll, ll>> spll;
// map<string,ll> mp;
// map<pair<ll,ll>,ll>::iterator iter;
// map<ll,ll> mp;
// deque<ll> deq;
// vector<ll> vll;
ll num[ten5];
// priority_queue<ll> pq;          //decreasing

int main(void) {
  long long int m, n, i, j, k, sum = 0, l, r;
  cin >> n;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      for (k = 1; k <= n; k++) {
        m = i * i + j * j + k * k + i * j + i * k + j * k;
        if (m >= 1e4)
          continue;
        num[m]++;
      }
    }
  }
  for (i = 1; i <= n; i++) {
    cout << num[i] << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int n, valx, valy, valz;
  cin >> n;

  for (int i = 1; i <= n; i++) {
    int cnt = 0;
    for (int x = 1; x <= i; x++) {
      valx = x * x;
      if (valx > i)
        break;
      for (int y = 1; y <= i; y++) {
        valy = valx + y * y + x * y;
        if (valy > i)
          break;
        for (int z = 1; z <= i; z++) {
          valz = valy + z * z + y * z + z * x;
          if (valz > i)
            break;
          if (valz == i)
            cnt++;
        }
      }
    }
    cout << cnt << endl;
  }
}


Error: TLE

Fixed submission:

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

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

  for (int i = 1; i <= n; i++) {
    int cnt = 0;
    for (int x = 1; x <= i; x++) {
      for (int y = 1; y <= i; y++) {
        for (int z = 1; z <= i; z++) {
          val = x * x + y * y + z * z + x * y + y * z + z * x;
          ;
          if (val > i)
            continue;
          if (val == i)
            cnt++;
        }
      }
    }
    cout << cnt << endl;
  }
}
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)
using namespace std;
using ll = long long;
using P = pair<int, int>;

void Main() {
  int n;
  cin >> n;
  vector<int> ans(n + 1, 0);
  // for(int a = 1; a <= n; a++){
  // int ans = 0;
  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      for (int k = 1; k <= 100; k++) {
        if (1 <= i * i + j * j + k * k + i * j + j * k + k * i &&
            i * i + j * j + k * k + i * j + j * k + k * i <= n) {
          // ans++;
          ans[i * i + j * j + k * k + i * j + j * k + k * i]++;
        }
      }
    }
  }
  // cout << ans << endl;
  //}
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << endl;
  }
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Error: TLE

Fixed submission:

#include "bits/stdc++.h"

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

void Main() {
  int n;
  cin >> n;
  for (int a = 1; a <= n; a++) {
    int ans = 0;
    for (int i = 1; i <= 100; i++) {
      for (int j = 1; j <= 100; j++) {
        for (int k = 1; k <= 100; k++) {
          if (i * i + j * j + k * k + i * j + j * k + k * i == a) {
            ans++;
          }
        }
      }
    }
    cout << ans << endl;
  }
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int vec[10001];
int func(int x, int y, int z) {
  return x * x + y * y + z * z + x * y + y * z + z * x;
}
int main() {
  int n;
  cin >> n;
  vint ans(n + 1, 0);
  int ma = sqrt(double(n)) + 1;
  for (int i = 1; i <= ma; i++)
    for (int j = 1; j <= ma; j++)
      for (int k = 1; k <= ma; k++) {
        if (func(i, j, k) <= n)
          ans[func(i, j, k)]++;
      }
  rep(i, n) cout << ans[i + 1] << endl;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i, j, n) for (int i = (int)(j); i < (int)(n); i++)
#define mrep(i, n) for (int i = (int)(n); i > 0; i--)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20)
ll INF = 1LL << 60;
ll mod = 1e9 + 7;
ll modn = 998244353;

int vec[10001];
int cosuu(int n) {
  if (n < 20) {
    return vec[n];
  }
  int ans = 0;
  for (int i = 1; i <= 20; i++)
    for (int j = 1; i <= 20; j++)
      for (int k = 1; i <= 20; k++) {
        int s = i * i + j * j + k * k + i * j + j * k + k * i;
        if (s == n)
          ans++;
        if (s > n)
          break;
      }
  vec[n - 1] = ans;
  return vec[n - 1];
}
int main() {
  vec[0] = 0;
  vec[1] = 0;
  vec[2] = 0;
  vec[3] = 0;
  vec[4] = 0;
  vec[5] = 1;
  vec[6] = 0;
  vec[7] = 0;
  vec[8] = 0;
  vec[9] = 0;
  vec[10] = 3;
  vec[11] = 0;
  vec[12] = 0;
  vec[13] = 0;
  vec[14] = 0;
  vec[15] = 0;
  vec[16] = 3;
  vec[17] = 3;
  vec[18] = 0;
  vec[19] = 0;
  int n;
  cin >> n;
  rep(i, n) { cout << cosuu(i) << endl; }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

template <class T> inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

// typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;

// container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
// repetition
//------------------------------------------
#define FOR(i, a, b) for (LL i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define ALL(a) (a).begin(), (a).end()
// constant
//--------------------------------------------
// clear memory
#define CLR(a) memset((a), 0, sizeof(a))

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


Error: TLE

Fixed submission:

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

template <class T> inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

// typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;

// container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
// repetition
//------------------------------------------
#define FOR(i, a, b) for (LL i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define ALL(a) (a).begin(), (a).end()
// constant
//--------------------------------------------
// clear memory
#define CLR(a) memset((a), 0, sizeof(a))

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

#include <bits/stdc++.h>
#include <cmath>
#include <string>

using namespace std;

#define ll long long int
#define ld long double
#define loop(i, n) for (int i = 0; i < n; i++)
#define loops(i, s, n) for (int i = s; i < n; i++)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
#define deb(x) cout << #x << '=' << x << endl
#define MOD 1000000007
const int N = 100;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int ans = 0;
    for (int x = 1; x <= N; x++) {
      for (int y = 1; y <= N; y++) {
        if (x * x + y * y + x * y > n) {
          break;
        }
        for (int z = 1; z <= N; z++) {
          ll res = (x * x + y * y + z * z);
          res += (x * y + y * z + z * x);
          if (res == i) {
            ans++;
          }
          if (res > i) {
            break;
          }
        }
      }
    }
    cout << ans << "\\n";
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <cmath>
#include <string>

using namespace std;

#define ll long long int
#define ld long double
#define loop(i, n) for (int i = 0; i < n; i++)
#define loops(i, s, n) for (int i = s; i < n; i++)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
#define deb(x) cout << #x << '=' << x << endl
#define MOD 1000000007
const int N = 500;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    bool f = 0;
    int ans = 0;
    for (int x = 1; x <= N; x++) {
      for (int y = 1; y <= N; y++) {
        for (int z = 1; z <= N; z++) {
          ll res = (x * x + y * y + z * z);
          res += (x * y + y * z + z * x);
          if (res == i) {
            ans++;
          }
          if (res > i) {
            f = 1;
            break;
          }
        }
      }
    }
    cout << ans << "\\n";
  }
}