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

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

using namespace std;

int main(void) {
  std::array<bool, 10> is_good_list;
  std::array<int, 10> height_list;
  int n, m;
  cin >> n;
  cin >> m;
  is_good_list.fill(true);

  // 展望台の高さを登録
  for (int s = 0; s < n; s++) {
    int h;
    cin >> h;
    height_list[s] = h;
  }

  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a;
    cin >> b;
    a--;
    b--;
    if (height_list[a] <= height_list[b]) {
      is_good_list[a] = false;
    }
    if (height_list[a] >= height_list[b]) {
      is_good_list[b] = false;
    }
  }
  int good_num = 0;
  for (int i = 0; i < n; i++) {
    if (is_good_list[i]) {
      good_num++;
    }
  }
  cout << good_num;
}

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

using namespace std;

int main(void) {
  std::array<bool, 100000> is_good_list;
  std::array<int, 100000> height_list;
  int n, m;
  cin >> n;
  cin >> m;
  is_good_list.fill(true);

  // 展望台の高さを登録
  for (int s = 0; s < n; s++) {
    int h;
    cin >> h;
    height_list[s] = h;
  }

  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a;
    cin >> b;
    a--;
    b--;
    if (height_list[a] <= height_list[b]) {
      is_good_list[a] = false;
    }
    if (height_list[a] >= height_list[b]) {
      is_good_list[b] = false;
    }
  }
  int good_num = 0;
  for (int i = 0; i < n; i++) {
    if (is_good_list[i]) {
      good_num++;
    }
  }
  cout << good_num;
}
Problem p02689 (C++)

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

int main() {
  long long N, M;
  cin >> N >> M;
  vector<long long> H(N);
  for (long long i = 0; i < N; i++) {
    cin >> H.at(i);
  }
  vector<long long> A(M), B(M);
  for (long long i = 0; i < M; i++) {
    cin >> A.at(i) >> B.at(i);
  }
  vector<long long> ans(N, 0);
  for (long long i = 0; i < M; i++) {

    if (H.at(A.at(i) - 1) > H.at(B.at(i) - 1)) {
      ans.at(B.at(i) - 1) = 1;
    }
    if (H.at(A.at(i) - 1) < H.at(B.at(i) - 1)) {
      ans.at(A.at(i) - 1) = 1;
    }
    if (H.at(A.at(i)) == H.at(B.at(i))) {
      ans.at(A.at(i) - 1) = 1;
      ans.at(B.at(i) - 1) = 1;
    }
  }
  long long X = 0;
  for (long long i = 0; i < N; i++) {
    if (ans.at(i) == 1) {
      X++;
    }
  }
  cout << N - X << endl;
}


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

int main() {
  long long N, M;
  cin >> N >> M;
  vector<long long> H(N);
  for (long long i = 0; i < N; i++) {
    cin >> H.at(i);
  }
  vector<long long> A(M), B(M);
  for (long long i = 0; i < M; i++) {
    cin >> A.at(i) >> B.at(i);
  }
  vector<long long> ans(N, 0);
  for (long long i = 0; i < M; i++) {

    if (H.at(A.at(i) - 1) > H.at(B.at(i) - 1)) {
      ans.at(B.at(i) - 1) = 1;
    }
    if (H.at(A.at(i) - 1) < H.at(B.at(i) - 1)) {
      ans.at(A.at(i) - 1) = 1;
    }
    if (H.at(A.at(i) - 1) == H.at(B.at(i) - 1)) {
      ans.at(A.at(i) - 1) = 1;
      ans.at(B.at(i) - 1) = 1;
    }
  }
  long long X = 0;
  for (long long i = 0; i < N; i++) {
    if (ans.at(i) == 1) {
      X++;
    }
  }
  cout << N - X << endl;
}
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;
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;
      }
    }
  }
}

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

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

using namespace std;

#define INF (1 << 30)
#define EPS 1e-10
#define MOD 1000000007

#define rep(i, n) FOR(i, 0, n)
#define FOR(i, x, n) for (int i = (x); i < (n); ++i)
#define all(v) (v).begin(), (v).end()

using ll = long long;

template <class T> void chmax(T &a, T b) { a > b ?: a = b; }
template <class T> void chmin(T &a, T b) { a < b ?: a = b; }

ll x;

void f(ll c) {
  for (ll b = -1e6; b <= 1e6; ++b) {
    ll a = b + c;
    if (pow(a, 5LL) - pow(b, 5LL) == x) {
      cout << a << " " << b << endl;
      exit(0);
    }
  }
}

int main() {
  cin >> x;
  for (ll i = 1; i * i <= x; ++i) {
    if (x % i == 0) {
      f(i);
      if (x / i != i)
        f(x / i);
    }
  }

  return 0;
}

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

using namespace std;

#define INF (1 << 30)
#define EPS 1e-10
#define MOD 1000000007

#define rep(i, n) FOR(i, 0, n)
#define FOR(i, x, n) for (int i = (x); i < (n); ++i)
#define all(v) (v).begin(), (v).end()

using ll = long long;

template <class T> void chmax(T &a, T b) { a > b ?: a = b; }
template <class T> void chmin(T &a, T b) { a < b ?: a = b; }

ll x;

void f(ll c) {
  for (ll b = -1e4; b <= 1e4; ++b) {
    ll a = b + c;
    if (pow(a, 5LL) - pow(b, 5LL) == x) {
      cout << a << " " << b << endl;
      exit(0);
    }
  }
}

int main() {
  cin >> x;
  for (ll i = 1; i * i <= x; ++i) {
    if (x % i == 0) {
      f(i);
      if (x / i != i)
        f(x / i);
    }
  }

  return 0;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = 1000000007;
using Graph = vector<vector<int>>;

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

  for (int i = 1;; i++) {
    int A = i * i * i * i * i;
    int sa = abs(X - A);
    for (int j = 0; j < 5; j++)
      sa = sqrt(sa);
    if (pow(sa, 5) != abs(X - A))
      continue;
    if (X - A > 0)
      cout << i << " " << -1 * sa << endl;
    else
      cout << i << " " << sa << endl;
    return 0;
  }
}

Fixed submission:
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = 1000000007;
using Graph = vector<vector<int>>;

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

  for (int A = -150; A <= 150; A++) {
    for (int B = -150; B <= 150; B++) {
      if (pow(A, 5) - pow(B, 5) == X) {
        cout << A << " " << B << endl;
        return 0;
      }
    }
  }
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  ll X;
  cin >> X;
  if (X == 1) {
    cout << 0 << " " << -1 << endl;
    return 0;
  }
  for (ll i = 1; i < X; i++) {
    if (X % i == 0) {
      ll X1 = i;
      ll X2 = X / i;
      for (int b = -X1; b <= X1; b++) {
        ll a = X1 + b;
        ll ans = pow(X1 + b, 4) + pow(X1 + b, 3) * b + pow(X1 + b, 2) * b * b +
                 pow(X1 + b, 1) * b * b * b + b * b * b * b;
        // cout << a << " " << b <<" " << ans<< endl;
        if (X2 == ans) {
          cout << a << " " << b << endl;
          return 0;
        }
      }
    }
  }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

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: Time Limit Exceeded):
// 2020-05-03 21:21:37
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
ll f(ll x) { return x * x * x * x * x; }
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll X;
  cin >> X;
  while (true) {
    ll A = -1000;
    for (ll B = -1000; B < 1000; B++) {
      if (f(A) - f(B) == X) {
        cout << A << " " << B << endl;
        return 0;
      }
    }
    A++;
  }
}

Fixed submission:
// 2020-05-03 21:21:37
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
ll f(ll x) { return x * x * x * x * x; }
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll X;
  cin >> X;
  int A = 1;
  while (f(A) - f(A - 1) < 1000000000) {
    for (int B = -200; B < 200; B++) {
      if (f(A) - f(B) == X) {
        cout << A << " " << B << endl;
        return 0;
      }
    }
    A++;
  }
}
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;
using ll = long long;
using P = pair<int, int>;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll x;
  cin >> x;
  for (ll i = 0; i < 100000; ++i) {
    for (ll j = 0; j < 100000; ++j) {
      if (i * i * i * i * i + j * j * j * j * j == x) {
        cout << i << " " << 0 - j << 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;
using ll = long long;
using P = pair<int, int>;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll x;
  cin >> x;
  map<ll, ll> mp;
  mp[0] = 0;
  for (ll i = 1; i * i * i * i * i <= 100 * x; i++) {
    ll cur = i * i * i * i * i;
    mp[cur] = i;
    mp[-cur] = -i;
    if (mp.count(cur - x) != 0) {
      cout << i << " " << mp[cur - x] << endl;
    }
  }
  return 0;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using ll = long long;
#define rep(i, n) for (ll i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()

using namespace std;
using Graph = vector<vector<int>>;

int main() {
  ll x;
  cin >> x;
  ll a, b;
  ll y = sqrt(x);
  // cout <<y<<endl;
  rep(i, y) {
    if (x % i == 0) {

      for (ll j = 0; j <= pow(x, 0.8); j++) {
        //  cout<<pow(x,0.2)<<endl;
        if (j * j * j * j + j * j * j * (j - i) + j * j * (j - i) * (j - i) +
                j * (j - i) * (j - i) * (j - i) +
                (j - i) * (j - i) * (j - i) * (j - i) ==
            x / i) {
          a = j;
          b = j - i;
          break;
        }
      }
      if (!(a == 0 && b == 0))
        break;
    }
  }

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

Fixed submission:
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using ll = long long;
#define rep(i, n) for (ll i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()

using namespace std;
using Graph = vector<vector<int>>;

int main() {
  ll x;
  cin >> x;
  ll a, b;
  ll y = sqrt(x);
  // cout <<y<<endl;
  rep(i, y) {
    if (x % i == 0) {

      for (ll j = 0; j <= pow(x, 0.6); j++) {
        //  cout<<pow(x,0.2)<<endl;
        if (j * j * j * j + j * j * j * (j - i) + j * j * (j - i) * (j - i) +
                j * (j - i) * (j - i) * (j - i) +
                (j - i) * (j - i) * (j - i) * (j - i) ==
            x / i) {
          a = j;
          b = j - i;
          break;
        }
      }
      if (!(a == 0 && b == 0))
        break;
    }
  }

  cout << a << " " << b << endl;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int x;
  cin >> x;
  int a = 0, b = 0;
  int temp = 0;
  while (1) {
    while (pow(a, 5.0) < x) {
      a++;
    }
    if (pow(a, 5.0) == x) {
      cout << a << " " << b << endl;
      return 0;
    }
    a--;
    temp = pow(a, 5.0);
    int val = 0;
    while ((val = temp - pow(b, 5.0)) != x && val <= x) {
      b--;
    }
    if (temp - pow(b, 5.0) == x) {
      cout << a << " " << b << endl;
      return 0;
    }
  }
  return 0;
}

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

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define ll long long
#define P pair<ll, ll>
#define mk make_pair
using namespace std;
const int N = 55;
ll a[N];
map<ll, P> mp;
int main() {
  for (ll i = 0; i <= 1000; i++) {
    ll y = i;
    for (ll x = 1; x <= 4; x++) {
      y = y * i;
    }
    a[i] = y;
  }
  for (int i = 0; i <= 1000; i++) {
    for (int j = 0; j <= 1000; j++) {
      mp[a[i] - a[j]] = mk(i, j);
      mp[a[i] + a[j]] = mk(i, -j);
    }
  }
  ll x;
  cin >> x;
  cout << mp[x].first << ' ' << mp[x].second << '\n';
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#define ll long long
#define P pair<ll, ll>
#define mk make_pair
using namespace std;
const int N = 10005;
ll a[N];
map<ll, P> mp;
int main() {
  for (ll i = 0; i <= 1000; i++) {
    ll y = i;
    for (ll x = 1; x <= 4; x++) {
      y = y * i;
    }
    a[i] = y;
  }
  for (int i = 0; i <= 1000; i++) {
    for (int j = 0; j <= 1000; j++) {
      mp[a[i] - a[j]] = mk(i, j);
      mp[a[i] + a[j]] = mk(i, -j);
    }
  }
  ll x;
  cin >> x;
  cout << mp[x].first << ' ' << mp[x].second << '\n';
  return 0;
}
Problem p02690 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
inline int gi() {
  int data = 0, w = 1;
  char ch = 0;
  while (!isdigit(ch) && ch != '-')
    ch = getchar();
  if (ch == '-')
    w = -1, ch = getchar();
  while (isdigit(ch))
    data = 10 * data + ch - '0', ch = getchar();
  return w * data;
}
long long X;
int main() {
  cin >> X;
  for (long long a = -500; a <= 500; a++)
    for (long long b = -500; b <= 500; b++) {
      long long t1 = a * a * a * a * a, t2 = b * b * b * b * b;
      if (t1 - t2 == X)
        return printf("%lld %lld\n", a, b);
    }
  return 0;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
inline int gi() {
  int data = 0, w = 1;
  char ch = 0;
  while (!isdigit(ch) && ch != '-')
    ch = getchar();
  if (ch == '-')
    w = -1, ch = getchar();
  while (isdigit(ch))
    data = 10 * data + ch - '0', ch = getchar();
  return w * data;
}
long long X;
int main() {
  cin >> X;
  for (long long a = -500; a <= 500; a++)
    for (long long b = -500; b <= 500; b++) {
      long long t1 = a * a * a * a * a, t2 = b * b * b * b * b;
      if (t1 - t2 == X)
        return printf("%lld %lld\n", a, b) & 0;
    }
  return 0;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define FOR(i, m, n) for (ll i = m; i < (n); i++)
#define RFOR(i, m, n) for (ll i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
// #define print(ele) cout << (ele) << "\n"
#define print10(ele) cout << fixed << setprecision(10) << (ele) << "\n"

using namespace std;
typedef long long ll;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

void print() { cout << endl; }

template <class Head, class... Tail> void print(Head &&head, Tail &&...tail) {
  cout << head;
  if (sizeof...(tail) != 0)
    cout << " ";
  print(forward<Tail>(tail)...);
}

int main() {
  ll x;
  cin >> x;
  int a, b;
  FOR(i, -sqrt(x) - 1, sqrt(x) + 1) {
    FOR(j, -sqrt(x) - 1, sqrt(x) + 1) {
      if (pow(i, 5) - pow(j, 5) == x) {
        print(i, j);
        return 0;
      }
    }
  }

  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define FOR(i, m, n) for (ll i = m; i < (n); i++)
#define RFOR(i, m, n) for (ll i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
// #define print(ele) cout << (ele) << "\n"
#define print10(ele) cout << fixed << setprecision(10) << (ele) << "\n"

using namespace std;
typedef long long ll;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

void print() { cout << endl; }

template <class Head, class... Tail> void print(Head &&head, Tail &&...tail) {
  cout << head;
  if (sizeof...(tail) != 0)
    cout << " ";
  print(forward<Tail>(tail)...);
}

int main() {
  ll x;
  cin >> x;
  int y = pow(x, 1.0 / 3.0);
  FOR(i, -y - 1, y + 1) {
    FOR(j, -y - 1, y + 1) {
      if (pow(i, 5) - pow(j, 5) == x) {
        print(i, j);
        return 0;
      }
    }
  }

  return 0;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <string>
#include <vector>

using namespace std;

#define ll long long int
#define rep(i, n) for (int i = 0; i < n; i++)
#define repp(i, n) for (int i = 1; i <= n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define riverse(v) reverse((v).begin(), (v).end())
using vi = vector<int>;
using vs = vector<string>;
const int MOD = 1e9 + 7;

int main() {
  ll X;
  cin >> X;
  vector<ll> kouho;
  ll A = 0;
  ll B = 0;
  bool frag = false;
  for (int i = 1; i < sqrt(X) + 1; i++) {
    if (X % i == 0) {
      kouho.push_back(i);
      kouho.push_back(X / i);
    }
  }
  for (ll x : kouho) {
    for (ll i = 0 - x / 2; i < 130; i++) {
      ll y = pow(i + x, 5) - pow(i, 5);
      if (y == X) {
        B = i;
        A = i + x;
        frag = true;
      } else if (y > X)
        break;
    }
    if (frag)
      break;
  }
  if (!frag) {
    for (ll x : kouho) {
      for (ll i = 0 - x / 2; i >= (-1) * x; i--) {
        ll y = pow(i + x, 5) - pow(i, 5);
        if (y == X) {
          B = i;
          A = i + x;
          frag = true;
        } else if (y > X)
          break;
      }
      if (frag)
        break;
    }
  }
  cout << A << " " << B << endl;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <string>
#include <vector>

using namespace std;

#define ll long long int
#define rep(i, n) for (int i = 0; i < n; i++)
#define repp(i, n) for (int i = 1; i <= n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define riverse(v) reverse((v).begin(), (v).end())
using vi = vector<int>;
using vs = vector<string>;
const int MOD = 1e9 + 7;

int main() {
  ll X;
  cin >> X;
  vector<ll> kouho;
  ll A = 0;
  ll B = 0;
  bool frag = false;
  for (int i = 1; i < sqrt(X) + 1; i++) {
    if (X % i == 0) {
      kouho.push_back(i);
    }
  }
  for (ll x : kouho) {
    for (ll i = 0 - x / 2; i < 130; i++) {
      ll y = pow(i + x, 5) - pow(i, 5);
      if (y == X) {
        B = i;
        A = i + x;
        frag = true;
      } else if (y > X)
        break;
    }
    if (frag)
      break;
  }
  if (!frag) {
    for (ll x : kouho) {
      for (ll i = 0 - x / 2; i >= (-1) * x; i--) {
        ll y = pow(i + x, 5) - pow(i, 5);
        if (y == X) {
          B = i;
          A = i + x;
          frag = true;
        } else if (y > X)
          break;
      }
      if (frag)
        break;
    }
  }
  cout << A << " " << B << endl;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <string.h>
#include <vector>

using namespace std;

long long i, j, k, n, m, N, M, ans, X, A, B;

double x;

int main() {
  cin >> X;

  A = 0;
  B = 0;

  for (i = 0; i <= X; i++) {
    N = i * i * i * i * i;
    if (2 * N >= X) {
      n = i;
      break;
    }
  }

  for (i = n; i <= X; i++) {
    for (j = 0; j <= n; j++) {
      N = i * i * i * i * i;
      M = j * j * j * j * j;
      if (N - M == X) {
        A = i;
        B = j;
        break;
      } else if (N + M == X) {
        A = i;
        B = -j;
        break;
      } else if (-N - M == X) {
        A = -i;
        B = j;
        break;
      } else if (-N + M == X) {
        A = -i;
        B = -j;
        break;
      }
    }

    if (A != 0)
      break;
  }

  cout << A << " " << B;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <string.h>
#include <vector>

using namespace std;

long long i, j, k, n, m, N, M, ans, X, A, B;

double x;

int main() {
  cin >> X;

  A = 0;
  B = 0;

  for (i = 0; i <= X; i++) {
    N = i * i * i * i * i;
    if (2 * N >= X) {
      n = i;
      break;
    }
  }

  for (i = n; i <= X; i++) {
    for (j = 0; j <= i; j++) {
      N = i * i * i * i * i;
      M = j * j * j * j * j;
      if (N - M == X) {
        A = i;
        B = j;
        break;
      } else if (N + M == X) {
        A = i;
        B = -j;
        break;
      } else if (-N - M == X) {
        A = -i;
        B = j;
        break;
      } else if (-N + M == X) {
        A = -i;
        B = -j;
        break;
      }
    }

    if (A != 0)
      break;
  }

  cout << A << " " << B;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef long double ld;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF ll(1e18)
#define MOD (ll)1e9 + 7
#define print(a)                                                               \
  ;                                                                            \
  for (auto x : a)                                                             \
    cout << x << " ";                                                          \
  cout << "\n";
#define mset(a)                                                                \
  ;                                                                            \
  memset(a, 0, sizeof(a));

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ll x;
  cin >> x;
  for (ll i = -3000; i <= 3000; i++) {
    for (ll j = -3000; j <= 3000; j++) {
      if (pow(i, 5) - pow(j, 5) == x) {
        cout << i << " " << j << "\n";
        return 0;
      }
    }
  }
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef long double ld;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF ll(1e18)
#define MOD (ll)1e9 + 7
#define print(a)                                                               \
  ;                                                                            \
  for (auto x : a)                                                             \
    cout << x << " ";                                                          \
  cout << "\n";
#define mset(a)                                                                \
  ;                                                                            \
  memset(a, 0, sizeof(a));

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ll x;
  cin >> x;
  for (ll i = -118; i <= 119; i++) {
    for (ll j = -119; j <= 118; j++) {
      if (pow(i, 5) - pow(j, 5) == x) {
        cout << i << " " << j << "\n";
        return 0;
      }
    }
  }
}
Problem p02690 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <vector>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target(                                                            \
    "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
#define pie 3.141592653589793238
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int x;
  cin >> x;

  long long map[121];
  for (long long i = 0; i < 121; i++) {
    map[i] = i * i * i * i * i;
  }

  for (int i = 0; i < 121; i++) {
    for (int j = 0; i < 121; j++) {
      if (map[i] - map[j] == x) {
        cout << i << " " << j << endl;
        return 0;
      }
      if (map[i] + map[j] == x) {
        cout << i << " " << j * -1 << endl;
        return 0;
      }
    }
  }

  return 0;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <vector>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target(                                                            \
    "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
#define pie 3.141592653589793238
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int x;
  cin >> x;

  long long map[121];
  for (long long i = 0; i < 121; i++) {
    map[i] = i * i * i * i * i;
  }

  for (int i = 0; i < 121; i++) {
    for (int j = 0; j < 121; j++) {
      if (map[i] - map[j] == x) {
        cout << i << " " << j << endl;
        return 0;
      }
      if (map[i] + map[j] == x) {
        cout << i << " " << j * -1 << endl;
        return 0;
      }
    }
  }

  return 0;
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for (int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) ((v).begin(), (v).end())
using ll = long long;
using P = pair<int, int>;
/* ------------------------------------------------ */
ll fact(int i) { // 階乗
  if (i == 0)
    return 1;
  return (fact(i - 1)) * i;
}
ll gcd(ll a, ll b) { // 最大公約数
  if (b == 0)
    return a;
  return gcd(b, a % b);
}
ll lcm(ll a, ll b) { // 最小公倍数
  return a * b / gcd(a, b);
}
int keta(ll n) { // 桁数を求める
  if (n == 0)
    return 1;
  int count = 0;
  while (n != 0) {
    n /= 10;
    count++;
  }
  return count;
}
ll ketasum(ll n) { // 各桁の和
  ll sum = 0;
  while (n != 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
/* ------------------------------------------------ */

int main() {
  ll x;
  cin >> x;
  for (int i = -5000; i <= 5000; i++) {
    for (int j = -5000; j <= 5000; 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;
#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 rev(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for (int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) ((v).begin(), (v).end())
using ll = long long;
using P = pair<int, int>;
/* ------------------------------------------------ */
ll fact(int i) { // 階乗
  if (i == 0)
    return 1;
  return (fact(i - 1)) * i;
}
ll gcd(ll a, ll b) { // 最大公約数
  if (b == 0)
    return a;
  return gcd(b, a % b);
}
ll lcm(ll a, ll b) { // 最小公倍数
  return a * b / gcd(a, b);
}
int keta(ll n) { // 桁数を求める
  if (n == 0)
    return 1;
  int count = 0;
  while (n != 0) {
    n /= 10;
    count++;
  }
  return count;
}
ll ketasum(ll n) { // 各桁の和
  ll sum = 0;
  while (n != 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
/* ------------------------------------------------ */

int main() {
  ll x;
  cin >> x;
  for (int i = -1000; i <= 1000; i++) {
    for (int j = -1000; j <= 000; 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;

  scanf("%lld", &X);

  for (int i = -1; i <= X; i++) {
    for (int j = -1; j <= X; j++) {
      if ((pow(i, 5) - pow(j, 5)) == X) {
        printf("%d %d\n", i, j);
        return 0;
      }
    }
  }
}


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

int main() {

  long long X;

  scanf("%lld", &X);

  for (int i = -118; i <= 119; i++) {
    for (int j = -118; j <= 119; j++) {
      if ((pow(i, 5) - pow(j, 5)) == X) {
        printf("%d %d\n", i, j);
        return 0;
      }
    }
  }
}
Problem p02690 (C++)

Buggy submission (status: 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, -3500, 3500) rep(j, -3500, 3500) {
    if (pow(i, 5) - pow(j, 5) == X) {
      cout << i << " " << j << endl;
      return 0;
    }
  }
}

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

Buggy submission (status: Time Limit Exceeded):
// Winners don't quit and Quitters don't win
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vii vector<int>
#define vll vector<ll>
#define mod 998244353
#define MAX 100005
vll adj[MAX];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll x, i, j, a, b;
  cin >> x;
  for (i = 0;; ++i) {
    for (j = -1; j <= i; ++j) {
      if ((pow(i, 5) - pow(j, 5)) == x) {
        a = i;
        b = j;
        cout << a << " " << b;
        return 0;
      }
      if ((pow(i, 5) - pow(j, 5)) < x) {
        break;
      }
    }
  }
}

Fixed submission:
// Winners don't quit and Quitters don't win
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vii vector<int>
#define vll vector<ll>
#define mod 998244353
#define MAX 100005
vll adj[MAX];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll x, i, j, a, b;
  cin >> x;
  for (i = 0;; ++i) {
    for (j = -100; j <= i; ++j) {
      if ((pow(i, 5) - pow(j, 5)) == x) {
        a = i;
        b = j;
        cout << a << " " << b;
        return 0;
      }
      if ((pow(i, 5) - pow(j, 5)) < x) {
        break;
      }
    }
  }
}
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##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
using ll = long long;
string char_to_string(char val) { return string(1, val); }
int char_to_int(char val) { return val - '0'; }
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;
}

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

  ll ans_a = 0;
  ll ans_b = 0;
  bool flag = false;
  for (int i = -X; i <= X; ++i) {
    for (int k = -X; k <= X; ++k) {
      // cout << k << " " << i << " " << pow(i, 5) - pow(k, 5) << " " << X <<
      // endl;
      if (pow(i, 5) - pow(k, 5) == X) {
        ans_a = i;
        ans_b = k;
        flag = true;
        break;
      }
    }

    if (flag == true)
      break;
  }

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

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 all(x) (x).begin(), (x).end()
using ll = long long;
string char_to_string(char val) { return string(1, val); }
int char_to_int(char val) { return val - '0'; }
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;
}

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

  ll ans_a = 0;
  ll ans_b = 0;
  bool flag = false;
  for (int i = -1000; i <= 1000; ++i) {
    for (int k = -1000; k <= 1000; ++k) {
      // cout << k << " " << i << " " << pow(i, 5) - pow(k, 5) << " " << X <<
      // endl;
      if (pow(i, 5) - pow(k, 5) == X) {
        ans_a = i;
        ans_b = k;
        flag = true;
        break;
      }
    }

    if (flag == true)
      break;
  }

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

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define sz(a) (int)a.size()
using namespace std;

// mod無しバージョン
ll pow(ll a, ll n) {
  ll res = 1;
  while (n > 0) {
    if (n & 1)
      res = res * a;
    a = a * a;
    n >>= 1;
  }
  return res;
}

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


Fixed submission:
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define sz(a) (int)a.size()
using namespace std;

// mod無しバージョン
ll pow(ll a, ll n) {
  ll res = 1;
  while (n > 0) {
    if (n & 1)
      res = res * a;
    a = a * a;
    n >>= 1;
  }
  return res;
}

int main() {
  ll x;
  cin >> x;
  for (ll i = -1000; i <= 1000; i++) {
    for (ll 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: Time Limit Exceeded):
#include <algorithm>
#include <cfenv>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>

#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define vint vector<int>
#define vvint vector<vint>
#define P pair<int, int>
#define INT_MAX 2147483647
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(void) {
  ll x;
  cin >> x;
  ll a, b;
  ll k = x % 5;
  ll t = 1;
  while (true) {
    for (a = 1; a < 150; a++) {
      b = a - (5 * t + k);
      if (abs(b) > abs(a)) {
        continue;
      }
      if (a * a * a * a * a - b * b * b * b * b == x) {
        cout << a << ' ' << b << endl;
        return 0;
      }
    }
    t++;
  }
}


Fixed submission:
#include <algorithm>
#include <cfenv>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>

#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define vint vector<int>
#define vvint vector<vint>
#define P pair<int, int>
#define INT_MAX 2147483647
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(void) {
  ll x;
  cin >> x;
  ll a, b;
  ll k = x % 5;
  ll t = 0;
  while (true) {
    for (a = 1; a < 150; a++) {
      b = a - (5 * t + k);
      if (abs(b) > abs(a)) {
        continue;
      }
      if (a * a * a * a * a - b * b * b * b * b == x) {
        cout << a << ' ' << b << endl;
        return 0;
      }
    }
    t++;
  }
}
Problem p02690 (C++)

Buggy submission (status: Runtime Error):
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for (int __x = __start; __x < __end; __x++)

int main() {
  ll x;
  cin >> x;
  vector<ll> A;
  loop(i, 0, 200) {
    ll f = i;
    ll y = 1;
    loop(j, 0, 5) y *= f;
    if (y > 2000000000)
      break;
    A.push_back(y);
  }

  int n = A.size();
  vector<ll> signs{-1, 1};
  loop(i, 0, n) {
    loop(j, 0, n) {
      for (auto &&signA : signs) {
        for (auto &&signB : signs) {
          if (signA * A[i] - A[j] * signB == x) {
            cout << signA * i << " " << signB * j << endl;
            return 0;
          }
        }
      }
    }
  }
  assert(x == 0);
  return 0;
}


Fixed submission:
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for (int __x = __start; __x < __end; __x++)

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

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


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

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 1; i < (ll)(n); i++)
#define REP(a, b, m) for (ll a = (ll)(b); a < (ll)(m); a++)

int main() {
  ll x;
  cin >> x;
  queue<ll> memo;
  ll karioki = sqrt(x);
  rep(i, karioki + 1) {
    if (x % i == 0) {
      memo.push(i);
    }
  }
  bool flag = false;
  while (memo.size() > 0) {
    ll a = memo.front();
    memo.pop();
    ll m1 = x / a;
    rep(i, m1 + 1) {
      if (x ==
          i * i * i * i * i - (i - a) * (i - a) * (i - a) * (i - a) * (i - a)) {
        cout << i << " " << i - a << endl;
        break;
        flag = false;
      }
      if (flag) {
        break;
      }
    }
  }
}

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 1; i < (ll)(n); i++)
#define REP(a, b, m) for (ll a = (ll)(b); a < (ll)(m); a++)

int main() {
  ll x;
  cin >> x;
  queue<ll> memo;
  ll karioki = sqrt(x);
  rep(i, karioki + 1) {
    if (x % i == 0) {
      memo.push(i);
    }
  }
  bool flag = false;
  while (memo.size() > 0) {
    ll a = memo.front();
    memo.pop();
    ll m1 = x / a;
    ll m2 = sqrt(m1);
    rep(i, m2 + 1) {
      if (x ==
          i * i * i * i * i - (i - a) * (i - a) * (i - a) * (i - a) * (i - a)) {
        cout << i << " " << i - a << endl;
        break;
        flag = false;
      }
      if (flag) {
        break;
      }
    }
  }
}
Problem p02690 (C++)

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

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

Buggy submission (status: 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 = 0; a <= 100; a++) {
    for (int b = -100; b <= 100; b++) {
      if (pow5(a) - pow5(b) == X) {
        cout << a << " " << b;
        return 0;
      }
    }
  }
  assert(0);
}


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 = -150; a <= 150; a++) {
    for (int b = -150; b <= 150; b++) {
      if (pow5(a) - pow5(b) == X) {
        cout << a << " " << b;
        return 0;
      }
    }
  }
  assert(0);
}
Problem p02690 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <numeric>
#include <string>
#include <vector>
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
using namespace std;

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

  return 0;
}


Fixed submission:
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <numeric>
#include <string>
#include <vector>
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
using namespace std;

int main() {
  ll X;
  cin >> X;
  for (ll B = -200; B <= 200; B++) {
    for (ll A = -200; A <= 200; A++) {
      if (pow(A, 5) == X + pow(B, 5)) {
        cout << A << " " << B << endl;
        return 0;
      }
    }
  }

  return 0;
}