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 <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int main(){

	int N,M;
	scanf("%d %d",&N,&M);

	int left_len,maximum = 0,right_len,tmp,pre;

	scanf("%d",&tmp);

	left_len = tmp-1;
	pre = tmp;

	if(M == 1){
		right_len = N-tmp;
		printf("%d\n",max(left_len,right_len));
	}else{

		for(int i = 0; i < M-1; i++){
			scanf("%d",&tmp);
			maximum = max(maximum,tmp-pre);
			pre = tmp;
		}
		right_len = N-tmp;

		printf("%d\n",max(max(left_len,right_len),maximum/2));
	}
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define rep(i,x) for(int i=0;i<(x);++i)
#define rep1(i,x) for(int i=1;i<=(x);++i)
#define rrep(i,x) for(int i=(x)-1;i>=0;--i)
#define rrep1(i,x) for(int i=(x);i>=1;--i)
#define FOR(i,a,x) for(int i=(a);i<(x);++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>istream&operator>>(istream&is,vector<T>&vec){rep(i,vec.size())is>>vec[i];return is;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

int dx[2] = {-1, 1};

int a[100000];

signed main()
{
    omajinai;

    int N, M; cin >> N >> M;

    memset(a, -1, sizeof(a));

    queue<int> q;

    rep(i, M) {
        int b; cin >> b; b--;
        a[b] = 0;
        q.push(b);
    }

    int ma = 0;

    while (q.size()) {
        int x = q.front(); q.pop();
        rep(i, 2) {
            int nx = x + dx[i];
            if (0 <= nx && nx < N) {
                if (~a[nx]) continue;
                a[nx] = a[x] + 1;
                q.push(nx);
                ma = max(ma, a[nx]);
            }
        }
    }

    cout << ma << endl;
}

C++: /*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            pass System Test!
*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

template <typename T>
std::ostream& operator<<(std::ostream& out, const std::vector<T>& v) {
  if (!v.empty()) {
    out << '[';
    std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
    out << "\b\b]";
  }
  return out;
}

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

  int N, M;
  cin >> N >> M;
  set<int> a;
  for (int i = 0; i < M; ++i) {
    int b;
    cin >> b;
    b--;
    a.insert(b);
  }

  int ma = 0;
  for (int i = 0; i < N; ++i) {
    if (i >= *(a.rbegin())) {
      ma = max(ma, i - *(a.rbegin()));
      continue;
    }

    auto it = a.lower_bound(i);
    int mi = N;
    mi = min(mi, *it - i);
    if (it != a.begin()) {
      it--;
      mi = min(mi, i - *it);
    }
    // cerr << mi << endl;
    ma = max(ma, mi);
  }
  cout << ma << endl;
}

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(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;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

int main(){
  int n,m;
  cin>>n>>m;
  vi a(m);
  REP(i,m)cin>>a[i];
  REP(i,m)--a[i];
  vi d(n,1145141919);
  queue<int> Q;
  REP(i,m){
    d[a[i]]=0;
    Q.push(a[i]);
  }
  while(!Q.empty()){
    int p = Q.front(); Q.pop();
    if(p>0){
      if(d[p-1]>d[p]+1){
        d[p-1] = d[p]+1;
        Q.push(p-1);
      }
    }
    if(p<n-1){
      if(d[p+1]>d[p]+1){
        d[p+1] = d[p]+1;
        Q.push(p+1);
      }
    }
  }
  int res = 0;
  REP(i,n)res=max(res,d[i]);
  cout<<res<<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]) / 2);
	}
	cout << res << endl;
	return 0;
}