#include #define _overload(_1,_2,_3,name,...) name #define _rep(i,n) _range(i,0,n) #define _range(i,a,b) for(int i=int(a);i=int(b);--i) #define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__) #define _all(arg) begin(arg),end(arg) #define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg)) #define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary) #define clr(a,b) memset((a),(b),sizeof(a)) #define bit(n) (1LL<<(n)) #define popcount(n) (__builtin_popcountll(n)) templatebool chmax(T &a, const T &b) { return (abool chmin(T &a, const T &b) { return (b> l >> h; ll ans=0LL,fmax=0LL; for(ll p=2LL;p*p<=2*h;++p){ if(prime[p]==false) continue; for(ll p2=p; p*p2>=l;--p2){ if(prime[p2]==false) continue; if(p*p2<=h){ if(fmax < p2 || (fmax == p2 && ans < p*p2)) fmax=p2,ans=p*p2; break; } } } if(h-l<=400){ for(ll i=l;i<=h;++i){ ll cur=i,res=1LL; for(ll f=2LL;f*f<=cur;++f){ if(prime[f]==false) continue; if(cur%f==0){ cur/=f; res=f; break; } } if(cur==i) continue; if(fmax < res || (fmax == res && ans < i)) fmax=res,ans=i; } } cout << ans << endl; return 0; }