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

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

/*If you are going to try,keep going until the end ,or don't even try to start*/

/* Remember, Hope is a good thing... May be the best of things... And No Good
 * thing ever Dies !!!*/

using namespace std;

#define ll long long
#define nada "\\n"
#define st string
#define S second
#define F first
#define pb push_back
#define MP make_pair
#define isnttriangle(a, b, c) (a + b < c || a + c < b || b + c < a)
#define todegree(rad) rad * (180.0 / pi)
#define rrp(i, a, b) for (ll i = a; i >= b; i--)
#define repp(i, a, b) for (int i = int(a); i <= int(b); i++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define allr(v) ((v).rbegin()), ((v).rend())
#define all(v) ((v).begin()), ((v).end())
#define fx(n) cout << fixed << setprecision(n);
#define sz(v) ((int)(v).size())
#define Test                                                                   \\
  ll t;                                                                        \\
  cin >> t;                                                                    \\
  while (t--)
#define mod 1000000009LL

const double ME = 2.71828;
const int N = 3e5 + 20;
const int inf = 0x3f3f3f3f;
const double pi = 3.141592653;

void LOSER() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

void file() {
  freopen("records.in", "r", stdin);
  // freopen("text.out", "w", stdout);
}

ll gcd(ll a, ll b) {
  // Eculidean Algorthim
  return (!b) ? a : gcd(b, a % b);
  // complixty=log(ab);
}

ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

ll Fib_recur(ll n) {
  vector<ll> v(n + 5, 0);
  // BaseCase
  v[1] = 0;
  v[2] = 1;
  repp(i, 3, n) v[i] = v[i - 1] + v[i - 2];
  return v[n];
}

bool isprime(ll n) {
  for (ll i = 2; i <= sqrt(n); i++) {
    if (n % i == 0)
      return false;
  }
  return true;
}

void Solve() {
  vector<int> ans(10050, 0);
  int n, v = 0;
  cin >> n;
  rep1(i, 105) {
    rep1(j, 105) {
      rep1(k, 105) {
        if (v = i * i + j * j + k * k + i * j + j * k + k * i)
          if (v < 10050)
            ans[v] += 1;
      }
    }
  }
  rep1(i, n) { cout << ans[i] << nada; }
}

//"I AM A LOSER ";

int main() {
  // fx(7)
  // file();
  LOSER();
  // Test

  Solve();
}


Error: TLE

Fixed submission:

#include <algorithm>
#include <iostream>
#include <set>
#include <string>
#include <vector>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n, m, x, cnt = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int x = 1; x < n; x++) {
      for (int y = 1; y < n; y++) {
        for (int z = 1; z < n; z++) {
          if (x * x + y * y + z * z + x * y + x * z + y * z == i)
            cnt++;
          if (x * x + y * y + z * z + x * y + x * z + y * z > i)
            break;
        }
      }
    }
    cout << cnt << endl;
    cnt = 0;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define loop(n, i, a) for (int i = a; i < n; i++)
#define loopR(n, i, a) for (int i = n - 1; i >= a; i--)
#define all(arr, n) arr, arr + n
#define allv(v) (v).begin(), (v).end()
#define rallv(v) (v).rbegin(), (v).rend()
#define m_p make_pair
#define ll long long
#define pii pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<pair<ll, ll>>
#define sz(x) (int)x.size()
#define pb push_back
#define endl "\\n"
#define Endl "\\n"
#define f first
#define s second
#define mem(dp, n) memset(dp, n, sizeof dp)
int dx[] = {1, 0, -1, 0, -1, -1, 1, 1};
int dy[] = {0, 1, 0, -1, -1, 1, -1, 1};
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
  s += ',';
  vector<string> res;
  while (!s.empty()) {
    res.push_back(s.substr(0, s.find(',')));
    s = s.substr(s.find(',') + 1);
  }
  return res;
}
void debug_out(vector<string> __attribute__((unused)) args,
               __attribute__((unused)) int idx,
               __attribute__((unused)) int LINE_NUM) {
  cerr << endl;
}
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
  if (idx > 0)
    cerr << ", ";
  else
    cerr << "Line(" << LINE_NUM << ") ";
  stringstream ss;
  ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...)                                                             \\
  debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN = 2e6 + 10, oo = 0x3f3f3f3f, MOD = 998244353;
const double PI = acos(-1);

void solve() {
  int n;
  cin >> n;
  int cnt[mxN] = {};
  loop(101, i, 1) {
    loop(101, j, 1) {
      loop(101, k, 1) { cnt[i * i + j * j + k * k + i * j + j * k + i * k]++; }
    }
  }
  loop(n + 1, i, 1) cout << cnt[i] << Endl;
}
int main() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  fast();
  solve();
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <iostream>
#define ll long long
using namespace std;
int main() {
  int n, count = 0;
  cin >> n;

  for (int i = 1; i <= n; i++) {
    for (int x = 1; x * x < 10000; x++) {
      for (int y = 1; y * y < 10000; y++) {
        for (int z = 1; z * z < 10000; z++) {
          if ((x + z + y) * (x + z + y) - x * y - x * z - y * z == i)
            count++;
        }
      }
    }
    cout << count << '\\n';
    count = 0;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#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 calc(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;
  vector<int> ans(10500, 0);

  for (int x = 1; x < 150; x++) {
    for (int y = 1; y < 150; y++) {
      for (int z = 1; z < 150; z++) {
        int v = calc(x, y, z);
        if (v < 10500) {
          ans[v - 1]++;
        }
      }
    }
  }

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

  // int N;
  // cin >> N;
  // vector<vector<int>> vec;

  // for(int x = 1; x < 42; x++){
  //     for(int y = 1; y < 42; y++){
  //         for(int z = 1; z < 42; z++){
  //             vector<int> xyz;
  //             xyz.push_back(x);
  //             xyz.push_back(y);
  //             xyz.push_back(z);
  //             vec.push_back(xyz);
  //         }
  //     }
  // }

  // for(int n = 1; n <=N; n++ ){
  //     bool find = false;
  //     int x = -1, y = -1, z = -1;
  //     for(auto v:vec){
  //         if(calc(v[0], v[1], v[2]) == n){
  //             find = true;
  //             x = v[0];
  //             y = v[1];
  //             z = v[2];
  //             break;
  //         }
  //     }
  //     int ans = 0;
  //     if(find){
  //         ans = f(x,y,z);
  //     }
  //     cout<< ans << endl;
  // }

  return 0;
}

Error: TLE

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 calc(int x, int y, int z) {
  return x * x + y * y + z * z + x * y + y * z + z * x;
}

int f(int x, int y, int z) {
  set<int> s;
  s.insert(x);
  s.insert(y);
  s.insert(z);

  if (s.size() == 1)
    return 1;
  else if (s.size() == 2)
    return 3;
  else if (s.size() == 3)
    return 6;
}

int main() {

  int N;
  cin >> N;
  vector<vector<int>> vec;

  for (int x = 1; x < 50; x++) {
    for (int y = 1; y < 50; y++) {
      for (int z = 1; z < 50; z++) {
        vector<int> xyz;
        xyz.push_back(x);
        xyz.push_back(y);
        xyz.push_back(z);
        vec.push_back(xyz);
      }
    }
  }

  for (int n = 1; n <= N; n++) {
    bool find = false;
    int x = -1, y = -1, z = -1;
    for (auto v : vec) {
      if (calc(v[0], v[1], v[2]) == n) {
        find = true;
        x = v[0];
        y = v[1];
        z = v[2];
        break;
      }
    }
    int ans = 0;
    if (find) {
      ans = f(x, y, z);
    }
    cout << ans << endl;
  }

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

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <utility>
#include <vector>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template <class T> inline void chmin(T &a, T b) {
  if (a > b) {
    a = b;
  }
}
template <class T> inline void chmax(T &a, T b) {
  if (a < b) {
    a = b;
  }
}
void printvec(vec &v) {
  Rep(i, (ll)v.size()) { cout << v[i] << " \\n"[i + 1 == (ll)v.size()]; }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll N;
  cin >> N;

  map<ll, ll> cnt;
  for (ll x = 1; x <= 100; x++) {
    for (ll y = 1; y <= 100; y++) {
      for (ll z = 1; z <= 100; z++) {
        ll num = x * x + y * y + z * z + x * y + y * z + z * x;
        if (num > 10000)
          break;
        cnt[x * x + y * y + z * z + x * y + y * z + z * x]++;
      }
    }
  }

  for (ll i = 1; i <= N; i++) {
    cout << cnt[i] << "\\n";
  }
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <utility>
#include <vector>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template <class T> inline void chmin(T &a, T b) {
  if (a > b) {
    a = b;
  }
}
template <class T> inline void chmax(T &a, T b) {
  if (a < b) {
    a = b;
  }
}
void printvec(vec &v) {
  Rep(i, (ll)v.size()) { cout << v[i] << " \\n"[i + 1 == (ll)v.size()]; }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll N;
  cin >> N;

  ll ans = 0;
  map<ll, ll> cnt;
  for (ll x = 1; x <= 200; x++) {
    for (ll y = 1; y <= 200; y++) {
      for (ll z = 1; z <= 200; z++) {
        cnt[x * x + y * y + z * z + x * y + y * z + z * x]++;
      }
    }
  }

  for (ll i = 1; i <= N; i++) {
    cout << cnt[i] << "\\n";
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  ll n;
  cin >> n;
  ll sum = 0;
  vector<ll> ans(n, 0);
  for (int x = 1; x <= n; x++) {
    for (int y = 1; y <= n; y++) {
      for (int z = 1; z <= n; z++) {
        sum = (x + y + z) * (x + y + z) - (x * y + y * z + z * x);
        if (sum > n)
          break;
        ans[sum - 1]++;
      }
    }
  }
  rep(i, n) { cout << ans[i] << endl; }
  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  ll n;
  cin >> n;
  ll sum = 0;
  vector<ll> ans(n, 0);
  for (int x = 1; x <= n; x++) {
    for (int y = 1; y <= n; y++) {
      for (int z = 1; z <= n; z++) {
        sum = (x + y + z) * (x + y + z) - (x * y + y * z + z * x);
        if (sum > n)
          continue;
        ans[sum - 1]++;
      }
    }
  }
  rep(i, n) { cout << ans[i] << endl; }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(v) v.begin(), v.end()
#define PI 3.141592653589793238462643383279
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
typedef long long int ll;
typedef unsigned long long ull;
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;
}
typedef pair<ll, ll> P;
const long long MOD = 1e9 + 7;
const ll INF = 1LL << 60;
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int triplets(int x) {
  int cnt = 0;
  for (int i = 1; i <= (int)(1e2); i++) {
    for (int j = 1; j <= (int)(1e2); j++) {
      for (int k = 1; k <= (int)(1e2); k++) {
        if (i * i + j * j + k * k + i * j + j * k + k * i > x)
          break;
        if (i * i + j * j + k * k + i * j + j * k + k * i == x)
          cnt++;
      }
    }
  }
  return cnt;
}

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

  for (int i = 1; i <= n; i++) {
    cout << triplets(i) << endl;
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(v) v.begin(), v.end()
#define PI 3.141592653589793238462643383279
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
typedef long long int ll;
typedef unsigned long long ull;
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;
}
typedef pair<ll, ll> P;
const long long MOD = 1e9 + 7;
const ll INF = 1LL << 60;
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int triplets(int x) {
  int cnt = 0;
  for (int i = 1; i <= (int)(1e2); i++) {
    for (int j = 1; j <= (int)(1e2); j++) {
      for (int k = 1; k <= (int)(1e2); k++) {
        if (i * i + j * j + k * k + i * j + j * k + k * i == x)
          cnt++;
      }
    }
  }
  return cnt;
}

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

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

#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 main() {
  int n;
  cin >> n;
  vector<int> ans(n);

  for (int x = 1; x < 100; ++x) {
    for (int y = 1; y < 100; ++y) {
      for (int z = 1; z < 100; ++z) {
        int out = x * x + y * y + z * z + x * y + y * z + z * x;
        if (out <= n) {
          ++ans[out - 1];
        }
      }
    }
  }
  rep(i, n) { cout << ans[i] << endl; }

  return 0;
}


Error: TLE

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 main() {
  int n;
  cin >> n;

  for (int i = 1; i <= n; ++i) {
    int ans = 0;
    for (int x = 1; x <= (int)sqrt(i); ++x) {
      for (int y = 1; y <= (int)sqrt(i - x * x); ++y) {
        for (int z = 1; z <= (int)sqrt(i - x * x - y * y); ++z) {
          // printf("%d %d %d\\n", x, y, z);
          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>
using namespace std;

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

#define REP(i, n) for (ll i = 0; i < n; i++)

// #define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\\n", ##__VA_ARGS__)

int f(int n) {
  int count = 0;
  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        if ((x * x + y * y + z * z + x * y + y * z + z * x) == n) {
          count++;
        } else if ((x * x + y * y + z * z + x * y + y * z + z * x) > n) {
          break;
        }
      }
    }
  }

  return count;
}

int main() {
  std::cout << std::fixed << std::setprecision(10);

  ll N;

  cin >> N;

  for (int i = 1; i <= N; i++) {
    cout << f(i) << endl;
  }
}


Error: TLE

Fixed submission:

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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 1000000007LL;

#define REP(i, n) for (ll i = 0; i < n; i++)

// #define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\\n", ##__VA_ARGS__)

int f(int n) {
  int count = 0;
  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        if ((x * x + y * y + z * z + x * y + y * z + z * x) == n) {
          count++;
        }
      }
    }
  }

  return count;
}

int main() {
  std::cout << std::fixed << std::setprecision(10);

  ll N;

  cin >> N;

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

#include <cstdio>
#include <iostream>
using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  int ans[10050] = {0};
  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        int v = x * x + y * y + z * z + x * y + y * z + z * x;
        if (v < 10050)
          ans[v]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    printf("%d\\n", ans[i]);
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int calc(int n) {
  int ans = 0;
  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        if (x * x + y * y + z * z + x * y + y * z + z * x == n)
          ans++;
      }
    }
  }
  return ans;
}

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

#include <bits/stdc++.h>
using namespace std;
const int maxN = 2e5 + 10;

int ans[10001];

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= 100; i++) {
    if (i * i > n)
      break;
    for (int j = 1; j <= 100; j++) {
      if (i * i + j * j + i * j > n)
        break;
      for (int k = 1; k <= 100; k++) {
        int tmp = i * i + j * j + k * k + i * j + i * k + j * k;
        if (tmp > n)
          break;
        ans[tmp]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << endl;
  }
}

Error: TLE

Fixed submission:

#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
using namespace std;

const int maxN = 2e5 + 10;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (int p = 1; p <= n; p++) {
    int cnt = 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 == p) {
            cnt++;
          }
        }
      }
    }
    cout << cnt << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;

  int i, end, ANS;
  int x, y, z;

  for (i = 1; i <= N; i++) {
    int ans = 0;
    end = sqrt(i);

    for (x = 1; x <= end; x++) {
      if (x * x > i) {
        break;
      }
      for (y = 1; y <= end; y++) {
        if (x * x + y * y + x * y > i) {
          break;
        }
        for (z = 1; z <= end; z++) {
          ANS = x * x + y * y + z * z + x * y + y * z + z * x;
          if (ANS > i) {
            break;
          }
          // cout << x << " " << y << " " << z << " " << ANS << endl;
          if (ANS == i)
            ans++;
        }
      }
    }
    cout << ans << endl;
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;

  int i, end, ANS;
  int x, y, z;

  for (i = 1; i <= N; i++) {
    int ans = 0;
    end = sqrt(i);

    for (x = 1; x <= end; x++) {
      for (y = 1; y <= end; y++) {
        for (z = 1; z <= end; z++) {
          ANS = x * x + y * y + z * z + x * y + y * z + z * x;
          // cout << x << " " << y << " " << z << " " << ANS << endl;
          if (ANS == i)
            ans++;
        }
      }
    }
    cout << ans << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <queue>
#include <random>
#include <stack>
#include <string>

#include <algorithm>
#include <fstream>
#include <vector>

#define ll long long int
#define MOD 1000000007

using namespace std;

bool isPrime(ll n) {
  if (n == 1) {
    return false;
  }
  for (ll i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      return false;
    }
  }

  return true;
}

ll f(ll n) {
  ll res = 0;
  for (ll x = 1; x * x <= n - 2; x++) {
    for (ll y = x; y * y <= n - 2; y++) {
      for (ll z = y; z * z <= n - 2; z++) {
        if (x * x + y * y + z * z + x * y + y * z + z * x == n) {
          if (x == y && y == z && z == x) {
            res++;
          } else if ((x == y && y != z) || (y == z && z != x) ||
                     (z == x && x != y)) {
            res += 3;
          } else if (x != y && y != z) {
            res += 6;
          }
        }
      }
    }
  }

  return res;
}

int main(void) {

  ll n;

  cin >> n;

  for (ll i = 1; i <= n; i++) {
    cout << f(i) << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <queue>
#include <random>
#include <stack>
#include <string>

#include <algorithm>
#include <fstream>
#include <vector>

#define ll long long int
#define MOD 1000000007

using namespace std;

bool isPrime(ll n) {
  if (n == 1) {
    return false;
  }
  for (ll i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      return false;
    }
  }

  return true;
}

ll f(ll n) {
  ll res = 0;
  for (ll x = 1; x * x <= n - 2; x++) {
    for (ll y = 1; y * y <= n - 2; y++) {
      for (ll z = 1; z * z <= n - 2; z++) {
        if (x * x + y * y + z * z + x * y + y * z + z * x == n) {
          res++;
        } else if (x * x + y * y + z * z + x * y + y * z + z * x > n) {
          break;
        }
      }
    }
  }

  return res;
}

int main(void) {

  ll n;

  cin >> n;

  for (ll i = 1; i <= n; i++) {
    cout << f(i) << endl;
  }

  return 0;
}