Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; i++)
#define pb push_back
#define in insert
#define test                                                                   \\
  ll t;                                                                        \\
  cin >> t;                                                                    \\
  while (t--)
#define bs binary_search
#define rep1(x, n) for (ll x = n - 1; x >= 0; x--)

#define SORT(x) sort(x.begin(), x.end())
#define ERASE(x) x.erase(unique(x.begin(), x.end()), x.end())
#define POSL(x, v) (lower_bound(x.begin(), x.end(), v) - x.begin())
#define POSU(x, v) (upper_bound(x.begin(), x.end(), v) - x.begin())
#define All(x) (x).begin(), (x).end()
#define rAll(x) (x).rbegin(), (x).rend()
#define db double
#define sc scanf
#define pf printf
const ll MAX = 1e8;
// ll d[MAX],h[MAX];
const double pi = 3.14159265358979323846;
const ll M = 2e18 + 7;
ll gcd(ll x, ll y) {
  if (x == 0)
    return y;
  else
    return gcd(y % x, x);
}
ll lcm(ll x, ll y) { return (x * y) / gcd(x, y); }

bool isPrime(ll n) {
  if (n <= 1)
    return false;
  if (n <= 3)
    return true;
  if (n % 2 == 0 || n % 3 == 0)
    return false;

  for (ll i = 5; i * i <= n; i = i + 6) {
    if (n % i == 0 || n % (i + 2) == 0) {
      return false;
    }
  }
  return true;
}
bool pdrome(string s) {
  ll n = s.length();
  for (ll i = 0; i < n / 2; i++) {
    if (s[i] != s[n - i - 1]) {
      return false;
    }
  }
  return true;
}
ll mindig(ll x) {
  ll ans = 9;
  ll t = x;
  while (x) {
    ans = min(ans, x % 10);
    x /= 10;
  }
  x = t;
  return ans;
}
ll maxdig(ll x) {
  ll ans = 0;
  ll t = x;
  while (x) {
    ans = max(ans, x % 10);
    x /= 10;
  }
  x = t;
  return ans;
}
ll modpow(ll x, ll n, ll M) {
  if (n == 0)
    return 1 % M;
  ll u = modpow(x, n / 2, M);
  u = (u * u) % M;
  if (n % 2 == 1)
    u = (u * x) % M;
  return u;
}
ll sum(ll a) {
  ll result = 0;
  while (a > 0) {
    result += a % 10;
    a /= 10;
  }
  return result;
}
ll digits(long long n) { return floor(log10(n) + 1); }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n;
  cin >> n;
  vector<int> a(10050);

  for (int x = 1; x <= 105; x++) {
    for (int y = 1; y <= 105; y++) {
      for (int z = 1; z <= 105; z++) {
        int l = (x * x + y * y + z * z + x * y + y * z + z * x);
        if (l < 10050)
          a[l]++;
      }
    }
  }
  // int ans=0;

  // cout<<ans;
  for (int x = 1; x <= n; x++)
    cout << a[x] << "\\n";
  return 0;
}


Error: -11

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; i++)
#define pb push_back
#define in insert
#define test                                                                   \\
  ll t;                                                                        \\
  cin >> t;                                                                    \\
  while (t--)
#define bs binary_search
#define rep1(x, n) for (ll x = n - 1; x >= 0; x--)

#define SORT(x) sort(x.begin(), x.end())
#define ERASE(x) x.erase(unique(x.begin(), x.end()), x.end())
#define POSL(x, v) (lower_bound(x.begin(), x.end(), v) - x.begin())
#define POSU(x, v) (upper_bound(x.begin(), x.end(), v) - x.begin())
#define All(x) (x).begin(), (x).end()
#define rAll(x) (x).rbegin(), (x).rend()
#define db double
#define sc scanf
#define pf printf
const ll MAX = 1e8;
// ll d[MAX],h[MAX];
const double pi = 3.14159265358979323846;
const ll M = 2e18 + 7;
ll gcd(ll x, ll y) {
  if (x == 0)
    return y;
  else
    return gcd(y % x, x);
}
ll lcm(ll x, ll y) { return (x * y) / gcd(x, y); }

bool isPrime(ll n) {
  if (n <= 1)
    return false;
  if (n <= 3)
    return true;
  if (n % 2 == 0 || n % 3 == 0)
    return false;

  for (ll i = 5; i * i <= n; i = i + 6) {
    if (n % i == 0 || n % (i + 2) == 0) {
      return false;
    }
  }
  return true;
}
bool pdrome(string s) {
  ll n = s.length();
  for (ll i = 0; i < n / 2; i++) {
    if (s[i] != s[n - i - 1]) {
      return false;
    }
  }
  return true;
}
ll mindig(ll x) {
  ll ans = 9;
  ll t = x;
  while (x) {
    ans = min(ans, x % 10);
    x /= 10;
  }
  x = t;
  return ans;
}
ll maxdig(ll x) {
  ll ans = 0;
  ll t = x;
  while (x) {
    ans = max(ans, x % 10);
    x /= 10;
  }
  x = t;
  return ans;
}
ll modpow(ll x, ll n, ll M) {
  if (n == 0)
    return 1 % M;
  ll u = modpow(x, n / 2, M);
  u = (u * u) % M;
  if (n % 2 == 1)
    u = (u * x) % M;
  return u;
}
ll sum(ll a) {
  ll result = 0;
  while (a > 0) {
    result += a % 10;
    a /= 10;
  }
  return result;
}
ll digits(long long n) { return floor(log10(n) + 1); }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n;
  cin >> n;
  int a[10005] = {0};

  for (int x = 1; x <= 105; x++) {
    for (int y = 1; y <= 105; y++) {
      for (int z = 1; z <= 105; z++) {
        int l = (x * x + y * y + z * z + x * y + y * z + z * x);
        a[l]++;
      }
    }
  }
  // int ans=0;

  // cout<<ans;
  for (int x = 1; x <= n; x++)
    cout << a[x] << "\\n";
  return 0;
}