Bakhtiar sir's Artificial Intelligence Lab is famous for its exciting 'Pacman' challenges. But some students, unwilling to risk their marks solving the tasks on the spot, have been secretly studying previous years' solutions passed down by seniors. However, this time Bakhtiar sir outsmarted them by introducing a brand new lab task — a twist on the classic Pacman game where the ghosts are replaced by Vampires.
The game proceeds in turns. In each turn, Pacman moves first, and then the vampires move one by one. Pacman will eat the food pellet immediately after reaching it. The game ends as soon as Pacman eats the food pellet and exits the game, or after $$$10^7$$$ turns.
The input of the task is a two-dimensional grid world containing:
The moves available to Pacman are:
The moves available to each Vampire are:
After the end of any turn, if a Vampire that hasn't bitten Pacman yet is in the same cell as Pacman, it will bite it. Each Vampire can bite Pacman at most once, but multiple Vampires can bite Pacman after the same turn.
The output of the lab task is a sequence of moves for Pacman. After a student submits his move sequence, Bakhtiar sir's AI will read it and control the Vampires optimally to maximize the number of Vampires that can bite Pacman before the game ends.
Pacman gets +500 points for eating the food pellet. However, each time a Vampire bites Pacman, -10 points is added to the score (Pacman loses 10 points). The final score can be negative.
To obtain full marks in the lab, a student must submit a move sequence that maximizes the final score, despite the Vampires moving optimally.
Tanbir, surprised by this new task, wants to solve it carefully. Before actually finding a move sequence, he wants to know the maximum score that is theoretically achievable for a given grid and initial position of Pacman and vampires. Your task is to calculate this.
The first line of the input contains an integer $$$t$$$ $$$(1 \le t \le 1000)$$$ — the number of test cases.
The first line of each test case contains two space-separated integers $$$n$$$ and $$$m$$$ $$$(1 \le n, m \le 10^6)$$$ — the number of rows and columns in the grid world.
The next $$$n$$$ lines contain a string of length $$$m$$$ — describing the grid world layout.
Each character in the grid is one of the following
It is guaranteed that the grid for each test case contains exactly one 'P' and exactly one 'F', and the sum of $$$n \times m$$$ over all test cases does not exceed $$$10^6$$$.
For each test case, print a single integer in a line — the maximum score achievable.
84 8P......V.....F....V.............4 8PV.........V....F.........V.....4 8PV......#..V....F.........V.....5 6P...#...#..#.V.#.F.#..#.V.....3 2#VPF#V1 12P..V.V...V.F3 12P#...#...#.F.#.#.#.#.#.#...#...#...#8 8PVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVF
480 500 470 490 480 470 500 -120
The first test case is illustrated in the following diagram:

Here, one of the optimal move sequences for Pacman is "RDRRRRE". The vampire in the first row (from the top) can meet Pacman with the move sequence "LLLDXX". The vampire in the third row can meet Pacman with the move sequence "LUXXXX". Here, 'X' means any move.
The layouts of all other sample test cases are illustrated below:
![]() | ![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
After Roman Reigns' historic 1316-day title reign came to an end at WrestleMania 40, his cousin Dwayne "The Rock" Johnson decided to write a 1316-page book chronicling the reign.
To make it iconic, he wants to number each page using Roman numerals. Unfortunately, The Final Boss is not very good at counting.
You need to help him convert the page numbers from standard representation to Roman numerals.
Roman numerals are a number system that uses letters from the Latin alphabet to represent values. The basic symbols and their corresponding values are:
Roman numerals are usually written from largest to smallest. When this rule is followed strictly, the numeral is evaluated as a sum of its parts. This is called additive notation. For example: $$$1316 = 1000 + 100 + 100 + 100 + 10 + 5 + 1 = \texttt{MCCCXVI}$$$.
However, to avoid repeating the same symbol four or more times in a row, Roman numerals also allow a smaller value to appear before a larger one. In such cases, the smaller value is subtracted from the larger. This is called subtractive notation. Examples: $$$\texttt{IV} = 5 - 1 = 4$$$, $$$\texttt{IX} = 10 - 1 = 9$$$, $$$\texttt{XL} = 50 - 10 = 40$$$, $$$\texttt{XC} = 100 - 10 = 90$$$, $$$\texttt{CD} = 500 - 100 = 400$$$, $$$\texttt{CM} = 1000 - 100 = 900$$$.
Using both additive and subtractive notation, the number $$$1248$$$ can be expressed as MCCXLVIII.
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1316$$$) — the number of test cases.
Each test case consists of a single line containing a single integer $$$n$$$ ($$$1 \le n \le 1316$$$) — the standard representation of the page number that needs to be converted.
For each test case, output one string in a line — the Roman numeral representation of $$$n$$$.
831217194999912481316
III XII XVII XIX XLIX CMXCIX MCCXLVIII MCCCXVI
You are given a cursed number $$$m$$$ and an array $$$a$$$ of length $$$n$$$.
You will then be given $$$q$$$ queries. Each query is of one of the following two types:
Your task is to process all the queries and print the result for each type 2 query.
A number is called good if it is not divisible by the cursed number $$$m$$$.
A number $$$x$$$ is called $$$k$$$-good if $$$x$$$ remains good after adding $$$k$$$ to it any number of times.
The $$$k$$$-goodness of an array $$$a$$$ is the number of elements in the array that are $$$k$$$-good.
A subarray of an array is a contiguous portion of it. Formally, if $$$a$$$ is an array of size $$$n$$$ and $$$1 \le l \le r \le n$$$, an array $$$a[l\,\dots\,r] = [a_l, a_{l+1}, \dots, a_r]$$$ is called a subarray of $$$a$$$.
The $$$k$$$-goodness of the subarray $$$a[l\,\dots\,r]$$$ is the number of integers $$$i \: (l \le i \le r)$$$ such that $$$a_i$$$ is $$$k$$$-good.
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases.
The first line of each test case contains two space-separated integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^5$$$, $$$1 \le m \le 5000$$$) — the size of the array and the cursed number.
The second line of each test case contains $$$n$$$ space-separated integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array.
The third line of each test case contains a single integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — the number of queries. Each of the next $$$q$$$ lines describes a query.
Each query is of one of the following two types:
It is guaranteed that the sum of $$$n$$$ over all test cases and the sum of $$$q$$$ over all test cases do not exceed $$$10^5$$$. It is also guaranteed that each test case contains at least one query of type 2.
For each query of type 2, print a single line containing one integer — the $$$k$$$-goodness of the subarray $$$a[l\,\dots\,r]$$$.
29 81 5 8 1 6 6 8 6 581 2 92 2 9 121 4 62 4 8 42 5 5 71 6 102 3 9 62 9 9 35 101 2 3 4 552 1 5 12 1 5 22 1 5 32 1 5 42 1 5 5
6 4 0 1 0 0 3 0 3 4
In the first test case, the cursed number is $$$8$$$.
After the first query, the array will become $$$[1, 9, 8, 1, 6, 6, 8, 6, 5]$$$.
For the second query, the $$$12$$$-goodness of the subarray $$$[9, 8, 1, 6, 6, 8, 6, 5]$$$ is $$$6$$$.
For the fourth query, the $$$4$$$-goodness of the subarray $$$[6, 6, 6, 8, 6]$$$ is $$$4$$$.

After winning a hard-fought battle against Ogre Magi, Thrall returned to his manufactory in upland Druud to repair his stormcrafting device. He was tinkering around with the plates of a faulty circular parallel plate capacitor that he retrieved from the heart of the device. Both of the circular plates have a uniform radius of $$$r$$$ units. Thrall wanted to control the distance $$$d$$$ between the two plates, and so he decided to join them by soldering many equally spaced strings of length $$$L$$$. One end of each string was soldered to the side of the $$$+ve$$$ plate, while the other end was soldered to the side of the $$$-ve$$$ plate.
![]() | ![]() |
| (a) The circular plates of the capacitor. | (b) Thrall's contraption. |
Figure 1: Salvaging the spoils of war.
This contraption enabled him to rotate one of the circular plates (say, the $$$+ve$$$ plate) and consequently calibrate the value of $$$d$$$.
![]() | ![]() | ![]() |
| (a) $$$\theta = 60^\circ$$$ | (b) $$$\theta = 90^\circ$$$ | (c) $$$\theta = 120^\circ$$$ |
Figure 2: Rotating the $$$+ve$$$ plate by different angles ($$$\theta$$$).
If Thrall rotates the $$$+ve$$$ circular plate by an angle of $$$\theta$$$ degrees, what would be the corresponding value of $$$d$$$, the distance between the circular plates?
The first line contains an integer $$$t$$$ $$$(1 \leq t \leq 100)$$$ — the number of test cases.
Each test case consists of a single line containing three space-separated integers $$$r$$$ $$$(0 \lt r \leq 10^9)$$$, $$$L$$$ $$$(0 \lt L \leq 10^9)$$$, and $$$\theta$$$ $$$(0^{\circ} \lt \theta^{\circ} \lt 180^{\circ})$$$ — the radius of the plates, the length of the strings, and the angle (in degrees) by which Thrall rotates the $$$+ve$$$ plate respectively.
It is guaranteed that for all test cases, the string length $$$L$$$ is sufficient to allow the rotation of the $$$+ve$$$ plate by $$$\theta$$$ degrees, resulting in a real and non-negative value of $$$d$$$.
For each test case, output a single number $$$d$$$ in a line — the distance between the circular plates.
The answer will be considered correct if the absolute error does not exceed $$$10^{-6}$$$.
41 2 601 2 901 2 120420 911 69
1.732051 1.414214 1.000000 776.886872
217 42 1500000000 1000000000 179
41.998952 8726535.498374
After a grueling Division 2 contest, Nayeem fell asleep. The next morning, he woke up in a strange place called Borderland, where he was forced to participate in a peculiar challenge: the "Queen of Diamonds" game!
In the game arena, there is a line of $$$n$$$ bottles, each having a color label. Nayeem is armed with a special pistol. His task is to shoot and remove some (possibly none) bottles such that, in the remaining bottles, every color appears an even number of times.
Nayeem has to play multiple rounds. In each round, he will survive the game if and only if he can achieve this condition.
Your task is to determine the total number of different ways Nayeem can shoot the bottles. Two results are considered different if there is at least one bottle whose state (removed or kept) differs between them. Since the answer can be very large, output it modulo $$$1000000007$$$.
The first line of the input contains an integer $$$r$$$ ($$$1 \leq r \leq 2 \times 10^4$$$) — the number of rounds Nayeem has to play. The descriptions of $$$r$$$ rounds follow.
The first line of each round contains a single integer $$$n$$$ $$$(1 \le n \le 10^6)$$$ — the number of bottles.
The second line of each round contains a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters — describing the color of the bottles. The $$$i$$$-th character $$$(1 \le i \le n)$$$ of the string represents the color of the $$$i$$$-th bottle.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \times 10^6$$$.
For each round, output a single integer in a line — the total number of ways Nayeem can beat the game modulo $$$1000000007$$$.
65ababa5zzzzz6abcabc7missile11mississippi31thefiveboxingwizardsjumpquickly
8 16 8 4 128 32
The $$$8$$$ ways to beat the game for the first round are illustrated in the following diagram:
The garden at the Institute of Unbearable Torture (IUT) is known for its breathtaking beauty. Rows of vibrant flower columns line the pathways, each a testament to nature's charm. But lately, the greenery has started to fade.
There are $$$n$$$ flower columns in the garden. Each column has a total of $$$t_i$$$ flowers, out of which $$$s_i$$$ are healthy and green. To restore the garden's full glory, the campus gardening team will plant $$$m$$$ magical seeds. Each seed, when planted in a column, instantly grows into a new healthy flower.
The beauty score of a column is defined as: $$$\text{Score}_i = \dfrac{1}{t_i - s_i + 1}$$$
Your task is to determine the maximum average beauty score across all columns after planting the $$$M$$$ seeds optimally.
The first line contains an integer $$$t$$$ $$$(1 \le t \le 10^5)$$$ — the number of test cases.
Each test case consists of three lines:
The first line contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n \le 10^6,\ 0 \le m \le 10^9)$$$ — the number of flower columns and the number of magical seeds to be planted.
The second line contains $$$n$$$ integers $$$s_1, s_2, \dots, s_n$$$ $$$(1 \le s_i \le t_i)$$$ — the number of healthy flowers in each column.
The third line contains $$$n$$$ integers $$$t_1, t_2, \dots, t_n$$$ $$$(s_i \le t_i \le 10^9)$$$ — the total number of flowers in each column.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^6$$$.
Print a single real number — the maximum average beauty score achievable after planting the $$$M$$$ seeds optimally.
The answer will be considered correct if the absolute error does not exceed $$$10^{-6}$$$.
23 21 2 32 3 71 011
0.4 1
In the first test case, one of the optimal ways to plant the two seeds is to plant one seed in column $$$1$$$ and another in column $$$3$$$. After that, the beauty scores of the columns will be $$$\dfrac{1}{3 - 2 + 1} = 0.5$$$, $$$\dfrac{1}{3 - 2 + 1} = 0.5$$$ and $$$\dfrac{1}{8 - 4 + 1} = 0.2$$$ respectively. The average beauty score will be $$$0.4$$$.
Faris loves to play with numbers. Today, he's looking for an interesting array. He defines an array of $$$n$$$ positive integers to be interesting if it satisfies the following property: $$$$$$\gcd(a_1, a_2, \dots, a_n) \lt \gcd(a_1, \dots, a_{i - 1}, a_{i + 1}, \dots, a_n) \text{ for all integer } i \text{ where } 1 \le i \le n$$$$$$
In other words, the GCD of the entire array is strictly less than the GCD of any subset formed by removing exactly one element.
Being amazed by this property, Faris has challenged you, a famous mathematician, to construct any such interesting array of size $$$n$$$ — but with an extra challenge: the LCM of the elements of the array cannot exceed $$$l$$$.
Given two integers $$$n$$$ and $$$l$$$, your task is to construct such an array, or report that it is impossible.
The greatest common divisor or GCD of a set of positive integers is the largest positive integer that divides all of them. Formally, $$$$$$\gcd(a_1, a_2, \dots, a_n) = \max \Bigl\{ d \in \mathbb{Z}^+ \ \big|\ d \mid a_i \ \forall i \in \{1, 2, \dots, n\} \Bigr\} $$$$$$
The least common multiple or LCM of a set of positive integers is the smallest positive integer that is divisible by all of them. Formally, $$$$$$\mathrm{lcm}(a_1, a_2, \dots, a_n) = \min \Bigl\{ m \in \mathbb{Z}^+ \ \big|\ a_i \mid m \ \forall i \in \{1, 2, \dots, n\} \Bigr\}$$$$$$
The first line of the input contains a single integer $$$t \: (1 \leq t \leq 10^5)$$$ — the number of test cases. Then $$$t$$$ test cases follow.
Each test case consists of a single line containing two space-separated integers $$$n \: (2 \leq n \le 10^5)$$$ and $$$l \: (1 \leq l \le 10^{18})$$$ — the size of the array to be constructed and the maximum allowed LCM.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \times 10^5$$$.
For each test case, output $$$n$$$ space-separated positive integers — the elements of the interesting array.
If no such array exists, output $$$-1$$$.
23 5004 200
21 60 70 -1
For the first test case, $$$\gcd(21, 60, 70) = 1$$$ and $$$\mathrm{lcm}(21, 60, 70) = 420 \lt 500$$$. Here, $$$1 \lt \gcd(21, 60) = 3$$$, $$$1 \lt \gcd(21, 70) = 7$$$ and $$$1 \lt \gcd(60, 70) = 10$$$.
For the second test case, it can be proven that no interesting array exists under the given constraints.
Little Pythagoras has a semicircular playhouse of radius $$$r$$$, where he loves to play with triangular toys. But he's very picky about his toys — he only plays with special ones he calls Pythagorean triangles.
A Pythagorean triangle is a non-degenerate triangle that has one right angle and all three of its side lengths are integers.
Today, Pythagoras is visiting the fair, which has toys of all possible shapes and sizes. Pythagoras wants to buy every Pythagorean triangle from the fair that can somehow fit entirely inside his playhouse.
Your task is to count the number of toys that Pythagoras will buy, i.e., the number of different Pythagorean triangles that can somehow fit inside his playhouse (one triangle at a time).
Two triangles are considered the same if their three side lengths are the same when sorted in non-decreasing order. For example, triangles with sides $$$(3,4,5)$$$ and $$$(5,3,4)$$$ are considered the same because their sorted side lengths are the same, i.e., $$$(3,4,5)$$$.
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases.
Each test case consists of a single line containing a single integer $$$r$$$ ($$$1 \le r \le 10^7$$$) — the radius of the playhouse.
It is guaranteed that the sum of $$$r$$$ over all test cases does not exceed $$$10^7$$$.
For each test case, output a single integer in a line — the number of toys that Pythagoras will buy from the fair today.
5481050260
1 4 6 52 406
For every right-angled triangle with side lengths $$$(a, b, c)$$$ where $$$c$$$ is the length of the hypotenuse, $$$a^2 + b^2 = c^2$$$. The converse is also true, i.e., for a triangle with side lengths $$$(a, b, c)$$$, if $$$a^2 + b^2 = c^2$$$, then the triangle is a right-angled triangle where $$$c$$$ denotes the length of the hypotenuse.
For example:
Although $$$(5, 12, 13)$$$ and $$$(6, 8, 10)$$$ are valid Pythagorean triangles, it can be proven that neither of them can fit inside a semicircle of radius $$$4$$$ in any orientation.
For the first test case, the only Pythagorean triangle that fits inside the playhouse has sorted side lengths $$$(3, 4, 5)$$$.
Two examples from the first two test cases are illustrated in the following diagram:
Flatland is on the verge of collapse.
Tensions between the East and the West have reached an all-time high, and civil unrest threatens to erupt at any moment. As a last-ditch effort to save the nation, both sides have agreed to a peace negotiation — and Pranto has been elected as the neutral mediator. The negotiations are scheduled to begin soon, but there's a problem: Pranto overslept. Woken up by a call from Shanto, Pranto realizes he has very little time left to reach the Negotiation Hall on the other side of Flatland. To make matters worse, private cars have been banned in Flatland to reduce traffic congestion. Now, Pranto must rely entirely on public transportation.
Flatland is organized as a grid of size $$$n \times m$$$, where each cell is a city. Pranto starts at city $$$u$$$, and the Negotiation Hall is at city $$$v$$$. A city is identified as a pair $$$(r, c)$$$, representing the city in the $$$r$$$-th row and $$$c$$$-th column. Additionally, each city has a boarding cost $$$B_{r,c}$$$ and a traffic jam $$$J_{r,c}$$$.
There are two types of public transport in Flatland:
To board a train or a bus at city $$$(r, c)$$$, Pranto must pay a boarding cost of $$$B_{r,c}$$$. This cost is the same regardless of the destination or travel distance.
Your task is to help Pranto find the minimum total cost to reach the Negotiation Hall within at most $$$T$$$ units of time, or report that it is impossible.
The first line of the input contains a single integer $$$t$$$ $$$(1 \le t \le 100)$$$ — the number of test cases.
The first line of each test case contains seven space-separated integers $$$n$$$, $$$m$$$, $$$r_u$$$, $$$c_u$$$, $$$r_v$$$, $$$c_v$$$, and $$$T$$$ $$$(2 \le n, m \le 500,\ 1 \le r_u, r_v \le n,\ 1 \le c_u, c_v \le m,\ 0 \le T \le 10^9)$$$ — the number of rows and columns in Flatland, the row and column of the starting city $$$u$$$, the row and column of the destination city $$$v$$$, and the maximum allowed time.
The next $$$n$$$ lines each contain $$$m$$$ space-separated integers $$$(1 \le B_{r,c} \le 10^3)$$$ — the boarding cost matrix. The $$$c$$$-th integer in the $$$r$$$-th line denotes $$$B_{r,c}$$$.
The following $$$n$$$ lines each contain $$$m$$$ space-separated integers $$$(0 \le J_{r,c} \le 10^9)$$$ — the traffic jam matrix. The $$$c$$$-th integer in the $$$r$$$-th line denotes $$$J_{r,c}$$$.
It is guaranteed that the sum of $$$n \cdot m$$$ over all test cases does not exceed $$$10^3$$$, and that the sum of all boarding costs in a single test case does not exceed $$$10^4$$$.
For each test case, output a single integer:
The minimum total boarding cost required to reach the destination city within at most $$$T$$$ units of time. If it is not possible, output $$$-1$$$.
63 3 1 1 3 3 41 100 1001 1 100100 1 10 0 00 0 00 0 03 3 1 1 3 3 41 1 1100 1 1001 1 10 100 00 0 00 100 03 3 1 1 3 3 41 1 11 1 11 1 10 0 0100 0 1000 0 03 3 1 1 3 3 41 1 1100 1 1001 1 10 0 0100 100 1000 0 03 3 1 1 3 3 41 1 1100 100 1001 1 10 0 0100 100 1000 0 03 3 1 1 3 3 31 1 1100 100 1001 1 10 0 0100 100 1000 0 0
4 2 3 4 102 -1
Given two integers $$$L$$$ and $$$R$$$, your task is to compute the following three values:
Formally, you need to compute: $$$$$$ A = L\ \&\ (L+1)\ \&\ (L+2)\ \&\ \dots\ \&\ R $$$$$$ $$$$$$ O = L\ |\ (L+1)\ |\ (L+2)\ |\ \dots\ |\ R $$$$$$ $$$$$$ X = L\ \oplus\ (L+1)\ \oplus\ (L+2)\ \oplus\ \dots\ \oplus\ R $$$$$$
Bitwise operations work on the binary representation of integers, operating on bits of the same positions of the numbers involved.
The first line of the input contains a single integer $$$t$$$ $$$(1 \leq t \leq 2 \times 10^5)$$$ — the number of test cases. Then $$$t$$$ test cases follow.
Each test case consists of a single line containing two space-separated integers, $$$L$$$ and $$$R$$$ $$$(0 \leq L \leq R \leq 10^{18})$$$ — the boundaries of the range (inclusive).
For each test case, output three integers $$$A$$$, $$$O$$$, and $$$X$$$ in a line — the bitwise AND, OR, and XOR of all integers from $$$L$$$ to $$$R$$$ inclusive, in order.
58 120 51 1016 32100000000000 100000000000
8 15 12 0 7 1 0 15 11 0 63 32 100000000000 100000000000 100000000000
The calculations of the first test case:
$$$$$$ \begin{array}{rcl} 8 & = & 1000_2 \\ 9 & = & 1001_2 \\ 10 & = & 1010_2 \\ 11 & = & 1011_2 \\ 12 & = & 1100_2 \\ \hline A & = & 1000_2 \\ O & = & 1111_2 \\ X & = & 1100_2 \\ \end{array} $$$$$$
This is an interactive problem.
You are Professor Utonium, the brilliant scientist of Townsville. You were about to start your project of creating the 'perfect little girls'. Unfortunately, you discover that your lab assistant Jojo has removed all the labels from the chemical containers in the lab.
Now, you have $$$N$$$ unlabeled chemicals, numbered from $$$1$$$ to $$$N$$$. Among them are two very dangerous chemicals – Chemical X and Chemical Y. When these two are mixed in the same mixture, they react explosively.
To identify the exact indices of Chemical X and Chemical Y, you'll need to carry out a series of controlled experiments. In each experiment, you may mix a subset of the chemicals in a secure environment. If both Chemical X and Chemical Y are present in the mixture, it results in "Kaboom" – an explosion! If not, you'll simply observe a "Noboom", meaning the mixture is stable.
But there's a catch — you can perform at most $$$20$$$ experiments before the Mayor and Miss Bellum shut the lab down for safety violations!
The first line of the input contains a single integer $$$N$$$ ($$$2 \le N \le 1000$$$) — the number of chemicals in the lab.
The interaction begins by reading the value of $$$N$$$.
After that, the experiments begin.
For performing an experiment, output $$$(m + 1)$$$ integers $$$(1 \le m \le N)$$$ in a line in the following format (without the quotes):
Here, $$$\{c_1, c_2, \dots, c_m\}$$$ are the indices of the $$$m$$$ selected chemicals for the mixture. After each experiment, the judge will respond with:
After performing at most $$$20$$$ experiments, you must output your final answer in a line in the following format (without the quotes):
Here, $$$x$$$ and $$$y$$$ are the indices of the explosive chemicals.
After printing a line, do not forget to output the end of the line and flush the output. Otherwise, you will get Idleness Limit Exceeded. To flush the output, you can use:
10 Noboom Kaboom Noboom Noboom Kaboom Noboom
? 3 1 2 3 ? 5 1 2 3 4 5 ? 2 4 5 ? 2 1 5 ? 3 2 3 4 ? 2 3 4 ! 2 4