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:
# Python3 program to count
# number of factors
# of an array of integers
MAX = 1000005

# array to store
# prime factors
factor = [0]*(MAX + 1)

# function to generate all
# prime factors of numbers
# from 1 to 10^6


def generatePrimeFactors():
    factor[1] = 1

    # Initializes all the
    # positions with their value.
    for i in range(2, MAX):
        factor[i] = i

    # Initializes all
    # multiples of 2 with 2
    for i in range(4, MAX, 2):
        factor[i] = 2

    # A modified version of
    # Sieve of Eratosthenes
    # to store the smallest
    # prime factor that divides
    # every number.
    i = 3
    while(i * i < MAX):
        # check if it has
        # no prime factor.
        if (factor[i] == i):
            # Initializes of j
            # starting from i*i
            j = i * i
            while(j < MAX):
                # if it has no prime factor
                # before, then stores the
                # smallest prime divisor
                if (factor[j] == j):
                    factor[j] = i
                j += i
        i += 1

# function to calculate
# number of factors


def calculateNoOFactors(n):
    if (n == 1):
        return 1
    ans = 1

    # stores the smallest
    # prime number that
    # divides n
    dup = factor[n]

    # stores the count of
    # number of times a
    # prime number divides n.
    c = 1

    # reduces to the next
    # number after prime
    # factorization of n
    j = int(n / factor[n])

    # false when prime
    # factorization is done
    while (j > 1):
        # if the same prime
        # number is dividing
        # n, then we increase
        # the count
        if (factor[j] == dup):
            c += 1

        # if its a new prime factor
        # that is factorizing n,
        # then we again set c=1 and
        # change dup to the new prime
        # factor, and apply the formula
        # explained above.
        else:
            dup = factor[j]
            ans = ans * (c + 1)
            c = 1

        # prime factorizes
        # a number
        j = int(j / factor[j])

    # for the last
    # prime factor
    ans = ans * (c + 1)

    return ans
# Driver Code


if __name__ == "__main__":

    # generate prime factors
    # of number upto 10^6
    generatePrimeFactors()
    # a = [10, 30, 100, 450, 987]
    # q = len(a)
    s=0
    for i in range(1, int(input())):
        s+=(calculateNoOFactors(i))
    print(s)

# This code is contributed
# by mits.

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

def main():
    n = int(input())
    li = [1] * (n + 1)
    for i in range(2, n + 1):
        j = 1
        while i * j <= n:
            li[i * j] += 1
            j += 1

    print(sum(li[1:n]))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
n = int(input())
count = 0
for i in range(1,n):
    for j in range(i,n):
        if i*j <= n-1:
            if i != j:
                count += 2
            else:
                count += 1
        else:
            break
print(count)

Submission status: Accepted

Solution code:
import math

n = int(input())

root=int(math.sqrt(n))
count=0
for i in range(1,n):
    for j in range(i,math.ceil((n/i))):
        if i*j<n:
            count+=1

count*=2
if root==math.ceil(math.sqrt(n)):
    root-=1
print(count-root)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(res)

Submission status: Accepted

Solution code:
n=int(input())
cnt=0

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

print(cnt)

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())
def solver(N):
    times = math.ceil(math.sqrt(N))
    counter = 0
    for i in range(1,times):
        for j in range(i,N//i + 1):
            C = N - i * j
            if C > 0:
                if i == j:
                    counter += 1
                else:
                    counter += 2
    return counter
print(solver(N))

Submission status: Accepted

Solution code:
n = int(input())

count = 0
for a in range(1,n):
  #a=1ならBはn-1通り
  #a=2ならBはint(n-1/2)通り
  #a=3ならBはint(n-1/3)
  count += int((n-1)/a)
print(count)

Submission status: Accepted

Solution code:
n = int(input())

res = 0
for a in range(1, n+1):
    for b in range(1, int((n+1)/a)+1):
        c = n-a*b
        if c>0 and a*b+c==n:
            res+=1
print(res)

Submission status: Accepted

Solution code:
def resolve():
    n = int(input())

    count = 0
    a, b = 1, 1
    while a < n:
        while b < n / a:
            count += 1
            b += 1
        b = 1
        a += 1
    print(count)


if 'unittest' not in globals():
    resolve()

Submission status: Accepted

Solution code:
import math
n = int(input())

inter = int(math.sqrt(n))

count = (inter)**2
if n / inter == inter:
  count -= 1

for a in range(1, inter+2):
  for b in range(inter+1, n):
    if a*b < n:
      count += 2
    else:
      break
      
print(count)

Submission status: Accepted

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

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())

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

print(ans)

Submission status: Accepted

Solution code:
import math
n = int(input())
ans = 0

for a in range(1, n):
    buf = math.floor((n-1)/a)
    ans += buf

print(ans)

Submission status: Accepted

Solution code:
import math
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())

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

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 -*-
import math

N = int(input())

ans = 0
N_half = int(math.sqrt(N))
for A in range(1, N_half+1):
    for B in range(1, N):
        if A * B < N:
            ans += 1
            if B > N_half:
                ans += 1
        else:
            break
    
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import math


def solve(N: int):
    cnt = 0
    for i in range(1, N):
        div = math.floor((N-1) / i) - (i-1)
        if div <= 0:
            break
        cnt += 2 * div - 1
    return cnt


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    print(solve(N))


if __name__ == '__main__':
    main()
    # print(solve(3))

Submission status: Accepted

Solution code:
N = int(input())

N_1 = N - 1
counts = 0
i = 1
j = 1
while i <= N_1:
    while j <= N_1:
        if i * j <=  N_1:
            counts = counts + 1
        else:
            j = N_1
        j = j + 1
    j = 1
    i = i + 1

print(counts)

Submission status: Accepted

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

for i in range(1, N):
    quotient = (N - 1) // i
    if quotient:           
        count += quotient
                         
print(count)

Submission status: Accepted

Solution code:
import math
def main():

    n = int(input())
    counter = 0
    for a in range(1,int(math.sqrt(n))+2):
        for b in range(a,n//a+1):
            c = n - a*b
            #print(a,b,c,c >= 1)
            if c <= 0:
                continue
            if a==b:
                counter += 1
            else:
                counter += 2
    print(counter)



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())
#約数の個数メモ化

"""
A*B+C=N
N-C=A*B
AB+C=Nの組み合わせは、N-1通り
NlogNは
"""
ans=0
# 約数の個数を一斉取得
def getNumsOfDivisorsOfEachNumbers(n: int):
    # validation check
    if not isinstance(n, int):
        raise("[ERROR] parameter must be integer")
    if n < 0:
        raise("[ERROR] parameter must be not less than 0 (n >= 0)")
    nums = [0] * (n + 1) # 0-indexed
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            nums[j] += 1
    nums.pop(0)
    return nums


# 約数の個数を一斉取得
all_=getNumsOfDivisorsOfEachNumbers(N-1)
#c=1のとき、all_[N-1](N-1の約数)を見ればいい
for i in range(1,N):
    c=N-i
    ans+=(all_[i-1]//2)*2+all_[i-1]%2
print(ans)

Submission status: Accepted

Solution code:
def abc179c():

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

Submission status: Accepted

Solution code:
import math
N = int(input())

d = [0] * N
for i in range(1, math.floor(math.sqrt(N)) + 1):
    for j in range(i, N // i + 1):
        if i == j:
            d[i * j - 1] += 1
        else:
            d[i * j - 1] += 2

print(sum(d) - d[-1])

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
a = input()
N = int(a)
count = 0

for i in range(1,N):
    if (N-1)//i >= i:
        count = count + 2*(((N-1)//i)-i+1)
        count = count - 1
    
print(count)

Submission status: Accepted

Solution code:
from sys import stdin

input = stdin.readline



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



if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/local/bin/python3

def factorization(n):
    arr = [[1, 1]]
    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

N = int(input()) - 1

ans = 0
left = 1
while True:
    right = N // left
    if right < left:
        break
    # print(f"{left}×({left}〜{right})")
    ans += right - (left - 1)
    left += 1

last_left = left -1
ans = (ans - last_left)*2 + last_left

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    
    return table
print(sum(num_divisors_table(int(input()))[1:-1]))

Submission status: Accepted

Solution code:
z=int(input())
i=1
re=0
b=1
d=1
while z>i:
  b=1
  while True:
    x=i*(i+b)
    if z>x:
      re+=2
    else:
      break
    b+=1
  i+=1
while True:
  if d*d<z:
    d+=1
    re+=1
  else:
    break
print(re)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for i in range(1, N+1):
    cnt = (N-1) // i
#     for j in range(1, cnt+1):
#         if i * j >= N:
#             break
#         print(1, j)
    ans += cnt
print(ans)

Submission status: Accepted

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

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

print(s)

Submission status: Accepted

Solution code:
N = int(input())

cnt = 0
for a in range(1, N + 1):
    b = 1
    while True:
        if a * b < N:
            cnt += 1
        else:
            break
        b += 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

n = int(input())
t = int(math.sqrt(n)) + 1

count = 0
p = 0
for a in range(1,t):
    for b in range(a,1000000):
        if a*b < n:
            count += 1
        else:
            break
        if a==b: p+=1
count = (count*2) - p
print(count)

Submission status: Accepted

Solution code:
# Date [ 2020-09-19 21:04:27 ]
# Problem [ c.py ]
# Author Koki_tkg

import sys
# import math
# import bisect
# import numpy as np
# from decimal import Decimal
# from numba import njit, i8, u1, b1 #JIT compiler
# from itertools import combinations, product
# from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b)
def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b)

class PrimeFactorization():
    def __init__(self, num):
        self.num = num
        self.factor_table = [0] * (num + 1)
        self.eratosthenes()

    def eratosthenes(self):
        for i in range(2, self.num + 1):
            if self.factor_table[i] == 0:
                self.factor_table[i] = i
                for j in range(i * i, self.num + 1, i):
                    if self.factor_table[j] == 0:
                        self.factor_table[j] = i
    
    def factorization(self, a):
        now = a
        ret = []
        while now > 1:
            cnt = 0
            prime = self.factor_table[now]
            while now % prime == 0:
                cnt += 1
                now //= prime
            ret.append((prime, cnt))
        return ret
def Main():
    n = read_int()
    prime = PrimeFactorization(n + 10)
    ans = 0

    for c in range(1, n):
        num = n - c
        tmp = prime.factorization(num)
        length = 1
        if not tmp:
            ans += 1
            continue
        for x, y in tmp:
            length *= (y + 1)
        if length == 1:
            ans += 1
        else:
            ans += length
    print(ans)

if __name__ == '__main__':
    Main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
n=int(input())
c=n-1
for i in range(2,n+1):
    c+=math.ceil(n/i-1)
    # print(c,i)
print(c)

Submission status: Accepted

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

for C in range(1, N):
    ans += div_list[N - C]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int):
    n = 0
    for c in range(1, N):
        if N % c == 0:
            n += N // c - 1
        else:
            n += N // c
    print(n)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
''' ===============================
	-- @uthor : Kaleab Asfaw
	-- Handle : kaleabasfaw2010
	-- Bio    : High-School Student
	==============================='''

# Fast IO
import sys
import os
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")
# Others
# from math import floor, ceil, gcd
# from decimal import Decimal as d
mod = 10**9+7
def lcm(x, y): return (x * y) / (gcd(x, y))
def fact(x, mod=mod):
	ans = 1
	for i in range(1, x+1): ans = (ans * i) % mod
	return ans
def arr2D(n, m, default=0):
	lst = []
	for i in range(n): temp = [default] * m; lst.append(temp)
	return lst
def sortDictV(x): return {k: v for k, v in sorted(x.items(), key = lambda item : item[1])}

def solve(n):
	cnt = 0
	for i in range(1, n):
		val = n // i
		if n % i == 0: val -= 1
		cnt += val
	return cnt

n = int(input())
print(solve(n))

Submission status: Accepted

Solution code:
import math
n = int(input())
k = 0
a = 1
while a<n:
  k += (n//a)
  if n%a == 0:
    k -= 1
  #print(a,(n//a)-1)
  a += 1
print(k)

Submission status: Accepted

Solution code:
from sys import stdin
import collections
def ip(): return [int(i) for i in stdin.readline().split()]
def sp(): return [str(i) for i in stdin.readline().split()]


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:
n = int(input())
count = 0
for a in range(1,n):
    if n%a==0:
        b = n//a - 1
    else:
        b = n//a
    count+=b
print(count)

Submission status: Accepted

Solution code:
from sys import stdin
from collections import defaultdict
readline = stdin.readline
def i_input(): return int(readline().rstrip())
def i_map(): return map(int, readline().rstrip().split())
def i_list(): return list(i_map())


def main():
    N = i_input()
    d = defaultdict(lambda: 1)
    ans = 0
    for i in range(2, N):
        for j in range(i, N, i):
            d[j] += 1
    for c in range(1, N):
        ans += d[c]
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
count=0
for i in range(1,n):
    if i>=n/2:
        count+=1
        continue
    else:
        syou,amari=divmod(n,i)
        if amari==0:
            count+=syou-1
        else:
            count+=syou

print(count)

Submission status: Accepted

Solution code:
import math
n = int(input())
tmp_s = math.sqrt(n)
s = math.floor(math.sqrt(n))

if n == 1:
  print(0)
elif n == 2:
  print(1)
elif n == 3:
  print(3)
else:
  cnt = 0
  for i in range(s):
    if n % (i+1) == 0:
      if i+1 != s:
        tmp = (n / (i+1) - 1 - (i+1)) * 2 + 1
        cnt += tmp
    else:
      tmp = (n // (i+1) - (i+1)) * 2 + 1
      cnt += tmp

  print(round(cnt))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
n = int(input())

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

Submission status: Accepted

Solution code:
from math import log,ceil,floor
n=int(input())
index=1
tot=0
for i in range(n//2):
	tot+=(n-1)//index
	index+=1

if n%2==0:
	print(tot+n//2-1)
else:
	print(tot+n//2)

Submission status: Accepted

Solution code:
n = int(input())
count = 0
same = 0
for i in range(1,n):
	a = i
	b = i
	if a*b >= n:
		break
	same += 1
	while a*b < n:
		count+=1
		b+=1
print(count*2-same)

Submission status: Accepted

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




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):
    q = n // a
    r = n % a
    if r == 0:
        cnt += q -1
    else:
        cnt += q

print(cnt)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    NN = N - 1
    ans = 0
    
    for i in range(1,N):
        j = NN//i
        ans += j
    
    print(ans)
    
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:
N = int(input())

k = 0
for i in range(1, N):
    j = 1
    while i * j <= N - 1:
        j += 1
        k += 1
print(k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

def main():
    N = int(input())
    ans = 0
    for a in range(1, int(math.sqrt(N))+1):
        for b in range(a, (N // a) + 1):
            if a * b >= N:
                break
            if a != b:
                ans += 2
            else:
                ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

ans = N - 1
for i in range(2,N):
    n = N
    if N % i == 0:
        n = N - 1
    
    #print(str(i) + " " + str(n//i))
    ans += n//i
    #print(str(i) + " " + str(n // i) + " " + str(N - (i * (n//i))))

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
#A*B<NとなるA,Bの組み合わせの数
a=0

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

Submission status: Accepted

Solution code:
import math
n=int(input())
m=round(math.sqrt(n))
ans=0
for i in range(1,n):
  res=n//i
  if n%i==0:
    ans+=res-1
  else:
    ans+=res
print(ans)

Submission status: Accepted

Solution code:
#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3

n = int(input())

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

Submission status: Accepted

Solution code:
N=int(input())
l=N-1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

count = 0

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import math
import collections
import itertools

def YesNo(Bool):
    if(Bool):
        print("Yes")
    else:
        print("No")
    return

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return len(lower_divisors) + len(upper_divisors[::-1])


def getNumsOfDivisorsOfEachNumbers(n: int):
    # validation check
    if not isinstance(n, int):
        raise("[ERROR] parameter must be integer")
    if n < 0:
        raise("[ERROR] parameter must be not less than 0 (n >= 0)")
    nums = [0] * (n + 1) # 0-indexed
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            nums[j] += 1
    nums.pop(0)
    return nums

def resolve():

    N=int(input())


    print(sum(getNumsOfDivisorsOfEachNumbers(N-1)))
    # cnt=0
    # for i in range(N):
    #     cnt+=num_divisors_table(i)

    # print(cnt)

resolve()

Submission status: Accepted

Solution code:
import math
a=int(input())
def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    
    return table
print(sum(num_divisors_table(a-1)))

Submission status: Accepted

Solution code:
import math
n = int(input())

a = 1

count = 0
ans = 0


while a < n:
	ans += math.floor((n-1)/a)
	a += 1

  
print (ans)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
import math

n = int(input())

c = int(math.sqrt(n-1))

for i in range(1,n):
    for j in range(1,i):
        if i * j <= n-1:
            c += 2
        else:
            break

print(c)

Submission status: Accepted

Solution code:
import math

N = int(input())
cnt = 0
for i in range(1, int(math.sqrt(N)) + 1):
    for j in range(1, N // i + 1):
        if i * j < N:
            if i == j:
                cnt += 1
            elif i < j:
                cnt += 2
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

count = 0

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

print(count)

Submission status: Accepted

Solution code:
import math
N = int(input())

sqrt_N = math.floor(math.sqrt(N - 1))
conbination = 0
conbination_AeqB = 0
for A in range(1, sqrt_N + 1):

    # B = Aからfloor(N-1 / A)まで
    conbination_AeqB += 1
    conbination += math.floor((N - 1) / A) - A
    # N = 5
    # (1, 1, 4), (1, 2, 3), (1, 3, 2), (1, 4, 1)
    # (2, 1, 3), (2, 2, 1)
    # (3, 1, 2)
    # (4, 1, 1)
    # N = 4
    # (1, 1, 3), (1, 2, 2), (1, 3, 1)
    # (2, 1, 2)
    # (3, 1, 1)
print(conbination_AeqB + conbination * 2)

Submission status: Accepted

Solution code:
n=int(input())
count=0
for i in range(1,n):
	x=n//i
	for j in range(1,x+1):
		if i*j<n:
			count+=1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
i = 1
while i**2 < N:
    j = i
    while i*j < N:
        if i == j:
            ans += 1
        else:
            ans += 2
        j += 1
    i+= 1

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:
            break
        else:
            ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    nums = list(range(1, N))
    count = 0
    for i in nums:
        for j in nums:
            if N <= i * j:
                break
            count += 1
    print(count)


main()