For this Question: Given N cities in a line and your initial position, you want to visit all the cities at least once. You can go to one coordinate P to P+D or P-D where D is the number of steps which you choose initially. Your task is to find the maximum value of D such that you can visit all the cities at least once.The first line of input contains two integers N and X(initial position). The second line of input contains N space separated integers representing the location of cities.

Constraints:-
1 <= N <= 100000
1 <= City[] <= 100000000Print the maximum value of D such that you can visit all the cities.Sample Input:-
3 3
1 7 11

Sample Output:-
2

Sample Input:-
3 81
33 105 57

Sample Output:-
24, I have written this Solution Code: #include<bits/stdc++.h>
using namespace std;

int main(){


int n,k;
cin>>n>>k;
int a[n];
for(int i=0;i<n;i++){
    cin>>a[i];
}
sort(a,a+n);
int ans = abs(a[0]-k);
for(int i=1;i<n;i++){
    ans=__gcd(ans,a[i]-a[i-1]);
}
cout<<ans;

}
, In this Programming Language: C++, Now tell me if this Code is compilable or not?