apaz/codeforces-genesys huggingface dataset:
You are an expert competitive programmer. You will be given a problem statement, test case constraints and example test inputs and outputs. Please reason step by step about the solution (that must respect memory and time limits), then provide a complete implementation in python3.

Your solution must read input from standard input (cin), write output to standard output (cout).
Do not include any debug prints or additional output.

Put your final solution within a single code block:
```python
<your code here>
```

Execution time limit: 1.0 seconds
Memory limit: 256.0 MB

# Problem
You are given three digits $$$a$$$, $$$b$$$, $$$c$$$. Two of them are equal, but the third one is different from the other two.

Find the value that occurs exactly once.

## Input Format
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 270$$$) — the number of test cases.

The only line of each test case contains three digits $$$a$$$, $$$b$$$, $$$c$$$ ($$$0 \leq a$$$, $$$b$$$, $$$c \leq 9$$$). Two of the digits are equal, but the third one is different from the other two.

## Output Format
For each test case, output the value that occurs exactly once.

## Examples
```input
10
1 2 2
4 3 4
5 5 6
7 8 8
9 0 9
3 6 3
2 8 2
5 7 7
7 7 5
5 7 5
```
```output
1
3
6
7
0
6
8
5
5
7
```

Now solve the problem and return the code.
You are an expert competitive programmer. You will be given a problem statement, test case constraints and example test inputs and outputs. Please reason step by step about the solution (that must respect memory and time limits), then provide a complete implementation in python3.

Your solution must read input from standard input (cin), write output to standard output (cout).
Do not include any debug prints or additional output.

Put your final solution within a single code block:
```python
<your code here>
```

Execution time limit: 1.0 seconds
Memory limit: 256.0 MB

# Problem
A Latin square is a $$$3 \times 3$$$ grid made up of the letters $$$\texttt{A}$$$, $$$\texttt{B}$$$, and $$$\texttt{C}$$$ such that:

- in each row, the letters $$$\texttt{A}$$$, $$$\texttt{B}$$$, and $$$\texttt{C}$$$ each appear once, and
- in each column, the letters $$$\texttt{A}$$$, $$$\texttt{B}$$$, and $$$\texttt{C}$$$ each appear once.

You are given a Latin square, but one of the letters was replaced with a question mark $$$\texttt{?}$$$. Find the letter that was replaced.

## Input Format
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 108$$$) — the number of testcases.

Each test case contains three lines, each consisting of three characters, representing the Latin square. Each character is one of $$$\texttt{A}$$$, $$$\texttt{B}$$$, $$$\texttt{C}$$$, or $$$\texttt{?}$$$.

Each test case is a Latin square with exactly one of the letters replaced with a question mark $$$\texttt{?}$$$.

## Output Format
For each test case, output the letter that was replaced.

## Examples
```input
3
ABC
C?B
BCA
BCA
CA?
ABC
?AB
BCA
ABC
```
```output
A
B
C
```

## Note
The correct Latin squares for the three test cases are shown below:

$$$$$$\begin{bmatrix} \texttt{A} & \texttt{B} & \texttt{C} \\ \texttt{C} & \color{red}{\texttt{A}} & \texttt{B} \\ \texttt{B} & \texttt{C} & \texttt{A} \\ \end{bmatrix} \quad \begin{bmatrix} \texttt{B} & \texttt{C} & \texttt{A} \\ \texttt{C} & \texttt{A} & \color{red}{\texttt{B}} \\ \texttt{A} & \texttt{B} & \texttt{C} \\ \end{bmatrix} \quad \begin{bmatrix} \color{red}{\texttt{C}} & \texttt{A} & \texttt{B} \\ \texttt{B} & \texttt{C} & \texttt{A} \\ \texttt{A} & \texttt{B} & \texttt{C} \\ \end{bmatrix}$$$$$$

Now solve the problem and return the code.
You are an expert competitive programmer. You will be given a problem statement, test case constraints and example test inputs and outputs. Please reason step by step about the solution (that must respect memory and time limits), then provide a complete implementation in python3.

Your solution must read input from standard input (cin), write output to standard output (cout).
Do not include any debug prints or additional output.

Put your final solution within a single code block:
```python
<your code here>
```

Execution time limit: 1.0 seconds
Memory limit: 256.0 MB

# Problem
Lura was bored and decided to make a simple language using the five letters $$$\texttt{a}$$$, $$$\texttt{b}$$$, $$$\texttt{c}$$$, $$$\texttt{d}$$$, $$$\texttt{e}$$$. There are two types of letters:

- vowels — the letters $$$\texttt{a}$$$ and $$$\texttt{e}$$$. They are represented by $$$\textsf{V}$$$.
- consonants — the letters $$$\texttt{b}$$$, $$$\texttt{c}$$$, and $$$\texttt{d}$$$. They are represented by $$$\textsf{C}$$$.

A word in the language is a sequence of syllables. Lura has written a word in the language, but she doesn't know how to split it into syllables. Help her break the word into syllables.

For example, given the word $$$\texttt{bacedbab}$$$, it would be split into syllables as $$$\texttt{ba.ced.bab}$$$ (the dot $$$\texttt{.}$$$ represents a syllable boundary).

## Input Format
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows.

The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the length of the word.

The second line of each test case contains a string consisting of $$$n$$$ lowercase Latin characters  — the word.

All words given are valid words in the language; that is, they only use the letters $$$\texttt{a}$$$, $$$\texttt{b}$$$, $$$\texttt{c}$$$, $$$\texttt{d}$$$, $$$\texttt{e}$$$, and each word is made up of several syllables.

The sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.

## Output Format
For test case, output a string denoting the word split into syllables by inserting a dot $$$\texttt{.}$$$ between every pair of adjacent syllables.

If there are multiple possible splittings, output any of them. The input is given in such a way that at least one possible splitting exists.

## Examples
```input
6
8
bacedbab
4
baba
13
daddecabeddad
3
dac
6
dacdac
22
dababbabababbabbababba
```
```output
ba.ced.bab
ba.ba
dad.de.ca.bed.dad
dac
dac.dac
da.bab.ba.ba.bab.bab.ba.bab.ba
```

Now solve the problem and return the code.
You are an expert competitive programmer. You will be given a problem statement, test case constraints and example test inputs and outputs. Please reason step by step about the solution (that must respect memory and time limits), then provide a complete implementation in python3.

Your solution must read input from standard input (cin), write output to standard output (cout).
Do not include any debug prints or additional output.

Put your final solution within a single code block:
```python
<your code here>
```

Execution time limit: 1.0 seconds
Memory limit: 256.0 MB

# Problem
Iulia has $$$n$$$ glasses arranged in a line. The $$$i$$$-th glass has $$$a_i$$$ units of juice in it. Iulia drinks only from odd-numbered glasses, while her date drinks only from even-numbered glasses.

To impress her date, Iulia wants to find a contiguous subarray of these glasses such that both Iulia and her date will have the same amount of juice in total if only the glasses in this subarray are considered. Please help her to do that.

More formally, find out if there exists two indices $$$l$$$, $$$r$$$ such that $$$1 \leq l \leq r \leq n$$$, and $$$a_l + a_{l + 2} + a_{l + 4} + \dots + a_{r} = a_{l + 1} + a_{l + 3} + \dots + a_{r-1}$$$ if $$$l$$$ and $$$r$$$ have the same parity and $$$a_l + a_{l + 2} + a_{l + 4} + \dots + a_{r - 1} = a_{l + 1} + a_{l + 3} + \dots + a_{r}$$$ otherwise.

## Input Format
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases.

The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 2 \cdot 10^5$$$) — the total number of glasses.

The second line of each test case contains $$$n$$$ integers $$$a_1, \ldots, a_n$$$ ($$$1 \leq a_i \leq 10^9$$$) — the amount of juice in each glass.

The sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.

## Output Format
For each test case, output "YES" if there exists a subarray satisfying the condition, and "NO" otherwise.

You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).

## Examples
```input
6
3
1 3 2
6
1 1 1 1 1 1
10
1 6 9 8 55 3 14 2 7 2
8
1 2 11 4 1 5 1 2
6
2 6 1 5 7 8
9
2 5 10 4 4 9 6 7 8
```
```output
YES
YES
NO
YES
NO
YES
```

## Note
In the first test case, Iulia can pick $$$l=1$$$ and $$$r=3$$$. Then she drinks $$$a_1+a_3=1+2=3$$$ units and her date drinks $$$a_2=3$$$ units of juice.

In the second test case, Iulia can pick $$$l=2$$$ and $$$r=5$$$. Then she drinks $$$a_3+a_5=1+1=2$$$ units and her date drinks $$$a_2+a_4=1+1=2$$$ units of juice.

In the third test case no such contiguous subarray works.

In the fourth test case, Iulia can pick $$$l=2$$$ and $$$r=8$$$. Then she drinks $$$a_3+a_5+a_7=11+1+1=13$$$ units and her date drinks $$$a_2+a_4+a_6+a_8=2+4+5+2=13$$$ units of juice.

Now solve the problem and return the code.
You are an expert competitive programmer. You will be given a problem statement, test case constraints and example test inputs and outputs. Please reason step by step about the solution (that must respect memory and time limits), then provide a complete implementation in python3.

Your solution must read input from standard input (cin), write output to standard output (cout).
Do not include any debug prints or additional output.

Put your final solution within a single code block:
```python
<your code here>
```

Execution time limit: 5.0 seconds
Memory limit: 256.0 MB

# Problem
There are $$$n$$$ people on the number line; the $$$i$$$-th person is at point $$$a_i$$$ and wants to go to point $$$b_i$$$. For each person, $$$a_i < b_i$$$, and the starting and ending points of all people are distinct. (That is, all of the $$$2n$$$ numbers $$$a_1, a_2, \dots, a_n, b_1, b_2, \dots, b_n$$$ are distinct.)

All the people will start moving simultaneously at a speed of $$$1$$$ unit per second until they reach their final point $$$b_i$$$. When two people meet at the same point, they will greet each other once. How many greetings will there be?

Note that a person can still greet other people even if they have reached their final point.

## Input Format
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows.

The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of people.

Then $$$n$$$ lines follow, the $$$i$$$-th of which contains two integers $$$a_i$$$ and $$$b_i$$$ ($$$-10^9 \leq a_i < b_i \leq 10^9$$$) — the starting and ending positions of each person.

For each test case, all of the $$$2n$$$ numbers $$$a_1, a_2, \dots, a_n, b_1, b_2, \dots, b_n$$$ are distinct.

The sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.

## Output Format
For each test case, output a single integer denoting the number of greetings that will happen.

## Examples
```input
5
2
2 3
1 4
6
2 6
3 9
4 5
1 8
7 10
-2 100
4
-10 10
-5 5
-12 12
-13 13
5
-4 9
-2 5
3 4
6 7
8 10
4
1 2
3 4
5 6
7 8
```
```output
1
9
6
4
0
```

## Note
In the first test case, the two people will meet at point $$$3$$$ and greet each other.

Now solve the problem and return the code.
You are an expert competitive programmer. You will be given a problem statement, test case constraints and example test inputs and outputs. Please reason step by step about the solution (that must respect memory and time limits), then provide a complete implementation in python3.

Your solution must read input from standard input (cin), write output to standard output (cout).
Do not include any debug prints or additional output.

Put your final solution within a single code block:
```python
<your code here>
```

Execution time limit: 1.0 seconds
Memory limit: 256.0 MB

# Problem
A sequence of brackets is called balanced if one can turn it into a valid math expression by adding characters '+' and '1'. For example, sequences '(())()', '()', and '(()(()))' are balanced, while ')(', '(()', and '(()))(' are not.

A subsequence is a sequence that can be derived from the given sequence by deleting zero or more elements without changing the order of the remaining elements.

You are given three integers $$$n$$$, $$$m$$$ and $$$k$$$. Find the number of sequences consisting of $$$n$$$ '(' and $$$m$$$ ')', such that the longest balanced subsequence is of length $$$2 \cdot k$$$. Since the answer can be large calculate it modulo $$$1\,000\,000\,007$$$ ($$$10^9 + 7$$$).

## Input Format
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 3 \cdot 10^3$$$). Description of the test cases follows.

The first line of each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$1 \le n, m, k \le 2 \cdot 10^3$$$)

## Output Format
For each test case, print one integer — the answer to the problem.

## Examples
```input
3
2 2 2
3 2 3
3 2 1
```
```output
2
0
4
```

## Note
For the first test case "()()", "(())" are the $$$2$$$ sequences

For the second test case no sequence is possible.

For the third test case ")((()", ")(()(", ")()((", "())((" are the $$$4$$$ sequences.

Now solve the problem and return the code.
You are an expert competitive programmer. You will be given a problem statement, test case constraints and example test inputs and outputs. Please reason step by step about the solution (that must respect memory and time limits), then provide a complete implementation in python3.

Your solution must read input from standard input (cin), write output to standard output (cout).
Do not include any debug prints or additional output.

Put your final solution within a single code block:
```python
<your code here>
```

Execution time limit: 3.0 seconds
Memory limit: 256.0 MB

# Problem
There is a rectangular sheet of paper with initial height $$$n$$$ and width $$$m$$$. Let the current height and width be $$$h$$$ and $$$w$$$ respectively. We introduce a $$$xy$$$-coordinate system so that the four corners of the sheet are $$$(0, 0), (w, 0), (0, h)$$$, and $$$(w, h)$$$. The sheet can then be cut along the lines $$$x = 1,2,\ldots,w-1$$$ and the lines $$$y = 1,2,\ldots,h-1$$$. In each step, the paper is cut randomly along any one of these $$$h+w-2$$$ lines. After each vertical and horizontal cut, the right and bottom piece of paper respectively are discarded.

Find the expected number of steps required to make the area of the sheet of paper strictly less than $$$k$$$. It can be shown that this answer can always be expressed as a fraction $$$\dfrac{p}{q}$$$ where $$$p$$$ and $$$q$$$ are coprime integers. Calculate $$$p\cdot q^{-1} \bmod (10^9+7)$$$.

## Input Format
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 57000$$$). Description of the test cases follows.

The first line of each test case contains 3 integers $$$n$$$, $$$m$$$, and $$$k$$$ ($$$1 \le n, m \le 10^6$$$, $$$2 \le k \le 10^{12}$$$).

It is guaranteed that the sum of $$$n$$$ and the sum of $$$m$$$ over all test cases do not exceed $$$10^6$$$.

## Output Format
For each test case, print one integer — the answer to the problem.

## Examples
```input
4
2 4 10
2 4 8
2 4 2
2 4 6
```
```output
0
1
833333342
250000003
```

## Note
For the first test case, the area is already less than $$$10$$$ so no cuts are required.

For the second test case, the area is exactly $$$8$$$ so any one of the $$$4$$$ possible cuts would make the area strictly less than $$$8$$$.

For the third test case, the final answer is $$$\frac{17}{6} = 833\,333\,342\bmod (10^9+7)$$$.

For the fourth test case, the final answer is $$$\frac{5}{4} = 250\,000\,003\bmod (10^9+7)$$$.

Now solve the problem and return the code.
You are an expert competitive programmer. You will be given a problem statement, test case constraints and example test inputs and outputs. Please reason step by step about the solution (that must respect memory and time limits), then provide a complete implementation in python3.

Your solution must read input from standard input (cin), write output to standard output (cout).
Do not include any debug prints or additional output.

Put your final solution within a single code block:
```python
<your code here>
```

Execution time limit: 1.0 seconds
Memory limit: 256.0 MB

# Problem
There are $$$2n$$$ positive integers written on a whiteboard. Being bored, you decided to play a one-player game with the numbers on the whiteboard.

You start with a score of $$$0$$$. You will increase your score by performing the following move exactly $$$n$$$ times:

- Choose two integers $$$x$$$ and $$$y$$$ that are written on the whiteboard.
- Add $$$\min(x,y)$$$ to your score.
- Erase $$$x$$$ and $$$y$$$ from the whiteboard.

Note that after performing the move $$$n$$$ times, there will be no more integers written on the whiteboard.

Find the maximum final score you can achieve if you optimally perform the $$$n$$$ moves.

## Input Format
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 5000$$$) — the number of test cases. The description of the test cases follows.

The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of integers written on the whiteboard is $$$2n$$$.

The second line of each test case contains $$$2n$$$ integers $$$a_1,a_2,\ldots,a_{2n}$$$ ($$$1 \leq a_i \leq 10^7$$$) — the numbers written on the whiteboard.

## Output Format
For each test case, output the maximum final score that you can achieve.

## Examples
```input
3
1
2 3
2
1 1 2 1
3
1 1 1 1 1 1
```
```output
2
2
3
```

## Note
In the first test case, you can only make one move. You select $$$x=2$$$ and $$$y=3$$$, and your score will be $$$\min(x,y)=2$$$.

In the second test case, the following is a sequence of moves that achieves a final score of $$$2$$$:

- In the first move, select $$$x=1$$$ and $$$y=1$$$. Then, add $$$\min(x,y)=1$$$ to the score. After erasing $$$x$$$ and $$$y$$$, the integers left on the whiteboard are $$$1$$$ and $$$2$$$.
- In the second move, select $$$x=1$$$ and $$$y=2$$$. Then, add $$$\min(x,y)=1$$$ to the score. After removing $$$x$$$ and $$$y$$$, no more integers will be left on the whiteboard.

In the third test case, you will perform the move thrice, adding $$$1$$$ to the score each time.

Now solve the problem and return the code.
You are an expert competitive programmer. You will be given a problem statement, test case constraints and example test inputs and outputs. Please reason step by step about the solution (that must respect memory and time limits), then provide a complete implementation in python3.

Your solution must read input from standard input (cin), write output to standard output (cout).
Do not include any debug prints or additional output.

Put your final solution within a single code block:
```python
<your code here>
```

Execution time limit: 3.0 seconds
Memory limit: 256.0 MB

# Problem
Stack has an array $$$a$$$ of length $$$n$$$ such that $$$a_i = i$$$ for all $$$i$$$ ($$$1 \leq i \leq n$$$). He will select a positive integer $$$k$$$ ($$$1 \leq k \leq \lfloor \frac{n-1}{2} \rfloor$$$) and do the following operation on $$$a$$$ any number (possibly $$$0$$$) of times.

- Select a subsequence$$$^\dagger$$$ $$$s$$$ of length $$$2 \cdot k + 1$$$ from $$$a$$$. Now, he will delete the first $$$k$$$ elements of $$$s$$$ from $$$a$$$. To keep things perfectly balanced (as all things should be), he will also delete the last $$$k$$$ elements of $$$s$$$ from $$$a$$$.

Stack wonders how many arrays $$$a$$$ can he end up with for each $$$k$$$ ($$$1 \leq k \leq \lfloor \frac{n-1}{2} \rfloor$$$). As Stack is weak at counting problems, he needs your help.

Since the number of arrays might be too large, please print it modulo $$$998\,244\,353$$$.

$$$^\dagger$$$ A sequence $$$x$$$ is a subsequence of a sequence $$$y$$$ if $$$x$$$ can be obtained from $$$y$$$ by deleting several (possibly, zero or all) elements. For example, $$$[1, 3]$$$, $$$[1, 2, 3]$$$ and $$$[2, 3]$$$ are subsequences of $$$[1, 2, 3]$$$. On the other hand, $$$[3, 1]$$$ and $$$[2, 1, 3]$$$ are not subsequences of $$$[1, 2, 3]$$$.

## Input Format
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 2 \cdot 10^3$$$) — the number of test cases. The description of the test cases follows.

The first line of each test case contains a single integer $$$n$$$ ($$$3 \leq n \leq 10^6$$$) — the length of the array $$$a$$$.

It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^6$$$.

## Output Format
For each test, on a new line, print $$$\lfloor \frac{n-1}{2} \rfloor$$$ space-separated integers — the $$$i$$$-th integer representing the number of arrays modulo $$$998\,244\,353$$$ that Stack can get if he selects $$$k=i$$$.

## Examples
```input
4
3
4
5
10
```
```output
2 
4 
10 2 
487 162 85 10
```

## Note
In the first test case, two $$$a$$$ are possible for $$$k=1$$$:

- $$$[1,2,3]$$$;
- $$$[2]$$$.

In the second test case, four $$$a$$$ are possible for $$$k=1$$$:

- $$$[1,2,3,4]$$$;
- $$$[1,3]$$$;
- $$$[2,3]$$$;
- $$$[2,4]$$$.

In the third test case, two $$$a$$$ are possible for $$$k=2$$$:

- $$$[1,2,3,4,5]$$$;
- $$$[3]$$$.

Now solve the problem and return the code.
You are an expert competitive programmer. You will be given a problem statement, test case constraints and example test inputs and outputs. Please reason step by step about the solution (that must respect memory and time limits), then provide a complete implementation in python3.

Your solution must read input from standard input (cin), write output to standard output (cout).
Do not include any debug prints or additional output.

Put your final solution within a single code block:
```python
<your code here>
```

Execution time limit: 3.0 seconds
Memory limit: 256.0 MB

# Problem
For an array $$$b$$$ of $$$m$$$ non-negative integers, define $$$f(b)$$$ as the maximum value of $$$\max\limits_{i = 1}^{m} (b_i | x) - \min\limits_{i = 1}^{m} (b_i | x)$$$ over all possible non-negative integers $$$x$$$, where $$$|$$$ is bitwise OR operation.

You are given integers $$$n$$$ and $$$q$$$. You start with an empty array $$$a$$$. Process the following $$$q$$$ queries:

- $$$v$$$: append $$$v$$$ to the back of $$$a$$$ and then output $$$f(a)$$$. It is guaranteed that $$$0 \leq v < n$$$.

The queries are given in a modified way.

## Input Format
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 2 \cdot 10^5$$$) — the number of test cases. The description of the test cases follows.

The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \leq n \leq 2^{22}$$$, $$$1 \leq q \leq 10^6$$$) — the number of queries.

The second line of each test case contains $$$q$$$ space-separated integers $$$e_1,e_2,\ldots,e_q$$$ ($$$0 \leq e_i < n$$$) — the encrypted values of $$$v$$$.

Let $$$\mathrm{last}_i$$$ equal the output of the $$$(i-1)$$$-th query for $$$i\geq 2$$$ and $$$\mathrm{last}_i=0$$$ for $$$i=1$$$. Then the value of $$$v$$$ for the $$$i$$$-th query is ($$$e_i + \mathrm{last}_i$$$) modulo $$$n$$$.

It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2^{22}$$$ and the sum of $$$q$$$ over all test cases does not exceed $$$10^6$$$.

## Output Format
For each test case, print $$$q$$$ integers. The $$$i$$$-th integer is the output of the $$$i$$$-th query.

## Examples
```input
2
5 2
1 2
7 4
3 1 5 2
```
```output
0 2
0 2 3 5
```

## Note
In the first test case, the final $$$a=[1,2]$$$. For $$$i=1$$$, the answer is always $$$0$$$, irrespective of $$$x$$$. For $$$i=2$$$, we can select $$$x=5$$$.

In the second test case, the final $$$a=[3,1,0,5]$$$.

Now solve the problem and return the code.