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())
count = 0
lis = []

for i in range(1,N):
  lis.append([2 for j in range(1,int((N-i+1)**0.5)+1) if (N-i)%j == 0])
  if int((N-i)**0.5) == (N-i)**0.5:
    lis.append([-1])

for i in lis:
  count += sum(i)
  
print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def get_divisors_length(n):
    ret = 0
    i = 1
    while i*i < n:
        if n % i == 0:
            ret += 2
        i += 1
    return ret+1 if i*i == n else ret

print(sum(get_divisors_length(i) for i in range(1, N)))

Submission status: Time Limit Exceeded

Solution code:
import collections
import numpy as np


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
  
  
N = int(input())
ans = 0
for i in range(1, N):
    if N-i == 1:
        ans += 1
    if N-i > 1:
        c = collections.Counter(prime_factorize(N-i))
        prod = np.prod(np.array(list(c.values()))+1)
        ans += prod
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
ans=0
for c in range(1,n-1):
    div=0
    for i in range(1,int((n-c)**0.5)+1):
        if (n-c)%i ==0:
            div+=1
            if i!=(n-c)//i:
                div+=1
    ans+=div
print(ans+1)

Submission status: Time Limit Exceeded

Solution code:
import math

N = int(input())

count = 0

for i in range(1,N):
  c = 1
  a = N-i
  for k in range(2,math.floor(math.sqrt(a))+1):
    cnt = 0
    while(a%k==0):
      cnt += 1
      a = a/k
    c = c * (cnt+1)
    if a == 1:
      break
  if a != 1:
    c = c*2
  count = count + c
      
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
c = 1
total = 0

def makedivs(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]
                  

while(N-c >= 1):
      divnums = makedivs(N-c)

      # print(N-c,end=" ")
      # print(str(divnums) + ", divcombies: " + str(divcombies))
      
      total += len(divnums)
      c += 1

print(total)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
c = []
ans = 1

import collections
ans = 1
all_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, N):
  ans = 1
  c = collections.Counter(prime_factorize(N-i))
  for i in c.values():
    ans *= (i+1)
  all_ans += ans

print(all_ans)

Submission status: Time Limit Exceeded

Solution code:
#c
import sys
n = int(input())
import math

ans = 0
for i in range(1,n):
    before = n
    for j in range(1,n):
        if (n-i)%j==0 :
            
            if before <= j:
                break
            if j==(n-i)/j:
                ans+=1
            else:
                ans+=2
                

        before = (n-i)/j
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
sum=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]

for c in range(1,N):
    sum+=len(make_divisors(c))
print(sum)

Submission status: Time Limit Exceeded

Solution code:
import math

nu=int(input())
total=0
for p in range(1,nu):
    num=nu-p
    for j in range(1,math.floor(math.sqrt(num))+1):
        if j**2==num:
            total+=1
        elif num%j==0:
            total+=2
print(total)

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

Submission status: Time Limit Exceeded

Solution code:
import math
n=int(input())
count=0
for i in range(n-1):
  a=n-(i+1)
  b=math.sqrt(a)
  c=math.floor(b)
  cnty=0
  for j in range(c):
    if a%(j+1)==0:
      if j+1==b:
        cnty+=1
      else:
        cnty+=2
  count+=cnty
print(count)

Submission status: Time Limit Exceeded

Solution code:
import math
n=int(input())
ans=0
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


for i in range(1,n):
    ans+=int(search_divisor_num_1(i))
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

def divisor(n): 
    i = 1
    num = 0
    while i * i <= n:
        if n%i == 0:
            num+=2
            if i==n//i:
                num-=1
        i += 1
    return num

ans=0
for c in range(1, n):
    ab = n-c
    ans+=divisor(ab)

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:
from collections import Counter


def factorize(n):
    fct = []
    while n % 2 == 0:
        fct.append(2)
        n //=2
    f = 3
    while f * f <= n:
        if n % f == 0:
            fct.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        fct.append(n)
    d = [i+1 for i in list(Counter(fct).values())]
    return d

n = int(input())
cnt = 0
for c in range(1,n):
    tmp = 1
    for i in factorize(n-c):
        tmp *= i
    cnt += tmp
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import math
a = 0
N = int(input())
for i in range(1, N):
  for j in range(1, N):
    if i % j == 0:
      a += 1
print(a)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
num = int(input())
cnt=0
for i in range(1,num):
    new = num - i
    for j in range(1,new+1):
            if new%j==0:
                cnt += 1
            else:
                pass
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
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 resolve():
  N = int(input())
  count = 1

  for c in range(1, N-1):
    factorized = factorization(N-c)
    num_of_pattern = 1
    even_flag = True
    
    for segment in factorized:
      num_of_pattern *= segment[1] + 1

      if segment[1] % 2 == 1:
        even_flag = False

    count += num_of_pattern

  print(count)

if __name__ == "__main__":
  resolve()

Submission status: Time Limit Exceeded

Solution code:

number = int(input())


def isqrt(n):
    if n == 0:
        return 0
    x, y = n, (n + 1) // 2
    while y < x:
        x, y = y, (y + n // y) // 2
    return x


def isprime(n):
    if n < 2:
        return False
    for i in range(2, isqrt(n) + 1):
        if n % i == 0:
            return False
    return True


# a * b == n - c
count = 0
for c in range(1, number + 1):
    # if not isprime(number - c):
    for a in range(1, number + 1):
        for b in range(1, number + 1):
            if a * b + c == number:
                count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
import collections

def trial_division(n):
    if n < 3:
        return 1
    # prime_factors = []
    product_sum=1
    for i in range(2, int(n**0.5)+1):
        # 個々で i で複数回割り切れるのなら割り切る．
        count = 0
        while n % i ==0:
            # prime_factors.append(i)
            n //= i
            count += 1
        product_sum*=(count+1)
    if n > 1:
        # prime_factors.append(n)
        product_sum*=(1+1)
    return product_sum


N = int(input())
if(N==2):
    print(1)
    exit()
ans = [0 for i in range(N)]
for n in range(1, N):
    ans[n] = trial_division(n)
# print(ans)
print(sum(ans)+1)

Submission status: Time Limit Exceeded

Solution code:
from collections import defaultdict
import operator
from functools import reduce


def prime_factorize(n, divs):
    """素因数分解する。"""

    ans = defaultdict(int)
    for fac in divs:
        while n % fac == 0:
            ans[fac] += 1
            n //= fac
        if fac ** 2 > n:
            break
    if n != 1:
        ans[n] += 1
    return ans


def primes(n):
    """素因数分解する。"""
    def facs(n):
        """試し割り法における割る数を生成する。"""
        yield 2
        max_prime = int(pow(n, 0.5)) + 1
        for x in range(3, max_prime, 2):
            yield x

    nums = [1] * (n + 1)
    for i, fac in enumerate(nums):
        if i < 2:
            continue
        if fac == 0:
            continue
        for multi in range(i * 2, n + 1, i):
            nums[multi] = 0
    return [i for i, fac in enumerate(nums) if fac and i > 1]


def main():
    n = int(input())
    divs = primes(n)
    ans = 0
    for ab in range(1, n):
        prm = prime_factorize(ab, divs)
        tmp = reduce(operator.mul, (v+1 for v in prm.values()), 1)
        ans += tmp
    return ans


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

Submission status: Time Limit Exceeded

Solution code:
import math
import numpy as np
n = int(input())
li = np.zeros(n, dtype=np.int)
def solve(n):
    s = math.sqrt(n)
    i = 2
    f = {}
    n_ = n
    while i <= s:
        while n_ % i == 0:
            f[i] = f.get(i,0)+1
            n_ = n_ // i
        i += 1

    c = 1
    if n_ > 1:
        f[n_] = 1
    for x in f.values():
        c *= (x+1)
    
    return c

ans = 0
while n > 0:
    n -= 1
    if n==0:
        break
    ans += solve(n)
print(ans)

Submission status: Time Limit Exceeded

Solution code:

n = int(input())

ans = 0
count = 0

a, b, c = 1, 1, 1

while a <= n:

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

    while a * b < n:

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

        ans += 1

        # if c >= n - (a * b) :
        #     ans += 1

        # while a * b + c <= n:

        #     # print("C : {0}".format(c))

        #     count += 1

        #     if a * b + c == n :
        #         ans += 1

        #     c += 1

        b += 1
        c = 1

    a += 1
    b, c = 1, 1

# print("計算実行回数 : {0}".format(count))
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())
ans = 0

for i in range(1, N):
    count = len(make_divisors(N-i))
    ans += count
    # print(N-i, end='')
    # print('の約数の個数は')

    # print(count)
    # if count % 2 == 0:
    #     ans += count*2
    # else:
    #     ans += 1 + (count-1)*2
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math
def num_divisors(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

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

Submission status: Time Limit Exceeded

Solution code:
import math
n = int(input())
ans = 0
for i in range(1,n):
   for j in range(int(math.sqrt(i))):
      if i%(j+1)==0:
        ans+=2
print(ans-int(math.sqrt(n-1)))

Submission status: Time Limit Exceeded

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


nn=int(input())
ans=0

for i in range(nn-2):
    c=i+1
    k=factorization(nn-c)
    ans1=1
    for j in range(len(k)) :
        ans1=ans1*(k[j][1]+1)

    ans=ans+ans1


ans=ans+1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = [_ for _ in range(1, n)]
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]



count = 0
for c in range(1, n):
    count+=len(make_divisors(n-c))
print(count)

Submission status: Time Limit Exceeded

Solution code:
import math
from collections import defaultdict as dd

def count_divisor(x):
  if x == 1:
    return 1
  
  divided = x
  d = dd(int)
  for i in range(2, math.floor(math.sqrt(x))+1):
    while divided%i == 0:
      d[i] += 1
      divided /= i
  if divided != 1:
    d[int(divided)] += 1
  
  count = 1
  for v in d.values():
     count *= v+1
  return count

N = int(input())
ans = 0
for c in range(1, N):
  ans += count_divisor(N-c)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
def divisor(n): 
    cnt=0
    i = 1
    while i * i <= n:
        if n%i == 0:
            if i==n//i:
                cnt+=1
            else:
                cnt+=2
        i += 1
    return cnt

n = int(input(''))
result=0
for c in range(1,n):
    n2 = n-c
    div = divisor(n2)
#    print("{}->{}".format(n2,div))
    result+=div

print(result)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

cnt=0

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

Submission status: Time Limit Exceeded

Solution code:
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
c=0
k=int(input())
for x in range(k):
  c += num_divisors_trial_division(x)

print(c)

Submission status: Time Limit Exceeded

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

N=int(input())
s=0
for i in range(N-1,0,-1):
    s+=num_divisors_trial_division(i)
print(s)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

list = []

for a in range(1, 10**6-1):
  for b in range(a, 10**6-1):
    if a * b >= N:
      break 
    c = N - a * b
    list.append([a, b, c])

add_list = []
for l in list:
  if l[0] == l[1]:
    continue
  add_list.append([l[1], l[0], l[2]])

print(len(list) + len(add_list))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

Submission status: Time Limit Exceeded

Solution code:
import math
N=int(input())
count=0
for i in range(1,N):
    AB=N-i
    bb=int(math.sqrt(AB))
    for j in range(1,bb+1):
        if j*j==AB:
            count+=1
        elif AB%j==0:
            count+=2
            #print((j,AB/j,i))
print(count)

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(input())

cnt = 0
for c in range(1, n):
    d = n - c
    a = 0
    amax = math.sqrt(d)
    while (a <= amax):
        a += 1
        b = d / a
        if b < a:
            break
        if b == int(b):
            if a == b:
                cnt += 1
            else:
                cnt += 2

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from math import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
import heapq
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
INF = float('inf')
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
    return int(readline())

is_prime = [0] * (10**6+1)
is_prime[0] = False
is_prime[1] = False

for a in range(2,10**6+1):
    if is_prime[a]:
        for v in range(a*2,10**6+1,a):
            is_prime[v] = False
# def yaku(m):
#     ans = []
#     i = 1
#     while i*i <= m:
#         if m % i == 0:
#             j = m // i
#             ans.append(i)
#             if j != i:
#                 ans.append(j)
#         i += 1
#     ans = sorted(ans)
#     return ans
n = I()
ans = 0
for c in range(1,n):
    nc = n-c
    if nc == 1:
        ans += 1
        continue
    else:
        ans += 2
    i = 2
    while i*i <= nc:
        if nc%i == 0:
            if i*i == nc:
                ans += 1
            else:
                ans += 2
        i += 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())
ans=0
for i in range(1,n):
    ans+=len(make_divisors(i))
print(ans)

Submission status: Time Limit Exceeded

Solution code:
num = int(input())

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]

count = 0
for i in range(num):
  count += len(make_divisors(i))

print(count)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

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

print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
count = 0
for i1 in range(1,n):
    for i2 in range(1,n):
        for i3 in range(1,n):
            if i1 * i2 + i3 == n:
                count += 1         
print(count)

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):
    if i*j>=n:
      break
    else:
      cnt+=1
      
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = 0
B = 1
C = 0
D = 0
total = 0
while A < N:
    B = 1
    A += 1
    D = A*B
    while D < N:
        total = total + 1
        B = B + 1
        D = A*B
print(total)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
cnt = 0
for n in range(1,N):

    i = 1
    lst = []
    while i * i <= n:
        if n%i == 0:
            lst.append(i)
            lst.append(n//i)
        i += 1

    cnt += len(set(lst))
    
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
def get_divisors_number(n):
  divisorNumber = 0
  num = 1
  for i in range(N):
    if n % num == 0:
      divisorNumber += 1
    num += 1
    if num ** 2 > n:
      break
  if (num-1) ** 2 == n:
    return divisorNumber * 2 - 1
  return divisorNumber * 2

N = int(input())
result = 0
for i in range(N-1):
  result += get_divisors_number(i+1)
print(result)

Submission status: Time Limit Exceeded

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]


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

    
if __name__ == "__main__":
    main()

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
        B += 1
        if ans >= N:
            break
        D += 1
    A += 1
print(D)

Submission status: Time Limit Exceeded

Solution code:
import itertools
n=int(input())
l=[]
for i in range(1,n):
    l.append(i)
ct=0
for p in itertools.product(l,repeat=3):
    if p[0]*p[1]+p[2]==n:
        ct+=1
print(ct)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
a=1
b=1
count=0
while a<N:
  while a*b<N:
    count=count+1
    b=b+1
  else:
    b=1
    a=a+1
else:
  print(count)

Submission status: Time Limit Exceeded

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

for a in range(1, n+1):
  for b in range(1, n//a+1):
    c = n - a * b
    if c != 0:
      num += 1

print(num)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

def times_com(num):
    count1 = 0
    for a in range(1,num+1):
        if num % a == 0:
            count1 += 1
    return count1

count2 = 0
for c in range(1, n):
    num = n - c
    count2 += times_com(num)

print(count2)

Submission status: Time Limit Exceeded

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


n = int(input())

cnt = 0

for c in range(1, n):
    d = n - c
    e = factorization(d)

    x = 1

    if e[0][0] == 1 and e[0][1] == 1:   # 1の場合
        cnt += 1
    else:
        for i in range(len(e)):
            x *= e[i][1] + 1
        cnt += x

print(cnt)

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())
c = 1
ans = 0
while n-c>0:
  #print(make_divisors(n-c))
  ans += len(make_divisors(n-c))
  c += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

count = 0

for b in range(1,N):
    for c in range(1,N):
        a = (N-c)/b
        aa = a - int(a)
        if a > 0 and aa == 0:
            count += 1

print(count)

Submission status: Time Limit Exceeded

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

cnt=1
for i in range(2,n):
  cnt+=search_divisor_num_1(i)
  
print(cnt)

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):
            if (i*j+k) == n:
                count += 1
                continue
print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
count = 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]
for i in range(1, n, 1):
    count += len(make_divisors(n-i))
print(count)

Submission status: Time Limit Exceeded

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

def mal(m):
    global count
    for a in range(1,int(m**(1/2))+1):
        b = m/a
        if(b.is_integer()):
            count+=2
            if(a==b):
                count-=1

for c in range(1,n):
    mal(n-c)

print(count)

Submission status: Time Limit Exceeded

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

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

C = 1
Cnt = 0
cnt = 1
while N - C > 0:
    cnt = 1
    x = collections.Counter(prime_factorize(N-C))
    X = list(x.values())
    for i in X:
        cnt *= (i+1)
    Cnt += cnt
    C += 1
    
print(Cnt)

Submission status: Time Limit Exceeded

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 divisors(n):
    num = 0
    for i in range(1, int(math.sqrt(n) + 1)):
        if n % i == 0:
            num += 1
            if n != i**2:
                num += 1
    
    return num
n = N()
cnt = 0
for i in range(1,n):
    ab = n-i
    cnt += divisors(ab)
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans = 0

for c in range(1,N,1):
    for a in range(1,N,1):
        b = (N-c)/a
        if b > 0 and  b.is_integer() == True:
            ans += 1

print(ans)

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):
        if (n - i) % j == 0:
            ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
  
def fctr(n):
    f=[]
    c=0
    r=int(n**0.5)
    for i in range(2,r+2):
        while n%i==0:
            c+=1
            n=n//i
        if c!=0:
            f.append([i,c])
            c=0
    if n!=1:
        f.append([n,1])
    return f
cnt = 0
for i in range(1,n):
  x =1
  a = fctr(n-i)
  for j in range(len(a)):
    x *= (a[j][1]+1)
  cnt += x
print(cnt)

Submission status: Time Limit Exceeded

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

def factorization(n):
  a = 1
  temp = n
  for i in range(2, int(math.sqrt(n))+1):
    if temp%i == 0:
      cnt = 1
      while temp%i==0:
        cnt += 1
        temp //= i
      a *= cnt
  if temp != 1:
    a *= 2
  return a

if N <= 4*(10**5):
  ans = 0
  for i in range(1, N):
    ans += factorization(i)
elif 4*(10**5) < N <= 6*(10**5):
  ans = 5221424
  for i in range(4*(10**5), N):
    ans += factorization(i)
elif 6*(10**5) < N <= 8*(10**5):
  ans = 8075420
  for i in range(6*(10**5), N):
    ans += factorization(i)
elif 8*(10**5) < N <= 9*(10**5):
  ans = 10997400
  for i in range(8*(10**5), N):
    ans += factorization(i)
else:
  ans = 12478098
  for i in range(9*(10**5), N):
    ans += factorization(i)
print(ans)