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

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

#define int long long
#define INT int
#define MOD 1000000007

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T> void print(T x) { std::cout << x << '\\n'; }
typedef long long ll;

/* nの約数を求める関数*/
vector<int> enum_div(int n) // nの約数を列挙
{
  vector<int> divisor;
  for (int i = 1; i * i <= n; ++i) {
    if (n % i == 0) {
      divisor.push_back(i);
      if (i != 1 && i * i != n) {
        divisor.push_back(n / i);
      }
    }
  }
  return divisor;
}

int x;

bool fun(int A, int B) { return A * A * A * A * A - B * B * B * B * B == x; }

int fun2(int B, int P) {

  int temp = ((B + P) * (B + P) + B * B) - (B + P + B) * (B + P + P);
  int temp2 = (B + P) * B * ((B + P) * (B + P) + (B + P) * B + B * B);
  return temp - temp2;
}

signed main() {
  cin >> x;
  vector<int> y = enum_div(x);

  int a, b;

  for (auto p : y) {
    rep(i, 1e6) {
      int _x = i;
      int _y = _x - p;
      if (fun(_x, _y)) {
        cout << _x << " " << _y << endl;
        break;
      }
    }
  }

  return 0;
}


Error: TLE

Fixed submission:

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

#define int long long
#define INT int
#define MOD 1000000007

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T> void print(T x) { std::cout << x << '\\n'; }
typedef long long ll;

/* nの約数を求める関数*/
vector<int> enum_div(int n) // nの約数を列挙
{
  vector<int> divisor;
  for (int i = 1; i * i <= n; ++i) {
    if (n % i == 0) {
      divisor.push_back(i);
      if (i != 1 && i * i != n) {
        divisor.push_back(n / i);
      }
    }
  }
  return divisor;
}

int x;

bool fun(int A, int B) { return A * A * A * A * A - B * B * B * B * B == x; }

int fun2(int B, int P) {

  int temp = ((B + P) * (B + P) + B * B) - (B + P + B) * (B + P + P);
  int temp2 = (B + P) * B * ((B + P) * (B + P) + (B + P) * B + B * B);
  return temp - temp2;
}

signed main() {
  cin >> x;
  vector<int> y = enum_div(x);

  int a, b;

  for (auto p : y) {
    rep(i, x) {
      int _x = i;
      int _y = _x - p;
      if (fun(_x, _y)) {
        cout << _x << " " << _y << endl;
        break;
      }
    }
  }

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

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

int main() {
  ll X;
  cin >> X;
  int counter = 0;
  long long int A = 0, B = 0;
  rep(i, 1000) {
    rep(j, 1000) {
      if (i * i * i * i * i - j * j * j * j * j == X) {
        A = i;
        B = j;
        counter++;
        break;
      }
      if (i * i * i * i * i + j * j * j * j * j == X) {
        A = i;
        B = -j;
        counter++;
        break;
      }
    }
    if (counter > 0)
      break;
  }
  cout << A << ' ' << B;
}


Error: -6
terminate called after throwing an instance of 'std::out_of_range'
  what():  vector::_M_range_check: __n (which is 9151338440288712704) >= this->size() (which is 33)


Fixed submission:

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

int main() {
  long long int N, M;
  cin >> N >> M;
  vector<long long int> H(N);
  rep(i, N) cin >> H.at(i);
  vector<long long int> X(N, 1);
  rep(i, M) {
    long long int A, B;
    cin >> A >> B;
    if (H.at(A) < H.at(B))
      X.at(A) = 0;
    if (H.at(A) > H.at(B))
      X.at(B) = 0;
  }

  long long int counter = 0;
  rep(i, N) {
    if (X.at(i) == 1)
      counter++;
  }
  cout << counter << endl;
}
Problem p02690 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
using ll = long long;
int main() {
  ll a = -200, b = -200, X;
  cin >> X;
  rep(i, 400) {
    a++;
    b = -200;
    rep(j, 400) {
      b++;
      if (a * a * a * a * a - b * b * b * b * b == X) {
        cout << a << " " << b << endl;
        return 0;
      }
    }
  }
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
using ll = long long;
ll X;
bool pp = false;
void ch(ll x, ll y) {
  if (x * x * x * x * x - y * y * y * y * y == X) {
    cout << x << " " << y << endl;
    pp = true;
  }
}
int main() {
  ll a = 0, b = -1000;
  cin >> X;
  while (1) {
    a++;
    rep(j, 50000) {
      b++;
      if (X % (a - b) == 0) {
        ch(a, b);
        if (pp)
          return 0;
      }
    }
  }
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef pair<int, int> P;

int x;
priority_queue<int, vector<int>, greater<int>> q;
long long ans;

int main(void) {
  cin >> x;

  for (int i = 1; i * i <= x; i++) {
    if (x % i == 0) {
      q.push(i);
      q.push(x / i);
    }
  }

  while (true) {
    int k = q.top();
    q.pop();
    long long b = -k;
    while (true) {
      long long a = b + k;
      long long tmp = a * a * a * a * a - b * b * b * b * b;
      if (tmp == x) {
        cout << a << " " << b << endl;
        return 0;
      }
      if (tmp > x and b >= 0)
        break;
      b++;
    }
  }
}


Error: TLE

Fixed submission:

#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef pair<int, int> P;

int x;
queue<int> q;
long long ans;

int main(void) {
  cin >> x;

  for (int i = 1; i * i <= x; i++) {
    if (x % i == 0) {
      q.push(i);
      q.push(x / i);
    }
  }

  while (true) {
    int k = q.front();
    q.pop();
    long long b = -k;
    while (true) {
      long long a = b + k;
      long long tmp = a * a * a * a * a - b * b * b * b * b;
      if (tmp == x) {
        cout << a << " " << b << endl;
        return 0;
      }
      if (tmp > x and b >= 0)
        break;
      b++;
    }
  }
}
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##_len = (n); i < i##_len; ++i)
#define xrep(i, a, b) for (int i = int(a); i < int(b); ++i)
using ll = long long;

int a, b;
int X;

void search(int A, int B) {
  if (pow(A, 5) > X) {
    A = B;
    search(A, B - 1);
    return;
  }
  if (pow(A, 5) - pow(B, 5) == X) {
    a = A;
    b = B;
    return;
  }
  search(A + 1, B);
}

int main() {
  cin >> X;
  search(-100, 100);
  cout << a << " " << b << endl;

  return 0;
}

Error: TLE

Fixed submission:

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

int a, b;
int X;

void search(int A, int B) {
  if (pow(A, 5) > X) {
    A = B;
    search(A, B + 1);
    return;
  }
  if (pow(A, 5) - pow(B, 5) == X) {
    a = A;
    b = B;
    return;
  }
  search(A + 1, B);
}

int main() {
  cin >> X;
  search(-10, -10);
  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;
const ll INF = 1LL << 60;
ll MOD = 1e9 + 7;

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

int main() {
  ll x;
  cin >> x;
  ll i = -200, j = -200;
  while (true) {
    j = -200;
    while (true) {
      if (pow5(i) - pow5(j) == x)
        break;
      if (j == 200)
        break;
      j++;
    }
    if (pow5(i) - pow5(j) == x)
      break;
    i++;
  }
  cout << i << " " << j << endl;
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
ll MOD = 1e9 + 7;

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

int main() {
  ll x;
  cin >> x;
  ll i = 0, j = -70;
  while (true) {
    j = -70;
    while (true) {
      if (pow5(i) - pow5(j) == x)
        break;
      if (j == 100)
        break;
      j++;
    }
    if (pow5(i) - pow5(j) == x)
      break;
    i++;
  }
  cout << i << " " << j << endl;
  return 0;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
signed main() {
  bool f = true;
  long long x, a, b, i, j;
  cin >> x;

  for (a = -1000; a <= 1000; a++) {
    for (b = -1000; b <= 1000; b++) {
      if (a * a * a * a * a - b * b * b * b * b == x) {
        i = a, j = b;
      }
    }
  }

  cout << i << ' ' << j << ' ' << endl;
  return (0);
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
signed main() {
  bool f = true;
  long long x, a = 0, b = 1, i, j;
  cin >> x;

  i = 0;
  while (f) {
    j = i + 1;
    a = i * i * i * i * i;
    b = j * j * j * j * j;
    while (a + b <= x && f) {
      if (a - b == x) {
        a = i, b = j;
        f = false;
      } else if (a + b == x) {
        a = i, b = -j;
        f = false;
      } else {
        j++;
        b = j * j * j * j * j;
      }
    }
    i++;
  }

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

#include <cmath>
#include <iostream>

using namespace std;

int main() {
  int x;
  cin >> x;
  long long a, b;
  for (a = 0; a < 130; a++) {
    long long a5 = a * a * a * a * a;
    if (a5 < x) {
      for (b = 0; b > -130; b--) {
        long long b5 = b * b * b * b * b;
        if (a5 > x + b5)
          break;
        else if (a5 == x + b5) {
          cout << a << " " << b;
          return 0;
        }
      }
    } else if (a5 > x) {
      for (b = 0; b < 130; b++) {
        long long b5 = b * b * b * b * b;
        if (a5 < x + b5)
          break;
        else if (a5 == x + b5) {
          cout << a << " " << b;
          return 0;
        }
      }
    } else {
      b = 0;
      cout << a << " " << b;
      return 0;
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <cmath>
#include <iostream>

using namespace std;

int main() {
  int x;
  cin >> x;
  int a, b;
  for (a = 0; a < 130; a++) {
    long long a5 = a * a * a * a * a;
    if (a5 < x) {
      for (b = 0; b < 130; b--) {
        long long b5 = b * b * b * b * b;
        if (a5 > x + b5)
          break;
        else if (a5 == x + b5) {
          cout << a << " " << b;
          return 0;
        }
      }
    } else if (a5 > x) {
      for (b = 0;; b++) {
        long long b5 = b * b * b * b * b;
        if (a5 < x + b5)
          break;
        else if (a5 == x + b5) {
          cout << a << " " << b;
          return 0;
        }
      }
    } else {
      b = 0;
      cout << a << " " << b;
      return 0;
    }
  }
  return 0;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;

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

  double A, B;

  int A_i, B_i, count;
  A_i = 121;
  count = 0;
  for (A_i = -118; A_i < 120; A_i++) {
    for (B_i = -119; B_i < 119; B_i++) {
      if (X == pow(A_i, 5) - pow(B_i, 5)) {
        cout << A_i << " " << B_i << endl;
        count++;
        break;
      }
      if (count)
        break;
    }
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;

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

  double A, B;

  int A_i, B_i;
  B = (int)pow(X, 0.2);
  do {
    B_i--;
    A = pow(X + pow(B_i, 5), 0.2);
    A_i = int(A);
  } while (X + pow(B, 5) > 0 && (A - A_i != 0));

  cout << A_i << " " << B_i << endl;
  return 0;
}
Problem p02690 (C++) — buggy submission, verdict: Runtime Error

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

// vector<ll> divisor(ll n) {
//     vector<ll> ret;
//     for (ll i = 1; i * i <= n; i++) {
//         if (n % i == 0) {
//             ret.push_back(i);
//             if (i * i != n) ret.push_back(n / i);
//         }
//     }
//     sort(ret.begin(), ret.end()); // 昇順に並べる
//     return ret;
// }

int main() {
  /*変数定義，入力*/
  ll X;
  cin >> X;
  ll a = 0;
  ll b;
  while (a < 1000000000) {

    for (ll i = 1; i * i <= X; i++) {
      if (X % i == 0) {
        b = a - X / i;
        if (a * a * a * a * a - b * b * b * b * b == X) {
          cout << a << " " << b << endl;
          return 0;
        }
        if (i * i != X) {
          b = a - X / (X / i);
          if (a * a * a * a * a - b * b * b * b * b == X) {
            cout << a << " " << b << endl;
            return 0;
          }
        }
      }
    }

    a += 1;
  }

  /*終了*/
  return 0;
}


Error: -8

Fixed submission:

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

vector<long long> divisor(long long n) {
  vector<long long> ret;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n)
        ret.push_back(n / i);
    }
  }
  sort(ret.begin(), ret.end()); // 昇順に並べる
  return ret;
}

int main() {
  /*変数定義，入力*/
  ll X;
  cin >> X;
  vector<ll> Xdiv = divisor(X);
  ll a = 0, b = 0;
  while (a < 1000000000) {
    rep(i, sizeof(Xdiv)) {
      b = a - X / Xdiv[i];
      if (pow(a, 5) - pow(b, 5) == X) {
        cout << a << " " << b << endl;
        return 0;
      }
    }
    a += 1;
  }

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

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

int main() {
  long long int X;
  cin >> X;
  bool ans = false;
  for (int i = 0; i < 10000; i++) {
    for (int j = -1000; j < 1000; j++) {
      if (i * i * i * i * i - j * j * j * j * j == X) {
        cout << i << " " << j << endl;
        ans = true;
      }
    }
    if (ans)
      break;
  }
}

Error: TLE

Fixed submission:

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

int main() {
  int X;
  cin >> X;
  bool ans = false;
  for (int i = 1; i < 100000; i++) {
    for (int j = -100000; j < 100000; j++) {
      if (i * i * i * i * i - j * j * j * j * j == X) {
        cout << i << " " << j << endl;
      }
    }
  }
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

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

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

  map<long long, long long> score;

  for (long long i = 0; i < std::pow(10, 4); i++) {
    score[i] = std::pow(i, 5);
  }

  for (long long j = 0; j < std::pow(10, 4); j++) {
    for (long long k = 0; k < std::pow(10, 4); k++) {
      if (score.at(j) - score.at(k) == x) {
        cout << j << " " << k;
        return 0;
      }
      if (score.at(j) + score.at(k) == x) {
        cout << j << " " << -k;
        return 0;
      }
    }
  }
}

Error: TLE

Fixed submission:

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

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

  map<long long, long long> score;

  for (long long i = 0; i < std::pow(10, 5); i++) {
    score[i] = std::pow(i, 5);
  }

  for (long long j = 0; j < std::pow(10, 5); j++) {
    for (long long k = 0; k < std::pow(10, 5); k++) {
      if (score.at(j) - score.at(k) == x) {
        cout << j << " " << k;
        return 0;
      }
      if (score.at(j) + score.at(k) == x) {
        cout << j << " " << -k;
        return 0;
      }
    }
  }
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main(void) {
  ll x;
  cin >> x;
  ll y;
  for (int a = -120; a <= 120; a++) {
    for (int b = -120; b <= 120; b++) {
      ll ans = pow(a, 5) - pow(b, 5);
      if (x == ans) {
        cout << a << " " << b << endl;
        return 0;
      }
    }
  }
}

Error: TLE

Fixed submission:

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

int main(void) {
  ll x;
  cin >> x;
  ll y;
  for (int a = -120; a <= x; a++) {
    for (int b = -120; b <= x; b++) {
      ll ans = pow(a, 5) - pow(b, 5);
      if (x == ans) {
        cout << a << " " << b << endl;
        return 0;
      }
    }
  }
}
Problem p02690 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int INF = 1e9 + 7;
vector<int> v;

int main() {
  int x;
  cin >> x;
  int k = 1;
  /*
  while(pow(k,5) < 10e9 * 2){
      k++;
  }
  */
  // cout << k << endl;
  for (int i = -130; i < 130; i++) {
    for (int j = -130; j < 130; j++) {
      if (pow(i, 5) - pow(j, 5) == x) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
}

Error: -11

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int INF = 1e9 + 7;
vector<int> v(200, INF);

int main() {
  int x;
  cin >> x;
  int i = 1;
  for (int i = 1; pow(i, 5) < 1e9; i++) {
    v[2 * i] = pow(i, 5);
    v[2 * i + 1] = -pow(i, 5);
  }
  sort(v.begin(), v.end());

  for (int i = 0; i < 200; i++) {
    for (int j = i; i < v.size(); j++) {
      int y = v[i] - v[j];
      if (y == x) {
        cout << v[i] << " " << v[j] << endl;
        return 0;
      }
    }
  }
}
Problem p02690 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  long long int x;
  cin >> x;
  long long int A_5, B_5;
  for (long long int i = -1000; i <= 1000; i++) {
    A_5 = i * i * i * i * i;

    for (long long int j = -1000; j <= 1000; j++) {
      B_5 = j * j * j * j * j;
      if (A_5 - B_5 == x) {

        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
}


Error: 0

Fixed submission:

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

int main() {
  long int x;
  cin >> x;
  long int a, b;
  long int A_5, B_5;
  bool hantei = false;
  int y, z;
  for (int i = 1; i <= 100000; i++) {
    A_5 = i * i * i * i * i;
    if (x / A_5 > 10)
      continue;
    for (int j = 0; j <= i; j++) {
      if (i == j) {
        y = 1;
      } else {
        y = (x % (i - j));
      }
      z = (x % (i + j));
      if (y == 0 || z == 0) {

        B_5 = j * j * j * j * j;
        if (A_5 - B_5 == x) {
          a = i;
          b = j;
          hantei = true;
          break;
        }
        if (A_5 + B_5 == x) {
          a = i;
          b = 0 - j;
          hantei = true;
          break;
        }
      }
    }
    if (hantei)
      break;
  }
  cout << a << ' ' << b << endl;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main(void) {
  long long int x = 0, y = 0, z = 0, a = 0, b = 0;
  cin >> x;

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

Error: TLE

Fixed submission:

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

int main(void) {
  long long int x = 0, y = 0, z = 0, i = 0, a = 0, b = 0;
  cin >> x;
  if (x == 1) {
    cout << "0 -1\\n";
    return 0;
  }
  y = x;
  while (y) {
    y = y - pow(i, 5);
    i++;
  }
  y = pow(i, 5) - x;
  z = x - pow(i - 1, 5);
  for (int k = 1; k < i; k++) {
    if (pow(k, 5) == y) {
      a = i;
      b = k;
      cout << a << " " << b << endl;
      return 0;
    }
    if (pow(k, 5) == z) {
      a = i - 1;
      b = -k;
      cout << a << " " << b << endl;
      return 0;
    }
  }
  return 0;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i, m, n) for (lli i = m; i < n; i++)
#define rrep(i, m, n) for (lli i = m - 1; i >= n; i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(), N.end()), N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(), n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K, L, N, S) vector<L> K(N, S)
#define DV(K, L, N, M, S) vector<vector<L>> K(N, vector<L>(M, S))
#define TV(K, L, N, M, R, S)                                                   \\
  vector<vector<vector<L>>> K(N, vector<vector<L>>(M, vector<L>(R, S)))
#define pint pair<lli, lli>
#define paf(L, R) pair<L, R>
#define mod 998244353
#define MAX 10000000
#define ALL(a) a.begin(), a.end()
#define chmax(a, b) a = (((a) < (b)) ? (b) : (a))
#define chmin(a, b) a = (((a) > (b)) ? (b) : (a))
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A, B, C, D, E, F, L, N, M, K, X, Y, Z, H, W, sum = 0, num = 0, flag = 0;
  string S, T;
  cin >> X;
  rep(i, -3000, 3000) {
    lli A = pow(i, 5);
    if (A < X) {
      rep(j, -3000, 0) {
        if (A - pow(j, 5) == X) {
          cout << i << " " << j << endl;
          return 0;
        }
      }
    } else {
      rep(j, 0, 3000) {
        if (A - pow(j, 5) == X) {
          cout << i << " " << j << endl;
          return 0;
        }
      }
    }
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i, m, n) for (lli i = m; i < n; i++)
#define rrep(i, m, n) for (lli i = m - 1; i >= n; i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(), N.end()), N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(), n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K, L, N, S) vector<L> K(N, S)
#define DV(K, L, N, M, S) vector<vector<L>> K(N, vector<L>(M, S))
#define TV(K, L, N, M, R, S)                                                   \\
  vector<vector<vector<L>>> K(N, vector<vector<L>>(M, vector<L>(R, S)))
#define pint pair<lli, lli>
#define paf(L, R) pair<L, R>
#define mod 998244353
#define MAX 10000000
#define ALL(a) a.begin(), a.end()
#define chmax(a, b) a = (((a) < (b)) ? (b) : (a))
#define chmin(a, b) a = (((a) > (b)) ? (b) : (a))
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A, B, C, D, E, F, L, N, M, K, X, Y, Z, H, W, sum = 0, num = 0, flag = 0;
  string S, T;
  cin >> X;
  rep(i, -3500, 3500) rep(j, -3500, 3500) {
    if (pow(i, 5) - pow(j, 5) == X) {
      cout << i << " " << j << endl;
      return 0;
    }
  }
}