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: 2.0 seconds
Memory limit: 256.0 MB

# Problem
You are given two integers $$$x$$$ and $$$y$$$. A sequence $$$a$$$ of length $$$n$$$ is called modular if $$$a_1=x$$$, and for all $$$1 < i \le n$$$ the value of $$$a_{i}$$$ is either $$$a_{i-1} + y$$$ or $$$a_{i-1} \bmod y$$$. Here $$$x \bmod y$$$ denotes the remainder from dividing $$$x$$$ by $$$y$$$.

Determine if there exists a modular sequence of length $$$n$$$ with the sum of its elements equal to $$$S$$$, and if it exists, find any such sequence.

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

The first and only line of each test case contains four integers $$$n$$$, $$$x$$$, $$$y$$$, and $$$s$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$0 \le x \le 2 \cdot 10^5$$$, $$$1 \le y \le 2 \cdot 10^5$$$, $$$0 \le s \le 2 \cdot 10^5$$$) — the length of the sequence, the parameters $$$x$$$ and $$$y$$$, and the required sum of the sequence elements.

The sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$, and also the sum of $$$s$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.

## Output Format
For each test case, if the desired sequence exists, output "Yes" on the first line (without quotes). Then, on the second line, output $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ separated by a space — the elements of the sequence $$$a$$$. If there are multiple suitable sequences, output any of them.

If the sequence does not exist, output "No" on a single line.

You can output each letter in any case (lowercase or uppercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be accepted as a positive answer.

## Examples
```input
3
5 8 3 28
3 5 3 6
9 1 5 79
```
```output
YES
8 11 2 2 5 
NO
NO
```

## Note
In the first example, the sequence $$$[8, 11, 2, 5, 2]$$$ satisfies the conditions. Thus, $$$a_1 = 8 = x$$$, $$$a_2 = 11 = a_1 + 3$$$, $$$a_3 = 2 = a_2 \bmod 3$$$, $$$a_4 = 5 = a_3 + 3$$$, $$$a_5 = 2 = a_4 \bmod 3$$$.

In the second example, the first element of the sequence should be equal to $$$5$$$, so the sequence $$$[2, 2, 2]$$$ is not suitable.

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
Given an array $$$a$$$ of $$$n$$$ elements, find the maximum value of the expression:

$$$$$$|a_i - a_j| + |a_j - a_k| + |a_k - a_l| + |a_l - a_i|$$$$$$

where $$$i$$$, $$$j$$$, $$$k$$$, and $$$l$$$ are four distinct indices of the array $$$a$$$, with $$$1 \le i, j, k, l \le n$$$.

Here $$$|x|$$$ denotes the absolute value of $$$x$$$.

## Input Format
The first line contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. The description of the test cases follows.

The first line of each test case contains a single integer $$$n$$$ ($$$4 \le n \le 100$$$) — the length of the given array.

The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$-10^6 \le a_i \le 10^6$$$).

## Output Format
For each test case, print a single integer — the maximum value.

## Examples
```input
5
4
1 1 1 1
5
1 1 2 2 3
8
5 1 3 2 -3 -1 10 3
4
3 3 1 1
4
1 2 2 -1
```
```output
0
6
38
8
8
```

## Note
In the first test case, for any selection of $$$i$$$, $$$j$$$, $$$k$$$, $$$l$$$, the answer will be $$$0$$$. For example, $$$|a_1 - a_2| + |a_2 - a_3| + |a_3 - a_4| + |a_4 - a_1| = |1 - 1| + |1 - 1| + |1 - 1| + |1 - 1| = 0 + 0 + 0 + 0 = 0$$$.

In the second test case, for $$$i = 1$$$, $$$j = 3$$$, $$$k = 2$$$, and $$$l = 5$$$, the answer will be $$$6$$$. $$$|a_1 - a_3| + |a_3 - a_2| + |a_2 - a_5| + |a_5 - a_1| = |1 - 2| + |2 - 1| + |1 - 3| + |3 - 1| = 1 + 1 + 2 + 2 = 6$$$.

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
You have $$$5$$$ different types of coins, each with a value equal to one of the first $$$5$$$ triangular numbers: $$$1$$$, $$$3$$$, $$$6$$$, $$$10$$$, and $$$15$$$. These coin types are available in abundance. Your goal is to find the minimum number of these coins required such that their total value sums up to exactly $$$n$$$.

We can show that the answer always exists.

## Input Format
The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — 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 10^9$$$) — the target value.

## Output Format
For each test case, output a single number — the minimum number of coins required.

## Examples
```input
14
1
2
3
5
7
11
12
14
16
17
18
20
98
402931328
```
```output
1
2
1
3
2
2
2
3
2
3
2
2
8
26862090
```

## Note
In the first test case, for $$$n = 1$$$, the answer is $$$1$$$ since only one $$$1$$$ value coin is sufficient. $$$1 = 1 \cdot 1$$$.

In the fourth test case, for $$$n = 5$$$, the answer is $$$3$$$, which can be achieved using two $$$1$$$ value coins and one $$$3$$$ value coin. $$$5 = 2 \cdot 1 + 1 \cdot 3$$$.

In the seventh test case, for $$$n = 12$$$, the answer is $$$2$$$, which can be achieved using two $$$6$$$ value coins.

In the ninth test case, for $$$n = 16$$$, the answer is $$$2$$$, which can be achieved using one $$$1$$$ value coin and one $$$15$$$ value coin or using one $$$10$$$ value coin and one $$$6$$$ value coin. $$$16 = 1 \cdot 1 + 1 \cdot 15 = 1 \cdot 6 + 1 \cdot 10$$$.

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: 2.0 seconds
Memory limit: 256.0 MB

# Problem
After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from left to right and they are numbered with numbers from 1 to m, correspondingly. The balls are numbered with numbers from 1 to n.

Valeric decided to sort the balls in the order of increasing of their numbers by the following scheme. He will put each new ball in the basket with the least number of balls. And if he's got several variants, he chooses the basket which stands closer to the middle. That means that he chooses the basket for which $$\left|\frac{m+1}{2}-i\right|$$ is minimum, where i is the number of the basket. If in this case Valeric still has multiple variants, he chooses the basket with the minimum number.

For every ball print the number of the basket where it will go according to Valeric's scheme.

Note that the balls are sorted into baskets in the order of increasing numbers, that is, the first ball goes first, then goes the second ball and so on.

## Input Format
The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of balls and baskets, correspondingly.

## Output Format
Print n numbers, one per line. The i-th line must contain the number of the basket for the i-th ball.

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

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: 2.0 seconds
Memory limit: 256.0 MB

# Problem
As Valeric and Valerko were watching one of the last Euro Championship games in a sports bar, they broke a mug. Of course, the guys paid for it but the barman said that he will let them watch football in his bar only if they help his son complete a programming task. The task goes like that.

Let's consider a set of functions of the following form:

$$y_i(x) = \begin{cases} 
k_i \cdot x + b_i, & \text{if } k_i \cdot x + b_i \geq 0; \\
0, & \text{if } k_i \cdot x + b_i < 0.
\end{cases}$$

Valeric and Valerko really want to watch the next Euro Championship game, so they asked you to help them.

## Input Format
The first line contains integer n (1 ≤ n ≤ 105) — the number of functions. Each of the following n lines contains two space-separated integer numbers ki, bi ( - 109 ≤ ki, bi ≤ 109) that determine the i-th function.

## Output Format
Print a single number — the number of angles that do not equal 180 degrees in the graph of the polyline that equals the sum of the given functions.

## Examples
```input
1
1 0
```
```output
1
```
-----
```input
3
1 0
0 2
-1 1
```
```output
2
```
-----
```input
3
-2 -4
1 7
-5 1
```
```output
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: 1.0 seconds
Memory limit: 256.0 MB

# Problem
A mathematician grabbed my computer as I was preparing this problem, deleted the statement, and changed the samples to fit his liking. The model solution and input/output format are still correct, but the samples are wrong.

I've partially fixed the problem so that when you submit, it will be tested against the correct version of the problem. However, I can't fix the samples below. As a computer scientist, can you solve the correct problem?

## Input Format
The only line of input contains a real number $$$x$$$ ($$$1 \leq x \leq 100$$$), given to exactly three decimal places.

## Output Format
Output one real number — the answer. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-4}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a-b|}{\max(1,|b|)} \le 10^{-4}$$$.

## Examples
```input
1.234
```
```output
0.21026
```
-----
```input
4.113
```
```output
1.41415
```
-----
```input
99.000
```
```output
4.59512
```

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: 15.0 seconds
Memory limit: 1024.0 MB

# Problem
Let $$$p_1, \ldots, p_n$$$ be a permutation of $$$[1, \ldots, n]$$$.

Let the $$$q$$$-subsequence of $$$p$$$ be a permutation of $$$[1, q]$$$, whose elements are in the same relative order as in $$$p_1, \ldots, p_n$$$. That is, we extract all elements not exceeding $$$q$$$ together from $$$p$$$ in the original order, and they make the $$$q$$$-subsequence of $$$p$$$.

For a given array $$$a$$$, let $$$pre(i)$$$ be the largest value satisfying $$$pre(i) < i$$$ and $$$a_{pre(i)} > a_i$$$. If it does not exist, let $$$pre(i) = -10^{100}$$$. Let $$$nxt(i)$$$ be the smallest value satisfying $$$nxt(i) > i$$$ and $$$a_{nxt(i)} > a_i$$$. If it does not exist, let $$$nxt(i) = 10^{100}$$$.

For each $$$q$$$ such that $$$1 \leq q \leq n$$$, let $$$a_1, \ldots, a_q$$$ be the $$$q$$$-subsequence of $$$p$$$. For each $$$i$$$ such that $$$1 \leq i \leq q$$$, $$$pre(i)$$$ and $$$nxt(i)$$$ will be calculated as defined. Then, you will be given some integer values of $$$x$$$, and for each of them you have to calculate $$$\sum\limits_{i=1}^q \min(nxt(i) - pre(i), x)$$$.

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

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

The second line of each test case contains $$$n$$$ integers $$$p_1, \ldots, p_n$$$ ($$$1 \leq p_i \leq n$$$) — the initial permutation.

Then, for each $$$q$$$ such that $$$1 \leq q \leq n$$$ in ascending order, you will be given an integer $$$k$$$ ($$$0 \leq k \leq 10^5$$$), representing the number of queries for the $$$q$$$-subsequence. Then $$$k$$$ numbers in a line follow: each of them is the value of $$$x$$$ for a single query ($$$1 \leq x \leq q$$$).

It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$3\cdot 10^5$$$ and the sum of $$$k$$$ over all test cases does not exceed $$$10^5$$$.

## Output Format
For each test case, for each query, print a single line with an integer: the answer to the query.

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

## Note
The $$$1$$$-subsequence is $$$[1]$$$, and $$$pre=[-10^{100}]$$$, $$$nxt=[10^{100}]$$$. $$$ans(1)=\min(10^{100}-(-10^{100}),1)=1$$$.

The $$$5$$$-subsequence is $$$[1,4,3,2,5]$$$, and $$$pre=[-10^{100},-10^{100},2,3,-10^{100}]$$$, $$$nxt=[2,5,5,5,10^{100}]$$$. $$$ans(1)=5,ans(2)=10,ans(3)=14$$$.

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: 2.0 seconds
Memory limit: 256.0 MB

# Problem
It's another beautiful day on Farmer John's farm.

After Farmer John arrived at his farm, he counted $$$n$$$ legs. It is known only chickens and cows live on the farm, and a chicken has $$$2$$$ legs while a cow has $$$4$$$.

What is the minimum number of animals Farmer John can have on his farm assuming he counted the legs of all animals?

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

Each test case contains an integer $$$n$$$ ($$$2 \leq n \leq 2 \cdot 10^3$$$, $$$n$$$ is even).

## Output Format
For each test case, output an integer, the minimum number of animals Farmer John can have on his farm.

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

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: 2.0 seconds
Memory limit: 256.0 MB

# Problem
Tina has a square grid with $$$n$$$ rows and $$$n$$$ columns. Each cell in the grid is either $$$0$$$ or $$$1$$$.

Tina wants to reduce the grid by a factor of $$$k$$$ ($$$k$$$ is a divisor of $$$n$$$). To do this, Tina splits the grid into $$$k \times k$$$ nonoverlapping blocks of cells such that every cell belongs to exactly one block.

Tina then replaces each block of cells with a single cell equal to the value of the cells in the block. It is guaranteed that every cell in the same block has the same value.

For example, the following demonstration shows a grid being reduced by factor of $$$3$$$.

Original grid $$$0$$$$$$0$$$$$$0$$$$$$1$$$$$$1$$$$$$1$$$$$$0$$$$$$0$$$$$$0$$$$$$1$$$$$$1$$$$$$1$$$$$$0$$$$$$0$$$$$$0$$$$$$1$$$$$$1$$$$$$1$$$$$$1$$$$$$1$$$$$$1$$$$$$0$$$$$$0$$$$$$0$$$$$$1$$$$$$1$$$$$$1$$$$$$0$$$$$$0$$$$$$0$$$$$$1$$$$$$1$$$$$$1$$$$$$0$$$$$$0$$$$$$0$$$

Reduced grid $$$0$$$$$$1$$$$$$1$$$$$$0$$$

Help Tina reduce the grid by a factor of $$$k$$$.

## Input Format
The first line contains $$$t$$$ ($$$1 \leq t \leq 100$$$) – the number of test cases.

The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 1000$$$, $$$1 \le k \le n$$$, $$$k$$$ is a divisor of $$$n$$$) — the number of rows and columns of the grid, and the factor that Tina wants to reduce the grid by.

Each of the following $$$n$$$ lines contain $$$n$$$ characters describing the cells of the grid. Each character is either $$$0$$$ or $$$1$$$. It is guaranteed every $$$k$$$ by $$$k$$$ block has the same value.

It is guaranteed the sum of $$$n$$$ over all test cases does not exceed $$$1000$$$.

## Output Format
For each test case, output the grid reduced by a factor of $$$k$$$ on a new line.

## Examples
```input
4
4 4
0000
0000
0000
0000
6 3
000111
000111
000111
111000
111000
111000
6 2
001100
001100
111111
111111
110000
110000
8 1
11111111
11111111
11111111
11111111
11111111
11111111
11111111
11111111
```
```output
0
01
10
010
111
100
11111111
11111111
11111111
11111111
11111111
11111111
11111111
11111111
```

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
You are given two strings $$$a$$$ and $$$b$$$ of length $$$n$$$. Then, you are (forced against your will) to answer $$$q$$$ queries.

For each query, you are given a range bounded by $$$l$$$ and $$$r$$$. In one operation, you can choose an integer $$$i$$$ ($$$l \leq i \leq r$$$) and set $$$a_i = x$$$ where $$$x$$$ is any character you desire. Output the minimum number of operations you must perform such that $$$\texttt{sorted(a[l..r])} = \texttt{sorted(b[l..r])}$$$. The operations you perform on one query does not affect other queries.

For an arbitrary string $$$c$$$, $$$\texttt{sorted(c[l..r])}$$$ denotes the substring consisting of characters $$$c_l, c_{l+1}, ... , c_r$$$ sorted in lexicographical order.

## Input Format
The first line contains $$$t$$$ ($$$1 \leq t \leq 1000$$$) – the number of test cases.

The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \leq n, q \leq 2 \cdot 10^5$$$) – the length of both strings and the number of queries.

The following line contains $$$a$$$ of length $$$n$$$. It is guaranteed $$$a$$$ only contains lowercase latin letters.

The following line contains $$$b$$$ of length $$$n$$$. It is guaranteed $$$b$$$ only contains lowercase latin letters.

The following $$$q$$$ lines contain two integers $$$l$$$ and $$$r$$$ ($$$1 \leq l \leq r \leq n$$$) – the range of the query.

It is guaranteed the sum of $$$n$$$ and $$$q$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.

## Output Format
For each query, output an integer, the minimum number of operations you need to perform in a new line.

## Examples
```input
3
5 3
abcde
edcba
1 5
1 4
3 3
4 2
zzde
azbe
1 3
1 4
6 3
uwuwuw
wuwuwu
2 4
1 3
1 6
```
```output
0
1
0
2
2
1
1
0
```

## Note
For the first query, $$$\texttt{sorted(a[1..5])} =$$$ abcde and $$$\texttt{sorted(b[1..5])} =$$$ abcde, so no operations are necessary.

For the second query, you need to set $$$a_1 = $$$ e. Then, $$$\texttt{sorted(a[1..4])} = \texttt{sorted(b[1..4])} = $$$ bcde.

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: 2.0 seconds
Memory limit: 256.0 MB

# Problem
Given two integers $$$n$$$ and $$$x$$$, find the number of triplets ($$$a,b,c$$$) of positive integers such that $$$ab + ac + bc \le n$$$ and $$$a + b + c \le x$$$.

Note that order matters (e.g. ($$$1, 1, 2$$$) and ($$$1, 2, 1$$$) are treated as different) and $$$a$$$, $$$b$$$, $$$c$$$ must be strictly greater than $$$0$$$.

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

Each test case contains two integers $$$n$$$ and $$$x$$$ ($$$1 \leq n,x \leq 10^6$$$).

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

## Output Format
Output a single integer — the number of triplets ($$$a,b,c$$$) of positive integers such that $$$ab + ac + bc \le n$$$ and $$$a + b + c \le x$$$.

## Examples
```input
4
7 4
10 5
7 1000
900000 400000
```
```output
4
10
7
1768016938
```

## Note
In the first test case, the triplets are ($$$1, 1, 1$$$), ($$$1, 1, 2$$$), ($$$1, 2, 1$$$), and ($$$2, 1, 1$$$).

In the second test case, the triplets are ($$$1, 1, 1$$$), ($$$1, 1, 2$$$), ($$$1, 1, 3$$$), ($$$1, 2, 1$$$), ($$$1, 2, 2$$$), ($$$1, 3, 1$$$), ($$$2, 1, 1$$$), ($$$2, 1, 2$$$), ($$$2, 2, 1$$$), and ($$$3, 1, 1$$$).

Now solve the problem and return the code.