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 5.4.1) (judge verdict: Accepted)

#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
#include <assert.h>
typedef int64_t ll;
typedef uint64_t ull;
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)

#define MAXN (1000000000)
#define MOD (1000000007)

ll d[100000];
ll dn[100000];
ll dp[100][100000];
int main(void)
{
    ll n,k;
    scanf("%ld %ld",&n,&k);
    ll dc=1;
    d[0]=1;
    while((n/d[dc-1])!=1)
    {
        d[dc] = (n/(n/d[dc-1]))+1;
        dc++;
    }
    for(int i=0;i<dc-1;i++) dn[i] = d[i+1]-d[i];
    dn[dc-1] = n-d[dc-1]+1;
    for(int i=0;i<dc;i++) dp[0][i] = dn[i];

    for(int i=1;i<k;i++)
    {
        ll s = 0;
        for(int j=dc-1;j>=0;j--)
        {
            s = (s+dp[i-1][(dc-1)-j])%MOD;
            dp[i][j] = s * dn[j] %MOD;
        }
    }
    ll ans=0;
    for(int i=0;i<dc;i++) ans= (ans +dp[k-1][i])%MOD;
    printf("%ld\n",ans);

    return 0;
}