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, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n, k = MAP()
ans = 0
if k == 0:
    print(pow(n, 2))
    exit()

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

Solution (Python):
lim, pol = map(int,input().split())

count = 0
num = 0
if pol == 0:
    count = lim * lim
else:
    for kk in range(pol, lim + 1):
        num = (lim - lim % kk) / kk
        count += (kk - pol) * num
        if lim % kk >= pol:
            count += lim % kk - pol + 1

print(int(count))

Solution (Python):
'''
全体からKよりも小さくなる組を引く
(1~N)%iのあまりについて考える。(iは固定)
0<=i<=Kの時、あまりは必ずK-1以下になる(2で割ると余りは[0,1]、3で割ると余りは[0,1,2]、....、Kで割ると余りは[0,1,..,K-1])
i>Kの時、
まず、(1~i)%iについて考える
    ①(1~K-1)%iの余りはK-1以下、個数は(K-1)個     (例:i=K+5の時、1%(K+5)=1、2%(K+5)=2、......、(K-1)%(K+5)=K-1)
    ②(K~i-1)%iの余りはK以上、個数は(i-K)個    (例：i=K+5の時、(K)%(K+5)=K、(K+1)%(K+5)=K+1、.....、(K+4)%(K+5)=K+4)
    ③i%iの余りは0、個数は1個      (例:i=K+5の時、(K+5)%(K+5)=0)

    全部合わせてi個
    このうち、余りがKよりも小さくなるのはK個

では、(i+1~N)%iも上と同様に考える(余りは周期的に繰り返される)と、(N//K)回繰り返されるので、(N//i)*K
あとは余りのところを考えて、min(K-1,N%i)   (maxの部分はK=0対策)
i>Kにおいてはこの和をansから引けば良い。
'''

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

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

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

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

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

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

Solution (Python):
N,K=map(int,input().split())
ans=0
for b in range(K,N+1):
    if b==0:
        continue
    
    
    
    
    
    ans += (b-K)*int(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):
N,K=map(int,input().split())
ans=0
for b in range(K,N+1):
    if b==0:
        continue
    
    
    
    
    
    ans += (b-K)*int(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):
N,K=map(int,input().split())
ans=0
for b in range(K,N+1):
    if b==0:
        continue
    ans += (b-K)*int(N//b)
    if N%b>=K and K>0:
        ans+=N%b-K+1
    elif N%b>=K:
        ans+=N%b - K
print(ans)

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

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

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

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

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):
    q = n // b
    r = n % b
    if r < k:
        ans += q * (b-k)
    else:
        ans += q * (b-k) + (r-k+1)
print(ans)

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

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

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

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

cnt = 0

for i in range(1, N + 1):
    if i <= K:
        continue
    a = i - K 
    b = N // i 
    c = N % i 

    cnt += a * b
    if c >= K:
        cnt += c - K + 1

print(cnt)

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

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

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

if k == 0:
    ans = n**2

print(ans)

Solution (Python):
class Solution:

    def solve(self, N: int, K: int) -> int:

        if K == 0:
            return N**2

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

            answer += (N//b) * (b-K) + max(N % b-K+1, 0)

        return answer


if __name__ == '__main__':

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

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

print(ans)

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



def f(a, n, k):
    syou, amari = divmod(n, a)
    one_syou = max(a - k, 0)
    plus = max(amari+1 - k, 0) if k != 0 else amari
    
    return syou * one_syou + plus


ans = 0
for a in range(max(K, 1), N+1):
    ans += f(a, N, K)
    

print(ans)

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



def f(a, n, k):
    syou, amari = divmod(n, a)
    one_syou = max(a - k, 0)
    plus = max(amari+1 - k, 0) if k != 0 else amari
    
    return syou * one_syou + plus


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

print(ans)

Solution (Python):
def main():
    limit, remainder_min = map(int, input().split(" "))
    answer = 0
    if remainder_min:
        for i in range(1, limit + 1):
            answer += max(0, i - remainder_min) * (limit // i) + max(0, limit % i - remainder_min + 1)
    else:
        answer = limit ** 2
    print(answer)


if __name__ == '__main__':
    main()

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

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

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

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

Solution (Python):
N, K = map(int, input().split())
total = 0
if not K:
    print(N ** 2)
    quit()

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

print(total)

Solution (Python):

import math
import heapq
import bisect
import numpy as np
from collections import Counter


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) + max(r-K+1,0)

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

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

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 9)




INF = 1e10

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


def f(b):
    """
    a= b*x + r
    a=[0,N] まで回すとき, あまり r は 0,1,...,b-1 と順番に出現する. (x = a//b)
    """
    p = (N // b)  
    ans = max(p * (b - K), 0)

    
    ans += max(N % b - K + 1, 0)

    if K == 0:
        ans -= 1

    return ans

def main():
    ans =0
    for b in range(1,N+1):
        ans+=f(b)
    print(ans)
main()

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

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


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

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

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

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 main():
    N, K = LI()
    cnt = 0
    if K == 0:
        print(N * N)
        return

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

main()

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,k = map(int,readline().split())
ans = 0
if k == 0:
    print(n**2)
    exit()
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):
import sys

input = sys.stdin.readline


def main():
    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:
            continue
        ans += max(0, N % i - max(K - 1, 0))
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline

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

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

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


if __name__ == '__main__':
    main()

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

ans = 0
for i in range(1, N + 1):
    p, r = divmod(N, i)
    ans += p * max(0, i - K) + 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):
    d, m = divmod(N+1, b)
    k = max(b-K, 0)
    ans += max(k*d, 0)
    if K == 0:
        ans -= 1
    ans += max(m-K, 0)

print(ans)

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

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

for b in range(K+1, N+1, 1):
    cnt += 1
    tmp = (N - (K + cnt - 1)) // b
    ans += cnt * (tmp + 1)
    if (tmp + 1) * b + K <= N:
        ans += N - ((tmp + 1) * b + 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(2,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())
ans = 0
for b in range(K+1,N+1):
    Q = N//b
    R = N%b
    ans += Q*(b-K)+max(0,R+1-K)
if K == 0:
    ans = N**2
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):
  ans += int(N/b) * max(0, b-K)
  ans += max(0, N%b + (1-K))

print(ans)

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

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

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

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

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

if k == 0:
    ans =n**2

print(ans)

Solution (Python):

si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
n,k=nm()
ans=0

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

for i in range(k+1,n+1):
    ans+=(n//i)*(i-k)
    if n%i>=k:
        ans+=n%i-k+1

print(ans)

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

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

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

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

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

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

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):
    k, m = N//b, N%b
    ans += k*(b-K)
    if m != 0:
      ans += max(m-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(1, N+1):
    ans += max(0, 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:
	print(N * N)
else:
	for i in range(K + 1, N + 1):
		ans += (N // i) * (i - K)
		if N % i >= K:
			ans += N % i - (K - 1)
	print(ans)

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

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

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

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

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


if __name__ == '__main__':
    main()

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,K = MI()
    if K==0:
        print(N**2)
        return
    ans = 0
    for b in range(K+1,N+1):
        roop = N//b
        ans += roop*(b-K)
        remain = N-roop*b
        ans += max(0,remain-K+1)
    print(ans)
if __name__ == '__main__':
    main()

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

"""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())

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

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

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

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

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

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

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

print(res)

Solution (Python):
import sys

n, k = map(int, sys.stdin.readline().split())

def main():
    res = 0
    for b in range(k+1, n+1):
        q, r = divmod(n, b)
        res += q * (b - k) + max(0, r - (k - 1))
    if k == 0:
        res -= n - k
    return res

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

Solution (Python):
import sys

n, k = map(int, sys.stdin.readline().split())

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

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

Solution (Python):


import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N, K = MAP()

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

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

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

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

count = 0
for b in range(k+1, n+1):
    candidate = (n // b) * (b - k)
    mod = n % b
    if mod >= k:
        add = mod - k + 1
        if k == 0:
            add -= 1
        candidate += add
    count += candidate

print(count)

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

Solution (Python):
def check():
    N,K = map(int, input().split())
    total = 0
    
    if K == 0: return N**2
    
    for b in range(1,N+1):
        if b <= K:
            continue
        
        amari = N-b*(N//b)        
        test = amari-K+1 if amari >= K else 0           
        total += (b - K) * (N//b) + test
    return total
print(check())

Solution (Python):
def counter(b,N,K):
    return(max((N//b)*(b-K)+max(N%b-K+1,0),0))

N,K=map(int,input().split())
ans=0
for i in range(1,N+1):
    ans+=counter(i,N,K)

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

Solution (Python):
import sys
input = sys.stdin.readline

def main():
    n,k = map(int, input().split())
    ans = 0
    for b in range(k+1, n+1):
        c = 0
        a = k+c*b
        while a <= n:
            if a != 0:
                if a+b-k <= n:
                    ans += b-k
                else:
                    ans += n-a+1
            else:
                if a+b-k <= n:
                    ans += b-k-1
                else:
                    ans += n-a
            c += 1
            a = k+c*b
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
import sys
input = sys.stdin.readline

def main():
    n,k = map(int, input().split())
    ans = 0
    for b in range(k+1, n+1):
        c = 0
        a = k+c*b
        while a <= n:
            if a != 0:
                if a+b-k <= n:
                    ans += b-k
                else:
                    ans += n-a+1
            else:
                if a+b-k <= n:
                    ans += b-k-1
                else:
                    ans += n-a
            c += 1
            a = k+c*b
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
import sys
input = sys.stdin.readline
N, K = [int(x) for x in input().strip().split()]

ans = 0
for m in range(1, N+1):
    if m <= K:
        continue
    maxlen, mod = divmod(N, m)
    ans += maxlen * (m - K)
    
    ans += max(0, N - m * maxlen - K + 1)
    if K == 0:
        ans -= 1
print(ans)

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:
    print(n**2)
else:
    
    co=0
    for i in range(k+1,n+1):
        co+=(n//i)*(i-k)
        co+=max(n%i-k+1,0)
    print(co)

Solution (Python):
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n, k = list(map(int, readline().split()))
    cnt = 0
    for i in range(1, n + 1):
        if i > k:
            cnt += int((n - n % i) / i * (i - k) + max(0, n % i - max(1, k) + 1))
    print(cnt)


if __name__ == '__main__':
    solve()

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

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

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

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

Solution (Python):
N , K = map(int,input().split())
ans = 0
for i in range(K + 1, N + 1):
    before_range = max((N % i - K + 1) , 0)
    before_cnt = (N // i + 1)
    before = before_cnt * before_range
    after_range = min((i - 1) - (N % i) , (i - 1) - K + 1)
    after_cnt = (N // i)
    after = after_cnt * after_range
    now = before + after
    if K == 0:
        now -= 1
    
    ans += now
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):
        ans+=max(0,n%i-k+1)+n//i*(i-k)   
    print(ans)

Solution (Python):

import sys


def solve(N: int, K: int):
    if K!=0:
        ans = 0
        for j in range(K+1,N+1):      
            ans += (j-K) * (N//j)
            if N%j >=K:
                ans += N%j - K + 1
    else:
        ans = N * N

    print(ans)
    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):

import sys


def solve(N: int, K: int):
    if K!=0:
        ans = 0
        for j in range(1,N+1): 
            if K <= j-1:
                ans += (j-K) * (N//j)
                if N%j >=K:
                    ans += N%j - K + 1
    else:
        ans = N * N

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

print(ans)

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

if k == 0:
    print(n*n)
    import sys
    sys.exit()

ans = 0
for i in range(k+1,n+1):
    a = n // i
    ans += (i-k) * a
    if k <= n % i and n % i != 0:
        ans += n % i - k + 1
print(ans)

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

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

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

Solution (Python):
def examD():
    N, K =LI()
    cur = 0
    for i in range(K+1,N+1):
        cur +=((N//i)*(i-K) + max(0,N%i-K+1))

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

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examD()

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

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

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(N%b - K + 1, 0)
print(ans if K else N*N)

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

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

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,k=map(int,input().split())
    if(k==0):
        print(n**2)
        return
    ans=0
    for b in range(k+1,n+1):
        q=(n-k)//b+1
        ans+=q*(b-k)-max(0,(q*b-1)-n)
    print(ans)
resolve()

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
int1 = lambda x: int(x) - 1

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

main()

Solution (Python):
n,k=map(int,input().split())
ans=0
for i in range(k+1,n+1):
  ans+=(n//i)*(i-k)
  x=n%i
  ans+=max(0,x-k+1)
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):

  count += (b-K)*(N//b) + max(0, (N%b) - K +1)
  
if K == 0:
  count = N*N

  
print(count)

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

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

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

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

print(ans)

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

Solution (Python):
import sys
def input():
    return sys.stdin.readline()[:-1]
n,k=map(int,input().split())
tmp=0
ans=0



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

Solution (Python):
import sys
def input():
    return sys.stdin.readline()[:-1]
n,k=map(int,input().split())
tmp=0
ans=0
if k==0:
    print(n*n)
    quit()
for i in range(k,n):
    tmp=n//(i+1)
    ans+=(i+1-k)*tmp
    if n%(i+1)-k+1>0:
        ans+=n%(i+1)-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):
    ans+=max(0,(b-1-k+1)*(n//b))+max(0,(n%b-k+1))
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
  else: ans += N//b*(b-K) + max(0,(N-(N//b)*b)-K+1)

print(ans)

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

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

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

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

print(answer)

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

if K == 0:
    print(N * N)
else:
    cnt = 0
    for b in range(1, N+1):
        l_max = N // b
        for l in range(l_max + 1):
            k = min(b-1, N - b*l)
            if k >= K:
                cnt += k - K + 1

    print(cnt)