P9009 [Beginner Contest #9] The Interconnected World (Hard Version)

Background

This is a **hack problem**. In this type of problem, you will be given several tasks and some code that claims to solve the corresponding tasks, but the provided code cannot produce the correct output for some inputs. Cases where it fails include: 1. Outputting a wrong result. 2. Timing out. 3. Causing some runtime undefined behavior. Currently, the only undefined behavior that can be detected by our system is out-of-bounds array access. For each task, you need to submit an input that meets the requirements such that the given code cannot produce the correct output. You may directly use the “Submit Answer” feature, or submit a data generator written in any language. --- **Hint: If you use the “Submit Answer” feature, remember to change the language back to the one you use when submitting other problems.**

Description

The following are the statements for three tasks: #### Task 1 Given $n$ integers, find the number of odd integers among them. #### Task 2 Determine whether $p$ is a prime number. #### Task 3 Given $n$ integers where the $i$-th one is $a_i$. Find the largest number $p$ such that the number of indices $i$ satisfying $a_i \ge p$ is at least $\left\lfloor \dfrac{n}{2} \right\rfloor$.

Input Format

#### Task 1 The input contains two lines. The first line is an integer representing the length of the sequence $n$. The second line contains $n$ integers separated by single spaces, representing $a_1, a_2, \dots, a_n$ in order. #### Task 2 The input contains one line with one integer $p$. #### Task 3 The input contains two lines. The first line is an integer representing the length of the sequence $n$. The second line contains $n$ integers separated by single spaces, representing $a_1, a_2, \dots, a_n$ in order.

Output Format

#### Task 1 Output one line with one integer representing the answer. #### Task 2 Output one line. If $p$ is prime, output `Yes`; otherwise output `No`. #### Task 3 Output one line with one integer representing the answer.

Explanation/Hint

### Notes on samples and actual input The three samples correspond to the sample input and output of the three tasks respectively. If you use the “Submit Answer” method, please name the three input files `1.in`, `2.in`, and `3.in`, and submit them as a zip archive. If you use the data generator method, your generator may read an integer $x$ from standard input, where $1 \leq x \leq 3$, indicating the task ID of the test point, and then **output the corresponding input data**. Obviously, your program should not read anything mentioned in the “Input Format” (instead, it should construct them), and it should not output anything mentioned in the “Sample Output” (it should output only the input data you constructed). You should not use the samples to test your program; they are only explanations of the samples for the three tasks. ### Constraints requirements The data you provide must satisfy the following requirements: 1. It must fully follow the “Input Format”. There must be no extra input, but trailing spaces at line ends and a final newline are allowed. 2. All numbers in the data must be integers. 3. For Task 1, $1 \leq n \leq 1000, -2 \times 10^9 \le a_i \le 2 \times 10^9$. 4. For Task 2, $1 \le p \le 10^{12}$. 5. For Task 3, $2 \leq n \leq 100$, $1 \leq a_i \leq 2 \times 10^9$. ### Target code You need to hack the following code: #### Task 1 ```cpp #include using namespace std; int main() { int n, ans = 0; cin >> n; for(int i = 1, x; i > x; if(x % 2 == 1) ++ans; } cout a[i]; int L = 1, R = 2000000000, ans; while(L