#include <bits/stdc++.h>
#define int long long
using namespace std;
void uprint(int x){//输出无符号类型数
if(x>9){
uprint(x/10);
}
putchar(x%10^48);
return ;
}
void print(int x){//有符号类型,可直接调用这个
if(x<0){
putchar('-');
x=-x;
}
uprint(x);
return ;
}
int read() {
int x=0, w=1;
char ch=0;
while (ch<'0'||ch>'9') {
if(ch=='-') w=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9') {
x=x*10+(ch-'0');
ch=getchar();
}
return x*w;
}
bool check(int x){
if(x==1){
return false;
}
if(x==2){
return true;
}
for(int i=2; i<=sqrt(x); i++){
if(x%i==0){
return false;
}
}
return true;
}
signed main(){
int n,m;
n=read();
m=read();
for(int i=1; i<=n; i++){
int l,r;
l=read();
r=read();
int ans=0;
if(l>=1&&r<=m){
for(int j=l; j<=r; j++){
if(check(j))ans++;
}
}
if(ans!=0){
print(ans);
cout<<"\n";
}else{
cout<<"Crossing the line"<<"\n";
}
}
return 0;
}
悬赏一关