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:
import sys
from math import ceil as C, floor as F, sqrt, gcd as G
from collections import defaultdict as D, Counter as CNT
from functools import reduce as R
import heapq as HQ

class Heap:
  def __init__(self, data, reverse=False):
    self.reverse = -1 if reverse else 1
    self.data = [self.reverse * d for d in data]
    HQ.heapify(self.data)
  def push(self, x): return HQ.heappush(self.data, self.reverse * x)
  def pop(self): return self.reverse * HQ.heappop(self.data) 

ALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alp = 'abcdefghijklmnopqrstuvwxyz'
def _X(): return sys.stdin.readline().rstrip().split(' ')
def _S(ss): return tuple(ss) if len(ss) > 1 else ss[0]
def S(): return _S(_X())
def Ss(): return list(S())
def _I(ss): return tuple([int(s) for s in ss]) if isinstance(ss, tuple) else int(ss)
def I(): return _I(S())
def _Is(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Is(): return _Is(I())

n = I()
ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
n = int(raw_input())
ans = 0
def f(a,n):
	howmanybs = n/a
	return howmanybs +(-1 if n % a == 0 else 0)

for a in xrange(1, n+1):
	ans += f(a,n)
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

def is_ok(A,B,N):
    if A*B<N:
        return True
    else:
        return False

for a in range(1,N):

    ok=0
    ng=10**6+100
    while abs(ng-ok)>1:
        mid=(ok+ng)//2
        
        if is_ok(a,mid,N):
            ok=mid
        else:
            ng=mid
    
    ans+=ok
    
print(ans)

Submission status: Accepted

Solution code:
import math
n = int(input())
ans = 0
for i in range(n):
  a = i + 1
  b = 1
  c = n - a * b
  ans += math.ceil(c / a)
print(ans)

Submission status: Accepted

Solution code:
n=int(input())

ans=0
for a in range(1,n):
  b_max=n//a
  num=a*b_max
  if n>num:
    ans+=b_max
  else:
    ans+=b_max-1
print(ans)

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:
N = int(input())
count = 0
for i in range(N):
  m = N // (i+1)
  if N % (i + 1) == 0:
    count += m -1
  else:
    count += m
print(count)

Submission status: Accepted

Solution code:
N = int(input())
i=1
c=0
while i**2<N:
    if N%i==0:
        c+=(N//i-1-i)*2+1
    else:
        c+=(N//i-i)*2+1
    i+=1
print(c)

Submission status: Accepted

Solution code:
n=int(input())
count=0
for i in range(1,int(n**(1/2))+1):
    for j in range(i,n):
        if i*j>=n:
            break
        elif i==j:
            count+=1
        else:
            count+=2
print(count)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
for i in range(1,N+1):
    for j in range(1,N+1):
        if N - i*j >=1:
            ans += 1
        else:    
            break
print(ans)

Submission status: Accepted

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

count = 0
for i in range(1, N+1):
  for j in range(i, N+1):
    k = N - i*j
    #print(i,j,k)
    if k >0:
      if i==j:
        count += 1
      else:
        count += 2
    else:
      break
print(count)

Submission status: Accepted

Solution code:
N = int(input())

count = 0

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

print(count)

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
# d = defaultdict(int)で0で初期化
# d = defaultdict(lambda: 100)で100で初期化
MAXN = 10**6 + 10
sieve = [i for i in range(MAXN + 1)]
p = 2
while p * p <= MAXN:
    if sieve[p] == p:
        for q in range(2 * p, MAXN + 1, p):
            if sieve[q] == q:
                sieve[q] = p
    p += 1


def solve(a):
    tmp = defaultdict(int)
    while a > 1:
        tmp[sieve[a]] += 1
        a //= sieve[a]
    ans = 1
    for i in tmp.values():
        ans *= (i + 1)
    return ans


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

Submission status: Accepted

Solution code:
n = int(input())

l = [0]*(n+1)
ans = 0

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

if n%2 == 0:
    ans -= 1
print(ans)

Submission status: Accepted

Solution code:
# import numpy as np
import sys, math, heapq
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep="\n")


N = 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


table = num_divisors_table(N + 3)
chkset = set()
for i in range(int(math.sqrt(N) + 10)):
    chkset.add(i ** 2)
# print(table)
cnt = 0
for C in range(1, N):
    NC = N - C
    cnt += table[NC]
    # if NC in chkset:
    #     cnt -= 1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

# A * B >= Nとなる点を探す
for i in range(n):
    A = i + 1
    B = n // A
    Bmod = n % A
    if Bmod == 0:
        ans += B - 1
    else:
        ans += B

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

print(count)

Submission status: Accepted

Solution code:
N = int(input())
A = 1
B = 1
d = 0
e = 0

while A < N:
  while A * B < N:
    if A == B:
      e += 1
    else:
      d += 1
    B += 1
  A += 1
  B = A

print(d*2+e)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# coding:utf-8
import math

def main():
    stdIn = int(input())
    stdOut = solve(stdIn)
    print(stdOut)


"""
方針
A * B + C = N を満たす正の整数の組の数を答える問題
掛け算から詰めていくのが良さそう
A <= Bに固定して、A == B なら +1, A != B なら +2するのがよさぞう
CはA * Bの値によって一意に定められる

"""


def solve(n):
    pattern = 0
    a = 1
    while a < n:
        # C >= 1なので、a * b = n は不適
        patternB =  math.ceil(n / a) - 1 
        pattern += patternB
        a += 1
    return pattern


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
n=int(input())

cnt=0

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

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
count = 0
flg = False
for i in range(1,N):

    count +=  int(N / i)
    if N% i == 0:
        count -=1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

spf=[1 for _ in range(N+1)]

for i in range(2,N+1):
    n=i
    if spf[i]!=1:
        continue
    while n<=N:
        if spf[n]==1:
            spf[n]=i
        n+=i

ans=0
for j in range(1,N):
    d={}
    t=j
    res=1
    while t>1:
        if spf[t] in d:
            d[spf[t]]+=1
        else:
            d[spf[t]]=1
        t//=spf[t]
    for D in d:
        res*=d[D]+1
    ans+=res
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
cnt = 0
tmp = 0
for i in range(1, N):
    if i**2 >= N:break
    for j in range(i, N):
        if i * j < N:
            ans += 1
        else: break
    tmp += 1

print(ans*2 - tmp)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

for i in range(1,n):
    a = n // i
    for j in range(1,a+2):
        if i * j < n:
            ans = ans + 1

print(ans)

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):
    if N%i==0:
        cnt+=N//i-1
    else:
        cnt+=N//i
    

print(cnt)

Submission status: Accepted

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

import numpy as np
N=int(input())

ans=0

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

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

n=int(input())

sum = 0
for i in range(n):

    if n%(i+1) == 0:
        sum += int(n/(i+1))-1
    else:
        sum += int(math.floor(n/(i+1)))

print(sum)

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+1):
    b = n//a
    c = n - a*b
    if c <= 0: ans += b-1
    else: ans += b
print(ans)

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
for a in range(1,n):
    for b in range(1,n//a+1):
        if n-a*b > 0:
            ans += 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 - 1) // A + 1):
        ans += 1

print(ans)

Submission status: Accepted

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

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
    po = b
    ans += po

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import pprint
import fractions
import collections
import itertools
from decimal import *
from collections import deque
from bisect import *
N=int(input())
l=[]
keys=[]
values=[]
ans=0
ma=10**6
x=[0]*(ma+1)
for i in range(1,ma):
    for j in range(i,ma+1,i):
        x[j]=x[j]+1
    #print(x)
for j in range(1,N):
    #print(i)
    m = N-j
    ans=ans+x[m]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#Python Competetive Programming Template

from sys import stdin, stdout
from math import *

testing = False

def tp(s=""):
	if testing:
		stdout.write("{0}\n".format(s))

def main():
	n = int(stdin.readline())
	total = 0

	for a in range(1, n):
		count = (n-1)//a
		total += count
		tp(count)

	stdout.write("{0}\n".format(total))


	

main()

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

Submission status: Accepted

Solution code:
"""
                            pppppppppppppppppppp
                         ppppp  ppppppppppppppppppp
                      ppppppp    ppppppppppppppppppppp
                      pppppppp  pppppppppppppppppppppp
                      pppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppppp
       ppppppppppppppppppppppppppppppppppppppppppppppp  pppppppppppppppppppp
      pppppppppppppppppppppppppppppppppppppppppppppppp  ppppppppppppppppppppp
     ppppppppppppppppppppppppppppppppppppppppppppppppp  pppppppppppppppppppppp
    ppppppppppppppppppppppppppppppppppppppppppppppp    pppppppppppppppppppppppp
   pppppppppppppppppppppppppppppppppppppppppppppp     pppppppppppppppppppppppppp
  ppppppppppppppppppppppppppppppppppppppppppppp      pppppppppppppppppppppppppppp
  pppppppppppppppppppppppppppppppp               pppppppppppppppppppppppppppppppp
  pppppppppppppppppppppppppppp     pppppppppppppppppppppppppppppppppppppppppppppp
  ppppppppppppppppppppppppppp    pppppppppppppppppppppppppppppppppppppppppppppppp
    pppppppppppppppppppppppp  pppppppppppppppppppppppppppppppppppppppppppppppppp
     ppppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppppppp
      pppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppppp
       ppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppppp
                              pppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppp  pppppppp
                              ppppppppppppppppppppp    ppppppp
                                 ppppppppppppppppppp  ppppp
                                    pppppppppppppppppppp
"""


import sys
from functools import lru_cache, cmp_to_key
from collections import defaultdict as dd, deque, Counter as C
from bisect import bisect_left as bl, bisect_right as br, bisect
from heapq import heapify, heappop, heappush
from math import ceil, log, floor, sqrt
mod = pow(10, 9) + 7
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(var, end="\n"): sys.stdout.write(str(var)+end)
def outa(*var, end="\n"): sys.stdout.write(' '.join(map(str, var)) + end)
def L(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]


MAX = 1000001
factor = [0] * (MAX + 1)


def generatePrimeFactors():
    factor[1] = 1
    for i in range(2, MAX):
        factor[i] = i
    for i in range(4, MAX, 2):
        factor[i] = 2
    i = 3
    while i * i < MAX:
        if factor[i] == i:
            j = i * i
            while j < MAX:
                if factor[j] == j:
                    factor[j] = i
                j += i
        i += 1


def calculateNoOFactors(n):
    if n == 1:
        return 1
    ans = 1
    dup = factor[n]
    c = 1
    j = int(n / factor[n])
    while j > 1:
        if factor[j] == dup:
            c += 1
        else:
            dup = factor[j]
            ans = ans * (c + 1)
            c = 1
        j //= factor[j]
    ans = ans * (c + 1)
    return ans


sq = set()
i = 1
while True:
    sq.add(i * i)
    if i * i > 10 ** 6:
        break
    i += 1
number = int(data())
generatePrimeFactors()
answer = 0
for i in range(1, number):
    fact = calculateNoOFactors(i)
    answer += fact
out(answer)

Submission status: Accepted

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

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

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


def solve(*args: str) -> str:
    n = int(args[0])
    ret = 0
    for a in range(1, n):
        for b in range(a, n):
            if n <= a*b:
                break
            else:
                ret += 1 if a == b else 2

    return str(ret)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

Solution code:
import sys
N=int(sys.stdin.readline().strip())
ans=0
for i in range(1,N):
    if N%i==0:
        max_sho=N/i-1
    else:
        max_sho=N/i
    ans+=max_sho
print ans

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
N = int(input())
ans = 0

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

print(ans)

Submission status: Accepted

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

# 標準入力を取得
N = int(input())

# 求解処理
ans = 0
for a in range(1, N):
    ans += math.ceil(N / a) - 1

# 結果出力
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = 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

p = num_divisors_table(N)

print(sum(p[:N]))

Submission status: Accepted

Solution code:
import math
def main():

    N = int(input())
    ans = 0
    for i in range(1, N):
        j = N // i
        if i * j == N:
            j -=1
        ans += max(j, 0)
    return ans

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

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
# import math
# n_max = int(math.sqrt(N))+1
for a in range(1,N+1):
    for b in range(1,N+1):
        if N-a*b>=1:
            ans+=1
        else:
            break
print(ans)

Submission status: Accepted

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

for i in range(1, 1001):
  for j in range(i, 1000001):
    m = n - i * j
    if m > 0:
      if i == j:
        count += 1
      else:
        count += 2
    if m <= 0:
      break
print(count)

Submission status: Accepted

Solution code:
N = int(input())

iMax = N - 1

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

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin,stdout
def fn(div):
    cnt=0
    mul=1
    while (n-(mul*div))>0:
        cnt+=1
        mul+=1
    return cnt
n=int(stdin.readline());ans=0
# a=list(map(int,stdin.readline().split()))
for x in range(1,n):
    ans+=fn(x)
print(ans)

Submission status: Accepted

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

N = int(input())

ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

N = int(input())

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

print(count)

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:
            ans += 1
        else:
            break
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:
n = int(input())
ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
import itertools
import functools
import math
from collections import Counter
from itertools import combinations
import re

N=int(input())

ans = 0

for i in range(1,N):
    ans = ans + ( (N-1) // 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:
from sys import stdin, setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)

INF = int(1e10)
MOD = int(1e9 + 7)

def naive(N):
    NN = int(N ** 0.5 + 1) + 1
    count = 0

    for a in range(1, N):
        for b in range(1, N // a + 1):
            if N - a * b > 0:
                count += 1
    return count


def main():
    from builtins import int, map
    N = int(input())
    print(naive(N))

        

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
a_limit = math.ceil(math.sqrt(N))
ans = 0
for a in range(1,a_limit+1):
    b_limit = N//a
    for b in range(a,b_limit+1):
        c = N - a*b
        if c != 0:
            if a == b:
                ans += 1
            else:
                ans += 2
    
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
import sys
mod=10**9+7 ; inf=float("inf")
from math import sqrt, ceil
from collections import deque, Counter, defaultdict #すべてのkeyが用意されてる defaultdict(int)で初期化
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from decimal import ROUND_HALF_UP,Decimal  #変換後の末尾桁を0や0.01で指定
  #Decimal((str(0.5)).quantize(Decimal('0'), rounding=ROUND_HALF_UP))
from functools import lru_cache
from bisect import bisect_left as bileft, bisect_right as biright
from fractions import Fraction as frac  #frac(a,b)で正確なa/b
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#ソート、"a"+"b"、再帰ならPython3の方がいい
#######ここから天ぷら########


def Dlist(BIG):
    D=[1]*(BIG+1)
    for p in range(2,BIG+1):
        if D[p]!=1:
            continue
        for i in range(p,BIG+1,p):
            if D[i]==1:
                D[i]=p
    return D
# Dlist(10) -> [1, 1, 2, 3, 2, 5, 2, 7, 2, 3, 2]

def BUNKAI(num,D):
    now=num ; ans=[]
    while now>1:
        ans.append(D[now])
        now//= D[now]
    # return ans
    return Counter(ans)
# print(BUNKAI(3012,Dlist(3012))) -> Counter({2: 2, 3: 1, 251: 1})

def SOINSU(num,D): #素因数だけ列挙(setしただけ)
    now=num ; ans=set()
    while now>1:
        ans.add(D[now])
        now//=D[now]
    return ans
# print(SOINSU(3012,Dlist(3012)))　-> {2, 3, 251}
D=Dlist(n)
ans=0
for i  in range(1,n):
    now=1
    l=BUNKAI(i,D)
    for j in l.values():
        now*=j+1
    ans+=now
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

# A <= B
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 a in range(1, N):
    for b in range(1, N//a + 1):
        if a * b < N:
            cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import sqrt
def readinput():
    n=int(input())
    return n

def main(n):
    m=int(sqrt(n))+1
    count=0
    for a in range(1,m+1):
        if a*a < n:
            count+=1
        else:
            break
    
    for a in range(1,m+1):
        for b in range(a+1,n+1):
            if a*b < n:
                count+=2
            else:
                break
    return count

if __name__=='__main__':
    n=readinput()
    ans=main(n)
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())

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

print(count)

Submission status: Accepted

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

for B in range(1,N):
    for A in range(1,N):
        if A*B >= N:
            break
        Ans += 1

print(Ans)

Submission status: Accepted

Solution code:
N = int(input())

count = 0
for i in range(1, N+1):
    if i * i > N:
        break
    for j in range(i, N+1):
        if N > i * j:
            if i == j:
                count += 1
            else:
                count += 2
        else:
            break
print(count)

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:
def main():

    N = int(input())
    ans = 0

    for A in range(1, 1000000):
        for B in range(1, 1000000):
            if A * B < N:
                #print(A, B, A*B)
                ans = ans + 1
            else:
                break
        if A >= N:
            break

    print(ans)

    return

main()

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:
N = int(input())
memo = [0]*(N+1)
for i in range(1,N+1):
    for j in range(i,N+1,i):
        memo[j] += 1

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

Submission status: Accepted

Solution code:
n=int(input())

#a*b<nの個数を足す→aにかけてn未満になるものの個数
cnt=0
for a in range(1,n+1):
  cnt+=int((n-1)/a)
  
print(cnt)

Submission status: Accepted

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

import sys

DEBUG = False


def read(t):
    return t(sys.stdin.readline().rstrip())


def read_list(t, sep=" "):
    return [t(s) for s in sys.stdin.readline().rstrip().split(sep)]


def dprint(*args, **kwargs):
    if DEBUG:
        print(*args, **kwargs)
    return


def main():
    n = read(int)

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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:
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):
  count += (n-1)//a
print(count)

Submission status: Accepted

Solution code:
n = int(input())
l = [0] * n
for i in range(1, n+1):
    for j in range(i, n+1, i):
        l[j-1] += 1
ans = 0
for c in range(1, n):
    ans += l[n-c-1]
print(ans)

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 += b-1
  else:
    cnt += b

print(cnt)

Submission status: Accepted

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

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

print(num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys;input = sys.stdin.readline
inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()]

n = inp()
ct = n-1
for i in range(2,n):
        ct += (n-1)//i
print(ct)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

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

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



if __name__ == '__main__':
    main()

Submission status: Accepted

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

    return ans

print(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:
import math
N = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque
import sys, copy, itertools,heapq
input = sys.stdin.readline

n = int(input())
count = 0

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

print(count)