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):
def main():
    N, K = map(int, input().split())
    count = 0
    if K == 0:
        return N**2

    for b in range(K+1, N+1):
        cc = N//b
        count += cc * (b-K)
        dd = N-cc*b
        if dd >= K:
            count += dd - K + 1

    return count

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

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

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

Solution (Python):
N, K = map(int, input().split())
if K==0:
    print(N*N)
    exit()
b = K+1
cnt = 0
while b<=N:
    cnt += (N//b)*(b-K)+max(N%b-K+1, 0)
    b += 1
print(cnt)

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

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

print(m())

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

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


def count_a(b, N, K):
    p = int((N + 1) / b)
    r = (N + 1) % b
    return (b - K) * p + max(0, r - K)


count = 0

for b in range(K + 1, N + 1):
    count += count_a(b, N, K)
    if K == 0:
        count -= 1
print(count)

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

Solution (Python):
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)

Solution (Python):



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

count = 0
for b in range(1, N+1):
  if b-K <= 0: continue
  x = N // b
  count += (b-K) * x

  if N%b > 0 and N%b >= K:
    if K == 0:
      count += N%b
      continue
    count += N%b-K+1

print(count)

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

ans=0

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

print(ans)

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

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

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

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

Solution (Python):
n,k = map(int, raw_input().split())
c = 0
for d in range(k+1,n+1):
    p = (n - k) / d
    c += (p+1) * (d-k)
    c -= max(0, (p+1) * d - 1 - n)
    if k == 0: c -= 1
print c

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

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

print(counter)

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

count = 0

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

print(count)

Solution (Python):
def solve(n, k):
    if k == 0:
        return n**2
    ans = 0
    for b in range(k+1, n+1):
        m = (n-k) / b
        if (m+1)*b <= n:
            ans += (m+1)*(b-k)
        else:
            ans += m*(b-k) + n - m*b - k + 1
    return ans
n, k = map(int, raw_input().split())
print solve(n, k)

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

ct=(N-K)*(N-K+1)//2
if K==0:
    ct-=N

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

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

res = 0

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

print(res)

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

Solution (Python):
tmp = list(map(int,input().split()))
n, k = tmp[0],tmp[1]
if k == 0:
  print(n**2)
  quit()
ans = 0
for i in range(k+1,n+1):
  t = n // i
  ans += (i-k) * t
  l = n - t * i - k
  if l >= 0:
    ans += (l + 1)
print(ans)

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


if k==0:
    print(n**2)
else:
    for b in range(k+1,n+1):
        amari=n%b
        if amari>=k and amari<b:
            result+=(amari-k+1)*((n//b)+1)+(b-amari-1)*((n//b))
        elif amari>=k:
            result+=(b-k)*((n//b)+1)
        else:
            result+=(b-k)*((n//b))
    print(result)

Solution (Python):
K = input().split()
N = int(K[0])
K = int(K[1])

count = 0
for b in range(K+1, N+1):
    siki1 = int((N-K)/b)
    siki2 = int((N-b+1)/b)
    if siki1 <= siki2:
        count += (b-K)*siki1
    elif siki1 > siki2:
        count += (b-K)*siki1
        count -= (b-N-1)*(siki1 - siki2)
        count -= b*(int((siki1*(siki1+1))/2) - int((siki2*(siki2+1))/2))

if K != 0:
    for a in range(K, N+1):
        count += N-a
if K == 0:
        for a in range(1, N+1):
            count += N-a

print(count)

Solution (Python):


def calc(N, K):
    
    
    ans = (N - K + 1) *(N - K)//2

    
    
    
    ik = N//2 + 1
    while ik >= K and ik != 0:
        x = (N - ik - 1) // ik
        while x > 0:
            tmp = ((N - ik) // x) - ik


            if tmp > 0:
                ans = ans + tmp
            x = x - 1
        ik = ik - 1
    if K == 0:
        i = 2
        while i <= N:
            ans = ans + N // i
            i = i + 1
    return ans


def main():
    N, K = map(int, raw_input().split())
    ans = calc(N,K)
    print(ans)

main()

Solution (Python):
n,k = 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) + max(0,r-k+1)
if k == 0:ans -= n
print(ans)

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

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

Solution (Python):
def max(a,b):
    if a > b:
        return a
    else:
        return b
n, k = [int(i) for i in input().split()]
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)
if k == 0:
    ans -= n
    
print(ans)

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

count = 0

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

if k == 0:
    count -= n

print(count)

Solution (Python):
def count_k_or_more(b, N, K):
    
    
    
    if K == 0:
        return N

    
    p = N // b
    r = N % b

    count = p * max(b - K, 0) + max(r + 1 - K, 0)
    return count


if __name__ == '__main__':
    N, K = [int(v) for v in input().split()]

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

    print(total)

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

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

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

if K == 0:
    print(N * N)
else:
    count = 0
    for i in range(K + 1, N + 1):
        amari = N % i
        warikiriru = N - amari

        count += warikiriru - int(warikiriru / i) - int(warikiriru / i) * (K - 1)
        
        if amari >= K:
            count += amari - (K - 1)
            

    print(count)

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

if K > 0:
    for b in range(K+1, N+1):
        u = ((N - b)//b) + 1
        v =  (N - K)//b

        cnt += (b-K)*u + (v-u+1)*(-b*(u+v)+2*N-2*K+2)/2
else:
    for b in range(K+1, N+1):
        u = ((N - b)//b) + 1
        v =  (N - K)//b

        cnt += (b-K)*u + (v-u+1)*(-b*(u+v)+2*N-2*K+2)/2 - 1

print(int(cnt))

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

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

Solution (Python):
import math

a=input().rstrip().split(" ")
n=int(a[0])
k=int(a[1])
t=1
_sum=0

if k == 0:
    t=0
for b in range(k+1,n+1):
    
    _sum = _sum + (b-k)*math.floor(n/b)+max(0,n%b-k+t)
print(_sum)

Solution (Python):
S = input().split(" ")
S = [int(i) for i in S]
a = 0
for i in range(1,S[0] + 1):
    a += (max(i-S[1],0) * int(S[0]/i)) + max(0,S[0]%i-(S[1]-1))
if S[1] == 0:
    a -= S[0]    
print(a)

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

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

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)
    if n%b-k >= 0:
        ans += n%b-k+1

print(ans)

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

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

total = 0
for m in xrange(k + 1, n + 1):
    
    total += n / m * (m - k)
    
    total += max(n % m - (k - 1), 0)
    

print total

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):
import numpy as np

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

for i in range(k + 1, n + 1, 1):
    if k == 0:
        a += n ** 2
        break

    b, c, d= i - k, (n - k) // i, 0
    if i - 1 + i * c > n:
        d = i - 1 + i * c - n

    a += b * (c + 1) - d

print(a)

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

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

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

print ans

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

Solution (Python):
data = input()
data = data.split(" ")
n = int(data[0])
k = int(data[1])
sum = 0
for b in range(1, n+1):
    sum += (n//b*max(0,b-k)+max(0,n%b-k+1))
if k == 0: sum-=n
print(sum)

Solution (Python):
data = input()
data = data.split(" ")
n = int(data[0])
k = int(data[1])
sum = 0
for b in range(1, n+1):
    sum += (n//b*max(0,b-k)+max(0,n%b-k+1))
if k == 0: sum-=n
print(sum)

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

Solution (Python):


n,k=map(int,raw_input().split())
res=0
for b in xrange(1,n+1):
 x=n/b
 r=n%b
 res+=x*max(0,b-k)
 res+=max(0,r-k+1)
if k==0:
 res=n**2
print res

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

Solution (Python):
x = input().split(" ")
n = int(x[0])
k = int(x[1])
count = 0

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

if k == 0:
    count -= n
print(count)

Solution (Python):





if __name__ == '__main__':
    number, k = list(map(int, input().split()))
    count = 0

    
    
    
    for b in range(1, number + 1):
        p, r = divmod(number, b)
        count += p * max(0, b - k) + max(0, r - k + 1)

    if k == 0:
        count -= number

    print(count)

Solution (Python):





if __name__ == '__main__':
    number, k = list(map(int, input().split()))
    count = 0

    
    if k == 0:
        print(number ** 2)
    else:
        for b in range(1, number + 1):
            p = (number + 1) // b
            r = number - (p * b)
            count += p * max(0, b - k)

            if (number + 1) % b != 0:
                count += max(0, r - k + 1)

        print(count)

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

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):
        var = N % b
        if var >= K:
            ans += var - K + 1
        var2 = b - K
        var3 = N // b
        ans += var2 * var3
print(ans)

Solution (Python):
j = list(map(int, input().split()))
counter = 0
n = j[0]
k = j[1]

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

print(counter)

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

    
    editorial(N, K)


def editorial(N, K):
    """
    
    N = p*b + r (0 <= r < b)

    a固定: bが変わるので余りが変わるため意味なし
    b固定: aが変わっても余りは一定周期になる
        0%b, 1%b, 2%b, ..., (b-1)%b, b%b, (b+1)%b, ..., (pb-1)%b, pb%b, ..., (pb+r)%b
        0,   1,   2,   ..., (b-1),   0,   1,       ...,  b-1,      0,    ..., r
        余りの数列: (0...b-1)がp個 と 0...r
        ↓
        0...K-1, K...b-1
        b個の中にKより小さい数はK個
        よって, b - min(b, K) = max(b-K, 0)
    """
    ans = 0
    if K == 0:
        
        
        ans -= N

    
    
    for b in range(K+1, N+1):
        
        p, r = divmod(N+1, b)

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

    print(ans)


def TLE(N, K):
    """
    1 <= a,b <= N <= 10^5
    a mod b >= K
    0 <= K <= N-1
    """
    
    ans = 0
    for a in range(K, N):
        b_pattern = N - a
        ans += b_pattern

    
    
    
    for a in range(K+2, N+1):
        for b in range(K+1, a):
            if a % b >= K:
                ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
Tmp = []
Tmp  = input().rstrip().split(' ')

N = int(Tmp[0])
K = int(Tmp[1])

Ans = 0
nTmp = 0
nTmp2 = 0
nTmp3 = 0

if K == 0:
  Ans = N **2
else:
    for i in range(N+1):
        if i == 0:
            continue
        B = i
        nTmp = B - K
        if nTmp > 0:
            nTmp2 = N // B
            nTmp3 = (B - K) * nTmp2
            Ans += nTmp3
            nTmp2 = N % B
            if nTmp2 != 0:
                nTmp2 = nTmp2 - K + 1
                if nTmp2 > 0:
                    Ans += nTmp2
    
print(Ans)

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


solve()

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

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

main()

Solution (Python):

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

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

ans = 0
for b in range(1, n+1):
    q = n // b
    r = n % b

    ans = ans + q * max(0, b - k) + max(0, r - k + 1)
    if k == 0:
        ans -= 1

print (ans)

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

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

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

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 += max(0, b-K) * p
    ans += max(0, r-K+1)

print(ans)

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

print(cnt)

Solution (Python):


line = input().split(" ")
n = int(line[0])
k = int(line[1])

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

print(ret)

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

for b in range(k+1, n+1):
	quo = int(n / b)
	rem = n % b
	if rem == 0:
		count += quo * (b - k)
	else:
		count += quo * (b - k)
		if (rem >= k) and (k != 0):
			count += rem - k + 1
		elif (rem >= k) and (k == 0):
			count += rem - k
print(count)

Solution (Python):
import math
if __name__ == "__main__":
    N, K = list(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 += (p * max(0, b-K))
            ans += max(0, r-K+1)
    print(ans)

Solution (Python):
n,k = [int(i) for i in input().split()]
count = 0
if k == 0:
    count = n**2
else:
    for K in range(k,n):
        waru = K+1
        p,r = divmod(n,waru)
        count += p * (waru - k) + max(0,r-k+1)

print(count)

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

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

b=1
ans=0
while b<=n:
    p,r=divmod(n,b)
    ans+=p*max(0,b-k)+max(0,r-k+1)
    b+=1
if k==0:
    ans-=n
print(ans)

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

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

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

ans = 0
if K == 0:
    ans = N ** 2
else:
    for i in range(K+1,N+1):
        ans += (i - K) * ((N - K + 1) // i) + min((N - K + 1) % i,i - K)
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())

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

print(res)

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

Solution (Python):


N, K = map(int, input().split(" "))
c = 0
 
if K != 0:
    for b in range(K+1, N+1):
        r = N % b
        p = N // b
        s = p * (b-K)
        t = max(0, r - (K - 1))
        c += (s + t)
        
else:
    c = N ** 2

print(c)

Solution (Python):


N, K = map(int, input().split(" "))
c = 0
 
if K != 0:
    for b in range(K+1, N+1):
        s = N % b
        t = N - s
        p = t // b * (b - K)
        q = max(0, s - (K - 1))
        c += (p + q)
        
else:
    c = N ** 2

print(c)

Solution (Python):


N, K = map(int, input().split(" "))
c = 0
 
if K != 0:
    for b in range(K+1, N+1):
        s = N % b
        t = N - s
        p = t // b * (b - K)
        q = max(0, s - (K - 1))
        c += (p + q)
        
else:
    c = N ** 2

print(c)

Solution (Python):


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

def main():
    A, B = input().split(' ')
    print(solve(int(A), int(B)))


if __name__ == '__main__':
    main()

Solution (Python):


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

def main():
    A, B = input().split(' ')
    print(solve(int(A), int(B)))


if __name__ == '__main__':
    main()

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

Solution (Python):
def solve(n,k):
  counter = 0
  for i in range(n,k,-1):
    theValue = n//i * (i-k) + max(n%i-k+1,0)
    if (k == 0):
      theValue = max(theValue-1, 0)
    counter += theValue
  return counter

c = list(map(int, input().split()))
print(solve(c[0], c[1]))

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

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

if K != 0:
    for i in range(K, N):
        s = N % a
        t = N - s
        p = t // a * (a - K)
        q = max(0, s - (K - 1))
        ans += (p + q)
        a += 1
else:
    ans = N ** 2
print(ans)

Solution (Python):

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

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

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

count = 0

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

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

Solution (Python):

N,K=map(int,input().split(' '))
count = 0
for b in range(K+1,N+1):
    l, h, n = K, b-1, b-K
    while l <= N:
        if h <= N:
            count += n
            if l==0:
                count -=1
        else:
            count += N-l+1
            if l==0:
                count -=1
            break
        l+=b
        h+=b
print(count)

Solution (Python):
n,k = map(int,input().split())
if k == 0:
    print(n**2)
elif k <= 100:
    ans = 0
    for j in range(k):
        for i in range(k+1,n+1):
            ans += (n-j)//i
    print((n-k+1)*(n-k)-ans)
else:
    r = n//k
    ans = 0
    for i in range(1,r+3): 
        genkai = n - (i)*k
        for j in range(1,n-k+1): 
            x = (i-1)*j
            ans += min(max(genkai-x+1,0),j)
    print(ans)

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

Solution (Python):
N, K = map(int, raw_input().split())
ans = 0
for b in xrange(K + 1, N + 1):
    l, r, c = K, b - 1, (N + 1) / b
    ll = K + c * b
    ans += c * (r - l + 1)
    if ll <= N:
        ans += N - ll + 1
    if l == 0:
        ans -= 1
print ans

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

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

else:
	for i in range(N-K):
		counter += (N-i) - K;
	
	for i in range(K+1,N):
		a = N//i;
		
		b = N%i;
		
		if b >= K and b != 0:
			b = b;
		else:
			b = K - 1;

		counter += ( b - K + 1 ) + ( a - 1 )*( i - K ) 
		

	print (counter)

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

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

print(ans)

Solution (Python):
n,k=[int(i) for i in input().split()]
ans=0
left=[i+1 for i in range(n)]
right=[i+1 for i in range(k, n)]
amari=[0 for i in range(k, n)]

for i in range(len(amari)):
    amari[i]=(n//right[i])*(right[i]-1)-(n//right[i])*(k-1) + max(0,n%right[i]-(k-1))

if k==0:
    print(n**2)
else:
    print(sum(amari))

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

if __name__=='__main__':
    main()

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

Solution (Python):
def d_remainder_reminder(N, K):
    if K==0:
        return N*N
    import bisect
    ans = 0
    for b in range(K + 1, N + 1):
        tmp1 = (N+1)//b 
        tmp2 = (N+1)%b 
        

        t=0 if tmp2<=K else tmp2-K
        ans += (b-K)*tmp1 + t
        
    return ans 

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

Solution (Python):
N,K = map(int, input().split())
x = 0
if K == 0:
    x = N*N
else:
    for i in range(N-K):
        A = K+1+i
        x += (A-K)*(N // A)
        T = (N%(A-K))-K+1
        if  T > 0:
            x += T

print(x)

Solution (Python):
import sys 

temp=input().split(" ")
n=int(temp[0])
k=int(temp[1])
count=0
for b in range(k+1,n+1):
    temp=int(n/b)
    count+=temp*(b-k)

    temp=n%b
    if (temp-k+1)>0:
        count+=(temp-k+1)
if k==0:
    count-=n


print(count)

Solution (Python):
NK= list(map(int,input().split()))
a = NK[1]
b = NK[1]+1
if NK[1] == 0:
    a = 1
    b = 1
temp = 0
while a <= NK[0]-1:
    temp += (NK[0]-a)
    a+=1
while b <= (NK[0]-NK[1]):
    step = int(NK[0]/b)
    cross = b-NK[1]
    temp += (step-1)*cross
    if (b*step + NK[1]) < NK[0]:
        temp += (NK[0]+1-(b*step + NK[1]))
    if (b*step + NK[1]) == NK[0]:
        temp += 1
    b+=1

print(temp)

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


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

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

print(ans)

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

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

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

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

print(ans)

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

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

print(result)

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

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

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

ans = 0

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

for b in range(k+1,n+1):
  
    
    
    
    buf = b-k
    buf2 = n/b
    buf = buf * buf2
    
    buf3 = buf2*b
    
    if (n - buf3 - k + 1) > 0:
      buf += (n - buf3 - k + 1)
    ans += buf
    
    
print ans

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

Solution (Python):
nk = input().split()
n = int(nk[0])
k = int(nk[1])

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

        

print(cnt)

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

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

if K == 0:
    count -= len(range(K + 1, N + 1))

print (count)

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

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

Solution (Python):


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

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

ans = 0
for i in range(1, N - K + 1):
    b = K + i
    x = int((N - K) / b)
    M = min(N, K + x*b + i - 1)

    ans += i*x + M - (K + x*b) + 1

print(ans)