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 <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

int main() {

  int N, M; cin >> N >> M;
  vector<int> v(N, inf);
  rep(i, M) {
    int x; cin >> x; x--;
    v[x] = 0;
  }

  REP(i, 1, N) {
    v[i] = min(v[i], v[i-1] + 1);
  }

  for(int i=N-2; i>=0; i--) {
    v[i] = min(v[i], v[i+1] + 1);
  }

  cout << *max_element(all(v)) << endl;

  return 0;
}

C++: #include <iostream>
#include <vector>

int main()
{
    int n, m;
    std::cin >> n >> m;
    
    std::vector<int> min_t(n, (1 << 29));
    for (int i = 0; i < m; i++) {
        int a;
        std::cin >> a;
        min_t[a - 1] = 0;
    }

    for (int i = 1; i < n; i++) {
        min_t[i] = std::min(min_t[i], min_t[i - 1] + 1);
    }

    for (int i = n - 2; i >= 0; i--) {
        min_t[i] = std::min(min_t[i], min_t[i + 1] + 1);
    }

    int ret = 0;
    for (int t : min_t) {
        ret = std::max(ret, t);
    }

    std::cout << ret << std::endl;
    
    return 0;
}

C++: #include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int ans=0;
	int n,m;
	cin>>n>>m;
	vint v(m);
	rep(i,m){
		cin>>v[i];
	}
	v.PB(0);
	v.PB(n+1);
	sort(ALL(v));
	rep(i,v.size()-1){
		maxs(ans,v[i+1]-v[i]);
	}
	ans=(ans+1)/2;
	cout<<ans<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

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

int main()
{
    int n, m, d;

    cin >> n >> m;

    bool a[n+2];
    for( int i = 0; i < n + 2; i++ )
        a[i] = 0;
    a[0] = a[n+1] = 1;

    int ma = 0;
    for( int i = 0; i < m; i++ )
    {
        cin >> d;
        if( i == 0 )
            ma = d - 1;
        if( i == m - 1 )
            ma = max( ma, n - d );
        a[d] = 1;
    }

    int sum = 0;
    for( int i = 0; i < n + 2; i++ )
    {
        if( a[i] )
            sum = 0;
        if( !a[i] )
            sum++;
        if( ma < ( sum + 1 ) / 2 )
            ma = ( sum + 1 ) / 2;
    }

    cout << ma << endl;

    return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define LL long long
#define Fi first
#define Se second
using namespace std;
static const LL INF = 1LL<<61LL;
typedef pair<int,int> PII;

int N,M;
int A[100010];
int temp=1;
int ans;

int main(){
    cin>>N>>M;
    rep(i,M){
        int a;
        cin>>a;
        A[a]=1;
    }
    FOR(i,1,N){
        //cout<<temp<<endl;
        if(A[i]==1){
            if(temp==1&&A[1]!=1){
                int t=(i-temp);
                temp=i;
                ans=max(ans,t);
                continue;
            }
            int t=(i-temp-1)/2;
            if((i-temp-1)%2!=0)t++;
            temp=i;
            ans=max(ans,t);
        }
        else if(i==N){
            ans=max(ans,N-temp);
        }
    }
    cout<<ans<<endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main()
{
	int n, m;
	cin >> n >> m;
	vector<int> A;
	A.push_back(1);
	int a;
	for(int i = 1; i <= m; i++)
	{
		cin >> a;
		A.push_back(a);
	}
	A.push_back(n);
	int ans = 0;
	for(int i = 1; i < A.size(); i++)
	{
		int tmp;
		if(i == 1 || i == A.size() - 1)
			tmp = A[i] - A[i - 1];
		else
			tmp = (A[i] - A[i - 1]) / 2;
		ans = max(tmp, ans);
	}
	cout << ans << endl;
	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int N,M,a[100000];
int main(){
	cin>>N>>M;
	rep(i,M) cin>>a[i];
	int ans=0;
	rep(i,M-1) chmax(ans,(a[i+1]-a[i])/2);
	chmax(ans,a[0]-1);
	chmax(ans,N-a[M-1]);
	cout<<ans<<endl;
}