The foggy moors of Devonshire hold a secret that has haunted the Baskerville bloodline for centuries.

Sherlock Holmes has discovered that the creature's genes do not change randomly. They follow an ancient, ritualistic mutation pattern known as the "Descent of the Beast" .
If a creature $$$A$$$ is the direct progenitor of creature $$$B$$$, then for every gene position $$$i$$$, the transition must obey these laws:
The Fallen Gene : A type '1' gene is dominant but unstable; its child can remain a '1' or degrade into a '0'.
The Alpha Spark: A type '0' gene usually remains '0', but once in a millennium, it sparks into an Alpha Gene, denoted as '?'.
The Alpha's Burden: An Alpha Gene '?' is too powerful to sustain itself; its child cannot be another '?'. It must revert to either a '0' or a '1'.
Holmes has $$$Q$$$ new samples from his latest clash on the moors. For each sample string $$$X$$$, he tasks you, his trusted assistant, with two investigations:
Type 1: How many recorded strings $$$S_i$$$ in the archives could have been a direct parent of $$$X$$$?
Type 2: How many recorded strings $$$S_i$$$ in the archives could be a direct child of $$$X$$$?
The first line contains two integers $$$N$$$ and $$$M$$$ ($$$1 \le N \le 2 \cdot 10^5, 1 \le M \le 13$$$) — the number of historical records and the length of the genetic strings.
Each of the next $$$N$$$ lines contains a string $$$S_i$$$ of length $$$M$$$ consisting of characters 0, 1, and ?. These are the recorded observations in the Great Hall.
The next line contains an integer $$$Q$$$ ($$$1 \le Q \le 10^6$$$) — the number of Sherlock's investigations.
Each of the next $$$Q$$$ lines contains an integer $$$T$$$ ($$$T \in \{1, 2\}$$$) and a string $$$X$$$ of length $$$M$$$, representing the query type and the sample string to be analyzed.
For each query, output a single line containing an integer representing the count of recorded strings $$$S_i$$$ that satisfy the condition for Type $$$T$$$.
9 211001001?00??11???81 ?12 ?11 ?02 ?01 ??2 ??1 112 11
2 4 3 4 1 4 4 4
Young Sherlock Holmes has just received his first official data set from Scotland Yard. It is a simple chronological record of $$$n$$$ crime reports from various districts in London.
To challenge himself, Sherlock decides he will only investigate the district with the highest number of reported crimes. If there are multiple districts with the same maximum number of crimes, Sherlock, being a man of efficiency, will choose the one that appeared earliest in the records.
The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of districts recorded.
The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^9$$$) — the number of crimes in each district.
Output a single integer — the 1-based index of the first district that contains the maximum number of crimes.
510 20 50 40 50
3

The first line contains two integers $$$n$$$ and $$$K$$$ ($$$1 \le n \le 200,000$$$, $$$1 \le K \le 10^9$$$) — the number of levels and the number of colors.
The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 200,000$$$) — the size of each level.
For each test case, output a single integer — the number of fundamentally different artifacts modulo $$$10^9 + 7$$$.
5 34 2 1 2 4
31320
5 34 2 1 4 2
62208

There are $$$n$$$ residents in the Medina, numbered from $$$1$$$ to $$$n$$$. After the crime, each resident gives exactly one statement during the police interrogation:
Some residents claim innocence, represented as $$$a_i = -1$$$.
Others point fingers at exactly one other resident, represented as $$$a_i = j$$$ ($$$1 \le j \le n, j \ne i$$$).
The local police are overwhelmed by the complexity of the case. As the night progresses and new evidence surfaces from various surveillance cameras in the Medina's narrow streets, the investigators realize that the reliability of witnesses keeps changing.
Sherlock is given $$$q$$$ intelligence reports. Each report states: "Exactly $$$k$$$ residents are telling the truth." For each report, Holmes must determine which residents could possibly be guilty. It is guaranteed that exactly one person committed the crime.
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10,000$$$) — the number of test cases.For each test case:
The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 10^6, 1 \le q \le n$$$).
The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$-1 \le a_i \le n, a_i \ne 0, a_i \ne i$$$).
Each of the next $$$q$$$ lines contains a single integer $$$k$$$ ($$$0 \le k \le n$$$).
The sum of $$$n$$$ over all test cases does not exceed $$$10^6$$$. The sum of $$$q$$$ over all test cases does not exceed $$$10^6$$$. It is guaranteed that all queries are distinct.
For each query, output a single line:
First, an integer $$$m$$$ — the number of residents who could be guilty.
Then $$$m$$$ space-separated integers — the IDs of these possible guilty residents in ascending order.
If no resident could be guilty for a given $$$k$$$, simply output 0.
15 5-1 1 2 1 -101234
01 52 3 42 1 20
For the first query:
the first person claims he is innocent. Since everyone is lying, that would mean he is actually guilty. However, person 2 says that A is the criminal, which would make person 2's statement true, contradicting the assumption that everyone is lying.
Therefore, this is not a valid scenario and we ignore it.
A suspect is considered possibly guilty only if they appear in at least one valid scenario.
While investigating a peculiar case in Baker Street, Sherlock Holmes discovers a strange mechanical device left by Professor Moriarty. The device consists of N coins placed in a straight line on a table. Each coin shows either Head (H) or Tail (T).
Sherlock notices that the device follows very specific rules:
Sherlock can remove a coin only if it shows Head.
When Sherlock removes the coin at position i, a hidden mechanical switch activates and flips the state of the coins that were originally adjacent to it:
The coin that was originally to its left, if it exists.
The coin that was originally to its right, if it exists.
Two coins are considered neighbors only if they were adjacent in the initial arrangement, regardless of which coins have been removed afterward.
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases.
Each test case consists of two lines.
The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of coins.
The second line of each test case contains a string $$$s$$$ of length $$$n$$$ consisting only of characters 'H' and 'T'.
If it is impossible to remove all coins, print NO.
Otherwise, print YES in the first line.
In the second line, print $$$n$$$ integers — the sequence of removed coin positions in order.
If there are multiple valid answers, print any.
12HH
NO
Sherlock Holmes has uncovered a secret society led by his archenemy — Professor Moriarty. Each member of this criminal network possesses a mysterious integer known as their Cipher Code.
Whenever two members meet, they produce a Conspiracy Signal equal to the bitwise XOR of their cipher codes.
Holmes is interested in analyzing entire groups of suspects. For any group, he defines the Grand Conspiracy Signal as the XOR of the Conspiracy Signals produced by every pair of suspects in the group.
Formally, for a range of suspects from index $$$l$$$ to $$$r$$$, the Grand Conspiracy Signal is:
$$$$$$ \bigoplus_{l \le i \lt j \le r} (a_i \oplus a_j) $$$$$$

However, the investigation is ongoing, and Dr. Watson frequently updates the suspects' cipher codes as new evidence appears.
Your task is to help Sherlock Holmes process the updates and answer his queries.
where $$$\oplus$$$ denotes the bitwise XOR operation.
Constraints
$$$1 \le n, q \le 2 \times 10^5$$$ ; $$$0 \le a_i, \text{val} \lt 10^{7}$$$ ; $$$1 \le \text{pos} \le n$$$ ; $$$1 \le l \le r \le n$$$
The first line contains two integers $$$n$$$ and $$$q$$$ — the number of suspects and the number of operations.
The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ — the Cipher Code of each suspect.
Each of the next $$$q$$$ lines describes an operation:
• $$$1\ \text{pos}\ \text{val}$$$ — Watson updates the evidence. Set the Cipher Code of suspect $$$\text{pos}$$$ to $$$\text{val}$$$.
• $$$2\ l\ r$$$ — Holmes asks for the Grand Conspiracy Signal of suspects from $$$l$$$ to $$$r$$$.
For each operation of type 2, output a single integer — the Grand Conspiracy Signal for the requested range.
5 41 2 3 4 52 1 42 2 41 2 32 1 4
4 0 5
Sherlock Holmes has determined that the Grand Conspiracy Signal ($$$\mathcal{G}$$$) for any group of $$$k$$$ suspects chosen from the range $$$[l, r]$$$ is not merely the xor of their codes, but a complex interaction of their indices' internal bitwise structures.
Formal Definition Given an array $$$a$$$ of size $$$n$$$, and $$$q$$$ operations (updates or queries), define the Grand Conspiracy Signal for a range $$$[l, r]$$$ and subset size $$$k$$$ as:$$$$$$\mathcal{G}(l, r, k) = = \bigoplus_{l \le i_1 \lt i_2 \lt \dots \lt i_k \le r} \left( a_{\left( \bigoplus_{j_1 \subseteq i_1} j_1 \right)} \oplus a_{\left( \bigoplus_{j_2 \subseteq i_2} j_2 \right)} \oplus \dots \oplus a_{\left( \bigoplus_{j_k \subseteq i_k} j_k \right)} \right)$$$$$$

Where:
$$$\bigoplus$$$ denotes the bitwise XOR operation.
$$$j \subseteq i_m$$$ denotes that $$$j$$$ is a bitwise submask of $$$i_m$$$.
The outermost XOR sum is taken over all possible combinations of $$$k$$$ distinct indices within the interval $$$[l, r]$$$.
Operations :
1. Update($$$pos, val$$$): Change the suspect's cipher code at index $$$pos$$$ such that $$$a_{pos} = val$$$.
2. Query($$$l, r, k$$$): Calculate the current value of $$$\mathcal{G}(l, r, k)$$$.
The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n, q \le 2 \cdot 10^5$$$) — the number of suspects and the number of operations.
The second line contains $$$n$$$ integers $$$a_0, a_1, \dots, a_{n-1}$$$ ($$$0 \le a_i \lt 2^{30}$$$) — the Cipher Code of each suspect.
Each of the next $$$q$$$ lines describes an operation:
• $$$1\ \text{pos}\ \text{val}$$$ — Watson updates the evidence. Set the Cipher Code of suspect $$$\text{pos}$$$ to $$$\text{val}$$$ ($$$0 \le pos \le n-1, 0 \le val \lt 2^{30}$$$).
• $$$2\ l\ r\ k$$$ — Holmes asks for the Grand Conspiracy Signal $$$\mathcal{G}(l, r, k) .$$$ ($$$0 \le l \le r \le n-1$$$ , $$$ 2 \le k \le r-l+1 $$$ ).
For each operation of type 2, output a single integer — the Grand Conspiracy Signal .
5 41 2 3 4 52 1 4 22 2 4 21 2 32 1 4 2
5 0 5
London, 1891. Sherlock Holmes wants to send a secret message to Dr. Watson.
There are $$$N$$$ identical iron posts in a courtyard. Holmes may write one digit (0–9) on any post and may leave some posts blank. Later, Watson will see the courtyard, but because of fog and moved lanterns, he cannot know the order of the posts. He only knows how many times each digit appears. The order does not matter.
Before Watson arrives, a clerk may use a cipher wheel. Every time the wheel is used, each written digit $$$d$$$ is replaced by $$$ d \rightarrow (a \cdot d + b) \bmod 10 $$$ where:
The wheel may be used any number of times (possibly zero). Each use can choose any $$$a \in S_a$$$ and any $$$b \in S_b$$$. So the final effect is a composition of such transformations.
Holmes and Watson know $$$N$$$, $$$S_a$$$, and $$$S_b$$$, but Watson does not know which transformations were applied.
Because Watson only sees digit counts:
Two writings are indistinguishable if one can be obtained from the other by applying some allowed sequence of cipher wheel operations (and then shuffling).
Your task is to compute how many different secrets Holmes can encode so that Watson can always decode them correctly.
The first line contains an integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases.
Each test case contains one line with:
The strings satisfy:
For each test case, output one integer — the maximum number of different secrets Holmes can encode.
It is guaranteed that the answer fits in a signed 64-bit integer.
33 1 03 19 053 1379 0123456789
285 79 13
In the first test case, only the identity transformation is possible, so all non-empty digit multisets of size at most $$$3$$$ are distinguishable.
In the last test case, the full affine group acts on the digits, so many different writings become indistinguishable, and the number of secrets is much smaller.
Watson is on a foggy mountain represented by an $$$n \times m$$$ grid.
Each cell contains one of:
Watson can move in 4 directions (up, down, left, right) to a neighboring cell in one step. He cannot step on rocks.
Because of fog, Watson can only plan to catch the next butterfly if it is reachable within at most $$$k$$$ steps from his current position, where $$$1 \le k \le 10$$$.
Watson catches a butterfly when he visits its cell. He may choose the first butterfly to catch freely. After catching one butterfly, he may move to another butterfly only if the shortest path length between their cells (avoiding rocks) is at most $$$k$$$. Watson cannot catch the same butterfly twice.
Your task is to compute the maximum number of butterflies Watson can catch.
The first line contains three integers $$$n$$$, $$$m$$$, $$$k$$$: $$$ 1 \le n,m \le 2000,\quad 1 \le k \le 10. $$$ The next $$$n$$$ lines each contain a string of length $$$m$$$ consisting of ., *, #.
It is guaranteed that the number of butterflies in the grid does not exceed $$$20$$$.
Print one integer: the maximum number of butterflies Watson can catch.
2 2 1*#.*
1
1 1 8.
0
21 17 5#.....###....#.#..#*##.............#..##.......#.##...#.#.....*.###...#..**.#..*.....###.....##....*.##..**#..........*...#.#.......*.....#....*.......#.....#...#........#.#...#..#*........#...##..#.#.....*....#.#..##..##.....#....#*#....#...........*#....##.*..#.......###...*..*#..##..#..#....#..#.#....##.#......#.....##.*..*...#.#.#...##....###.##......
6
7 9 4.*#..#.....*.*..*..**..**..*...#...#*.*.*..*..*.*..*..**.#..*..
19
11 24 3..*..*#.##..*....#....*..#.#..#..#.#....#..#..##......#...*##.#...........#....###.#...###.##....#....#...#........##.......#...#...#.#.###.#..##.*.#..#...#..##.#..#...##..##...*...##.#..#.##...##..#.#*......#...#...###..#.#........##..*.......##.#*###...#........
3
You are given an $$$n \times n$$$ grid of bits (each cell is either 0 or 1). Initially, the grid is filled with 0.
The grid is placed on a torus: row and column indices are taken modulo $$$n$$$. Formally, for any integer $$$x$$$ define $$$ wrap(x) = ((x-1) \bmod n) + 1. $$$
You may apply the following operation any number of times:
You are given $$$q$$$ target grids. For each target grid, determine whether it can be obtained from the all-zero grid using the operations above.
The first line contains three integers $$$n$$$, $$$k$$$, $$$q$$$: $$$ 3 \le n \le 2000,\quad 3 \le k \le n,\quad k \text{ is odd},\quad 1 \le q \le 2000. $$$ Additionally, it is guaranteed that $$$ q \cdot n^2 \le 2 \cdot 10^7. $$$ Then follow $$$q$$$ grids. Each grid is given by $$$n$$$ lines, each containing a string of length $$$n$$$ consisting only of characters 0 and 1.
Print $$$q$$$ lines. For each grid, print YES if it is reachable from the all-zero grid, otherwise print NO.
3 3 3000000000111111111100000000
YES YES NO
Watson runs along a straight road from position $$$0$$$ to the Palace at position $$$L$$$.
Watson runs only forward (toward increasing positions), and the Hound always runs forward as well.
Smoke Bombs When Watson reaches position $$$p_i$$$, he immediately picks up bomb $$$i$$$ (this takes no time). At any later moment, Watson may use any bomb he has already picked up. When Watson uses bomb $$$i$$$, the Hound stops moving for exactly $$$b_i$$$ seconds, while Watson continues running normally. Each bomb can be used at most once, and Watson may use at most $$$T$$$ bombs total. If Watson uses a bomb while the Hound is already stopped, the remaining stop time increases accordingly.
Capture rule Watson is caught if the Hound reaches Watson before Watson reaches the Palace.
Watson is considered safe if he reaches the Palace before the Hound catches him, or if their first meeting happens exactly at the Palace gates (position $$$L$$$).
Task Determine whether Watson can reach the Palace safely.
The first line contains six integers $$$n, L, S, v, k, T$$$: $$$ 1 \le n \le 2\cdot 10^5,\quad 1 \le L \le 10^9,\quad 1 \le S \le 10^9,\quad 1 \le v \le 3000,\quad 1 \le k \le 1000,\quad 0 \le T \le n. $$$ Each of the next $$$n$$$ lines contains two integers $$$p_i$$$ and $$$b_i$$$: $$$ 0 \le p_i \le L,\quad 0 \le b_i \le 10^9. $$$ Multiple bombs may be located at the same position.
Print YES if Watson can reach the Palace safely, otherwise print NO.
3 10 6 1 2 23 16 29 2
YES
In the shadowy aftermath of The Final Problem, Sherlock Holmes prepares for his greatest confrontation.Professor James Moriarty — the "Napoleon of Crime" — has assembled a vast and intricate network, threatening the very order of London. Holmes knows that even his unmatched intellect may not suffice this time. To defeat his greatest enemy, he must form a carefully balanced League of Detectives.
There are $$$n$$$ distinct investigative skills, numbered from $$$1$$$ to $$$n$$$, encompassing everything from forensic chemistry to cryptanalysis and disguise. Each detective is described by the set of skills they possess.The pool of candidates is limitless and contains every possible combination of skills.
Sherlock Holmes himself possesses exactly $$$k$$$ skills. To maintain command and coherence within the League, Holmes refuses to recruit anyone who surpasses him in expertise.
Furthermore, to ensure flawless cooperation against Moriarty's web, he imposes strict rules:Collaboration:
1. Any two detectives in the League must share at least one common skill, so that no pair is ever unable to collaborate.
2. Hierarchy: All selected detectives must possess the same number of skills, say $$$x$$$. This number must be at most $$$k$$$ ($$$1 \le x \le k$$$).
3. Uniqueness: No two detectives may have identical sets of skills.
Holmes wishes to recruit as many detectives as possible under these constraints, forming the largest League capable of bringing Moriarty to justice.
Determine the maximum possible size of the League.Since the answer may be large, output it modulo $$$998244353$$$.
The input contains a single line with two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 10^6 $$$) — the total number of investigative skills and the number of skills possessed by Sherlock Holmes.
Output one integer — the maximum number of detectives Sherlock Holmes can recruit, modulo $$$998244353$$$.
1 1
1
2 1
1
2 2
1
5 4
10
10 7
210
1000000 1256
267705305

Detective Sherlock Holmes stared at the crime scene photos, his pipe emitting thoughtful curls of smoke. The Lestrade Manor banquet had ended in what appeared to be a meticulously orchestrated mass murder.
He turned to you, his assistant. "The police have recorded every constraint, but missed the crucial connections. We need to count every possible scenario consistent with their fragmented evidence. It's a straight forward combinatorial problem, really."
Sherlock Holmes needs to count the number of possible crime scenarios that fit the police evidence. A "scenario" consists of two independent parts: assigning suspects and scheduling actions.
Part 1: There are $$$S$$$ suspects and $$$K$$$ cases. Suspects were assigned to these cases under rigid constraints: every case had at least one suspect, and every suspect was assigned to at least one case.
Part 2: For each of the $$$K$$$ case files, the forensic team has identified exactly $$$L$$$ distinct actions that occurred during the crime. However, the exact order of these actions is not fully known. To model this, the police have represented the $$$L$$$ actions of a single case as a Directed Acyclic Graph (DAG). If there is a directed edge from action $$$u$$$ to action $$$v$$$, it means action $$$u$$$ must happen before action $$$v$$$ in the sequence.The structure of the DAG is identical for all $$$K$$$ cases.The "Global Timeline" consists of all actions from all cases combined.
Global Sequence: You must merge the actions from all $$$K$$$ cases into one single sequence of length $$$N = K \times L$$$. You can interleave actions from different cases however you like, as long as the internal order for each case is preserved.
Calculate the total number of valid scenarios modulo $$$10^9 + 7$$$.A scenario is valid if it satisfies all rules in Part 1 and Part 2.
The first line contains four integers $$$S$$$, $$$K$$$, $$$L$$$, and $$$M$$$ ($$$1 \le S, K \le 10^3$$$, $$$1 \le L \le 20$$$, $$$0 \le M \le \frac{L(L-1)}{2}$$$) — the number of suspects, the number of cases, the number of actions per case, and the number of dependencies in the DAG.The next $$$M$$$ lines each contain two integers $$$u$$$ and $$$v$$$ ($$$1 \le u, v \le L, u \ne v$$$), indicating that action $$$u$$$ must occur before action $$$v$$$.
It is guaranteed that the graph is a Directed Acyclic Graph (DAG).
Output a single integer — the total number of valid scenarios modulo $$$10^9 + 7$$$.
2 2 4 2 1 2 2 3
7840
There are 7 possible ways to assign the suspects :
case 1 $$$.....$$$ case 2
{1,2}$$$....$$$ {1,2}
{1,2}$$$....$$$ {1}——> x2 (switch)
{1,2}$$$....$$$ {2}——> x2
{1}$$$.......$$$ {2}——> x2
for the second part we have : 1—>2—>3 , 4
Therefore, in the final solution, the characteristic sequence of a case can be constructed in 4 ways :
$$$A_1$$$$$$A_2$$$$$$A_3$$$$$$A_4$$$ ; $$$A_4$$$$$$A_1$$$$$$A_2$$$$$$A_3$$$ ; $$$A_1$$$$$$A_4$$$$$$A_2$$$$$$A_3$$$ ; $$$A_1$$$$$$A_2$$$$$$A_4$$$$$$A_3$$$ .
An exemple of the global sequence : $$$A_1$$$$$$B_4$$$$$$B_1$$$$$$A_2$$$$$$B_2$$$$$$A_4$$$$$$A_3$$$$$$B_3$$$
it can be shown that there are 1120 valid configurations .

Sherlock Holmes is stuck and cannot leave until he solves this puzzle. There are $$$n$$$ lamps in another chamber and $$$m$$$ switches in his current room. Each lamp can have up to $$$k$$$ distinct heat levels, which Sherlock can sense with his hands. He is very sensitive and can detect subtle changes, and after Valentine's Day, he finds himself with nothing but switches and lamps for company. Don't worry, all coders understand: love may crash, but programs run forever.
Sherlock needs to determine with absolute certainty which switch controls which lamp $$$(n \le m)$$$, knowing that he can enter the lamp room at most $$$t$$$ times. Each time he enters, he can observe for every lamp whether it is on or off and its temperature level.
Determine whether it is possible for Sherlock to map every lamp to its switch under these constraints.
The first line contains four integers $$$n , m , k , t (1 \le n \le m \le 10^{18}, 1 \le k \le 10^9, 1 \le t \le 10^6)$$$.
Print YES if it is possible for Sherlock to determine the mapping with certainty, or NO otherwise.
4 16 6 2
YES
28 28 5 4
YES
10 11 7 1
YES
8 9 10 10
YES
1. The Classic Riddle SetupThe Scenario: ($$$n = 1, m = 3, k =2, t = 1$$$)
You are in a room with 3 switches ($$$m=3$$$). Only one connects to a light bulb in the next room. The Constraint: You can flip switches as much as you like, but you can only enter the bulb room once ($$$t=1$$$).
The Goal: Find the correct switch.
2. The Solution (The Physical "Trick")
The standard solution exploits the fact that a light bulb gets hot.
Turn Switch 1 ON and leave it for 10 minutes (to generate heat).
Turn Switch 1 OFF.
Turn Switch 2 ON.
Walk into the room immediately.
3. The Diagnosis:
If the bulb is ON: It's Switch 2.
If the bulb is OFF but HOT: It's Switch 1.
If the bulb is OFF and COLD: It's Switch 3.

Some nodes are crime scenes that must be watched. Holmes can place stakeout teams on some nodes. A team placed at node $$$u$$$ watches every node $$$v$$$ such that:
Every crime scene must be watched by at least one team. Your task is to find the minimum number of teams needed.
Important: the list of crime scenes may contain duplicates; a node is a crime scene if it appears at least once.
The first line contains an integer $$$t$$$ ($$$1\le t\le 5$$$) — the number of test cases.
For each test case:
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2\cdot 10^5$$$.
For each test case, print one integer — the minimum number of stakeout teams needed to watch all crime scenes.
1 8 3 2 1 2 2 4 2 5 1 3 3 6 6 7 6 8 5 7 8
2
In the example, the crime scenes are $$$\{5,7,8\}$$$ and $$$k=2$$$. One optimal strategy is:

A single rat is hiding in one of these tunnels. Warlock Gnomes wants to capture it, but the rat is elusive and follows a strict ritual:
• The Midnight Scuttle: Every night, the rat must move from its current tunnel $$$i$$$ to an adjacent tunnel ($$$i-1$$$ or $$$i+1$$$). If the rat is at an end (tunnel $$$1$$$ or $$$n$$$), it must move to the only possible neighbor ($$$2$$$ or $$$n-1$$$, respectively).
•The Daylight Hunt: During the day, Warlock Gnomes can choose exactly one tunnel $$$k$$$ to inspect. If the rat is currently in tunnel $$$k$$$, it is captured! Otherwise, the rat hears the cat's footsteps and retreats deep into its current tunnel, making it impossible to catch for the rest of that day.
Shimlock Gnomes does not know the rat's starting position. Your task is to provide a sequence of tunnel inspections such that, regardless of where the rat starts or how it moves, the cat is guaranteed to capture the rat at some point during the sequence.
A single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of tunnels in the line.
print an integer $$$s$$$ ($$$1 \le s \le 3n$$$) — the number of days in your hunting sequence.On the second line, print $$$s$$$ space-separated integers $$$p_1, p_2, \dots, p_s$$$ ($$$1 \le p_i \le n$$$) — the index of the tunnel Shimlock Gnomes should check on day $$$i$$$.
3
2 2 2
If $$$n=3$$$, the rat can start at 1, 2, or 3.
•If the rat starts at 2: On Day 1, the cat checks 2. Captured.
•If the rat starts at 1 or 3: After the first night, the rat must move to tunnel 2. On Day 2, the cat checks 2. Captured.