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

#include <bits/stdc++.h>
using namespace std;
// T+N
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")
#define endl "\\n"
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template <class T, class T2> inline bool chkmax(T &x, const T2 &y) {
  return x < y ? x = y, 1 : 0;
}
template <class T, class T2> inline bool chkmin(T &x, const T2 &y) {
  return x > y ? x = y, 1 : 0;
}
const ll mod = 1e9 + 7;
template <class T> inline void fix(T &x) {
  if (x >= mod | x <= -mod) {
    x %= mod;
  }
  if (x < 0) {
    x += mod;
  }
}
#define out(x) cout << __LINE__ << ": " << (#x) << " = " << (x) << endl

const int MAX_N = 101;
ll cnt[MAX_N * MAX_N];

signed main() {
  // ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  int n;
  cin >> n;
  for (ll x = 1; x <= MAX_N; x++) {
    for (ll y = 1; y <= MAX_N; y++) {
      for (ll z = 1; z <= MAX_N; z++) {
        ll now = x * x + y * y + z * z + x * y + z * x + y * z;
        if (now <= n) {
          cnt[now]++;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << cnt[i] << endl;
  }
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
// T+N
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")
#define endl "\\n"
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template <class T, class T2> inline bool chkmax(T &x, const T2 &y) {
  return x < y ? x = y, 1 : 0;
}
template <class T, class T2> inline bool chkmin(T &x, const T2 &y) {
  return x > y ? x = y, 1 : 0;
}
const ll mod = 1e9 + 7;
template <class T> inline void fix(T &x) {
  if (x >= mod | x <= -mod) {
    x %= mod;
  }
  if (x < 0) {
    x += mod;
  }
}
#define out(x) cout << __LINE__ << ": " << (#x) << " = " << (x) << endl

const int MAX_N = 101;
ll cnt[MAX_N];

signed main() {
  // ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  int n;
  cin >> n;
  for (ll x = 1; x <= MAX_N; x++) {
    for (ll y = 1; y <= MAX_N; y++) {
      for (ll z = 1; z <= MAX_N; z++) {
        ll now = x * x + y * y + z * z + x * y + z * x + y * z;
        if (now <= n) {
          cnt[now]++;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << cnt[i] << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vi = vector<int>;
#define _GLIBCXX_DEBUG
#define IO_STREAM                                                              \\
  cin.tie(0);                                                                  \\
  ios::sync_with_stdio(false)
#define all(x) x.begin(), x.end()
#define rep(i, sta, end) for (int i = sta; i < end; ++i)
#define lcm(a, b) (a) / __gcd((a), (b)) * (b)
#define pb push_back
const ll INF = 1000000000000000;
const ll MOD = 1000000007;
const double PI = acos(-1);
//||
#define DBG(a, b, c, d) // cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<endl
// DBG("","","","");

int main() {
  IO_STREAM;
  int N;
  cin >> N;
  vi ans(10000);
  int x, y, z;
  int x2, y2, z2;
  rep(j, 1, 101) {
    x = j;
    x2 = x * x;
    //		if((x2+y2)>N) break;
    rep(k, 1, 101) {
      y = k;
      y2 = y * y;
      //			if((x2+y2)>N) break;
      rep(p, 1, 101) {
        int calc;
        z = p;
        z2 = z * z;
        //				if((x2+y2+z2)>N) break;
        calc = x2 + y2 + z2 + x * y + y * z + z * x;
        if (calc <= 10000)
          ans[calc]++;
      }
    }
  }
  rep(i, 1, N + 1) { cout << ans[i] << endl; }
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vi = vector<int>;
#define _GLIBCXX_DEBUG
#define IO_STREAM                                                              \\
  cin.tie(0);                                                                  \\
  ios::sync_with_stdio(false)
#define all(x) x.begin(), x.end()
#define rep(i, sta, end) for (int i = sta; i < end; ++i)
#define lcm(a, b) (a) / __gcd((a), (b)) * (b)
#define pb push_back
const ll INF = 1000000000000000;
const ll MOD = 1000000007;
const double PI = acos(-1);
//||
#define DBG(a, b, c, d) // cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<endl
// DBG("","","","");

int main() {
  IO_STREAM;
  int N;
  cin >> N;
  int x, y, z;
  x = y = 1;
  int x2, y2, z2;
  rep(i, 1, N + 1) {
    int ans = 0;
    rep(j, 1, 101) {
      x = j;
      x2 = x * x;
      rep(k, 1, 101) {
        y = k;
        y2 = y * y;
        if ((x2 + y2) > i)
          break;
        rep(p, 1, 101) {
          int calc;
          z = p;
          z2 = z * z;
          if ((x2 + y2 + z2) > i)
            break;
          calc = x2 + y2 + z * z + x * y + y * z + z * x;
          if (calc == i) {
            DBG(x, y, z, 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 < (n); i++)
#define rep2(i, n) for (int i = 1; i <= (n); i++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
using ll = long long;
template <class T> using Grid = vector<vector<T>>;

int main() {
  int N;
  cin >> N;
  vector<int> v(N + 1);
  for (ll x = 1; x * x < N; x++) {
    for (ll y = 1; y * y < N; y++) {
      for (ll z = 1; z * z < N; z++) {
        ll ans = x * x + y * y + z * z + x * y + y * z + z * x;
        if (ans <= N)
          v[ans]++;
      }
    }
  }
  rep2(i, N) { printf("%d\\n", v[i]); }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, n) for (int i = 1; i <= (n); i++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
using ll = long long;
template <class T> using Grid = vector<vector<T>>;
ll f(ll N) {
  ll ans = 0;
  for (ll x = 1; x * x < N; x++) {
    for (ll y = 1; x * x + y * y + x * y < N; y++) {
      for (ll z = 1; x * x + y * y + z * z < 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;
  rep2(i, N) { cout << f(i) << endl; }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

unsigned int N;

vector<int> f(int n);

int main() {
  cin >> N;

  vector<int> ans = f(N);

  // for_each(ans.begin(), ans.end(), [](int x){cout << x << endl;});
  for (int i = 1; i < N + 1; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}

vector<int> f(int n) {
  int i = (int)(sqrt(n));
  vector<int> cnt(n + 1);
  int val = 0;
  for (int x = 1; x < i + 1; x++) {
    for (int y = 1; y < i + 1; y++) {
      for (int z = 1; z < i + 1; z++) {
        val = pow(x + y + z, 2) - (x * y + y * z + z * x);
        if (val < n + 1) {
          cnt[val]++;
        }
      }
    }
  }

  return cnt;
}

Error: TLE

Fixed submission:

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

unsigned int N;

vector<int> f(int n);

int main() {
  cin >> N;

  vector<int> ans = f(N);

  // for_each(ans.begin(), ans.end(), [](int x){cout << x << endl;});
  for (int i = 1; i < N + 1; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}

vector<int> f(int n) {
  // int i = (int)(sqrt(n));
  vector<int> cnt(n + 1);
  int val = 0;
  for (int x = 1; x < n; x++) {
    for (int y = 1; y < n; y++) {
      for (int z = 1; z < n; z++) {
        val = pow(x + y + z, 2) - (x * y + y * z + z * x);
        if (val < n) {
          cnt[val]++;
        }
      }
    }
  }

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

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

int main() {

  int N;

  cin >> N;

  int a[10005] = {};

  for (int i = 1; i <= sqrt(N); i++) {
    for (int j = 1; j <= sqrt(N); j++) {
      for (int k = 1; k <= sqrt(10005); k++) {

        if (i * i + j * j + k * k + i * j + i * k + j * k <= N) {
          a[i * i + j * j + k * k + i * j + i * k + j * k]++;
        }
      }
    }
  }

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

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

  return 0;
}


Error: TLE

Fixed submission:

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

int main() {

  int N;

  cin >> N;
  for (int l = 1; l <= N; l++) {
    int ans = 0;

    for (int i = 1; i <= sqrt(l); i++) {
      for (int j = 1; j <= sqrt(l); j++) {
        for (int k = 1; k <= sqrt(l); k++) {
          if ((i * i + j * j + k * k + i * j + i * k + j * k) == l) {
            ans++;
          }
        }
      }
    }
    cout << ans << endl;
  }

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

#include <bits/stdc++.h>

using namespace std;

int main() {
  int n, i, j, k, x;
  cin >> n;
  int arr[n + 1];
  memset(arr, 0, (n + 1) * sizeof(int));
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      for (k = 1; k <= n;
           k++) { // with these 3 for loops you try all possible combinations
        x = i * i + j * j + k * k + i * j + j * k + i * k;
        if (x > n) // if you reach a number > n then you need to change y i.e j
          break;
        else // if the number is included in the range then increase the values
             // of it's index in the array
          arr[x]++;
      }
    }
  }
  for (i = 1; i <= n; i++)
    cout << arr[i] << endl;
  return 0;
}

Error: -11

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

int main() {
  int n;
  cin >> n;
  int arr[10000] = {0};
  for (int i = 1; i <= 1000; i++) {
    for (int j = 1; j <= 1000; j++) {
      for (int k = 1; k <= 1000; k++) {
        arr[(i * i) + (j * j) + (k * k) + (i * j) + (j * k) + (k * i)]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << arr[i] << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

using namespace std;
// int arr[109][3];
int arr[10050];
int main() {
  /*   vector<string> s;
     int n;
     cin >> n;
     for (int i = 0; i < n; ++i) {
         int num;
         cin >> num;
         string str;
         cin >> str;
         s.push_back(str);
         for (int j = 0; j < num; ++j) {
             int count = 0;
             string a;
             cin >> a;
             a.erase(a.begin() + 2);
             a.erase(a.begin() + 4);
             string q;
             for (int k = 0; k < 6; ++k)
                 q += a[0];
             if (q == a) {
                 arr[i][0]++;
             }else {
                 for (int l = 0; l < 5; ++l)
                     if (a[l] > a[l + 1])
                         count++;
                 if (count < 5)
                     arr[i][2]++;
                 else
                     arr[i][1]++;

             }
         }
     }

 */
  int n;
  cin >> n;
  for (int i = 1; i <= 105; ++i) {
    for (int j = 1; j <= 105; ++j) {
      for (int k = 1; k <= 105; ++k) {
        int x = pow(i, 2) + pow(j, 2) + pow(k, 2) + i * j + k * j + i * k;
        if (x < 10050)
          arr[x]++;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    cout << arr[i] << endl;
  }
}


Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int N = 0;
  cin >> N;
  int increament = 0;
  int counter = 0;

  for (int i = 1; i <= N; i++) {
    for (int x = 1; x < i; x++) {
      for (int y = 1; y < i; y++) {
        for (int z = 1; z < i; z++) {
          if (x * x + y * y + z * z + x * y + x * z + z * y == i) {
            counter++;
          }
        }
      }
    }
    cout << counter << endl;
    counter = 0;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
int main() {
  int N = 0;
  scanf("%d", &N);
  vector<long> v(N + 1, 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 + x * z + z * y) !=
  0 && ((x * x + y * y + z * z + x * y + x * z + z * y) < v.size())) { v[(x * x
  + y * y + z * z + x * y + x * z + z * y) - 1]++;
                          }

                  }

          }

  }*/

  for (int i = 1; i <= 100; i++) {
    for (int w = 1; w <= 100; w++) {
      for (int y = 1; y <= 100; y++) {
        if (((i * i) + (w * w) + (y * y) + (i * w) + (i * y) + (y * w)) <=
            v.size()) {
          v[((i * i) + (w * w) + (y * y) + (i * w) + (i * y) + (y * w))]++;
        }
      }
    }
  }

  for (int i = 1; i <= N; i++) {
    string str = to_string(v[i]);
    const char *l = str.c_str();
    printf(l);
    printf("\\n");
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define oo (long long)1e18
#define ll long long
#define setdp memset(dp, -1, sizeof(dp))
const ll mod = 1e9 + 7;
void _IOS() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin.sync_with_stdio(0);
}
#define PI 3.14159265359
int n, m;
int a[200009];
vector<int> BFS(int source, vector<vector<int>> &adj) {
  vector<bool> vis(100009);
  vector<int> dis(100009, -1);
  queue<int> q;
  q.push(source);
  dis[source] = 0;
  vis[source] = 1;
  while (!q.empty()) {
    int node = q.front();
    q.pop();
    int d = dis[node];
    for (auto x : adj[node]) {
      if (!vis[x]) {
        vis[x] = 1;
        q.push(x);
        dis[x] = d + 1;
      }
    }
  }
  return dis;
}
int main() {
  // freopen ("jumping.in","r",stdin);
  _IOS();
  int n;
  cin >> n;
  int ans = 0;
  for (int o = 1; o <= n; o++) {
    ans = 0;
    for (int i = 1; i <= 70; i++) {
      int x = i;
      for (int j = 1; j <= 70; j++) {
        int y = j;
        for (int k = 1; k <= 70; k++) {
          int z = k;
          ll q = x * x + y * y + z * z + x * y + x * z + z * y;
          if (q == o)
            ans++;
        }
      }
    }
    cout << ans << endl;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define endl "\\n"
#define goat()                                                                 \\
  ios_base::sync_with_stdio(0);                                                \\
  cout.tie(0);                                                                 \\
  cin.tie(0);                                                                  \\
  srand(time(NULL))
typedef long long ll;

int main() {
  goat();
  ll n, i, x, y, z, c = 0;
  cin >> n;
  unordered_map<ll, ll> mp;
  for (x = 1; x <= 100; x++) {
    for (y = 1; y <= 100; y++) {
      for (z = 1; z <= 100; z++) {
        ll s = 0;
        s += x * x;
        s += y * y;
        s += z * z;
        s += x * y;
        s += y * z;
        s += x * z;
        mp[s]++;
      }
    }
  }
  for (i = 1; i <= n; i++) {
    cout << mp[i] << endl;
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, c = 0;
  cin >> n;
  for (int e = 1; e <= n; e++) {
    c = 0;
    for (int x = 1; x <= e; x++) {
      for (int y = 1; y <= e; y++) {
        for (int z = 1; z <= e; z++) {
          if ((x * x + z * z + y * y + x * y + y * z + z * x) == e)
            ++c;
        }
      }
    }
    cout << c << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int formula(int x, int y, int z) {
  int ans = x * x + y * y + z * z + x * y + x * z + y * z;
  return ans;
}

int main() {
  int n;
  cin >> n;
  int x(1), y(1), z(1), formul(0), c(0);
  for (int i = 1; i <= n; i++) {
    for (int x = 1; x <= 99; x++) {
      for (int y = 1; y <= 99; y++) {
        for (int z = 1; z <= 99; z++) {
          formul = formula(x, y, z);
          if (formul == i)
            c++;
          if (formul > i)
            break;
        }
      }
    }

    cout << c << endl;
    c = 0;
  }
}

Error: TLE

Fixed submission:

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

int formula(int x, int y, int z) {
  int ans = x * x + y * y + z * z + x * y + x * z + y * z;
  return ans;
}

int main() {
  int n;
  cin >> n;
  int x(1), y(1), z(1), formul, c(0);
  for (int i = 1; i <= n; i++) {
    for (int x = 1; x <= 99; x++) {
      for (int y = 1; y <= 99; y++) {
        for (int z = 1; z <= 99; z++) {
          formul = formula(x, y, z);
          if (formul == i)
            c++;
        }
      }
    }
    cout << c << endl;
    c = 0;
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

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

void solve() {
  int N;
  cin >> N;
  int s = sqrt(N);
  int cnt = 0;
  int arr[N + 1];
  fill(arr, arr + N + 1, 0);
  for (int x = 1; x <= s; ++x) {
    for (int y = 1; y <= s; ++y) { // x^2 + y^2 + + z^2 + xy + xz + yz = N
      for (int z = 1; z <= s; ++z) {
        int val = x * x + y * y + z * z + x * y + y * z + x * z;
        if (val > N)
          continue;
        ++arr[val];
      }
    }
  }
  for (int i = 1; i <= N; ++i)
    cout << arr[i] << "\\n";
}

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

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


Error: TLE

Fixed submission:

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

unordered_map<int, unordered_set<int>> cache;

void preProcess(int N) {
  for (int i = 1; i <= N; ++i) {
    for (int x = 1; x * x < i; ++x) {
      if (i % x == 0) {
        cache[i].insert(x);
        cache[i].insert(i / x);
      }
    }
  }
}

int compute(int N) {
  int s = sqrt(N);
  int cnt = 0;
  for (int x = 1; x <= s; ++x) {
    for (int y = 1; y <= s; ++y) { // x^2 + y^2 + + z^2 + xy + xz + yz = N
                                   // z^2 + z(x + y) = N - x^2 - y^2 - xy
                                   // z( z + K) = N - x^2 - y^2 - xy
                                   // z(z + K) = R
      int R = N - x * x - y * y - x * y;
      int K = x + y;
      if (cache.find(R) == cache.end())
        continue;
      const unordered_set<int> &st = cache[R];
      for (auto &z : st) {
        if (z * (z + K) == R && st.find(z + K) != st.end()) {
          ++cnt;
        }
      }
    }
  }
  return cnt;
}

void solve() {
  int N;
  cin >> N;

  preProcess(1e4);

  for (int i = 1; i <= N; ++i) {
    cout << compute(i) << "\\n";
  }
}

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

  int t = 1;
  while (t--) {
    solve();
  }
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 100000000;
const ll half_inf = 0x3f3f3f3f;
const ll inf = 0x7fffffff;
const ll mod = 998244353;
const ll maxn = 2000005;
int m[50005] = {0};
int main() {
  int n;
  scanf("%d", &n);
  for (int j1 = 2; j1 < 145; j1++) {
    for (int j2 = 2; j2 < 145; j2++) {
      for (int j3 = 2; j3 < 145; j3++) {
        int a = j1 + j3 - j2, b = j1 + j2 - j3, c = j2 + j3 - j1;
        int k = j1 * j1 + j2 * j2 + j3 * j3;
        if (k % 2 == 0 && (a > 0 && a % 2 == 0) && (b > 0 && b % 2 == 0) &&
            (c > 0 && c % 2 == 0)) {
          m[k / 2]++;
        }
      }
    }
  }

  for (int i = 1; i <= n; i++) {
    printf("%d\\n", m[i]);
  }

  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 100000000;
const ll half_inf = 0x3f3f3f3f;
const ll inf = 0x7fffffff;
const ll mod = 998244353;
const ll maxn = 2000005;

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int sum = 0;
    for (int j1 = 1; j1 <= 100; j1++) {
      for (int j2 = 1; j2 <= 100; j2++) {
        for (int j3 = 1; j3 <= 100; j3++) {
          int a = j1 + j3 - j2, b = j1 + j2 - j3, c = j2 + j3 - j1;

          if (j1 * j1 + j2 * j2 + j3 * j3 == 2 * i && (a > 0 && a % 2 == 0) &&
              (b > 0 && b % 2 == 0) && (c > 0 && c % 2 == 0)) {
            sum++;
          }
        }
      }
    }

    printf("%d\\n", sum);
  }

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

#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {

  int N;
  cin >> N;

  int x, y, z;

  vector<int> vec(N + 1);

  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) {
          vec[a]++;
        }
      }
    }
  }
  for (int i = 1; i <= N; i++) {
    cout << vec[i] << endl;
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {

  int N;
  cin >> N;

  int x, y, z;

  int ans = 0;

  for (int i = 1; i <= N; i++) {
    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 <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
typedef long long ll;
bool debug = false;
string yes = "Yes";
string no = "No";
const ll mod = 998244353;
const double e = 0.000000001;
ll func(ll x, ll y, ll z) {
  return x * x + y * y + z * z + x * y + y * z + z * x;
}
int main() {
  ll n;
  cin >> n;
  map<ll, ll> m;
  for (ll x = 1; x < 100; x++) {
    for (ll y = 1; y < 100; y++) {
      for (ll z = 1; z < 100; z++) {
        m[func(x, y, z)]++;
      }
    }
  }
  rep1(i, n) { cout << m[i] << endl; }
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
typedef long long ll;
bool debug = false;
string yes = "Yes";
string no = "No";
const ll mod = 998244353;
const double e = 0.000000001;
ll func(ll x, ll y, ll z) {
  return x * x + y * y + z * z + x * y + y * z + z * x;
}
int main() {
  ll n;
  cin >> n;
  rep1(i, n) {
    ll ans = 0;
    for (ll x = 1; x < 100; x++) {
      for (ll y = 1; y < sqrt(n - x * x - 1); y++) {
        for (ll z = 1; z < sqrt(n - x * x - y * y); z++) {
          if (func(x, y, z) == i)
            ans++;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
Problem p02608 (C++) — buggy submission, verdict: Time Limit Exceeded

//:::: Alien :::://
// Muhammad Eid //
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long

const int N = 6e4 + 5;
ll ar[N];

void Mo35() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

void countVal(ll n) {

  for (ll x = 1; x <= n; ++x)
    for (ll y = 1; y <= n; ++y)
      for (ll z = 1; z <= n; ++z)
        ar[(x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (z * x)]++;
}

int main() {
  Mo35();

  ll n;
  cin >> n;
  countVal(sqrt(n));
  for (ll i = 1; i <= n;)
    cout << ar[i++] << "\\n";

  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <iostream>

using namespace std;

int N;

int chkVld(int num, int x, int y, int z) {
  int summ = (x * x) + (y * y) + (z * z) + (x * y) + (x * z) + (y * z);
  if (summ == num)
    return 1;
  else if (summ > num)
    return -1;
  return 0;
}

int gnrt(int num) {
  int cnt = 0;
  for (int i = 1; i <= num; i++) {
    for (int j = 1; j <= num; j++) {
      for (int k = 1; k <= num; k++) {
        if (chkVld(num, i, j, k) == 1)
          cnt++;
        else if (chkVld(num, i, j, k) == -1)
          break;
      }
    }
  }
  return cnt;
}

int main() {
  cin >> N;

  for (int i = 1; i <= N; i++) {
    cout << gnrt(i) << endl;
  }

  return 0;
}