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>
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){
    ans=max(A[0]-1,n-A[1]);
    ans=(ans,(A[1]-A[0])/2);
    cout << ans << endl;
    return -1;
  }
  else{
    for(i=0;i<m;i++){
      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{
	if((A[i]-A[i-1])%2==0){
	  ans=max(ans,(A[i]-A[i-1])/2);
	}
	else{
	  ans=max(ans,(A[i]-A[i-1]/2+1));
	}
      }
    }
  }
  
  return 0;
}

C++: #define _USE_MATH_DEFINES

#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<iostream>
#include<fstream>
#include<iomanip>

using namespace std;

int n, m;
int data[100000];

int main(){
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; ++i){
		scanf("%d", &data[i]);
	}

	int Max = data[0] - 1;
	for (int i = 1; i < m; ++i) {
		if ((data[i] - data[i - 1])/2>Max){
			Max = (data[i] - data[i - 1])/2;
		}
	}
	if (n - data[m - 1] > Max) {
		Max = n - data[m - 1];
	}
	printf("%d\n", Max);
	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){
            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;

// #define int long long
#define ll long long
#define pb push_back
#define vi vector<int>
#define vii vector<vector<int> >

template <class X> void print(X Target){ cout << Target << '\n'; }

bool check[100001];
bool tmp[100001];

signed main()
{
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;

  int a;
  for (int i = 0; i < m; i++){
    cin >> a;
  }
  /*
  int cnt = 0;
  while (true){
    memcpy(tmp, check, sizeof(tmp));
    for (int i = 1; i <= n; i++){
      if (check[i]){
        if (0 < i - 1 && !tmp[i - 1]){
          tmp[i - 1] = true;
        }
        if (i + 1 <= n && !tmp[i + 1]){
          tmp[i + 1] = true;
        }
      }
    }
    cnt++;
    bool finish = true;
    for (int i = 1; i <= n; i++){
      if (!tmp[i]){
        finish = false; 
        break;
      }
    }
    if (finish) break;
    memcpy(check, tmp, sizeof(check));
  }*/
  if (m == 1){
    print(n - a);
  }
  else {
    print(n / m);
  }

  return (0);
}

C++: #include <bits/stdc++.h>
using namespace std;
int t[100000];
int main(){
	int n,m;	cin>>n>>m;
	vector<int> a(m);
	for(int i=0;i<n;i++)	t[i]=1e9;
	queue<int> q;
	for(int i=0;i<m;i++){
		cin>>a[i];	a[i]--;
		t[a[i]]=0;
		q.push(a[i]);
	}
	while(!q.empty()){
		int cur=q.front();	q.pop();
		if(cur+1<n){
			if(t[cur+1]>t[cur]+1){
				t[cur+1]=t[cur]+1;
				q.push(cur+1);
			}
		}
		if(cur-1>=0){
			if(t[cur-1]>t[cur]+1){
				t[cur-1]=t[cur]+1;
				q.push(cur-1);
			}
		}
	}
	int ans=0;
	for(int i=0;i<n;i++)	ans=max(ans,t[i]);
	cout<<ans<<endl;
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
int main(){
	int n,m;
	cin>>n>>m;
	vi in(m);
	rep(i,m)cin>>in[i];
	int ma=in[0]-1;
	rep(i,m){
		int q=in[i+1]-in[i];
		q/=2;
		ma=max(ma,q);
	}
	ma=max(ma,n-in[m-1]);
	cout<<ma<<endl;
}

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

// #define int long long
#define ll long long
#define pb push_back
#define vi vector<int>
#define vii vector<vector<int> >

template <class X> void print(X Target){ cout << Target << '\n'; }

bool check[100001];
bool tmp[100001];

signed main()
{
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;

  for (int i = 0; i < m; i++){
    int a;
    cin >> a;
    check[a] = true;
  }

  int cnt = 0;
  while (true){
    memcpy(tmp, check, sizeof(tmp));
    for (int i = 1; i <= n; i++){
      if (check[i]){
        if (0 < i - 1 && !tmp[i - 1]){
          tmp[i - 1] = true;
        }
        if (i + 1 <= n && !tmp[i + 1]){
          tmp[i + 1] = true;
        }
      }
    }
    cnt++;
    bool finish = true;
    for (int i = 1; i <= n; i++){
      if (!tmp[i]){
        finish = false; 
        break;
      }
    }
    if (finish) break;
    memcpy(check, tmp, sizeof(check));
  }

  print(cnt);

  return (0);
}

C++: #include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
int main(){
	int n,m;
	cin>>n>>m;
	vi in(m);
	rep(i,m)cin>>in[i];
	int ma=in[0]-1;
	rep(i,m-1){
		int q=in[i+1]-in[i];
		q/=2;
		ma=max(ma,q);
	}
	ma=max(ma,n-in[m-1]);
	cout<<ma<<endl;
}

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

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