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

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

int n;

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

Error: 0

Fixed submission:

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

int n;

int main() {
  cin >> n;
  vector<int> ans(n + 1);
  for (int x = 1; x * x <= n; x++) {
    for (int y = 1; y * y <= n; y++) {
      for (int z = 1; z * z <= n; z++) {
        ans[x * x + y * y + z * z + x * y + y * z + z * x]++;
      }
    }
  }
  for (int i = 1; i <= n; i++)
    cout << ans[i] << 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;

  int count = 0;
  for (int n = 1; n <= N; n++) {
    count = 0;
    for (int x = 1; x < n; x++) {
      if (x * x + 2 * x + 3 > n) {
        break;
      }
      for (int y = 1; y < n; y++) {
        if (x * x + y * y + 1 + x * y + y + x > n) {
          break;
        }
        for (int z = 1; z < n; z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x > n) {
            break;
          }
          if (x * x + y * y + z * z + x * y + y * z + z * x == n) {
            count++;
          }
        }
      }
    }
    cout << count << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

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

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

  int count = 0;
  for (int n = 1; n <= N; n++) {
    count = 0;
    for (int x = 1; x < sqrt(n); x++) {
      for (int y = 1; y < n - x * x; y++) {
        for (int z = 1; z < n - x * x - y * y; z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == n) {
            count++;
          }
        }
      }
    }
    cout << count << endl;
  }

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

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f(i, x, n) for (int i = x; i < n; i++)
#define all(c) c.begin(), c.end()
const int MOD = 1e9 + 7, N = 5e5 + 10;
const int LINF = LLONG_MAX;

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  f(i, 1, n + 1) {
    int c = 0;
    f(x, 1, 101) {
      if (x * x > i) {
        break;
      }
      f(y, 1, 101) {
        if (x * x + y * y + x * y >= i) {
          break;
        }
        f(z, 1, 101) {
          int a = x * x + y * y + z * z + (x * y) + (y * z) + (z * x);
          if (a > i) {
            break;
          }
          if (a == i) {
            c++;
          }
        }
      }
    }
    cout << c << "\\n";
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f(i, x, n) for (int i = x; i < n; i++)
#define all(c) c.begin(), c.end()
const int MOD = 1e9 + 7, N = 5e5 + 10;
const int LINF = LLONG_MAX;

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  f(i, 1, n + 1) {
    int c = 0;
    f(x, 1, 91) {
      f(y, 1, 91) {
        f(z, 1, 91) {
          int a = x * x + y * y + z * z + (x * y) + (y * z) + (z * x);
          if (a == i) {
            c++;
          }
        }
      }
    }
    cout << c << "\\n";
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

using namespace std;

int main(void) {
  int N;
  cin >> N;
  vector<int> count(N, 0);
  int max = sqrt(N);
  for (int x = 1; x <= max; x++) {
    for (int y = 1; y <= max; y++) {
      for (int z = 1; z <= max; z++) {
        int t = x * x + y * y + z * z + x * y + y * z + z * x;
        if (t - 1 < N)
          count[t - 1]++;
      }
    }
  }
  for (int ct : count) {
    cout << ct << endl;
  }

  return 0;
}


Error: -6
malloc(): corrupted top size


Fixed submission:

#include <bits/stdc++.h>

using namespace std;

int main(void) {
  int N;
  cin >> N;
  vector<int> count(N, 0);
  int max = sqrt(N);
  for (int x = 1; x <= max; x++) {
    for (int y = 1; y <= max; y++) {
      for (int z = 1; z <= max; z++) {
        int t = x * x + y * y + z * z + x * y + y * z + z * x;
        count[t - 1]++;
      }
    }
  }
  for (int ct : count) {
    cout << ct << 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(10000, 0);

  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        int tmp = x * x + y * y + z * z + x * y + y * z + z * x;
        if (tmp <= 10000) {
          ans[tmp]++;
        }
      }
    }
  }
  for (int i = 0; i < N; i++) {
    cout << ans[i + 1] << endl;
  }
}

Error: TLE

Fixed submission:

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

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

  for (int i = 1; i <= N; i++) {
    int n = i;
    int ans = 0; // n毎の答え

    for (int x = 1; x <= 100; x++) {
      for (int y = 1; y <= 100; y++) {
        for (int z = 1; z <= 100; z++) {
          int equal_or_not_equal_n =
              x * x + y * y + z * z + x * y + y * z + z * x;
          if (equal_or_not_equal_n == n) {
            ans++;
          }
        }
      }
    }
    cout << ans << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

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

int f[10010];

int main() {
  int N;
  cin >> N;
  rep(i, 10010) f[i] = 0;

  for (int x = 1; x * x <= N; x++) {
    for (int y = 1; y * y <= N; y++) {
      for (int z = 1; z * z <= N; z++) {
        int now = x * x + y * y + z * z + x * y + y * z + z * x;
        if (now <= N)
          f[now] += 1;
      }
    }
  }

  rep(i, N) { cout << f[i + 1] << endl; }
  return 0;
}

Error: 0

Fixed submission:

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

int f[10010];

int main() {
  int N;
  cin >> N;
  rep(i, 10010) f[i] = 0;

  for (int x = 1; x * x <= N; x++) {
    for (int y = 1; y * y <= N; y++) {
      for (int z = 1; z * z <= N; z++) {
        int now = x * x + y * y + z * z + x * y + y * z + z * x;
        f[now] += 1;
      }
    }
  }

  rep(i, N) { cout << f[i + 1] << endl; }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

#define rep(i, n) for (int i = 1; i <= n; i++)
#define ll long long

using namespace std;

int a[10001];

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

  rep(x, 99) rep(y, 99) rep(z, 99) {
    int xx = pow(x, 2) + pow(y, 2) + pow(z, 2) + x * y + y * z + z * x;
    if (xx > 10000)
      continue;
    a[xx]++;
  }

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


Error: TLE

Fixed submission:

#include <bits/stdc++.h>

#define rep(i, n) for (int i = 1; i <= n; i++)
#define ll long long

using namespace std;

int f(int n) {
  int ans = 0;
  rep(x, 50) rep(y, 99) rep(z, 99) {
    if (pow(x, 2) + pow(y, 2) + pow(z, 2) + x * y + y * z + z * x == n)
      ans++;
    if (x == 42 && y == 42 && z == 42)
      return ans;
  }
  return 0;
}

int main() {
  int n;
  cin >> n;
  rep(i, n) cout << f(i) << endl;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define vii vector<ll>
#define pb push_back
#define fast                                                                   \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
using namespace std;
const int MOD = 1e9 + 7, N = 1e4 + 3;

int main() {
  fast;
  ll n, k = 6;
  cin >> n;
  for (int i = 1; i <= 5; ++i) {
    cout << "0\\n";
    if (i == n)
      break;
  }
  for (int i = 6; i <= n; ++i) {
    ll ans = 0;
    for (int j = 1; j <= sqrt(i); ++j) {
      for (int k = 1; k <= sqrt(i); ++k) {
        for (int l = 1; l <= sqrt(i); ++l) {
          int a = (l * l) + (k * k) + (j * j) + (l * k) + (l * j) + (k * j);
          if (a == i)
            ++ans;
          if (a > i)
            break;
        }
      }
    }
    cout << ans << "\\n";
  }
  cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \\n";
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define vii vector<ll>
#define pb push_back
#define fast                                                                   \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
using namespace std;
const int MOD = 1e9 + 7, N = 1e4 + 3;

int main() {
  fast;
  ll n, k = 6;
  cin >> n;
  for (int i = 1; i <= 5; ++i) {
    cout << "0\\n";
    if (i == n)
      break;
  }
  for (int i = 6; i <= n; ++i) {
    ll ans = 0;
    for (int j = 1; j <= sqrt(i); ++j) {
      for (int k = 1; k <= sqrt(i); ++k) {
        for (int l = 1; l <= sqrt(i); ++l) {
          int a = (l * l) + (k * k) + (j * j) + (l * k) + (l * j) + (k * j);
          if (a == i)
            ++ans;
        }
      }
    }
    cout << ans << "\\n";
  }
  cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \\n";
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define ull unsigned long long
#define ll long long int
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend() // reverse
#define vl vector<long long> v(n);
#define mii unordered_map<ll, ll>
#define pb push_back
double pi = 2 * acos(0.0);
// ll power(ll a,ll b){ ll res=1;while(b){if(b&1)res=res*a;b=b/2; a=(a*a);
// }return res;}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ll tst;
  tst = 1;
  // cin>>tst;

  while (tst--) {
    ll u;
    cin >> u;
    ll cnt = 0;
    vector<int> v(u + 1);
    for (int i = 1; i <= sqrt(u); i++) {

      for (int j = 1; j <= sqrt(u); j++) {

        for (int k = 1; k <= sqrt(u); k++) {
          int d = (i * i + j * j + k * k + i * j + i * k + j * k);
          if (d <= u) {
            v[d]++;
          }
        }
      }
    }

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

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define ull unsigned long long
#define ll long long int
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend() // reverse
#define vl vector<long long> v(n);
#define mii unordered_map<ll, ll>
#define pb push_back
double pi = 2 * acos(0.0);
// ll power(ll a,ll b){ ll res=1;while(b){if(b&1)res=res*a;b=b/2; a=(a*a);
// }return res;}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ll tst;
  tst = 1;
  // cin>>tst;

  while (tst--) {
    ll u;
    cin >> u;
    ll cnt = 0;
    int n = 1;
    while (n <= u) {

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

        for (int j = 1; j <= sqrt(n); j++) {

          for (int k = 1; k <= sqrt(n); k++) {
            if (i * i + j * j + k * k + i * j + i * k + j * k == n) {
              cnt++;
            }
          }
        }
      }
      n++;
      cout << cnt << endl;
    }
  }
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main() {
  int n;
  cin >> n;
  vector<int> ans(1e5, 0);
  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        int sum = x * x + y * y + z * z + x * y + y * z + z * x;
        ans[sum]++;
      }
    }
  }
  for (int i = 1; i <= n; i++)
    cout << ans[i] << endl;
}


Error: -11

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main() {
  int n;
  cin >> n;
  vector<int> ans(n + 1, 0);
  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        int sum = x * x + y * y + z * z + x * y + y * z + z * x;
        ans[sum]++;
      }
    }
  }
  for (int i = 1; i <= n; i++)
    cout << ans[i] << endl;
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

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

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

  vector<u64> ans(N);
  u64 lim = (u64)sqrt(N);

  for (u64 x = 1; x <= lim; x++) {
    u64 x_ans = x * x;
    if (x_ans > N)
      break;

    for (u64 y = 1; y <= lim; y++) {
      u64 xy_ans = x_ans + y * y + x * y;
      if (xy_ans > N)
        break;

      for (u64 z = 1; z <= lim; z++) {
        u64 xyz_ans = xy_ans + z * z + y * z + z * x;
        if (xyz_ans > N)
          break;

        ans[xyz_ans - 1]++;
      }
    }
  }

  for (u64 cnt : ans) {
    cout << cnt << endl;
  }
  return 0;
}

Error: 0

Fixed submission:

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

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

  vector<u64> ans(N);
  u64 lim = (u64)sqrt(N);

  for (u64 x = 1; x <= lim; x++) {
    for (u64 y = 1; y <= lim; y++) {
      for (u64 z = 1; z <= lim; z++) {
        u64 l_ans = x * x + y * y + z * z + x * y + y * z + z * x;
        ans[l_ans - 1]++;
      }
    }
  }

  for (u64 cnt : ans) {
    cout << cnt << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

void solve(long long N) {
  vector<long long> ans(10001);
  for (long long x = 1; x <= 100; x++) {
    for (long long y = 1; y <= 100; y++) {

      for (long long z = 1; z <= 100; z++) {
        long long v =
            (pow(x, 2) + pow(y, 2) + pow(z, 2) + (x * y) + (y * z) + (z * x));
        if (v <= 10000)
          ans[v]++;
      }
    }
  }

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

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips:
// You use the default template now. You can remove this line by using your
// custom template)
int main() {
  long long N;
  scanf("%lld", &N);
  solve(N);
  return 0;
}


Error: TLE

Fixed submission:

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

void solve(long long N) {
  for (long long i = 0; i < N; i++) {
    long long count = 0;

    for (long long x = 1; x < i + 2; x++) {
      for (long long y = 1; y < i + 2; y++) {
        if (pow(x, 2) + pow(y, 2) + (x * y) >= i + 1)
          continue;

        for (long long z = 1; z < i + 2; z++) {
          if (pow(x, 2) + pow(y, 2) + pow(z, 2) + (x * y) + (y * z) + (z * x) ==
              i + 1)
            count++;
        }
      }
    }
    cout << count << endl;
  }
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips:
// You use the default template now. You can remove this line by using your
// custom template)
int main() {
  long long N;
  scanf("%lld", &N);
  solve(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;
  for (int i = 1; i <= n; i++) {
    int ans = 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 + y * z + z * x == i) {
            if (x != y && x != z && y != z)
              ans += 6;
            else if (x != y && x != z && y == z || x != y && y != z && x == z ||
                     x != z && y != z && x == y)
              ans += 3;
            else
              ans++;
          }
        }
      }
    }
    cout << ans << "\\n";
  }
}

Error: TLE

Fixed submission:

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

using namespace std;

int main() {
  int n, cnt = 0;
  cin >> n;

  for (int i = 1; i <= n; i++) {
    int x = sqrt(i);
    for (int j = 1; j <= x; j++) {
      for (int k = 1; k <= x; k++) {
        for (int l = 1; l <= x; l++) {
          if ((j + l) * (j + l) + (j + k) * (j + k) + (l + k) * (l + k) ==
              2 * i) {
            cnt++;
          }
        }
      }
    }
    cout << cnt << "\\n";
    cnt = 0;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cmath>
#include <cstring> // memset()
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;

#define ll long long
#define For(i, a, b) for (int i = (int)(a), sz = (int)(b); i < sz; i++)
#define rFor(i, a, b) for (int i = (int)(a); i >= (int)(b); i--)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fill(a, b) memset(a, b, sizeof(a))
#define IO ios_base::sync_with_stdio(0), cin.tie(0)

const int MAX = 2e2 + 5;

int main() {
  IO;
  int n;
  cin >> n;
  vector<int> v(n + 1);
  For(i, 1, 100) For(j, 1, 100) For(k, 1, 100) {
    int a = i * i + j * j + k * k + i * j + j * k + i * k;
    if (a <= n)
      v[a]++;
  }
  For(i, 1, n + 1) printf("%d\\n", v[i]);
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

vector<int> res;

void trip(int i);

long up(int x, int y, int z);

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    trip(i);
  }
  for (int i : res) {
    cout << i << endl;
  }
}

void trip(int i) {
  int c = 0;
  int x = 1, y = 1, z = 1;
  long val = 6;
  bool k = false;
  while (val <= i or k) {
    if (val == i) {
      c++;
    }
    if (x + 1 < ceil(sqrt(i))) {
      x++;
      k = true;
    } else if (y + 1 < ceil(sqrt(i))) {
      k = true;
      y++;
      x = 1;
    } else if (z + 1 < ceil(sqrt(i))) {
      k = true;
      z++;
      x = 1;
      y = 1;
    } else {
      k = false;
    }
    val = up(x, y, z);
  }
  res.emplace_back(c);
}

long up(int x, int y, int z) {
  long val = x * x + y * y + z * z + x * y + x * z + y * z;
  return val;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <vector>
int num[10001];
using namespace std;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      for (int k = 1; k <= 100; k++) {
        int x = i * i + k * k + j * j + i * j + i * k + j * k;
        if (x > n)
          break;
        num[x]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << num[i] << endl;
  }
}

Error: TLE

Fixed submission:

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

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

#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
int main() {
  int N = 0;
  scanf("%d", &N);
  vector<long> v(N + 1, 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 + x * z + z * y) !=
  0 && ((x * x + y * y + z * z + x * y + x * z + z * y) < v.size())) { v[(x * x
  + y * y + z * z + x * y + x * z + z * y) - 1]++;
                          }

                  }

          }

  }*/

  for (int i = 1; i < 100; i++) {
    for (int w = 1; w < 100; w++) {
      for (int y = 1; y < 100; y++) {
        if (((i * i) + (w * w) + (y * y) + (i * w) + (i * y) + (y * w)) <=
            v.size()) {
          v[((i * i) + (w * w) + (y * y) + (i * w) + (i * y) + (y * w))]++;
        }
      }
    }
  }

  for (int i = 1; i <= N; i++) {
    string str = to_string(v[i]);
    const char *l = str.c_str();
    printf(l);
    printf("\\n");
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define oo (long long)1e18
#define ll long long
#define setdp memset(dp, -1, sizeof(dp))
const ll mod = 1e9 + 7;
void _IOS() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin.sync_with_stdio(0);
}
#define PI 3.14159265359
int n, m;
int a[200009];
vector<int> BFS(int source, vector<vector<int>> &adj) {
  vector<bool> vis(100009);
  vector<int> dis(100009, -1);
  queue<int> q;
  q.push(source);
  dis[source] = 0;
  vis[source] = 1;
  while (!q.empty()) {
    int node = q.front();
    q.pop();
    int d = dis[node];
    for (auto x : adj[node]) {
      if (!vis[x]) {
        vis[x] = 1;
        q.push(x);
        dis[x] = d + 1;
      }
    }
  }
  return dis;
}
int main() {
  // freopen ("jumping.in","r",stdin);
  _IOS();
  int n;
  cin >> n;
  int ans = 0;
  for (int o = 1; o <= n; o++) {
    ans = 0;
    for (int i = 1; i <= 60; i++) {
      int x = i;
      for (int j = 1; j <= 60; j++) {
        int y = j;
        for (int k = 1; k <= 60; k++) {
          int z = k;
          ll q = x * x + y * y + z * z + x * y + x * z + z * y;
          if (q == o)
            ans++;
        }
      }
    }
    cout << ans << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>

using namespace std;

#define vi vector<int>
#define vvi vector<vi>
#define rpt(i, x) for (int i = 0; i < x; i++)
#define fti(i, f, t) for (int i = f; i <= t; i++)
#define fte(i, f, t) for (int i = f; i < t; i++)
#define rptws(i, x, s) for (int i = 0; i < x; i += s)
#define llrpt(i, x) for (long long i = 0; i < x; i++)
#define llfti(i, f, t) for (long long i = f; i <= t; i++)
#define llfte(i, f, t) for (long long i = f; i < t; i++)

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

  fti(i, 1, n) {
    int ans = 0;
    llfti(x, 1, i) {
      llfti(y, 1, i) {
        long long b = x + y;
        long long c = i - (x * x) - (y * y) - (x * y);

        // cout<<i<<": "<<b<<" "<<c<<"\\n";

        if (c > 0) {
          double ans1 = ((-1.0 * b) + (double)sqrt(b * b + 4.0 * c)) / 2.0;
          double ans2 = ((-1.0 * b) - (double)sqrt(b * b + 4.0 * c)) / 2.0;

          if (ans1 == (int)ans1 && ans1 >= 1.0 && ans1 == ans2) {
            // cout<<"from 1"<<"\\n";
            ans++;
          } else if (ans1 == (int)ans1 && ans1 >= 1.0) {
            // cout<<"from 2: "<<ans1<<"\\n";
            ans++;
          } else if (ans2 == (int)ans2 && ans2 >= 1.0) {
            // cout<<"from 3: "<<ans2<<"\\n";
            ans++;
          }

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


Error: TLE

Fixed submission:

#include <iostream>
#include <math.h>
#include <string>
using namespace std;
int main() {
  int N = 0;
  scanf("%d", &N);
  int increament = 0;
  int counter = 0;

  for (int i = 1; i <= N; i++) {
    for (int x = 1; x < sqrt(i); x++) {
      for (int y = 1; y < sqrt(i); y++) {
        for (int z = 1; z < sqrt(i); z++) {
          if (x * x + y * y + z * z + x * y + x * z + z * y == i) {
            counter++;
          }
        }
      }
    }
    string str = to_string(counter);
    const char *l = str.c_str();
    printf(l);
    printf("\\n");
    counter = 0;
  }
  return 0;
}