Problem:
 Score : 400 points    Problem Statement Takahashi had a pair of two positive integers not exceeding N , (a,b) , which he has forgotten.
He remembers that the remainder of a divided by b was greater than or equal to K .
Find the number of possible pairs that he may have had.      Constraints  1 \leq N \leq 10^5  0 \leq K \leq N-1  All input values are integers.         Input Input is given from Standard Input in the following format:  N  K       Output Print the number of possible pairs that he may have had.        Sample Input 1 5 2      Sample Output 1 7  There are seven possible pairs: (2,3),(5,3),(2,4),(3,4),(2,5),(3,5) and (4,5) .       Sample Input 2 10 0      Sample Output 2 100       Sample Input 3 31415 9265      Sample Output 3 287927211

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


if __name__ == '__main__':
    main()

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

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

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

print(ans)

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,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
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
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()
    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()

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

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 7)

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

ans = 0
for n in range(N + 1):
    
    if n <= K:
        continue

    if K == 0:
        ans += N
        continue

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

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

Solution (Python):
def examC():
    N = LI(); N.sort()
    if N[0]==1:
        if N[1]==1:
            ans = 1
        else:
            ans = max(0,N[1]-2)
    else:
        ans = (N[1]-2)*(N[0]-2)
    print(ans)
    return

def examD():
    N, K = LI()
    ans = 0
    b = K+1
    while(b<=N):
        cur = N//b * (b-K) + max(0,N%b - K+1)
        if cur==N+1:
            cur = N
        ans += cur
        b += 1

    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

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 SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examD()

"""

"""

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

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

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

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

def f(x, y):
    a, b = divmod(x,y)

    return y*a*(a+1)//2 + (b+1)*(a+1)

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

    r += f(N-K, b)- f(N-b, b)
    if K == 0:
        r -= 1




print(r)

Solution (Python):
from _collections import deque
from _ast import Num


def parser():
    while 1:
        data = list(input().split(' '))
        for number in data:
            if len(number) > 0:
                yield (number)


input_parser = parser()


def gw():
    global input_parser
    return next(input_parser)


def gi():
    data = gw()
    return int(data)


MOD = int(1e9 + 7)

import numpy
from collections import deque
from math import sqrt
from math import floor


"""
m > n impossible
m = n, possible only when n = 1


"""

N = gi()
K = gi()

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

print(ans)

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

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

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,k = inpl()
res = 0
if k == 0:
    print(n**2)
    quit()
for b in range(k+1,n+1):
    cnt = 0
    cnt += (b-1)-(k-1)
    cnt += (n-(b-1))//b * (b-k)
    cnt += max(0, (n-(b-1))%b-k)
    res += cnt
print(res)

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

Solution (Python):
import sys
input = sys.stdin.readline
N, K = map(int, input().split())
res = 0
for i in range(1, N + 1):
  u = max(i - K, 0)
  v = N // i
  x = max(N % i - K + 1, 0)
  res += u * v + x - (K == 0)
  
  
print(res)

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


s=0

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

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

print(s)

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

Solution (Python):
import sys

stdin = sys.stdin
 
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  

N, K = rl()
answer = 0
if K == 0:
    print(N**2)
    exit()
for b in range(K+1, N+1):
    x = N // b
    answer += x * (b-K) + max(0, (N-(x*b))-K+1)
    

print(answer)

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

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

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

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

Solution (Python):
from collections import Counter,defaultdict,deque
import sys
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
    
def inp(): 
    return int(input())
def inpm(): 
    return map(int,input().split())
def inpl(): 
    return list(map(int, input().split()))
def inpls(): 
    return list(input().split())
def inplm(n): 
    return list(int(input()) for _ in range(n))
def inpll(n): 
    return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    n,k=inpm()
    ans = 0
    for b in range(k+1,n+1):
        x=n//b
        y=n%b
        a=x*(b-k)+max(0,y-k+1)
        ans+=a
    if k==0:
        ans-=n
    print(ans)


if __name__ == "__main__":
    main()

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

Solution (Python):
import sys
input = sys.stdin.readline
def solve():
  n,k  =(int(i) for i in input().split())
  if n <= k:
    print(0)
    exit()
  else:

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

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

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

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

ans = 0

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

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

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

    if K == 0:
        cnt -= N

    print(cnt)


if __name__ == "__main__":
    main()

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

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

    print(res)


if __name__ == "__main__":
    main()

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

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

print(ans)

Solution (Python):
import sys
n, k = [int(i) for i in sys.stdin.readline().split()]
cnt = 0
for i in range(k+1, n+1):
    larger = n // i
    amari = n % i
    cnt += larger * (i - k) + max(0, amari - k + 1) if k != 0 else larger * (i - k) + amari
print(cnt)

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























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



if __name__ == '__main__':
    main()

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























def main():
    N,K=map(int,input().split())
    ans=0
    for i in range(K+1,N+1):
        ans+=(N//i)*(i-K)+max((N%i-max(K,1)+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):
    tmp1 = max(0, n//i * (i-k))
    tmp2 = max(n%i+1-k, 0)
    ans += tmp1 + tmp2

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

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

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

Solution (Python):

import sys
input = sys.stdin.buffer.readline


from collections import defaultdict


def getlist():
	return list(map(int, input().split()))


def main():
	N, K = getlist()
	ans = 0
	for i in range(K + 1, N + 1):
		ans += (N // i) * (i - K)
		if N % i >= K and N % i != 0:
			ans += N % i - K + 1

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


if __name__ == '__main__':
	main()

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

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

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

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

    print(ans)

if __name__ == '__main__':
    main()

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

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

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

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

Solution (Python):
def main():
    n, k = map(int, input().split(' '))
    result = [n//i*max(0,i-k) + max(0, n%i-k+1) for i in range(1, n+1)]
    if k != 0:
        print(sum(result))
    else:   
        print(sum(result)-n)
main()

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

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

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

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

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

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):
import math
from operator import itemgetter
import re
import sys
from itertools import accumulate
from collections import defaultdict
from collections import deque
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
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):
        chk1 = N%b
        chk2 = N//b
        ans += (b-K)*chk2+max(0,chk1-K+1)
    print(ans)

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

count = 0
for b in range(max(k,1),n+1):
    if n % b != 0:
        t = math.ceil(n/b)
    else:
        t = int(n/b) + 1
    if n % b >= k:
        count += (b-k)*t - ((t*b-1)-n)
    else:
        count += (b-k)*(t-1)


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


print(count)

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

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

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

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

if K==0:
  print(N**2)
else:
  ans=0
  for i in range(K+1,N+1):
    ans+=(N-N%i)//i*(i-K)
    ans+=N%i-K+1if N%i>=K else 0
  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)*(b-K)
    ans += max(0, N-((N//b)*b+K)+1)
    
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):
import sys
input = sys.stdin.readline

def main():
    N,K = map(int,input().split())
    count = 0
    for i in range(K+1,N+1):
        p = N//i
        r = N%i
        count += p*max(0,i-K)+max(0,r-K+1)

    print(count) if K != 0 else print(count-N)

if __name__ == "__main__":
    main()

Solution (Python):


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

sum=0

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

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

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

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

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

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

Solution (Python):
from sys import exit, stdin
N, K = [int(_) for _ in stdin.readline().rstrip().split()]
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):

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


if __name__ == "__main__":
    main()

Solution (Python):

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


if __name__ == "__main__":
    main()

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

print(ans)

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

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

Solution (Python):

import sys


def solve(N: int, K: int):
    
    
    res = 0
    for b in range(K+1, N+1):
        m, r = divmod(N, b)
        res += N + 1
        if K == 0:
            res -= 1
        res -= m * K 
        res -= min(r+1, K) 
    print(res)
    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())

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

print(ans)

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

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

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

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

ans = 0

c = 0

for i in range(K+1,N+1) :
    c += 1
    d = min(N,N-(K-1))

    while d > 0 :
        ans += min(d,c)
        d -= c
        d -= K

print(ans)

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

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


n, k = li()

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

if k == 0:
    ans -= n

print(ans)

Solution (Python):
import sys
import numpy as np


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


main()

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

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

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

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

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

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

Solution (Python):
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n, k = f()
    ans = 0
    for b in range(k+1, n+1):
        if k!=0:
            ans += n//b * (b-k) + (n%b - (k-1) if n%b >k-1 else 0)
        else:
            ans += n
    
    print(ans)


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

print(ans)

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

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

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

print(s if K != 0 else N*N)

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

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

b = K + 1
s = 0
while b <= N:
    c = N % b
    s += (N//b)*(b-K) + max(0,c-K+1)
    b += 1

print(s)

Solution (Python):
import bisect
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
from operator import mul

import numpy as np
import re
import sys

sys.setrecursionlimit(10000)
INF = float('inf')

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

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

for b in range(K + 1, N + 1):
    nk = (N - K)
    bk = (b - K)
    ans += nk // b * bk + min((nk % b) + 1, bk)
print(ans)

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


def count():
    if k == 0:
        return n * n

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

    return c


print(count())

Solution (Python):



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

for b in range(K+1,N+1):
  cnt = 0
  x_max = N//b
  
  
  cnt += x_max * (b-K)
  
  lower = x_max*b+K
  if lower <= N:
    upper = min((x_max+1)*b-1,N)
    cnt += upper - lower + 1
  ans += cnt


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

Solution (Python):
import sys
import math
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()

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

print(result)

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)

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

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

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

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

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

if K==0:
  answer -= N

print(answer)

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

print(ans)

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

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

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

print(a if K!=0 else a-N)

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

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

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

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

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

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

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

Solution (Python):

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

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

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