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 Java (OpenJDK 11.0.6) (judge verdict: Time Limit Exceeded)

import java.util.Scanner;
public class Main{
	static private Scanner scanner;
	static{
		scanner = new Scanner(System.in);
	}
	static public void main(String[] args){
		m3();
	}
	static public void m1(){
		String s = scanner.next();
	  	String result;
		if(s.endsWith("s")){
			result = s + "es";
		}else{
			result = s + "s";
		}
		System.out.println(result);

	}
	static public void m2(){
		int n = scanner.nextInt();
		boolean result = false;
		boolean[] ba = new boolean[]{false,false,false};
		String s;
		String[] sa;
		int d1;
		int d2;
		for(int i = 0; i < n; i++){
			//s = scanner.next();
			//sa = s.split(" ");
			d1 = scanner.nextInt();//Integer.parseInt(sa[0]);
			d2 = scanner.nextInt();//Integer.parseInt(sa[1]);
			if( d1 == d2 ){
				if( ba[0] == false ){
					ba[0] = true;
				}else{
					if( ba[1] == false ){
						ba[1] = true;
					}else{
						if( ba[2] == false ){
							ba[2] = true;
							result = true;
						}else{
						}
					}
				}
				
			}else{
				ba = new boolean[]{false,false,false};
			}

		}
		if(result == true){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
	static public void m3(){
		int n = scanner.nextInt();
		int a;
		int b;
		int c;
		int result = 0;
			for( a = 1; a < n; a++){
				if( a <= n / 2 ){
					for( b = 1; b < n; b++){
						for( c = 1; c < n; c++){
							if ( a * b + c == n ){
								result++;
							}else{
							}
						}
					}
				}else{
					b=1;
						for( c = 1; c < n; c++){
							if ( a * b + c == n ){
								result++;
							}else{
							}
						}

				}

			}
		System.out.println(result);
	}
}