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

#include <bits/stdc++.h>

#define ll long long
#define dd double
#define scl(n) scanf("%lld", &n)
#define scd(n) scanf("%lf", &n)
#define ptl(n) printf("%lld", n)
#define ptd(n) printf("%lf", n)
#define nline printf("\\n")
#define vld vector<ll>
#define vbd vector<bool>
#define eb emplace_back
#define FOR(i, n) for (ll i = 0; i < n; i++)
#define FOR1(i, n) for (ll i = 1; i <= n; i++)
#define pi 2 * acos(0.0)

using namespace std;

int main() {
  ll n, l, i, j, k, eq[100000] = {0}, cnt = 0;
  scl(n);
  for (i = 1; i * i + 2 * i + 3 <= n; i++) {
    for (j = 1; j * j + 2 * j + 3 <= n; j++) {
      for (k = 1; k * k + 2 * k + 3 <= n; k++) {
        eq[i * i + j * j + k * k + i * j + j * k + k * i]++;
      }
    }
  }
  FOR1(i, n) {
    ptl(eq[i]);
    nline;
  }
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>

#define ll long long
#define dd double
#define scl(n) scanf("%lld", &n)
#define scd(n) scanf("%lf", &n)
#define ptl(n) printf("%lld", n)
#define ptd(n) printf("%lf", n)
#define nline printf("\\n")
#define vld vector<ll>
#define vbd vector<bool>
#define eb emplace_back
#define FOR(i, n) for (ll i = 0; i < n; i++)
#define FOR1(i, n) for (ll i = 1; i <= n; i++)
#define pi 2 * acos(0.0)

using namespace std;

int main() {
  ll n, l, i, j, k, eq[10004] = {0}, cnt = 0;
  scl(n);
  for (i = 1; i * i + 2 * i + 3 <= n; i++) {
    for (j = 1; j * j + 2 * j + 3 <= n; j++) {
      for (k = 1; k * k + 2 * k + 3 <= n; k++) {
        eq[i * i + j * j + k * k + i * j + j * k + k * i]++;
      }
    }
  }
  FOR1(i, n) {
    ptl(eq[i]);
    nline;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
const long long mod = 1e9 + 7;
//////////////////////////////////

int main() {
  int n;
  cin >> n;
  vector<int> ans(n + 1, 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++) {
        int s = x * x + y * y + z * z + x * y + y * z + z * x;
        if (s <= n) {
          ans[s]++;
        }
      }
    }
  }

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

  return 0;
}

// EOF

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
const long long mod = 1e9 + 7;
//////////////////////////////////

int f(int n) {
  int cnt = 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++) {
        if (x * x + y * y + z * z + x * y + y * z + z * x == n)
          cnt++;
      }
    }
  }
  return cnt;
}

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

  for (int i = 1; i <= n; i++) {
    cout << f(i) << endl;
  }

  return 0;
}

// EOF
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

using namespace std;
#define int long long
#define N 1666666
int a[N];
map<int, int> mp;
signed main() {
  for (int x = 1; x <= 200; x++)
    for (int y = x; y <= 200; y++)
      for (int z = y; z <= 200; z++) {
        set<int> s;
        s.insert(x);
        s.insert(y);
        s.insert(z);
        if (s.size() == 1)
          mp[x * x + y * y + z * z + x * y + y * z + z * x]++;
        else if (s.size() == 2)
          mp[x * x + y * y + z * z + x * y + y * z + z * x] += 3;
        else
          mp[x * x + y * y + z * z + x * y + y * z + z * x] += 6;
      }

  int n;
  cin >> n;
  for (int i = 1; i <= n; i++)
    cout << mp[i] << '\\n';
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;
#define int long long
#define N 1666666
int a[N];
map<int, int> mp;
signed main() {
  for (int x = 1; x <= 500; x++)
    for (int y = x; y <= 500; y++)
      for (int z = y; z <= 500; z++) {
        set<int> s;
        s.insert(x);
        s.insert(y);
        s.insert(z);
        if (s.size() == 1)
          mp[x * x + y * y + z * z + x * y + y * z + z * x]++;
        else if (s.size() == 2)
          mp[x * x + y * y + z * z + x * y + y * z + z * x] += 3;
        else
          mp[x * x + y * y + z * z + x * y + y * z + z * x] += 9;
      }

  int n;
  cin >> n;
  for (int i = 1; i <= n; i++)
    cout << mp[i] << '\\n';
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

/// in the name of ALLAH
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  int n;
  cin >> n;
  /// pre calculate
  int ar[10005];
  int mx = 10000;
  memset(ar, 0, sizeof(ar));
  for (int i = 1; i <= sqrt(n); i++) {
    for (int j = 1; j <= sqrt(n); j++) {
      for (int k = 1; k <= sqrt(n); k++) {
        ll p = i * i + j * j + k * k + i * j + j * k + k * i;
        if (p <= n)
          ar[p]++;
      }
    }
  }
  for (int i = 1; i <= n; i++)
    cout << ar[i] << endl;
}


Error: 0

Fixed submission:

/// in the name of ALLAH
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  int n;
  cin >> n;
  /// pre calculate
  int ar[10005];
  int mx = 10000;
  memset(ar, 0, sizeof(ar));
  for (int i = 1; i <= sqrt(n); i++) {
    for (int j = 1; j <= sqrt(n); j++) {
      for (int k = 1; k <= sqrt(n); k++) {
        ll p = i * i + j * j + k * k + i * j + j * k + k * i;
        ar[p]++;
      }
    }
  }
  for (int i = 1; i <= n; i++)
    cout << ar[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++)
typedef long long ll;

int main() {
  int n;
  cin >> n;
  vector<int> ans(10001, 0);

  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        int m = x * x + y * y + z * z + x * y + y * z + z * x;
        if (m <= n)
          ans.at(m)++;
      }
    }
  }

  for (int i = 1; i <= n; i++)
    cout << ans.at(i) << endl;
}

Error: 0

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;
  vector<int> ans(1001, 0);

  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        int m = x * x + y * y + z * z + x * y + y * z + z * x;
        if (m <= n)
          ans.at(m)++;
      }
    }
  }

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

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

#define mod 1e9 + 7;
#define INF 1e9 + 9;
#define ps(x, y) fixed << setprecision(y) << x
#define PI 3.14159265358979323846264338327950 L
typedef long long ll;
typedef unsigned long long ull;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  int c[10001];
  for (int i = 0; i <= 10000; i++)
    c[i] = 0;
  int n = 105, n1;
  cin >> n1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      for (int k = 1; k <= n; k++) {
        int cal = i * i + j * j + k * k + i * j + j * k + k * i;
        if (cal <= 10000) {
          c[cal]++;
        }
      }
    }
  }
  for (int i = 1; i <= n1; i++)
    cout << c[i] << endl;
  return 0;
}

Error: TLE

Fixed submission:

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

#define mod 1e9 + 7;
#define INF 1e9 + 9;
#define ps(x, y) fixed << setprecision(y) << x
#define PI 3.14159265358979323846264338327950 L
typedef long long ll;
typedef unsigned long long ull;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  int c[10001];
  for (int i = 0; i <= 10000; i++)
    c[i] = 0;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      for (int k = 1; k <= n; k++) {
        int cal = i * i + j * j + k * k + i * j + j * k + k * i;
        if (cal <= 10000) {
          c[cal]++;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++)
    cout << c[i] << endl;
  return 0;
}
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<int, int>;

int main() {
  int N;
  cin >> N;
  vector<int> ans(10050, 0);
  for (int x = 1; x < 105; x++) {
    for (int y = 1; y < 105; y++) {
      for (int z = 1; z < 105; z++) {
        int v = x * x + y * y + z * z + x * y + y * z + z * x;
        if (v < 10050) {
          ans[v]++;
        }
      }
    }
  }
  for (int i = 1; i <= N; i++) {
    cout << ans[i] << endl;
  }
}

Error: TLE

Fixed submission:

#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

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

#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll inf = 1000000007;

int main(void) {
  ll n;
  cin >> n;
  ll count = 0;
  for (int i = 1; i <= n; i++) {
    count = 0;
    for (int x = 1; x <= sqrt(2 * i) + 1; x++) {
      for (int y = 1; y <= sqrt(2 * i) + 1; y++) {
        if (i - (x * x + x * y + y * y) < 2) {
          continue;
        }
        for (int z = 1; z * z + x * z + y * z <= i - (x * x + y * y + x * y);
             z++) {
          if ((x + y) * (x + y) + (x + z) * (x + z) + (y + z) * (y + z) ==
              2 * i) {
            count++;
          }
        }
      }
    }
    cout << count << endl;
  }
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll inf = 1000000007;

int main(void) {
  ll n;
  cin >> n;
  ll count = 0;
  for (int i = 1; i <= n; i++) {
    count = 0;
    for (int x = 1; x <= sqrt(2 * i) + 1; x++) {
      for (int y = 1; y <= sqrt(2 * i) + 1; y++) {
        for (int z = 1; z <= sqrt(2 * i) + 1; z++) {
          if ((x + y) * (x + y) + (x + z) * (x + z) + (y + z) * (y + z) ==
              2 * i) {
            count++;
          }
        }
      }
    }
    cout << count << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int i, N, x, y, z, t;

  cin >> N;
  vector<int> a(N);
  // vector<int> b(M);
  // for (i = 1; i <= N; i++){
  for (i = 1; i <= N; i++) {
    a[i] = 0;
  }
  for (x = 1; x <= sqrt(N); x++) {
    for (y = 1; y <= sqrt(N); y++) {
      for (z = 1; z <= sqrt(N); z++) {
        t = pow(x, 2) + pow(y, 2) + pow(z, 2) + x * y + y * z + x * z;
        if (t <= N) {
          a[t] += 1;
        }
      }
    }
  }

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

  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int i, N, x, y, z, t;

  cin >> N;
  vector<int> a(N);
  // vector<int> b(M);
  // for (i = 1; i <= N; i++){
  for (i = 1; i <= N; i++) {
    a[i] = 0;
  }
  for (x = 1; x <= N; x++) {
    for (y = 1; y <= N; y++) {
      for (z = 1; z <= N; z++) {
        t = pow(x, 2) + pow(y, 2) + pow(z, 2) + x * y + y * z + x * z;
        if (t <= N) {
          a[t] += 1;
        }
      }
    }
  }

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

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


#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(), c.end()
#define mp(x, y) make_pair(x, y)
#define mem(a, val) memset(a, val, sizeof(a))
#define eb emplace_back
#define f first
#define s second

using namespace std;
ll lis[99999];
ll n;
bool dp[101][101][101];

ll f(ll i, ll j, ll k) {
  return (i * i + j * j + k * k + i * j + j * k + i * k);
}

int main() {
  std::ios::sync_with_stdio(false);

  cin >> n;
  memset(lis, 0, sizeof(lis));
  memset(dp, false, sizeof(dp));
  for (ll i = 1; i <= sqrt(n); i++) {
    for (ll j = 1; j <= sqrt(n); j++) {
      for (ll k = 1; k <= sqrt(n); k++) {
        ll num = f(i, j, k);
        if (dp[i][j][k] == false) {
          lis[num] = lis[num] + 1;
          dp[i][j][k] = true;
        }
      }
    }
  }

  for (ll i = 1; i <= n; i++) {

    cout << lis[i] << endl;
  }

  return 0;
}


Error: TLE

Fixed submission:


#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(), c.end()
#define mp(x, y) make_pair(x, y)
#define mem(a, val) memset(a, val, sizeof(a))
#define eb emplace_back
#define f first
#define s second

using namespace std;
ll lis[99999];
ll n;

ll f(ll i, ll j, ll k) {
  return (i * i + j * j + k * k + i * j + j * k + i * k);
}

void calc(ll i, ll j, ll k) {
  ll num = f(i, j, k);
  if (lis[num] == -1) {
    if (i == j && j == k) {
      lis[num] = 1;
    } else {
      lis[num] = 3;
    }
  }

  if (num < n) {
    calc(i + 1, j, k);
    calc(i, j + 1, k);
    calc(i, j, k + 1);
  } else {
    return;
  }
}
int main() {
  std::ios::sync_with_stdio(false);

  cin >> n;
  memset(lis, -1, sizeof(lis));
  calc(1, 1, 1);

  for (ll i = 1; i <= n; i++) {
    if (lis[i] == -1) {
      cout << 0 << endl;
    } else {
      cout << lis[i] << endl;
    }
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int x = 1; x < 100; x++) {
    for (int y = 1; y < 100; y++) {
      for (int z = 1; z < 100; z++) {
        int s = (x + y) * (x + y) + (y + z) * (y + z) + (z + x) * (z + x);
        if (s % 2 == 0 && s / 2 > 0 && s / 2 < n + 1) {
          a[s / 2 - 1]++;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << a[i - 1] << endl;
  }
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 1; i <= n; i++) {
    for (int x = 1; x < 100; x++) {
      for (int y = 1; y < 100; y++) {
        for (int z = 1; z < 100; z++) {
          if ((x + y) * (x + y) + (y + z) * (y + z) + (z + x) * (z + x) ==
              2 * i)
            a[i - 1]++;
        }
      }
    }
    cout << a[i - 1] << 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 MOD 1000000007;
using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        ll i = x * x + y * y + z * z;
        i += x * y + y * z + z * x;
        if (i > n)
          continue;
        a[i]++;
      }
    }
  }
  rep(i, n) cout << a[i + 1] << endl;
}


Error: TLE

Fixed submission:

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

int main() {
  int n, ans;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    ans = 0;
    rep(x, i) {
      if ((x + 1) * (x + 1) + 2 * x + 5 > i)
        x = i;
      rep(y, x + 1) {   // 0~i-1
        rep(z, y + 1) { // 0~i-1
          if (i == (x + 1) * (x + 1) + (y + 1) * (y + 1) + (z + 1) * (z + 1) +
                       (x + 1) * (y + 1) + (y + 1) * (z + 1) +
                       (x + 1) * (z + 1)) {
            if (x != y && y != z && z != x)
              ans += 6;
            else if (x == y && y == z)
              ans++;
            else
              ans += 3;
            x = i;
            y = i;
            z = i;
          }
        }
      }
    }
    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 < n; i++)
#define REP(i, n) for (int i = 1; i <= n; i++)
typedef long long ll;

int main() {
  ll n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    ll ans = 0;
    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 && z == y) {
              ans++;
            } else if (x != y && z != y && x != z) {
              ans += 6;
            } else {
              ans += 3;
            }
          }
        }
      }
    }
    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 < n; i++)
#define REP(i, n) for (int i = 1; i <= n; i++)
typedef long long ll;

int main() {
  ll n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    ll ans = 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 + 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;
int c[105][105];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      c[i][j] = (i + j) * (i + j);
    }
  }
  for (int i = 1; i <= n; i++) {
    int d = i << 1;
    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 (c[x][y] + c[x][z] + c[y][z] == d) {
            if (x == y && y == z)
              cnt++;
            else if (x != y && y != z && x != z)
              cnt += 6;
            else
              cnt += 3;
          }
        }
      }
    }
    cout << cnt << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int c[105][105];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      c[i][j] = (i + j) * (i + j);
    }
  }
  for (int i = 1; i <= n; i++) {
    int d = i << 1;
    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 (c[x][y] + c[x][z] + c[y][z] == d)
            cnt++;
        }
      }
    }
    cout << cnt << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define IOS                                                                    \\
  {                                                                            \\
    ios::sync_with_stdio(0);                                                   \\
    cin.tie(0);                                                                \\
    cout.tie(0);                                                               \\
  }
#define endl "\\n"
#define int long long int
#define f(i, a, b) for (int i = a; i < b; i++)
#define fb(i, a, b) for (int i = a; i >= b; i--)
#define pb push_back
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int, int>
#define LB lower_bound
#define UB upper_bound
#define fp(x, y) fixed << setprecision(y) << x
#define PI 3.141592653589793238462643383279502884
using namespace std;

const int M = (int)2e5 + 5;
const int mod = (int)1e9 + 7;

void solve() {
  int n;
  cin >> n;
  int cnt[10005] = {};
  f(i, 1, 101) {
    f(j, 1, 101) {
      f(k, 1, 101) {
        int x = (i + j) * (i + j) + (i + k) * (i + k) + (j + k) * (j + k);
        if (x < 20005 && x % 2 == 0)
          cnt[x / 2]++;
      }
    }
  }
  f(i, 1, n + 1) cout << cnt[i] << endl;
}

int32_t main() {
  IOS int t = 1;
  // cin>>t;
  f(tno, 1, t + 1) { solve(); }
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
#define IOS                                                                    \\
  {                                                                            \\
    ios::sync_with_stdio(0);                                                   \\
    cin.tie(0);                                                                \\
    cout.tie(0);                                                               \\
  }
#define endl "\\n"
#define int long long int
#define f(i, a, b) for (int i = a; i < b; i++)
#define fb(i, a, b) for (int i = a; i >= b; i--)
#define pb push_back
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int, int>
#define LB lower_bound
#define UB upper_bound
#define fp(x, y) fixed << setprecision(y) << x
#define PI 3.141592653589793238462643383279502884
using namespace std;

const int M = (int)2e5 + 5;
const int mod = (int)1e9 + 7;

void solve() {
  int n;
  cin >> n;
  int cnt[1005] = {};
  f(i, 1, 101) {
    f(j, 1, 101) {
      f(k, 1, 101) {
        int x = (i + j) * (i + j) + (i + k) * (i + k) + (j + k) * (j + k);
        if (x < 2005 && x % 2 == 0)
          cnt[x / 2]++;
      }
    }
  }
  f(i, 1, n + 1) cout << cnt[i] << endl;
}

int32_t main() {
  IOS int t = 1;
  // cin>>t;
  f(tno, 1, t + 1) { solve(); }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

#define ll long long
#define sz(x) (int)x.size()

using namespace std;

int fact(int n) {
  if (n == 1)
    return 1;
  if (n == 2)
    return 3;
  if (n == 3)
    return 6;
}

int f(int x) {
  int cnt = 0;
  for (int i = 1; i * i <= x; i++) {
    for (int j = 1; j * j <= x; j++) {
      int l = 1, r = 100, ans = -1;
      while (l <= r) {
        int k = (l + r) / 2;
        if (i * i + j * j + k * k + i * j + k * j + i * k == x)
          ans = k;
        if (i * i + j * j + k * k + i * j + k * j + i * k < x)
          l = k + 1;
        else
          r = k - 1;
      }
      if (ans != -1) {
        // cout<<x<<' '<<i<<' '<<j<<' '<<ans<<'\\n';
        cnt++;
      }
    }
  }
  return cnt;
}

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cout << f(i) << '\\n';
  }
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>

#define ll long long
#define sz(x) (int)x.size()

using namespace std;

int f(int x) {
  int cnt = 0;
  for (int i = 1; i * i <= x; i++) {
    for (int j = 1; j * j <= x; j++) {
      for (int k = 1; k * k <= x; k++) {
        if (i * i + j * j + k * k + i * j + k * j + i * k == x) {
          cnt++;
        }
      }
    }
  }
  return cnt;
}

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cout << f(i) << '\\n';
  }
}