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

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

int f(int x, int y, int z) {
  return x * x + y * y + z * z + x * y + y * z + z * x;
}

int main() {
  int n, sum[100000] = {0};
  cin >> n;

  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        sum[f(x, y, z)]++;
      }
    }
  }

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


Error: TLE

Fixed submission:

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

int f(int x, int y, int z) {
  return x * x + y * y + z * z + x * y + y * z + z * x;
}

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

  for (int i = 1; i <= n; i++) {
    sum = 0;
    for (int x = 1, y = 1, z = 1; x <= 100; x++) {
      for (y = 1; y <= 100; y++) {
        for (z = 1; z <= 100; z++) {
          if (f(x, y, z) == i)
            sum++;
        }
      }
    }
    cout << sum << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

// Example program
#include <iostream>
#include <string>
using namespace std;
#include <math.h>
#define mx 10002
void solve() {
  int n;
  cin >> n;

  int ans[100000] = {0};
  int a = sqrt(mx);
  for (long long i = 1; i <= a; i++) {
    for (long long j = 1; j <= a; j++) {
      for (long long k = 1; k <= a; k++) {
        long long c = i * i + j * j + k * k + i * j + i * k + k * j;

        ans[c]++;
      }
    }
  }

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

int main() { solve(); }


Error: TLE

Fixed submission:

// Example program
#include <iostream>
#include <string>
using namespace std;
#include <math.h>
void solve() {
  int n;
  cin >> n;
  long long cnt = 0;
  for (int c = 1; c <= n; c++) {
    cnt = 0;
    for (int i = 1; i <= sqrt(c); i++) {
      for (int j = 1; j <= sqrt(c); j++) {
        for (int k = 1; k <= sqrt(c); k++) {
          if (pow((i + j + k), 2) - i * j - j * k - i * k == c)
            cnt++;
        }
      }
    }
    cout << cnt << endl;
  }
}

int main() {
  // int t; cin>>t;
  // while(t--)
  solve();
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {

  int64_t n;
  cin >> n;

  int cnt = 0;
  for (int64_t i = 1; i <= n; i++) {
    cnt = 0;
    for (int64_t x = 1; x * x <= i; x++) {
      for (int64_t y = 1; y * y <= i; y++) {
        long double xd = x, yd = y, id = i;
        if (4.0 * id - 3 * xd * xd - 2.0 * xd * yd - 3 * yd * yd > 0) {
          int64_t z = (int64_t)(0.5 * (sqrt(4.0 * id - 3 * xd * xd -
                                            2.0 * xd * yd - 3 * yd * yd) -
                                       xd - yd));
          // int64_t z=(sqrt(4*i-3*x*x-2*x*y-3*y*y)-x-y)/2;
          if (z >= 1 && x * x + y * y + z * z + x * y + y * z + z * x == i)
            cnt++;
        }
      }
    }
    cout << cnt << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

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

int main() {

  int64_t n;
  cin >> n;

  int cnt = 0;
  for (int i = 1; i < n; i++) {
    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 + y * z + z * x == i)
            cnt++;
        }
      }
    }
    cout << cnt << endl;
  }

  cout << cnt << endl;

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

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int f(int x, int y, int z) {
  return x * x + y * y + z * z + x * y + y * z + z * x;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int max = 100;
  int ans[70001] = {0};
  for (int x = 1; x <= max; x++) {
    for (int y = 1; y <= max; y++) {
      for (int z = 1; z <= max; z++) {
        ans[f(x, y, z)]++;
      }
    }
  }
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << '\\n';
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int f(int x, int y, int z) {
  return x * x + y * y + z * z + x * y + y * z + z * x;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    long long ans = 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 (f(x, y, z) == i) {
            ans += 1LL;
          }
        }
      }
    }
    cout << ans << '\\n';
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

#define PI 3.14159265359

int main() {
  int N;
  cin >> N;
  for (int i = 1; i < N + 1; i++) {
    int ans = 0;
    for (int j = 1; j < 59; j++) {
      for (int k = j; k < 71; k++) {
        for (int l = k; l < 100; l++) {
          if (j * j + k * k + l * l + j * k + k * l + l * j == i) {
            if (j == k && k == l)
              ans++;
            else if (j == k || k == l || l == j)
              ans += 3;
            else
              ans += 6;
          }
        }
      }
    }
    cout << ans << endl;
  }
}


Error: TLE

Fixed submission:

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

#define PI 3.14159265359

int main() {
  int N;
  cin >> N;
  for (int i = 1; i < N + 1; i++) {
    int ans = 0;
    for (int j = 1; j < 100; j++) {
      for (int k = j; k < 100; k++) {
        for (int l = k; l < 100; l++) {
          if (j * j + k * k + l * l + j * k + k * l + l * j == i) {
            if (j == k && k == l)
              ans++;
            else if (j == k || k == l || l == j)
              ans += 3;
            else
              ans += 6;
          }
        }
      }
    }
    cout << ans << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int x = 1; x < 10000; x++) {
    if (x * x > n)
      break;
    for (int y = 1; y < 10000; y++) {
      if (y * y > n)
        break;
      for (int z = 1; z < 10000; z++) {
        if (z * z > n)
          break;
        if (x * x + y * y + z * z + x * y + y * z + z * x <= n)
          a[x * x + y * y + z * z + x * y + y * z + z * x - 1]++;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    cout << a[i] << endl;
  }

  return 0;
}

Error: -6
malloc(): corrupted top size


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;
  vector<int> a(n);
  for (int x = 1; x < 10000; x++) {
    if (x * x > n)
      break;
    for (int y = 1; y < 10000; y++) {
      if (y * y > n)
        break;
      for (int z = 1; z < 10000; z++) {
        if (z * z > n)
          break;
        a[x * x + y * y + z * z + x * y + y * z + z * x - 1]++;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    cout << a[i] << endl;
  }

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

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

int main() {

  int N;
  cin >> N;

  vector<int> ans(60001);
  for (int x = 1; x <= ceil(sqrt(N)); x++) {
    for (int y = 1; y <= ceil(sqrt(N)); y++) {
      for (int z = 1; z <= ceil(sqrt(N)); z++) {
        int n = pow(x + y, 2) / 2 + pow(y + z, 2) / 2 + pow(z + x, 2) / 2;
        ans[n - 1]++;
      }
    }
  }

  rep(i, N) cout << ans[i] << endl;

  return 0;
}

Error: MLE

Fixed submission:

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

int main() {

  int N;
  cin >> N;

  vector<int> ans(6 * pow(N + 1, 2));
  for (int x = 1; x <= ceil(sqrt(N)); x++) {
    for (int y = 1; y <= ceil(sqrt(N)); y++) {
      for (int z = 1; z <= ceil(sqrt(N)); z++) {
        int n = pow(x + y, 2) / 2 + pow(y + z, 2) / 2 + pow(z + x, 2) / 2;
        ans[n - 1]++;
      }
    }
  }

  rep(i, N) cout << ans[i] << endl;

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

#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define vv(T) std::vector<std::vector<T>>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;

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

  vector<int> ans(n);
  int v;
  for (int x = 1; x < 101; ++x) {
    for (int y = 1; y < 101; ++y) {
      for (int z = 1; z < 101; ++z) {
        v = x * x + y * y + z * z + x * y + y * z + z * x;
        if (v <= n)
          ans[v - 1] += 1;
      }
    }
  }
  for (int i = 0; i < n; ++i)
    cout << ans[i] << endl;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define vv(T) std::vector<std::vector<T>>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;

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

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

#include <bits/stdc++.h>

using namespace std;
int kb[1000000];
long int f(int x, int y, int z) {
  long int value;
  value = x * x + y * y + z * z + x * y + x * z + z * y;

  kb[value] += 1;

  return value;
}

int main() {
  int n;
  cin >> n;
  int p = sqrt(n) + 1;
  for (int i = 1; i <= p; i++) {
    for (int j = 1; j <= p; j++) {
      for (int k = 1; k <= p; k++) {
        if (f(i, j, k) >= n)
          break;
      }
    }
  }

  for (int l = 1; l <= n; l++)
    cout << kb[l] << "\\n";

  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>

using namespace std;
int kb[10000];
long int f(int x, int y, int z) {
  long int value;
  value = x * x + y * y + z * z + x * y + x * z + z * y;

  kb[value] += 1;

  return value;
}

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

  for (int i = 1; i <= sqrt(n) + 1; i++) {
    for (int j = 1; j <= sqrt(n) + 1; j++) {
      for (int k = 1; k <= sqrt(n) + 1; k++) {
        if (f(i, j, k) > n)
          break;
      }
    }
  }

  for (int l = 1; l <= n; l++)
    cout << kb[l] << "\\n";

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

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  int n, temp;
  cin >> n;
  int arr[10005] = {0};
  for (int i = 1; i < 100; ++i) {
    for (int j = 1; j < 100; ++j) {
      for (int k = 1; k < 100; ++k) {
        temp = i * i + j * j + k * k + i * j + j * k + k * i;
        if (temp <= 10000)
          arr[temp]++;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    cout << arr[i] << endl;
  }
  return 0;
}


Error: 0

Fixed submission:

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  int n, temp;
  cin >> n;
  int arr[1005] = {0};
  for (int i = 1; i < 100; ++i) {
    for (int j = 1; j < 100; ++j) {
      for (int k = 1; k < 100; ++k) {
        temp = i * i + j * j + k * k + i * j + j * k + k * i;
        if (temp <= 1000)
          arr[temp]++;
      }
    }
  }
  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>
using namespace std;
#define ll long long
#define pb push_back
int func(int x, int y, int z) {
  return x * x + y * y + z * z + x * y + z * x + z * y;
}
int main() {
  int n;
  cin >> n;
  int z = sqrt(n);
  const int nax = 6e4 + 123;
  vector<int> f(nax);
  for (int i = 1; i <= z; i++) {
    for (int j = 1; j <= z; j++) {
      for (int k = 1; k <= z; k++) {
        if ((func(i, j, k)) <= n)
          f[(func(i, j, k))]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << f[i] << endl;
  }
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
int func(int x, int y, int z) {
  return x * x + y * y + z * z + x * y + z * x + z * y;
}
int main() {
  int n;
  cin >> n;
  int z = sqrt(n);
  const int nax = 2e4 + 123;
  vector<int> f(nax);
  for (int i = 1; i <= z; i++) {
    for (int j = 1; j <= z; j++) {
      for (int k = 1; k <= z; k++) {
        f[(func(i, j, k))]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << f[i] << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

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

  vector<int> res(N, 0);
  for (int x = 1; x < sqrt(N); x++) {
    for (int y = 1; y < sqrt(N); y++) {
      for (int z = 1; z < sqrt(N); z++) {
        int n = x * x + y * y + z * z + x * y + y * z + x * z;
        if (n <= N) {
          res.at(n - 1)++;
        }
      }
    }
  }

  for (int i = 0; i < N; i++) {
    cout << res.at(i) << endl;
  }
}

Error: TLE

Fixed submission:

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

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

  vector<int> res(N, 0);
  for (int x = 1; x < N / 2; x++) {
    for (int y = 1; y < N / 2; y++) {
      for (int z = 1; z < N / 2; z++) {
        int n = x * x + y * y + z * z + x * y + y * z + x * z;
        if (n <= N) {
          res.at(n - 1)++;
        }
      }
    }
  }

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

#include <iostream>

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 + x <= i; x++)
      for (int y = 1; x * x + y * y + x * y + y + x + 1 <= i; y++)
        for (int z = 1; x * x + y * y + z * z + x * (y + z) + y * z <= i; z++)
          if (x * x + y * y + z * z + x * (y + z) + y * z == i) {
            ans += 1;
            break;
          }
    cout << ans << '\\n';
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>

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 = 1; y * y < i; y++)
        for (int z = 1; z * z < i; z++)
          if (x * x + y * y + z * z + x * (y + z) + y * z == i)
            ans += 1;
    cout << ans << '\\n';
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <math.h>
#include <stdio.h>

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x, y, z;
    int xx, yy, zz, xy;
    int count = 0;
    int mid = sqrt(n) + 1;
    for (x = 1; x < mid; x++) {
      xx = x * x;
      for (y = 1; y <= x; y++) {
        yy = y * y;
        xy = x * y;
        if (xx + yy >= n) {
          break;
        }
        for (z = 1; z <= y; z++) {
          zz = z * z;
          if (yy + zz >= n) {
            break;
          }
          if (xx + yy + zz + xy + x * z + y * z == i) {
            if (x == y && x == z && y == z) {
              count++;
            } else if (x != y && x != z && y != z) {
              count += 6;
            } else {
              count += 3;
            }
          }
        }
      }
    }
    printf("%d\\n", count);
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <math.h>
#include <stdio.h>

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x, y, z;
    int xx, yy, zz, xy;
    int count = 0;
    int mid = sqrt(n) + 1;
    for (x = 1; x < mid; x++) {
      xx = x * x;
      for (y = 1; y < mid; y++) {
        yy = y * y;
        xy = x * y;
        if (xx + yy >= n) {
          break;
        }
        for (z = 1; z < mid; z++) {
          zz = z * z;
          if (yy + zz >= n) {
            break;
          }
          if (xx + yy + zz + xy + x * z + y * z == i) {
            count++;
          }
        }
      }
    }
    printf("%d\\n", count);
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

// #include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define fast_io()                                                              \\
  ios::sync_with_stdio(false);                                                 \\
  std::cin.tie(0);
#define mod 998244353
typedef long long ll;
typedef long double ld;
using namespace std;

int main() {
  fast_io();
  int n;
  cin >> n;
  int tmp = max(1, (int)ceil(sqrt(n - 2)) + 1);
  map<int, int> f;
  int x = 0, y = 0, z = 0;
  for (x = 1; x <= tmp; x++) {
    for (y = 1; y <= tmp; y++) {
      for (z = 1; z <= tmp; z++) {
        int ans = x * x + y * y + z * z + x * y + y * z + z * x;
        f[ans]++;
      }
    }
  }
  for (int i = 1; i <= n; i++)
    cout << f[i] << "\\n";

  return 0;
}

Error: TLE

Fixed submission:

// #include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define fast_io()                                                              \\
  ios::sync_with_stdio(false);                                                 \\
  std::cin.tie(0);
#define mod 998244353
typedef long long ll;
typedef long double ld;
using namespace std;

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

#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define Mod 998244353
#define pi 3.14159265358979323846
#define endl '\\n'
#define IO                                                                     \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
using namespace std;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<char> vc;

const int N = 1e5 + 5;
int main() {
  int n;
  cin >> n;
  vector<int> A(N);

  for (int x = 1; x <= 105; x++) {
    for (int y = 1; y <= 105; y++) {
      for (int z = 1; z <= 105; z++) {
        if (10000 >= x * x + y * y + z * z + z * x + z * y + x * y)
          A[x * x + y * y + z * z + z * x + z * y + x * y]++;
      }
    }
  }

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


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define Mod 998244353
#define pi 3.14159265358979323846
#define endl '\\n'
#define IO                                                                     \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
using namespace std;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<char> vc;

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

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

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

#include <iostream>
using namespace std;
int a[100006];
int main() {
  int N;
  cin >> N;
  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: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int N;
  cin >> N;
  for (int i = 1; i <= N; i++) {
    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 == i) {
            cnt++;
          }
        }
      }
    }
    cout << cnt << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  ll n;
  cin >> n;
  vector<ll> v(n + 1, 0);
  ll cnt = 0;
  ll x = 1;
  while (x * x < n) {
    ll y = 1;
    while (y * y < n - x * x) {
      ll z = 1;
      while (z * z < n - x * x - y * y) {
        ll f = x * x + y * y + z * z + x * y + y * z + z * x;
        if (f <= n)
          v[f]++;
        z++;
      }
      y++;
    }
    x++;
  }
  for (ll i = 1; i < n + 1; i++) {
    cout << v[i] << endl;
  }
}

Error: TLE

Fixed submission:

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

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

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

  long long int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    a[i] = 0;
  }
  for (int x = 1; x <= sqrt(n); x++) {
    for (int y = 1; y <= sqrt(n); y++) {
      for (int z = 1; z <= sqrt(n); z++) {
        int temp = (x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (z * x);
        temp--;
        if (temp < n)
          a[temp]++;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    cout << a[i] << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

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