Go: package main

import "fmt"

func main() {
	var n, x int
	fmt.Scanln(&n)
	min, max := 2000, 0
	for ; n > 0; n-- {
		fmt.Scan(&x)
		if x < min {
			min = x
		}
		if x > max {
			max = x
		}
	}
	fmt.Println((max - min + 1) / 2)
}

C++: #include<algorithm>
#include<iostream>
#include<vector>
using namespace std;

vector<int> input(int N){
    int i;
    vector<int> output(N);
    for(i=0;i<N;i++)cin>>output[i];
    return output;
}

int main(){
    int N,i,result,x_min,x_max;
    vector<int> X;

    cin>>N;
    X=input(N);
    x_min=*min_element(X.begin(),X.end());
    x_max=*max_element(X.begin(),X.end());
    
    result=(x_max-x_min)/2+(x_max-x_min)%2;

    cout<<result<<endl;
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n,home,m=10000,M=0;
  cin >> n;
  for(int i=0; i<n; i++){
    int x;
    cin >> x;
    if(m>=x)m=x;
    if(M<=x)M=x;
  }
  home=M-((m+M)/2);
  //  cout << M <<" "<< m << endl;
  //  cout << m+M << endl;
  // cout << (m+M)/2 << endl;
  cout << home << endl;
}

C++: #include<iostream>
using namespace std;

int main(){
	int n, x, min, max;
	cin >> n;
	cin >> x;
	min = x;
	max = x;
	for(int i=1; i<n; ++i){
		cin >> x;
		if(x>max){max=x;}
		if(x<min){min=x;}
	}

	cout << (max-min)/2 + (max-min)%2 << endl;

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> X(N);
    for(int i = 0;i < N; i++) cin >> X[i];
    int MIN = *min_element(begin(X), end(X));
    int MAX = *max_element(begin(X), end(X));
    int m = (MIN + MAX) / 2;
    cout << max(abs(MIN - m), abs(MAX - m)) << endl;
}

C++: #include <stdio.h>
typedef long long ll;
using namespace std;

int main(void) {
  ll i, n, max = 0, min = 2000, x;
  scanf("%lld", &n);
  for(i = 0; i < n; i++) {
    scanf("%lld", &x);
    if(max < x) max = x;
    if(min > x) min = x;
  }
  printf("%lld\n", (max - min + 1) / 2);
  return 0;
}

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

int main(){
	int n;
	int xmax=0,xmin=2000;
	cin>>n;
	for(int i=0; i < n;i++){
		int a;
		cin>>a;
		xmax = max(xmax,a);
		xmin = min(xmin,a);
	}
	cout<<(xmax-xmin+1)/2<<endl;
}

C++: #include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i = 0; i < n; i++)
#define Rep(i,n) for(int i = 1; i <= n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
template<class T> using V = vector<T>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



int main(){
    int n;
    cin >> n;
    V<int> a(n);
    rep(i,n) cin >> a[i];
    int ans = inf;
    sort(all(a));
    for(int i = 0; i <= 2000; i++) {
        int tmp = 0;
        rep(j,n) chmax(tmp, abs(a[j]-i));
        chmin(ans, tmp);
    }
    cout << ans << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define INF INT_MAX
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a * b / gcd(a, b);};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
template<class T>inline bool chmax(T& a,T b){if(a < b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a > b){a=b;return true;}return false;};



int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);

  int n;
  cin >> n;
  int a[n];
  rep(i, n) cin >> a[i];
  int x = INF, y = 0;
  rep(i, n) {
    chmin(x, a[i]);
    chmax(y, a[i]);
  }
  cout << (y - x + 1) / 2 << endl;
  return 0;
}

C++: #include<iostream>
using namespace std;
int fabs(int x){
    if(x<0) return -x;
    return x;
}
int main(){
    int n; cin>>n;
    int data[1001];
    for(int i=1;i<=n;++i) cin>>data[i];
    int maxv=0,minv=1000000000;
    for(int i=1;i<=2000;++i){
	maxv=0;
	for(int j=1;j<=n;++j)
	    maxv=max(maxv,fabs(i-data[j]));
	minv=min(minv,maxv);
    }
    cout<<minv<<endl;
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(){
    int N;
    cin >> N;
    int a,Imax = 0,Imin = 3000;
    for(int i = 0;i < N;i++){
        cin >> a;
        Imax = max(Imax,a);
        Imin = min(Imin,a);
    }
    int I;
    I = Imax - Imin;
    //cout << Imax << endl;
    //cout << Imin << endl;
    if(I % 2 == 1){
        cout << I/2+1 << endl;
    }else{
        cout << I/2 << endl;
    }
    
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (int i = m; i < (n); ++i)
using namespace std;
using ll = long long;

int main(){
    int n;
    cin >> n;
    vector<int> ie(n);
    rep(i,n){
        cin >> ie[i];
    }
    int mi = 2005;
    int mx = 0;
    rep(j,n){
        mi = min(mi, ie[j]);
        mx = max(mx, ie[j]);
    }
    int ans;
    if ((mx - mi) % 2 == 0){
        ans = (mx - mi) / 2;
    }
    else{
        ans = (mx - mi + 1) / 2;
    }
    cout << ans << endl;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    int n;
    cin >> n;
    vi a(n);
    rep(i,n)cin >> a[i];
    int ans = INF;
    rep(i,2001){
        int t = 0;
        rep(j,n)t = max(t, abs(a[j]-i));
        ans = min(ans, t);
    }
    cout << ans << endl;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
template<class T, class Compare = less<T> >
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template<class T, class Compare = greater<T> >
using MinHeap = priority_queue<T, vector<T>, Compare>;
using llong = long long;

llong n;
llong x[1005];

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) cin >> x[i];

    llong ans = 1ll << 60ll;
    for (llong p = 0; p <= 2000; p++) {
        llong mv = -1;
        for (llong i = 0; i < n; i++) {
            mv = max(mv, llabs(x[i] - p));
        }

        ans = min(mv, ans);
    }

    cout << ans << endl;

    return 0;
}