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:
from collections import defaultdict
N = int(input())

fact = [1] * (10**3+1)
for i in range(2, 10**3+1):
    fact[i] = i * fact[i-1]

def nCr(n, r):
    return fact[n] // (fact[r] * fact[n-r])

class Sieve:
    """
    N以下の素数を列挙するエラトステネスのふるいです。
    O(NloglogN)でできます。

    Attributes
    sieveList : その数の素因数のうち最小のものの配列
    primes : N以下の素数のリスト
    """
    def __init__(self, N):
        self.sieveList = [-1 for _ in range(N+1)]
        self.sieveList[1] = 1
        self.primes = []

        for i in range(2, N+1):
            #すでに何らかの数で割られていたらcontinue
            if self.sieveList[i] != -1:
                continue
            self.primes.append(i)
            for j in range(i, N+1, i):
                if self.sieveList[j] != -1:
                    continue
                self.sieveList[j] = i

    def getPrimes(self):
        return self.primes

    def getSieveList(self):
        return self.sieveList

class FastFactorization(Sieve):
    """
    高速素因数分解です。
    与えられたL個の数がすべてA以下の時、
    エラトステネスでO(AloglogA)＋素因数分解でO(LlogA) = O(AloglogA+LlogA)でできます。
    「試し割り」をする必要が無いのではやいです。
    """

    def __init__(self, N):
        """
        前処理でスーパークラスのエラトステネスを使ってN以下の素因数を列挙します。
        """
        super().__init__(N)
        self.N = N
        self.sieveList = self.getSieveList()
        self.factorSet = None
        self.factorDict = None

    def factorize(self, x):
        if x > self.N:
            raise ValueError("与えられた数がエラトステネスのリストの上限を超えている")
        factorDict = defaultdict(int)
        while x > 1:
            divisor = self.sieveList[x]
            x //= divisor
            # factors += 1
            factorDict[divisor] += 1

        self.factorDict = factorDict

    def getFactorSet(self):
        return self.factorSet

    def getFactorDict(self):
        return self.factorDict


ff = FastFactorization(N+1)
ans = 0
for c in range(1, N):
    num = N - c
    # print(num, ff.factorize(num))
    tmp = 1
    if num == 1:
        ans += 1
    else:
        ff.factorize(num)
        factors = ff.getFactorDict()
        for v in factors.values():
            tmp *= nCr(2 + v - 1, v)
        ans += tmp

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
L=[0]*N

for i in range (1,N):
  L[i]=(N-1)//i
  #print(i)

#print(L)
ans = sum(L)
print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from math import ceil
from numba import njit
def main():
    n = int(input())
    @njit
    def s(n):
        res = 0
        for i1 in range(1, n + 1):
            for i2 in range(1, n + 1):
                if i1 * i2 >= n:
                    break
                else:
                    res += 1
        return res
    r = s(n)
    print(r)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#coding: UTF-8

N = int(input())

cnt = 0
#A.Bは対称
for i in range(1,N): #A
  for j in range(i,N): #B
    if i*j<N:
      #i=jなら+1
      if i==j:
        cnt += 1
      else:
        cnt += 2
    else:
      #それ以上jあげても無理
      break
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
def resolve():
    input_num = int(input())
    div_list = [input_num//i if input_num%i!=0 else input_num//i-1 for i in range(1, input_num+1) ]
    print(sum(div_list))

resolve()

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

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


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()

    ret = 0
    for a in range(1, N):
        b = N // a
        if N - (a * b) <= 0:
            ret += b - 1
        else:
            ret += b
    print(ret)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
import numpy as np
import math  # gcdもあるよ
from collections import deque
from collections import defaultdict
from copy import deepcopy
from itertools import accumulate #リストを与えると累積和を返す
import bisect #二部探索
def input(): return sys.stdin.readline().rstrip()
from functools import lru_cache #メモ化
INF = 10**9 + 7
mod = 10**9 + 7
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int-type.')
    if n < 2:
        raise ValueError('n is more than 2')
    data = [i for i in range(2, n + 1)]
    for d in data:
        data = [x for x in data if (x == d or x % d != 0)]
    return data

def main():
    n = int(input())
    # 1～n-1 までcを回す
    x = math.floor(math.sqrt(n-1))
    ans = 0
    a = 1
    while(a <= x):
        ans += (n-1) // a
        a += 1
    ans -= (x - 1) * x / 2
    ans *= 2
    ans -= x
    print(int(ans))
    return 0

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import itertools
import collections

N = int(input())

def prime_factor_table(n):
    table = [0] * (n + 1)
    
    for i in xrange(2, n + 1):
        if table[i] == 0:
            for j in xrange(i + i, n + 1, i):
                table[j] = i
    
    return table

def prime_factor(n, prime_factor_table):
    prime_count = collections.Counter()
    
    while prime_factor_table[n] != 0:
        prime_count[prime_factor_table[n]] += 1
        n /= prime_factor_table[n]
    prime_count[n] += 1
    
    return prime_count

t = prime_factor_table(N)

ans = 0
for c in range(1,N-1):
  ab = N-c
  f = prime_factor(ab,t)
  v = f.values()
  tmp = 1
  for i in range(len(f)):
    tmp *= v[i]+1
  ans += tmp
  
print(ans+1)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
import sys

#inp = list(map(int, input().split())
#inp = list(input())


n = int(input())
count = 0
count2 = 0

#m = n - 1
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())
cnt = 0
flag = 0
a = int(n ** 0.5)
if a == n ** 0.5:
    flag = 1
for i in range(1,a + 1):
    for j in range(i, n):
        if i * j < n:
            cnt += 1
        else:
            break
if flag == 1:
    num = (cnt - a + 1) * 2 + a - 1
else:
    num = (cnt - a) * 2 + a
print(num)

Submission status: Accepted

Solution code:
n = int(input())
divisors_list = [0] * (n + 1)

for i in range(1, n + 1):
    for j in range(i, n + 1, i):
        divisors_list[j] += 1

ans = sum(divisors_list) - divisors_list[-1]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:

import math
n = int(input())
n_rev = int(math.sqrt(n))

cnt = 0
for i in range(1, n_rev + 1):
    if ((n - 1) // i - i) * 2 + 1 >= 0:
        cnt += ((n - 1) // i - i) * 2 + 1

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

table = [0] * (N+5)

for i in range(1, N+3):
    for j in range(i, N+2, i):
        table[j] += 1
ans = 0
for i in range(N):
    ans += table[i]

print(ans)

Submission status: Accepted

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

while A*A < N:
  if N%A == 0:
    ans += N//A-A
  else:
    ans += N//A-A+1
  A += 1

ans = 2*ans - A + 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

a = 1
ans = 0

while a< N:
    b = a+1
    while a*b < N:
        ans += 2
        b += 1
    a+=1
a=1
while a**2 < N:
    ans+=1
    a += 1
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())
g=0
for i in range(n-1):
  g=g+int((n-1)/(i+1))
print(g)

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
n = int(input())
ans = 0
for i in range(1, n-1):
    a = i
    if n%a==0:
        ans+=n//a-1
    else:
        ans+=n//a

print(ans+1)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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


def main():
    N = int( sys.stdin.readline() )

    cnt = 0

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
table = [0]*(10**6)

for i in range(1,10**6):
  for j in range(i,10**6,i):
    table[j] += 1

N = int(input())
table_ans = table[:N]
print(sum(table_ans))

Submission status: Accepted

Solution code:
import sys,math,collections
from collections import defaultdict

#from itertools import permutations,combinations
    
def file():
    sys.stdin = open('input.py', 'r')
    sys.stdout = open('output.py', 'w') 
def get_array():
    l=list(map(int, input().split()))
    return l
def get_ints():   
    return map(int, input().split())
    #return a,b
def get_3_ints():   
    a,b,c=map(int, input().split())
    return a,b,c    
def sod(n):
    n,c=str(n),0
    for i in n: 
        c+=int(i)
    return c    
def isPrime(n):
    if (n <= 1):
        return False
    if (n <= 3):
        return True
    if (n % 2 == 0 or n % 3 == 0):
        return False
    i = 5
    while(i * i <= n):
        if (n % i == 0 or n % (i + 2) == 0):
            return False
        i = i + 6
  
    return True
def getFloor(A, x):

    (left, right) = (0, len(A) - 1)

    floor = -1
    while left <= right:
        mid = (left + right) // 2
        if A[mid] == x:
            return A[mid]
        elif x < A[mid]:
            right = mid - 1
        else:
            floor = A[mid]
            left = mid + 1
            
    return floor
def chk(aa,bb):
	f=0
	for i in aa:
		for j in bb:
			if(j[0]>=i[0] and j[1]<=i[1]):
				f+=1
			elif(j[0]<=i[0] and j[1]>=i[1]):	
				f+=1
			elif(i[0]==j[1] or i[1]==j[0]):
				f+=1
			else:
				continue
	return f			

#file()
def main():
	n=int(input())
	c=0
	for i in range(1,n+1):
		t=n/i
		#print(t,int(t))
		if(t==int(t)):
			c+=(int(t)-1)
		else:
			c+=int(t)
	print(c)			

		




				





		


	





        
            
        























    

    
    

        











        
        

        























































                

            







            
            
































        








if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
c=int(input())
total=c-1
for i in range(2,c):
    total+=(c-1)//i
print(total)

Submission status: Accepted

Solution code:
a = int(input())

count = 0
flag = False

for c in range(1, a):
    for d in range(1, a):
        if c * d >= a:
            break
        else:
            count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

    return count

"""
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]
"""

if __name__ == '__main__':
    print(main())
    #print(make_divisors(100))

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())
count = 0
for A in range(1,int((N)**0.5)+2):
  for B in range(A,int((N)/A)+2):
    if A*B < N:
      count += 1
      if A != B:
        count += 1
print(count)

Submission status: Accepted

Solution code:
n = int(input())  # nは入力回数

a = n-1 
count = 0 
d = 0

for l in range(n):
  d = int(a/(l+1))
  
  if d >= (l+1):
    count += (d-l-1)*2+1
  else:
    break

print(count)

Submission status: Accepted

Solution code:

n=int(input())

icnt=0
for ai in range(1,n):
    icnt+=(n-1)//ai
    
print(icnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def i_input(): return int(input())


n = i_input()
cnt = 0

for i in range(1, n):
    q = n // i
    r = n % i
    if q != 0 and r != 0:
        cnt += q
    elif q != 0 and r == 0:
        cnt += q - 1

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

c=0
for i in range(n):
    a = i+1
    for j in range(n-a+1):
        d = a*(j+1+i)
        if(d >= n):
            tmp = j*2-1
            if(tmp < 0):
                print(c)
                exit()
            c += j*2-1
            break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

count = 1#よくわからない、1とその数のぶんか？
for i in range(1, N-1):
  count += (N-1)//i
print(count)

Submission status: Accepted

Solution code:
N = int(input())
rt = int(N ** 0.5)

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
def main():
    n = int(input())

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

    print(ans)


main()

Submission status: Accepted

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

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
MOD2 = 998244353
INF = float('inf')
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: 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


def main():
    N = NI()
    print(sum(num_divisors_table(N-1)))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

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

print(count)

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

table = num_divisors_table(1000000)

ans = 0

for c in range(1,N):
    ans += table[N-c]

print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())
#sqrtN = math.floor(math.sqrt(N))
#count = 1
#for i in range(sqrtN):
#   count += 2 *((N-1) // (i+2))
count = 0
for i in range(N):
  count += (N-1) // (i+1)
  
print(count)

Submission status: Accepted

Solution code:
N=int(input())

cnt=0

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

print(cnt)

Submission status: Accepted

Solution code:
N=int(input())
def test(n):
    buf=0
    for i in range(1,n):
        if i**2 > n:
            break
        if i**2 == n:
            buf+=1
            break
        if n%i==0:
            buf+=2
    return buf

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from sys import exit
from math import gcd, factorial, ceil, floor, sqrt
from bisect import bisect_left, bisect_right
from copy import deepcopy
from heapq import heapify, heappop, heappush
from itertools import permutations, combinations, product, accumulate
from collections import defaultdict, deque, Counter
sys.setrecursionlimit(10**7)

ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(map(int, input().split()))

N = int(input())

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

Submission status: Accepted

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

count = 0

for i in range(1 ,n) :
    count += math.floor((n - 1) / i)

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

count = 0

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

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

print(cnt)

Submission status: Accepted

Solution code:
from math import *
from collections import *
from itertools import *
from functools import *
from bisect import *
from heapq import *
from operator import *
from sys import *
setrecursionlimit(100000000)


n=int(input())
if n==2:
    print(1)
    exit()
ans=0
for x in range(1,n):
    if (n-x*x)>0:
        ans+=1
        ans+=(((n-1)-x*x)//x)*2
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
# 1以上n未満の数について、それぞれ約数の個数を数える
i_Divs = [0] * (N+1)
base = 1
Max = int(N**0.5)+1
while base < Max:
    now = base
    while now <= N:
        if now//base >= Max:
            i_Divs[now] += 2
        else:
            #print(now,base,1)
            i_Divs[now] += 1
        now += base
    base += 1
#print(i_Divs)

ans = 0
for c in range(1,N):
    p = N-c
    ans += i_Divs[p]
print(ans)

Submission status: Accepted

Solution code:
import math
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
print(sum(num_divisors_table(N-1)))

Submission status: Accepted

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

import collections

N = int(input())

ans = 1
for n in range(2,N):
    a = prime_factorize(n)
    c = collections.Counter(a)
    ans_ = 1
    for i in c.values():
        ans_ *= (i+1)
    ans += ans_
print(ans)

Submission status: Accepted

Solution code:
import math


def main():
    n = int(input())
    sum = (n-1)*2-1
    for i in range(2, n):
        sho = n // i
        amari = n % i
        if i**2 >= n:
            break
        if amari == 0:
            sho -= 1
        sum += (sho - i+1) * 2 - 1
    print(sum)


if __name__ == "__main__":
    main()

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
def resolve():
    n = int(input())
    print(sum(num_divisors_table((n)-1)))
resolve()

Submission status: Accepted

Solution code:
nn = int(input())
count = 0
tt = nn
tt = tt-1
while tt > 0:
    count = count + int((nn-1)/tt)
    tt = tt - 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
counter = 0
for i in range(1,N):
    if (i**0.5).is_integer():
        #print(i,"here",N-1//i)
        counter += (N-1)//i
    else:
        #print(i,(N-1)//i-1)
        counter += (N-1)//i
print(counter)

Submission status: Accepted

Solution code:
n = int(input())

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

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
  

N=int(input())
#################################
ans = 0
#for i in range(1,N):
#  ans += num_divisors_table(i)

#print(ans)


a = num_divisors_table(N)
#print(a)
print(sum(a[1:-1]))

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 math
N = int(input())
ans =0
for a in range(1,N):
  if N%a == 0:
    ans += math.floor(N / a) -1
  else:
    ans += math.floor(N / a)
print(ans)

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:
n = int(input())
cnt = 0

for i in range(1,n):
    b = n//i
    c = n%i
    if c:
        cnt += b
    else:
        cnt += b-1
    

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

def cal2(a):
    if N % a == 0:
        return N // a - 1
    else:
        return N // a
cnt = 0

for a in range(1,N + 1):
    cnt += cal2(a)

print(cnt)

Submission status: Accepted

Solution code:
# ABC179-C AxB+C
N = int(input())
cnt = 0
for i in range(N):
    ii = i + 1
    for j in range(N+1):
        jj = j + 1
        if N-(ii*jj) > 0:
            cnt += 1
        else:
            break
print(cnt)

Submission status: Accepted

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

    duplicate = 0
    count = 0
    for i in range(1, N):
        count += (N - 1) // i
        if i * i < N:
            duplicate += 1

    print(count)


main()

Submission status: Accepted

Solution code:
# coding: utf-8

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
count = 0
for i in range(1,N):
    q,mod = divmod(N,i)
    #ピッタリは外す
    if mod == 0:
        q -= 1
    if q-i >= 0:
        count += (q-i)*2 + 1
    else:
        break
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(cnt)

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:
import numpy as np
num=int(input())
count=0
for a in range(num-1):
  tmp=int(num/(a+1))
  if num%(a+1)==0:
    count+=tmp-1
  else:
    count+=tmp
print(count)

Submission status: Accepted

Solution code:
n = int(input())
count = ((n-1) * 2) -1

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

Submission status: Accepted

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

for A in range(1, N):
  for B in range(1, N):
    if N-A*B < 1:
      break
    count += 1

print(count)

Submission status: Accepted

Solution code:
def resolve():
    import sys

    input = sys.stdin.readline

    n = int(input().rstrip())

    ans = 0


    for a in range(1, n):
        # aがiの田沖の最大のB
        max_b = (n - 1) // a

        if max_b < a:
            ans += (max_b) * 2
        else:
            ans += (a - 1) * 2 + 1


    print(ans)

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
N = int(input())

count = 0

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

print(count)

Submission status: Accepted

Solution code:
#
import sys
import math
import itertools

n = int(input())

answer =0

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

print(answer)

Submission status: Accepted

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

for a in range(1,n+1):
  for b in range(1,n//a+1):
    if a*b<n:
      cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
import math

#input
n = int(input())

def main():
    cnt = 0
    for a in range(1, n):
        if a < n/a:
            m = int(n/a)
            for b in range(a,m+2):
                if a * b < n :
                    if a == b :
                        cnt += 1
                    else :
                        cnt += 2
    print(cnt)


if __name__ == '__main__':
    main()