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

using namespace std;



typedef long long ll;

typedef pair<int, int> pii;

typedef pair<int, pii> pipii;

typedef pair<pii, int> piipi;

typedef pair<pii, pii> piipii;



#define mp make_pair

#define fi first

#define se second

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

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

#define eb emplace_back



int ft[100005];

void update(int i, int v){

    for(;i<=100000;i+=(i&-i)) ft[i] += v;

}

int query(int i){

    int ans = 0;

    for(;i>0;i-=(i&-i)) ans+=ft[i];

    return ans;

}



int l[300005], r[300005];

vector<int> del[100005];

int main(){

    int n, m, sum = 0;

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

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

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

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

        sum++;

    }



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

        int ans = sum;

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

            ans += query(i);

        }



        for(int j=0;j<sz(del[d]);j++){

            int idx = del[d][j];

            update(l[idx], 1);

            update(r[idx]+1, -1);

            sum--;

        }

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

using namespace std;



typedef long long ll;

typedef pair<int, int> pii;

typedef pair<int, pii> pipii;

typedef pair<pii, int> piipi;

typedef pair<pii, pii> piipii;



#define mp make_pair

#define fi first

#define se second

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

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

#define eb emplace_back



int ft[100005];

void update(int i, int v){

    for(;i<=100000;i+=(i&-i)) ft[i] += v;

}

int query(int i){

    int ans = 0;

    for(;i>0;i-=(i&-i)) ans+=ft[i];

    return ans;

}



int l[300005], r[300005];

vector<int> del[100005];

int main(){

    int n, m, sum = 0;

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

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

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

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

        sum++;

    }



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

        int ans = sum;

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

            ans += query(i);

        }



        for(int j=0;j<sz(del[d]);j++){

            int idx = del[d][j];

            update(l[idx], 1);

            update(r[idx]+1, -1);

            sum--;

        }

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

using namespace std;



typedef long long ll;

typedef pair<int, int> pii;

typedef pair<int, pii> pipii;

typedef pair<pii, int> piipi;

typedef pair<pii, pii> piipii;



#define mp make_pair

#define fi first

#define se second

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

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

#define eb emplace_back



int ft[100005];

void update(int i, int v){

    for(;i<=100000;i+=(i&-i)) ft[i] += v;

}

int query(int i){

    int ans = 0;

    for(;i>0;i-=(i&-i)) ans+=ft[i];

    return ans;

}



int l[300005], r[300005];

vector<int> del[100005];

int main(){

    int n, m, sum = 0;

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

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

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

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

        sum++;

    }



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

        int ans = sum;

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

            ans += query(i);

        }



        for(int j=0;j<sz(del[d]);j++){

            int idx = del[d][j];

            update(l[idx], 1);

            update(r[idx]+1, -1);

            sum--;

        }

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

    }

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

using namespace std;

#define fi first

#define se second

typedef pair<int, int> Pi;



struct BIT {

  

  vector<int> sum;

  

  BIT (int sz)

  {

    sum.assign(++sz, 0);

  }

  

  int query(int k)

  {

    int ret = 0;

    for (; k > 0; k -= k & -k) ret += sum[k];

    return ret;

  }



  void add(int k, int x)

  {

    for (; k < sum.size(); k += k & -k) sum[k] += x;

  }

  

};



int main()

{

  int N, M;

  int A[300005], B[300005];

  Pi pmt[300005];

  

  cin >> N >> M;

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

    cin >> A[i] >> B[i]; B[i]++;

    pmt[i] = Pi(B[i] - A[i], i);

  }

  sort (pmt, pmt + N);

  

  int now = 0;

  BIT tree(M);

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

    while (pmt[now].fi <= i && now < N) {

      int sec = pmt[now].se;

      int a = A[sec], b = B[sec];

      tree.add(a, 1); tree.add(b, -1);

      now++;

    }

    int ans = 0;

    for (int j = i; j <= M; j += i) ans += tree.query(j);

    cout << (N - now) + ans << endl;

  }

  

  return 0;

}


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

using namespace std;



using ll = long long;

using Pi = pair<int, int>;

using Pl = pair<ll, ll>;

using vint = vector<int>;

using vll = vector<ll>;

template<typename T> using uset = unordered_set<T>;

template<typename T1, typename T2> using umap = unordered_map<T1, T2>;



constexpr int INF = (1 << 30) - 1;

constexpr ll LLINF = 1LL << 60;

constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};

constexpr char el = '\n';

constexpr int mod = 1000000007;



template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }

template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }

template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }



int main() {

        ll N, M;

        cin >> N >> M;

        int sum[100006] = {};   



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

                int l, r;

                cin >> l >> r;

                int minv = M + 1;

                for (int j = 1; j < minv && j * j <= r; j++) {

                        int a = l / j * j, b = r / j * j;

                        if (l <= a && a <= r || l <= b && b <= r) sum[j]++, sum[j + 1]--;

                        int dl = l / j, dr = r / j;

                        if (dl * j < l) dl++;

                        dl = max(dl, j + 1);

                        dr = min(dr, minv - 1);

                        if (dl > dr) continue;

                        sum[dl]++, sum[dr + 1]--;

                        minv = min(minv, dl);

                }

        }

        int d = 0;      

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

                d += sum[i];

                cout << d << el;

        }

    return (0);

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

}

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

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

        }

    }

}


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

    }

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



}	

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

using namespace std;

using ii = pair<int, int>;

const int N  = 3e5 + 5;



int n, m, fen[N];

ii seg[N];



void add(int p, int val) {

  for (; p <= m; p += p & -p) fen[p] += val;

}



int sum(int p) {

  int res = 0;

  for (; p; p -= p & -p) res += fen[p];

  return res;

}



#define L first

#define R second

int main() {

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

  cin >> n >> m;

  for (int i = 1; i <= n; ++i) cin >> seg[i].L >> seg[i].R;

  sort(seg + 1, seg + 1 + n, [](const ii &x, const ii &y){ return x.R - x.L < y.R - y.L; });



  int x = n, j = 1;

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

    while (j <= n && seg[j].R - seg[j].L + 1 < d) {

      add(seg[j].L, +1);

      add(seg[j].R + 1, -1);

      --x; ++j;

    }

    int ans = x;

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

      ans += sum(i);

    cout << ans << "\n";

  }

  return 0;

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

}


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

using namespace std;

using ii = pair<int, int>;

const int N  = 3e5 + 5;



int n, m, fen[N];

ii seg[N];



void add(int p, int val) {

  for (; p <= m; p += p & -p) fen[p] += val;

}



int sum(int p) {

  int res = 0;

  for (; p; p -= p & -p) res += fen[p];

  return res;

}



#define L first

#define R second

int main() {

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

  cin >> n >> m;

  for (int i = 1; i <= n; ++i) cin >> seg[i].L >> seg[i].R;

  sort(seg + 1, seg + 1 + n, [](const ii &x, const ii &y){ return x.R - x.L < y.R - y.L; });



  int x = n, j = 1;

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

    while (j <= n && seg[j].R - seg[j].L + 1 < d) {

      add(seg[j].L, +1);

      add(seg[j].R + 1, -1);

      --x; ++j;

    }

    int ans = x;

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

      ans += sum(i);

    cout << ans << "\n";

  }

  return 0;

}