prithivMLmods/Coder-Stat huggingface dataset:
Problem p02690 (C++)

Buggy submission (status: 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

/*

*/

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 (status: 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 > 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;
}

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 < 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;
}
Problem p02690 (C++)

Buggy submission (status: 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;
  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;
}


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;
  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;
}
Problem p02690 (C++)

Buggy submission (status: 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 = 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;
    }
  }
}


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 = -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;
    }
  }
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long x;
  cin >> x;
  int a = 0, b = 0;
  long long a_s = 0, b_s = 0;
  for (; a_s <= x; a++) {
    a_s = pow(a, 5);
  }
  a = a - 2;
  a_s = pow(a, 5);
  for (; a_s - b_s != x; b--) {
    b_s = pow(b, 5);
  }
  b_s = pow(b, 5);
  if (a_s - b_s < x) {
    cout << a << " " << b - 1;
  } else if (a_s - b_s == x) {
    cout << a << " " << b;
  } else {
    cout << a << " " << b + 1;
  }
  return 0;
}

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

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long x;
  cin >> x;
  long long a, b;
  for (a = -1000; a <= 1000; a++) {
    for (b = 1000; b >= -1000; b--) {
      if (pow(a, 5) - pow(b, 5) == x) {
        cout << a << " " << b;
        return 0;
      }
    }
  }
  return 0;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int64_t X;
  cin >> X;
  bool finished = true;
  for (int64_t i = 0; i < 10000; i++) {
    for (int64_t j = i; j < 10000; j++) {
      if (pow(i, 5) + pow(j, 5) == X) {
        cout << i << " -" << j;
        finished = false;
        break;
      } else if (pow(i, 5) - pow(j, 5) == X) {
        cout << i << " " << j;
        finished = false;
        break;
      }
    }
    if (finished == false)
      break;
  }
}


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

int main() {
  int64_t X;
  cin >> X;
  bool finished = true;
  for (int64_t i = 0; i < 120; i++) {
    for (int64_t j = 0; j < 120; j++) {
      if (pow(i, 5) + pow(j, 5) == X) {
        cout << i << " -" << j;
        finished = false;
        break;
      } else if (pow(i, 5) - pow(j, 5) == X) {
        cout << i << " " << j;
        finished = false;
        break;
      }
    }
    if (finished == false)
      break;
  }
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;
const int mod = MOD7;

void ERROR(int num) { printf("ERROR%d!\n", num); }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
int dx[8] = {-1, 0, 1, 0, 1, 1, -1, -1};
int dy[8] = {0, -1, 0, 1, 1, -1, 1, -1};

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

  ll X;
  cin >> X;

  map<ll, int> Map;
  vector<ll> vec;

  ll front = 0;
  for (ll i = 0;; i++) {
    int v = pow(i, 5);
    // if(i>0 && v-front>X) break;
    if (i > 0 && v - front > X)
      break;
    Map[v] = 1;
    vec.pb(v);
    front = v;
  }

  ll A = -33, ans_B = -33;
  for (ll i = 0; i < vec.size(); i++) {
    ll v = vec[i];
    ll res1 = X + v;
    ll res2 = X - v;
    if (res2 < 0)
      res2 = res2 * (-1);

    if (Map[res1] == 1) {
      A = res1;
      ans_B = i;
      // cout << "B1 " << ans_B << endl;
      break;
    } else if (Map[res2] == 1) {
      A = res2;
      ans_B = -(i);
      // cout << "B2 " << ans_B << endl;
      break;
    }
  }

  // cout << A << endl;
  for (ll i = 0; i < vec.size(); i++) {
    if (vec[i] == A) {
      cout << i << " ";
      break;
    }
  }
  cout << ans_B << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
const int maxn = 10000;
const int INF32 = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7 = 1'000'000'007;
const int MOD9 = 1'000'000'009;
const int mod = MOD7;

void ERROR(int num) { printf("ERROR%d!\n", num); }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
int dx[8] = {-1, 0, 1, 0, 1, 1, -1, -1};
int dy[8] = {0, -1, 0, 1, 1, -1, 1, -1};

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

  ll X;
  cin >> X;

  map<ll, int> Map;
  vector<ll> vec;

  ll front = 0;
  for (ll i = 0;; i++) {
    ll v = pow(i, 5);
    if (i > 0 && v - front > X)
      break;
    Map[v] = 1;
    vec.pb(v);
    front = v;
  }

  ll A = -33, ans_B = -33;
  for (ll i = 0; i < vec.size(); i++) {
    ll v = vec[i];
    ll res1 = X + v;
    ll res2 = X - v;
    if (res2 < 0)
      res2 = res2 * (-1);

    if (Map[res1] == 1) {
      A = res1;
      ans_B = i;
      // cout << "B1 " << ans_B << endl;
      break;
    } else if (Map[res2] == 1) {
      A = res2;
      ans_B = -(i);
      // cout << "B2 " << ans_B << endl;
      break;
    }
  }

  // cout << A << endl;
  for (ll i = 0; i < vec.size(); i++) {
    if (vec[i] == A) {
      cout << i << " ";
      break;
    }
  }
  cout << ans_B << endl;
}
Problem p02690 (C++)

Buggy submission (status: Runtime Error):
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <functional>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (auto i = a; i < b; i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll power(ll x, ll p) {
  ll a = 1;
  while (p > 0) {
    if (p % 2 == 0) {
      x *= x;
      p /= 2;
    } else {
      a *= x;
      p--;
    }
  }
  return a;
}

#define INF 1 << 30
int t[100][100];
int main() {
  ll X, l, r, k, m;
  cin >> X;
  k = (ll)sqrt(X);
  rep(i, 1ll, k + 1) {
    if (X % i == 0) {
      rep(l, 0ll, X) {
        if (X % (2 * l - i))
          continue;
        if (power(l, 5) - power(l - i, 5) == X) {
          printf("%lld %lld\n", l, l - i);
          return 0;
        }
      }
    }
  }
  return 0;
}


Fixed submission:
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <functional>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (auto i = a; i < b; i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll power(ll x, ll p) {
  ll a = 1;
  while (p > 0) {
    if (p % 2 == 0) {
      x *= x;
      p /= 2;
    } else {
      a *= x;
      p--;
    }
  }
  return a;
}

#define INF 1 << 30
int t[100][100];
int main() {
  ll X, l, r, k, m;
  cin >> X;
  k = (ll)sqrt(X);
  rep(i, 1ll, k + 1) {
    if (X % i == 0) {
      rep(l, 0ll, X) {
        r = power(l, 5) - power(l - i, 5);
        if (l >= i && r > X)
          break;
        if (r == X) {
          printf("%lld %lld\n", l, l - i);
          return 0;
        }
      }
    }
  }
  return 0;
}
Problem p02690 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <chrono>
#include <cstdio>
#include <ctime>
#include <ctype.h>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unistd.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
#define debug(name) DEBUG(#name, (name))
template <typename T> void DEBUG(string label, T value) {
  cerr << "[" << label << " = " << value << "]\n";
}

void solve() {
  ll x;
  cin >> x;
  const int N = 72;
  vector<ll> table(N + 1);
  for (int i = 0; i <= N; ++i) {
    table[i] = 1LL * i * i * i * i * i;
  }
  for (int i = 0; i <= N; ++i) {
    for (int j = 0; j <= N; ++j) {
      if (table[i] + table[j] == x) {
        cout << i << " " << -j << endl;
        return;
      }
      if (table[i] - table[j] == x) {
        cout << i << " " << j << endl;
        return;
      }
    }
  }
  assert(0);
}
int main(int argv, char **argc) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  solve();
}


Fixed submission:
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <chrono>
#include <cstdio>
#include <ctime>
#include <ctype.h>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unistd.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
#define debug(name) DEBUG(#name, (name))
template <typename T> void DEBUG(string label, T value) {
  cerr << "[" << label << " = " << value << "]\n";
}

void solve() {
  ll x;
  cin >> x;
  const int N = 3980;
  vector<ll> table(N + 1);
  for (int i = 0; i <= N; ++i) {
    table[i] = 1LL * i * i * i * i * i;
  }
  for (int i = 0; i <= N; ++i) {
    for (int j = 0; j <= N; ++j) {
      if (table[i] + table[j] == x) {
        cout << i << " " << -j << endl;
        return;
      }
      if (table[i] - table[j] == x) {
        cout << i << " " << j << endl;
        return;
      }
    }
  }
  assert(0);
}
int main(int argv, char **argc) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  solve();
}
Problem p02690 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
const long long N = 9000;
long long arr[N] = {};
int main() {
  long long x;
  cin >> x;
  if (x == 0) {
    cout << "0 0\n";
    return 0;
  }
  long long a, b;
  for (long long i = 1; i < N; i++)
    for (long long j = i + 1; j < N; j++) {
      a = j, b = i;
      long long t = a * a + b * b;
      if (a != b && x % (a - b) == 0)
        if (x / (a - b) - t * t == a * b * (t - a * b)) {
          cout << a << " " << b;
          return 0;
        }
      a = j, b = -i;
      if (x % (a - b) == 0)
        if (x / (a - b) - t * t == a * b * (t - a * b)) {
          cout << a << " " << b;
          return 0;
        }
    }
  return -1;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
const long long N = 9000;
long long arr[N] = {};
int main() {
  long long x;
  cin >> x;
  if (x == 0) {
    cout << "0 0\n";
    return 0;
  }
  if (x == 1) {
    cout << "1 0\n";
    return 0;
  }
  long long a, b;
  for (long long i = 1; i < N; i++)
    for (long long j = i + 1; j < N; j++) {
      a = j, b = i;
      long long t = a * a + b * b;
      if (a != b && x % (a - b) == 0)
        if (x / (a - b) - t * t == a * b * (t - a * b)) {
          cout << a << " " << b;
          return 0;
        }
      a = j, b = -i;
      if (x % (a - b) == 0)
        if (x / (a - b) - t * t == a * b * (t - a * b)) {
          cout << a << " " << b;
          return 0;
        }
    }
  return -1;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
const long long INF = 1LL << 60;

int main() {
  int X;
  cin >> X;
  bool owari = 0;
  for (int i = -10000; i <= 10000; i++) {
    for (int j = -10000; j <= 10000; j++) {
      int A = pow(i, 5);
      int B = pow(j, 5);
      if (A - B == X) {
        cout << i << " " << j << endl;
        owari = 1;
        break;
      }
    }
    if (owari)
      break;
  }
}


Fixed submission:
#include <bits/stdc++.h>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
const long long INF = 1LL << 60;

int main() {
  int X;
  cin >> X;
  bool owari = 0;
  for (int i = -120; i <= 120; i++) {
    for (int j = -120; j <= 120; j++) {
      long long A = pow(i, 5);
      long long B = pow(j, 5);
      if (A - B == X) {
        cout << i << " " << j << endl;
        owari = 1;
        break;
      }
    }
    if (owari)
      break;
  }
}
Problem p02690 (C++)

Buggy submission (status: Runtime Error):
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define db(x) cerr << __LINE__ << ": " << #x << " = " << (x) << '\n'
const int N = 1e6;

int main() {
  ios_base::sync_with_stdio(0);
  ll a, b, n, x, T, cas = 0;
  cin >> x;
  a = 0, b = 0;
  for (ll i = -100; i <= 100; ++i) {
    ll p = i * i * i * i * i;
    ll q = p - x;
    ll t = q;
    // cerr<<p<<" "<<q;
    int neg = 0;
    if (q < 0) {
      neg = 1;
      q *= -1;
    }
    ll r = pow(q, 1.0 / 5);
    if (neg)
      r *= -1;
    // cerr<<r<<endl;
    if (r * r * r * r * r == t) {
      a = i, b = r;
      // if(neg) b*=-1;
      break;
    }
  }
  if (a == 0 && b == 0)
    assert(a != 0);
  cout << a << " " << b << endl;
  return 0;
}

Fixed submission:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define db(x) cerr << __LINE__ << ": " << #x << " = " << (x) << '\n'
const int N = 1e6;

int main() {
  ios_base::sync_with_stdio(0);
  ll a, b, n, x, T, cas = 0;
  cin >> x;
  a = 0, b = 0;
  for (ll i = -1000; i <= 1000; ++i) {
    ll p = i * i * i * i * i;
    ll q = p - x;
    ll t = q;
    // cerr<<p<<" "<<q;
    int neg = 0;
    if (q < 0) {
      neg = 1;
      q *= -1;
    }
    ll r = pow(q, 1.0 / 5);
    if (neg)
      r *= -1;
    // cerr<<r<<endl;
    if (r * r * r * r * r == t) {
      a = i, b = r;
      // if(neg) b*=-1;
      break;
    }
  }
  if (a == 0 && b == 0)
    assert(a != 0);
  cout << a << " " << b << endl;
  return 0;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll GCD(ll a, ll b) { return a ? GCD(b % a, a) : b; }
int main() {
  ll x;
  cin >> x;
  for (ll i = -1e4; i <= 1e4; i++) {
    for (ll j = -1e4; j <= 1e4; j++) {
      if (pow(i, 5) - pow(j, 5) == x) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
}

Fixed submission:
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll GCD(ll a, ll b) { return a ? GCD(b % a, a) : b; }
int main() {
  ll x;
  cin >> x;
  for (ll i = -1e3; i <= 1e3; i++) {
    for (ll j = -1e3; j <= 1e3; j++) {
      if (pow(i, 5) - pow(j, 5) == x) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;

int X;

vector<int> factor(int n) {
  vector<int> x;
  for (int i = 2; i <= n; i++) {
    while (n % i == 0) {
      x.push_back(i);
      n /= i;
    }
  }
  return x;
}

int pow(int a, int b) {
  int ans = 1;
  while (b--) {
    ans *= a;
  }
  return ans;
}

void solve() {
  vector<int> f = factor(X);
  int bit = 0;

  while (1) {
    bit++;
    if (bit > pow(2, f.size())) {
      break;
    }

    int x = 1;
    for (int i = 0; i < f.size(); i++) {
      if (bit & (2 << i)) {
        x *= f[i];
      }
    }
    int y = X / x;

    long long a = x, b;
    if (x > y || a > 177) {
      continue;
    }
    while (1) {
      a--;
      b = a - x;
      if (a - b < 0) {
        break;
      }
      if (a * a * a * a * a - b * b * b * b * b == X) {
        cout << a << " " << b << endl;
        return;
      }
    }
  }
}

int main() {
  cin >> X;
  solve();
  return 0;
}


Fixed submission:
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;

int X;

vector<int> factor(int n) {
  vector<int> x;
  for (int i = 2; i <= n; i++) {
    while (n % i == 0) {
      x.push_back(i);
      n /= i;
    }
  }
  return x;
}

int pow(int a, int b) {
  int ans = 1;
  while (b--) {
    ans *= a;
  }
  return ans;
}

void solve() {
  vector<int> f = factor(X);
  int bit = 0;

  for (long long a = -178; a <= 178; a++) {
    for (long long b = -178; b <= 178; b++) {
      if (a * a * a * a * a - b * b * b * b * b == X) {
        cout << a << " " << b << endl;
        return;
      }
    }
  }
}

int main() {
  cin >> X;
  solve();
  return 0;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
typedef long long ll;
using namespace std;

int main() {
  ll x;
  cin >> x;
  ll root = pow(x, 1 / 5);

  ll ans_a = 0;
  ll ans_b = 0;
  bool flg = false;

  rep(i, 100000) {
    rep(j, 100000) {
      // if(x>=pow(root+i, 5)-pow(j, 5) && x<=pow(root+i, 5)-pow(-j, 5))break;

      if (x == pow(root + i, 5) - pow(j, 5)) {
        ans_a = root + i;
        ans_b = j;
        flg = true;
      }
      if (x == pow(root + i, 5) - pow(-j, 5)) {
        ans_a = root + i;
        ans_b = -j;
        flg = true;
      }
      if (x == pow(root - i, 5) - pow(j, 5)) {
        ans_a = root - i;
        ans_b = j;
        flg = true;
      }
      if (x == pow(root - i, 5) - pow(-j, 5)) {
        ans_a = root - i;
        ans_b = -j;
        flg = true;
      }
      if (flg)
        break;
    }
    if (flg)
      break;
  }

  cout << ans_a << " " << ans_b << endl;
}

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
typedef long long ll;
using namespace std;

int main() {
  ll x;
  cin >> x;
  ll root = pow(x, 1 / 5);

  ll ans_a = 0;
  ll ans_b = 0;
  bool flg = false;

  rep(i, 10000) {
    rep(j, 10000) {
      if (x >= pow(root + i, 5) - pow(j, 5) &&
          x <= pow(root - i, 5) - pow(-j, 5))
        break;

      if (x == pow(root + i, 5) - pow(j, 5)) {
        ans_a = root + i;
        ans_b = j;
        flg = true;
      }
      if (x == pow(root + i, 5) - pow(-j, 5)) {
        ans_a = root + i;
        ans_b = -j;
        flg = true;
      }
      if (x == pow(root - i, 5) - pow(j, 5)) {
        ans_a = root - i;
        ans_b = j;
        flg = true;
      }
      if (x == pow(root - i, 5) - pow(-j, 5)) {
        ans_a = root - i;
        ans_b = -j;
        flg = true;
      }
      if (flg)
        break;
    }
    if (flg)
      break;
  }

  cout << ans_a << " " << ans_b << endl;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main() {
  ll x;
  cin >> x;
  ll ansa = 0, ansb = 0;
  for (ll i = 0; i < 10000; i++) {
    for (ll j = 0; j < 10000; j++) {
      if (pow(i, 5) - pow(j, 5) == x) {
        ansa = i;
        ansb = j;
        break;
      } else if (pow(i, 5) + pow(j, 5) == x) {
        ansa = i;
        ansb = 0 - j;
        break;
      }
    }
  }
  cout << ansa << ' ' << ansb << endl;
}


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

typedef long long ll;

int main() {
  ll x;
  cin >> x;
  ll ansa = 0, ansb = 0;
  for (ll i = 0; i < 1000; i++) {
    for (ll j = 0; j < 1000; j++) {
      if (pow(i, 5) - pow(j, 5) == x) {
        ansa = i;
        ansb = j;
        break;
      } else if (pow(i, 5) + pow(j, 5) == x) {
        ansa = i;
        ansb = 0 - j;
        break;
      }
    }
  }
  cout << ansa << ' ' << ansb << endl;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;

int main() {
  long long x;
  cin >> x;
  long long mi, mi2;
  for (int i = 1; i < 40000; i++) {
    if (x % i == 0) {
      long long y = x / i;
      for (long long j = 0; j < y; j++) {
        mi = j - i;
        mi2 = mi * mi;
        if (j * j * j * j + j * j * j * mi + j * j * mi2 + j * mi * mi2 +
                mi2 * mi2 ==
            y) {
          printf("%lld %lld\n", j, mi);
          return 0;
        }
      }
    }
  }
}

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

int main() {
  long long x;
  cin >> x;
  long long mi, mi2;
  for (int i = 1; i < 40000; i++) {
    if (x % i == 0) {
      long long y = x / i;
      long long start = sqrt(sqrt(y));
      for (long long j = start; j > 0; j--) {
        mi = j - i;
        mi2 = mi * mi;
        if (j * j * j * j + j * j * j * mi + j * j * mi2 + j * mi * mi2 +
                mi2 * mi2 ==
            y) {
          printf("%lld %lld\n", j, mi);
          return 0;
        }
      }
    }
  }
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define set_bits(a) __builtin_popcount(a)
#define pb push_back
#define pf push_front
#define mod 1000000007
#define M 998244353
#define fi first
#define se second
#define endl '\n'
#define INF 1e18
#define PI 3.14159265358979323846
#define fast                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);

int main() {
  ll x;
  cin >> x;

  vector<ll> v;
  ll i;
  map<ll, ll> m;
  map<ll, ll> mp;
  for (i = -1000000; i <= 1000000; i++) {
    ll x = i * i * i * i * i;
    mp[x]++;
    v.pb(x);
    m[x] = i;
  }
  ll a1, a2;
  if (x == 1) {
    cout << "0"
         << " "
         << "-1" << endl;
    exit(0);
  }

  for (i = 0; i < v.size(); i++) {
    ll p = v[i] - x;

    if (mp.find(p) != mp.end()) {
      a1 = m[v[i]];
      a2 = m[p];
      break;
    }
  }

  cout << a1 << " " << a2 << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define set_bits(a) __builtin_popcount(a)
#define pb push_back
#define pf push_front
#define mod 1000000007
#define M 998244353
#define fi first
#define se second
#define endl '\n'
#define INF 1e18
#define PI 3.14159265358979323846
#define fast                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);

int main() {
  ll x;
  cin >> x;

  vector<ll> v;
  ll i;
  map<ll, ll> m;
  map<ll, ll> mp;
  for (i = -100000; i <= 100000; i++) {
    ll x = i * i * i * i * i;
    mp[x]++;
    v.pb(x);
    m[x] = i;
  }
  ll a1, a2;
  if (x == 1) {
    cout << "0"
         << " "
         << "-1" << endl;
    exit(0);
  }

  for (i = 0; i < v.size(); i++) {
    ll p = v[i] - x;

    if (mp.find(p) != mp.end()) {
      a1 = m[v[i]];
      a2 = m[p];
      break;
    }
  }

  cout << a1 << " " << a2 << endl;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  ll x;
  cin >> x;
  ll judge = 0;
  for (ll i = -10000; i < 10000; i++) {
    for (ll j = -10000; j < 10000; j++) {
      ll i5 = pow(i, 5);
      ll j5 = pow(j, 5);
      if (i5 - j5 == x) {
        cout << i << " " << j << endl;
        judge = 1;
        break;
      }
    }
    if (judge == 1) {
      break;
    }
  }
}

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

int main() {
  ll x;
  cin >> x;
  ll judge = 0;
  for (ll i = -1000; i < 1000; i++) {
    for (ll j = -1000; j < 1000; j++) {
      ll i5 = pow(i, 5);
      ll j5 = pow(j, 5);
      if (i5 - j5 == x) {
        cout << i << " " << j << endl;
        judge = 1;
        break;
      }
    }
    if (judge == 1) {
      break;
    }
  }
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#define int long long int
using namespace std;

int X;

signed main() {
  cin >> X;
  for (int i = -200; i <= 200; i++) {
    for (int j = -200; j = 200; j++) {
      if (i * i * i * i * i - j * j * j * j * j == X) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
}

Fixed submission:
#include <iostream>
#define int long long int
using namespace std;

int X;

signed main() {
  cin >> X;
  for (int i = -200; i <= 200; i++) {
    for (int j = -200; j <= 200; j++) {
      if (i * i * i * i * i - j * j * j * j * j == X) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <stdio.h>
#include <utility>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, string> P;

int main() {
  int x;
  cin >> x;
  long long ans = 0;
  for (int i = -10000; i <= 10000; i++) {
    for (int j = -10000; j <= 10000; j++) {

      ans = pow(i, 5) - pow(j, 5);
      if (ans == x) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
}


Fixed submission:
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <stdio.h>
#include <utility>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, string> P;

int main() {
  int x;
  cin >> x;
  long long ans = 0;
  for (int i = -1000; i <= 1000; i++) {
    for (int j = -1000; j <= 1000; j++) {

      ans = pow(i, 5) - pow(j, 5);
      if (ans == x) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
#include <list>
#include <string>
#include <vector>

using namespace std;

int main() {
  long long x;
  cin >> x;
  for (long a = 0;; a++) {
    for (long b = 0; b >= -1000000000; b--) {
      long long c = (a * a * a * a * a) - (b * b * b * b * b);
      if (x == c) {
        cout << a << " " << b << endl;
        return 0;
      }
    }
  }
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <list>
#include <string>
#include <vector>

using namespace std;

int main() {
  long long x;
  cin >> x;
  for (long a = -1000;; a++) {
    for (long b = 0; b >= -1000; b--) {
      long long c = (a * a * a * a * a) - (b * b * b * b * b);
      if (x == c) {
        cout << a << " " << b << endl;
        return 0;
      }
    }
  }
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (n); i < (m); i++)
#define rrep(i, n, m) for (int i = (n)-1; i >= (m); i--)
#define pvec(vec)                                                              \
  {                                                                            \
    for (auto v : vec)                                                         \
      cout << v << ' ';                                                        \
    cout << endl;                                                              \
  }
#define pivec(vec)                                                             \
  {                                                                            \
    rep(i, 0, vec.size()) cout << i << ':' << vec[i] << ' ';                   \
    cout << endl;                                                              \
  }

using namespace std;
using ll = long long;

unordered_map<ll, int> value5;
void init() {
  ll num = 0;
  for (;;) {
    ll now = num * num * num * num * num;
    if (now < 0)
      break;
    value5[now] = num++;
  }
  unordered_map<ll, int> new_value5(value5);
  for (auto v : value5)
    new_value5[-v.first] = -v.second;
  swap(value5, new_value5);
}

int main() {
  init();
  ll x;
  cin >> x;
  ll num = 0;
  for (;;) {
    ll now = num * num * num * num * num;
    ll tgt = now - x;
    if (value5.count(tgt) > 0) {
      cout << num << ' ' << value5[tgt] << endl;
      return 0;
    }
    // cout << num << endl;
    ++num;
  }
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (n); i < (m); i++)
#define rrep(i, n, m) for (int i = (n)-1; i >= (m); i--)
#define pvec(vec)                                                              \
  {                                                                            \
    for (auto v : vec)                                                         \
      cout << v << ' ';                                                        \
    cout << endl;                                                              \
  }
#define pivec(vec)                                                             \
  {                                                                            \
    rep(i, 0, vec.size()) cout << i << ':' << vec[i] << ' ';                   \
    cout << endl;                                                              \
  }

using namespace std;
using ll = long long;

unordered_map<ll, int> value5;
void init() {
  ll num = 0;
  for (;;) {
    ll now = num * num * num * num * num;
    if (now > 100000000000)
      break;
    value5[now] = num++;
  }
  unordered_map<ll, int> new_value5(value5);
  for (auto v : value5)
    new_value5[-v.first] = -v.second;
  swap(value5, new_value5);
}

int main() {
  init();
  ll x;
  cin >> x;
  ll num = 0;
  for (;;) {
    ll now = num * num * num * num * num;
    ll tgt = now - x;
    if (value5.count(tgt) > 0) {
      cout << num << ' ' << value5[tgt] << endl;
      return 0;
    }
    // cout << num << endl;
    ++num;
  }
  return 0;
}
Problem p02690 (C++)

Buggy submission (status: Runtime Error):
#include <cstdio>

int main() {
  int X;
  scanf("%d", X);
  for (int A = 0; A < 1000; ++A)
    for (int B = -1000; B < A; ++B)
      if (A * A * A * A * A - B * B * B * B * B == X) {
        printf("%d %d", A, B);
        return 0;
      }
}

Fixed submission:
#include <cstdio>

int main() {
  int X;
  scanf("%d", &X);
  for (int A = 0; A < 1000; ++A)
    for (int B = -1000; B < A; ++B)
      if (A * A * A * A * A - B * B * B * B * B == X) {
        printf("%d %d", A, B);
        return 0;
      }
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define FASTIO
using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

template <typename _Ty> _Ty bpow(_Ty a, int64_t n) {
  _Ty res = 1;
  for (; n > 0; n >>= 1) {
    if (n & 1)
      res *= a;
    a *= a;
  }
  return res;
}

void solve() {
  ll X;
  cin >> X;

  Vl pow5(101);
  for (ll i = 0; i < 101; i++) {
    pow5[i] = bpow(i, 5);
  }

  ll a, b;
  b = 0;
  while (true) {
    ll idx =
        lower_bound(pow5.begin(), pow5.end(), X + bpow(b, 5)) - pow5.begin();
    if (bpow(idx, 5) - bpow(b, 5) == X) {
      a = idx;
      break;
    }

    idx = lower_bound(pow5.begin(), pow5.end(), X - bpow(b, 5)) - pow5.begin();
    if (bpow(idx, 5) + bpow(b, 5) == X) {
      a = idx;
      b = -b;
      break;
    }

    ++b;
  }

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

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
  cin.tie(0), cout.tie(0);
  ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
  ifstream ifs("./in_out/input.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
  ofstream ofs("./in_out/output.txt");
  cout.rdbuf(ofs.rdbuf());
#endif
  solve();
  cout << flush;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define FASTIO
using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

template <typename _Ty> _Ty bpow(_Ty a, int64_t n) {
  _Ty res = 1;
  for (; n > 0; n >>= 1) {
    if (n & 1)
      res *= a;
    a *= a;
  }
  return res;
}

void solve() {
  ll X;
  cin >> X;

  ll mx = 6209;

  Vl pow5(mx);
  for (ll i = 0; i < mx; i++) {
    pow5[i] = bpow(i, 5);
  }

  ll a, b;
  b = 0;
  while (true) {
    ll idx =
        lower_bound(pow5.begin(), pow5.end(), X + bpow(b, 5)) - pow5.begin();
    if (bpow(idx, 5) - bpow(b, 5) == X) {
      a = idx;
      break;
    }

    idx = lower_bound(pow5.begin(), pow5.end(), X - bpow(b, 5)) - pow5.begin();
    if (bpow(idx, 5) + bpow(b, 5) == X) {
      a = idx;
      b = -b;
      break;
    }

    ++b;
  }

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

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
  cin.tie(0), cout.tie(0);
  ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
  ifstream ifs("./in_out/input.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
  ofstream ofs("./in_out/output.txt");
  cout.rdbuf(ofs.rdbuf());
#endif
  solve();
  cout << flush;
  return 0;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
int main() {
  int x, limit;
  cin >> x;
  limit = pow(x, 1.0 / 5.0);
  for (int i = 0; i <= limit; i++) {
    for (int j = 0; j >= -limit; j--) {
      if (x == pow(i, 5) - pow(j, 5)) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
  for (long long i = limit;; i++) {
    for (long long j = 0;; j++) {
      if (x == pow(i, 5) - pow(j, 5)) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
int main() {
  int x, limit;
  cin >> x;
  limit = pow(x, 1.0 / 5.0);
  for (int i = 0; i <= limit; i++) {
    for (int j = 0; j >= -limit; j--) {
      if (x == pow(i, 5) - pow(j, 5)) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
  for (long long i = limit;; i++) {
    for (long long j = 0; j < i; j++) {
      if (x == pow(i, 5) - pow(j, 5)) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin >> a;
  for (long long i = -3981; i <= 3981; i++)
    for (long long n = -3981; n <= 3981; n++)
      if ((pow(i, 5)) - (pow(n, 5)) == a) {
        cout << i << " " << n;
        return 0;
      }
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin >> a;
  for (long long i = -1000; i <= 1000; i++)
    for (long long n = -1000; n <= 1000; n++)
      if ((pow(i, 5)) - (pow(n, 5)) == a) {
        cout << i << " " << n;
        return 0;
      }
  return 0;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int, int> P;

int main() {
  ll x;
  cin >> x;

  ll a5, b5;
  for (int i = -10000; i <= 10000; i++) {
    for (int j = -10000; j <= 10000; j++) {
      if (pow(i, 5) - pow(j, 5) == x) {
        printf("%d %d\n", i, j);
        return 0;
      }
    }
  }

  return 0;
}

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

int main() {
  ll x;
  cin >> x;

  ll a5, b5;
  for (int i = -1000; i <= 1000; i++) {
    for (int j = -1000; j <= 1000; j++) {
      if (pow(i, 5) - pow(j, 5) == x) {
        printf("%d %d\n", i, j);
        return 0;
      }
    }
  }

  return 0;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main() {
  LLONG X;
  cin >> X;
  set<LLONG> divs;
  for (LLONG d = 1; d * d <= X; ++d) {
    if (X % d == 0) {
      divs.insert(d);
      divs.insert(X / d);
      divs.insert(-d);
      divs.insert(-X / d);
    }
  }
  for (const LLONG d : divs) {
    LLONG X2 = X / d - d * d * d * d;
    if (X2 % 5 == 0) {
      X2 /= 5;
      if (X2 == 0) {
        cout << d << ' ' << 0 << endl;
        return 0;
      }
      set<LLONG> BCands;
      for (LLONG B = 1; B * B <= abs(X2); ++B) {
        if (abs(X2) % B == 0) {
          for (LLONG b : {B, X2 / B, -B, -X2 / B}) {
            LLONG X3 = X2 / b - d * d * d;
            if (b * b * b + 2 * d * b * b + 2 * d * d * b == X3) {
              cout << b + d << ' ' << b << endl;
              return 0;
            }
          }
        }
      }
    }
  }
}


Fixed submission:
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main() {
  LLONG X;
  cin >> X;
  set<LLONG> divs;
  for (LLONG d = 1; d * d <= X; ++d) {
    if (X % d == 0) {
      divs.insert(d);
      divs.insert(X / d);
      // divs.insert(-d);
      // divs.insert(-X / d);
    }
  }
  for (const LLONG d : divs) {
    LLONG X2 = X / d - d * d * d * d;
    if (X2 % 5 == 0) {
      X2 /= 5;
      if (X2 == 0) {
        cout << d << ' ' << 0 << endl;
        return 0;
      }
      set<LLONG> BCands;
      for (LLONG B = 1; B * B <= abs(X2); ++B) {
        if (abs(X2) % B == 0) {
          for (LLONG b : {B, X2 / B, -B, -X2 / B}) {
            LLONG X3 = X2 / b - d * d * d;
            if (b * b * b + 2 * d * b * b + 2 * d * d * b == X3) {
              cout << b + d << ' ' << b << endl;
              return 0;
            }
          }
        }
      }
    }
  }
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <algorithm>
#include <bitset>
#include <cfenv>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

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

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;

ll pow5(ll x) { return x * x * x * x * x; }

int main() {
  ll x;
  cin >> x;

  for (ll i = 0;; i++) {
    ll b = abs(pow5(i) - x);
    double b0 = pow((double)b, 0.2);
    if (ceil(b0) == floor(b0)) {
      println(i << " " << -(ll)b0);
      break;
    }
  }
}


Fixed submission:
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <algorithm>
#include <bitset>
#include <cfenv>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

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

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;

ll pow5(ll x) { return x * x * x * x * x; }

int main() {
  ll x;
  cin >> x;

  for (ll i = 1; i < 200; i++) {
    for (ll j = 0; j < 200; j++) {
      for (ll k = 0; k < 200; k++) {
        if (pow5(j) - pow5(k - i) == x) {
          println(j << " " << k - i);
          return 0;
        }
      }
    }
  }
}