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())
ans = 0

for a in range(1,10**6):
    for b in range(1,10**6):
        if a*b < n:
            ans += 1
        else:
            break
            
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
cnt = [0] * (n+1)
for i in range(1, n):
    for j in range(i, n, i):
        cnt[j] += 1

ans = sum(cnt[:-1])
print(ans)

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
ans = np.zeros(n, dtype=np.int64)
for a in range(1,n):
    ans[a::a] += 1
print(ans.sum())

Submission status: Accepted

Solution code:
n = int(input())

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

print(sum)

Submission status: Accepted

Solution code:
N=int(input())
ans=0
for a in range(1,pow(10,3)+1):
    for b in range(a,pow(10,6)+1):
        if a*b>=N:
            break
        if N-a*b>0:
            if a==b:
                ans+=1
            else:
                ans+=2
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
counter = 0
for a in range(1, N):
    q, r = divmod(N, a)
    counter += q if r != 0 else q - 1
    a += 1
print(counter)

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    ans = n-1
    for i in range(2, n):
        a = n // i
        if n % i == 0:
            a -= 1
        ans += a
    print(ans)
if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
#C
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 -*-
# map(int, input().split())
N = int(input())

total = 0
for a in range(1,N):
    total += max(0,int((N-1)/a))

print(total)

Submission status: Accepted

Solution code:
def calc(N):
    ans = 0
    for i in range(N - 1):
        ans += (N - 1) // (i + 1)
    return ans


N = int(input())
print(calc(N))

Submission status: Accepted

Solution code:
N = int(input())

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

print(res)

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
#import string
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
#import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np
#import sympy

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    n = int(stdin.readline().rstrip())
    #A, B, C = map(int, stdin.readline().rstrip().split())
    #l = list(map(int, stdin.readline().rstrip().split())
    ans = 0
    for a in range(1,n):
        z = n//a
        if n%a == 0:
            ans += z-1
        else:
            ans += z
    print(ans)





if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

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


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


if __name__ == '__main__':
    main(sys.stdin.readline, print)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
check = [0]*(N+1)
for i in range(1,N+1):
    for k in range(i,N+1,i):
        check[k] += 1
for c in range(1,N):
    ans += check[c]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

num = [1]*(N)
for i in range(2, N):
    for j in range(i, N, i):
        num[j] += 1
print(sum(num) - 1)

Submission status: Accepted

Solution code:
from collections import defaultdict
from collections import deque
from collections import Counter
import math
import itertools

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n = readInt()

ans = 0
for a in range(1,10**6):
	if a>n:
		break
	for b in range(1,10**6):
		c = n-a*b
		#print(a,b,c)
		if c>0:
			ans+=1
		else:
			break

print(ans)

Submission status: Accepted

Solution code:
N=int(input())

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

li=num_divisors_table(n)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

x=[-1]*(n+1) #2以上の自然数に対して最小の素因数を表す
x[0]=0
x[1]=1
i=2
prime=[]
while i<=n:
    if x[i]==-1:
        x[i]=i
        prime.append(i)
    for j in prime:
        if i*j>n or j>x[i]:break
        x[j*i]=j
    i+=1

def f(k):
    z=[]
    if k==1:
        return 1
    p=x[k]
    c=1
    while k>1:
        if p!=x[k//p]:
            z.append(c)
            c=1
        else:
            c+=1

        k=k//p
        p=x[k]

    ans=1
    for i in range(len(z)):
        ans=ans*(z[i]+1)
    return ans

s=0
for i in range(1,n):
    s+=f(i)
print(s)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque, Counter, defaultdict
from itertools import chain, combinations
import json
# import numpy as np
import bisect
import sys
import math
import bisect
from functools import lru_cache
import itertools

sys.setrecursionlimit(10 ** 8)

M = 10 ** 9 + 7
INF = 10 ** 17


def main():
    N = int(input())
    # D = [
    #     [int(a) for a in input().split()]
    #     for _ in range(N)
    # ]

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


if __name__ == "__main__":
    main()

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

Submission status: Accepted

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

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

nn = N - 1

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
for i in range(1,10**6 + 1):
    for j in range(1,10**6 + 1):
        if i*j < n:
            ans += 1
        else:
            break
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:
N = int(input())
C = N-1
ans = 0
i = 1
while C>=i:
    ans += C//i
    i += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: map(int, read().split())


class Factorize(object):

    def __init__(self, maxnum):
        self.primes = self.__smallest_prime_factors(maxnum)

    # 素因数分解 O(logN)
    def factorize(self, n):
        fct = defaultdict(lambda: 0)
        while n != 1:
            fct[self.primes[n]] += 1
            n //= self.primes[n]

        ans = 1
        for k, v in fct.items():
            ans *= (v + 1)

        return ans

    # n以下の最小の素因数を列挙する O(NlogN)
    def __smallest_prime_factors(self, n):

        prime = list(range(n + 1))

        for i in range(2, int(n**0.5) + 1):
            if prime[i] != i:
                continue
            for j in range(i * 2, n + 1, i):
                prime[j] = min(prime[j], i)
        return prime


def main():

    N = in_n()

    fct = Factorize(N + 10)

    ans = 0
    for i in range(1, N):
        ans += fct.factorize(i)

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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:
import sys
import math
import collections
import bisect
import itertools
import decimal
import copy
import heapq

# import numpy as np

# sys.setrecursionlimit(10 ** 6)
INF = 10 ** 20
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))
flush = lambda: sys.stdout.flush()


# ===CODE===
def main():
    n = ni()

    ans = 0

    for i in range(1, n + 1):
        b = n // i
        tmp = 1 if i * b == n else 0

        ans += n // i - tmp
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math
from collections import deque
import itertools
import heapq
#import bisect
from fractions import Fraction
import copy
from functools import lru_cache
from collections import defaultdict
import pprint

#oo=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
# ko=list("abcdefghijklmnopqrstuvwxyz")

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)

def soinsubunkai(n):
    a = []
    i = 1
    while i*i <= n:
        if n % i == 0 and i!=1:
            a.append(i)
            n=n//i

        if n% i !=0 or i==1:
            i += 1
    nokori=[n]
    return a + nokori

def soinsubunkai_e(n,m): #高速素因数分解 m[n]=nを割ることの出来る最小の素数
    a = set()
    i = 1
    while n>1:
        a.add(m[n])
        n=n//m[n]
    nokori=n
    a.add(nokori)
    return a

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 lower_divisors + upper_divisors[::-1]


def era(n): #b[n]=nを割ることの出来る最小の素数　の配列を生成　エラトステネスの篩
    b=[i for i in range(n+1)]
    for i in range(2,int(math.sqrt(n)+10)):
        j=1
        temp=i*j
        while temp<=n:
            b[temp]=min(i,b[temp])
            temp+=i
    return b


def main():
    #l,r,d=map(int,input().split())
    n=int(input())
    count=0
    for i in range(1,n):
        count+=(n-1)//i
    print(count)





if __name__ == "__main__":

    main()

Submission status: Accepted

Solution code:
import collections
N = int(input())
cnt = collections.defaultdict(int)
for lower in range(1, N):
    for upper in range(lower, N):
        if lower * upper > N:
            break
        cnt[lower * upper] += 1 if lower == upper else 2
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 i in range(1, n):
	x = n//i
	if n%i == 0:
		x -= 1
	ans += x
print(ans)

Submission status: Accepted

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

for i in range(1,N+1):
    for j in range(i,N+1):
        if i * j < N:
            if i == j:
                counter += 1
            else:
                counter += 2
        else:
            break

print(counter)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import sys

def solve():
      input = sys.stdin.readline
      N = int(input())
      count = N - 1
      for i in range(2, N):
            b = 1
            while i * b < N:
                  count += 1
                  b += 1
      print(count)

      return 0

if __name__ == "__main__":
      solve()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1
from collections import defaultdict

N=int(input())

M=10**6

D=[-1]*(M+1)
D[0]=D[1]=1
for i in range(2,int(M**0.5)+1):
    if D[i]!=-1:
        continue
    for j in range(i*2,M+1,i):
        if D[j]==-1:
            D[j]=i

ans=0
for i in range(1,N):
    ab=N-i
    d=defaultdict(int)
    while D[ab]>1:
        d[D[ab]]+=1
        ab//=D[ab]
    if ab>1:
        d[ab]+=1
    tmp=1
    for v in d.values():
        tmp*=(v+1)
    ans+=tmp
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:
N = int(input())
divisors = [1] * N
divisors[0] = 0
for i in range(2,N):
    for j in range(i,N,i):
        divisors[j] += 1
print(sum(divisors))

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-1) // i

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:
def main():
    n = int(input())
    ans = 0
    for a in range(1, 10 ** 3 + 1):
        mb = (n - 1) // a
        if mb < a:
            continue
        ans += 2 * (mb - a) + 1
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    r = 0
    for a in range(1, N):
        b = N // a
        if b < 1:
            continue
        if a * b == N:
            b -= 1
        r += b
    return r

print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#import math
#import itertools
#import numpy as np
#from collections import deque
# sys.setrecursionlimit(10 ** 6)
#MOD = 10 ** 9 + 7
#INF = 10 ** 9
#PI = 3.14159265358979323846

INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    n=INT()
    ans=0
    for i in range(1,n):
        ans+=(n-1)//i
    print(ans)
if __name__=='__main__':
    do()

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

n = int(input())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

cnt = 0
from collections import Counter
for i in range(1, n):
    a = Counter(prime_factorize(i))
    add = 1
    for j in a.values():
        add *= j + 1
    cnt += add
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a=1
m = n - 1
count = 0
while a < n:
  count = count + (m // a)
  a = a + 1
print(count)

Submission status: Accepted

Solution code:
# # Make IO faster
# import sys
# input = sys.stdin.readline

# # get single (or) multiple str
# X = input()

# # get single int
# N = int(input())
# # get multiple int (e.g., 2)
# X, Y = map(int, input().split())
# # get multiple int (e.g., 2) for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();

# 全部入り
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**7)
import bisect
import heapq
import itertools
import math
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from math import gcd
from operator import add, itemgetter, mul, xor
def cmb(n,r,mod):
  bunshi=1
  bunbo=1
  for i in range(r):
    bunbo = bunbo*(i+1)%mod
    bunshi = bunshi*(n-i)%mod
  return (bunshi*pow(bunbo,mod-2,mod))%mod
mod = 10**9+7
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

#bisect.bisect_left(list,key)はlistのなかでkey未満の数字がいくつあるかを返す
#つまりlist[i] < x となる i の個数
#bisect.bisect_right(list, key)はlistのなかでkey以下の数字がいくつあるかを返す
#つまりlist[i] <= x となる i の個数
#これを応用することで
#len(list) - bisect.bisect_left(list,key)はlistのなかでkey以上の数字がいくつあるかを返す
#len(list) - bisect.bisect_right(list,key)はlistのなかでkeyより大きい数字がいくつあるかを返す
#これらを使うときはあらかじめlistをソートしておくこと！

n = I()
ans = 0
for i in range(1,10**6+5):
    q = n//i
    r = n%i
    if r == 0:
        ans += q-1
    else:
        ans += q
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(1, N):
    if i >= N:
        break

    for j in range(1, N):
        tmp = i * j

        if tmp >= N:
            break

        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

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

def main():
    N = int(input())
    dp = [1] * N
    for p in range(2, N + 1):
        num = p
        while num < N:
            dp[num] += 1
            num += p
    print(sum(dp[1:]))



if __name__ == "__main__":
    main()

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

cnt = 0
for a in range(1, N):
    # print(f'{a=}, {N // a}')
    if N % a == 0:
        cnt += N // a - 1
    else:
        cnt += N // a

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())

ans = 0
for a in range(1, N+1):
    cnt = 1
    while a*cnt<N:
        ans += 1
        cnt += 1

print(ans)

Submission status: Accepted

Solution code:
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest
#import itertools
#import heapq
#from collections import deque
#d = deque()

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    #n,m,k=map(int, readline().rstrip().split())
    #arr=list(map(int, readline().rstrip().split()))
    n=int(readline())
    ans=0
    for a in range(1,n):
        #bn=(n-1)//a
        ans+=(n-1)//a
    print(ans)
    #ss=readline().rstrip()
    #yn(1)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------