#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long int ll; typedef pair P; const ll MAX=100001; vector prime; bool isprime[MAX]; void sieve(){ for(ll i=3; i>l>>h; sieve(); int i1=0, i2=prime.size()-1; while(i1!=i2){ int i0=(i1+i2+1)/2; if(prime[i0]*prime[i0]<=h){ i1=i0; }else{ i2=i0-1; } } if(l<=prime[i1]*prime[i1]) l=prime[i1]*prime[i1]; vector

fac[5000000]; ll x[5000000]; for(ll i=l; i<=h; i++) x[i-l]=i; for(auto p:prime){ ll x0=(l+p-1)/p*p; for(ll x1=x0; x1<=h; x1+=p){ int e=0; while(x[x1-l]%p==0){ x[x1-l]/=p; e++; } fac[x1-l].push_back(P(p, e)); } } for(ll i=l; i<=h; i++){ if(x[i-l]>1) fac[i-l].push_back(P(x[i-l], 1)); } ll mx=0, ans; for(ll i=h; i>=l; i--){ if(fac[i-l].size()==1 && fac[i-l][0].second==1) continue; if(fac[i-l][0].first>mx){ mx=fac[i-l][0].first; ans=i; } } cout<