Problem:
Score : 600 points

Problem Statement

Find the number of sequences of length K consisting of positive integers such that the product of any two adjacent elements is at most N, modulo 10^9+7.

Constraints

1\leq N\leq 10^9

1 2\leq K\leq 100 (fixed at 21:33 JST)

N and K are integers.

Input

Input is given from Standard Input in the following format:

N K

Output

Print the number of sequences, modulo 10^9+7.

Sample Input 1

3 2

Sample Output 1

5

(1,1), (1,2), (1,3), (2,1), and (3,1) satisfy the condition.

Sample Input 2

10 3

Sample Output 2

147

Sample Input 3

314159265 35

Sample Output 3

457397712

Solution in Rust (1.15.1) (judge verdict: Accepted)

#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<i64>();
    let (n, k) = (v[0], v[1]);
    let big_int: i64 = 1000_000_000 + 7;

    let mut divides = vec![];
    for i in 1..(n as f64).sqrt().floor() as i64 + 1 {
        divides.push(i);
        divides.push(n / i);
    }
    let divides = divides.into_iter().collect::<BTreeSet<_>>();
    let divides = divides.into_iter().collect::<Vec<_>>();
    let mut spans = vec![1]; // spans[0] == 1
    for i in 1..divides.len() {
        spans.push(divides[i] - divides[i - 1]);
    }

    let mut dp = vec![0i64; divides.len()];
    dp[0] = 1;
    for _ in 0..k {
        let mut dp_sum = vec![0; divides.len()];
        dp_sum[0] = dp[0];
        for i in 1..divides.len() {
            dp_sum[i] = dp_sum[i - 1] + dp[i];
            dp_sum[i] %= big_int;
        }

        let mut next = vec![0i64; divides.len()];
        for i in 0..divides.len() {
            next[i] = dp_sum[divides.len() - 1 - i] * spans[i];
            next[i] %= big_int;
        }
        dp = next;
        // debug!(dp);
    }
    let mut ans = 0i64;
    for elem in dp {
        ans += elem;
        ans %= big_int;
    }
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}