Language: C++

#include<iostream>
#include<map>
#include<atcoder/all>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

// Container コンテナ型, map以外
template< template<class ...> class Ctn,class T>
std::ostream& operator<<(std::ostream& os,const Ctn<T>& v){
  auto itr=v.begin();
  while(itr!=v.end()){
    if(itr!=v.begin())cout << " ";
    cout << *(itr++);
  }
  return os;
}

// map 型
template<class S,class T>
std::ostream& operator<<(std::ostream& os, const map<S,T>& mp){
  for(const pair<S,T>& x: mp){
    cout << "[" << x.first << "]=" << x.second << " ";
  }
  return os;
}

struct deta{
  int a,b,i;
  deta(int x=0,int y=0,int z=0){a=x;b=y;i=z;};
};
std::ostream& operator<<(std::ostream& os, const deta& x){
  print(x.a,x.b,x.i);
  return os;
}

const int operator<(const deta& p1, const deta& p2){
  return p1.a<p2.a;
}

struct less1 {
  bool operator()(const deta& p1, const deta& p2) const{
    return p1.i<p2.i;
  }
};



int main(){
  int n; cin >>n;
  vector<deta> v(n);
  rep(i,n){
    int a,b; cin >>a >>b;
    v[i]={a,b,i};
  }
  sort(v.begin(),v.end());
  if(df)print(v);
  atcoder::dsu d(n);
  map<int,int> mp;
  rep(i,n){
    int b=v[i].b;
    auto itr=mp.lower_bound(b);
    if(itr==mp.begin()){
      mp[b]=v[i].i;
    }else{
      while(itr!=mp.begin()){
        itr--;
        d.merge(v[i].i,itr->second);
        if(itr!=mp.begin())itr=mp.erase(itr);
      }
    }
    if(df)print(mp);
  }
  rep(i,n){
    print(d.size(i));
  }
}
#define df 0
#include<iostream>
#include<map>
#include<atcoder/all>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

// Container コンテナ型, map以外
template< template<class ...> class Ctn,class T>
std::ostream& operator<<(std::ostream& os,const Ctn<T>& v){
  auto itr=v.begin();
  while(itr!=v.end()){
    if(itr!=v.begin())cout << " ";
    cout << *(itr++);
  }
  return os;
}

// map 型
template<class S,class T>
std::ostream& operator<<(std::ostream& os, const map<S,T>& mp){
  for(const pair<S,T>& x: mp){
    cout << "[" << x.first << "]=" << x.second << " ";
  }
  return os;
}

struct deta{
  int a,b,i;
  deta(int x=0,int y=0,int z=0){a=x;b=y;i=z;};
};
std::ostream& operator<<(std::ostream& os, const deta& x){
  print(x.a,x.b,x.i);
  return os;
}

const int operator<(const deta& p1, const deta& p2){
  return p1.a<p2.a;
}

struct less1 {
  bool operator()(const deta& p1, const deta& p2) const{
    return p1.i<p2.i;
  }
};



int main(){
  int n; cin >>n;
  vector<deta> v(n);
  rep(i,n){
    int a,b; cin >>a >>b;
    v[i]={a,b,i};
  }
  sort(v.begin(),v.end());
  if(df)print(v);
  atcoder::dsu d(n);
  map<int,int> mp;
  rep(i,n){
    int b=v[i].b;
    auto itr=mp.lower_bound(b);
    if(itr==mp.begin()){
      mp[b]=v[i].i;
    }else{
      while(itr!=mp.begin()){
        itr--;
        d.merge(v[i].i,itr->second);
        if(itr!=mp.begin())itr=mp.erase(itr);
      }
    }
    if(df)print(mp);
  }
  rep(i,n){
    print(d.size(i));
  }
}


Compiler output:
a.cc:3:9: fatal error: atcoder/all: No such file or directory
    3 | #include<atcoder/all>
      |         ^~~~~~~~~~~~~
compilation terminated.