Language: C++

// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;

#define ll long long
#define ull unsigned long long
#define lld long double
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define vt vector
#define vll vt<ll>
#define pll pair<ll,ll>
#define vpll vt<pll>
#define vvll vt<vll>
#define all(v) v.begin(),v.end()
#define FOR(i,n) for(ll i=0;i<n;i++)
#define ffo(i,a,b) for(ll i=a;i<=b;i++)
#define rfo(i,a,b) for(ll i=a;i>=b;i--)
#define space cout<<"\n\n";
#define endl '\n'
template <typename T> using mxpq = priority_queue<T>;
template <typename T> using mnpq = priority_queue<T, vt<T>, greater<T>>;
#define fps(x,y) fixed<<setprecision(y)<<x
#define merg(a,b,c) set_union(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.begin()))
#define set_ar(arr,v) memset(arr,v,sizeof(arr))
#define go_t int testcases; cin>>testcases; ffo(caseno,1,testcases)

#define ctime auto start = high_resolution_clock::now()
#define etime auto stop = high_resolution_clock::now()
#define ptime auto z1z = duration_cast<microseconds>(stop-start); cout<<"Time elapsed : "<<z1z.count()<<" microseconds\n"

const ll mod = 1e9 + 7;
const ll N = 6e4 + 6;
const ll maxN = 1e4 + 5;
const ll MAX_SIZE = 2e6 + 6;
const ll INF = 0x3f3f3f3f3f3f3f3fll;
const double PI = 3.14159265359;

int dx[4] = { -1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};
// up, right, down, left
//int dx [] = {+1,-1,+0,+0,-1,-1,+1,+1};///Eight Directions
//int dy [] = {+0,+0,+1,-1,+1,-1,-1,+1};///Eight Directions
//int dx[]={-2,-2,-1,1,-1,1,2,2};///Knight moves
//int dy[]={1,-1,-2,-2,2,2,-1,1};///Knight moves

ll powerM(ll x, ll y, ll M = mod) { // default argument
	ll v = 1; x = x % M; while (y > 0) {if (y & 1)v = (v * x) % M; y = y >> 1; x = (x * x) % M;} return v;
}

ll power(ll x, ll y) {
	ll v = 1; while (y > 0) {if (y & 1)v = v * x; y = y >> 1; x = x * x;} return v;
}

struct data {
	ll x, y, val;
};

bool comp(data a, data b) {
	if (a.val != b.val)
		return a.val < b.val;
	return 0;
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("in4.txt", "r", stdin);
	freopen("out1.txt", "w", stdout);
#endif
	FIO
	ll n;
	cin >> n;
	ll x, y;
	vt<data> ab(n);
	vt<data> ba(n);
	FOR(i, n) {
		cin >> x >> y;
		ab[i].val = x + y;
		ba[i].val = x - y;
		ab[i].x = ba[i].x = x;
		ab[i].y = ba[i].y = y;
	}
	sort(all(ab), comp);
	sort(all(ba), comp);
	cout << max(abs(ab[n - 1].x - ab[0].x) + abs(ab[n - 1].y - ab[0].y), abs(ba[n - 1].x - ba[0].x) + abs(ba[n - 1].y - ba[0].y));
	// cout << abs(a[0].ss.ff - a[n - 1].ss.ff) + abs(a[0].ss.ss - a[n - 1].ss.ss);
	return 0;
}


Compiler output:
a.cc:63:11: error: reference to 'data' is ambiguous
   63 | bool comp(data a, data b) {
      |           ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:2:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:59:8: note:                 'struct data'
   59 | struct data {
      |        ^~~~
a.cc:63:19: error: reference to 'data' is ambiguous
   63 | bool comp(data a, data b) {
      |                   ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:59:8: note:                 'struct data'
   59 | struct data {
      |        ^~~~
a.cc:63:25: error: expression list treated as compound expression in initializer [-fpermissive]
   63 | bool comp(data a, data b) {
      |                         ^
a.cc: In function 'int main()':
a.cc:79:16: error: template argument 1 is invalid
   79 |         vt<data> ab(n);
      |                ^
a.cc:79:16: error: template argument 2 is invalid
a.cc:80:16: error: template argument 1 is invalid
   80 |         vt<data> ba(n);
      |                ^
a.cc:80:16: error: template argument 2 is invalid
a.cc:83:19: error: invalid types 'int[long long int]' for array subscript
   83 |                 ab[i].val = x + y;
      |                   ^
a.cc:84:19: error: invalid types 'int[long long int]' for array subscript
   84 |                 ba[i].val = x - y;
      |                   ^
a.cc:85:19: error: invalid types 'int[long long int]' for array subscript
   85 |                 ab[i].x = ba[i].x = x;
      |                   ^
a.cc:85:29: error: invalid types 'int[long long int]' for array subscript
   85 |                 ab[i].x = ba[i].x = x;
      |                             ^
a.cc:86:19: error: invalid types 'int[long long int]' for array subscript
   86 |                 ab[i].y = ba[i].y = y;
      |                   ^
a.cc:86:29: error: invalid types 'int[long long int]' for array subscript
   86 |                 ab[i].y = ba[i].y = y;
      |                             ^
a.cc:19:18: error: request for member 'begin' in 'ab', which is of non-class type 'int'
   19 | #define all(v) v.begin(),v.end()
      |                  ^~~~~
a.cc:88:14: note: in expansion of macro 'all'
   88 |         sort(all(ab), comp);
      |              ^~~
a.cc:19:28: error: request for member 'end' in 'ab', which is of non-class type 'int'
   19 | #define all(v) v.begin(),v.end()
      |                            ^~~
a.cc:88:14: note: in expansion of macro 'all'
   88 |         sort(all(ab), comp);
      |              ^~~
a.cc:19:18: error: request for member 'begin' in 'ba', which is of non-class type 'int'
   19 | #define all(v) v.begin(),v.end()
      |                  ^~~~~
a.cc:89:14: note: in expansion of macro 'all'
   89 |         sort(all(ba), comp);
      |              ^~~
a.cc:19:28: error: request for member 'end' in 'ba', which is of non-class type 'int'
   19 | #define all(v) v.begin(),v.end()
      |                            ^~~
a.cc:89:14: note: in expansion of macro 'all'
   89 |         sort(all(ba), comp);
      |              ^~~
a.cc:90:27: error: invalid types 'int[long long int]' for array subscript
   90 |         cout << max(abs(ab[n - 1].x - ab[0].x) + abs(ab[n - 1].y - ab[0].y), abs(ba[n - 1].x - ba[0].x) + abs(ba[n - 1].y - ba[0].y));
      |                           ^
a.cc:90:41: error: invalid types 'int[int]' for array subscript
   90 |         cout << max(abs(ab[n - 1].x - ab[0].x) + abs(ab[n - 1].y - ab[0].y), abs(ba[n - 1].x - ba[0].x) + abs(ba[n - 1].y - ba[0].y));
      |                                         ^
a.cc:90:56: error: invalid types 'int[long long int]' for array subscript
   90 |         cout << max(abs(ab[n - 1].x - ab[0].x) + abs(ab[n - 1].y - ab[0].y), abs(ba[n - 1].x - ba[0].x) + abs(ba[n - 1].y - ba[0].y));
      |                                                        ^
a.cc:90:70: error: invalid types 'int[int]' for array subscript
   90 |         cout << max(abs(ab[n - 1].x - ab[0].x) + abs(ab[n - 1].y - ab[0].y), abs(ba[n - 1].x - ba[0].x) + abs(ba[n - 1].y - ba[0].y));
      |                                                                      ^
a.cc:90:84: error: invalid types 'int[long long int]' for array subscript
   90 |         cout << max(abs(ab[n - 1].x - ab[0].x) + abs(ab[n - 1].y - ab[0].y), abs(ba[n - 1].x - ba[0].x) + abs(ba[n - 1].y - ba[0].y));
      |                                                                                    ^
a.cc:90:98: error: invalid types 'int[int]' for array subscript
   90 |         cout << max(abs(ab[n - 1].x - ab[0].x) + abs(ab[n - 1].y - ab[0].y), abs(ba[n - 1].x - ba[0].x) + abs(ba[n - 1].y - ba[0].y));
      |                                                                                                  ^
a.cc:90:113: error: invalid types 'int[long long int]' for array subscript
   90 |         cout << max(abs(ab[n - 1].x - ab[0].x) + abs(ab[n - 1].y - ab[0].y), abs(ba[n - 1].x - ba[0].x) + abs(ba[n - 1].y - ba[0].y));
      |                                                                                                                 ^
a.cc:90:127: error: invalid types 'int[int]' for array subscript
   90 |         cout << max(abs(ab[n - 1].x - ab[0].x) + abs(ab[n - 1].y - ab[0].y), abs(ba[n - 1].x - ba[0].x) + abs(ba[n - 1].y - ba[0].y));
      |                                                                                                                               ^