Go: package main

import (
    "bufio"
    "fmt"
    "strconv"
    "os"
    "strings"
    "math"
)

/*
var sc = bufio.NewScanner(os.Stdin) exceed MaxScanTokenSize
func read() string {
    sc.Scan()
    return sc.Text()
}
*/

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() string {
    buf := make([]byte, 0, 1000000)
    for {
        l, p, e := rdr.ReadLine()
        if e != nil {
            panic(e)
        }
        buf = append(buf, l...)
        if !p {
            break
        }
    }
    return string(buf)
}

func toInt(str string) int {
    n, _ := strconv.Atoi(str)
    return n
}

func min(a int, b int) int {
    return int(math.Min(float64(a), float64(b)))
}

func max(a int, b int) int {
    return int(math.Max(float64(a), float64(b)))
}

func main() {
    nm := strings.Split(readLine(), " ")
    n := toInt(nm[0])
    var infoDist [100000]int
    for i := 0; i < n; i++ {
        infoDist[i] = 100000
    }
    haveInfo := strings.Split(readLine(), " ")
    for _, value := range haveInfo {
        infoDist[toInt(value) - 1] = 0
    }

    for i := 0;i < n - 1; i++ {
        infoDist[i + 1] = min(infoDist[i] + 1, infoDist[i + 1])
    }

    for i := n - 1;i > 0; i-- {
        infoDist[i - 1] = min(infoDist[i] + 1, infoDist[i - 1])
    }

    ans := 0
    for i := 0;i < n;i++ {
        ans = max(ans, infoDist[i])
    }

    fmt.Println(max(ans, infoDist[0]))

}

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

int N;

struct P{
	int x,y,z;
	int dist(P p){
		return abs(x-p.x) + abs(y-p.y) + abs(z-p.z);
	}
	P rotZ(){ return {y,N-x-1,z}; }
	P rotY(){ return {z,y,N-x-1}; }
	P rotX(){ return {x,z,N-y-1}; }

	bool valid(){
		if( x < 0 || x >= N ) return false;
		if( y < 0 || y >= N ) return false;
		if( z < 0 || z >= N ) return false;
		return true;
	}
	string toString(){
		stringstream ss;
		ss << "(" << x << " " << y << " " << z << ")";
		return ss.str();
	}
};
bool operator < (const P &a,const P &b){
	if( a.x != b.x ) return a.x < b.x;
	if( a.y != b.y ) return a.y < b.y;
	return a.z < b.z;
}
bool operator == (const P &a,const P &b){
	if( a.x != b.x ) return false;
	if( a.y != b.y ) return false;
	return a.z == b.z;
}

P operator + (P a,P b){
	a.x += b.x;
	a.y += b.y;
	a.z += b.z;
	return a;
};


struct NODE{
	vector<P> p;
	int phase;
	int cost;
};
bool operator < (const NODE &a,const NODE &b){
	if( a.phase != b.phase ) return a.phase < b.phase;
	return a.p < b.p;
}

int dx[] = {-1,1,0,0,0,0,0};
int dy[] = {0,0,-1,1,0,0,0,0};
int dz[] = {0,0,0,0,-1,1,0,0,0,0};

vector<P> rot(vector<P> p,int id){
	
	if( id == 0 ){
		p[0] = p[0].rotZ();
		if( p[0].z == p[1].z ) p[1] = p[1].rotZ();
	}
	if( id == 1 ){
		p[0] = p[0].rotY();
		if( p[0].y == p[1].y ) p[1] = p[1].rotY();
	}
	if( id == 2 ){
		p[0] = p[0].rotX();
		if( p[0].x == p[1].x ) p[1] = p[1].rotX();
	}
	if( id == 3 ){
		p[0] = p[0].rotZ().rotZ().rotZ();
		if( p[0].z == p[1].z ) p[1] = p[1].rotZ().rotZ().rotZ();
	}
	if( id == 4 ){
		p[0] = p[0].rotY().rotY().rotY();
		if( p[0].y == p[1].y ) p[1] = p[1].rotY().rotY().rotY();
	}
	if( id == 5 ){
		p[0] = p[0].rotX().rotX().rotX();
		if( p[0].x == p[1].x ) p[1] = p[1].rotX().rotX().rotX();
	}
	return p;

}

int main(){
	cin >> N;
	vector<P> c; 
	for(int i = 0 ; i < N ; i++){
		int x,y,z;
		cin >> x >> y >> z;
		c.push_back({x,y,z});
	}
	c.resize(2);
	N = 100000;
	c[0] = {0,0,0};
	c[1] = {N-1,N-1,N-1};
	
	//assert(c[0].rotY().rotY().rotY().rotY() == c[0]);
	//assert(c[1].rotZ().rotZ().rotZ().rotZ() == c[1]);
	//assert(c[1].rotX().rotX().rotX().rotX() == c[1]);


	map<NODE,int> done;

	deque<NODE> Q;

	int ans = 1e9;
	Q.push_back({c,0,0});
	while( Q.size() ){
		NODE q = Q.front(); Q.pop_front();
		if( done[q]++ ) continue;
		//cout << q.phase << "|" << q.p[0].toString() << " " << q.p[1].toString() << "|" << q.cost << endl;
		ans = min(ans,q.cost + q.p[0].dist(q.p[1]));
		if( q.phase == 2 ) continue;

		if( q.phase == 0 || q.phase == 2 ){
			for(int i = 0 ; i < 6 ; i++){
				P ne = q.p[0] + P{dx[i],dy[i],dz[i]};
				if( !ne.valid() ) continue;
				
				NODE nextq = q;
				nextq.cost ++;
				nextq.p[0] = ne;
				nextq.phase++;
				if( !done[nextq] ) Q.push_back(nextq);
			}
		}else if( q.phase == 1 ){
			for(int i = 0 ; i < 6 ; i++){
				NODE nextq = q;
				nextq.cost++;
				nextq.p = rot(nextq.p,i);
				if( !done[nextq] ) Q.push_back(nextq);
			}
		}
		// next phase 
		q.phase++;
		Q.push_front(q);
	}
	cout << done.size() << endl;
	cout << ans << endl;
}

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

int main(){

  int n, m, a[100000], ans=0;

  cin>>n>>m;
  for(int i=0;i<m;i++) cin>>a[i];

  for(int i=1;i<m;i++) ans=max(ans, (a[i]-a[i-1])/2);

  ans=max(ans, a[0]-1);
  ans=max(ans, n-a[m-1]);

  cout<<ans<<endl;

  return 0;
}

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

int main() {
	int n, m;
	cin >> n >> m;

	set<int> ok;
	for(int i = 0; i < m; ++i) {
		int a;
		cin >> a;
		ok.emplace(a);
	}

	int ans = 0;
	for(int i = 1; i <= n; ++i) {
		auto it = ok.lower_bound(i);
		int mn = INT_MAX;
		if(it != ok.end()) {
			mn = min(mn, *it - i);
		}

		if(it != ok.begin()) {
			--it;
			mn = min(mn, i - *it);
		}
		ans = max(ans, mn);
	}
	cout << ans << endl;

	return 0;
}

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

#define int long long

typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

int N,M;
int dp[111111];
signed main(){
    cin>>N>>M;
    fill_n(dp,N,1<<25);
    rep(i,M){
        int a;
        cin>>a;
        dp[--a]=0;
    }

    reps(i,1,N)chmin(dp[i],dp[i-1]+1);
    for(int i=N-2;i>=0;i--)chmin(dp[i],dp[i+1]+1);

    cout<<*max_element(dp,dp+N)<<endl;
    return 0;
}

C++: /*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int n,m,a,x[100005]={},ans=0;
  cin >> n >> m;
  for(int i=1; i<=n; i++) {
    x[i]=inf;
  }
  for(int i=0; i<m; i++) {
    cin >> a;
    x[a]=0;
  }
  for(int i=2; i<=n; i++) {
    if(x[i-1]!=inf) {
      x[i]=min(x[i-1]+1,x[i]);
    }
  }
  for(int i=n-1; i>=1; i--) {
    if(x[i+1]!=inf) {
      x[i]=min(x[i+1]+1,x[i]);
    }
  }
  for(int i=1; i<=n; i++) {
    ans=max(ans,x[i]);
  }
  cout << ans << endl;
}

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

int main() {
	int N, M;
	cin >> N >> M;
	long long int ans = LLONG_MIN / 6;
	long long int now;
	cin >> now;
	for( size_t i = 1; i < M; i++ ) {
		long long int a;
		cin >> a;
		ans = max( (a - now) / 2, ans );
		now = a;
	}
	ans = max( N - now, ans );
	cout << ans << endl;
}