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: Runtime Error

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
s = [0,1]
for i in range(2,N):
    if i % 2 = 0:
        s.append(s[i//2]*2)
    else:
        s.append(num_divisors_trial_division(i))
print(sum(s))

Submission status: Runtime Error

Solution code:
N=int(input())
import sympy
count=0
for k in range(1,N):
    r=sympy.divisor_count(k)
    count=count+r
print(count)

Submission status: Runtime Error

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
s = [0,1]
for i in range(2,N):
    if i % 2 = 0:
        s.append(s[i//2]*2)
    else:
        num_divisors_trial_division(n)

Submission status: Runtime Error

Solution code:
N=int(input())
import sympy
count=0
for k in range(1,N):
    count=count+sympy.divisor_count(k)
print(count)

Submission status: Runtime Error

Solution code:

package main

import (
    "fmt"
    "bufio"  
    "os"  
    "strconv"  
    "strings"
    )
func StrStdin() string {  
    scanner := bufio.NewScanner(os.Stdin)  
    scanner.Scan()  
    return strings.TrimSpace(scanner.Text())  
}  

// 1つの符号付き整数値(64bit)入力  
// Exapmle:  
// ------------------  
// 1000000007  
// ------------------  
func Int64Stdin() int64 {  
    stringInput := StrStdin()  
    num, _ := strconv.ParseInt(strings.TrimSpace(stringInput), 10, 64)  
    return num  
}  

// 1つの符号なし整数値(64bit)入力  
// Exapmle:  
// ------------------  
// 1000000007  
// ------------------  
func Uint64Stdin() uint64 {  
    stringInput := StrStdin()  
    num, _ := strconv.ParseUint(strings.TrimSpace(stringInput), 10, 64)  
    return num  
}  

// 1つの符号付き浮動小数点数(64bit)の入力  
// Exapmle:  
// ------------------  
// 33.4  
// ------------------  
func Float64Stdin() float64 {  
    stringInput := StrStdin()  
    num, _ := strconv.ParseFloat(strings.TrimSpace(stringInput), 64)  
    return num  
}  

// 空白や空文字だけの値を除去したSplit  
func SplitWithoutEmpty(stringTargeted string, delim string) []string {  
    stringSplited := strings.Split(stringTargeted, delim)  
    strs := []string{}  

    for _, str := range stringSplited {  
        if str != "" {  
            strs = append(strs, str)  
        }  
    }  
    return strs  
}  

// 空白区切りで複数の文字列を1行で入力  
// Example:  
// --------------------  
// hoge fuga hage  
// --------------------  
func SliceStrsStdin(delim string) []string {  
    stringInput := StrStdin()  
    return SplitWithoutEmpty(stringInput, delim)  
}  

// 空白区切りで複数の符号付き整数値(64bit)を1行で入力  
// Example:  
// --------------------  
// 45 -100 23  
// --------------------  
func SliceInt64Stdin() []int64 {  
    stringSplited := SliceStrsStdin(" ")  

    int64Slice := []int64{}  

    for ni := range stringSplited {  
        num, _ := strconv.ParseInt(stringSplited[ni], 10, 64)  
        int64Slice = append(int64Slice, num)  
    }  

    return int64Slice  
}  

// 空白区切りで複数の符号なし整数値(64bit)を1行で入力  
// Example:  
// --------------------  
// 43 7 21  
// --------------------  
func SliceUint64Stdin() []uint64 {  
    stringSplited := SliceStrsStdin(" ")  

    uint64Slice := []uint64{}  

    for ni := range stringSplited {  
        num, _ := strconv.ParseUint(stringSplited[ni], 10, 64)  
        uint64Slice = append(uint64Slice, num)  
    }  

    return uint64Slice  
}  

// 空白区切りで複数の符号付き浮動小数点数(64bit)を入力  
// Example:  
// --------------------  
// 45.0 -62.1 11.7  
// --------------------  
func SliceFloat64Stdin() []float64 {  
    stringSplited := SliceStrsStdin(" ")  

    float64Slice := []float64{}  

    for ni := range stringSplited {  
        num, _ := strconv.ParseFloat(stringSplited[ni], 64)  
        float64Slice = append(float64Slice, num)  
    }  

    return float64Slice  
}  
func main() {
    var(a,b,c,x,N int)
    M := Int64Stdin()
    N = int(M)
    x=0
    for a=1;a<N;a++{
        for b=1;b<N;b++{
            for c=1;c<N;c++{
                if a*b+c==N{
                    x++
                }
        
            }
        }
    }
    fmt.Print(x)
}

Submission status: Runtime Error

Solution code:
import sympy
N=int(input())
s=0
for i in range(N-1,0,-1):
    s+=len(sympy.divisors(i))
print(s)

Submission status: Runtime Error

Solution code:
N = int(input())
import sympy
ans=0
for i in range(1,N):
    ans+=sympy.divisor_count(i)
print(ans)

Submission status: Runtime Error

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 * b + c = n 
# a * b - n = c

cnt = 0

import sympy
for i in range(1, n):
  cnt += len(make_divisors(n - i))
print(cnt)

Submission status: Runtime Error

Solution code:
import sympy


def couples(num: int) -> int:
    count = 0
    for i in range(num - 1):
        _sub = i + 1
        yakusus = sympy.divisors(num - _sub)
        count += len(yakusus)

    return count


def main():
    num = int(input())
    print(couples(num))


if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sympy

n = int(input())

sum_v = 0
for i in range(1, n):
    v = (n - 1) // i
    sum_v += v

print(sum_v)

Submission status: Runtime Error

Solution code:
import sympy

def main():
    n = int(input())
    result = 0
    for c in range(1, n):
        divs = len(sympy.divisors(n-c))
        result += divs
    print(result)

    
if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
N=int(input())
total=0
import sympy
for i in range(1,N):
  total=total+sympy.divisor_count(i)
print (total)

Submission status: Runtime Error

Solution code:
n = int(input())
flag = True
count = 0
for i in range(1, n):
    for j in range(1, n):
        c = n-i*j
        if c <= 0:
            break
        elif isinstance(c, int):
            cnt += 1
print(count)

Submission status: Runtime Error

Solution code:
n = int(input())
A = True
count = 0
for i in range(1, n):
    for j in range(1, n):
        c = n-i*j
        if c <= 0:
            break
        elif isinstance(c, int):
            cnt += 1
print(count)

Submission status: Runtime Error

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

import sympy

N = int(input())

total = 0
for i in range(1,N):
    total += len(sympy.divisors(i))

print(total)

Submission status: Runtime Error

Solution code:
import sympy
N = int(input())
count = 0
for i in range(1,N):
    count += len(sympy.divisors(N-i))
print(count)

Submission status: Runtime Error

Solution code:
import sys, re
import math
import numpy as np
from decimal import Decimal
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul	# 
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd	# 最大公約数
from heapq import heappush, heappop

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.maxsize = 10 ** 15
sys.setrecursionlimit(10 ** 9 + 7)
INF = float('inf')
MOD = 10 ** 9 + 7

# -*- coding: utf-8 -*-

n = INT()

def A(a, count):
    if a > n:
        print(count)
    else:
        if n % a == 0:
            A(a + 1, count + n // a - 1)
        else:
            A(a + 1, count + n // a)
        

A(1, 0)

Submission status: Runtime Error

Solution code:
from scipy.special import comb

N = int(input())
print(sum([comb(len(factorize(N-C)) + 1, 2, exact=True) for C in range(1, N)]) + 2)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sympy

N = int(input())

ans = 0
for i in range(N-1):
    ans += len(sympy.divisors(i+1))
print(ans)

Submission status: Runtime Error

Solution code:
import sympy

N = int(input())

ans = 0
for i in range(N-1):
    ans += sympy.divisor_count(i+1)
print(ans)

Submission status: Runtime Error

Solution code:
import sympy
N = int(input())
ans = 0
for i in range(1, N):
    Q = N - i
    ans += sympy.divisor_count(Q)
print(ans)

Submission status: Runtime Error

Solution code:
N=int(input())
from sympy import divisor_count
c=1
summ=0
for c in range(1,N):
    a=divisor_count(c)
    summ+=a
    c+=1
print(summ)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
import sympy

n=int(input())
ans=0
for c in range(1,n):
    ab=n-c
    buffer=sympy.divisors(ab)
    ans+=len(buffer)
print(ans)

Submission status: Runtime Error

Solution code:
import sympy

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)


print(ans)

Submission status: Runtime Error

Solution code:
use std::fmt::Debug;
use std::str::FromStr;

pub struct TokenReader {
    reader: std::io::Stdin,
    tokens: Vec<String>,
    index: usize,
}

impl TokenReader {
    pub fn new() -> Self {
        Self {
            reader: std::io::stdin(),
            tokens: Vec::new(),
            index: 0,
        }
    }

    pub fn next<T>(&mut self) -> T
    where
        T: FromStr,
        T::Err: Debug,
    {
        if self.index >= self.tokens.len() {
            self.load_next_line();
        }
        self.index += 1;
        self.tokens[self.index - 1].parse().unwrap()
    }

    pub fn vector<T>(&mut self) -> Vec<T>
    where
        T: FromStr,
        T::Err: Debug,
    {
        if self.index >= self.tokens.len() {
            self.load_next_line();
        }
        self.index = self.tokens.len();
        self.tokens.iter().map(|tok| tok.parse().unwrap()).collect()
    }

    pub fn load_next_line(&mut self) {
        let mut line = String::new();
        self.reader.read_line(&mut line).unwrap();

        self.tokens = line
            .split_whitespace()
            .map(String::from)
            .collect();
        self.index = 0;
    }
}

fn divisors(mut n: i64) -> i64 {
    let mut div = 1;
    let mut fac = 2;

    while fac * fac <= n {
        let mut pow = 0;
        while n % fac == 0 {
            n /= fac;
            pow += 1;
        }

        div *= pow + 1;
        fac += 1;
    }
    if n > 1 {
        div *= 2;
    }

    div
}

fn solve(n: i64) -> i64 {
    let mut res = 0;
    for i in 1..n {
        res += divisors(n - i);
    }
    res
}

fn main() {
    let mut reader = TokenReader::new();
    let n = reader.next();

    let res = solve(n);
    println!("{}", res);
}

Submission status: Runtime Error

Solution code:
N = input()
setN = 0
setN2 = 0
for c in range(1, N+1):
    for a in range(1, N-c+1):
        for b in range(1, a+1):
            if a * b == N - c:
                if a == b:
                    setN += 1
                else:
                    setN += 2

print(setN)

Submission status: Runtime Error

Solution code:
from itertools import product
n = input()
n = int(n)

mylist = list(range(1,n+1))
# print(mylist)
perm = [p for p in product(mylist, repeat=n)]
# print(list(perm))

count =0

for x in list(perm):
    # print(str(x[0])+ 'x'+ str(x[1]) + '+' +str(x[2]) + str(x[0] * x[1] +x[2]))
    if x[0] * x[1] +x[2] == n:
        count += 1
print(count)

Submission status: Runtime Error

Solution code:
import sympy

n = int(input())
ans = 0
for i in range(1, n+1):
    tmp = sympy.divisors(n-i)
    ans += len(tmp)
print(ans)

Submission status: Runtime Error

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

for c in range(1,n):
    ab = n - c
    ans += sympy.divisor_count(ab)
        
print(ans)

Submission status: Runtime Error

Solution code:
import sympy
N=int(input())
total=0
for i in range(1,N):
  total=total+sympy.divisor_count(i)
print (total)

Submission status: Runtime Error

Solution code:
import sympy



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

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

    print(dp[-1])


if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

N = int(input())

table = [0] * (N+5)

for i in range(1, N+2):
    for j in range(i, N+2, i):
        table[j] += 1
ans = 0
for i in range(N):
    ans += table[i]

print(ans)

Submission status: Runtime Error

Solution code:
import sympy

N = int(input())

a = 1
b = 1
c = 1

count = 0

for c in range(1, N):
    count += len(sympy.divisors(c))

print(count)

Submission status: Runtime Error

Solution code:
import sympy
n=int(input())
ans=1
for i in range(2,n):
    ans+=sympy.divisor_count(i)
print(ans)

Submission status: Runtime Error

Solution code:
import sympy
n = int(input())
ans = 0
for i in range(1,n):
    ans  += len(sympy.divisors(n-i))
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
# a * b + c = n 
# a * b - n = c
cnt = 0
import sympy
for i in range(1, n):
  # print(sympy.divisors(n - i))
  cnt += len(sympy.divisors(n - i))
print(cnt)

Submission status: Runtime Error

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: Runtime Error

Solution code:
import sympy
N = int(input())
count = 0
for i in range(0,N):
    count = count + sympy.divisor_count(i)
print(count)

Submission status: Runtime Error

Solution code:
import sympy
n=int(input())
ans=0
for i in range(1,n):
    a=n-i
    b=sympy.divisor_count(a)
    ans+=b
print(ans)

Submission status: Runtime Error

Solution code:
import sympy
N=int(input())
count=0
for i in range(1,N):
  count=count+sympy.divisor_count(i)
print (count)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
import sympy

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

Submission status: Runtime Error

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

print(count)

Submission status: Runtime Error

Solution code:
N = int(input())

import sympy as sy

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

print(kotae)

Submission status: Runtime Error

Solution code:
from collections import defaultdict

import math

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

@lru_cache(None)
def prime_factorization_1(num):
    if num <= 1:
        return False
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(num_sqrt)

        dict_counter = defaultdict(int)
        for prime in prime_list:
            while num % prime == 0:
                dict_counter[prime] += 1
                num //= prime
        if num != 1:
            dict_counter[num] += 1

        dict_counter = dict(dict_counter)

        return dict_counter
def search_divisor_num_2(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        divisor_num = 1
        dict_fact = prime_factorization_1(num)
        for value in dict_fact.values():
            divisor_num *= (value + 1)
        return divisor_num
    
N=int(input())
cnt=0
for i in range(1,N):
    cnt += search_divisor_num_2(N-i)
    
print(cnt)

Submission status: Runtime Error

Solution code:
N = int(input_[0])

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

Submission status: Runtime Error

Solution code:
import sympy
N=int(input())
count=0
for i in range(1,N)
  count=count+sympy.divisor_count(i)
print (count)

Submission status: Runtime Error

Solution code:
%%time
N = int(input())

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

Submission status: Runtime Error

Solution code:
import sympy,math

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

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

print(ttl)

Submission status: Runtime Error

Solution code:


if __name__ == '__main__':
    n = int(input())

    if n < 3:
        print(0)
    else:
        count = 1
        n2=n-1
        for i in range(1,n2):
            count+=n2//i

    print(count)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
N = int(input())
count = 0
for i in range(1, N):
    AB_product = N - i
    count += count_divisors(AB_product)

print(count)

Submission status: Runtime Error

Solution code:
num=int(input())
a=0
import sympy

for i in range(1,num):
    temp=sympy.divisors(i)
    a+=len(temp)
    
print(a)

Submission status: Runtime Error

Solution code:
N=int(input())
ans=1
def test(n):
    buf=0
    for i in range(1,n):
        if i**2 > n:
            break
        if i**2 == n:
            buf+=1
            break
        if n%i==0:
            buf+=2
    return buf

def ans(n):
    if n==2:
        return 1
    return test(n-1) + ans(n - 1)

print(ans(N))

Submission status: Runtime Error

Solution code:
import sympy

N = int(input())
cnt = 0

for c in range(1,N):
    k = len(sympy.divisors(N - c))
    cnt += k
print(cnt)

Submission status: Runtime Error

Solution code:
N=int(input())
import sympy
a=0
for i in range(1,N):
    a+=len(sympy.divisors(i))
print(a)

Submission status: Runtime Error

Solution code:
N = int(input())

import sympy as sy

kotae = 0
for C in range(1, N):
    sa = N - C
    if sa == 1:
        kotae += 1
    else:
        kotae += sy.divisor_count(sa)

print(kotae)

Submission status: Runtime Error

Solution code:
import sympy

N=int(input())
count=0
for i in range(1,N):
    count+=len(sympy.divisors(i))
    
print(count)

Submission status: Runtime Error

Solution code:
import sympy

def main():
    n = int(input())
    res = 0
    for c in range(1,n):
        ab = n - c
        res += sympy.divisor_count(ab)
    print(res)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
n=input()
c=0
for i in range(n):
    for j in range(n-2):
        for k in range(n-3):
            if(i*j+k==n):
                c+=1
print(c)

Submission status: Runtime Error

Solution code:
n = int(input())
import sympy
ans = 0
for i in range(1,n):
    ans += sympy.divisor_count(i)
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sympy
n = int(input())
cnt = 0
for i in range(1, n):
    cnt+=len(sympy.divisors(n-i))
print(cnt)

Submission status: Runtime Error

Solution code:
n=int(input())
import sympy
ans=0
for i in range(1,n):
    ans+=len(sympy.divisors(i))
print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np
num=int(input())-1
m=np.outer([a+1 for a in range(num)],[a+1 for a in range(num)])
m=np.where(m<=num,1,0)
print(np.sum(m))

Submission status: Runtime Error

Solution code:
import sympy
n = int(input())
ans = 0
for i in range(1,n):
    ans += sympy.divisor_count(i)
print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np
num=int(input())-1
m=np.outer([a+1 for a in range(num)],[a+1 for a in range(num)])
print(m)
m=np.where(m<=num,1,0)
print(np.sum(m))

Submission status: Runtime Error

Solution code:
import sympy
N=int(input())
s=0
for i in range(1,N):
    x=N-i
    s+=len(sympy.divisors(x))
print(s)

Submission status: Runtime Error

Solution code:
import math
import collections
import bisect
from collections import deque
from copy import copy, deepcopy
import time

import numpy as np
import numba
from numba import njit, b1, i4, i8, f8
from numba import jit


def main():
    N = int(input())
    count=0
    ans=False
    for i in range(N):
        a,b = map(int,input().split())
        if a==b:
            count += 1
        else:
            count=0
        if count >=3:
            ans=True
    print("Yes" if ans else "No")

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def main():
    N = input()
    ans = 0
    for c in range(1, N):
        ans += solve(N-c)
    print(ans)

def solve(n):
    res = 0
    for i in range(1,n//2):
        if n % i == 0:
            res += 1
    return res

main()