Problem:
 Score : 400 points    Problem Statement Takahashi had a pair of two positive integers not exceeding N , (a,b) , which he has forgotten.
He remembers that the remainder of a divided by b was greater than or equal to K .
Find the number of possible pairs that he may have had.      Constraints  1 \leq N \leq 10^5  0 \leq K \leq N-1  All input values are integers.         Input Input is given from Standard Input in the following format:  N  K       Output Print the number of possible pairs that he may have had.        Sample Input 1 5 2      Sample Output 1 7  There are seven possible pairs: (2,3),(5,3),(2,4),(3,4),(2,5),(3,5) and (4,5) .       Sample Input 2 10 0      Sample Output 2 100       Sample Input 3 31415 9265      Sample Output 3 287927211

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heapify,heappop,heappush
import sys,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,k = inpl()
res = 0
if k == 0:
    res = n**2
else:
    for i in range(k+1,n+1):
        res += (i - k)*((n+1) // i)
        t = n % i
        if t == i-1:
            continue
        if t >= k:
            res += t-k+1
print(res)

Solution (Python):
n,k = map(int,input().split())
count = 0
if k==0:
    print(n ** 2)
    exit()

for i in range(1,n+1):
    if i <= k:
        continue
    count += max(0, (n%i) - k + 1)
    count += (n // i) * (i - k)
print(count)

Solution (Python):
n,k=map(int, input().split())  


ans=0
for i in range(1,n+1):
    x=(n+1)//i
    y=(n+1)%i
    ans+=max(x*(i-k),0)+max(y-k,0)

if k==0:
    print(ans-n)
else:
    print(ans)

Solution (Python):
n,k=map(int,input().split())
ans=0
for b in range(1,n+1):
	ans+=n//b*max(b-k,0)
	ans+=max(0,n%b-k+1)
if k==0:
	print(n**2)
	exit()
print(ans)

Solution (Python):
from fractions import gcd

def NK():
    return map(int,input().split())

def main():
    n,k = NK()
    ans = 0
    for i in range(1,n+1):
        ans += (n//i)*max((i-k),0) + max(n%i-max((k-1),0),0)
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
n, k = map(int, input().split())
ans = 0
for i in range(1, n+1):
    ans += (n+1)//i * max(0, i-k)
    ans += max(0, (n+1) % i - k)
print(ans-n if k == 0 else ans)

Solution (Python):
n, k = list(map(int, input().split()))
count = 0

if k == 0:
    print(n ** 2)
    exit()
for i in range(1, n + 1):
    if i <= k:
        continue
    count += max(0, (n % i) - k + 1)
    count += (n // i) * (i - k)
print(count)

Solution (Python):



N,K = map(int,input().split())
ans = 0

for b in range(K+1,N+1):
  cnt = 0
  x_max = N//b
  
  
  cnt += x_max * (b-K)
  
  lower = x_max*b+K
  if lower <= N:
    upper = min((x_max+1)*b-1,N)
    cnt += upper - lower + 1
  ans += cnt


if K == 0:
  ans -= N
  
print(ans)

Solution (Python):

N, K = map(int, input().split())
ans = 0
for b in range(1, N + 1):
    div, mod = divmod(N, b)
    ans += div * max(0, b - K)
    ans += max(mod - K + 1, 0)
if K == 0:
    ans -= N
print(ans)

Solution (Python):
def solve(n, k):
    cnt = 0
    if k == 0:
        return n * n
    for b in range(k + 1, n + 1):
        p = n // b
        r = n % b
        cnt += p * (b - k)
        if r >= k:
            cnt += r - k + 1
    return cnt

n, k = map(int, input().split())
print(solve(int(n), int(k)))

Solution (Python):
n,k=map(int,input().split())

if k==0:
  print(n**2)
else:
  ans=0
  for i in range(1,n+1):
    ans+=max(0,i-k)*(n//i) + max(0,(n%i)-k+1)
  print(ans)

Solution (Python):
N,K=map(int,input().split())

if K==0:
  print(N*N)
else:
    ans=0
    for i in range(K+1,N+1):
        ans+=N//i*max(0,i-K)+max(0,N%i-K+1)
    print(ans)

Solution (Python):
N,K=map(int,input().split())

if K==0:
  print(N*N)
else:
  ans=0
  for i in range(K,N+1):
    ans+=(N//i*max(0,i-K)+max((N%i)+1-K,0))
  print(ans)

Solution (Python):
N, K = map(int, input().split())

if K == 0:
    print(N**2)
    exit()

c = 0 
for b in range(1, N+1):
    c += max(0, b-K)*(N//b) + max(0, (N%b)-K+1)
    

print(c)

Solution (Python):
n,k=map(int,input().split());print(sum(n//i*(i-k)+n%i-min(max(k-1,0),n%i)for i in range(k+1,n+1)))

Solution (Python):
N, K = map(int, input().split())



if K == 0:
    ans = N**2
else:
    ans = 0
    for i in range(1,N-K+1):
        ans += i
        a_start = 2*K+i
        while a_start <= N:
            if a_start+i > N :
                ans += N - a_start +1
            else:
                ans += i
            a_start += K+i
print(ans)

Solution (Python):
import sys


n, k = [int(_) for _ in input().split()]
if k == 0:
    print(n*n)
    sys.exit()
ans = 0
m = n-k
t1 = 0
t2 = 0
t3 = 0
ans += ((m*m - m) // 2) + m
for i in range(k+1, n+1):
    t1 = n-i+1
    t2 = t1 // i
    t3 = t1 % i
    ans += t2 * (i-k)
    if t3 > k:
        ans += t3 - k
print(ans)

Solution (Python):
n,k = map(int,input().split())
s = 0
for b in range(k+1,n+1):s += n//b*(b-k) + max(n%b-max(k-1,0),0)
print(s)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()

ans = 0
for i in range(1, N+1):
	p = N//i
	r = N%i

	ans += p * max(0, i-K) + max(0, r-K+1)

if K == 0:
	ans -= N
print(ans)

Solution (Python):
N,K = [int(x) for x in input().split()]
ans =0
for i in range(K+1,N+1):
  
  ans += (N//i)*(i-K)
  if N%i!=0 and K!=0:
    ans +=max((N%i+1-K),0)
  elif N%i!=0 and K==0:
    ans +=(N%i)
print(ans)

Solution (Python):
n,k=map(int,input().split())
if k==0:
    print(n**2)
    exit()
ans=0
for i in range(k+1,n+1):
    p=n//i
    q=n%i
    ans +=p*max(0,i-k)+max(0,q-k+1)
print(ans)

Solution (Python):
import math 
n,k=map(int,input().split())
if k==0:
    print(n**2)
if k>=1:
    ans=0
    flow=0
    for some in range(k+1,n+1):
        flow=math.floor(n/some)*(some-k)
        ans+=flow
        if  math.floor(n/some)*some+k>n:
            ans=ans
        if math.floor(n/some)*some+k<=n:
            ans=ans+n+1-math.floor(n/some)*some-k

    print(ans)

Solution (Python):
N,K = map(int, input().split())

if K == 0:
    print(N*N)
    exit()


ans = 0
for b in range(K+1,N+1):
    
    num = N // b 
    rest = N - (b*num)
    
    ans += (b - K) * num + max(0, rest-K+1) 


print(ans)

Solution (Python):
N, K = map(int, input().split())

if K == 0:
    print(N**2)
    exit()

ans = 0
for i in range(K+1, N+1):
    if N % i < K:
        temp = 0
    else:
        temp = N % i - K + 1

    ans += N // i * (i - K) + temp

print(ans)

Solution (Python):
N,K = map(int, input().split())

if K == 0:
    ans = N**2
else:
    ans = (N-K) * (N-K+1) // 2
    for b in range(K+1, N+1):
        q = (N-b+1) // b
        r = (N-b+1) % b
        ans += q*(b-K) + max(0, r-K)
        
print(ans)

Solution (Python):
n,k = map(int,input().split())
count = 0
if k == 0:
    print(n**2)
else:
    for i in range(k+1,n+1):
        count += (n//i)*(i-k)+max(n%i-k+1,0)
    print(count)

Solution (Python):
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        for _ in range(num): return []
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list,zip(*read_all))



N,K = II()
ans = 0
for b in range(K+1,N+1):
    i = math.floor((N-K)/b)
    ans += i*(b-K) + min(N-(K+i*b)+1, b-K)

if K==0:
    ans -= N-K

print(ans)

Solution (Python):
import sys
from collections import defaultdict, deque
from functools import reduce
import math

input = sys.stdin.readline


def main():
    N, K = map(int, input().split())
    count = 0
    for b in range(K+1, N+1):
        count += max((b - K), 0) * (N // b) + max(N % b - K + 1, 0)
    if K == 0:
        count = N*N
    print(count)

if __name__ == '__main__':
    main()

Solution (Python):


n, k = map(int, input().split())

cnt = 0
for b in range(1, n + 1):
    q, r = divmod(n + 1, b)
    cnt += q * max(0, b - k) + max(0, r - k)

if k == 0:
    cnt -= n

print(cnt)

Solution (Python):


n, k = map(int, input().split())

if k == 0:
    print(n * n)
    exit()

cnt = 0
for b in range(k + 1, n + 1):
    q, r = divmod(n - k + 1, b)
    cnt += (b - k) * q + min((b - k), r)

print(cnt)

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


n, k = LI()
ans = 0
for b in range(k+1, n+1):
    ans += n // b * (b - k) + max(n % b - k + 1 , 0)



if k:
    print(ans)
else:
    print(n ** 2)

Solution (Python):
n, k = [ int(v) for v in input().split() ]

if k == 0:
    ans = n ** 2
else:
    ans = 0
    for i in range(k+1,n+1):
        j = n - k + 1
        a, b = j // i, j % i
        ans += a * (i-k) + min(b, i-k)
print(ans)

Solution (Python):
N, K = map(int, input().split())

ans = 0
for a in range(1, N + 1):
    r = N % a
    ans += (N // a) * max(a - K, 0) + min(r, max(0, r + 1 - K))
print(ans)

Solution (Python):
n, k = map(int, input().split())
res = (n - k) * (n - k + 1) // 2
for i in range(k + 1, n + 1):
    if i == 1:
        continue
    a, b = divmod(n - i, i)
    res += a * (i - k) + max(b - k + 1, 0)
print(res)

Solution (Python):
N,K=map(int,input().split())
ans=0
for i in range(K+1,N+1):
  ans += (i-K) * (N//i) + (max(0,N%i - max(K-1,0)))
print(ans)

Solution (Python):
N,K = map(int, input().split())

ans = 0

if K != 0:
    for b in range(K+1,N+1):
        ans += (b-K)*(N//b) + max(N%b-K+1, 0)
    print(ans)
else:
    print(N*N)

Solution (Python):
N, K = map(int, input().split())

ret = 0
if K == 0 :
    ret = N * N
else :
    for a in range(1, N + 1) :
        ret += (N // a) * max(0, a - K)
        ret += max(0, N % a - K + 1)
print(ret)

Solution (Python):
n,k=map(int,input().split());print(sum(n//b*(b-k)+max(n%b-k+(k>0),0)for b in range(k+1,n+1)))

Solution (Python):
N, K = map(int, input().split()); res = 0
for i in range(K + 1, N + 1):
  if i == 1:
    res += 1
    continue
  res += (i - K) * (N // i) + max(N % i - K + 1, 0)
print(res)

Solution (Python):

def solve(N, K):
    
    if K == 0:
        return N * N
    cnt = 0
    for b in range(K, N+1):
        q, r = divmod(N, b)
        cnt += max(0, b-K) * q + max(0, r - K + 1)
    return cnt

assert solve(5, 2) == 7
assert solve(10, 0) == 100
N, K = map(int, input().split())
print(solve(N, K))

Solution (Python):
s = 0
N, K = map(int, input().split())
if K == 0:
  print(N*N)
else:
  for b in range(K+1, N+1):
    q = N//b
    r = N%b
    s += q*(b-K)
    if r >= K:
      s += r-K+1
  print(s)

Solution (Python):
def main():
    N, K = map(int, input().split())

    if K == 0:
        return N * N

    count = 0
    for b in range(K+1, N+1):
        count += (N-K+1)//b * (b-K) + min(b-K, (N-K+1) % b)
    return count

if __name__ == '__main__':
    print(main())

Solution (Python):
def main():
    N, K = map(int, input().split())
    
    ans = 0
    for b in range(K+1, N+1):
        p = N // b
        r = N % b
        
        
        ans += p * (b - K) + max(0, r - K + 1)
        if K == 0:
            ans -= 1
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):

def updiv(a,b):

    if a % b == 0:

        return a // b

    else:

        return a // b + 1


N,K = map(int,input().split())
ans = 0

if K == 0:
    print (N ** 2)

else:

    for i in range(N):

        i += 1

        if i < K:
            continue;

        ans += (i - K) * (N // i)

        nk = N - (N // i) * i

        ans += max(0 , nk - (K-1))

    print (ans)

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A():
    s = SR(3)
    for i in range(3):
        print(s[i][i], end="")
    print()
    return


def B():
    a, b = LI()
    ans = 0
    for i in range(a, b + 1):
        x = str(i)
        for k in range(len(x)//2):
            if x[k] != x[-k - 1]:
                break
        else:
            ans += 1
    print(ans)
    return


def C():
    n, m = LI()
    if n == m == 1:
        print(1)
        return
    if n == 1 or m == 1:
        print(max(n - 2, m - 2))
        return
    if n == 2 or m == 2:
        print(0)
        return
    print(n * m - n * 2 - (m - 2) * 2)
    return


def D():
    n, k = LI()
    ans = 0
    if k == 0:
        print(n * n)
        return
    for b in range(k + 1, n + 1):
        tmp1, tmp2 = n // b, n % b
        ans += tmp1 * (b - k) + max(tmp2 - k + 1, 0)
    print(ans)
    return


if __name__ == '__main__':
    D()

Solution (Python):
N , K = map(int , input().split())
ans = 0
if K == 0:
    print(N * N)
    exit(0)
for b in range(1, N + 1):
    ans += int(N / b) * max(0,b - K) + max(N % b - K + 1 ,0)
print(ans)

Solution (Python):
N, K = map(int, input().split())
if K == 0:
  r = N*N
  print(r)
  exit()
r = 0
for b in range(K+1, N+1):
  r0 = r
  r += (N//b)*(b-K)
  r1 = r
  r += max(0, N+1-(N//b*b+K))
  
    
  
  
print(r)

Solution (Python):
n,k = map(int,input().split())
count = 0
flag = False
if k==0:
    flag = True
for i in range(k+1,n+1):
    if n%i >= k:
        count += (i-k)*(n//i) + n%i - k + 1
    else:
        count += (i-k)*(n//i)
if flag:
    print(n*n)
else:
    print(count)

Solution (Python):

def main():
    N, K = tuple(map(int, input().split()))
    if K == 0:
        print(N ** 2)
        return
    ans = 0
    for i in range(K + 1, N + 1):
        ans += N // i * (i - K) + max(0, (N % i) - K + 1)
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
N, K = map(int,input().split())

if K == 0:
  print(N*N)
  exit()

result = 0
for i in range(K+1, N+1):
  loop = int(N/i)
  result += (i-K)*loop
  result += max(N-K-(loop*i)+1,0)

print(result)

Solution (Python):
N, K = map(int, input().split())

if K == 0:
    ans = N ** 2
    print(ans)
    exit()
    
ans = 0
for i in range(K+1, N+1):
    d = N // i
    m = N % i
    ans += (i - K) * d + max(m-K+1, 0)

print(ans)

Solution (Python):
n, k=map(int, input().split())

if k==0:
    ans=n**2
else:
    ans=0
    for i in range(k+1, n+1):
        div=n//i
        mod=n%i
        ans+=div*(i-k)
        ans+=max(0, mod-k+1)
print(ans)

Solution (Python):
n, k = map(int, input().split())

ans = 0

if k == 0:
  print(n**2)
  exit()

for b in range(k+1, n+1):
  c = n//b
  r = n%b
  
  ans += (b-k)*c+max(0, r-k+1)
print(ans)

Solution (Python):
n, k = (int(i) for i in input().split())
cnt = 0
for x in range(k+1, n+1):
    cnt = cnt + int(n / x) * (x - k) + max(int(n % x) - (k - 1), 0)
    
    
if k == 0:
    cnt = cnt - n
print(cnt)

Solution (Python):
import math

def count(n, k, b):
    if k >= b:
        return 0
    n_blocks = math.floor((n+1) / b)
    ans = (b-k) * n_blocks

    remainder = (n+1) - n_blocks * b
    if remainder > k:
        ans += remainder - k

    
    return ans

n, k = map(int, input().split())

if k == 0:
    print(n*n)
    exit(0)

ans = 0
for b in range(1, n+1):
    cnt = count(n, k, b)
    ans += cnt
    
print(ans)

Solution (Python):
n, k = map(int, input().split())

ans = 0
if k == 0:
    ans = n * n
else:
    for b in range(k+1, n+1):
        ans += (n // b) * (b-k)
        ans += max(((n % b) - k + 1), 0)
        

print(ans)

Solution (Python):

import sys, math, fractions, itertools, collections, copy, heapq


def solve(N: int, K: int):
    counter = 0
    for b in range(1, N+1):
        p = N // b
        r = N % b
        counter += p * max(0, b-K)
        counter += max(0, r-K+1)
    if K > 0:
        print(counter)
    else:
        print(counter - N)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    K = int(next(tokens))  
    solve(N, K)

if __name__ == '__main__':
    main()

Solution (Python):
n,k=map(int,input().split())
if k==0:
    print(n*n)
else:
    a=0
    for b in range(n+1):
        if k<b:a+=n//b*(b-k)+max(0,n-n//b*b-k+1)
    print(a)

Solution (Python):
N, K = map(int, input().split())
if K == 0:
    print(N * N)
    exit()
ans = 0
for b in range(K + 1, N + 1):
    p = N // b
    ans += p * max(0,b - K) + max(0, N - p * b - K + 1)
print(ans)

Solution (Python):
N, K = map(int, input().split())
if K == 0:
    print(N * N)
    exit()
ans = 0
for b in range(K + 1, N + 1):
    p = N // b
    ans += p * (b - K) + max(0, N - p * b - K + 1)
print(ans)

Solution (Python):
N,K=map(int,input().split())
ans=0
if K==0:
    print(N*N)
else:
    for b in range(K+1,N+1):
        ans = ans + (b-K)*(N//b) + max((N%b-K+1),0)
    print(ans)

Solution (Python):
N, K = map(int, input().split())

if K == 0:
    print(N * N)
    exit(0)

cnt = 0
for b in range(K + 1, N + 1):
    p = N // b
    r = N % b
    cnt += p * max(0, b - K)
    cnt += max(0, r - K + 1)
print(cnt)

Solution (Python):
n, k = map(int, input().split())

if k == 0:
  print(n * n)
else:
  x = 0
  for b in range(k, n + 1):
    x += (n // b) * (b - k)
    r = n % b
    if r >= k:
      x += r - k + 1
  print(x)

Solution (Python):
N, K = map(int, input().split())

ans = 0

if K == 0:
    print(N*N)
    exit()

for b in range(K+1, N+1):
    max_p = N // b
    max_q = N % b
    if max_q < K:
        max_p -= 1
        max_q = b - 1
    
    ans += max_p * (b-K) + (max_q-K+1)

print(ans)

Solution (Python):
n, k = map(int, input().split())
res = 0
for b in range(k+1, n+1):

    if n%b == 0:
        res += (n//b) * (b-k)

    else:
        res += n//b*(b-k) + max(n%b - k  + 1, 0)
        if k == 0:
            res -= 1

print(res)

Solution (Python):
n,k = map(int,input().split())
ans = 0
for i in range(1,n+1):
    if i-k > 0:
        ans += (n//i)*(i-k) 
        if (n%i) >= k:
            ans += (n%i) - k + 1
if k == 0:
    print(ans-n)
else:
    print(ans)

Solution (Python):
import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque

from itertools import product

from itertools import permutations

from itertools import combinations

from itertools import accumulate
from bisect import bisect_left, bisect_right

import re







def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
 
def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
def line_inpl(x): return [i_inpl() for _ in range(x)]

INF = int(1e18)
MOD = int(1e9)+7 


def create_grid(H, W, value = 0):
    return [[ value for _ in range(W)] for _ in range(H)]


    
def main():
    N, K = l_inpl()

    if K == 0:
        print(N*N)
        return

    ans = 0
    for b in range(1, N+1):
        if b < K:
            continue
        p = N//b
        r = N%b
        ans += max(b-K, 0) * p + max(r-K+1, 0)
    print(ans)
if __name__ == "__main__":
    main()

Solution (Python):
N, K = map(int, input().split())
if K == 0:
    print(N * N)
    exit()
ans = 0
for b in range(K + 1, N + 1):
    p = N // b
    ans += p * (b - K) + max(0, N - p * b - K + 1)
print(ans)

Solution (Python):



def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    n, k = rli()
    if k == 0:
        print(n*n)
        return
    ans = 0
    for b in range(1, n+1):
        if b <= k:
            continue
        ans += (n // b)*(b-k)
        ans += max(0, n%b-k+1)
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):

N,K = map(int,input().split())

ans = 0
for b in range(K+1,N+1):
    tmp = 0
    multi = int(N/b)
    tmp += (b-K) * multi
    if K==0:
        tmp += max(0,N%b)
    else:
        tmp += max(0,(N%b-K+1))
    ans += tmp
print(ans)

Solution (Python):
N, K = map(int, input().split())

if K == 0 :
    ans = N**2
else :
    ans = 0
    for b in range(K+1, N+1) :
        maxQ = N // b
        ans += (b - K) * maxQ
        ans += max(N - K - (maxQ * b) + 1, 0)

print(ans)

Solution (Python):



import sys
import math
import bisect
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
mod = 10**9 + 7


n,k = map(int,input().split())

ans = 0
for i in range(1,n+1):
    p = n//i
    r = n%i
    ans += p*max(0,i-k) + max(0,r-k+1)
if k == 0:
    ans = n**2
print(ans)

Solution (Python):
N,K = map(int,input().split())
ans = sum(N//b*(b-K) + max(0,N%b-K+1) for b in range(K+1,N+1)) if K>0 else N*N
print(ans)

Solution (Python):
N,K = map(int,input().split())
ans = 0
for b in range(K+1,N+1):
    ans += N//b*(b-K) + max(0,N%b-K+1)
if K==0:ans = N*N
print(ans)

Solution (Python):
N,K=map(int,input().split())
def kosuu(n,b,k):
    res = 0
    res += n//b * (b-k)
    diff = n%b - k
    if diff >= 0:
        res += diff + 1
    return res

cnt = 0
for b in range(K+1,N+1):
    ko = kosuu(N,b,K)
    
    cnt += ko

if K == 0:
    cnt -= N

print(cnt)

Solution (Python):
n, k = map(int, raw_input().split())
pb = n - (k + 1)
combi = 0
for b in range(k+1, n+1):
    combi += (n/b)*(b-k)
    if n % b >= k:
        combi += (n%b) - (k-1)
    if k == 0:
        combi -=1
print combi

Solution (Python):
N, K = map(int, input().split())
ans = -N+K if K == 0 else 0
for b in range(K+1, N+1):
    ans += N // b * (b - K) + max(0, N - N // b * b - K + 1)
print(ans)

Solution (Python):
N,K=map(int,input().split())
print(sum([(max((i-K),0)*(N//i)+max(N%i-K+min(K,1),0)) for i in range(1,N+1)]))

Solution (Python):
n,k=map(int,input().split())
if k==0:
    print(n*n)
    exit()
ans=0
for i in range(k+1,n+1):
    ans+=((n+1)//i)*(i-k)+max(0,((n+1)%i-k))
print(ans)

Solution (Python):
n, k = map(int, input().split())
ans = 0
if k == 0:
    print(n ** 2)
    exit(0)
for b in range(1, n + 1):
    ans += n // b * max(b - k, 0) + max(n % b - k + 1, 0)
print(ans)

Solution (Python):
def main():
  n,k=map(int,input().split())
  r=0
  for q in range(n+1):
      if q==0:
          for b in range(1,n+1):r+=max(min(b,k)-1,0)
      else:
          for b in range(1,n//q+1):r+=min(k,n-q*b+1,b)
  print(n*n-r)

if __name__=="__main__":
  main()

Solution (Python):
N,K = map(int,input().split())

ans = 0
for b in range(K+1,N+1):
    m = N//b
    r = N%b
    ans += max(r-K+1,0)+m*(b-K)

if K == 0:
    ans = N**2

print(ans)

Solution (Python):
n,k = map(int,input().split())
ans = 0
if k == 0:
  print(n**2)
else:
  for b in range(k+1,n+1):
    ans += (b-k)*(n//b)+max(((n%b)-k+1),0)
  print(ans)

Solution (Python):
n,k=map(int,input().split())
ans=0
if k==0:
    print(n**2)
else:
    for i in range(k+1,n+1):
        temp=(i-k)*(n//i)
        r=n%i
        if r>=k:
            temp=temp+(r+1-k)
        ans=ans+temp
    print(ans)

Solution (Python):
N, K = list(map(int, input().split()))
ans = 0

for b in range(1, N+1):
	p = N // b
	r = N % b
	
	ans += p * max(0, b-K)
	ans += max(0, r-K+1)
	
print(ans-N*(not K))

Solution (Python):
n, k = map(int, input().split())

if k == 0:
  print(n**2)
  exit()

ans  = 0

for b in range(1,n+1):

  
  if b - k > 0:
    ans += (n // b) * (b-k)
    
  
  if ((n - (n // b)*b) - (k-1)) > 0:
    ans += ((n - (n // b)*b) - (k-1))


  
  
print(ans)

Solution (Python):
n,k=map(int,input().split())
if k==0:
  print(n*n)
else:
  ct=0
  for i in range(1,n-k+1):
    ct+=i
  for j in range(k+1,n):
    ct+=((n-j)//j)*(j-k)
    ct+=max(0,(n-j)%j-k+1)
  print(ct)

Solution (Python):
N, K = map(int, input().split())

if K == 0:
  print(N ** 2)
  exit()

ans = 0
for b in range(K+1, N+1): 
  var1 = b-1 - K + 1
  Nmodb = N // b
  if N < K + Nmodb * b:
    var2 = 0
  else:
    var2 = N - (K+Nmodb*b) + 1
  ans += var1 * Nmodb + var2
  
  
print(ans)

Solution (Python):
n, k = map(int, input().split())
ans = 0
if k == 0:
    ans = n ** 2
else:
    for b in range(k + 1, n):
        p = n // b
        r = n % b
        ans += p * max(0, b - k) + max(0, r - k + 1)
    ans += n - k
print(ans)

Solution (Python):
N, K = map(int, input().split())

ans = 0
for b in range(1, N+1): 
    amari = max(b-K, 0)
    count = N // b
    
    
    ans += count * amari + max(N%b - K + 1, 0)

if K == 0:
    ans -= N
print (ans)

Solution (Python):
N,K=map(int,input().split())
ans=0
if K==0:
    print(N**2)
    quit()
for b in range(K+1,N+1):
    if N%b==0:
        ans+=(b-K)*(N//b)
    else:
        ans+=(b-K)*(N//b)+max(0,(N%b-(K-1)))
print(ans)

Solution (Python):
N, K = map(int, input().split())
ans = 0
for b in range(K+1, N+1):
    k = b-K
    n = int((N+1)/b)
    ans += k*n
    k2 = N%b
    if k2 >= K and (k2+1)%b != 0:
        ans += k2-K+1
if K == 0:
    ans -= N
print(ans)

Solution (Python):
n, k = map(int, input().split())

if k != 0:
    counter = 0
    for b in range(k+1, n+1):
        counter += (n // b) * (b - k) + (n % b) - min(n % b, k - 1)
    print(counter)
else:
    print(n ** 2)

Solution (Python):

import sys


def solve(N: int, K: int):
    ret = 0
    if K == 0:
        ret = N * N
    else:
        for k in range(K + 1, N + 1):
            tmp = N // k
            mod = N % k
            ret += tmp * (k - K)
            ret += max(0, mod - K + 1)
            
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    K = int(next(tokens))  
    solve(N, K)

if __name__ == '__main__':
    main()

Solution (Python):
N, K = map(int, input().split())

ans = 0
N += 1

for b in range(K+1, N):
    max_x = N // b
    ans += max_x * (b - K) + max(N-b*max_x-K, 0)
    if K == 0:
        ans -= 1
print(ans)

Solution (Python):


from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    if y > x // 2:
        y = x - y

    ret = 1

    for i in range(0, y):
        j = x - i
        i = i + 1

        ret = ret * j
        ret = ret // i

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


class UnionFind:

    def __init__(self, n):
        self.parent = [i for i in range(n)]

    def root(self, i):
        if self.parent[i] == i:
            return i
        self.parent[i] = self.root(self.parent[i])
        return self.parent[i]

    def unite(self, i, j):
        rooti = self.root(i)
        rootj = self.root(j)
        if rooti == rootj:
            return
        if rooti < rootj:
            self.parent[rootj] = rooti
        else:
            self.parent[rooti] = rootj

    def same(self, i, j):
        return self.root(i) == self.root(j)





def main():
    n, k = intin()

    ans = 0

    for b in range(k + 1, n + 1):
        ans += (b - k) * (n // b)
        ans += max(n % b - max(k, 1) + 1, 0)

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
N, K = map(int, input().split())

if K == 0:
    print(N**2)
    quit()
    
ans = 0
for b in range(1, N+1):
    p = N // b
    r = N % b
    ans += p * max(0, b-K) + max(0, r-K+1)

print(ans)