AtCoder Beginner Contest 179 - A x B + C

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-----
3

-----Sample Output-----
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).

Difficulty: EASY

Starter code:

Solutions:
n = int(input())
res = 0
for i in range(1, n):
	res += (n - 1) // i
print(res)


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


n = int(input())
cnt = 0
for a in range(1, n):
	b = (n - 1) // a
	cnt += b
print(cnt, flush=True)


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


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


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


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


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


N = int(input())
cnt = 0
for i in range(1, N):
	j = (N - 1) // i
	cnt += j
print(cnt)


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


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


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


N = int(input()) - 1
out = 0
for i in range(N):
	out += N // (i + 1)
print(out)


N = int(input())
print(sum(((N - 1) // i for i in range(1, N))))


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


n = int(input())
s = 0
for i in range(1, 10 ** 6 + 1):
	s = s + (n - 1) // i
print(s)


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


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


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


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


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


n = int(input()) - 1
print(sum((n // -~i for i in range(n))))


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


n = int(input())
s = 0
for i in range(1, n + 1):
	d = (n - 1) // i
	s += d
print(s)


def main():
	n = int(input())
	ans = 0
	for a in range(1, 10 ** 6 + 1):
		b = 1
		while a * b < n:
			ans += 1
			b += 1
	print(ans)

def __starting_point():
	main()
__starting_point()


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


N = int(input())
print(sum(((N - 1) // a for a in range(1, N))))


n = int(input())
cnt = 0
i = 1
while i < n:
	cnt += (n - 1) // i
	i += 1
print(cnt)


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


def solve():
	ans = 0
	for a in range(1, n):
		for b in range(1, n):
			c = n - a * b
			if c <= 0:
				break
			else:
				ans += 1
	return ans
n = int(input())
print(solve())


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


N = int(input())
k = 0
for s in range(1, N):
	k += (N - 1) // s
print(k)


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


N = int(input())
ANS = 1
for i in range(1, N - 1):
	ANS += (N - 1) // i
print(ANS)


def main():
	n = int(input())
	m = int(n ** 0.5) + 1
	ans = 0
	for a in range(1, m):
		for b in range(a, n):
			if a * b < n:
				if a != b:
					ans += 2
				else:
					ans += 1
			else:
				break
	print(ans)
main()


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


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


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


from sys import stdin
N = int(stdin.readline().rstrip())
ans = 0
for i in range(1, N):
	ans += (N - 1) // i
print(ans)


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


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


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


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


n = int(input())
m = n - 1
count = 0
for i in range(1, n):
	count += m // i
print(count)


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


N = int(input())
c = 0
for i in range(N):
	c += (N - 1) // (i + 1)
print(c)


import math
n = int(input())
sum = 0
for i in range(1, n):
	sum += math.ceil(n / i) - 1
print(sum)


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


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


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


N = int(input())
cou = 0
for i in range(1, 10 ** 6 + 1):
	cou += (N - 1) // i
print(cou)


n = int(input())
answer = sum([(n - 1) // a for a in range(1, n)])
print(answer)


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


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


N = int(input())
ans = 0
for A in range(1, 10 ** 6):
	ans += (N - 1) // A
print(ans)


def parse():
	N = int(input())
	return N

def main():
	N = parse()
	limit_n = 10 ** 6
	ans = 0
	for A in range(1, min(limit_n, N)):
		for B in range(1, min(limit_n, N)):
			if A * B >= N:
				break
			ans += 1
	print(ans)

def __starting_point():
	main()
__starting_point()


n = int(input())
ans = sum((n // a - int(not n % a) for a in range(1, n)))
print(ans)


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


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


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


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


N = int(input())
S = N - 1
ret = 0
for i in range(1, N + 1):
	ret += S // i
print(ret)


(N,) = map(int, input().split())
R = 0
for i in range(1, N + 1):
	R += (N - 1) // i
print(R)


import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce
rr = lambda : sys.stdin.readline().rstrip()
rs = lambda : sys.stdin.readline().split()
ri = lambda : int(sys.stdin.readline())
rm = lambda : list(map(int, sys.stdin.readline().split()))
rl = lambda : list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10 ** 9 + 7
n = ri()
ans = 0
for a in range(1, n):
	ans += (n - 1) // a
print(ans)


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


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


n = int(input())
count = 0
daburi = 0
for i in range(1, n):
	count += (n - 1) // i
print(count)


c = int(input())
total = c - 1
for i in range(2, c):
	total += (c - 1) // i
print(total)


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


import math

def cin():
	return list(map(int, input().split()))
count = 0
N = cin()[0]
for A in range(1, N + 1):
	B = math.floor(N / A)
	C = N % A
	if B != 0 and C != 0:
		count += B
	elif B != 0 and C == 0:
		count += B - 1
print(count)


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


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


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


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


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


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


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


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


a = int(input())
i = 1
n = 0
while i < a:
	n = n + int((a - 1) / i)
	i = i + 1
print(n)


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


import math

def main():
	n = int(input())
	cnt = 0
	for a in range(1, n):
		for b in range(1, n):
			if n - a * b > 0:
				cnt += 1
			else:
				break
	print(cnt)

def __starting_point():
	main()
__starting_point()


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


N = int(input())
l = N - 1
a = 0
for c in range(1, N):
	a += (N - 1) // c
print(a)


import math
N = int(input())
cnt = 0
for i in range(1, N + 1):
	cnt += (N - 1) // i
print(cnt)


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


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


n = int(input(''))
p = 0
for i in range(n - 1):
	a = i + 1
	p = p + (n - 1) // a
print(p)


n = int(input())
count = 0
for a in range(1, n + 1):
	for b in range(a, n + 1):
		if a * b >= n:
			break
		count += 2 if a != b else 1
print(count)


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


n = int(input())
r = 0
for i in range(1, n):
	r += int(n / i - 1e-09)
print(r)


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


N = int(input())
s = 0
for A in range(1, 1 + N):
	s += N // A
	if N % A == 0:
		s -= 1
print(s)


def run_prime_factorization(max_number: int) -> dict:
	from math import sqrt
	ans = dict()
	remain = max_number
	for base in range(2, int(sqrt(max_number)) + 1):
		if remain % base == 0:
			exponent_count = 0
			while remain % base == 0:
				exponent_count += 1
				remain //= base
			ans[base] = exponent_count
	if remain != 1:
		ans[remain] = 1
	return ans

def main():
	from math import floor
	import sys
	input = sys.stdin.readline
	n = int(input())
	ans = 0
	for a in range(1, n):
		b = floor(n / a)
		ans += b
	p = list(run_prime_factorization(n).values())
	if len(p) == 1:
		ans -= list(p)[0]
	else:
		count = 1
		for pi in p:
			count *= pi + 1
		ans -= count
		ans += 1
	print(ans)

def __starting_point():
	main()
__starting_point()


N = int(input())
i = 1
s = 0
while i < N:
	s += (N - 1) // i
	i += 1
print(s)


n = int(input())
t = int(n ** (1 / 2))
a = 0
for i in range(1, t + 1):
	if i ** 2 == n:
		a += i - 1
	elif int((n - 1) / i) > t:
		a += int((n - 1) / i) * 2 - t
	else:
		a += int((n - 1) / i)
print(a)


n = int(input())
a = 1
cnt = 0
while n > a:
	cnt += (n - 1) // a
	a += 1
print(cnt)


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


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


N = int(input())
cnt = 0
for i in range(1, N):
	add = (N - 1) // i
	cnt += add
	if add < 1:
		break
print(cnt)


import math
N = int(input())
S = 0
for A in range(1, N):
	S += max(0, int(math.ceil(N / A) - 1))
print(S)


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


N = int(input())
ans = sum(((N - 1) // denom for denom in range(1, N)))
print(ans)


n = int(input())
a = 0
for i in range(1, n):
	for j in range(i, n, i):
		a += 1
print(a)


n = int(input())
ab = n - 1
c = 0
for i in range(ab):
	ai = i + 1
	c += ab // ai
print(c)


n = int(input())
print(sum([n // a + (0 if n % a else -1) for a in range(1, n)]))


n = int(input())
g = 0
for i in range(n - 1):
	g = g + int((n - 1) / (i + 1))
print(g)


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


import math
a = int(input())
n = 0
for i in range(1, a):
	n += math.floor((a - 1) / i)
print(n)


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


import sys
input = sys.stdin.readline

def main():
	n = int(input())
	cnt = 0
	for a in range(1, n):
		for b in range(1, n):
			if a * b < n:
				cnt += 1
			else:
				break
	print(cnt)

def __starting_point():
	main()
__starting_point()


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


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


N = int(input())
b_num = 0
for a in range(1, N):
	if N % a == 0:
		b_num += int(N / a) - 1
	else:
		b_num += N // a
print(b_num)


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


import math
n = int(input())
k = 0
l = int(math.sqrt(n - 1))
for i in range(1, l + 1):
	k += (n - 1) // i - i
print(k * 2 + l)


import numpy as np
N = int(input())
LS = np.array([sum([1 for i in range((N - 1) // (j + 1))]) for j in range(N)])
print(sum(LS))


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


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


import math
N = int(input())
res = 0
for a in range(1, N):
	res += math.floor((N - 1) / a)
print(res)


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


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


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


def main():
	n = int(input())
	(ans, i) = (0, 1)
	while i < n:
		ans += (n - 1) // i
		i += 1
	print(ans)
main()


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


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

def int1(x):
	return int(x) - 1

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

def input_to_int_tuple():
	return tuple(map(int, input().split()))

def input_to_int_tuple_minus1():
	return tuple(map(int1, input().split()))
cache = {}

def factorization(n):
	arr = []
	temp = n
	for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
		if temp // i in cache:
			arr = cache[temp // i]
		if temp % i == 0:
			cnt = 0
			while temp % i == 0:
				cnt += 1
				temp //= i
			arr.append([i, cnt])
	if temp != 1:
		arr.append([temp, 1])
	if arr == []:
		arr.append([n, 1])
	cache[n] = arr
	return arr

def main():
	N = input_int()
	cnt = 0
	for a in range(1, N):
		for b in range(1, N):
			if a * b - N < 0:
				cnt += 1
			else:
				break
	print(cnt)

def __starting_point():
	main()
__starting_point()


import math
N = int(input())
count = 0
for i in range(1, N):
	count += math.ceil(N / i) - 1
print(count)


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


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


N = int(input())
count = 0
for A in range(1, 10 ** 6 + 1):
	if A > N:
		break
	else:
		count += (N - 1) // A
print(count)


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


X = int(input())
A = 0
for i in range(X):
	if i != 0:
		A = A + (X - 1) // i
print(A)


def main():
	import sys
	input = sys.stdin.readline
	n = int(input())
	ans = 0
	for a in range(1, n):
		ans += (n - 1) // a
	print(ans)

def __starting_point():
	main()
__starting_point()


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


N = int(input())
C = N - 1
ans = 0
i = 1
while C >= i:
	ans += C // i
	i += 1
print(ans)