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 in C# (.NET Core 3.1.201) (judge verdict: Accepted)

using System;
using System.Linq;
using System.ComponentModel;
using System.Collections.Generic;

namespace AtCoder {
    public class TestCode {
        static void Main(string[] args) {
            var N = ReadValue<long>();
            long ans = 0;
            for(var i = 1; i < N; i++) {
                for(var n = N/i; n > 0; n--) {
                    if (i * n >= N) continue ;
                    ans++;
                }
            }
            Console.Write(ans);
        }

        static T1 ReadValue<T1>() {
            var t1 = TypeDescriptor.GetConverter(typeof(T1));
            return (T1)t1.ConvertFromString(Console.ReadLine());
        }

        static (T1, T2) ReadValue<T1, T2>() {
            var rl = Console.ReadLine().Trim().Split().ToArray();
            var t1 = TypeDescriptor.GetConverter(typeof(T1));
            var t2 = TypeDescriptor.GetConverter(typeof(T2));
            return ((T1)t1.ConvertFromString(rl[0]),
                    (T2)t2.ConvertFromString(rl[1]));
        }

        static (T1, T2, T3) ReadValue<T1, T2, T3>() {
            var rl = Console.ReadLine().Trim().Split().ToArray();
            var t1 = TypeDescriptor.GetConverter(typeof(T1));
            var t2 = TypeDescriptor.GetConverter(typeof(T2));
            var t3 = TypeDescriptor.GetConverter(typeof(T3));
            return ((T1)t1.ConvertFromString(rl[0]),
                    (T2)t2.ConvertFromString(rl[1]),
                    (T3)t3.ConvertFromString(rl[2]));
        }

        static (T1, T2, T3, T4) ReadValue<T1, T2, T3, T4>() {
            var rl = Console.ReadLine().Trim().Split().ToArray();
            var t1 = TypeDescriptor.GetConverter(typeof(T1));
            var t2 = TypeDescriptor.GetConverter(typeof(T2));
            var t3 = TypeDescriptor.GetConverter(typeof(T3));
            var t4 = TypeDescriptor.GetConverter(typeof(T4));
            return ((T1)t1.ConvertFromString(rl[0]),
                    (T2)t2.ConvertFromString(rl[1]),
                    (T3)t3.ConvertFromString(rl[2]),
                    (T4)t4.ConvertFromString(rl[3]));
        }

        static (T1, T2, T3, T4, T5) ReadValue<T1, T2, T3, T4, T5>() {
            var rl = Console.ReadLine().Trim().Split().ToArray();
            var t1 = TypeDescriptor.GetConverter(typeof(T1));
            var t2 = TypeDescriptor.GetConverter(typeof(T2));
            var t3 = TypeDescriptor.GetConverter(typeof(T3));
            var t4 = TypeDescriptor.GetConverter(typeof(T4));
            var t5 = TypeDescriptor.GetConverter(typeof(T5));
            return ((T1)t1.ConvertFromString(rl[0]),
                    (T2)t2.ConvertFromString(rl[1]),
                    (T3)t3.ConvertFromString(rl[2]),
                    (T4)t4.ConvertFromString(rl[3]),
                    (T5)t5.ConvertFromString(rl[4]));
        }

        static string[] stringArray => Console.ReadLine().Split().ToArray();
        static int[] intArray => Console.ReadLine().Trim().Split().Select(int.Parse).ToArray();
        static long[] longArray => Console.ReadLine().Trim().Split().Select(long.Parse).ToArray();
        static double[] doubleArray => Console.ReadLine().Trim().Split().Select(double.Parse).ToArray();
        static decimal[] decimalArray => Console.ReadLine().Trim().Split().Select(decimal.Parse).ToArray();
    }
}