alexjercan/bugnet huggingface dataset:
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int x;
  cin >> x;
  int i = 1;
  while (true) {
    int ans = pow(i, 5) - pow(i - 1, 5);
    if (ans >= x)
      break;
    i++;
  }
  // iは最大の数

  for (int k = -i + 1; k <= i; k++) {
    for (int t = -i; t < i; t++) {
      int ans = pow(k, 5) - pow(t, 5);
      if (ans == x) {
        cout << k << " " << t << endl;
        return 0;
      }
    }
  }
}


Error: TLE

Fixed submission:

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

int main() {
  int x;
  cin >> x;
  double a = 10, b;
  while (true) {
    // cout
    // <<pow(abs(pow(a,5)-x),(double)1/5)-(int)pow(abs(pow(a,5)-x),(double)1/5)<<endl;
    if (pow(abs(pow(a, 5) - x), (double)1 / 5) -
            (int)pow(abs(pow(a, 5) - x), (double)1 / 5) ==
        0) {
      long long b = pow(abs(pow(a, 5) - x), (double)1 / 5);
      if (pow(a, 5) - pow(b, 5) == x) {
        cout << a << " " << b << endl;
        return 0;
      } else if (pow(a, 5) - pow(-b, 5) == x) {
        cout << a << " " << -b << endl;
        return 0;
      }
    } else if (pow(a, 5) + (int)pow(abs(pow(a, 5) - x), (double)1 / 5) > x) {
      a--;
    } else {
      a *= a;
    }
  }

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

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for (ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll x;
  cin >> x;
  ll n = (1 << 10) + 1;
  rep(i, n) rep(j, n) rep(p, 2) rep(q, 2) {
    ll a = i;
    ll b = j;
    if (p)
      a *= -1;
    if (q)
      b *= -1;
    ll now = a * a * a * a * a - b * b * b * b * b;
    if (now != x)
      continue;
    cout << a << ' ' << b << endl;
    return 0;
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for (ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll x;
  cin >> x;
  ll n = (1 << 12) + 1;
  rep(i, n) rep(j, n) rep(p, 2) rep(q, 2) {
    ll a = i * pow(-1, a);
    ll b = j * pow(-1, b);
    ll now = pow(a, 5) - pow(b, 5);
    if (now != x)
      continue;
    cout << a << ' ' << b << endl;
    return 0;
  }
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cmath>
#include <iostream>

using namespace std;

int main() {
  long long X;
  cin >> X;
  int a = 0;
  double b = 0;
  while (true) {
    b = pow(abs(X - (long long)pow(a, 5.)), 0.2);
    if (abs(b - floor(b)) < 0.000000001) {
      if (pow(a, 5) - pow(floor(b), 5) == X ||
          pow(a, 5) + pow(floor(b), 5) == X)
        break;
    }
    a++;
  }

  if (pow(a, 5) - pow(floor(b), 5) == X)
    cout << a << " " << floor(b) << endl;
  else
    cout << a << " -" << floor(b) << endl;
}


Error: TLE

Fixed submission:

#include <cmath>
#include <iostream>

using namespace std;

int main() {
  long long X;
  cin >> X;
  int con = floor(pow(X, 0.2));
  double b = 0.;
  while (true) {
    b = pow(X - pow(con, 5.), 0.2);
    if (b == floor(b)) {
      break;
    } else {
      con--;
    }
  }
  if (b != 0)
    cout << con << " -" << b << endl;
  else
    cout << con << " " << b << endl;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios {
  fast_ios() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  };
} fast_ios_;

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end)                                                     \\
  for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end)                                                    \\
  for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

void solve(long long X) {
  lint x, y;
  for (x = -2000; x <= 2000; x++) {
    for (y = -2000; y <= 2000; y++) {
      if ((x * x * x * x * x - y * y * y * y * y) == X) {
        cout << x << " " << y << endl;
        return;
      }
    }
  }
}

int main() {

  long long X;
  scanf("%lld", &X);
  solve(X);
  return 0;
}


Error: TLE

Fixed submission:

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

ll fun(ll a, ll b) {
  return a * a * a * a + a * a * a * b + a * a * b * b + a * b * b * b +
         b * b * b * b;
}

int main() {

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll x;
  cin >> x;
  if (x == 0) {
    cout << 0 << " " << 0 << "\\n";
    return 0;
  }
  vector<ll> v;

  for (ll i = 2; i * i <= x; ++i) {
    if (x % i == 0) {
      v.push_back(i);
      v.push_back(x / i);
      break;
    }
  }
  bool flag = false;
  if (v.size() == 0) {
    ll aa = 1;
    ll bb = x;

    for (ll i = 0; i <= 1e9; ++i) {
      ll j = i - 1;
      if (fun(i, j) == x) {
        cout << i << " " << j << "\\n";
        break;
      }
    }

  } else {
    ll aa = v[0];
    ll bb = v[1];

    for (ll i = 0; i <= 1e9; ++i) {
      ll j = i - aa;
      if (fun(i, j) * aa == x) {
        cout << i << " " << j << "\\n";
        break;
      }
    }
  }

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

#include <iostream>
#include <string>
#include <vector>

using namespace std;
int main(void) {
  long long x;
  int a = 0, b = 0;
  int flag = 0;
  cin >> x;
  long long m[1001];
  for (long long i = 0; i <= 1000; i++) {
    m[i] = i * i * i * i * i;
  }

  for (int i = 0; i < 1001; i++) {
    for (int j = 0; j < 1001; j++) {
      if (m[i] - m[j] == x) {
        a = i;
        b = j;
        flag = 1;
        break;
      } else if (m[i] + m[j] == x) {
        a = i;
        b = -1 * j;
        flag = 1;
        break;
      }
    }
    if (flag) {
      break;
    }
  }

  cout << a << " " << b << endl;
  return 0;
}

Error: -11

Fixed submission:

#include <iostream>
#include <string>
#include <vector>

using namespace std;
int main(void) {
  long long x;
  int a = 0, b = 0;
  int flag = 0;
  cin >> x;
  long long m[1000];
  for (int i = 0; i <= 10000; i++) {
    m[i] = i * i * i * i * i;
  }

  for (int i = 0; i < 1000; i++) {
    x -= m[i];
    // cout << x << endl;
    for (int j = 0; j < 1000; j++) {
      if (x == -1 * m[j]) {
        a = i;
        b = j;
        flag = 1;
        break;
      } else if (x == m[j]) {
        a = i;
        b = -1 * j;
        flag = 1;
        break;
      }
    }
    if (flag) {
      break;
    }
    x += m[i];
  }

  cout << a << " " << b << endl;
  return 0;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using mii = map<int, int>;
using mll = map<ll, ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vpi = vector<pii>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpl = vector<pll>;
using vs = vector<string>;

int main() {
  ll x;
  cin >> x;
  for (ll i = -120; i <= 120; i++) {
    for (ll j = -120; j <= 120; j++) {
      if (i * i * i * i * i - j * j * j * j * j == x) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using mii = map<int, int>;
using mll = map<ll, ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vpi = vector<pii>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpl = vector<pll>;
using vs = vector<string>;

int main() {
  ll x;
  cin >> x;
  ll half = sqrtl(x);
  ll bai;
  for (ll i = half;; i--) {
    if (x % i == 0) {
      bai = i;
      break;
    }
  }
  for (ll i = 0;; i++) {
    ll j = i - bai;
    if (i * i * i * i + i * i * i * j + i * i * j * j + i * j * j * j +
            j * j * j * j ==
        x / bai) {
      cout << i << " " << j << endl;
      break;
    }
  }
  return 0;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;

int main(void) {
  lli x;

  cin >> x;

  lli xx = 120;

  for (lli i = -xx; i <= xx; i++) {
    for (lli j = -xx; j <= xx; j++) {
      lli temp = pow(i, 5) - pow(j, 5);
      if (temp == x) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;

int main(void) {
  lli x;

  cin >> x;

  lli xx = 20000;

  for (lli i = -xx; i <= xx; i++) {
    for (lli j = -xx; j <= xx; j++) {
      lli temp = (i * i - j * j) * (i * i + j * j) * (i + j) -
                 i * j * (i + j) * (i * i - i * j + j * j);
      if (temp == x) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }

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

// https://atcoder.jp/contests/abc166/tasks/abc166_d
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll = long long;
const ll LINF = 0x1fffffffffffffff;
#define FOR(i, a, b) for (ll i = (a); i < static_cast<ll>(b); ++i)
#define REP(i, n) FOR(i, 0, n)
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  ll X;
  cin >> X;
  unordered_map<ll, ll> vtbl;
  vector<ll> nums;
  {
    ll i = 0;
    while (true) {
      auto i5 = i * i * i * i * i;
      if (i5 < 0)
        break;
      if (i5 > LINF)
        break;
      vtbl[i5] = i;
      vtbl[-i5] = -i;
      nums.push_back(i5);
      nums.push_back(-i5);
      dump(i5);

      ++i;
    }
  }

  dump(nums.size())

      FOR(i, 0, nums.size()) {
    FOR(j, 0, nums.size()) {
      auto a5 = nums[i];
      auto b5 = nums[j];
      if (a5 - b5 == X) {
        dump(a5, b5);
        cout << vtbl[a5] << " " << vtbl[b5] << endl;
        return 0;
      }
    }
  }
  assert(0);

  return 0;
}

Error: WA

Fixed submission:

// https://atcoder.jp/contests/abc166/tasks/abc166_d
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll = long long;
const ll LINF = 0x1fffffffffffffff;
#define FOR(i, a, b) for (ll i = (a); i < static_cast<ll>(b); ++i)
#define REP(i, n) FOR(i, 0, n)
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  ll X;
  cin >> X;
  unordered_map<ll, ll> vtbl;
  vector<ll> nums;
  {
    ll i = 0;
    while (true) {
      auto i5 = i * i * i * i * i;
      if (i5 > 1e+9)
        break;
      vtbl[i5] = i;
      vtbl[-i5] = -i;
      nums.push_back(i5);
      nums.push_back(-i5);
      dump(i5);

      ++i;
    }
  }

  dump(nums.size())

      FOR(i, 0, nums.size()) {
    FOR(j, 0, nums.size()) {
      auto a5 = nums[i];
      auto b5 = nums[j];
      if (a5 - b5 == X) {
        dump(a5, b5);
        cout << vtbl[a5] << " " << vtbl[b5] << endl;
        return 0;
      }
    }
  }
  assert(0);

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

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll ts = 1000000007;

int five(ll n) { return n * n * n * n * n; }

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

  ll x;
  cin >> x;
  bool can = false;
  for (ll i = -118; i <= 119; i++) {
    for (ll j = -118; j <= 119; j++) {
      if (i - j != 0 && x % (i - j) == 0) {
        if (five(i) - five(j) == x) {
          cout << i << " " << j << "\\n";
          can = true;
          break;
        }
      }
    }
    if (can) {
      break;
    }
  }
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll ts = 1000000007;

int five(ll n) { return n * n * n * n * n; }

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

  ll x;
  cin >> x;
  bool can = false;
  for (ll i = 0; i <= x; i++) {
    for (ll j = 0; j >= i * -1; j--) {
      if (i - j != 0 && x % (i - j) == 0) {
        if (five(i) - five(j) == x) {
          cout << i << " " << j << "\\n";
          can = true;
          break;
        }
      }
    }
    if (can) {
      break;
    }
  }
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

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

const ll mod = 1000000007;

int main() {
  bool flag = true;
  ll x;
  cin >> x;
  ll a = 0, b = 0;
  while (flag) {
    ll c, y;
    c = b * b * b * b * b;
    y = x + c;
    ll a = sqrt(sqrt(sqrt(y)));
    while (a * a * a * a * a <= y) {
      if (a * a * a * a * a == y)
        flag = false;
      if (flag)
        a++;
      else {
        cout << a << " " << b << endl;
        return 0;
      }
    }
    if (flag) {
      a = 0;
      if (b == 0)
        b = 1;
      else if (b > 0)
        b *= -1;
      else
        b = b * (-1) + 1;
    }
  }
}

Error: TLE

Fixed submission:

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

const ll mod = 1000000007;

int main() {
  bool flag = true;
  ll x;
  cin >> x;
  int a = 0, b = 0;
  while (flag) {
    ll c, y;
    c = b * b * b * b * b;
    y = x + c;
    while (a * a * a * a * a <= y) {
      if (a * a * a * a * a == y)
        flag = false;
      if (flag)
        a++;
      else {
        cout << a << " " << b << endl;
        return 0;
      }
    }
    if (flag) {
      a = 0;
      if (b == 0)
        b = 1;
      else if (b > 0)
        b *= -1;
      else
        b = b * (-1) + 1;
    }
  }
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define deb(x) cout << #x << " " << x << "\\n";
#define pi 3.1415926535897932384626433832795
#define mod 1000000007
#define all(x) x.begin(), x.end()
#define cr7                                                                    \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (((a) * (b)) / gcd((a), (b)))

// POWER FUNCTION

ll power(ll x, ll y) {
  ll temp;
  if (y == 0)
    return 1;
  temp = power(x, y / 2);
  if (y % 2 == 0)
    return ((temp) * (temp));
  else
    return (x * (temp) * (temp));
}
int main() {
  cr7
#ifndef ONLINE_JUDGE
      freopen("input1.txt", "r", stdin);
  freopen("output1.txt", "w", stdout);
#endif
  ll x;
  cin >> x;
  ll a = 1;
  while (1) {
    for (ll b = a - 1; b >= -a; --b) {
      if (power(a, 5) - power(b, 5) == x) {
        cout << a << " " << b << "\\n";
        return 0;
      }
    }
    a++;
  }
  return 0;
}

// OUTPUT

/*

*/

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define deb(x) cout << #x << " " << x << "\\n";
#define pi 3.1415926535897932384626433832795
#define mod 1000000007
#define all(x) x.begin(), x.end()
#define cr7                                                                    \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL);
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (((a) * (b)) / gcd((a), (b)))

// POWER FUNCTION

ll power(ll x, ll y) {
  ll temp;
  if (y == 0)
    return 1;
  temp = power(x, y / 2);
  if (y % 2 == 0)
    return ((temp) * (temp));
  else
    return (x * (temp) * (temp));
}
int main() {
  cr7
#ifndef ONLINE_JUDGE
      freopen("input1.txt", "r", stdin);
  freopen("output1.txt", "w", stdout);
#endif
  ll x;
  cin >> x;
  ll a = 1;
  while (1) {
    for (ll b = a - 1; b >= -a; ++b) {
      if (power(a, 5) - power(b, 5) == x) {
        cout << a << " " << b << "\\n";
        return 0;
      }
    }
    a++;
  }
  return 0;
}

// OUTPUT

/*

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

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

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

int main(void) {
  ll X;
  ll A, B;
  cin >> X;
  for (A = -119; A <= 120; A++) {
    for (B = -119; B <= 120; B++) {
      if (pow(A, 5) - pow(B, 5) == X)
        goto aaa;
    }
  }
aaa:
  cout << A << ' ' << B << endl;
  return 0;
}


Error: TLE

Fixed submission:

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

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

int main(void) {
  ll X;
  ll a;
  ll A, B;
  cin >> X;
  a = pow(X, 0.2);
  A = a - 1;
  while (true) {
    bool mode;
    ll tempA = pow(A, 5);
    if (tempA > X) {
      mode = true;
      B = pow(tempA - X, 0.2) - 1;
    } else {
      mode = false;
      B = -pow(X - tempA, 0.2) + 1;
    }
    // cout << A << ' ' << B << endl;
    // return 0;
    while (true) {
      ll temp = tempA - pow(B, 5);
      if (temp == X)
        goto aaaa;
      if ((mode && temp < X) || (!mode && temp > X))
        break;
      if (mode)
        B++;
      else
        B--;
    }
    A++;
  }
aaaa:
  cout << A << ' ' << B << endl;
  return 0;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

using namespace std;

#define pow5(x) x *x *x *x *x

int main() {
  int x;
  cin >> x;
  long long a, b;
  while (true) {
    for (a = 0; a < 140; a++) {
      if (pow5(a) - x < 0) {
        for (b = 0; b > -100; b--) {
          if (pow5(a) == x + pow5(b)) {
            cout << a << " " << b << endl;
            return 0;
          }
        }
      } else {
        for (b = 0; b < a; b++) {
          if (pow5(a) == x + pow5(b)) {
            cout << a << " " << b << endl;
            return 0;
          }
        }
      }
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

#define pow5(x) x *x *x *x *x

int main() {
  int x;
  cin >> x;
  long long a, b;
  b = -100;
  while (true)
    for (b = -100; b < 100; b++) {
      if (x + pow5(b) < 0)
        continue;
      for (a = 0; a < 100; a++) {
        if (pow5(a) == x + pow5(b)) {
          cout << a << " " << b << endl;
          return 0;
        }
      }
    }
  return 0;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/range/algorithm/sort.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using boost::irange;
using boost::sort;
using boost::adaptors::reversed;

int main() {
  double x;
  cin >> x;
  long a = 0;
  unordered_set<long> s;

  for (;; a++) {
    long y = pow(a, 5);
    bool br = false;
    s.insert(y);
    for (auto j : s) {
      if (y + j == x) {
        br = true;
        break;
      }
      if (y - j == x) {
        br = true;
        break;
      }
    }
    if (br)
      break;
  }

  long d = pow(a, 5) - x;
  long b = (d >= 0 ? 1 : -1) * pow(abs(d), 0.2);

  cout << a << " " << b << endl;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/range/algorithm/sort.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using boost::irange;
using boost::sort;
using boost::adaptors::reversed;

int main() {
  double x;
  cin >> x;
  int a = 0;
  unordered_set<int> s;

  for (;; a++) {
    int y = pow(a, 5);
    bool br = false;
    s.insert(y);
    for (auto j : s) {
      if (y + j == x) {
        br = true;
        break;
      }
      if (y - j == x) {
        br = true;
        break;
      }
    }
    if (br)
      break;
  }

  int d = pow(a, 5) - x;
  int b = (d >= 0 ? 1 : -1) * pow(abs(d), 0.2);

  cout << a << " " << b << endl;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int64_t X;
  cin >> X;
  //  A^5-B^5=X;
  //  (A-B)(A^4+A^3B+A^2B^2+AB^3+B^4)=X;
  int64_t F4 = (int64_t)pow(X, 0.25) + 1;
  int64_t F5 = (int64_t)pow(X, 0.2) - 1;
  for (int64_t i = 0; i <= F4; i++) {
    int64_t B = (int64_t)pow(i, 5) - X;
    if (B >= 0) {
      int Q = (int64_t)sqrt(B);
      for (int64_t j = 0; j <= Q; j++) {
        if ((int64_t)pow(j, 5) == B) {
          cout << i << " " << j << endl;
          goto finish;
        }
      }
    }
    if (B < 0) {
      int64_t E = -B;
      int64_t Q = (int64_t)sqrt(E);
      for (int64_t j = 0; j <= Q; j++) {
        if ((int64_t)pow(j, 5) == E) {
          cout << i << " " << -j << endl;
          goto finish;
        }
      }
    }
  }
finish:
  X = 0;
}

Error: TLE

Fixed submission:

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

int main() {
  int X;
  cin >> X;
  //  A^5-B^5=X;
  //  (A-B)(A^4+A^3B+A^2B^2+AB^3+B^4)=X;
  int F4 = (int)pow(X, 0.25) + 1;
  int F5 = (int)pow(X, 0.2) - 1;
  for (int i = 0; i <= 1000000000; i++) {
    int B = (int)pow(i, 5) - X;
    if (B >= 0) {
      int Q = (int)sqrt(B);
      for (int j = 0; j <= Q; j++) {
        if ((int)pow(j, 5) == B) {
          cout << i << " " << j << endl;
          goto finish;
        }
      }
    }
    if (B < 0) {
      int E = -B;
      int Q = (int)sqrt(E);
      for (int j = 0; j <= Q; j++) {
        if ((int)pow(j, 5) == E) {
          cout << i << " " << -j << endl;
          goto finish;
        }
      }
    }
  }
finish:
  X = 0;
}