#include #define REP_(i, a_, b_, a, b, ...) \ for (int i = (a), END_##i = (b); i < END_##i; ++i) #define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__) #define ALL(x) std::begin(x), std::end(x) using i64 = long long; #include using Int = boost::multiprecision::checked_int128_t; // using i256 = boost::multiprecision::int256_t; // using i512 = boost::multiprecision::int512_t; // using i1024 = boost::multiprecision::int1024_t; // using Int = boost::multiprecision::cpp_int; template inline bool chmax(T &a, U b) { return a < b and ((a = std::move(b)), true); } template inline bool chmin(T &a, U b) { return a > b and ((a = std::move(b)), true); } template inline int ssize(const T &a) { return (int)std::size(a); } template std::istream &operator>>(std::istream &is, std::vector &a) { for (auto &x : a) is >> x; return is; } template std::ostream &operator<<(std::ostream &os, const std::pair &a) { return os << "(" << a.first << ", " << a.second << ")"; } template std::ostream &print_seq(const Container &a, std::string_view sep = " ", std::string_view ends = "\n", std::ostream &os = std::cout) { auto b = std::begin(a), e = std::end(a); for (auto it = std::begin(a); it != e; ++it) { if (it != b) os << sep; os << *it; } return os << ends; } template struct is_iterable : std::false_type {}; template struct is_iterable())), decltype(std::end(std::declval()))>> : std::true_type {}; template ::value && !std::is_same::value && !std::is_same::value>> std::ostream &operator<<(std::ostream &os, const T &a) { return print_seq(a, ", ", "", (os << "{")) << "}"; } #ifdef ENABLE_DEBUG #include "debug_dump.hpp" #else #define DUMP(...) #endif using namespace std; #include template using gp_hash_table = __gnu_pbds::gp_hash_table< K, V, std::hash, std::equal_to, __gnu_pbds::direct_mask_range_hashing, __gnu_pbds::linear_probe_fn<>, __gnu_pbds::hash_standard_resize_policy< __gnu_pbds::hash_exponential_size_policy<>, __gnu_pbds::hash_load_check_resize_trigger, true>>; std::mt19937_64 &PRNG() { static std::random_device seed_gen; static std::mt19937_64 engine(seed_gen()); // non-deterministic return engine; } auto solve() { i64 n, K; cin >> n >> K; vector va, vb; REP(i, 1, n + 1) { va.push_back(i); } std::shuffle(va.begin(), va.end(), PRNG()); REP(i, n / 2) { vb.push_back(va.back()); va.pop_back(); } sort(ALL(va), greater{}); sort(ALL(vb), greater{}); auto f = [&](auto &f, const vector &v, int i, i64 acc, unordered_map &mp) -> void { const int m = ssize(v); if (i == m) { return; } f(f, v, i + 1, acc, mp); acc *= v[i]; if (acc <= K) { ++mp[acc]; f(f, v, i + 1, acc, mp); } }; unordered_map ma, mb; ma.reserve(1 << 20); ma.max_load_factor(0.25); mb.reserve(1 << 20); mb.max_load_factor(0.25); // ma.resize(1000000); // mb.resize(1000000); ma[1] = 1; mb[1] = 1; f(f, va, 0, 1, ma); f(f, vb, 0, 1, mb); DUMP(ma); DUMP(mb); cerr << "ma:" << ssize(ma) << " mb:" << ssize(mb) << endl; vector> ca(ssize(ma) + 1), cb(ssize(mb)); { int i = 0; for (auto [k, v] : ma) { ++i; ca[i] = {k, v}; // ca[i].second += ca[i - 1].second; } sort(ALL(ca)); REP(j, 1, ssize(ca)) { ca[j].second += ca[j - 1].second; } i = 0; for (auto [k, v] : mb) { cb[i] = {k, v}; ++i; // cb[i].second += cb[i - 1].second; } sort(ALL(cb), greater{}); } ca.emplace_back(K + 1, 0); DUMP(ca); DUMP(cb); i64 ans = 0; { int i = 1; for (const auto &[x2, k2] : cb) { while (i < ssize(ca) and ca[i].first * x2 <= K) { ++i; } ans += k2 * ca[i - 1].second; DUMP(x2, k2, ca[i - 1].second, ans); } } return ans - 1; } int main() { ios_base::sync_with_stdio(false), cin.tie(nullptr); cout << solve() << "\n"; }