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)
}

Python: n=int(input())
x=list(map(int,input().split()))
s=max(x)-min(x)
if s%2==0:
    print(int(s/2))
else:
    print(int((s+1)/2))

Python: N=int(input())
x=list(map(int, input().split()))
m=max(x)
n=min(x)
if (m-n)%2==0:
    print((m-n)//2)
else:
    print(((m-n)//2)+1)

Python: n=int(input())
x=list(map(int,input().split()))
if (max(x)+min(x)+1)%2 != 0:
    print((max(x)+min(x)+1)//2-min(x))
else:
    print((max(x)+min(x)+1)//2-min(x))

Python: n=int(input())
a=list(map(int,input().split()))
if (max(a)-min(a))%2==0:
    print((max(a)-min(a))//2)
else:
    print((max(a)-min(a)+1)//2)

Python: n=int(input())
x=list(map(int,input().split()))
if (max(x)+min(x))%2==0:
    m=(int((max(x)+min(x))/2))
else:
    m=(int((max(x)+min(x)-1)/2))
print(max(x)-m)

Python: n = int(input())
x = list(map(int,input().split()))
m = abs(max(x) - min(x))
if m % 2:
  m = m + 1
  print(m // 2)
else:
  print(m // 2)

Python: N=int(input())
table=list(map(int,input().split()))
if (max(table)-min(table))%2==0:
    print((max(table)-min(table))//2)
else:
    print(((max(table)-min(table))//2)+1)

Python: N=int(input())
n=list(map(int,input().split()))
kyori=max(n)-min(n)
if kyori==1:
    print('1')
else:
    if kyori%2==0:
        print(int(kyori/2))
    else:
        print(int((kyori+1)/2))

Python: N = int(input())
x = [int(i) for i in input().split()]
x.sort()
a = min(x)
b = max(x)
c = b-a
if c > 1:
    print(-(-c//2))
else:
    print(c)

Python: N=input()
x_list=list(map(int,input().split()))
ans=(max(x_list)-min(x_list)+1)//2

print(ans)

Python: n = int(input())
x = list(map(int,input().split()))
#print((max(x) + min(x))/2)
print(max(x) - int((max(x) + min(x))/2))

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

#define N 2000

int main() {

  int n;
  cin>>n;

  int a, max = 0, min = N;
  for (int i = 0; i < n; i++) {
    cin>>a;
    if (max < a) max = a;
    if (min > a) min = a;
  }

  int dis = (max - min) + 1;
  cout<<dis/2<<endl;

  return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#define all(x) (x).begin(), (x).end()
using namespace std;

int main(void) {
    int N;cin>>N;
    vector<int> x(N);
    for (int i = 0; i < N; i++) cin>>x[i];
    sort(all(x));
    int tmp = x[0] + x[N-1];
    cout << max(tmp/2 - x[0], x[N-1] - tmp/2) << endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto& e : a) {
    cin >> e;
  }
  sort(a.begin(), a.end());
  cout << a[n - 1] - (a[0] + a[n - 1]) / 2 << "\n";
}

C++: #include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;
int main() {
	double a;
	double c = 0;
	cin >> a;
	vector<int> b(a);
	for (int i = 0;i < a;i++) {
		cin >> b[i];
		c += b[i];
	}
	int x=*max_element(b.begin(), b.end());
	int y=*min_element(b.begin(), b.end());
	if((x+y)%2==0) cout << (x+y)/2 -y<< endl;
	else cout << (x + y+1) / 2-y << endl;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n;
	int x[1001];
	cin >> n;
	for (int i = 1;i <= n;i++)cin >> x[i];
	int ans, Ma, Mi;
	ans = Ma = 0;
	Mi = 10000;
	for (int i = 1;i <= n;i++) {
		Ma = max(Ma, x[i]);
		Mi = min(Mi, x[i]);
	}
	ans = abs(Ma - Mi+1)/2;
	cout << ans << endl;

	return 0;
}

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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = INT_MAX / 2; const ll INF = LLONG_MAX / 2;
//template end



int main(){
    int n; scanf("%d",&n);
    int maxx=-inf,minn=inf;
    rep(i,0,n){
        int p; scanf("%d",&p);
        chmax(maxx,p); chmin(minn,p);
    }
    printf("%d\n",(maxx-minn+1)/2);
    return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
    int n, l=9999, r=0;
    cin >> n;
    for(int i=0;i<n;i++){
        int x;
        cin >> x;
        l = min(l, x);
        r = max(r, x);
    }
    cout << (r-l+1)/2 << endl;
    return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int N; cin >> N;
    int x[1100];
    for(int i=0;i<N;i++){
        cin >> x[i];
    }
    sort(x,x+N);
    cout << (x[N-1]-x[0]+1)/2 << endl;
}

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

int n, mx = 0, mn = 2000;

int main()
{
	cin >> n;

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

		if (x > mx)
			mx = x;

		if (x < mn)
			mn = x;
	}

	cout << (mx - mn + 1) / 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];
    }

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

    int max = x[n-1];
    int min = x[0];

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

}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>
#include <set>
#include <cstdlib>
#include <queue>
#include <map>
#include <cstdio>

using namespace std;

typedef long long llint;
typedef long double ld;
#define inf 1e18
#define mod 1000000007
//priority_queue<llint,vector<llint>,greater<llint>> que;
//priority_queue<llint> q;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n;

void solve(){
  cin >> n;
  vector<int> x(n);
  for(int i=0;i<n;i++)cin >> x[i];
  int mx=*max_element(x.begin(),x.end());
  int mn=*min_element(x.begin(),x.end());
  int ans=10000;
  int t,tmp;
  for(int i=mn;i<=mx;i++){
    t=0;
    tmp=-1;
    for(int j=0;j<n;j++){
      t=abs(i-x[j]);
      tmp=max(t,tmp);
    }
    ans=min(ans,tmp);
  }
  cout << ans << endl;
}

int main() {
  solve();
  return 0;
}

C++: #include<iostream>
#include<string>
#include<set>
#include<utility>
#include<vector>
#include<map>
#include<algorithm>
#include<queue>
#include<stack>
#include<iomanip>

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

#define P pair<int, int>

typedef long long ll;

using namespace std;

#include <string>
#include <cctype>
typedef string::const_iterator State;
class ParseError {};


int main() {
	int N;
	cin >> N;
	int h[1005];
	rep(i, N) cin >> h[i];
	sort(h, h + N);
	int mid = (h[0] + h[N - 1]) / 2;
	cout << max(mid - h[0], h[N - 1] - mid) << endl;

	return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<string>
#include <algorithm>
#include<cstring>
#include <math.h>
#include <iomanip>
using namespace std;

int main()
{
  int n;
  cin>>n;
  int x;
  int max=0,min=2000;
  for(int i=0;i<n;i++){
    cin>>x;
    if(x<min)min=x;
    if(x>max)max=x;
  }
  x=(min+max)/2;
  int ans=max-x;
  cout<<ans<<endl;
  return 0;
  
}

C++: #include <stdio.h>

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