alexjercan/bugnet huggingface dataset:
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 REP2(i, x, n) for (int i = x; i < (n); i++)
#define ALL(n) begin(n), end(n)
struct cww {
  cww() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  }
} star;
const long long INF = numeric_limits<long long>::max();
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  long long ans[10100];
  memset(ans, 0, sizeof(ans));
  for (int x = 1; x <= 110; x++) {
    for (int y = 1; y <= 110; y++) {
      for (int z = 1; z <= 110; z++) {
        long long cnt = x * x + y * y + z * z + x * y + y * z + z * x;
        if (cnt < 10100) {
          ans[cnt]++;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP2(i, x, n) for (int i = x; i < (n); i++)
#define ALL(n) begin(n), end(n)
struct cww {
  cww() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  }
} star;
const long long INF = numeric_limits<long long>::max();
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int ans[10100];
  for (int x = 1; x <= n - 2; x++) {
    for (int y = x; y <= n - 1; y++) {
      for (int z = y; z <= n; z++) {
        long long cnt = (x + y + z) * (x + y + z) - (x * y + y * z + z * x);
        if (cnt > 0 && cnt <= n) {
          vector<int> j = {x, y, z};
          sort(j.begin(), j.end());
          if ((j[0] == j[1]) && (j[0] == j[2])) {
            ans[cnt]++;
          } else if (((j[0] == j[1]) && (j[1] != j[2])) ||
                     ((j[0] != j[1]) && (j[1] == j[2]))) {
            ans[cnt] += 3;
          } else {
            ans[cnt] += 6;
          }
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

/*==========================================================================*/
/*
    AUTHOR:    BPZ
        CREATED:   10.09.2020 18:04:20

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  const int maxn = (int)1e7 + 6;
  vector<int> ans(maxn, 0);
  for (int i = 1; i <= 200; i++) {
    for (int j = 1; j <= 200; j++) {
      for (int k = 1; k <= 200; k++) {
        int pos = pow(i + j, 2) + pow(i + k, 2) + pow(j + k, 2);
        ans[pos / 2]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << '\\n';
  }
  return 0;
}


Error: TLE

Fixed submission:

/*==========================================================================*/
/*
    AUTHOR:    BPZ
        CREATED:   10.09.2020 14:55:32

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  // const int maxv = 200;
  const int maxn = n;
  int kcase = 1;
  while (kcase <= maxn) {
    int cnt = 0;
    for (int i = 1; i <= (int)sqrt(maxn); i++) {
      for (int j = 1; j <= (int)sqrt(maxn); j++) {
        for (int k = 1; k <= (int)sqrt(maxn); k++) {
          if (i >= kcase || j >= kcase || k >= kcase)
            continue;
          if ((i + j) * (i + j) + (i + k) * (i + k) + (j + k) * (j + k) ==
              2 * kcase) {
            cnt++;
          }
        }
      }
    }
    kcase++;
    cout << cnt << '\\n';
  }
  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> ans(10050, 0);
  int v;
  for (int i = 1; i < 106; i++) {
    for (int j = 1; j < 106; j++) {
      for (int k = 1; k < 106; k++) {
        v = i * i + j * j + k * k + i * j + j * k + k * i;
        if (v < 10050) {
          ans.at(v) += 1;
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    cout << ans.at(i + 1) << endl;
  }
}

Error: TLE

Fixed submission:

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

int main() {
  int N = 0;
  cin >> N;
  if (N <= 5) {
    for (int i = 0; i < N; i++)
      cout << 0 << endl;
  } else {
    for (int i = 0; i < 5; i++)
      cout << 0 << endl;

    for (int n = 6; n < N + 1; n++) {
      int ans = 0;
      double nn = 0;
      nn = pow(n, 0.5);
      for (int i = 1; i <= nn; i++) {
        double ii = 0;
        ii = pow(n - i * i, 0.5);
        for (int j = 1; j <= ii; j++) {
          double jj = 0;
          jj = pow(n - i * i - j * j, 0.5);
          for (int l = 1; l <= jj; l++) {
            if (i * i + j * j + l * l + i * j + j * l + l * i == n)
              ans++;
          }
        }
      }
      cout << ans << endl;
    }
  }
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

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

vector<ll> a;
ll n;

ll solve(ll x, ll y, ll z) {
  ll sum = (x * x + y * y + z * z + x * y + y * z + z * x);
  if (sum > n)
    return 0;
  return sum;
}

int main(void) {
  cin >> n;
  a.resize(n + n, 0);

  for (ll i = 1; i <= n; i++) {
    for (ll j = i; i * j <= n; j++) {
      for (ll l = j; j * l <= n; l++) {
        if (i == j && j == l)
          a[solve(i, j, l)]++;
        else if (i != j && j != l && j != l)
          a[solve(i, j, l)] += 6;
        else
          a[solve(i, j, l)] += 3;
      }
    }
  }

  for (int i = 1; i <= n; i++)
    cout << a[i] << endl;
}


Error: 0

Fixed submission:

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

int main(void) {
  ll n;
  cin >> n;
  vector<ll> a(n * n, 0);

  for (ll i = 1; i <= n; i++) {
    for (ll j = i; i * j <= n; j++) {
      for (ll l = j; i * j * l <= n; l++) {
        ll sum = i * i + j * j + l * l + i * j + j * l + l * i;
        if (i == j && j == l)
          a[sum - 1]++;
        else
          a[sum - 1] += 3;
      }
    }
  }

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

#include <bits/stdc++.h>

typedef long long ll;
#define IO                                                                     \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0);
#define endl '\\n'
const int N = 5e5 + 10;
using namespace std;

int main() {
  IO;
  int n;
  cin >> n;
  map<int, int> cnt;
  for (int i = 1; i <= 100; ++i) {
    for (int j = 1; j <= 100; ++j) {
      for (int k = 1; k <= 100; ++k) {
        int ans = i * i + j * j + k * k + i * j + j * k + k * i;
        cnt[ans]++;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    cout << cnt[i] << endl;
  }
}

Error: TLE

Fixed submission:

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

int fun(long long n) {
  int c = 0;
  for (int x = 1; x <= n; x++)
    for (int y = 1; y <= n; y++)
      for (int z = 1; z <= n; z++) {
        if (x * x > n)
          return c;
        if (y * y > n)
          y++;
        if (z * z > n)
          break;
        if (pow(x, 2) + pow(y, 2) + pow(z, 2) + +x * y + y * z + x * z == n)
          c++;
      }
  return c;
}

int main() {

  long long n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cout << fun(i) << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <cmath>
#include <iostream>
#include <vector>
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> ans(N + 1);
  int n = sqrt(N);
  for (int x = 1; x < n; x++) {
    for (int y = 1; y < n; y++) {
      for (int z = 1; z < n; z++) {
        int a = (x + y + z) * (x + y + z) - (x * y + y * z + z * x);
        if (a >= 1 && a <= N)
          ans[a]++;
      }
    }
  }

  for (int i = 1; i <= N; i++) {
    cout << ans[i] << endl;
  }
}

Error: 0

Fixed submission:

#include <cmath>
#include <iostream>
#include <vector>
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> ans(N + 1);
  int n = sqrt(N);
  for (int x = 1; x < n; x++) {
    for (int y = 1; y < n; y++) {
      for (int z = 1; z < n; z++) {
        int a = (x + y + z) * (x + y + z) - (x * y + y * z + z * x);
        ans[a]++;
      }
    }
  }

  for (int i = 1; i <= N; i++) {
    cout << ans[i] << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int MAX = 101;
const int SIZE = 1e5;

int main() {

  int n;
  cin >> n;
  vector<int> v(SIZE, 0);
  for (int i = 1; i <= MAX; ++i) {
    for (int j = 1; j <= MAX; ++j) {
      for (int k = 1; k <= MAX; ++k) {
        if (i * i + k * k + j * j + i * j + i * k + j * k <= 10000)
          v[i * i + k * k + j * j + i * j + i * k + j * k]++;
      }
    }
  }
  for (int i = 1; i <= n; ++i)
    cout << v[i] << endl;
}

Error: -11

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

int main() {
  int n;
  cin >> n;
  int arr[10000] = {0};
  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      for (int k = 1; k <= 100; k++) {
        arr[(i * i) + (j * j) + (k * k) + (i * j) + (j * k) + (k * i)]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << arr[i] << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define ll long long
#define endl "\\n"
#define pb push_back
#define READ(FILE) freopen(FILE, "r", stdin)
#define WRITE(FILE) freopen(FILE, "w", stdout)
#define loop(i, s, e) for (int i = s; i < e; i++)
#define mego fast();
using namespace std;
void fast() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

ll lcm(ll x, ll y) { return (x * y) / __gcd(x, y); }
int sum(string s) {
  int x = 0, sz = s.size();
  loop(i, 0, sz) x += (s[i] - '0');
  return x;
}
/*
struct node
{
int data;
node *link;
};
typedef node* nodeptr;
void head_insert(nodeptr& head,int x)
{
    nodeptr tmp;
    tmp=new node;
    tmp->data=x;
    tmp->link=head;
    head=tmp;
}
nodeptr search(nodeptr head,int x)
{
    nodeptr cur=head;
    if(cur ==  nullptr)return cur;
    while(cur->data!=x&&cur->link!=nullptr)
    {
        cur=cur->link;
    }
    if(cur->data==x)return cur;
    else return nullptr;
}
void show(nodeptr head)
{
    nodeptr cur=head;
    if(cur==nullptr)return;
   // cout<<head->data<<" ";
    while(cur->link!=nullptr){
        cout<<cur->data<<" ";
        cur=cur->link;
    }
    cout<<endl;
}
*/

int main() {
  mego int n, id, m, x = 0;
  unordered_map<int, int> f;
  loop(i, 1, 101) loop(j, 1, 101) loop(k, 1, 101) {
    x = (i * i);
    x += (j * j);
    x += (k * k);
    x += (i * j);
    x += (i * k);
    x += (j * k);
    f[x]++;
  }
  cin >> n;
  loop(i, 1, n) cout << f[i] << endl;
  cout << f[n];
  return 0;
}


Error: -11

Fixed submission:

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

using namespace std;
int arr[1500] = {0};
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++) {
        int h = i * i + j * j + k * k + i * j + i * k + j * k;
        //  cout<<h<<endl;
        arr[h]++;
      }
    }
  }

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

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

#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long int n, m, a[10001] = {};
  cin >> n;
  for (long long int x = 1; x <= 100; x++) {
    for (long long int y = 1; y <= 100; y++) {
      for (long long int z = 1; z <= 100; z++) {
        m = (x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (z * x);
        if (m <= n)
          a[m]++;
        else
          break;
      }
    }
  }
  for (long long int i = 1; i <= n; i++)
    cout << a[i] << endl;
  return 0;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long int n, m, a[10001] = {};
  cin >> n;
  for (long long int x = 1; x <= 100; x++) {
    for (long long int y = x; y <= 100; y++) {
      for (long long int z = z; z <= 100; z++) {
        m = (x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (z * x);
        if (m <= n) {
          if (x == y && y == z)
            a[m] = 1;
          else
            a[m] = 3;
        } else {
          break;
        }
      }
    }
  }
  for (long long int i = 1; i <= n; i++)
    cout << a[i] << endl;
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  ll n;
  cin >> n;
  map<ll, ll> mp;
  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      for (int k = 1; k <= 100; k++) {
        mp[i * i + j * j + k * k + i * j + j * k + k * i]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << mp[i] << endl;
  }
}

Error: TLE

Fixed submission:

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

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

#include <bits/stdc++.h>
#define N 1000000007;

using namespace std;
vector<int> Sieve(int n) {
  vector<int> v;
  bool prime[n + 1];
  memset(prime, true, sizeof(prime));

  for (int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (int i = p * p; i <= n; i += p)
        prime[i] = false;
    }
  }
  for (int p = 2; p <= n; p++)
    if (prime[p])
      v.push_back(p);
  return (v);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int a[60001] = {};
  int v;
  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y < 100; y++) {
      for (int z = 1; z < 100; z++) {
        v = x * x + y * y + z * z + x * y + y * z + z * x;
        a[v]++;
      }
    }
  }
  int n;
  cin >> n;
  for (int i = 0; i < n; i++)
    cout << a[i + 1] << endl;

  return (0);
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define N 1000000007;

using namespace std;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int nb = 0;
    for (int x = 1; x <= 100; x++) {
      for (int y = 1; y <= 100; y++) {
        for (int z = 1; z <= 100; z++) {
          if (pow(x + y, 2) + pow(y + z, 2) + pow(x + z, 2) == 2 * i)
            nb++;
        }
      }
    }
    cout << nb << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define REP(i, k, n) for (long long i = k; i < (long long)(n); i++)
#define all(a) a.begin(), a.end()
#define pb push_back
typedef long long ll;
typedef pair<ll, ll> P;
using vi = vector<ll>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;

int main() {
  int n, cnt = 0, sum, num = 0;
  cin >> n;
  vi a(n);
  rep(i, n + 1) a[i] = 0;

  for (int i = 1; i <= 105; i++) {
    num++;
    for (int j = 1; j <= 105; j++) {
      for (int k = 1; k <= 105; k++) {

        sum = pow(i, 2) + pow(j, 2) + pow(k, 2) + i * j + j * k + i * k;
        if (n >= sum) {
          // cout<<i<<" "<<sum<<endl;

          a[sum] += 1;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++)
    cout << a[i] << endl;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define REP(i, k, n) for (long long i = k; i < (long long)(n); i++)
#define all(a) a.begin(), a.end()
#define pb push_back
typedef long long ll;
typedef pair<ll, ll> P;
using vi = vector<ll>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;

int main() {
  int n, count = 0, sum, num = 0;
  cin >> n;
  vi a(n);
  rep(i, n + 1) a[i] = 0;

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

        sum = pow(i, 2) + pow(j, 2) + pow(k, 2) + i * j + j * k + i * k;
        if (n > sum) {
          // cout<<i<<" "<<sum<<endl;

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

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

int main() {
  ll n;
  std::cin >> n;
  vector<ll> ans(n + 1, 0);
  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      for (int k = 1; k <= 100; k++) {
        auto num = i * i + j * j + k * k + i * j + j * k + k * i;
        if (num > n)
          continue;
        ans[num]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    std::cout << ans[i] << std::endl;
  }
}

Error: TLE

Fixed submission:

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

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

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

int main() {
  int n;
  std::cin >> n;
  int m = (int)(std::sqrt((n + 5) / 6) + 0.9);

  for (int l = 1; l <= n; l++) {
    int count = 0;
    for (int i = 1; i < m; i++) {
      for (int j = i; j < 100; j++) {
        for (int k = j; k < 100; k++) {
          if (i * i + j * j + k * k + i * j + j * k + k * i == l) {
            if (i == j && j == k) {
              count++;
            } else if ((i == j && j != k) || (j == k && k != i) ||
                       (k == i && i != j)) {
              count += 3;
            } else {
              count += 6;
            }
          }
        }
      }
    }
    std::cout << count << std::endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  int n;
  std::cin >> n;
  int m = (int)(std::sqrt((n + 5) / 6) + 0.9);

  for (int l = 1; l <= n; l++) {
    int count = 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 == l) {
            count++;
          }
        }
      }
    }
    std::cout << count << std::endl;
  }

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

#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;

int main() {
  int n;
  cin >> n;
  vi cnt(n, 0);
  int c = sqrt(n) + 1;
  for (int x = 1; x <= c + 1; x++) {
    for (int y = 1; y <= c + 1; y++) {
      for (int z = 1; z <= c + 1; z++) {
        if (x * x + y * y + z * z + x * y + y * z + z * x <= n)
          cnt.at(x * x + y * y + z * z + x * y + y * z + z * x - 1)++;
      }
    }
  }
  for (int x : cnt)
    cout << x << endl;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;

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

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

int main() {

  ll N;
  cin >> N;

  bool flg = false;
  vector<int> ans(N + 1);

  for (int a = 1; a <= sqrt(N); a++) {
    for (int b = 1; b <= sqrt(N); b++) {
      for (int c = 1; c <= sqrt(N); c++) {
        int buf = a * a + b * b + c * c + a * b + b * c + c * a;
        if (a * a + b * b + c * c + a * b + b * c + c * a <= N)
          ans.at(buf)++;
      }
    }
  }

  for (int i = 1; i <= N; i++)
    cout << ans.at(i) << endl;
  return 0;
}

Error: TLE

Fixed submission:

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

int main() {

  ll N;
  cin >> N;

  bool flg = false;
  vector<int> ans(N + 1);
  for (int i = 1; i <= N; i++) {
    flg = false;

    for (int a = 1; a <= i; a++) {
      for (int b = 1; b <= i; b++) {
        //                if(flg) break;
        for (int c = 1; c <= i; c++) {
          if (a * a + b * b + c * c + a * b + b * c + c * a > N) {
            flg = true;
            break;
          }
          if (a * a + b * b + c * c + a * b + b * c + c * a == i)
            ans.at(i)++;
        }
      }
    }
  }

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

#include <cmath>
#include <iostream>
#include <vector>
using namespace std;

int main() {
  int N;
  double z;
  cin >> N;
  vector<int> f(N + 1);
  for (int n = 6; n <= N; n++) {
    for (int x = 1; x < sqrt(n); x++) {
      for (int y = 1; y < sqrt(n); y++) {
        if (-3 * (pow(x, 2) + pow(y, 2)) - 2 * x * y + 4 * n < 0)
          continue;
        z = (-(y + x) +
             sqrt(-3.0 * (pow(x, 2) + pow(y, 2)) - 2.0 * x * y + 4.0 * n)) /
            2.0;
        int z_d = z;
        double z_i = z - z_d * 1.0;
        if (z_i != 0 or z <= 0)
          continue;
        if (pow(x, 2) + pow(y, 2) + pow(z_d, 2) + x * y + y * z + z * x == n) {
          f[n]++;
        }
      }
    }
  }
  for (int n = 1; n <= N; n++)
    cout << f[n] << endl;
}

Error: TLE

Fixed submission:

#include <cmath>
#include <iostream>
#include <vector>
using namespace std;

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

  for (int n = 6; n <= N; n++) {
    for (int x = 1; x < sqrt(n - 3); x++) {
      for (int y = 1; y < sqrt(n - pow(x, 2) - 2); y++) {
        for (int z = 1;
             z <= sqrt(n - pow(x, 2) - pow(y, 2) - x * y - (x + y) * z); z++) {
          if (pow(x, 2) + pow(y, 2) + pow(z, 2) + x * y + y * z + z * x == n) {
            f[n]++;
          }
        }
      }
    }
  }

  for (int n = 1; n <= N; n++)
    cout << f[n] << endl;
}