#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include using namespace std; __attribute__((target("avx"),optimize("O3","unroll-loops"))) ll prime_pi(const ll n){ if(n<=1) return 0; if(n==2) return 1; const int sq=sqrtl(n); int s=1+sq>>1; vector smalls(s); for(int i=1;i roughs(s); for(int i=0;i larges(s); for(int i=0;i>1; vector skip(sq+1); const auto divide=[](ll n, ll d) -> int{return (long double)n/d;}; const auto half=[](int n) -> int{return (n-1)>>1;}; int pc=0; for(int p=3;p<=sq;p+=2) if(!skip[p]){ int q=p*p; if((ll)q*q>n) break; skip[p]=true; for (int i=q;i<=sq;i+=p<<1) skip[i]=true; int ns=0; for(int k=0;k>1]-pc]:smalls[half(divide(n,d))])+pc; roughs[ns++]=i; } s=ns; for(int i=half(sq),j=((sq/p)-1)|1;j>=p;j-=2){ int c=smalls[j>>1]-pc; for(int e=(j*p)>>1;i>=e;--i) smalls[i]-=c; } ++pc; } larges[0]+=(ll)(s+2*(pc-1))*(s-1)/2; for(int k=1;k>l>>r; cout<