func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = (int)1e6 + 1;   const int INF = (int)1e9;   const int logN = 20;   int n, k, a[N], Log2[N];   int maxValue[N][21];   int getMax(int l, int r) {     int k = Log2[r - l + 1];     return max(maxValue[l][k], maxValue[r - (1 << k) + 1][k]);   }   void solve() {     cin >> n >> k;     int minV = INF;     for (int i = 1; i <= n; ++i) {       cin >> a[i];       maxValue[a[i]][0] = a[i];       minV = min(minV, a[i]);     }     for (int j = 1; (1 << j) < N; ++j) {       for (int i = 1; i + (1 << j) - 1 < N; ++i) {         maxValue[i][j] =             max(maxValue[i][j - 1], maxValue[i + (1 << (j - 1))][j - 1]);       }     }     for (int i = 0; (1 << i) < N; ++i) Log2[(1 << i)] = i;     for (int i = 1; i < N; ++i) Log2[i] = max(Log2[i], Log2[i - 1]);     int res = 1;     for (int i = 2; i <= minV; ++i) {       bool check = 1;       for (int j = i; j < N; j += i) {         int d = getMax(j, min(N - 1, j + i - 1)) - j;         if (d > k) {           check = 0;         }       }       if (check) res = i;     }     cout << res;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     solve();     return 0;   }   