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 Python (3.4.3) (judge verdict: Time Limit Exceeded)

import sys

def solve():
    N, K = map(int, input().split())
    mod = 7 + 10 ** 9
    lim = 0
    for i in range(1, 10 ** 5):
        if i ** 2 > N:
            lim = i - 1
            break
    
    large = [0] * (lim + 1)
    for i in range(1, lim): large[i] = (N // i) - (N // (i + 1))
    large[lim] = N // lim - lim
   
    
    DP = [[0 for j in range(lim + 1)] for i in range(K)] #x <= lim
    DP[0] = [1] * (lim + 1)

    DPlarge = [[0 for j in range(lim + 1)] for i in range(K)] #x >= lim
    for i in range(1, lim+1): DPlarge[0][i] = large[i]

    for k in range(K-1):
        for i in range(1, lim + 1):
            for t in range(1, i + 1):
                DP[k+1][t] += DPlarge[k][i]
                DP[k+1][t] %= mod
                DP[k+1][t] += DP[k][i]
                DP[k+1][t] %= mod
            
            DPlarge[k+1][i] += (DP[k][i] * large[i]) % mod
            DPlarge[k+1][i] %= mod

            for t in range(i + 1, lim + 1):
                DPlarge[k+1][t] += (DP[k][i] * large[t]) % mod 
                DPlarge[k+1][t] %= mod
                DP[k+1][t] += DP[k][i]
                DP[k+1][t] %= mod
                

    ans = 0
    for i in range(1, lim+1):
        ans += (DP[K-1][i] + DPlarge[K-1][i]) % mod
        ans %= mod

    print(ans)
    #print(DP)
    #print(DPlarge)

    
    return 0

if __name__ == "__main__":
    solve()