stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#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]);

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
//### In The Name Of GOD ###



//%% Remember; (((He))) is The (((Accepter))) %%



// GOD IS GREATER ...



#include <bits/stdc++.h>



using namespace std;



typedef long long ll ;

typedef long double ld ;



#define int ll

#define pb push_back

#define bp pop_back

#define pf push_front

#define fp pop_front

#define X first

#define Y second

#define IO ios_base::sync_with_stdio(false);

#define sz(a) (int)(a.size())

#define sg(a, b) (a + b - 1) / b



const int MOD = 1000 * 1000 * 1000 + 7;

const int INF = 8 * 1000 * 1000 + 200;

const int MAXN =  100 * 1000 + 10;

const int MLOG = 18;

const int NMAX = 20;



struct fen{

	int fn[MAXN];

	

	void add(int idx, int val){

		for (idx++; idx < MAXN; idx += idx & -idx)

			fn[idx] += val;

	}



	void addr(int l, int r, int val = 1){

		add(l, val);

		add(r + 1, -val);

	}



	int ansq(int idx){

		int ans = 0;

		for (idx++; idx > 0; idx -= idx & -idx)

			ans += fn[idx];

		return ans;

	}

}me;



signed main(){

	IO;

	int n, m;

	cin >> n >> m;

	int seg[n][2];

	vector<pair<int, int>> vc[3 * MAXN];

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

   		cin >> seg[i][0] >> seg[i][1];

		vc[seg[i][1] - seg[i][0] + 1].pb({seg[i][0], seg[i][1]});

	}

	int x = 0;

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

		int ans = 0;

		for(int j = 0; j < sz(vc[i]); j++){

			me.addr(vc[i][j].X, vc[i][j].Y);

			x++;

		}

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

			ans += me.ansq(j);

		}

		cout << ans + n - x << endl;

	}

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <iostream>

#include <algorithm>

 

using namespace std;

 

const int maxn = 300005;

 

int n, m;

 

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

 

struct Tree

{

	int no[maxn];

	

	inline void add(int pla, int x)

	{

		for (; pla <= m; pla += lowbit(pla))

			no[pla] += x;

	}

	

	inline void add_qj(int l, int r)

	{

//		cout << "add " << l << ' ' << r << endl;

		add(l, 1);

		if (r < m)

			add(r + 1, -1);

	}

	

	inline int query(int pla)

	{

		int ans = 0;

		for (; pla; pla -= lowbit(pla))

			ans += no[pla];

		return ans;

	}

} tr;

 

struct QJ

{

	int l, r;

	inline int len() { return r - l + 1; }

	friend bool operator < (QJ a, QJ b)

	{ return a.r - a.l < b.r - b.l; }

} qj[maxn];

 

int main()

{

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

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

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

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

//	cout << "qj\n";

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

//		cout << qj[i].l << ' ' << qj[i].r << endl;

	int now = 1;

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

	{

		while (now <= n && qj[now].len() < i)

		{

			tr.add_qj(qj[now].l, qj[now].r);

			now++;

		}

		int ans = n - now + 1;

//		cout << "ans = " << i << ' ' << ans << ' ' << now << endl;

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

//		{

			ans += tr.query(j);

//			cout << j << ' ' << tr.query(j) << endl;

//		}

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

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define pb          emplace_back

#define ll          long long

#define fi          first

#define se          second

#define mp          make_pair

 

using namespace std;

 

const int N = int(3e5) + 7;

const int mod = int(1e9) + 7;

typedef pair<int, int> pii;

 

int n, m, res, l[N], r[N], t[N], remain;

vector<int> dis[N];

 

void Update(int x, int val) {for(; x < N; x += (x & -x)) t[x] += val;}

int Get(int x) {int res = 0; for(; x > 0; x -= (x & -x)) res += t[x]; return res;}

 

int32_t main() {

    ios_base::sync_with_stdio(0);

    cin.tie(0), cout.tie(0);

    #define Task        "test"

    if(fopen(Task".inp", "r")) {

        freopen(Task".inp", "r", stdin);

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

    }

    cin >> n >> m;

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

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

        dis[r[i] - l[i] + 1].pb(i);

    }

    remain = n;

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

       for(int j: dis[i - 1]) Update(l[j], 1), Update(r[j] + 1, -1);

       remain -= int(dis[i - 1].size()); res = remain;

       if(i != 1) for(int j = i; j <= m; j += i) res += Get(j);

       cout << res << '\n';

    }

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <iostream>

#include <algorithm>

 

using namespace std;

 

const int maxn = 300005;

 

int n, m;

 

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

 

struct Tree

{

	int no[maxn];

	

	inline void add(int pla, int x)

	{

		for (; pla <= m; pla += lowbit(pla))

			no[pla] += x;

	}

	

	inline void add_qj(int l, int r)

	{

//		cout << "add " << l << ' ' << r << endl;

		add(l, 1);

		if (r < m)

			add(r + 1, -1);

	}

	

	inline int query(int pla)

	{

		int ans = 0;

		for (; pla; pla -= lowbit(pla))

			ans += no[pla];

		return ans;

	}

} tr;

 

struct QJ

{

	int l, r;

	inline int len() { return r - l + 1; }

	friend bool operator < (QJ a, QJ b)

	{ return a.r - a.l < b.r - b.l; }

} qj[maxn];

 

int main()

{

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

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

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

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

//	cout << "qj\n";

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

//		cout << qj[i].l << ' ' << qj[i].r << endl;

	int now = 1;

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

	{

		while (now <= n && qj[now].len() < i)

		{

			tr.add_qj(qj[now].l, qj[now].r);

			now++;

		}

		int ans = n - now + 1;

//		cout << "ans = " << i << ' ' << ans << ' ' << now << endl;

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

//		{

			ans += tr.query(j);

//			cout << j << ' ' << tr.query(j) << endl;

//		}

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

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstring>

#include<algorithm>

#include<cstdio>

using namespace std;



int m,n;

typedef pair<int,int> Pair;

Pair p[300005];

int sum[400005],add[400005];



void update(int o,int l,int r,int x,int y,int a){

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

		sum[o]+=a*(r-l);

		add[o]+=a;

	}else{

		int mid=l+r>>1;

		if(x<mid)update(o<<1,l,mid,x,y,a);

		if(y>mid)update(o<<1|1,mid,r,x,y,a);

		sum[o]=sum[o<<1]+sum[o<<1|1]+add[o]*(r-l);

	}

}



int query(int o,int l,int r,int x,int a){

	if(r-l==1){

		return sum[o]+a;

	}else{

		int mid=l+r>>1;

		if(x<mid)return query(o<<1,l,mid,x,a+add[o]);

		else return query(o<<1|1,mid,r,x,a+add[o]);

	}

}



bool comp(Pair a,Pair b){

	return a.second-a.first<b.second-b.first;

}



int main(){

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

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

        scanf("%d%d",&p[i].first,&p[i].second);

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

    int i=1;

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

        while(i<=n&&p[i].second-p[i].first+1<d){

            update(1,1,m+1,p[i].first,p[i].second+1,1);

            i++;

        }

        int ans=n-i+1;

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

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

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

    }

    return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;



const int N = 300010;



int n, m, d[N];

struct Point {int l, r;} a[N];



bool operator < (Point a, Point b) {

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

}



namespace BIT {

#define lowbit(i) (i & -i)

int c[N];

void add(int x, int v) {

	for(int i = x; i <= m; i += lowbit(i)) c[i] += v;

}

int query(int x) {

	int ans = 0;

	for(int i = x; i; i -= lowbit(i)) ans += c[i];

	return ans;

}

}



int main() {

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

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

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

	int cur = 1;

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

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

			BIT::add(a[cur].l, 1); BIT::add(a[cur].r + 1, -1);

			++cur;

		}

		for(int j = i; j <= m; j += i) d[i] += BIT::query(j);

		d[i] += n - cur + 1;

	}

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

	return 0;

} 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;



typedef pair<int, int> pii;



const int MX = 100002;

int N, M;



struct BIT {

    int tree[4*MX];

    void init() {

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

    }

    void upd(int idx, int val, int l, int r, int n) {

        if(idx < l || r < idx) return;

        if(l == r) {

            tree[n] += val;

            return;

        }

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

        upd(idx, val, l, m, 2*n);

        upd(idx, val, m + 1, r, 2*n + 1);

        tree[n] = tree[2*n] + tree[2*n + 1];

    }

    int quer(int a, int b, int l, int r, int n) {

        if(b < l || r < a) return 0;

        if(a <= l && r <= b) return tree[n];

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

        int L = quer(a, b, l, m, 2*n);

        int R = quer(a, b, m + 1, r, 2*n + 1);

        return L + R;

    }

} bit, cnt;



vector<pii> seg[MX];



int main() {

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



    cnt.init();



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

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

        seg[ r - l + 1 ].push_back(pii(l, r));

        cnt.upd(r - l + 1, 1, 0, MX - 1, 1);

    }



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

        int ans = cnt.quer(i, MX - 1, 0, MX - 1, 1);

        int d = i;

        while(d <= M) {

            ans += bit.quer(0, d, 0, MX - 1, 1);

            d += i;

        }

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

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

            bit.upd(seg[i][j].first, 1, 0, MX - 1, 1);

            bit.upd(seg[i][j].second + 1, -1, 0, MX - 1, 1);

        }

    }

}


// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;



typedef pair<int, int> pii;



const int MN = 300010;



int N, M;

pii seg[MN];

int ans[MN];



struct Fenwick {

    vector<int> tree;

    void init() {

        tree = vector<int>(MN + 1, 0);

    }

    void upd(int idx, int val) {

        for(int i = idx + 1; i <= MN; i += (i & -i)) tree[i] += val;

    }

    int quer(int a) {

        int ret = 0;

        for(int i = a + 1; i >= 1; i -= (i & -i)) ret += tree[i];

        return ret;

    }

} fw;



bool cmp(pii a, pii b) {

    return a.second - a.first < b.second - b.first;

}



int main() {

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



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

        scanf("%d %d", &seg[i].first, &seg[i].second);

    }



    sort(seg, seg + N, cmp);



    fw.init();

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

        fw.upd(seg[i].first, 1);

        fw.upd(seg[i].second + 1, -1);

    }

    int pos = N - 1;

    for(int i = M; i >= 1; i--) {

        while(pos >= 0 && seg[pos].second - seg[pos].first >= i) {

            fw.upd(seg[pos].first, -1);

            fw.upd(seg[pos].second + 1, 1);

            pos--;

        }



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

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

            ans[i] += fw.quer(j);

        }

    }

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

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

    }

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define st first

#define nd second

#define pb push_back

#define pf push_front

#define ppb pop_back

#define ppf pop_front

#define umax(x,y) x=max(x,y)

#define umin(x,y) x=min(x,y)

#define ll long long

#define ii pair<int,int>

#define iii pair<int,ii>

#define iiii pair<ii,ii>

#define sz(x) ((int) x.size())

#define orta ((bas+son)/2)

#define all(x) x.begin(),x.end()

#define inf 1000000000

#define MOD 1000000007 

#define N 100005

#define M 1000000

#define LOG 20

#define KOK 300

#define EPS 0.0000001

using namespace std;



int n,m;

int ans[N];

int f[N<<1];

vector<ii> v[N<<1];



int get(int x) {



	int res=0;



	for(int i=x;i>=1;i-=i&-i) res+=f[i];



	return res;



}



void up(int x) {



	for(int i=x;i<=m+m;i+=i&-i) f[i]++;



}



int main() {



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



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



		int l,r;



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



		v[r].pb({l,1});



	}



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



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



			v[j].pb({j-i,0});



		}



	}



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



		sort(all(v[i]),[](ii a,ii b){return a.nd<b.nd;});



		for(auto x:v[i]) {



			if(x.nd) {



				up(x.st);



			}

			else {



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



			}



		}



	}



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



}	

// Optimized solution to the same problem (faster):
/*ILTH      ILTH            ILTHILTHILTH    ILTH        ILTH

  ILTH      ILTH                ILTH        ILTH        ILTH

  ILTH      ILTH                ILTH        ILTHILTHILTHILTH

  ILTH      ILTH                ILTH        ILTH        ILTH

  ILTH      ILTHILTHILTH        ILTH        ILTH        ILTH



  */

#include <bits/stdc++.h>

#define fi first

#define se second

#define pb push_back



using namespace std;

typedef long long ll;

typedef pair<int,int> pii;

const int maxN=300009;

pii a[maxN];

int n,m,bt[maxN];

bool comp(pii a, pii b){

    return a.se-a.fi<b.se-b.fi;

}

void up(int x, int y){

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

}

int get(int x){

    int res=0;

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

    return res;

}

int main()

{

    cin >> n >> m;

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

        int l,r;

        cin >> l >> r;

        a[i]={l,r};

    }

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



    int j=1;

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

        int res=0;

        while (a[j].se-a[j].fi+1<i && j<=n){

            up(a[j].fi,1);

            up(a[j].se+1,-1);

            ++j;

        }

        res+=n-j+1;

        for (int k=1; k*i<=m; ++k) res+=get(k*i);

        cout << res << "\n";

    }



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<cstring>

#include<algorithm>

#include<vector>

#define pii pair<int,int>

#define fi first

#define se second

#define pb push_back

#define mp make_pair

using namespace std;

inline int read(){

	int f=1,ans=0;char c=getchar();

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

	while(c>='0'&&c<='9'){ans=ans*10+c-'0';c=getchar();}

	return ans*f;

}

const int MAXN=300001;

int N,M,tot;

struct BIT{

	int Ans[MAXN];

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

	void Modify(int x,int w){for(;x<=N;x+=lowbit(x)) Ans[x]+=w;}

	int Query(int x){int res=0;for(;x;x-=lowbit(x)) res+=Ans[x];return res;}

	void Add(int l,int r,int w){tot++;Modify(l,w),Modify(r+1,-w);return;}

}T;

vector<pii> vec[MAXN];

int main(){

	M=read(),N=read();

	for(int i=1;i<=M;i++){int l=read(),r=read();vec[r-l+1].pb(mp(l,r));}

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

		int cur=i-1;for(int j=0;j<vec[cur].size();j++) T.Add(vec[cur][j].fi,vec[cur][j].se,1);

		int Ans=M-tot;for(int j=i;j<=N;j+=i) Ans+=T.Query(j);printf("%d\n",Ans);

	}return 0;

}


// Optimized solution to the same problem (faster):
/*ILTH      ILTH            ILTHILTHILTH    ILTH        ILTH

  ILTH      ILTH                ILTH        ILTH        ILTH

  ILTH      ILTH                ILTH        ILTHILTHILTHILTH

  ILTH      ILTH                ILTH        ILTH        ILTH

  ILTH      ILTHILTHILTH        ILTH        ILTH        ILTH



  */

#include <bits/stdc++.h>

#define fi first

#define se second

#define pb push_back



using namespace std;

typedef long long ll;

typedef pair<int,int> pii;

const int maxN=300009;

pii a[maxN];

int n,m,bt[maxN];

bool comp(pii a, pii b){

    return a.se-a.fi<b.se-b.fi;

}

void up(int x, int y){

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

}

int get(int x){

    int res=0;

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

    return res;

}

int main()

{

    cin >> n >> m;

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

        int l,r;

        cin >> l >> r;

        a[i]={l,r};

    }

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



    int j=1;

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

        int res=0;

        while (a[j].se-a[j].fi+1<i && j<=n){

            up(a[j].fi,1);

            up(a[j].se+1,-1);

            ++j;

        }

        res+=n-j+1;

        for (int k=1; k*i<=m; ++k) res+=get(k*i);

        cout << res << "\n";

    }



    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define ll long long

#define INF 999999999

#define MOD 1000000007

#define rep(i,n) for(int i=0;i<n;i++)



using namespace std;



typedef pair<int,int>P;



const int MAX_N = 125252;



vector<P> lens[125252];



int bit[MAX_N+1],n,m;

//i番目までの和を計算する

int sum(int i)

{

	int s = 0;

	while(i>0){

		s += bit[i];

		i -= i & -i;

	}

	return s;

}

//i番目の値にxを加える

void add(int i,int x)

{

	while(i <= MAX_N){

		bit[i] += x;

		i += i & -i;

	}

}



int main()

{

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

	rep(i,n){

		int l,r;

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

		r++;

		lens[r-l].push_back(P(l,r));	//rはr+1を指すようにする

	}

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

	int rest = n;

	for(int i=2;i<m+1;i++){	//iは間隔dのこと

		rep(j,lens[i-1].size()){

			add(lens[i-1][j].first,1);

			add(lens[i-1][j].second,-1);

			rest--;

		}

		int ans = rest;	//間隔がm以上の区間

		int it = i;

		while(it<=m){

			ans += sum(it);

			it += i;

		}

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

	}

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

#define ll long long

#define INF 999999999

#define MOD 1000000007

#define rep(i,n) for(int i=0;i<n;i++)



using namespace std;



typedef pair<int,int>P;



const int MAX_N = 100005;



vector<P> lens[100005];



int bit[MAX_N+1],n,m;

//i番目までの和を計算する

int sum(int i)

{

	int s = 0;

	while(i>0){

		s += bit[i];

		i -= i & -i;

	}

	return s;

}

//i番目の値にxを加える

void add(int i,int x)

{

	while(i <= MAX_N){

		bit[i] += x;

		i += i & -i;

	}

}



int main()

{

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

	rep(i,n){

		int l,r;

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

		r++;

		lens[r-l].push_back(P(l,r));	//rはr+1を指すようにする

	}

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

	int rest = n;

	for(int i=2;i<m+1;i++){	//iは間隔dのこと

		rep(j,lens[i-1].size()){

			add(lens[i-1][j].first,1);

			add(lens[i-1][j].second,-1);

			rest--;

		}

		int ans = rest;	//間隔がm以上の区間

		int it = i;

		while(it<=m){

			ans += sum(it);

			it += i;

		}

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

	}

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<algorithm>

#include<cstring>

#include<vector>

using namespace std;

const int maxn=300050;

int sum[maxn<<3],lazy[maxn<<3],l[maxn],r[maxn];

int n,M;

vector<int>q[maxn];

inline void push_down(int ID,int l,int r){

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

	sum[ID<<1]+=(m-l+1)*lazy[ID],sum[ID<<1|1]+=(r-m)*lazy[ID];

	lazy[ID<<1]+=lazy[ID],lazy[ID<<1|1]+=lazy[ID],lazy[ID]=0;

}

inline void ins(int ID,int l,int r,int L,int R){

	if(lazy[ID])push_down(ID,l,r);

	if(l>=L&&r<=R){

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

		lazy[ID]++;

		return;

	}

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

	if(m>=L)ins(ID<<1,l,m,L,R);

	if(m<R)ins(ID<<1|1,m+1,r,L,R);

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

}

inline int query(int ID,int x,int l,int r){

	if(lazy[ID])push_down(ID,l,r);

	if(sum[ID]==0)return 0;

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

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

	if(m>=x)return query(ID<<1,x,l,m);

	else return query(ID<<1|1,x,m+1,r);

}

int main(){

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

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

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

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

	}

	int remain=n;

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

		int ans=remain;

		remain-=q[i].size();

		if(i!=1)

		for(register int j=1;j*i<=M;j++)ans+=query(1,i*j,1,300000);

		for(register int j=0;j<q[i].size();j++)ins(1,1,300000,l[q[i][j]],r[q[i][j]]);

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

	}

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<cstring>

#include<iostream>

#include<algorithm>

#include<bitset>

#include<vector>

#include<math.h>

#define ls(x) (x<<1)

#define rs(x) ((x<<1)|1)

using namespace std;

int n,m;

struct nod

{

    int l,r,len;

    bool operator<(const nod &b)const

    {

        return len<b.len;

    }

}a[300005];

int lazy[1200005];

void pushdown(int now)

{

    lazy[ls(now)]+=lazy[now];

    lazy[rs(now)]+=lazy[now];

    lazy[now]=0;

}

void jia(int now,int l,int r,int st,int ed)

{

    if(l==r)

    {

        lazy[now]++;

        return;

    }

    if(st<=l&&ed>=r)

    {

        lazy[now]++;

        return;

    }

    if(lazy[now])pushdown(now);

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

    if(st<=mid)jia(ls(now),l,mid,st,ed);

    if(ed>=mid+1)jia(rs(now),mid+1,r,st,ed);

}

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

{

    if(l==r)return lazy[now];

    if(lazy[now])pushdown(now);

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

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

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

}

int main()

{

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

    for(int i=1;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+1+n);

    int flag=1,ans;

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

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

    {

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

        {

            jia(1,1,m,a[flag].l,a[flag].r);

            //printf("%d %d\n",a[flag].l,a[flag].r);

            flag++;

        }

        ans=0;

        //printf("%d %d\n",i,query(1,1,m,9));

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

        {

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

            //printf("%d ",ans);

        }

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

    }

}

// Fastest known solution for this problem: