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++ (GCC 9.2.1) (judge verdict: Runtime Error)

#pragma GCC optimize(2)
#include<iostream> 
#include<cstdio> 
#include<cstring> 
#include<algorithm> 
#include<map> 
#define File(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout);
#define re register
#define ri re int
#define gtch() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
#define For(i,a,b) for(ri i=a;i<=b;++i) 
#define iFor(i,a,b) for(ri i=a;i>=b;--i) 
using namespace std;
typedef long long ll;
char buf[1<<21],*p1=buf,*p2=buf;
inline ll fr()
{
	re char ch=getchar();re ll res=0;int bl=0;
	while(!isdigit(ch)) bl=(ch=='-'),ch=getchar();
	while(isdigit(ch)) res=(res<<1)+(res<<3)+ch-'0',ch=getchar();
	return bl?-res:res;
}
const int MAXN=1e7;
int mf[MAXN];
ll prime[MAXN],tot;
ll d[MAXN],cnt[MAXN]; 
int n;
inline void sieve()
{
	d[1]=1;
	for(ri i=2;i<=n;++i)
	{
		if(!mf[i]){mf[i]=i,prime[++tot]=i,d[i]=2,cnt[i]=1;}
//		cout<<i<<" "<<d[i]<<" "<<cnt[i]<<"\n";
		for(ri j=1;j<=tot;++j)
		{
			ri p=prime[j],t=i*p;
			mf[t]=p;
			if(p==mf[i]){cnt[t]=cnt[i]+1,d[t]=d[i]/(cnt[i]+1)*(cnt[i]+2);break;}
			cnt[t]=1,d[t]=d[i]*2;
		}
	}
}
signed main()
{
//	File("temp")
	n=fr();
	sieve();
	ll ans=0;
	for(ri i=1;i<n;++i) ans+=d[i];
	cout<<ans;
	return 0;
}