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



Sample input:
5 2


Sample output:
7

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 13 17:57:26 2018


1 <= a,b <= N
a % b >= K　である(a, b)の個数

分かるもの
N, K


入力
5 2

出力
7


@author: Yuya
"""

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

count = 0

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

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
count = 0
for k in range(K, N):  # あまりがk
    for i in range(k + 1, N + 1):
        count += int((N - k) / i) + 1
        # print(",".join(["({},{})".format(j, i)
        # for j in range(k, N + 1, i)]))
print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

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

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

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

print(count)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
r=0
for b in range(1,n+1):r+=min(b,k)-1
for q in range(1,n+1):
  for b in range(1,n//q+1):r+=min(k,n-q*b+1,b)
print(n*n-r)

Submission status: Wrong Answer

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

num = 0

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

Submission status: Wrong Answer

Solution code:
N,K=map(int,input().split())
# a<bのとき(N-k)+(N-k-1)+...+1
ct=(N-K)*(N-K+1)//2
# a>bのときsum_b(N-K)//b ただしb=k+1~
for b in range(K+1,N+1):
    ct+=(b-K)*(N//b-1)+max(0,N%b-K+1)
print(ct)

Submission status: Wrong Answer

Solution code:
n,k=list(map(int,input().split()))
result=0
for b in range(k+1,n+1):
    amari=n%b
    if amari>=k and amari<b:
        result+=(amari-k+1)*((n//b)+1)+(b-amari-1)*((n//b))
    elif amari>=k:
        result+=(b-k)*((n//b)+1)
    else:
        result+=(b-k)*((n//b))
print(result)

Submission status: Wrong Answer

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

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

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

print(count)

Submission status: Wrong Answer

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

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


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

print(count)

Submission status: Wrong Answer

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

count = 0
for b in range(K+1, N+1):
    for l in range(K, b):
        count += int((N-l)/b)

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

print(count)

Submission status: Wrong Answer

Solution code:
def count_k_or_more(b, N, K):
    # N = pb + r
    p = N // b
    r = N % b

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


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

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

    print(total)

Submission status: Wrong Answer

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


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

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

print(int(cnt))

Submission status: Wrong Answer

Solution code:
# N, K = map(int, input().split())
N = 31415
cnt = 0
K = 9265

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

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

print(int(cnt))

Submission status: Wrong Answer

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

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

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

print(cnt)

Submission status: Wrong Answer

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

cnt = 0


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

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

print(cnt)

Submission status: Wrong Answer

Solution code:
# N, K = map(int, input().split())
K = 2
cnt = 0
N = 5

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

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

print(cnt)

Submission status: Wrong Answer

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

cnt = 0


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

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

print(cnt)

Submission status: Wrong Answer

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

cnt = 0


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

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


print(cnt)

Submission status: Wrong Answer

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

cnt = 0


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

    cnt += (b-K)*(N//b) + max((N - (N //b) * b) - K , 0)
    print((b-K)*(N//b) , max((N - (N //b) * b) - K, 0), cnt)

Submission status: Wrong Answer

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

cnt = 0


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

print(cnt)

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
#K = 2
cnt = 0
#N = 5

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

print(cnt)

Submission status: Wrong Answer

Solution code:
N, K = map(int, input().split())
#K = 2
cnt = 0
#N = 5

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

print(cnt)

Submission status: Wrong Answer

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

cnt = 0

for k in range(K, N):
    for b in range(k+1, N+1):
        cnt += int((N - k)/b) + 1

print(cnt)

Submission status: Wrong Answer

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

cnt = 0

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

        while m * b + k <= N:
            cnt += 1
            m += 1

print(cnt)

Submission status: Wrong Answer

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

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

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

print total

Submission status: Wrong Answer

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

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

print(count)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
x = input().split(" ")
n = int(x[0])
k = int(x[1])
count = 0
for a in range(k, n+1):
    count += n-a
    for b in range(1, a+1):
        if a % b >= k:
            count += 1
            if a % b == k:
                continue
print(count)

Submission status: Wrong Answer

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

count = 0

for a in range(k, n+1):
    for b in range(1, n+1):
        if a % b >= k:
            count += 1

print(count)

Submission status: Wrong Answer

Solution code:
n = raw_input()
n= n.split()
N = int(n[0])
K = int(n[1])
ans = 0

for i in range(K,int(N)+1):
	for r in range(1,int(N)+1):
		if r == i:
			ans += int(N) - r
			print("break")
			break
		mod = pow(i,1,r)
		if mod >= K:
			ans += 1

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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



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

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

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

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

print (ans)

Submission status: Wrong Answer

Solution code:
def f(n, k):
    return 0.5*(n-k)*(n-k+1)
    #return 0.5*(n**2 - 2*n*k - n + k**2 + k)

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

cnt = 0
for a in range(K, N+1):
    for b in range(K, a+1):
        if a == 0 or b == 0:
            continue
        if ((a%b) >= K):
            cnt += 1

cnt += f(N, K)
print(int(cnt))

Submission status: Wrong Answer

Solution code:
import math
if __name__ == "__main__":
    N, K = list(map(int, (input().split(' '))))
#    ans = N * N
#    buf = 0
#    for i in range(0, K):
#        for j in range(1, N+1):
#            if i == 0:
#                if j == 0:
#                    buf += N
#                else:
#                    buf += math.floor(N / j)
#            else:
#                if j != 1:
#                    if (N % j) >= i:
##                        print(i, j, math.floor(N / j) + 1)
#                        buf += math.floor(N / j) + 1
#                    else:
##                        print(i, j, math.floor(N / j))
#                        buf += math.floor(N / j)
#    ans -= buf
    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)
    print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def d_remainder_reminder(N, K):
    ans = 0
    for b in range(K + 1, N + 1):
        # N=pb+r(0<=r<b) と表すと、aを"0"からNまで変化させたときに
        # a%bを順に並べた列は、[0,1,2,...,b-1]*p + [0,1,2,...,r] となる
        p = N // b
        r = N % b
        # 条件を満たすaの個数は、p*max(0,b-K) + max(0,r+1-K) 個
        ans += p * max(0, b - K) + max(0, r + 1 - K)
    if K == 0:
        # K=0のとき、1回のループで1だけ解が大きくなる(a=0の分を足してしまうため)
        # その分を差し引く
        ans -= N
    return ans

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

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

print(c)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def solve(n,k):
  counter = 0
  for i in range(n,k,-1):
    theValue = n//i * (i-k) + max(n%i-k , 0)
    counter += theValue
  return counter
 
c = list(map(int, input().split(' ')))
solve(c[0], c[1])

Submission status: Wrong Answer

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

ans = 0
for i in range(1, N + 1):
    if i < K:
        continue
    for j in range(1, N + 1):
        if j <= K:
            continue
        elif i < j:
            ans += len(list(range(i, N)))
            break
        elif i > j:
            if i % j >= K:
                ans += 1

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
if __name__ == "__main__":
    N, K = list(map(int, (input().split(' '))))
    ans = N * N
    buf = 0
    for i in range(0, K):
        for j in range(1, N+1):
            if i == 0:
                if j == 0:
                    buf += N
                else:
                    buf += math.floor(N / j)
            else:
                if j != 1:
                    if (N % j) >= i:
#                        print(i, j, math.floor(N / j) + 1)
                        buf += math.floor(N / j) + 1
                    else:
#                        print(i, j, math.floor(N / j))
                        buf += math.floor(N / j)
    ans -= buf
    print(ans)

Submission status: Wrong Answer

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

cnt = 0
for a in range(K, N+1):
    for b in range(K, a+1):
        if a == 0 or b == 0:
            continue
        if ((a%b) >= K):
            cnt += 1

cnt += 0.5*(N**2 - 2*N*K - N + K**2 + K)
print(int(cnt))

Submission status: Wrong Answer

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

cnt = 0
for a in range(K, N+1):
    for b in range(K, a+1):
        if a == 0 or b == 0:
            continue
        if ((a%b) >= K):
            print(a,b)
            cnt += 1
            print(cnt)

print(cnt)

cnt += 0.5*(N**2 - 2*N*K - N + K**2 + K)
print(int(cnt))

Submission status: Wrong Answer

Solution code:
#-*- coding:utf-8 -*-
import math

if __name__ == "__main__":
    N, K = list(map(int, input().split()))
    # (1)aがK以上のとき、 a<b を満たすものはありうる組となる
    # (2)ソレ以外のとき、愚直に計算する
    ans = 0
    #(1)
    n = (N-K)
    ans += int(n*(n+1)/2)
    #(2)
    for a in range(K, N+1):
        for b in range(1, a+1):
                if a%b >= K:
                    ans += 1
    print(ans)

Submission status: Wrong Answer

Solution code:
#-*- coding:utf-8 -*-
import math

if __name__ == "__main__":
    N, K = list(map(int, input().split()))
    # (1)aがK以上のとき、 a<b を満たすものはありうる組となる
    # (2)ソレ以外のとき、愚直に計算する
    ans = 0
    #(1)
    n = (N-K)
    ans += int(n*(n+1)/2)
    #(2)
    for a in range(1, N+1):
        for b in range(1, a+1):
            if a >= K:
                if a%b >= K:
                    ans += 1
    print(ans)

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
if k == 0:
    print(n**2)
if k <= 100:
    ans = 0
    for j in range(k):
        for i in range(k+1,n+1):
            ans += (n-j)//i
    print((n-k+1)*(n-k)-ans)
else:
    r = n//k
    ans = 0
    for i in range(1,r+3): #a=(i-1)×b+あまり
        genkai = n - (i)*k
        for j in range(1,n-k+1): #b=k+j
            x = (i-1)*j
            ans += min(max(genkai-x+1,0),j)
    print(ans)

Submission status: Wrong Answer

Solution code:
n, k = map(int, input().split())
c = 0
for a in range(k, n+1):
  c += max(a // 2 + 1 - k, 0)
  c += n+1 - a

print(c)

Submission status: Wrong Answer

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

count = 0

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

Submission status: Wrong Answer

Solution code:
import numpy as np
n, k = map(int, input().strip().split(" "))
count = (n - k) * (n - k + 1) // 2
primes = np.array([True for _ in range(n + 1)])
primes[0] = False
primes[1] = False
p = []
for i in range(2, n + 1):
    if primes[i]:
        p.append(i)
        primes[i::i] = False
# """
# count = 0
for a in range(max(k, 1), n + 1):
    if a < k:
        continue
    for b in range(1, n + 1):
        if a < b:
            break

        if a % b >= k:
            count += 1
"""
for _p in p:
    if _p < k:
        continue
    for a in range(max(1, _p+1), n + 1):
        if a % _p >= k:
            count += 1
# """
print(count)

Submission status: Wrong Answer

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

print(x)

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
if k == 0:
    print(n**2)
elif k == 1:
    x = 0
    for i in range(2, n+1):
        x += n//i
    print(n*(n-k)-x)
elif k == 2:
    x = 0
    for i in range(3, n+1):
        x += n//i
    for i in range(3,n+1):
        x += (n-1)//i
    print(x*(n-k)-x)
else:
    r = n//k
    ans = 0
    for i in range(1,r+3): #a=(i-1)×b+あまり
        genkai = n - (i)*k
        for j in range(1,n-k+1): #b=k+j
            x = (i-1)*j
            ans += min(max(genkai-x+1,0),j)
    print(ans)

Submission status: Wrong Answer

Solution code:
n,k = map(int,input().split())
if k == 0:
    print(n**2)
elif k == 1:
    x = 0
    for i in range(1, n+1):
        x += n//i
    print(n*(n-k)-x)
else:
    r = n//k
    ans = 0
    for i in range(1,r+3): #a=(i-1)×b+あまり
        genkai = n - (i)*k
        for j in range(1,n-k+1): #b=k+j
            x = (i-1)*j
            ans += min(max(genkai-x+1,0),j)
    print(ans)

Submission status: Wrong Answer

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

Submission status: Time Limit Exceeded

Solution code:
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()  # ignore trailing spaces

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()  # ignore trailing spaces

N, K = na()
ans = 0
if K == 0:
    print(N ** 2)
    sys.exit()
    
for b in range(K+1, N+1):
    #print(b)
    for q in range(K, b):
        ans += (N - q) // b + 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
ans = 0
for k in range(K, N):
  for b in range(k + 1, N + 1):
    if k == 0:
      ans += ((N - k) // b)
    else:
      ans += ((N - k) // b + 1)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n,k = map(int,input().split())
count = 0
on = 0
for i in range(1,n+1):
    if i < k:
        continue
    elif i >= k and i <= 2*k:
        count+=(n-i)
    else:
        count += (n-i)
        for j in range(k+1,i-k+1):
            if i % j >= k:
                count+=1
            else:
                continue

print(count)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
x=0
for b in range(k+1,n+1):
  for i in range(k,b):
    x+=(n-i)//b+(i>0)
print(x)

Submission status: Time Limit Exceeded

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

# naive O(N^2)

ret = 0

for a in range(1, N + 1):
  for b in range(1, N + 1):
    d, m = divmod(a, b)
    if m >= K:
      ret += 1

print(ret)

Submission status: Time Limit Exceeded

Solution code:
A,B=map(int, input().split())
X =0
for i in range(1,A+1):
    for n in range(1,A+1):
        if i%n>=B:
            X+=1
        else:
            X+=0
print(X)

Submission status: Time Limit Exceeded

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

for x in range(1, N+1):
    for y in range(1, N+1):
        if x%y >=K:
            cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
ans=0
for i in range(1,n+1):
  for j in range(1,n+1):
    if i%j>=k:
      ans+=1
print(ans)

Submission status: Time Limit Exceeded

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

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

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
def  main():
    N,K = map(int,input().split())
    ans = 0
    for k in range(K,N):
        for b in range(k+1,N+1):
            cnt = (N-k)//b
            if k!=0:
                cnt += 1
            ans += cnt
    print(ans)    


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
N,K = map(int,input().split())
ans = 0
for k in range(K,N):
    for b in range(k+1,N+1):
        cnt = (N-k)//b
        if k!=0:
            cnt += 1
        ans += cnt
print(ans)

Submission status: Time Limit Exceeded

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

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

ans = 0
for b in range(K+1,N+1):
  now = K
  while True:
    if now+K <= N:
      ans += b-K
      now += b
    else:
      ans += len([now+i for i in range(b-K) if now+i <= N])
      break
      
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
ans = 0
for i in range(1, N+1):
    for j in range(1, N+1):
        if i % j >= K:
            ans += 1
print(ans)

Submission status: Time Limit Exceeded

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

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

cnt=0
for a in range(k,n+1):
    b=list(range(k,n+1))
    cnt+=len(list(filter(lambda x: a%x>=k, b)))

print(cnt)

Submission status: Time Limit Exceeded

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

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

cnt=0
for a in range(k,n+1):
    for b in range(k,n+1):
        if a<k or b<k:
            continue
        if a%b >= k:
            cnt+=1

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n,k=map(int,input().split())
ans=0
## a<b and k>0
ans+=(n-k)*(n-k+1)//2

#print(ans)
## a>b
for i in range(k,n+1):
    for j in range(1,i):
        if i%j>=k:
            ans+=1

print(ans)

Submission status: Time Limit Exceeded

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

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

print (count)

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
ans = 0
for a in range(K, N + 1):
    for b in range(1, a):
        if a > b:
            if a % b >= K:
                ans += 1
    ans += N - a
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

for a in range(1, n+1):
    for b in range(1, n+1):
        if a % b >= k:
            count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
N, K = map(int, input().split())
l = []
cnt = 0

for i in range(1, N+1):
	l.append(i)


for a in l:
	for b in range(K, N+1):
		if b != 0:
			if a % b >= K:
				cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-

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

ans = 0

for i in range(max(k,1),n+1):
    for j in range(max(k,1),n+1):
        if i % j >= k:
            ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
#D
n, k = map(int, input().split())
count = 0
for a in range(1, n+1):
    for b in range(1, n+1):
        if a % b >= k:
            count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
N, K = map( int, input().split())
ans = 0
for a in range(K,N+1):
    for b in range(1,a):
        if a%b >= K:
            ans += 1
    ans += N - a
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys
import time

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

ans = 0

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

#start = time.time()

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

#elapsed_time = time.time() - start

print(ans)
#print ("elapsed_time:{0}".format(elapsed_time) + "[sec]")

Submission status: Time Limit Exceeded

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

if K > 0:
    count = 0

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

    print(count)
else:
    print(N*N)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 13 17:57:26 2018


1 <= a,b <= N
a % b >= K　である(a, b)の個数

分かるもの
N, K


入力
5 2

出力
7


@author: Yuya
"""

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

if K > 0:
    count = 0

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

    print(count)
else:
    print(N*N)

Submission status: Time Limit Exceeded

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

count = 0
for b in range(K+1, N+1):
    for l in range(K, b):
        count += int((N-l)/b)


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

print(count)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

N_K = list(map(int, input().split()))
 
count = 0

a = np.array([i for i in range(1, N_K[0]+1)])
b = np.array([i for i in range(1, N_K[0]+1)])

for i in range(len(b)):
    count += sum(a % b[i] >= N_K[1])

    
'''
for a in range(1, N_K[0]+1):
  for b in range(1, N_K[0]+1):
    if a % b >= N_K[1]:
      count += 1
'''

print(count)