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

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define sz(x) (int)x.size()
#define F first
#define S second
#define endl "\\n"
#define inf (long long)1000000007
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define bigint 1e18
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count());
#define SHUF(v) shuffle(aint(v), RNG);
// Use mt19937_64 for 64 bit random numbers.

template <typename T> T ceil(T a, T b) { return (a + b - 1) / b; }

template <typename T> T binpow(T a, T b, T m) {
  a %= m;
  T res = 1;
  while (b > 0) {
    if (b & 1)
      res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
class Solution {
  int M = 3e9 + 7;

public:
  Solution() {}
  void solve() {
    int n;
    cin >> n;
    int mx1 = 0, mn1 = M, mx2 = -M, mn2 = M;
    FOR(i, 0, n) {
      int x, y;
      cin >> x >> y;
      mx1 = max(mx1, x + y);
      mn1 = min(mn1, x + y);
      mx2 = max(mx2, x - y);
      mn2 = min(mn2, x - y);
    }
    cout << max(abs(mx1 - mn1), abs(mx2 - mn2));
  }
};
// abs(x1 - x2) + abs(y1 - y2)
// (x1 - x2) + (y1-y2)       -- both +ve
// (x1 + y1) - ( x2 + y2)    -- (1)
// OR
// -(x1 - x2) - (y1 - y2)    -- both -ve
// -x1 + x2 - y1 + y2        -- Same as (1) (?)
// OR
// x1 - x2 - y1 + y2         -- second -ve
// (x1 - y1) - (x2 - y2)     -- (2)
// OR
// -x1 + x2 + y1 - y2
// -(x1 - y1) + (x2 - y2)    -- Same as (2) ()

void solve() {
  Solution sol;
  sol.solve();
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t = 1;
  // cin>>t;
  FOR(i, 1, t + 1) {
    // cout<<"Case #"<<i<<": ";
    solve();
  }
  cerr << "\\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\\n";
  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define sz(x) (int)x.size()
#define F first
#define S second
#define endl "\\n"
#define inf (long long)1000000007
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define bigint 1e18
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count());
#define SHUF(v) shuffle(aint(v), RNG);
// Use mt19937_64 for 64 bit random numbers.

template <typename T> T ceil(T a, T b) { return (a + b - 1) / b; }

template <typename T> T binpow(T a, T b, T m) {
  a %= m;
  T res = 1;
  while (b > 0) {
    if (b & 1)
      res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
class Solution {
  int M = 3e9 + 7;

public:
  Solution() {}
  int solve() {
    int n;
    cin >> n;
    int mx1 = 0, mn1 = M, mx2 = -M, mn2 = M;
    FOR(i, 0, n) {
      int x, y;
      cin >> x >> y;
      mx1 = max(mx1, x + y);
      mn1 = min(mn1, x + y);
      mx2 = max(mx2, x - y);
      mn2 = min(mn2, x - y);
    }
    cout << max(abs(mx1 - mn1), abs(mx2 - mn2));
  }
};
// abs(x1 - x2) + abs(y1 - y2)
// (x1 - x2) + (y1-y2)       -- both +ve
// (x1 + y1) - ( x2 + y2)    -- (1)
// OR
// -(x1 - x2) - (y1 - y2)    -- both -ve
// -x1 + x2 - y1 + y2        -- Same as (1) (?)
// OR
// x1 - x2 - y1 + y2         -- second -ve
// (x1 - y1) - (x2 - y2)     -- (2)
// OR
// -x1 + x2 + y1 - y2
// -(x1 - y1) + (x2 - y2)    -- Same as (2) ()

void solve() {
  Solution sol;
  sol.solve();
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t = 1;
  // cin>>t;
  FOR(i, 1, t + 1) {
    // cout<<"Case #"<<i<<": ";
    solve();
  }
  cerr << "\\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\\n";
  return 0;
}