**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Phone Desktop
time_limit_ms: 1000
memory_limit_mb: 256
Description: Little Rosie has a phone with a desktop (or launcher, as it is also called). The desktop can consist of several screens. Each screen is represented as a grid of size $5 \times 3$, i.e., five rows and three columns.

There are $x$ applications with an icon size of $1 \times 1$ cells; such an icon occupies only one cell of the screen. There are also $y$ applications with an icon size of $2 \times 2$ cells; such an icon occupies a square of $4$ cells on the screen. Each cell of each screen can be occupied by no more than one icon.

Rosie wants to place the application icons on the minimum number of screens. Help her find the minimum number of screens needed.

Input: The first line of the input contains $t$ ($1 \leq t \leq 10^4$) — the number of test cases.

The first and only line of each test case contains two integers $x$ and $y$ ($0 \leq x, y \leq 99$) — the number of applications with a $1 \times 1$ icon and the number of applications with a $2 \times 2$ icon, respectively.

Output: For each test case, output the minimal number of required screens on a separate line.

Examples:
input:
11
1 1
7 2
12 4
0 3
1 0
8 1
0 0
2 0
15 0
8 2
0 9
output:
1
1
2
2
1
1
0
1
1
2
5

Note: The solution for the first test case can look as follows:

![](CDN_BASE_URL/c1f8e47d264264fb303b101863bef14b) Blue squares represent empty spaces for icons, green squares represent $1 \times 1$ icons, red squares represent $2 \times 2$ icons

The solution for the third test case can look as follows:

![](CDN_BASE_URL/05b392e954bd162bfc00b3f026bcba0d)

Buggy Code:
def box(x,y):
    if x <= 0 and y <= 0:
        return 0
    if x > 0 and y <= 0:
        return 1 + box(x-15,y)
    elif x <= 0 and y >0:
        return 1 + box(x,y-2)
    else:
        if x + y*4 <= 15: return 1
        else:
            return 1 + box(x-7,y-2)
n = int(input())
for i in range(n):
     k = input()
     s = []
     for j in k.split():
         s.append(int(j))
     print(box(s[0],s[1]))

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To expose the bug in the provided code, we need to focus on edge cases where the code's logic might fail. The primary issues in the code are:

1. The handling of the base case where both `x` and `y` are zero.
2. The recursive calls that do not correctly account for the placement of icons.
3. The incorrect conditions for the recursive calls, especially when both `x` and `y` are non-zero.

Let's consider the following test cases:

1. **Case with only 1x1 icons (x > 0, y = 0):**
   - This should handle the case where only 1x1 icons are present and should correctly calculate the number of screens needed.
   - Example: `15 0` (Expected output: 1)

2. **Case with only 2x2 icons (x = 0, y > 0):**
   - This should handle the case where only 2x2 icons are present and should correctly calculate the number of screens needed.
   - Example: `0 2` (Expected output: 1)

3. **Case with both 1x1 and 2x2 icons (x > 0, y > 0):**
   - This should handle the case where both types of icons are present and should correctly calculate the number of screens needed.
   - Example: `7 1` (Expected output: 1)

4. **Case with a large number of 1x1 icons and a few 2x2 icons:**
   - This should handle the case where the number of 1x1 icons is large and the number of 2x2 icons is small.
   - Example: `14 1` (Expected output: 2)

5. **Case with a large number of 2x2 icons and a few 1x1 icons:**
   - This should handle the case where the number of 2x2 icons is large and the number of 1x1 icons is small.
   - Example: `1 4` (Expected output: 2)

6. **Case with a mix of 1x1 and 2x2 icons that require multiple screens:**
   - This should handle the case where the number of icons is such that more than one screen is required.
   - Example: `16 2` (Expected output: 2)

7. **Case with a mix of 1x1 and 2x2 icons that exactly fit one screen:**
   - This should handle the case where the number of icons is such that they exactly fit one screen.
   - Example: `7 2` (Expected output: 1)

8. **Case with zero icons:**
   - This should handle the case where there are no icons to place.
   - Example: `0 0` (Expected output: 0)

9. **Case with a very large number of 1x1 icons and no 2x2 icons:**
   - This should handle the case where the number of 1x1 icons is very large.
   - Example: `99 0` (Expected output: 7)

10. **Case with a very large number of 2x2 icons and no 1x1 icons:**
    - This should handle the case where the number of 2x2 icons is very large.
    - Example: `0 99` (Expected output: 49)

Given these considerations, a small-scale test input that exposes the bug in the provided code is:

```plaintext
5
15 0
0 2
7 1
14 1
1 4
```

This input includes a mix of cases that should highlight the issues in the code's logic.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Phone Desktop
time_limit_ms: 1000
memory_limit_mb: 256
Description: Little Rosie has a phone with a desktop (or launcher, as it is also called). The desktop can consist of several screens. Each screen is represented as a grid of size $5 \times 3$, i.e., five rows and three columns.

There are $x$ applications with an icon size of $1 \times 1$ cells; such an icon occupies only one cell of the screen. There are also $y$ applications with an icon size of $2 \times 2$ cells; such an icon occupies a square of $4$ cells on the screen. Each cell of each screen can be occupied by no more than one icon.

Rosie wants to place the application icons on the minimum number of screens. Help her find the minimum number of screens needed.

Input: The first line of the input contains $t$ ($1 \leq t \leq 10^4$) — the number of test cases.

The first and only line of each test case contains two integers $x$ and $y$ ($0 \leq x, y \leq 99$) — the number of applications with a $1 \times 1$ icon and the number of applications with a $2 \times 2$ icon, respectively.

Output: For each test case, output the minimal number of required screens on a separate line.

Examples:
input:
11
1 1
7 2
12 4
0 3
1 0
8 1
0 0
2 0
15 0
8 2
0 9
output:
1
1
2
2
1
1
0
1
1
2
5

Note: The solution for the first test case can look as follows:

![](CDN_BASE_URL/c1f8e47d264264fb303b101863bef14b) Blue squares represent empty spaces for icons, green squares represent $1 \times 1$ icons, red squares represent $2 \times 2$ icons

The solution for the third test case can look as follows:

![](CDN_BASE_URL/05b392e954bd162bfc00b3f026bcba0d)

Buggy Code:
// Online Java Compiler
// Use this editor to write, compile and run your Java code online
import java.util.*;
public class HelloWorld {
    public static void main(String[] args) {
        Scanner Sc=new Scanner(System.in);
        int N=Sc.nextInt();
        Sc.nextLine();
        for(int j=0;j<N;j++){
            int XX=0;
            String S=Sc.nextLine();
            String L[]=S.split(" ");
            int X=Integer.parseInt(L[0]);
            int Y=Integer.parseInt(L[1]);

            if(Y%2==0){
                XX+=Y/2;
            }
            else{
                XX+=(Y/2)+1;
            }
            int TB=15*XX;
            int BL=TB-(Y*4);
            if(BL>=X){
                System.out.println(XX);
            }
            else{
                XX+=1;
                System.out.println(XX);
            }

        }
    }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To generate a challenging test input that exposes the bug in the provided buggy code, we need to focus on edge cases where the code might fail. The main issues in the buggy code are:

1. Incorrect calculation of the number of screens needed for 2x2 icons.
2. Incorrect handling of the remaining space after placing 2x2 icons.
3. Incorrect calculation of the total number of screens required.

Let's consider the following edge cases:

1. **No 2x2 icons, but a large number of 1x1 icons**:
   - This case tests whether the code correctly handles scenarios where only 1x1 icons are present.
2. **A large number of 2x2 icons**:
   - This case tests whether the code correctly handles scenarios where only 2x2 icons are present.
3. **A mix of 1x1 and 2x2 icons that require multiple screens**:
   - This case tests whether the code correctly handles scenarios where both types of icons are present and require multiple screens.

Here is a small-scale test input that includes these edge cases:

```plaintext
4
0 10
15 0
8 2
1 15
```

### Explanation:
1. **Test Case 1: 0 10**
   - 10 2x2 icons, which will require 5 screens (each screen can fit 2 2x2 icons).
   - The code should output 5.

2. **Test Case 2: 15 0**
   - 15 1x1 icons, which will require 1 screen (since each screen can fit 15 1x1 icons).
   - The code should output 1.

3. **Test Case 3: 8 2**
   - 8 1x1 icons and 2 2x2 icons.
   - The 2 2x2 icons will take up 2 screens (each screen can fit 2 2x2 icons).
   - The remaining 8 1x1 icons can fit in the remaining space of the 2 screens.
   - The code should output 2.

4. **Test Case 4: 1 15**
   - 1 1x1 icon and 15 2x2 icons.
   - 15 2x2 icons will require 8 screens (since each screen can fit 2 2x2 icons, and 15/2 = 7.5, which rounds up to 8).
   - The remaining 1 1x1 icon can fit in the remaining space of the 8 screens.
   - The code should output 8.

This test input will help identify the issues in the buggy code by covering a variety of scenarios.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Phone Desktop
time_limit_ms: 1000
memory_limit_mb: 256
Description: Little Rosie has a phone with a desktop (or launcher, as it is also called). The desktop can consist of several screens. Each screen is represented as a grid of size $5 \times 3$, i.e., five rows and three columns.

There are $x$ applications with an icon size of $1 \times 1$ cells; such an icon occupies only one cell of the screen. There are also $y$ applications with an icon size of $2 \times 2$ cells; such an icon occupies a square of $4$ cells on the screen. Each cell of each screen can be occupied by no more than one icon.

Rosie wants to place the application icons on the minimum number of screens. Help her find the minimum number of screens needed.

Input: The first line of the input contains $t$ ($1 \leq t \leq 10^4$) — the number of test cases.

The first and only line of each test case contains two integers $x$ and $y$ ($0 \leq x, y \leq 99$) — the number of applications with a $1 \times 1$ icon and the number of applications with a $2 \times 2$ icon, respectively.

Output: For each test case, output the minimal number of required screens on a separate line.

Examples:
input:
11
1 1
7 2
12 4
0 3
1 0
8 1
0 0
2 0
15 0
8 2
0 9
output:
1
1
2
2
1
1
0
1
1
2
5

Note: The solution for the first test case can look as follows:

![](CDN_BASE_URL/c1f8e47d264264fb303b101863bef14b) Blue squares represent empty spaces for icons, green squares represent $1 \times 1$ icons, red squares represent $2 \times 2$ icons

The solution for the third test case can look as follows:

![](CDN_BASE_URL/05b392e954bd162bfc00b3f026bcba0d)

Buggy Code:
import java.util.*;
public class Cf{
    public static void main(String args[]){
        Scanner s=new Scanner(System.in);
        int t=s.nextInt();
        // int t=1;
        while(t-- >0){
            int x=s.nextInt();
            int y=s.nextInt();
            // int x=18;
            // int y=3;
            int res=0;
            if(x==0 && y==0)
                System.out.println(0);
            else if (x==0)
                System.out.println((y+1)/2);
            else if(y==0)
                System.out.println((x+14)/15);
            else{
                while(x>0 || y>0){
                    if(y<=0){
                        x=x-15;
                        res++;
                    }
                    else if(y%2==0){
                        x=x-7;
                        y=y-2;
                        res++;
                    }
                    else{
                        x=x-11;
                        y=y-2;
                        res++;
                    }
                }
                System.out.println(res);
            }
        }
    }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
15 2
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Phone Desktop
time_limit_ms: 1000
memory_limit_mb: 256
Description: Little Rosie has a phone with a desktop (or launcher, as it is also called). The desktop can consist of several screens. Each screen is represented as a grid of size $5 \times 3$, i.e., five rows and three columns.

There are $x$ applications with an icon size of $1 \times 1$ cells; such an icon occupies only one cell of the screen. There are also $y$ applications with an icon size of $2 \times 2$ cells; such an icon occupies a square of $4$ cells on the screen. Each cell of each screen can be occupied by no more than one icon.

Rosie wants to place the application icons on the minimum number of screens. Help her find the minimum number of screens needed.

Input: The first line of the input contains $t$ ($1 \leq t \leq 10^4$) — the number of test cases.

The first and only line of each test case contains two integers $x$ and $y$ ($0 \leq x, y \leq 99$) — the number of applications with a $1 \times 1$ icon and the number of applications with a $2 \times 2$ icon, respectively.

Output: For each test case, output the minimal number of required screens on a separate line.

Examples:
input:
11
1 1
7 2
12 4
0 3
1 0
8 1
0 0
2 0
15 0
8 2
0 9
output:
1
1
2
2
1
1
0
1
1
2
5

Note: The solution for the first test case can look as follows:

![](CDN_BASE_URL/c1f8e47d264264fb303b101863bef14b) Blue squares represent empty spaces for icons, green squares represent $1 \times 1$ icons, red squares represent $2 \times 2$ icons

The solution for the third test case can look as follows:

![](CDN_BASE_URL/05b392e954bd162bfc00b3f026bcba0d)

Buggy Code:
#include <bits/stdc++.h>

using namespace std;

int main() {
    int t;
    cin >> t;

    while(t--) {
        int x, y, ans = 0;
        cin >> x >> y;

        int c = y / 2;
        if(y % 2 == 1) c++;

        ans = c;

        if(c == 0) {
            ans = x / 15;
            if(x % 15 != 0) ans++;

            cout << ans << endl;
            continue;
        }

        if(y % 2 == 0) {
            if(x > c * 7) {
                ans++;
                x -= 15;
            }
            else x = 0;

            while(x > 0) {
                ans++;
                x -= 15;
            }
        }
        else {
            if(x > (c - 1) * 7 + 11) {
                ans++;
                x -= 15;
            }
            else x = 0;

            while(x > 0) {
                ans++;
                x -= 15;
            }
        }

        cout << ans << endl;
    }

    return 0;
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
14 2
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Phone Desktop
time_limit_ms: 1000
memory_limit_mb: 256
Description: Little Rosie has a phone with a desktop (or launcher, as it is also called). The desktop can consist of several screens. Each screen is represented as a grid of size $5 \times 3$, i.e., five rows and three columns.

There are $x$ applications with an icon size of $1 \times 1$ cells; such an icon occupies only one cell of the screen. There are also $y$ applications with an icon size of $2 \times 2$ cells; such an icon occupies a square of $4$ cells on the screen. Each cell of each screen can be occupied by no more than one icon.

Rosie wants to place the application icons on the minimum number of screens. Help her find the minimum number of screens needed.

Input: The first line of the input contains $t$ ($1 \leq t \leq 10^4$) — the number of test cases.

The first and only line of each test case contains two integers $x$ and $y$ ($0 \leq x, y \leq 99$) — the number of applications with a $1 \times 1$ icon and the number of applications with a $2 \times 2$ icon, respectively.

Output: For each test case, output the minimal number of required screens on a separate line.

Examples:
input:
11
1 1
7 2
12 4
0 3
1 0
8 1
0 0
2 0
15 0
8 2
0 9
output:
1
1
2
2
1
1
0
1
1
2
5

Note: The solution for the first test case can look as follows:

![](CDN_BASE_URL/c1f8e47d264264fb303b101863bef14b) Blue squares represent empty spaces for icons, green squares represent $1 \times 1$ icons, red squares represent $2 \times 2$ icons

The solution for the third test case can look as follows:

![](CDN_BASE_URL/05b392e954bd162bfc00b3f026bcba0d)

Buggy Code:
#include<bits/stdc++.h>
using namespace std;
#define fio        ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long int
#define nl cout<<endl;
int main()
{
    ll t;
    cin>>t;
    while(t--){
        ll x,y;
        cin>>x>>y;
        ll r=ceil(y/2.0);
        if(x==0 && y==0)cout<<"0"<<endl;
        else if(x==0)cout<<ceil(y/2.0)<<endl;
        else if(y==0)cout<<ceil(x/15.0)<<endl;
        else if(r*(15-y*4)>=x)cout<<r<<endl;
         else{
            ll d = x-(r*7);
            cout<<r+ceil(d/15.0)<<endl;
        }

    }

}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
5
1 14
14 1
15 1
16 1
0 15
```

**Explanation:**

1. **Test Case 1: (1, 14)**
   - This test case checks the scenario where there is a single 1x1 icon and a large number of 2x2 icons. The code should correctly handle the placement of 14 2x2 icons, which would require 7 screens, and the remaining 1x1 icon can fit into one of these screens.

2. **Test Case 2: (14, 1)**
   - This test case checks the scenario where there are 14 1x1 icons and a single 2x2 icon. The code should correctly place the 2x2 icon and then place the 14 1x1 icons, which can fit into 2 screens (one for the 2x2 icon and one for the 14 1x1 icons).

3. **Test Case 3: (15, 1)**
   - This test case checks the scenario where there are 15 1x1 icons and a single 2x2 icon. The code should correctly place the 2x2 icon and then place the 15 1x1 icons, which can fit into 2 screens (one for the 2x2 icon and one for the 15 1x1 icons).

4. **Test Case 4: (16, 1)**
   - This test case checks the scenario where there are 16 1x1 icons and a single 2x2 icon. The code should correctly place the 2x2 icon and then place the 16 1x1 icons, which would require 3 screens (one for the 2x2 icon and two for the 16 1x1 icons).

5. **Test Case 5: (0, 15)**
   - This test case checks the scenario where there are no 1x1 icons and a large number of 2x2 icons. The code should correctly handle the placement of 15 2x2 icons, which would require 8 screens.

These test cases are designed to challenge the buggy code by focusing on edge cases and scenarios that maximize the failure probability in faulty solutions.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Phone Desktop
time_limit_ms: 1000
memory_limit_mb: 256
Description: Little Rosie has a phone with a desktop (or launcher, as it is also called). The desktop can consist of several screens. Each screen is represented as a grid of size $5 \times 3$, i.e., five rows and three columns.

There are $x$ applications with an icon size of $1 \times 1$ cells; such an icon occupies only one cell of the screen. There are also $y$ applications with an icon size of $2 \times 2$ cells; such an icon occupies a square of $4$ cells on the screen. Each cell of each screen can be occupied by no more than one icon.

Rosie wants to place the application icons on the minimum number of screens. Help her find the minimum number of screens needed.

Input: The first line of the input contains $t$ ($1 \leq t \leq 10^4$) — the number of test cases.

The first and only line of each test case contains two integers $x$ and $y$ ($0 \leq x, y \leq 99$) — the number of applications with a $1 \times 1$ icon and the number of applications with a $2 \times 2$ icon, respectively.

Output: For each test case, output the minimal number of required screens on a separate line.

Examples:
input:
11
1 1
7 2
12 4
0 3
1 0
8 1
0 0
2 0
15 0
8 2
0 9
output:
1
1
2
2
1
1
0
1
1
2
5

Note: The solution for the first test case can look as follows:

![](CDN_BASE_URL/c1f8e47d264264fb303b101863bef14b) Blue squares represent empty spaces for icons, green squares represent $1 \times 1$ icons, red squares represent $2 \times 2$ icons

The solution for the third test case can look as follows:

![](CDN_BASE_URL/05b392e954bd162bfc00b3f026bcba0d)

Buggy Code:
import math
t=int(input())
for _ in range(t):
    a,b=map(int,input().split())
    if b<=2:
        x=(a+b*4)
        print(math.ceil(x/15))
    else:
        x=math.ceil(b/2)
        n=x*15
        m=b*4
        o=a//(n-m)
        print(x+o)

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
5
14 3
15 3
16 3
17 3
18 3
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Phone Desktop
time_limit_ms: 1000
memory_limit_mb: 256
Description: Little Rosie has a phone with a desktop (or launcher, as it is also called). The desktop can consist of several screens. Each screen is represented as a grid of size $5 \times 3$, i.e., five rows and three columns.

There are $x$ applications with an icon size of $1 \times 1$ cells; such an icon occupies only one cell of the screen. There are also $y$ applications with an icon size of $2 \times 2$ cells; such an icon occupies a square of $4$ cells on the screen. Each cell of each screen can be occupied by no more than one icon.

Rosie wants to place the application icons on the minimum number of screens. Help her find the minimum number of screens needed.

Input: The first line of the input contains $t$ ($1 \leq t \leq 10^4$) — the number of test cases.

The first and only line of each test case contains two integers $x$ and $y$ ($0 \leq x, y \leq 99$) — the number of applications with a $1 \times 1$ icon and the number of applications with a $2 \times 2$ icon, respectively.

Output: For each test case, output the minimal number of required screens on a separate line.

Examples:
input:
11
1 1
7 2
12 4
0 3
1 0
8 1
0 0
2 0
15 0
8 2
0 9
output:
1
1
2
2
1
1
0
1
1
2
5

Note: The solution for the first test case can look as follows:

![](CDN_BASE_URL/c1f8e47d264264fb303b101863bef14b) Blue squares represent empty spaces for icons, green squares represent $1 \times 1$ icons, red squares represent $2 \times 2$ icons

The solution for the third test case can look as follows:

![](CDN_BASE_URL/05b392e954bd162bfc00b3f026bcba0d)

Buggy Code:
from collections import Counter
import math as mt

def si():
    return input()

def ii():
    return int(input())

def fi():
    return float(input())

def ili(n=None):
    if n:
        return list(map(int, input().split()))[:n]
    return list(map(int, input().split()))

def fli(n=None):
    if n:
        return list(map(float, input().split()))[:n]
    return list(map(float, input().split()))

def sli(n=None):
    if n:
        return list(map(str, input().split()))[:n]
    return list(map(str, input().split()))

def minInd(m: list):
    mn = m[0]
    ind = 0
    l = len(m)
    for i in range(1, l):
        if m[i] < mn:
            mn = m[i]
            ind = i
    return [mn, ind]

def main():
    t = ii()
    for _ in range(t):
        n, k = ili(2)
        if k == 0 and n == 0:
            print(0)
        elif k == 0:
            print(mt.ceil(n / 15))
        elif n == 0:
            print(mt.ceil(k / 2))
        elif k == 1:
            n -= 11
            if n < 0:
                print(1)
            else:
                print(mt.ceil(n / 15) + 1)
        else:
            kdis = mt.ceil(k / 2)
            n -= (kdis * 7)
            if n < 0:
                print(kdis)
            else:
                print(kdis + mt.ceil(n / 15))

if __name__ == "__main__":  # 12 4 6
    main()

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To generate a challenging test input that exposes the bug in the given buggy code, let's consider the edge cases and scenarios that might cause the code to fail. The code provided handles several conditions but might have issues in specific scenarios, especially where the number of large icons (2x2) and small icons (1x1) is such that the placement logic is not correctly handled.

### Steps to Identify Edge Cases:
1. **Zero Icons**: This case is already handled correctly.
2. **Only Small Icons**: This case is also handled correctly.
3. **Only Large Icons**: This case is also handled correctly.
4. **Mix of Small and Large Icons**:
   - **Small Number of Large Icons and Large Number of Small Icons**: This is where the code might have issues. Specifically, the code subtracts a fixed number of small icons based on the number of large icons, which might not always be the optimal placement.
   - **Large Number of Large Icons and Small Number of Small Icons**: This might also cause issues if the placement logic for large icons is not optimal.

### Challenging Test Cases:
- **Case 1**: A mix of a small number of large icons and a large number of small icons.
- **Case 2**: A mix of a large number of large icons and a small number of small icons.

### Test Input:
```plaintext
2
1 11
9 1
```

### Explanation:
1. **Test Case 1 (1 11)**:
   - 1 large icon (2x2) and 11 small icons (1x1).
   - The optimal placement would be to place the 2x2 icon in one corner and the 1x1 icons around it, but the code might incorrectly handle the subtraction of small icons, leading to an incorrect result.

2. **Test Case 2 (9 1)**:
   - 9 large icons (2x2) and 1 small icon (1x1).
   - The optimal placement would be to place the large icons in a way that minimizes the number of screens, but the code might incorrectly handle the placement of the large icons, leading to an incorrect result.

These test cases should help expose any bugs in the placement logic of the given buggy code.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Phone Desktop
time_limit_ms: 1000
memory_limit_mb: 256
Description: Little Rosie has a phone with a desktop (or launcher, as it is also called). The desktop can consist of several screens. Each screen is represented as a grid of size $5 \times 3$, i.e., five rows and three columns.

There are $x$ applications with an icon size of $1 \times 1$ cells; such an icon occupies only one cell of the screen. There are also $y$ applications with an icon size of $2 \times 2$ cells; such an icon occupies a square of $4$ cells on the screen. Each cell of each screen can be occupied by no more than one icon.

Rosie wants to place the application icons on the minimum number of screens. Help her find the minimum number of screens needed.

Input: The first line of the input contains $t$ ($1 \leq t \leq 10^4$) — the number of test cases.

The first and only line of each test case contains two integers $x$ and $y$ ($0 \leq x, y \leq 99$) — the number of applications with a $1 \times 1$ icon and the number of applications with a $2 \times 2$ icon, respectively.

Output: For each test case, output the minimal number of required screens on a separate line.

Examples:
input:
11
1 1
7 2
12 4
0 3
1 0
8 1
0 0
2 0
15 0
8 2
0 9
output:
1
1
2
2
1
1
0
1
1
2
5

Note: The solution for the first test case can look as follows:

![](CDN_BASE_URL/c1f8e47d264264fb303b101863bef14b) Blue squares represent empty spaces for icons, green squares represent $1 \times 1$ icons, red squares represent $2 \times 2$ icons

The solution for the third test case can look as follows:

![](CDN_BASE_URL/05b392e954bd162bfc00b3f026bcba0d)

Buggy Code:
import java.util.*;

public class Main{
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while(t-- != 0){
        int x = sc.nextInt();
        int y = sc.nextInt();
        if((x * y) != 0 && ((x + 4*y) > 15) ){
            System.out.println((int)Math.ceil((x + 4*y)/15.0));
        }
        else if(x == 0 && y==0){
            System.out.println(0);
        }
        else if(x != 0 && y == 0){
            System.out.println((int)Math.ceil(x/15.0));
        }
        else if(x == 0 && y != 0){
            System.out.println((int)Math.ceil(y/2.0));
        }
        else{
            System.out.println(1);
        }

        }
    }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
14 2
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Phone Desktop
time_limit_ms: 1000
memory_limit_mb: 256
Description: Little Rosie has a phone with a desktop (or launcher, as it is also called). The desktop can consist of several screens. Each screen is represented as a grid of size $5 \times 3$, i.e., five rows and three columns.

There are $x$ applications with an icon size of $1 \times 1$ cells; such an icon occupies only one cell of the screen. There are also $y$ applications with an icon size of $2 \times 2$ cells; such an icon occupies a square of $4$ cells on the screen. Each cell of each screen can be occupied by no more than one icon.

Rosie wants to place the application icons on the minimum number of screens. Help her find the minimum number of screens needed.

Input: The first line of the input contains $t$ ($1 \leq t \leq 10^4$) — the number of test cases.

The first and only line of each test case contains two integers $x$ and $y$ ($0 \leq x, y \leq 99$) — the number of applications with a $1 \times 1$ icon and the number of applications with a $2 \times 2$ icon, respectively.

Output: For each test case, output the minimal number of required screens on a separate line.

Examples:
input:
11
1 1
7 2
12 4
0 3
1 0
8 1
0 0
2 0
15 0
8 2
0 9
output:
1
1
2
2
1
1
0
1
1
2
5

Note: The solution for the first test case can look as follows:

![](CDN_BASE_URL/c1f8e47d264264fb303b101863bef14b) Blue squares represent empty spaces for icons, green squares represent $1 \times 1$ icons, red squares represent $2 \times 2$ icons

The solution for the third test case can look as follows:

![](CDN_BASE_URL/05b392e954bd162bfc00b3f026bcba0d)

Buggy Code:
import java.util.*;
public class Main {
    public static void main(String[]args)
    {Scanner sc=new Scanner(System.in);
//        System.out.println(Math.ceil(1.0/7));
       int t=sc.nextInt();
       for(int i=0;i<t;i++)
       {
           int x=sc.nextInt();
           double y=sc.nextDouble();
           int m=(int)Math.ceil(y/2);
           double num=7.0*m;
           double hh=x-num;
           if(m==0)
           {
               System.out.println((int)Math.ceil((double)x/15));
               continue;
           }
           if(y%2==1)
           {
               if((int)num>=x-1)
               {
                   System.out.println(m);continue;
               }
               else{
                   System.out.println((int)Math.ceil((hh-1)/7)+m);
                   continue;
               }

           }
           if((int)num>=x)
           {
               System.out.println(m);
           }
           else{
               System.out.println((int)Math.ceil(hh/7)+m);
           }

       }

    }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
14 2
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Phone Desktop
time_limit_ms: 1000
memory_limit_mb: 256
Description: Little Rosie has a phone with a desktop (or launcher, as it is also called). The desktop can consist of several screens. Each screen is represented as a grid of size $5 \times 3$, i.e., five rows and three columns.

There are $x$ applications with an icon size of $1 \times 1$ cells; such an icon occupies only one cell of the screen. There are also $y$ applications with an icon size of $2 \times 2$ cells; such an icon occupies a square of $4$ cells on the screen. Each cell of each screen can be occupied by no more than one icon.

Rosie wants to place the application icons on the minimum number of screens. Help her find the minimum number of screens needed.

Input: The first line of the input contains $t$ ($1 \leq t \leq 10^4$) — the number of test cases.

The first and only line of each test case contains two integers $x$ and $y$ ($0 \leq x, y \leq 99$) — the number of applications with a $1 \times 1$ icon and the number of applications with a $2 \times 2$ icon, respectively.

Output: For each test case, output the minimal number of required screens on a separate line.

Examples:
input:
11
1 1
7 2
12 4
0 3
1 0
8 1
0 0
2 0
15 0
8 2
0 9
output:
1
1
2
2
1
1
0
1
1
2
5

Note: The solution for the first test case can look as follows:

![](CDN_BASE_URL/c1f8e47d264264fb303b101863bef14b) Blue squares represent empty spaces for icons, green squares represent $1 \times 1$ icons, red squares represent $2 \times 2$ icons

The solution for the third test case can look as follows:

![](CDN_BASE_URL/05b392e954bd162bfc00b3f026bcba0d)

Buggy Code:
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>

using namespace std;

#define DestroeD ios::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);
#define ll long long

void solve() {
    int a, b; cin >> a >> b;
    int num;
    if(b%2 == 0){
        num = b/2;
        a -= num*7;
        if(a <= 0){
            cout << num << endl;
        }
        else{
            cout << num + ceil((double)a / 15) << endl;
        }
    }
    else{
        num = b/2+1;
        a -= num*7 + 11;
        if(a <= 0){
            cout << num << endl;
        }
        else{
            cout << num + ceil((double)a / 15) << endl;
        }
    }
}

int main() {
    DestroeD

    int t; cin >> t;

    while(t--) {
        solve();
    }

    return 0;
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To expose the bug in the provided buggy code, let's consider the logic and edge cases:

### Logic Analysis
1. The code calculates the number of screens based on the number of 2x2 icons (`b`) and 1x1 icons (`a`).
2. If `b` is even, it tries to place `b/2` 2x2 icons on one screen, which takes up 8 cells (4 cells for each 2x2 icon).
3. If `b` is odd, it tries to place `b/2 + 1` 2x2 icons, which takes up 9 cells on one screen.
4. After placing the 2x2 icons, it calculates the remaining 1x1 icons and determines the number of additional screens needed.

### Edge Cases
1. **Zero 2x2 icons and many 1x1 icons**: This tests the base case where only 1x1 icons are present.
2. **One 2x2 icon and many 1x1 icons**: This tests the case where the 2x2 icon takes up 4 cells and the remaining 1x1 icons need to be placed.
3. **Many 2x2 icons and few 1x1 icons**: This tests the case where the 2x2 icons take up most of the space.
4. **Many 1x1 icons and few 2x2 icons**: This tests the case where the 1x1 icons take up most of the space.

### Chosen Test Input
Let's choose a test input that includes these edge cases:
- A case with only 1x1 icons.
- A case with one 2x2 icon and many 1x1 icons.
- A case with many 2x2 icons and few 1x1 icons.
- A case with many 1x1 icons and few 2x2 icons.

### Test Input
```plaintext
4
15 0
1 14
0 7
14 1
```

### Explanation
1. **15 0**: This tests the case where there are only 1x1 icons. The expected output is 1 screen, as 15 1x1 icons fit exactly into one 5x3 screen.
2. **1 14**: This tests the case with one 2x2 icon and many 1x1 icons. The 2x2 icon takes up 4 cells, leaving 11 cells for 1x1 icons. The expected output is 1 screen.
3. **0 7**: This tests the case with many 2x2 icons and no 1x1 icons. 7 2x2 icons require 7/2 = 3.5 screens, so the expected output is 4 screens.
4. **14 1**: This tests the case with many 1x1 icons and one 2x2 icon. The 2x2 icon takes up 4 cells, leaving 11 cells for 1x1 icons. The expected output is 1 screen.

This test input should expose any issues in the buggy code, particularly in how it handles the placement of 2x2 icons and the remaining 1x1 icons.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Phone Desktop
time_limit_ms: 1000
memory_limit_mb: 256
Description: Little Rosie has a phone with a desktop (or launcher, as it is also called). The desktop can consist of several screens. Each screen is represented as a grid of size $5 \times 3$, i.e., five rows and three columns.

There are $x$ applications with an icon size of $1 \times 1$ cells; such an icon occupies only one cell of the screen. There are also $y$ applications with an icon size of $2 \times 2$ cells; such an icon occupies a square of $4$ cells on the screen. Each cell of each screen can be occupied by no more than one icon.

Rosie wants to place the application icons on the minimum number of screens. Help her find the minimum number of screens needed.

Input: The first line of the input contains $t$ ($1 \leq t \leq 10^4$) — the number of test cases.

The first and only line of each test case contains two integers $x$ and $y$ ($0 \leq x, y \leq 99$) — the number of applications with a $1 \times 1$ icon and the number of applications with a $2 \times 2$ icon, respectively.

Output: For each test case, output the minimal number of required screens on a separate line.

Examples:
input:
11
1 1
7 2
12 4
0 3
1 0
8 1
0 0
2 0
15 0
8 2
0 9
output:
1
1
2
2
1
1
0
1
1
2
5

Note: The solution for the first test case can look as follows:

![](CDN_BASE_URL/c1f8e47d264264fb303b101863bef14b) Blue squares represent empty spaces for icons, green squares represent $1 \times 1$ icons, red squares represent $2 \times 2$ icons

The solution for the third test case can look as follows:

![](CDN_BASE_URL/05b392e954bd162bfc00b3f026bcba0d)

Buggy Code:
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    cin >> t;
    int i = 1;
    while(t--)
    {
        int x, y;
        cin >> x >> y;
        if(i == 1503) cout << "x = " << x << " y = " << y << "\n";
        i++;

        int screens = (y + 1) / 2;

        int remain = screens * 15 - 4 * y;

        if(remain > 0)
        screens += ((x - 1) / remain);

        else
        screens += ((x+14)/15);

        cout << screens << "\n";
    }

    return 0;
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
99 24
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Phone Desktop
time_limit_ms: 1000
memory_limit_mb: 256
Description: Little Rosie has a phone with a desktop (or launcher, as it is also called). The desktop can consist of several screens. Each screen is represented as a grid of size $5 \times 3$, i.e., five rows and three columns.

There are $x$ applications with an icon size of $1 \times 1$ cells; such an icon occupies only one cell of the screen. There are also $y$ applications with an icon size of $2 \times 2$ cells; such an icon occupies a square of $4$ cells on the screen. Each cell of each screen can be occupied by no more than one icon.

Rosie wants to place the application icons on the minimum number of screens. Help her find the minimum number of screens needed.

Input: The first line of the input contains $t$ ($1 \leq t \leq 10^4$) — the number of test cases.

The first and only line of each test case contains two integers $x$ and $y$ ($0 \leq x, y \leq 99$) — the number of applications with a $1 \times 1$ icon and the number of applications with a $2 \times 2$ icon, respectively.

Output: For each test case, output the minimal number of required screens on a separate line.

Examples:
input:
11
1 1
7 2
12 4
0 3
1 0
8 1
0 0
2 0
15 0
8 2
0 9
output:
1
1
2
2
1
1
0
1
1
2
5

Note: The solution for the first test case can look as follows:

![](CDN_BASE_URL/c1f8e47d264264fb303b101863bef14b) Blue squares represent empty spaces for icons, green squares represent $1 \times 1$ icons, red squares represent $2 \times 2$ icons

The solution for the third test case can look as follows:

![](CDN_BASE_URL/05b392e954bd162bfc00b3f026bcba0d)

Buggy Code:
import math

def min_screens(x, y):
    count = 0
    a = 15
    count = math.ceil(y/2)
    total_cells = x + (2 * count)
    o = (15*count) -(4*y) - x
    if o < 0   :
        return(math.ceil(x/15) + count)
    else:
        return(count)

t = int(input())

for _ in range(t):

    x, y = map(int, input().split())

    print(min_screens(x, y))

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
9 2
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Phone Desktop
time_limit_ms: 1000
memory_limit_mb: 256
Description: Little Rosie has a phone with a desktop (or launcher, as it is also called). The desktop can consist of several screens. Each screen is represented as a grid of size $5 \times 3$, i.e., five rows and three columns.

There are $x$ applications with an icon size of $1 \times 1$ cells; such an icon occupies only one cell of the screen. There are also $y$ applications with an icon size of $2 \times 2$ cells; such an icon occupies a square of $4$ cells on the screen. Each cell of each screen can be occupied by no more than one icon.

Rosie wants to place the application icons on the minimum number of screens. Help her find the minimum number of screens needed.

Input: The first line of the input contains $t$ ($1 \leq t \leq 10^4$) — the number of test cases.

The first and only line of each test case contains two integers $x$ and $y$ ($0 \leq x, y \leq 99$) — the number of applications with a $1 \times 1$ icon and the number of applications with a $2 \times 2$ icon, respectively.

Output: For each test case, output the minimal number of required screens on a separate line.

Examples:
input:
11
1 1
7 2
12 4
0 3
1 0
8 1
0 0
2 0
15 0
8 2
0 9
output:
1
1
2
2
1
1
0
1
1
2
5

Note: The solution for the first test case can look as follows:

![](CDN_BASE_URL/c1f8e47d264264fb303b101863bef14b) Blue squares represent empty spaces for icons, green squares represent $1 \times 1$ icons, red squares represent $2 \times 2$ icons

The solution for the third test case can look as follows:

![](CDN_BASE_URL/05b392e954bd162bfc00b3f026bcba0d)

Buggy Code:
n = int(input())

for i in range(n):
    a, b = list(map(int, input().split()))
    if b>a:
        k = (-(-b//2))
        k += a//15
        print(k)
    else:
        tg = a + (b*4)
        print(-(-tg//15))

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
10
0 0
1 0
0 1
1 1
14 1
15 0
14 2
15 1
1 14
0 15
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Phone Desktop
time_limit_ms: 1000
memory_limit_mb: 256
Description: Little Rosie has a phone with a desktop (or launcher, as it is also called). The desktop can consist of several screens. Each screen is represented as a grid of size $5 \times 3$, i.e., five rows and three columns.

There are $x$ applications with an icon size of $1 \times 1$ cells; such an icon occupies only one cell of the screen. There are also $y$ applications with an icon size of $2 \times 2$ cells; such an icon occupies a square of $4$ cells on the screen. Each cell of each screen can be occupied by no more than one icon.

Rosie wants to place the application icons on the minimum number of screens. Help her find the minimum number of screens needed.

Input: The first line of the input contains $t$ ($1 \leq t \leq 10^4$) — the number of test cases.

The first and only line of each test case contains two integers $x$ and $y$ ($0 \leq x, y \leq 99$) — the number of applications with a $1 \times 1$ icon and the number of applications with a $2 \times 2$ icon, respectively.

Output: For each test case, output the minimal number of required screens on a separate line.

Examples:
input:
11
1 1
7 2
12 4
0 3
1 0
8 1
0 0
2 0
15 0
8 2
0 9
output:
1
1
2
2
1
1
0
1
1
2
5

Note: The solution for the first test case can look as follows:

![](CDN_BASE_URL/c1f8e47d264264fb303b101863bef14b) Blue squares represent empty spaces for icons, green squares represent $1 \times 1$ icons, red squares represent $2 \times 2$ icons

The solution for the third test case can look as follows:

![](CDN_BASE_URL/05b392e954bd162bfc00b3f026bcba0d)

Buggy Code:
import java.util.Scanner;

public class Q1
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();

        while(t-- > 0)
        {
            int x = sc.nextInt(); // 1 x 1
            int y = sc.nextInt(); // 2 x 2

            //  screen size = 5 x 3
            int count = (int) Math.ceil((float) y / 2.0);

            if (y % 2 == 0)
            {
                if (x > count * 7)
                {
                    // System.out.println("Here" + count);
                    count += (int) Math.ceil((x - count * 7) / 15.0);
                }
            }
            else
            {
                if (x > (count - 1) * 7 + 11)
                {
                    // System.out.println("Here" + count);
                    count += (int) Math.ceil((x - (count - 1) * 7) / 15.0);
                }
            }
            System.out.println(count);
        }
    }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
3
0 8
15 3
22 1
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Phone Desktop
time_limit_ms: 1000
memory_limit_mb: 256
Description: Little Rosie has a phone with a desktop (or launcher, as it is also called). The desktop can consist of several screens. Each screen is represented as a grid of size $5 \times 3$, i.e., five rows and three columns.

There are $x$ applications with an icon size of $1 \times 1$ cells; such an icon occupies only one cell of the screen. There are also $y$ applications with an icon size of $2 \times 2$ cells; such an icon occupies a square of $4$ cells on the screen. Each cell of each screen can be occupied by no more than one icon.

Rosie wants to place the application icons on the minimum number of screens. Help her find the minimum number of screens needed.

Input: The first line of the input contains $t$ ($1 \leq t \leq 10^4$) — the number of test cases.

The first and only line of each test case contains two integers $x$ and $y$ ($0 \leq x, y \leq 99$) — the number of applications with a $1 \times 1$ icon and the number of applications with a $2 \times 2$ icon, respectively.

Output: For each test case, output the minimal number of required screens on a separate line.

Examples:
input:
11
1 1
7 2
12 4
0 3
1 0
8 1
0 0
2 0
15 0
8 2
0 9
output:
1
1
2
2
1
1
0
1
1
2
5

Note: The solution for the first test case can look as follows:

![](CDN_BASE_URL/c1f8e47d264264fb303b101863bef14b) Blue squares represent empty spaces for icons, green squares represent $1 \times 1$ icons, red squares represent $2 \times 2$ icons

The solution for the third test case can look as follows:

![](CDN_BASE_URL/05b392e954bd162bfc00b3f026bcba0d)

Buggy Code:
import java.util.*;
public class Cf{
    public static void main(String args[]){
        Scanner s=new Scanner(System.in);
        int t=s.nextInt();
        // int t=1;
        while(t-- >0){
            int x=s.nextInt();
            int y=s.nextInt();
            // int x=18;
            // int y=3;
            int res=0;
            if(x==0 && y==0)
                System.out.println(0);
            else if (x==0)
                System.out.println((y+1)/2);
            else if(y==0)
                System.out.println((x+14)/15);
            else{
                while(x>0 || y>0){
                    if(y==0){
                        x=x-15;
                        res++;
                    }
                    else if(y%2==0){
                        x=x-7;
                        y=y-2;
                        res++;
                    }
                    else{
                        x=x-11;
                        y=y-2;
                        res++;
                    }
                }
                System.out.println(res);
            }
        }
    }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
14 2
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Trapped in the Witch's Labyrinth
time_limit_ms: 3000
memory_limit_mb: 256
Description: In the fourth labor of Rostam, the legendary hero from the Shahnameh, an old witch has created a magical maze to trap him. The maze is a rectangular grid consisting of $$$n$$$ rows and $$$m$$$ columns. Each cell in the maze points in a specific direction: up, down, left, or right. The witch has enchanted Rostam so that whenever he is in a cell, he will move to the next cell in the direction indicated by that cell.

If Rostam eventually exits the maze, he will be freed from the witch's enchantment and will defeat her. However, if he remains trapped within the maze forever, he will never escape.

The witch has not yet determined the directions for all the cells. She wants to assign directions to the unspecified cells in such a way that the number of starting cells from which Rostam will be trapped forever is maximized. Your task is to find the maximum number of starting cells which make Rostam trapped.

Input: The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$), the number of test cases.

For each test case:

- The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 1000$$$), representing the number of rows and columns in the maze.
- Each of the next $$$n$$$ lines contains a string of $$$m$$$ characters representing the directions in the maze. Each character is one of the following:   U (up)  D (down)  L (left)  R (right)  ? (unspecified direction)

It's guaranteed that the sum of $$$n \cdot m$$$ over all test cases is at most $$$10^6$$$.

Output: For each test case, print a single integer, the maximum number of starting cells from which Rostam will be trapped forever after assigning directions to the unspecified cells optimally.

Examples:
input:
3
3 3
UUU
L?R
DDD
2 3
???
???
3 3
?U?
R?L
RDL
output:
0
6
5

Note: In the first test case, all of the cells will be good no matter what you do.

In the second test case, if you assign the ?s like the picture below, all of the cells will be bad:

In the third test case, if you assign the ?s like the picture below, you will have $$$5$$$ bad cells (red-shaded cells):

Buggy Code:
// #pragma GCC optimize(2)
/* // 快读：返回读入的第一个整数
inline int read()
{
 int x=0,f=1;char ch=getchar();
 while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
 while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
 return x*f;
}*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <stack>
#include <map>
#include <queue>
#include <cmath>
#include <cstdio>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <cfloat>
#include <set>
#include <climits>
using namespace std;
//using f64 = long double;
//#define int long long
//# define int unsigned long long
// #define endl '\n'
// #define minn(a,b) (a>b?b:a)
const int N = 1e3 + 10, M = N * N;
const int base = 1e9;
const int basebit = 9;
const int mod = 1e9 + 7;
const long long INF = 1e18;
typedef long long ll;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<pair<int, int>, int> PIII;
//typedef pair<f64, int> PDI;
/*
inline __int128 read()
{
    __int128 x = 0, f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9')
    {
        if (ch == '-')
        f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9')
    {
        x = (x << 1) + (x << 3) + (ch - '0');
        ch = getchar();
    }
    return x * f;
}
void print (__int128 x)
{
    if (x < 0)
    {
        putchar('-');
        x = -x;
    }
    if(x > 9)print(x / 10);
    putchar(x % 10 + '0');
}
*/
int st[N][N];
bool used[N][N];
int mapp[N][N];
int dx[]={0,0,0,-1,1};
int dy[]={0,-1,1,0,0};
int n,m;

void dfs(int x,int y)
{
    if(mapp[x][y]==5)return;
    st[x][y]=0;
    for(int i=1;i<=4;i++)
    {
        int nx=x+dx[i],ny=y+dy[i];
        if(nx>=1&&nx<=m&&ny>=1&&ny<=n)
        {
            if(i==1&&mapp[nx][ny]==2)dfs(nx,ny);
            if(i==2&&mapp[nx][ny]==1)dfs(nx,ny);
            if(i==3&&mapp[nx][ny]==4)dfs(nx,ny);
            if(i==4&&mapp[nx][ny]==3)dfs(nx,ny);
        }
    }
}

void solve()
{
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            char op;
            cin>>op;
            st[i][j]=-1;
            used[i][j]=false;
            if(op=='U')mapp[i][j]=1;
            else if(op=='D')mapp[i][j]=2;
            else if(op=='L')mapp[i][j]=3;
            else if(op=='R')mapp[i][j]=4;
            else mapp[i][j]=5;
        }
    }
    for(int i=1;i<=n;i++)
    {
        int x=i,y=1;
        if(mapp[x][y]==3)dfs(x,y);
        x=i,y=m;
        if(mapp[x][y]==4)dfs(x,y);
        x=1,y=i;
        if(mapp[x][y]==1)dfs(x,y);
        x=n,y=i;
        if(mapp[x][y]==2)dfs(x,y);
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(st[i][j]!=-1)continue;
            if(mapp[i][j]==5)
            {
                 for(int o=1;o<=4;o++)
                 {
                     int nx=i+dx[o],ny=j+dy[o];
                     if(nx>=1&&nx<=m&&ny>=1&&ny<=n&&st[nx][ny]==1)st[i][j]=1;
                     if(nx>=1&&nx<=m&&ny>=1&&ny<=n&&mapp[nx][ny]==5)st[i][j]=1,st[nx][ny]=1;
                 }
            }
            else
            {
                int nextx=i+dx[mapp[i][j]],nexty=j+dy[mapp[i][j]];
                if(nextx>=1&&nextx<=m&&nexty>=1&&nexty<=n)
                {
                    if(st[nextx][nexty]==1)st[i][j]=1;//下一个是好点
                    else if(st[nextx][nexty]==0)st[i][j]=0;//下一个是坏点
                    else if(mapp[nextx][nexty]==5)st[nextx][nexty]=1,st[i][j]=1;//下一个是待定点
                    else//既不是待定点也不知道是不是好点
                    {
                        st[i][j]=1;
                    }
                }
                else
                {
                    st[i][j]=0;
                }
            }
        }
    }
    ll res=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(st[i][j]==1)res++;
        }
    }
    cout<<res<<endl;
}

int main()
{
    int t=1;
    cin>>t;
    while(t--)
    {
        solve();
    }

    return 0;
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
3
3 3
UUU
L?R
DDD
2 2
??
??
3 3
?U?
R?L
RDL
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Trapped in the Witch's Labyrinth
time_limit_ms: 3000
memory_limit_mb: 256
Description: In the fourth labor of Rostam, the legendary hero from the Shahnameh, an old witch has created a magical maze to trap him. The maze is a rectangular grid consisting of $$$n$$$ rows and $$$m$$$ columns. Each cell in the maze points in a specific direction: up, down, left, or right. The witch has enchanted Rostam so that whenever he is in a cell, he will move to the next cell in the direction indicated by that cell.

If Rostam eventually exits the maze, he will be freed from the witch's enchantment and will defeat her. However, if he remains trapped within the maze forever, he will never escape.

The witch has not yet determined the directions for all the cells. She wants to assign directions to the unspecified cells in such a way that the number of starting cells from which Rostam will be trapped forever is maximized. Your task is to find the maximum number of starting cells which make Rostam trapped.

Input: The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$), the number of test cases.

For each test case:

- The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 1000$$$), representing the number of rows and columns in the maze.
- Each of the next $$$n$$$ lines contains a string of $$$m$$$ characters representing the directions in the maze. Each character is one of the following:   U (up)  D (down)  L (left)  R (right)  ? (unspecified direction)

It's guaranteed that the sum of $$$n \cdot m$$$ over all test cases is at most $$$10^6$$$.

Output: For each test case, print a single integer, the maximum number of starting cells from which Rostam will be trapped forever after assigning directions to the unspecified cells optimally.

Examples:
input:
3
3 3
UUU
L?R
DDD
2 3
???
???
3 3
?U?
R?L
RDL
output:
0
6
5

Note: In the first test case, all of the cells will be good no matter what you do.

In the second test case, if you assign the ?s like the picture below, all of the cells will be bad:

In the third test case, if you assign the ?s like the picture below, you will have $$$5$$$ bad cells (red-shaded cells):

Buggy Code:
/*
    (( '-""``""-' ))
     )-__-_.._-__-(
   / --- (o _ o) --- \
   \ .-* ( .0. ) *-. /
   _'-. ,_ '=' _, .-'_
  /  ;#'#'# - #'#'#; \
 \_)) #----'#'-----#((_/
       #----------#
      ' #--------#'
   /..-' #------#'-.\
  _\...-\'#---#'/-.../_
  ((____)- '#' -(____))

    art by - Vinni01

    MD_DM - sheber

    Nah I'd win

    cout << fixed << setprecision(6) << x;

    freopen ( "sum.in", "r", stdin )
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣿⠷⢛⠩⣡⠦⢂⢂⢂⠂⡂⢂⢐⢀⠂⠄⡂⠄⢂⢐⠠⢀⢂⢐⢀⢂⠄⡂⡂⡂⠢⠡⡂⠪⡐⢅⠪⣙⢛⡻⡻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣯⣿⣯⣿⣯⣿⣯⣿⣽⣿⣺⡫⣿⣽⣯⣿⣽⣯⣿⣽⣯⣿⣽⣯⣿⣽⣯⣿⣽⣯⣿⣽⢾⣻⣵⢞⣴⠟⡡⡊⠄⠢⢐⠨⢐⢐⢐⠠⢁⠅⡂⠌⠔⡐⡨⢐⠐⡐⡈⡢⢑⢐⢅⠪⡘⢔⠌⡪⢐⢅⠇⡎⡪⡪⣚⢮⡻⡾⣿⣾⣿⣽⣯⣿⣾⣿⣾⣿⣽⣿⣽⣯⣿⣽⣯⣿⣽⣯⣿⣽
⣿⣻⣿⣽⣿⣽⣿⣻⣿⣽⣞⢽⢽⣿⣟⣿⣿⣻⣿⣟⣿⣿⣻⣿⣟⣿⣟⣿⣻⣯⣯⣷⣿⣻⣚⣞⠵⡩⢂⠊⠌⠨⡐⠨⢂⢂⠢⠨⡐⢔⠨⡘⢌⢐⢐⠔⡡⢂⠢⠪⡨⡢⢱⠨⡊⢆⢣⢪⠢⢅⠣⡣⡣⡱⡑⡕⡯⣿⣾⢿⣾⣿⣻⣿⣯⣿⣾⣿⣯⣿⣟⣿⣟⣿⣿⣻⣿⣟⣿⣟
⣿⣿⣟⣿⣽⣿⣻⣿⣻⣿⣻⣿⣻⣯⣿⣿⣽⣿⣯⣿⣿⣽⣿⣯⣿⣿⣻⣿⢿⣻⣿⣻⣿⢻⡝⡪⡑⢌⢐⠁⠌⡂⡊⢌⢂⢂⠅⢕⠨⡂⢕⠨⡢⡑⢔⢑⢌⠆⢕⢑⢌⢪⢊⢎⢎⢎⢪⡸⡸⡱⡱⡌⡎⣞⢼⢸⢪⢮⡻⣿⣿⣾⣿⣯⣿⣿⣽⣷⣿⣟⣿⣟⣿⣿⣽⣿⣯⣿⡿⣟
⣿⣯⣿⣿⣟⣿⣟⣿⣟⣿⣟⣿⣟⡯⣿⣯⣿⣯⣿⣯⣿⣯⣿⣯⣿⣟⣿⡿⣿⡿⣟⣯⡾⢣⢑⠌⡐⡐⡐⡐⠅⡂⡪⠐⡐⠔⡅⢕⠨⢌⢢⠣⡢⡱⢡⢃⢎⠜⡨⡊⡆⢎⢪⡪⡎⣞⡜⡼⣸⠸⣜⢼⢸⢬⢳⢳⡱⡱⢕⢇⠯⣷⣿⣯⣷⣿⣟⣯⣿⣿⣻⣿⣿⣽⣿⣽⣿⣽⣿⣿
⣿⣿⣽⣾⣿⣟⣿⣿⣻⣿⣟⣿⣷⢿⣟⣿⣽⣿⣯⣿⣯⣿⣯⣿⣯⣿⣻⡿⣟⣟⣯⠷⢩⢂⢂⢊⢐⢐⠰⡈⡂⡪⠠⡑⡌⠕⡌⡢⢣⢑⢅⢇⢪⠸⡰⡱⡘⡌⡆⡣⣪⢪⢪⡪⡎⣗⢵⢝⡮⣣⡣⡫⡺⣜⢵⡓⡽⡸⡸⡱⡹⡘⢾⣽⡿⣯⣿⣿⣟⣿⣟⣿⣾⣿⣯⣿⣿⣽⣿⣷
⣿⣾⡿⣟⣷⣳⣻⣿⣻⣯⣿⣿⣻⣿⣿⢿⣟⣯⢯⢯⣿⣿⣽⣿⣻⣿⣻⣿⣿⢿⢫⢘⠔⢐⢐⢐⢐⠔⠡⢂⢒⢌⠪⡢⡑⡅⢇⢊⢆⢣⢱⢸⠸⡘⡌⣆⢳⢨⢪⢪⢪⡪⣣⢫⢞⢜⢕⢗⢝⢮⢺⡸⡜⢎⢮⢺⢜⢜⢜⢜⢜⢌⢇⢟⣿⣿⣟⣷⣿⡿⣟⣿⣿⣾⢿⣻⣾⣿⣷⣿
⣾⡿⣿⣿⣿⢿⣽⣿⣟⣿⣿⣽⣿⣽⣾⣿⣿⣿⣽⣽⣿⣽⣿⣽⣿⣟⣿⣯⠟⢕⢡⢑⠨⢐⢐⢐⠔⠡⢁⠢⡱⢰⢑⠱⡐⡕⢅⢕⢱⢱⢱⢱⠱⡱⡱⡱⡕⡕⡵⡹⣜⢸⢸⢸⢱⢕⢕⢕⢭⢳⡱⡕⣝⢜⢜⡜⡎⣎⢎⢎⢜⠜⣜⢜⢷⣿⣻⢿⣻⣿⣿⣿⣾⣿⣿⣿⡿⣿⣾⣿
⣾⣿⣿⢿⣾⣿⣿⡽⣿⣻⣽⣿⣾⣿⢿⣻⣽⣾⣻⣿⣽⣿⣯⣿⣯⣿⠽⡂⡣⢑⠐⢄⠕⠡⡐⢌⠌⢌⠢⡱⠸⡐⡅⡣⡱⡸⡐⡕⡱⡑⡅⡇⡇⡣⡣⡫⡣⣪⡎⡇⣇⢣⢱⢱⢱⢱⢑⢕⢕⢕⢕⢕⢕⢕⢕⢜⢎⢮⢢⢣⠱⡑⡜⡵⡱⡻⣿⣿⡿⣿⣾⣿⣾⣿⣾⡿⣿⣟⣿⣾
⣻⣯⣿⣿⢿⣻⣽⣿⢿⣿⢿⣻⣗⢯⡻⡻⡿⣿⣿⣻⣯⣷⣿⡷⣟⣍⣪⢴⡜⡐⢌⠢⠨⡨⠨⡐⢌⠆⡕⢜⠡⡱⠨⡢⡣⣊⢢⢱⠱⡱⡱⡱⡡⡣⡣⡣⡱⣯⢿⡜⡔⡕⡅⡇⡇⡕⡕⢕⢅⢣⢣⢣⢣⢣⢣⠣⡣⡣⡣⡣⡩⡊⢆⡻⣽⡜⣽⣷⣿⣿⣷⣿⣷⣿⣷⣿⣿⡿⣟⣿
⢯⣞⣮⣻⡻⣿⣿⢿⣿⢿⣿⣿⢗⢧⡫⡮⣻⣿⣽⣿⡿⣟⣿⣿⣻⣽⡛⢕⣨⡬⢂⢐⢑⠠⠡⡘⢔⠱⡘⠔⡑⢜⢨⠪⡒⡔⡸⡰⡱⡱⡑⡕⡌⡎⡜⡰⡽⣯⢷⢯⡪⡪⡸⡨⡪⡸⡸⡸⡸⡘⡜⡌⡎⡜⡔⡕⢕⢕⢕⠕⡌⠌⡆⢇⡻⣟⣎⢷⣿⣷⣿⣷⣿⣯⣿⣯⣷⣿⣿⣿
⢕⣗⣵⣳⢽⣟⣿⣿⡿⣿⣿⣽⣏⢗⣝⢮⣳⣿⡿⣷⣿⣿⣿⣻⣯⢗⣮⡏⡃⡂⡂⠔⡡⠈⡔⢌⠢⡑⠅⢅⠕⠅⡢⡣⠣⡊⢔⠕⡜⢜⢜⠜⡌⡎⡊⣞⣯⡯⡿⡽⣎⢎⢆⢣⢱⠸⡰⡱⡸⡐⡌⡊⡎⡆⡕⡜⢌⢎⢆⢇⢇⠕⠨⢪⢪⢻⢗⣟⣿⣯⣷⣿⣯⣿⣯⣿⡿⣟⣿⣽
⡳⡵⣳⣳⣻⣿⣻⣷⣿⣿⣿⣽⣾⣿⣾⢷⣿⣟⣿⣿⣟⣷⣿⣽⢾⢛⠣⡑⡐⡐⡐⡐⠄⡕⢌⠢⠑⢌⠊⢔⠡⢡⢃⠎⢕⢑⢸⢘⢜⠜⡔⡕⢅⠇⢮⣻⣞⣽⢽⢯⢷⢕⠥⡑⡅⢇⢕⢜⠔⡅⡣⢕⢌⠊⢎⢜⠔⢅⢇⢕⢅⢣⠡⠡⡓⣝⢽⣗⣿⣟⣿⣿⣽⣿⣯⣿⣿⣿⣿⣿
⢜⢽⡺⣿⣿⣻⣿⣟⣿⣷⣿⢿⣻⣽⣿⡿⣿⣽⣿⢷⣿⢯⣞⣪⡦⣱⢕⢐⠅⡊⠔⢀⠣⢊⢠⢂⠅⡂⡑⡐⠅⡪⡂⠪⡪⡨⠢⡣⡱⡑⡕⢜⢸⢨⢛⢚⢚⠚⠫⠫⠫⢓⢅⢇⢊⢪⠢⡱⡑⢌⢊⠔⡐⡱⡑⠜⡜⡌⢎⢪⢊⢆⠣⡑⡌⡌⡺⢜⡽⣻⢯⣿⣯⣷⡿⣿⣾⣿⣾⣿
⡸⣜⢼⢹⡫⡿⣟⣿⣿⣽⣾⣿⣿⣟⣯⣿⣿⣿⣽⣿⣯⢿⣾⢟⢅⠫⡐⢅⠪⡌⡐⠄⡃⡢⡑⠌⢊⢂⢎⠌⡢⠱⠀⢱⠨⡢⠱⡱⡘⡌⡎⢜⠰⡸⣝⢞⢜⠎⢎⢪⢸⢰⢱⡸⡨⡂⢇⢪⢘⢌⠢⠁⠈⡀⠁⠑⠨⡊⡪⡸⡐⢅⠪⢰⣱⡽⡌⣮⣮⣎⡯⣞⣷⣿⡿⣿⣿⣾⣿⣻
⡺⣪⣷⣷⣯⣮⢇⣗⢽⣿⣻⣿⡷⣿⡿⣿⡿⣾⣿⣻⣞⣟⢏⢊⡢⢱⢘⢌⢎⠆⡊⡐⡐⢌⢊⢊⠊⠌⠂⣊⡤⢥⢌⠐⢕⢌⠪⡢⢣⢱⠸⡨⠊⠊⠂⠁⠈⠈⡁⠐⢡⢳⢵⢝⡦⡣⡣⡑⡢⠪⡀⡊⢔⢌⡮⢀⢐⠸⡰⡱⡑⡰⡁⡣⣑⡻⣻⣜⡽⡿⣿⣷⣮⣗⣿⣿⣷⣿⣟⣿
⢽⣽⣻⣯⣿⣟⣮⣺⣺⢿⣻⣯⣿⡿⣿⡿⣟⣿⣾⢿⢝⢅⢧⠱⡱⡑⡕⠌⡎⠔⡐⡐⢌⠂⢅⠢⠠⠁⢰⠣⡪⡪⡨⠣⡑⢔⠱⡘⡌⢆⢣⢊⠀⡐⠠⣑⠡⣱⢸⢼⡰⡹⣮⣻⣺⢽⣎⣎⢌⠇⡎⣌⢫⠜⡊⡔⠄⢕⠨⡪⡢⠢⡱⡘⡔⣷⢹⣷⢿⣿⢿⣷⣿⡿⣷⡽⣷⣿⡿⣿
⢿⢿⣾⣞⢿⣻⣯⣿⡿⣿⣿⣿⢿⣿⢿⣟⣿⡿⡞⣍⣾⣻⣣⢗⢕⢱⢡⠑⠌⣂⠢⡨⠂⠌⠄⠌⢀⠈⢸⢨⢲⡙⠌⠌⢌⢆⢣⠱⡘⡌⡆⠕⡠⡈⠣⡙⡝⡪⡞⣏⢮⣞⣗⣗⡽⣽⣺⣗⢷⡱⡸⣘⢮⡳⡕⡕⡅⢕⢸⢸⢐⡑⠴⡑⡜⠽⣗⣿⣽⢿⣿⣟⣷⣿⣿⣿⡽⣿⡿⣿
⢿⣽⣳⡯⡯⣿⣟⣿⡿⣿⣿⣾⣿⣿⡿⣯⣿⠏⣮⣾⣳⢯⢣⢣⠣⡱⢡⠩⡊⢔⠡⠨⠨⡈⠄⡁⠠⠐⡀⠓⡜⡎⢕⢁⢂⢪⠰⠡⡣⢪⠨⡊⢜⣜⢖⣔⢦⣳⢽⣺⢽⣺⣺⢮⣻⡺⡮⡯⣗⣟⣜⢮⢎⡞⡮⡪⡂⢕⢸⠰⡐⣯⢯⢾⣼⣮⣮⢺⣿⢿⣻⣿⣟⣿⣯⣿⣟⣿⣿⣿
⢸⢹⢺⣻⢭⡻⣟⣿⡿⣿⣷⣿⢿⡾⣟⣯⢏⢮⠳⡣⢣⢪⢪⠢⡑⡕⡡⢑⢌⠢⡊⠌⡂⠂⠅⠄⡑⡐⡈⡐⠈⢝⢆⢅⢂⠂⡣⡃⡪⡂⢇⠪⡸⣪⡳⣕⡯⣺⢽⣺⢽⣳⢯⣻⢮⡫⡾⢽⡻⡺⣺⣝⡯⡯⡯⣎⢂⠪⡪⡸⢐⢿⣿⣻⣾⣯⣿⡕⣿⣿⣿⣟⣿⣟⣿⣽⣟⣯⣷⣿
⢱⢨⠢⡊⡪⡻⣯⣟⡿⣿⢷⡿⡯⡿⡳⡫⡪⡊⡎⡎⡎⡎⢆⢣⢣⠱⡈⡢⡊⡢⡑⡁⡂⠅⠅⢂⠂⡐⠐⠨⠈⠄⠃⢆⢐⠄⡱⠰⡐⢅⢣⠑⡌⡞⡮⣗⢯⣫⣗⡯⣟⡾⣽⣺⣳⡱⡡⢕⢱⢡⣷⣳⢯⡯⣯⠪⡐⡱⡱⡸⠨⣟⣿⣿⣻⣿⣻⡧⣿⣿⣾⣿⢿⣻⣿⣟⣿⣿⢿⣿
⢸⠸⡸⡨⢢⢊⢢⢑⠍⡝⢝⠞⡪⡚⡜⡜⡜⡜⡜⢜⢜⠨⡪⢸⢐⢕⢘⢌⠢⠢⡱⠐⠄⠅⡊⠄⢂⢠⡑⠈⠐⡈⢀⣆⠔⠈⢂⠇⡊⡢⡑⢅⠪⡪⡫⡾⣝⣞⡮⡯⣗⡯⣗⡯⡾⣝⡮⡧⣳⢯⢾⣺⢯⣻⡪⡁⠢⢪⠪⡊⡪⢿⣯⣿⣟⣿⣯⢿⣟⣿⣾⣿⣿⡿⣟⣿⣯⣿⣿⣿
⠰⡑⡅⡣⠣⡊⡢⢣⢑⢜⢔⢕⢕⢱⠱⡑⡕⡱⢨⢃⢆⠣⡘⡌⠆⡂⡢⡑⠌⢌⠢⡑⡁⡊⠄⠅⠢⢘⣦⡁⡂⠐⠠⢈⠣⠐⠀⠎⡪⠰⡘⡌⡪⡪⢯⡺⣵⡳⡯⡯⣗⡯⣗⡯⡯⡳⠙⠜⣘⢸⣙⣞⡽⡺⠐⡀⡣⢱⢱⢱⡪⣹⣿⣯⣿⣿⣽⣿⡿⣟⣿⣾⡿⣿⣿⡿⣟⣯⣿⣿
⠨⡢⡑⢜⢘⠜⡸⢘⢌⠆⡕⢔⡑⡔⢕⠡⡂⡊⡢⢑⠔⢅⢃⠢⢑⠐⠔⡠⢑⠄⡃⢆⠕⡨⡘⣬⠌⡂⣳⣷⠄⠅⡘⠐⡀⠂⡁⠌⡊⢎⠔⢕⢌⢪⢳⡹⣪⢞⡽⣝⢮⣻⡺⣜⣖⢮⢏⠯⡪⣺⢺⡪⠎⠠⢐⠐⡌⡪⡢⣻⣯⣒⢿⣯⣿⣾⣿⣷⣿⣿⣿⣟⡿⣿⣷⣿⣿⣿⡿⣿
⢌⢂⠪⠨⡂⠕⢌⠢⡢⡑⢜⢐⢑⢌⠢⡑⢔⠔⢜⠰⡑⡑⠄⠕⡠⠡⠑⠄⠅⡂⡪⡂⡣⣫⢷⢹⣣⡊⠔⣿⢺⣲⣄⡡⠀⠅⠠⢂⠪⡨⡊⡪⡪⡊⡆⢝⢜⢵⢝⢮⡳⡳⣝⡞⡮⡣⡣⡣⣣⡳⡝⢼⠀⢂⠂⢅⢣⢣⢹⣽⣿⢿⣞⣿⢿⣽⣾⣯⣿⣿⣾⣿⣿⢿⣽⣿⣽⣿⣻⣿
⠔⡨⠨⡨⢂⠣⡑⡑⢔⠨⠢⡑⢔⠢⠱⡘⢔⠡⠅⢕⠨⡐⢡⢑⠠⠡⠡⠡⠨⠢⡱⡱⡽⣽⢿⡷⣝⢗⢅⠫⢫⠳⡙⡪⢀⠠⢑⢀⢂⢒⠌⢆⢣⢣⢝⠰⡐⢔⠩⡑⠹⢹⢪⢞⢽⡹⣝⣞⢞⢎⢎⢽⣷⠡⡈⢔⢕⢕⢽⣷⣿⣿⣿⣽⣿⣿⢿⣻⣿⣾⣿⣾⣿⣿⡿⣿⣽⣿⣜⣮
⢈⠢⡑⠔⡡⠊⠔⡨⠠⠡⠡⠨⢐⠨⠨⡐⡐⡡⠡⡁⡢⠨⢂⠂⢌⠌⢌⠌⣜⣼⣽⣺⡝⡾⡹⡹⡸⣝⢜⢮⡲⣕⢬⠢⡂⠆⡂⡂⠢⠀⠕⡑⡌⡪⢪⢱⢡⠣⡑⡌⡊⣂⠂⠉⠘⠊⠃⠓⣡⢇⣗⢽⡗⣕⠀⡎⡎⡦⣿⢿⣷⣿⣯⣿⣿⣾⣿⣿⡿⣷⣿⣷⣿⣷⣿⣿⡿⣯⣿⣿
⠠⡑⠌⢌⠢⠑⢅⠢⠡⠡⠡⡑⠄⠅⢅⢂⠢⠨⢂⠢⢊⠌⢄⠅⠅⢌⢂⢣⡮⣷⡿⡎⡎⡞⡜⣜⢕⢗⡽⣕⢗⡕⣗⢽⡹⡵⣢⢦⢅⠅⢌⠐⢅⠇⡇⡎⡪⡪⡊⡆⢕⠔⠀⠀⠈⠌⡨⢐⠨⢙⢎⣟⣯⠇⢌⢎⢂⢻⣽⣿⢿⣷⣿⣿⣾⣿⣯⣿⣿⢿⣯⣷⣿⣯⣿⣷⣿⣿⣿⣻
⠨⠢⡑⡡⠨⡊⠔⢌⢊⠌⢌⠔⠌⢌⢂⠢⡡⡑⡐⢅⠅⡪⢐⠡⡑⢕⢨⣾⡿⡟⢟⠕⡕⢕⠝⠜⡜⣕⠧⡓⡯⡺⡵⡫⣞⣝⢮⡳⣝⣝⢔⢅⠅⢇⢇⢇⢇⢎⢪⢪⠢⡃⠀⠀⠁⠀⠂⠢⠡⡑⡰⡐⠝⢄⠕⢌⢂⢂⢳⣿⣿⡿⣷⣿⣷⣿⣯⣿⣾⣿⣿⣿⣻⣽⣿⣽⢯⣾⣿⣿
⠨⡈⡂⡪⠨⡂⠕⡁⡂⡊⢔⢬⠮⣒⣥⢷⠻⡐⠅⢕⠨⢂⠢⡣⢑⢡⣟⣿⠘⠜⡌⣆⢮⢢⡕⣗⡬⣢⣣⡣⡧⣕⢕⣍⡪⡨⡣⡫⣞⢮⡳⡕⡅⡣⢣⢣⢣⢣⢣⠪⡒⡄⠀⠁⠀⠁⡀⠈⠈⠰⡐⢜⠨⡢⢃⢅⠪⡐⠼⣿⣷⣿⣿⣿⣾⣿⣽⣿⣻⣽⣷⣟⣿⣿⣟⣿⣿⣿⣯⣿
⢐⠰⢐⠐⢥⣶⣷⣶⣾⡾⣾⡾⡝⡫⠨⠢⡑⢌⠪⢐⢈⠢⡃⠪⣐⣵⣟⠭⣊⢎⢇⢧⢳⢱⢝⢮⡺⣕⢗⡝⣞⢮⡫⣞⢵⡻⣮⣲⡡⣓⡝⣎⢧⢑⢅⢇⢇⢇⢇⢇⢕⢜⢄⢑⠈⠀⡀⠄⠀⠄⠌⡢⢱⢡⢑⠔⡑⢌⠪⡹⣿⣽⣷⣿⣷⣿⣟⣿⡿⣟⣿⣿⢿⣽⣿⢿⣽⣾⣿⣿
⠐⠌⡂⢅⢹⣯⣷⣿⣷⣿⠟⢕⢼⢐⢑⢑⠌⡐⠨⢐⠐⢅⠊⢌⣾⣟⣧⡣⡣⡱⢹⢸⢸⢜⢮⡺⡜⣞⢼⡺⣪⢞⠮⣎⢗⢝⡞⣎⢯⡳⣝⢮⡳⡥⣱⢰⢑⢕⢕⢕⢕⢌⢆⢇⠅⢅⠀⡀⠄⠀⢁⢊⠢⡑⢅⠕⡅⢕⢱⠐⡙⣿⣿⣽⣾⣿⣟⣿⣿⣿⡿⣿⣿⢿⣿⢿⣿⣟⣿⣾
⠨⠨⢂⠅⣞⣿⣻⡽⡳⣡⣳⠫⡑⡐⡡⠂⠢⠨⡈⡂⠅⢅⢊⣾⢿⢍⢇⠇⢇⢓⢕⠇⡗⢵⢱⢕⢵⢝⡜⡜⡌⡇⡏⡎⡮⡳⡹⡪⡳⣝⢮⢧⡳⣝⢮⡳⡅⡎⡜⢜⢜⢜⢌⢆⠝⡔⡡⡀⠄⢀⠀⠑⡅⢕⡐⢅⠣⡣⡱⡈⡢⢊⠻⣟⣯⣿⣟⣿⣷⣿⡿⣿⣻⣿⣯⣯⣿⡿⣟⣿
⠨⠨⢂⢊⠝⢝⣱⣵⣾⢯⣦⢊⢐⠔⠠⠡⠡⠡⢂⢊⢌⠢⣹⡷⡹⡐⡅⢕⠅⠕⠔⡑⢌⠢⡃⢕⠸⡘⢜⠑⠅⡃⠣⡑⢌⠪⡊⡣⢫⢪⢎⡇⡧⡳⡕⣝⢮⢳⡑⡅⢇⢧⢱⢪⣪⢲⣳⢸⢨⠢⡐⡀⠘⢔⠜⢌⢊⢎⢎⢆⠊⡆⡇⡻⣿⢿⣟⣿⣽⣾⣿⣿⡿⣟⣿⣟⣿⣿⣿⣿
⢈⢪⣲⣳⣳⣿⡾⣿⣾⡟⡓⡐⡐⠌⡊⠌⢌⢊⠔⣰⠢⣱⣿⣷⡑⢌⠌⡂⠁⠄⠡⠈⠄⡁⠂⡁⠅⠨⠠⢈⢐⢀⠡⡐⡐⢔⢐⠌⡐⢐⠐⢍⢊⠇⠏⡎⡮⣣⢳⡘⡌⢎⢖⠅⢗⡯⣞⢵⡪⣊⢆⠠⠀⠂⡣⡱⡘⡌⡎⡎⣮⣔⢕⢕⢎⢿⣿⡿⣿⣻⣯⣷⣿⡿⣿⣿⣻⣷⣿⣿
⢐⢽⡿⣿⣟⣯⣿⠿⢑⢐⢐⠌⡐⡡⢂⢑⢐⢐⢌⡯⡨⣾⣿⣯⣿⣆⠁⠄⠁⠌⢈⠠⠁⢀⠂⠄⠌⢌⠌⠆⠕⠌⠪⠐⠅⠃⠆⠕⡐⡐⡈⠠⢀⠈⡈⠐⠩⢊⢇⢳⢸⠨⢪⢪⠢⡫⣞⢵⡫⣞⡔⡅⡂⠀⠐⠜⡌⡪⢪⢪⢺⣿⣳⡱⡱⡕⣕⢿⣿⣿⡿⣟⣯⣮⣫⣿⣿⣻⣽⣾
⢷⣗⣟⢿⡻⢏⠅⡑⡐⠔⡐⢌⢐⢐⢐⢐⢐⠔⡘⠅⣾⣿⣯⣿⢾⣿⡆⠀⢁⠠⢀⠠⠐⡐⢈⠌⠨⠐⠈⢈⢀⠅⡢⢒⠔⡢⡂⡂⠄⠠⠈⢈⠂⡂⡂⡡⠐⢀⠐⠡⢊⠪⡢⢑⢕⢕⢽⣕⢯⢞⢮⣣⢅⠨⡀⠀⢕⢜⢸⢸⡸⣿⡿⣟⣎⢮⡪⡪⢝⢷⣿⣿⣯⣾⣿⣿⣻⣿⣿⢿
⣿⣿⢿⡯⠃⢅⢂⢂⢊⠌⡐⡐⡐⡐⡐⡐⡐⡐⡰⣵⣹⣳⣷⡩⠛⠓⠠⠈⠄⠂⠄⠂⠡⠐⠀⠐⢀⢐⠨⢂⢑⠌⡢⢑⢌⠢⡑⠕⡅⢅⠀⢂⠠⠠⢀⠂⡁⢂⠐⠠⠀⠌⢌⠢⡑⡕⡕⠵⡯⣯⣳⡳⡳⠀⢕⠅⠄⢣⠱⡱⡱⣻⣿⣿⣽⣯⣿⣮⡪⡪⡎⡿⣿⣻⣽⣾⣿⣿⣾⣿
⣿⣾⡟⡐⡡⢁⢂⠢⠂⢅⠂⡂⡂⡂⡂⣂⢆⢢⣿⡿⣿⡿⣿⣿⡄⠈⠄⠁⠌⠀⠂⠁⠐⠈⡀⠅⢂⢐⠨⡐⡐⠅⢌⠢⠢⡑⠌⢌⠌⡢⢃⠢⠨⠨⢐⠠⠂⠄⠌⡀⠡⠐⢀⠁⠊⢜⢌⠇⡏⣞⢮⣞⡝⠀⡧⣃⢇⠌⡪⡪⡪⣙⢯⣿⣷⣿⣷⣿⣻⣮⡪⡪⡪⡝⢿⡿⣟⣷⣿⣟
⣿⣻⢂⢊⠄⢅⠂⢅⠑⠄⠅⡂⡂⡂⡢⣿⡂⣾⣟⣿⣿⢿⣟⣿⠂⡈⢀⠈⡀⢈⠀⠁⢀⠁⠠⠐⡀⠂⠌⡐⡨⠨⢂⠅⠕⡨⠨⢂⠑⠄⠡⢑⠁⠅⢂⢑⠈⡈⠢⡐⡠⢈⠠⠀⠅⡕⢌⠪⡌⡲⡙⠎⠎⢠⡻⣪⢦⢑⠈⢎⢜⢔⢽⣿⢿⣾⣿⣾⣷⣿⢿⣮⢪⢪⢪⢪⢻⢻⢿⣟
⣿⢯⠐⠄⠕⡠⠑⠄⠅⢅⠕⡐⡐⠔⣽⣿⢊⣿⣟⣿⣽⣿⣟⣷⠀⠠⠀⠠⠀⠠⠀⠐⠀⠄⠁⠄⢂⠡⠑⡐⠄⠕⡠⠡⡑⠠⠡⡑⠨⠨⠐⠠⠡⠈⠄⡐⢀⠨⠂⠢⡈⡢⠨⢂⠅⡇⢌⠪⡸⡰⡘⡔⡈⡮⡺⣝⡵⡣⡃⢅⢣⢱⢸⣿⣿⡿⣷⣿⣯⣿⣿⣿⣷⣕⠧⣇⢇⢇⢇⢏
⡿⡯⡈⠪⠨⠠⠡⠡⢡⢑⠰⡐⡌⢌⣿⡿⣸⣿⡿⣿⣟⣯⣿⣿⣿⣶⣌⡠⠐⠀⠐⠈⠀⠄⠂⠐⡀⢂⠡⢐⠈⠌⡐⠡⡂⠅⠅⠂⠅⠡⢂⠐⢀⠈⠐⠀⠄⢊⠢⣁⡐⠄⠅⠅⡢⠅⢑⠱⡈⢎⠪⡊⡎⡮⣪⣪⢺⡘⡼⣅⠪⡸⡨⢿⣷⣿⣿⣯⣿⣯⣷⣿⣯⣿⣿⣵⣯⣺⢮⣪
⣏⠢⠨⡊⠌⢌⠌⠌⡂⢆⢕⢸⣷⢁⢻⡯⣺⣿⢿⣿⢿⣿⣻⣷⣿⣷⣻⣿⣶⣌⠄⠐⠀⠂⢀⠁⠄⢂⠐⡐⠨⢐⢈⠢⠨⡘⠨⡈⠌⡈⠄⡀⠄⠀⠁⢂⠀⠀⠄⠁⡘⠸⢸⢨⠊⠄⠄⠁⢊⢪⢑⠅⡇⡗⣕⢗⣳⡹⣝⢮⢆⢊⢆⢑⠻⣯⣿⣯⣿⣟⣿⣯⣿⣟⣯⣿⣟⣿⣷⣟
⠆⢅⠕⡐⡡⠡⡈⡂⠪⡐⢴⣹⣿⣧⢂⠫⣺⣿⣿⢿⣿⢿⣟⣿⣽⣿⣻⣿⡍⠁⠀⢀⠐⠀⠠⠐⠈⠄⠂⠄⠡⢂⢐⠨⢐⠨⢐⠨⠐⡀⡂⠄⠠⠀⢈⠠⠀⠠⠐⢀⠠⠀⠀⡀⠌⠢⠡⠡⡀⢐⠱⡁⢧⢇⢯⢳⠵⣝⢮⣫⢳⡢⢊⠔⠱⡨⠻⣿⣽⣿⣟⣯⣿⣿⢿⣿⣻⣿⣯⣿
⡍⡂⡢⢂⢊⠔⡐⠌⡂⡊⢾⡮⣾⣿⣷⣌⢺⣿⣻⣿⡿⣿⣿⢿⣟⣿⣟⣿⡇⠈⠀⠠⠐⠀⠂⢀⠁⢂⠁⠌⠐⡀⠂⠌⠠⠨⢐⠨⠠⢀⠐⢈⠐⠀⡀⠐⠈⢀⠀⠢⢐⠀⠅⡀⢀⠀⠈⠨⢐⠀⡘⢌⢪⡳⣹⢪⡫⣎⢧⢳⡣⡇⡕⡌⡌⠢⠨⢌⢛⣯⣿⣿⣟⣿⣿⢿⣻⣯⣿⣿
⡒⢼⣂⠢⠡⢂⠊⠔⡐⢌⢺⣷⢹⣷⣿⣿⣅⡻⣻⣯⣿⣿⢿⣿⢿⣿⣻⡟⠀⡈⠀⠂⡀⠂⠈⢀⠠⠐⠀⠌⡀⢂⢈⠈⠨⠐⡐⠠⢁⢂⠐⡀⠌⠀⠀⠈⠠⠀⠄⠨⠂⢅⢂⠐⡐⡐⡀⠀⡂⡒⠢⠢⡡⡫⡎⣗⢝⣜⣎⢧⢳⢕⣝⠮⡪⠠⢁⠑⡔⣿⣿⣯⣿⣿⣻⣿⣿⡿⣟⣿
⢌⢽⢧⠨⢊⠔⢡⡑⡐⢄⠹⣿⣧⡻⣿⣽⣷⣝⣷⣽⡻⡿⣿⢿⣿⢿⡏⠀⠄⠀⡀⢁⠠⠀⡁⠀⠄⠐⠈⠀⠄⠠⠀⠌⡀⠂⠐⠈⠄⠂⡂⠂⢄⠀⠄⠁⠠⠀⠠⠈⠄⢅⢐⠠⠐⢐⠨⠠⠀⠕⠊⠡⡂⢇⢟⢮⡳⡕⡧⣫⢺⡸⡸⣕⢕⡕⢄⠐⢌⢻⣽⣿⣽⠻⣟⣯⣷⣿⣿⣿
⢐⠌⢿⣕⢐⠸⣔⢿⣔⠄⠅⠽⣾⣷⣝⢿⣿⣻⣞⣿⢿⣿⣾⢿⣽⣟⣿⣆⠐⠀⠠⠀⠠⠀⠔⠈⢀⠁⡈⠠⠐⠀⠂⠐⠀⠅⠨⠐⠈⠠⠠⠑⠠⠂⠄⠂⠀⠀⠄⠨⠀⢕⠐⡀⠂⠀⠁⢅⠑⠄⠂⠨⢨⢊⢗⣕⢗⡝⣎⢮⢣⡣⡯⣪⢳⡱⢅⠂⡐⠝⣿⣟⣯⡣⣿⣿⣿⡿⣟⣿
⢐⠅⠕⡻⣕⠌⣻⢷⢽⢮⡨⠂⠝⣿⣽⣮⡻⡿⣿⣻⣽⣿⣽⣿⣿⣻⣿⠝⠀⠐⠀⡈⠠⢈⠐⢈⠀⠠⠀⠂⠐⠈⠀⡁⠌⠀⠅⠌⢐⠀⢂⠈⠨⠈⡀⠀⠀⠐⠀⡂⠡⢐⠠⠀⠅⡈⢀⠂⠁⠅⠂⠌⡐⢅⢇⢗⡕⡧⡳⡱⡣⡣⡳⡱⡱⡑⢅⠂⠠⢑⠐⢝⢿⣿⣿⢿⣷⣿⣿⣿
⠐⢌⠌⡢⠙⢜⢈⢿⣻⣷⣵⡡⠑⠌⢟⣿⢿⣯⣽⡻⡿⣷⣿⣷⢿⣻⣿⠀⠄⠀⠁⡀⠠⠀⠂⡀⠂⠁⠄⠁⡈⠄⠁⢀⠀⠡⠐⠈⠠⠈⠄⢂⠀⡁⠠⠀⠀⠀⠂⠠⡁⠐⠄⠨⠐⡀⠐⠠⡱⠡⡁⠌⠄⠕⢜⠸⡘⢜⠨⢌⠪⡘⢌⢌⠢⡑⠔⠈⠀⠌⢌⢐⠕⣿⣿⢿⣟⣯⣿⣿
*/
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>
#include <unordered_map>
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
#define ll long long
#define dd double
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define UseOFF ios_base::sync_with_stdio(0);cin.tie(0), cout.tie(0);
#define sz size
#define ins insert
#define new junkedseduneon
#define prev usfdjik
#define yes cout << "YES\n";
#define no cout << "NO\n";
#define fopen(s) freopen(s".in","r",stdin);freopen(s".out","w",stdout)
#define y1 ALALOU
const ll N = 2e6 + 111;
const ll mod = 1e9 + 7;
const ll P = 37;
string abc = "Zabcdefghijklmnopqrstuvwxyz";
char a[1111][1111];
bool t[1111][1111];
ll r[1111][1111], used[1111][1111];
pair <ll, ll> p[1111][1111];
ll add(ll x, ll y) {
	x %= mod;
	y %= mod;
	return (x + y) % mod;
}
ll mul(ll x, ll y) {
	x %= mod;
	y %= mod;
	return x * y % mod;
}
ll binpow(ll a, ll b) {
	//cout << a << " " << b << '\n';
	if(b == 0) return 1;
	if(b % 2 == 1) {
		return binpow(a, b - 1) * a;
	}
	else {
		ll x = binpow(a, b / 2);
		return x * x;
	}
}
ll n, m;
pair <ll, ll> get(ll x, ll y) {
	if(p[x][y].ff == x && p[x][y].ss == y) {
		return p[x][y];
	}
	return p[x][y] = get(p[x][y].ff, p[x][y].ss);
}
void merge(ll x1, ll y1, ll x2, ll y2) {
	pair <ll, ll> x = get(x1, y1);
	pair <ll ,ll> y = get(x2, y2);
	if(x == y) return;
	ll d = max(t[x.ff][x.ss], t[y.ff][y.ss]);
	if(r[x.ff][x.ss] > r[y.ff][y.ss]) {
		r[x.ff][x.ss] += r[y.ff][y.ss];
		p[y.ff][y.ss] = p[x.ff][x.ss];
	}
	else {
		r[y.ff][y.ss] += r[x.ff][x.ss];
		p[x.ff][x.ss] = p[y.ff][y.ss];
	}
	t[x.ff][x.ss] = t[y.ff][y.ss] = d;
}
void dfs(ll x, ll y, ll px, ll py) {
	used[x][y]++;
	if(x < 1 || x > n || y < 1 || y > m) return;
	//cout << a[x][y] << " " << x << " " << y << " " << px << " " << py << endl;
 	if(a[x][y] == '?') {
		if(px == x + 1) {
			a[x][y] = 'D';
		}
		if(px == x - 1) {
			a[x][y] = 'U';
		}
		if(py == y + 1) {
			a[x][y] = 'R';
		}
		if(py == y - 1) {
			a[x][y] = 'L';
		}
		t[x][y] = 1;
		merge(x, y, px, py);
		return;
	}
	else {
		if(x - 1 >= 1 && a[x][y] == 'U') {
// 			if(a[x + 1][y] == '?') {
// 				a[x + 1][y] = 'D';
// 				t[x][y] = 1;
// 				merge(x, y, px, py);
// 				merge(x, y, x + 1, y);
// 				dfs(x - 1, y, x, y);
// 			}
			pair <ll, ll> d = get(x - 1, y);
			if(t[d.ff][d.ss] == 1) {
				merge(x, y, d.ff, d.ss);
				return;
			}
			if(used[x - 1][y] == 2) {
				t[x][y] = 1;
				merge(x, y, px, py);
				merge(x - 1, y, x, y);
				return;
			}
			else dfs(x - 1, y, x, y);
		}
		if(x + 1 <= n && a[x][y] == 'D') {
// 			if(a[x - 1][y] == '?') {
// 				a[x - 1][y] = 'U';
// 				t[x][y] = 1;
// 				merge(x, y, px, py);
// 				merge(x, y, x - 1, y);
// 				dfs(x + 1, y, x, y);
// 			}
			pair <ll, ll> d = get(x + 1, y);
			if(t[d.ff][d.ss] == 1) {
				merge(x, y, d.ff, d.ss);
				return;
			}
			if(used[x + 1][y] == 2) {
				t[x][y] = 1;
				merge(x, y, px, py);
				merge(x + 1, y, x, y);
				return;
			}
			else dfs(x + 1, y, x, y);
		}
		if(y - 1 >= 1 && a[x][y] == 'L') {
// 			if(a[x][y - 1] == '?') {
// 				a[x][y - 1] = 'R';
// 				t[x][y] = 1;
// 				merge(x, y, px, py);
// 				merge(x, y, x, y - 1);
// 				dfs(x, y - 1, x, y);
// 			}
			pair <ll, ll> d = get(x, y - 1);
			if(t[d.ff][d.ss] == 1) {
				merge(x, y, d.ff, d.ss);
				return;
			}
			if(used[x][y - 1] == 2) {
				t[x][y - 1] = 1;
				merge(x, y, px, py);
				merge(x, y, x, y - 1);
				return;
			}
			else dfs(x, y - 1, x, y);
		}
		if(y + 1 <= m && a[x][y] == 'R') {
// 			if(a[x][y + 1] == '?') {
// 				a[x][y + 1] = 'L';
// 				t[x][y] = 1;
// 				merge(x, y, px, py);
// 				merge(x, y, x, y + 1);
// 				dfs(x, y + 1, x, y);
// 			}
			pair <ll, ll> d = get(x, y + 1);
			if(t[d.ff][d.ss] == 1) {
				merge(x, y, d.ff, d.ss);
				return;
			}
			if(used[x][y + 1] == 2) {
				t[x][y] = 1;
				merge(x, y, px, py);
				merge(x, y, x, y + 1);
				return;
			}
			else dfs(x, y + 1, x, y);
		}
	}
}
void solve() {
    ll N, M;
	cin >> N >> M;
	n = N;
	m = M;
	ll cnt = 0;
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= m; j++) {
			cin >> a[i][j];
			if(a[i][j] == '?') cnt++;
			p[i][j].ff = i;
			p[i][j].ss = j;
			r[i][j] = 1;
			used[i][j] = 0;
			t[i][j] = 0;
		}
	}
	if(cnt == n * m) a[1][1] = 'D';
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= m; j++) {
			if(!used[i][j] && a[i][j] != '?') {
				dfs(i, j, i, j);
			}
		}
	}
	// for(int i = 1; i <= n; i++) {
		// for(int j = 1; j <= m; j++) {
			// pair <ll, ll> d = get(i, j);
			// cout << i << " " << j << " " << d.ff << " " << d.ss << " " << t[d.ff][d.ss] << '\n';
		// }
	// }
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= m; j++) {
			bool bb = 0;
			if(a[i][j] == '?') {
				if(i - 1 >= 1) {
					if(a[i - 1][j] == '?') {
						a[i - 1][j] = 'D';
						a[i][j] = 'U';
						t[i][j] = 1;
						merge(i, j, i - 1, j);
						bb = 1;
					}
					else {
						pair <ll, ll> d = get(i - 1, j);
						if(t[d.ff][d.ss] == 1) {
							merge(i, j, d.ff, d.ss);
							bb = 1;
							a[i][j] = 'U';
						}
					}
				}

				if(i + 1 <= n) {
				    //cout << i << " " << j << endl;
					if(a[i + 1][j] == '?') {
						a[i + 1][j] = 'U';
						a[i][j] = 'D';
						t[i][j] = 1;
						merge(i, j, i + 1, j);
						bb = 1;
					}
					else {
						pair <ll, ll> d = get(i + 1, j);
						// if(i == 2 && j == 2) {
							// cout << d.ff << " " << d.ss << " " << t[d.ff][d.ss] << '\n';
						// }
						if(t[d.ff][d.ss] == 1) {
							merge(i, j, d.ff, d.ss);
							a[i][j] = 'D';
							bb = 1;
						}
					}
				}
				if(j + 1 <= m && bb == 0) {
					if(a[i][j + 1] == '?') {
						a[i][j + 1] = 'L';
						a[i][j] = 'R';
						t[i][j] = 1;
						merge(i, j, i, j + 1);
						bb = 1;
					}
					else {
						pair <ll, ll> d = get(i, j + 1);
						if(t[d.ff][d.ss] == 1) {
							merge(i, j, d.ff, d.ss);
							a[i][j] = 'R';
							bb = 1;
						}
					}
				}
				if(j - 1 >= 1 && bb == 0) {
					if(a[i][j - 1] == '?') {
						a[i][j - 1] = 'R';
						a[i][j] = 'L';
						t[i][j] = 1;
						merge(i, j, i, j - 1);
						bb = 1;
					}
					else {
						pair <ll, ll> d = get(i, j + 1);
						if(t[d.ff][d.ss] == 1) {
							merge(i, j, d.ff, d.ss);
							a[i][j] = 'L';
							bb = 1;
						}
					}
				}
				if(bb == 0) a[i][j] = 'L';
			}
			//cout << a[i][j] << " " << i << " " << j << " " << bb << endl;
		}
	}
	ll ans = 0;
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= m; j++) {
			pair <ll, ll> d = get(i, j);
			if(t[d.ff][d.ss] == 1) {
				ans++;
			}
		}
	}
	cout << ans << '\n';
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= m; j++) {
			p[i][j].ff = 0;
			p[i][j].ss = 0;
			r[i][j] = 1;
			used[i][j] = 0;
			t[i][j] = 0;
			a[i][j] = '?';
		}
	}
}
signed main()
{
    //fopen("skibidisigma");
    UseOFF
    ll ttt = 1;
    cin >> ttt;
    while( ttt-- )
    {
        solve();
    }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
3
3 3
???
???
???
2 2
??
??
1 1
?
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Trapped in the Witch's Labyrinth
time_limit_ms: 3000
memory_limit_mb: 256
Description: In the fourth labor of Rostam, the legendary hero from the Shahnameh, an old witch has created a magical maze to trap him. The maze is a rectangular grid consisting of $$$n$$$ rows and $$$m$$$ columns. Each cell in the maze points in a specific direction: up, down, left, or right. The witch has enchanted Rostam so that whenever he is in a cell, he will move to the next cell in the direction indicated by that cell.

If Rostam eventually exits the maze, he will be freed from the witch's enchantment and will defeat her. However, if he remains trapped within the maze forever, he will never escape.

The witch has not yet determined the directions for all the cells. She wants to assign directions to the unspecified cells in such a way that the number of starting cells from which Rostam will be trapped forever is maximized. Your task is to find the maximum number of starting cells which make Rostam trapped.

Input: The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$), the number of test cases.

For each test case:

- The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 1000$$$), representing the number of rows and columns in the maze.
- Each of the next $$$n$$$ lines contains a string of $$$m$$$ characters representing the directions in the maze. Each character is one of the following:   U (up)  D (down)  L (left)  R (right)  ? (unspecified direction)

It's guaranteed that the sum of $$$n \cdot m$$$ over all test cases is at most $$$10^6$$$.

Output: For each test case, print a single integer, the maximum number of starting cells from which Rostam will be trapped forever after assigning directions to the unspecified cells optimally.

Examples:
input:
3
3 3
UUU
L?R
DDD
2 3
???
???
3 3
?U?
R?L
RDL
output:
0
6
5

Note: In the first test case, all of the cells will be good no matter what you do.

In the second test case, if you assign the ?s like the picture below, all of the cells will be bad:

In the third test case, if you assign the ?s like the picture below, you will have $$$5$$$ bad cells (red-shaded cells):

Buggy Code:
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<cstring>
//#include<queue>
#define MAXN 1005
using namespace std;
int ans = 0;
int f[4][2] = { {0,-1},{0,1},{1,0},{-1,0} };
int a[MAXN][MAXN] = { 0 };
char b[MAXN][MAXN];
int n, m;

void search(int x,int y) {
	if (a[x][y]) {
		ans++;
		return;
	}
	if (b[y][x] == '?') {
		if (b[f[0][1] + y][f[0][0] + x] == 'D' || b[f[1][1] + y][f[1][0] + x] == 'U' || b[f[2][1] + y][f[2][0] + x] == 'L'
			|| b[f[1][1] + y][f[1][0] + x] == 'R' || b[f[1][1] + y][f[1][0] + x] == '?') {
			ans++;
			return;
		}
		a[x][y] = 1;
		int tmp = ans;
		for (int i = 0; i < 4; i++) {
			if (tmp != ans)break;
			if (f[i][0] + x<1 || f[i][0] + x>m || f[i][1] + y<1 || f[i][1] + y>n)continue;
			else search(f[i][0] + x, f[i][1] + y);
		}
		a[x][y] = 0;
	}
	else {
		switch (b[y][x]) {
		case'U':if (f[0][0] + x<1 || f[0][0] + x>m || f[0][1] + y<1 || f[0][1] + y>n)return;
			   else { a[x][y] = 1; search(f[0][0] + x, f[0][1] + y); a[x][y] = 0; } break;
		case'D':if (f[1][0] + x<1 || f[1][0] + x>m || f[1][1] + y<1 || f[1][1] + y>n)return;
			   else { a[x][y] = 1; search(f[1][0] + x, f[1][1] + y); a[x][y] = 0; } break;
		case'R':if (f[2][0] + x<1 || f[2][0] + x>m || f[2][1] + y<1 || f[2][1] + y>n)return;
			   else { a[x][y] = 1; search(f[2][0] + x, f[2][1] + y); a[x][y] = 0; } break;
		case'L':if (f[3][0] + x<1 || f[3][0] + x>m || f[3][1] + y<1 || f[3][1] + y>n)return;
			   else { a[x][y] = 1; search(f[3][0] + x, f[3][1] + y); a[x][y] = 0; } break;
		}
	}
}

int main() {
	std::ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	int t;

	//char c;
	cin >> t;
	while (t--) {
		cin >> n >> m;
		//vector<char>a;
		for(int i=1;i<=n;i++)
			for (int j = 1; j <= m; j++) {
				cin >> b[i][j];
			}
		for (int i = 1; i <= n; i++)
			for (int j = 1; j <= m; j++)search(j, i);
		cout << ans << endl;
		ans = 0;
	}
	return 0;
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
3 3
???
???
???
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Trapped in the Witch's Labyrinth
time_limit_ms: 3000
memory_limit_mb: 256
Description: In the fourth labor of Rostam, the legendary hero from the Shahnameh, an old witch has created a magical maze to trap him. The maze is a rectangular grid consisting of $$$n$$$ rows and $$$m$$$ columns. Each cell in the maze points in a specific direction: up, down, left, or right. The witch has enchanted Rostam so that whenever he is in a cell, he will move to the next cell in the direction indicated by that cell.

If Rostam eventually exits the maze, he will be freed from the witch's enchantment and will defeat her. However, if he remains trapped within the maze forever, he will never escape.

The witch has not yet determined the directions for all the cells. She wants to assign directions to the unspecified cells in such a way that the number of starting cells from which Rostam will be trapped forever is maximized. Your task is to find the maximum number of starting cells which make Rostam trapped.

Input: The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$), the number of test cases.

For each test case:

- The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 1000$$$), representing the number of rows and columns in the maze.
- Each of the next $$$n$$$ lines contains a string of $$$m$$$ characters representing the directions in the maze. Each character is one of the following:   U (up)  D (down)  L (left)  R (right)  ? (unspecified direction)

It's guaranteed that the sum of $$$n \cdot m$$$ over all test cases is at most $$$10^6$$$.

Output: For each test case, print a single integer, the maximum number of starting cells from which Rostam will be trapped forever after assigning directions to the unspecified cells optimally.

Examples:
input:
3
3 3
UUU
L?R
DDD
2 3
???
???
3 3
?U?
R?L
RDL
output:
0
6
5

Note: In the first test case, all of the cells will be good no matter what you do.

In the second test case, if you assign the ?s like the picture below, all of the cells will be bad:

In the third test case, if you assign the ?s like the picture below, you will have $$$5$$$ bad cells (red-shaded cells):

Buggy Code:
def solve_test_case(n, m, grid):
    def is_valid(x, y):
        return 0 <= x < n and 0 <= y < m

    def get_next_cell(x, y, direction):
        if direction == 'U': return x-1, y
        if direction == 'D': return x+1, y
        if direction == 'L': return x, y-1
        if direction == 'R': return x, y+1
        return None

    def is_trapped(start_x, start_y, grid_copy):
        seen = {}
        x, y = start_x, start_y
        steps = 0

        while is_valid(x, y):
            key = (x, y)
            if key in seen:
                return True

            seen[key] = steps
            current_direction = grid_copy[x][y]
            next_coords = get_next_cell(x, y, current_direction)

            if not next_coords:
                return False

            x, y = next_coords
            steps += 1

        return False

    def count_trapped_cells(grid_copy):
        return sum(is_trapped(x, y, grid_copy) for x in range(n) for y in range(m))

    question_cells = [(x, y) for x in range(n) for y in range(m) if grid[x][y] == '?']

    if not question_cells:
        return count_trapped_cells(grid)

    max_trapped = 0
    directions = ['U', 'D', 'L', 'R']

    def backtrack(index):
        nonlocal max_trapped

        if index == len(question_cells):
            max_trapped = max(max_trapped, count_trapped_cells([row[:] for row in grid]))
            return

        x, y = question_cells[index]
        for d in directions:
            grid[x][y] = d
            backtrack(index + 1)
            grid[x][y] = '?'

    backtrack(0)
    return max_trapped

def main():
    t = int(input())
    for _ in range(t):
        n, m = map(int, input().split())
        grid = [list(input().strip()) for _ in range(n)]
        result = solve_test_case(n, m, grid)
        print(result)

main()

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
3 3
???
???
???
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Trapped in the Witch's Labyrinth
time_limit_ms: 3000
memory_limit_mb: 256
Description: In the fourth labor of Rostam, the legendary hero from the Shahnameh, an old witch has created a magical maze to trap him. The maze is a rectangular grid consisting of $$$n$$$ rows and $$$m$$$ columns. Each cell in the maze points in a specific direction: up, down, left, or right. The witch has enchanted Rostam so that whenever he is in a cell, he will move to the next cell in the direction indicated by that cell.

If Rostam eventually exits the maze, he will be freed from the witch's enchantment and will defeat her. However, if he remains trapped within the maze forever, he will never escape.

The witch has not yet determined the directions for all the cells. She wants to assign directions to the unspecified cells in such a way that the number of starting cells from which Rostam will be trapped forever is maximized. Your task is to find the maximum number of starting cells which make Rostam trapped.

Input: The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$), the number of test cases.

For each test case:

- The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 1000$$$), representing the number of rows and columns in the maze.
- Each of the next $$$n$$$ lines contains a string of $$$m$$$ characters representing the directions in the maze. Each character is one of the following:   U (up)  D (down)  L (left)  R (right)  ? (unspecified direction)

It's guaranteed that the sum of $$$n \cdot m$$$ over all test cases is at most $$$10^6$$$.

Output: For each test case, print a single integer, the maximum number of starting cells from which Rostam will be trapped forever after assigning directions to the unspecified cells optimally.

Examples:
input:
3
3 3
UUU
L?R
DDD
2 3
???
???
3 3
?U?
R?L
RDL
output:
0
6
5

Note: In the first test case, all of the cells will be good no matter what you do.

In the second test case, if you assign the ?s like the picture below, all of the cells will be bad:

In the third test case, if you assign the ?s like the picture below, you will have $$$5$$$ bad cells (red-shaded cells):

Buggy Code:
from math import lcm

def color(x,y,colors,a):
    seen={}
    while 0<=x<len(a) and 0<=y<len(a[0]) and (x,y) not in seen and colors[x][y]==0:
        seen[(x,y)]=1
        if a[x][y]=='U':
            x-=1
            continue
        if a[x][y]=='D':
            x+=1
            continue
        if a[x][y]=='R':
            y+=1
            continue
        if a[x][y]=='L':
            y-=1
            continue
    # print(seen.keys())
    if (not (0<=x<len(a) and 0<=y<len(a[0]))) or colors[x][y]==-1: #
        for i,j in seen.keys():
            colors[i][j]=-1
    else:
        for i,j in seen.keys():
            colors[i][j]=1

t=int(input())
for _ in range(t):
    n,m = [int(i) for i in input().split()]
    a=[[i for i in input()] for _ in range(n)]

    for i in range(n):
        for j in range(m):
            if a[i][j]!='?':
                continue
            if j+1<m and a[i][j+1]=='L':
                a[i][j]='R'
                continue
            if j-1>=0 and a[i][j-1]=='R':
                a[i][j]='L'
                continue
            if i+1<n and a[i+1][j]=='U':
                a[i][j]='D'
                continue
            if i-1>=0 and a[i-1][j]=='D':
                a[i][j]=='U'
                continue

            if j+1<m and a[i][j+1]=='?':
                a[i][j],a[i][j+1]='R','L'
                continue
            if j-1>=0 and a[i][j-1]=='?':
                a[i][j],a[i][j-1]='L','R'
                continue
            if i+1<n and a[i+1][j]=='?':
                a[i][j],a[i+1][j]='D','U'
                continue
            if i-1>=0 and a[i-1][j]=='?':
                a[i][j],a[i-1]=='U','D'
                continue

    colors=[[0 for i in range(m)] for _ in range(n)]
    for i in range(n):
        for j in range(m):
            if colors[i][j]==0 and a[i][j]!='?':
                color(i,j,colors,a)

    for i in range(n):
        for j in range(m):
            if a[i][j]!='?':
                continue
            if j+1<m and colors[i][j+1]==1:
                colors[i][j]=1
                continue
            if j-1>=0 and colors[i][j-1]==1:
                colors[i][j]=1
                continue
            if i+1<n and colors[i+1][j]==1:
                colors[i][j]=1
                continue
            if i-1>=0 and colors[i-1][j]==1:
                colors[i][j]==1
                continue
    print(sum([row.count(1) for row in colors]))

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
3 3
???
???
???
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Trapped in the Witch's Labyrinth
time_limit_ms: 3000
memory_limit_mb: 256
Description: In the fourth labor of Rostam, the legendary hero from the Shahnameh, an old witch has created a magical maze to trap him. The maze is a rectangular grid consisting of $$$n$$$ rows and $$$m$$$ columns. Each cell in the maze points in a specific direction: up, down, left, or right. The witch has enchanted Rostam so that whenever he is in a cell, he will move to the next cell in the direction indicated by that cell.

If Rostam eventually exits the maze, he will be freed from the witch's enchantment and will defeat her. However, if he remains trapped within the maze forever, he will never escape.

The witch has not yet determined the directions for all the cells. She wants to assign directions to the unspecified cells in such a way that the number of starting cells from which Rostam will be trapped forever is maximized. Your task is to find the maximum number of starting cells which make Rostam trapped.

Input: The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$), the number of test cases.

For each test case:

- The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 1000$$$), representing the number of rows and columns in the maze.
- Each of the next $$$n$$$ lines contains a string of $$$m$$$ characters representing the directions in the maze. Each character is one of the following:   U (up)  D (down)  L (left)  R (right)  ? (unspecified direction)

It's guaranteed that the sum of $$$n \cdot m$$$ over all test cases is at most $$$10^6$$$.

Output: For each test case, print a single integer, the maximum number of starting cells from which Rostam will be trapped forever after assigning directions to the unspecified cells optimally.

Examples:
input:
3
3 3
UUU
L?R
DDD
2 3
???
???
3 3
?U?
R?L
RDL
output:
0
6
5

Note: In the first test case, all of the cells will be good no matter what you do.

In the second test case, if you assign the ?s like the picture below, all of the cells will be bad:

In the third test case, if you assign the ?s like the picture below, you will have $$$5$$$ bad cells (red-shaded cells):

Buggy Code:
def solve_test_case(n, m, grid):
    def is_valid(x, y):
        return 0 <= x < n and 0 <= y < m

    def get_next_cell(x, y, direction):
        if direction == 'U': return x-1, y
        if direction == 'D': return x+1, y
        if direction == 'L': return x, y-1
        if direction == 'R': return x, y+1
        return None

    def is_trapped(start_x, start_y, grid_copy):
        visited = set()
        x, y = start_x, start_y
        path = []

        while is_valid(x, y):
            current = (x, y)

            if current in visited:
                cycle_start = path.index(current)
                return True

            visited.add(current)
            path.append(current)

            current_direction = grid_copy[x][y]
            next_coords = get_next_cell(x, y, current_direction)

            if not next_coords:
                return False

            x, y = next_coords
            if len(path) > n * m * 2:
                return False

        return False

    def count_trapped_cells(grid_copy):
        return sum(is_trapped(x, y, grid_copy) for x in range(n) for y in range(m))

    question_cells = [(x, y) for x in range(n) for y in range(m) if grid[x][y] == '?']

    if not question_cells:
        return count_trapped_cells(grid)

    max_trapped = 0
    directions = ['U', 'D', 'L', 'R']

    def backtrack(index):
        nonlocal max_trapped

        if index == len(question_cells):
            grid_copy = [row[:] for row in grid]
            max_trapped = max(max_trapped, count_trapped_cells(grid_copy))
            return

        x, y = question_cells[index]
        for d in directions:
            grid[x][y] = d
            backtrack(index + 1)
            grid[x][y] = '?'

    backtrack(0)
    return max_trapped

def main():
    t = int(input())
    for _ in range(t):
        n, m = map(int, input().split())
        grid = [list(input().strip()) for _ in range(n)]
        result = solve_test_case(n, m, grid)
        print(result)

main()

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
3 3
???
???
???
```