stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#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';

    }

}

// Faster C++ solution for the same problem (measured speedup: 9.53851071576471x):
#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;

}
// 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: 3.428386828051175x):
#include <bits/stdc++.h>



using namespace std;



#define endl "\n"

#define fi first

#define se second

#define pb push_back

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

#define rall(x) (x).rbegin(), (x).rend()

#define fastio { ios_base::sync_with_stdio(false), cin.tie(NULL); }

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

#define for1(i, n) for(int i = 1; i <= (int)(n); i++)

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

#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)



#ifdef RICARDO

//Header here

	#include "E:\\Code\\dbg.h"

#else

	#define bug(...) "RICARDO MILOS"

#endif





template<class T> bool mini(T &a, T b) { return a > b ? (a = b, true) : false; }

template<class T> bool maxi(T &a, T b) { return a < b ? (a = b, true) : false; }



typedef pair<int, int> pii;

typedef vector<int> vi;

typedef vector<pii> vpi;

typedef vector<vi> vvi;

typedef long long i64;

typedef vector<i64> vi64;

typedef vector<vi64> vvi64;

typedef pair<i64, i64> pi64;

typedef double ld;



//=================================================CODE=================================================//



signed main()

{	

	fastio;

	cout.precision(10);

	cout << fixed;

#ifdef RICARDO		

	freopen("i", "r", stdin);

#endif

	int n, m; cin >> m >> n;

	vpi prs(m);

	for(auto &e : prs) cin >> e.fi >> e.se;

	sort(rall(prs));



	//siege

	vvi D(n + 1);

	for1(i, n) {

		D[0].pb(i);

		for(int j = i; j <= n; j += i) D[j].pb(i);

	}

	//



	vi bit(n + 1, 0);

	auto up = [&](int i) {

		for(; i <= n; i += i & -i) bit[i]++;

	};

	auto get = [&](int i) {

		int RES = 0;

		for(; i; i -= i & -i) RES += bit[i];

		return RES;

	};



	vi ANS(n + 1, m);

	int cur = 0;

	ford(i, n) {

		while(cur < m && prs[cur].fi > i) {

			up(prs[cur].se);			

			cur++;			

		}



		for(int v : D[i]) {

			int j = i + v;

			ANS[v] -= get(min(j - 1, n));						

		}	

	}



	for1(i, n) cout << ANS[i] << endl;

#ifdef RICARDO

	cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";

#endif

}
// 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: 9.478084175736363x):
#include <bits/stdc++.h>

using namespace std;

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

const int M=3e5+5;

struct d{int l,r;}a[M];

bool cmp(d a,d b){return a.r-a.l<b.r-b.l;}

int sum[M];

void upd(int pos,int x){for(int i=pos;i<M;i+=lowbit(i))sum[i]+=x;return ;}

int que(int pos){int res=0;for(int i=pos;i>0;i-=lowbit(i))res+=sum[i];return res;}

int main()

{

    int n,m;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+1+n,cmp);

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

    {

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

        {

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

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

            j++;

        }

        int ans=n-j+1;

        for(int i=d;i<=m;i+=d)ans+=que(i);

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

    }

}
// 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: 3.555428910902052x):
#include <bits/stdc++.h>

using namespace std;

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

const int M=3e5+5;

struct d{int l,r;}a[M];

bool cmp(d a,d b){return a.r-a.l<b.r-b.l;}

int sum[M];

void upd(int pos,int x){for(int i=pos;i<M;i+=lowbit(i))sum[i]+=x;return ;}

int que(int pos){int res=0;for(int i=pos;i>0;i-=lowbit(i))res+=sum[i];return res;}

int main()

{

    int n,m;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+1+n,cmp);

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

    {

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

        {

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

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

            j++;

        }

        int ans=n-j+1;

        for(int i=d;i<=m;i+=d)ans+=que(i);

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

    }

}
// 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: 2.2166982910201214x):
#include <bits/stdc++.h>

using namespace std;

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

const int M=3e5+5;

struct d{int l,r;}a[M];

bool cmp(d a,d b){return a.r-a.l<b.r-b.l;}

int sum[M];

void upd(int pos,int x){for(int i=pos;i<M;i+=lowbit(i))sum[i]+=x;return ;}

int que(int pos){int res=0;for(int i=pos;i>0;i-=lowbit(i))res+=sum[i];return res;}

int main()

{

    int n,m;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+1+n,cmp);

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

    {

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

        {

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

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

            j++;

        }

        int ans=n-j+1;

        for(int i=d;i<=m;i+=d)ans+=que(i);

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

    }

}
// Slower C++ solution:
//### 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;

	}

}

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

using namespace std;

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

const int M=3e5+5;

struct d{int l,r;}a[M];

bool cmp(d a,d b){return a.r-a.l<b.r-b.l;}

int sum[M];

void upd(int pos,int x){for(int i=pos;i<M;i+=lowbit(i))sum[i]+=x;return ;}

int que(int pos){int res=0;for(int i=pos;i>0;i-=lowbit(i))res+=sum[i];return res;}

int main()

{

    int n,m;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+1+n,cmp);

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

    {

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

        {

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

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

            j++;

        }

        int ans=n-j+1;

        for(int i=d;i<=m;i+=d)ans+=que(i);

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

    }

}
// Slower C++ solution:
#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';

    }

}

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

using namespace std;

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

const int M=3e5+5;

struct d{int l,r;}a[M];

bool cmp(d a,d b){return a.r-a.l<b.r-b.l;}

int sum[M];

void upd(int pos,int x){for(int i=pos;i<M;i+=lowbit(i))sum[i]+=x;return ;}

int que(int pos){int res=0;for(int i=pos;i>0;i-=lowbit(i))res+=sum[i];return res;}

int main()

{

    int n,m;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+1+n,cmp);

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

    {

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

        {

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

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

            j++;

        }

        int ans=n-j+1;

        for(int i=d;i<=m;i+=d)ans+=que(i);

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

    }

}
// 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: 2.6627981188127907x):
#include <bits/stdc++.h>

using namespace std;

vector<int> v[100005];

int l[300005], r[300005];



int st[400004], lazy[400004];

void push(int n, int s, int e, int val){

    st[n] += val;

    if(s != e){

        lazy[n+n] += val;

        lazy[n+n+1] += val;

    }

    lazy[n] = 0;

}

void update(int n, int s, int e, int l, int r, int v){

    push(n, s, e, lazy[n]);

    if(s > r || l > e) return;

    if(l <= s && e <= r){

        push(n, s, e, v);

        return;

    }

    int mid = (s+e)/2;

    update(n+n, s, mid, l, r, v);

    update(n+n+1, mid+1, e, l, r, v);

    st[n] = st[n+n] + st[n+n+1];

}

int query(int n, int s, int e, int l, int r){

    push(n, s, e, lazy[n]);

    if(s > r || l > e) return 0;

    if(l <= s && e <= r) return st[n];

    int mid = (s+e)/2;

    return query(n+n, s, mid, l, r) + query(n+n+1, mid+1, e, l, r);

}



int main(){

    int n, m;

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

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

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

        v[r[i]-l[i]+1].emplace_back(i);

    }

    int ans = n;

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

        for(int i=0;i<v[d-1].size();i++){

            int j = v[d-1][i];

            update(1, 1, m, l[j], r[j], 1);

            ans--;

        }

        int res = ans;

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

            res += query(1, 1, m, i, i); 

        }

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

    }

}
// Slower C++ solution:
//### 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;

	}

}

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

using namespace std;

vector<int> v[100005];

int l[300005], r[300005];



int st[400004], lazy[400004];

void push(int n, int s, int e, int val){

    st[n] += val;

    if(s != e){

        lazy[n+n] += val;

        lazy[n+n+1] += val;

    }

    lazy[n] = 0;

}

void update(int n, int s, int e, int l, int r, int v){

    push(n, s, e, lazy[n]);

    if(s > r || l > e) return;

    if(l <= s && e <= r){

        push(n, s, e, v);

        return;

    }

    int mid = (s+e)/2;

    update(n+n, s, mid, l, r, v);

    update(n+n+1, mid+1, e, l, r, v);

    st[n] = st[n+n] + st[n+n+1];

}

int query(int n, int s, int e, int l, int r){

    push(n, s, e, lazy[n]);

    if(s > r || l > e) return 0;

    if(l <= s && e <= r) return st[n];

    int mid = (s+e)/2;

    return query(n+n, s, mid, l, r) + query(n+n+1, mid+1, e, l, r);

}



int main(){

    int n, m;

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

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

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

        v[r[i]-l[i]+1].emplace_back(i);

    }

    int ans = n;

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

        for(int i=0;i<v[d-1].size();i++){

            int j = v[d-1][i];

            update(1, 1, m, l[j], r[j], 1);

            ans--;

        }

        int res = ans;

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

            res += query(1, 1, m, i, i); 

        }

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

    }

}