fn main() { const SZ : usize = 1_000_000; input!{ n: usize, _h: usize, ab: [(usize, usize); n], } // いもす法で区間加算する let mut acc = vec![0i64; SZ + 9]; for (a, b) in ab { acc[a] += 1; acc[b+1] -= 1; } for i in 0..=SZ+5 { acc[i+1] += acc[i]; } // 最も多い時間帯を答える let mut ans = 0; for i in 0..=SZ+5 { ans = max(ans, acc[i]); } println!("{}", ans); } // const MOD17: usize = 1000000007; // const MOD93: usize = 998244353; // const INF: usize = 1 << 60; // let dx = vec![!0, 0, 1, 0]; // 上左下右 // let dy = vec![0, !0, 0, 1]; // 上左下右 // let d = vec!{(!0, 0), (0, !0), (1, 0), (0, 1)}; // 上左下右 #[allow(unused)] use proconio::{input, marker::Chars, marker::Usize1}; #[allow(unused)] use std::{ mem::swap, cmp::min, cmp::max, cmp::Reverse, collections::HashSet, collections::BTreeSet, collections::HashMap, collections::BTreeMap, collections::BinaryHeap, collections::VecDeque, iter::FromIterator, };