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

//---Vaidik Patel"---//-------------------Proud to be
//Indian--------------------------------//
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> // include the associative containers or group of templates such as set,multi multimap, map etc.
#include <ext/pb_ds/tree_policy.hpp> // include the tree_order_statistics_node update
using namespace __gnu_pbds;
#define int long long int
#define ld long double
#define pii pair<int, int>
typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set; // find_by_order()
#define deb1(x) cout << #x << " : " << x << "\\n";
#define deb2(x, y) cout << #x << ": " << x << " " << #y << ": " << y << "\\n";
#define deb3(x, y, z)                                                          \\
  cout << #x << ": " << x << " " << #y << ": " << y << " " << #z << ": " << z  \\
       << "\\n";
#define deb4(x, y, z, w)                                                       \\
  cout << #x << " : " << x << "\\t" << #y << " : " << y << "\\t" << #z << " : "  \\
       << z << "\\t" << #w << " : " << w << endl;
#define deb5(a, b, c, d, e)                                                    \\
  cout << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": "   \\
       << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define deb6(a, b, c, d, e, f)                                                 \\
  cout << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": "   \\
       << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | "   \\
       << #f << ": " << f << endl;
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define rFOR(i, a, b) for (int i = a; i >= b; i--)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define vvi vector<vector<int>>
#define M 1000000007
#define FIO                                                                    \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0);
int powermodm(int x, int n, int m) {
  int ans = 1;
  while (n) {
    if (n & 1) {
      ans = (ans * x) % m;
    }
    x = (x * x) % m;
    n = n >> 1;
  }
  return ans;
}
void solve() {
  int n;
  cin >> n;
  vi arr(10005);
  int temp;
  FOR(i, 1, 101) {
    FOR(j, 1, 101) {
      FOR(k, 1, 101) {
        temp = i * i + j * j + k * k + i * j + j * k + k * i;
        if (temp <= 10000) {
          arr[temp]++;
        }
      }
    }
  }
  FOR(i, 1, n + 1) { cout << arr[i] << "\\n"; }
}
signed main() {
#ifndef ONLINE_JUDGE

#endif
  FIO int t;
  t = 1;
  // cin>>t;
  FOR(i, 0, t) {
    // cout<<"Case #"<<i+1<<": ";
    solve();
  }
}


Error: TLE

Fixed submission:

//---Vaidik Patel"---//-------------------Proud to be
//Indian--------------------------------//
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> // include the associative containers or group of templates such as set,multi multimap, map etc.
#include <ext/pb_ds/tree_policy.hpp> // include the tree_order_statistics_node update
using namespace __gnu_pbds;
#define int long long int
#define ld long double
#define pii pair<int, int>
typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set; // find_by_order()
#define deb1(x) cout << #x << " : " << x << "\\n";
#define deb2(x, y) cout << #x << ": " << x << " " << #y << ": " << y << "\\n";
#define deb3(x, y, z)                                                          \\
  cout << #x << ": " << x << " " << #y << ": " << y << " " << #z << ": " << z  \\
       << "\\n";
#define deb4(x, y, z, w)                                                       \\
  cout << #x << " : " << x << "\\t" << #y << " : " << y << "\\t" << #z << " : "  \\
       << z << "\\t" << #w << " : " << w << endl;
#define deb5(a, b, c, d, e)                                                    \\
  cout << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": "   \\
       << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define deb6(a, b, c, d, e, f)                                                 \\
  cout << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": "   \\
       << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | "   \\
       << #f << ": " << f << endl;
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define rFOR(i, a, b) for (int i = a; i >= b; i--)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define vvi vector<vector<int>>
#define M 1000000007
#define FIO                                                                    \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0);
int powermodm(int x, int n, int m) {
  int ans = 1;
  while (n) {
    if (n & 1) {
      ans = (ans * x) % m;
    }
    x = (x * x) % m;
    n = n >> 1;
  }
  return ans;
}
void solve() {
  int n;
  cin >> n;

  int temp = 0;
  FOR(num, 1, n + 1) {
    temp = 0;
    for (int i = 1; i <= num; i++) {
      for (int j = 1; j <= num; j++) {
        if (i * j > num)
          break;
        for (int k = 1; k <= num; k++) {
          if (i * j * k > num)
            break;

          if (i * i + j * j + k * k + i * j + j * k + k * i == num)
            temp++;
        }
      }
    }
    cout << temp << "\\n";
  }
}
signed main() {
#ifndef ONLINE_JUDGE

#endif
  FIO int t;
  t = 1;
  // cin>>t;
  FOR(i, 0, t) {
    // cout<<"Case #"<<i+1<<": ";
    solve();
  }
}