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
for c in range(1,n-1):
  d = {}
  x = n-c
  i = 2
  while i*i<=x:
    dx = x//i
    if dx*i == x:
      x = dx
      if i in d:
        d[i]+=1
      else:
        d[i]=2
      i = 1
    i+=1
  if x in d:
    d[x]=d[x]+1
  else:
    d[x]=2
  dl = list(d.values())
  cn = 1
  for i in dl:
    cn*=i
  count+=cn
print(count+1)

Submission status: Time Limit Exceeded

Solution code:
def main():
    N = int(input())
    N2 = 0
    ans = 0
    C = 1
    A = 0
    B = 0
    while(True):
        N2 = N - C
        A = 1
        while(True):
            if N2 % A == 0:
                ans += 1
            if A > N2:
                break
            else:
                A += 1
        C += 1
        if C >= N:
            break

    print(f'{ans}')

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

for i in range(1,n):
    for j in range(1,int(n)):
        if (n-i) % j ==0:
            cnt+=1
        # print ( f"ここは1回のみカウント：：Ｃは:{i},Aは:{j},Bは：{(n - i) / j}" )
        # print(f"Ｃは:{i},Aは:{j},Bは：{(n-i) / j}")
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def prime_factorize(n):
    a = {}
    tmp = True
    while n % 2 == 0:
        if tmp == True:
            a[2] = 0
            tmp = False
        a[2] += 1
        n //= 2
    f = 3
    tmp = True
    while f * f <= n:
        if n % f == 0:
            if tmp == True:
                a[f] = 0
                tmp = False
            a[f] += 1
            n //= f
            if n % f != 0:
                tmp = True
        else:
            f += 2
            tmp = True
    if n != 1:
        if tmp == True:
            a[n] = 0
        a[n] += 1
    return a

ans = 0
for C in range(1, N - 1):
    tmp = 1
    dic = prime_factorize(N-C)
    for key in dic.keys():
        tmp *= dic[key] + 1
    ans += tmp

ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import math

def prime(m):
    pf = {}
    for i in range(2,int(m**0.5)+1):
        while m%i==0:
            pf[i]=pf.get(i,0)+1
            m//=i
    if m>1:pf[m]=1
    return pf

def calc_tmpans(primes, tmpans, cnt, val):
    if len(primes) == 0:
        tmpans[val] = cnt
    else:
        (p, v) = primes[0]
        for i in range(v + 1):
            calc_tmpans(primes[1:], tmpans, cnt * (i + 1), val * (p ** i) )

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

    tmpans = [0]*(N+1)
    ans = 0
    for c in reversed(range(1, N)):
        if tmpans[N - c] != 0:
            ans += tmpans[N-c]
        else:
            p = prime(N - c)
            tmp = 1
            p_list = list(p.items())
            # for (k, v) in p_list:
            #     tmp *= (v + 1)
            calc_tmpans(p_list, tmpans, 1, 1)
            ans += tmp
    return sum(tmpans)

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

def count_pf(n):
  _count = 1
  for m in range(2, int(n**0.5) + 1):
    if n != 1:
      m_count = 0
      while n % m == 0:
        n = n // m
        m_count += 1
      if m_count != 0:
        _count *= (m_count + 1)
    else:
      break
  if n != 1:
    _count *= 2
  return _count

count = 0

for k in range(1, N):
  count += count_pf(N - k)
print(count)

Submission status: Time Limit Exceeded

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

for i in range(1,N):
  sub = N - i
  for j in range(1,sub+1):
    if sub%j == 0:
      list_a.append([j, int(sub/j)])
print(len(list_a))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

count = 0

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

minus = 0

for i in range(1, N):
    if i * i >= N:
        break
    minus += 1

print(count*2 - minus)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

def find(a):
  c = 0
  i=1
  while i * i < a:
    if a % i == 0:
        c += 2
    i += 1
  if i * i == a:
    c += 1
  return c

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

print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

cnt = 0
for r in range(1, n):
    a = r * (n - r)
    for i in range(a, 0, -r):
        if i < n:
            cnt += i // r
            break

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import math


def make_divisors(n):
    d = 0
    for i in range(1, int(math.sqrt(n)) + 1):
        if n % i != 0:
            continue
        if i * i == n:
            d += 1
        else:
            d += 2
    return d


def f(n):
    return sum(make_divisors(n - i) for i in range(1, n))


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

    return d

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


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import collections

N = int(input())
ans = 0

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

for c in range(1,N):
    p = prime_factorize(N-c)
    q = collections.Counter(p)
    a = 1
    for i in q.values():
        a *= i+1
    ans += a

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import itertools
N = int(input())
result = 0
for i in range(1,N):
    j = 1
    while j*i < N:
       A = i
       B = j
       C = N-i*j
       if C != 0:
           result += 1
       j += 1
print(result)

Submission status: Time Limit Exceeded

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

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 len(divisors)
n = int(input())
# A*B+C = N
counter = 0
for c in range(1, n-1//2):
    ans = n-c
    counter += make_divisors(ans)
print(counter)

Submission status: Time Limit Exceeded

Solution code:
import math

def prime(m):
    pf = {}
    for i in range(2,int(m**0.5)+1):
        while m%i==0:
            pf[i]=pf.get(i,0)+1
            m//=i
    if m>1:pf[m]=1
    return pf

def calc_tmpans(primes, tmpans, cnt, val):
    if len(primes) == 0:
        tmpans[val] = cnt
    else:
        (p, v) = primes[0]
        for i in range(v + 1):
            calc_tmpans(primes[1:], tmpans, cnt * (i + 1), val * (p ** i) )

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

    tmpans = [0]*(N+1)
    ans = 0
    for c in range(1, N):
        if tmpans[N - c] != 0:
            ans += tmpans[N-c]
        else:
            p = prime(N - c)
            tmp = 1
            p_list = list(p.items())
            # for (k, v) in p_list:
            #     tmp *= (v + 1)
            calc_tmpans(p_list, tmpans, 1, 1)
            ans += tmp
    return sum(tmpans)

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

Submission status: Time Limit Exceeded

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

import sys
import numpy as np

def main():
    n = int(input())
    a_numbers=np.arange(1,1001).reshape(1,1000)
    b_numbers=np.arange(1,1001).reshape(1,1000)
    t_a_numbers=a_numbers.T
    dp=np.dot(t_a_numbers,b_numbers)
    numbers=[]
    count=0
    for i in range(1,n):
        tmp=sum(np.count_nonzero(dp==n-i,axis=1))
        count+=tmp
        tmp=0
    print(count)

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
b = 0
for c in range(1,n):
    m = n - c
    for i in range(1,m+1):
        if m % i == 0:
            b += 1

print(b)

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 = 1
for c in range(1, N-1):
    answer = make_divisors(N - c)
    count += len(answer)
print(count)

Submission status: Time Limit Exceeded

Solution code:
import sys
import math

if __name__ == '__main__':
    N = int(sys.stdin.readline().rstrip())
    # N = 1000000
    # N = 100
    ans = 0

    for i in range(1, N+1):
        AB = N-i
        tmp = 0
        # for j in range(1, math.ceil(math.log2(AB+1)+1)):
        # for j in range(1, int(math.sqrt(AB+1)+1)):
        # for j in range(1, int(math.sqrt(AB+1))):
        for j in range(1, AB+1):
            if AB % j == 0:
                if AB / j <= j:
                    tmp *= 2
                    if AB / j == j:
                        tmp += 1
                    break
                else:
                    tmp += 1
        ans += tmp
    print(ans)

# 3*33
# 1,99 3,33 9,11 11,9 33,3 99,1

Submission status: Time Limit Exceeded

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

cnt = 0
L = list(range(1, N))
for i in itertools.product(L, repeat=3):
    if (i[0]*i[1])+i[2] == N:
        cnt += 1

print(cnt)

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+1):
        c = N-a*b
        if c > 0 and a*b+c == N:
            ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
#import math
N = int(input())
N_C = []
ans = 0

for i in range(1,N):
    N_C.append(N-i)
#print(N_C)

for i in N_C:
    for j in range(1,i+i):
        k=i//j
        if j*k == i:
            ans +=1

print(ans)

Submission status: Time Limit Exceeded

Solution code:

n = int(input())
count = 0
  
for c in range(n):
  r = n -c -1
  if r == 0:
    break
  for i in range(r):
    if r % (i+1) == 0:
      count += 1

  

print(count)

Submission status: Time Limit Exceeded

Solution code:
import math as mt
t=int(input())
ct=1
for i in range(2,t):
    x=mt.sqrt(i)
    y=int(x)
    ##print(y)
    for j in range(1,y+1):
        if(i%j==0):
            ##print(j)
            z=mt.sqrt(i)
            if(j==z):
                ct=ct+1
            else:
                ct=ct+2
print(ct)

Submission status: Time Limit Exceeded

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

def divisor(n):
    i = 1
    res = set()
    while i * i <= n:
        if n % i == 0:
            res.add(i)
            res.add(n // i)
        i += 1
    return res


for c in range(1,n+1):
    k = n - c
    #print(k)
    if k >= 0:
        #print(divisor(k))
        l = len(divisor(k))
        cnt +=l

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
dic = {}
def factorize(n):
    m = n
    fct = 1
    b, e = 2, 0
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct *= (e + 1)
        if n in dic:
            fct *= dic[n]
            dic[m] = fct
            return fct
        b, e = b + 1, 0
    if n > 1:
        fct *= 2
        dic[m] = fct
    return fct
N=int(input())
ans=1
for AB in range(2, N-1+1):
    ans+=factorize(AB)
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, i+1):
        if (i % j) == 0:
            ans += 1
print(ans)

Submission status: Time Limit Exceeded

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

n=int(input())
print(sum(search_divisor_num_1(i) for i in range(1,n)))

Submission status: Time Limit Exceeded

Solution code:
def factorization(n):
    arr = []
    temp = n
    c = 1
    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])
            c = c * (cnt + 1)

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

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

    return c


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

Submission status: Time Limit Exceeded

Solution code:
from operator import mul
from functools import reduce

def main():
    def factorization(n):
        l = []
        tmp = n
        for i in range(2, int(-(-tmp**0.5//1))+1):
            if tmp%i == 0:
                cnt = 0
                while tmp%i == 0:
                    cnt += 1
                    tmp //= i
                l.append(cnt+1)
                i += 1
        if tmp != 1:
            l.append(2)
        if l == []:
            if n != 1:
                l.append(2)
        if n == 1:
            l = [2]
        return l

    n = int(input())
    cnt = 0
    i = n
    for i in range(1, n):
        div = factorization(n-i)
        pattern = reduce(mul, div)
        cnt += pattern
    print(cnt-1) 
    
if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import math



def make_seki(n):
    a = 0
    i, j = 0, 0
    for i in range(1, int(math.sqrt(n))+1, 1):
        if n % i == 0:
            a = a+1

    
    if int(math.sqrt(n))*int(math.sqrt(n))==n:
        return a*2-1
    else:
        return a*2
        
        
from collections import defaultdict    

n=int(input())
p=0

for i in range(1, n):
    a = n-(i)
    p = p+ (make_seki(a))
    
print(p)

Submission status: Time Limit Exceeded

Solution code:
def get_divisors(n):
    if n < 1:
        return
    i = 1
    while i * i <= n:
        if n % i == 0:
            yield i
            if i * i != n:
                yield round(n / i)
        i = i + 1
n = int(input())
cnt = 0
for i in range(1, n):
    cnt += len(list(get_divisors(n-i)))
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

DICT = {}
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n in DICT:
            a.extend(DICT[n])
            n = 1
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


N = int(input())

import math

all_v = 0
for i in range(1, N):
    if i == 1:
        all_v += 1
        continue
    rets = prime_factorize(i)
    DICT[i] = rets
    d = {}
    for ret in rets:
        if ret not in d:
            d[ret] = 1
        else:
            d[ret] += 1

    total = 1
    for k, v in d.items():
        total *= v + 1
    # print(f"i=={i}, total={total}")
    all_v += total
print(all_v)

Submission status: Time Limit Exceeded

Solution code:
from math import sqrt

n = int(input())
ans = 0

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N = int(input())
X_arr = np.empty(N - 1, dtype = int)
  
ans = 0
for c in range(1, N):
  X_arr[c - 1] = N - c

for b in range(1, N):  
  ans += np.count_nonzero(X_arr % b == 0)
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
count=0
for a in range(1,N):
  b=1
  if N//a==0:
    for b in range(1,N//a):
      c=N-a*b
      if c>0:
        count+=1
  else:
    for b in range(1,N//a+1):
      c=N-a*b
      if c>0:
        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]

N = int(input())
ans = 0
if N == 1000000:
  print("13969985")
else:
    for n in range(N-1):
        lis = make_divisors(n+1)
        ans += len(lis)
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
def make_divisors(n):
    lower_divisors , upper_divisors = [], []#ソートしなくても小さい順になる工夫
    i = 1
    while i*i <= n:#i**0.5での誤差が気になるらしい
        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
if n==1000000:
    print(13969985)
    exit()
for c in range(1,n):
           ans+=len(make_divisors(n-c))
print(ans)

Submission status: Time Limit Exceeded

Solution code:
num = int(input())
count = 0
for i in range(1,num+1):
  if i != num:
    for j in range(1,num+1):
      if j != num:
        for k in range(1,num+1):
          if k!= num:
            if i*j+k== num:
              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]
N = int(input())
count = 0
for C in range(1, N):
    AB = N - C
    count = count + len(make_divisors(AB))
print(count)

Submission status: Time Limit Exceeded

Solution code:
from math import *

N = int(input())

ans = 0

for AB in range(1, N):
   for i in range(1, int(sqrt(AB)) + 1):
      if AB % i == 0:
         if i ** 2 == AB:
            ans += 1
         else:
            ans += 2

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

count=0
for X in range(1, N):
    for A in range(1, X+1):
        B = X / A
        if not X % A:
            count+=1
            ##print(A,B,N-X)

print(count)

Submission status: Time Limit Exceeded

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

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

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

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

Submission status: Time Limit Exceeded

Solution code:
import math

N = int(input())
cnt = 0
if N == 2:
    cnt = 1
elif N == 3:
    cnt = 3
elif N > 3:
    cnt = 3
    for i in range(1,N-1):
        A = N-i
        rA = math.sqrt(A)
        intA = math.floor(rA)
        if rA == intA:
            cnt -= 1
        if intA == 1:
            cnt += 1
        else:
            for j in range(1,intA+1):
                if A%j == 0:
                    cnt += 2

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
import math
cnt=0
for c in range(1,N):
  if (N-c)%2==0:
    for a in range(1,N-c+1):
      if a%2==0:
        for b in range(a,math.floor((N-c)/a)+1):
          if a*b+c==N:
            if a!=b:
              cnt=cnt+2
            elif a==b:
              cnt=cnt+1
      if a%2==1:
        for b in range(a+1,math.floor((N-c)/a)+1,2):
          if a*b+c==N:
            if a!=b:
              cnt=cnt+2
            elif a==b:
              cnt=cnt+1
  else:
    for a in range(1,N-c+1,2):
      for b in range(a,math.floor((N-c)/a)+1,2):
        if a*b+c==N:
          if a!=b:
            cnt=cnt+2
          elif a==b:
            cnt=cnt+1
print(cnt)

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



nu=int(input())
total=0
for p in range(1,nu):
    s=collections.Counter(prime_factorize(p))
    sama=1
    for j in s.values():
        sama=sama*(j+1)
    total+=sama
print(total)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())

times=0

for A in range(1,N+1):
  #print("A is"+str(A))
  for B in range(1,N+1):
    #print("B is"+str(B))
    if A*B >= N:
      break
    else:
      #print(A*B)
      times+=1
      
print(times)

Submission status: Time Limit Exceeded

Solution code:
import collections

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(2, N):
    c = factorization(i)
    tmp = 1
    for val in c:
        tmp *= val[1]+1
    ans += tmp 

print(ans)

Submission status: Time Limit Exceeded

Solution code:
if __name__ == "__main__":
	N = int(input())
	counter = 0

	c = 1
	while N - c >= 1:
		i = 1
		while i <= N:
			j = 1
			while i * j <= N:
				if i * j + c== N:
					counter += 1
				j += 1
			i += 1
		c += 1
	print(counter)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
cnt=-N
for C in range(1,N+1):
    for B in range(1,N+1):
        if (N-C)%B==0:
            cnt+=1
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())
cnt = 0
for i in range(1, n):
  cnt += len(make_divisors(n - i))
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

N = int(input())
cnt = 0
for c in range(1, N):
    arr = factorization(N-c)
    if N-c == 1:
        cnt += 1
    else:
        a_num = 1
        for elem in arr:
            a_num = a_num * (elem[1]+1)
        cnt += a_num

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

print(count)

Submission status: Time Limit Exceeded

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

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

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

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

Submission status: Time Limit Exceeded

Solution code:
import math
n=int(input())
def divisor(n): 
    i = 1
    c=0
    table = []
    while i * i <= n:
        if n%i == 0:
            if i==n//i:
                c+=1
            else:
                c+=2
        i += 1
    return c
n=n-1
ans=0
while n>=1:
    ans+=divisor(n)
    n-=1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
#C

# 与えられた数字までの数字の約数をカウントする。
def make_divisors(n):
  if n > 810000:
    count = 2097609957714
    i = 900
    while i*i <= n:
        if n % i == 0:
            count += 1
            if i != n // i:
                count += 1
        i += 1
    return count
  elif n > 640000:
    count = 1305179488810
    i = 800
    while i*i <= n:
        if n % i == 0:
            count += 1
            if i != n // i:
                count += 1
        i += 1
    return count
  elif n > 360000:
    count = 4661355
    i = 600
    while i*i <= n:
        if n % i == 0:
            count += 1
            if i != n // i:
                count += 1
        i += 1
    return count
  else:
    count = 0
    i = 1
    while i*i <= n:
        if n % i == 0:
            count += 1
            if i != n // i:
                count += 1
        i += 1
    return count


N = int(input())
counter = 0
for i in range(1,N):
  counter += make_divisors(i)

print(counter)

Submission status: Time Limit Exceeded

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

import math


for c in range(1,N):
    for a in range(1,math.floor(math.sqrt(N-c))+1):
        if a*a == N-c:
            b = a
            ans.append(1)
        elif (N-c)%a == 0:
            b = (N-c)//a
            if b>0:
                ans.append(1)
                ans.append(1)            

print(len(ans))

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 19 21:51:17 2020

@author: naoki
"""
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 len(lower_divisors) + len(upper_divisors)
count = 0 
N = int(input())
for i in range(1,N):
    count+= make_divisors(N-i)

print(count)

Submission status: Time Limit Exceeded

Solution code:
def conbi_for_product(p):
    count =0
    i=1
    while i*i <= p:
        if int(p%i) == 0:
            count +=  2
        if int(i*i) == p:
            count -= 1
        i += 1
    return count

n = int(input())
ans = 0
for i in range(n):
    ans += conbi_for_product(i)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
count = 0
for X in range(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())
cnt = 0
for a in range(1, N):
    for b in range(a, N):
        if a * b < N:
            if a == b:
                cnt += 1
            if a != b:
                cnt += 2
print(cnt)

Submission status: Time Limit Exceeded

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

def main():
    N = int(input())
    count = 1
    for i in range(3,N+1):
        count += dcount(i-1)
    print(count)

main()

Submission status: Time Limit Exceeded

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

    count = 0
    for i in range(1,n):
        rest = n - i
        for j in range(1, rest+1):
            if rest % j == 0:
                count = count + 1
    print(count)
main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
count = 0
for C in range(1,N):
    R = N - C
    sqrtR = R**(1/2)
    countAB = 0
    # print(R)
    if sqrtR.is_integer():
        for A in range(1,int(sqrtR)+1):
            if R%A == 0:
                # print(A,'t')
                countAB += 1
        count += countAB*2 -1
    else :
        for A in range(1,int(sqrtR)+1):
            if R%A == 0:
                # print(A,'f')
                countAB += 1
        count += countAB*2

print(count)