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())
count = 0
for i in range(1, n+1):
    for j in range(i+1, n+1):
        if i*j < n:
            count += 2
        else:
            break
for i in range(1, n+1):
    if i**2 < n:
        count += 1
    else:
        break
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

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

Submission status: Accepted

Solution code:
from typing import List, Any


def read_int() -> int:
    return int(input().strip())


def read_ints() -> List[int]:
    return list(map(int, input().strip().split(' ')))


def solve() -> Any:
    N = read_int()
    answer = 0
    for A in range(1, N):
        count = N//A
        if N%A == 0:
            count -= 1
        answer += count
    return answer


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

res = 0

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

print(res)

Submission status: Accepted

Solution code:
N = int(input())
cnt = 0
for A in range(1,N):
    for B in range(1,(N-1)//A+1):
        if A*B<=N-1:
            cnt+=1
print(cnt)

Submission status: Accepted

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

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:
def main():
    n = int(input())
    ans = 0
    for a in range(1, n):
        b = (n-1)//a
        ans += b
    print(ans)

if __name__ == "__main__":
    main()

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())
res = 0
for a in range(1,N):
    res += (N-1)//a

print(res)

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from math import gcd
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gcd
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().rstrip().split()
def S(): return sys.stdin.readline().rstrip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]

mod=10**9+7
n=I()
ans=0
for i in range(1,n+1):
    ans+=(n-1)//i

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
max_ = 10 ** 6 + 10
ans = [2 for _ in range(max_)]
ans[0] = 0
ans[1] = 1
for i in range(2, max_):
    for j in range(i * i, max_, i):
        ans[j] += 2
        if j == i * i:
            ans[j] -= 1

ans_ = 0
for i in range(1, n):
    ans_ += ans[i]
print(ans_)

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def input():
    return sys.stdin.readline().strip()

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

def main():
    INF = 999999999999999999999999
    MOD = 10**9+7

    n = int(input())
    ans = 0

    for a in range(1, n):
        b = 1
        while a*b < n:
            ans += 1
            b += 1
    
    print(ans)

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())

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

    print(ans)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
N, = [int(x) for x in input().split()]

ans = 0
for A in range(1, N + 1):
    numB = N // A
    if N % A == 0:
        ans += numB - 1
    else:
        ans += numB

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
ans=sum(n//a-int(not n%a) for  a in range(1,n))
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:
#!/usr/bin/env python3
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:
n = int(input())
ans = 0
for a in range(1, n):
    for b in range(1, n):
        if a * b < n:
            ans += 1
        else:
            break
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
ans=0
n=n-1
for i in range(1,n+1):
    ans+=(n//i)
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):
  # b: 1  a*b <= N-1 b<= (N-1)//a
  ans += (N-1) // a
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache

#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')
AZ = "abcdefghijklmnopqrstuvwxyz"

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


#####Shorten#####
def DD(arg): return defaultdict(arg)

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n): return kaijo_memo[n]
  if(len(kaijo_memo) == 0): kaijo_memo.append(1)
  while(len(kaijo_memo) <= n): kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n): return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0): gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n): gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if n == r: return 1
  if n < r or r < 0: return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
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

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

#####MakePrimes######
def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum

#####GCD#####
def gcd(a, b):
    while b: a, b = b, a % b
    return a

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n-1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n: return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))

def base_10_to_n_without_0(X, n):
  X -= 1
  if X//n: return base_10_to_n_without_0(X//n, n)+[X%n]
  return [X%n]

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

N = I()
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:
# region header
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
import copy
# @lru_cache(maxsize=None)
# sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7
# endregion
# region input function


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


# endregion

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
for a in range(1, N):
    for b in range(1, N):
        ab = a * b
        if ab >= N:
            break
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
#create date: 2020-09-19 21:04

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from math import floor


n = int(input())
m = floor(n**0.5)
ans = 0
for i in range(1, m+1):
  ans += 2*((n-1)//i)
  ans -= 2*i-1
if m*m == n:
  ans += 1
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:
# import sys; input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**7)
from collections import defaultdict
mod = 10 ** 9 + 7; INF = float("inf")

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

def inverse(N, mod):
	return (pow(N, mod - 2, mod))

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

	print(ans)

	




if __name__ == '__main__':
	main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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()) - 1
ans = 0
for a in range(1, n + 1):
    ans += n // a
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
r = 0
for i in range(1, 10**6):
    r += n//i
    if n%i == 0:
        r -= 1
print(r)

Submission status: Accepted

Solution code:
def main():
    examC()

def examA():
    S = SI()
    if S[-1]=="s":
        ans = S+"es"
    else:
        ans = S+"s"
    print(ans)
    return

def examB():
    N = I()
    D = [LI()for _ in range(N)]
    current = 0
    for d1,d2 in D:
        if d1==d2:
            current += 1
        else:
            current = 0
        if current==3:
            print("Yes")
            return
    print("No")
    return

def examC():
    N = I()
    cnt = 0
    for i in range(1,N):
        for j in range(1,1+N//i-(N%i==0)):
            cnt += 1
    ans = cnt
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,alphabet_convert,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 1<<31
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    main()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


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

    ans = 0

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
res = 0
for i in range(1,N+1):
    if N%i ==0 and N//i>=2:
        res += N//i-1
    elif N%i!=0:
        res += N//i
print(res)

Submission status: Accepted

Solution code:
n = int(input())

cnt = 0
for i in range(1, n+1):
  for j in range(1, n+1):
    if i * j >= n:
      break
    # print(i, j, n-i*j)
    cnt += 1

print(cnt)

Submission status: Accepted

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


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
# ------------------- fast io --------------------
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# ------------------- fast io --------------------
from math import gcd, ceil

def pre(s):
    n = len(s)
    pi = [0] * n
    for i in range(1, n):
        j = pi[i - 1]
        while j and s[i] != s[j]:
            j = pi[j - 1]
        if s[i] == s[j]:
            j += 1
        pi[i] = j
    return pi


def prod(a):
    ans = 1
    for each in a:
        ans = (ans * each)
    return ans

def lcm(a, b): return a * b // gcd(a, b)


def binary(x, length=16):
    y = bin(x)[2:]
    return y if len(y) >= length else "0" * (length - len(y)) + y


for _ in range(int(input()) if not True else 1):
    n = int(input())
    #n, k = map(int, input().split())
    #a, b = map(int, input().split())
    #c, d = map(int, input().split())
    #a = list(map(int, input().split()))
    #b = list(map(int, input().split()))
    ans = 0
    for i in range(1, n):
        a = i
        b = n // a - (n % a == 0)
        ans += max((b), 0)
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

print(result)

Submission status: Accepted

Solution code:
N=int(input())

ans=0
for A in range(1,N+1):
    B=1
    while(A*B<N):
        ans+=1
        B+=1
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:
# coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read

#n,q = map(int, readline().split())
#*a, = map(int, readline().split())

n = int(input())

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



print(ans)

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy,deepcopy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

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

Submission status: Accepted

Solution code:
N = int(input())
tau = [0 for i in range(N)]
for d in range(1,N):
    for n in range(d,N,d):
        tau[d] += 1

print(sum(tau))

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for i in range(1, 10 ** 6):
    if N // i > 0:
        ans += N // i
    if N % i == 0:
        ans -= 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

# from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
printout = sys.stdout.write
sprint = sys.stdout.flush
# from heapq import heappop, heappush
# from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
# import math
# from itertools import product, accumulate, combinations, product
# import bisect
# import numpy as np
# from copy import deepcopy
#from collections import deque
# from decimal import Decimal
# from numba import jit

INF = 1 << 50
EPS = 1e-8
mod = 10 ** 9 + 7


def intread():
    return int(sysread())
def mapline(t=int):
    return map(t, sysread().split())
def mapread(t=int):
    return map(t, read().split())

def run():
    N = int(sysread())
    ans = 0
    for a in range(1, N):
        for b in range(1, N//a+1):
            c = N - a * b
            if c > 0:
                ans += 1
    print(ans)
if __name__ == "__main__":
    run()

Submission status: Accepted

Solution code:
import sys
import math


def input():
    return sys.stdin.readline().rstrip()


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

    #i A
    #j B
    #k? C
    ans =0
    for i in range(1,N):
        ans += (N-1)//i

    print(ans)








if __name__ == "__main__":
    main()

# \n

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque, defaultdict
#deque(l), pop(), append(x), popleft(), appendleft(x)
#q.rotate(n)で → にn回ローテート
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations,product#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
from functools import reduce,lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal
from argparse import ArgumentParser

args=ArgumentParser()
args.add_argument('-loc', '--local', type=bool,default=False)
LOCAL=args.parse_args().local

def input(): 
    x=sys.stdin.readline(); 
    if x[-1]=="\n": 
        return x.rstrip() 
    return x
    
def printe(*x):_=print("## ",*x,file=sys.stderr) if LOCAL else 0
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def binr(x): return bin(x)[2:]
def bitcount(x): #xは64bit整数
    x= x - ((x >> 1) & 0x5555555555555555)
    x= (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x= (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f 
    x+= (x >> 8); x+= (x >> 16); x+= (x >> 32) 
    return x & 0x7f
def yakusuu(n):
    divisors = set()
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.add(i)
            if i != n // i:
                divisors.add(n//i)
    # divisors.sort()
    return divisors

def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reverse=True)  #二個目の要素で降順並び替え

    N = int(input())
    #N, K = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列
    ans=0
    for a in range(1,N):
        ans+=(N-1)//a
    print(ans)
    


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:

n = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
D=[0 for i in range(N+1)]
for i in range(1,N+1):
    for j in range(i,N+1,i):
        D[j]+=1
ans=0
for AB in range(1,N):
    ans+=D[AB]
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

N = int(input())
ans = 0

for a in range(1,N):

    maxb = N // a

    if maxb * a == N:
        ans += maxb-1
    else:
        ans += maxb

print (ans)

Submission status: Accepted

Solution code:
N = int(input())

a = 1
answer = 0

while a<N:
  answer += (N-1)//a
  a += 1

print(answer)

Submission status: Accepted

Solution code:
N = int(input())
cnt = [0] * (N + 1)
for A in range(1, N+1):
    B = 1
    while A * B <= N:
        cnt[A * B] += 1
        B += 1
ans = 0
for C in range(1, N):
    ans += cnt[N - C]
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())

# count A, B s.t. A * B <= N-1                                                                                                                                

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from collections import *

N = int(input())
ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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:
import sys
input = sys.stdin.readline
N = int(input())
res = 0
for i in range(1, N + 1): res += (N - 1) // i
print(res)

Submission status: Accepted

Solution code:
n = int(input())

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

    ans += temp
print(ans)

Submission status: Accepted

Solution code:
# by the authority of GOD     author: manhar singh sachdev #

import os,sys
from io import BytesIO, IOBase

def main():
    n = int(input())
    ans = 0
    for i in range(1,n):
        ans += (n-1)//i
    print(ans)
    
#Fast IO Region
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
import re
import random
import math
import copy
from heapq import heappush, heappop, heapify
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter
# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = float("inf")
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)


def solve():
    n = getN()
    ans = 0
    for i in range(1, n+1):
        ans += (n-1) // i

    print(ans)
def main():
    n = getN()
    for _ in range(n):
        solve()

    return
if __name__ == "__main__":
    # main()
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

K=0
for a in range(1,N+1):
    b=1
    while a*b<N:
        K+=1
        b+=1
print(K)

Submission status: Accepted

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