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

#include <bits/stdc++.h>

using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d)                                                              \\
  for (auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); \\
       blockTime.second;                                                       \\
       debug("%s: %.5lf s\\n", d,                                               \\
             chrono::duration_cast<chrono::milliseconds>(                      \\
                 chrono::high_resolution_clock::now() - blockTime.first)       \\
                     .count() /                                                \\
                 1000.0),                                                      \\
            blockTime.second = false)

template <typename T> std::string NumberToString(T Number) {
  std::ostringstream ss;
  ss << Number;
  return ss.str();
} // Usages NumberToString(3)
template <typename T> T StringToNumber(const string &Text) {
  istringstream ss(Text);
  T result;
  return ss >> result ? result : 0;
} // StringToNumber<int>("3")
template <class T>
inline constexpr T _pow_(const T base, unsigned const exponent) {
  return (exponent == 0) ? 1 : (base * pow(base, exponent - 1));
} // _pow_(2,5)
string StrCpy(string str, long long int start, long long int end) {
  string temp = "";
  for (long long int i = start; i <= end; i++) {
    temp += str[i];
  }
  return temp;
} // StrCoy(abcd,1,2)

#define ull unsigned long long int
#define ll long long int
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a * b) / gcd(a, b))

int solve() {

  ll X;

  cin >> X;

  for (ll i = -1000; i <= 1000; i++) {
    for (ll j = -1000; j <= 1000; j++)
      if (_pow_(i, 5) - _pow_(j, 5) == X) {
        cout << i << " " << j << endl;
        return 0;
      }
  }

  return 0;
}

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

  time__("programm time") { solve(); }
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d)                                                              \\
  for (auto blockTime = make_pair(chrono::high_resolution_clock::now(), true); \\
       blockTime.second;                                                       \\
       debug("%s: %.5lf s\\n", d,                                               \\
             chrono::duration_cast<chrono::milliseconds>(                      \\
                 chrono::high_resolution_clock::now() - blockTime.first)       \\
                     .count() /                                                \\
                 1000.0),                                                      \\
            blockTime.second = false)

template <typename T> std::string NumberToString(T Number) {
  std::ostringstream ss;
  ss << Number;
  return ss.str();
} // Usages NumberToString(3)
template <typename T> T StringToNumber(const string &Text) {
  istringstream ss(Text);
  T result;
  return ss >> result ? result : 0;
} // StringToNumber<int>("3")

string StrCpy(string str, long long int start, long long int end) {
  string temp = "";
  for (long long int i = start; i <= end; i++) {
    temp += str[i];
  }
  return temp;
}

#define ull unsigned long long int
#define ll long long int
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a * b) / gcd(a, b))

int solve() {

  ll A;
  cin >> A;

  for (ll i = 0;; i = i + 1) {

    ll temp = pow(i, 5);
    ll j = temp - 1;
    if (j == A) {
      cout << i << " "
           << "1" << endl;
      break;
    }
    j = temp + 1;
    if (j == A) {
      cout << i << " "
           << "-1" << endl;
      break;
    }
  }

  return 0;
}

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

  time__("programm time") { solve(); }
  return 0;
}