#include #include using namespace std; using namespace atcoder; #define reps(i,s,n) for(int i = s; i < n; i++) #define rep(i,n) reps(i,0,n) #define Rreps(i,n,e) for(int i = n - 1; i >= e; --i) #define Rrep(i,n) Rreps(i,n,0) #define ALL(a) a.begin(), a.end() using ll = long long; using vec = vector; using mat = vector; ll N,M,H,W,Q,K,A,B; string S; using P = pair; using tp = tuple; const ll INF = (1LL<<60); template bool chmin(T &a, const T b){ if(a > b) {a = b; return true;} else return false; } template bool chmax(T &a, const T b){ if(a < b) {a = b; return true;} else return false; } template void my_printv(std::vector v,bool endline = true){ if(!v.empty()){ for(std::size_t i{}; i; ll msqrt(ll n){ ll lb = 0, ub = n + 1; while(ub - lb > 1){ ll cen = lb + ((ub - lb)>>1); (cen * cen <= n ? lb : ub) = cen; } return lb; } ll pr(ll n){ //[1, n) if((--n) <= 1) return 0; ll sn = msqrt(n); vec smalls(n / sn + 1), larges(sn + 1); for(int i = 1; i <= sn; ++i) larges[i] = n / i - 1; for(int i = 1; i <= n / sn; ++i) smalls[i] = i - 1; auto access_inv = [&](int i){ ll n_i = n / i; if(n_i == 0) return 0LL; return (n_i <= sn ? smalls[n_i] : larges[i]); }; for(ll p = 2; p <= sn; ++p){ if(p < n / sn && smalls[p] <= smalls[p - 1]) continue; if(p >= n / sn && larges[n / p] <= smalls[p - 1]) continue; ll pp = p * p, now_pi = smalls[p - 1]; for(ll i = 1, ip = p, ipp = pp; ipp <= n && i <= sn; ++i, ip += p, ipp += pp){ larges[i] -= access_inv(ip) - now_pi; } for(ll i = n / sn; i >= pp; --i){ smalls[i] -= smalls[i / p] - now_pi; } } return larges[1]; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); //reps(i, 3, 102) if(pr(i) - pr(i) == 1) cout<>A>>B; ++B; cout<