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: Time Limit Exceeded

Solution code:
n = int(input())
import math
# Method to print the divisors 
def printDivisors(n) : 
    tuples = 0
    for i in range(1, int(math.sqrt(n) + 1)) : 
          
        if (n % i == 0) : 
            if (n / i == i) : 
                tuples+=1;    #(3,3) type
            else : 
                # Otherwise print both 
                tuples+=2
    return tuples
          

overall = 0  
for c in range(n-1,0,-1):
  val = n - c
  overall+= printDivisors(val)
print(overall)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

ans = 0

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


print(ans)

Submission status: Time Limit Exceeded

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

ans=0
for i in range(1,n):
  num=n-i
  m=round(math.sqrt(num))
  for j in range(1,m+1):
    if num%j==0 and num//j==j:
      ans+=1
    elif num%j==0 and num//j!=j:
      ans+=2
print(ans)

Submission status: Time Limit Exceeded

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

    def count_div(num):
        count = 0
        upper = num ** 0.5
        i = 1
        while i <= upper:
            if num % i == 0:
                if i == upper:
                    count += 1
                else:
                    count += 2
            i += 1
        return count

    ans = 0
    for c in range(1, n + 1):
        ans += count_div(n - c)
    print(ans)

resolve()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ans = 0
a = 1
repeat_count = 0
while a*a <= n:
    b = 1
    while a*b < n:
        ans += 1
        if b * b > n:
            repeat_count += 1
        b += 1
    a += 1
print(ans + repeat_count)

Submission status: Time Limit Exceeded

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

N = int(input())
ttl = 0
tempNum = 0
count = 0

for i in range(1,N):
    tempNum = N - i
    count = len(make_divisors(tempNum))
    ttl += count

print(ttl)

Submission status: Time Limit Exceeded

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush
import collections
import bisect

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

    ans = 0
    for i in range(1,n):
        if len(make_divisors(n-i)) != 0:
            num = len(make_divisors(n-i))
            ans += num
    print(ans)



if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

num = int(input())
count = 0
for i in range(1, num):
  count += len(make_divisors(i))
print(count)

Submission status: Time Limit Exceeded

Solution code:
import collections

n = int(input())

if n == 1:
    print(0)
else:
    lis = [0 for i in range(n+1)]
    for i in range(2, n+1):
        if lis[i] == 0:
            lis[i] = i
            for j in range(i**2, n+1, i):
                if lis[j] == 0:
                    lis[j] = i

def bunkai(m):
    ans = []
    for i in range(m):
        ans.append(lis[m])
        m = m//lis[m]
        if m == 1:
            break
    return ans

ans = 1

for i in range(2,n):
    tmp = 1
    yaku = collections.Counter(bunkai(i))
    for i in yaku:
        tmp = tmp * (yaku[i] +1)
    ans += tmp

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans = 0

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
D =0
A = 1
while A <= N:
    B = 1
    while B <= N:
        ans = A*B
        if ans > N:
            break
        C = 1
        while C <=N:
            anss =  ans + C
            if anss == N:
                D += 1
            C += 1
        B += 1
    A += 1
print(D)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
i=0
for c in range(1,N+1):
    x=N-c
    for a in range(1,x+1):
        if x%a==0:
            y=int(x/a)
            for b in range(1, y+1):
                if y==b:
                    i+=1
print(i)

Submission status: Time Limit Exceeded

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

def make_divisors(n):
    div_num = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            div_num += 1
            if i != n // i:
                div_num += 1
    return div_num

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
count = 0
for C in range(1,N):
  for A in range(1,N-C+1):
    for B in range(1,N-C+1):
      if A*B + C == N:
        count += 1
print(count)

Submission status: Time Limit Exceeded

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

# A * B  = N - C
N = int(input())
count = 0
for i in range(1, N):
    AB = N - i
    count += len(make_divisors(AB))

print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans = 0
for c in range(1,N):
    N_ = N-c
    sq_N_ = int(N_**(1/2))
    for a in range(1,sq_N_+1):
        if N_ % a == 0:
            b = N_//a
            ans += 2
        if a == b:
            ans -= 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
pair_list = []

ans = 0

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

Submission status: Time Limit Exceeded

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

for i in range(1,N) :
    for j in range(1,N) :
        for k in range(1,N) :
            a = i
            b = j
            c = k
            if a*b+c==N :
                count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
import math

N = int(input())

count = 0

for c in range(N-1, 0, -1):
    k = N - c
    ct = 0
    for b in range(1, int(math.sqrt(k+1)+1)):
        a = k / b
        if a == b:
            ct += 1
        elif a == int(a):
            ct += 2
    count += ct


print(count)

Submission status: Time Limit Exceeded

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

for i in range(1,n):
    hoge = n - i
    for j in range(1,hoge+1):
        if hoge % j == 0:
            ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
print(sum(A*B + C == N for A in range(1,N) for B in range(1,N) for C in range(1,N)))

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt

N = int(input())


def calc_combo(n):
  ls = []
  for i in range (2, int(sqrt(n)) + 1):
      c = 0
      while n % i == 0:
          n /= i
          c += 1
      if c > 0:
          ls.append(c)
  if n != 1:
    ls.append(1)

  a = 1
  for i in range(len(ls)):
    a *= (ls[i] + 1)

  return(a)


out = 0
for i in range(1, N):
  newN = N - i
  out += calc_combo(newN)
  
print(out)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

N = int(input())
p = [0] * N
p[1] = 1
for i in range(2,N):
    a = len(make_divisors(i))
    p[i] = p[i-1] + a

print(p[N-1])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
##C - A x B + C
N = int(input())
def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
ans = 0
for i in range(1,N):
    ans += len(divisor(i))
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

func = lambda A, B, C: A * B + C

count = 0
for C in range(1, N):
	for A in range(1, N-C+1):
		for B in range(1, N-C+1):
			if func(A, B, C) == N:
				count += 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
#A,B,C>0 C=N-A*B
count=0
for A in range(1,N):
    for B in range(1,N):
        # print(A,B,N-A*B)
        if N-(A*B)<0:
            break
        elif N-(A*B)>0:
            count+=1
print(count)

Submission status: Time Limit Exceeded

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

n = int(input())

def divisor(n):
    i = 1 
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

ans = 0 
for i in range(1, n): 
    ans += len(divisor(n-i))

print(ans)

Submission status: Time Limit Exceeded

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 factorization(n):
    if n == 1:
        return [[1,0]]
    else:
        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 main():
    N = NI()
    ans = 0
    for C in range(1,N):
        cnt = 1
        AXB = N-C
        factri = factorization(AXB)
        for x in range(len(factri)):
            cnt = cnt * (factri[x][1]+1)
        ans += cnt
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
c=0
for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):
            s=i*j+k
            if s==n:
                c+=1
print(c)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

a = 1
b = 1
ans = 0

while a<N:
    b = 1
    while a*b <N:
        ans += 1
        b += 1
    a+=1
print(ans)

Submission status: Time Limit Exceeded

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

for i in range(1,n):
    for j in range(1, n):
        if i * j < n:
            cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

i=2
j=2
cal=0

while i*j<n:

    while i*j<n:
        cal+=1
        j+=1

    j=2
    i+=1

ans = cal + (n*2-3)

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

n = int(input())
r = 0
for i in range(n):
  if i == 0:
    continue
  a = make_divisors(n - i)
  r += len(a)
  
print(r)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input(""))
d = 0
for a in range(1,N):
  for b in range(1,N):
    for c in range(1,N):
      if a*b+c == N:
        d += 1
print(d)

Submission status: Time Limit Exceeded

Solution code:
#
import sys
import math
import itertools

n = int(input())

# 素因数分解
def factorialization(n):
    a = []
    t = n
    for i in range(2,int(n**0.5)+1):
        if t%i == 0:
            e = 0
            while t%i ==0:
                e += 1
                t = t // i
            a.append([i,e])
    if t > 1:
        a.append([t,1])
    return a

answer=0

for c in range(1,n):
    ff=1
#    print(factorialization(c))
    for p in factorialization(c):
        ff *= (p[1]+1)
    answer += ff

print(answer)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

results = []
for C in range(1, N+1):
    for A in range(1, N-C + 1):
        if (N-C) % A == 0:
            B = int((N-C)/A)
            results.append([A, B, C])
            
print(len(results))

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

cnt=0

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

print(cnt)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt

def SieveOfEratosthenes(n):
    prime = [True for i in range(n + 1)] 
    p = 2
    while (p * p <= n):
        if (prime[p] == True):
            for i in range(p * 2, n + 1, p): 
                prime[i] = False
        p += 1
    prime[0]= False
    prime[1]= False
    return(prime)
def f(n):
    ans = 0
    for i in range(1, int(sqrt(n)+1)):
        if n%i == 0:
            if i**2 == n:ans+=1
            else:ans += 2
    return(ans)
prime = SieveOfEratosthenes(10**6)
n = int(input())
ans = 0
for i in range(1, n):
    tem = n-i
    if not prime[tem]:
        ans += f(tem)
    else:
        ans += 2
#     print(tem ,ans)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
count=0
for k in range(1,N):
    for a in range (1,k+1):
        if k%a==0:
            count=count+1
        else:
            continue
print(count)

Submission status: Time Limit Exceeded

Solution code:
num = int(input())
count = 0
for i in range(1, num):
  for j in range(1, i + 1):
    if i % j != 0:
      continue
    count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

count = 0

for i in range(N-1):
  for j in range(N-1):
    if (i+1)*(j+1) < N:
      count += 1
    else:
      break
print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

count = 0
for c in range(1,n):
  ab = n - c
    
  for a in range(1,int(ab**(1/2))+1):
    if ab % a == 0:
      count += 2
  if int(ab**(1/2))**2 == ab:
    count -= 1
    
print(count)

Submission status: Time Limit Exceeded

Solution code:
import math

from functools import lru_cache
#上手くいかない時は下
# from functools32 import lru_cache 

@lru_cache(None)
def make_prime_list_2(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]

def search_divisor_num_1(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(num_sqrt)

        divisor_num = 1
        for prime in prime_list:
            count = 1
            while num % prime == 0:
                num //= prime
                count += 1
            divisor_num *= count

        if num != 1:
            divisor_num *= 2

        return divisor_num
    
N=int(input())
cnt=0
for i in range(1,N):
    cnt += search_divisor_num_1(N-i)
    
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

import math
def num_divisors_trial_division(n):
    num = 0
    for i in range(1, int(math.sqrt(n) + 1e-9) + 1):
        if n % i == 0:
            num += 1
            if n != i**2:
                num += 1
    
    return num

result = 0
for ab in range(1,n):
  tmp = num_divisors_trial_division(ab)
  result += tmp
print(result)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
from collections import Counter


class SmallestPrimeFactors:
    def __init__(self, n):
        self.spf = list(range(n + 1))
        self.spf[0] = -1
        self.spf[1] = -1
        for i in range(2, int(n ** 0.5) + 1):
            if self.spf[i] == i:
                for j in range(i * i, n + 1, i):
                    if self.spf[j] == j:
                        self.spf[j] = i

    def is_prime(self, x):
        return self.spf[x] == x

    def __traverse(self, x):
        if self.spf[x] == x:
            return [x]
        nxt = x // self.spf[x]
        return self.__traverse(nxt) + [self.spf[x]]

    def factor(self, x):
        if x < 2:
            return []
        return self.__traverse(x)


spf = SmallestPrimeFactors(1_000_000)
N = int(input())
ans = 0
for C in range(1, N):
    fac = Counter(spf.factor(N - C))
    tmp = 1
    for v in fac.values():
        tmp *= v + 1
    ans += tmp
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

ans = 0
for c in range(1,n-1):
  ab = n-c
  f = factorization(ab)
  tmp = 1
  for i in range(len(f)):
    tmp *= f[i][1]+1
  ans += tmp
  
print(ans+1)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

count = 0
for C in range(1,N):
  n = N - C
  for B in range(1,n+1):
    a = n/B
    if(a == int(a)):
      count += 1
      
print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
count = 0
for A in range(1,N):
    for B in range(1,N):
        for C in range(1,N):
            if N == A*B+C:
                count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
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 main():
    n = int(input())

    dp = [0] * (n+1)
    dp[0] = 0
    dp[1] = 0
    for i in range(2, n+1):
        divisor = make_divisors(i-1)
        dp[i] = dp[i-1] + len(divisor)

    print(dp[-1])


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
def prime(p):
    memo = 0
    for i in range(1,(int(p**0.5)+1)):
        if p%i==0:
            memo += 2
            if i == p//i:
                memo -= 1
        #print(memo,i,p)
    return memo      

N = int(input())

ans = 0
for i in range(1,N):
    ans += prime(i)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
"""
A*B+C=N
N-C=A*B

AB+C=Nの組み合わせは、N-1通り

"""
def factorization(n):
    def factor_sub(n, m):
        c = 0
        while n % m == 0:
            c += 1
            n /= m
        return c, n
    #
    buff = []
    c, m = factor_sub(n, 2)
    if c > 0: buff.append((2, c))
    c, m = factor_sub(m, 3)
    if c > 0: buff.append((3, c))
    x = 5
    while m >= x * x:
        c, m = factor_sub(m, x)
        if c > 0: buff.append((x, c))
        if x % 6 == 5:
            x += 2
        else:
            x += 4
    if m > 1: buff.append((m, 1))
    return buff
def divisor_num(n):
    a = 1
    for _, x in factorization(n):
        a *= x + 1
    return a

ans=0

for c in range(1,N):
    ab=divisor_num(N-c)
    ans+=(ab//2)*2+ab%2
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
count = 0
for A in range(1,N):
    for B in range(1,N):
        for C in range(1,N):
            if N == A*B+C:
                count += 1
                # print(A,B,C)
print(count)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
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
ans=1
for i in range(1,n-1):
    x=1
    tmp=factorization(n-i)
    for j in tmp:
        x*=(j[1]+1)
    ans+=x
        
print(ans)

Submission status: Time Limit Exceeded

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

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

print(count)

Submission status: Time Limit Exceeded

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

input = sys.stdin.readline


def I():
    return int(input())


def make_divisors(n):
    c = 0
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            c += 1
            if i != n // i:
                c += 1
    return c


n = I()

ans = 0
for i in range(1, n):
    q, r = divmod(make_divisors(n - i), 2)
    ans += q * 2 + 1 * r

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input())
ans = 0
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]
#N = A × B + C
for j in range(1,N):
    k = make_divisors(j)
    ans += len(k)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
ans = 0
s = []

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


print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
def main():
    N = int(input())
    ans = 0
    for c in range(1, N):
        tmp = 0
        sqrtnc = int(math.sqrt(N - c))
        for b in range(1, sqrtnc + 1):
            if ((N - c) // b) * b == N - c:
                tmp += 1
        ans += tmp * 2
        if sqrtnc ** 2 == N - c:
            ans -= 1
    return ans

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

Submission status: Time Limit Exceeded

Solution code:
def main():
    n = int(input())
    cnt = 0
    for c in range(1, n):
        for i in range(1, c+1):
            if c % i == 0:
                cnt += 1
    print(cnt)
    
    
if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans = 0
for i in range(1,N):
    for j in range(1,N//i+1):
        c = N - i*j
        if c>0:
            ans = ans + 1
            #print("i,j,c =",i,j,c)
			
            
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input())
result = 0
for i in range(1, N + 1):
    s = math.ceil(N / i)
    for j in range(1, s + 1):
        a = N - i * j
        if a > 0:
            result = result + 1
        else:
            break
print(result)

Submission status: Time Limit Exceeded

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

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 main():
    n = int(input())
    ans = 0
    for c in range(1, n):
        d = n - c
        ans += len(make_divisors(d))
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
from itertools import product 
n=int(input())
T = [ (a,b,c) for a,b,c in product(range(1, n+1), repeat=3) if a*b+c == n]
#print(*T)
print(len(T))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
cnt = 0
for a in range(1, N):
    for b in range(1, N):
        for c in range(1, N):
            if a*b+c == N:
                cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
def yaku(k):
    count  = 0
    an = []
    for i in range(1,k+1):
        if len(an) > 0 and i == an[-1]:
            count += len(an)
            break
        if k % i == 0:
            count += 1
            if k/i != i:
                an.append(k/i)
    return count

n = int(input())
ans = 0
for i in range(n-1):
    count = yaku(n-i-1)
    ans += count
print(ans)

Submission status: Time Limit Exceeded

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 main():
    n = int(input())
    # 1～n-1 までcを回す
    c = 1
    ans = 0
    while(c <= n-1):
        ab = n - c
        if ab == 1:
            ans += 1
            break
        arr_ab = factorization(ab)
        ans_temp = 1
        for i in range(len(arr_ab)):
            ans_temp *= arr_ab[i][1] + 1
        #print(ans_temp, arr_ab)
        ans += ans_temp
        c += 1
    print(ans)
    return 0

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt
from collections import Counter

def primes(N):
    is_prime = [True]*(N+1)
    is_prime[0] = False
    is_prime[1] = False
    D = [0]*(N+1)
    for n in range(2, int(sqrt(N)+1)):
        if is_prime[n]:
            D[n] = n
            j = n+n
            while j <= N:
                is_prime[j] = False
                D[j] = n
                j+=n
    for n in range(int(sqrt(N)), N+1):
        if is_prime[n]:
            D[n] = n
                
    return is_prime, D

def solve(N):
    is_prime, D = primes(N)
    total = 0
    for c in range(1, N-1):
        if is_prime[N-c] and False:
            total += 2
            continue

        C = Counter()
        x = N-c
        while x >= 2:
            d = D[x]
            C[d] += 1
            x //= d
        a = 1
        for k, v in C.items():
            a *= (v+1)
        #print(f"{N=} {c=}, {a=}, {C=}")
        total += a
    # c = N-1
    total += 1
    return total

N = int(input())
print(solve(N))