Language: C++

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

ll mod = 1e9+7;

ll fpow(ll a, ll b){

	if(b == 0)
		return 1ll;
	if(b == 1)
		return a;
	
	ll val = fpow(a,b/2)%mod;

	ll res = (val*val)%mod;
	if(b%2 == 1)
		return (res*a)%mod;
	return res;
}
bool comp(pair<ll,ll> p1, pair<ll,ll> p2){
	return p1.first + p1.second < p2.first + p2.second;
}

int main(){

	/*ll n;
	cin >> n;
	if(n == 1){
		cout << 0 << "\n";
	}
	else{
		ll pos =  (n * (n-1))%mod;
		ll ans = (fpow(10,n-2) * pos);
		
		cout << ans%mod << "\n";
		
	}*/

	ll n,a,b;
	cin >> n;

	vector<pair<ll,ll>> v(n);
	for(int i = 0; i < n; i++){
		cin >> a >> b;
		v[i] = {a,b};
	}

	ll ans = 0;
	sort(v.begin(), v.end(),comp);
	if(n <= 1000){
		for(int i =0;  i < n; i++){
			for(int j = 0; j < n; j++){
				ans = max(ans, abs(v[i].first - v[j].first) + abs(v[i].second - v[j].second));
			}
		}
	}
	else{
		for(int i = n-1; i >= max(0ll,n-1000); i--){
			for(int j = 0; j <= min(n,1000); j++){
				ans = max(ans, abs(v[i].first - v[j].first) + abs(v[i].second - v[j].second));
			}
		}
	}
	cout << ans << "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:48: error: no matching function for call to 'min(long long int&, int)'
   60 |                         for(int j = 0; j <= min(n,1000); j++){
      |                                             ~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:60:48: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   60 |                         for(int j = 0; j <= min(n,1000); j++){
      |                                             ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:60:48: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   60 |                         for(int j = 0; j <= min(n,1000); j++){
      |                                             ~~~^~~~~~~~