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

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

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

Solution (Python):

from math import floor, ceil, sqrt, factorial, log, gcd, log10
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, chain
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heappushpop, heapify
from copy import copy, deepcopy
import sys
INF = float('inf')
mod = 10**9+7
sys.setrecursionlimit(10 ** 6)


def lcm(a, b): return a * b / gcd(a, b)





def LI(): return list(map(int, sys.stdin.buffer.readline().split()))




def I(): return int(sys.stdin.buffer.readline())





def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()




def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')







def IR(n): return [I() for i in range(n)]







def LIR(n): return [LI() for i in range(n)]







def SR(n): return [S() for i in range(n)]







def LSR(n): return [LS() for i in range(n)]







def SRL(n): return [list(S()) for i in range(n)]


n, k = LI()
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, input().split())
answer = 0

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

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

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

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

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

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy
from operator import itemgetter

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

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  


N, K = na()
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 = list(map(int,input().split()))
ans=0

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

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

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

print(ans)

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

Solution (Python):


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

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

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

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

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

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

print(ans)

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

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

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

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

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

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

s = 0

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

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from copy import deepcopy

INF = 10 ** 20


def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

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

print(ans)

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from copy import deepcopy

INF = 10 ** 20


def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

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

print(ans)

Solution (Python):
import sys

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

if k==0:
    print(n*n)
    sys.exit()
    
icnt=0
for ki in range(k+1,n+1):
    qki=n//ki
    icnt+=qki*(ki-k)+max(n%ki-(k-1),0)

print(icnt)

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

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

print(ans)

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

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

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

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

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

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


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

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

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

    print(ans)
    return


if __name__ == '__main__':
    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 = map(int, input().split())
ans = 0
for b in range(k + 1, n + 1):
    temp = n // b
    temp2 = n % b
    ans += temp * (b - k) + max(temp2 - max(0, (k - 1)), 0)
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):
  q,r=divmod(N,i)
  ans += q*max(0,i-K)+max(0,r-K+1)
print(ans)

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

    print(res)

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

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

Solution (Python):
import numpy as np
n,k = map(int,input().split())

a = np.array([0]*n,dtype ='int64')
a[0] += n
for i in range(1,n):
    c = n // (1+i)
    d = n % (1+i)
    a[1:i+1] += c
    a[0] +=c
    if d > 0:
        a[1:d+1] +=1
print(np.sum(a[k:]))

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

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

print(ans)

Solution (Python):
n,k = map(int, open(0).read().split())

ans = 0

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

print(ans)

Solution (Python):
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())

N,K = MI()

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

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

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

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

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

ans = 0

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

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

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

Solution (Python):


import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

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

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

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

print(ans)

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()


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

if __name__ == "__main__":
    main()

Solution (Python):
n,k=map(int,input().split())
ans=n*n
if k!=0:
    ans-=k*n
    for b in range(k+1,n+1):
        tmp=(n//b)*(k)+min(n%b,k-1)
        ans-=tmp
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):
    quo, rem = divmod(n, i)
    ans += quo * (i-k)
    if rem >= k:
        ans += rem - k + 1

print(ans)

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

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

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

print(res)

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):
    quo, rem = divmod(n, i)
    ans += quo * (i-k)
    if rem >= k:
        ans += rem - 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(k+1, n+1):
    quo, rem = divmod(n, i)
    ans += quo * (i-k)
    if rem >= k:
        ans += rem - k + 1

print(ans)

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

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

print(res)

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





ans = 0

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

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

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

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

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

print(ans)

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(str, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

from decimal import *

N, K = MAP()

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 -= N

print(ans)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(str, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

from decimal import *

N, K = MAP()

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

ans = 0

for b in range(K+1, N+1):
	p = N//b
	ans += p * (b-K) + max(0, N%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(k, n+1):
    p = n // i
    r = n % i
    ans += p * (i - k) + max(0, (r - 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):
    one_loop_k = b-k
    if one_loop_k <=  0: continue
    loop_cnt = n//b
    ans += one_loop_k*loop_cnt

    rem = n-loop_cnt*b
    ans += max(0,rem-k+1)
    

print(ans)

Solution (Python):
import sys

def input():
    return sys.stdin.readline()[:-1]

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

def ii():
    return int(input())

def main():
    N, K = mi()
    ans = 0
    for b in range(K+1, N+1):
        q = 0
        while K+b*q <= N:
            ans += min((q+1)*b, N+1)-(K+b*q)
            q += 1
    if K == 0:
        ans -= N
    print(ans)


if __name__ == '__main__':
    main()

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

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

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

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

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

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

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

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

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

Solution (Python):



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

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

print(count)

Solution (Python):

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""
全体からあまりがK未満を引く
"""
N, K = lr()
total = N * N
for b in range(1, N+1):
    if b <= K:
        total -= N
    else:
        total -= K * (N // b) + max(0, min(N % b, K - 1))
    

answer = total
print(answer)

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

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

Solution (Python):

import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial
from bisect import bisect_left 
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

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

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

print(cnt)

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

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

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

if k==0:
    ans = (1+n-1)*(n-1)//2
else:
    ans = (1+n-k)*(n-k)//2


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

for i in range(k,n):
    if i==0:
        continue
    for j in range(1,n//i+1):
        if j*(i+1)+i<=n:
            ans+=(n-(j*(i+1)+i))//j+1
        if j*(i+1)+i>n:
            break

print(ans)

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

ans = 0

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

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

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

    print(solve(N,K))

if __name__ == "__main__":
    main()

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


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

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


if __name__ == '__main__':
    main()

Solution (Python):
N,K = map(int, open(0).read().split())
ans = 0
if K == 0:
    print(pow(N,2))
else:
    for b in range(K+1,N+1):
        d, m = divmod(N,b)
        ans += d * (b-K) + max(0,(m-K+1))
    print(ans)

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

if '__main__' == __name__:
    resolve()

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

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





if __name__ == '__main__':
    main()

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

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

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

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

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

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

ans = 0
for b in range(k + 1, n + 1):
    q, mod = divmod(n, b)
    ans += q * (b - k)
    if mod >= k:
        ans += mod - k + 1
print(ans)

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

print(ans)

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

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

Solution (Python):
def main():
    n, k = map(int, input().split())
    if k == 0:
        print(n * n)
        return
    ans = 0
    for i in range(k + 1, n + 1):
        p, q = divmod(n, i)
        ans += p * (i - k) + max(q - k + 1, 0)

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

Solution (Python):
import sys
N, K = map(int, sys.stdin.readline().rstrip().split())
if K == 0:
    print(N ** 2)
    exit()
ans = 0
for b in range(1, N + 1):
    if b - 1 < K:
        continue
    ans += (N // b) * (b - K) + (max(N % b - K + 1, 0))
print(ans)

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


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


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count





N,K = IL()

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

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

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

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

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

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

print(ans)

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

Solution (Python):
N, K = 5, 2





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


def calculate(n, k):
    result = 0
    for b in range(1, N + 1):
        p = n // b
        s1 = p * max(0, (b - 1 - (k - 1)))
        s2 = max(0, (n % b) - (k - 1))

        res = s1 + s2
        if k == 0:
            result = result + res - 1
        else:
            result = result + res

    print(result)


calculate(N, K)

Solution (Python):
def count_possible_pairs(N, K):
  if K == 0:
    return N**2
  else:
    cnt = 0      
    for b in range(K+1, N+1):
      block = (N+1) // b
      cnt += block * (b - K)    
      res = (N+1) % b
      if res > K:
        cnt += (res - K)
    return cnt




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

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

Solution (Python):
def main():
    N, K = list(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 -= 1
    print(ans)


if __name__ == '__main__':
    main()