stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<cmath>



using namespace std;



const int MAXN=100010;

long long X[MAXN];

long long f[MAXN];



long long A,B,N;



long long min(long long a,long long b)

{

	return a<b?a:b;

}



int main()

{

	

	scanf("%ld %ld %ld",&N,&A,&B);

	f[1]=0;

	

	for(int i=1;i<=N;i++)

	scanf("%ld",&X[i]);

	

	for(int i=2;i<=N;i++)

	f[i]=f[i-1]+min(A*(X[i]-X[i-1]),B);

		

	printf("%ld",f[N]);

	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <algorithm>



using namespace std;



int x[100005], n;

long long ans = 0, a, b;



int main() {

    scanf("%d %lld %lld", &n, &a, &b);

    for(int i=0; i<n; i++) {

        scanf("%d", &x[i]);

    }

    for(int i=1; i<n; i++) {

        long long s = x[i-1], e = x[i];

        ans += min((e-s) * a, b);

    }

    printf("%lld\n", ans);

//    system("pause");

    return 0; 

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include <bits/stdc++.h>

using namespace std;

typedef vector<int> VI;

typedef long long ll;



int main(){

  ll N, A, B;

  cin>>N>>A>>B;

  vector<ll> X;

  for(int i=0; i<N; i++){

    ll k;

    cin>>k;

    X.push_back(k);

  }

  ll cnt = 0;



  for(int i=0; i<N-1; i++){



    ll n = abs(X[i] - X[i+1]);

    ll p = n * A;

    if(p <= B){

      cnt += p;

    }else{

      cnt += B;

    }

  }

  cout<<cnt;

  return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <algorithm>



using namespace std;



int x[100005], n;

long long ans = 0, a, b;



int main() {

    scanf("%d %lld %lld", &n, &a, &b);

    for(int i=0; i<n; i++) {

        scanf("%d", &x[i]);

    }

    for(int i=1; i<n; i++) {

        long long s = x[i-1], e = x[i];

        ans += min((e-s) * a, b);

    }

    printf("%lld\n", ans);

//    system("pause");

    return 0; 

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <algorithm>

#include <vector>

using namespace std;



int main() {

  long long counter = 0;

  long long n, a, b;

  cin >> n >> a >> b;



  vector<int> towns(n);



  for (int i = 0; i < n; i++) {

    cin >> towns[i];

  }



  for (int i = 1; i < n; i++) {

    long long distance = (towns[i] - towns[i - 1]) * a;

    counter += min(distance, b);

  }



  cout << counter;

  return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <algorithm>



using namespace std;



int x[100005], n;

long long ans = 0, a, b;



int main() {

    scanf("%d %lld %lld", &n, &a, &b);

    for(int i=0; i<n; i++) {

        scanf("%d", &x[i]);

    }

    for(int i=1; i<n; i++) {

        long long s = x[i-1], e = x[i];

        ans += min((e-s) * a, b);

    }

    printf("%lld\n", ans);

//    system("pause");

    return 0; 

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
/*g++ file.cpp -o file.out*/

/*./file.out*/



#include <cmath>

#include <queue>

#include <stack>

#include <cstdio>

#include <string>

#include <vector>

#include <cstring>

#include <iostream>

#include <algorithm>

using namespace std;



#define LL long long

#define Mod 1000000007

#define L_Mod 17100000013



LL sov[100005],tmp[100005];

int main()

{

    int n,A,B;

    scanf("%d%d%d",&n,&A,&B);

    for(int i=1;i<=n;i++)

    {

        scanf("%lld",&tmp[i]);

    }

    tmp[0]=0;

    sov[1]=0;

    for(int i=2;i<=n;i++)

    {

        sov[i]=min(sov[i-1]+(tmp[i]-tmp[i-1])*A,sov[i-1]+B);

    }

    printf("%lld\n",sov[n]);

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <algorithm>



using namespace std;



int x[100005], n;

long long ans = 0, a, b;



int main() {

    scanf("%d %lld %lld", &n, &a, &b);

    for(int i=0; i<n; i++) {

        scanf("%d", &x[i]);

    }

    for(int i=1; i<n; i++) {

        long long s = x[i-1], e = x[i];

        ans += min((e-s) * a, b);

    }

    printf("%lld\n", ans);

//    system("pause");

    return 0; 

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;



int main(){

    ll n,cnt=0,x,a,b,s;

	cin>>n>>a>>b>>s;

	for(int i=2;i<=n;i++)

	{

		cin>>x;

		cnt+=min((x-s)*a,b);

		s=x;

	}

	cout<<cnt<<endl;

	return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <algorithm>



using namespace std;



int x[100005], n;

long long ans = 0, a, b;



int main() {

    scanf("%d %lld %lld", &n, &a, &b);

    for(int i=0; i<n; i++) {

        scanf("%d", &x[i]);

    }

    for(int i=1; i<n; i++) {

        long long s = x[i-1], e = x[i];

        ans += min((e-s) * a, b);

    }

    printf("%lld\n", ans);

//    system("pause");

    return 0; 

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>



long long x[100005];

int main(){

    long long n,a,b;

    std::cin >> n >> a >> b;

    for(int i = 1; i <= n; i ++){

        std::cin >> x[i];

    }

    long long res = 0;

    for(int i = 2; i <= n; i ++) res += (x[i] - x[i - 1] )* a > b ? b : a * (x[i] - x[i - 1]);

    std::cout << res;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <algorithm>



using namespace std;



int x[100005], n;

long long ans = 0, a, b;



int main() {

    scanf("%d %lld %lld", &n, &a, &b);

    for(int i=0; i<n; i++) {

        scanf("%d", &x[i]);

    }

    for(int i=1; i<n; i++) {

        long long s = x[i-1], e = x[i];

        ans += min((e-s) * a, b);

    }

    printf("%lld\n", ans);

//    system("pause");

    return 0; 

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

#include <queue>

#include <stack>

#include <map>

#include <set>

#include <vector>

#include <iomanip>

#define ALL(x) (x).begin(), (x).end()

#define dll(x) scanf("%I64d",&x)

#define xll(x) printf("%I64d\n",x)

#define sz(a) int(a.size())

#define all(a) a.begin(), a.end()

#define rep(i,x,n) for(int i=x;i<n;i++)

#define repd(i,x,n) for(int i=x;i<=n;i++)

#define pii pair<int,int>

#define pll pair<long long ,long long>

#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)

#define MS0(X) memset((X), 0, sizeof((X)))

#define MSC0(X) memset((X), '\0', sizeof((X)))

#define pb push_back

#define mp make_pair

#define fi first

#define se second

#define eps 1e-6

#define gg(x) getInt(&x)

#define db(x) cout<<"== [ "<<x<<" ] =="<<endl;

using namespace std;

typedef long long ll;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll powmod(ll a,ll b,ll MOD){ll ans=1ll;while(b){if(b&1)ans=ans*a%MOD;a=a*a%MOD;b>>=1;}return ans;}

inline void getInt(int* p);

const int maxn=1000010;

const int inf=0x3f3f3f3f;

/*** TEMPLATE CODE * * STARTS HERE ***/

int n;

ll a,b;

ll x[maxn];



int main()

{

	//    freopen("C:\\Users\\DH_M\\Desktop\\code_io\\in.txt.txt","r",stdin);

	//    freopen("C:\\Users\\DH_M\\Desktop\\code_io\\out.txt.txt","w",stdout);

	gbtb;

	cin>>n>>a>>b;

	repd(i,1,n)

	{

		cin>>x[i];

	}	

	ll ans=0ll;

	repd(i,2,n)

	{

		ll cha=x[i]-x[i-1];

		if(cha*a<=b)

		{

			ans+=cha*a;

		}else

		{

			ans+=b;

		}

	}

	cout<<ans<<endl;

	

	

    return 0;

}



inline void getInt(int* p) {char ch;do {ch = getchar();} 

while (ch == ' ' || ch == '\n');if (ch == '-') {*p = -(getchar() - '0');

while ((ch = getchar()) >= '0' && ch <= '9') {*p = *p * 10 - ch + '0';}}

else {*p = ch - '0';while ((ch = getchar()) >= '0' && ch <= '9') 

{*p = *p * 10 + ch - '0';}}}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <algorithm>



using namespace std;



int x[100005], n;

long long ans = 0, a, b;



int main() {

    scanf("%d %lld %lld", &n, &a, &b);

    for(int i=0; i<n; i++) {

        scanf("%d", &x[i]);

    }

    for(int i=1; i<n; i++) {

        long long s = x[i-1], e = x[i];

        ans += min((e-s) * a, b);

    }

    printf("%lld\n", ans);

//    system("pause");

    return 0; 

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

using LL = long long;

//#define zerol

#define FOR(i, x, y) for (decay<decltype(y)>::type i = (x), _##i = (y); i < _##i; ++i)

#define FORD(i, x, y) for (decay<decltype(x)>::type i = (x), _##i = (y); i > _##i; --i)

#ifdef zerol

#define dbg(x...) do { cout  << #x << " -> "; err(x); } while (0)

void err() { cout <<  endl; }

template<template<typename...> class T, typename t, typename... A>

void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }

template<typename T, typename... A>

void err(T a, A... x) { cout << a << ' '; err(x...); }

#else

#define dbg(...)

#endif



const int MAXN = 1e5+5;

const LL MOD = 1e9+7;



vector<int> p;

bool nop[MAXN];



int n;

LL a, b, x[MAXN];



int main() {

    scanf("%d%lld%lld", &n, &a, &b);

    FOR (i, 0, n) {

        scanf("%lld", &x[i]);

    }



    LL ans = 0;

    FOR (i, 1, n) {

        LL da = (x[i]-x[i-1]) * a, db = b;

        ans += min(da, db);

    }

    cout << ans << endl;





    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <algorithm>



using namespace std;



int x[100005], n;

long long ans = 0, a, b;



int main() {

    scanf("%d %lld %lld", &n, &a, &b);

    for(int i=0; i<n; i++) {

        scanf("%d", &x[i]);

    }

    for(int i=1; i<n; i++) {

        long long s = x[i-1], e = x[i];

        ans += min((e-s) * a, b);

    }

    printf("%lld\n", ans);

//    system("pause");

    return 0; 

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

typedef long long i64;

#define N 100005



i64 n, a, b, xarr[N];



int main()

{

	scanf("%lld%lld%lld", &n, &a, &b);

	for(int i = 1; i <= n; ++i) scanf("%lld", xarr + i);

	i64 ans = 0;

	for(int i = 2; i <= n; ++i)

		ans += std::min((xarr[i] - xarr[i - 1]) * a, b);

	printf("%lld\n", ans);

	return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <algorithm>



using namespace std;



int x[100005], n;

long long ans = 0, a, b;



int main() {

    scanf("%d %lld %lld", &n, &a, &b);

    for(int i=0; i<n; i++) {

        scanf("%d", &x[i]);

    }

    for(int i=1; i<n; i++) {

        long long s = x[i-1], e = x[i];

        ans += min((e-s) * a, b);

    }

    printf("%lld\n", ans);

//    system("pause");

    return 0; 

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <vector>

#include <iostream>

#include <algorithm>



using namespace std;



int main()

{

	int N, M, D;



	while (true)

	{

		scanf("%d", &N);

		scanf("%d", &M);



		if (N == 0 && M == 0) { break; }



		vector<int> C; C.push_back(0);



		for (int i = 0; i < N; i++)

		{

			scanf("%d", &D);



			if (D <= M)

			{

				C.push_back(D);

			}

		}



		vector<int> r;



		for (int i = 0; i < C.size(); i++)

		{

			for (int j = 0; j < C.size(); j++)

			{

				if (C[i] + C[j] <= M)

				{

					r.push_back(C[i] + C[j]);

				}

			}

		}



		sort(r.begin(), r.end());



		int ret = 0;



		for (int i = 0; i < r.size(); i++)

		{

			int ptr = upper_bound(r.begin(), r.end(), M - r[i]) - r.begin() - 1;

			

			if (ptr >= 0)

			{

				ret = max(ret, r[i] + r[ptr]);

			}

		}



		printf("%d\n", ret);

	}



	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

using namespace std;

int n, m, c[1009], s[1000009];

int main() {

	while (scanf("%d%d", &n, &m), n) {

		for (int i = 1; i <= n; i++) scanf("%d", &c[i]);

		int b = 0;

		for (int i = 0; i <= n; i++) {

			for (int j = i; j <= n; j++) {

				if (c[i] + c[j] <= m) s[b++] = c[i] + c[j];

			}

		}

		sort(s, s + b);

		int r = b - 1, ret = 0;

		for (int i = 0; i < b && i <= r; i++) {

			while (r > 0 && s[i] + s[r] > m) r--;

			ret = max(ret, s[i] + s[r]);

		}

		printf("%d\n", ret);

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <vector>

#include <iostream>

#include <algorithm>



using namespace std;



int main()

{

	int N, M, D;



	while (true)

	{

		scanf("%d", &N);

		scanf("%d", &M);



		if (N == 0 && M == 0) { break; }



		vector<int> C; C.push_back(0);



		for (int i = 0; i < N; i++)

		{

			scanf("%d", &D);



			if (D <= M)

			{

				C.push_back(D);

			}

		}



		vector<int> r;



		for (int i = 0; i < C.size(); i++)

		{

			for (int j = i; j < C.size(); j++)

			{

				if (C[i] + C[j] <= M)

				{

					r.push_back(C[i] + C[j]);

				}

			}

		}



		sort(r.begin(), r.end());



		int ret = 0;



		for (int i = 0; i < r.size(); i++)

		{

			int ptr = upper_bound(r.begin(), r.end(), M - r[i]) - r.begin() - 1;

			

			if (ptr >= 0)

			{

				ret = max(ret, r[i] + r[ptr]);

			}

		}



		printf("%d\n", ret);

	}



	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

using namespace std;

int n, m, c[1009], s[1000009];

int main() {

	while (scanf("%d%d", &n, &m), n) {

		for (int i = 1; i <= n; i++) scanf("%d", &c[i]);

		int b = 0;

		for (int i = 0; i <= n; i++) {

			for (int j = i; j <= n; j++) {

				if (c[i] + c[j] <= m) s[b++] = c[i] + c[j];

			}

		}

		sort(s, s + b);

		int r = b - 1, ret = 0;

		for (int i = 0; i < b && i <= r; i++) {

			while (r > 0 && s[i] + s[r] > m) r--;

			ret = max(ret, s[i] + s[r]);

		}

		printf("%d\n", ret);

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <vector>

#include <iostream>

#include <algorithm>



using namespace std;



int main()

{

	int N, M, D;



	while (true)

	{

		scanf("%d", &N);

		scanf("%d", &M);



		if (N == 0 && M == 0) { break; }



		vector<int> C; C.push_back(0);



		for (int i = 0; i < N; i++)

		{

			scanf("%d", &D);



			if (D <= M)

			{

				C.push_back(D);

			}

		}



		vector<int> r1, r;



		for (int i = 0; i < C.size(); i++)

		{

			for (int j = i; j < C.size(); j++)

			{

				if (C[i] + C[j] <= M)

				{

					r1.push_back(C[i] + C[j]);

				}

			}

		}



		sort(r1.begin(), r1.end());



		r.push_back(r1[0]);



		for (int i = 0; i < r1.size(); i++)

		{

			if (r1[i - 1] != r1[i])

			{

				r.push_back(r1[i]);

			}

		}



		int ret = 0;



		for (int i = 0; i < r.size(); i++)

		{

			int ptr = upper_bound(r.begin(), r.end(), M - r[i]) - r.begin() - 1;

			

			if (ptr >= 0)

			{

				ret = max(ret, r[i] + r[ptr]);

			}

		}



		printf("%d\n", ret);

	}



	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

using namespace std;

int n, m, c[1009], s[1000009];

int main() {

	while (scanf("%d%d", &n, &m), n) {

		for (int i = 1; i <= n; i++) scanf("%d", &c[i]);

		int b = 0;

		for (int i = 0; i <= n; i++) {

			for (int j = i; j <= n; j++) {

				if (c[i] + c[j] <= m) s[b++] = c[i] + c[j];

			}

		}

		sort(s, s + b);

		int r = b - 1, ret = 0;

		for (int i = 0; i < b && i <= r; i++) {

			while (r > 0 && s[i] + s[r] > m) r--;

			ret = max(ret, s[i] + s[r]);

		}

		printf("%d\n", ret);

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <vector>

#include <iostream>

#include <algorithm>



using namespace std;



int main()

{

	int N, M, D;



	while (true)

	{

		scanf("%d", &N);

		scanf("%d", &M);



		if (N == 0 && M == 0) { break; }



		vector<int> C; C.push_back(0);



		for (int i = 0; i < N; i++)

		{

			scanf("%d", &D);



			if (D <= M)

			{

				C.push_back(D);

			}

		}



		vector<int> r;



		for (int i = 0; i < C.size(); i++)

		{

			for (int j = i; j < C.size(); j++)

			{

				if (C[i] + C[j] <= M)

				{

					r.push_back(C[i] + C[j]);

				}

			}

		}



		sort(r.begin(), r.end());



		int ret = 0, lc = 0, rc = r.size() - 1;



		while (rc - lc >= 0)

		{

			if (r[lc] + r[rc] > M)

			{

				rc--;

			}

			else

			{

				ret = max(ret, r[lc] + r[rc]); lc++;

			}

		}



		printf("%d\n", ret);

	}



	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

using namespace std;

int n, m, c[1009], s[1000009];

int main() {

	while (scanf("%d%d", &n, &m), n) {

		for (int i = 1; i <= n; i++) scanf("%d", &c[i]);

		int b = 0;

		for (int i = 0; i <= n; i++) {

			for (int j = i; j <= n; j++) {

				if (c[i] + c[j] <= m) s[b++] = c[i] + c[j];

			}

		}

		sort(s, s + b);

		int r = b - 1, ret = 0;

		for (int i = 0; i < b && i <= r; i++) {

			while (r > 0 && s[i] + s[r] > m) r--;

			ret = max(ret, s[i] + s[r]);

		}

		printf("%d\n", ret);

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <vector>

#include <iostream>

#include <algorithm>



using namespace std;



int main()

{

	int N, M, D;



	while (true)

	{

		scanf("%d", &N);

		scanf("%d", &M);



		if (N == 0 && M == 0) { break; }



		vector<int> C; C.push_back(0);



		for (int i = 0; i < N; i++)

		{

			scanf("%d", &D);



			if (D <= M)

			{

				C.push_back(D);

			}

		}



		vector<int> r;



		for (int i = 0; i < C.size(); i++)

		{

			for (int j = i; j < C.size(); j++)

			{

				if (C[i] + C[j] <= M)

				{

					r.push_back(C[i] + C[j]);

				}

			}

		}



		sort(r.begin(), r.end());



		int ret = 0, lc = 0, rc = r.size() - 1;



		while (rc - lc >= 0)

		{

			if (r[lc] + r[rc] > M)

			{

				rc--;

			}

			else

			{

				ret = max(ret, r[lc++] + r[rc]);

			}

		}



		printf("%d\n", ret);

	}



	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

using namespace std;

int n, m, c[1009], s[1000009];

int main() {

	while (scanf("%d%d", &n, &m), n) {

		for (int i = 1; i <= n; i++) scanf("%d", &c[i]);

		int b = 0;

		for (int i = 0; i <= n; i++) {

			for (int j = i; j <= n; j++) {

				if (c[i] + c[j] <= m) s[b++] = c[i] + c[j];

			}

		}

		sort(s, s + b);

		int r = b - 1, ret = 0;

		for (int i = 0; i < b && i <= r; i++) {

			while (r > 0 && s[i] + s[r] > m) r--;

			ret = max(ret, s[i] + s[r]);

		}

		printf("%d\n", ret);

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <vector>

#include <iostream>

#include <algorithm>



using namespace std;



int main()

{

	int N, M, D;



	while (true)

	{

		scanf("%d", &N);

		scanf("%d", &M);



		if (N == 0 && M == 0) { break; }



		vector<int> C(N + 1); C.push_back(0);



		for (int i = 1; i <= N; i++)

		{

			scanf("%d", &C[i]);

		}



		vector<int> r;



		for (int i = 0; i <= N; i++)

		{

			for (int j = i; j <= N; j++)

			{

				if (C[i] + C[j] <= M)

				{

					r.push_back(C[i] + C[j]);

				}

			}

		}



		sort(r.begin(), r.end());



		int ret = 0, lc = 0, rc = r.size() - 1;



		while (rc - lc >= 0)

		{

			if (r[lc] + r[rc] > M)

			{

				rc--;

			}

			else

			{

				ret = max(ret, r[lc++] + r[rc]);

			}

		}



		printf("%d\n", ret);

	}



	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <algorithm>

using namespace std;

int n, m, c[1009], s[1000009];

int main() {

	while (scanf("%d%d", &n, &m), n) {

		for (int i = 1; i <= n; i++) scanf("%d", &c[i]);

		int b = 0;

		for (int i = 0; i <= n; i++) {

			for (int j = i; j <= n; j++) {

				if (c[i] + c[j] <= m) s[b++] = c[i] + c[j];

			}

		}

		sort(s, s + b);

		int r = b - 1, ret = 0;

		for (int i = 0; i < b && i <= r; i++) {

			while (r > 0 && s[i] + s[r] > m) r--;

			ret = max(ret, s[i] + s[r]);

		}

		printf("%d\n", ret);

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
//Bokan ga bokka--nn!!

//Daily Lunch Special Tanoshii !!

//これは、頭が悪く競プロが世界で一番できないHIR180が

//IOI2014日本代表になるまでのN日間の記録である。

#include <cstdio>

#include <cstring>

#include <cstdlib>

#include <cmath>

#include <ctime>

#include <cassert>

#include <string>

#include <algorithm>

#include <vector>

#include <queue>

#include <stack>

#include <functional>

#include <iostream>

#include <map>

#include <set>

using namespace std;

typedef pair<int,int> P;

typedef pair<int,P> P1;

typedef pair<P,P> P2;

typedef long long ll;

#define pu push

#define pb push_back

#define mp make_pair

#define eps 1e-7

#define INF 2000000000

#define f first

#define s second

#define rep(i,x) for(int i=0;i<x;i++)

P za[100005];

int main()

{

	srand((unsigned int)time(NULL));

	int n,x,y;  scanf("%d",&n);

	int lx=INF,ly=INF,rx=-INF,ry=-INF;

	for(int i=0;i<n;i++)

	{

		scanf("%d%d",&x,&y);

		za[i]=mp(x+y,x-y);

		lx=min(lx,x+y);

		rx=max(rx,x+y);

		ly=min(ly,x-y);

		ry=max(ry,x-y);

	}

	int ret1=0,ret2=0;

	for(int i=0;i<n;i++)

	{

		//(lx,ly)(rx,ry)

		ret1=max(ret1,min(max(za[i].f-lx,za[i].s-ly),max(rx-za[i].f,ry-za[i].s)));

		//(lx,ry)(rx,ly)

		ret2=max(ret2,min(max(za[i].f-lx,ry-za[i].s),max(rx-za[i].f,za[i].s-ly)));

	}

	printf("%d\n",min(ret1,ret2));

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#define INF 100000000

int a[100005],b[100005];

int min(int a,int b){ return a<b?a:b;}

int max(int a,int b){ return a>b?a:b;}

int main()

{

	int n,x,y;  scanf("%d",&n);

	int lx=INF,ly=INF,rx=-INF,ry=-INF;

	for(int i=0;i<n;i++)

	{

		scanf("%d%d",&x,&y);

		a[i]=x+y;b[i]=x-y;

		lx=min(lx,x+y);

		rx=max(rx,x+y);

		ly=min(ly,x-y);

		ry=max(ry,x-y);

	}

	int ret1=0,ret2=0;

	for(int i=0;i<n;i++)

	{

		//(lx,ly)(rx,ry)

		ret1=max(ret1,min(max(a[i]-lx,b[i]-ly),max(rx-a[i],ry-b[i])));

		//(lx,ry)(rx,ly)

		ret2=max(ret2,min(max(a[i]-lx,ry-b[i]),max(rx-a[i],b[i]-ly)));

	}

	printf("%d\n",min(ret1,ret2));

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>



using namespace std;



typedef long long LL;



LL f[20];



LL p[20];



int main(){

    LL n;scanf("%lld",&n);



    f[0]=1;

    for(int i=1;i<=12;++i)f[i]=26ll*f[i-1];

    for(int i=2;i<=12;++i)f[i]+=f[i-1];



    p[0]=1;

    for(int i=1;i<=12;++i)p[i]=26ll*p[i-1];



    int idx=1;

    while(f[idx]<n)++idx;



    string res;



    LL cnt;

    if(idx==1)cnt=0;

    else cnt=f[idx-1];



    for(int i=1;i<=idx;++i){

        for(int ch=0;ch<=25;++ch){

            LL t=cnt+1ll*(ch+1)*p[idx-i];

            if(t>=n){

                res+=ch+'a';

                cnt+=1ll*ch*p[idx-i];

                break;

            }

        }

    }



    cout<<res;



    return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

typedef int int_;

#define int long long

#define maxn 200010

const int inf=1e9+7;

inline int read(){

	int ret=0,ff=1;

	char ch=getchar();

	while(ch<'0'||ch>'9'){

		if(ch=='-') ff=-ff;

		ch=getchar();

	}

	while(ch>='0'&&ch<='9'){

		ret=ret*10+ch-'0';

		ch=getchar();

	}

	return ret*ff;

}



int gcd(int a,int b){

	return b?gcd(b,a%b):a;

}

int ksm(int a,int b,int p){

	int ret=1;

	while(b){

		if(b&1) ret=ret*a%p;

		a=a*a%p;

		b>>=1;

	}

	return ret%p;

}

bool vis[maxn];

int a[maxn],ans[maxn];

int qwq[maxn];

int_ main(){

	int n=read();

	int cnt=0;

	while(n--){

		ans[++cnt]=n%26;

		n/=26;

	}

	while(cnt){

		printf("%c",'a'+ans[cnt]);

		--cnt;

	}

} 

// Fastest known solution for this problem: