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

#include <bits/stdc++.h>
#define ull unsigned long long
// #define _CRT_DISABLE_PERFCRIT_LOCKS

using namespace std;

int main(int argc, char const *argv[]) {
  // ios_base::sync_with_stdio(false);
  // cin.tie(NULL);
  // cout.tie(NULL);
  ull n;
  std::cin >> n;
  std::map<int, int> f;
  double upp = sqrt(n);
  for (int x = 1; x <= upp; x++) {
    for (int y = 1; y <= upp; y++) {
      for (int z = 1; z <= upp; z++) {
        ull fi = x * x + y * y + z * z + x * y + y * z + z * x;
        if (fi > n)
          break;
        f[fi]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    std::cout << f[i] << '\\n';
  }
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define _CRT_DISABLE_PERFCRIT_LOCKS

using namespace std;

int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  std::cin >> n;
  for (int i = 1; i <= n; i++) {
    int c = 0;
    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 + y * z + z * x == i) {
            // printf("for i=%d: %d %d %d\\n", i, x, y, z);
            c++;
          }
        }
      }
    }
    std::cout << c << '\\n';
  }
}
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 x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        int s = x * x + y * y + z * z + x * y + y * z + z * x;
        if (s > N) {
          continue;
        }
        ans[s]++;
      }
    }
  }

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

  return 0;
}


Error: TLE

Fixed submission:

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

int main() {

  int N;
  cin >> N;
  int x, y, z, C;
  x = 1;
  y = 1;
  z = 1;
  C = 0;

  for (int i = 1; i <= N; i++) {

    for (x = 1; x * x + 2 <= i; x++) {
      for (y = 1; y * y + x * x + 1 <= i; y++) {
        for (z = 1; (z * z + y * y + x * x) <= i; z++) {

          if (((x + y) * (x + y) + (y + z) * (y + z) + (x + z) * (x + z)) ==
              2 * i) {
            C++;
          }
        }
      }
    }

    cout << C << endl;
    C = 0;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

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

  std::vector<int> cnt(N + 1, 0);
  for (int x = 1; x < N; x++) {
    for (int y = x; y < N; y++) {
      for (int z = y; z < N; z++) {
        int index = x * x + y * y + z * z + x * y + y * z + z * x;
        if (index > N) {
          break;
        }
        if (x == y && x == z) {
          cnt[index]++;
        } else if (x == y || y == z || z == x) {
          cnt[index] += 3;
        } else {
          cnt[index] += 6;
        }
      }
    }
  }
  for (int i = 1; i <= N; i++) {
    std::cout << cnt[i] << std::endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>

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

  for (int i = 1; i <= N; i++) {
    int cnt = 0;
    for (int x = 1; x <= i; x++) {
      for (int y = x; y <= i; y++) {
        for (int z = y; z <= i; z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == i) {
            if (x == y && x == z) {
              cnt++;
            } else if (x == y || y == z || z == x) {
              cnt += 3;
            } else {
              cnt += 6;
            }
          }
        }
      }
    }
    std::cout << cnt << std::endl;
  }

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

#include <bits/stdc++.h>
using namespace std;
int f(int n) {
  if (n < 6)
    return 0;
  int ans = 0;
  for (int x = 1; x * x <= n; x++) {
    for (int y = x; x * x + y * y <= n; y++) {
      for (int z = y; x * x + y * y + z * z <= n; z++) {
        if (x * x + y * y + z * z + x * y + x * z + y * z == n) {
          if (x != y and y != z and x != z)
            ans += 6;
          else if (x == y and y == z and x == z)
            ans++;
          else
            ans += 3;
        }
      }
    }
  }
  return ans;
}

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>
using namespace std;
int f(int n) {
  if (n < 6)
    return 0;
  int ans = 0;
  for (int x = 1; x * x <= n; x++) {
    for (int y = 1; x * x + y * y <= n; y++) {
      for (int z = 1; x * x + y * y + z * z <= n; z++) {
        if (x * x + y * y + z * z + x * y + x * z + y * z == n) {
          ans++;
        }
      }
    }
  }
  return ans;
}

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 <cmath>
#include <cstdio>
int main() {
  int n, f;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    f = 0;
    for (int a = -sqrt(2 * i); a <= sqrt(2 * i); a++) {
      for (int b = -sqrt(2 * i); b <= sqrt(2 * i); b++) {
        if ((int)sqrt(2 * i - a * a - b * b) == sqrt(2 * i - a * a - b * b)) {
          int c = sqrt(2 * i - a * a - b * b);
          if (a - b + c >= 2 && a + b - c >= 2 && b + c - a >= 2)
            f++;
        }
      }
    }
    printf("%d\\n", f);
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <cstdio>

int main() {
  int n, f;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    f = 0;
    for (int x = 1; x <= i / 3; x++) {
      for (int y = 1; y <= i / 3; y++) {
        for (int z = 1; z <= i / 3; z++) {
          if (x * x + y * y + z * z + x * y + x * z + y * z == i)
            f++;
        }
      }
    }
    printf("%d\\n", f);
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <list>
#include <math.h>
#include <numeric>
#include <string>
#include <vector>
using namespace std;

int calc(int i) {
  double lim = sqrt((double)i);
  int ilim = (int)lim + 1;

  int val;
  int ans = 0;

  // �l���S������
  for (int x = 1; x <= ilim; x++) {
    val = x * x + x * x + x * x + x * x + x * x + x * x;
    if (val == i) {
      ans += 1;
    }
  }

  // �l���Q����
  for (int x = 1; x <= ilim - 1; x++) {
    for (int y = x + 1; y <= ilim; y++) {
      val = x * x + y * y + x * x + x * y + y * x + x * x;
      if (val == i) {
        ans += 3;
      }
      val = x * x + y * y + y * y + x * y + y * y + y * x;
      if (val == i) {
        ans += 3;
      }
    }
  }

  // �l���o���o��
  for (int x = 1; x <= ilim - 2; x++) {
    for (int y = x + 1; y <= ilim - 1; y++) {
      for (int z = y + 1; z <= ilim; z++) {
        val = x * x + y * y + z * z + x * y + y * z + z * x;
        if (val == i) {
          ans += 6;
        }
      }
    }
  }

  return ans;
}

int main() {

  int N;
  cin >> N;

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

  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <list>
#include <math.h>
#include <numeric>
#include <string>
#include <vector>
using namespace std;

int calc(int i) {
  double lim = sqrt((double)i);
  int ilim = (int)lim + 1;

  int val;
  int ans = 0;
  for (int x = 1; x <= ilim; x++) {
    for (int y = 1; y <= ilim; y++) {
      for (int z = 1; z <= ilim; z++) {
        val = x * x + y * y + z * z + x * y + y * z + z * x;
        if (val == i) {
          ans += 1;
        }
      }
    }
  }

  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: Runtime Error


#include <algorithm>
#include <iomanip> // std::setprecision()
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define pai 3.14159265358979323846
ll gcd(ll a, ll b) {
  if (a % b == 0)
    return (b);
  else
    return (gcd(b, a % b));
}
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
/* map<string,int> */
/* 大文字を小文字に変換 tolower*/
/* 小文字を大文字に変換 toupper*/
/* 辞書順 next_permutation(a.begin(),a.end()) */

int main() {
  int n;
  cin >> n;
  vector<ll> a(100 * 100 * 100, 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;
        a[tmp]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << a[i] << endl;
  }
}

Error: -11

Fixed submission:


#include <algorithm>
#include <iomanip> // std::setprecision()
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <string>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define pai 3.14159265358979323846
ll gcd(ll a, ll b) {
  if (a % b == 0)
    return (b);
  else
    return (gcd(b, a % b));
}
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
/* map<string,int> */
/* 大文字を小文字に変換 tolower*/
/* 小文字を大文字に変換 toupper*/
/* 辞書順 next_permutation(a.begin(),a.end()) */

int main() {
  int n;
  cin >> n;
  vector<ll> a(n, 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;
        a[tmp]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << a[i] << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < ll(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i < ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= b; i--)
#define ALL(x) x.begin(), x.end()
#define SIZE(x) ll(x.size())

#define INF 1000000000000 // 10^12
#define MOD 1000000007    // 10^9+7:合同式の法

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

  ll ansx, ansy, ansz;
  for (ll i = 1; i <= n; i++) {
    ll count = 0;
    for (ll x = 1; x <= sqrt(i / 6); x++) {
      for (ll y = x; y <= sqrt(i / 3); y++) {
        // ll z = (-x-y+sqrt(-3*x*x-3*y*y-2*x*y+4*i))/2;
        for (ll z = y; z <= sqrt(i); z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == i) {
            ansx = x;
            ansy = y;
            ansz = z;
            if (ansx == ansy && ansy == ansz) {
              count += 1;
            } else if (ansx != ansy && ansy != ansz) {
              count += 6;
            } else {
              count += 3;
            }
          }
        }
      }
    }
    cout << count << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < ll(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i < ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= b; i--)
#define ALL(x) x.begin(), x.end()
#define SIZE(x) ll(x.size())

#define INF 1000000000000 // 10^12
#define MOD 1000000007    // 10^9+7:合同式の法

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

  ll ansx, ansy, ansz;
  for (ll i = 1; i <= n; i++) {
    ll count = 0;
    for (ll x = 1; x <= sqrt(i / 6); x++) {
      for (ll y = x; y <= -1 / 3 + sqrt(3 * i - 2 * x * x) / 3; y++) {
        // ll z = (-x-y+sqrt(-3*x*x-3*y*y-2*x*y+4*i))/2;
        for (ll z = sqrt(n / 6); z < -1 + sqrt(4 * n - 15); z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == i) {
            ansx = x;
            ansy = y;
            ansz = z;
            if (ansx == ansy && ansy == ansz) {
              count += 1;
            } else if (ansx != ansy && ansy != ansz) {
              count += 6;
            } else {
              count += 3;
            }
          }
        }
      }
    }
    cout << count << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include "bits/stdc++.h" // 提出時こちらで問題なし
using namespace std;

int main() {
  int num_N = 0;
  cin >> num_N;

  vector<int> hash(10001, 0);
  int sum = 0;

  for (int x = 1; x < 100; x++) {
    for (int y = 1; y < 100; y++) {
      for (int z = 1; z < 100; z++) {
        sum = pow((x + y + z), 2) - (x * y + y * z + z * x);
        if (sum > 10000) {
          break;
        }
        hash[sum]++;
      }
    }
  }
  for (int i = 1; i <= num_N; i++)
    cout << hash[i] << endl;
  return 0;
}


Error: TLE

Fixed submission:

#include "bits/stdc++.h" // 提出時こちらで問題なし
using namespace std;

int main() {
  // gorioshi
  int num_N, num = 0;
  cin >> num;

  if (num <= 6) {
    num_N = 6;
  } else {
    num_N = num;
  }

  vector<int> v(num_N, 0);

  v.at(0) = 0;
  v.at(1) = 0;
  v.at(2) = 0;
  v.at(3) = 0;
  v.at(4) = 0;
  v.at(5) = 1;

  if (6 < num_N) {
    for (int w = 7; w <= num_N; w++) {
      for (int x = 1; x < (w / 100) + 10; x++) {
        for (int y = 1; y < (w / 100) + 10; y++) {
          for (int z = 1; z < (w / 100) + 10; z++) {
            if (pow((x + y + z), 2) - (x * y + y * z + z * x) == w) {
              v.at(w - 1) += 1;
            }
          }
        }
      }
    }
  }

  for (int i = 0; i < num; i++) {
    cout << v.at(i) << endl;
  }
  // system("pause");
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int n;
  cin >> n;
  for (int i = 1; i < n + 1; i++) {
    int ans = 0;
    for (int x = 1; x < 45; x++) {
      for (int y = x; y < 60; y++) {
        for (int z = y; z < 101; z++) {
          if (pow(x + y, 2) + pow(y + z, 2) + pow(z + x, 2) == 2 * i) {
            if (x < y && y < z)
              ans += 6;
            if (x < y && y == z)
              ans += 3;
            if (x == y && y < z)
              ans += 3;
            if (x == y && y == z)
              ans += 1;
          }
        }
      }
    }
    cout << ans << endl;
  }
}

Error: TLE

Fixed submission:

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

int main() {
  int n;
  cin >> n;
  for (int i = 1; i < n + 1; i++) {
    int ans = 0;
    for (int x = 1; x < 45; x++) {
      for (int y = x; y < 99; y++) {
        for (int z = y; z < 101; z++) {
          if (pow(x + y, 2) + pow(y + z, 2) + pow(z + x, 2) == 2 * i) {
            if (x < y && y < z)
              ans += 6;
            if (x < y && y == z)
              ans += 3;
            if (x == y && y < z)
              ans += 3;
            if (x == y && y == z)
              ans += 1;
          }
        }
      }
    }
    cout << ans << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main(void) {
  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; x * x + y * y <= i; y++) {
        // for (int z = 1; x * x + y * y + z * z <= i; z++) {
        //     if (x * x + y * y + z * z + x * y + y * z + z * x == i) {
        //       ans++;
        //     }
        //   }
        int D = (x + y) * (x + y) - 4 * (-i + x * x + y * y + x * y);
        if (D == 0) {
          double z = -(x + y) / 2.0;
          ans += floor(z) == ceil(z) && z > 0 ? 1 : 0;
        } else if (D > 0) {
          double z = (-(x + y) + sqrt(D)) / 2.0;
          ans += floor(z) == ceil(z) && z > 0 ? 1 : 0;
          z = (-(x + y) - sqrt(D)) / 2.0;
          ans += floor(z) == ceil(z) && z > 0 ? 1 : 0;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

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

int main(void) {
  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; x * x + y * y <= i; y++) {
        for (int z = 1; x * x + y * y + z * z <= i; 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;
using ll = int64_t;

const int MAX = 10005;

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

  vector<int> c(MAX, 0);
  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        int val = x * x + y * y + z * z + x * y + y * z + z * x;
        if (val > MAX)
          break;
        c[val]++;
      }
    }
  }

  for (int i = 1; i <= n; i++) {
    int ans = c[i];
    printf("%d\\n", ans);
  }
}


Error: TLE

Fixed submission:

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

const int MAX = 10005;

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

  map<pair<int, int>, vector<int>> m;
  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        int val = x * x + y * y + z * z + x * y + y * z + z * x;
        if (m.count({x, y}) == 0) {
          vector<int> tmp(MAX, 0);
          m[{x, y}] = tmp;
        }
        if (val <= MAX) {
          m[{x, y}][val] = 1;
        }
      }
    }
  }

  for (int i = 1; i <= n; i++) {
    int ans = 0;
    for (int x = 1; x <= 100; x++) {
      for (int y = 1; y <= 100; y++) {
        if (m[{x, y}][i] == 1) {
          ans++;
        }
      }
    }
    printf("%d\\n", ans);
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int num;
  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++) {
        num = x * x + y * y + z * z + x * y + y * z + z * x;
        if (num <= 10000)
          ans[num]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << endl;
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long ans;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    ans = 0;
    for (int x = 1; x * x <= i; x++) {
      for (int y = 1; y * y <= i; y++) {
        if ((x + y) * (x + y) > i)
          continue;
        for (int z = 1; z * z <= i; 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: Time Limit Exceeded

#include <iostream>

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

  int f;

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

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>

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

  int f;

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

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

#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, n) for (int i = (a); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define FOR(it, c)                                                             \\
  for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

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

  vector<ll> ret(N + 1, 0);

  for (ll x = 1; x * x <= N; x++) {
    for (ll y = 1; y * y <= N; y++) {
      for (ll z = 1; z * z <= N; z++) {
        ll res = x * x + y * y + z * z + x * y + y * z + z * x;

        if (res <= N)
          ret[res]++;
      }
    }
  }

  REP(i, 1, N + 1) { cout << ret[i] << endl; }

  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, n) for (int i = (a); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define FOR(it, c)                                                             \\
  for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

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

  vector<ll> ret(N + 1, 0);

  for (ll x = 1; x * x <= N; x++) {
    for (ll y = 1; y * y <= N; y++) {
      for (ll z = 1; z * z <= N; z++) {
        ll res = x * x + y * y + z * z + x * y + y * z + z * x;

        ret[res]++;
      }
    }
  }

  REP(i, 1, N + 1) { cout << ret[i] << endl; }

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

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

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int cnt = 0;
    for (int x = 1; x * x <= i; x++) {
      for (int y = 1; y * y <= i; y++) {
        int b = x + y, c = i - x * x - y * y - x * y;
        if (c > 0) {
          double z = (-b + sqrt(b * b + 4 * c)) / 2;
          if (ceil(z) == floor(z))
            cnt++;
        }
      }
    }
    cout << cnt << '\\n';
  }
  return 0;
}

Error: TLE

Fixed submission:

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

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

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

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


Error: TLE

Fixed submission:

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

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