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):
n, k = map(int, input().split())
ans = 0
if k == 0:
    ans = n ** 2
else:
    for b in range(k + 1, n + 1):
        period = n // b
        nokori = n % b
        ans += period * (b - k) + max(nokori - k + 1, 0)
print(ans)

Solution (Python):
N, K = map(int, input().split())
ans = 0
b = K+1
while b <= N:
  p = N//b
  r = N%b
  ans += p*max(0,b-K)+max(0, r-K+1)-(0 if K > 0 else 1)
  b += 1
print(ans)

Solution (Python):
n,k = map(int,input().split())
result = 0
for b in range(k+1,n+1):
  roop = n //b
  roop_ok = (b-1) - (k-1)
  amari = n % b
  amari_ok = amari - k + 1
  if roop_ok >= 0 :
    result += roop * roop_ok
    if amari_ok > 0 :
      result += amari_ok
      
if k == 0:
  print(n**2)
else:
  print(result)

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

ret = 0

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

print(ret)

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

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

print(num)

Solution (Python):
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10 ** 7)

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n, k = na()

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)

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

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

Solution (Python):
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True 
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

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

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

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

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

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


if K == 0:
    ans -= N

print(ans)

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    N, K = map(int, input().split())
    cnt = 0

    if K == 0:
        print(N ** 2)
    else:
        for b in range(K + 1, N + 1):
            p, mod = divmod((N + 1), b)

            cnt += p * (b - K)
            if mod != 0:
                if N >= K + p * b:
                    cnt += N - (K + p * b)+1

        print(cnt)


resolve()

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

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

Solution (Python):
import sys
import math  
import bisect  
import queue  


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


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

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

    print(res)


if __name__ == '__main__':
    main()

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

if K == 0:
    print(N ** 2)
else:
    ans = 0
    for b in range(K + 1, N + 1):
        n_groups = N // b
        rest = N % b
        ans += n_groups * (b - K) + max(0, rest - 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+=p*max(0,b-K)
  ans+=max(0,r-K+1)
if(K==0):
  ans-=N
print(ans)

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

if k > 0:
    for i in range(k+1,n+1):
        a = n // i
        b = n % i
        ans += (a * (i-k) + (max(0,b-(k-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_i=(i-k)*(-(-(n+1)//i))

    if(n%i<k):
        ans_i-=(i-k)
    else:
        ans_i-=(i-1)-(n%i)

    ans+=ans_i

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

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

    ans+=(p*max(0, i-k))
    ans+=(max(0, n%i-k+1))
print(int(ans))

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




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

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

Solution (Python):
import sys
sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
mod=10**9+7

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


main()

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

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

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

    print(ans)

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

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

ans = 0
for b in range(1, n+1):
    if b <= k:
        continue
    q, r = divmod(n, b)
    if r < k:
        ans += ((b-1)-k+1)*q
    else:
        ans += ((b-1)-k+1)*q + r-k+1
print(ans)

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

    return 0

if __name__ == "__main__":
    solve()

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

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


if __name__ == '__main__':
    main()

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

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

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

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

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

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

print(ans)

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

answer=0
for i in range(1,N+1):
  p=N//i
  r=N%i
  a1=p*max(0,i-K)
  a2=max(0,r-K+1)
  answer+=a1+a2
  
  
if K==0:
  answer-=N
print(answer)

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

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

Solution (Python):
def f(n, m, k):
    return (n + 1) // m * (m - k) + max(0, (n + 1) - (n + 1) // m * m - k) - (1 if k == 0 else 0)

n, k = [int(x) for x in input().split()]
print(sum(f(n, m, k) for m in range(k + 1, n + 1)))

Solution (Python):

import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def solve():
    N, K = Scanner.map_int()
    ans = 0
    for b in range(1, N+1):
        ans += N // b * max(0, b - K)
        ans += max(0, N % b - K + 1)
    if K == 0:
        ans -= N
    print(ans)


def main():
    
    solve()


if __name__ == "__main__":
    main()

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

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

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


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

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

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


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

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

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, k = map(int, readline().split())
ans = 0
for i in range(k + 1, n + 1):
    cnt = 0
    max_x = n // i
    cnt += max_x * (i - k)
    low = max_x * i + k
    if low <= n:
        high = min((max_x + 1) * i - 1, n)
        cnt += high - low + 1
    ans += cnt
if k == 0:
    ans -= n
print(ans)

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

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

    ans = 0
    for b in range(K + 1, N + 1):
        q, r = divmod(N, b)
        ans += q * (b - K) + max(0, r - (K - 1))
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
n,k = map(int, input().split())
if k == 0:
    print(n**2)
else:
    ans = 0
    for b in range(k+1,n+1):
        ans += (b-k)*((n+1)//b) + max(0,((n+1)%b)-k)
    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):
解説AC=True

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

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

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

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

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

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

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

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

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

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

Solution (Python):



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

ans=0
for n in range(K+1,N+1):
    coff=(n)-(K)
    quan=(N)//n
    ans+=coff*quan
    temp=N-quan*n
    if K!=0:
        temp-=(K-1)
    
    ans+=max(temp,0)
    

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

Solution (Python):
import sys

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

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

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

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

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

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

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

Solution (Python):

from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
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)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,k = LI()
    if k == 0:
        print(n**2)
        return
    ans = 0
    for b in range(k+1,n+1):
        s = n//b
        ans += s*(b-k)
        ans += max(0,n-s*b-k+1)
    print(ans)
    return


if __name__ == "__main__":
    solve()

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

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

if __name__ == '__main__':
    main()

Solution (Python):
from itertools import permutations
import sys

sys.setrecursionlimit(10 ** 6)
from bisect import *
from collections import *
from heapq import *

def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def SI(): return sys.stdin.readline()[:-1]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
int1 = lambda x: int(x) - 1
def MI1(): return map(int1, sys.stdin.readline().split())
def LI1(): return list(map(int1, sys.stdin.readline().split()))
p2D = lambda x: print(*x, sep="\n")
dij = [(1, 0), (0, 1), (-1, 0), (0, -1)]

def main():
    n,k=MI()
    if k==0:
        print(n*n)
        exit()
    ans=0
    for b in range(k+1,n+1):
        w=b-k
        c=(n+b)//b
        over=b*c-(n+1)
        ans+=w*c-min(w,over)
    print(ans)

main()

Solution (Python):
n,k = map(int,input().split())
ret = 0
for b in range(1, n+1):
    if b<k+1:
        continue
    else:
        m = n//b
        l = n%b
        ret += (b-k)*m
        if k!=0 and l>=k:
            ret += l-k+1
        elif k==0:
            ret += l
print(ret)

Solution (Python):

from collections import Counter
def inputlist(): return [int(k) for k in input().split()]

N,K = inputlist()
if K == 0:
    print(N**2)
    exit()
ans = 0
for i in range(K+1,N+1):
    indexa = i-K
    sub = N-i+1
    ans += indexa
    if sub // i != 0:
        ans += (sub//i)*indexa

    mod = sub % i
    ans += max(0,mod-K)

print(ans)

Solution (Python):
def main():
    N, K = (int(i) for i in input().split())
    if K == 0:
        return print(N**2)
    ans = 0
    for b in range(2, N+1):
        if K > b-1:
            continue
        pat = N//b
        ans += pat*(b-K)
        m = N % b
        if K <= m:
            ans += m-K+1
    print(ans)


if __name__ == '__main__':
    main()

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

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


if __name__ == '__main__':
    main()

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
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 debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(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()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = False

n, k = MAP()
if k == 0:
    print(n ** 2)
    exit()
ans = 0
for b in range(k + 1, n + 1):
    qmax = n // b
    ans += (b - k) * qmax
    t = n % b
    ans += max(0, t - 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 -= 1
print(ans)

Solution (Python):
import sys
N, K = map(int, input().split())
if K == 0:
    print(N**2)
    sys.exit()
ans = 0
for b in range(K+1,N+1):
    peri, res = divmod(N,b)
    ans += (b-K)*peri + max(0,res-K+1)

print(ans)

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

Solution (Python):
from collections import *
from heapq import *
from itertools import *
from fractions import gcd
import sys
from decimal import *
import copy
from bisect import *
input=lambda :sys.stdin.readline().rstrip()
N,K=map(int,input().split())
if K==0:
    print(N**2)
    exit()
count=0
for b in range(K+1,N+1):
    count+=(N//b)*(b-K)
    count+=max(N%b-(K-1),0)
print(count)

Solution (Python):

from collections import Counter
def inputlist(): return [int(j) for j in input().split()]

N,K = inputlist()
ans = 0
if K == 0:
    print(N**2)
    exit()
for i in range(K+1,N+1):
    d = i-K
    l = N // i
    m = N % i
    ans += d*l
    ans += max(0,m-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-p*b
  ans+=p*max(b-k,0)+max(0,r-k+1)
if k==0:
  ans-=n
print(ans)

Solution (Python):



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


class_count = 0

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


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

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

Solution (Python):

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

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


if K == 0:
    cnt -= N

print(cnt)

Solution (Python):
import math

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

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

print(res)

Solution (Python):



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


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

    class_count += c_1 + c_2

if K==0:
    class_count -= N

print(class_count)

Solution (Python):
n, k = map(int, input().split())
if k == 0:
    ans = -n
else:
    ans = 0
for i in range(1,n+1):
    ans += max(0, (i-k) * (n // i)) + max(0, (n-(n//i)*i)-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):
    num=b-k
    l=n//b
    m=n%b
    ans+=num*l
    ans+=max(0,m-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(1, n+1):
    if i <= k:
        continue
    q, r = divmod(n, i)
    if r < k:
        ans += (i-k)*q
    else:
        ans += (i-k)*q + (r-k+1)
print(ans)

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

cnt=0
for i in range(1,n+1):
    temp=(n//i)*(i-k)+max((n-(i*(n//i)+k-1)),0) if i-1>=k else 0
    cnt+=min(temp,n)
    
print(cnt)

Solution (Python):
import sys
def main():
    input = sys.stdin.readline
    N,K = map(int, input().split())
    
    ans = 0
    for b in range(K+1, N+1):
        div, mod = divmod(N, b)
        one = b - K
        ans += div * one
        ans += max(0, mod - K + (1 if K!=0 else 0))
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
import sys
from collections import deque

def solve():
    input = sys.stdin.readline
    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)
            mod = N % b
            if mod >= K and mod > 0: Ans += mod - K + 1
        
        print(Ans)

    return 0

if __name__ == "__main__":
    solve()

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


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

if k == 0:
    ans+=1
print(ans)

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

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

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

print(ans)

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

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

Solution (Python):

import sys,os
from collections import defaultdict, deque
from fractions import gcd
from math import ceil, floor
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    MIIS = lambda: map(int,input().split())
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7

    N,K = MIIS()
    
    
    
    ans = 0
    
    
    
    
    
    ans = 0
    
    
    
    
    
    
    ans2 = 0
    for b in range(K+1,N+1):
        ans2 += (N//b)*(b-K)
        

        
        ans2 += max(N - (N//b*b + K) +min(1,K),0)
        
            
        
        
        
        
        
        
    
    print(ans2)

    

if __name__ == '__main__':
    main()

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

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

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

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

Solution (Python):



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

if __name__=='__main__':
  main()

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

Solution (Python):
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()



def main():
  n,k=LI()
  ans=0

  for b in range(1,n+1):
    if b<k:
      continue

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

  if k==0:
    ans-=n
  return ans


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

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

ans = 0

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

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

print(ans)

Solution (Python):
from sys import stdin
n,k = map(int,stdin.readline().rstrip().split())
point = 0

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

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 = map(int,input().split())
ans = 0
for b in range(K+1,N+1):
    ans += (b-K)*(N//b)
    if N%b >= K:
        ans += N%b-K+1
    if K == 0:
        ans -= 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):
    num = n//b
    add=num * (b-k)

    nokori = n-b*num
    if nokori-k+1 > 0:
       add+= nokori - k+1


    ans+=add
print(ans)

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

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

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