Problem p02061 - Generation 3

Orig Description

B: Twice of oneself
Problem
You are given Q queries. For each query, you are given a positive integer N, and you need to find the number of positive integers M that satisfy the following two conditions:
2 \leq M \leq N
The sum of the proper divisors of M (i.e. the divisors of M other than M itself) is at least twice as large as M.
Input Format
The input is given in the following format:
Q
N_1
N_2
:
N_Q
The first line contains the number of queries, Q.
The following N lines contain one positive integer N per query.
Constraints
1 \leq Q \leq 10^5
2 \leq N_i \leq 10^5 (1 \leq i \leq Q)
Output Format
For each given N, output the number of positive integers M that satisfy the above two conditions, separated by a newline.
Sample Input
3
43
9
24
Sample Output
11
0
5
For N=24, the five possible values of M are 12, 16, 18, 20, and 24.

Extracted Specification

Canonicalized Input Description:

An integer Q (1 ≤ Q ≤ 10^5), representing some quantity or size.
Q positive integers, where each integer is between 2 and 10^5.

### Example Input:

```
3
43
9
24
```

### Function Signature:
Write a function f(inputs) that takes in the input.
```python
def f(inputs: List[int]):
    ''' 
    inputs: a list of integers 
    '''
```

Test Case Generator

Sure! Here is a test case generator for the problem "Twice of oneself".

```python
import random

def tcgen():
    Q = random.randint(1, 10**5)
    
    # Generate Q integers N, each in the range [2, 10^5]
    N_list = [random.randint(2, 10**5) for _ in range(Q)]
    
    return Q, N_list

# Example usage:
Q, N_list = tcgen()
print(Q)
for N in N_list:
    print(N)
```

This function generates a random number of queries \( Q \) within the constraints and then generates \( Q \) integers \( N \), each within the specified range. You can use this function to produce input test cases for your problem.

For example, this might output:
```
3
43
9
24
```

Which corresponds to the sample input provided in the problem statement.

Extract Arguments

def extract_arguments(fh):
    Q = int(fh.readline().strip())
    queries = [int(fh.readline().strip()) for _ in range(Q)]
    return Q, queries