#include #include #include using namespace std; int main() { int N, H; cin >> N >> H; vector> lst; // 入力処理 for (int i = 0; i < N; i++) { int a, b; cin >> a >> b; lst.emplace_back(a, 1); // 配信開始 (+1) lst.emplace_back(b + 1, -1); // 配信終了 (-1) } // 時刻順にソート sort(lst.begin(), lst.end()); // スイープライン処理 int ans = 0, temp = 0; for (const auto& [_, sgn] : lst) { temp += sgn; ans = max(ans, temp); } // 最大同時視聴数を出力 cout << ans << endl; return 0; }