alexjercan/bugnet huggingface dataset:
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 < 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;
}

Error: TLE

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 = -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;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n, k) (((ll)n >> (ll)k) & 1) /*nのk bit目*/
const long long INF = 1e+18 + 1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
const ll MOD = 1000000007LL;
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vl dx = {-1, -1, -1, 0, 0, 1, 1, 1};
vl dy = {1, -1, 0, 1, -1, 1, 0, -1};
// 約数の列挙O(√n)
vector<ll> divisor(ll n) {
  vector<ll> res;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      res.push_back(i);
      if (i != n / i)
        res.push_back(n / i);
    }
  }
  return res;
}
int main() {
  ll x;
  cin >> x;
  vl vec = divisor(x);
  for (auto d : vec) {
    for (ll b = -d / 2 + 1;
         abs((b + d) * (b + d) * (b + d) * (b + d) * (b + d) -
             b * b * b * b * b) <= x;
         b++) {
      if ((b + d) * (b + d) * (b + d) * (b + d) * (b + d) - b * b * b * b * b ==
          x) {
        cout << b + d << " " << b << endl;
        return 0;
      }
    }
    for (ll b = -d / 2; abs((b + d) * (b + d) * (b + d) * (b + d) * (b + d) -
                            b * b * b * b * b) <= x;
         b--) {
      if ((b + d) * (b + d) * (b + d) * (b + d) * (b + d) - b * b * b * b * b ==
          x) {
        cout << b + d << " " << b << endl;
        return 0;
      }
    }
  }
}


Error: TLE

Fixed submission:

// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n, k) (((ll)n >> (ll)k) & 1) /*nのk bit目*/
const long long INF = 1e+18 + 1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
const ll MOD = 1000000007LL;
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vl dx = {-1, -1, -1, 0, 0, 1, 1, 1};
vl dy = {1, -1, 0, 1, -1, 1, 0, -1};
// 約数の列挙O(√n)
vector<ll> divisor(ll n) {
  vector<ll> res;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      res.push_back(i);
      if (i != n / i)
        res.push_back(n / i);
    }
  }
  return res;
}
int main() {
  ll x;
  cin >> x;
  vl vec = divisor(x);
  for (auto d : vec) {
    for (ll b = 0;
         (b + d) * (b + d) * (b + d) * (b + d) * (b + d) - b * b * b * b * b <=
         x;
         b++) {
      if ((b + d) * (b + d) * (b + d) * (b + d) * (b + d) - b * b * b * b * b ==
          x) {
        cout << b + d << " " << b << endl;
        return 0;
      }
    }
    for (ll b = 0;
         b + d >= 0 || abs((b + d) * (b + d) * (b + d) * (b + d) * (b + d) -
                           b * b * b * b * b) <= x;
         b--) {
      if ((b + d) * (b + d) * (b + d) * (b + d) * (b + d) - b * b * b * b * b ==
          x) {
        cout << b + d << " " << b << endl;
        return 0;
      }
    }
  }
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(a) (a).begin(), (a).end()
typedef vector<int> vi;
const int INF = 1LL << 58;
const int MOD = 1000000007;
const int MAX_N = 200100;

int tim(int b) { return b * b * b * b * b; }

// index が条件を満たすかどうか
bool isOK(int index, int key) {
  if (tim(index) >= key)
    return true;
  else
    return false;
}

int solve(int key) {
  int left = -1000; // 「index = 0」が条件を満たすこともあるので、初期値は -1
  int right =
      1000; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は
            // a.size()

  /* どんな二分探索でもここの書き方を変えずにできる！ */
  while (right - left > 1) {
    int mid = left + (right - left) / 2;
    int tmp = tim(mid);
    if (tmp == key) {
      return mid;
    }
    if (tmp > key)
      right = mid;
    else
      left = mid;
  }

  /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている
   */
  return right;
}

signed main() {
  //  以降 cin の入力元が 'input.txt' になる
  // std::ifstream in("input.txt");
  // std::cin.rdbuf(in.rdbuf());
  int X;
  cin >> X;
  int a, b;
  b = -1000;
  while (1) {
    a = solve(X + tim(b));
    if (tim(a) - tim(b) == X) {
      cout << a << " " << b;
      break;
    }
    b++;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(a) (a).begin(), (a).end()
typedef vector<int> vi;
const int INF = 1LL << 58;
const int MOD = 1000000007;
const int MAX_N = 200100;

int tim(int b) { return b * b * b * b * b; }

// index が条件を満たすかどうか
bool isOK(int index, int key) {
  if (tim(index) >= key)
    return true;
  else
    return false;
}

int solve(int key) {
  int left = -100; // 「index = 0」が条件を満たすこともあるので、初期値は -1
  int right =
      100; // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は
           // a.size()

  /* どんな二分探索でもここの書き方を変えずにできる！ */
  while (right - left > 1) {
    int mid = left + (right - left) / 2;
    int tmp = tim(mid);
    if (tmp == key) {
      return mid;
    }
    if (tmp > key)
      right = mid;
    else
      left = mid;
  }

  /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている
   */
  return right;
}

signed main() {
  //  以降 cin の入力元が 'input.txt' になる
  // std::ifstream in("input.txt");
  // std::cin.rdbuf(in.rdbuf());
  int X;
  cin >> X;
  int a, b;
  b = -100;
  while (1) {
    a = solve(X + tim(b));
    if (tim(a) - tim(b) == X) {
      cout << a << " " << b;
      break;
    }
    b++;
  }

  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(v) v.begin(), v.end()
#define int long long
#define _GLIBCXX_DEBUG

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

  int b = 0;

  while (true) {
    int x = X - (int)(pow(b, 5));
    int a = 1;
    while (pow(a, 5) < x) {
      a++;
    }
    if (pow(a, 5) == x) {
      cout << a << " " << -b << endl;
      return 0;
    }
    x = X + (int)(pow(b, 5));
    while (pow(a, 5) < x) {
      a++;
    }
    if (pow(a, 5) == x) {
      cout << a << " " << b << endl;
      return 0;
    }
    b++;
  }
}

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(v) v.begin(), v.end()
#define int long long
#define _GLIBCXX_DEBUG

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

  int b = 0;

  while (true) {
    double a = pow(X + pow(b, 5), 0.2);
    if (a - (int)(a) == 0) {
      cout << a << " " << b << endl;
      return 0;
    }
    a = pow(X - pow(b, 5), 0.2);
    if (a - (int)(a) == 0) {
      cout << a << " " << -b << endl;
      return 0;
    }
    b++;
  }
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
typedef long long int ll;
void sayYes() { cout << "Yes" << endl; };
void sayNo() { cout << "No" << endl; };
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } // 最大公約数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); };    // 最小公倍数
ll getDigit(ll num) { return log10(num) + 1; }       // 桁数
ll digitSum(ll n) {
  return (n < 10) ? n : digitSum(n / 10) + n % 10;
} // 各桁の和
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repn(i, n) for (ll i = 1; i <= n; i++)

bool is_integer(long double x) { return std::floor(x) == x; }

void Main() {
  // int n;
  // cin >> n;
  // vector<int> a(n);
  // rep(i, n)
  // {
  //     cin >> a[i];
  // }

  ll x;
  cin >> x;
  ll a, b;
  for (a = -1000; a <= 1000; ++a) {
    for (b = -1000; b <= 1000; ++b) {
      if (x == (ll)(pow(a, 5) - pow(b, 5)))
        break;
    }

    if (x == (ll)(pow(a, 5) - pow(b, 5)))
      break;
  }
  cout << a << " " << b << endl;
  return;
}

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


Error: TLE

Fixed submission:

#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
typedef long long int ll;
void sayYes() { cout << "Yes" << endl; };
void sayNo() { cout << "No" << endl; };
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } // 最大公約数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); };    // 最小公倍数
ll getDigit(ll num) { return log10(num) + 1; }       // 桁数
ll digitSum(ll n) {
  return (n < 10) ? n : digitSum(n / 10) + n % 10;
} // 各桁の和
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repn(i, n) for (ll i = 1; i <= n; i++)

bool is_integer(long double x) { return std::floor(x) == x; }

void Main() {
  // int n;
  // cin >> n;
  // vector<int> a(n);
  // rep(i, n)
  // {
  //     cin >> a[i];
  // }

  ll x;
  cin >> x;

  long double a = 0;
  ll b = 0;
  ll i = 0;
  long double j = 2 * (pow(x, 1.0 / 5.0) - 1);

  while (1) {
    b = pow(-1, i) * (ll)j;

    a = pow((long double)(x + pow(b, 5)), 1.0 / 5.0);
    if (is_integer(a))
      break;

    i++;
    j += 0.5;
  }

  cout << (ll)a << " " << b << endl;
  return;
}

signed main(void) {
  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: Runtime Error

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 5;

long long x;

int main() {
  scanf("%lld", &x);
  long long ansA = 1e18;
  long long ansB = -1;
  for (long long i = -1000; i <= 1000; i++) {
    for (long long j = -1000; j <= 1000; j++) {
      if (i * i * i * i * i - j * j * j * j * j == x) {
        ansA = i;
        ansB = j;
        break;
      }
    }
    if (ansA != 1e18)
      break;
  }
  assert(ansA != 1e18);
  printf("%lld %lld\\n", ansA, ansB);
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 5;

long long x;

int main() {
  scanf("%lld", &x);
  long long ansA = 1e18;
  long long ansB = -1;
  for (long long i = -100; i <= 100; i++) {
    for (long long j = -100; j <= 100; j++) {
      if (i * i * i * i * i - j * j * j * j * j == x) {
        ansA = i;
        ansB = j;
        break;
      }
    }
    if (ansA != 1e18)
      break;
  }
  assert(ansA != 1e18);
  printf("%lld %lld\\n", ansA, ansB);
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using boost::multiprecision::cpp_int;
using namespace std;

#if __has_include("print.hpp")
#include "print.hpp"
#endif

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll x;
  cin >> x;
  for (int i = -1000; i < 1000; ++i) {
    for (int j = -1000; j < 1000; ++j) {
      if (pow(i, 5) - pow(j, 5) == x) {
        cout << i << ' ' << j << endl;
        return 0;
      }
    }
  }
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using boost::multiprecision::cpp_int;
using namespace std;

#if __has_include("print.hpp")
#include "print.hpp"
#endif

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll x;
  cin >> x;
  for (int i = -3000; i < 3000; ++i) {
    for (int j = -3000; j < 3000; ++j) {
      if (pow(i, 5) - pow(j, 5) == x) {
        cout << i << ' ' << j << endl;
        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 reps(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
using ll = long long;
const ll MOD = 1e9 + 7;
const long long INF = 1LL << 60;

void solve(ll x) {
  for (ll a = -1000; a <= 1000; a++) {
    for (ll b = -1000; b <= 1000; b++) {
      if (a * a * a * a * a - b * b * b * b * b == x) {
        cout << a << " " << b << endl;
        return;
      }
    }
  }
  return;
}

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

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
using ll = long long;
const ll MOD = 1e9 + 7;
const long long INF = 1LL << 60;

vector<long long> enum_divisors(long long N) {
  vector<long long> res;
  for (long long i = 1; i * i <= N; ++i) {
    if (N % i == 0) {
      res.push_back(i);
      // 重複しないならば i の相方である N/i も push
      if (N / i != i)
        res.push_back(N / i);
    }
  }
  // 小さい順に並び替える
  sort(res.begin(), res.end());
  return res;
}

void solve(ll x) {
  const auto &res = enum_divisors(x);
  for (int i = 0; i < res.size(); ++i) {
    ll x1 = res[i], x2 = x / res[i];

    for (ll b = -x1; b < x1; b++) {
      ll a = x1 + b;
      if (a * a * a * a + a * a * a * b + a * a * b * b + a * b * b * b +
              b * b * b * b ==
          x2) {
        cout << a << " " << b << endl;
        return;
      }
    }
  }
  return;
}

int main() {
  ll x;
  cin >> x;
  solve(x);
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define ll long long int
#define mi -1000
#define ma 1000
using namespace std;

void solve() {
  ll n;
  cin >> n;
  for (ll i = mi; i < ma; i++) {
    for (ll j = mi; j < ma; j++) {
      if (pow(i, 5) - pow(j, 5) == n) {
        cout << i << " " << j << endl;
        return;
      }
    }
  }
}

int main() {
  solve();
  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  int n;
  cin >> n;
  int i = 0, j = 0;
  bool k = false;
  for (i = (-n); i < n; i++) {
    for (j = (-n); j < n; j++) {

      if ((pow(i, 5) - pow(j, 5)) == n)
        k = true;
      if (k)
        break;
    }
    if (k)
      break;
  }
  cout << i << " " << j;
  return 0;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i, j, flag = 0;
  ;
  scanf("%lld", &n);
  for (i = -200; i <= 200; i++) {
    for (j = -200; j <= 200; j++) {
      if (pow(i, 5) - pow(j, 5) == n) {
        flag = 1;
        printf("%lld %lld\\n", i, j);
        break;
      }
    }
    if (flag)
      break;
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i, j, flag = 0;
  scanf("%lld", &n); // printf("%lf %lf ",pow(n,1/2),pow(n,1/5));
  for (i = 0; i <= sqrt(n); i++) {
    for (j = 0; j >= -sqrt(n); j--) {

      if (pow(i, 5) - pow(j, 5) == n) {
        printf("%lld %lld", i, j);
        flag = 1;
        break;
      }
    }
    if (flag)
      break;
  }
}
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 = -200;; ++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;
}


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;
#define MOD 1000000007
vector<int> vt;
set<int> st;
map<int, int> mp;
unordered_map<string, int> umap;
const long long MAX = 1e5;
const long long INF = 1e9;
const double pi = acos(-1);

int main() {

  int x;
  cin >> x;
  for (long long int i = -2000; i <= 2000; i++)
    for (long long int j = -2000; j <= 2000; j++) {
      if (i * i * i * i * i == j * j * j * j * j + x) {
        cout << i << " " << j << endl;
        exit(0);
      }
    }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
vector<int> vt;
set<int> st;
map<int, int> mp;
unordered_map<string, int> umap;
const long long MAX = 1e5;
const long long INF = 1e9;
const double pi = acos(-1);

int main() {

  int x;
  cin >> x;
  for (int i = -2000; i <= 2000; i++)
    for (int j = -2000; j <= 2000; j++) {
      if ((int)pow(i, 5) == (int)pow(j, 5) + x) {
        cout << i << " " << j << endl;
        exit(0);
      }
    }
}
Problem p02690 (C++) — buggy submission, verdict: Runtime Error

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

long long X;

int main() {
  cin >> X;
  map<long long, long long> mapi;

  for (long long i = -1000; i < 1000; i++) {
    long long count = i;
    for (long long j = 0; j < 4; j++) {
      count *= i;
    }
    mapi[i] = count;
  }

  for (long long i = -1000; i < 1000; i++) {
    for (long long j = -1000; j < 1000; j++) {
      if (mapi[i] - mapi[j] == X) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
  return 1;
}


Error: WA

Fixed submission:

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

long long X;

int main() {
  cin >> X;
  map<long long, long long> mapi;

  for (long long i = -105; i < 105; i++) {
    long long count = i;
    for (long long j = 0; j < 4; j++) {
      count *= i;
    }
    mapi[i] = count;
  }

  for (long long i = -105; i < 105; i++) {
    for (long long j = -105; j < 105; j++) {
      if (mapi[i] - mapi[j] == X) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
  return 1;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
using pp = pair<int, int>;
using ll = long long;

int main() {
  ll X;
  cin >> X;
  ll m;
  for (ll i = 1; i < 1000; i++) {
    if (i * i * i * i > X) {
      m = i - 1;
    }
  }
  ll A, B, fin = 0;
  for (ll b = -m; b <= 1000; b++) {
    for (ll a = b; a <= 1000; a++) {
      if (a * a * a * a * a - b * b * b * b * b == X) {
        A = a;
        B = b;
        fin = 1;
        break;
      }
    }
    if (fin == 1) {
      break;
    }
  }
  cout << A << " " << B << endl;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
using pp = pair<int, int>;
using ll = long long;

int main() {
  ll X;
  cin >> X;
  ll m;
  for (ll i = 2; i <= X; i++) {
    if (X % i == 0) {
      m = i;
      break;
    }
  }
  if (X == 1) {
    m = 1;
  }
  // cout << m << endl;

  ll a = 0, b = -m;
  while (true) {
    ll AB = m * (a * a * a * a + a * a * a * b + a * a * b * b + a * b * b * b +
                 b * b * b * b);
    if (AB == X) {
      break;
    }
    a++;
    b++;
  }
  cout << a << " " << b << endl;
}
Problem p02690 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using ll = long long;
using namespace std;

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

  ll x;
  cin >> x;
  for (int a = -118; a < 120; a++) {
    for (int b = -119; b < 129; b++) {
      if (pow(a, 5) - pow(b, 5) == x) {
        cout << a << " " << b;
        return 0;
      }
    }
  }

  return 0;
}

Error: -11

Fixed submission:

#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using ll = long long;
using namespace std;

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

  int x;
  cin >> x;

  vector<ll> p;
  for (int i = -1000; i <= 1000; i++) {
    p[i] = pow(i, 5);
  }
  bool f = false;
  for (int i = -1000; i <= 1000; i++) {
    for (int j = i + 1; j <= 1000; j++) {
      if (p[j] - p[i] == x) {
        cout << j << " " << i;
        f = true;
        break;
      }
    }
    if (f)
      break;
  }

  return 0;
}