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

#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define itn int
#define fi first
#define se second
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, ans;
  map<int, int> d;
  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++) {
        d[pow(i, 2) + pow(j, 2) + pow(k, 2) + (i * j) + (i * k) + (j * k)]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << d[i] << "\\n";
  }
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define itn int
#define fi first
#define se second
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, ans;
  cin >> n;
  for (int o = 1; o <= n; o++) {
    ans = 0;
    for (int i = 1; i <= sqrt(o); i++) {
      for (int j = 1; j <= sqrt(o); j++) {
        for (int k = 1; k <= sqrt(o); k++) {
          if (pow(i, 2) + pow(j, 2) + pow(k, 2) + (i * j) + (i * k) + (j * k) ==
              o)
            ans++;
        }
      }
    }
    cout << ans << "\\n";
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
const double pi = acos(-1.0);
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int max(int a, int b) {
  if (a > b) {
    return a;
  }
  return b;
}
int min(int a, int b) {
  if (a < b) {
    return a;
  }
  return b;
}
int main(void) {
  int n;
  cin >> n;
  int i, j, k, x;
  int a[10010] = {0};
  for (i = 1; i < 100; ++i) {
    for (j = 1; j < 100; ++j) {
      for (k = 1; k < 100; ++k) {
        x = i * i + j * j + k * k + i * j + j * k + k * i;
        if (x < 10010)
          a[x]++;
      }
    }
  }
  for (i = 1; i <= n; ++i)
    cout << a[i] << endl;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
const double pi = acos(-1.0);
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int max(int a, int b) {
  if (a > b) {
    return a;
  }
  return b;
}
int min(int a, int b) {
  if (a < b) {
    return a;
  }
  return b;
}
int main(void) {
  int n;
  cin >> n;
  int a, i, j, k;
  for (a = 1; a <= n; ++a) {
    int cnt = 0;
    for (i = 70; i > 0; --i) {
      for (j = 70; j > 0; --j) {
        for (k = 70; k > 0; --k) {
          if (i * i + j * j + k * k + i * j + j * k + k * i == a)
            cnt++;
        }
      }
    }
    cout << cnt << 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;

int main(void) {
  int n;
  cin >> n;
  for (ll i = 1; i <= n; ++i) {
    int cnt = 0;
    for (ll x = 1; x * x <= i; ++x) {
      ll a = x * x;
      for (ll y = 1;; ++y) {
        ll b = a + y * y + x * y;
        if (b > i)
          break;
        for (ll z = 1;; ++z) {
          ll c = b + z * z + y * z + z * x;
          if (c > i)
            break;
          if (c == i)
            ++cnt;
        }
      }
    }
    cout << cnt << 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;

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

#include <bits/stdc++.h>

#define M_PI 3.14159265358979323846 // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

#define rep(a, n) for (ll a = 0; a < n; a++)
#define repi(a, b, n) for (ll a = b; a < n; a++)

using namespace std;

static const ll INF = 1e15;

const ll mod = 1000000007;

int main() {
  ll n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    ll sum = 0;
    for (int x = 1; x <= i; x++) {
      if (x * x + 2 * x > i)
        break;
      for (int y = x; y <= i; y++) {
        if (x * x + x * y + y * y + 1 > i)
          break;
        for (int z = y;
             z <= i && x * x + y * y + z * z + x * y + y * z + z * x <= i;
             z++) {
          ll a = x * x + y * y + z * z + x * y + y * z + z * x;
          if (a == i) {
            if (x == y && y == z) {
              sum++;
            } else if (x == y) {
              sum += 3;
            } else if (y == z) {
              sum += 3;
            } else {
              sum += 6;
            }
          }
        }
      }
    }
    cout << sum << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>

#define M_PI 3.14159265358979323846 // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

#define rep(a, n) for (ll a = 0; a < n; a++)
#define repi(a, b, n) for (ll a = b; a < n; a++)

using namespace std;

static const ll INF = 1e15;

const ll mod = 1000000007;

int main() {
  ll n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    ll sum = 0;
    for (int x = 1; x <= i; x++) {
      if (x * x + 2 * x > i)
        continue;
      for (int y = x; y <= i; y++) {
        if (x * x + x * y + y * y + 1 > i)
          continue;
        for (int z = y;
             z <= i && x * x + y * y + z * z + x * y + y * z + z * x <= i;
             z++) {
          ll a = x * x + y * y + z * z + x * y + y * z + z * x;
          if (a == i) {
            if (x == y && y == z) {
              sum++;
            } else if (x == y) {
              sum += 3;
            } else if (y == z) {
              sum += 3;
            } else {
              sum += 6;
            }
          }
        }
      }
    }
    cout << sum << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include "bits/stdc++.h"

using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> Ans(N + 1);
  for (int m = 1; m <= sqrt(N); ++m) {
    for (int i = 1; i <= sqrt(N); ++i) {
      for (int j = 1; j <= sqrt(N); ++j) {
        int num = m * m + i * i + j * j + i * j + i * m + j * m;
        if (num <= N) {
          Ans[num]++;
        }
      }
    }
  }
  for (int n = 1; n <= N; ++n) {
    cout << Ans[n] << endl;
  }
  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 m = 1; m <= sqrt(N); ++m) {
      for (int i = 1; i <= sqrt(N); ++i) {
        for (int j = 1; j <= sqrt(N); ++j) {
          int num = m * m + i * i + j * j + i * j + i * m + j * m;
          if (n == num) {
            ++ans;
          }
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int N;
  cin >> N;
  int ans = 0;
  for (int n = 1; n <= N; n++) {
    ans = 0;
    for (int x = 1; x <= sqrt(n); x++) {
      for (int y = x; y <= sqrt(n); y++) {
        if (x + y >= sqrt(2 * n))
          break;
        for (int z = y; z <= sqrt(n); z++) {
          if (x + z >= sqrt(2 * n))
            break;
          if (y + z >= sqrt(2 * n))
            break;
          if (pow(x + y, 2) + pow(y + z, 2) + pow(z + x, 2) == 2 * n) {
            if (x != y && y != z && z != x)
              ans += 6;
            else if (x == y && y == z)
              ans++;
            else
              ans += 3;
          }
        }
      }
    }
    cout << ans << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  int N;
  cin >> N;
  int ans = 0;
  for (int n = 1; n <= N; n++) {
    ans = 0;
    for (int x = 1; x <= sqrt(n); x++) {
      for (int y = 1; y <= sqrt(n); y++) {
        if (x + y >= sqrt(2 * n))
          break;
        for (int z = 1; z <= sqrt(n); z++) {
          if (x + z >= sqrt(2 * n))
            break;
          if (y + z >= sqrt(2 * n))
            break;
          if (pow(x + y, 2) + pow(y + z, 2) + pow(z + x, 2) == 2 * n)
            ans++;
        }
      }
    }
    cout << ans << endl;
  }

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

#include <bits/stdc++.h>
using namespace std;
#define endl '\\n'
#define rep(i, n)                                                              \\
  ;                                                                            \\
  for (long long i = 0; i < (n); i++)
using ll = long long;
using P = pair<long long, long long>;
template <class T> using vec = vector<T>;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  ll f[100005];
  for (ll i = 1; i <= n; i++) {
    for (ll j = i; j <= n; j++) {
      for (ll k = j; k <= n; k++) {
        ll r = i * i + j * j + k * k + i * j + j * k + k * i;
        if (r > n)
          break;
        if (i == j && i == k)
          f[r]++;
        else if (i == j || j == k || k == i)
          f[r] += 3;
        else
          f[r] += 6;
      }
    }
  }
  rep(i, n) cout << f[i + 1] << endl;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define endl '\\n'
#define rep(i, n)                                                              \\
  ;                                                                            \\
  for (long long i = 0; i < (n); i++)
using ll = long long;
using P = pair<long long, long long>;
template <class T> using vec = vector<T>;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  ll f[1005];
  for (ll i = 1; i <= n; i++) {
    for (ll j = i; j <= n; j++) {
      for (ll k = j; k <= n; k++) {
        ll r = i * i + j * j + k * k + i * j + j * k + k * i;
        if (r > n)
          break;
        if (i == j && i == k)
          f[r]++;
        else if (i == j || j == k || k == i)
          f[r] += 3;
        else
          f[r] += 6;
      }
    }
  }
  rep(i, n) cout << f[i + 1] << endl;
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

// C++ program to demonstrate __builtin_popcount()
#include <iostream>
#include <math.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  int ans[60000] = {0};
  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      for (int k = 1; k <= 100; k++) {
        ans[i * i + j * j + k * k + i * j + j * k + k * i]++;
      }
    }
  }
  for (int i = 1; i <= n; i++)
    cout << ans[i] << "\\n";
  return 0;
}


Error: 0

Fixed submission:

// C++ program to demonstrate __builtin_popcount()
#include <iostream>
#include <math.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  int ans[60000] = {0};
  for (int i = 1; i <= (n ^ (1 / 2)); i++) {
    for (int j = 1; j <= (n ^ (1 / 2)); j++) {
      for (int k = 1; k <= (n ^ (1 / 2)); k++) {
        ans[i * i + j * j + k * k + i * j + j * k + k * i]++;
      }
    }
  }
  for (int i = 1; i <= n; i++)
    cout << ans[i] << "\\n";
  return 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)
#define rep2(i, a, b) for (int i = (a); i <= (b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int f(int n) {
  int cnt = 0;
  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      int a = (x + y);
      int b = 4 * (x * x + y * y + x * y - n);
      double c = sqrt(a * a - b);
      if ((c - a) >= 2 && int(c) == c && (int(c) - a) % 2 == 0)
        cnt++;
    }
  }
  return cnt;
}

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cout << f(i) << "\\n";
  }
  return 0;
}


Error: TLE

Fixed submission:

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

int f(int n) {
  int cnt = 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)
          cnt++;
      }
    }
  }
  return cnt;
}

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cout << f(i) << "\\n";
  }
  return 0;
}
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 < (int)(n); i++)
typedef long long int ll;
typedef pair<int, int> P;

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int ans = 0;
    int num = i;
    for (int x = 1; x * x < num; x++) {
      for (int y = 1; x * x + y * y + x * y < num; y++) {
        for (int z = 1; x * x + y * y + z * z + x * y + y * z + z * x <= num;
             z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == num)
            ans++;
        }
      }
    }
    printf("%d\\n", ans);
  }
  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int ans = 0;
    int num = i;
    for (int x = 1; x * x <= num; x++) {
      for (int y = 1; y * y <= num - x * x; y++) {
        for (int z = 1; z * z <= num - x * x - y * y - x * y; z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == num)
            ans++;
        }
      }
    }
    printf("%d\\n", ans);
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int N;
  cin >> N;
  vector<int> a(100001, 0);
  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        ll v = x * x + y * y + z * z + x * y + y * z + z * x;
        if (v <= 10000) {
          a[v]++;
        }
      }
    }
  }

  for (int n = 1; n <= N; n++) {
    cout << a[n] << "\\n";
  }
  return 0;
}


Error: TLE

Fixed submission:

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

int solve(int n) {
  int triplets = 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) {
          triplets++;
        }
      }
    }
  }
  return triplets;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N;
  cin >> N;
  for (int n = 1; n <= N; n++) {
    cout << solve(n) << "\\n";
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <math.h>

#include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int, int>;

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

  for (int i = 1; i <= n; i++) { // i=1~nまで
    int cnt = 0;
    for (int x = 1; x * x < i; x++) {
      for (int y = x; y * y < i; y++) {
        for (int z = y; z * z < i; z++) {
          if (x * x + y * y + z * z + x * y + x * z + y * z == i) {
            if (x == y && y == z) {
              cnt++;
            } else if ((x == y && y != z) || (y == z && z != x) ||
                       (z == x && x != y)) {
              cnt += 3;
            } else {
              cnt += 6;
            }
          }
        }
      }
    }
    cout << cnt << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <math.h>

#include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int, int>;

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

  for (int i = 1; i <= n; i++) { // i=1~nまで
    int cnt = 0;
    for (int x = 1; x * x <= i; x++) {
      for (int y = 1; y * y <= i; y++) {
        for (int z = 1; z * z <= i; z++) {
          if (x * x + y * y + z * z + x * y + x * z + y * z == i) {
            cnt++;
          }
        }
      }
    }
    cout << cnt << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(), (x).end())
#define RSORT(x) sort((x).rbegin(), (x).rend())
#define REVE(x) reverse((x).begin(), (x).end())
#define mp make_pair
#define pb push_back
#define chmax(x, y) x = max(x, y)

typedef vector<int> VI;

int main() {
  int n;
  cin >> n;
  int ans = 0;
  VI 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 t = i * i + j * j + k * k + i * j + i * k + j * k;
        if (t <= n)
          a[t]++;
      }
    }
  }
  int cnt = 0;

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


Error: -11

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(), (x).end())
#define RSORT(x) sort((x).rbegin(), (x).rend())
#define REVE(x) reverse((x).begin(), (x).end())
#define mp make_pair
#define pb push_back
#define chmax(x, y) x = max(x, y)

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<bool> VB;
typedef vector<LL> VL;
typedef vector<vector<long long>> VVLL;
typedef vector<set<int>> VSI;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const LL LINF = 1e18;
int gcd(int a, int b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}

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

int main() {
  int n;
  cin >> n;
  int ans = 0;
  VI a(n + 1);
  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      for (int k = 1; k <= 100; k++) {
        a[i * i + j * j + k * k + i * j + i * k + j * k]++;
      }
    }
  }

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

  cout << ans << endl;
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int n;
  cin >> n;
  int a[100000];
  for (int i = 1; i < 100000; i++)
    a[i] == 0;
  for (int x = 1; x < 100; x++) {
    for (int y = 1; y < 100; y++) {
      for (int z = 1; z < 100; z++) {
        a[x * x + y * y + z * z + x * y + y * z + z * x]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << a[i] << endl;
  }
}


Error: -11

Fixed submission:

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

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

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

typedef long long int ll;

const ll maxN = 1e4 + 11;

int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  map<ll, ll> dp;
  for (ll i = 1; i <= 100; i++) {
    for (ll j = 1; j <= 100; j++) {
      for (ll k = 1; k <= 100; k++) {
        ll q = i * i + j * j + k * k + i * j + j * k + i * k;
        dp[q] += 1;
      }
    }
  }
  for (ll i = 1; i <= n; i++) {
    cout << dp[i] << "\\n";
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

typedef long long int ll;

int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  for (ll i = 1; i <= n; i++) {
    if (i < 6) {
      cout << 0 << "\\n";
    } else {
      ll ans = 0;
      for (ll j = 1; j < i; j++) {
        for (ll k = 1; k < i; k++) {
          for (ll q = 1; q < i; q++) {
            if (j * j + k * k + q * q + j * k + j * q + q * k == i)
              ans++;
            else if (j * j + k * k + q * q + j * k + j * q + q * k > i)
              break;
          }
        }
      }
      cout << ans << "\\n";
    }
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <limits>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;

#define ll long long

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

  multiset<int> coe;
  for (int x = 1; x <= (int)sqrt((double)n) + 1; ++x) {
    for (int y = 1; y <= (int)sqrt((double)n) + 1; ++y) {
      for (int z = 1; z <= (int)sqrt((double)n) + 1; ++z) {
        coe.insert(x * x + y * y + z * z + x * y + y * z + z * x);
      }
    }
  }

  for (int i = 1; i <= n; ++i) {
    cout << coe.count(i) << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <limits>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;

#define ll long long

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

  for (int i = 1; i <= n; ++i) {
    int ans = 0;
    for (int x = 1; x <= (int)sqrt((double)i) + 1; ++x) {
      for (int y = 1; y <= (int)sqrt((double)i) + 1; ++y) {
        for (int z = 1; z <= (int)sqrt((double)i) + 1; ++z) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == i) {
            ans += 1;
          }
          // cout << x << " " << y << " " << z << " " << x*x + y*y + z*z + x*y +
          // y*z + z*x << endl;
        }
      }
    }

    cout << ans << endl;
  }

  return 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;

int main() {
  int n;
  cin >> n;
  vector<int> ans(20000, 0);

  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        int tmp = pow(x + y + z, 2) - x * y - y * z - z * x;
        if (tmp <= n)
          ans[tmp]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    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;

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int ans = 0;
    for (int x = 1; x <= 50; x++) {
      for (int y = 1; y <= 50; y++) {
        for (int z = 1; z <= 50; z++) {
          if (pow(x + y + z, 2) - x * y - y * z - z * x == i)
            ans++;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}