#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; for(ll p=2LL;p*p<=h;++p){ if(prime[p]==false) continue; if(p*p>=l) l=p*p; } ll ans=0LL,fmax=0LL; 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; }