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):

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

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)
        r = N % b
        if K <= r < b:
            ans += max(0, r-K+1)
print(ans)

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

ans = 0

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

print(ans)

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

ans = 0

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

print(ans)

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

ans = 0

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

print(ans)

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

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

Solution (Python):



def main():
    n, k = map(int, input().split())
    ans = 0

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

    for i in range(k + 1, n + 1):
        p, q = divmod(n, i)
        ans += p * (i - k)
        ans += max(q - k + 1, 0)

    print(ans)


if __name__ == '__main__':
    main()

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

sub = 0
for i in range(1, n+1):
    s = n//i
    sub += s*(min(i, k))
    sub += min(n%i, max(0, k-1))
print(n**2 - sub)

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

if K == 0:
    print(N**2)
    exit()
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)

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

if K == 0:
    print(N**2)
else:
    def Mods(i, N, K): 
        lim = N//i
        pattern = i - K
        total = lim * pattern
        if N - i * lim < K:
            return total
        else:
            extra = N - i * lim - K + 1
            return total + extra

    for i in range(K+1, N+1):
        Ans += Mods(i, N, K)
    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 ** 2
print(ans)

Solution (Python):
import sys
N, K = [int(i) for i in input().split()]

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

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

Solution (Python):

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

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

print(ans)

Solution (Python):
def big(a,b):
    if a >= b:
        return a
    else:
        return b

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

b = 1
while b <= n:
    p = n//b
    ans += p*big(0,b-k)
    r = n%b
    ans += big(0,r-k+1)
    b += 1

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

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

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

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

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

print(ans)

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



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

Solution (Python):

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

for i in range(k+1,n+1):
    jkl = ass
    ass += (i-1)-k+1
    w = (n-(i-1))//i
    if w >= 1:
        ass += ((i-1)-k+1)*w
    r = n-(w+1)*i
    if r >= k:
        ass += r-k+1
    
if k ==0:
    print(n**2)
else:
    print(ass)

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

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

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

    cnt = 0
    for b in range(k+1, n+1):
        p = n // b + 1
        cnt += p * (b-k)

        if p * b > n + 1:
            cnt -= p * b - max((p-1)*b+k, n+1)

        if k == 0:
            cnt -= 1

    print(cnt)


if __name__ == '__main__':
    main()

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

    cnt = 0
    for b in range(k+1, n+1):
        p = (n-k) // b + 1
        cnt += p * (b-k)

        if p * b > n + 1:
            cnt -= p * b - n - 1

        if k == 0:
            cnt -= 1

    print(cnt)


if __name__ == '__main__':
    main()

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

ans = 0

if k == 0 :
	print n*n

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

	print ans

Solution (Python):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

ans = 0
N, K = getNM()
for i in range(N):
    b = i + 1
    if b > K:
        set = N // b
        ans += set*(b-K)
        rem = N % b
        if K == 0:
            ans -=1
        ans += max(rem-K+1,0)
print(ans)

Solution (Python):
N, K = list(map(int,input().split()))
ans = 0
for i in range(K+1,N+1):
    ans +=  (i- K) * (N // i) + max( N % i,K -1) - max((K - 1),0)
    
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):
    d,m = divmod(N,b)
    ans += d*(b-K) + max(0,m+1-K)
print(ans)

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

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

count = 0
for bi in range(K+1, N+1):
    count += (bi - K) * (N // bi) + max(0, N % bi - K + 1)
print(count)

Solution (Python):

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

Solution (Python):


def main():
    n, k = map(int, input().split())
    cnt = 0
    for b in range(k + 1, n + 1):
        cnt += count_a(n, k, b)
    print(cnt)

def count_a(n, k, b):
    assert b > k
    fulls = (n + 1) // b
    rest = (n + 1) % b
    cnt = fulls * (b - k)
    cnt += max(0, rest - k)
    if k == 0:
        cnt -= 1
    return cnt

main()

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):
		div = n // i
		ans += (i - k) * div
		if n % i != 0:
			ans += max(n + 1 - ((n // i) * i + k), 0)

	print(ans)

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

Solution (Python):


import sys,collections,itertools,re,math,fractions,decimal,random,array,bisect,heapq





def solve(f):
    n, k = f.read_int_list()
    if k == 0: return n**2
    ans = 0
    for b in xrange(k+1, n+1):
        ans += (n/b)*(b-k)+max(0,n-((n/b)*b+k)+1)
    return ans


class Reader(object):
    def __init__(self, filename=None):
        self.file = open(filename) if filename is not None else None
        self.case = 1

    def __readline(self):
        return self.file.next().strip() if self.file else raw_input()

    def next_case(self):
        self.file.next()
        self.case += 1

    def read_int(self): return int(self.__readline())
    def read_float(self): return float(self.__readline())
    def read_long(self): return long(self.__readline())
    def read_decimal(self): return decimal.Decimal(self.__readline())
    def read_str(self): return self.__readline()

    def read_int_list(self): return map(int, self.__readline().split())
    def read_float_list(self): return map(float, self.__readline().split())
    def read_long_list(self): return map(long, self.__readline().split())
    def read_decimal_list(self): return map(decimal.Decimal, self.__readline().split())
    def read_str_list(self): return self.__readline().split()

if __name__ == '__main__':
    filename = sys.argv[1] if len(sys.argv) > 1 else None
    f = Reader(filename)
    if f.file:
        while True:
            print "Case 
            try:
                f.next_case()
            except StopIteration:
                break
    else:
        print solve(f)

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

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

Solution (Python):

def inpl(): return map(int, input().split())
N, K = inpl()

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

ans = 0
for b in range(K+1, N+1):
    d, m = divmod(N, b)
    ans += d*(b-K)
    ans += max(0, m+1-K)

print(ans)

Solution (Python):
N,K = map(int,input().split())
if K == 0:
    print(N*N)
    exit()

ans = 0
for b in range(1,N+1):
    cycle,rem = divmod(N,b)
    ans += cycle * max(0, b-K)
    ans += max(0, rem+1 - K)
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):
    ans += (b-k)*(n//b) + max(0, n%b - k+1)
print(ans)

Solution (Python):
N, K = map(int, input().split())
ans = 0
if K == 0:
    ans = N**2
else:
    for b in range(1, N+1):
        p, r = N // b, N % b
        ans += p*max(0, b-K) + max(0, r-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(1, N+1):
    block_K = max(0, b-K)
    
    ans += block_K * ((N+1)//b) + max(0, (N+1)%b - K)

print(ans)

Solution (Python):
import sys

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

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

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


print ans

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

answer = 0

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

print(answer)

Solution (Python):
import math, string, fractions, heapq, re, array, bisect, sys, random, time, copy
import itertools as it
import collections as cl
import functools as ft


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

n, k = LI()

counts = 0
for b in range(1, n+1):
    p, r = divmod(n, b)
    counts += max(0, p*(b-k)) + max(0, r-k+1)
    if k == 0:
        counts -= 1

    

print(counts)

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

retSum = 0
for b in range(K+1, N+1):
    q = N // b
    r = N - q * b
    if r >= K and r != 0:
        if r == K: retSum += 1
        else:
            if K == 0: retSum += r - K
            else: retSum += r - K + 1
    retSum += q * (b - K)
print(retSum)

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

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

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

print(result)

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):
        p, r = n // b, n % b
        ans += p * max(0, b - k) + max(0, r - k + 1)
print(ans)

Solution (Python):
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

(N, K) = reads()

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

Solution (Python):
def solve(N, K):
    if K==0:
        return N*N
    ans = 0
    for b in range(K+1, N+1):
        ans += (N//b) * (b-K) + max(0, (N%b) - (K-1))
    return ans

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

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

ans = 0

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

print(ans)

Solution (Python):
import sys

N,K = map(int, input().split())
res = 0
if K==0:
    print(N*N)
    sys.exit(0)
for i in range(N):
    i += 1
    if i-K<=0:
        continue
    amari = N % i
    amari = amari - K + 1
    re = N // i
    if amari <= 0:
        amari = 0
    res += re*(i-K) + amari
print(res)

Solution (Python):
def calc(N, K):
    if K == 0:
        return N**2
    result = 0
    for b in range(K + 1, N + 1):
        n, m = divmod(N, b)
        result += (b - K) * n
        if m >= K:
            result += m - K + 1
    return result

N, K = [int(_) for _ in input().split()]
print(calc(N, K))

Solution (Python):
def calc0(N, K):
    r = 0
    for a in range(1, N + 1):
        for b in range(1, N + 1):
            if a % b >= K:
                print(a, b, a % b)
                r += 1
    return r

def calc1(N, K):
    result = 0
    for i in range(K, N):
        for x in range(i + 1, N + 1):
            if i > 0:
                r = (N + x - i) // x
            else:
                r = (N + x - i) // x - 1
            
            result += r
    return result

def calc2(N, K):
    if K == 0:
        return N**2
    result = 0
    for x in range(1, N + 1):
        for i in range(K, min(N, x)):
            r = (N - i) // x + 1
            result += r
    return result

def calc2(N, K):
    if K == 0:
        return N**2
    result = 0
    for x in range(1, N + 1):
        for i in range(K, min(N, x)):
            r = (N - i) // x + 1
            result += r
    return result

def calc3(N, K):
    if K == 0:
        return N**2
    result = 0
    for x in range(1, N + 1):
        st = N - min(N, x) + 1
        ed = N - K
        if (ed < x):
            r = (ed - st + 1)
        else:
            r = 0
            for j in range(st, ed + 1):
                r += j // x + 1
        print(st, ed, x, r)
        result += r
    return result

def calc(N, K):
    if K == 0:
        return N**2
    result = 0
    for b in range(1, N + 1):
        if b <= K:
            continue
        n, m = divmod(N, b)
        r1 = (b - K) * n
        r2 = 0
        if m >= K:
            r2 = m - K + 1
        result += r1 + r2
    return result

N, K = [int(_) for _ in input().split()]

print(calc(N, K))

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

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

Solution (Python):
import sys
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, K] = [int(input_raw[0]), int(input_raw[1])]
    S = 0
    for b in range(K + 1, N + 1):
        i_max = (N - K)/b
        t = max((i_max * b + (b - 1)) - N, 0)
        S += (((N - K)/b) + 1) * (b-K) - t
    if K == 0:
        S -= N
    print S

if __name__ == '__main__':
    main()

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

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

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

ans = 0
for b in range(K+1,N+1):
	
	

	k = ((N - K) // b)
	num = min(((N - K) % b) + 1,b-K)
	other = (b - K) - num

	ans += ((b - K) * (k + 1) - other)
	

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

Solution (Python):
import sys
n, k = map(int, raw_input().split())
c = 0
if k == 0:
    print n**2
    sys.exit()
for x in xrange(k+1, n+1):
    c += len(xrange(k, x))
    c += ((n-x)/x)*(x-k)
    if (n-x)%x-k+1 > 0:
        c += (n-x)%x-k+1
print c

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

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

if __name__ == "__main__":
    solve()

Solution (Python):
if __name__ == '__main__':
    N, K = list(map(int, input().split(' ')))

    if K != 0:
        counter = 0
        for b in range(K+1, N+1):
            counter += (b - K) * ((N+1) // b)
            if N - ((N+1) // b) * b + 1>= K:
                counter += N - ((N+1) // b) * b - K + 1

        print(counter)
    else:
        print(N**2)

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

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

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

else:
    for i in range(N):
        row=N-i
        if row <= K or row ==0:
            break
        out += (N-i-K) * int(N/row)
        if N%row >= K:
            out+=N%row-K+1

    print(out)

Solution (Python):
num = map(int,raw_input().split())
n = num[0]
k = num[1]

tot = 0

for i in range(n - k):
    s = n / (k + i + 1)
    t = n % (k + i + 1) - k + 1
    if t < 0:
        t = 0
    tot += s * (i + 1) + t

if k == 0:
    tot -= n 
    
print tot

Solution (Python):

def solve1():
    n, k = map(int, input().split())

    ans = 0
    for i in range(1, n+1):
        for j in range(1, n+1):
            if i % j >= k:
                ans += 1
    print(ans)


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

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

    
    
    
    ans = 0
    for b in range(k+1, n+1):
        n_iter = (n+1)//b
        amari = (n+1) % b

        
        ans += n_iter * (b-k)
        ans += max(0, amari-k)

    
    

    print(ans)

solve()

Solution (Python):
import numpy as np

n, k = map(int, input().split())
ans = 0
for m in range(k, n):
    nm = n - m
    sb = m + 1
    s = nm // sb
    p = s + 1 if m else s
    ps = sb
    for d in range(s, 0, -1):
        ds = nm // d + 1
        co = ds - ps
        ans += co * p
        ps = ds
        p -= 1
    ans += n + 1 - ps

    
    
    
    
    
    
    
print(ans)

Solution (Python):

import math


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

    if K == 0:
        return N * N

    ans = 0
    for n in range(1, N + 1):
        if n <= K:
            pass
        else:
            ans += (N // n) * (n - K)
            ans += (N % n) - K + 1 if (N % n) - K + 1 > 0 else 0

    return ans


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

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

Solution (Python):
import sys
import random

def rd():
        return sys.stdin.readline().rstrip()

def rdi():
        return [ int(x) for x in rd().split() ]

N, K = rdi()





s = 0
for b in range(K+1, N+1):
        an = 0
        j = N / b
        an = j * (b - K)
        
        if N % b > 0:
                x1 = j * b + K
                if K == 0:
                        x1 += 1
                x2 = min(N, (j+1) * b - 1)
                
                if x2 >= x1:
                        an += (x2 - x1 + 1)
        s += an
        
print s

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):
    ans += (N // b) * (b - 1 - K + 1)
    ans += max(N % b + 1 - K, 0)

print(ans)

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:
    continue
  ans += (N // b) * (b - K)
  ans += max(0, N % b - K + 1)

print(ans)

Solution (Python):

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

ans = 0

i = K + 1

if K == 0:
    ans = N * N
else:
    while i <= N:
        div = N // i
        ans += max(N % i - K + 1, 0)
        ans += div * (i - K)
        i += 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):
    ans += ((N+1)//b) * (b-K) + max(0, (N+1)%b - K)
print(ans)

Solution (Python):


N,K=[int(i) for i in input().split()]

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

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

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


if __name__ == '__main__':
    main()

Solution (Python):
def f(b, K, N):
    i = N // b
    ans = N - ((K-1) + (i - 1) * K + min((N%b) + 1, K))
    return ans

N, K = map(int, input().split(' '))
if K == 0:
    ans = int(N * N)
    print(ans)
else:
    ans = 0
    for b in range(K+1, N+1):
        ans += f(b, K, N)
    print(ans)

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

Solution (Python):
l = input().split(" ")
N = int(l[0])
K = int(l[1])
ts = 0
for b in range(K + 1, N + 1):
  ts += (N // b) * (b - K) \
      + max(0, N % b - K + 1)
  if K == 0:
    ts -= 1
print(ts)

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

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,k = LI()
    if k == 0:
        return n*n
    r = 0
    for b in range(k+1,n+1):
        t = b - k
        u = n // b
        a = t * u
        a += max(0, n - (u * b + k - 1))
        r += a

    return r


print(main())