Problem:
 Score : 300 points    Problem Statement Given is a positive integer N .
How many tuples (A,B,C) of positive integers satisfy A \times B + C = N ?      Constraints  2 \leq N \leq 10^6  All values in input are integers.         Input Input is given from Standard Input in the following format:  N       Output Print the answer.        Sample Input 1 3      Sample Output 1 3  There are 3 tuples of integers that satisfy A \times B + C = 3 : (A, B, C) = (1, 1, 2), (1, 2, 1), (2, 1, 1) .       Sample Input 2 100      Sample Output 2 473       Sample Input 3 1000000      Sample Output 3 13969985

Solution (Python):
n = int(input())

def gcd(a, b):
    while b: a, b = b, a % b
    return a
def isPrimeMR(n):
    d = n - 1
    d = d // (d & -d)
    L = [2]
    for a in L:
        t = d
        y = pow(a, t, n)
        if y == 1: continue
        while y != n - 1:
            y = (y * y) % n
            if y == 1 or t == n - 1: return 0
            t <<= 1
    return 1
def findFactorRho(n):
    m = 1 << n.bit_length() // 8
    for c in range(1, 99):
        f = lambda x: (x * x + c) % n
        y, r, q, g = 2, 1, 1, 1
        while g == 1:
            x = y
            for i in range(r):
                y = f(y)
            k = 0
            while k < r and g == 1:
                ys = y
                for i in range(min(m, r - k)):
                    y = f(y)
                    q = q * abs(x - y) % n
                g = gcd(q, n)
                k += m
            r <<= 1
        if g == n:
            g = 1
            while g == 1:
                ys = f(ys)
                g = gcd(abs(x - ys), n)
        if g < n:
            if isPrimeMR(g): return g
            elif isPrimeMR(n // g): return n // g
            return findFactorRho(g)
def primeFactor(n):
    i = 2
    ret = {}
    rhoFlg = 0
    while i*i <= n:
        k = 0
        while n % i == 0:
            n //= i
            k += 1
        if k: ret[i] = k
        i += 1 + i % 2
        if i == 101 and n >= 2 ** 20:
            while n > 1:
                if isPrimeMR(n):
                    ret[n], n = 1, 1
                else:
                    rhoFlg = 1
                    j = findFactorRho(n)
                    k = 0
                    while n % j == 0:
                        n //= j
                        k += 1
                    ret[j] = k

    if n > 1: ret[n] = 1
    if rhoFlg: ret = {x: ret[x] for x in sorted(ret)}
    return ret

ans = 0
for c in range(1, n):
    d = primeFactor(n-c)
    temp = 1
    for k, v in d.items():
        temp *= (v+1)
    ans += temp
print(ans)

Solution (Python):
N = int(input())

res = 0
for a in range(1, N):
    res += (N-1) // a

print(res)

Solution (Python):

from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify

import itertools
import math, fractions
import sys, copy

def L(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline().rstrip())
def SL(): return list(sys.stdin.readline().rstrip())
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def R(n): return [sys.stdin.readline().strip() for _ in range(n)]
def LR(n): return [L() for _ in range(n)]
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def LIR1(n): return [LI1() for _ in range(n)]
def SR(n): return [SL() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]

def perm(n, r): return math.factorial(n) // math.factorial(r)
def comb(n, r): return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))

def make_list(n, *args, default=0): return [make_list(*args, default=default) for _ in range(n)] if len(args) > 0 else [default for _ in range(n)]

dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
alphabets = "abcdefghijklmnopqrstuvwxyz"
ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
MOD = 1000000007
INF = float("inf")

sys.setrecursionlimit(1000000)

class Eratosthenes:
    
    def __init__(self, n):
        primes, lp = [], [0] * (n + 1)
        for i in range(2, n + 1):
            if lp[i] == 0:
                primes.append(i)
                lp[i] = i

            for pj in primes:
                if pj > lp[i] or i * pj > n: break
                lp[i * pj] = pj
        self.primes, self.lp = primes, lp

    def is_prime(self, x): return self.lp[x] == x

    def factors(self, x):
        ret = []
        while x > 1:
            ret.append(self.lp[x])
            x //= self.lp[x]
        return ret

    def factors_count(self, x):
        ret = defaultdict(int)
        while x > 1:
            ret[self.lp[x]] += 1
            x //= self.lp[x]
        return ret


def main():
    N = I()
    era = Eratosthenes(N)
    d = defaultdict(int)
    for i in range(1, N):
        cnt = era.factors_count(i)
        tmp = 1
        for v in cnt.values():
            tmp *= v+1
        d[i] = tmp

    ans = 0
    for c in range(1, N):
        ans+= d[N - c]

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):


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

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

Solution (Python):
from sys import stdin


def main():
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])  
    
    ans = 0
    for A in range(1, N+1):
        ans += (N-1) // A
    
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
import math

res = 0
for a in range(1, n + 1):
    x = math.ceil(n / a) - 1
    res += x

print(res)

Solution (Python):
n = int(input())
ans = 0

for a in range(1,10**6):
    for b in range(1,10**6):
        if a*b < n:
            ans += 1
        else:
            break
            
print(ans)

Solution (Python):
n = int(input())
ans = 0
for a in range(1, n + 1):
    temp = n // a
    if n % a == 0:
        temp -= 1
    b = n // a
    c = b - a
    ans += temp
print(ans)

Solution (Python):
n=int(input())
ans=0

for a in range(1,10**6+1):
    ans+=(n-1)//a

print(ans)

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
cnt = [0] * (n+1)
for i in range(1, n):
    for j in range(i, n, i):
        cnt[j] += 1

ans = sum(cnt[:-1])
print(ans)

Solution (Python):
import numpy as np
n = int(input())
ans = np.zeros(n, dtype=np.int64)
for a in range(1,n):
    ans[a::a] += 1
print(ans.sum())

Solution (Python):
n = int(input())

sum = 0
for i in range(1, n):
    sum += (n - 1) // i

print(sum)

Solution (Python):
N=int(input())
ans=0
for a in range(1,pow(10,3)+1):
    for b in range(a,pow(10,6)+1):
        if a*b>=N:
            break
        if N-a*b>0:
            if a==b:
                ans+=1
            else:
                ans+=2
print(ans)

Solution (Python):
N = int(input())
counter = 0
for a in range(1, N):
    q, r = divmod(N, a)
    counter += q if r != 0 else q - 1
    a += 1
print(counter)

Solution (Python):
N = int(input())

ans = 0
for a in range(1, N+1):
    for b in range(1, N+1):
        if a*b < N:
            ans += 1
        else:
            break
print(ans)

Solution (Python):
def main():
    n = int(input())
    ans = n-1
    for i in range(2, n):
        a = n // i
        if n % i == 0:
            a -= 1
        ans += a
    print(ans)
if __name__=='__main__':
    main()

Solution (Python):

N=int(input())

ans=0
for a in range(1,N):
    ans+=(N-1)//a
print(ans)

Solution (Python):


N = int(input())

total = 0
for a in range(1,N):
    total += max(0,int((N-1)/a))

print(total)

Solution (Python):
def calc(N):
    ans = 0
    for i in range(N - 1):
        ans += (N - 1) // (i + 1)
    return ans


N = int(input())
print(calc(N))

Solution (Python):
N = int(input())

res = 0
for a in range(1, N):
    for b in range(1, N):
        if N <= a * b:
            break
        res += 1

print(res)

Solution (Python):
n = int(input())
ans = 0
for a in range(1, n):
    if n % a == 0:
        ans += n // a - 1
    else:
        ans += n // a
print(ans)

Solution (Python):
import sys













stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    n = int(stdin.readline().rstrip())
    
    
    ans = 0
    for a in range(1,n):
        z = n//a
        if n%a == 0:
            ans += z-1
        else:
            ans += z
    print(ans)





if __name__ == '__main__':
    solve()

Solution (Python):
N = int(input())
ans = 0
for i in range(1, N):
    for j in range(1, N):
        if i*j >= N:
            break
        else:
            ans += 1
print(ans)

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


def main(input, print):
    n = int(input())
    ans = 0
    for a in range(1, n):
        for b in range(1, n):
            if a*b >= n:
                break
            ans += 1
    print(ans)


if __name__ == '__main__':
    main(sys.stdin.readline, print)

Solution (Python):
n = int(input())
total = 0
for i in range(1,n):
  if n % i == 0:
    chk = (n // i) - 1
  else:
    chk = n // i
  total += chk
print(total)

Solution (Python):
N = int(input())
ans = 0
check = [0]*(N+1)
for i in range(1,N+1):
    for k in range(i,N+1,i):
        check[k] += 1
for c in range(1,N):
    ans += check[c]
print(ans)

Solution (Python):
n=int(input())
arr=[0]*n
for i in range(1,n+1):
	for j in range(i,n+1,i):
		arr[j-1]+=1
print(sum(arr)-arr[-1])

Solution (Python):
s=0
n=int(input())-1
for i in range(n):s+=n//(i+1)
print(s)

Solution (Python):
N = int(input())
print(sum((N-1)//a for a in range(1,N)))

Solution (Python):
N = int(input())

result = 0
for A in range(1, N):
    B_num = (N - 1) // A
    result += B_num
print(result)

Solution (Python):
n=int(input())
sm=0
for i in range(1,n):
    sm+=(n-1)//i
print(sm)

Solution (Python):
N = int(input())

num = [1]*(N)
for i in range(2, N):
    for j in range(i, N, i):
        num[j] += 1
print(sum(num) - 1)

Solution (Python):
from collections import defaultdict
from collections import deque
from collections import Counter
import math
import itertools

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n = readInt()

ans = 0
for a in range(1,10**6):
	if a>n:
		break
	for b in range(1,10**6):
		c = n-a*b
		
		if c>0:
			ans+=1
		else:
			break

print(ans)

Solution (Python):
N=int(input())

ans=0
for i in range(1,N+1):
    for j in range(i,N+1):
        if i==j:
            if i*j<N:
                ans+=1
            else:
                break
        else:
            if i*j<N:
                ans+=2
            else:
                break
print(ans)

Solution (Python):
n = int(input())

def num_divisors_table(n):
    table = [0] * (n + 1)

    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    return table

li=num_divisors_table(n)

ans = 0
for i in range(1,n):
    ans+=li[i]
print(ans)

Solution (Python):
N = int(input())
L = [0]*N
for i in range(1,N):
    for j in range(1,((N-1)//i)+1):
        L[i*j] += 1
ans = 0
for l in L:
    ans += l
print(ans)

Solution (Python):
N = int(input())
a = 1
s = 0
for i in range (N):
    if N%a == 0:
        s = s + (N // a) - 1
    else:
        s = s + (N // a)
    a = a + 1
print(s)

Solution (Python):
N = int(input())
ans = 0
for i in range(1,N//2+1):
    ans += (N-1)//i
ans += (N-1) - (N//2)
print(ans)

Solution (Python):
N=int(input())
ans = 0
for i in range(1,N):
  ans += (N-1)//i
print(ans)

Solution (Python):
N = int(input())
ans = 0
for i in range(1,N):
    ans += (N-1)//i

print(ans)

Solution (Python):
n = int(input())
ab = n-1
c = 0
for i in range(ab):
  ai = i+1
  c += ab//ai
print(c)

Solution (Python):
n=int(input())

x=[-1]*(n+1) 
x[0]=0
x[1]=1
i=2
prime=[]
while i<=n:
    if x[i]==-1:
        x[i]=i
        prime.append(i)
    for j in prime:
        if i*j>n or j>x[i]:break
        x[j*i]=j
    i+=1

def f(k):
    z=[]
    if k==1:
        return 1
    p=x[k]
    c=1
    while k>1:
        if p!=x[k//p]:
            z.append(c)
            c=1
        else:
            c+=1

        k=k//p
        p=x[k]

    ans=1
    for i in range(len(z)):
        ans=ans*(z[i]+1)
    return ans

s=0
for i in range(1,n):
    s+=f(i)
print(s)

Solution (Python):
n = int(input())
ans = 0
for a in range(1, n):
    ans += max(0, (n - 1) // a)
print(ans)

Solution (Python):
N = int(input())
ans = 0
for i in range(1, N):
    for j in range(i, N//i+1):
        
        if i*j < N:
            if i == j:
                ans += 1
            else:
                ans += 2
        else:
            break
print(ans)

Solution (Python):
n = int(input())
ans = 0

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

Solution (Python):
from collections import deque, Counter, defaultdict
from itertools import chain, combinations
import json

import bisect
import sys
import math
import bisect
from functools import lru_cache
import itertools

sys.setrecursionlimit(10 ** 8)

M = 10 ** 9 + 7
INF = 10 ** 17


def main():
    N = int(input())
    
    
    
    

    t = 0
    for a in range(1, N):
        d = (N-1) // a
        t += d
    print(t)


if __name__ == "__main__":
    main()

Solution (Python):

N = int(input())
ans = 0
for i in range(1, N+1):
    for j in range(1, N+1):
        if i*j <= N-1:
            ans += 1
        else:
            break
print(ans)

Solution (Python):





N = int(input())

nn = N - 1

ans = 0

for i in range(1, N):
    ans += nn // i

print(ans)

Solution (Python):
n = int(input())

ans = 0
for i in range(1,10**6 + 1):
    for j in range(1,10**6 + 1):
        if i*j < n:
            ans += 1
        else:
            break
print(ans)

Solution (Python):
N = int(input())
ans = 0
for i in range(1,N):
    ans += N//i
    if N%i==0:
        ans -= 1

print(ans)

Solution (Python):
N = int(input())
C = N-1
ans = 0
i = 1
while C>=i:
    ans += C//i
    i += 1
print(ans)

Solution (Python):
N = int(input())
res = 0
for a in range(1,N-1):
    res += N // a
    if N % a == 0:
        res -= 1
print(res+1)

Solution (Python):
import sys
from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: map(int, read().split())


class Factorize(object):

    def __init__(self, maxnum):
        self.primes = self.__smallest_prime_factors(maxnum)

    
    def factorize(self, n):
        fct = defaultdict(lambda: 0)
        while n != 1:
            fct[self.primes[n]] += 1
            n //= self.primes[n]

        ans = 1
        for k, v in fct.items():
            ans *= (v + 1)

        return ans

    
    def __smallest_prime_factors(self, n):

        prime = list(range(n + 1))

        for i in range(2, int(n**0.5) + 1):
            if prime[i] != i:
                continue
            for j in range(i * 2, n + 1, i):
                prime[j] = min(prime[j], i)
        return prime


def main():

    N = in_n()

    fct = Factorize(N + 10)

    ans = 0
    for i in range(1, N):
        ans += fct.factorize(i)

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
count = 0
for i in range(1,n):
    count += (n-1)//i
print(count)

Solution (Python):
n = int(input())

ans = 0
for a in range(1, n):
    for b in range(1, n):
        if a * b < n:
            ans += 1
        else:
            break
print(ans)

Solution (Python):
import sys
import math
import collections
import bisect
import itertools
import decimal
import copy
import heapq




INF = 10 ** 20
MOD = 10 ** 9 + 7


ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))
flush = lambda: sys.stdout.flush()



def main():
    n = ni()

    ans = 0

    for i in range(1, n + 1):
        b = n // i
        tmp = 1 if i * b == n else 0

        ans += n // i - tmp
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())

ans = 0

for i in range(1, n):
    for j in range(i, n):
        if i*j >= n:
            break
        if i == j:
            ans += 1
        else:
            ans += 2

print(ans)

Solution (Python):

MOD = 10 ** 9 + 7
INFI = 10**10

import math
from collections import deque
import itertools
import heapq

from fractions import Fraction
import copy
from functools import lru_cache
from collections import defaultdict
import pprint




def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default




def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)

def soinsubunkai(n):
    a = []
    i = 1
    while i*i <= n:
        if n % i == 0 and i!=1:
            a.append(i)
            n=n//i

        if n% i !=0 or i==1:
            i += 1
    nokori=[n]
    return a + nokori

def soinsubunkai_e(n,m): 
    a = set()
    i = 1
    while n>1:
        a.add(m[n])
        n=n//m[n]
    nokori=n
    a.add(nokori)
    return a

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


def era(n): 
    b=[i for i in range(n+1)]
    for i in range(2,int(math.sqrt(n)+10)):
        j=1
        temp=i*j
        while temp<=n:
            b[temp]=min(i,b[temp])
            temp+=i
    return b


def main():
    
    n=int(input())
    count=0
    for i in range(1,n):
        count+=(n-1)//i
    print(count)





if __name__ == "__main__":

    main()

Solution (Python):
import collections
N = int(input())
cnt = collections.defaultdict(int)
for lower in range(1, N):
    for upper in range(lower, N):
        if lower * upper > N:
            break
        cnt[lower * upper] += 1 if lower == upper else 2
ans = 0
for C in range(1, N):
    ans += cnt[N - C]
print(ans)

Solution (Python):
n = int(input())
ans = 0
for i in range(1, n):
	x = n//i
	if n%i == 0:
		x -= 1
	ans += x
print(ans)

Solution (Python):
N = int(input())
counter = 0

for i in range(1,N+1):
    for j in range(i,N+1):
        if i * j < N:
            if i == j:
                counter += 1
            else:
                counter += 2
        else:
            break

print(counter)

Solution (Python):
N = int(input())

count = 0
for i in range(1,N+1):
    for j in range(i,N+1):
        ab = i*j
        if ab < N and i==j:
            count+=1
        elif ab < N:
            count+=2
        else:
            break
print(count)

Solution (Python):
import sys

def solve():
      input = sys.stdin.readline
      N = int(input())
      count = N - 1
      for i in range(2, N):
            b = 1
            while i * b < N:
                  count += 1
                  b += 1
      print(count)

      return 0

if __name__ == "__main__":
      solve()

Solution (Python):
n = int(input())

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

Solution (Python):
n = int(input())
res = 0
for i in range(1, n):
    for j in range(1, n):
      
        if i*j >= n:
            break
        if i * j < n:
            res += 1
            
print(res)

Solution (Python):
n = int(input())
counter = 0
for i in range(n-1):
	ii = i + 1
	counter += (n - 1)// ii
print(counter)

Solution (Python):

N = int(input())

ans = 0
for i in range(1, N):
    ans += N // i - (1 if N % i == 0 else 0)

print(ans)

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1
from collections import defaultdict

N=int(input())

M=10**6

D=[-1]*(M+1)
D[0]=D[1]=1
for i in range(2,int(M**0.5)+1):
    if D[i]!=-1:
        continue
    for j in range(i*2,M+1,i):
        if D[j]==-1:
            D[j]=i

ans=0
for i in range(1,N):
    ab=N-i
    d=defaultdict(int)
    while D[ab]>1:
        d[D[ab]]+=1
        ab//=D[ab]
    if ab>1:
        d[ab]+=1
    tmp=1
    for v in d.values():
        tmp*=(v+1)
    ans+=tmp
print(ans)

Solution (Python):
N  = int(input())

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

Solution (Python):
N = int(input())
divisors = [1] * N
divisors[0] = 0
for i in range(2,N):
    for j in range(i,N,i):
        divisors[j] += 1
print(sum(divisors))

Solution (Python):
n=int(input())
ans=0
for a in range(1,n):
  if n%a==0:
    ans+=n//a-1
  else:
    ans+=n//a
print(ans)

Solution (Python):
N = int(input())

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

print(ans)

Solution (Python):
N = int(input())
ans = 0
for i in range(1, N):
  ans += N//i
  if N%i == 0:
    ans -= 1
print(ans)

Solution (Python):
def main():
    n = int(input())
    ans = 0
    for a in range(1, 10 ** 3 + 1):
        mb = (n - 1) // a
        if mb < a:
            continue
        ans += 2 * (mb - a) + 1
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    N = int(input())
    r = 0
    for a in range(1, N):
        b = N // a
        if b < 1:
            continue
        if a * b == N:
            b -= 1
        r += b
    return r

print(main())

Solution (Python):
def resolve():
    n = int(input())
    ans = 0
    for i in range(1, n):
        if n%i == 0:
            ans += n//i-1
        else:
            ans += n//i
    print(ans)
resolve()

Solution (Python):









INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    n=INT()
    ans=0
    for i in range(1,n):
        ans+=(n-1)//i
    print(ans)
if __name__=='__main__':
    do()

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

n = int(input())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

cnt = 0
from collections import Counter
for i in range(1, n):
    a = Counter(prime_factorize(i))
    add = 1
    for j in a.values():
        add *= j + 1
    cnt += add
print(cnt)

Solution (Python):
n = int(input())
ans = 0
if n == 2:
    print(1)
    exit()
else:
    for i in range(1, n):
        ans += (n-1)//i
    print(ans)

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    M = N-1
    ans = 0
    for i in range(1,N):
        ans += M//i
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())

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

print(ans)

Solution (Python):
n = int(input())
a=1
m = n - 1
count = 0
while a < n:
  count = count + (m // a)
  a = a + 1
print(count)

Solution (Python):

















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

N = INT()
ans = 0
for i in range(1, N):
    
    ans += (N - 1) // i
print(ans)

Solution (Python):
N = int(input())

count = 0
for a in range(1, N + 1):
    for b in range(1, (N // a) + 1):
        if a * b < N:
            count += 1

print(count)

Solution (Python):
n = int(input())
cnt = 0
for a in range(1, n+1):
    for b in range(a, n+1):
        if a * b < n: cnt += (2 if a != b else 1)
        else: break
print(cnt)

Solution (Python):

import sys
sys.setrecursionlimit(10**7)
import bisect
import heapq
import itertools
import math
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from math import gcd
from operator import add, itemgetter, mul, xor
def cmb(n,r,mod):
  bunshi=1
  bunbo=1
  for i in range(r):
    bunbo = bunbo*(i+1)%mod
    bunshi = bunshi*(n-i)%mod
  return (bunshi*pow(bunbo,mod-2,mod))%mod
mod = 10**9+7
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]










n = I()
ans = 0
for i in range(1,10**6+5):
    q = n//i
    r = n%i
    if r == 0:
        ans += q-1
    else:
        ans += q
print(ans)

Solution (Python):
N = int(input())
ans = 0
for i in range(1,10**6):
    for j in range(1,10**6):
        if N>i*j:
            ans += 1
        else:
            break
print(ans)

Solution (Python):
n=int(input())
ans=0
for i in range(1,n):
  for j in range(1,(n-1)//i+1):
    ans=ans+1
print(ans)

Solution (Python):
n = int(input())

ans = 0
for a in range(1, n):
    ans += (n-1) // a
print(ans)

Solution (Python):
import math
N = int(input())
cnt = 0
for a in range(1,N):
  for b in range(1,math.ceil(N/a)):
    cnt+=1
print(cnt)

Solution (Python):
n = int(input())
count = 0
for i in range(1, n):
  count += (n - 1) // i
print(count)

Solution (Python):
N = int(input())
ans = 0

for i in range(1, N):
    if i >= N:
        break

    for j in range(1, N):
        tmp = i * j

        if tmp >= N:
            break

        ans += 1

print(ans)

Solution (Python):
N = int(input())
ans = 0
for n in range(1, N):
    if N % n == 0:
        ans += N // n - 1
    else:
        ans += N // n
print(ans)

Solution (Python):
n = int(input())
res = 0
for i in range(1, n):
    for j in range(1, n):
        if i*j >= n:
            break
        if i * j < n:
            res += 1
print(res)

Solution (Python):
N = int(input())

cnt = 0
for a in range(1, N):
    for b in range(1, N):
        if N - a*b > 0:
            cnt += 1
        else:
            break
print(cnt)

Solution (Python):
N = int(input())

ans = 0
for a in range(1, N+1):
    if N%a == 0:
        ans += N // a - 1
    else:
        ans += N // a

print(ans)

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

def main():
    N = int(input())
    dp = [1] * N
    for p in range(2, N + 1):
        num = p
        while num < N:
            dp[num] += 1
            num += p
    print(sum(dp[1:]))



if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
ans=0
for a in range(1,n+1):
  for b in range(1,n+1):
    if a*b>=n:
      break
    else:
      ans+=1
print(ans)

Solution (Python):
N = int(input())
ans = 0
for i in range(1, N):
    if (N % i == 0):
        ans += N // i - 1
    else:
        ans += N // i

print(ans)

Solution (Python):
n = int(input())
ans = 0
for a in range(1, n + 1):
    for b in range(a, n + 1):
        if a * b < n:
            if a == b:
                ans += 1
            else:
                ans += 2
        else:
            break
print(ans)

Solution (Python):
N = int(input())

cnt = 0
for a in range(1, N):
    
    if N % a == 0:
        cnt += N // a - 1
    else:
        cnt += N // a

print(cnt)

Solution (Python):
n = int(input())
ans = 0
for i in range(1,n+1):
    if i > n:
        break
    ans += n//i
    if n//i * i == n:
        ans -= 1
print(ans)

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())

ans = 0
for a in range(1, N+1):
    cnt = 1
    while a*cnt<N:
        ans += 1
        cnt += 1

print(ans)

Solution (Python):




import sys
from io import StringIO
import unittest





def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    
    
    n=int(readline())
    ans=0
    for a in range(1,n):
        
        ans+=(n-1)//a
    print(ans)
    
    

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()