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>
#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){
                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++: /*
                   _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) {
    auto it = a.lower_bound(i);
    int mi = N;
    mi = min(mi, *it - i);
    if (it != a.begin()) {
      it--;
      mi = min(mi, i - *it);
    }
    ma = max(ma, mi);
  }
  cout << ma << endl;
}

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define pb push_back
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = 1; i <= n; ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
using namespace std;
typedef vector<int> vi;

const int MX = 100005;
const int INF = 1001001001;

int n, m;
int a[MX];

int main() {
  scanf("%d%d",&n,&m);
  rrep(i,n) a[i] = INF;
  rep(i,m) {
    int x;
    scanf("%d",&x);
    a[x] = 0;
  }
  rrep(i,n) mins(a[i+1],a[i]+1);
  drep(i,n) mins(a[i],a[i+1]+1);
  int ans = 0;
  rrep(i,n) maxs(ans, a[i]);
  cout<<ans<<endl;
  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#define rep(i,a,b) for(int (i)=(a);i<(b);i++)
#define INF 100000000
#define MAX_N 1000000
using namespace std;

int main(){
    int n,m,a=0,b=0;
    cin>>n>>m;
    int ans=0;
    rep(i,0,m){
        cin>>a;
        ans=max(a-b,ans);
        //cout<<ans<<endl;
        b=a;
    }
    if(ans/2<n-a) cout<<n-a<<endl;
    else cout<<ans/2<<endl;
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
int n,m;
int a[200005];
int b[200005];

int main() {
    cin>>n>>m;
    rep(i,m) cin>>a[i];
    rep(i,m) a[i]--;
    rep(i,200005) b[i]=1e8;
    rep(i,m) b[a[i]]=0;
    rep(i,n) if(i) {
        b[i]=min(b[i],b[i-1]+1);
    }
    for(int i=n-1;i>=0;i--) if(i+1!=n) b[i]=min(b[i],b[i+1]+1);

    int ans=0;
    rep(i,n) ans=max(ans,b[i]);
    cout<<ans<<endl;
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  int n,m,a[100000],r=0;;
  cin>>n>>m;
  for(int i=0;i<m;i++) cin>>a[i];
  r=max(a[0]-1,n-a[m-1]);
  for(int i=1;i<m;i++) r=max(r,(a[i]-a[i-1])/2);
  cout<<r<<endl;
  return 0;
}

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

int main(){ 

  int n,m,A[100000],ans;
  int i;
  
  cin >> n >> m;
  
  for(i=0;i<m;i++){
    cin >> A[i];
    if(m==1){
      cout << max(n-A[0],A[0]-1) << endl;
      return -1;
    }
    else if(m==2 && i==1){
      ans=max(A[0]-1,n-A[1]);
      ans=(ans,(A[1]-A[0])/2);
      cout << ans << endl;
      return -1;
    }
    else{
      if(i==0){
	ans=A[0]-1;
	continue;
      }
      else if(i=m-1){
	ans=max(ans,n-A[m-1]);
	cout << ans << endl;
	return 0;
      }
      else{
	ans=max(ans,A[i]-A[i-1]);
      }
    }
  }
  return 0;
}

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

int main(){
	int sum;
	while(cin >> sum){
		int number, info[100005], ans;
		cin >> number;
		for(int i = 0; i < number; i++){
			cin >> info[i];
		}
	
			for(int i = 0; i < number + 1; i++){
				if(!i){
					ans = info[i] - 1;
				}else if(i == number){
					ans = max(ans, sum - info[i - 1]);
				}else{
					int a = (info[i] - info[i - 1]) / 2;
					ans = max(ans, a);
				}	
			}		
			cout << ans << endl;
	}
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <stack>
#include <queue>
#include <utility>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int,int> pii;


int main(){
	int n,m;
	cin>>n>>m;
	vi know(m+1);
	rep(i,0,m) cin>>know[i];
	know[m]=1e8;
	int MAX=0,l=0,r=1;
	rep(i,1,n+1){
		if(i==know[r]){
			l=r; r++;
		}
		int tmp=min(know[r]-i,abs(i-know[l]));
		MAX=max(tmp,MAX);
	}
	o(MAX);
}