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

#include<cstring>

#include<vector>

#include<algorithm>

using namespace std;

int n,m,l[310000],r[310000],tree[110000];

vector<int> vec[110000];

void add(int x,int y){

    for (;x<=m;x+=x&-x) tree[x]+=y;

}

int getsum(int x){

    int sum=0;

    for (;x;x-=x&(-x)) sum+=tree[x];

    return sum;

}

int main(){

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

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

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

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

    }

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

        int ans=0;

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

            add(l[vec[i][j]],1),add(r[vec[i][j]]+1,-1);

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

        n-=vec[i].size();

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

    }

    return 0;

}






// Faster C++ solution for the same problem (measured speedup: 3.6511124113304336x):
#include <bits/stdc++.h>

#define fto(i,a,b) for(int i=a; i<=b;++i)

#define fdto(i,a,b) for(int i=a; i>=b;--i)

#define fi first

#define se second

#define mp make_pair

#define pb push_back

#define pii pair<ll,ll>

#define ll long long

#define maxn 300009

#define maxm 100009

#define gb(i,j) ((i>>j)&1)

#define name "a"

#define endl '\n'



using namespace std;

int l[maxn],r[maxn];

int t[maxm],m,n;

void add(int x, int y){

    for(;x<=m; x+=x&-x)t[x]+=y;

}



int get(int x){

    int res=0;

    for(;x;x-=x&-x)res+=t[x];

    return res;

}

pii c[maxn];

main()

{

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

    #ifndef ONLINE_JUDGE

    #endif // ONLINE_JUDGE

    cin >> n >> m;

    fto(i,1,n){

        cin >> l[i] >> r[i];

        c[i]=mp(r[i]-l[i]+1,i);

    }

    sort(c+1,c+n+1);

    int j=1;

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

        while(c[j].fi <i && j<=n){

            int t=c[j].se;

            add(l[t],1);

            add(r[t]+1,-1);

            ++j;

        }

        int res=n-j+1;

        for(int t=0; t<=m; t+=i)res+=get(t);

        cout << res<<endl;

    }

    return 0;

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

#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

const int N=300005,M=100005;

int n,m;

struct Node

{

    int l,r,len;

}a[N];

bool cmp(Node x,Node y)

{

    return x.len<y.len;

}

struct Binary_Indexed_Tree

{

    int tree[M];

    Binary_Indexed_Tree()

    {

        memset(tree,0,sizeof(tree));

        return;

    }

    int lowbit(int x)

    {

        return x&-x;

    }

    void add(int x,int y)

    {

        if(x==0) return;

        for(int i=x;i<=m;i+=lowbit(i))

            tree[i]+=y;

        return;

    }

    void add(int a,int b,int val)

    {

        if(a>b) return;

        add(a,val);

        add(b+1,-val);

        return;

    }

    int getsum(int x)

    {

        int res=0;

        for(int i=x;i>0;i-=lowbit(i))

            res+=tree[i];

        return res;

    }

}T;

int main()

{

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

    for(int i=1,l,r;i<=n;++i)

    {

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

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

    }

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

    int j=1;

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

    {

        while(j<=n&&a[j].len<i)

        {

            T.add(a[j].l,a[j].r,1);

            j++;

        }

        int ans=n-j+1;

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

            ans+=T.getsum(k);

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

    }

    return 0;

}


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

#include <cstdio>

#include <vector>

#include <algorithm>

#include <queue>

#include <cmath>



#define mp make_pair

#define pb push_back

#define x first

#define y second

#define FOR(i, a, b) for(int i=a, _n=b; i<=_n; ++i)

using namespace std;



const int N = 1e5+5, open = -1e7, close = 1e7;

int n, m, ans[N], bit[N];

vector<pair<int, int> > qu;



void update(int i, int x)

{

    for(; i>0; i-=i&-i) bit[i] += x;

}

int get(int i)

{

    int res =0 ; for(; i<=m; i+=i&-i)

    res += bit[i]; return res;

}

int main()

{

    ios::sync_with_stdio(); cin.tie(0);

    ///freopen("a.inp","r",stdin);



    cin >> n >> m;

    FOR(i, 1, n) {

        int l, r; cin >> l >> r;

        FOR(j, 2, sqrt(m)) if (l <= r/j*j) ans[j] += 1;

        qu.pb(mp(l, open));

        qu.pb(mp(r, close+l));

    }

    FOR(j, sqrt(m)+1, m) for(int x=j; x<=m; x+=j) qu.pb(mp(x, j));



    sort(qu.begin(), qu.end());

    FOR(i, 0, qu.size()-1)

    if (qu[i].y == open) {

        update(qu[i].x, 1);

    } else

    if (qu[i].y > close) {

        update(qu[i].y-close, -1);

    } else {

        ans[qu[i].y] += get(qu[i].x-qu[i].y+1);

    }



    ans[1] = n;

    FOR(i, 1, m) cout << ans[i] << '\n';

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

#include<cstring>

#include<vector>

#include<algorithm>

using namespace std;

int n,m,l[310000],r[310000],tree[110000];

vector<int> vec[110000];

void add(int x,int y){

    for (;x<=m;x+=x&-x) tree[x]+=y;

}

int getsum(int x){

    int sum=0;

    for (;x;x-=x&(-x)) sum+=tree[x];

    return sum;

}

int main(){

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

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

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

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

    }

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

        int ans=0;

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

            add(l[vec[i][j]],1),add(r[vec[i][j]]+1,-1);

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

        n-=vec[i].size();

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

    }

    return 0;

}






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

#include <cstdio>

#include <vector>

#include <algorithm>

#include <queue>

#include <cmath>



#define mp make_pair

#define pb push_back

#define x first

#define y second

#define FOR(i, a, b) for(int i=a, _n=b; i<=_n; ++i)

using namespace std;



const int N = 1e5+5, open = -1e7, close = 1e7;

int n, m, ans[N], bit[N];

vector<pair<int, int> > qu;



void update(int i, int x)

{

    for(; i>0; i-=i&-i) bit[i] += x;

}

int get(int i)

{

    int res =0 ; for(; i<=m; i+=i&-i)

    res += bit[i]; return res;

}

int main()

{

    ios::sync_with_stdio(); cin.tie(0);

    ///freopen("a.inp","r",stdin);



    cin >> n >> m;

    FOR(i, 1, n) {

        int l, r; cin >> l >> r;

        FOR(j, 2, sqrt(m)) if (l <= r/j*j) ans[j] += 1;

        qu.pb(mp(l, open));

        qu.pb(mp(r, close+l));

    }

    FOR(j, sqrt(m)+1, m) for(int x=j; x<=m; x+=j) qu.pb(mp(x, j));



    sort(qu.begin(), qu.end());

    FOR(i, 0, qu.size()-1)

    if (qu[i].y == open) {

        update(qu[i].x, 1);

    } else

    if (qu[i].y > close) {

        update(qu[i].y-close, -1);

    } else {

        ans[qu[i].y] += get(qu[i].x-qu[i].y+1);

    }



    ans[1] = n;

    FOR(i, 1, m) cout << ans[i] << '\n';

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

#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

const int N=300005,M=100005;

int n,m;

struct Node

{

    int l,r,len;

}a[N];

bool cmp(Node x,Node y)

{

    return x.len<y.len;

}

struct Binary_Indexed_Tree

{

    int tree[M];

    Binary_Indexed_Tree()

    {

        memset(tree,0,sizeof(tree));

        return;

    }

    int lowbit(int x)

    {

        return x&-x;

    }

    void add(int x,int y)

    {

        if(x==0) return;

        for(int i=x;i<=m;i+=lowbit(i))

            tree[i]+=y;

        return;

    }

    void add(int a,int b,int val)

    {

        if(a>b) return;

        add(a,val);

        add(b+1,-val);

        return;

    }

    int getsum(int x)

    {

        int res=0;

        for(int i=x;i>0;i-=lowbit(i))

            res+=tree[i];

        return res;

    }

}T;

int main()

{

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

    for(int i=1,l,r;i<=n;++i)

    {

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

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

    }

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

    int j=1;

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

    {

        while(j<=n&&a[j].len<i)

        {

            T.add(a[j].l,a[j].r,1);

            j++;

        }

        int ans=n-j+1;

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

            ans+=T.getsum(k);

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

    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.3901194281024003x):
#include <bits/stdc++.h>



using namespace std;

const int Nmax = 3e5 + 5;

struct line

{

    int l,r;

    bool operator < (const line &b) const

    {

        return r - l < b.r - b.l;

    }

};

line a[Nmax];

int ans[Nmax];

int cnt[Nmax];

int T[Nmax];

int n,m;



void update(int i, int val)

{

    while (i <= m)

    {

        T[i] += val;

        i += i & -i;

    }

}



int get(int i)

{

    int res = 0;

    while (i > 0)

    {

        res += T[i];

        i -= i & -i;

    }

    return res;

}



int main()

{

    //freopen("file.inp","r",stdin);

    cin >> n >> m;

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

    {

        cin >> a[i].l >> a[i].r;

    }

    sort(a + 1, a + n + 1);

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

    {

        ans[1]++;

        ans[a[i].r - a[i].l + 2]--;

    }

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

    {

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

    }

    int j = 1;

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

    {

        while (j <= n && a[j].r - a[j].l + 1 < i)

        {

            update(a[j].l, 1);

            update(a[j].r + 1, -1);

            j++;

        }

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

        {

            ans[i] += get(k);

        }

    }

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

    {

        cout << ans[i] << "\n";

    }

    return 0;

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

#include<cstring>

#include<vector>

#include<algorithm>

using namespace std;

int n,m,l[310000],r[310000],tree[110000];

vector<int> vec[110000];

void add(int x,int y){

    for (;x<=m;x+=x&-x) tree[x]+=y;

}

int getsum(int x){

    int sum=0;

    for (;x;x-=x&(-x)) sum+=tree[x];

    return sum;

}

int main(){

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

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

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

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

    }

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

        int ans=0;

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

            add(l[vec[i][j]],1),add(r[vec[i][j]]+1,-1);

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

        n-=vec[i].size();

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

    }

    return 0;

}






// Faster C++ solution for the same problem (measured speedup: 3.6938195125850313x):
#include <bits/stdc++.h>



using namespace std;

const int Nmax = 3e5 + 5;

struct line

{

    int l,r;

    bool operator < (const line &b) const

    {

        return r - l < b.r - b.l;

    }

};

line a[Nmax];

int ans[Nmax];

int cnt[Nmax];

int T[Nmax];

int n,m;



void update(int i, int val)

{

    while (i <= m)

    {

        T[i] += val;

        i += i & -i;

    }

}



int get(int i)

{

    int res = 0;

    while (i > 0)

    {

        res += T[i];

        i -= i & -i;

    }

    return res;

}



int main()

{

    //freopen("file.inp","r",stdin);

    cin >> n >> m;

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

    {

        cin >> a[i].l >> a[i].r;

    }

    sort(a + 1, a + n + 1);

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

    {

        ans[1]++;

        ans[a[i].r - a[i].l + 2]--;

    }

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

    {

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

    }

    int j = 1;

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

    {

        while (j <= n && a[j].r - a[j].l + 1 < i)

        {

            update(a[j].l, 1);

            update(a[j].r + 1, -1);

            j++;

        }

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

        {

            ans[i] += get(k);

        }

    }

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

    {

        cout << ans[i] << "\n";

    }

    return 0;

}
// Slower C++ solution:
//© 2017 Jazengm/Zeng Xiangru, All Rights Reserved

#include<bits/stdc++.h>

using namespace std;



#define Re return

#define In inline

#define St static

#define Rg register

#define Op operator

#define Ct continue

#define inc(l, i, r) for(Rg int i=l; i<r; ++i)

#define dec(l, i, r) for(Rg int i=r; r>l; --i)

typedef long long ll;

typedef double db;



const int mxn = 3<<17;



int main()

{

    St int n, m;

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

    St int c[mxn];

    inc(0, i, n)

    {

        St int l, r;

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

        for(Rg int i=1; i<=l;)

        {

            Rg int i_=min(l/(l/i), r/(r/i))+1;

            if(l/i!=r/i)

                ++c[i], --c[i_];

            i=i_;

        }

/*        for(Rg int i=1; i<=l;)

        {

            Rg int i_=r/(l/i+1), i__=l/(l/i)+1;

            if(i_>=i)

                ++c[i], --c[min(i_+1, i__)];

            i=i__;

        }*/

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

    }

    Rg int ans=0;

    inc(1, i, m+1)

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

    Re 0;

}


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

#include<algorithm>

#include<cstring>

using namespace std;

int sum[400005],lazy[400005],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 push_down(int k,int l,int r)

{

    if(l==r)

    {

        sum[k]+=lazy[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 sum[k];

    }

    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);

    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<cstring>

#include<cstdio>

#include<algorithm>

#include<vector>

#define N 300010

#define gc getchar()

#define lb(x) (x&-x)

#define debug(x) cerr<<#x<<"="<<x

#define sp <<" "

#define ln <<endl

using namespace std;

inline int inn()

{

    int x,ch;while((ch=gc)<'0'||ch>'9');

    x=ch^'0';while((ch=gc)>='0'&&ch<='9')

        x=(x<<1)+(x<<3)+(ch^'0');return x;

}

int l[N],r[N],b[N],ans[N];vector<int> v[N];

inline int update(int x,int n,int v) { for(;x<=n;x+=lb(x)) b[x]+=v;return 0; }

inline int update(int x,int y,int n,int v) { return update(x,n,v),update(y+1,n,-v); }

inline int query(int x,int v=0) { for(;x;x-=lb(x)) v+=b[x];return v; }

int main()

{

    int n=inn(),m=inn();

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

        l[i]=inn(),r[i]=inn(),v[r[i]-l[i]+1].push_back(i);

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

    {

        for(int i=d;i<=m;i+=d) ans[d]+=query(i);

        for(int i=0,id;i<(int)v[d].size();i++)

            id=v[d][i],update(l[id],r[id],m,1);

    }

    for(int d=m,cnt=0;d;d--)

        cnt+=(int)v[d].size(),ans[d]+=cnt;

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

    return 0;

}

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

#include<algorithm>

#include<cstring>

using namespace std;

int sum[400005],lazy[400005],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 push_down(int k,int l,int r)

{

    if(l==r)

    {

        sum[k]+=lazy[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 sum[k];

    }

    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);

    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:
//© 2017 Jazengm/Zeng Xiangru, All Rights Reserved

#include<bits/stdc++.h>

using namespace std;



#define Re return

#define In inline

#define St static

#define Rg register

#define Op operator

#define Ct continue

#define inc(l, i, r) for(Rg int i=l; i<r; ++i)

#define dec(l, i, r) for(Rg int i=r; r>l; --i)

typedef long long ll;

typedef double db;



const int mxn = 3<<17;



int main()

{

    St int n, m;

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

    St int c[mxn];

    inc(0, i, n)

    {

        St int l, r;

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

        for(Rg int i=1; i<=l;)

        {

            Rg int i_=min(l/(l/i), r/(r/i))+1;

            if(l/i!=r/i)

                ++c[i], --c[i_];

            i=i_;

        }

/*        for(Rg int i=1; i<=l;)

        {

            Rg int i_=r/(l/i+1), i__=l/(l/i)+1;

            if(i_>=i)

                ++c[i], --c[min(i_+1, i__)];

            i=i__;

        }*/

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

    }

    Rg int ans=0;

    inc(1, i, m+1)

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

    Re 0;

}


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

#include<cstring>

#include<algorithm>

#include<vector>

using namespace std;

const int MAXN=3e5+5;

int n,m;

int ans[MAXN];

namespace Seg

{

	#define ls (x<<1)

	#define rs (x<<1|1)

	int add[MAXN<<2],sum[MAXN<<2];

	void down(int x,int l,int r)

	{

		if(!add[x]) return;

		int mid=l+r>>1;

		add[ls]+=add[x];

		add[rs]+=add[x];

		sum[ls]+=add[x]*(mid-l+1);

		sum[rs]+=add[x]*(r-mid);

		add[x]=0;

	}

	void up(int x)

	{

		sum[x]=sum[ls]+sum[rs];

	}

	void fix(int x,int l,int r,int ql,int qr)

	{

		if(ql<=l&&r<=qr)

		{

			add[x]++;

			sum[x]+=(r-l+1);

			return;

		}

		int mid=l+r>>1;

		down(x,l,r);

		if(ql<=mid) fix(ls,l,mid,ql,qr);

		if(qr>mid) fix(rs,mid+1,r,ql,qr);

		up(x);

	}

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

	{

		if(l==r) return sum[x];

		down(x,l,r);

		int mid=l+r>>1;

		if(pos<=mid) return query(ls,l,mid,pos);

		else return query(rs,mid+1,r,pos);

	}

}

pair<int,int>p[MAXN];

int main()

{

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

	for(int i=1,l,r;i<=n;i++)

		scanf("%d%d",&l,&r),p[i]=make_pair(r-l+1,l);

	sort(p+1,p+n+1);

	int cnt=1;

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

	{

		while(cnt<=n&&p[cnt].first<i)

		{

			Seg::fix(1,1,m,p[cnt].second,p[cnt].first+p[cnt].second-1);

			cnt++;

		}

		int ans=n-cnt+1;

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

			ans+=Seg::query(1,1,m,j);

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

	}

	return 0;

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

#include<cstring>

#include<cstdio>

#include<algorithm>

#include<vector>

#define N 300010

#define gc getchar()

#define lb(x) (x&-x)

#define debug(x) cerr<<#x<<"="<<x

#define sp <<" "

#define ln <<endl

using namespace std;

inline int inn()

{

    int x,ch;while((ch=gc)<'0'||ch>'9');

    x=ch^'0';while((ch=gc)>='0'&&ch<='9')

        x=(x<<1)+(x<<3)+(ch^'0');return x;

}

int l[N],r[N],b[N],ans[N];vector<int> v[N];

inline int update(int x,int n,int v) { for(;x<=n;x+=lb(x)) b[x]+=v;return 0; }

inline int update(int x,int y,int n,int v) { return update(x,n,v),update(y+1,n,-v); }

inline int query(int x,int v=0) { for(;x;x-=lb(x)) v+=b[x];return v; }

int main()

{

    int n=inn(),m=inn();

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

        l[i]=inn(),r[i]=inn(),v[r[i]-l[i]+1].push_back(i);

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

    {

        for(int i=d;i<=m;i+=d) ans[d]+=query(i);

        for(int i=0,id;i<(int)v[d].size();i++)

            id=v[d][i],update(l[id],r[id],m,1);

    }

    for(int d=m,cnt=0;d;d--)

        cnt+=(int)v[d].size(),ans[d]+=cnt;

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

    return 0;

}

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

#include<cstring>

#include<algorithm>

#include<vector>

using namespace std;

const int MAXN=3e5+5;

int n,m;

int ans[MAXN];

namespace Seg

{

	#define ls (x<<1)

	#define rs (x<<1|1)

	int add[MAXN<<2],sum[MAXN<<2];

	void down(int x,int l,int r)

	{

		if(!add[x]) return;

		int mid=l+r>>1;

		add[ls]+=add[x];

		add[rs]+=add[x];

		sum[ls]+=add[x]*(mid-l+1);

		sum[rs]+=add[x]*(r-mid);

		add[x]=0;

	}

	void up(int x)

	{

		sum[x]=sum[ls]+sum[rs];

	}

	void fix(int x,int l,int r,int ql,int qr)

	{

		if(ql<=l&&r<=qr)

		{

			add[x]++;

			sum[x]+=(r-l+1);

			return;

		}

		int mid=l+r>>1;

		down(x,l,r);

		if(ql<=mid) fix(ls,l,mid,ql,qr);

		if(qr>mid) fix(rs,mid+1,r,ql,qr);

		up(x);

	}

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

	{

		if(l==r) return sum[x];

		down(x,l,r);

		int mid=l+r>>1;

		if(pos<=mid) return query(ls,l,mid,pos);

		else return query(rs,mid+1,r,pos);

	}

}

pair<int,int>p[MAXN];

int main()

{

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

	for(int i=1,l,r;i<=n;i++)

		scanf("%d%d",&l,&r),p[i]=make_pair(r-l+1,l);

	sort(p+1,p+n+1);

	int cnt=1;

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

	{

		while(cnt<=n&&p[cnt].first<i)

		{

			Seg::fix(1,1,m,p[cnt].second,p[cnt].first+p[cnt].second-1);

			cnt++;

		}

		int ans=n-cnt+1;

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

			ans+=Seg::query(1,1,m,j);

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

	}

	return 0;

}