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

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define pi 3.14159265359
using namespace std;
const long long INF = 1e9 + 7;
const string alp = "abcdefghijklmnopqrstuvwxyz"; // 26
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
// const ll MOD=998244353LL;
// const ll MOD=1777777777LL;

ll triplets(ll x) {
  ll count = 0;
  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      for (int k = 1; k <= 100; k++) {
        ll v = i * i + j * j + k * k + i * j + j * k + k * i;
        if (v == x) {
          count++;
        }
      }
    }
  }
  return count;
}

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

  vl ans(10010, 0);
  cin >> N;
  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      for (int k = 1; k <= 100; k++) {
        int v = i * i + j * j + k * k + i * j + j * k + k * i;
        if (v <= 10000)
          ans[v]++;
      }
    }
  }
  for (int i = 1; i <= N; i++) {
    cout << ans[i] << endl;
  }
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define pi 3.14159265359
using namespace std;
const long long INF = 1e9 + 7;
const string alp = "abcdefghijklmnopqrstuvwxyz"; // 26
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
// const ll MOD=998244353LL;
// const ll MOD=1777777777LL;

ll triplets(ll x) {
  ll count = 0;
  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 == x) {
          count++;
        }
      }
    }
  }
  return count;
}

int main() {
  ll N;
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cout << triplets(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)
using namespace std;
using ll = long long;
using P = pair<string, int>;
const int INF = 1000000007;

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

  for (int i = 1; i <= n; i++) {
    int cnt = 0;
    for (int x = 1; x <= sqrt(i); x++) {
      for (int y = x; y <= sqrt(i); y++) {
        for (int z = y; z <= sqrt(i); z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == i) {
            if (x == y && y == z) {
              cnt += 1;
            }

            else if (x == y || y == z || z == x) {
              cnt += 3;
            }

            else {
              cnt += 6;
            }
          }
        }
      }
    }
    cout << cnt << endl;
  }
}


Error: TLE

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<string, int>;
const int INF = 1000000007;

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

  for (int i = 1; i <= n; i++) {
    int cnt = 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)
            cnt++;
        }
      }
    }
    cout << cnt << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cmath>
#include <iostream>
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 c = 0;
    for (int x = 1; x <= sqrt(i); x++) {
      for (int y = 1; y <= sqrt(i); y++) {
        // cout << (y + x) * (y + x) - 4 * (-i + x * x + y * y + x * y) << "\\n";
        int tmp = pow(x + y, 2) - 4 * (pow(x, 2) + pow(y, 2) + x * y - i);
        if (tmp == 0) {
          int z = (-1 * (x + y) + sqrt(tmp)) / 2;
          if (z >= 1 &&
              pow(x, 2) + pow(y, 2) + pow(z, 2) + x * y + y * z + z * x == i) {
            c++;
          }
        } else if (tmp > 0) {
          int z = (-1 * (x + y) + sqrt(tmp)) / 2;
          if (z >= 1 &&
              pow(x, 2) + pow(y, 2) + pow(z, 2) + x * y + y * z + z * x == i) {
            c++;
          }
          z = (-1 * (x + y) - sqrt(tmp)) / 2;
          if (z >= 1 &&
              pow(x, 2) + pow(y, 2) + pow(z, 2) + x * y + y * z + z * x == i) {
            c++;
          }
        }
      }
    }
    cout << c << " \\n";
  }
}

Error: TLE

Fixed submission:

#include <cmath>
#include <iostream>
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 c = 0;
    for (int x = 1; x <= i; x++) {
      for (int y = 1; y <= i; y++) {
        // cout << (y + x) * (y + x) - 4 * (-i + x * x + y * y + x * y) << "\\n";
        int tmp = pow(x + y, 2) - 4 * (pow(x, 2) + pow(y, 2) + x * y - i);
        if (tmp == 0) {
          int z = (-1 * (x + y) + sqrt(tmp)) / 2;
          if (z >= 1 &&
              pow(x, 2) + pow(y, 2) + pow(z, 2) + x * y + y * z + z * x == i) {
            c++;
          }
        } else if (tmp > 0) {
          int z = (-1 * (x + y) + sqrt(tmp)) / 2;
          if (z >= 1 &&
              pow(x, 2) + pow(y, 2) + pow(z, 2) + x * y + y * z + z * x == i) {
            c++;
          }
          z = (-1 * (x + y) - sqrt(tmp)) / 2;
          if (z >= 1 &&
              pow(x, 2) + pow(y, 2) + pow(z, 2) + x * y + y * z + z * x == i) {
            c++;
          }
        }
      }
    }
    cout << c << " \\n";
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
using namespace std;
typedef long long ll;
#define MODSIZE 1000000007
// priority_queue<int, vector<int>, greater<int> > PQ; // 昇順PQ
priority_queue<ll> PQ;

ll sum[1000006];
int main() {
  int n;

  scanf("%d", &n);

  int i, j, k;
  int s;
  int t = 0;
  int ans[10006] = {0};

  for (i = 1; i <= 100; i++) {
    for (j = 1; j <= 100; j++) {
      for (k = 1; k <= 100; k++) {
        s = i * i + j * j + k * k + i * j + i * k + j * k;
        if (s > n)
          break;
        sum[t++] = s;
      }
    }
  }

  for (i = 0; i < t; i++) {
    ans[sum[i]]++;
  }

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

  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
using namespace std;
typedef long long ll;
#define MODSIZE 1000000007
// priority_queue<int, vector<int>, greater<int> > PQ; // 昇順PQ
priority_queue<ll> PQ;

int main() {
  int n;

  scanf("%d", &n);

  int i, j, k, l;
  int ii, jj, kk;
  int ij, jk, ik;
  int ans[10006] = {0};
  for (l = 1; l <= n; l++) {
    for (i = 1; i <= sqrt(l); i++) {
      ii = i * i;
      for (j = 1; j <= sqrt(l - ii); j++) {
        jj = j * j;
        ij = i * j;
        for (k = 1; k <= sqrt(l - ii - jj - ij); k++) {
          kk = k * k;
          if (ii + jj + kk + i * j + j * k + i * k == l)
            ans[l]++;
        }
      }
    }
  }

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

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

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (i = 1; i <= n; i++)
// 2D::rep(i,j)rep(j,j)cin>>bin[i][j];
// vector<int> a(n)
#define Graph vector<vector<int>>
#define A1 cout << "No" << endl
#define A2 cout << "Yes" << endl
#define A3 cout << ans <<
#define AA(i) cout << i << endl;
const int U = 2e5 + 5;
const ll MOD = 1000000007;
const int INF = 1001001001;

int main() {
  int N;
  cin >> N;
  int i, j, k;
  vector<int> a(N + 1);
  rep(i, 150) {
    rep(j, 150) {
      rep(k, 150) {
        int b = (i + j) * (i + j) + (j + k) * (j + k) + (k + i) * (k + i);
        if (b / 2 <= N)
          a[b / 2]++;
      }
    }
  }
  rep(i, N) AA(a[i]);
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (i = 1; i <= n; i++)
// 2D::rep(i,j)rep(j,j)cin>>bin[i][j];
// vector<int> a(n)
#define Graph vector<vector<int>>
#define A1 cout << "No" << endl
#define A2 cout << "Yes" << endl
#define A3 cout << ans <<
#define AA(i) cout << i << endl;
const int U = 2e5 + 5;
const ll MOD = 1000000007;
const int INF = 1001001001;

int main() {
  int N;
  cin >> N;
  int i, j, k;
  vector<int> a(N + 1);
  rep(i, N) {
    rep(j, N) {
      rep(k, N) {
        int b = (i + j) * (i + j) + (j + k) * (j + k) + (k + i) * (k + i);
        if (b / 2 <= N)
          a[b / 2]++;
      }
    }
  }
  rep(i, N) AA(a[i]);
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int f(int n) {
  int i, j, k, ret = 0;
  for (i = 1; (i + 1) * (i + 1) + 2 <= n; i++) {
    for (j = 1; (j + 1) * (j + 1) + 2 <= n; j++) {
      for (k = 1; (i * i + j * j + k * k + i * j + j * k + k * i) <= n; k++) {
        if ((i * i + j * j + k * k + i * j + j * k + k * i) == n)
          ret++;
      }
    }
  }
  return ret;
}
int main() {
  int N, i;
  cin >> N;
  for (i = 0; i < N; i++) {
    cout << f(i + 1) << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

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

#include <algorithm>
#include <bitset>
#include <iostream>
#include <limits.h>
#include <map>
#include <queue>
#include <sstream>
#include <stack>
#include <vector>
using namespace std;

int main() {
  int n;
  cin >> n;
  long long int cnt = 0;

  std::map<int, int> mp;
  // for(int i=0; i<n; i++){
  cnt = 0;
  // cout << "### " << i+1 << endl;
  for (int x = 1; x <= 101; x++) {
    // long long int x2 = x*x;
    // if(x2 > n) continue;
    for (int y = 1; y <= 101; y++) {
      // long long int y2 = y*y;
      // long long int xy = x*y;
      // long long int num = x2+y2+xy;
      // if(num+3 > n) continue;
      for (int z = 1; z <= 101; z++) {

        // long long int z2 = z*z;
        // long long int xz = x*z;
        // long long int yz = y*z;
        long long int num = x * x + y * y + z * z + x * y + x * z + y * z;
        mp[num]++;
        /*
        if(num == i+1){
            //cout << x << ", " << y << ", " << z << endl;
            //cout << num << ":" << num+z2+xz+yz << endl;
            cnt++;
        }
        */
      }
    }
  }
  // cout << cnt << endl;
  //}
  for (int i = 1; i <= n; i++) {
    cout << mp[i] << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <bitset>
#include <iostream>
#include <limits.h>
#include <map>
#include <queue>
#include <sstream>
#include <stack>
#include <vector>
using namespace std;

int main() {
  int n;
  cin >> n;
  long long int cnt = 0;

  for (int i = 0; i < n; i++) {
    cnt = 0;
    // cout << "### " << i+1 << endl;
    for (int x = 1; x <= 101; x++) {
      // long long int x2 = x*x;
      // if(x2 > n) continue;
      for (int y = 1; y <= 101; y++) {
        // long long int y2 = y*y;
        // long long int xy = x*y;
        // long long int num = x2+y2+xy;
        // if(num+3 > n) continue;
        for (int z = 1; z <= 101; z++) {

          // long long int z2 = z*z;
          // long long int xz = x*z;
          // long long int yz = y*z;
          long long int num = x * x + y * y + z * z + x * y + x * z + y * z;
          if (num == i + 1) {
            // cout << x << ", " << y << ", " << z << endl;
            // cout << num << ":" << num+z2+xz+yz << endl;
            cnt++;
          }
        }
      }
    }
    cout << cnt << endl;
  }

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

#include <bits/stdc++.h>

#define ll long long
#define rep(A, B, C) for (A = B; A < C; ++A)
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

/////////////////////////////////////////////////////

ll N;
ll A[202020];
ll i, j, k;

int main() {
  scanf("%lld", &N);
  rep(i, 1, 111) {
    rep(j, 1, 111) {
      rep(k, 1, 111) {
        ll a = i * i + j * j + k * k + i * j + j * k + k * i;
        if (a > 101010)
          continue;
        ++A[a];
      }
    }
  }
  rep(i, 0, N) { printf("%lld\\n", A[i + 1]); }
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>

#define ll long long
#define rep(A, B, C) for (A = B; A < C; ++A)
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

/////////////////////////////////////////////////////

ll N;
ll A[1111];
ll i, j, k;

int main() {
  scanf("%lld", &N);
  rep(i, 1, 50) {
    rep(j, 1, 50) {
      rep(k, 1, 50) {
        ll a = i * i + j * j + k * k + i * j + j * k + k * i;
        if (a > 1000)
          continue;
        ++A[a];
      }
    }
  }
  rep(i, 0, N) { printf("%lld\\n", A[i + 1]); }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 1; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  vector<int> v(n + 1);

  rep(i, 105) {
    rep(j, 105) {
      rep(k, 105) {
        int now = i * i + j * j + k * k + i * j + j * k + k * i;
        if (now <= n)
          v.at(now)++;
      }
    }
  }

  rep(i, n + 1) cout << v.at(i) << endl;
}


Error: WA

Fixed submission:

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 1; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  vector<int> v(n);

  rep(i, 105) {
    rep(j, 105) {
      rep(k, 105) {
        int now = i * i + j * j + k * k + i * j + j * k + k * i;
        if (now <= n)
          v.at(now)++;
      }
    }
  }

  rep(i, n) cout << v.at(i) << endl;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define ll long long
const ll mod = 1e9 + 7;
const int maxn = 10000;
using namespace std;
bool sortbysec(pair<ll, ll> &a, pair<ll, ll> &b) {
  return (a.second < b.second);
}

int main()
// int found; found=chaine.find(cara); if (found!=std::string::npos) how to
// verify if a caracter exists in a chaine
//  toupper(caractere) ==> return the majuscule of a caractere
// floor(x) Returns the largest integer smaller than x
// ceil(x) returns  Returns the smallest integer greater
/* #ifndef ONLINE_JUDGE
      freopen("input.txt","r",stdin);
    #endif */
{

  int nb = 10008;
  int v[nb + 1];
  for (int i = 1; i <= nb; i++)
    v[i] = 0;

  for (int x = 1; x <= sqrt(nb); x++) {
    for (int y = 1; y <= sqrt(nb); y++) {
      for (int z = 1; z <= sqrt(nb); z++) {
        int k = x * x + z * z + y * y + x * y + x * z + y * z;
        if (k <= nb)
          v[k]++;
      }
    }
  }

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


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define ll long long
const ll mod = 1e9 + 7;
const int maxn = 10000;
using namespace std;
bool sortbysec(pair<ll, ll> &a, pair<ll, ll> &b) {
  return (a.second < b.second);
}

int main()
// int found; found=chaine.find(cara); if (found!=std::string::npos) how to
// verify if a caracter exists in a chaine
//  toupper(caractere) ==> return the majuscule of a caractere
// floor(x) Returns the largest integer smaller than x
// ceil(x) returns  Returns the smallest integer greater
/* #ifndef ONLINE_JUDGE
      freopen("input.txt","r",stdin);
    #endif */
{

  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int nb = 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++) {
          if (x * x + z * z + y * y + x * y + x * z + y * z == i)
            nb++;
        }
      }
    }
    cout << nb << 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)
#define ll long long
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> ans(n + 5);

  int sn = sqrt(n);
  for (int x = 1; x < sn; x++) {
    for (int y = 1; y <= sn; y++) {
      for (int z = 1; z <= sn; z++) {
        ll tmp = x * x + y * y + z * z + x * y + y * z + z * x;
        if (tmp <= n)
          ans[tmp]++;
      }
    }
  }

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


Error: TLE

Fixed submission:

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

int main() {
  int n;
  cin >> n;
  vector<int> ans(n + 1);
  for (int i = 1; i <= n; i++) {
    int sn = sqrt(i);
    for (int x = 1; x < sn; x++) {
      for (int y = 1; y <= sn; y++) {
        if (x * x + y * y >= i)
          continue;
        for (int z = 1; z <= sn; z++) {
          if (x * x + y * y + z * z + x * y + y * z + z * x == i)
            ans[i]++;
        }
      }
    }
  }

  for (int i = 1; i <= n; i++)
    cout << ans[i] << endl;
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm> //ソート等に使用
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <string> //
#include <vector> //
#define _USE_MATH_DEFINES
#include <bitset>
#include <cmath>
#include <math.h>
#include <queue> //幅優先等のキュー
#include <stack>
#include <stdio.h>
#include <thread> ///////////////////
#include <tuple>

#define rep(i, m, n) for (int i = (m); i <= (n); i++)
#define mer(i, m, n) for (int i = (m); i >= (n); --i)

#define MOD 1000000007
// #define MOD 998244353
// #define MAX

using namespace std;

using ll = long long int;
using ld = long double;
using std::swap;

vector<int> v;
vector<long long int> vll;
// vector<vector<int>> vec(50, vector<int>(4, 0));
vector<vector<int>> vv;
vector<char> vc;
vector<string> vs;

int main() {
  int N;
  cin >> N;
  v.resize(10001);
  rep(x, 1, pow(10001, 0.5)) {
    rep(y, 1, pow(10001, 0.5)) {
      rep(z, 1, pow(10001, 0.5)) {
        int ans = x * x + y * y + z * z + x * y + y * z + z * x;
        if (ans <= 10000)
          ++v[ans];
      }
    }
  }
  rep(i, 1, N) cout << v[i] << '\\n';
  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm> //ソート等に使用
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <string> //
#include <vector> //
#define _USE_MATH_DEFINES
#include <bitset>
#include <cmath>
#include <math.h>
#include <queue> //幅優先等のキュー
#include <stack>
#include <stdio.h>
#include <thread> ///////////////////
#include <tuple>

#define rep(i, m, n) for (int i = (m); i <= (n); i++)
#define mer(i, m, n) for (int i = (m); i >= (n); --i)

#define MOD 1000000007
// #define MOD 998244353
// #define MAX

using namespace std;

using ll = long long int;
using ld = long double;
using std::swap;

vector<int> v;
vector<long long int> vll;
// vector<vector<int>> vec(50, vector<int>(4, 0));
vector<vector<int>> vv;
vector<char> vc;
vector<string> vs;

int main() {
  int N;
  cin >> N;
  rep(i, 1, N) {
    int ans = 0;
    rep(x, 1, pow(N, 0.5)) {
      rep(y, 1, pow(N, 0.5)) {
        double z =
            (-(x + y) + pow(-(3 * (x * x + y * y) + 2 * x * y) + 4 * i, 0.5)) /
            2.0;
        if (floor(z) == z && z > 0)
          ++ans;
      }
    }
    cout << ans << '\\n';
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

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

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, ans[1001] = {0}, i, j, k;
  cin >> n;
  for (i = 1; i <= 500; i++) {
    for (j = 1; j <= 500; j++) {
      for (k = 1; k <= 500; k++) {
        long long tmp;
        tmp = i * i + j * j + k * k + i * j + j * k + k * i;
        if (tmp <= 1000)
          ans[tmp]++;
      }
    }
  }
  for (i = 1; i <= n; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define int int64_t
signed main() {
  int n, ans, date[100000] = {};
  int x = 1, y = 1, z = 1;
  cin >> n;
  for (int i = 1; i <= (int)sqrt(n); i++) {
    for (int j = 1; j <= (int)sqrt(n); j++) {
      for (int k = 1; k <= (int)sqrt(n); k++) {
        date[i * i + j * j + k * k + (i * j) + (i * k) + (j * k)]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << date[i] << "\\n";
  }
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define int int64_t
signed main() {
  int n, ans, date[10000] = {};
  int x = 1, y = 1, z = 1;
  cin >> n;
  for (int i = 1; i <= (int)sqrt(n); i++) {
    for (int j = 1; j <= (int)sqrt(n); j++) {
      for (int k = 1; k <= (int)sqrt(n); k++) {
        date[i * i + j * j + k * k + (i * j) + (i * k) + (j * k)]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << date[i] << "\\n";
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

// Copyright 2020 yaito3014
#include <iostream>
#include <set>
#include <vector>

int main() {
  int N;
  std::cin >> N;
  std::vector<int> ans(N, 0);
  using ll = long long;
  auto f = [](ll x, ll y, ll z) {
    return x * x + y * y + z * z + x * y + y * z + z * x;
  };
  for (ll x = 1; x <= N; ++x)
    for (ll y = 1; y <= x && f(x, y, 1) <= N; ++y)
      for (ll z = 1; z <= y; ++z) {
        ll n = f(x, y, z);
        if (n > N)
          continue;
        int k = std::set<long long>{x, y, z}.size();
        ans[n - 1] += k == 3 ? 6 : k == 2 ? 3 : 1;
      }
  for (const auto &e : ans)
    std::cout << e << '\\n';
}


Error: TLE

Fixed submission:

// Copyright 2020 yaito3014
#include <iostream>
#include <set>
#include <vector>

int main() {
  int N;
  std::cin >> N;
  std::vector<int> ans(N, 0);
  for (int x = 1; x <= N; ++x)
    for (int y = 1; y <= x; ++y)
      for (int z = 1; z <= y; ++z) {
        int n = x * x + y * y + z * z + x * y + y * z + z * x;
        int k = std::set<int>{x, y, z}.size();
        if (n <= N)
          ans[n - 1] += k == 3 ? 6 : k == 2 ? 3 : 1;
      }
end:;
  for (const auto &e : ans)
    std::cout << e << '\\n';
}