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



Sample input:
3


Sample output:
3

Submission status: Accepted

Solution code:
N = int(input())

answer = 0
for a in range(1, N):
    answer += (N-1) // a

print(answer)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1 << 25)
readline = sys.stdin.buffer.readline
read = sys.stdin.readline  # 文字列読み込む時はこっち
ra = range
enu = enumerate


def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと


def a_int(): return int(readline())


def ints(): return list(map(int, readline().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, readline().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, readline().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, readline().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter, xor, add
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from functools import reduce
from math import gcd


class FastFactorization:
    def __init__(self, N: int):
        '''構築O(NloglogN)、クエリO(logN)'''
        self.N = N
        self.min_prime = self._make_minimum_prime()

    def _make_minimum_prime(self):
        # xの最小の素因数表を作成
        min_prime = [x for x in range(self.N + 1)]
        # min_prime[0] = 0  # 0と1は素数ではない
        # min_prime[1] = 1
        for i in range(2, int(self.N ** 0.5) + 1):
            if min_prime[i] == i:  # 素数だったら更新
                for j in range(2 * i, self.N + 1, i):  # iの倍数は素数でない
                    if min_prime[j] == j:
                        min_prime[j] = i
        return min_prime

    def query(self, x: int):
        # 最小素数配列min_primeを使ってO(log N)で因数分解
        # -> Counter[p,n] (素数,冪数) を格納
        # xはself.N以下
        if x == 1:
            return Counter()  # 1は素数ではない

        # 素因数分解
        arr = []
        tmp = x
        while tmp != 1:
            p = self.min_prime[tmp]
            tmp //= p
            arr.append(p)
        return Counter(arr)


# a*b = N-c
# 1 <= N-c <= N-1
# N-c=X
# a*b = X #Xの約数の個数は？
# N-cを素因数分解 -> 冪数 p1^m1 p2^m2 p3^m3  の+1の積

# 素因数分解 -> O(√X)
# O(N√N) ~ 10^9 ← TLE

# 高速素因数分解 -> 前処理 O(N) クエリ O(log(X))
# →O(N + NlogN) ~ 10^7 ←ちょうどいい感じ
# table[i] ... 整数iを構成する最小の素因数
# while X: X//=table[X];cnt+=1 <-cntが冪数になる

N = a_int()
fact = FastFactorization(N + 1)
ans = 0
for x in range(1, N):
    tmp = 1
    for v in fact.query(x).values():
        tmp *= v + 1
    ans += tmp

print(ans)

# たてのアイデアが天才的だった

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))

n = readint()

ans = 0
for a in range(1,n):
    b = n//a
    if a*b==n:
        ans += b-1
    else:
        ans += b

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

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

Submission status: Accepted

Solution code:
N=int(input())


ans = 0

for a in range(1,N):
	ans += ((N-1)//a)

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())
ans = 0

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#c
import sys
n = int(input())
import math

ans = 0

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

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for a in range(1, n+1):
    b=1
    while n>a*b:
        ans += 1
        b+=1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    cnt = 0
    # aが1からn-1まで動くと考える
    for a in range(1, n):
        # a*bがn-1以下であると考える
        cnt += (n-1) // a
    print(cnt)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
cnt = 0
for a in range(1,N+1):
  b = N // a
  if a * b == N:
    cnt = cnt + b - 1
  else:
    cnt = cnt + b
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

table = [0] * (n + 1)

for x in range(1, n + 1):
    for y in range(x, n + 1, x):
        table[y] += 1

res = 0
for c in range(1, n):
    res += table[c]

print(res)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush
import collections
import bisect

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

print(count)

Submission status: Accepted

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

print(res)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
from typing import List


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


def input_list_int() -> List[int]:
    return list(map(lambda x: int(x), input().split()))


def f(n: int) -> int:
    ans = 0
    for a in range(1, n):
        ans += (n - 1) // a
    return ans


if __name__ == '__main__':
    n = input_int()
    print(f(n))

Submission status: Accepted

Solution code:
## necessary imports
import sys
input = sys.stdin.readline
from bisect import bisect_left;
from bisect import bisect_right;
from math import ceil, factorial;

def ceil(x):
    if x != int(x):
        x = int(x) + 1;
    return x;
    
# swap_array function
def swaparr(arr, a,b):
    temp = arr[a];
    arr[a] = arr[b];
    arr[b] = temp;

## gcd function
def gcd(a,b):
    if b == 0:
        return a;
    return gcd(b, a % b);

## nCr function efficient using Binomial Cofficient
def nCr(n, k, modulus = 1): 
    if(k > n - k): 
        k = n - k; 
    res = 1;
    for i in range(k): 
        res = res * (n - i);
        res = res / (i + 1);
        res %= modulus; 
    return int(res);

## prime factorization
def primefs(n):
    ## if n == 1    ## calculating primes
    primes = {}
    while(n%2 == 0 and n > 0):
        primes[2] = primes.get(2, 0) + 1
        n = n//2
    for i in range(3, int(n**0.5)+2, 2):
        while(n%i == 0 and n > 0):
            primes[i] = primes.get(i, 0) + 1
            n = n//i
    if n > 2:
        primes[n] = primes.get(n, 0) + 1
    ## prime factoriazation of n is stored in dictionary
    ## primes and can be accesed. O(sqrt n)
    return primes

## MODULAR EXPONENTIATION FUNCTION
def power(x, y, p): 
    res = 1
    x = x % p  
    if (x == 0) : 
        return 0
    while (y > 0) : 
        if ((y & 1) == 1) : 
            res = (res * x) % p 
        y = y >> 1      
        x = (x * x) % p 
    return res 

## DISJOINT SET UNINON FUNCTIONS
def swap(a,b):
    temp = a
    a = b
    b = temp
    return a,b;

# find function with path compression included (recursive)
# def find(x, link):
#     if link[x] == x:
#         return x
#     link[x] = find(link[x], link);
#     return link[x];

# find function with path compression (ITERATIVE)
def find(x, link):
    p = x;
    while( p != link[p]):
        p = link[p];
    
    while( x != p):
        nex = link[x];
        link[x] = p;
        x = nex;
    return p;


# the union function which makes union(x,y)
# of two nodes x and y
def union(x, y, link, size):
    x = find(x, link)
    y = find(y, link)
    if size[x] < size[y]:
        x,y = swap(x,y)
    if x != y:
        size[x] += size[y]
        link[y] = x

## returns an array of boolean if primes or not USING SIEVE OF ERATOSTHANES
def sieve(n): 
    prime = [True for i in range(n+1)] 
    p = 2
    while (p * p <= n): 
        if (prime[p] == True): 
            for i in range(p * p, n+1, p):
                prime[i] = False
        p += 1
    return prime

#### PRIME FACTORIZATION IN O(log n) using Sieve ####
MAXN = int(1e6 + 5)
def spf_sieve():
    spf[1] = 1;
    for i in range(2, MAXN):
        spf[i] = i;
    for i in range(4, MAXN, 2):
        spf[i] = 2;
    for i in range(3, ceil(MAXN ** 0.5), 2):
        if spf[i] == i:
            for j in range(i*i, MAXN, i):
                if spf[j] == j:
                    spf[j] = i;
    ## function for storing smallest prime factors (spf) in the array

################## un-comment below 2 lines when using factorization #################
spf = [0 for i in range(MAXN)]
spf_sieve();
def factoriazation(x):
    ret = {};
    while x != 1:
        ret[spf[x]] = ret.get(spf[x], 0) + 1;
        x = x//spf[x]
    return ret;
    ## this function is useful for multiple queries only, o/w use
    ## primefs function above. complexity O(log n)

## taking integer array input
def int_array():
    return list(map(int, input().strip().split()));

def float_array():
    return list(map(float, input().strip().split()));

## taking string array input
def str_array():
    return input().strip().split();

#defining a couple constants
MOD = int(1e9)+7;
CMOD = 998244353;
INF = float('inf'); NINF = -float('inf');

################### ---------------- TEMPLATE ENDS HERE ---------------- ###################

# n = int(input()); a = sorted(int_array());
# this = [None] * n; a1 = a.copy();

# for i in range(0, n, 2):
#     this[i] = a.pop();

# a = a[::-1];

# for i in range(1, n, 2):
#     this[i] = a.pop();
# ans = 0;
# for i in range(1, n - 1):
#     if this[i] < this[i - 1] and this[i] < this[i + 1]:
#         ans += 1;

# ans1 = ans; this1 = this.copy();

# a = a1;
# this = [None] * n;
# for i in range(0, n, 2):
#     this[i] = a.pop();
# for i in range(1, n, 2):
#     this[i] = a.pop();
# ans = 0;
# for i in range(1, n - 1):
#     if this[i] < this[i - 1] and this[i] < this[i + 1]:
#         ans += 1;

# if ans >= ans1:
#     print(ans); print(*this);
# else:
#     print(ans1); print(*this1);

n = int(input()); ans = 0;
for i in range(1, n):
    x = n - i; num = 1;
    this = factoriazation(x);
    for i in this:
        num *= (this[i] + 1);
    ans += num;
print(ans);

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

N = int(input())

s = 0

for a in range(1, N+1):
    s += (N-1)//a

print(s)

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

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

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n = int(input())
    ans = 0
    for a in range(1,n):
        if a ** 2 >= n:
            break
        for b in range(a,n):
            if a * b >= n:
                break
            if a == b:
                ans += 1
            else:
                ans += 2
    print(ans)
        

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

tot = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


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


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())
count = np.zeros(n, dtype=np.int)
for d in range(1, n):
  count[d::d] += 1
print(count.sum())

Submission status: Accepted

Solution code:
def readInt():
    return int(input())
def readList():
    return list(map(int,input().split()))
def readMap():
	return map(int,input().split())
def readStr():
    return input()
inf=float('inf')
mod = 10**9+7
import math
from itertools import permutations
def solve(N):
    count=0
    for i in range(1,N):
        count+=(N-1)//i
    return count

N=readInt()
print(solve(N))

Submission status: Accepted

Solution code:
#約数の個数の和（１~N）約数そのものを求めないので「速い」
def divisor_num(N):
    ans =0
    for i in range(1,N):
        ans +=(N-1)//i #項数
    return ans


# 初期入力
import sys
input = sys.stdin.readline  #文字列では使わない

N = int(input())
ans =divisor_num(N)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    ab_max = n-1
    ans = sum(ab_max // a for a in range(1, n))
    return ans


if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
cnt = 0
for a in range(1,N):
    for b in range(1,N):
        if a * b >= N:
            break
        else:
            cnt +=1
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
cnt = 0
for i in range(1, N):
    cnt += N // i
    if N % i == 0:
        cnt -= 1
print(cnt)

Submission status: Accepted

Solution code:
#   ==========     //\\       //||     ||====//||
#       ||        //  \\        ||     ||   // ||
#       ||       //====\\       ||     ||  //  ||
#       ||      //      \\      ||     || //   ||
#   ========== //        \\  ========  ||//====|| 
#  code

# 1 -> 1,2 2,1 3,
# 2 -> 1,1
def solve():
    n = int(input())
    cnt = 0
    for i in range(1, n + 1):
        k = n // i
        if n % i:
            cnt += k
        else:
            cnt += max(0, k - 1)
    print(cnt)
    return

def main():
    t = 1
    # t = int(input())
    for _ in range(t):
        solve()

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
class factorization:
    def __init__(self, N=1_000_010):
        """min_factor[i] = iの最小の素因数"""
        self.min_factor = list(range(N))
        for i in range(2, N):
            if i * i > N:
                break
            for j in range(i * i, N, i):
                if self.min_factor[j] == j:
                    # 小さくできるなら小さくするmin_factor[j] != j => i < j
                    self.min_factor[j] = i

    def fact(self, n):
        """nの素因数分解の結果を{素因数:回数}で返す"""
        d = {}
        while n > 1:
            if self.min_factor[n] in d:
                d[self.min_factor[n]] += 1
            else:
                d[self.min_factor[n]] = 1
            n //= self.min_factor[n]
        return d

    def count_divisors(self, n):
        res = 1
        for v in self.fact(n).values():
            res *= v + 1
        return res

    def sum_divisors(self, n):
        res = 1
        for r, Len in self.fact(n).items():
            res *= (r ** (Len + 1) - 1) // (r - 1)
        return res

    def Eulers_function(self, n):
        res = 1
        for i in self.fact(n):
            res *= (i - 1)
            n //= i
        return res * n


n = int(input())
ans = 0
p = factorization(n)
for i in range(1, n):
    ans += p.count_divisors(i)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

answer = 0

for i in range(1, n):
    if n % i == 0:
        answer += (n / i) - 1
    else:
        answer += n // i

print(int(answer))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
 
count = 0
if int(N)-N== 0:
    for i in range(1,int(N)):
        if int(N/i)-N/i == 0:
            count += int(N/i)-1
        else:
            count += int(N/i)

 
 
print(count)

Submission status: Accepted

Solution code:
N = int(input())

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


print(count)

Submission status: Accepted

Solution code:
from math import ceil
ans = 0
n = int(input())
for a in range(1, n + 1):
    for b in range(a+1, n + 1):
        c = n - a * b
        if c > 0:
            ans += 2
        else:
            break
for a in range(1, ceil(n**0.5) + 1):
        c = n - a * a
        if c > 0:
            ans += 1
        else:
            break
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0

for i in range(1, N):
    ans += (N - 1) // i

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

answer = 0
for n in range(1, int(N**0.5)+1):
  m = N//n if N%n != 0 else N//n-1
  if m >= n:
    answer += (m-n+1)*2-1
print(answer)

Submission status: Accepted

Solution code:
N = int(input())

count = 0

count += int(N/2)

if int(N/2)-N/2 == 0:
    for i in range(1,int(N/2)):
        if int(N/i)-N/i == 0:
            count += int(N/i)-1
        else:
            count += int(N/i)
else:
    for i in range(1,int(N/2)+1):
        if int(N/i)-N/i == 0:
            count += int(N/i)-1
        else:
            count += int(N/i)

print(count)

Submission status: Accepted

Solution code:
N = int(input())
count = 0
if int(N/2)-N/2 == 0:
    for i in range(1,int(N/2)):
        if int(N/i)-N/i == 0:
            count += int(N/i)-1
        else:
            count += int(N/i)
else:
    for i in range(1,int(N/2)+1):
        if int(N/i)-N/i == 0:
            count += int(N/i)-1
        else:
            count += int(N/i)

count += int(N/2)
print(count)

Submission status: Accepted

Solution code:
def main():
    import sys
    ikimasu = sys.stdin.buffer.readline
    ini = lambda: int(ins())
    ina = lambda: list(map(int, ikimasu().split()))
    ins = lambda: ikimasu().strip()
    
    n = ini()
    rick = 0
    import math
    for i in range(1,n+1):
        rick+=math.floor((n-1)/i)
    print(rick)
        


    
        


        


    




















if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
NR = int(N**0.5)
count = 0
if int(N/2)-N/2 == 0:
    for i in range(1,int(N/2)):
        if int(N/i)-N/i == 0:
            count += int(N/i)-1
        else:
            count += int(N/i)
else:
    for i in range(1,int(N/2)+1):
        if int(N/i)-N/i == 0:
            count += int(N/i)-1
        else:
            count += int(N/i)

count += int(N/2)
print(count)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    n = int(input())
    r = 0
    for i1 in range(1, n+1):
        for i2 in range(1, n+1):
            if i1 * i2 >= n:
                break
            else:
                r += 1
    print(r)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(1, n):
    for j in range(1, n):
        if i*j>=n:
            break
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
def solve1():
    n = int(input())
    a, b, c = 1, 1, 1
    ans = 0

    while n >= c:
        while b <= (n-c):
            ans += (n-c)//b
            b += 1
        c += 1

    print(ans)


def solve2():
    n = int(input())
    ans = 0

    for i in range(1, n):
        ans += (n-1)//i

    print(ans)


solve2()

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math
import random
########################################################
F=[1]*(10**6+1)
for i in range(2,10**6+1):
    for j in range(i,10**6+1,i):
        F[j]+=1
ans=0
n=int(input())
for c in range(1,n):
    ans+=F[n-c]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
cnt = 0
for a in range(1, 10**6+1):
    if (a * a) < N :
        cnt = cnt + 1
    else:
        break
    for b in range(a+1, 10**6+1):
        if a*b < N:
            cnt = cnt + 2
        else:
            break
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

s = 0
m = N//2 if N%2 == 0 else N//2 + 1
for n in range(1, m):
    s += (N//n if N%n != 0 else N//n - 1)

print(s+N//2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
for a in range(1,n):
    b = n//a
    if b*a == n:
        b -= 1
    ans += b
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
from numba import njit

@njit
def get_div_nums(n):
    divs = np.ones(n+1, dtype=np.int64)
    for i in range(2, n):
        divs[i::i] += 1
    return divs

def main():
    N = int(input())
    divs = get_div_nums(N)
    ans = divs[:N].sum()-1
    print(ans)
    #print(divs[:20])

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
m=n-1

p=int(m**(1/2))
c=0

for i in range(1,p+1):
        c+=(m//i-(i-1))*2-1
        
print(c)

Submission status: Accepted

Solution code:
n=int(input())
cnt=0
for i in range(1,n):
    cnt+=(n-1)//i
        # print(f"Ｃは:{i},Aは:{j},Bは：{(n-i) / j}")
print(cnt)

Submission status: Accepted

Solution code:
def Next(): return input()
def NextInt(): return int(Next())
def NextInts(): return map(int,input().split())
def Nexts(): return map(str,input().split())
def NextIntList(): return list(map(int,input().split()))
def RowInts(n): return [input() for i in range(n)]

n = NextInt()
ans = 0
for i in range(1, n):
    now = i
    while now < n:
        now += i
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# import itertools
# import math
# import sys
# sys.setrecursionlimit(500*500)
# import numpy as np
# import heapq
# from collections import deque

N = int(input())
# S = input()
# n, *a = map(int, open(0))
# N, M = map(int, input().split())
# A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

# def factorization(n):
#     arr = []
#     temp = n
#     for i in range(2, int(-(-n**0.5//1))+1):
#         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])
#     return arr

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
count=0
#N未満の値がaで割り切れさえすればいい
for a in range(1,N):
    count = count + (N-1)//a
print(count)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

n = int(input())
ans = 0

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

Submission status: Accepted

Solution code:
from functools import reduce
from operator import add
n=int(input())
print(reduce(add, ((n-1)//a for a in range(1,n))))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def func(x):
    ans = 0
    for a in range(1, n):
        for b in range(1, n):
            c = n - a * b
            if c <= 0:
                break
            ans += 1
    return ans

n = int(input())
print(func(n))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# モジュールのインポート
import math


def get_input() -> int:
    """
    標準入力を取得する.

    Returns:\n
        int: 標準入力
    """
    N = int(input())

    return N


def main(N: int) -> None:
    """
    メイン処理.

    Args:\n
        N (int): 正整数(2 <= N <= 10**6)
    """
    # 求解処理
    ans = 0
    for a in range(1, N):
        ans += math.floor((N - 1) / a)

    # 結果出力
    print(ans)


if __name__ == "__main__":
    # 標準入力を取得
    N = get_input()

    # メイン処理
    main(N)

Submission status: Accepted

Solution code:
N=int(input())
x = N
n = 1
s = 0
while x > 0:
    x = (N-1)//n
    s += x
    n+=1
print(s)

Submission status: Accepted

Solution code:

def resolve():
    N = int(input())

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

    print(ans)


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
# inp.readline()
# int(inp.readline())
# out.write()
# raw_input()
# map(int,raw_input().split())
# map(int,inp.readline().split())
# for _ in xrange(input()):
# print "Case #"+str(_+1)+": "+ 
if __name__ == "__main__":
    from sys import stdin as inp, stdout as out,setrecursionlimit as srl
    from collections import Counter,defaultdict,deque
    from heapq import *
    for _ in xrange(1):
        n=input()
        t=int(pow(n,0.5))+1
        c=Counter()
        for i in xrange(1,t+1):
          for j in xrange(i*i,n+1,i):
            c[j]+=1
        print 2*sum(c[i] for i in xrange(1,n))-int(pow(n-1,0.5))

Submission status: Accepted

Solution code:
'''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7
# mod = 998244353
dir = [(-1,0),(0,-1),(1,0),(0,1)]
alp = "abcdefghijklmnopqrstuvwxyz"
INF = 1<<32-1
# INF = 10**18

def main():
    n = int(ipt())
    ans = 0
    for i in range(1,n):
        ans += (n-1)//i

    print(ans)

    return None

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
from sys import stdin,stdout
import math
import random
import heapq
from collections import Counter
from functools import lru_cache
#@lru_cache(maxsize=None) #for optimizing the execution time of callable objects/functions(placed above callable functions)




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



    
except EOFError as e:
    print(e)

Submission status: Accepted

Solution code:

n = int(input())

res = 0


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

Submission status: Accepted

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