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<iomanip>
#include<string>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
#include<iomanip>


using namespace std;


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

	int count = 0;
	int input;
	int ex;
	for(int i=0; i<m; i++) {
		cin >> input;
		if(i == 0 && input-1 > count) count = input-1;
		if(i == m-1 && n-input > count) count = n-input;
		if(i != 0 && (input-ex)/2 > count) count = (input-ex)/2;
		ex=input;
	}

	cout << count << endl;

	return 0;
}

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

int main() {
  int n,m;
  cin >> n >> m;
  int d[n],d2[n],ans=0;
  fill(d,d+n,1<<29);
  fill(d2,d2+n,1<<29);
  for(int i=0,x; i<m; i++) {
    cin >> x;
    d[x-1]=d2[x-1]=0;
  }
  for(int i=1; i<n; i++) d[i]=min(d[i],d[i-1]+1);
  for(int i=n-2; i>=0; i--) d2[i]=min(d2[i],d2[i+1]+1);
  for(int i=0; i<n; i++) ans=max(ans,min(d[i],d2[i]));
  cout << ans << endl;
  return 0;
}

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

struct init{
	init(){
		cin.tie(0); ios::sync_with_stdio(false);
	}
}________init;
int main() {

#ifdef INPUT_FROM_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
#endif
	int n, m;
	cin >> n >> m;
	vector<int> a(m);
	for (auto& it : a){
		cin >> it;
	}
	int res = 0;
	res = max(res, n - a[m - 1]);
	res = max(res, a[0] - 1);
	for (int i = 1; i < m; i++){
		res = max(res, (a[i] - a[i - 1] + 1) / 2);

	}
	cout << res << endl;
	return 0;
}

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

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


using namespace std;

int main() {

  int n; cin >> n;
  int m; cin >> m;

  vector<int> a;
  rep(i, m) {
    int x; cin >> x; x--;
    a.push_back(x);
  }

  int ans = 0;

  REP(i, 0, (int)a.size()-1) {
    ans = max(ans, (a[i+1]-a[i]) / 2);
  }

  if(a[0] != 0) {
    ans = max(ans, a[0]);
  }


  if(a[m-1] != n-1) {
    ans = max(ans, n - a[m-1] - 1);
  }

  cout << ans << endl;


  return 0;
}

C++: #include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using namespace std;
int main(void)
{
  int n,m;
  cin >> n >> m;
  vector<int> se;
  se.resize(m);
  REP(i,m) cin >> se[i];
  int answer=0;
  answer=max(answer,se[0]-1);
  REP(i,m-1) answer=max(answer,(se[i+1]-se[i]-1)/2);
  answer=max(answer,n-se[m-1]);
  cout << answer << endl;
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

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

    const int INF = 10000000;
    vector<int> a;
    a.pb(-INF);
    rep(i,m){
        int v;
        cin >>v;
        a.pb(v);
    }
    a.pb(INF);

    int idx = 0;
    int ans = 0;
    for(int i=1; i<=n; ++i){
        ans = max(ans, min(i-a[idx], a[idx+1]-i));
        if(a[idx+1] == i) ++idx;
    }
    cout << ans << endl;
    return 0;
}

C++: #include<bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

int a[100000];

int main(){
	int n, m; cin >> n >> m;
	int ans = 0;
	rep(i, m) cin >> a[i];
	rep(i, m - 1) ans = max(ans, (a[i + 1] - a[i]) / 2);
	ans = max(ans, a[i] - 1);
	ans = max(ans, n - a[i]);
	cout << ans << endl;
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<cassert>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<tuple>
#include<numeric>
using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef ll int__;
#define rep(i,j) for(int__ i=0;i<(int__)(j);i++)
#define repeat(i,j,k) for(int__ i=(j);i<(int__)(k);i++)
#define all(v) v.begin(),v.end()

template<typename T>
ostream& operator << (ostream &os , const vector<T> &v){
    rep(i,v.size()) os << v[i] << (i!=v.size()-1 ? " " : "\n"); return os;
}

template<typename T>
istream& operator >> (istream &is , vector<T> &v){
    rep(i,v.size()) is >> v[i]; return is;
}


bool solve(){
    int n, m; cin >> n >> m;
    vector<int> a(m); cin >> a;
    int ans = max(a[0] - 1, n - a.back());
    rep(i, m-1){
        ans = max(ans, (a[i+1] - a[i]) / 2);
    }
    cout << ans << endl;
    return false;
}

int main(){
    ios::sync_with_stdio(false);
    while(solve());
    return 0;
}

C++: #include<iostream>
#include<vector>
#include<cassert>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<tuple>
#include<numeric>
using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef ll int__;
#define rep(i,j) for(int__ i=0;i<(int__)(j);i++)
#define repeat(i,j,k) for(int__ i=(j);i<(int__)(k);i++)
#define all(v) v.begin(),v.end()

template<typename T>
ostream& operator << (ostream &os , const vector<T> &v){
    rep(i,v.size()) os << v[i] << (i!=v.size()-1 ? " " : "\n"); return os;
}

template<typename T>
istream& operator >> (istream &is , vector<T> &v){
    rep(i,v.size()) is >> v[i]; return is;
}

bool solve(){
    int n, m; cin >> n >> m;
    vector<int> a(m); cin >> a;
    int ans = max(a[0] - 1, n - a.back());
    rep(i, m-1){
        ans = max(ans, (a[i+1] - a[i]) / 2);
    }
    cout << ans << endl;
    return false;
}

int main(){
    ios::sync_with_stdio(false);
    while(solve());
    return 0;
}

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

int n,m;
int a[100001];

int main(void){
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		scanf("%d",&a[i]);
	}
	int ans=max(a[0]-1,n-a[m-1]);
	for(int i=0;i<m-1;i++){
		ans=max(ans,(a[i+1]-a[i])/2);
	}
	printf("%d\n",ans);
	return 0;
}