#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define plll pair<ll,pll>
#define tull tuple<ll,ll,ll>
#define pb push_back
#define f first
#define endl '\n'
#define se second
#define piii pair<int,pii>
#define id1 id<<1
#define bit(x,i) (((x) >> (i)) & 1)
#define id2 (id<<1)+1
#define MASK(i) (1<<i)
#define set_on(x,i) ((x) | MASK(i))
#define set_off(x,i) ((x) & ~MASK(i))
#define TIME "\nTime elapsed : "<<(double)clock()/1000<<" ms"
#define all(x) x.begin(),x.end()
#define id(i,j) (i - 1) * m + j
#define TASK "test"
#define fast ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
using namespace std;
const ll mod = 1e9 + 7; //998244353;
const ll base = 311;
const ll INF = 1e18 + 7;
const ll maxn = 1e6 + 5;
const ll maxs = 1e5;
const ll dx[] = {-1,0,0,1};
const ll dy[] = {0,-1,1,0};
const ll d2x[] = {0,0,1,2};
const ll d2y[] = {1,2,1,2};
const int dx8[] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy8[] = {0, 1, 0, -1, 1, -1, 1, -1};
int n,k;
ll res = LLONG_MIN;
ll a[maxn];
ll st[maxn][21];
ll get(int l,int r)
{
int k = __lg(r - l + 1);
return __gcd(st[l][k],st[r - (1 << k) + 1][k]);
}
int main()
{
fast
cin >> n >> k;
for(int i = 1; i <= n; ++i){
cin >> a[i];
}
for(int i = 1; i <= n; ++i){
st[i][0] = a[i];
}
int lim = log2(n) + 1;
for(int j = 1; j <= lim; ++j){
for(int i = 1; i + (1 << j) - 1 <= n; ++i){
st[i][j] = __gcd(st[i][j - 1],st[i + (1 << (j - 1))][j - 1]);
}
}
for(int i = 1; i + k - 1 <= n; ++i){
res = max(res,get(i,i + k - 1));
}
cout << res;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgbGwgbG9uZyBsb25nCiNkZWZpbmUgbGQgbG9uZyBkb3VibGUKI2RlZmluZSBwaW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10gPSB7MCwwLDEsMn07CmNvbnN0IGxsIGQyeVtdID0gezEsMiwxLDJ9Owpjb25zdCBpbnQgZHg4W10gPSB7MSwgMCwgLTEsIDAsIDEsIC0xLCAtMSwgMX07CmNvbnN0IGludCBkeThbXSA9IHswLCAxLCAwLCAtMSwgMSwgLTEsIDEsIC0xfTsKCmludCBuLGs7CmxsIHJlcyA9IExMT05HX01JTjsKbGwgYVttYXhuXTsKbGwgc3RbbWF4bl1bMjFdOwoKbGwgZ2V0KGludCBsLGludCByKQp7CiAgICBpbnQgayA9IF9fbGcociAtIGwgKyAxKTsKICAgIHJldHVybiBfX2djZChzdFtsXVtrXSxzdFtyIC0gKDEgPDwgaykgKyAxXVtrXSk7Cn0KCmludCBtYWluKCkKewogICAgZmFzdAoKICAgIGNpbiA+PiBuID4+IGs7CgogICAgZm9yKGludCBpID0gMTsgaSA8PSBuOyArK2kpewogICAgICAgIGNpbiA+PiBhW2ldOwogICAgfQoKICAgIGZvcihpbnQgaSA9IDE7IGkgPD0gbjsgKytpKXsKICAgICAgICBzdFtpXVswXSA9IGFbaV07CiAgICB9CgogICAgaW50IGxpbSA9IGxvZzIobikgKyAxOwoKICAgIGZvcihpbnQgaiA9IDE7IGogPD0gbGltOyArK2opewogICAgICAgIGZvcihpbnQgaSA9IDE7IGkgKyAoMSA8PCBqKSAtIDEgPD0gbjsgKytpKXsKICAgICAgICAgICAgc3RbaV1bal0gPSBfX2djZChzdFtpXVtqIC0gMV0sc3RbaSArICgxIDw8IChqIC0gMSkpXVtqIC0gMV0pOwogICAgICAgIH0KICAgIH0KCiAgICBmb3IoaW50IGkgPSAxOyBpICsgayAtIDEgPD0gbjsgKytpKXsKICAgICAgICByZXMgPSBtYXgocmVzLGdldChpLGkgKyBrIC0gMSkpOwogICAgfQoKICAgIGNvdXQgPDwgcmVzOwoKICAgIHJldHVybiAwOwp9Cg==
Main.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:1: error: class, interface, or enum expected
#include <bits/stdc++.h>
^
Main.java:2: error: illegal character: '#'
#define ll long long
^
Main.java:3: error: illegal character: '#'
#define ld long double
^
Main.java:4: error: illegal character: '#'
#define pii pair<int,int>
^
Main.java:5: error: illegal character: '#'
#define pll pair<ll,ll>
^
Main.java:6: error: illegal character: '#'
#define plll pair<ll,pll>
^
Main.java:7: error: illegal character: '#'
#define tull tuple<ll,ll,ll>
^
Main.java:8: error: illegal character: '#'
#define pb push_back
^
Main.java:9: error: illegal character: '#'
#define f first
^
Main.java:10: error: illegal character: '#'
#define endl '\n'
^
Main.java:11: error: illegal character: '#'
#define se second
^
Main.java:12: error: illegal character: '#'
#define piii pair<int,pii>
^
Main.java:13: error: illegal character: '#'
#define id1 id<<1
^
Main.java:14: error: illegal character: '#'
#define bit(x,i) (((x) >> (i)) & 1)
^
Main.java:15: error: illegal character: '#'
#define id2 (id<<1)+1
^
Main.java:16: error: illegal character: '#'
#define MASK(i) (1<<i)
^
Main.java:17: error: illegal character: '#'
#define set_on(x,i) ((x) | MASK(i))
^
Main.java:18: error: illegal character: '#'
#define set_off(x,i) ((x) & ~MASK(i))
^
Main.java:19: error: illegal character: '#'
#define TIME "\nTime elapsed : "<<(double)clock()/1000<<" ms"
^
Main.java:20: error: illegal character: '#'
#define all(x) x.begin(),x.end()
^
Main.java:21: error: illegal character: '#'
#define id(i,j) (i - 1) * m + j
^
Main.java:22: error: illegal character: '#'
#define TASK "test"
^
Main.java:23: error: illegal character: '#'
#define fast ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
^
Main.java:23: error: class, interface, or enum expected
#define fast ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
^
Main.java:23: error: class, interface, or enum expected
#define fast ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
^
Main.java:24: error: class, interface, or enum expected
using namespace std;
^
Main.java:25: error: class, interface, or enum expected
const ll mod = 1e9 + 7; //998244353;
^
Main.java:26: error: class, interface, or enum expected
const ll base = 311;
^
Main.java:27: error: class, interface, or enum expected
const ll INF = 1e18 + 7;
^
Main.java:28: error: class, interface, or enum expected
const ll maxn = 1e6 + 5;
^
Main.java:29: error: class, interface, or enum expected
const ll maxs = 1e5;
^
Main.java:30: error: class, interface, or enum expected
const ll dx[] = {-1,0,0,1};
^
Main.java:31: error: class, interface, or enum expected
const ll dy[] = {0,-1,1,0};
^
Main.java:32: error: class, interface, or enum expected
const ll d2x[] = {0,0,1,2};
^
Main.java:33: error: class, interface, or enum expected
const ll d2y[] = {1,2,1,2};
^
Main.java:34: error: class, interface, or enum expected
const int dx8[] = {1, 0, -1, 0, 1, -1, -1, 1};
^
Main.java:35: error: class, interface, or enum expected
const int dy8[] = {0, 1, 0, -1, 1, -1, 1, -1};
^
Main.java:37: error: class, interface, or enum expected
int n,k;
^
Main.java:38: error: class, interface, or enum expected
ll res = LLONG_MIN;
^
Main.java:39: error: class, interface, or enum expected
ll a[maxn];
^
Main.java:40: error: class, interface, or enum expected
ll st[maxn][21];
^
Main.java:42: error: class, interface, or enum expected
ll get(int l,int r)
^
Main.java:45: error: class, interface, or enum expected
return __gcd(st[l][k],st[r - (1 << k) + 1][k]);
^
Main.java:46: error: class, interface, or enum expected
}
^
Main.java:54: error: class, interface, or enum expected
for(int i = 1; i <= n; ++i){
^
Main.java:54: error: class, interface, or enum expected
for(int i = 1; i <= n; ++i){
^
Main.java:54: error: class, interface, or enum expected
for(int i = 1; i <= n; ++i){
^
Main.java:56: error: class, interface, or enum expected
}
^
Main.java:58: error: class, interface, or enum expected
for(int i = 1; i <= n; ++i){
^
Main.java:58: error: class, interface, or enum expected
for(int i = 1; i <= n; ++i){
^
Main.java:60: error: class, interface, or enum expected
}
^
Main.java:64: error: class, interface, or enum expected
for(int j = 1; j <= lim; ++j){
^
Main.java:64: error: class, interface, or enum expected
for(int j = 1; j <= lim; ++j){
^
Main.java:64: error: class, interface, or enum expected
for(int j = 1; j <= lim; ++j){
^
Main.java:65: error: class, interface, or enum expected
for(int i = 1; i + (1 << j) - 1 <= n; ++i){
^
Main.java:65: error: class, interface, or enum expected
for(int i = 1; i + (1 << j) - 1 <= n; ++i){
^
Main.java:67: error: class, interface, or enum expected
}
^
Main.java:70: error: class, interface, or enum expected
for(int i = 1; i + k - 1 <= n; ++i){
^
Main.java:70: error: class, interface, or enum expected
for(int i = 1; i + k - 1 <= n; ++i){
^
Main.java:72: error: class, interface, or enum expected
}
^
Main.java:76: error: class, interface, or enum expected
return 0;
^
Main.java:77: error: class, interface, or enum expected
}
^
63 errors