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):



import sys
from collections import defaultdict, deque
from heapq import heappush, heappop
import math
import bisect
input = sys.stdin.readline




n = int(input())

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

print(ans)

Solution (Python):
n = int(input())
ans = 0
for i in range(1,n+1):
    div,mod = divmod(n,i)
    ans += div
    if mod == 0:
        ans -= 1
print(ans)

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

result = 0

for  A_1 in range(N):
    A = A_1 + 1
    B_m = N // A
    
    if N % A == 0:
        B_m -= 1
    
    result += B_m
    
print(result)

Solution (Python):
import sys


def main():
    input = sys.stdin.buffer.readline
    n = int(input())
    ans = 0
    for i in range(1, 1000):

        lo = 1
        hi = n + 1
        while hi - lo > 1:
            mid = (hi + lo) // 2
            if i * mid >= n:
                hi = mid
            else:
                lo = mid
        if lo < i:
            break
        else:
            ans += (lo - i) * 2 + 1
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):



import sys


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


def main():
    n = int(std_in())
    ans = 0
    neg = 0
    for a in range(1, n + 1):
        b, c = divmod(n, a)
        ans += b
        if c == 0:
            neg += 1

    print(ans - neg)


if __name__ == "__main__":
    main()

Solution (Python):
import sys
N=int(input())
wari=1
count=0
sum=0
for i in range(N):
    count=(N-1)//wari
    sum+=count
    wari+=1
print(sum)

Solution (Python):
from collections import defaultdict
n = int(input())
ans = 0
divide_minimam_prime = [i for i in range(n + 1)]
is_prime = [True for i in range(n + 1)]
is_prime[0] = False
is_prime[1] = False
for div in range(2,int(n**0.5) + 1):
    if is_prime[div]:
        
        k = div
        divide_minimam_prime[k] = k
        k += div
        while k <= n:
            is_prime[k] = False
            if divide_minimam_prime[k] == k:
                divide_minimam_prime[k] = div
            k += div
for i in range(1,n):
    k = i
    use_divnum = defaultdict(int)
    while k != 1:
        div = divide_minimam_prime[k]
        while k % div == 0 and k > 1:
            k = k // div
            use_divnum[div] += 1
    count = 1

    for j in use_divnum.values():
        count *= j + 1
    ans += count
print(ans)

Solution (Python):
num = 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
  
cnt = 0

print(sum(num_divisors_table(num)[:-1]))

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

Solution (Python):

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

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

ans = 0

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

print(ans)

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

total = 0
for i in range(n-1):
  total += n // (i+1)
  if n % (i+1) == 0 :
    total -= 1

print(total)

Solution (Python):
import math

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

    n_list=[0 for i in range(N)]

    for i in range(1,N):
        counter=1
        while counter*i<=N-1:
            n_list[counter*i]+=1
            counter+=1
    res=sum(n_list)
    print(res)
if __name__=="__main__":
    main()

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

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

for A in range(1, N + 1):
    for B in range(1, N + 1):
        if A * B >= N:
            break
        else:
            c += 1
print(c)

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(1000000000)
import math
from math import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations, combinations, chain, product
from functools import lru_cache
from collections import deque, defaultdict
from operator import itemgetter
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):
    return fs[n] * invs[n-k] * invs[k] % modp



class UnionFindEx:
    def __init__(self, size):
        
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    
        self.roots[r2] = r1
        return True

Yes = 'Yes'
No = 'No'

def main():
    N = ii()
    ans = 0
    for a in range(1, N):
        if a*a + 1 <= N:
            ans += 1
        maxb = (N-1)//a
        if a < maxb:
            ans += (maxb - a)*2
    print(ans)










main()

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

n = int(input())

cnt = 0
for i in range(n):
    a = i+1
    cnt += n//a
    if n%a == 0:
        cnt -= 1

print(cnt)

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

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

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
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()



def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
ans = 0

memo = [0] * N
A = N - 1
ans = 0
for i in range(1, N):
    ans += A // i
print(ans)

Solution (Python):
def main():
  n=int(input())
  r=0
  for i in range(1,n):
    for j in range(1,n):
      if i*j<n:
        r+=1
      else:
        break
  print(r)
main()

Solution (Python):
n=int(input())
ans=0
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
table=num_divisors_table(n)
for i in range(1,n):
    ans+=table[n-i]
print(ans)

Solution (Python):

n = int(input())

nsq = int( n ** (1/2) )
ans = 0
for i in range(1,nsq+1):
  res = (n-1) // i
  
  if res >= nsq:
    ans += 2*(res-i) + 1
print(ans)

Solution (Python):
N=int(input())
ans=0
for a in range(1,int(N**0.5)+1):
    for b in range(a,(N//a+1)):
        if a*b < N and a==b:
            ans+=1
        elif a*b < N and a!=b:
            ans+=2
print(ans)

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

divisors = []
ans = 0








for i in range(1, N):  
    divisors.append([i, N//i])

for a, b in divisors:
    if a*b == N:
        ans += b-1
    else:
        ans += b
print(ans)

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

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

print(ans)

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

c = 0

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

print(c)

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

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

main()

Solution (Python):
from sys import stdin, stdout
import heapq
import cProfile
from collections import Counter, defaultdict, deque
from functools import reduce
import math
import threading
import sys
import time


def get_int(): return int(stdin.readline().strip())


def get_tuple(): return map(int, stdin.readline().split())


def get_list(): return list(map(int, stdin.readline().split()))

n = get_int()
ans = n-1
for i in range(2,n):
    temp = n//i
    if temp*i==n: temp -= 1
    ans += temp
print(ans)

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

resolve()

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

dl = [0] * (N)

for i in range(1, N):
    for j in range(i, N, i):
        dl[j] += 1

ans = sum(dl)
print(ans)

Solution (Python):
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
def era_primes(n):
    is_prime = [-1] * (n + 1)
    is_prime[1]=1
    for i in range(2, int(n**0.5) + 1):
        if is_prime[i]!=-1:
            continue
        for j in range(i * 2, n + 1, i):
            if is_prime[j]==-1:
                is_prime[j] = i
    for i in range(n):
        if is_prime[i+1]==-1:
            is_prime[i+1]=i+1
    return is_prime

def factorize(N,prime_list):  
    lst = []
    
    
    
    while prime_list[N]!=1:
        lst.append(prime_list[N])
        N//=prime_list[N]
    return lst

lst=era_primes(10**6+10)

ans=0
for i in range(n-1):
    c=i+1
    ab=factorize(n-c,lst)
    dic={}
    tmp=1
    for i in ab:
        if i in dic:
            dic[i]+=1
        else:
            dic[i]=1
    for j in dic.values():
        tmp*=j+1
    
    ans+=tmp
    
print(ans)

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

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

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

print(count)

Solution (Python):

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

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

    divtable = num_divisors_table(n)
    
    ans = 0
    for c in range(1,n):
        t = divtable[n-c]
        ans += t

    print(ans)
    
        

if __name__ == "__main__":
    main()

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

Solution (Python):


import sys
import math
import time

import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools









N = int(input())
ans = 0

for i in range(1, N):
    ans += math.floor((N-1)/i)

ans = ans
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):
    c1 = n // i
    c2 = n % i

    if c2 == 0:
        ans += c1 - 1
    else:
        ans += c1
print(ans)

Solution (Python):
import sys
from math import ceil as C, floor as F, sqrt, gcd as G
from collections import defaultdict as D, Counter as CNT
from functools import reduce as R
import heapq as HQ

class Heap:
  def __init__(self, data, reverse=False):
    self.reverse = -1 if reverse else 1
    self.data = [self.reverse * d for d in data]
    HQ.heapify(self.data)
  def push(self, x): return HQ.heappush(self.data, self.reverse * x)
  def pop(self): return self.reverse * HQ.heappop(self.data) 

ALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alp = 'abcdefghijklmnopqrstuvwxyz'
def _X(): return sys.stdin.readline().rstrip().split(' ')
def _S(ss): return tuple(ss) if len(ss) > 1 else ss[0]
def S(): return _S(_X())
def Ss(): return list(S())
def _I(ss): return tuple([int(s) for s in ss]) if isinstance(ss, tuple) else int(ss)
def I(): return _I(S())
def _Is(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Is(): return _Is(I())

n = I()
ans = 0

for x in range(1, n):
    ans += (n-1) // x

print(ans)

Solution (Python):
n = int(raw_input())
ans = 0
def f(a,n):
	howmanybs = n/a
	return howmanybs +(-1 if n % a == 0 else 0)

for a in xrange(1, n+1):
	ans += f(a,n)
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

def is_ok(A,B,N):
    if A*B<N:
        return True
    else:
        return False

for a in range(1,N):

    ok=0
    ng=10**6+100
    while abs(ng-ok)>1:
        mid=(ok+ng)//2
        
        if is_ok(a,mid,N):
            ok=mid
        else:
            ng=mid
    
    ans+=ok
    
print(ans)

Solution (Python):
import math
n = int(input())
ans = 0
for i in range(n):
  a = i + 1
  b = 1
  c = n - a * b
  ans += math.ceil(c / a)
print(ans)

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

ans=0
for a in range(1,n):
  b_max=n//a
  num=a*b_max
  if n>num:
    ans+=b_max
  else:
    ans+=b_max-1
print(ans)

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

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

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

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

Solution (Python):
N = int(input())
i=1
c=0
while i**2<N:
    if N%i==0:
        c+=(N//i-1-i)*2+1
    else:
        c+=(N//i-i)*2+1
    i+=1
print(c)

Solution (Python):
n=int(input())
count=0
for i in range(1,int(n**(1/2))+1):
    for j in range(i,n):
        if i*j>=n:
            break
        elif i==j:
            count+=1
        else:
            count+=2
print(count)

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

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

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

count = 0
for i in range(1, N+1):
  for j in range(i, N+1):
    k = N - i*j
    
    if k >0:
      if i==j:
        count += 1
      else:
        count += 2
    else:
      break
print(count)

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

count = 0

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

print(count)

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


MAXN = 10**6 + 10
sieve = [i for i in range(MAXN + 1)]
p = 2
while p * p <= MAXN:
    if sieve[p] == p:
        for q in range(2 * p, MAXN + 1, p):
            if sieve[q] == q:
                sieve[q] = p
    p += 1


def solve(a):
    tmp = defaultdict(int)
    while a > 1:
        tmp[sieve[a]] += 1
        a //= sieve[a]
    ans = 1
    for i in tmp.values():
        ans *= (i + 1)
    return ans


n = int(input())
ans = 0
for i in range(1, n):
    ans += solve(i)
print(ans)

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

l = [0]*(n+1)
ans = 0

for i in range(1, n//2+1):
    for j in range(1, n+1, i):
        ans += 1

if n%2 == 0:
    ans -= 1
print(ans)

Solution (Python):

import sys, math, heapq
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep="\n")


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


table = num_divisors_table(N + 3)
chkset = set()
for i in range(int(math.sqrt(N) + 10)):
    chkset.add(i ** 2)

cnt = 0
for C in range(1, N):
    NC = N - C
    cnt += table[NC]
    
    
print(cnt)

Solution (Python):

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

Solution (Python):
n = int(input())
con = 0;
for x in range(1,n):
    con += (n-1) // x;
    
print(con)

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


for i in range(n):
    A = i + 1
    B = n // A
    Bmod = n % A
    if Bmod == 0:
        ans += B - 1
    else:
        ans += B

print(ans)

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

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

print(count)

Solution (Python):
N = int(input())
A = 1
B = 1
d = 0
e = 0

while A < N:
  while A * B < N:
    if A == B:
      e += 1
    else:
      d += 1
    B += 1
  A += 1
  B = A

print(d*2+e)

Solution (Python):


import math

def main():
    stdIn = int(input())
    stdOut = solve(stdIn)
    print(stdOut)


"""
方針
A * B + C = N を満たす正の整数の組の数を答える問題
掛け算から詰めていくのが良さそう
A <= Bに固定して、A == B なら +1, A != B なら +2するのがよさぞう
CはA * Bの値によって一意に定められる

"""


def solve(n):
    pattern = 0
    a = 1
    while a < n:
        
        patternB =  math.ceil(n / a) - 1 
        pattern += patternB
        a += 1
    return pattern


if __name__ == "__main__":
    main()

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

ans = 0

for n in range(N):
    ans += (N-1) // (n+1)

print(ans)

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

cnt=0

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

print(cnt)

Solution (Python):
N = int(input())
count = 0
flg = False
for i in range(1,N):

    count +=  int(N / i)
    if N% i == 0:
        count -=1
print(count)

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

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

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

spf=[1 for _ in range(N+1)]

for i in range(2,N+1):
    n=i
    if spf[i]!=1:
        continue
    while n<=N:
        if spf[n]==1:
            spf[n]=i
        n+=i

ans=0
for j in range(1,N):
    d={}
    t=j
    res=1
    while t>1:
        if spf[t] in d:
            d[spf[t]]+=1
        else:
            d[spf[t]]=1
        t//=spf[t]
    for D in d:
        res*=d[D]+1
    ans+=res
print(ans)

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

print(ans*2 - tmp)

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

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

ans = 0

for i in range(1,n):
    a = n // i
    for j in range(1,a+2):
        if i * j < n:
            ans = 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())

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

print(cnt)

Solution (Python):


import numpy as np
N=int(input())

ans=0

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

print(ans)

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

Solution (Python):
import math

n=int(input())

sum = 0
for i in range(n):

    if n%(i+1) == 0:
        sum += int(n/(i+1))-1
    else:
        sum += int(math.floor(n/(i+1)))

print(sum)

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 a in range(1,n+1):
    b = n//a
    c = n - a*b
    if c <= 0: ans += b-1
    else: ans += b
print(ans)

Solution (Python):
def main():
    n = int(input())
    count = 0
    a, b = 1, 1
    for i in range(1, n):
        for j in range(i, n):
            if i*j >= n:
                break
            if i == j:
                count += 1
            else:
                count += 2
    print(count)

if __name__ == '__main__':
    main()

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

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

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

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

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

print(ans)

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

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

ans = 0

for a in range(1, N):
    b = N // a
    if a * b == N:
        b -= 1
    po = b
    ans += po

print(ans)

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

Solution (Python):
import math
import pprint
import fractions
import collections
import itertools
from decimal import *
from collections import deque
from bisect import *
N=int(input())
l=[]
keys=[]
values=[]
ans=0
ma=10**6
x=[0]*(ma+1)
for i in range(1,ma):
    for j in range(i,ma+1,i):
        x[j]=x[j]+1
    
for j in range(1,N):
    
    m = N-j
    ans=ans+x[m]
print(ans)

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

Solution (Python):


from sys import stdin, stdout
from math import *

testing = False

def tp(s=""):
	if testing:
		stdout.write("{0}\n".format(s))

def main():
	n = int(stdin.readline())
	total = 0

	for a in range(1, n):
		count = (n-1)//a
		total += count
		tp(count)

	stdout.write("{0}\n".format(total))


	

main()

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

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

Solution (Python):
"""
                            pppppppppppppppppppp
                         ppppp  ppppppppppppppppppp
                      ppppppp    ppppppppppppppppppppp
                      pppppppp  pppppppppppppppppppppp
                      pppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppppp
       ppppppppppppppppppppppppppppppppppppppppppppppp  pppppppppppppppppppp
      pppppppppppppppppppppppppppppppppppppppppppppppp  ppppppppppppppppppppp
     ppppppppppppppppppppppppppppppppppppppppppppppppp  pppppppppppppppppppppp
    ppppppppppppppppppppppppppppppppppppppppppppppp    pppppppppppppppppppppppp
   pppppppppppppppppppppppppppppppppppppppppppppp     pppppppppppppppppppppppppp
  ppppppppppppppppppppppppppppppppppppppppppppp      pppppppppppppppppppppppppppp
  pppppppppppppppppppppppppppppppp               pppppppppppppppppppppppppppppppp
  pppppppppppppppppppppppppppp     pppppppppppppppppppppppppppppppppppppppppppppp
  ppppppppppppppppppppppppppp    pppppppppppppppppppppppppppppppppppppppppppppppp
    pppppppppppppppppppppppp  pppppppppppppppppppppppppppppppppppppppppppppppppp
     ppppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppppppp
      pppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppppp
       ppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppppp
                              pppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppp  pppppppp
                              ppppppppppppppppppppp    ppppppp
                                 ppppppppppppppppppp  ppppp
                                    pppppppppppppppppppp
"""


import sys
from functools import lru_cache, cmp_to_key
from collections import defaultdict as dd, deque, Counter as C
from bisect import bisect_left as bl, bisect_right as br, bisect
from heapq import heapify, heappop, heappush
from math import ceil, log, floor, sqrt
mod = pow(10, 9) + 7
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(var, end="\n"): sys.stdout.write(str(var)+end)
def outa(*var, end="\n"): sys.stdout.write(' '.join(map(str, var)) + end)
def L(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]


MAX = 1000001
factor = [0] * (MAX + 1)


def generatePrimeFactors():
    factor[1] = 1
    for i in range(2, MAX):
        factor[i] = i
    for i in range(4, MAX, 2):
        factor[i] = 2
    i = 3
    while i * i < MAX:
        if factor[i] == i:
            j = i * i
            while j < MAX:
                if factor[j] == j:
                    factor[j] = i
                j += i
        i += 1


def calculateNoOFactors(n):
    if n == 1:
        return 1
    ans = 1
    dup = factor[n]
    c = 1
    j = int(n / factor[n])
    while j > 1:
        if factor[j] == dup:
            c += 1
        else:
            dup = factor[j]
            ans = ans * (c + 1)
            c = 1
        j //= factor[j]
    ans = ans * (c + 1)
    return ans


sq = set()
i = 1
while True:
    sq.add(i * i)
    if i * i > 10 ** 6:
        break
    i += 1
number = int(data())
generatePrimeFactors()
answer = 0
for i in range(1, number):
    fact = calculateNoOFactors(i)
    answer += fact
out(answer)

Solution (Python):
N = int(input())
ans = 0
for a in range(1,N+1):
    for b in range(1,int(N/a)+1):
        if a*b<N:
            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()) -1
out = 0
for i in range(N):
    out += N // (i+1)
print(out)

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

Solution (Python):



def solve(*args: str) -> str:
    n = int(args[0])
    ret = 0
    for a in range(1, n):
        for b in range(a, n):
            if n <= a*b:
                break
            else:
                ret += 1 if a == b else 2

    return str(ret)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

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


if __name__ == "__main__":
    main()

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

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

print(cnt)

Solution (Python):
import sys
N=int(sys.stdin.readline().strip())
ans=0
for i in range(1,N):
    if N%i==0:
        max_sho=N/i-1
    else:
        max_sho=N/i
    ans+=max_sho
print ans

Solution (Python):

 
N = int(input())
ans = 0

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

print(ans)

Solution (Python):


import math


N = int(input())


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


print(ans)

Solution (Python):
n=int(input())
ans=0
for i in range(1,n):
    if n%i==0:
        p=n//i
    else:
        p=n//i+1
    for j in range(1,p):
        ans+=1
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

p = num_divisors_table(N)

print(sum(p[:N]))

Solution (Python):
import math
def main():

    N = int(input())
    ans = 0
    for i in range(1, N):
        j = N // i
        if i * j == N:
            j -=1
        ans += max(j, 0)
    return ans

if __name__ == '__main__':
    print(main())

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


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

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

for i in range(1, 1001):
  for j in range(i, 1000001):
    m = n - i * j
    if m > 0:
      if i == j:
        count += 1
      else:
        count += 2
    if m <= 0:
      break
print(count)

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

iMax = N - 1

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

print(ans)

Solution (Python):
from sys import stdin,stdout
def fn(div):
    cnt=0
    mul=1
    while (n-(mul*div))>0:
        cnt+=1
        mul+=1
    return cnt
n=int(stdin.readline());ans=0

for x in range(1,n):
    ans+=fn(x)
print(ans)

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

N = int(input())

ans = 0

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

print(ans)

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

Solution (Python):
n = int(input())
ans = 0
for a in range(1,n):
    for b in range(1,a+1):
        if a * b < n:
            if a == b:
                ans += 1
            else:
                ans += 2
        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 < n:
            ans += 1
            if i != j:
                ans += 1
        else:
            break
print(ans)