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.
A list of integers N of size Q, where each integer is between 2 and 10^5.
### Example Input:
```
3
43
9
24
```
### Function Signature:
Write a function f(Q, N) that takes in the input.
```python
def f(Q: int, N: List[int]):
'''
Q: an integer
N: a list of integers
'''
```
Test Case Generator
Sure, I can help you write a test case generator for the given problem statement "Twice of oneself." The generator will create random test cases within the specified constraints. Here is the implementation in Python:
```python
import random
def generate_test_case():
Q = random.randint(1, 10**5) # Number of queries
queries = [random.randint(2, 10**5) for _ in range(Q)]
return Q, queries
def format_test_case(Q, queries):
result = [str(Q)]
result.extend(map(str, queries))
return '\n'.join(result)
# Example usage to generate and print a test case
Q, queries = generate_test_case()
test_case = format_test_case(Q, queries)
print(test_case)
```
### Explanation:
1. **generate_test_case Function:**
- **Q**: Randomly generates the number of queries between 1 and \(10^5\).
- **queries**: Generates a list of \(Q\) integers, each ranging from 2 to \(10^5\).
2. **format_test_case Function:**
- Converts the generated test case into the required input format as a string.
- The first line contains the number of queries \(Q\).
- The subsequent lines contain the \(Q\) integers.
### Example Output:
Running the example usage will print a test case, for instance:
```
5
25784
128
99999
2
45000
```
This output is consistent with the input format specified in the problem statement. You can use this generator to create multiple test cases for thorough testing of your solution.
Extract Arguments
def extract_arguments(fh):
Q = int(fh.readline().strip())
N = [int(fh.readline().strip()) for _ in range(Q)]
return Q, N