alexjercan/bugnet huggingface dataset:
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 count = 0;
    for (int x = 1; x <= 100; x++) {
      if (x * x >= i)
        break;
      for (int y = x; y <= 100; y++) {
        for (int z = y; z <= 100; z++) {
          int p = (x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (z * x);
          if (p == i) {
            if (x == y && y == z)
              count++;
            else if (x != y && y != z && z != x)
              count += 6;
            else
              count += 3;
          }
        }
      }
    }
    cout << count << endl;
  }
  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 count = 0;
    for (int x = 1; x <= 100; x++) {
      if (x * x >= i)
        break;
      for (int y = 1; y <= 100; y++) {
        if ((x * x) + (y * y) >= i)
          break;
        for (int z = 1; z <= 100; z++) {
          if ((x * x) + (y * y) + (z * z) >= i)
            break;
          int p = (x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (z * x);
          if (p == i)
            count++;
        }
      }
    }
    cout << count << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int main() {
  int N;

  cin >> N;

  int ans[10100];

  for (int i = 0; i < 10100; i++) {
    ans[i] = 0;
  }

  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 < 10100) {
          ans[v] += 1;
        }
      }
    }
  }

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

Error: -6
*** stack smashing detected ***: terminated


Fixed submission:

#include <iostream>
using namespace std;

int main() {
  int N;

  cin >> N;

  int ans[10001];

  for (int i = 0; i < 10100; i++) {
    ans[i] = 0;
  }

  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 < 10100) {
          ans[v] += 1;
        }
      }
    }
  }

  for (int i = 1; i <= N; i++) {
    cout << ans[i] << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>

namespace NS20200711Acing {

class XYZtriplets final {
public:
  XYZtriplets() = default;
  ~XYZtriplets() = default;

public:
  void Run() {
    Input();
    Calc();
    Output();
  }

  void Input() { std::cin >> m_N; }

  void Calc() {
    int max_k = 0;
    for (int i = 1; i < m_N; ++i) {
      int sum = i * i + 2 * i + 3;
      if (sum > m_N) {
        max_k = i - 1;
        break;
      }
    }

    for (int i = 1; i <= max_k; ++i) {
      int i2 = i * i;
      for (int j = 1; j <= max_k; ++j) {
        int j2 = j * j;
        int ji = j * i;
        if (i2 + j2 + ji > m_N)
          break;
        for (int k = 1; k <= max_k; ++k) {
          int sum = i2 + j2 + k * k + ji + j * k + i * k;
          if (sum <= m_N) {
            ++m_A[sum];
          } else {
            break;
          }
        }
      }
    }
  }

  void Output() {
    for (int i = 1; i <= m_N; ++i)
      std::cout << m_A[i] << std::endl;
  }

private:
  static const int N_MAX = 10000;
  int m_N;
  int m_A[N_MAX + 1] = {};
};

} // namespace NS20200711Acing
int main() {
  NS20200711Acing::XYZtriplets prob;
  prob.Run();

  return 0;
}


Error: 0

Fixed submission:

#include <iostream>

namespace NS20200711Acing {

class XYZtriplets final {
public:
  XYZtriplets() = default;
  ~XYZtriplets() = default;

public:
  void Run() {
    Input();
    Calc();
    Output();
  }

  void Input() { std::cin >> m_N; }

  void Calc() {
    int max_k = 0;
    for (int i = 1; i < m_N; ++i) {
      int sum = i * i + 2 * i + 3;
      if (sum > m_N) {
        max_k = i - 1;
        break;
      }
    }

    for (int i = 1; i <= max_k; ++i) {
      int i2 = i * i;
      for (int j = 1; j <= max_k; ++j) {
        int j2 = j * j;
        int ji = j * i;
        if (i2 + j2 + ji > m_N)
          break;
        for (int k = 1; k <= max_k; ++k) {
          int sum = i2 + j2 + k * k + ji + j * k + i * k;
          if (sum <= m_N) {
            ++m_A[sum];
          } else {
            break;
          }
        }
      }
    }
  }

  void Output() {
    for (int i = 1; i <= m_N; ++i)
      std::cout << m_A[i] << std::endl;
  }

private:
  static const int N_MAX = 1000;
  int m_N;
  int m_A[N_MAX + 1] = {};
};

} // namespace NS20200711Acing

int main() {
  NS20200711Acing::XYZtriplets prob;
  prob.Run();

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

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

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

  vector<int> A(N);
  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) {
        int v = x * x + y * y + z * z + x * y + y * z + z * x;
        if (v > N)
          continue;
        ++A[v - 1];
      }
    }
  }
  for (auto e : A)
    cout << e << "\\n";
}


Error: -6
malloc(): corrupted top size


Fixed submission:

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

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

  vector<int> A(N);
  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) {
        int v = x * x + y * y + z * z + x * y + y * z + z * x;
        ++A[v - 1];
      }
    }
  }
  for (auto e : A)
    cout << e << "\\n";
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
#define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++)

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

  vl f(10010, 0);

  rep(x, 1, 110) {
    if (x * x > 10010)
      break;
    rep(y, 1, 110) {
      if (y * y > 10010)
        break;
      rep(z, 1, 110) {
        int sum = x * x + y * y + z * z + x * y + y * z + z * x;
        if (sum < 10010) {
          f[sum]++;
        } else
          break;
      }
    }
  }

  rep(i, 1, n + 1) cout << f[i] << endl;

  return 0;
}

Error: 0

Fixed submission:

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
#define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++)

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

  vl f(1020, 0);

  rep(x, 1, 33) {
    rep(y, 1, 33) {
      rep(z, 1, 33) {
        if (x * x + y * y + z * z + x * y + y * z + z * x < 1010) {
          f[x * x + y * y + z * z + x * y + y * z + z * x]++;
        } else
          break;
      }
    }
  }

  rep(i, 1, n + 1) cout << f[i] << endl;

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

#include <bits/stdc++.h>
#define ll long long int
using namespace std;
#define MAX 200005
#define MOD 1000000007
#define max(a, b) (a > b ? a : b)
#define min(a, b) (a < b ? a : b)
#define vi vector<ll>
#define ii pair<ll, ll>
#define vii vector<ii>
#define si set<ll>
#define mp map<ll, ll>
#define mpi map<ii, ll>
#define fast                                                                   \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
#define pb push_back
#include <unordered_map>
#define ump unordered_map<ll, ll>
#define F first
#define S second
int calc(int n) {
  int i, j, k;
  int ans = 0;
  for (i = 1; i <= sqrt(n); i++) {
    for (j = 1; j <= sqrt(n); j++) {
      ll val1 = (i * i + j * j + i * j);
      if (val1 > n) {
        break;
      }
      for (k = 1; k <= sqrt(n); k++) {
        ll val = (i * i + j * j + k * k + i * j + j * k + i * k);
        if (val == n) {
          ans++;
        }
        if (val > n) {
          break;
        }
      }
    }
  }
  return ans;
}
int main() {
  fast ll n;
  cin >> n;
  ll i;
  for (i = 1; i <= n; i++) {
    cout << calc(i) << endl;
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define ll long long int
using namespace std;
#define MAX 200005
#define MOD 1000000007
#define max(a, b) (a > b ? a : b)
#define min(a, b) (a < b ? a : b)
#define vi vector<ll>
#define ii pair<ll, ll>
#define vii vector<ii>
#define si set<ll>
#define mp map<ll, ll>
#define mpi map<ii, ll>
#define fast                                                                   \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
#define pb push_back
#include <unordered_map>
#define ump unordered_map<ll, ll>
#define F first
#define S second
int calc(int n) {
  int i, j, k;
  int ans = 0;
  for (i = 1; i <= sqrt(n); i++) {
    for (j = 1; j <= sqrt(n); j++) {
      for (k = 1; k <= sqrt(n); k++) {
        ll val = (i * i + j * j + k * k + i * j + j * k + i * k);
        if (val == n) {
          ans++;
        }
      }
    }
  }
  return ans;
}
int main() {
  fast ll n;
  cin >> n;
  ll i;
  for (i = 1; i <= n; i++) {
    cout << calc(i) << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

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

#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define rep3(i, m, n) for (int(i) = m; (i) <= (n); (i)++)
#define rep3rev(i, m, n) for (int(i) = m; (i) >= (n); (i)--)
#define all(a) (a.begin()), (a.end())
#define rall(a) (a.rbegin()), (a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

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

void Main() {
  int n;
  cin >> n;
  int m = sqrt(n + 1);
  vi ans(n + 1, 0);

  rep3(i, 1, m) rep3(j, 1, m) rep3(k, 1, m) {
    int now = f(i, j, k);
    if (0 < now && now <= n)
      ans[now]++;
  }

  rep3(i, 1, n) cout << ans[i] << endl;
  return;
}

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
  return 0;
}

Error: 0

Fixed submission:

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

#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define rep3(i, m, n) for (int(i) = m; (i) <= (n); (i)++)
#define rep3rev(i, m, n) for (int(i) = m; (i) >= (n); (i)--)
#define all(a) (a.begin()), (a.end())
#define rall(a) (a.rbegin()), (a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

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

void Main() {
  int n;
  cin >> n;
  int m = sqrt(n + 1);
  vi ans(n + 1, 0);

  rep3(i, 1, m) rep3(j, 1, m) rep3(k, 1, m) {
    int now = f(i, j, k);
    ans[now]++;
  }

  rep3(i, 1, n) cout << ans[i] << endl;
  return;
}

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
static const int64_t mod = 1000000007;
int64_t f(int64_t x, int64_t y) {
  if (y == 0)
    return 1;
  else if (y % 2 == 0)
    return (f(x, y / 2) * f(x, y / 2)) % mod;
  else
    return (x * ((f(x, y / 2) * f(x, y / 2)) % mod)) % mod;
}
int main() {
  int N;
  cin >> N;
  map<int, int> M;
  for (int i = 0; i < 100000; i++)
    M[i] = 0;
  for (int i = 2; i <= 150; i++)
    for (int j = 2; j <= 150; j++)
      for (int k = 2; k <= 150; k++) {
        int sum = i * i + j * j + k * k;
        if (sum % 2 == 0 && (i + j + k) % 2 == 0 && i < ((i + j + k) / 2) &&
            j < ((i + j + k) / 2) && k < ((i + j + k) / 2)) {
          M.at(sum / 2)++;
        }
      }
  for (int i = 1; i <= N; i++)
    cout << M.at(i) << endl;
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
static const int64_t mod = 1000000007;
int64_t f(int64_t x, int64_t y) {
  if (y == 0)
    return 1;
  else if (y % 2 == 0)
    return (f(x, y / 2) * f(x, y / 2)) % mod;
  else
    return (x * ((f(x, y / 2) * f(x, y / 2)) % mod)) % mod;
}
int main() {
  int64_t N;
  cin >> N;
  map<int, int> M;
  for (int i = 0; i < 10000000; i++)
    M[i] = 0;
  for (int i = 2; i <= 150; i++)
    for (int j = 2; j <= 150; j++)
      for (int k = 2; k <= 150; k++) {
        int sum = i * i + j * j + k * k;
        if (sum % 2 == 0 && (i + j + k) % 2 == 0 && i < ((i + j + k) / 2) &&
            j < ((i + j + k) / 2) && k < ((i + j + k) / 2)) {
          M.at(sum / 2)++;
        }
      }
  for (int i = 1; i <= N; i++)
    cout << M.at(i) << endl;
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cstdint>   // int64_t, int*_t
#include <cstdio>    // printf
#include <deque>     // deque
#include <iomanip>   // fixed, setprecision
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <math.h>    // double sqrt
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
#define rep(i, n) for (int i = 1; i < (n); ++i)
#define ll long long
using namespace std;

int main() {
  int v;
  int n;
  cin >> n;
  vector<int> a(100001);
  rep(x, 105) {
    rep(y, 105) {
      rep(z, 105) {
        v = x * x + y * y + z * z + x * y + z * x + y * z;
        if (v <= 10001)
          a[v] += 1;
      }
    }
  }
  rep(i, n + 1) cout << a[i] << endl;
}

Error: TLE

Fixed submission:

#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cstdint>   // int64_t, int*_t
#include <cstdio>    // printf
#include <deque>     // deque
#include <iomanip>   // fixed, setprecision
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <math.h>    // double sqrt
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define ll long long
using namespace std;

int main() {
  ll n;
  cin >> n;
  for (int r = 1; r <= n; r++) {
    ll ans = 0;
    for (int x = 1; x <= 41; x++) {
      for (int i = 0; i < 100; i++) {
        for (int j = 0; j < 100; j++) {
          ll m = x * x + (x + i) * (x + i) + (x + j) * (x + j) + x * (x + i) +
                 x * (x + j) + (x + i) * (x + j);
          if (i <= j && r == m) {
            if (i == 0 && j == 0)
              ans++;
            else if (i == 0 || i == j)
              ans += 3;
            else if (i != 0 && i != j)
              ans += 6;
          }
        }
      }
    }
    cout << ans << endl;
  }

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

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

int main() {
  int N, f, a;
  cin >> N;
  vector<int> b(N + 1, 0);
  a = sqrt(N);
  for (int j = 1; j <= a; j++) {
    for (int k = 1; k <= a; k++) {
      for (int l = 1; l <= a; l++) {
        f = j * j + k * k + l * l + j * k + k * l + l * j;
        if (f <= N)
          b.at(f)++;
      }
    }
  }
  for (int i = 1; i <= N; i++)
    cout << b.at(i) << endl;
}

Error: TLE

Fixed submission:

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

int main() {
  int N, f, c = 0, a;
  cin >> N;
  for (int i = 1; i <= N; i++) {
    a = sqrt(i);
    for (int j = 1; j <= a; j++) {
      for (int k = 1; k <= a; k++) {
        for (int l = 1; l <= a; l++) {
          f = j * j + k * k + l * l + j * k + k * l + l * j;
          if (f == i)
            c++;
        }
      }
    }
    cout << c << endl;
    c = 0;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

//
// Created by 10940 on 2020/7/11.
//

#include <bits/stdc++.h>

using namespace std;
// #define LOCAL
int a[10005];

void fun(int num) {
  int ans = 0;
  for (int i = 1; i * i <= num; i++) {
    for (int j = 1; j * j <= num; j++) {
      for (int k = 1; k * k <= num; k++) {
        int re = i * i + j * j + k * k + i * j + j * k + i * k;
        if (re <= num) {
          a[re]++;
        }
      }
    }
  }
}

int main() {
  /*#ifdef LOCAL
      freopen("in.txt", "r", stdin);
      freopen("out.txt", "w", stdout);
  #endif*/
  int N;
  cin >> N;
  fun(N);
  for (int i = 1; i <= N; i++) {
    cout << a[i] << endl;
  }
  /*printf("Time used = %.3fs\\n", (double) clock() / CLOCKS_PER_SEC);
  printf("Time used = %dms", clock());*/
  return 0;
}


Error: 0

Fixed submission:

//
// Created by 10940 on 2020/7/11.
//

#include <bits/stdc++.h>

using namespace std;
// #define LOCAL
int a[10005];

int fun(int num) {
  int ans = 0;
  for (int i = 1; i * i <= num; i++) {
    for (int j = 1; j * j <= num; j++) {
      for (int k = 1; k * k <= num; k++) {
        int re = i * i + j * j + k * k + i * j + j * k + i * k;
        if (re <= num) {
          a[re]++;
        }
      }
    }
  }
}

int main() {
  /*#ifdef LOCAL
      freopen("in.txt", "r", stdin);
      freopen("out.txt", "w", stdout);
  #endif*/
  int N;
  cin >> N;
  fun(N);
  for (int i = 1; i <= N; i++) {
    cout << a[i] << endl;
  }
  /*printf("Time used = %.3fs\\n", (double) clock() / CLOCKS_PER_SEC);
  printf("Time used = %dms", clock());*/
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error


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

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

  vector<int> vec(n + 1, 0);

  for (int i = 1; i <= 100; ++i) {
    for (int j = 1; j <= 100; ++j) {
      for (int k = 1; k <= 100; ++k) {
        int tmp = pow(i, 2) + pow(j, 2) + pow(k, 2) + i * j + j * k + k * i;
        if (tmp <= 10000)
          ++vec[tmp];
      }
    }
  }

  for (int i = 0; i < n; ++i)
    cout << vec[i + 1] << "\\n";

  return 0;
}


Error: -11

Fixed submission:


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

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

  vector<int> vec(n + 1, 0);

  for (int i = 1; i <= 100; ++i) {
    for (int j = 1; j <= 100; ++j) {
      for (int k = 1; k <= 100; ++k) {
        int tmp = pow(i, 2) + pow(j, 2) + pow(k, 2) + i * j + j * k + k * i;
        if (n <= 10001)
          ++vec[tmp];
      }
    }
  }

  for (int i = 0; i < n; ++i)
    cout << vec[i + 1] << "\\n";

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

#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int n, ans[N];

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

  cin >> n;

  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 f = 0;
        f += x * x + y * y + z * z;
        f += x * y + y * z + z * x;
        ans[f] += 1;
      }
    }
  }

  for (int i = 1; i <= n; i++) {
    cout << ans[i] << '\\n';
  }

  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
const int N = 5e4 + 10;
int n, ans[N];

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

  cin >> n;

  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 f = 0;
        f += x * x + y * y + z * z;
        f += x * y + y * z + z * x;
        ans[f] += 1;
      }
    }
  }

  for (int i = 1; i <= n; i++) {
    cout << ans[i] << '\\n';
  }

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

#include <bits/stdc++.h>
#define mod 1000000009
#define int long long
#define garou                                                                  \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);
using namespace std;
int pow(int p, int r) {
  int ans = 1;
  while (r > 0) {
    if (r & 1) {
      ans = ((ans % mod) * (p % mod)) % mod;
    }
    r = r >> 1;
    p = ((p % mod) * (p % mod)) % mod;
  }
  return ans;
}
signed main() {
  garou;
  int n;
  cin >> n;
  int re = 0;
  int x = 1;
  map<int, int> mp;
  while ((x * x) <= n) {
    int y = 1;
    while ((y * y) <= n) {
      int z = 1;
      while ((z * z) <= n) {
        int a = pow(x, 2) + pow(y, 2) + pow(z, 2) + (x * y) + (y * z) + (x * z);
        mp[a]++;
        z++;
      }
      y++;
    }
    x++;
  }
  for (int i = 1; i <= n; i++)
    cout << mp[i] << endl;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
#define mod 1000000009
#define int long long
#define garou                                                                  \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);
using namespace std;
int pow(int p, int r) {
  int ans = 1;
  while (r > 0) {
    if (r & 1) {
      ans = ((ans % mod) * (p % mod)) % mod;
    }
    r = r >> 1;
    p = ((p % mod) * (p % mod)) % mod;
  }
  return ans;
}
int arr[10010];
signed main() {
  garou;
  int n;
  cin >> n;
  int re = 0;
  int x = 1;
  while ((x * x) <= n) {
    int y = 1;
    while ((y * y) <= n) {
      int z = 1;
      while ((z * z) <= n) {
        int a = pow(x, 2) + pow(y, 2) + pow(z, 2) + (x * y) + (y * z) + (x * z);
        arr[a]++;
        z++;
      }
      y++;
    }
    x++;
  }
  for (int i = 1; i <= n; i++)
    cout << arr[i] << endl;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#pragma GCC optimize("O2")
#include <iostream>
using namespace std;
#define f(x, y, z) for (int x = y; x < z; ++x)
int h, h1, h2, n, c, l, r, t, z;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  f(i, 1, n + 1) {
    h = h1 = h2 = 0;
    for (int x = 1; x * x + x + x + 2 < i; ++x) {
      for (int y = x; x * x + y * y + x * y + x + y < i; ++y) {
        z = y;
        while (x * x + y * y + z * z + x * y + y * z + z * x < i)
          ++z;
        if (x * x + y * y + z * z + x * y + y * z + z * x == i) {
          if (x == y || y == z || z == x) {
            if (x == y && y == z && z == x)
              ++h2;
            else
              ++h1;
          } else
            ++h;
        }
      }
    }
    cout << h * 6 + h1 * 3 + h2 << '\\n';
  }
  // cout << c << '\\n';
}

Error: TLE

Fixed submission:

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

signed main() {
  int t;
  cin >> t;
  for (int i = 1; i <= t; 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 * z + x * y + y * z == i)
            cnt++;
        }
      }
    }
    cout << cnt << '\\n';
  }
}