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

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

int main() {
  /*
  string s;
  cin>>s;
  if(s=="ABC")
  {
      cout<<"ARC"<<endl;
  }
  else
  {
      cout<<"ABC"<<endl;
  }
  */
  /*
   int n,k;
   cin>>n>>k;
   map <int,int> mp;
   for(int i=1;i<=k;i++)
   {
       int d;
       cin>>d;
       for(int j=1;j<=d;j++)
       {
           int a;
           cin>>a;
           mp[a]++;
       }
   }
   int count=0;
   for(int i=1;i<=n;i++)
   {
       if(mp[i]==0)
       {
           count++;
       }
   }

   cout<<count<<endl;
   */
  /*
  int n,m;
  cin>>n>>m;
  vector <pair<bool,ll>> h(n+1);  //良いか悪いか、標高
  for(int i=1;i<=n;i++)
  {
      int height;
      cin>>height;
      h[i].first=true;
      h[i].second=height;
  }

  for(int i=0;i<m;i++)
  {
      int a,b;
      cin>>a>>b;
      if(h[a].second<=h[b].second)
      {
          h[a].first = false;
      }
      if(h[a].second>=h[b].second)
      {
          h[b].first=false;
      }
  }

  int count=0;

  for(int i=1;i<=n;i++)
  {
      if(h[i].first)
      {
          count++;
      }
  }

  cout<<count<<endl;
  */

  ll A, B, X;
  cin >> X;
  for (ll i = -1000; i < 1000; i++) {
    for (ll j = -1000; j < 1000; j++) {
      if (i * i * i * i * i - j * j * j * j * j == X) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }

  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  /*
  string s;
  cin>>s;
  if(s=="ABC")
  {
      cout<<"ARC"<<endl;
  }
  else
  {
      cout<<"ABC"<<endl;
  }
  */
  /*
   int n,k;
   cin>>n>>k;
   map <int,int> mp;
   for(int i=1;i<=k;i++)
   {
       int d;
       cin>>d;
       for(int j=1;j<=d;j++)
       {
           int a;
           cin>>a;
           mp[a]++;
       }
   }
   int count=0;
   for(int i=1;i<=n;i++)
   {
       if(mp[i]==0)
       {
           count++;
       }
   }

   cout<<count<<endl;
   */
  /*
  int n,m;
  cin>>n>>m;
  vector <pair<bool,ll>> h(n+1);  //良いか悪いか、標高
  for(int i=1;i<=n;i++)
  {
      int height;
      cin>>height;
      h[i].first=true;
      h[i].second=height;
  }

  for(int i=0;i<m;i++)
  {
      int a,b;
      cin>>a>>b;
      if(h[a].second<=h[b].second)
      {
          h[a].first = false;
      }
      if(h[a].second>=h[b].second)
      {
          h[b].first=false;
      }
  }

  int count=0;

  for(int i=1;i<=n;i++)
  {
      if(h[i].first)
      {
          count++;
      }
  }

  cout<<count<<endl;
  */

  ll x;
  cin >> x;
  for (ll i = 1; i <= x; i++) {
    if (x % i == 0) {
      ll temp = x;
      temp = x / i;
      for (ll j = 0; j <= i; j++) {
        ll a = j;
        ll b = j - i;
        if ((pow(a, 4) + pow(a, 3) * b + pow(a, 2) * pow(b, 2) + a * pow(b, 3) +
             pow(b, 4)) == temp) {
          cout << a << " " << b << endl;
          return 0;
        }
      }
    }
  }

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

#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i >= b; i--)
// #define fore(i,a) for(auto &i:a)
// #define all(x) (x).begin(),(x).end()
// #pragma GCC optimize ("-O3")
// using namespace std; void _main(); int main() { cin.tie(0);
// ios::sync_with_stdio(false); _main(); } typedef long long ll; const int inf =
// INT_MAX / 2; const ll infl = 1LL << 60; template<class T>bool chmax(T& a,
// const T& b) { if (a < b) { a = b; return 1; } return 0; } template<class
// T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

using namespace std;

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

  for (long int i = 0; i < 1000; i++) {
    long double A5 = x + pow(i, 5);
    long double Ad = pow(A5, 0.2);
    long int Ai = (int)Ad;
    if ((Ad - Ai) < pow(10, -10) && Ai != i) {
      cout << Ai << " " << i << endl;
      return 0;
    }
  }
  for (long int i = -1; i > -1000; i--) {
    long double A5 = x + pow(i, 5);
    long double Ad = pow(A5, 0.2);
    long int Ai = (int)Ad;
    if ((Ad - Ai) < pow(10, -10) && Ai != i) {
      cout << Ai << " " << i << endl;
      return 0;
    }
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i >= b; i--)
// #define fore(i,a) for(auto &i:a)
// #define all(x) (x).begin(),(x).end()
// #pragma GCC optimize ("-O3")
// using namespace std; void _main(); int main() { cin.tie(0);
// ios::sync_with_stdio(false); _main(); } typedef long long ll; const int inf =
// INT_MAX / 2; const ll infl = 1LL << 60; template<class T>bool chmax(T& a,
// const T& b) { if (a < b) { a = b; return 1; } return 0; } template<class
// T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

using namespace std;

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

  int B = 0;
  while (1) {
    long double A5 = x + pow(B, 5);
    long double Ad = pow(A5, 0.2);
    long int Ai = (int)Ad;
    if ((Ad - Ai) < pow(10, -9)) {
      cout << Ai << " " << B << endl;
      break;
    }
    B--;
  }

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

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

int main() {
  int64_t x;
  cin >> x;
  int A = 0, B = 0;
  for (int a = -1001; a < 1001; a++) {
    for (int b = -1001; b < 1001; b++) {
      if (x == pow(a, 5) - pow(b, 5)) {
        A = a;
        B = b;
        break;
      }
    }
  }
  cout << A << " " << B << endl;
}

Error: TLE

Fixed submission:

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

int main() {
  int x;
  cin >> x;
  vector<int> fct;
  for (int i = 1; i <= x / 2 + 1; i++) {
    if (x % i == 0)
      fct.push_back(i);
  }

  for (int i = 0; i < fct.size(); i++) {
    int tmp = 0;

    if (i == fct.size() - 1) {
      while (1) {
        if (x == pow(fct.at(i) + tmp, 5) - pow(tmp, 5)) {
          cout << fct.at(i) + tmp << " " << tmp << endl;
          return 0;
        }
      }
    }

    while (fct.at(i) + tmp < fct.at(i + 1)) {
      if (x == pow(fct.at(i) + tmp, 5) - pow(tmp, 5)) {
        cout << fct.at(i) + tmp << " " << tmp << endl;
        return 0;
      }
      tmp++;
    }
  }
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int64_t intpow(int64_t n, int64_t k, int64_t INF = int64_t(1e18)) {
  if (n == 0)
    return 0;
  int64_t ret = 1;
  while (k--) {
    if (ret > INF / n)
      return INF;
    ret *= n;
  }
  return ret;
}

int main() {
  int X;
  cin >> X;
  for (int a = 1;; a++) {
    int64_t b5 = intpow(a, 5) - X;
    int b = round(pow(abs(b5), 0.2));
    if (intpow(b, 5) == abs(b5)) {
      cout << a << " " << (b5 > 0 ? b : -b) << endl;
      return 0;
    }
  }
  return 0;
}


Error: TLE

Fixed submission:

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

int64_t intpow(int64_t n, int64_t k, int64_t INF = int64_t(1e18)) {
  if (n == 0)
    return 0;
  int64_t ret = 1;
  while (k--) {
    if (ret > INF / n)
      return INF;
    ret *= n;
  }
  return ret;
}

int64_t introot(int64_t n, int64_t k = 2) {
  if (n == 0)
    return 0;
  int64_t ret = pow((long double)n, 1.0L / k);
  while (intpow(ret, k, n + 1) > n)
    ret--;
  while (intpow(ret + 1, k, n + 1) <= n)
    ret++;
  return ret;
}

int main() {
  int X;
  cin >> X;
  for (int a = 1;; a++) {
    int b5 = intpow(a, 5) - X;
    if (b5 >= 0) {
      int b = introot(b5, 5);
      if (intpow(b, 5) == b5) {
        cout << a << " " << b << endl;
        return 0;
      }
    } else {
      int b = -introot(-b5, 5);
      if (intpow(-b, 5) == -b5) {
        cout << a << " " << b << endl;
        return 0;
      }
    }
  }
  return 0;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

using namespace std;

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


Error: TLE

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
int main() {
  ll x;
  cin >> x;
  for (int i = -x; i <= x; i++) {
    ll l = -x, r = x;
    while (l < r) {
      ll mid = l + (r - l) / 2;
      ll res1 = pow(i, 5) - pow(mid, 5);
      ll res2 = pow(i, 5) - pow(mid + 1, 5);
      if (res1 == x) {
        cout << i << " " << mid;
        return 0;
      }
      if (res2 == x) {
        cout << i << " " << mid + 1;
        return 0;
      } else if (res2 > x)
        l = mid + 1;
      else
        r = mid - 1;
    }
  }
  return 0;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

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

typedef long long llint;
typedef long double ld;

#define inf 1e18
#define mod 1000000007
priority_queue<llint, vector<llint>, greater<llint>> que;
priority_queue<llint> Que;
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

llint n;

unsigned long calc(llint a) { return a * a * a * a * a; }

void solve() {
  cin >> n;
  llint ansa, ansb;

  if (n == 1) {
    ansa = 0;
    ansb = -1;
  } else if (n == 2) {
    ansa = 1;
    ansb = -1;
  } else {
    for (int i = -200; i <= 200; i++) {
      llint a = calc(i);
      for (int j = -200; j <= 200; j++) {
        llint b = calc(j);
        if (a - b == n) {
          ansa = i;
          ansb = j;
          break;
        }
      }
    }
  }

  cout << ansa << " " << ansb << endl;
}

int main(int argc, char *argv[]) {
  solve();
  return 0;
}


Error: TLE

Fixed submission:

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

typedef long long llint;
typedef long double ld;

#define inf 1e18
#define mod 1000000007
priority_queue<llint, vector<llint>, greater<llint>> que;
priority_queue<llint> Que;
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

llint n;

llint calc(llint a) { return a * a * a * a * a; }

vector<llint> make_div(llint x) {
  vector<llint> div;
  llint t = x;
  for (llint i = 2; i * i <= x; i++) {
    if (t % i == 0) {
      div.push_back(i);
      if (i != t / i) {
        div.push_back(t / i);
      }
    }
  }
  sort(div.begin(), div.end());
  return div;
}

llint c(llint a, llint b) {
  return a * a * a * a + a * a * a * b + a * a * b * b + a * b * b * b +
         b * b * b * b;
}

void solve() {
  cin >> n;
  llint ansa, ansb;

  if (n == 1) {
    ansa = 0;
    ansb = -1;
  } else if (n == 2) {
    ansa = 1;
    ansb = -1;
  } else {
    vector<llint> div;
    div = make_div(n);
    for (llint g : div) {
      for (llint a = 1; a <= n; a++) {
        llint b = a - g;
        llint v = c(a, b);
        if ((a - b) * v == n) {
          ansa = a;
          ansb = b;
          break;
        }
      }
    }
  }

  cout << ansa << " " << ansb << endl;
}

int main(int argc, char *argv[]) {
  solve();
  return 0;
}
Problem p02690 (C++) — buggy submission, verdict: 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 = -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;
}

Error: WA

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

#include <bits/stdc++.h>
#define int long long
#define rep(i, l, r) for (register int i = l; i <= r; ++i)
int MAXN = 100010;
inline int read() {
  register char cc = getchar();
  register int cn(0), flus(1);
  while (cc > '9' || cc < '0') {
    if (cc == '-')
      flus = -flus;
    cc = getchar();
  }
  while (cc >= '0' && cc <= '9') {
    cn = cn * 10 + cc - 48;
    cc = getchar();
  }
  return cn * flus;
}
signed main() {
  int x = read();
  for (register int i = -1000;; ++i) {
    for (register int j = -1000; j <= 1000; ++j) {
      // printf("i = %d j = %d \\n",i,j);
      if (i * i * i * i * i - j * j * j * j * j == x) {
        printf("%lld %lld \\n", i, j);
        return 0;
      }
    }
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define int long long
#define rep(i, l, r) for (register int i = l; i <= r; ++i)
int MAXN = 100010;
inline int read() {
  register char cc = getchar();
  register int cn(0), flus(1);
  while (cc > '9' || cc < '0') {
    if (cc == '-')
      flus = -flus;
    cc = getchar();
  }
  while (cc >= '0' && cc <= '9') {
    cn = cn * 10 + cc - 48;
    cc = getchar();
  }
  return cn * flus;
}
signed main() {
  int x = read();
  for (register int i = -100;; ++i) {
    for (register int j = -100; j <= 100; ++j) {
      // printf("i = %d j = %d \\n",i,j);
      if (i * i * i * i * i - j * j * j * j * j == x) {
        printf("%lld %lld \\n", i, j);
        return 0;
      }
    }
  }
  return 0;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int64_t pow(int64_t n, int64_t r) {
  int ret = 1;
  for (int i = 0; i < r; i++) {
    ret *= n;
  }
  return n;
}
int main(void) {
  int64_t 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 << "\\n";
        return 0;
      }
    }
  }
  return 0;
}


Error: TLE

Fixed submission:

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

int64_t pow(int64_t n, int64_t r) {
  int ret = 1;
  for (int i = 0; i < r; i++) {
    ret *= n;
  }
  return n;
}
int main(void) {
  int64_t X;

  cin >> X;

  for (int i = 6208; i > -6208; i--) {
    for (int j = 6208; j > -6208; j--) {
      if ((pow(i, 5) - pow(j, 5)) == X) {
        cout << i << " " << j << "\\n";
        return 0;
      }
    }
  }
  return 0;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, X;
  cin >> X;
  for (int i = -300; i < 300; i++) {
    for (int j = -300; j < 300; j++) {
      if (pow(i, 5) - pow(j, 5) == X) {
        A = i;
        B = j;
        break;
      }
    }
  }
  cout << A << " " << B << endl;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int X;
  cin >> X;
  for (int i = -2000; i < 2000; i++) {
    for (int j = -2000; j < 2000; j++) {
      if (pow(i, 5) - pow(j, 5) == X) {
        cout << i << " " << j << endl;
        break;
      }
    }
  }
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG // これつけるとA[N]でもいいらしい
// for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(), (a).end()) // ソートのマクロ
#define Re(a) reverse((a).begin(), (a).end())
#define YN(a)                                                                  \\
  if (a) {                                                                     \\
    cout << "Yes" << endl;                                                     \\
  } else                                                                       \\
    cout << "No" << endl; // 条件によってYes、Noを出力する
const int MOD = 1000000007;
int main() {
  int64_t x;
  cin >> x;
  int A, B;
  for (int64_t a = -300; a <= 300; a++) {
    for (int64_t b = -300; b <= 300; b++) {
      if (a * a * a * a * a - b * b * b * b * b == x) {
        A = a, B = b;
      }
    }
  }
  cout << A << " " << B << endl;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG // これつけるとA[N]でもいいらしい
// for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(), (a).end()) // ソートのマクロ
#define Re(a) reverse((a).begin(), (a).end())
#define YN(a)                                                                  \\
  if (a) {                                                                     \\
    cout << "Yes" << endl;                                                     \\
  } else                                                                       \\
    cout << "No" << endl; // 条件によってYes、Noを出力する
const int MOD = 1000000007;
int64_t b;
bool is_five_square(int k) {
  if (k == 1) {
    b = 1;
    return true;
  }
  int64_t i = 1;
  while (i * i * i * i * i <= k) {
    if (i * i * i * i * i == k) {
      b = i;
      return true;
    }
    i++;
  }
  return false;
}
int main() {
  int64_t x;
  cin >> x;
  int a = 0;
  while (1) {
    if (is_five_square(abs(x - pow(a, 5)))) {
      if (x - pow(a, 5) >= 0) {
        b *= -1;
      }
      break;
    }
    a++;
  }
  cout << a << " " << b << endl;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
long long arr[1000000], arr1[1000000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long x, i, j, k, y, z, w;
  cin >> z;
  i = 0;
  for (i = 0; i <= 1000; i++) {
    arr[i] = i * i * i * i * i;
    arr1[i] = i;
  }
  for (i = 1001; i <= 2000; i++) {
    x = -(i - 1000);
    arr[i] = x * x * x * x * x;
    arr1[i] = x;
  }
  for (i = 0; i <= 2000; i++) {
    for (j = 0; j <= 2000; j++) {
      if (arr[i] - arr[j] == z) {
        cout << arr1[i] << " " << arr1[j] << endl;
        return 0;
      }
    }
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
long long arr[1000000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long x, i, j, k, y, z, w;
  cin >> x;
  i = 0;
  while (1) {
    z = i * i * i * i * i;
    j = abs(x - z);
    y = cbrt(sqrt(j));
    w = y * y * y * y * y;
    if (w == j) {
      break;
    }
    i++;
  }
  if (z > x) {
    cout << i << " " << y << endl;
  } else {
    cout << i << " " << -y << endl;
  }
}
Problem p02690 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const int MAX = 1000000000;

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


Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const int MAX = 1000000000;

int main() {
  ll x;
  cin >> x;
  for (ll i = -100; i < 100; i++) {
    for (ll j = -100; j < 100; j++) {
      if (pow(i, 5) - pow(j, 5) == x) {
        cout << i << " " << j;
        return 0;
      }
    }
  }
  return -1;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout << (bool x ? "Yes" : "No") << endl;
#define out(s) cout << s << endl;
#define pb push_back;
#define sp " ";
void vout(vector<int> v) {
  for (int i = 0; i < v.size(); i++)
    cout << v.at(i) << endl;
}
int main() {
  //-119<=A<=119;
  lli a, b;
  lli x;
  cin >> x;
  for (lli i = -119; i < 120; i++) {
    for (lli j = -119; j < 120; j++) {
      if (pow(i, 5) - pow(j, 5) == x) {
        a = i;
        b = j;
        break;
      }
    }
  }
  cout << a << " " << b;
}

Error: TLE

Fixed submission:

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, c = 0;
  long long int a, b, k = 1;
  double d;
  cin >> x;
  for (int i = 0; i < 101; i++) {
    a = i;
    k = i;
    a = a * a * a * a * a;
    if (x < a)
      break;
    d = pow(x - a, -5);
    if (d == floor(d)) {
      c = 1;
      b = -d;
      break;
    }
  }
  if (c != 1) {
    while (c == 0) {
      a = k;
      a = a * a * a * a * a;
      d = pow(-(x - a), -5);
      if (d == floor(d)) {
        c = 1;
        b = d;
        break;
      }
      k++;
    }
  }
  cout << k << " " << b;
}
Problem p02690 (C++) — buggy submission, verdict: Time Limit Exceeded

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

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define 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;
}

Error: TLE

Fixed submission:

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

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define 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;
}