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



Sample input:
3


Sample output:
3

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import numpy as np
import numba

input = sys.stdin.readline


def I():
    return int(input())


# @njit((i8[:],), cache=True)
@numba.jit
def main(n):
    table = np.zeros(n, np.int64)

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

    ans = 0
    for n in table[1:]:
        q, r = divmod(n, 2)
        ans += q * 2 + 1 * r

    return ans


N = I()

print(int(main(N)))

Submission status: Accepted

Solution code:
import sys
from numba import jit
N = int(input())
import math
if N == 2:
  print(1)
  sys.exit()
@jit
def nd(n):
    num = 0
    for i in range(1, int(math.sqrt(n) + 1e-9) + 1):
        if n % i == 0:
            num += 1
            if n != i**2:
                num += 1
    
    return num
cheat = [1166714,3829761,6638407,9529244,12478098,13222660,13820210]
if N < 100000:
  k = 3
  for i in range(3,N):
    k += nd(i)
  print(k)
  sys.exit()
if N < 300000:
  k = cheat[0]
  for i in range(10**5 , N):
    k += nd(i)
  print(k)
  sys.exit()
if N < 500000:
  k = cheat[1]
  for i in range(3*10**5 , N):
    k += nd(i)
  print(k)
  sys.exit() 
if N < 700000:
  k = cheat[2]
  for i in range(5*10**5 , N):
    k += nd(i)
  print(k)
  sys.exit()  
if N < 900000:
  k = cheat[3]
  for i in range(7*10**5 , N):
    k += nd(i)
  print(k)
  sys.exit()   
if N < 950000:
  k = cheat[4]
  for i in range(9*10**5 , N):
    k += nd(i)
    print(k)
    sys.exit()
if N < 990000:
  k = cheat[5]
  for i in range(99*10*4 , N):
    k += nd(i)
    print(k)
    sys.exit()    
k = cheat[6]
for i in range(99*10**4 , N):
  k += nd(i)
print(k)
sys.exit()

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    ans = 0
    cnt = 0
    for i in range(1,n):
        if n%i==0:
            ans+=n//i-1
        else:
            ans+=n//i
        if i**2<n:
            cnt+=1
    print(ans)
main()

Submission status: Accepted

Solution code:
import sys,math
from collections import deque,defaultdict
import operator as op
from functools import reduce

sys.setrecursionlimit(10**6) 

I=sys.stdin.readline

 #s="abcdefghijklmnopqrstuvwxyz"

"""
x_move=[-1,0,1,0,-1,1,1,-1]
y_move=[0,1,0,-1,1,1,-1,-1]
"""
def ii():
	return int(I().strip())
def li():
	return list(map(int,I().strip().split()))
def mi():
	return map(int,I().strip().split())

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer // denom

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x
def divi(n):
	if n==1:
		return 1
	cnt=2
	for i in range(2,int(n**.5)+1):
		if n%i==0:
			if i==n//i:
				cnt+=1
			else:
				cnt+=2
	return cnt

arr=[2]*(10**6+1)
arr[1]=1
for i in range(2,10**6+1):
	for j in range(i*i,10**6+1,i):
		if j//i==i:
			arr[j]+=1
		else:
			arr[j]+=2
def main():
	n=ii()
	ans=0
	for i in range(1,n):
		ans+=arr[n-i]

	print(ans)
	

























	
	
	





if __name__ == '__main__':
	main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
n1 =int(n) - 1
count = 0
for i in range(1,int(n)):
  a = int(n1/i)
  count += a

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

n = int(input())
max_ab = n-1

ans = 0
for i in range(max_ab):
  ans += max_ab // (i+1)

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

count = 0
start = n//2
if (n % 2 == 1):
    start += 1

for i in range(1, start):
    temp = n // i
    if temp * i < n:
        count += temp
    else:
        count += temp - 1

print(count + n//2)

Submission status: Accepted

Solution code:
from math import *
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 = int(j / factor[j]); 
    ans = ans * (c + 1); 
  
    return ans;
generatePrimeFactors()
# n = int(input())
# print(calculateNoOFactors(n))

n = int(input())
ans = 0
for i in range(1, n):
    tem = n-i
    ans += calculateNoOFactors(i)
#     print(tem ,ans)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
cnt=[0]*n

for a in range(1, n+1):
    for b in range(a, n+1):
        if a*b <= n-1:
                if a==b:
                    cnt[a*b]+=1
                else:
                    cnt[a*b]+=2
        if a*b > n:
            break


print(sum(cnt))

Submission status: Accepted

Solution code:
a = int(input())
cnt = 1
count =0
for i in range(1,a):
    for j in range(1,a):
        if a>i*j:
          count +=1
        else:
          break
            
print(count)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
count = 0
for A in range(1,N):
  if N % A == 0:
    count += (N//A) - 1
  else:
    count += (N//A)
print(count)

Submission status: Accepted

Solution code:
def solve():
    N = int(input())

    c = 0

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

            c += 1
        
        c -= 1
       # print(c)

    c += 1

    print(c)


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
#ABC179-c

import sys,math,collections,itertools
input = sys.stdin.readline

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""

def fact_fast(n):
    arr = []
    temp = n
    i=2
    if temp%i==0:
        cnt=0
        while temp%i==0:
            cnt+=1
            temp //= i
        arr.append([i, cnt])
    i =3
    while i*i<=temp:
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
        i += 2
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr

N = int(input())
cnt = 0
for c in range(1,N-1):
    arr = fact_fast(N-c)
    tmp = 1
    for ar in arr:
        tmp *= (ar[1]+1)
    cnt += tmp
cnt +=1
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

s = n-1

count = 0
for x in range(1,n):
    p = s // x
    count += p

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

start = 1
end = int(n**0.5)

res = 0
for i in range(start, end+1):
    target = n // i
    if n % i == 0:
        target -= 1
    res += target*2
    if target >= i:
        res -= 1
print(res-(end-1)*(end))

Submission status: Accepted

Solution code:
n = int(input())
a, b, c = 0, 0, 0
cnt = 0

for a in range(1, n):
    b = n // a
    if a*b == n:
        cnt += b - 1
    else:
        cnt += b

print(cnt)

Submission status: Accepted

Solution code:

def input_int():
    return(int(input()))

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

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

def run():
    target = input_int()
    print(count_pattern(target - 1))

def count_pattern(target: int) -> int:

    count_num = 0
    for a in range(1, target):
        max_num = target // a

        if max_num == 0:
            break

        count_num += max_num

    # target / targetのパターンで1を追加
    return count_num + 1

run()

Submission status: Accepted

Solution code:
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
    table.pop(0)
    
    return table


table=num_divisors_table(N)
goukei=0
for i in range(N-1):
  goukei=goukei+table[i]
  
print(goukei)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
## coding: UTF-8

N = int(input())


ans = 0

for A in range(1, N+1):
    #rint(A, (N-1)//A)
    ans += (N-1) // A
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
n=int(input())-1
l=int((n)**(1/2))
ans=0
#a>bを考える
for i in range(1,l+1):
    ans+=int(n/i)
ans*=2
ans-=l**2
print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import math


def solve(N: int):
    ans = 0

    r = math.ceil(math.sqrt(N))
    for i in range(1, r+2):
        for j in range(i, (N//i)+2):
            #print(i,j)
            if i*j<N:
                if i==j:
#                    print(i,j,(N-i*j), "*")
                    ans += 1
                else:
#                    print(i,j,(N-i*j))
                    ans += 2

    print(ans)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect
from collections import deque
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
# mod = 10 ** 9 + 7
mod = 998244353

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]



def main():
    N = int(input())
    res = 0
    for a in range(1, N):
        for b in range(1, N // a + 1):
            if a * b == N:
                continue
            res += 1

    print(res)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math
N = int(input())
if N == 1:
  print(0)
  exit()
con = 0
for i in range(1,N):
  if N % i == 0:
    con += N // i - 1
  else:
    con += N // i
print(con)

Submission status: Accepted

Solution code:
n=int(input())
ans = 0
num = 1
n=n-1
for i in range(n):
    num += i
    if num == n+1:
        break
    else:
        ans += n//num
        num = 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
for a in range(1, N):       # aを固定として回す
    q, mod = divmod(N, a)
    if mod == 0:            # modが0ならb=qとした場合, C=0となるため不採用
        q -= 1
    ans += q

print(ans)

Submission status: Accepted

Solution code:
n=int(input())

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

ans = comb
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

print(sum_v)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
s=0
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]
  
if N<200000:
    t=0
elif 400000>N>=200000:
    t=1
elif 600000>N>=400000:  
    t=2
elif 800000>N>=600000:
    t=3
elif 900000>N>=800000:
    t=4
else:
    t=5
    
lis=[0,2472071,5221424,8075420,10997400,12478098]
s=lis[t]
if N%200000==0 and N!=1000000:
  print(lis[N//200000])
elif N==900000:
  print(lis[5])
elif t<5:
  for i in range((N//200000)*200000+1,N+1):
    s+=len(make_divisors(i-1))
  print(s)
elif t==5:
  for i in range(900001,N+1):
    s+=len(make_divisors(i-1))
  print(s)

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
ans=0
from math import sqrt
for a in range(1,int(sqrt(n-1)+1)):
  up=((n-1)//a)
  ans+=(up-a+1)*2
  ans-=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
count = 0
for a in range(1, n):
#     print(a, )
    count += int((n-1)/a)
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

N_1 = n - 1
ans = 0
i = 1
j = 1
while i <= N_1:
    while j <= N_1:
        if i * j <=  N_1:
            ans += 1
        else:
            j = N_1
        j = j + 1
    j = 1
    i = i + 1

print(ans)

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

from collections import deque
from collections import Counter
import bisect
from collections import defaultdict

def main():
    N = I()
    ans = 0
    for i in range(1, N):
        x, y = divmod(N, i)
        ans += x
        if y == 0:
            ans -= 1


    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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

Submission status: Accepted

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

Submission status: Accepted

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

count = 0
for a in range(1, N+1):
    b = int(N/a)
    count += b 
    if int(N/a) == N/a:
        count -= 1
print(count)

Submission status: Accepted

Solution code:
if __name__ == '__main__':

	n = int(input())

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

Submission status: Accepted

Solution code:
l = int(input())
sum = 0
c = 0

for i in range(1,l):
  for ii in range(i,l):
    sum = i * ii
    if sum >= l:
       break
    else:
      if i != ii:
        c+=2
      else:
        c+=1 
      

print(c)

Submission status: Accepted

Solution code:
def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError("n is int-type.")
    if n < 2:
        raise ValueError("n is more than 2")
    data = [i for i in range(2, n + 1)]
    for d in data:
        data = [x for x in data if (x == d or x % d != 0)]
    return data

p_list = get_sieve_of_eratosthenes(10**3)

def factorization_counta(n):
    arr = []
    temp = n
    for i in p_list:
        if i * i > n:
            break
        elif temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append(cnt)
            
    if temp != 1:
        arr.append(1)
    if arr == []:
        arr.append(1)
    return arr

def get_number_comb(arr):
    ans = 1
    for i in arr:
        ans *= (i + 1)
    return ans

# 約数の数 == その数に掛け算でなるための組み合わせの数

def main(N):
    ans = 1
    for n in range(2, N):
        ans += get_number_comb(factorization_counta(n))
    print(ans)


if __name__ == '__main__':
    N = int(input())
    main(N)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def make_divisors(n):
    div_num = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            div_num += 1
            if i != n // i:
                div_num += 1
    return div_num

ans = [1166714, 2472071, 3829761, 5221424, 6638407, 8075420, 9529244, 10997400, 12478098]

n = int(input())
keta = 0
for j in range(1, 10+1):
  if n <= j*100000:
    keta = j-1
    break
if keta == 0:
  count = 0
else:
  count = ans[keta-1]
for i in range(max(keta*100000,1), n):
  count += make_divisors(i)
print(count)

Submission status: Accepted

Solution code:
N = int(input())

count = 0
for A in range(1, N):
    max_a = int((N-1)/A)
    # AとBが同じものが1件あるので-1する
    count += max_a

print(count)

Submission status: Accepted

Solution code:
#C - A x B + C
N = int(input())
ans = 0
for i in range(1,N-1):
    if i == 1:
        ans += N-1
    else:
        ans += int((N-1) / i)

print(ans+1)

Submission status: Accepted

Solution code:
n=int(input())

a=1
kai=0
while a*a < n:
    b = a
    while b*a <n:
        if b == a:
            kai +=1
        else:
            kai +=2
        b +=1
    a +=1
print(kai)

Submission status: Accepted

Solution code:
import sys
import collections as cc
import bisect as bi
I=lambda:list(map(int,input().split()))
n,=I()
s=int(n**0.5)
ans=0
for i in range(1,n+1):
    ans+=(n//i)
    if (n==(i)*(n//i)):
        ans-=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
import sys
from sys import stdin, stdout
import bisect            #c++ upperbound
import math
import heapq
##import numpy as np
##i_m=9223372036854775807
def modinv(n,p):
    return pow(n,p-2,p)
def cin():
    return map(int,sin().split())
def ain():                           #takes array as input
    return list(map(int,sin().split()))
def sin():
    return input()
def inin():
    return int(input())
def msb(n):         #log2 for n <= 10**10
    n|=n>>1
    n|=n>>2
    n|=n>>4
    n|=n>>8
    n|=n>>16
    return n-(n>>1)
def GCD(x, y): 
    x=abs(x)
    y=abs(y)
    if(min(x,y)==0):
        return max(x,y)
    while(y): 
        x, y = y, x % y 
    return x
def pref(a,n):             #preSum array
    pre=[0]*n
    pre[0]=a[0]
    for i in range(1,n):
        pre[i]=a[i]+pre[i-1]
    return pre
##def Divisors(n) : #list of divisors
##    l = []  
##    for i in range(1, int(math.sqrt(n) + 1)) :
##        if (n % i == 0) : 
##            if (n // i == i) : 
##                l.append(i) 
##            else : 
##                l.append(i)
##                l.append(n//i)
##    return l
prime1=[]
def SieveOfEratosthenes(n): #list of primes upto n
    global prime1
    prime1 = [True for i in range(n+1)] 
    p = 2
    while (p * p <= n): 
        if (prime1[p] == True): 
            for i in range(p * p, n+1, p): 
                prime1[i] = False
        p += 1
    f=[]
    for p in range(2, n): 
        if prime1[p]: 
            f.append(p)
    return f
prime=[]
def Sieve(bo):
    global prime
    prime = [1 for i in range(bo)] 
    p = 2
    while (p<bo): 
        if (prime[p] == 1): 
            for i in range(p,bo, p): 
                prime[i] = p
        p += 1
    f=[]
    for p in range(2, n): 
        if prime[p]==1: 
            f.append(p)
    return f
vi=[0]*(200005)
adj=[[] for i in range(200005)]
def dfs(node,ans):
    vi[node]=1
    ans+=[node+1]
    for j in adj[node]:
        if(vi[j]==0):
            dfs(j,ans)
    return ans

# https://github.com/cheran-senthil/PyRival/blob/master/pyrival/misc/bootstrap.py
def bootstrap(f, stack=[]):   #write @bootstrap before recursive func
    def wrappedfunc(*args, **kwargs):
        if stack:
            return f(*args, **kwargs)
        else:
            to = f(*args, **kwargs)
            while True:
                if type(to) is GeneratorType:
                    stack.append(to)
                    to = next(to)
                else:
                    stack.pop()
                    if not stack:
                        break
                    to = stack[-1].send(to)
            return to
 
    return wrappedfunc
def Divisors(n) : #list of divisors
    c=0 
    for i in range(1, int(math.sqrt(n) + 1)) :
        if (n % i == 0) : 
            if (n // i == i) : 
                c+=1
            else :
                c+=2
    return c
"""*******************************************************"""
def main():
    n=inin();ans=0;l=1
    if(n==10**6):
        ans=13969985
        l=n
    elif(n>=950000):
        ans=13222660
        l=950000
    elif(n>=900000):
        ans=12478098
        l=900000
    elif(n>=850000):
        ans=11736253
        l=850000
    elif(n>=800000):
        ans=10997400
        l=800000
    elif(n>=750000):
        ans=10261678
        l=750000
    elif(n>=10**6//2):
        l=1000000//2
        ans=6638407
    elif(n>=10**5):
        l=100000
        ans=1166714
    elif(n>=10**4):
        l=10000
        ans=93643
    for i in range(l,n):
        f=0
##        sq=int(math.sqrt(i))
##        if(sq*sq==i):
##            f=1
        k=Divisors(i)
##        k=len(D)
##        t=k
##        print(ans,i,t,D)
        ans+=k
    print(ans)
    
  
##    dp = np.full(10**5+1, 10**18, dtype=np.int64)
    
######## Python 2 and 3 footer by Pajenegod and c1729
 
# Note because cf runs old PyPy3 version which doesn't have the sped up
# unicode strings, PyPy3 strings will many times be slower than pypy2.
# There is a way to get around this by using binary strings in PyPy3
# but its syntax is different which makes it kind of a mess to use.
 
# So on cf, use PyPy2 for best string performance.

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange
 
import os, sys
from io import IOBase, BytesIO
 
BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0
 
    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None
 
    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s
 
    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()
 
    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)
 
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s:self.buffer.write(s.encode('ascii'))
            self.read = lambda:self.buffer.read().decode('ascii')
            self.readline = lambda:self.buffer.readline().decode('ascii')
 
 
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip('\r\n')
 
# Cout implemented in Python
import sys
class ostream:
    def __lshift__(self,a):
        sys.stdout.write(str(a))
        return self
cout = ostream()
endl = '\n'
 
# Read all remaining integers in stdin, type is given by optional argument, this is fast
def readnumbers(zero = 0):
    conv = ord if py2 else lambda x:x
    A = []; numb = zero; sign = 1; i = 0; s = sys.stdin.buffer.read()
    try:
        while True:
            if s[i] >= b'R' [0]:
                numb = 10 * numb + conv(s[i]) - 48
            elif s[i] == b'-' [0]: sign = -1
            elif s[i] != b'\r' [0]:
                A.append(sign*numb)
                numb = zero; sign = 1
            i += 1
    except:pass
    if s and s[-1] >= b'R' [0]:
        A.append(sign*numb)
    return A
 
# threading.Thread(target=main).start()
if __name__== "__main__":
  main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

count = 0

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

Submission status: Accepted

Solution code:
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

div = num_divisors_table(n)

res = 0
for c in range(1, n):
    num = n - c
    res += div[num]

print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
i=0
for a in range(2,1000001):
    if a>=n:
        break
    else:
        for b in range(1,int(n/a)+1):

            if n-(a*b)>=1:
                i+=1
            else:
                break
i+=n-1
print(i)

Submission status: Accepted

Solution code:
l = int(input())
sum = 0
c = 0

for i in range(1,l):
  for ii in range(i,l):
    sum = i * ii
    if sum >= l:
      break
    else:
      if i != ii:
        c+=2
      else:
        c+=1

print(c)

Submission status: Accepted

Solution code:
from collections import defaultdict 
import sys
import math 
import random
def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections
n=int(input())

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

ans=1
if n>2:
  for i in range(2,n):
    c=collections.Counter(calc(i))
    wk=1
    for value in c.values():
      wk*=(value+1)
    ans+=wk
print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())
cnt = 0


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

print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
o=0
nn=n-1
for i in range(1,n):
    o+=nn//i
print(o)

Submission status: Accepted

Solution code:
N = int(input())

A = 0


cn = 0

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

    
print(cn)

Submission status: Accepted

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