fn main() { #![allow(unused_imports, unused_macros)] prepare_io!(_in_buf, scanner, _out); macro_rules ! print { ($ ($ arg : tt) *) => (:: std :: write ! (_out , $ ($ arg) *) . expect ("io error")) } macro_rules ! println { ($ ($ arg : tt) *) => (:: std :: writeln ! (_out , $ ($ arg) *) . expect ("io error")) } scan!(scanner, n, k); let mut dp = BTreeMap::new(); dp.insert(k, 1usize); for i in (1..=n).rev() { for k in dp.keys().cloned().collect::>() { if k >= i { *dp.entry(k / i).or_default() += dp[&k]; } } } let ans = dp.values().sum::() - 1; println!("{}", ans); } mod main_macros { #[macro_export] macro_rules! prepare_io { ($ in_buf : ident , $ scanner : ident , $ out : ident) => { use std::io::{stdout, BufWriter, Write as _}; let $in_buf = read_stdin_all_unchecked(); let mut $scanner = Scanner::new(&$in_buf); let $out = stdout(); let mut $out = BufWriter::new($out.lock()); }; } } pub fn echo( mut writer: impl std::io::Write, iter: impl IntoIterator, sep: impl std::fmt::Display, ) -> std::io::Result<()> { let mut iter = iter.into_iter(); if let Some(item) = iter.next() { write!(writer, "{}", item)?; } for item in iter { write!(writer, "{}{}", sep, item)?; } writeln!(writer) } pub fn read_stdin_all_unchecked() -> String { use std::io::Read as _; let mut buf = Vec::new(); std::io::stdin().read_to_end(&mut buf).expect("io error"); unsafe { String::from_utf8_unchecked(buf) } } pub fn read_stdin_line() -> String { let mut s = String::new(); std::io::stdin().read_line(&mut s).expect("io error"); s } use std::collections::BTreeMap; pub use scanner_impls::{IterScan, MarkedIterScan, Scanner}; mod scanner_impls { pub trait IterScan: Sized { type Output; fn scan<'a, I: Iterator>(iter: &mut I) -> Option; } pub trait MarkedIterScan: Sized { type Output; fn mscan<'a, I: Iterator>(self, iter: &mut I) -> Option; } #[derive(Clone, Debug)] pub struct Scanner<'a> { iter: std::str::SplitAsciiWhitespace<'a>, } impl<'a> Scanner<'a> { #[inline] pub fn new(s: &'a str) -> Self { let iter = s.split_ascii_whitespace(); Self { iter } } #[inline] pub fn scan(&mut self) -> ::Output where T: IterScan, { ::scan(&mut self.iter).expect("scan error") } #[inline] pub fn mscan(&mut self, marker: T) -> ::Output where T: MarkedIterScan, { marker.mscan(&mut self.iter).expect("scan error") } #[inline] pub fn scan_vec(&mut self, size: usize) -> Vec<::Output> where T: IterScan, { (0..size) .map(|_| ::scan(&mut self.iter).expect("scan error")) .collect() } #[inline] pub fn iter<'b, T>(&'b mut self) -> ScannerIter<'a, 'b, T> where T: IterScan, { ScannerIter { inner: self, _marker: std::marker::PhantomData, } } } macro_rules ! iter_scan_impls { ($ ($ t : ty) *) => { $ (impl IterScan for $ t { type Output = Self ; # [inline] fn scan <'a , I : Iterator < Item = &'a str >> (iter : & mut I) -> Option < Self > { iter . next () ?. parse ::<$ t > () . ok () } }) * } ; } iter_scan_impls ! (char u8 u16 u32 u64 usize i8 i16 i32 i64 isize f32 f64 u128 i128 String); macro_rules ! iter_scan_tuple_impl { ($ ($ T : ident) *) => { impl <$ ($ T : IterScan) ,*> IterScan for ($ ($ T ,) *) { type Output = ($ (<$ T as IterScan >:: Output ,) *) ; # [inline] fn scan <'a , It : Iterator < Item = &'a str >> (_iter : & mut It) -> Option < Self :: Output > { Some (($ (<$ T as IterScan >:: scan (_iter) ?,) *)) } } } ; } iter_scan_tuple_impl!(); iter_scan_tuple_impl!(A); iter_scan_tuple_impl ! (A B); iter_scan_tuple_impl ! (A B C); iter_scan_tuple_impl ! (A B C D); iter_scan_tuple_impl ! (A B C D E); iter_scan_tuple_impl ! (A B C D E F); iter_scan_tuple_impl ! (A B C D E F G); iter_scan_tuple_impl ! (A B C D E F G H); iter_scan_tuple_impl ! (A B C D E F G H I); iter_scan_tuple_impl ! (A B C D E F G H I J); iter_scan_tuple_impl ! (A B C D E F G H I J K); pub struct ScannerIter<'a, 'b, T> { inner: &'b mut Scanner<'a>, _marker: std::marker::PhantomData T>, } impl<'a, 'b, T> Iterator for ScannerIter<'a, 'b, T> where T: IterScan, { type Item = ::Output; #[inline] fn next(&mut self) -> Option { ::scan(&mut self.inner.iter) } } #[macro_export] macro_rules ! scan_value { ($ scanner : expr , ($ ($ t : tt) ,*)) => { ($ ($ crate :: scan_value ! ($ scanner , $ t)) ,*) } ; ($ scanner : expr , [$ t : tt ; $ len : expr]) => { (0 ..$ len) . map (| _ | $ crate :: scan_value ! ($ scanner , $ t)) . collect ::< Vec < _ >> () } ; ($ scanner : expr , [$ t : ty ; $ len : expr]) => { $ scanner . scan_vec ::<$ t > ($ len) } ; ($ scanner : expr , [$ t : ty]) => { $ scanner . iter ::<$ t > () } ; ($ scanner : expr , { $ e : expr }) => { $ scanner . mscan ($ e) } ; ($ scanner : expr , $ t : ty) => { $ scanner . scan ::<$ t > () } ; } #[macro_export] macro_rules ! scan { ($ scanner : expr) => { } ; ($ scanner : expr ,) => { } ; ($ scanner : expr , mut $ var : tt : $ t : tt) => { let mut $ var = $ crate :: scan_value ! ($ scanner , $ t) ; } ; ($ scanner : expr , $ var : tt : $ t : tt) => { let $ var = $ crate :: scan_value ! ($ scanner , $ t) ; } ; ($ scanner : expr , mut $ var : tt : $ t : tt , $ ($ rest : tt) *) => { let mut $ var = $ crate :: scan_value ! ($ scanner , $ t) ; scan ! ($ scanner , $ ($ rest) *) } ; ($ scanner : expr , $ var : tt : $ t : tt , $ ($ rest : tt) *) => { let $ var = $ crate :: scan_value ! ($ scanner , $ t) ; scan ! ($ scanner , $ ($ rest) *) } ; ($ scanner : expr , mut $ var : tt) => { let mut $ var = $ crate :: scan_value ! ($ scanner , usize) ; } ; ($ scanner : expr , $ var : tt) => { let $ var = $ crate :: scan_value ! ($ scanner , usize) ; } ; ($ scanner : expr , mut $ var : tt , $ ($ rest : tt) *) => { let mut $ var = $ crate :: scan_value ! ($ scanner , usize) ; scan ! ($ scanner , $ ($ rest) *) } ; ($ scanner : expr , $ var : tt , $ ($ rest : tt) *) => { let $ var = $ crate :: scan_value ! ($ scanner , usize) ; scan ! ($ scanner , $ ($ rest) *) } ; } } pub use marker_impls::{CharWithBase, Chars, CharsWithBase, Collect, SizedCollect, Usize1}; mod marker_impls { use super::*; use std::{ iter::{repeat_with, FromIterator}, marker::PhantomData, }; #[derive(Debug, Copy, Clone)] pub struct Usize1; impl IterScan for Usize1 { type Output = usize; #[inline] fn scan<'a, I: Iterator>(iter: &mut I) -> Option { ::scan(iter)?.checked_sub(1) } } #[derive(Debug, Copy, Clone)] pub struct CharWithBase(pub char); impl MarkedIterScan for CharWithBase { type Output = usize; #[inline] fn mscan<'a, I: Iterator>(self, iter: &mut I) -> Option { Some((::scan(iter)? as u8 - self.0 as u8) as usize) } } #[derive(Debug, Copy, Clone)] pub struct Chars; impl IterScan for Chars { type Output = Vec; #[inline] fn scan<'a, I: Iterator>(iter: &mut I) -> Option { Some(iter.next()?.chars().collect()) } } #[derive(Debug, Copy, Clone)] pub struct CharsWithBase(pub char); impl MarkedIterScan for CharsWithBase { type Output = Vec; #[inline] fn mscan<'a, I: Iterator>(self, iter: &mut I) -> Option { Some( iter.next()? .chars() .map(|c| (c as u8 - self.0 as u8) as usize) .collect(), ) } } #[derive(Debug, Copy, Clone)] pub struct Collect::Output>> where T: IterScan, B: FromIterator<::Output>, { size: usize, _marker: PhantomData (T, B)>, } impl Collect where T: IterScan, B: FromIterator<::Output>, { pub fn new(size: usize) -> Self { Self { size, _marker: PhantomData, } } } impl MarkedIterScan for Collect where T: IterScan, B: FromIterator<::Output>, { type Output = B; #[inline] fn mscan<'a, I: Iterator>(self, iter: &mut I) -> Option { repeat_with(|| ::scan(iter)) .take(self.size) .collect() } } #[derive(Debug, Copy, Clone)] pub struct SizedCollect::Output>> where T: IterScan, B: FromIterator<::Output>, { _marker: PhantomData (T, B)>, } impl IterScan for SizedCollect where T: IterScan, B: FromIterator<::Output>, { type Output = B; #[inline] fn scan<'a, I: Iterator>(iter: &mut I) -> Option { let size = usize::scan(iter)?; repeat_with(|| ::scan(iter)) .take(size) .collect() } } }