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.Collections.Generic;
using System.Linq;
using static Scanner;

class Program
{
    public static void Main()
    {
        int n = ReadInt();
        int ans = 1;
        for (int i = 2; i < n; i++)
        {
            var dic = new Dictionary<int, int>();
            foreach (var p in MyMath.PrimeFactor(i))
            {
                if (dic.ContainsKey(p)) dic[p]++;
                else dic[p] = 1;
            }
            int m = 1;
            foreach (var x in dic.Values) m *= x + 1;
            ans += m;
        }
        Console.WriteLine(ans);
    }
}

static class Scanner
{
    static Queue<string> que = new Queue<string>();
    public static string Read() { if (!que.Any()) foreach (var s in Console.ReadLine().Split()) que.Enqueue(s); return que.Dequeue(); }
    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static IEnumerable<string> Read(long n) { for (long i = 0; i < n; i++) yield return Read(); }
    public static IEnumerable<int> ReadInt(long n) => Read(n).Select(int.Parse);
    public static IEnumerable<long> ReadLong(long n) => Read(n).Select(long.Parse);
}

static class MyMath
{
    public static int Gcd(int a, int b) => b == 0 ? a : Gcd(b, a % b);
    public static int Lcm(int a, int b) => a * b / Gcd(a, b);

    static List<int> fib = new List<int> { 0, 1 };
    public static int Fib(int n)
    {
        for (int i = fib.Count(); i <= n; i++) fib.Add(fib[i - 2] + fib[i - 1]);
        return fib[n];
    }

    public static int NextCombination(int bit)
    {
        int x = bit & -bit;
        int y = x + bit;
        return y | (((bit & ~y) / x) >> 1);
    }

    public static bool IsPrime(int n)
    {
        for (int p = 2; p * p <= n; p++) if (n % p == 0) return false;
        return true;
    }

    public static IEnumerable<int> PrimeFactor(int n)
    {
        int p = 2;
        while (p * p <= n) if (n % p == 0) { n /= p; yield return p; } else p++;
        if (n != 1) yield return n;
    }
}