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

#include <bits/stdc++.h>

using namespace std;

int main() {
  long long x;
  cin >> x;
  for (long long i = -1000; i <= 1000; i++) {
    for (long long j = -1000; j <= 1000; j++) {
      if (pow(i, 5) - pow(j, 5) == x) {
        cout << i << ' ' << j << '\\n';
        return 0;
      }
    }
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

int main() {
  long long x;
  cin >> x;
  for (long long i = 0;; i++) {
    for (long long j = 0;
         pow(i, 5) - pow(j, 5) >= 0 && pow(i, 5) + pow(j, 5) <= x; j++) {
      long long plus, neg;
      plus = pow(i, 5) - pow(j, 5);
      neg = pow(i, 5) + pow(j, 5);
      if (plus == x) {
        cout << i << ' ' << j << '\\n';
        return 0;
      } else if (neg == x) {
        cout << i << ' ' << j * -1 << '\\n';
        return 0;
      }
    }
  }
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#define ill long long
#define rep(i, a, b) for (ill i = a; i < b; i++)
using namespace std;

int main() {
  int x;
  cin >> x;
  rep(i, -500, 501) {
    rep(j, -500, 501) {
      if (i * i * i * i * i - j * j * j * j * j == x) {
        cout << i << " " << j << "\\n";
        return 0;
      }
    }
  }
}


Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#define ill long long
#define rep(i, a, b) for (ill i = (a); i < (b); i++)
#define fcout cout << fixed << setprecision(10)
using namespace std;

int main() {
  ill x;
  cin >> x;
  rep(i, 0, 1000000000) {
    rep(j, 0, 1000) {
      if (j * j * j * j * j - i * i * i * i * i == x) {
        cout << j << " " << i;
        return 0;
      } else if (j * j * j * j * j + i * i * i * i * i == x) {
        cout << j << " -" << i;
        return 0;
      } else if (i * i * i * i * i - j * j * j * j * j == x) {
        cout << i << " " << j;
        return 0;
      } else {
        if (j * j * j * j * j + i * i * i * i * i > x) {
          break;
        }
      }
    }
  }
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(n) begin(n), end(n)
#define IN(a, x, b) (a <= x && x < b)
#define INIT                                                                   \\
  std::ios::sync_with_stdio(false);                                            \\
  std::cin.tie(0);
template <class T> inline T CHMAX(T &a, const T b) {
  return a = (a < b) ? b : a;
}
template <class T> inline T CHMIN(T &a, const T b) {
  return a = (a > b) ? b : a;
}

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);

int main() {
  INIT;
  int x;
  scanf("%d", &x);
  int a, b;
  int ans_a = 0;
  int ans_b = 0;
  for (a = -119; a < 120; a++) {
    for (b = -119; b < 120; b++) {
      if ((a * a * a * a * a - b * b * b * b * b) == x) {
        ans_a = a;
        ans_b = b;
      }
    }
  }
  printf("%d %d", ans_a, ans_b);
  return 0;
}

Error: TLE

Fixed submission:


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(n) begin(n), end(n)
#define IN(a, x, b) (a <= x && x < b)
#define INIT                                                                   \\
  std::ios::sync_with_stdio(false);                                            \\
  std::cin.tie(0);
template <class T> inline T CHMAX(T &a, const T b) {
  return a = (a < b) ? b : a;
}
template <class T> inline T CHMIN(T &a, const T b) {
  return a = (a > b) ? b : a;
}

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);

int main() {
  INIT;
  ll x;
  scanf("%d", &x);
  int a, b;
  for (a = -1000; a < 1000; a++) {
    for (b = -1000; b < 1000; b++) {
      if ((a - b) * (a * a * a * a + a * a * a * b + a * a * b * b +
                     a * b * b * b + b * b * b * b) ==
          x)
        break;
    }
    if ((a - b) * (a * a * a * a + a * a * a * b + a * a * b * b +
                   a * b * b * b + b * b * b * b) ==
        x)
      break;
  }
  printf("%d %d", a, b);
  return 0;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
long long int X;
long long int A, B;
int flg = 0;

int main() {
  cin >> X;
  for (int i = -120; i <= 120; i++) {
    A = i;
    long long int A5 = pow(A, 5);
    for (int j = -120; j <= 120; j++) {
      B = j;
      long long int B5 = pow(B, 5);
      if (A5 - B5 == X) {
        flg = 1;
        break;
      }
    }
    if (flg == 1)
      break;
  }
  cout << A << " " << B;
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int X;
int A, B;
int flg = 0;
int main() {
  cin >> X;

  for (int i = 0; i < X; i++) {
    A = i;
    int A5 = pow(A, 5);
    for (int j = -pow(X - A5, 0.2) - 1; j < pow(X - A5, 0.2) + 1; j++) {
      B = j;
      int B5 = pow(B, 5);
      if (A5 - B5 == X) {
        flg = 1;
        break;
      }
    }
    if (flg == 1)
      break;
  }
  cout << A << " " << B;
  return 0;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  ll x, a, b, f;
  cin >> x;
  f = 1;
  for (a = 0; (a <= 1e4 && f == 1); a++) {
    for (b = 0; b <= 1e4; b++) {
      if ((pow(a, 5) - pow(b, 5)) == x) {
        cout << a << " " << b << endl;
        f = 0;
      } else if ((pow(a, 5) + pow(b, 5)) == x) {
        cout << a << " " << -b << endl;
        f = 0;
      }
    }
  }

  return 0;
}

Error: TLE

Fixed submission:

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

int gojosu(int x) {
  int n = 1;
  while (true) {
    if (pow(n, 5) == x)
      return true;
    else if (pow(n, 5) >= x)
      return false;
    n++;
  }
}

int mitatsu(int x) {
  int n = 1;
  while (true) {
    if (pow(n, 5) > x)
      return n - 1;
    n++;
  }
}

int choka(int x) {
  int n = 1;
  while (true) {
    if (pow(n, 5) > x)
      return n;
    n++;
  }
}

int main() {
  ll x;

  cin >> x;
  if (gojosu(x)) {
    cout << x << " " << 0 << endl;
  } else {
    int mit, cho;
    int y = 1;

    mit = mitatsu(x);
    cho = choka(x);

    while (true) {
      if ((pow(mit, 5) + pow(y, 5)) == x) {
        cout << mit << " " << -y << endl;
        break;
      } else if ((pow(mit, 5) - pow(y, 5)) == x) {
        cout << mit << " " << y << endl;
        break;
      }

      y++;
    }
  }

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

#include <stdio.h>
int main(void) {
  int power_5[120] = {0};
  for (int i = 0; i < 120; i++) {
    power_5[i] = i * i * i * i * i;
  }
  int x = 0;
  int flag = 0;
  scanf("%d", &x);
  for (int i = 0; i < 120; i++) {
    for (int j = i; j < 120; j++) {
      if (power_5[i] + power_5[j] == x) {
        printf("%d %d", j, -i);
        flag = 1;
        break;
      }
      if (power_5[j] - power_5[i] == x) {
        printf("%d %d", j, i);
        flag = 1;
        break;
      }
    }
    if (flag == 1) {
      break;
    }
  }

  return 0;
}

Error: -11

Fixed submission:

#include <stdio.h>
int main(void) {
  int minus[1000000000][2] = {0};
  int plus[1000000000][2] = {0};
  int power_5[120] = {0};
  for (int i = 0; i < 120; i++) {
    power_5[i] = i * i * i * i * i;
  }
  for (int i = 0; i < 120; i++) {
    for (int j = i; j < 120; j++) {
      plus[power_5[i] + power_5[j]][0] = j;
      plus[power_5[i] + power_5[j]][1] = i;
      minus[power_5[j] - power_5[i]][0] = j;
      minus[power_5[j] - power_5[i]][1] = i;
    }
  }
  int x = 0;
  scanf("%d", &x);
  if (plus[x][0] == 0) {
    printf("%d %d", minus[x][0], minus[x][1]);
  } else {
    printf("%d %d", plus[x][0], -plus[x][1]);
  }

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

#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define rrep(i, a, b) for (int i = a; i > b; --i)
#define sq(a) (a) * (a)
#define nitro                                                                  \\
  std::ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define debug(x) std::cerr << #x << "=" << x << '\\n'
#define text std::cerr << "SacredCoupoid08\\n"
#define endl '\\n'
#define all(c) (c).begin(), (c).end()
#define U 1000000007
#define N 100005
#define sz(c) (int)c.size()
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair<int, int> pi;
#define cin std::cin
#define cout std::cout
#define vector std::vector
#define pb push_back
#define pv(x)                                                                  \\
  for (auto y : x)                                                             \\
    cerr << y << " ";                                                          \\
  cerr << '\\n';
#define fr first
#define sc second
#define ppb pop_back
#define max(a, b) a = max(a, b)
#define min(a, b) a = min(a, b)
#define int ll
#define tr(c, it) for (typeof(c.begin()) it = c.begin(); it != c.end(); it++)
signed main() {
  nitro;
  int VASU = 1;
  // cin>>VASU;
  while (VASU--) {
    int n;
    cin >> n;
    rep(i, -200, 200) {
      rep(j, -200, 200) {
        if (pow(i, 5) - pow(j, 5) == n) {
          cout << i << " " << j << endl;
          return 0;
        }
      }
    }
  }

  return 0;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define rrep(i, a, b) for (int i = a; i > b; --i)
#define sq(a) (a) * (a)
#define nitro                                                                  \\
  std::ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define debug(x) std::cerr << #x << "=" << x << '\\n'
#define text std::cerr << "SacredCoupoid08\\n"
#define endl '\\n'
#define all(c) (c).begin(), (c).end()
#define U 1000000007
#define N 100005
#define sz(c) (int)c.size()
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair<int, int> pi;
#define cin std::cin
#define cout std::cout
#define vector std::vector
#define pb push_back
#define pv(x)                                                                  \\
  for (auto y : x)                                                             \\
    cerr << y << " ";                                                          \\
  cerr << '\\n';
#define fr first
#define sc second
#define ppb pop_back
#define max(a, b) a = max(a, b)
#define min(a, b) a = min(a, b)
#define int ll
#define tr(c, it) for (typeof(c.begin()) it = c.begin(); it != c.end(); it++)
signed main() {
  nitro;
  int VASU = 1;
  // cin>>VASU;
  while (VASU--) {
    int n;
    cin >> n;
    rep(i, -1, 200) {
      rep(j, -200, 1) {
        if (pow(i, 5) - pow(j, 5) == n) {
          cout << i << " " << j << endl;
          return 0;
        }
      }
    }
  }

  return 1;
}
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++)
typedef long long ll;

/*
  ll n , m ;
  cin >> n >> m ;
  ll a , b , c ;
  cin >> a >> b >> c ;
  vector<ll> A(n) ;
  cout << "Yes" << endl ;
  cout << "No"  << endl ;
*/

int main() {
  ll x;
  cin >> 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 0;
      }
    }
  }
}


Error: -11

Fixed submission:

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

int main() {
  int n;
  cin >> n;
  int A[n];
  rep(i, n) cin >> A[i];
  ll count = 0;
  rep(i, n) {
    for (int j = i + A[i]; j < n; j++) {
      if (A[i] + A[j] == j - i)
        count++;
    }
  }
  cout << count << endl;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
using ll = long long;

int main() {
  ll x;
  cin >> x;
  for (ll a = -300; a <= 300; a++) {
    ll temp = sqrtl(sqrtl(abs((powl(a, 5) - x))));
    // cout << temp << endl;
    for (ll b = temp * -1; b <= temp; b++) {
      if (powl(a, 5) - powl(b, 5) == x) {
        cout << a << " " << b;
        return 0;
      }
    }
  }
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
using ll = long long;

int main() {
  ll x;
  cin >> x;
  for (ll a = -64; a <= 64; a++) {
    ll temp = sqrtl(abs((powl(a, 5) - x)));
    // cout << temp << endl;
    for (ll b = temp * -1; b <= temp; b++) {
      if (powl(a, 5) - powl(b, 5) == x) {
        cout << a << " " << b;
        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;
typedef long long ll;

int main() {
  ll X;
  cin >> X;
  vector<ll> V(150);

  rep(i, 150) { V[i] = pow(i, 5); }

  rep(i, 150) {
    for (int j = 0; j <= i; j++) {
      if (V[i] - V[j] == X) {
        cout << i << " " << j << endl;
        return 0;
      } else if (V[i] + V[j] == X) {
        cout << i << " " << -j << 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;
typedef long long ll;

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

  vector<int> V(1000);
  int i = 0;
  while (true) {
    int v = i * i * i * i * i;
    V[i] = v;
    if (v * 2 < X) {
      i++;
      continue;
    }
    for (int j = 0; j <= i; j++) {
      if (V[i] - V[j] == X) {
        cout << i << " " << j << endl;
        return 0;
      } else if (V[i] + V[j] == X) {
        cout << i << " " << -j << endl;
        return 0;
      }
    }
  }
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main() {
  long long x;
  cin >> x;
  for (int i = 0; i <= 1000; i++) {
    for (int j = 0; j <= i; j++) {
      if (pow(i, 5) - pow(j, 5) == x) {
        cout << i << " " << j << endl;
        return 0;
      } else if (pow(i, 5) + pow(j, 5) == x) {
        cout << i << " " << -j << endl;
        return 0;
      }
    }
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(0), cin.tie(0)
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 5;
const int inf = ~0u >> 1;
ll Pow(ll a, ll b) {
  ll ans = 1;
  while (b) {
    if (b & 1)
      ans = (ans * a);
    a = (a * a);
    b >>= 1;
  }
  return ans;
}
int main() {
  IO;
  ll x;
  cin >> x;
  for (ll i = 1;; ++i) {
    ll a = Pow(i, 5);
    double b = pow(abs(a - x), 0.2);
    if (b == (ll)b) {
      cout << i << ' ' << (a >= x ? b : -b) << endl;
      break;
    }
  }
  return 0;
}
Problem p02690 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> pi;
#define f first
#define s second
#define FAST                                                                   \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);
const int maxn = 100010;

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

int X;
int32_t main() {
  FAST cin >> X;
  for (int a = -150; a <= 150; a++) {
    for (int b = -150; b <= 150; b++) {
      if (pow5(a) - pow5(b) == X) {
        cout << a << " " << b;
        return 0;
      }
    }
  }
  assert(0);
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> pi;
#define f first
#define s second
#define FAST                                                                   \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);
const int maxn = 100010;

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

int X;
int32_t main() {
  FAST cin >> X;
  for (int a = 0; a <= 100; a++) {
    for (int b = -100; b <= 100; b++) {
      if (pow5(a) - pow5(b) == X) {
        cout << a << " " << b;
        return 0;
      }
    }
  }
  assert(0);
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll mod = 1e9 + 7;

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

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll mod = 1e9 + 7;

set<ll> divisor(ll n) {
  if (n < 0)
    n *= -1;
  else if (n == 0) {
    set<ll> st;
    st.insert(0);
    return st;
  }
  set<ll> st;
  for (int i = 1; i <= sqrt(n); ++i) {
    if (n % i == 0) {
      st.insert(i);
      st.insert(n / i);
      st.insert(-1 * i);
      st.insert(-1 * n / i);
    }
  }
  return st;
}

int main() {
  ll x;
  cin >> x;
  set<ll> st = divisor(x);

  for (const auto &e : st) {
    if (abs(x / e - e * e * e * e) % 5 != 0)
      continue;
    ll tgt = (x / e - e * e * e * e) / 5;
    set<ll> div = divisor(tgt);
    for (const auto &b : div) {
      if ((b + e) * (b + e) * (b + e) * (b + e) * (b + e) - b * b * b * b * b ==
          x) {
        cout << b + e << " " << b << endl;
        return 0;
      }
    }
  }
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <math.h>
#include <numeric>
#include <sstream>
#include <vector>
//---------------------------------------------------------------
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1000000000000000000ll
#define all(x) x.begin(), x.end()
#define fi first
#define se second
using pint = pair<int, int>;
using vec = vector<int>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
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;
}
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const double pi = acos(-1);
//---------------------------------------------------------------

// ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

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

  ll x;
  cin >> x;
  ll ans;
  for (int i = -200; i <= 200; i++) {
    for (int j = -200; j <= 200; j++) {
      ans = pow(i, 5) - pow(j, 5);
      if (ans == x) {
        cout << i << ' ' << j << endl;
        return 0;
      }
    }
  }
}

Error: TLE

Fixed submission:

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

int main() {
  int64_t x;
  int64_t a, b;
  cin >> x;
  for (int64_t i = 0; i < 1e5; i++) {
    for (int64_t j = 0; j < 1e5; j++) {
      int64_t a_jou = pow(a, 5);
      int64_t b_jou = pow(b, 5);
      if (x == a_jou - b_jou) {
        cout << a_jou << " " << b_jou << endl;
        break;
      } else {
        continue;
      }
    }
  }
}
Problem p02690 (C++) — buggy submission, verdict: Runtime Error

#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_map>
// #include"testlib.h"
#define endl "\\n"
#define all(v) v.begin(), v.end()
#define allr(s) s.rbegin(), s.rend()
#define RT(s) return cout << s, 0
#define watch(x) cout << (#x) << " = " << x << endl
#define sz(s) (int)(s.size())
#define PI acos(-1)
#define EPS 1e-100
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
void file() {
#ifndef ONLINE_JUDGE
  freopen("in.txt", "r", stdin);
  // freopen("out.txt", "w", stdout);
#else
  // freopen("street.in", "r", stdin);
  // freopen("out.txt", "w", stdout);
#endif
}
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
}
ii solve(int x) {
  int n = 5e3;
  for (ll a = -n; a <= n; a++) {
    for (ll b = -n; b <= n; b++) {
      ll A = a * a * a * a * a;
      ll B = b * b * b * b * b;
      if (A - B == x)
        return {a, b};
    }
  }
  assert(0);
  return {INT_MIN, INT_MIN};
}
int main() {
  //	file();
  fast();
  int x;
  cin >> x;
  cout << solve(x).first << ' ' << solve(x).second << endl;
  return 0;
}


Error: WA

Fixed submission:

#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_map>
// #include"testlib.h"
#define endl "\\n"
#define all(v) v.begin(), v.end()
#define allr(s) s.rbegin(), s.rend()
#define RT(s) return cout << s, 0
#define watch(x) cout << (#x) << " = " << x << endl
#define sz(s) (int)(s.size())
#define PI acos(-1)
#define EPS 1e-100
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
void file() {
#ifndef ONLINE_JUDGE
  freopen("in.txt", "r", stdin);
  // freopen("out.txt", "w", stdout);
#else
  // freopen("street.in", "r", stdin);
  // freopen("out.txt", "w", stdout);
#endif
}
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
}
ii solve(int x) {
  int n = 5e3;
  for (int a = -n; a <= n; a++) {
    for (int b = -n; b <= n; b++) {
      ll A = a * a * a * a * a;
      ll B = b * b * b * b * b;
      if (A - B == x)
        return {a, b};
    }
  }
  assert(0);
  return {INT_MIN, INT_MIN};
}
int main() {
  //	file();
  fast();
  int x;
  cin >> x;
  cout << solve(x).first << ' ' << solve(x).second << endl;
  return 0;
}