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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

n = int(input())

ans = 0

a = 1

while a <= n:
 
    if a == 1 :
        ans =  ans + (n - 1)
    else :
        if n % a == 0 :
            ans = ans + ( (n // a) - 1)
        else :
            ans = ans + ( (n // a) )

    a += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
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 A in range(1, N):
  N_ = (N - 1) // A
  count += N_

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for a in range(1, N):
  ans += N//a
  if N%a == 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:
def main3():
    N = int(input())
    ans = 0

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

if __name__ == "__main__":
    main3()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline

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








'''
# Wrap solution for more recursion depth
#submit as python3
import collections,sys,threading
sys.setrecursionlimit(10**9)
threading.stack_size(10**8)



threading.Thread(target=solve).start()
'''

Submission status: Accepted

Solution code:
# coding=utf-8
from math import floor, ceil, sqrt, factorial, log, gcd
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heappushpop, heapify
import copy
import sys
INF = float('inf')
mod = 10**9+7
sys.setrecursionlimit(10 ** 6)


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

# 1 2 3
# a, b, c = LI()


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))

# a = I()


def I(): return int(sys.stdin.buffer.readline())

# abc def
# a, b = LS()


def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()

# a = S()


def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')

# 2
# 1
# 2
# [1, 2]


def IR(n): return [I() for i in range(n)]

# 2
# 1 2 3
# 4 5 6
# [[1,2,3], [4,5,6]]


def LIR(n): return [LI() for i in range(n)]

# 2
# abc
# def
# [abc, def]


def SR(n): return [S() for i in range(n)]

# 2
# abc def
# ghi jkl
# [[abc,def], [ghi,jkl]]


def LSR(n): return [LS() for i in range(n)]

# 2
# abcd
# efgh
# [[a,b,c,d], [e,f,g,h]]


def SRL(n): return [list(S()) for i in range(n)]


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

print(int(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 math import factorial

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
from math import sqrt
N = int(input())
# Cが固定されAxBを入れ替えるときは省略したい

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]

ans = 0
""" for C in range(1,N):
    ans += len(make_divisors(N-C)) """

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

def facrapid(N):
	i=2
	ans=dict()
	div_sum=1
	n=N
	while i*i <=N:
		while n%i==0:
			n=n//i
			if i in ans:
				ans[i]+=1
			else:
				ans[i]=1
		i+=1
	if n!=1:
		ans[n]=1
	
	ans_list=list(ans.items())
	for j in ans_list:
		div_sum*=j[1]+1
	
	return(div_sum)



ans_d={10000: 93643, 20000: 201147, 30000: 313875, 40000: 430027, 50000: 548695, 60000: 669362, 70000: 791730, 80000: 915508, 90000: 1040555, 100000: 1166714, 110000: 1293885, 120000: 1421926, 130000: 1550852, 140000: 1680518, 150000: 1810893, 160000: 1941957, 170000: 2073616, 180000: 2205896, 190000: 2338713, 200000: 2472071, 210000: 2605908, 220000: 2740255, 230000: 2875035, 240000: 3010225, 250000: 3145923, 260000: 3281913, 270000: 3418335, 280000: 3555125, 290000: 3692288, 300000: 3829761, 310000: 3967572, 320000: 4105737, 330000: 4244174, 340000: 4382931, 350000: 4522005, 360000: 4661355, 370000: 4800992, 380000: 4940862, 390000: 5081020, 400000: 5221424, 410000: 5362088, 420000: 5502988, 430000: 5644109, 440000: 5785515, 450000: 5927120, 460000: 6068940, 470000: 6210971, 480000: 6353214, 490000: 6495739, 500000: 6638407, 510000: 6781192, 520000: 6924283, 530000: 7067586, 540000: 7210986, 550000: 7354651, 560000: 7498424, 570000: 7642414, 580000: 7786609, 590000: 7930954, 600000: 8075420, 610000: 8220149, 620000: 8364937, 630000: 8509899, 640000: 8655135, 650000: 8800424, 660000: 8945854, 670000: 9091540, 680000: 9237258, 690000: 9383192, 700000: 9529244, 710000: 9675454, 720000: 9821778, 730000: 9968274, 740000: 10114912, 750000: 10261678, 760000: 10408551, 770000: 10555535, 780000: 10702703, 790000: 10849984, 800000: 10997400, 810000: 11144971, 820000: 11292593, 830000: 11440361, 840000: 11588236, 850000: 11736253, 860000: 11884387, 870000: 12032640, 880000: 12181018, 890000: 12329497, 900000: 12478098, 910000: 12626745, 920000: 12775605, 930000: 12924462, 940000: 13073527, 950000: 13222660, 960000: 13371907, 970000: 13521236, 980000: 13670735, 990000: 13820210, 1000000: 13969985}

n=N//10000

if n>0:
	for i in range(n*10000,n*10000+10000):
		ans_d[i+1]=ans_d[i]+facrapid(i)
	print(ans_d[N])
else:
	ans_d[2]=1
	for i in range(3,10000):
		ans_d[i]=ans_d[i-1]+facrapid(i-1)
	print(ans_d[N])



# 2darray [[0] * 4 for i in range(3)]
# import itertools

Submission status: Accepted

Solution code:
from collections import Counter

class Eratosthenes():  # エラトステネスの篩
    def __init__(self, N):  # 素数リスト生成 O(n*log(log n))
        self.fact = [i for i in range(N + 1)]
        for i in range(2, int(N ** 0.5) + 1):
            if self.fact[i] < i:
                continue
            for j in range(i ** 2, N + 1, i):
                self.fact[j] = i
        self.prime = [i for i in range(2, N + 1) if i == self.fact[i]]

    def factor(self, NUM):  # 高速素因数分解 O(log num)
        PRIME = []
        while NUM > 1:
            PRIME.append(self.fact[NUM])
            NUM //= self.fact[NUM]
        return Counter(PRIME)

n = int(input())

era = Eratosthenes(n)
ans = 0
for i in range(1, n):
    tmp = 1
    for num in era.factor(i).values():
        tmp *= num + 1
    ans += tmp
print(ans)

Submission status: Accepted

Solution code:
n = int(input()) - 1

j = 0

ans = 0

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

k = 1

er = 0

while True:
    if k ** 2 > n:
        break
    er += 1
    k += 1

print((ans * 2) + er)

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

Submission status: Accepted

Solution code:
from math import sqrt

# Function to return count of Ordered pairs
# whose product are less than N
def countOrderedPairs(N):
    # Initialize count to 0
    count_pairs = int(0)

    # count total pairs
    p = int(sqrt(N - 1)) + 1
    q = N
    # q = int(sqrt(N)) + 2
    for i in range(1, p, 1):
        for j in range(i, q, 1):
            if i * j > N-1:
                break
            # print(i,j)
            count_pairs += 1
    #print(count_pairs)
    # multiply by 2 to get ordered_pairs
    count_pairs *= 2

    #print(count_pairs)
    # subtract redundant pairs (a, b) where a==b.
    count_pairs -= int(sqrt(N - 1))

    # return answer
    return count_pairs

    # Driver code

N = int(input())
print(countOrderedPairs(N))
# ans=prime_factorize(N)
# print(ans)

Submission status: Accepted

Solution code:
import math

n = int(input())
count = 0
for i0 in range(n):
    i0 += 1
    count += math.floor(n / i0)
    if n - (math.floor(n / i0) * i0) == 0:
        count -= 1
print(count)

Submission status: Accepted

Solution code:
def N():
    return int(input())
def L():
    return list(map(int,input().split()))
def NL(n):
    return [list(map(int,input().split())) for i in range(n)]
mod = pow(10,9)+7
#import numpy
#import sympy
import math
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 divi(n):
    ans = {1}
    for i in range(2,int(n**0.5)+1):
        if n%i == 0:
            ans |= l[i]
            ans |= l[n//i]
    ans.add(n)
    return ans

n = N()
cnt = 1
l = [{} for _ in range(n)]
l[1] = {1}
tab = [0]*(n+1)
for i in range(1,n+1):
    for j in range(i, n + 1, i):
        tab[j] += 1
tab[n]=0
print(sum(tab))

Submission status: Accepted

Solution code:
import math


def f2(n):
    d = 0
    c = 0
    for i in range(1, n):
        e = 0
        if i * i == n:
            e -= 1
        elif n % i == 0:
            e -= 1
        e += n // i
        d += e

    return d

def main():
    print(f2(int(input())))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def make_divisors(n):
    cnt = 0
    i = 1
    while i*i <= n:
        if n % i == 0:
            cnt += 1
            if i != n // i:
                cnt += 1
        i += 1
    return cnt
numbers = [1,10, 100, 1000, 10000, 100000, 150000,200000, 250000,300000,350000, 400000,450000, 500000,550000,600000,630000,675000,700000,720000,750000,800000,825000,850000,875000,900000,912500,925000,950000,975000,987500,1000000]
datas = [0,23,473,7053,93643,1166714, 1810893, 2472071, 3145923, 3829761, 4522005,5221424,5927120,6638407,7354651,8075420,8509899,9164377,9529244,9821778,10261678,10997400,11366472,11736253,12106789,12478098,12664043,12850013,13222660,13595947,13782871,13969985]

N = int(input())
ttl = 0
numPin = 0

for i in range(len(numbers)):
    if N == 1000000:
        numPin = len(numbers) - 1
        break
    if numbers[i] <= N < numbers[i+1]:
        numPin = i
        break

if numPin != len(numbers)-1:
    if N - numbers[numPin] < numbers[numPin + 1] - N:
        for i in range(numbers[numPin], N):
            ttl += make_divisors(i)
        print(ttl + datas[numPin])
    else:
        for i in range(N,numbers[numPin+1]):
            ttl -= make_divisors(i)
        print(ttl + datas[numPin + 1])
else:
    print(datas[numPin])

Submission status: Accepted

Solution code:
def DivisorsTable(N):
    DivTable = [0]*(N+1) 
    for I in range(1,N+1):
        for J in range(I,N+1,I):
            DivTable[J] += 1
    return sum(DivTable)
print(DivisorsTable(int(input())-1))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def funcion_a(n):
  count = 0
  i = 2
  while i*i <= n:
    count += 1
    j = i + 1
    while i*j <= n:
      count += 2
      j += 1
    i += 1
  return count
  
n = int(input())
answer = funcion_a(n-1) + (n-2)*2 + 1
print(answer)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
import math

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 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, N):
  tmp = (N-1) // a
  if a <= (N) // 2:
    count += tmp
  else:
    count += 1          

print(count)

Submission status: Accepted

Solution code:
import collections

zzz = 1
nn = int(input())
ans = 0

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

for i in range(1,nn):
    zzz = 1
    cc = collections.Counter(prime_factorize(i))
    hoge = cc.values()
    for aaa in hoge:
        zzz *= aaa + 1
    ans += zzz
   
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
s=[n-1]
for i in range(2,n):
    s.append((n-1)//i)
t=0    
for j in s:
    t+=j
print(t)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
#a, b = map(int,input().split())
#l = list(map(int,input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
ans=0
for a in range(1,n+1):
    ans+=(n-1)//a
print(ans)

Submission status: Accepted

Solution code:
#timeout
n=int(input())
a_max=int(n**0.5)+1

#a<=b

s_count=0
d_count=0
for a in range(1,a_max):
    b_max=(n//a)+1
    
    for b in range(a,b_max):
        c=n-a*b
        if c>=1:
            if a==b:
                s_count+=1
            else:
                d_count+=1
           
ans=s_count+d_count*2
print(ans)

Submission status: Accepted

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

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
print(sum(num_divisors_table(N)[:-1]))

Submission status: Accepted

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

Submission status: Accepted

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

count += int(N/2)
print(count)

Submission status: Accepted

Solution code:
N = int(input())
a = 0
k = 2*(N-2)+1
for i in range(2,N):
    for j in range(i,N):
        if (i*j<N)and(i!=j):
            a+=2
        elif(i*j<N)and(i==j):
            a+=1
        else:
            break
       
print(a+k)

Submission status: Accepted

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

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

    count = [0]*(n)

    for i in range(1, n):
        for j in range(i, n, i):
            count[j] += 1
    
    ans = sum(count)
    print(ans)
    
    
    
    
if __name__ == "__main__":
    main()

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=n-1
b=2
while True:
    a=n//b
    if n%b==0:
        a-=1
    ans+=a
    if a==0:
        break
    else:
        b+=1
        if n==b:
            break
print(ans)

Submission status: Accepted

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

print (ans)

Submission status: Accepted

Solution code:

n = int(input())

ans = 0
count = 0

a, b, c = 1, 1, 1

while a <= n:

    # print("A : {0}".format(a))
    # print("追加パターン : {0}".format( (n // a) ))

    if a == 1 :
        ans =  ans + ( (n // a) - 1)
    else :

        if n // a == 1 :
            ans = ans + 1
        else :

            if n % a == 0 :
                ans = ans + ( (n // a) - 1)
            else :
                ans = ans + ( (n // a) )

            



    # if n % a == 0 :
    #     ans = ans + ( (n / a) - 1 )
    # else :
    #     ans = ans + ( (n // a) - 1 )

    # ans = ans + (n / a) - 1

    # print("A : {0}".format(a))

    # while a * b < n:

    #     print("B : {0}".format(b))

    #     ans += 1

    #     b += 1
    #     c = 1

    a += 1
    b, c = 1, 1

# print("計算実行回数 : {0}".format(count))
print(ans - 1)

Submission status: Accepted

Solution code:
import sys, os.path
import math
from collections import Counter
if(os.path.exists('input.txt')):
    sys.stdin = open("input.txt","r")
    sys.stdout = open("output.txt","w")
 
 
 
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 = int(j / factor[j])
    ans = ans * (c + 1)
 
    return ans
generatePrimeFactors()
 
n = int(input())
temp = n
c = 1
count = 0
while(temp-c > 0):
    w = temp-c
    count += calculateNoOFactors(w)
    c += 1
print(count)

Submission status: Accepted

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

r=0
t=n
for i in range(1,n):
    p=((n-1)//i)



    s+=p

print(s)

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)

# a x b + c == n
# n - c == a x b

res = 0
for i in range(1, N):
  res += table[i]

print(res)

Submission status: Accepted

Solution code:
n = int(input())

s = 0
a = 1
b = 1
while a*b < n:
    while a*b < n and b <= a:
        if a == b:
            s += 1
        else:
            s += 2
        b += 1
    a += 1
    b = 1
print(s)

Submission status: Accepted

Solution code:
import sys

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

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

def input_int():
    return int(input())


def answer():
    n = input_int()

    count = 0
    for a in range(1, n):
        b = (n - 1) // a
        if b >= a:
            count += (b - a) * 2
            count += 1
        else:
            continue
    print(count)


answer()

Submission status: Accepted

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

Submission status: Accepted

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


print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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):
    x = (N-1)//i
    ans += x
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans=0
c=0
for a in range(1,1001):
    c=N-a*a
    if c>=1:
        ans+=1
ans1=0
for a in range(1,1000001):
    for b in range(a+1,int(N/a)+1):
        c=N-a*b
        if c>=1:
            ans1+=1
print(ans+ans1*2)

Submission status: Accepted

Solution code:
import sys

N = int(sys.stdin.readline())

ans = 0
for i in range(1, int(N**0.5) + 1):
    # print(i, N % i)
    a = i
    b_max = N // i
    for b in range(a, b_max + 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())
ans=0
for i in range(1,10**6+1):
    for j in range(1,1000001):
        if i*j>N-1:
            break
        else:
            ans+=1
print(ans)

Submission status: Accepted

Solution code:
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def main():
	n = int(input())
	#b , c = tin()
	#s = input()
	ret = 0
	for i in range(1, n):
		ret += (n-1)//i
	return ret
		
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Accepted

Solution code:
N = int(input())

counter = 0
for i in range(1,N):
    for j in range(1,min(i, int((N-1)/i))+1):
      if i == j:
        counter += 1
      else:
        counter += 2

print(counter)

Submission status: Accepted

Solution code:
N = int(input())

count = 0
count2 = 0
ABC = [0]*3

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
#a*b+c=n

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

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
A = np.arange(1, N, 1)
ans = 0
for a in A:
    ans += int((N-1)/a)
print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
z = 0
for a in range(N):
    for b in range(min(a,math.floor(N/(a+1)))):
        if N - (a+1)*(b+1) > 0:
            z = z+2
        else:
            pass
    if N - (a+1)*(a+1) > 0:
        z = z+1
    else:
        pass
print(z)

Submission status: Accepted

Solution code:
#pypyで通らないと思ったけど普通に通るやん
'''
Created on 2020/09/19

@author: harurun
'''

def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write

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

Submission status: Accepted

Solution code:
import math

N = int(input())

count = 0

for i in range(math.ceil(math.sqrt(N)))[1:]:
    if N % i == 0:
        tmp = N // i - 1
    else:
        tmp = N // i 
    count += (tmp - i) * 2 + 1
print(count)

Submission status: Accepted

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

for i in range(1,10**6):
  for j in range(i,10**6//i+1):
    if N > i*j:
      if i==j:
        ans += 1
      else:
        ans += 2

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
cnt = 0
for a in range(1,N+1):
    cnt += N // a
    if N % a == 0:
        cnt -= 1
print(cnt)

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

print(sum(num_divisors_table(n-1)))

Submission status: Accepted

Solution code:
def sieve(n):
    """
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = [2]
    limit = int(n**0.5)
    data = [i + 1 for i in range(2, n, 2)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]
    """
    from math import sqrt
    M = 10**6
    p = [1]*(M+1)
    p[0] = p[1] = 0
    P = []
    for x in range(2, int(sqrt(M))+1):
        if p[x]:
            P.append(x)
            for y in range(x*x, M+1, x):
                p[y] = 0
    return P

def isPrime(n,p):
    cnt = 0
    while n%p==0:
        n //= p
        cnt += 1
    return cnt,n

N = int(input())
P = sieve(N)
ans = 0
d = dict()
for n in range(1,N):
    flg = 1
    m = n
    d[m] = 0
    fac = 1
    for p in P:
        if n!=m and n in d:
            d[m] = d[n]*fac
            flg = 0
            break
        elif n%p == 0:
            l,n = isPrime(n,p)
            fac *= l+1
            d[m//n] = fac
        if p > n:
            break

    if flg:
        if n > 1:
            fac += 1
        d[m] = fac
    ans += d[m]
print(ans)

Submission status: Accepted

Solution code:
k=int(input())


cnt=0
if k>6:
    for i in range(7,k):
        for j in range(1,k):
            
                
            if i*j<k:
                cnt+=1
            else:
                break
print(cnt+k-1+((k-1)//2)+((k-1)//3)+((k-1)//4)+((k-1)//5)+((k-1)//6))

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

Submission status: Accepted

Solution code:
import sys
import math
N=int(input())
n=math.ceil(N**0.5)
s=0
t=0
for a in range(1,n+1):
    if a*a<N:
        t=t+1
        #print(a,N-a*a)
        for b in range(a+1,N//a+1):
            if a*b<N:
                s=s+1
            #print(a,b,N-a*b)
    else:
        print(t+2*s)
        sys.exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
a = 1
c = N-1
count = 0
b = 1
while b>0 :
    b = (N-1)//a
    count += b
    a += 1
print(count)

Submission status: Accepted

Solution code:
import math
N = int(input())
count = 0
for i in range(1, N):
    if i == 1:
        count += N - 1
        continue
    if N % i == 0:
        count += N / i -1
    elif N % i >= 1:
        count += math.floor(N / i)
print(int(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())

# def num_divisors_trial_division(n):
#     num = 0
#     for i in range(1, int(n ** (1 / 2)) + 1):
#         if n % i == 0:
#             num += 1
#             if n != i ** 2:
#                 num += 1
#     return num
#
# ans = 0
# for j in range(1, n):
#     ans += num_divisors_trial_division(j)
#     #print(i , ans)
# print(ans)

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

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
for a in range(1, int(n**0.5)+1):
    for b in range(a, n):
        if n > a*b:
            if a == b:
                cnt += 1
            else:
                cnt += 2
        else:
            break
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:
n = int(input())
cnt =[0]*(n+1)
ans = 0

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

Submission status: Accepted

Solution code:
import math
val = int(input())
num = 0
for i in range(1, val):
    num += math.ceil(val/ i) - 1
print(num)