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 C++ (GCC 9.2.1) (judge verdict: Runtime Error)

/// You just can't beat the person who never gives up
/// ICPC next year

///#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
///#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include<bits/stdc++.h>
using namespace std ;
const int N = 2e5+5 ,M = 1e2+5 ,mod = 1e9+7 ;

int n ,k ,to[N] ;
vector<pair<int,int>> val_cnt ;
void init(){
    int i = 1 ;
    while(i<=n){
        int st = i ,en = n ;
        while(st<en){
            int mid = (st+en+1)/2 ;
            if(n/mid == n/i) st = mid ;
            else en = mid-1 ;
        }
        val_cnt.push_back({st,st-i+1});
        i = st+1 ;
    }
    sort(val_cnt.begin(),val_cnt.end());
    for(i=0;i<val_cnt.size();++i){
        int st = 0 ,en = val_cnt.size()-1 ;
        while(st<en){
            int mid = (st+en+1)/2 ;
            if(1ll * val_cnt[i].first * val_cnt[mid].first <= n) st = mid ;
            else en = mid-1 ;
        }
        to[i] = st ;
    }
}
int mem[M][N] ;
int solve(int i,int cur){
    if(cur<0) return 0;
    int&ret = mem[i][cur] ;
    if(~ret) return ret ;
    ret = solve(i,cur-1) ;
    if(i+1==k) return ret = (ret + val_cnt[cur].second)%mod ;
    return ret = (ret + 1ll * val_cnt[cur].second * solve(i+1,to[cur])%mod)%mod ;
}
bool Never_give_up(){
    cin >> n >> k ;
    init() ;
    memset(mem,-1,sizeof mem);
    cout << solve(0,val_cnt.size()-1) ;
    return 0;
}
int main(){
#ifndef ONLINE_JUDGE
    freopen("input.txt" ,"r" ,stdin);
    freopen("output.txt" ,"w" ,stdout);
#endif
    std::ios::sync_with_stdio(0);
    cin.tie(0) ,cout.tie(0);
    int t = 1 ;
    //cin >> t ;
    while(t--){
        Never_give_up();
    }
    return 0;
}