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:


if __name__ == "__main__":

    n = int(input())
    result = 0

    for a in range(1,n):
        for b in reversed(range(1,n)):
            if a > b:
                continue
            if a * b > n:
                continue

            for c in range(1,n):
                if a * b + c == n:
                    if a == b:
                        result = result + 1
                    else:
                        result = result + 2

    print(result)

Submission status: Time Limit Exceeded

Solution code:
import math

N=int(input())

s=[0] * (N+1)

mlt=[[] for i in range(N+1)]
for i in range(1,N+1):
    for j in range(1,int(N/i)+1):
        mlt[i*j].append(i)

# print(mlt[N])
# exit(0)

def combi(n):
    if n == 1:
        return 1

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

def combi2(n):
    return len(mlt[n])

for i in range(2,N+1):
    # s[i]=s[i-1]+combi(i-1)
    s[i]=s[i-1]+combi2(i-1)

print(s[N])

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

Submission status: Time Limit Exceeded

Solution code:
import sys
import math


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


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


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


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

    
if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans = 0

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

for i in range(N):
    num = len(make_divisors(i))
    ans += num
    


print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
b = 0
"""def div(n):
    for k in range(2,n+1):
        if n % k == 0:
            return k
    return 1

def pf(n):
    pf=[]
    while n != 1:
        pf.append(div(n))
        n = n // div(n)
    #p = list(set(pf))
    return pf"""

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):
    m = n - c #mの約数を数える
    b += len(make_divisors(m))
    """insu2 = list(set(insu))
    l = len(insu2)
    d = 1
    for j in range(l):
        k = insu.count(insu2[j]) + 1
        d = k * d
    b += d"""

print(b)

Submission status: Time Limit Exceeded

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

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 - i + 1):
        if i * j >= N:
            break
        else:
            ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(input())

def find(a):
  c = 0
  for i in range(1, int(math.sqrt(a))+1):
    if a % i == 0:
      c += 2
  if math.sqrt(a).is_integer():
    c -= 1
  return c

count = 0
for i in range(1, n):
  count += find(i)

print(count)

Submission status: Time Limit Exceeded

Solution code:
import math
def num_divisors_trial_division(n):
  num = 0
  for i in xrange(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:
N = int(input())
ans = 1
for c in range(1,N-1):
  ab = N-c
  ans += 2
  for a in range(2, int(ab**.5)+1):
    if ab % a == 0: ans += 2
    if a**2 == ab: ans -= 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(i,n-i+1):
        if i*j<n and i==j:
            cnt+=1
        elif i*j<n:
            cnt+=2
        else:
            pass

print(cnt)

Submission status: Time Limit Exceeded

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

N = int(input())

total = 0
for m in range(1,N):
    sub = 1

    tmp = m
    for i in range(2, int(-(-m**0.5//1))+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            sub *= (cnt + 1)

    if tmp != 1:
        sub *= 2

    total += sub

print(total)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

ans = 0

a, b = 1, 1
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:
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
n = int(input())
for c in range(1, n):
    count += len(make_divisors(n-c))

print(count)

Submission status: Time Limit Exceeded

Solution code:
def number_factors(x):
  result=0
  for i in range(1, x + 1):
    if x % i == 0:
      result+=1
  return result
N= int(input())
count=0
for C in range(N-1,0,-1):
  x=N-C
  no_factors=number_factors(x)
  if no_factors==1:
    count+=1
  else:
    count+=no_factors
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())
summ = 0
for i in range(1, N):
    temp = num_divisors_trial_division(i)
#    print(temp)
    summ += temp

print(summ)

Submission status: Time Limit Exceeded

Solution code:
# cording:utf-8

# Nを入力
N = int(input())

cnt = 0

for i in range(1, N+1):
    # Aがiの時
    A = i

    for j in range(1, N+1):
        # Bがjの時
        B = j

        for k in range(1, N+1):
            # Cがkの時
            C = k

            # 計算結果がNだったら
            if (A * B + C) == N:
                cnt = cnt + 1

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
from itertools import product
n = int(input())
count = 0
for i,j,k in product(range(1,n), range(1,n), range(1,n)):
  if(i*j+k) == n:
    count += 1
    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) ) + 1):
        if n % i == 0:
            num += 1
            if n != i**2:
                num += 1
    return num
N=int(input())
count=0
for i in range(1,N):
  count+=num_divisors_trial_division(i)
print(count)

Submission status: Time Limit Exceeded

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

MAXN = 1000001

spf = [0 for i in range(MAXN)]



def sieve():
    spf[1] = 1
    for i in range(2, MAXN):

        
        spf[i] = i

    for i in range(4, MAXN, 2):
        spf[i] = 2

    for i in range(3, mt.ceil(mt.sqrt(MAXN))):

        if (spf[i] == i):

            for j in range(i * i, MAXN, i):

                if (spf[j] == j):
                    spf[j] = i



def getFactorization(x):
    ret = [0]*(x+1)
    while (x != 1):
        ret[spf[x]]+=1
        x = x // spf[x]

    return ret

sieve()
x = int(input())
ans = 0
for i in range(1,x):
    p = getFactorization(x-i)
    sumi=1
    for i in range(len(p)):
        sumi*=(1+p[i])
    ans+=sumi
print(ans)

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt as sq
n=int(input())
c=0
for i in range(1,n):
    s=set()
    k=n-i
    for i in range(1,int(sq(n))+1):
        if k%i==0:
            s.add(i)
            s.add(k//i)
    c+=(len(s))
print(c)

Submission status: Time Limit Exceeded

Solution code:
import math
from math import gcd,pi,sqrt
INF = float("inf")
MOD = 10**9 + 7

import sys
sys.setrecursionlimit(10**6)
import itertools
import bisect
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


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

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

if __name__=="__main__":
    main()

Submission status: Time Limit Exceeded

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

n=int(input())
res=0

for i in range(1,n):
    res+=aaa(n-i)
print(res)

Submission status: Time Limit Exceeded

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

for c in range (1,n):
    ab = n-c
    cnt = 1
    table = []
    while cnt * cnt <= ab:
        if ab%cnt ==0:
            table.append(cnt)
            table.append(ab//cnt)
        cnt += 1
    ans += len(set(table))
print(ans)

Submission status: Time Limit Exceeded

Solution code:
#ABC179-c

import sys,math,collections,itertools
input = sys.stdin.readline

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""

def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

N = int(input())
cnt = 0
for c in range(1,N-1):
    arr = factorize(N-c)
    tmp = 1
    for ar in arr:
        tmp *= (ar[1]+1)
    cnt += tmp
cnt +=1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
count = 0
C = 1
while N > C:
    M = N - C
    A = 1
    while M // A > 0:
        if M % A == 0:
            count += 1
        A += 1
    A = 0
    C += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ans=0
for i in range(1,N):
    p = 0
    k = 1
    while k*k <= i:
        if i % k == 0:
            p+=1
            if k != i // k:
                p+=1
        k += 1
    ans+=p
print(ans)

Submission status: Time Limit Exceeded

Solution code:
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
import collections
_counter= 0
_n = int(input())
for _i in range(1, _n):
  _x = _n - _i
  _c = collections.Counter(prime_factorize(_x))
  _prime_list = list(_c.values())
  _mini_counter = 1
  for _j in range(len(_prime_list)):
    _mini_counter *= (_prime_list[_j] + 1)
  _counter += _mini_counter
print(_counter)

Submission status: Time Limit Exceeded

Solution code:

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

    for e in range(1,int(n/i)+1):
        if i*e<n:
            #print(i,e)
            ans+=1
print(ans)

Submission status: Time Limit Exceeded

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


ans = 0
for i in range(1, N):
    ans += len(make_divisors(i))

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans = 0
for C in range(1, N):
    k = N - C
    for A in range(1, k+1):
        if k % A == 0:
            ans += 1

print(ans)

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

import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

ans=0

for i in range(1,N):
  if is_prime(N-i)==True:
    ans+=2
  else:
    ans+=num_divisors_trial_division(N-i)

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math

n = int(input())

def find(a):
  c = 0
  for i in range(1, a+1):
    if a % i == 0:
      c += 1
  return c

count = 0
for i in range(1, n):
  count += find(i)

print(count)

Submission status: Time Limit Exceeded

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

def divisor_count(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

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

Submission status: Time Limit Exceeded

Solution code:
import collections

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


N = int(input())
if(N==2):
    print(1)
    exit()
ans = [0 for i in range(N)]
for n in range(1, N):
    prime = collections.Counter(trial_division(n))
    product_sum=1
    for p in prime.values():
        product_sum*=(p+1)
    ans[n] = product_sum
# print(ans)
print(sum(ans)+1)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
p = int(input())
def Divisor(n):
  divs = []
  for i in range(1, int(n ** 0.5) + 1):
    if n % i == 0:
      divs.append(i)
      if i != n // i:
        divs.append(n // i)
  return(divs)
nsum = 0
for i in range(p):
  nsum += len(Divisor(i))
print(nsum)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
count = 1
for i in range(2, n):
    for j in range(1, i+1):
        if j**2 == i:
            count += 1
        elif i%j == 0:
            count += 1
print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict,deque
import math
def main():
    from collections import Counter
    def prime_factors2(n):
        i = 2
        b = Counter()
        while i * i <= n:
            if n % i:
                i += 1
            else:
                n //= i
                b[i] += 1
        if n > 1:
            b[n] += 1
        p = 1
        for i in b:
            p = p * (b[i] + 1)
        return p

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

# region fastio
BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    main()

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 a*b+c == N:
                count += 1

print(count)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

for i in range(1,int(n//2)+1):
    if i != n-i:
        ans += len(make_divisors(i))
        ans += len(make_divisors(n-i))
    if i == n-i:
        ans += len(make_divisors(i))
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
ans =0
for i in range(N-1):
  N = i+1
  
  for j in range(N):
    if N%(j+1) == 0:
      ans += 1

  
    
      
print(ans)

Submission status: Time Limit Exceeded

Solution code:
from numba import jit
N = int(input())
ans = 0

@jit
def num(n):
  num = 0
  for i in range(1,int(n**0.5)+1):
    if n%i==0:
      num+=1
      if n!=i**2:
        num+=1
  return num
  
for n in range(1,N):
  ans+=num(n)

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def get_divisor(n):
    ans = []
    i = 1
    while i*i <= n:
        if n % i == 0:
            ans.append(i)
            if n//i != i:
                ans.append(n//i)
        i += 1
    return sorted(ans)

ans = 0
for i in range(1, N):
    k = len(get_divisor(N - i))
    ans += k

print(ans)

Submission status: Time Limit Exceeded

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

print(counter)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

i=1
j=1
cal=0

while i*j<n:

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

    j=1
    i+=1

print(cal)

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

Submission status: Time Limit Exceeded

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

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

for i in range(1,N):
  total=total+divisor_count(i)
print (total)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def divisor(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)
    return len(divisors)


N = int(input())
count = 0

for c in range(1, N):
    count += divisor(c)

print(count)

Submission status: Time Limit Exceeded

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

for c in range(1,N):
    for b in range(1,N-c+1):
        ab=int(N-c)
        # print("ab:",ab)
        # print("b:",b)
        # print("ab/b:",ab/b)
        if(ab%b==0):
            sum+=1
            # print("ab%b",ab%b)
            # print("############")
        
print(sum)

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:
      break
    ans += 1

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
targetlist = [i+1 for i in range(n)]
cnt=0
import itertools
for i in itertools.product(targetlist,targetlist,targetlist):
    if (i[0]*i[1])+i[2] == n:
        cnt+=1
print(cnt)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import collections
n = int(input())
def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct
num = 0
for i in range(1,n):
    L = collections.Counter(factorize(i))
    a = 1
    for v in L.values():
        a = a * (v+1)
    num  += a
print(num)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

cnt = 1
L, M = [],[]
i = 1

for j in range(2, n):
    i = 1
    while i*i <= j:
        if j%i == 0 and i*i == j:
            cnt += 1
        elif j%i == 0 and i*i<j:
            cnt+=2
        i += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
b = 0
"""def div(n):
    for k in range(2,n+1):
        if n % k == 0:
            return k
    return 1

def pf(n):
    pf=[]
    while n != 1:
        pf.append(div(n))
        n = n // div(n)
    #p = list(set(pf))
    return pf"""

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):
    m = n - c #mの約数を数える
    insu = make_divisors(m)
    l = len(insu)
    b += l
    """insu2 = list(set(insu))
    l = len(insu2)
    d = 1
    for j in range(l):
        k = insu.count(insu2[j]) + 1
        d = k * d
    b += d"""

print(b)

Submission status: Time Limit Exceeded

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

cnt = 0
cnt2 = 0
for i in range(1, n):
    k = n-i
    for j in range(1, int(math.sqrt(k+1))+1):
        if k%j == 0:
            if j == math.sqrt(k):
                cnt2 += 1
            else:
                cnt += 1

print(int(cnt*2)+cnt2)

Submission status: Time Limit Exceeded

Solution code:
import math

ans = 0
N = int(input())

for n in range(1,N):
    for A in range(1,math.ceil(n**(1/2)+1)):
        if n % A == 0:
            B = n // A
            
            
            if A == B:
                ans += 1
            elif A < B:
                ans += 2

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
def make_divisors(n):
    divisors = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors+=1
            if i != n // i:
                divisors+=1
    return divisors
a=0
if N<=400000:
    for i in range(1,N):
        a+=make_divisors(i)
elif N<=600000:
    a=5221424
    for i in range(400000,N):
        a+=make_divisors(i)
elif N<=800000:
    a=8075420
    for i in range(600000,N):
        a+=make_divisors(i)
elif N<=900000:
    a=10997400
    for i in range(800000,N):
        a+=make_divisors(i)
else:
    a=12478098
    for i in range(900000,N):
        a+=make_divisors(i)
    
    
print(a)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

count = 0

for a in range(1, N):
    for b in range(1, N):
        tmp = a * b
        if tmp < N:
            count += 1
        else:
            continue

print(count)

Submission status: Time Limit Exceeded

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


nn=int(input())
ans=0

for i in range(nn-2):
    c=i+1
    kkk=collections.Counter(prime_factorize(nn-c))
    k1=kkk.keys()
    k2=list(kkk.values())
    #print(k2)
    ans1=1
    #print(k2)
    #if len(k2)>1:
     #    print(k2[0])

    for j in range(len(k2)):
        ans1=ans1*(k2[j]+1)

    #ans1=ans1*2

    ans=ans+ans1


ans=ans+1
print(ans)

Submission status: Time Limit Exceeded

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

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

ans = 0
for i in range(1, n):
    ans += num_divisors_trial_division(i)
    #print(i , ans)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
count = 0
for X in range(1,N):
  for i in range(1, int(X**0.5)+1):
    if X % i == 0:
      count += 1
      if i != X // i:
         count += 1
print(count)

Submission status: Time Limit Exceeded

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

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

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