stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<cstdio>  

#include<iostream>  

#include<algorithm>  

#include<cstdlib>  

#include<cstring>

#include<string>

#include<climits>

#include<vector>

#include<cmath>

#include<map>

#define LL long long



using namespace std;



inline char nc(){

  static char buf[100000],*p1=buf,*p2=buf;

  if (p1==p2) { p2=(p1=buf)+fread(buf,1,100000,stdin); if (p1==p2) return EOF; }

  return *p1++;

}



inline void read(int &x){

  char c=nc(),b=1;

  for (;!(c>='0' && c<='9');c=nc()) if (c=='-') b=-1;

  for (x=0;c>='0' && c<='9';x=x*10+c-'0',c=nc()); x*=b;

}



inline void read(LL &x){

  char c=nc(),b=1;

  for (;!(c>='0' && c<='9');c=nc()) if (c=='-') b=-1;

  for (x=0;c>='0' && c<='9';x=x*10+c-'0',c=nc()); x*=b;

}



int wt,ss[19];

inline void print(int x){

	if (x<0) x=-x,putchar('-'); 

	if (!x) putchar(48); else {for (wt=0;x;ss[++wt]=x%10,x/=10);for (;wt;putchar(ss[wt]+48),wt--);}

}

inline void print(LL x){

	if (x<0) x=-x,putchar('-');

	if (!x) putchar(48); else {for (wt=0;x;ss[++wt]=x%10,x/=10);for (;wt;putchar(ss[wt]+48),wt--);}

}



LL n,m;



int main()

{

    read(n);read(m);    

    LL x,y,z;

	vector<LL> a(m+10);

    for(int i=0;i<n;i++)

	{

		read(x);read(y);

        z=y-x+1;a[0]+=1;a[z]-=1;

        LL t=z+1,s;

        while(t<=m)

		{

            LL v=((x+t-1)/t);

            if((x+t-1)/t<=0) break;

            s=y/((x+t-1)/t);

            if(s>=t) a[t-1]+=1,a[s]-=1;

            if((x+t-1)/t<=1) break;

            t=max(s+1,(x+(v-1)-1)/(v-1));

        }

    }

    LL ans=0;

    for (int i=0;i<m;i++)

    	ans+=a[i],cout<<ans<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.760244297642648x):
#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

using namespace std;

const int SIZEN = 3 * 100010;

const int SIZEM = 100010;

int l[SIZEN] = {0},r[SIZEN] = {0};

int ans[SIZEM] = {0};

int N,M;





void Input(){

	scanf("%d%d",&N,&M);

	for(int i = 1;i <= N;i++)scanf("%d%d",&l[i],&r[i]);

}





void Judge(int x){

//	printf("x = %d\n",x);

	int ll,rr;

	int n = sqrt(l[x]);

	int last = M+1;

	for(int i = 1;i <= n;i++){

		if(l[x]%i == 0) ll = l[x]/i;

		else ll = l[x]/i+1;

		rr = r[x]/i;

		rr = min(last-1,rr);

		last = min(ll,last);

		if(ll > rr)continue;

		ans[ll]++;ans[rr+1]--;

	}

	for(int i = 1;i < last;i++){

		if(l[x]%i == 0) ll = l[x]/i;

		else ll = l[x]/i+1;

		rr = r[x]/i;

		if(ll > rr)continue;

		

		ans[i]++;ans[i+1]--;

	} 

} 

void Work(){

	for(int i = 1;i <= N;i++)Judge(i);

	for(int i = 1;i <= M;i++)ans[i] += ans[i-1];

	for(int i = 1;i <= M;i++)printf("%d\n",ans[i]);

}

int main(){

	Input();

	Work();

	return 0;

}
// Slower C++ solution:
//============================================================================

// Name        : test.cpp

// Author      : Qihan

// Version     :

// Copyright   : Your copyright notice

// Description : Hello World in C++, Ansi-style

//============================================================================



#include <bits/stdc++.h>

#define Lowbit(x) (x & (-x))

using namespace std;

typedef long long int LLI;

typedef pair<int,int> PII;

const int maxn = (300000 + 10);



struct Seg{

	int l,r,len;

}op[maxn];



bool cmp(Seg a,Seg b){

	return a.len < b.len;

}



int c[maxn];



void add(int x,int change,int n){

	while(x < n){

		c[x] += change;

		x += Lowbit(x);

	}

}



int sum(int x){

	int ans = 0;

	while(x > 0){

		ans += c[x];

		x -= Lowbit(x);

	}

	return ans;

}



int main(){

//	freopen("/home/qihan/Documents/in","r",stdin);

	int n,m;

	memset(c,0,sizeof(c));

	scanf("%d%d",&n,&m);

	for(int i = 1;i <= n;i ++){

		scanf("%d%d",&op[i].l,&op[i].r);

		op[i].len = op[i].r - op[i].l + 1;

	}

	sort(op + 1,op + 1 + n,cmp);

	int k = 1;

	for(int i = 1;i <= m;i ++){

		for(;k <= n && op[k].len < i;k ++){

			add(op[k].l,1,300000);

			add(op[k].r + 1,-1,300000);

		}

		int ans = n - k + 1;

		for(int j = i;j <= m;j += i){

			ans += sum(j);

		}

		printf("%d\n",ans);

	}

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 10.47187318569196x):
#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

using namespace std;

const int SIZEN = 3 * 100010;

const int SIZEM = 100010;

int l[SIZEN] = {0},r[SIZEN] = {0};

int ans[SIZEM] = {0};

int N,M;





void Input(){

	scanf("%d%d",&N,&M);

	for(int i = 1;i <= N;i++)scanf("%d%d",&l[i],&r[i]);

}





void Judge(int x){

//	printf("x = %d\n",x);

	int ll,rr;

	int n = sqrt(l[x]);

	int last = M+1;

	for(int i = 1;i <= n;i++){

		if(l[x]%i == 0) ll = l[x]/i;

		else ll = l[x]/i+1;

		rr = r[x]/i;

		rr = min(last-1,rr);

		last = min(ll,last);

		if(ll > rr)continue;

		ans[ll]++;ans[rr+1]--;

	}

	for(int i = 1;i < last;i++){

		if(l[x]%i == 0) ll = l[x]/i;

		else ll = l[x]/i+1;

		rr = r[x]/i;

		if(ll > rr)continue;

		

		ans[i]++;ans[i+1]--;

	} 

} 

void Work(){

	for(int i = 1;i <= N;i++)Judge(i);

	for(int i = 1;i <= M;i++)ans[i] += ans[i-1];

	for(int i = 1;i <= M;i++)printf("%d\n",ans[i]);

}

int main(){

	Input();

	Work();

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdlib>

#include <cstdio>

#include <cmath>

using namespace std;

int read(){

	int x=0,f=1;char ch=getchar();

	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}

	while(ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}

	return x*f;

}



const int maxn = 300100;

const int maxm = 100100;



struct edge{int l,r;}a[maxn];

int n,m;

int c[maxn];



void modify(int l,int r,int x){

	//printf("%d %d\n",l,r);

	c[l]+=x,c[r+1]-=x;

}



int main(){

	n=read(),m=read();

	//c[1]+=n;

	for(int i=1;i<=n;i++)

		a[i].l=read(),a[i].r=read();

	for(int i=1;i<=n;i++){

		int l=a[i].l,r=a[i].r;

		int block=sqrt(r);

		//printf("->>>>>%d %d %d\n",l,r,block);

		int x=0,last=0x7f7f7f7f;

		for(int j=1;j<=block;j++){

			int sl=l/j,sr=r/j;

			if(sl&&l%j) sl++;

			sr = min(last,sr);

			if(sl&&sl<=sr) modify(sl,sr,1);

			if(j==block) x=sl-1;

			last = sl-1;

		}

		int sb=r/block;

		for(int j=1;j<=min(sb,x);j++)

			if((l%j==0)||l/j<r/j) modify(j,j,1);

	}

	for(int i=1;i<=m;i++) c[i]+=c[i-1];

	for(int i=1;i<=m;i++)

		printf("%d\n",c[i]);

}

// Faster C++ solution for the same problem (measured speedup: 4.739135091375332x):
#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

using namespace std;

const int SIZEN = 3 * 100010;

const int SIZEM = 100010;

int l[SIZEN] = {0},r[SIZEN] = {0};

int ans[SIZEM] = {0};

int N,M;





void Input(){

	scanf("%d%d",&N,&M);

	for(int i = 1;i <= N;i++)scanf("%d%d",&l[i],&r[i]);

}





void Judge(int x){

//	printf("x = %d\n",x);

	int ll,rr;

	int n = sqrt(l[x]);

	int last = M+1;

	for(int i = 1;i <= n;i++){

		if(l[x]%i == 0) ll = l[x]/i;

		else ll = l[x]/i+1;

		rr = r[x]/i;

		rr = min(last-1,rr);

		last = min(ll,last);

		if(ll > rr)continue;

		ans[ll]++;ans[rr+1]--;

	}

	for(int i = 1;i < last;i++){

		if(l[x]%i == 0) ll = l[x]/i;

		else ll = l[x]/i+1;

		rr = r[x]/i;

		if(ll > rr)continue;

		

		ans[i]++;ans[i+1]--;

	} 

} 

void Work(){

	for(int i = 1;i <= N;i++)Judge(i);

	for(int i = 1;i <= M;i++)ans[i] += ans[i-1];

	for(int i = 1;i <= M;i++)printf("%d\n",ans[i]);

}

int main(){

	Input();

	Work();

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



typedef long long LL;



using namespace std;



int N,M;

struct Event

{

	int len,L,R;	

};

vector<Event>E;



Event Make(int len,int L,int R)

{

	return (Event){len,L,R};

}



int Tr[300010];

int lowbit(int x){return x&-x;}

int getsum(int x){int S=0;while(x){S+=Tr[x];x-=lowbit(x);}return S;}

void add(int x,int y){while(x<=M){Tr[x]+=y;x+=lowbit(x);}}



bool cmp(Event A,Event B)

{

	return A.len<B.len;

}



int main()

{

	scanf("%d%d",&N,&M);

	for (int i=1;i<=N;i++)

	{

		int LL,RR;

		scanf("%d%d",&LL,&RR);

		E.push_back(Make(RR-LL+1,LL,RR));

	}

	sort(E.begin(),E.end(),cmp);

	int now = 0;

	int cnt = N;

	for (int i=1;i<=M;i++)

	{

		while(now<E.size() && E[now].len<i)

		{

			Event tmp = E[now];

			add(tmp.L,1);

			add(tmp.R+1,-1);

			now++;

			cnt--;

		}

		int ans = cnt;

		for (int j=i;j<=M;j+=i) ans+=getsum(j);

		printf("%d\n",ans);

	}

}

// Faster C++ solution for the same problem (measured speedup: 5.044198030695604x):
#include<cstdio>

#include<algorithm>

#include<cstring>

using namespace std;

int sum[400005],lazy[400005],a[300005],n,m;;

struct obj

{

    int l,r;

}p[300005];

bool cmp(obj x,obj y)

{

    return x.r-x.l<y.r-y.l;

}

void build(int k,int l,int r)

{

    lazy[k]=0;

    if(l==r)

    {

        sum[k]=a[l];

    }

    else

    {

        int mid=(l+r)>>1;

        build(k<<1,l,mid);

        build(k<<1|1,mid+1,r);

        sum[k]=sum[k<<1]+sum[k<<1|1];

    }

}

void push_down(int k,int l,int r)

{

    if(l==r)

    {

        sum[k]+=lazy[k];

        a[l]=sum[k];

    }

    else

    {

        lazy[k<<1]+=lazy[k];

        lazy[k<<1|1]+=lazy[k];

        sum[k]+=lazy[k]*(r-l+1);

    }

    lazy[k]=0;

}

void change(int k,int l,int r,int x,int y,int w)

{

    if(l>=x&&r<=y)

    {

        lazy[k]+=w;

    }

    else

    {

        push_down(k,l,r);

        int mid=(l+r)>>1;

        if(!(y<l||x>mid))

        {                 

            change(k<<1,l,mid,x,y,w);

        }             

        if(!(y<mid+1||x>r))

        {                

            change(k<<1|1,mid+1,r,x,y,w);

    	}

    }

}

int query(int k,int l,int r,int x)

{

    push_down(k,l,r);

    if(l==r)

    {

        return a[l];

    }

    int mid=(l+r)>>1;

    if(x<=mid)

    {

        return query(k<<1,l,mid,x);

    }

    return query(k<<1|1,mid+1,r,x);

}

int main()

{

    scanf("%d%d",&n,&m);

    build(1,1,m);

    for(int i=0;i<n;i++)

    {

        scanf("%d%d",&p[i].l,&p[i].r);

    }

    int i=0;

    sort(p,p+n,cmp);

    for(int d=1;d<=m;d++)

    {

        while(i<n&&p[i].r-p[i].l<d)

        {

            change(1,1,m,p[i].l,p[i].r,1);

            i++;

        }

        int ans=n-i;

        for(int k=d;k<=m;k+=d)

        {

            ans+=query(1,1,m,k);

        }

        printf("%d\n",ans);

    }

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



typedef long long LL;



const int N = 3e5 + 10, M = 1e5 + 10;

int n, m;

int l[N], r[N], idx[N], len[N];

int a[M];



bool cmp(int x, int y) {

    return len[x] < len[y];

}



void add(int x, int v) {

    for (; x <= m + 1; x += x & -x) a[x] += v;

}



int query(int x) {

    int ret = 0;

    for (; x; x -= x &-x) ret += a[x];

    return ret;

}



int main() {

    scanf("%d%d", &n, &m);

    for (int i = 0; i < n; i++) {

        scanf("%d%d", l + i, r + i); 

        len[i] = r[i] - l[i] + 1;

        idx[i] = i;

    }

    sort(idx, idx + n, cmp);

    int j = 0;

    for (int i = 1; i <= m; i++) {

        while (j < n && len[idx[j]] < i) {

            add(l[idx[j]], 1);

            add(r[idx[j]]+1, -1);

            j++;

        }

        int ans = 0;

        for (int k = i; k <= m; k += i) ans += query(k);

        printf("%d\n", ans + n - j);

    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.028968544991543x):
#include<cstdio>

#include<algorithm>

#include<cstring>

using namespace std;

int sum[400005],lazy[400005],a[300005],n,m;;

struct obj

{

    int l,r;

}p[300005];

bool cmp(obj x,obj y)

{

    return x.r-x.l<y.r-y.l;

}

void build(int k,int l,int r)

{

    lazy[k]=0;

    if(l==r)

    {

        sum[k]=a[l];

    }

    else

    {

        int mid=(l+r)>>1;

        build(k<<1,l,mid);

        build(k<<1|1,mid+1,r);

        sum[k]=sum[k<<1]+sum[k<<1|1];

    }

}

void push_down(int k,int l,int r)

{

    if(l==r)

    {

        sum[k]+=lazy[k];

        a[l]=sum[k];

    }

    else

    {

        lazy[k<<1]+=lazy[k];

        lazy[k<<1|1]+=lazy[k];

        sum[k]+=lazy[k]*(r-l+1);

    }

    lazy[k]=0;

}

void change(int k,int l,int r,int x,int y,int w)

{

    if(l>=x&&r<=y)

    {

        lazy[k]+=w;

    }

    else

    {

        push_down(k,l,r);

        int mid=(l+r)>>1;

        if(!(y<l||x>mid))

        {                 

            change(k<<1,l,mid,x,y,w);

        }             

        if(!(y<mid+1||x>r))

        {                

            change(k<<1|1,mid+1,r,x,y,w);

    	}

    }

}

int query(int k,int l,int r,int x)

{

    push_down(k,l,r);

    if(l==r)

    {

        return a[l];

    }

    int mid=(l+r)>>1;

    if(x<=mid)

    {

        return query(k<<1,l,mid,x);

    }

    return query(k<<1|1,mid+1,r,x);

}

int main()

{

    scanf("%d%d",&n,&m);

    build(1,1,m);

    for(int i=0;i<n;i++)

    {

        scanf("%d%d",&p[i].l,&p[i].r);

    }

    int i=0;

    sort(p,p+n,cmp);

    for(int d=1;d<=m;d++)

    {

        while(i<n&&p[i].r-p[i].l<d)

        {

            change(1,1,m,p[i].l,p[i].r,1);

            i++;

        }

        int ans=n-i;

        for(int k=d;k<=m;k+=d)

        {

            ans+=query(1,1,m,k);

        }

        printf("%d\n",ans);

    }

    return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdio>

#include <cmath>

#include <cstring>

#include <algorithm>

#include <vector>

#include <map>

#include <cstdlib>

#include <set>

#include <stack>

#include <queue>

using namespace std;



#define X first

#define Y second

#define N 300010

#define M 400010

typedef long long ll;

typedef pair<int,int> pii;

const int Mod=1000000007;



int n,m;

int c[N];

vector<pii> g[N];



inline int Lowbit(int x){return x&(-x);}



void Add(int x,int v)

{

	while (x<=m)

	{

		c[x]+=v;

		x+=Lowbit(x);

	}

}



int Val(int x)

{

	int res=0;

	while (x)

	{

		res+=c[x];

		x-=Lowbit(x);

	}

	return res;

}



int main()

{

	//freopen("in.in","r",stdin);

	//freopen("out.out","w",stdout);

	

	scanf("%d%d",&n,&m);

	for (int i=1;i<=n;i++)

	{

		int l,r; scanf("%d%d",&l,&r);

		g[r-l+1].push_back(make_pair(l,r));

	}

	int sz=0;

	for (int i=1;i<=m;i++)

	{

		int x=i,res=0;

		do

		{

			res+=Val(x);

			x+=i;

		}while (x<=m);

		

		for (int j=0;j<g[i].size();j++)

		{

			Add(g[i][j].X,1);

			Add(g[i][j].Y+1,-1);

		}

		printf("%d\n",res+n-sz);

		sz+=g[i].size();

	}

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 47.67448554110991x):
#include<cstdio>

#include<algorithm>

#include<cstring>

using namespace std;

int sum[400005],lazy[400005],a[300005],n,m;;

struct obj

{

    int l,r;

}p[300005];

bool cmp(obj x,obj y)

{

    return x.r-x.l<y.r-y.l;

}

void build(int k,int l,int r)

{

    lazy[k]=0;

    if(l==r)

    {

        sum[k]=a[l];

    }

    else

    {

        int mid=(l+r)>>1;

        build(k<<1,l,mid);

        build(k<<1|1,mid+1,r);

        sum[k]=sum[k<<1]+sum[k<<1|1];

    }

}

void push_down(int k,int l,int r)

{

    if(l==r)

    {

        sum[k]+=lazy[k];

        a[l]=sum[k];

    }

    else

    {

        lazy[k<<1]+=lazy[k];

        lazy[k<<1|1]+=lazy[k];

        sum[k]+=lazy[k]*(r-l+1);

    }

    lazy[k]=0;

}

void change(int k,int l,int r,int x,int y,int w)

{

    if(l>=x&&r<=y)

    {

        lazy[k]+=w;

    }

    else

    {

        push_down(k,l,r);

        int mid=(l+r)>>1;

        if(!(y<l||x>mid))

        {                 

            change(k<<1,l,mid,x,y,w);

        }             

        if(!(y<mid+1||x>r))

        {                

            change(k<<1|1,mid+1,r,x,y,w);

    	}

    }

}

int query(int k,int l,int r,int x)

{

    push_down(k,l,r);

    if(l==r)

    {

        return a[l];

    }

    int mid=(l+r)>>1;

    if(x<=mid)

    {

        return query(k<<1,l,mid,x);

    }

    return query(k<<1|1,mid+1,r,x);

}

int main()

{

    scanf("%d%d",&n,&m);

    build(1,1,m);

    for(int i=0;i<n;i++)

    {

        scanf("%d%d",&p[i].l,&p[i].r);

    }

    int i=0;

    sort(p,p+n,cmp);

    for(int d=1;d<=m;d++)

    {

        while(i<n&&p[i].r-p[i].l<d)

        {

            change(1,1,m,p[i].l,p[i].r,1);

            i++;

        }

        int ans=n-i;

        for(int k=d;k<=m;k+=d)

        {

            ans+=query(1,1,m,k);

        }

        printf("%d\n",ans);

    }

    return 0;

}
// Slower C++ solution:
#include<set>

#include<map>

#include<stack>

#include<queue>

#include<deque>

#include<cmath>

#include<cstdio>

#include<cctype>

#include<string>

#include<vector>

#include<cstdlib>

#include<cstring>

#include<sstream>

#include<iostream>

#include<algorithm>

#define MAXN 300000

#define MAXM 100000

#define lowbit(x) (x&(-x))



using namespace std;



int n,m;

vector<int>gg[MAXM+80];

struct node{

	int a[MAXM+80];

	void add(int x,int A)

	{

		while(x<=m)

		{

			a[x]+=A;

			x+=lowbit(x);

		}

		return ;

	}

	int S(int x)

	{

		int sum=0;

		while(x)

		{

			sum+=a[x];

			x-=lowbit(x);

		}

		return sum;

	}

}tree;

int main()//You'll know it's a copy.

{

	int i,j,l,r,tmp=0,S;

	scanf("%d%d",&n,&m);

	for(i=1;i<=n;i++)

	{

		scanf("%d%d",&l,&r);

		gg[r-l+1].push_back(l);

	}

	for(i=1;i<=m;i++)

	{

		S=0;

		for(j=i;j<=m;j+=i)

			S+=tree.S(j);

		for(j=0;j<gg[i].size();j++)

			tree.add(gg[i][j],-1),tree.add(i+gg[i][j],1);

		printf("%d\n",n-tmp-S);

		tmp+=gg[i].size();

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 17.883703189634854x):
#include<cstdio>

#include<algorithm>

#include<cstring>

using namespace std;

int sum[400005],lazy[400005],a[300005],n,m;;

struct obj

{

    int l,r;

}p[300005];

bool cmp(obj x,obj y)

{

    return x.r-x.l<y.r-y.l;

}

void build(int k,int l,int r)

{

    lazy[k]=0;

    if(l==r)

    {

        sum[k]=a[l];

    }

    else

    {

        int mid=(l+r)>>1;

        build(k<<1,l,mid);

        build(k<<1|1,mid+1,r);

        sum[k]=sum[k<<1]+sum[k<<1|1];

    }

}

void push_down(int k,int l,int r)

{

    if(l==r)

    {

        sum[k]+=lazy[k];

        a[l]=sum[k];

    }

    else

    {

        lazy[k<<1]+=lazy[k];

        lazy[k<<1|1]+=lazy[k];

        sum[k]+=lazy[k]*(r-l+1);

    }

    lazy[k]=0;

}

void change(int k,int l,int r,int x,int y,int w)

{

    if(l>=x&&r<=y)

    {

        lazy[k]+=w;

    }

    else

    {

        push_down(k,l,r);

        int mid=(l+r)>>1;

        if(!(y<l||x>mid))

        {                 

            change(k<<1,l,mid,x,y,w);

        }             

        if(!(y<mid+1||x>r))

        {                

            change(k<<1|1,mid+1,r,x,y,w);

    	}

    }

}

int query(int k,int l,int r,int x)

{

    push_down(k,l,r);

    if(l==r)

    {

        return a[l];

    }

    int mid=(l+r)>>1;

    if(x<=mid)

    {

        return query(k<<1,l,mid,x);

    }

    return query(k<<1|1,mid+1,r,x);

}

int main()

{

    scanf("%d%d",&n,&m);

    build(1,1,m);

    for(int i=0;i<n;i++)

    {

        scanf("%d%d",&p[i].l,&p[i].r);

    }

    int i=0;

    sort(p,p+n,cmp);

    for(int d=1;d<=m;d++)

    {

        while(i<n&&p[i].r-p[i].l<d)

        {

            change(1,1,m,p[i].l,p[i].r,1);

            i++;

        }

        int ans=n-i;

        for(int k=d;k<=m;k+=d)

        {

            ans+=query(1,1,m,k);

        }

        printf("%d\n",ans);

    }

    return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cstdlib>

#include <cstdio>

#include <cmath>

using namespace std;

int read(){

	int x=0,f=1;char ch=getchar();

	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}

	while(ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}

	return x*f;

}



const int maxn = 300100;

const int maxm = 100100;



struct edge{int l,r;}a[maxn];

int n,m;

int c[maxn];



void modify(int l,int r,int x){

	//printf("%d %d\n",l,r);

	c[l]+=x,c[r+1]-=x;

}



int main(){

	n=read(),m=read();

	//c[1]+=n;

	for(int i=1;i<=n;i++)

		a[i].l=read(),a[i].r=read();

	for(int i=1;i<=n;i++){

		int l=a[i].l,r=a[i].r;

		int block=sqrt(r);

		//printf("->>>>>%d %d %d\n",l,r,block);

		int x=0,last=0x7f7f7f7f;

		for(int j=1;j<=block;j++){

			int sl=l/j,sr=r/j;

			if(sl&&l%j) sl++;

			sr = min(last,sr);

			if(sl&&sl<=sr) modify(sl,sr,1);

			if(j==block) x=sl-1;

			last = sl-1;

		}

		int sb=r/block;

		for(int j=1;j<=min(sb,x);j++)

			if((l%j==0)||l/j<r/j) modify(j,j,1);

	}

	for(int i=1;i<=m;i++) c[i]+=c[i-1];

	for(int i=1;i<=m;i++)

		printf("%d\n",c[i]);

}

// Faster C++ solution for the same problem (measured speedup: 5.045994289414579x):
#include<cstdio>

#include<algorithm>

#include<cstring>

using namespace std;

int sum[400005],lazy[400005],a[300005],n,m;;

struct obj

{

    int l,r;

}p[300005];

bool cmp(obj x,obj y)

{

    return x.r-x.l<y.r-y.l;

}

void build(int k,int l,int r)

{

    lazy[k]=0;

    if(l==r)

    {

        sum[k]=a[l];

    }

    else

    {

        int mid=(l+r)>>1;

        build(k<<1,l,mid);

        build(k<<1|1,mid+1,r);

        sum[k]=sum[k<<1]+sum[k<<1|1];

    }

}

void push_down(int k,int l,int r)

{

    if(l==r)

    {

        sum[k]+=lazy[k];

        a[l]=sum[k];

    }

    else

    {

        lazy[k<<1]+=lazy[k];

        lazy[k<<1|1]+=lazy[k];

        sum[k]+=lazy[k]*(r-l+1);

    }

    lazy[k]=0;

}

void change(int k,int l,int r,int x,int y,int w)

{

    if(l>=x&&r<=y)

    {

        lazy[k]+=w;

    }

    else

    {

        push_down(k,l,r);

        int mid=(l+r)>>1;

        if(!(y<l||x>mid))

        {                 

            change(k<<1,l,mid,x,y,w);

        }             

        if(!(y<mid+1||x>r))

        {                

            change(k<<1|1,mid+1,r,x,y,w);

    	}

    }

}

int query(int k,int l,int r,int x)

{

    push_down(k,l,r);

    if(l==r)

    {

        return a[l];

    }

    int mid=(l+r)>>1;

    if(x<=mid)

    {

        return query(k<<1,l,mid,x);

    }

    return query(k<<1|1,mid+1,r,x);

}

int main()

{

    scanf("%d%d",&n,&m);

    build(1,1,m);

    for(int i=0;i<n;i++)

    {

        scanf("%d%d",&p[i].l,&p[i].r);

    }

    int i=0;

    sort(p,p+n,cmp);

    for(int d=1;d<=m;d++)

    {

        while(i<n&&p[i].r-p[i].l<d)

        {

            change(1,1,m,p[i].l,p[i].r,1);

            i++;

        }

        int ans=n-i;

        for(int k=d;k<=m;k+=d)

        {

            ans+=query(1,1,m,k);

        }

        printf("%d\n",ans);

    }

    return 0;

}