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

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, n) for (int i = 1; i < 40001; i += 2)
using namespace std;
using P = pair<int, int>;
using ll = long long;

int main() {
  ll x;
  cin >> x;
  vector<pair<ll, ll>> A(40001);
  A[0].first = A[0].second = 0;

  ll num = 1;
  rep2(i, 40000) {
    A[i].first = num * num * num * num * num;
    A[i].second = num;
    A[i + 1].first = -num * num * num * num * num;
    A[i + 1].second = -num;
    num += 1;
  }
  int a, b = 1, anum = 0, bnum = 0, judge = 0;
  rep(i, 40001) {
    a = A[i].first;
    rep(j, 40001) {

      b = A[j].first;
      if (a == (x + b)) {
        judge = 1;
        anum = A[i].second;
        bnum = A[j].second;
        break;
      }
    }
    if (judge == 1)
      break;
  }

  rep(i, 4) {
    if ((a == 0) && (b == 0))
      break;
    else if (a == 0)
      b /= bnum;
    else if (b == 0)
      a /= anum;
    else {
      a /= anum;
      b /= bnum;
    }
  }
  cout << a << " " << b << endl;
}

Fixed submission:
#include <algorithm>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, n) for (int i = 1; i < 40001; i += 2)
using namespace std;
using P = pair<int, int>;
using ll = long long;

int main() {
  ll x;
  cin >> x;
  vector<pair<ll, ll>> A(40001);
  A[0].first = A[0].second = 0;

  ll num = 1;
  rep2(i, 40000) {
    A[i].first = num * num * num * num * num;
    A[i].second = num;
    A[i + 1].first = -num * num * num * num * num;
    A[i + 1].second = -num;
    num += 1;
  }
  ll a, b = 1, anum = 0, bnum = 0, judge = 0;
  rep(i, 40001) {
    a = A[i].first;
    rep(j, 40001) {

      b = A[j].first;
      if (a == (x + b)) {
        judge = 1;
        anum = A[i].second;
        bnum = A[j].second;
        break;
      }
    }
    if (judge == 1)
      break;
  }

  rep(i, 4) {
    if ((a == 0) && (b == 0))
      break;
    else if (a == 0)
      b /= bnum;
    else if (b == 0)
      a /= anum;
    else {
      a /= anum;
      b /= bnum;
    }
  }
  cout << a << " " << b << endl;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
const int INF = 1e9;
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;

int main() {
  cin >> X;

  for (ll i = 1; i < 100000; i++) {
    if (X % i == 0) {
      Y = X / i;
      // cout << Y << endl;
      for (ll j = 0; j <= Y; j++) {

        A = j;
        B = j - i;
        ll A2 = A * A;
        ll B2 = B * B;
        D = A * B;
        E = (A * A) + (A * B) + (A * A);
        if (Y == A2 * A2 + B2 * B2 + D * (A2 + D + B2)) {
          cout << A << " " << B;
          return 0;
        }
      }
    }
  }

  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
const int INF = 1e9;
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;

int main() {
  cin >> X;

  for (ll i = 1; i < 100000; i++) {
    if (X % i == 0) {
      Y = X / i;
      // cout << Y << endl;
      for (ll j = 0; j <= Y / 2; j++) {

        A = j;
        B = j - i;
        ll A2 = A * A;
        ll B2 = B * B;
        D = A * B;
        E = (A * A) + (A * B) + (A * A);
        if (Y == A2 * A2 + B2 * B2 + D * (A2 + D + B2)) {
          cout << A << " " << B;
          return 0;
        }
      }
    }
  }

  return 0;
}
Problem p02690 (C++)

Buggy submission (status: 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, x) {
      int _x = i;
      int _y = _x - p;
      if (fun(_x, _y)) {
        cout << _x << " " << _y << endl;
        break;
      }
    }
  }

  return 0;
}


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, 1e6) {
      int _x = i;
      int _y = _x - p;
      if (fun(_x, _y)) {
        cout << _x << " " << _y << endl;
        break;
      }
    }
  }

  return 0;
}
Problem p02690 (C++)

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

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

  for (int a = -5000; a <= 5000; a++) {
    for (int b = -5000; b <= 5000; b++) {
      long long A = pow(a, 5);
      long long B = pow(b, 5);
      if (A - B == X) {
        cout << a << " " << b << endl;
        return 0;
      }
    }
  }

  return 0;
}

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

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

  for (int a = -1000; a <= 1000; a++) {
    for (int b = -1000; b <= 1000; b++) {
      long long A = pow(a, 5);
      long long B = pow(b, 5);
      if (A - B == X) {
        cout << a << " " << b << endl;
        return 0;
      }
    }
  }

  return 0;
}
Problem p02690 (C++)

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


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

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


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

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


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) {
        mulB = GetMulti(B);
        if (result == mulB) {
          std::cout << A << " " << B << std::endl;
          return 0;
        }
      }
    }
  }
  return 0;
}
Problem p02690 (C++)

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

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

Buggy submission (status: Runtime Error):
#include "bits/stdc++.h"
using namespace std;

long long five[101];

long long p5(int i) {
  if (five[i])
    return five[i];
  else {
    long long tmp = i * i;
    tmp *= tmp;
    tmp *= i;
    five[i] = tmp;
    return tmp;
  }
}

void Main() {
  long long X;
  cin >> X;

  for (int i = 0; i <= 200; i++) {
    for (int j = 0; j <= 200; j++) {
      if (p5(j) - p5(i) == X) {
        cout << j << " " << i << endl;
        return;
      } else if (p5(j) + p5(i) == X) {
        cout << j << " " << -i << endl;
        return;
      }
    }
  }
}

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


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

long long five[201];

long long p5(int i) {
  if (five[i])
    return five[i];
  else {
    long long tmp = i * i;
    tmp *= tmp;
    tmp *= i;
    five[i] = tmp;
    return tmp;
  }
}

void Main() {
  long long X;
  cin >> X;

  for (int i = 0; i <= 200; i++) {
    for (int j = 0; j <= 200; j++) {
      if (p5(j) - p5(i) == X) {
        cout << j << " " << i << endl;
        return;
      } else if (p5(j) + p5(i) == X) {
        cout << j << " " << -i << endl;
        return;
      }
    }
  }
}

int main() {
  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 (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, s, n) for (int i = (s); i < (n); i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define REPR(i, s, n) for (int i = (s); i >= (n); i--)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define pf push_front
const int mod = 1e9 + 7;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
int main() {
  ll x;
  cin >> x;
  for (ll a = -10000; a <= 10000; a++) {
    for (ll b = -10000; b <= 10000; b++) {
      if (pow(a, 5) - pow(b, 5) == x) {
        cout << a << " " << b << endl;
        return 0;
      }
    }
  }
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, s, n) for (int i = (s); i < (n); i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define REPR(i, s, n) for (int i = (s); i >= (n); i--)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define pf push_front
const int mod = 1e9 + 7;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
int main() {
  ll x;
  cin >> x;
  for (ll a = -1000; a <= 1000; a++) {
    for (ll b = -1000; b <= 1000; b++) {
      if (pow(a, 5) - pow(b, 5) == x) {
        cout << a << " " << b << endl;
        return 0;
      }
    }
  }
  return 0;
}
Problem p02690 (C++)

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

int main() {
  int x;
  cin >> x;
  for (int i = 0; i <= 10000; i++) {
    for (int j = -10000; j <= 0; j++) {
      if (pow(i, 5) - pow(j, 5) == x) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
  return 0;
}

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

int main() {
  int x;
  cin >> x;
  for (int i = 0; i <= 5000; i++) {
    for (int j = -2500; j <= 2500; j++) {
      if (pow(i, 5) - pow(j, 5) == x) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
  return 0;
}
Problem p02690 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>
int main() {
  int X;
  while (scanf("%d", &X) != 0) {
    for (long long A = 0; A < 120; A++)
      for (long long B = -120; B < A; B++)
        if (A * A * A * A * A - B * B * B * B * B == X)
          return printf("%lld %lld\n", A, B);
  }
}

Fixed submission:
#include <stdio.h>
int main() {
  int X;
  while (scanf("%d", &X) != 0) {
    for (long long A = 0; A < 120; A++)
      for (long long B = -120; B < A; B++)
        if (A * A * A * A * A - B * B * B * B * B == X)
          return printf("%lld %lld\n", A, B), 0;
  }
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
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;
}
const long long INF = 1LL << 60;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int64_t x;
  cin >> x;
  int64_t a = 0, b = 1;
  int64_t insuu;
  for (int i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      insuu = i;
      break;
    }
  }
  for (int64_t i = (-1000) * insuu;; i += insuu) {
    double ggg = pow(i, 5);
    double gggg = ggg + x;
    double g = pow(gggg, 0.2);
    int64_t gg = pow(gggg, 0.2);
    if (floor(g) == g) {
      a = gg;
      b = i;
      break;
    }
  }
  cout << a << " " << b << endl;
}


Fixed submission:
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
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;
}
const long long INF = 1LL << 60;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int64_t x;
  cin >> x;
  int64_t a = 0, b = 0;
  for (int i = -500; i <= 500; i++) {
    for (int j = -500; j <= 500; j++) {
      if (pow(i, 5) - pow(j, 5) == x) {
        a = i;
        b = j;
        break;
      }
    }
  }
  cout << a << " " << b << endl;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
//

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, x, y) for (int i = x; i < y; i++)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) a / __gcd(a, b) * b
#define range(a) (a).begin(), (a).end()
const int inf = 2147483647;

int main() {
  int X;
  cin >> X;
  ll ansa, ansb;
  rep(i, -4000, 4000) {
    rep(j, -4000, 4000) {
      if (X == pow(j, 5.0) - pow(i, 5.0)) {
        ansa = j;
        ansb = i;
        break;
      }
    }
  }
  cout << ansa << " " << ansb << endl;
}

Fixed submission:
//

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, x, y) for (int i = x; i < y; i++)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) a / __gcd(a, b) * b
#define range(a) (a).begin(), (a).end()
const int inf = 2147483647;

int main() {
  int X;
  cin >> X;
  ll ansa, ansb;
  rep(i, -400, 400) {
    rep(j, -400, 400) {
      if (X == pow(j, 5.0) - pow(i, 5.0)) {
        ansa = j;
        ansb = i;
        break;
      }
    }
  }
  cout << ansa << " " << ansb << endl;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
//
//  main.cpp
//  CoderProj
//
//  Created by Minoru Hayashi on 2020/05/02.
//  Copyright © 2020 Minoru Hayashi. All rights reserved.
//
//  ABC165
//
//

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

#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP2(i, x, n) for (int i = x; i < (n); i++)
#define ALL(n) begin(n), end(n)

using ll = long long;

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

// const ll INF = 1LL<<60;
// const int INF = 1<<29;
// const int MOD = 1000000007;
// #define __DBG__

void solve(void) {

  ll X;

  cin >> X;

  ll Aans = 0;
  ll Bans = 0;

  REP2(A, -100, 1000000) {
    REP2(B, -100, 10000) {
      if (A * A * A * A * A - B * B * B * B * B == X) {
        Aans = A;
        Bans = B;
        break;
      }
    }
  }

  cout << Aans << " " << Bans << endl;
  return;
}

#define TESTCASES 1

int main() {

  cin.tie(0);
  ios::sync_with_stdio(false);

  REP(i, TESTCASES) { solve(); }

  return 0;
}


Fixed submission:
//
//  main.cpp
//  CoderProj
//
//  Created by Minoru Hayashi on 2020/05/02.
//  Copyright © 2020 Minoru Hayashi. All rights reserved.
//
//  ABC165
//
//

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

#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP2(i, x, n) for (int i = x; i < (n); i++)
#define ALL(n) begin(n), end(n)

using ll = long long;

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

// const ll INF = 1LL<<60;
// const int INF = 1<<29;
// const int MOD = 1000000007;
// #define __DBG__

void solve(void) {

  ll X;

  cin >> X;

  ll Aans = 0;
  ll Bans = 0;

  REP2(A, -120, 120) {
    REP2(B, -120, 120) {
      if (A * A * A * A * A - B * B * B * B * B == X) {
        Aans = A;
        Bans = B;
        break;
      }
    }
  }

  cout << Aans << " " << Bans << endl;
  return;
}

#define TESTCASES 1

int main() {

  cin.tie(0);
  ios::sync_with_stdio(false);

  REP(i, TESTCASES) { solve(); }

  return 0;
}
Problem p02690 (C++)

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SP << " "

using namespace std;

void PV(vector<int> pvv) {
  rep(i, pvv.size()) cout << pvv[i] SP;
  cout << endl;
}

int main() {

  long long int x, t = 0;
  vector<int> v;

  cin >> x;

  while (t * t * t * t * t / t / t / t / t / t == 1) {
    v.push_back(t * t * t * t * t);
    // cout << t * t*t*t*t << endl;
    auto itr = lower_bound(v.begin(), v.end(), x - t * t * t * t * t);
    if (*itr == x - t * t * t * t * t) {
      cout << t SP << -1 * (itr - v.begin()) << endl;
      return 0;
    }
    auto itr2 = lower_bound(v.begin(), v.end(), t * t * t * t * t - x);
    if (*itr2 == t * t * t * t * t - x) {
      cout << t SP << itr2 - v.begin() << endl;
      return 0;
    }
    t++;
  }

  return 0;
}


Fixed submission:
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SP << " "

using namespace std;

void PV(vector<int> pvv) {
  rep(i, pvv.size()) cout << pvv[i] SP;
  cout << endl;
}

int main() {

  long long int x, t = 0;
  vector<long long int> v;

  cin >> x;

  while (t * t * t * t * t / t / t / t / t / t == 1) {
    v.push_back(t * t * t * t * t);
    // cout << t * t*t*t*t << endl;
    auto itr = lower_bound(v.begin(), v.end(), x - t * t * t * t * t);
    if (*itr == x - t * t * t * t * t) {
      cout << t SP << -1 * (itr - v.begin()) << endl;
      return 0;
    }
    auto itr2 = lower_bound(v.begin(), v.end(), t * t * t * t * t - x);
    if (*itr2 == t * t * t * t * t - x) {
      cout << t SP << itr2 - v.begin() << endl;
      return 0;
    }
    t++;
  }

  return 0;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;
// ceil() 切り上げ, floor() 切り捨て
// next_permutation(all(x))

int main(void) {
  ll X;
  cin >> X;
  ll A = 0;
  ll B = -10000;
  while (pow(A, 5LL) < X)
    A++;
  while (B < 10000 && pow(A, 5LL) - pow(B, 5LL) != X)
    B++;
  if (B != 10000)
    cout << A << " " << B << endl;
  else {
    A--;
    B = -10000;
    while (pow(A, 5LL) - pow(B, 5LL) != X)
      B++;
    cout << A << " " << B << endl;
  }
}


Fixed submission:
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;
// ceil() 切り上げ, floor() 切り捨て
// next_permutation(all(x))

int main(void) {
  ll X;
  cin >> X;
  for (ll A = -1000LL; A < 1000LL; A++) {
    for (ll B = -1000LL; B < 1000LL; B++) {
      if (pow(A, 5LL) - pow(B, 5LL) == X) {
        cout << A << " " << B << endl;
        return (0);
      }
    }
  }
}
Problem p02690 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define __ << ' ' <<
#define ___ << ' '
#define bash push_back
#define ALL(x) x.begin(), x.end()
// #define int long long

struct IoSetup {
  IoSetup() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
  }
} IoSetup;

using ll = long long;
using pii = pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int SMOD = 1000000007;
constexpr int NMOD = 998244353;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, 1, 0, -1, -1, 1, -1, 1};

inline bool inside(int x, int y, int w, int h) {
  return (x >= 0 && y >= 0 && x < w && y < h);
}
template <class T> bool chmax(T &a, const T &b) {
  return (a < b ? a = b, true : false);
}
template <class T> bool chmin(T &a, const T &b) {
  return (a > b ? a = b, true : false);
}
inline int qp(int a, ll b, int mo) {
  ll ans = 1;
  do {
    if (b & 1)
      ans = 1ll * ans * a % mo;
    a = 1ll * a * a % mo;
  } while (b >>= 1);
  return ans;
}

signed main() {

  ll x;

  cin >> x;

  ll s = 0, i = 0;
  vector<pair<ll, int>> v;
  while (abs(s) < 1e9) {
    s = i * i * i * i * i;
    v.bash({s, i});
    v.bash({-s, -i});
    ++i;
  }

  sort(ALL(v));

  for (auto &&a : v) {
    auto p = *lower_bound(ALL(v), pair<ll, int>(a.first - x, -INF));
    if (a.first - p.first == x) {
      cout << a.second __ p.second << endl;
      return 0;
    }
  }

  return 1;

  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define __ << ' ' <<
#define ___ << ' '
#define bash push_back
#define ALL(x) x.begin(), x.end()
// #define int long long

struct IoSetup {
  IoSetup() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
  }
} IoSetup;

using ll = long long;
using pii = pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int SMOD = 1000000007;
constexpr int NMOD = 998244353;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, 1, 0, -1, -1, 1, -1, 1};

inline bool inside(int x, int y, int w, int h) {
  return (x >= 0 && y >= 0 && x < w && y < h);
}
template <class T> bool chmax(T &a, const T &b) {
  return (a < b ? a = b, true : false);
}
template <class T> bool chmin(T &a, const T &b) {
  return (a > b ? a = b, true : false);
}
inline int qp(int a, ll b, int mo) {
  ll ans = 1;
  do {
    if (b & 1)
      ans = 1ll * ans * a % mo;
    a = 1ll * a * a % mo;
  } while (b >>= 1);
  return ans;
}

signed main() {

  ll x;

  cin >> x;

  ll s = 0, i = 0;
  vector<pair<ll, int>> v;
  while (abs(s) < 1e18) {
    s = i * i * i * i * i;
    v.bash({s, i});
    v.bash({-s, -i});
    ++i;
  }

  sort(ALL(v));

  for (auto &&a : v) {
    auto p = *lower_bound(ALL(v), pair<ll, int>(a.first - x, -INF));
    if (a.first - p.first == x) {
      cout << a.second __ p.second << endl;
      return 0;
    }
  }

  return 1;

  return 0;
}
Problem p02690 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using llong = long long;

llong f(llong x) { return x * x * x * x * x; }

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

  for (llong i = -64; i <= 64; i++) {
    for (llong j = -64; j <= 64; j++) {
      if (f(i) - f(j) == x) {
        cout << i << ' ' << j << endl;
        return 0;
      }
    }
  }

  return 1;
}


Fixed submission:
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using llong = long long;

llong f(llong x) { return x * x * x * x * x; }

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

  for (int i = -1000; i <= 1000; i++) {
    llong y = x + f(i);

    for (int j = 0; j <= 1024; j++) {
      if (f(j) == y) {
        cout << j << ' ' << i << endl;
        return 0;
      }
    }
  }

  return 1;
}
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)

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;
}

int main() {
  int N;
  cin >> N;
  const auto &res = enum_divisors(N);

  for (int i = 0; i < res.size(); ++i) {
    rep(a, N) {
      if (pow(a, 5) - pow(a - res[i], 5) == N) {
        cout << a << ' ' << a - res[i] << endl;
        return 0;
      }
      if (pow(a, 5) - pow(res[i] - a, 5) == N) {
        cout << a << ' ' << res[i] - a << endl;
        return 0;
      }
    }
  }
  return 0;
}

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

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;
}

int main() {
  int N;
  cin >> N;
  const auto &res = enum_divisors(N);

  for (int i = 0; i < res.size(); ++i) {
    for (int a = 0; a < sqrt(N); ++a) {
      if (pow(a, 5) - pow(a - res[i], 5) == N) {
        cout << a << ' ' << a - res[i] << endl;
        return 0;
      }
      if (pow(a, 5) - pow(res[i] - a, 5) == N) {
        cout << a << ' ' << res[i] - a << endl;
        return 0;
      }
    }
  }
  return 0;
}
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;
  for (int i = -10000; i <= 10000; i++) {
    for (int j = -10000; j <= 10000; j++) {
      if (pow(i, 5) - pow(j, 5) == X) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
}

Fixed submission:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

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

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repc(i, a, b) for (int i = a; i <= (int)(b); i++)
#define ll long long
#define vec vector
#define ft first
#define sd second
#define all(vec) vec.begin(), vec.end()
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;

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

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repc(i, a, b) for (int i = a; i <= (int)(b); i++)
#define ll long long
#define vec vector
#define ft first
#define sd second
#define all(vec) vec.begin(), vec.end()
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;

int main() {
  ll x;
  cin >> x;
  for (ll a = -200; a <= 200; a++)
    for (ll b = -200; b <= 200; b++) {
      if ((a - b) != 0 && x % (a - b) == 0) {
        if (a * a * a * a * a - b * b * b * b * b == x) {
          cout << a << " " << b << endl;
          return 0;
        }
      }
    }
  return 0;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  map<int, pair<int, int>> check;
  for (int i = -10000; i < 10000; i++) {
    for (int j = -10000; j < 10000; j++) {
      check[pow(i, 5) - pow(j, 5)] = make_pair(i, j);
    }
  }
  int x;
  cin >> x;
  cout << check[x].first << ' ' << check[x].second;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  map<int, pair<int, int>> check;
  for (int i = -1000; i <= 1000; i++) {
    for (int j = -1000; j <= 1000; j++) {
      check[pow(i, 5) - pow(j, 5)] = make_pair(i, j);
    }
  }
  int x;
  cin >> x;
  cout << check[x].first << ' ' << check[x].second;
}
Problem p02690 (C++)

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

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

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

int main() {
  // your code goes here
  int x;
  cin >> x;
  for (long long i = 0; i <= 10000; i++) {
    for (long long j = -100000; j <= 100000; j++) {
      if ((pow(i, 5) - pow(j, 5)) == x) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
  return 0;
}


Fixed submission:
#include <cmath>
#include <iostream>
using namespace std;

int main() {
  // your code goes here
  int x;
  cin >> x;
  int flag = 0;
  for (long long i = 0; i < 10000; i++) {
    for (long long j = -10000; j < 10000; j++) {
      if ((pow(i, 5) - pow(j, 5)) == 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;
int main() {
  long long X, A, B;
  cin >> X;
  for (int i = 0; i < 10000000; i++) {
    for (int j = i - 65; j < i + 1000; j++) {
      A = i * i * i * i * i;
      B = j * j * j * j * j;
      if (A - B == X) {
        cout << i << " " << j << endl;
        goto as;
      }
    }
  }
as:
  cout << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long X, A, B;
  cin >> X;
  for (long long i = -200; i < 200; i++) {
    for (long long j = -200; j < 200; j++) {
      A = i * i * i * i * i;
      B = j * j * j * j * j;
      if (A - B == X) {
        cout << i << " " << j << endl;
        goto as;
      }
    }
  }
as:
  cout << endl;
}
Problem p02690 (C++)

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

using namespace std;
using ll = long long;

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


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

using namespace std;
using ll = long long;

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

  for (ll a = -120; a <= 120; a++) {
    for (ll b = -120; b <= 120; b++) {
      if (a * a * a * a * a - b * b * b * b * b == x) {
        cout << a << " " << b << endl;
        return 0;
      }
    }
  }
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <vector>

#define log(x) cout << x << endl
#define pb push_back
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long lint;
using namespace std;
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;
}
const long long INF = 1LL << 60;

// <<fixed<<setprecision(6)<<

int gcd(lint x, lint y) { return y == 0 ? x : gcd(y, x % y); }

int digsum(int n) {
  int res = 0;
  while (n > 0) {
    res += n % 10;
    n /= 10;
  }
  return res;
}

int dignum(int n) {
  int res = 0;
  while (n > 0) {
    res++;
    n /= 10;
  }
  return res;
}

int stringcount(string s, char c) { return count(s.cbegin(), s.cend(), c); }

int lcm(lint x, lint y) { return x / gcd(x, y) * y; }

int combi(int n, int r) {
  int num = 1;
  for (int i = 1; i <= r; i++) {
    num = num * (n - i + 1) / i;
  }
  return num;
}

int main() {
  lint x;
  cin >> x;
  lint a, b;
  bool is = true;
  for (lint i = -1; i < 10000; i++ && is) {
    for (lint j = -1; j < 10000; j++ && is) {
      if (pow(i, 5) - pow(j, 5) == x) {
        a = i;
        b = j;
        is = false;
        break;
      }
    }
  }
  cout << a << " " << b;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <vector>

#define log(x) cout << x << endl
#define pb push_back
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long lint;
using namespace std;
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;
}
const long long INF = 1LL << 60;

// <<fixed<<setprecision(6)<<

int gcd(lint x, lint y) { return y == 0 ? x : gcd(y, x % y); }

int digsum(int n) {
  int res = 0;
  while (n > 0) {
    res += n % 10;
    n /= 10;
  }
  return res;
}

int dignum(int n) {
  int res = 0;
  while (n > 0) {
    res++;
    n /= 10;
  }
  return res;
}

int stringcount(string s, char c) { return count(s.cbegin(), s.cend(), c); }

int lcm(lint x, lint y) { return x / gcd(x, y) * y; }

int combi(int n, int r) {
  int num = 1;
  for (int i = 1; i <= r; i++) {
    num = num * (n - i + 1) / i;
  }
  return num;
}

int main() {
  lint x;
  cin >> x;
  lint a, b;
  bool is = true;
  for (lint i = -300; i < 300; i++ && is) {
    for (lint j = -300; j < 300; j++ && is) {
      if (pow(i, 5) - pow(j, 5) == x) {
        a = i;
        b = j;
        is = false;
        break;
      }
    }
  }
  cout << a << " " << b;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define ll long long int
#define ul unsigned long long int
#define va vector<long long int> a
#define vb vector<long long int> b
#define M 1000000007
using namespace std;
ll t;
void fast() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
}
ll power(ll x, ul y, ll p) {
  ll res = 1;
  x = x % p;
  if (x == 0)
    return 0;
  while (y > 0) {
    if (y & 1)
      res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res % p;
}
void solve() {
  ll n;
  cin >> n;
  for (ll i = -1000; i < 1000; i++) {
    for (ll j = -1000; j < 1000; j++) {
      // cout<<(power(i,5,M)-power(i,5,M))%M<<"\n";
      if ((i * i * i * i * i) - (j * j * j * j * j) == n) {
        cout << i << " " << j << "\n";
        i = 100;
        j = 100;
      }
    }
  }
}
int main() {
  fast();
  solve();
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#define ll long long int
#define ul unsigned long long int
#define va vector<long long int> a
#define vb vector<long long int> b
#define M 1000000007
using namespace std;
ll t;
void fast() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
}
ll power(ll x, ul y, ll p) {
  ll res = 1;
  x = x % p;
  if (x == 0)
    return 0;
  while (y > 0) {
    if (y & 1)
      res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res % p;
}
void solve() {
  ll n;
  cin >> n;
  for (ll i = -1000; i < 1000; i++) {
    for (ll j = -1000; j < 1000; j++) {
      // cout<<(power(i,5,M)-power(i,5,M))%M<<"\n";
      if ((i * i * i * i * i) - (j * j * j * j * j) == n) {
        cout << i << " " << j << "\n";
        i = 1000;
        j = 1000;
      }
    }
  }
}
int main() {
  fast();
  solve();
  return 0;
}
Problem p02690 (C++)

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

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


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

int main() {
  long long X;
  cin >> X;
  for (int i = -1000; i < 1000; i++) {
    for (int j = -1000; j < i; 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: Runtime Error):
#include <cstdio>
typedef long long ll;
inline int rd() {
  int x = 0, p = 1;
  char a = getchar();
  while ((a < 48 || a > 57) && a != '-')
    a = getchar();
  if (a == '-')
    p = -p, a = getchar();
  while (a > 47 && a < 58)
    x = (x << 1) + (x << 3) + (a & 15), a = getchar();
  return x * p;
}
ll x;
int main() {
  x = rd();
  for (ll a = 0; a <= 1000; a++)
    for (ll b = -1000; b <= 1000; b++)
      if ((1ll * a * a * a * a * a - 1ll * b * b * b * b * b) == x)
        return printf("%lld %lld\n", a, b);
  return 0;
}

Fixed submission:
#include <cstdio>
typedef long long ll;
inline int rd() {
  int x = 0, p = 1;
  char a = getchar();
  while ((a < 48 || a > 57) && a != '-')
    a = getchar();
  if (a == '-')
    p = -p, a = getchar();
  while (a > 47 && a < 58)
    x = (x << 1) + (x << 3) + (a & 15), a = getchar();
  return x * p;
}
ll x;
int main() {
  x = rd();
  for (ll a = 0; a <= 1000; a++)
    for (ll b = -1000; b <= 1000; b++)
      if ((1ll * a * a * a * a * a - 1ll * b * b * b * b * b) == x)
        return printf("%lld %lld\n", a, b), 0;
  return 0;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <vector>
using namespace std;

int main() {
  long long int X;
  cin >> X;
  for (long long int i = -100; i <= 100; i++) {
    for (long long int j = -100; j <= 100; j++) {
      long long int ans = (int)pow(i, 5) - (int)pow(j, 5);
      if (ans == X) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
  long long int loop = 2 * (int)pow(10, 4);
  for (long long int i = 101; i <= loop; i++) {
    for (long long int j = i; j > 0; j--) {
      long long int ans = (int)pow(i, 5) - (int)pow(j, 5);
      if (ans > (long long int)pow(10, 9))
        break;
      if (ans == X) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
  return 0;
}


Fixed submission:
#include <iostream>
#include <map>
#include <math.h>
#include <string>
#include <vector>
using namespace std;

int main() {
  long long int X;
  cin >> X;
  for (long long int i = -200; i <= 200; i++) {
    for (long long int j = -200; j <= 200; j++) {
      long long int ans = (long long)pow(i, 5) - (long long)pow(j, 5);
      if (ans == X) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
  return 0;
}
Problem p02690 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template <typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template <typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {
  FastIO() {
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
} fastiofastio;
#ifdef DEBUG
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL << 60;

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

  for (ll a = -100; a <= 100; ++a)
    for (ll b = -100; b <= 100; ++b) {
      if (a * a * a * a * a - b * b * b * b * b == x) {
        cout << a << " " << b << endl;
        return 0;
      }
    }
  assert(false);

  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template <typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template <typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {
  FastIO() {
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
} fastiofastio;
#ifdef DEBUG
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL << 60;

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

  for (ll a = -3000; a <= 3000; ++a)
    for (ll b = -3000; b <= 3000; ++b) {
      if (a * a * a * a * a - b * b * b * b * b == x) {
        cout << a << " " << b << endl;
        return 0;
      }
    }
  assert(false);

  return 0;
}
Problem p02690 (C++)

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

long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}

int main() {
  ll x;
  cin >> x;
  for (ll i = -118; i <= 119; i++) {
    for (ll j = -119; j = 118; j++) {
      if ((i * i * i * i * i - j * j * j * j * j) == x) {
        cout << i << endl << j << endl;
        x = 0;
        break;
      }
    }
    if (x == 0)
      break;
  }
}

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

long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}

int main() {
  ll x;
  cin >> x;
  for (ll i = -118; i <= 119; i++) {
    for (ll j = -119; j <= 118; j++) {
      if ((i * i * i * i * i - j * j * j * j * j) == x) {
        cout << i << endl << j << endl;
        x = 0;
        break;
      }
    }
    if (x == 0)
      break;
  }
}