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

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

int main() {
  int n;
  cin >> n;
  vector<int> f(n);
  for (int i = 1; i < sqrt(n); i++) {
    for (int j = 1; j < sqrt(n); j++) {
      for (int k = 1; k < sqrt(n); k++) {
        int m = i * i + j * j + k * k + i * j + j * k + k * i;
        if (m <= n) {
          f[m - 1]++;
        }
      }
    }
  }

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

  return 0;
}

Error: -6
malloc(): corrupted top size


Fixed submission:

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

int main() {
  int n, m = 1;
  cin >> n;
  vector<int> f(n);
  for (int i = 1; i < n; i++) {
    for (int j = 1; j < n; j++) {
      for (int k = 1; n >= m; k++) {
        m = i * i + j * j + k * k + i * j + j * k + k * i;
        f[m - 1]++;
      }
      m = 1;
    }
    m = 1;
  }

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

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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> VI;
typedef vector<VI> VVI;
typedef pair<ll, ll> P;
#define FOR(i, a, b) for (ll i = ll(a); i < ll(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define PRINT(V)                                                               \\
  for (auto v : (V))                                                           \\
  cout << v << " "
#define ALL(n) begin(n), end(n)
struct cww {
  cww() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  }
} star;
const ll INF = numeric_limits<ll>::max();

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

  int m;
  map<int, int> ans;
  for (int x = 1; x * x <= 2 * n; ++x) {
    for (int y = 1; y * y <= 2 * n; ++y) {
      for (int z = 1; z * z <= 2 * n; ++z) {
        m = x * x + y * y + z * z + x * y + y * z + z * x;
        ++ans[m];
      }
    }
  }
  rep(i, n) { cout << ans[i + 1] << endl; }
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> VI;
typedef vector<VI> VVI;
typedef pair<ll, ll> P;
#define FOR(i, a, b) for (ll i = ll(a); i < ll(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define PRINT(V)                                                               \\
  for (auto v : (V))                                                           \\
  cout << v << " "
#define ALL(n) begin(n), end(n)
struct cww {
  cww() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  }
} star;
const ll INF = numeric_limits<ll>::max();

ll getans(int n) {
  ll ans = 0;
  for (int x = 1; x * x <= 2 * n; ++x) {
    for (int y = 1; y * y <= 2 * n; ++y) {
      for (int z = 1; z * z <= 2 * n; ++z) {
        if (x * x + y * y + z * z + x * y + y * z + z * x == n)
          ++ans;
      }
    }
  }
  return ans;
}

int main() {
  int n;
  cin >> n;
  rep(i, n) {
    ll ans = getans(i + 1);
    cout << ans << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <iostream>

using namespace std;

int f(int n) {
  int count = 0;
  for (int x = 1; x * x <= n; ++x) {
    int x2 = x * x;
    for (int y = x; y * y <= n - x2; ++y) {
      int y2 = x2 + y * y + x * y;
      for (int z = y; z * z <= n - y2; ++z) {
        if (y2 + z * z + y * z + x * z == n) {
          if (x == y && x == z)
            count++;
          else if (x == y || x == z || y == z) {
            count += 3;
          } else
            count += 6;
        }
      }
    }
  }
  return count;
}

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


Error: TLE

Fixed submission:

#include <algorithm>
#include <iostream>

using namespace std;

int f(int n) {
  int count = 0;
  for (int x = 1; x * x <= n; ++x) {
    int x2 = x * x;
    for (int y = 1; y * y <= n - x2; ++y) {
      int y2 = x2 + y * y + x * y;
      for (int z = 1; z * z <= n - y2; ++z) {
        if (y2 + z * z + y * z + x * z == n)
          ++count;
      }
    }
  }
  return count;
}

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

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

#define DEBUG 0

int main() {

  int N;

  cin >> N;

  vector<int> counter_n(N + 1, 0);

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

    for (int i = 1; i < (int)(sqrt(num) * 1.4); i++) {
      for (int j = i; j < (int)(sqrt(num) * 1.4); j++) {
        for (int k = j; k < (int)(sqrt(num) * 1.4); k++) {
          if (i * i + j * j + k * k == 2 * num) {
#if DEBUG
            cout << i << j << k << num << endl;
#endif

            int x2 = i + j - k;
            int y2 = i - j + k;
            int z2 = -i + j + k;

            if ((x2 > 0) && !(x2 & 1) && (y2 > 0) && !(y2 & 1) && (z2 > 0) &&
                !(z2 & 1)) {
              if ((x2 == y2) && (y2 == z2)) {
                counter_n.at(num)++;
              } else if ((x2 != y2) && (x2 != z2) && (y2 != z2)) {
                counter_n.at(num) += 6;
              } else {
                counter_n.at(num) += 3;
              }
            }
          }
        }
      }
    }
  }

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

  return 0;
}


Error: TLE

Fixed submission:

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

#define DEBUG 0

int main() {

  int N;

  cin >> N;

  vector<int> counter_n(N + 1, 0);

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

    for (int i = 1; i < (int)sqrt(num) * 2; i++) {
      for (int j = i; j < (int)sqrt(num) * 2; j++) {
        for (int k = j; k < (int)sqrt(num) * 2; k++) {
          if (i * i + j * j + k * k == 2 * num) {
#if DEBUG
            cout << i << j << k << num << endl;
#endif

            int x2 = i + j - k;
            int y2 = i - j + k;
            int z2 = -i + j + k;

            if ((x2 > 0) && !(x2 & 1) && (y2 > 0) && !(y2 & 1) && (z2 > 0) &&
                !(z2 & 1)) {
              if ((x2 == y2) && (y2 == z2)) {
                counter_n.at(num)++;
              } else if ((x2 != y2) && (x2 != z2) && (y2 != z2)) {
                counter_n.at(num) += 6;
              } else {
                counter_n.at(num) += 3;
              }
            }
          }
        }
      }
    }
  }

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

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

#include <bits/stdc++.h>
#include <cmath>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef long long ll;

int v(int x, int y, int z) {
  //  cout << "set:" << x << ","<< y << "," << z << endl;
  int ans = x * x + x * y + y * y + y * z + z * z + z * x;
  return ans;
}

void f(int N, vi &a) {
  int X, Y, Z;
  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 ans = v(X, Y, Z);
        // cout <<"ans:" << ans << endl;
        a[ans - 1]++;
      }
    }
  }
  return;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  bool cont = true;
  cin >> N;
  vi a(100000);
  f(N, a);
  for (int i = 0; i < N; i++) {
    cout << a.at(i) << endl;
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef long long ll;

int f(int x, int y, int z) {
  //  cout << "set:" << x << ","<< y << "," << z << endl;
  int ans = x * x + x * y + y * y + y * z + z * z + z * x;
  return ans;
}

int cal(int N) {
  int X, Y, Z;
  int count = 0;
  for (int X = 1; X < N; X++) {
    for (int Y = X; Y < N; Y++) {
      for (int Z = Y; Z < N; Z++) {
        int ans = f(X, Y, Z);
        if (ans == N) {
          if (X == Y && Y == Z) {
            count++;
          } else if (X == Y || Y == Z) {
            count = count + 3;
          } else {
            count = count + 6;
          }
        }
      }
    }
  }
  return count;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  bool cont = true;
  cin >> N;
  for (int i = 1; i < N + 1; i++) {
    // cout << "in loop" << endl;
    cout << cal(i) << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#pragma GCC optimize("Ofast")
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <string.h>
#include <vector>

const long long INFL = 1e17 + 7;
const long long INFI = 1e9 + 7;
const long long MOD = 1e9 + 7;
const double EPS = 1e-8;
const double PI = acos(-1);

using namespace std;

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

  int n;
  cin >> n;
  vector<int> count(n + 1, 0);
  for (int i = 1; i <= n; i++) {
    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 && y == z) {
              count[i]++;
              break;
            } else if (x != y && y != z) {
              count[i] += 6;
              break;
            } else {
              count[i] += 3;
              break;
            }
          }
        }
      }
    }
  }

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

  return 0;
}


Error: TLE

Fixed submission:

#pragma GCC optimize("Ofast")
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <string.h>
#include <vector>

const long long INFL = 1e17 + 7;
const long long INFI = 1e9 + 7;
const long long MOD = 1e9 + 7;
const double EPS = 1e-8;
const double PI = acos(-1);

using namespace std;

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

  int n;
  cin >> n;
  vector<int> count(n + 1, 0);
  for (int i = 1; i <= n; i++) {
    for (int x = 1; x * x <= n; x++) {
      for (int y = x; y * y <= n; y++) {
        for (int z = y; z * z <= n; z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == i) {
            if (x == y && y == z) {
              count[i]++;
              break;
            } else if (x != y && y != z) {
              count[i] += 6;
              break;
            } else {
              count[i] += 3;
              break;
            }
          }
        }
      }
    }
  }

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

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

#include <bits/stdc++.h>
#include <unordered_map>
#define ull unsigned long long
#define int long long
#define ll long long
#define fr(i, n) for (int i = 0; i < n; i++)
#define frf(i, j, n) for (int i = j; i <= n; i++)
#define frd(i, n) for (int i = n; i >= 0; i--)
#define mp(i, j) make_pair(i, j)
#define pb(x) push_back(x)
using namespace std;
// typedef vector<vector<ll>> matrix;
// const ll PRIME = 1e9 + 7;
// typedef pair<int,pair<int,int> >  ppi;

void solve() {
  int n;
  cin >> n;
  int a[n + 1];
  memset(a, 0, sizeof(a));
  for (int y = 6; y <= n; y++) {
    bool flag = 0;
    for (int i = 1; i * i <= y; i++) {
      for (int j = 1; j * j <= y; j++) {
        for (int k = 1; k * k <= y; k++) {
          if (i * i + j * j + k * k + i * j + i * k + j * k == y) {
            a[y]++;
          }
          if (i * i + j * j + k * k + i * j + i * k + j * k >= y) {
            flag = 1;
            break;
          }
        }
      }
    }
  }
  frf(i, 1, n) { cout << a[i] << "\\n"; }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  int t;
  // cin >> t
  t = 1;
  while (t--) {
    solve();
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <unordered_map>
#define ull unsigned long long
#define int long long
#define ll long long
#define fr(i, n) for (int i = 0; i < n; i++)
#define frf(i, j, n) for (int i = j; i <= n; i++)
#define frd(i, n) for (int i = n; i >= 0; i--)
#define mp(i, j) make_pair(i, j)
#define pb(x) push_back(x)
using namespace std;
// typedef vector<vector<ll>> matrix;
// const ll PRIME = 1e9 + 7;
// typedef pair<int,pair<int,int> >  ppi;

void solve() {
  int n;
  cin >> n;
  int a[n + 1];
  memset(a, 0, sizeof(a));
  for (int y = 6; y <= n; y++) {
    for (int i = 1; i * i <= y; i++) {
      for (int j = 1; j * j <= y; j++) {
        for (int k = 1; k * k <= y; k++) {
          if (i * i + j * j + k * k + i * j + i * k + j * k == y) {
            a[y]++;
            if (k * k >= y || j * j >= y || i * i >= y)
              break;
          }
        }
      }
    }
  }
  frf(i, 1, n) { cout << a[i] << "\\n"; }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  int t;
  // cin >> t
  t = 1;
  while (t--) {
    solve();
  }
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(), (v).end()
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const ll INF = 1LL << 60;
const int inf = (1 << 30) - 1;
const int mod = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, -1, -1, 1, 1};
int dy[8] = {0, 1, 0, -1, -1, 1, -1, 1};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<ll> res(n + 1);
  FOR(i, 1, 101) {
    FOR(j, 1, 101) {
      FOR(k, 1, 101) {
        if (i * i + j * j + k * k + i * j + j * k + k * i > n) {
          continue;
        }
        res[i * i + j * j + k * k + i * j + j * k + k * i]++;
      }
    }
  }
  FOR(i, 1, n + 1) { cout << res[i] << endl; }
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(), (v).end()
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const ll INF = 1LL << 60;
const int inf = (1 << 30) - 1;
const int mod = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, -1, -1, 1, 1};
int dy[8] = {0, 1, 0, -1, -1, 1, -1, 1};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<ll> res(n + 1);
  FOR(i, 1, 101) {
    FOR(j, 1, 101) {
      FOR(k, 1, 101) {
        if (i * i + j * j + k * k > n) {
          continue;
        }
        res[i * i + j * j + k * k + i * j + j * k + k * i]++;
      }
    }
  }
  FOR(i, 1, n + 1) { cout << res[i] << endl; }
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

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

bool f(int val, int rhs) {
  bool ok = false;
  for (int i = 1; i < 100; i++) {
    if (i * (i + val) == rhs)
      ok = true;
  }
  return ok;
}

int main() {
  int N;
  cin >> N;
  vector<int> ans(N);
  vector<vector<bool>> table(200, vector<bool>(10000));
  for (int i = 0; i < 200; i++) {
    for (int j = 0; j < 10000; j++) {
      table[i][j] = f(i, j);
    }
  }

  for (int x = 1; x <= N; x++) {
    int num = 0;
    for (int i = 1; i * i < x; i++) {
      for (int j = 1; j * j < x; j++) {
        int rhs = x - i * i - j * j - i * j;
        if (rhs <= 0)
          continue;
        else {
          int val = i + j;
          if (table[val][rhs])
            num++;
        }
      }
    }
    ans[x - 1] = num;
  }
  for (int i = 0; i < N; i++) {
    cout << ans[i] << endl;
  }
}

Error: -11

Fixed submission:

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

bool f(int val, int rhs) {
  bool ok = false;
  for (int i = 1; i < 100; i++) {
    if (i * (i + val) == rhs)
      ok = true;
  }
  return ok;
}

int main() {
  int N;
  cin >> N;
  vector<int> ans(N);
  vector<vector<bool>> table(200, vector<bool>(10000));
  for (int i = 0; i < 300; i++) {
    for (int j = 0; j < 1000; j++) {
      table[i][j] = f(i, j);
    }
  }

  for (int x = 1; x <= N; x++) {
    int num = 0;
    for (int i = 1; i * i < x; i++) {
      for (int j = 1; j * j < x; j++) {
        int rhs = x - i * i - j * j - i * j;
        if (rhs <= 0)
          continue;
        else {
          int val = i + j;
          if (table[val][rhs])
            num++;
        }
      }
    }
    ans[x - 1] = num;
  }
  for (int i = 0; i < N; i++) {
    cout << ans[i] << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int a[100005];

int main() {
  int n;
  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 v = x * x + y * y + z * z + x * y + y * z + z * x;
        if (v <= n)
          a[v]++;
      }
    }
  }

  rep(i, n) cout << a[i + 1] << endl;
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
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 <= n; x++) {
      for (int y = 1; y * y <= n; y++) {
        for (int z = 1; z * z <= n; z++) {
          ll a = x * x + y * y + z * z + x * y + y * z + z * x;
          if (a == i)
            ans++;
        }
      }
    }
    cout << ans << endl;
  }

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

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;
const int dx[] = {0, 1, -1, 0};
const int dy[] = {1, 0, 0, -1};
const ll mod = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = 1LL << 60;
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //////////////////////////////////////
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int ans = 0;
    for (int x = 1; x <= sqrt(n); x++) {
      for (int y = x; y <= sqrt(n); y++) {
        for (int z = y; z * (z + x + y) <= i - x * x - y * y - x * y; z++)
          if (x * x + y * y + z * z + x * y + y * z + z * x == i) {
            map<int, int> mp;
            mp[x]++;
            mp[y]++;
            mp[z]++;
            if (mp.size() == 1)
              ans++;
            if (mp.size() == 2)
              ans += 3;
            if (mp.size() == 3)
              ans += 6;
          }
      }
    }
    cout << ans << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;
const int dx[] = {0, 1, -1, 0};
const int dy[] = {1, 0, 0, -1};
const ll mod = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = 1LL << 60;
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //////////////////////////////////////
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int ans = 0;
    for (int x = 1; x <= sqrt(n); x++) {
      for (int y = x; y <= sqrt(n); y++) {
        for (int z = y; z <= sqrt(n); z++)
          if (x * x + y * y + z * z + x * y + y * z + z * x == i) {
            map<int, int> mp;
            mp[x]++;
            mp[y]++;
            mp[z]++;
            if (mp.size() == 1)
              ans++;
            if (mp.size() == 2)
              ans += 3;
            if (mp.size() == 3)
              ans += 6;
          }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
#define _GLIBCXX_DEBUG
#define INF 100000010
#define PI 3.14159265359

using namespace std;
const int64_t mod = 1000000007;
const int64_t tmpMod = 998244353;

int main() {

  int64_t N;
  cin >> N;
  vector<int64_t> A(N, 0);
  // for(int i=0; i<N; i++){cin>>A[i];}
  // vector<vector<int> > A(N,vector<int>(M));
  for (int i = 1; i < 100; i++) {
    for (int j = 1; j < 100; j++) {
      for (int k = 1; k < 100; k++) {
        if ((i * i) + (j * j) + k * k + i * j + j * k + k * i - 1 < N)
          A[(i * i) + (j * j) + k * k + i * j + j * k + k * i - 1]++;
      }
    }
  }
  // sort(A.begin(),A.end());
  // for (int i = 0; i < N; i++) { maximum = max(maximum , A[i]);}
  for (int i = 0; i < N; i++) {
    cout << A[i] << endl;
  }
}

Error: -11

Fixed submission:

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
#define _GLIBCXX_DEBUG
#define INF 100000010
#define PI 3.14159265359

using namespace std;
const int64_t mod = 1000000007;
const int64_t tmpMod = 998244353;

int main() {

  int64_t N;
  cin >> N;
  vector<int64_t> A(N, 0);
  // for(int i=0; i<N; i++){cin>>A[i];}
  // vector<vector<int> > A(N,vector<int>(M));
  for (int i = 1; i < 100; i++) {
    for (int j = 1; j < 100; j++) {
      for (int k = 1; k < 100; k++) {
        A[(i * i) + (j * j) + k * k + i * j + j * k + k * i - 1]++;
      }
    }
  }
  // sort(A.begin(),A.end());
  // for (int i = 0; i < N; i++) { maximum = max(maximum , A[i]);}
  for (int i = 0; i < N; i++) {
    cout << A[i] << endl;
  }
}