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

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define LI list<int>
#define vct vector
#define D(a) (double)(a)
#define vi vct<int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vvi vct<vi>
#define vll vct<ll>
#define vvll vct<vll>
#define vpii vct<pii>
#define vpll vct<pll>
#define vb vct<bool>
#define vs vector<string>
#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define mp(a, b) make_pair(a, b)
#define pb push_back
#define ff first
#define ss second
#define bg begin()
#define UNIQUE(X) (X).erase(unique(all(X)), (X).end())
#define ft cout << "for test" << endl;
#define read(v, a, n)                                                          \\
  for (int i = a; i < n; i++)                                                  \\
    cin >> v[i];
#define print(v)                                                               \\
  for (auto it : v)                                                            \\
    cout << it << ' ';                                                         \\
  cout << endl;
#define PI acos(-1.0)
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define FIO                                                                    \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0);
#define t_c                                                                    \\
  int test, cs = 1;                                                            \\
  cin >> test;                                                                 \\
  while (test--)
#define rt return true
#define rf return false
///................function.....................///
#define siz(s) (int)(s.size())
#define mod 1000000007
#define dbg(a) cout << #a << " = " << a << " ";
int main() {
  /// freopen("input.txt","r",stdin);
  /// freopen("input15.txt","w",stdout);
  int n, x, y, i;
  cin >> n;
  int mxx = -1e9, mnx = 1e9, mxy = -1e9, mny = 1e9;
  for (i = 0; i < n; i++) {
    cin >> x >> y;
    mxx = max(mxx, x + y);
    mnx = min(mnx, x + y);

    mxy = max(mxy, x - y);
    mny = min(mny, x - y);
  }
  cout << max(mxx - mnx, mxy - mny) << endl;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define LI list<int>
#define vct vector
#define D(a) (double)(a)
#define vi vct<int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vvi vct<vi>
#define vll vct<ll>
#define vvll vct<vll>
#define vpii vct<pii>
#define vpll vct<pll>
#define vb vct<bool>
#define vs vector<string>
#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define mp(a, b) make_pair(a, b)
#define pb push_back
#define ff first
#define ss second
#define bg begin()
#define UNIQUE(X) (X).erase(unique(all(X)), (X).end())
#define ft cout << "for test" << endl;
#define read(v, a, n)                                                          \\
  for (int i = a; i < n; i++)                                                  \\
    cin >> v[i];
#define print(v)                                                               \\
  for (auto it : v)                                                            \\
    cout << it << ' ';                                                         \\
  cout << endl;
#define PI acos(-1.0)
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define FIO                                                                    \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(0);                                                                  \\
  cout.tie(0);
#define t_c                                                                    \\
  int test, cs = 1;                                                            \\
  cin >> test;                                                                 \\
  while (test--)
#define rt return true
#define rf return false
///................function.....................///
#define siz(s) (int)(s.size())
#define mod 1000000007
#define dbg(a) cout << #a << " = " << a << " ";
bool cmp(pll a, pll b) {
  /// cout<<"( "<<a.ff<<" "<<a.ss<<" ) "<<b.ff<<" "<<b.ss<<" ) = ";
  if (a.ff < b.ff) {
    /// cout<<"rt"<<endl;
    return true;
  } else if (a.ff == b.ff) {
    if (a.ss <= b.ss) {
      /// cout<<"rt "<<endl;
      return true;
    }
    /// cout<<"rf"<<endl;
    return false;
  }
  /// cout<<"rf"<<endl;
  return false;
}
int main() {
  /// freopen("input.txt","r",stdin);
  /// freopen("input15.txt","w",stdout);
  FIO;
  int n, i, j;
  cin >> n;
  vpll v(n);
  for (i = 0; i < n; i++)
    cin >> v[i].ff >> v[i].ss;
  sort(all(v), cmp);
  cout << abs(v[0].ff - v[n - 1].ff) + abs(v[0].ff - v[n - 1].ss) << endl;
}