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

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

long long five[201];

long long p5(int i) {
  if (five[i])
    return five[i];
  else {
    long long tmp = i * i;
    tmp *= tmp;
    tmp *= i;
    five[i] = tmp;
    return tmp;
  }
}

void Main() {
  long long X;
  cin >> X;

  for (int i = 0; i <= 200; i++) {
    for (int j = 0; j <= 200; j++) {
      if (p5(j) - p5(i) == X) {
        cout << j << " " << i << endl;
        return;
      } else if (p5(j) + p5(i) == X) {
        cout << j << " " << -i << endl;
        return;
      }
    }
  }
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Error: 0

Fixed submission:

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

long long five[101];

long long p5(int i) {
  if (five[i])
    return five[i];
  else {
    long long tmp = i * i;
    tmp *= tmp;
    tmp *= i;
    five[i] = tmp;
    return tmp;
  }
}

void Main() {
  long long X;
  cin >> X;

  for (int i = 0; i <= 200; i++) {
    for (int j = 0; j <= 200; j++) {
      if (p5(j) - p5(i) == X) {
        cout << j << " " << i << endl;
        return;
      } else if (p5(j) + p5(i) == X) {
        cout << j << " " << -i << endl;
        return;
      }
    }
  }
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

inline long long GetMulti(int val) {
  return (long long)val * val * val * val * val;
}

int main() {
  unsigned int X;
  std::cin >> X;

  for (int A = 0;; ++A) {
    const long long mulA = GetMulti(A);
    const long long result = mulA - X;

    if (result < 0) {
      long long mulB = 0;
      for (int B = 0; mulB >= result; --B) {
        mulB = GetMulti(B);
        if (result == mulB) {
          std::cout << A << " " << B << std::endl;
          return 0;
        }
      }
    } else {
      long long mulB = 0;
      for (int B = 0; mulB <= result; ++B) {
        mulB = GetMulti(B);
        if (result == mulB) {
          std::cout << A << " " << B << std::endl;
          return 0;
        }
      }
    }
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <iostream>

inline long long GetMulti(int val) {
  return (long long)val * val * val * val * val;
}

int main() {
  unsigned int X;
  std::cin >> X;

  for (int A = 0;; ++A) {
    const long long mulA = GetMulti(A);
    const long long result = mulA - X;

    if (result < 0) {
      long long mulB = 0;
      for (int B = 0; mulB >= result; --B) {
        mulB = GetMulti(B);
        if (result == mulB) {
          std::cout << A << " " << B << std::endl;
          return 0;
        }
      }
    } else {
      long long mulB = 0;
      for (int B = 0; mulB <= result; ++B) {
        long long mulB = GetMulti(B);
        if (result == mulB) {
          std::cout << A << " " << B << std::endl;
          return 0;
        }
      }
    }
  }
  return 0;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define init(a, i)                                                             \\
  for (int k = 0; k < (i); k++)                                                \\
  (a)[k] = 0
#define in(a, i)                                                               \\
  for (int k = 0; k < (i); k++)                                                \\
  cin >> (a)[k]
#define all(a) (a).begin(), (a).end()
#define mod 1000000007
#define inf 2147483647
#define range(x, a, b) (a) <= x &&x <= (b)
ll pow5(ll a) { return a * a * a * a * a; }
int main() {
  int x;
  cin >> x;
  ll a, b, remainder = 1;
  while (1) {
    a = 1;
    b = a - remainder;
    while (a < abs(b) || pow5(a) - pow5(b) <= x) {
      if (pow5(a) - pow5(b) == x) {
        cout << a << " " << b;
        return 0;
      }
      a++;
      b++;
    }
    remainder++;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define init(a, i)                                                             \\
  for (int k = 0; k < (i); k++)                                                \\
  (a)[k] = 0
#define in(a, i)                                                               \\
  for (int k = 0; k < (i); k++)                                                \\
  cin >> (a)[k]
#define all(a) (a).begin(), (a).end()
#define mod 1000000007
#define inf 2147483647
#define range(x, a, b) (a) <= x &&x <= (b)
ll pow5(ll a) { return a * a * a * a * a; }
int main() {
  int x;
  cin >> x;
  ll a, b, remainder = 0;
  while (1) {
    a = 1;
    b = a - remainder;
    while (pow5(a) - pow5(b) <= x) {
      if (pow5(a) - pow5(b) == x) {
        cout << a << " " << b;
        return 0;
      }
      a++;
      b++;
    }
    remainder++;
  }
  return 0;
}
Problem p02690 (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;

int main() {
  long long X;
  cin >> X;

  for (int a = -1000; a <= 1000; a++) {
    for (int b = -1000; b <= 1000; b++) {
      long long A = pow(a, 5);
      long long B = pow(b, 5);
      if (A - B == X) {
        cout << a << " " << b << endl;
        return 0;
      }
    }
  }

  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  long long X;
  cin >> X;

  for (int a = -5000; a <= 5000; a++) {
    for (int b = -5000; b <= 5000; b++) {
      long long A = pow(a, 5);
      long long B = pow(b, 5);
      if (A - B == X) {
        cout << a << " " << b << endl;
        return 0;
      }
    }
  }

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

#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <numeric>
#include <string>
#include <vector>
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
using namespace std;

int main() {
  ll X;
  cin >> X;
  for (ll B = -200; B <= 200; B++) {
    for (ll A = -200; A <= 200; A++) {
      if (pow(A, 5) == X + pow(B, 5)) {
        cout << A << " " << B << endl;
        return 0;
      }
    }
  }

  return 0;
}


Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <numeric>
#include <string>
#include <vector>
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
using namespace std;

int main() {
  ll X;
  cin >> X;
  for (ll B = -100000; B <= 1000; B++) {
    for (ll A = -100; A <= 100; A++) {
      if (pow(A, 5) == X + pow(B, 5)) {
        cout << A << " " << B << endl;
        return 0;
      }
    }
  }

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

// Problem : D - I hate Factorization
// Contest : AtCoder - AtCoder Beginner Contest 166
// URL : https://atcoder.jp/contests/abc166/tasks/abc166_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define io                                                                     \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
#define pb push_back
#define all(x) begin(x), end(x)

int mod = 1e9 + 7;
int inf = 4e18;
const int N = 1e4 + 500;
bool sieve[N + 5];

void help() {

  for (int i = 2; i * i <= N; ++i) {
    if (!sieve[i]) {
      for (int j = i * i; j <= N; j += i) {
        sieve[j] = true;
      }
    }
  }
}
int give(int x) {
  int ans = 1;
  for (int i = 1; i <= 5; ++i)
    ans *= x;
  return ans;
}

signed main() {
  io int tt = 1;
  // cin>>tt;
  while (tt--) {
    int n;
    cin >> n;
    for (int i = 0; i < N; ++i) {
      for (int j = 0; j <= i; ++j) {
        if (give(i) - give(j) == n) {
          cout << i << " " << j;
          return 0;
        }
      }
    }
    for (int i = 0; i < N; ++i) {
      for (int j = 0; j <= i; ++j) {
        if (give(i) - give(-j) == n) {
          cout << i << " " << -j;
          return 0;
        }
      }
    }
  }
  return 0;
}


Error: TLE

Fixed submission:


// Problem : D - I hate Factorization
// Contest : AtCoder - AtCoder Beginner Contest 166
// URL : https://atcoder.jp/contests/abc166/tasks/abc166_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define io                                                                     \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
#define pb push_back
#define all(x) begin(x), end(x)

int mod = 1e9 + 7;
int inf = 4e18;
const int N = 6e4 + 500;
bool sieve[N + 5];

void help() {

  for (int i = 2; i * i <= N; ++i) {
    if (!sieve[i]) {
      for (int j = i * i; j <= N; j += i) {
        sieve[j] = true;
      }
    }
  }
}
int give(int x) {
  int ans = 1;
  for (int i = 1; i <= 5; ++i)
    ans *= x;
  return ans;
}

signed main() {
  io int tt = 1;
  // cin>>tt;
  while (tt--) {
    int n;
    cin >> n;
    for (int i = 0; i < N; ++i) {
      for (int j = 0; j < N; ++j) {
        if (give(i) - give(j) == n) {
          cout << i << " " << j;
          return 0;
        }
      }
    }
  }
  return 0;
}
Problem p02690 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// #define in freopen("in.txt","r",stdin)
// #define out freopen("out.txt","w",stdout)
ll n, m, k, t, l, r;
ll a, b, c, d, x;
char A, B, C, X, Y, Z;
ll ans, MAX, MIN, sum;
ll ax[100000];
char str[100000];
ll dx[200][200];
ll bx[2000];

int main() {
  ll i, j;
  t = 1;
  // scanf("lld",&t);
  while (t--) {
    n = 6310;
    sum = 0;
    cin >> x;
    for (i = 0; i <= n; i++) {
      ax[i] = i * i * i * i * i;
    }
    for (i = 0; i <= n; i++) {
      for (j = 0; j <= n; j++) {
        if (ax[j] - ax[i] == x) {
          printf("%lld %lld", j, i);
          return 0;
        }
        if (ax[j] + ax[i] == x) {
          printf("%lld %lld", j, -i);
          return 0;
        }
      }
    }
  }
  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// #define in freopen("in.txt","r",stdin)
// #define out freopen("out.txt","w",stdout)
ll n, m, k, t, l, r;
ll a, b, c, d;
char A, B, C, X, Y, Z;
ll ans, MAX, MIN, sum;
ll ax[1000000];
char str[100000];
ll dx[200][200];
ll bx[2000];

int main() {
  ll i, j;
  t = 1;
  // scanf("lld",&t);
  while (t--) {
    sum = 0;
    cin >> n;
    for (i = 0; i <= n; i++) {
      ax[i] = i * i * i * i * i;
    }
    for (i = 0; i <= n; i++) {
      for (j = 0; j <= n; j++) {
        if (ax[j] - ax[i] == n) {
          printf("%lld %lld", j, i);
          return 0;
        }
        if (ax[j] + ax[i] == n) {
          printf("%lld %lld", j, -i);
          return 0;
        }
      }
    }
  }
  return 0;
}
Problem p02690 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, n) for (int i = 1; i < 40001; i += 2)
using namespace std;
using P = pair<int, int>;
using ll = long long;

int main() {
  ll x;
  cin >> x;
  vector<pair<ll, ll>> A(40001);
  A[0].first = A[0].second = 0;

  ll num = 1;
  rep2(i, 40000) {
    A[i].first = num * num * num * num * num;
    A[i].second = num;
    A[i + 1].first = -num * num * num * num * num;
    A[i + 1].second = -num;
    num += 1;
  }
  ll a, b = 1, anum = 0, bnum = 0, judge = 0;
  rep(i, 40001) {
    a = A[i].first;
    rep(j, 40001) {

      b = A[j].first;
      if (a == (x + b)) {
        judge = 1;
        anum = A[i].second;
        bnum = A[j].second;
        break;
      }
    }
    if (judge == 1)
      break;
  }

  rep(i, 4) {
    if ((a == 0) && (b == 0))
      break;
    else if (a == 0)
      b /= bnum;
    else if (b == 0)
      a /= anum;
    else {
      a /= anum;
      b /= bnum;
    }
  }
  cout << a << " " << b << endl;
}

Error: WA

Fixed submission:

#include <algorithm>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, n) for (int i = 1; i < 40001; i += 2)
using namespace std;
using P = pair<int, int>;
using ll = long long;

int main() {
  ll x;
  cin >> x;
  vector<pair<ll, ll>> A(40001);
  A[0].first = A[0].second = 0;

  ll num = 1;
  rep2(i, 40000) {
    A[i].first = num * num * num * num * num;
    A[i].second = num;
    A[i + 1].first = -num * num * num * num * num;
    A[i + 1].second = -num;
    num += 1;
  }
  int a, b = 1, anum = 0, bnum = 0, judge = 0;
  rep(i, 40001) {
    a = A[i].first;
    rep(j, 40001) {

      b = A[j].first;
      if (a == (x + b)) {
        judge = 1;
        anum = A[i].second;
        bnum = A[j].second;
        break;
      }
    }
    if (judge == 1)
      break;
  }

  rep(i, 4) {
    if ((a == 0) && (b == 0))
      break;
    else if (a == 0)
      b /= bnum;
    else if (b == 0)
      a /= anum;
    else {
      a /= anum;
      b /= bnum;
    }
  }
  cout << a << " " << b << endl;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  long long X, a, b;
  cin >> X;
  int A = 1, B, f = 0;
  for (; A < 120; A++) {
    if (f == 1) {
      break;
    }
    a = pow(A, 5);
    B = -118;
    for (; B < 120; B++) {
      b = pow(B, 5);
      if (a - b == X) {
        f = 1;
        break;
      }
    }
  }
  cout << A - 1 << " " << B << endl;
}

Error: TLE

Fixed submission:

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

int main() {
  long long X, a, b;
  int A = -118, B = -118, f = 0;
  cin >> X;
  for (;; B++) {
    if (f == 1) {
      break;
    }
    b = B * B * B * B * B;
    for (; A < 120; A++) {
      a = A * A * A * A * A;
      if (a + b == X) {
        f = 1;
        B = -B;
        break;
      } else if (a - b == X) {
        f = 1;
        break;
      }
    }
  }
  cout << A << B << endl;
}
Problem p02690 (C++) — buggy submission, verdict: Runtime Error

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

using ll = long long;

#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (int)(a.size())
#define clr(a, b) memset(a, b, sizeof(a))
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define REPD(i, a, b) for (int i = (int)(a)-1; i >= (int)(b); --i)
#define FOR(it, c)                                                             \\
  for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)

template <typename T> inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T> inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll x;
  cin >> x;
  REP(i, 0, 120) {
    ll pi = pow(i, 5);
    REP(j, 0, 120) {
      ll pj = pow(j, 5);
      if (pi - pj == x) {
        cout << i << " " << j << "\\n";
        return 0;
      } else if (pi + pj == x) {
        cout << i << " " << -j << "\\n";
        return 0;
      }
    }
  }
  assert(false);
  return 0;
}


Error: 0

Fixed submission:

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

using ll = long long;

#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (int)(a.size())
#define clr(a, b) memset(a, b, sizeof(a))
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define REPD(i, a, b) for (int i = (int)(a)-1; i >= (int)(b); --i)
#define FOR(it, c)                                                             \\
  for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)

template <typename T> inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T> inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

ll ret;

bool ok(ll p) {
  p = abs(p);
  REP(i, 1, p + 1) {
    if (pow(i, 5) > p)
      break;
    if (pow(i, 5) == p) {
      ret = i;
      return true;
    }
  }
  return false;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll x;
  cin >> x;
  ll i = 0, p = 0;
  while (p <= x) {
    p = pow(i, 5) - x;
    if (ok(p)) {
      if (pow(ret, 5) + pow(i, 5) == x) {
        i *= -1;
      } else if (pow(i, 5) - pow(ret, 5) == x) {
        swap(i, ret);
      }
      cout << ret << " " << i << "\\n";
      return 0;
    }
    ll pp = pow(i, 5) + x;
    if (ok(pp)) {
      if (pow(ret, 5) + pow(i, 5) == x) {
        i *= -1;
      } else if (pow(i, 5) - pow(ret, 5) == x) {
        swap(i, ret);
      }
      cout << ret << " " << i << "\\n";
      return 0;
    }
    ++i;
  }
  assert(false);
  return 0;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

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

typedef long long ll;
typedef pair<ll, ll> P;

const ll mod =
    1000000007; // 出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60; // INF = 1152921504606846976

int main() {
  ll x;
  cin >> x;
  vector<ll> a;
  vector<ll> b;
  for (ll i = 0; i * i <= 1e9; i++) {
    a.push_back(i * i * i * i * i);
    b.push_back(i * i * i * i * i);
    b.push_back((-1) * (i * i * i * i * i));
  }
  sort(all(a));
  sort(all(b));
  ll s, t;
  for (auto i : a) {
    if (binary_search(b.begin(), b.end(), i - x)) {
      s = i;
      t = i - x;
    }
  }
  ll ans1, ans2;
  for (ll i = 0; i * i <= s; i++) {
    if (i * i * i * i * i == s)
      ans1 = i;
  }
  for (ll i = 0; i * i <= abs(t); i++) {
    if (i * i * i * i * i == abs(t)) {
      if (t < 0)
        ans2 = -i;
      else
        ans2 = i;
    }
  }
  cout << ans1 << ' ' << ans2;
}

Error: TLE

Fixed submission:

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

typedef long long ll;
typedef pair<ll, ll> P;

const ll mod =
    1000000007; // 出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60; // INF = 1152921504606846976

int main() {
  ll x;
  cin >> x;
  vector<ll> a;
  vector<ll> b;
  for (ll i = 0; i * i <= inf; i++) {
    a.push_back(i * i * i * i * i);
    b.push_back(i * i * i * i * i);
    b.push_back((-1) * (i * i * i * i * i));
  }
  sort(all(a));
  sort(all(b));
  ll s, t;
  for (auto i : a) {
    if (binary_search(b.begin(), b.end(), i - x)) {
      s = i;
      t = i - x;
    }
  }
  int ans1, ans2;
  for (int i = 0; i * i <= s; i++) {
    if (i * i * i * i * i == s)
      ans1 = i;
  }
  for (int i = 0; i * i <= abs(t); i++) {
    if (i * i * i * i * i == abs(t)) {
      if (t < 0)
        ans2 = -i;
      else
        ans2 = i;
    }
  }
  cout << ans1 << ' ' << ans2;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
const int INF = 1e9;
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;

int main() {
  cin >> X;

  for (ll i = 1; i < 100000; i++) {
    if (X % i == 0) {
      Y = X / i;
      // cout << Y << endl;
      for (ll j = 0; j <= Y / 2; j++) {

        A = j;
        B = j - i;
        ll A2 = A * A;
        ll B2 = B * B;
        D = A * B;
        E = (A * A) + (A * B) + (A * A);
        if (Y == A2 * A2 + B2 * B2 + D * (A2 + D + B2)) {
          cout << A << " " << B;
          return 0;
        }
      }
    }
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
const int INF = 1e9;
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;

int main() {
  cin >> X;

  for (ll i = 1; i < 100000; i++) {
    if (X % i == 0) {
      Y = X / i;
      // cout << Y << endl;
      for (ll j = 0; j <= Y; j++) {

        A = j;
        B = j - i;
        ll A2 = A * A;
        ll B2 = B * B;
        D = A * B;
        E = (A * A) + (A * B) + (A * A);
        if (Y == A2 * A2 + B2 * B2 + D * (A2 + D + B2)) {
          cout << A << " " << B;
          return 0;
        }
      }
    }
  }

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

#include <bits/stdc++.h>
using namespace std;
#define fastio                                                                 \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
#define pb push_back
#define ll long long
#define pii pair<int, int>

void test_case() {
  ll x;
  cin >> x;
  for (ll a = -118; a <= 119; a++) {
    for (ll b = -119; b <= 118; b++) {
      if ((a * a * a * a * a - b * b * b * b * b) == x) {
        cout << a << " " << b;
        return;
      }
    }
  }
}

int main() {
  fastio
  //    int t;
  //    cin>>t;
  //    while(t--)
  test_case();
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define fastio                                                                 \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);
#define pb push_back
#define ll long long
#define pii pair<int, int>
#define forn(i, n) for (int i = 0; i < (int)n; i++)
ll power(ll x, ll n);
bool isprime(ll n);

void test_case() {
  ll x;
  cin >> x;
  unordered_map<ll, ll> mp;
  mp[0] = 1;
  for (ll i = 1;; i++) {
    ll k = i * i * i * i * i;
    if (k <= 1e9) {
      mp[k] = 1;
      mp[-k] = 1;
    } else {
      break;
    }
  }
  for (ll i = 0;; i++) {
    ll k = i * i * i * i * i;
    if (mp.find(k - x) != mp.end()) {
      cout << i << " ";
      if (k - x < 0)
        cout << "-";
      cout << pow(abs(k - x), 1.0 / 5);
      return;
    }
  }
}

int main() {
  fastio
  //    int t;
  //    cin>>t;
  //    while(t--)
  test_case();
}
ll power(ll x, ll n) {
  ll ans = 1;
  while (n > 0) {
    if (n & 1)
      ans *= x;
    n >>= 1;
    x *= x;
  }
  return ans;
}

bool isprime(ll n) {
  if (n == 2 || n == 3)
    return true;
  if (n <= 1 || n % 2 == 0 || (n % 6 != 1 && n % 6 != 5))
    return false;
  for (ll i = 3; i * i <= n; i += 2) {
    if (n % i == 0)
      return false;
  }
  return true;
}