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:

from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
import sys
from sys import stdin, stdout
import bisect            #c++ upperbound
import math
import heapq
##import numpy as np
##i_m=9223372036854775807
def modinv(n,p):
    return pow(n,p-2,p)
def cin():
    return map(int,sin().split())
def ain():                           #takes array as input
    return list(map(int,sin().split()))
def sin():
    return input()
def inin():
    return int(input())
def msb(n):         #log2 for n <= 10**10
    n|=n>>1
    n|=n>>2
    n|=n>>4
    n|=n>>8
    n|=n>>16
    return n-(n>>1)
def GCD(x, y): 
    x=abs(x)
    y=abs(y)
    if(min(x,y)==0):
        return max(x,y)
    while(y): 
        x, y = y, x % y 
    return x
def pref(a,n):             #preSum array
    pre=[0]*n
    pre[0]=a[0]
    for i in range(1,n):
        pre[i]=a[i]+pre[i-1]
    return pre
##def Divisors(n) : #list of divisors
##    l = []  
##    for i in range(1, int(math.sqrt(n) + 1)) :
##        if (n % i == 0) : 
##            if (n // i == i) : 
##                l.append(i) 
##            else : 
##                l.append(i)
##                l.append(n//i)
##    return l
prime1=[]
def SieveOfEratosthenes(n): #list of primes upto n
    global prime1
    prime1 = [True for i in range(n+1)] 
    p = 2
    while (p * p <= n): 
        if (prime1[p] == True): 
            for i in range(p * p, n+1, p): 
                prime1[i] = False
        p += 1
    f=[]
    for p in range(2, n): 
        if prime1[p]: 
            f.append(p)
    return f
prime=[]
def Sieve(bo):
    global prime
    prime = [1 for i in range(bo)] 
    p = 2
    while (p<bo): 
        if (prime[p] == 1): 
            for i in range(p,bo, p): 
                prime[i] = p
        p += 1
    f=[]
    for p in range(2, n): 
        if prime[p]==1: 
            f.append(p)
    return f
vi=[0]*(200005)
adj=[[] for i in range(200005)]
def dfs(node,ans):
    vi[node]=1
    ans+=[node+1]
    for j in adj[node]:
        if(vi[j]==0):
            dfs(j,ans)
    return ans

# https://github.com/cheran-senthil/PyRival/blob/master/pyrival/misc/bootstrap.py
def bootstrap(f, stack=[]):   #write @bootstrap before recursive func
    def wrappedfunc(*args, **kwargs):
        if stack:
            return f(*args, **kwargs)
        else:
            to = f(*args, **kwargs)
            while True:
                if type(to) is GeneratorType:
                    stack.append(to)
                    to = next(to)
                else:
                    stack.pop()
                    if not stack:
                        break
                    to = stack[-1].send(to)
            return to
 
    return wrappedfunc
def Divisors(n) : #list of divisors
    c=0 
    for i in range(1, int(math.sqrt(n) + 1)) :
        if (n % i == 0) : 
            if (n // i == i) : 
                c+=1
            else :
                c+=2
    return c
"""*******************************************************"""
def main():
    for _ in range(1):
        n=inin();ans=0;l=1
        if(n==10**6):
            ans=13969985
            l=n
        elif(n>=10**6//2):
            l=1000000//2
            ans=6638407
        elif(n>=10**5):
            l=100000
            ans=1166714
        for i in range(l,n):
            f=0
    ##        sq=int(math.sqrt(i))
    ##        if(sq*sq==i):
    ##            f=1
            k=Divisors(i)
    ##        k=len(D)
    ##        t=k
    ##        print(ans,i,t,D)
            ans+=k
        print(ans)
    
  
##    dp = np.full(10**5+1, 10**18, dtype=np.int64)
    
######## Python 2 and 3 footer by Pajenegod and c1729
 
# Note because cf runs old PyPy3 version which doesn't have the sped up
# unicode strings, PyPy3 strings will many times be slower than pypy2.
# There is a way to get around this by using binary strings in PyPy3
# but its syntax is different which makes it kind of a mess to use.
 
# So on cf, use PyPy2 for best string performance.

py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange
 
import os, sys
from io import IOBase, BytesIO
 
BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0
 
    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None
 
    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s
 
    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()
 
    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)
 
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            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')
 
# Cout implemented in Python
import sys
class ostream:
    def __lshift__(self,a):
        sys.stdout.write(str(a))
        return self
cout = ostream()
endl = '\n'
 
# Read all remaining integers in stdin, type is given by optional argument, this is fast
def readnumbers(zero = 0):
    conv = ord if py2 else lambda x:x
    A = []; numb = zero; sign = 1; i = 0; s = sys.stdin.buffer.read()
    try:
        while True:
            if s[i] >= b'R' [0]:
                numb = 10 * numb + conv(s[i]) - 48
            elif s[i] == b'-' [0]: sign = -1
            elif s[i] != b'\r' [0]:
                A.append(sign*numb)
                numb = zero; sign = 1
            i += 1
    except:pass
    if s and s[-1] >= b'R' [0]:
        A.append(sign*numb)
    return A
 
# threading.Thread(target=main).start()
if __name__== "__main__":
  main()

Submission status: Time Limit Exceeded

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


N = int(input())

a = 1
b = 1
c = 1

count = 0

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

print(count)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N = int(input())
cnt = 0
for i in range(1,N):
    for j in range(1,N):
        if i * j >= N:
            break
        cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
from collections import Counter

def get_prime_factors(x):
    out = []
    if x < 1:
        return out
    while not x%2:
        out.append(2)
        x //= 2
    i = 3
    while i*i <= x:
        if not x%i:
            out.append(i)
            x //= i
        else:
            i += 2
    if x != 1:
        out.append(x)
    return out



def main():
    n = int(input())
    ans = 0
    
    for i in range(1, n):
        primes = get_prime_factors(i)
        num = 1
        for k, v in Counter(primes).items():
            num *= v+1
        ans += num
    print(ans)
        

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
ans=1
for x in range(3,N+1):
    tmp=x-1
    for i in range(1,int(tmp**0.5)+1):
        if tmp%i==0:
            ans+=2
            if tmp//i ==i:
                ans-=1

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

for i in range(2,n):
    l = factorization(i)
    p=1
    for j in range(len(l)):
        p *= (l[j][1]+1)
    ans +=p
print(ans)

Submission status: Time Limit Exceeded

Solution code:
z=int(input())
i=1
re=0
f=3
b=1
while z>i:
  b=1
  while True:
    x=i*b
    if z>x:
      re+=1
    else:
      break
    b+=1
  i+=1
print(re)

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,N):
    n = N - i
    m = len(make_divisors(n))
    ans += m
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]

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

print(count)

Submission status: Time Limit Exceeded

Solution code:
def abc179c():
    def divisor(n):
        """ nの約数列挙 """
        cnt = 0
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                cnt += 1
                if i ** 2 == n:
                    continue
                cnt+=1
        return cnt  # sortされていない
    n = int(input())
    cnt = 0
    for i in range(1, n):
        cnt += divisor(i)
    print(cnt)
abc179c()

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

        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:
n = int(input())
count = 0
for a in range(1,10 ** 6):
    for b in range(1,10 ** 6):
        if n - a*b >= 1:
            count += 1
        else:
            break
print(count)

Submission status: Time Limit Exceeded

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

for i in range(1,N+1):
  for j in range(1,(N+1)//i+1):
    if isinstance(i*j-N, int) and i*j-N<0:
      ans += 1
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
from collections import defaultdict
readline = stdin.readline
def i_input(): return int(readline().rstrip())
def i_map(): return map(int, readline().rstrip().split())
def i_list(): return list(i_map())


def main():
    N = i_input()
    d = defaultdict(lambda: 0)
    ans = 0
    for i in range(1, N):
        for j in range(i, N, i):
            d[j] += 1
    for c in range(1, N):
        ab = N - c
        ans += d[ab]
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

    divisors.sort()
    return divisors



n=int(input())
count=0
for c in range(1,n+1):
	ab=n-c
	tmp=len(make_divisors(ab))
	count+=tmp

print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans = 0
i = 1
while i < N:
    j = 1
    while i*j < N:
        ans += 1
        j += 1
    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())

a = 1
b = 1
c = 1

count = 0

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

print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

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

print(kotae)

Submission status: Time Limit Exceeded

Solution code:
import math

def divs(k):
    i=1
    cnt = 0
    hei = 0

    while i <= k**.5:
        if (k**.5).is_integer():
            hei = 1
        if k%i==0:
            cnt+=1
        i+=1
    if hei == 1:
        return cnt*2-1
    return cnt*2

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

# A * B + C = N

cnt = 0
for a in range(1, 10**6+1):
    for b in range(1, 10**6+1):
        for c in range(1, 10**6+1):
            if a * b + c > n:
                break
            if a * b + c == n:
                cnt += 1
        if a * b + 1 > n:
            break
    if a + 1 > n:
        break

print(cnt)

Submission status: Time Limit Exceeded

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

    divisors.sort()
    return divisors

nu=int(input())
total=0
for p in range(1,nu):
    num=nu-p
    total+=len(make_divisors(num))
print(total)

Submission status: Time Limit Exceeded

Solution code:
total = 0
N = int(input())
for i in range(N-1):
  n = i+2
  c = 1
  for k in range(n-c):
    a = k+1
    if (n-c) % a == 0:
      total += 1
print(total)

Submission status: Time Limit Exceeded

Solution code:
import math
from functools import lru_cache

N = int(input())

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

    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0
    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]

@lru_cache()
def search_divisor_num_1(num):
    if 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

ans = 0
for i in range(1, N):
    Q = N - i
    ans += search_divisor_num_1(Q)
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
def readInt():
    return int(input())
def readList():
    return list(map(int,input().split()))
def readMap():
	return map(int,input().split())
def readStr():
    return input()
inf=float('inf')
mod = 10**9+7
import math
from itertools import permutations
def solve(N):
    return sum(len(find_factors(i)) for i in range(1,N))

def find_factors(num):
    A=[]
    for i in range(1,num+1):
        if num%i==0:
            A.append(i)
    return A
N=readInt()
print(solve(N))

Submission status: Time Limit Exceeded

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

    def num_sum(p):
        N = p
        i = 2
        ans = dict()
        div_sum = 1
        n = N
        while i * i <= N:
            while n % i == 0:
                n = n // i
                if i in ans:
                    ans[i] += 1
                else:
                    ans[i] = 1
            i += 1
        if n != 1:
            ans[n] = 1

        ans_list = list(ans.items())
        for j in ans_list:
            div_sum *= j[1] + 1
        return div_sum
    # 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
    #
    # # print(factorization(400))
    # def num_sum(n):
    #     if n == 1:
    #         return 1
    #     fact = factorization(n)
    #     res = 1
    #     for f in fact:
    #         res *= f[1] + 1
    #     return res

    # print(num_sum(100))


    ans = 0
    for n in range(1, n_num):
        ans += num_sum(n)

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
ans=0
from  itertools import product
l1=[i for i in range(1,n+1)]
l2=[i for i in range(1,n+1)]
l3=[i for i in range(1,n+1)]
p=product(l1,l2,l3)
for a,b,c in p:
    if a*b+c==n:
        ans+=1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans = 0
import math
for c in range(1, N + 1):
  a_b = N - c

  for i in range(1, int(math.sqrt(a_b)) + 1):
    if a_b % i == 0:
      ans += 2
      if int(a_b / i) == i:
        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]

result = 0
N = int(input())
for C in range(1, N):
    n = N - C
    result += len(make_divisors(n))
print(result)

Submission status: Time Limit Exceeded

Solution code:

n = int(input())
cnt = 0
for i in range(1, n):
	c = i
	s = n - c
	for j in range(1, n):
		if(s%j == 0):
			cnt += 1
print(cnt)

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]


#print(len(make_divisors(8)))

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
c=1+(n-1-1)*2

for i in range(2,n):
    for j in range(2,n):
        if i*j>=n:
            continue
        for k in range(1,n):
            if i*j+k==n:
                c+=1

print(c)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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


n=k//2+1

ans_g=0
def cnt(l):
    ans=0
    for i in range(1,int(math.sqrt(l))+1):
        if l%i==0:
            if i==(l//i):
                ans+=1
            else:
                ans+=2
    return ans
        
 
    






for i in range(1,n):
    j=k-i
    if j!=i:
        ans_g+=cnt(j)
        ans_g+=cnt(i)
    else:
        ans_g+=cnt(i)
    
print(ans_g)

Submission status: Time Limit Exceeded

Solution code:
import math

n = 1000000 # 2부터 1,000까지의 모든 수에 대하여 소수 판별
array = [True for i in range(n + 1)] # 처음엔 모든 수가 소수(True)인 것으로 초기화
array[1] = False

# 에라토스테네스의 체 알고리즘 
for i in range(2, int(math.sqrt(n)) + 1): # 2부터 n의 제곱근까지의 모든 수를 확인하며
    if array[i] == True: # i가 소수인 경우 (남은 수인 경우)
        # i를 제외한 i의 모든 배수를 지우기
        j = 2 
        while i * j <= n:
            array[i * j] = False
            j += 1

''' Count all divisors of a number '''
def count_all_divisors_of_a_number(x):
    cnt = 0
    for i in range(1, int(math.sqrt(x)) + 1):
        if x % i == 0:
            cnt += 1
            if i * i != x:
                cnt += 1
    return cnt


cnt = 0
n = int(input())
for i in range(1, n):
    if array[i]:
        cnt += 2
    else:
        cnt += count_all_divisors_of_a_number(i)

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

count = 0
for A in range(1, N):
  for B in range (1, N):
    if (A*B) < N:
      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):
    for c in range(1,N):
      if a*b + c == N:
        x = x+1
print(x)

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

for c in range(1,n):
    m = n - c #mの約数を数える
    insu = pf(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())
z = 0
for a in range(N):
    for b in range(N):
        for c in range(N):
            if (a+1)*(b+1)+(c+1) == N:
                z = z+1
            else:
                pass
print(z)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
import math
count = 0
for C in range(1,N):
    NC = N-C
    NCP = math.sqrt(NC)
    NN = math.floor(NCP)
    for i in range(1,NN+1):
        
        if NC%i == 0:
            count += 2
            if i == NCP:
                count -=1
print(count)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
count=0
for i in range(1,n):
    wan=n//i
    for j in range(1,wan+1):
        charo=i*j
        if charo>=n:
            break
        else:
            count+=1
    else:
        continue
print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

ans =0

for i in range(1,N+1):
    x = (N+1)/i
    R= round(x, 0)
    for n in range(1,int(R)+1):
        if  i*n < N:
            ans +=1
print(ans)

Submission status: Time Limit Exceeded

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

for A in range(1,N+1):
	for B in range(1,N+1):
		if N != A*B:
			if N > A*B:
#				print('A:' + str(A) + "  B:" + str(B))
				j += 1
print(j)

Submission status: Time Limit Exceeded

Solution code:
c=int(input())
arr=[1 for i in range(c)]
arr[0]=0
for i in range(2,c+1):
    j=i
    while j<c:
        arr[j]+=1
        j+=i
print(sum(arr))

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input())
def make_prime_list_2(num):
    if num < 2:
        return []

    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0
    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 == 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

ans = 0
for i in range(1, N):
    Q = N - i
    ans += search_divisor_num_1(Q)
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

for c in range (1, N):
  t = N-c
  for a in range(1, int(t**0.5) +1):
    if t % a == 0:
      if t / a ==a:
        count += 1
      else:
        count += 2
print(count)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
# 入力
N = int(input())

count = 0

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

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):
    for c in range(1,n):
      if a*b+c == n:
        ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())

cnt = 0
for A in range(1,N):
    for B in range(1,N):
        if A * B <= N-1:
            cnt += 1
        else:
            break
print(cnt)

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
for i in range(1,N):
    a+=make_divisors(i)
print(a)

Submission status: Time Limit Exceeded

Solution code:
import math
N = int(input())
cnt = 0
for a in range(1,N):
  for b in range(1,math.ceil(N/a)):
    c = N - a * b
    if c <= 0:
      break
    else:
      # print("a,b :",end='')
      # print(a,b)
      # print("c :" + str(c))
      cnt += 1
print(cnt)

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 len(lower_divisors + upper_divisors[::-1])

kotae = 0
for C in range(1, N):
    sa = N - C
    kotae += make_divisors(sa)

print(kotae)

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:
            continue
print(count)

Submission status: Time Limit Exceeded

Solution code:
def countIntegralSolutions(n): 
  
    # Initialize result 
    result = 0
      
    # Consider all triplets and  
    # increment result whenever  
    # sum of a triplet is n. 
    for i in range(1,n + 1): 
        for j in range(1,n + 1): 
            for k in range(1,n + 1): 
                if i * j + k == n: 
                    result += 1
      
    return result
n=int(input())
print(countIntegralSolutions(n))

Submission status: Time Limit Exceeded

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

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 main():
    N = int(input())
    ans = 0
    for c in range(1, N):
        p = prime(N - c)
        tmp = 1
        for v in p.values():
            tmp *= (v + 1)
        ans += tmp
    return ans

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