**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Guess The Tree
time_limit_ms: 2000
memory_limit_mb: 256
Description: This is an interactive problem.

Misuki has chosen a secret tree with $$$n$$$ nodes, indexed from $$$1$$$ to $$$n$$$, and asked you to guess it by using queries of the following type:

- "? a b" — Misuki will tell you which node $$$x$$$ minimizes $$$|d(a,x) - d(b,x)|$$$, where $$$d(x,y)$$$ is the distance between nodes $$$x$$$ and $$$y$$$. If more than one such node exists, Misuki will tell you the one which minimizes $$$d(a,x)$$$.

Find out the structure of Misuki's secret tree using at most $$$15n$$$ queries!

Input: Each test consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases.

Each test case consists of a single line with an integer $$$n$$$ ($$$2 \le n \le 1000$$$), the number of nodes in the tree.

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

Output: None

Examples:
input:
1
4
1
1
3
output:
? 1 2

? 1 3

? 1 4

! 1 2 1 3 3 4

Note: A tree is an undirected acyclic connected graph. A tree with $$$n$$$ nodes will always have $$$n-1$$$ edges.

In the example case, the answer to "? 1 2" is $$$1$$$. This means that there is an edge between nodes $$$1$$$ and $$$2$$$.

The answer to "? 1 3" is $$$1$$$. This means that there is an edge between nodes $$$1$$$ and $$$3$$$.

The answer to "? 1 4" is $$$3$$$. It can be proven that this can only happen if node $$$3$$$ is connected to both node $$$1$$$ and $$$4$$$.

The edges of the tree are hence $$$(1,2)$$$, $$$(1,3)$$$ and $$$(3,4)$$$.

Buggy Code:
from sys import stdout
def ss(x,y):
    global ans
    if x!=y and b[x][y]==0 and ans!=n-1:
        print('?',x,y)
        stdout.flush()
        z=int(input())
        b[x][y]=z
        if x==z:
            a.append(x)
            a.append(y)
            ans+=1
        else:
            if x<z:
              ss(x,z)
            else:
                ss(z,x)
            if z<y:
              ss(z,y)
            else:
                ss(y,z)
for _ in range(int(input())):
  n=int(input())
  ans=0
  a=[]
  b=[[0 for i in range(n+1)] for i in range(n+1)]
  for i in range(1,n):
    for j in range(i+1,n+1):
      if b[i][j]==0:
        ss(i,j)
      if ans==n-1:
          break

  print('!',*a)

**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
4
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Guess The Tree
time_limit_ms: 2000
memory_limit_mb: 256
Description: This is an interactive problem.

Misuki has chosen a secret tree with $$$n$$$ nodes, indexed from $$$1$$$ to $$$n$$$, and asked you to guess it by using queries of the following type:

- "? a b" — Misuki will tell you which node $$$x$$$ minimizes $$$|d(a,x) - d(b,x)|$$$, where $$$d(x,y)$$$ is the distance between nodes $$$x$$$ and $$$y$$$. If more than one such node exists, Misuki will tell you the one which minimizes $$$d(a,x)$$$.

Find out the structure of Misuki's secret tree using at most $$$15n$$$ queries!

Input: Each test consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases.

Each test case consists of a single line with an integer $$$n$$$ ($$$2 \le n \le 1000$$$), the number of nodes in the tree.

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

Output: None

Examples:
input:
1
4
1
1
3
output:
? 1 2

? 1 3

? 1 4

! 1 2 1 3 3 4

Note: A tree is an undirected acyclic connected graph. A tree with $$$n$$$ nodes will always have $$$n-1$$$ edges.

In the example case, the answer to "? 1 2" is $$$1$$$. This means that there is an edge between nodes $$$1$$$ and $$$2$$$.

The answer to "? 1 3" is $$$1$$$. This means that there is an edge between nodes $$$1$$$ and $$$3$$$.

The answer to "? 1 4" is $$$3$$$. It can be proven that this can only happen if node $$$3$$$ is connected to both node $$$1$$$ and $$$4$$$.

The edges of the tree are hence $$$(1,2)$$$, $$$(1,3)$$$ and $$$(3,4)$$$.

Buggy Code:
#from math import ceil,log,lcm,gcd
#from collections import deque,Counter,defaultdict
#from bisect import bisect
#from heapq import heappush,heappop
#from random import randint

from sys import stdin,stdout
input=lambda:stdin.readline().rstrip()
print=lambda *x,sep=' ',end='\n':stdout.write(sep.join(map(str,x))+end)

def out(l):
    print(' '.join(map(str,l)))
    stdout.flush()

def yes():
    print('Yes')

def no():
    print('No')

def alice():
    print('Alice')

def bob():
    print('Bob')

def ask(a,b):
    print('?',a,b)
    stdout.flush()
    x=int(input())
    return x

def solve():
    n=int(input())
    if n==2:
        print('!',1,2)
        stdout.flush()
        return
    vis=[0]*(n+1)
    vis[1]=1
    stk=[]
    ans=['!']
    for i in range(2,n+1):
        if i<=n and not vis[i]:
            stk=[]
            node=ask(1,i)
            if node==-1:
                print('Excess Queries')
                stdout.flush()
                return
            if node==1:
                ans.extend([1,i])
                vis[i]=1
            else:
                stk.extend([1,node,i])
        while len(stk)>1:
            b=stk.pop()
            a=stk.pop()
            if vis[a] and vis[b]:
                continue
            node=ask(a,b)
            if node==-1:
                print('Excess Queries')
                stdout.flush()
                return
            if node==a:
                ans.extend([a,b])
                if stk:
                    ele=stk[-1]
                    if not vis[a]:
                        ans.extend([ele,a])
                vis[a]=1
                vis[b]=1
            else:
                stk.extend([a,node,b])
        if len(ans)==2*(n-1)+1:
            break
    out(ans)

for _ in range(int(input())):
    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
2
3
4
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Guess The Tree
time_limit_ms: 2000
memory_limit_mb: 256
Description: This is an interactive problem.

Misuki has chosen a secret tree with $$$n$$$ nodes, indexed from $$$1$$$ to $$$n$$$, and asked you to guess it by using queries of the following type:

- "? a b" — Misuki will tell you which node $$$x$$$ minimizes $$$|d(a,x) - d(b,x)|$$$, where $$$d(x,y)$$$ is the distance between nodes $$$x$$$ and $$$y$$$. If more than one such node exists, Misuki will tell you the one which minimizes $$$d(a,x)$$$.

Find out the structure of Misuki's secret tree using at most $$$15n$$$ queries!

Input: Each test consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases.

Each test case consists of a single line with an integer $$$n$$$ ($$$2 \le n \le 1000$$$), the number of nodes in the tree.

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

Output: None

Examples:
input:
1
4
1
1
3
output:
? 1 2

? 1 3

? 1 4

! 1 2 1 3 3 4

Note: A tree is an undirected acyclic connected graph. A tree with $$$n$$$ nodes will always have $$$n-1$$$ edges.

In the example case, the answer to "? 1 2" is $$$1$$$. This means that there is an edge between nodes $$$1$$$ and $$$2$$$.

The answer to "? 1 3" is $$$1$$$. This means that there is an edge between nodes $$$1$$$ and $$$3$$$.

The answer to "? 1 4" is $$$3$$$. It can be proven that this can only happen if node $$$3$$$ is connected to both node $$$1$$$ and $$$4$$$.

The edges of the tree are hence $$$(1,2)$$$, $$$(1,3)$$$ and $$$(3,4)$$$.

Buggy Code:
import java.io.*;
import java.util.*;

public class C2 {
  static Random rand;
  static Utils u;
  static FastReader f;
  static BuildAndRun br;

  public static void main(String[] args) {
    f = new FastReader();
    br = new BuildAndRun();
    rand = new Random();
    u = new Utils();
    int t = f.ni();
    while (t > 0) {
      br.run();
      t--;
    }
  }

  static class Interactor {

    int n;
    int[][] tree;

    public Interactor(int n) {
      this.n = n;
      // tree = new int[][] { { 1, 1, 1, 3 }, { 2, 2, 1, 1 }, { 3, 1, 3, 3 }, { 3, 3,
      // 4, 4 } };
      // tree = new int[][]{{1, 1, 2}, {2, 2, 2}, {2, 3, 3}};
      // tree = new int[][] { { 1, 1, 1 }, { 2, 2, 1 }, { 3, 1, 3 } };
      // tree = new int[][] {{1, 1}, {2, 2}};
      tree = new int[][] { { 1, 1, 2, 2, 3 }, { 2, 2, 2, 3, 3 }, { 2, 3, 3, 3, 4 }, { 3, 3, 4, 4, 4 },
          { 3, 4, 4, 5, 5 } };
    }

    int query(String query) {
      String[] sp = query.split(" ");
      int a = Integer.parseInt(sp[1]) - 1;
      int b = Integer.parseInt(sp[2]) - 1;
      return tree[a][b];
    }
  }

  static class BuildAndRun {
    boolean testing = false;
    Interactor test;
    HashMap<Integer, HashSet<Integer>> vis;
    HashMap<Integer, HashSet<Integer>> adj;
    int count = 0;

    public void run() {
      StringBuilder sb = new StringBuilder();
      int n = f.ni();
      test = new Interactor(n);

      vis = new HashMap<>();
      adj = new HashMap<>();

      int st = 1;
      count = 0;
      for (int i = 2; i <= n; i++) {
        if (count == n - 1) {
          break;
        }
        rec(st, i, n);
      }

      sb.append("! ");
      for (Map.Entry<Integer, HashSet<Integer>> e : adj.entrySet()) {
        int k = e.getKey();
        for (int v : e.getValue()) {
          sb.append(k + " " + v + " ");
        }
      }
      u.prln(sb);
    }

    void rec(int a, int b, int n) {
      if (vis.containsKey(a) && vis.get(a).contains(b)) {
        return;
      }
      if (vis.containsKey(b) && vis.get(b).contains(a)) {
        return;
      }
      vis.putIfAbsent(a, new HashSet<>());
      vis.get(a).add(b);

      vis.putIfAbsent(b, new HashSet<>());
      vis.get(b).add(a);

      int res = query(a, b);

      if (res == a) {
        if (a < b) {
          adj.putIfAbsent(a, new HashSet<>());
          if (!adj.get(a).contains(b)) {
            adj.get(a).add(b);
            count++;
          }
        } else {
          adj.putIfAbsent(b, new HashSet<>());
          if (!adj.get(b).contains(a)) {
            adj.get(b).add(a);
            count++;
          }
        }
        return;
      }

      rec(a, res, n);
      rec(res, b, n);
    }

    int query(int a, int b) {
      String query = "? " + a + " " + b;
      u.prln(query);
      int res;
      if (testing) {
        res = test.query(query);
      } else {
        res = f.ni();
      }
      return res;
    }
  }

  static class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
      br = new BufferedReader(
          new InputStreamReader(System.in));
    }

    String nx() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int ni() {
      return Integer.parseInt(nx());
    }

    long nlg() {
      return Long.parseLong(nx());
    }

    double nd() {
      return Double.parseDouble(nx());
    }

    String nl() {
      String str = "";
      try {
        if (st.hasMoreTokens()) {
          str = st.nextToken("\n");
        } else {
          str = br.readLine();
        }
      } catch (IOException e) {
        e.printStackTrace();
      }
      return str;
    }

    public int[] ba(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++) {
        a[i] = this.ni();
      }
      return a;
    }

    public long[] bal(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++) {
        a[i] = this.nlg();
      }
      return a;
    }

    public String[] bas(int n) {
      String[] a = new String[n];
      for (int i = 0; i < n; i++) {
        a[i] = f.nx();
      }
      return a;
    }

    public int[][] baa(int n, int m) {
      int[][] a = new int[n][m];
      for (int i = 0; i < n; i++) {
        a[i] = this.ba(m);
      }
      return a;
    }

    public long[][] baal(int n, int m) {
      long[][] a = new long[n][m];
      for (int i = 0; i < n; i++) {
        a[i] = this.bal(m);
      }
      return a;
    }

    public String[][] baas(int n, int m) {
      String[][] a = new String[n][m];
      for (int i = 0; i < n; i++) {
        a[i] = this.bas(m);
      }
      return a;
    }

    public List<String> bls(int n) {
      List<String> list = new ArrayList<>();
      for (int i = 0; i < n; i++) {
        list.add(this.nl());
      }
      return list;
    }

    public List<Integer> bl(int n) {
      List<Integer> list = new ArrayList<>();
      for (int i = 0; i < n; i++) {
        list.add(this.ni());
      }
      return list;
    }

    public List<Long> bll(int n) {
      List<Long> list = new ArrayList<>();
      for (int i = 0; i < n; i++) {
        list.add(this.nlg());
      }
      return list;
    }

    // build edges 2d
    public List<int[]> b2d(int n, boolean index0) {
      List<int[]> l = new ArrayList<>();
      for (int i = 0; i < n; i++) {
        if (index0) {
          l.add(new int[] { this.ni() - 1, this.ni() - 1 });
        } else {
          l.add(new int[] { this.ni(), this.ni() });
        }
      }
      return l;
    }

    // build weighted edges 3d
    public List<int[]> b3d(int m, boolean index0) {
      List<int[]> edges = new ArrayList<>();
      for (int i = 0; i < m; i++) {
        if (index0) {
          edges.add(new int[] { this.ni() - 1, this.ni() - 1, this.ni() - 1 });
        } else {
          edges.add(new int[] { this.ni(), this.ni(), this.ni() });
        }
      }
      return edges;
    }
  }

  static class Utils {
    public void pr(Object s) {
      System.out.print(s);
      System.out.flush();
    }

    public void prln(Object s) {
      pr(s + "\n");
    }

    public void pa(int[] nums) {
      int n = nums.length;
      for (int i = 0; i < n; i++) {
        pr(nums[i] + " ");
      }
      prln("");
    }

    public void pal(long[] nums) {
      int n = nums.length;
      for (int i = 0; i < n; i++) {
        pr(nums[i] + " ");
      }
      prln("");
    }

    public void pa2d(int[][] nums) {
      int n = nums.length;
      int m = nums[0].length;
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
          pr(nums[i] + " ");
        }
        prln("");
      }
    }

    public void pal2d(long[][] nums) {
      int n = nums.length;
      int m = nums[0].length;
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
          pr(nums[i] + " ");
        }
        prln("");
      }
    }

    // tree graph with parent array
    // 0 indexed
    public Map<Integer, List<Integer>> buildUndirAdjMapParent(int n, int[] p) {
      HashMap<Integer, List<Integer>> map = new HashMap<>();

      for (int i = 1; i < n; i++) {
        int a = i;
        int b = p[i - 1] - 1;

        map.putIfAbsent(a, new ArrayList<>());
        map.get(a).add(b);

        map.putIfAbsent(b, new ArrayList<>());
        map.get(b).add(a);
      }

      return map;
    }

    // unweighted undirected adjacency map
    public Map<Integer, List<Integer>> buildUndirAdjMap(List<int[]> edges) {
      HashMap<Integer, List<Integer>> map = new HashMap<>();

      for (int i = 0; i < edges.size(); i++) {
        int a = edges.get(i)[0];
        int b = edges.get(i)[1];

        map.putIfAbsent(a, new ArrayList<>());
        map.get(a).add(b);

        map.putIfAbsent(b, new ArrayList<>());
        map.get(b).add(a);
      }

      return map;
    }

    // unweighted directed adjacency map
    public Map<Integer, List<Integer>> builddirAdjMap(List<int[]> edges) {
      HashMap<Integer, List<Integer>> map = new HashMap<>();

      for (int i = 0; i < edges.size(); i++) {
        int a = edges.get(i)[0];
        int b = edges.get(i)[1];

        map.putIfAbsent(a, new ArrayList<>());
        map.get(a).add(b);
      }

      return map;
    }

    // weighted undirected Adjacency map
    // edges length 3
    public Map<Integer, List<int[]>> buildWeighUndirAdjMap(List<int[]> edges) {
      HashMap<Integer, List<int[]>> map = new HashMap<>();
      for (int i = 0; i < edges.size(); i++) {
        int a = edges.get(i)[0];
        int b = edges.get(i)[1];
        int c = edges.get(i)[2];

        List<int[]> l = map.getOrDefault(a, new ArrayList<>());
        l.add(new int[] { b, c });
        map.put(a, l);

        l = map.getOrDefault(b, new ArrayList<>());
        l.add(new int[] { a, c });
        map.put(b, l);
      }

      return map;
    }

    // Weighted directed adjacency map
    // edges 3
    public Map<Integer, List<int[]>> buildWeighDirAdjMap(List<int[]> edges) {
      HashMap<Integer, List<int[]>> map = new HashMap<>();
      for (int i = 0; i < edges.size(); i++) {
        int a = edges.get(i)[0];
        int b = edges.get(i)[1];
        int c = edges.get(i)[2];

        List<int[]> l = map.getOrDefault(a, new ArrayList<>());
        l.add(new int[] { b, c });
        map.put(a, l);
      }

      return map;
    }

    // Print Adjacency map
    public void printAdjMap(Map<Integer, List<int[]>> map) {
      for (Map.Entry<Integer, List<int[]>> entry : map.entrySet()) {
        int k = entry.getKey();
        List<int[]> v = entry.getValue();
        prln("k: " + k);
        for (int[] v1 : v) {
          pa(v1);
        }
      }
    }

    // print boolean answer YES / NO
    public void booleanAns(boolean res, StringBuilder sb) {
      if (res) {
        sb.append("YES");
      } else {
        sb.append("NO");
      }
    }

    // Print power 2 of a number with MOD
    public long[] pow2(int n, int mod) {
      long[] ans = new long[n];
      long curr = 1;
      for (int i = 0; i < n; i++) {
        ans[i] = curr;
        curr = (curr * 2) % mod;
      }
      return ans;
    }

    // get next greater for each elements in array
    public int[] nextGreater(int n, int[] a) {
      int[] ans = new int[n];
      Stack<Integer> st = new Stack<>();

      for (int i = n - 1; i >= 0; i--) {
        while (!st.isEmpty() && a[i] > a[st.peek()]) {
          st.pop();
        }

        if (st.isEmpty()) {
          ans[i] = n;
        } else {
          ans[i] = st.peek();
        }
        st.push(i);
      }
      return ans;
    }

    // get previous greater for each elements in array
    public int[] prevGreater(int n, int[] a) {
      int[] ans = new int[n];
      Stack<Integer> st = new Stack<>();

      for (int i = 0; i < n; i++) {
        while (!st.isEmpty() && a[i] > a[st.peek()]) {
          st.pop();
        }

        if (st.isEmpty()) {
          ans[i] = -1;
        } else {
          ans[i] = st.peek();
        }
        st.push(i);
      }
      return ans;
    }

    // get random between 0 to n-1
    public int getRand(int n) {
      return rand.nextInt(n);
    }

    // reverse numeric decimal n
    public int reverse(int n) {
      int ans = 0;
      while (n > 0) {
        ans = ans * 10 + n % 10;
        n = n / 10;
      }
      return ans;
    }

    // return sum of array
    public long sumArray(int[] nums) {
      long sum = 0;
      int n = nums.length;
      for (int i = 0; i < n; i++) {
        sum += Long.valueOf(nums[i]);
      }
      return sum;
    }

    // prefix sum of array
    public long[] prefixSum(int[] nums) {
      int n = nums.length;
      long[] ps = new long[n];
      ps[0] = nums[0];
      for (int i = 1; i < n; i++) {
        ps[i] = ps[i - 1] + Long.valueOf(nums[i]);
      }
      return ps;
    }
  }

  static class Pair {
    int k;
    int v;

    Pair(int k, int v) {
      this.k = k;
      this.v = v;
    }

    public String toString() {
      return "[" + k + "," + v + "]";
    }

    public int compareTo(Pair p) {
      if (this.k == p.k) {
        return this.v - p.v;
      }
      return this.k - p.k;
    }
  }
}

**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 code, we need to consider the following aspects:

1. **Edge Cases**: Test cases that push the boundaries of the algorithm, such as trees with the minimum and maximum number of nodes.
2. **Complex Structures**: Trees with complex structures that might not be handled correctly by the algorithm, such as trees with multiple branches and long paths.
3. **Symmetric and Asymmetric Trees**: Trees that have symmetric and asymmetric properties to test the algorithm's ability to handle different types of tree structures.

Given the constraints:
- The number of test cases \( t \) can be up to 200.
- The number of nodes \( n \) can be up to 1000.
- The sum of \( n \) across all test cases does not exceed 1000.

Let's create a small-scale test input that includes a mix of these aspects:

1. A tree with the minimum number of nodes (2 nodes).
2. A tree with a small number of nodes (4 nodes) with a simple structure.
3. A tree with a small number of nodes (5 nodes) with a more complex structure.

Here is the test input:

```plaintext
3
2
4
5
```

This input consists of three test cases:
1. A tree with 2 nodes.
2. A tree with 4 nodes.
3. A tree with 5 nodes.

These test cases will help in verifying the algorithm's ability to handle different tree structures and edge cases.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Guess The Tree
time_limit_ms: 2000
memory_limit_mb: 256
Description: This is an interactive problem.

Misuki has chosen a secret tree with $$$n$$$ nodes, indexed from $$$1$$$ to $$$n$$$, and asked you to guess it by using queries of the following type:

- "? a b" — Misuki will tell you which node $$$x$$$ minimizes $$$|d(a,x) - d(b,x)|$$$, where $$$d(x,y)$$$ is the distance between nodes $$$x$$$ and $$$y$$$. If more than one such node exists, Misuki will tell you the one which minimizes $$$d(a,x)$$$.

Find out the structure of Misuki's secret tree using at most $$$15n$$$ queries!

Input: Each test consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 200$$$) — the number of test cases.

Each test case consists of a single line with an integer $$$n$$$ ($$$2 \le n \le 1000$$$), the number of nodes in the tree.

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

Output: None

Examples:
input:
1
4
1
1
3
output:
? 1 2

? 1 3

? 1 4

! 1 2 1 3 3 4

Note: A tree is an undirected acyclic connected graph. A tree with $$$n$$$ nodes will always have $$$n-1$$$ edges.

In the example case, the answer to "? 1 2" is $$$1$$$. This means that there is an edge between nodes $$$1$$$ and $$$2$$$.

The answer to "? 1 3" is $$$1$$$. This means that there is an edge between nodes $$$1$$$ and $$$3$$$.

The answer to "? 1 4" is $$$3$$$. It can be proven that this can only happen if node $$$3$$$ is connected to both node $$$1$$$ and $$$4$$$.

The edges of the tree are hence $$$(1,2)$$$, $$$(1,3)$$$ and $$$(3,4)$$$.

Buggy Code:
import java.io.*;

import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {
    static FastReader fs;
    static PrintWriter out;
    static int mod = (int) 1e9+7;
    static long fact[], invfact[];
    static ArrayList<Integer> adj[];
    static long inf = (long) (9e18);

    static Node st[];
    static long b[];

    public static void main(String[] args) {
        fs = new FastReader();
        out = new PrintWriter(System.out);
//        int tt = 1;

        int tt = fs.fi();

        for(int test = 1; test <= tt; test++) {
            int n = fs.fi();
            HashSet<String> set = new HashSet<>();
            HashMap<String,Integer> map = new HashMap<>();
            boolean vis [] = new boolean[n+1];
            vis[1] = true;
            for(int i = 2; i <= n; i++){
                if(vis[i]) continue;
                int node = -1;
                int cur = i;
                int curNode = 1;
                while(node != i){
                    String s = curNode + " " + cur;
                    if(curNode != cur && !map.containsKey(s)){
                        out.println("? "+ curNode + " " + cur);
                        out.flush();
                        node = fs.fi();
                    }else if(curNode == cur){
                        node  = cur;
                    }
                    if(map.containsKey(s)){
                        node = map.get(s);
                    }else {
                        map.put(s,node);
                    }

                    if(node == curNode){
                        String ss = cur + " " + curNode;
                        if(curNode != cur && !set.contains(ss)){
                            set.add(curNode + " " +  cur);
                        }
                        curNode = cur;
                        cur = i;
                        vis[cur] = true;
                    }else if(node != -1){
                        cur = node;
                    }else break;
                }

            }
            StringBuilder sb =new StringBuilder();
            sb.append("!").append(" ");
            for(String i : set) sb.append(i).append(" ");

            out.println(sb);
            out.flush();

        }
        out.close();
    }

    static class Node {

        long val;
        int index;

        public Node(long val, int index) {
            this.val = val;
            this.index = index;
        }
    }
    static class Pair1{
        StringBuilder sb;
        long cnt01;
        long cnt10;

        long op;

        public Pair1(StringBuilder sb, long cnt01, long cnt10,long op) {
            this.sb = sb;
            this.cnt01 = cnt01;
            this.cnt10 = cnt10;
            this.op = op;
        }
    }

    static class Union {
        int[] id, sz; int comps;

        // 0 to n
        public Union(int n) {

            id = new int[n+1]; sz = new int[n+1];
            comps = n+1;
            for (int i = 0; i < n + 1; i++) {
                id[i] = i;
            }
            Arrays.fill(sz, 1);
        }

        public int find(int a) {
            return id[a]=(id[a]==a?a:find(id[a]));
        }

        public boolean con(int a, int b) {return find(a)==find(b);}

        public int size(int a) {return sz[find(a)];}

        public int comps() {return comps;}

        public void unify(int a, int b) {
            a = find(a); b = find(b);
            if(a==b)return;
            if(sz[a] >= sz[b]) {
                id[b] = a;
                sz[a] += sz[b];
            } else {
                id[a] = b;
                sz[b] += sz[a];
            }
            comps--;
        }
    }

    static class SegmentTreeMin {
        long[] tree;
        long[] nums;
        int n;

        SegmentTreeMin(long[] nums) {
            this.nums = nums;
            this.n = nums.length;
            this.tree = new long[4 * n];
            for (int i = 0; i < 4 * n; i++) tree[i] = inf;
            buildTree(1, 0, n - 1);
        }

        void buildTree(int node, int start, int end) {
            if (start == end) tree[node] = nums[start];
            else {
                int mid = (start + end) / 2;
                buildTree(2 * node, start, mid);
                buildTree(2 * node + 1, mid + 1, end);
                tree[node] = min(tree[2 * node], tree[2 * node + 1]);
            }
        }

        long query(int left, int right) {
            return query(1, 0, n - 1, left - 1, right - 1);
        }

        long query(int node, int start, int end, int left, int right) {
            if (right < start || left > end) return inf;
            else if (left <= start && right >= end) return tree[node];
            else
                return min(query(2 * node, start, (start + end) / 2, left, right), query(2 * node + 1, ((start + end) / 2) + 1, end, left, right));
        }

        void update(int index, long value) {
            update(1, 0, n - 1, index - 1, value);
        }

        void update(int node, int start, int end, int index, long value) {
            if (start == end) {
                nums[index] = value;
                tree[node] = value;
            } else {
                int mid = (start + end) / 2;
                if (index >= start && index <= mid) update(2 * node, start, mid, index, value);
                else update(2 * node + 1, mid + 1, end, index, value);
                tree[node] = min(tree[2 * node], tree[2 * node + 1]);
            }
        }
    }

    static class Pair2 {
        String s;
        long count;

        public Pair2(String s, long count) {
            this.s = s;

            this.count = count;
        }

    }

    static class MergeSortTree {
        int n;
        List<Integer>[] tree;

        public MergeSortTree(int[] a) {
            this.n = a.length;
            int size = 1;
            while (size < n) {
                size *= 2;
            }
            size *= 2;
            tree = new ArrayList[size];
            for (int i = 0; i < size; i++) {
                tree[i] = new ArrayList<>();
            }
            build(a, 0, 0, n);
            for (int i = 0; i < size; i++) {
                // if (test) System.out.format("  i:%2d %s\n", i, trace(tree[i]));
            }
        }

        void build(int[] a, int x, int l, int r) {
            if (l + 1 == r) {
                tree[x].add(a[l]);
                return;
            }
            int m = (l + r) / 2;
            build(a, 2 * x + 1, l, m);
            build(a, 2 * x + 2, m, r);
            merge(tree[2 * x + 1], tree[2 * x + 2], tree[x]);
        }

        int count(int lq, int rq, int mn, int mx, int x, int l, int r) {
            if (rq <= l || r <= lq) {
                return 0;
            }
            if (lq <= l && r <= rq) {
                int e = Collections.binarySearch(tree[x], mx);
                if (e < 0) {
                    e = -(e + 1);
                }
                int b = Collections.binarySearch(tree[x], mn);
                if (b < 0) {
                    b = -(b + 1);
                }
                return e - b;
            }

            int m = (l + r) / 2;
            int a = count(lq, rq, mn, mx, 2 * x + 1, l, m);
            int b = count(lq, rq, mn, mx, 2 * x + 2, m, r);
            return a + b;
        }

        int count(int lq, int rq, int mn, int mx) {
            return count(lq, rq, mn, mx, 0, 0, n);
        }

        static void merge(List<Integer> a, List<Integer> b, List<Integer> out) {
            int i = 0;
            int j = 0;
            while (i < a.size() && j < b.size()) {
                if (a.get(i) <= b.get(j)) {
                    out.add(a.get(i++));
                } else {
                    out.add(b.get(j++));
                }
            }
            while (i < a.size()) {
                out.add(a.get(i++));
            }
            while (j < b.size()) {
                out.add(b.get(j++));
            }
        }
    }

    static boolean found = false;

    public static void cal(int n) {
        fact = new long[n];
        invfact = new long[n];
        fact[0] = 1;
        invfact[0] = 1;
        for (int i = 1; i < n; i++) {
            fact[i] = (fact[i - 1] * i) % mod;
            invfact[i] = (modInverse(fact[i]));
        }

    }

    public static long NCR(int n, int r) {
        if (r < 0 || n < 0) {
            return -1;
        }
        if(n == 0) return 0;
        if (n < r) return 0;
        if ( r == n) return 1;
        return (fact[n] * (invfact[r]) % mod) * invfact[n - r] % mod;
    }

    public static long modInverse(long n) {
        return powMod(n, mod - 2);
    }

    public static long powMod(long x, long y) {

        long res = 1;
        x = x % mod;
        while (y > 0) {
            if ((y & 1) == 1) {
                res = (res * x) % mod;
            }
            y = y >> 1;
            x = (x * x) % mod;
        }
        return res;
    }
    public static long powMod(long x, long y,long mod) {

        long res = 1;
        x = x % mod;
        while (y > 0) {
            if ((y & 1) == 1) {
                res = (res * x) % mod;
            }
            y = y >> 1;
            x = (x * x) % mod;
        }
        return res;
    }

    public static long[] swap(long a, long b) {
        return new long[]{b, a};
    }

    // constants
    static final int IBIG = 1000000007;
    static final int IMAX = 2147483647;
    static final long LMAX = 9223372036854775807L;
    static Random __r = new Random();
    static int[][] direction = new int[][]{{-1, -1}, {-1, 0}, {-1, 1}, {0, 1}, {1, 1}, {1, 0}, {1, -1}, {0, -1}};

    // math util
    static int minof(int a, int b, int c) {
        return min(a, min(b, c));
    }

    static int minof(int... x) {
        if (x.length == 1)
            return x[0];
        if (x.length == 2)
            return min(x[0], x[1]);
        if (x.length == 3)
            return min(x[0], min(x[1], x[2]));
        int min = x[0];
        for (int i = 1; i < x.length; ++i)
            if (x[i] < min)
                min = x[i];
        return min;
    }

    static char maxc(char a, char b) {
        if (a > b) {
            return a;
        }
        return b;
    }

    static long minof(long a, long b, long c) {
        return min(a, min(b, c));
    }

    static long minof(long... x) {
        if (x.length == 1)
            return x[0];
        if (x.length == 2)
            return min(x[0], x[1]);
        if (x.length == 3)
            return min(x[0], min(x[1], x[2]));
        long min = x[0];
        for (int i = 1; i < x.length; ++i)
            if (x[i] < min)
                min = x[i];
        return min;
    }

    static int maxof(int a, int b, int c) {
        return max(a, max(b, c));
    }

    static int maxof(int... x) {
        if (x.length == 1)
            return x[0];
        if (x.length == 2)
            return max(x[0], x[1]);
        if (x.length == 3)
            return max(x[0], max(x[1], x[2]));
        int max = x[0];
        for (int i = 1; i < x.length; ++i)
            if (x[i] > max)
                max = x[i];
        return max;
    }

    static long maxof(long a, long b, long c) {
        return max(a, max(b, c));
    }

    static long maxof(long... x) {
        if (x.length == 1)
            return x[0];
        if (x.length == 2)
            return max(x[0], x[1]);
        if (x.length == 3)
            return max(x[0], max(x[1], x[2]));
        long max = x[0];
        for (int i = 1; i < x.length; ++i)
            if (x[i] > max)
                max = x[i];
        return max;
    }

    static int powi(int a, int b) {
        if (a == 0)
            return 0;
        int ans = 1;
        while (b > 0) {
            if ((b & 1) > 0)
                ans *= a;
            a *= a;
            b >>= 1;
        }
        return ans;
    }

    static long powl(long a, int b) {
        if (a == 0)
            return 0;
        long ans = 1;
        while (b > 0) {
            if ((b & 1) > 0)
                ans *= a;
            a *= a;
            b >>= 1;
        }
        return ans;
    }

    static int fli(double d) {
        return (int) d;
    }

    static int cei(double d) {
        return (int) ceil(d);
    }
    static long cei1(double d) {
        return (long) ceil(d);
    }

    static long fll(double d) {
        return (long) d;
    }

    static long cel(double d) {
        return (long) ceil(d);
    }

    static int gcd(int a, int b) {
        return b == 0 ? a : gcd(b, a % b);
    }

    static int lcm(int a, int b) {
        return (a / gcd(a, b)) * b;
    }

    static long gcd(long a, long b) {
        return b == 0 ? a : gcd(b, a % b);
    }

    static long lcm(long a, long b) {
        return (a / gcd(a, b)) * b;
    }

    static int[] exgcd(int a, int b) {
        if (b == 0)
            return new int[]{1, 0};
        int[] y = exgcd(b, a % b);
        return new int[]{y[1], y[0] - y[1] * (a / b)};
    }

    static long[] exgcd(long a, long b) {
        if (b == 0)
            return new long[]{1, 0};
        long[] y = exgcd(b, a % b);
        return new long[]{y[1], y[0] - y[1] * (a / b)};
    }

    static int randInt(int min, int max) {
        return __r.nextInt(max - min + 1) + min;
    }

    static long mix(long x) {
        x += 0x9e3779b97f4a7c15L;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9L;
        x = (x ^ (x >> 27)) * 0x94d049bb133111ebL;
        return x ^ (x >> 31);
    }

    public static boolean[] findPrimes(int limit) {
        assert limit >= 2;

        final boolean[] nonPrimes = new boolean[limit];
        nonPrimes[0] = true;
        nonPrimes[1] = true;

        int sqrt = (int) Math.sqrt(limit);
        for (int i = 2; i <= sqrt; i++) {
            if (nonPrimes[i])
                continue;
            for (int j = i; j < limit; j += i) {
                if (!nonPrimes[j] && i != j)
                    nonPrimes[j] = true;
            }
        }

        return nonPrimes;
    }

    // array util
    static void reverse(int[] a) {
        for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {
            int swap = a[i];
            a[i] = a[n - i - 1];
            a[n - i - 1] = swap;
        }
    }

    static void reverse(long[] a) {
        for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {
            long swap = a[i];
            a[i] = a[n - i - 1];
            a[n - i - 1] = swap;
        }
    }

    static void reverse(double[] a) {
        for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {
            double swap = a[i];
            a[i] = a[n - i - 1];
            a[n - i - 1] = swap;
        }
    }

    static void reverse(char[] a) {
        for (int i = 0, n = a.length, half = n / 2; i < half; ++i) {
            char swap = a[i];
            a[i] = a[n - i - 1];
            a[n - i - 1] = swap;
        }
    }

    public static String reverse(String input) {
        if (input == null) {
            return null;
        }

        StringBuilder reversed = new StringBuilder(input);
        return reversed.reverse().toString();
    }
    static void shuffle(int[] a) {
        int n = a.length - 1;
        for (int i = 0; i < n; ++i) {
            int ind = randInt(i, n);
            int swap = a[i];
            a[i] = a[ind];
            a[ind] = swap;
        }
    }

    static void shuffle(long[] a) {
        int n = a.length - 1;
        for (int i = 0; i < n; ++i) {
            int ind = randInt(i, n);
            long swap = a[i];
            a[i] = a[ind];
            a[ind] = swap;
        }
    }

    static void shuffle(double[] a) {
        int n = a.length - 1;
        for (int i = 0; i < n; ++i) {
            int ind = randInt(i, n);
            double swap = a[i];
            a[i] = a[ind];
            a[ind] = swap;
        }
    }

    static void rsort(int[] a) {
        shuffle(a);
        sort(a);
    }

    static void msort(int a[][]) {
        Arrays.sort(a, new Comparator<int[]>() {
            @Override
            public int compare(int[] o1, int[] o2) {
                return 0;
            }
        });
    }

    static PriorityQueue<int[]> funcPQ() {
        return new PriorityQueue<int[]>(new Comparator<int[]>() {
            @Override
            public int compare(int[] o1, int[] o2) {
                return 0;
            }
        });
    }

    static void rsort(long[] a) {
        shuffle(a);
        sort(a);
    }

    static void rsort(double[] a) {
        shuffle(a);
        sort(a);
    }

    static int[] copy(int[] a) {
        int[] ans = new int[a.length];
        for (int i = 0; i < a.length; ++i)
            ans[i] = a[i];
        return ans;
    }

    static long[] copy(long[] a) {
        long[] ans = new long[a.length];
        for (int i = 0; i < a.length; ++i)
            ans[i] = a[i];
        return ans;
    }

    static double[] copy(double[] a) {
        double[] ans = new double[a.length];
        for (int i = 0; i < a.length; ++i)
            ans[i] = a[i];
        return ans;
    }

    static char[] copy(char[] a) {
        char[] ans = new char[a.length];
        for (int i = 0; i < a.length; ++i)
            ans[i] = a[i];
        return ans;
    }

    static class FastReader {

        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(
                    new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int fi() {
            return Integer.parseInt(next());
        }

        int[] ria(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = Integer.parseInt(next());
            return a;
        }

        long fl() {
            return Long.parseLong(next());
        }

        long[] rla(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = Long.parseLong(next());
            return a;
        }

        double fd() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

**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 that can potentially cause the algorithm to fail. The code is designed to guess the structure of a tree using queries, and it relies on the responses to these queries to build the tree. Here are some considerations for generating a challenging test input:

1. **Linear Tree**: A linear tree (a chain) can be challenging because it has a very specific structure where each node is connected to at most two other nodes.
2. **Star Tree**: A star tree, where one central node is connected to all other nodes, can also be tricky because it has a highly centralized structure.
3. **Balanced Tree**: A balanced tree, such as a complete binary tree, can be challenging due to its symmetry.
4. **Complex Tree**: A tree with a mix of different structures, such as a combination of linear and star substructures, can be even more challenging.

Given the constraints and the need for a small-scale test input, let's focus on a linear tree and a star tree.

### Linear Tree
A linear tree with 4 nodes can be represented as:
```
1 - 2 - 3 - 4
```
This structure is simple but can expose issues in the algorithm's ability to correctly identify linear connections.

### Star Tree
A star tree with 4 nodes can be represented as:
```
  1
 /|\
2 3 4
```
This structure is centralized and can expose issues in the algorithm's ability to handle a highly connected central node.

### Test Input
Let's generate a test input with two test cases: one for the linear tree and one for the star tree.

```plaintext
2
4
4
```

### Explanation
- The first line `2` indicates that there are two test cases.
- The second line `4` indicates that the first test case has 4 nodes, forming a linear tree.
- The third line `4` indicates that the second test case also has 4 nodes, forming a star tree.

This test input is small-scale and complete, and it covers two different types of tree structures that can challenge the algorithm.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Competitive Fishing
time_limit_ms: 2000
memory_limit_mb: 512
Description: Alice and Bob participate in a fishing contest! In total, they caught $$$n$$$ fishes, numbered from $$$1$$$ to $$$n$$$ (the bigger the fish, the greater its index). Some of these fishes were caught by Alice, others — by Bob.

Their performance will be evaluated as follows. First, an integer $$$m$$$ will be chosen, and all fish will be split into $$$m$$$ non-empty groups. The first group should contain several (at least one) smallest fishes, the second group — several (at least one) next smallest fishes, and so on. Each fish should belong to exactly one group, and each group should be a contiguous subsegment of fishes. Note that the groups are numbered in exactly that order; for example, the fishes from the second group cannot be smaller than the fishes from the first group, since the first group contains the smallest fishes.

Then, each fish will be assigned a value according to its group index: each fish in the first group gets value equal to $$$0$$$, each fish in the second group gets value equal to $$$1$$$, and so on. So, each fish in the $$$i$$$-th group gets value equal to $$$(i-1)$$$.

The score of each contestant is simply the total value of all fishes that contestant caught.

You want Bob's score to exceed Alice's score by at least $$$k$$$ points. What is the minimum number of groups ($$$m$$$) you have to split the fishes into? If it is impossible, you should report that.

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

The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 2 \cdot 10^5$$$; $$$1 \le k \le 10^9$$$).

The second line contains a string, consisting of exactly $$$n$$$ characters. The $$$i$$$-th character is either 0 (denoting that the $$$i$$$-th fish was caught by Alice) or 1 (denoting that the $$$i$$$-th fish was caught by Bob).

Additional constraint on the input: the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.

Output: For each test case, print a single integer — the minimum number of groups you have to split the fishes into; or -1 if it's impossible.

Examples:
input:
7
4 1
1001
4 1
1010
4 1
0110
4 2
0110
6 3
001110
10 20
1111111111
5 11
11111
output:
2
-1
2
-1
3
4
-1

Note: In the first test case of the example, you can split the fishes into groups as follows: the first three fishes form the $$$1$$$-st group, the last fish forms the $$$2$$$-nd group. Then, Bob's score will be $$$1$$$, and Alice's score will be $$$0$$$.

In the third test case of the example, you can split the fishes into groups as follows: the first fish forms the $$$1$$$-st group, the last three fishes form the $$$2$$$-nd group. Then, Bob's score will be $$$2$$$, and Alice's score will be $$$1$$$.

Buggy Code:
#include<stdio.h>

int main()
{
	int t;
	scanf("%d",&t);
	while(t--)
	{
        int n,k;
        scanf("%d%d",&n,&k);
        char s[200000];
        scanf("%s",s);

		int cnt1=0;
		int cnt2=0;
		int score1=0;
		int score2=0;
		int j=1;
		int m=1;
		while(j<n-1)
		{
			int count1=0;
			int count2=0;
			int a=0;
			int b=0;
			int y=j;
			m++;
			for(int i=n-1;i>=j;i--)
			{
				if(s[i]=='1'){
					a++;
				}
				else{
					b++;
				}
				if((a-b)>0){
					count1=a;
					count2=b;
					y=i;
				}
			}
			cnt1+=count1;
			cnt2+=count2;
			if((cnt1-cnt2)>=k){
				break;
			}
			else if((cnt1-cnt2)>0&&(cnt1-cnt2)<k){
				j=(y+1);
			}
			else
			{
				break;
			}
		}
    if((cnt1-cnt2)>=k){
    	printf("%d\n",m);
	}
	else{
		printf("-1\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
10 5
0000011111
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Competitive Fishing
time_limit_ms: 2000
memory_limit_mb: 512
Description: Alice and Bob participate in a fishing contest! In total, they caught $$$n$$$ fishes, numbered from $$$1$$$ to $$$n$$$ (the bigger the fish, the greater its index). Some of these fishes were caught by Alice, others — by Bob.

Their performance will be evaluated as follows. First, an integer $$$m$$$ will be chosen, and all fish will be split into $$$m$$$ non-empty groups. The first group should contain several (at least one) smallest fishes, the second group — several (at least one) next smallest fishes, and so on. Each fish should belong to exactly one group, and each group should be a contiguous subsegment of fishes. Note that the groups are numbered in exactly that order; for example, the fishes from the second group cannot be smaller than the fishes from the first group, since the first group contains the smallest fishes.

Then, each fish will be assigned a value according to its group index: each fish in the first group gets value equal to $$$0$$$, each fish in the second group gets value equal to $$$1$$$, and so on. So, each fish in the $$$i$$$-th group gets value equal to $$$(i-1)$$$.

The score of each contestant is simply the total value of all fishes that contestant caught.

You want Bob's score to exceed Alice's score by at least $$$k$$$ points. What is the minimum number of groups ($$$m$$$) you have to split the fishes into? If it is impossible, you should report that.

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

The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 2 \cdot 10^5$$$; $$$1 \le k \le 10^9$$$).

The second line contains a string, consisting of exactly $$$n$$$ characters. The $$$i$$$-th character is either 0 (denoting that the $$$i$$$-th fish was caught by Alice) or 1 (denoting that the $$$i$$$-th fish was caught by Bob).

Additional constraint on the input: the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.

Output: For each test case, print a single integer — the minimum number of groups you have to split the fishes into; or -1 if it's impossible.

Examples:
input:
7
4 1
1001
4 1
1010
4 1
0110
4 2
0110
6 3
001110
10 20
1111111111
5 11
11111
output:
2
-1
2
-1
3
4
-1

Note: In the first test case of the example, you can split the fishes into groups as follows: the first three fishes form the $$$1$$$-st group, the last fish forms the $$$2$$$-nd group. Then, Bob's score will be $$$1$$$, and Alice's score will be $$$0$$$.

In the third test case of the example, you can split the fishes into groups as follows: the first fish forms the $$$1$$$-st group, the last three fishes form the $$$2$$$-nd group. Then, Bob's score will be $$$2$$$, and Alice's score will be $$$1$$$.

Buggy Code:
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<string>

using namespace std;
long long n, k;

int main() {
	int t;
	cin >> t;
	while (t--) {
		vector<int>a;
		char x;
		cin >> n >> k;
		for (int i = 1; i <= n; i++) {
			cin >> x;
			a.push_back(x - '0');
			if (a.size() > 1) {
				if (a[a.size() - 1] == 0 && a[a.size() - 2] == 1) {
					a.pop_back();
					a.pop_back();
				}
			}
		}
		long long sum1 = 0, sum0 = 0,sum;
		for (int i = 0; i < a.size(); i++) {
			if (a[i] == 1)sum1++;
			else sum0++;
		}
		if (sum0 == 0) {
			sum1--;
			int i,pd=0;
			for (i = 1; i <= sum1; i++) {
				sum = (sum1 - i) * i + i * (i + 1) / 2;
				if (sum >= k) {
					pd = 1;
					break;
				}
			}
			if (pd == 0)cout << "-1\n";
			else cout << i+1 << "\n";
		}
		else {
			int i,pd=0;
			for (i = 1; i <= a.size(); i++) {
				sum = (sum1 - i) * i + i * (i + 1) / 2;
				if (sum >= k) {
					pd = 1;
					break;
				}
			}
			if (pd == 0)cout << "-1\n";
			else cout << i + 1 << "\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
5
2 1
10
3 1
101
3 2
101
4 3
1010
5 1
10110
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Competitive Fishing
time_limit_ms: 2000
memory_limit_mb: 512
Description: Alice and Bob participate in a fishing contest! In total, they caught $$$n$$$ fishes, numbered from $$$1$$$ to $$$n$$$ (the bigger the fish, the greater its index). Some of these fishes were caught by Alice, others — by Bob.

Their performance will be evaluated as follows. First, an integer $$$m$$$ will be chosen, and all fish will be split into $$$m$$$ non-empty groups. The first group should contain several (at least one) smallest fishes, the second group — several (at least one) next smallest fishes, and so on. Each fish should belong to exactly one group, and each group should be a contiguous subsegment of fishes. Note that the groups are numbered in exactly that order; for example, the fishes from the second group cannot be smaller than the fishes from the first group, since the first group contains the smallest fishes.

Then, each fish will be assigned a value according to its group index: each fish in the first group gets value equal to $$$0$$$, each fish in the second group gets value equal to $$$1$$$, and so on. So, each fish in the $$$i$$$-th group gets value equal to $$$(i-1)$$$.

The score of each contestant is simply the total value of all fishes that contestant caught.

You want Bob's score to exceed Alice's score by at least $$$k$$$ points. What is the minimum number of groups ($$$m$$$) you have to split the fishes into? If it is impossible, you should report that.

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

The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 2 \cdot 10^5$$$; $$$1 \le k \le 10^9$$$).

The second line contains a string, consisting of exactly $$$n$$$ characters. The $$$i$$$-th character is either 0 (denoting that the $$$i$$$-th fish was caught by Alice) or 1 (denoting that the $$$i$$$-th fish was caught by Bob).

Additional constraint on the input: the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.

Output: For each test case, print a single integer — the minimum number of groups you have to split the fishes into; or -1 if it's impossible.

Examples:
input:
7
4 1
1001
4 1
1010
4 1
0110
4 2
0110
6 3
001110
10 20
1111111111
5 11
11111
output:
2
-1
2
-1
3
4
-1

Note: In the first test case of the example, you can split the fishes into groups as follows: the first three fishes form the $$$1$$$-st group, the last fish forms the $$$2$$$-nd group. Then, Bob's score will be $$$1$$$, and Alice's score will be $$$0$$$.

In the third test case of the example, you can split the fishes into groups as follows: the first fish forms the $$$1$$$-st group, the last three fishes form the $$$2$$$-nd group. Then, Bob's score will be $$$2$$$, and Alice's score will be $$$1$$$.

Buggy Code:
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<string.h>
using namespace std;
int n,k;
string str;
bool check(int m){
//	printf("mid=%d\n",m);
	int sta=m-1,end=n-1;
	int sum=0;
	int dp[n+5]={0};
	while(sta>=0){
		memset(dp,0,sizeof(int)*(n+5));
//		for(int i=sta;i<=end;i++){
//			printf("dp[%d]=%d\n",i,dp[i]);
//		}
		int max_ind=-1,max_dif=-1;
//		dp[end]=(str[end]=='1')?1:-1;
		for(int i=end;i>=sta;i--){
			dp[i]=dp[i+1]+((str[i]=='1')?1:-1);
			if(dp[i]>max_dif){
				max_dif=dp[i];
				max_ind=i;
			}
		}
//		for(int i=sta;i<=end;i++){
//			printf("dp[%d]=%d\n",i,dp[i]);
//		}
//		printf("sum=%d\n",sum);
		sum+=max_dif*(sta);
		end=max_ind-1;
		sta-=1;
	}
	if(sum<k)return 0;
	return 1;
}
int main(){
	int T;
	cin>>T;
	while(T--){
		cin>>n>>k;
		cin>>str;
		int l=2,r=n+1;
		while(l<r){
			int mid=(l+r)/2;
//			printf("check(%d)=%d\n",mid,check(mid));
			if(check(mid)==1)r=mid;
			else l=mid+1;
		}
		if(l==n+1)l=-1;
		cout<<l<<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
10 15
1010101010
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Competitive Fishing
time_limit_ms: 2000
memory_limit_mb: 512
Description: Alice and Bob participate in a fishing contest! In total, they caught $$$n$$$ fishes, numbered from $$$1$$$ to $$$n$$$ (the bigger the fish, the greater its index). Some of these fishes were caught by Alice, others — by Bob.

Their performance will be evaluated as follows. First, an integer $$$m$$$ will be chosen, and all fish will be split into $$$m$$$ non-empty groups. The first group should contain several (at least one) smallest fishes, the second group — several (at least one) next smallest fishes, and so on. Each fish should belong to exactly one group, and each group should be a contiguous subsegment of fishes. Note that the groups are numbered in exactly that order; for example, the fishes from the second group cannot be smaller than the fishes from the first group, since the first group contains the smallest fishes.

Then, each fish will be assigned a value according to its group index: each fish in the first group gets value equal to $$$0$$$, each fish in the second group gets value equal to $$$1$$$, and so on. So, each fish in the $$$i$$$-th group gets value equal to $$$(i-1)$$$.

The score of each contestant is simply the total value of all fishes that contestant caught.

You want Bob's score to exceed Alice's score by at least $$$k$$$ points. What is the minimum number of groups ($$$m$$$) you have to split the fishes into? If it is impossible, you should report that.

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

The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 2 \cdot 10^5$$$; $$$1 \le k \le 10^9$$$).

The second line contains a string, consisting of exactly $$$n$$$ characters. The $$$i$$$-th character is either 0 (denoting that the $$$i$$$-th fish was caught by Alice) or 1 (denoting that the $$$i$$$-th fish was caught by Bob).

Additional constraint on the input: the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.

Output: For each test case, print a single integer — the minimum number of groups you have to split the fishes into; or -1 if it's impossible.

Examples:
input:
7
4 1
1001
4 1
1010
4 1
0110
4 2
0110
6 3
001110
10 20
1111111111
5 11
11111
output:
2
-1
2
-1
3
4
-1

Note: In the first test case of the example, you can split the fishes into groups as follows: the first three fishes form the $$$1$$$-st group, the last fish forms the $$$2$$$-nd group. Then, Bob's score will be $$$1$$$, and Alice's score will be $$$0$$$.

In the third test case of the example, you can split the fishes into groups as follows: the first fish forms the $$$1$$$-st group, the last three fishes form the $$$2$$$-nd group. Then, Bob's score will be $$$2$$$, and Alice's score will be $$$1$$$.

Buggy Code:
for _ in range(int(input())):
    n, k = list(map(int, input().split()))

    o = list(map(lambda x : x * 2 - 1, map(int, list(input()))))

    d = [o[-1]]

    for i in o[::-1][1:-1]:
        d.append(d[-1] + i)

    d.sort()

    s = 0
    n = 2

    while len(d) > 0 and s + d[-1] < k:
        n += 1
        s += d.pop()

    if len(d) > 1 and s + d[-1] >= k:
        print(n)
    else:
        print(-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
6 5
000111
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Competitive Fishing
time_limit_ms: 2000
memory_limit_mb: 512
Description: Alice and Bob participate in a fishing contest! In total, they caught $$$n$$$ fishes, numbered from $$$1$$$ to $$$n$$$ (the bigger the fish, the greater its index). Some of these fishes were caught by Alice, others — by Bob.

Their performance will be evaluated as follows. First, an integer $$$m$$$ will be chosen, and all fish will be split into $$$m$$$ non-empty groups. The first group should contain several (at least one) smallest fishes, the second group — several (at least one) next smallest fishes, and so on. Each fish should belong to exactly one group, and each group should be a contiguous subsegment of fishes. Note that the groups are numbered in exactly that order; for example, the fishes from the second group cannot be smaller than the fishes from the first group, since the first group contains the smallest fishes.

Then, each fish will be assigned a value according to its group index: each fish in the first group gets value equal to $$$0$$$, each fish in the second group gets value equal to $$$1$$$, and so on. So, each fish in the $$$i$$$-th group gets value equal to $$$(i-1)$$$.

The score of each contestant is simply the total value of all fishes that contestant caught.

You want Bob's score to exceed Alice's score by at least $$$k$$$ points. What is the minimum number of groups ($$$m$$$) you have to split the fishes into? If it is impossible, you should report that.

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

The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 2 \cdot 10^5$$$; $$$1 \le k \le 10^9$$$).

The second line contains a string, consisting of exactly $$$n$$$ characters. The $$$i$$$-th character is either 0 (denoting that the $$$i$$$-th fish was caught by Alice) or 1 (denoting that the $$$i$$$-th fish was caught by Bob).

Additional constraint on the input: the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.

Output: For each test case, print a single integer — the minimum number of groups you have to split the fishes into; or -1 if it's impossible.

Examples:
input:
7
4 1
1001
4 1
1010
4 1
0110
4 2
0110
6 3
001110
10 20
1111111111
5 11
11111
output:
2
-1
2
-1
3
4
-1

Note: In the first test case of the example, you can split the fishes into groups as follows: the first three fishes form the $$$1$$$-st group, the last fish forms the $$$2$$$-nd group. Then, Bob's score will be $$$1$$$, and Alice's score will be $$$0$$$.

In the third test case of the example, you can split the fishes into groups as follows: the first fish forms the $$$1$$$-st group, the last three fishes form the $$$2$$$-nd group. Then, Bob's score will be $$$2$$$, and Alice's score will be $$$1$$$.

Buggy Code:
import sys
input = sys.stdin.readline

for _ in range(int(input())):
    n, k = map(int,input().split())
    a = list(map(int,input().rstrip('\n')))
    suf = [0]
    for ai in a[::-1]:
        suf.append(suf[-1])
        if ai:
            suf[-1] += 1
        else:
            suf[-1] -= 1
    suf.reverse()
    suf.pop()
    p = 0
    pre = 0
    for m in range(1, n+1):
        if pre + suf[p]*(m-1) >= k:
            print(m)
            break
        add = 1 if a[p] else -1
        p += 1
        while p<n and suf[p]<=0:
            add += 1 if a[p] else -1
            p += 1
        pre += add * (m-1)
        if p==n:
            print(-1)
            break
    else:
        print(-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
3
5 1
01010
5 2
01010
5 3
01010
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Competitive Fishing
time_limit_ms: 2000
memory_limit_mb: 512
Description: Alice and Bob participate in a fishing contest! In total, they caught $$$n$$$ fishes, numbered from $$$1$$$ to $$$n$$$ (the bigger the fish, the greater its index). Some of these fishes were caught by Alice, others — by Bob.

Their performance will be evaluated as follows. First, an integer $$$m$$$ will be chosen, and all fish will be split into $$$m$$$ non-empty groups. The first group should contain several (at least one) smallest fishes, the second group — several (at least one) next smallest fishes, and so on. Each fish should belong to exactly one group, and each group should be a contiguous subsegment of fishes. Note that the groups are numbered in exactly that order; for example, the fishes from the second group cannot be smaller than the fishes from the first group, since the first group contains the smallest fishes.

Then, each fish will be assigned a value according to its group index: each fish in the first group gets value equal to $$$0$$$, each fish in the second group gets value equal to $$$1$$$, and so on. So, each fish in the $$$i$$$-th group gets value equal to $$$(i-1)$$$.

The score of each contestant is simply the total value of all fishes that contestant caught.

You want Bob's score to exceed Alice's score by at least $$$k$$$ points. What is the minimum number of groups ($$$m$$$) you have to split the fishes into? If it is impossible, you should report that.

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

The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 2 \cdot 10^5$$$; $$$1 \le k \le 10^9$$$).

The second line contains a string, consisting of exactly $$$n$$$ characters. The $$$i$$$-th character is either 0 (denoting that the $$$i$$$-th fish was caught by Alice) or 1 (denoting that the $$$i$$$-th fish was caught by Bob).

Additional constraint on the input: the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.

Output: For each test case, print a single integer — the minimum number of groups you have to split the fishes into; or -1 if it's impossible.

Examples:
input:
7
4 1
1001
4 1
1010
4 1
0110
4 2
0110
6 3
001110
10 20
1111111111
5 11
11111
output:
2
-1
2
-1
3
4
-1

Note: In the first test case of the example, you can split the fishes into groups as follows: the first three fishes form the $$$1$$$-st group, the last fish forms the $$$2$$$-nd group. Then, Bob's score will be $$$1$$$, and Alice's score will be $$$0$$$.

In the third test case of the example, you can split the fishes into groups as follows: the first fish forms the $$$1$$$-st group, the last three fishes form the $$$2$$$-nd group. Then, Bob's score will be $$$2$$$, and Alice's score will be $$$1$$$.

Buggy Code:
iinp = lambda: int(input())
uinp = lambda: [int(i) for i in input().split()]

def solve():
    n,k = uinp()
    fi = [int(i) for i in input()]

    oseen = [0]
    zseen = [0]
    onepos = []

    party = 0
    maxscore = 0

    for ind,i in enumerate(fi):
        if(i == 0):
            zseen.append(zseen[-1]+1)
            oseen.append(oseen[-1])
        else:
            zseen.append(zseen[-1])
            oseen.append(oseen[-1]+1)

    for ind,i in enumerate(fi):
        if(i==1 and ind!=0):
            onepos.append(ind)
            party +=1
            maxscore+=party
        else:
            if(i==1):
                maxscore+=party
            else:
                maxscore-=party

    # if(maxscore<k):
    #     print(-1)
    #     return

    costs =[]
    for i in onepos:
        costs.append((oseen[-1]-oseen[i])-(zseen[-1]-zseen[i]))
    costs.sort()
    if((len(costs)>=1 or costs[0]>0) and maxscore<k):
        print(-1)
        return
    for i in costs:
        if(i<=0 or maxscore-i >= k):
            maxscore-=i
            party -=1
        else:
            break
    if(party == 0 or maxscore <k):
        print(-1)
    else:
        print(party+1)

tc = iinp()
for _ in range(tc):
    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
1
6 3
101010
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Competitive Fishing
time_limit_ms: 2000
memory_limit_mb: 512
Description: Alice and Bob participate in a fishing contest! In total, they caught $$$n$$$ fishes, numbered from $$$1$$$ to $$$n$$$ (the bigger the fish, the greater its index). Some of these fishes were caught by Alice, others — by Bob.

Their performance will be evaluated as follows. First, an integer $$$m$$$ will be chosen, and all fish will be split into $$$m$$$ non-empty groups. The first group should contain several (at least one) smallest fishes, the second group — several (at least one) next smallest fishes, and so on. Each fish should belong to exactly one group, and each group should be a contiguous subsegment of fishes. Note that the groups are numbered in exactly that order; for example, the fishes from the second group cannot be smaller than the fishes from the first group, since the first group contains the smallest fishes.

Then, each fish will be assigned a value according to its group index: each fish in the first group gets value equal to $$$0$$$, each fish in the second group gets value equal to $$$1$$$, and so on. So, each fish in the $$$i$$$-th group gets value equal to $$$(i-1)$$$.

The score of each contestant is simply the total value of all fishes that contestant caught.

You want Bob's score to exceed Alice's score by at least $$$k$$$ points. What is the minimum number of groups ($$$m$$$) you have to split the fishes into? If it is impossible, you should report that.

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

The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 2 \cdot 10^5$$$; $$$1 \le k \le 10^9$$$).

The second line contains a string, consisting of exactly $$$n$$$ characters. The $$$i$$$-th character is either 0 (denoting that the $$$i$$$-th fish was caught by Alice) or 1 (denoting that the $$$i$$$-th fish was caught by Bob).

Additional constraint on the input: the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.

Output: For each test case, print a single integer — the minimum number of groups you have to split the fishes into; or -1 if it's impossible.

Examples:
input:
7
4 1
1001
4 1
1010
4 1
0110
4 2
0110
6 3
001110
10 20
1111111111
5 11
11111
output:
2
-1
2
-1
3
4
-1

Note: In the first test case of the example, you can split the fishes into groups as follows: the first three fishes form the $$$1$$$-st group, the last fish forms the $$$2$$$-nd group. Then, Bob's score will be $$$1$$$, and Alice's score will be $$$0$$$.

In the third test case of the example, you can split the fishes into groups as follows: the first fish forms the $$$1$$$-st group, the last three fishes form the $$$2$$$-nd group. Then, Bob's score will be $$$2$$$, and Alice's score will be $$$1$$$.

Buggy Code:
import java.util.*;
public class CompetitiveFishing {
	public static void main(String[]args)
	{
		Scanner sc = new Scanner(System.in);
		int T = sc.nextInt();
		for(int i = 0;i<T;i++)
		{
			int N = sc.nextInt();
			long K = sc.nextLong();
			sc.nextLine();
			String s = sc.nextLine();
			int zeroCount = 0;
			int oneCount = 0;
			for(int j = 0;j<s.length();j++)
			{
				if(s.charAt(j)=='0')
				{
					zeroCount++;
				}
				else if(s.charAt(j)=='1')
				{
					oneCount++;
				}
			}

			long sum = 0;
			int m = 1;
			boolean done = false;
			for(int j = 0;j<s.length();j++)
			{
				if(s.charAt(j)=='1')
				{
					oneCount--;
					sum+=(m-1);
				}
				else if(s.charAt(j)=='0')
				{
					zeroCount--;
					sum-=(m-1);
				}

				if(zeroCount<oneCount)
				{
					m++;
					long remainginSum  = 0;
					remainginSum += (oneCount*(m-1))-(zeroCount*(m-1))+sum;
					if(remainginSum>=K)
					{
						done = true;
						break;
					}
				}

			}
			if(done==false)
			{
				System.out.println(-1);
			}
			else
			{
				System.out.println(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
5 3
10101
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Competitive Fishing
time_limit_ms: 2000
memory_limit_mb: 512
Description: Alice and Bob participate in a fishing contest! In total, they caught $$$n$$$ fishes, numbered from $$$1$$$ to $$$n$$$ (the bigger the fish, the greater its index). Some of these fishes were caught by Alice, others — by Bob.

Their performance will be evaluated as follows. First, an integer $$$m$$$ will be chosen, and all fish will be split into $$$m$$$ non-empty groups. The first group should contain several (at least one) smallest fishes, the second group — several (at least one) next smallest fishes, and so on. Each fish should belong to exactly one group, and each group should be a contiguous subsegment of fishes. Note that the groups are numbered in exactly that order; for example, the fishes from the second group cannot be smaller than the fishes from the first group, since the first group contains the smallest fishes.

Then, each fish will be assigned a value according to its group index: each fish in the first group gets value equal to $$$0$$$, each fish in the second group gets value equal to $$$1$$$, and so on. So, each fish in the $$$i$$$-th group gets value equal to $$$(i-1)$$$.

The score of each contestant is simply the total value of all fishes that contestant caught.

You want Bob's score to exceed Alice's score by at least $$$k$$$ points. What is the minimum number of groups ($$$m$$$) you have to split the fishes into? If it is impossible, you should report that.

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

The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 2 \cdot 10^5$$$; $$$1 \le k \le 10^9$$$).

The second line contains a string, consisting of exactly $$$n$$$ characters. The $$$i$$$-th character is either 0 (denoting that the $$$i$$$-th fish was caught by Alice) or 1 (denoting that the $$$i$$$-th fish was caught by Bob).

Additional constraint on the input: the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.

Output: For each test case, print a single integer — the minimum number of groups you have to split the fishes into; or -1 if it's impossible.

Examples:
input:
7
4 1
1001
4 1
1010
4 1
0110
4 2
0110
6 3
001110
10 20
1111111111
5 11
11111
output:
2
-1
2
-1
3
4
-1

Note: In the first test case of the example, you can split the fishes into groups as follows: the first three fishes form the $$$1$$$-st group, the last fish forms the $$$2$$$-nd group. Then, Bob's score will be $$$1$$$, and Alice's score will be $$$0$$$.

In the third test case of the example, you can split the fishes into groups as follows: the first fish forms the $$$1$$$-st group, the last three fishes form the $$$2$$$-nd group. Then, Bob's score will be $$$2$$$, and Alice's score will be $$$1$$$.

Buggy Code:
//package com.example.practice.codeforces.below2000;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.StringTokenizer;

//C. Competitive Fishing
public class Solution493 {
    public static void main(String [] args) throws IOException {
        // Use BufferedReader rather than RandomAccessFile; it's much faster
        final BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        final PrintWriter out = new PrintWriter(System.out);
        // input file name goes above
        int Q = Integer.parseInt(input.readLine());
        while (Q > 0) {
            StringTokenizer st = new StringTokenizer(input.readLine());
            final int n = Integer.parseInt(st.nextToken());
            final long k = Long.parseLong(st.nextToken());
            final char[] cc = input.readLine().toCharArray();
            out.println(calc(n, k, cc));
            Q--;
        }
        out.close();
    }

    private static int calc(final int n, final long k, final char[] cc) {
        final ArrayDeque<Long> ll = new ArrayDeque<>();
        ll.add(cc[n-1] == '1' ? 1L : -1L);
        long cur = 0, d = ll.peek();
        for (int i=n-2;i>=0;--i) {
            final long d2 = cc[i] == '1' ? 1L : -1L;
            if (d > 0) {
                cur += d;
                ll.add(d2);
            }else {
                long d3 = ll.pollLast();
                d3 += d2;
                ll.add(d3);
            }
            d += d2;
        }
        if (cur >= k) {
            while (ll.size() > 2) {
                d = ll.poll();
                if (cur - d >= k) {
                    cur -= d;
                    d += ll.poll();
                    ll.addFirst(d);
                }else {
                    ll.addFirst(d);
                    break;
                }
            }
            return ll.size();
        }else {
            return -1;
        }
    }

    private static void printArray(long[] ns, final PrintWriter out){
        for (int i=0;i<ns.length;++i){
            out.print(ns[i]);
            if (i+1<ns.length)out.print(" ");
            else out.println();
        }
    }

    private static void printArrayInt(int[] ns, final PrintWriter out){
        for (int i=0;i<ns.length;++i){
            out.print(ns[i]);
            if (i+1<ns.length)out.print(" ");
            else out.println();
        }
    }

    private static void printArrayVertical(long[] ns, final PrintWriter out){
        for (long a : ns){
            out.println(a);
        }
    }

    private static void printArrayVerticalInt(int[] ns, final PrintWriter out){
        for (int a : ns){
            out.println(a);
        }
    }

    private static void printArray2D(long[][] ns, final int len, final PrintWriter out){
        int cnt = 0;
        for (long[] kk : ns){
            cnt++;
            if (cnt > len)break;
            for (int i=0;i<kk.length;++i){
                out.print(kk[i]);
                if (i+1<kk.length)out.print(" ");
                else out.println();
            }
        }
    }

    private static void printArray2DInt(int[][] ns, final int len, final PrintWriter out){
        int cnt = 0;
        for (int[] kk : ns){
            cnt++;
            if (cnt > len)break;
            for (int i=0;i<kk.length;++i){
                out.print(kk[i]);
                if (i+1<kk.length)out.print(" ");
                else out.println();
            }
        }
    }

    private static long[] readArray(final int n, final BufferedReader input) throws IOException{
        long[] ns = new long[n];
        StringTokenizer st = new StringTokenizer(input.readLine());
        for (int i=0;i<n;++i){
            ns[i] = Long.parseLong(st.nextToken());
        }
        return ns;
    }

    private static int[] readArrayInt(final int n, final BufferedReader input) throws IOException{
        int[] ns = new int[n];
        if (n > 0) {
            StringTokenizer st = new StringTokenizer(input.readLine());
            for (int i = 0; i < n; ++i) {
                ns[i] = Integer.parseInt(st.nextToken());
            }
        }
        return ns;
    }

    private static long[] readArrayVertical(final int n, final BufferedReader input) throws IOException{
        long[] ns = new long[n];
        for (int i=0;i<n;++i){
            ns[i] = Long.parseLong(input.readLine());
        }
        return ns;
    }

    private static int[] readArrayVerticalInt(final int n, final BufferedReader input) throws IOException{
        int[] ns = new int[n];
        for (int i=0;i<n;++i){
            ns[i] = Integer.parseInt(input.readLine());
        }
        return ns;
    }

    private static long[][] readArray2D(final int n, final int len, final BufferedReader input) throws IOException{
        long[][] ns = new long[len][];
        for (int i=0;i<n;++i){
            StringTokenizer st = new StringTokenizer(input.readLine());
            ArrayList<Long> al = new ArrayList<>();
            while (st.hasMoreTokens()){
                al.add(Long.parseLong(st.nextToken()));
            }
            long[] kk = new long[al.size()];
            for (int j=0;j<kk.length;++j){
                kk[j] = al.get(j);
            }
            ns[i] = kk;
        }
        return ns;
    }

    private static int[][] readArray2DInt(final int n, final int len, final BufferedReader input) throws IOException{
        int[][] ns = new int[len][];
        for (int i=0;i<n;++i){
            StringTokenizer st = new StringTokenizer(input.readLine());
            ArrayList<Integer> al = new ArrayList<>();
            while (st.hasMoreTokens()){
                al.add(Integer.parseInt(st.nextToken()));
            }
            int[] kk = new int[al.size()];
            for (int j=0;j<kk.length;++j){
                kk[j] = al.get(j);
            }
            ns[i] = kk;
        }
        return ns;
    }

    private static int GCD(int x, int y){
        if (x > y)return GCD(y, x);
        if (x==0)return y;
        return GCD(y%x, x);
    }

    private static long GCD(long x, long y){
        if (x > y)return GCD(y, x);
        if (x==0)return y;
        return GCD(y%x, x);
    }

    private static ArrayList<int[]>[] convertToGraphUnDirectWithWeight(final int n, final int[][] es){
        ArrayList<int[]>[] als = new ArrayList[n+1];
        for (int i=0;i<=n;++i){
            als[i] = new ArrayList<>();
        }
        for (int[] e : es){
            als[e[0]].add(new int[]{e[1], e[2]});
            als[e[1]].add(new int[]{e[0], e[2]});
        }
        return als;
    }

    private static ArrayList<int[]>[] convertToGraphDirectWithWeight(final int n, final int[][] es){
        ArrayList<int[]>[] als = new ArrayList[n+1];
        for (int i=0;i<=n;++i){
            als[i] = new ArrayList<>();
        }
        for (int[] e : es){
            als[e[0]].add(new int[]{e[1], e[2]});
        }
        return als;
    }

    private static ArrayList<Integer>[] convertToGraphUnDirect(final int n, final int[][] es){
        ArrayList<Integer>[] als = new ArrayList[n+1];
        for (int i=0;i<=n;++i){
            als[i] = new ArrayList<>();
        }
        for (int[] e : es){
            als[e[0]].add(e[1]);
            als[e[1]].add(e[0]);
        }
        return als;
    }

    private static ArrayList<Integer>[] convertToGraphDirect(final int n, final int[][] es){
        ArrayList<Integer>[] als = new ArrayList[n+1];
        for (int i=0;i<=n;++i){
            als[i] = new ArrayList<>();
        }
        for (int[] e : es){
            als[e[0]].add(e[1]);
        }
        return als;
    }

    private static int find(final int[] rd, int idx){
        while (idx != rd[idx]){
            rd[idx] = rd[rd[idx]];
            idx = rd[idx];
        }
        return idx;
    }

    private static long pow(final long a, final long x, final int MODE){
        if (x==0)return 1L;
        long res = pow(a, x>>1, MODE);
        res = res * res % MODE;
        if ((x&1) == 1){
            res = res * a % MODE;
        }
        return 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
5 2
10010
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Competitive Fishing
time_limit_ms: 2000
memory_limit_mb: 512
Description: Alice and Bob participate in a fishing contest! In total, they caught $$$n$$$ fishes, numbered from $$$1$$$ to $$$n$$$ (the bigger the fish, the greater its index). Some of these fishes were caught by Alice, others — by Bob.

Their performance will be evaluated as follows. First, an integer $$$m$$$ will be chosen, and all fish will be split into $$$m$$$ non-empty groups. The first group should contain several (at least one) smallest fishes, the second group — several (at least one) next smallest fishes, and so on. Each fish should belong to exactly one group, and each group should be a contiguous subsegment of fishes. Note that the groups are numbered in exactly that order; for example, the fishes from the second group cannot be smaller than the fishes from the first group, since the first group contains the smallest fishes.

Then, each fish will be assigned a value according to its group index: each fish in the first group gets value equal to $$$0$$$, each fish in the second group gets value equal to $$$1$$$, and so on. So, each fish in the $$$i$$$-th group gets value equal to $$$(i-1)$$$.

The score of each contestant is simply the total value of all fishes that contestant caught.

You want Bob's score to exceed Alice's score by at least $$$k$$$ points. What is the minimum number of groups ($$$m$$$) you have to split the fishes into? If it is impossible, you should report that.

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

The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 2 \cdot 10^5$$$; $$$1 \le k \le 10^9$$$).

The second line contains a string, consisting of exactly $$$n$$$ characters. The $$$i$$$-th character is either 0 (denoting that the $$$i$$$-th fish was caught by Alice) or 1 (denoting that the $$$i$$$-th fish was caught by Bob).

Additional constraint on the input: the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.

Output: For each test case, print a single integer — the minimum number of groups you have to split the fishes into; or -1 if it's impossible.

Examples:
input:
7
4 1
1001
4 1
1010
4 1
0110
4 2
0110
6 3
001110
10 20
1111111111
5 11
11111
output:
2
-1
2
-1
3
4
-1

Note: In the first test case of the example, you can split the fishes into groups as follows: the first three fishes form the $$$1$$$-st group, the last fish forms the $$$2$$$-nd group. Then, Bob's score will be $$$1$$$, and Alice's score will be $$$0$$$.

In the third test case of the example, you can split the fishes into groups as follows: the first fish forms the $$$1$$$-st group, the last three fishes form the $$$2$$$-nd group. Then, Bob's score will be $$$2$$$, and Alice's score will be $$$1$$$.

Buggy Code:
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set; // find_by_order, order_of_key
typedef tree<int, null_type, less_equal<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_multiset; // find_by_order, order_of_key

typedef long long int ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pair<ll,ll>> vii;
typedef pair<ll,ll> ii;

#define f(i,l,u)\
    for(ll i=l;i<u;i++)

#define srt(a)\
    sort(a.begin(),a.end())

#define lb(a,b)\
    lower_bound(a.begin(),a.end(),b)

#define ub(a,b)\
    upper_bound(a.begin(),a.end(),b)

#define pb push_back
#define beg begin

#define MOD 1000000007

#define t\
    ll t;\
    cin>>t;\
    while(t--)

ll Pow(ll a, ll b)
{
    a %= MOD;
    ll ans = 1;
    while(b)
    {
        //if MOD is 10^18 use Mul for ans*a and a*a
        if(b & 1) ans = (ans * a) % MOD;
        a = (a * a) % MOD;
        b >>= 1;
    }
    return ans;
}

ll ModInverse(ll num)
{
    return Pow(num, MOD - 2);
}

ll Mul(ll a, ll b)
{
    ll ans = 0;
    while(b)
    {
        if(b & 1) ans = (ans + a) % MOD;
        a = (a + a) % MOD;
        b >>= 1;
    }
    return ans;
}
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    t
    {
        ll n,k;
        cin>>n>>k;
        string s;
        cin>>s;
        ll ct=0;
        multiset<ii> ms;

        for(ll i=n-1;i>=0;i--)
        {
            if(s[i]=='1')ct++;
            else ct--;
            ms.insert({ct,i});

        }
        ll tmp=0,cond=0,ind=0,ans=0;

        while(ms.size())
        {

            if((--ms.end())->first<0)break;
            else
            {

                if((--ms.end())->second>ind)
                {

                    tmp+=(--ms.end())->first;
                    ind=(--ms.end())->second;
                    ans++;
                    if(tmp>=k)break;

                }
                ms.erase((--ms.end()));
            }

        }

        if(tmp>=k)
        {
            cout<<ans+1<<endl;
        }
        else cout<<-1<<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
5 3
01010
```