Problem p02690 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
#pragma comment(linker, "/STACK:1024000000,1024000000")
#define INF 0x7f7f7f7f  // 2139062143
#define INF1 0x3f3f3f3f // 1061109567
#define INF2 2147483647
#define llINF 9223372036854775807
#define pi 3.14159265358979323846264338327950254
#define pb push_back
#define ll long long
#define debug cout << "debug\\n";
#define STDIN                                                                  \\
  freopen("in.txt", "r", stdin);                                               \\
  freopen("out.txt", "w", stdout);
#define IOS                                                                    \\
  ios::sync_with_stdio(false);                                                 \\
  cin.tie(NULL);
#define scai(x) scanf("%d", &x)
#define sca2i(x, y) scanf("%d %d", &x, &y)
#define scaf(x) scanf("%lf", &x)
#define sca2f(x, y) scanf("%lf %lf", &x, &y)
#define For(m, n) for (int i = m; i < n; i++)
#define PII pair<int, int>
#define PLL pair<long, long>
#define ft first
#define sd second
#define pb push_back
const int maxn = 333333, mod = 1000000009;
#define lson o << 1, l, mid
#define rson o << 1 | 1, mid + 1, r
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define ROF(i, a, b) for (int i = (a); i >= (b); i--)
#define MEM(x, v) memset(x, v, sizeof(x))
inline int read() {
  char ch = getchar();
  int x = 0, f = 0;
  while (ch < '0' || ch > '9')
    f |= ch == '-', ch = getchar();
  while (ch >= '0' && ch <= '9')
    x = x * 10 + ch - '0', ch = getchar();
  return f ? -x : x;
}
#define int ll
PII a[200000];
signed main() {
  // STDIN;
  int n;
  n = 1000;

  int cnt = 0;
  int k;
  cin >> k;
  for (int i = 0; i <= n; i++) {
    int t = i * i * i * i * i;
    // cout << t << endl;
    a[cnt++] = {i, t};
    a[cnt++] = {-i, -t};
  }
  for (int i = 0; i < cnt - 1; i++) {
    for (int j = i + 1; j < cnt; j++) {
      if (a[i].second - a[j].second == k) {
        cout << a[i].first << " " << a[j].first << endl;
        // cout << i << " " << j << endl;
        return 0;
      } else if (a[j].second - a[i].second == k) {
        cout << a[j].first << " " << a[i].first << endl;
        // cout << j << " " << i << endl;
        return 0;
      }
    }
  }
}

Error: -11

Fixed submission:

#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
#pragma comment(linker, "/STACK:1024000000,1024000000")
#define INF 0x7f7f7f7f  // 2139062143
#define INF1 0x3f3f3f3f // 1061109567
#define INF2 2147483647
#define llINF 9223372036854775807
#define pi 3.14159265358979323846264338327950254
#define pb push_back
#define ll long long
#define debug cout << "debug\\n";
#define STDIN                                                                  \\
  freopen("in.txt", "r", stdin);                                               \\
  freopen("out.txt", "w", stdout);
#define IOS                                                                    \\
  ios::sync_with_stdio(false);                                                 \\
  cin.tie(NULL);
#define scai(x) scanf("%d", &x)
#define sca2i(x, y) scanf("%d %d", &x, &y)
#define scaf(x) scanf("%lf", &x)
#define sca2f(x, y) scanf("%lf %lf", &x, &y)
#define For(m, n) for (int i = m; i < n; i++)
#define PII pair<int, int>
#define PLL pair<long, long>
#define ft first
#define sd second
#define pb push_back
const int maxn = 333333, mod = 1000000009;
#define lson o << 1, l, mid
#define rson o << 1 | 1, mid + 1, r
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define ROF(i, a, b) for (int i = (a); i >= (b); i--)
#define MEM(x, v) memset(x, v, sizeof(x))
inline int read() {
  char ch = getchar();
  int x = 0, f = 0;
  while (ch < '0' || ch > '9')
    f |= ch == '-', ch = getchar();
  while (ch >= '0' && ch <= '9')
    x = x * 10 + ch - '0', ch = getchar();
  return f ? -x : x;
}
#define int ll
signed main() {
  // STDIN;
  int n;
  n = 1000;
  PII a[200];
  int cnt = 0;
  int k;
  cin >> k;
  for (int i = 0; i <= n; i++) {
    int t = i * i * i * i * i;
    // cout << t << endl;
    a[cnt++] = {i, t};
    a[cnt++] = {-i, -t};
  }
  for (int i = 0; i < cnt - 1; i++) {
    for (int j = i + 1; j < cnt; j++) {
      if (a[i].second - a[j].second == k) {
        cout << a[i].first << " " << a[j].first << endl;
        // cout << i << " " << j << endl;
        return 0;
      } else if (a[j].second - a[i].second == k) {
        cout << a[j].first << " " << a[i].first << endl;
        // cout << j << " " << i << endl;
        return 0;
      }
    }
  }
}