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 < (n); i++)
using ll = long long;
using namespace std;

int main(void) {
  int N;
  cin >> N;
  for (int n = 1; n <= N; n++) {
    int ans = 0;
    int x;
    // int max_i = floor(sqrt(n/6.));
    for (int i = 1; i <= n; i++) {
      x = 6 * i * i;
      if (x > n)
        break;
      for (int j = i; j <= n; j++) {
        x = i * i + 2 * i * j + 3 * j * j;
        if (x > n)
          break;
        for (int k = j; k <= n; k++) {
          x = i * i + j * j + k * k + i * j + j * k + k * i;
          if (x < n)
            continue;
          if (x > n)
            break;

          if (i == j and j == k)
            ans += 1;
          if (i == j and j != k)
            ans += 3;
          if (i != j and j == k)
            ans += 3;
          if (i != j and j != k)
            ans += 6;
        }
      }
    }
    cout << ans << endl;
  }

  return 0;
}


Error: TLE

Fixed submission:

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

int main(void) {
  int N;
  cin >> N;
  for (int n = 1; n <= N; n++) {
    int ans = 0;
    for (int i = 1; i < n; i++) {
      for (int j = i; j < n; j++) {
        for (int k = j; k < n; k++) {
          int x = i * i + j * j + k * k + i * j + j * k + k * i;
          if (x != n)
            continue;

          if (i == j and j == k)
            ans += 1;
          if (i == j and j != k)
            ans += 3;
          if (i != j and j == k)
            ans += 3;
          if (i != j and j != k)
            ans += 6;
        }
      }
    }
    cout << ans << endl;
  }

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

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
using pis = pair<int, string>;
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007LL

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

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


Error: TLE

Fixed submission:

// #define _GLIBCXX_DEBUG //提出時に消す
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
using pis = pair<int, string>;
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007LL

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

  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++;
        }
      }
    }
    cout << ans << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> v(n + 1, 0);

  for (int i = 1; i * i <= n; i++) {

    for (int j = 1; j * j <= n; j++) {
      for (int l = 1; l * l <= n; l++) {

        long long sq = i + j + l;
        sq *= sq;
        int val = sq - i * j - j * l - i * l;
        if (val <= n)
          v[val]++;

        // cout<<val<<endl;
      }
    }
  }

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

  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int k = 0;
  int cnt = 0;
  for (int k = 1; k <= n; k++) {
    cnt = 0;

    for (int i = 1; i * i <= n; i++) {

      if (k <= 5)
        break;
      for (int j = 1; j * j <= n; j++) {
        for (int l = 1; l * l <= n; l++) {

          int sq = i + j + l;
          sq *= sq;
          int val = sq - i * j - j * l - i * l;
          // cout<<val<<endl;
          if (val == k)
            cnt++;
        }
      }
    }
    cout << cnt << endl;
  }

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

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1 << 30) - 1)
#define LINF (1LL << 60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

int ans[200010];

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

  for (int x = 1; x < 110; x++) {
    for (int y = 1; y < 110; y++) {
      for (int z = 1; z < 110; z++) {
        int tmp = x * x + y * y + z * z + x * y + y * z + z * x;
        ans[tmp]++;
      }
    }
  }

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

  return 0;
}


Error: -11

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1 << 30) - 1)
#define LINF (1LL << 60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

ll ans[200010];

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

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

  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 <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <unordered_set>
#include <valarray>
#include <vector>

#include <utility>

#include <deque>
#include <queue>

using namespace std;
long long a[10001];
int main() {
  long long n;
  cin >> n;
  long long x, y, z;
  long long counter;
  set<long long> numbers;
  for (int i = 1; i <= n; i++) {

    numbers.insert(i);
  }

  for (x = 1; x <= 98; x++) {

    for (y = 1; y <= 98; y++) {
      for (z = 1; z <= 98; z++) {
        long long c = (x * x) + (y * y) + (z * z) + (x * y) + (z * x) + (z * y);

        auto it = numbers.find(c);
        if (it != numbers.end()) {
          a[c]++;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << a[i] << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <unordered_set>
#include <valarray>
#include <vector>

#include <utility>

#include <deque>
#include <queue>

using namespace std;
long long a[10001];
int main() {
  long long n;
  cin >> n;
  long long x, y, z;
  long long counter;
  set<long long> numbers;
  for (int i = 1; i <= n; i++) {

    numbers.insert(i);
  }

  for (x = 1; x <= n; x++) {
    counter = 0;
    for (y = 1; y <= 98; y++) {
      for (z = 1; z <= 98; z++) {
        long long c = (x * x) + (y * y) + (z * z) + (x * y) + (z * x) + (z * y);

        auto it = numbers.find(c);
        if (it != numbers.end()) {
          a[c]++;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << a[i] << endl;
  }

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

//
// AISing 2020
// C
//

#include <algorithm>
#include <cassert>
#include <cmath>
#include <ctime>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;

const double PI = 3.14159265358979323846;

ll gcd(ll x, ll y) { return (x % y) ? gcd(y, x % y) : y; } // 最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }           // 最小公倍数

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

  map<int, int> ans;
  int nn = sqrt(n) + 10;
  FOR(x, 1, nn) {
    FOR(y, 1, nn) {
      FOR(z, 1, nn) { ans[x * x + y * y + z * z + x * y + y * z + z * x]++; }
    }
  }
  FOR(i, 1, n) {
    // cout << i << " ";
    cout << ans[i] << endl;
  }
  return 0;
}


Error: WA

Fixed submission:

//
// AISing 2020
// C
//

#include <algorithm>
#include <cassert>
#include <cmath>
#include <ctime>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;

const double PI = 3.14159265358979323846;

ll gcd(ll x, ll y) { return (x % y) ? gcd(y, x % y) : y; } // 最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }           // 最小公倍数

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

  vector<int> ans(10000, 0);
  int nn = sqrt(n);
  FOR(x, 1, nn) {
    FOR(y, 1, nn) {
      FOR(z, 1, nn) { ans[x * x + y * y + z * z + x * y + y * z + z * x]++; }
    }
  }
  REP(i, n) { cout << ans[i] << endl; }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

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

  vector<int> v(N + 1, 0);
  for (int x = 1; x <= 101; x++) {
    for (int y = 1; y <= 101; y++) {
      for (int z = 1; z <= 101; z++) {
        int num = x * x + y * y + z * z + x * y + y * z + z * x;
        if (num <= N) {
          v.at(num)++;
        }
      }
    }
  }

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

  return 0;
}

Error: TLE

Fixed submission:

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

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

  for (int n = 1; n <= N; n++) {
    int ans = 0;
    for (int x = 1; x <= (N / 2); x++) {
      for (int y = 1; y <= (N / 2); y++) {
        for (int z = 1; z <= (N / 2); z++) {
          int num = x * x + y * y + z * z + x * y + y * z + z * x;
          if (num == n) {
            ans++;
          }
        }
      }
    }
    cout << ans << endl;
  }

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

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

#define int long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define allrev(x) (x).rbegin(), (x).end()
#define pb push_back
#define pf push_front
#define fori(i, a, n) for (int i = a; i < n; ++i)
#define MAX(x) (*max_element(all(x)))
#define MIN(x) (*min_element(all(x)))
#define sortarr(a, n) sort(a, a + n)
#define sortvec(V) sort(all(V))

typedef vector<int> V;
typedef pair<int, int> pairi;
typedef set<int> seti;
typedef deque<int> deqi;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 8;
const double pi = 3.14159265359;
const int N = 1e5;
void solve() {
  int n;
  cin >> n;
  map<int, int> mp;
  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      for (int k = 1; k <= 100; k++) {
        int ans = (i * i + j * j + k * k + i * j + i * k + j * k);
        mp[ans]++;
      }
    }
  }
  for (int i = 1; i <= n; i++)
    cout << mp[i] << "\\n";
}

signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  solve();
  cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \\n ";
}

Error: TLE

Fixed submission:

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

#define int long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define allrev(x) (x).rbegin(), (x).end()
#define pb push_back
#define pf push_front
#define fori(i, a, n) for (int i = a; i < n; ++i)
#define MAX(x) (*max_element(all(x)))
#define MIN(x) (*min_element(all(x)))
#define sortarr(a, n) sort(a, a + n)
#define sortvec(V) sort(all(V))

typedef vector<int> V;
typedef pair<int, int> pairi;
typedef set<int> seti;
typedef deque<int> deqi;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 8;
const double pi = 3.14159265359;
int fun(int x) {
  int ans = 0;
  for (int i = 1; i <= x; i++) {
    for (int j = 1; j <= x; j++) {
      for (int k = 1; k <= x; k++)
        if (i * i + j * j + k * k + i * j + i * k + j * k == x)
          ans++;
    }
  }
  return ans;
}
void solve() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cout << fun(i) << endl;
  }
}

signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  solve();
  cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \\n ";
}
Problem p02608 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[60005] = {0};
int main() {
  ios ::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> 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 x = i * i + j * j + k * k + i * j + i * k + j * k;
        a[x]++;
      }
    }
  }

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


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[50005] = {0};
int main() {
  ios ::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> 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 x = i * i + j * j + k * k + i * j + i * k + j * k;
        a[x]++;
      }
    }
  }

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

#include <iostream>
using namespace std;
int main(void) {

  int n, x, y, z;
  int b, i;
  int ans = 0;

  cin >> n;
  int a[n + 1];
  for (i = 0; i <= n + 1; i++)
    a[i] = 0;

  for (x = 1; x * x <= n; x++) {
    for (y = 1; y * y <= n; y++) {
      for (z = 1; z * z <= n; z++) {
        b = x * (x + y) + y * (y + z) + z * (z + x);
        if (n >= b)
          a[b]++;
      }
    }
  }

  for (i = 1; i <= n; i++)
    cout << a[i] << endl;

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main(void) {

  int n, x, y, z;
  int a, b;
  int ans = 0;

  cin >> n;

  for (a = 1; a <= n; a++) {
    for (x = 1; x * x <= a; x++) {
      for (y = 1; y * y <= a; y++) {
        if (x * x + y * y > a)
          break;
        for (z = 1; z * z <= a; z++) {

          if (x * x + y * y + z * z > a)
            break;

          if (a == x * (x + y) + y * (y + z) + z * (z + x))
            ans++;
        }
      }
    }

    cout << ans << endl;
    ans = 0;
  }

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

#include <cmath>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  long long n;
  std::cin >> n;

  vector<long long> answers(n + 1, 0);

  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        long long val =
            pow(x, 2) + pow(y, 2) + pow(z, 2) + x * y + y * z + z * x;
        if (n < val)
          continue;
        answers[val] += 1;
      }
    }
  }

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

  return 0;
}


Error: -11

Fixed submission:

#include <cmath>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  long long n;
  std::cin >> n;

  vector<long long> answers(n + 1, 0);

  for (int x = 1; x <= 100; x++) {
    for (int y = 1; y <= 100; y++) {
      for (int z = 1; z <= 100; z++) {
        long long val =
            pow(x, 2) + pow(y, 2) + pow(z, 2) + x * y + y * z + z * x;
        answers[val] += 1;
      }
    }
  }

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

  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 <iostream>  // cout, endl, cin
#include <map>       // map
#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

using namespace std;

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

  int N_half = 100;

  map<int, int> score;

  for (int i = 1; i < N_half; i++) {
    for (int j = 1; j < N_half; j++) {
      for (int k = 1; k < N_half; k++) {
        int ans = i * i + j * j + k * k + i * j + j * k + k * i;
        if (ans <= N) {
          if (score.count(ans)) {
            score.at(ans)++;
          } else {
            score[ans] = 1;
          }
        }
      }
    }
  }

  for (int i = 1; i <= N; i++) {
    if (score.count(i)) {
      cout << score.at(i) << "\\n";
    } else {
      cout << 0 << "\\n";
    }
  }
}


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 <iostream>  // cout, endl, cin
#include <map>       // map
#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

using namespace std;

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

  map<int, int> score;

  for (int i = 1; i < N; i++) {
    for (int j = 1; j < N; j++) {
      for (int k = 1; k < N; k++) {
        int ans = i * i + j * j + k * k + i * j + j * k + k * i;
        if (ans <= N) {
          if (score.count(ans)) {
            score.at(ans)++;
          } else {
            score[ans] = 1;
          }
        }
      }
    }
  }

  for (int i = 1; i <= N; i++) {
    if (score.count(i)) {
      cout << score.at(i) << "\\n";
    } else {
      cout << 0 << "\\n";
    }
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int f(int n) {
  int ans = 0;
  for (int x = 1; x * x <= n; x++) {
    if (x * x > n)
      continue;
    for (int y = 1; x * x + y * y + x * y <= n; y++) {
      if (x * x + y * y > n)
        break;
      for (int z = 1; x * x + y * y + z * z + x * y + y * z + z * x <= n; z++) {
        if (x * x + y * y + z * z + x * y + y * z + z * x == n)
          ans++;
      }
    }
  }
  return ans;
}

signed main() {
  int n;
  int ans = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    printf("%d\\n", f(i));
  }
  return 0;
}

Error: TLE

Fixed submission:

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

int f(int n) {
  int ans = 0;
  repa(x, 1, n) {
    if (x * x > n)
      continue;
    repa(y, 1, n) {
      if (x * x + y * y > n)
        break;
      repa(z, 1, n) {
        if (x * x + y * y + z * z + x * y + y * z + z * x == n)
          ans++;
      }
    }
  }
  return ans;
}

signed main() {
  int n;
  int ans = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    printf("%d\\n", f(i));
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

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

  int ans = 0, f;
  FOR(i, 1, N) {
    bool flag = false;
    FOR(x, 1, 100) {
      FOR(y, 1, 100) {
        FOR(z, 1, 100) {
          f = x * x + y * y + z * z + x * y + y * z + x * z;
          if (f == i) {
            ans++;
          }
          if (f > i)
            break;
        }
        f = x * x + y * y + 1 + x + y + x * y;
        if (f > i)
          break;
      }
      f = x * x + 1 + 1 + x + x + 1;
      if (f > i)
        break;
    }
    cout << ans << endl;
    ans = 0;
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

int ans = 0;

void solv(int a, int b, int c, int n) {
  int f = pow(a, 2) + pow(b, 2) + pow(c, 2) + a * b + a * c + b * c;
  int na = a + 1, nb = b + 1, nc = c + 1;
  // cout << a << " " << b << " " << c << " " << f << " ";
  if (f > n)
    return;
  if (f == n) {
    set<int> st{a, b, c};
    if (st.size() == 1)
      ans++;
    else if (st.size() == 2)
      ans += 3;
    else if (st.size() == 3)
      ans += 6;
    return;
  }
  if (f < n) {
    solv(na, b, c, n);
    solv(na, nb, c, n);
    solv(na, nb, nc, n);
  }
  return;
}

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

  FOR(i, 1, N) {
    solv(1, 1, 1, i);
    cout << ans << endl;
    ans = 0;
  }
}