package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		t--
		var n, q int
		fmt.Fscan(in, &n, &q)
		a := make([]int, n+5)
		for i := 1; i <= n; i++ {
			fmt.Fscan(in, &a[i])
		}

		vis := make([]int, n+5)
		iq := 0
		for i := n; i >= 1; i-- {
			if a[i] <= iq {
				vis[i] = 1
			} else if iq < q {
				iq++
				vis[i] = 1
			}
		}
		ret := []byte{}
		for i := 1; i <= n; i++ {
			if vis[i] == 1 {
				ret = append(ret, '1')
			} else {
				ret = append(ret, '0')
			}
		}
		fmt.Fprintln(out, string(ret))
	}
}

// 00
package main

import (
	"bufio"
	"fmt"
	"os"
)

func max(a int, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n, q int
		fmt.Fscan(reader, &n, &q)
		a := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &a[i])
		}
		low := 0
		high := n
		for low < high {
			mid := (low + high) >> 1
			now := q
			ok := true
			for i := mid; i < n; i++ {
				if now == 0 {
					ok = false
					break
				}
				if a[i] > now {
					now--
				}
			}
			if ok {
				high = mid
			} else {
				low = mid + 1
			}
		}
		for i := 0; i < low; i++ {
			if a[i] <= q {
				fmt.Print(1)
			} else {
				fmt.Print(0)
			}
		}
		for i := low; i < n; i++ {
			fmt.Print(1)
		}
		fmt.Println()
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	var loops int
	fmt.Fscan(reader, &loops)
	for lnum := 0; lnum < loops; lnum++ {
		var n, q int
		fmt.Fscan(reader, &n, &q)
		slc := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &slc[i])
		}
		var sb strings.Builder
		targetq := 0
	inner:
		for i := n - 1; i >= 0; i-- {
			if targetq > q {
				val := slc[i]
				if q >= val {
					sb.WriteString("1")
				} else {
					sb.WriteString("0")
				}
				continue inner
			}
			val := slc[i]
			if targetq >= val {
				//free ride
				sb.WriteString("1")
				continue inner
			} else {
				if targetq == q {
					targetq++
					sb.WriteString("0")
				} else {
					targetq++
					sb.WriteString("1")
				}
			}
		}
		resstr := sb.String()
		runes := []rune(resstr)
		for ir, jr := 0, len(runes)-1; ir < jr; ir, jr = ir+1, jr-1 {
			runes[ir], runes[jr] = runes[jr], runes[ir]
		}
		fmt.Println(string(runes))
	}
}

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)

	var buf bytes.Buffer

	tc := readNum(reader)

	for tc > 0 {
		tc--
		n, k := readTwoNums(reader)
		A := readNNums(reader, n)
		res := solve(A, k)
		buf.WriteString(fmt.Sprintf("%s\n", res))
	}

	fmt.Print(buf.String())
}

func readString(reader *bufio.Reader) string {
	s, _ := reader.ReadString('\n')
	for i := 0; i < len(s); i++ {
		if s[i] == '\n' || s[i] == '\r' {
			return s[:i]
		}
	}
	return s
}

func normalize(s string) string {

	for i := len(s); i > 0; i-- {
		if s[i-1] >= 'a' && s[i-1] <= 'z' {
			return s[:i]
		}
	}
	return ""
}

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func solve(A []int, iq int) string {
	n := len(A)
	res := make([]byte, n)

	var cur int

	for i := n - 1; i >= 0; i-- {
		if A[i] > cur && cur == iq {
			res[i] = '0'
		} else {
			res[i] = '1'
			if A[i] > cur {
				cur++
			}
		}
	}

	return string(res)
}
func solve1(A []int, iq int) string {
	// when iq > A[i], always to test
	// when iq <= A[i], may test, but iq--, else not stay no change
	// only when iq > 0, can test
	n := len(A)

	check := func(x int) bool {
		// if x is the first bad contest
		// can we start from x, and take all the contests
		cur := iq
		for i := x; i < n; i++ {
			if cur == 0 {
				return false
			}
			if A[i] > cur {
				cur--
			}
		}
		return true
	}

	l, r := 0, n
	for l < r {
		mid := (l + r) / 2
		if check(mid) {
			r = mid
		} else {
			l = mid + 1
		}
	}
	res := make([]byte, n)

	for i := 0; i < r; i++ {
		if iq >= A[i] {
			res[i] = '1'
		} else {
			res[i] = '0'
		}
	}

	for i := r; i < n; i++ {
		res[i] = '1'
	}

	return string(res)
}

func min(a, b int) int {
	if a <= b {
		return a
	}
	return b
}

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)

	var buf bytes.Buffer

	tc := readNum(reader)

	for tc > 0 {
		tc--
		n, k := readTwoNums(reader)
		A := readNNums(reader, n)
		res := solve(A, k)
		buf.WriteString(fmt.Sprintf("%s\n", res))
	}

	fmt.Print(buf.String())
}

func readString(reader *bufio.Reader) string {
	s, _ := reader.ReadString('\n')
	for i := 0; i < len(s); i++ {
		if s[i] == '\n' || s[i] == '\r' {
			return s[:i]
		}
	}
	return s
}

func normalize(s string) string {

	for i := len(s); i > 0; i-- {
		if s[i-1] >= 'a' && s[i-1] <= 'z' {
			return s[:i]
		}
	}
	return ""
}

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func solve(A []int, iq int) string {
	// when iq > A[i], always to test
	// when iq <= A[i], may test, but iq--, else not stay no change
	// only when iq > 0, can test
	n := len(A)

	check := func(x int) bool {
		// if x is the first bad contest
		// can we start from x, and take all the contests
		cur := iq
		for i := x; i < n; i++ {
			if cur == 0 {
				return false
			}
			if A[i] > cur {
				cur--
			}
		}
		return true
	}

	l, r := 0, n
	for l < r {
		mid := (l + r) / 2
		if check(mid) {
			r = mid
		} else {
			l = mid + 1
		}
	}
	res := make([]byte, n)

	for i := 0; i < r; i++ {
		if iq >= A[i] {
			res[i] = '1'
		} else {
			res[i] = '0'
		}
	}

	for i := r; i < n; i++ {
		res[i] = '1'
	}

	return string(res)
}

func min(a, b int) int {
	if a <= b {
		return a
	}
	return b
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	reader = bufio.NewReader(os.Stdin)
	writer = bufio.NewWriter(os.Stdout)
)

func Print(a ...interface{})   { _, _ = fmt.Fprint(writer, a...) }
func Println(a ...interface{}) { _, _ = fmt.Fprintln(writer, a...) }

func main() {
	defer func() {
		_ = writer.Flush()
	}()

	T := ReadInt()
	for t := 0; t < T; t++ {
		Solve()
	}
}

func Solve() {
	n, q := ReadInt(), ReadInt()
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = ReadInt()
	}
	max := 1
	first := true
	for i := n - 1; i >= 0; i-- {
		if a[i] > max {
			if first {
				a[i] = max
			} else {
				a[i] = max + 1
			}
			max += 1
		} else if a[i] == max {
			first = false
		}
	}
	for i := 0; i < n; i++ {
		if q >= a[i] {
			Print(1)
		} else {
			Print(0)
		}
	}
	Println()
}

func ReadInt() (value int) {
	_, _ = fmt.Fscan(reader, &value)
	return
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func readInt(in *bufio.Reader) int {
	nStr, _ := in.ReadString('\n')
	nStr = strings.ReplaceAll(nStr, "\r", "")
	nStr = strings.ReplaceAll(nStr, "\n", "")
	n, _ := strconv.Atoi(nStr)
	return n
}

func readLineNumbs(in *bufio.Reader) []string {
	line, _ := in.ReadString('\n')
	line = strings.ReplaceAll(line, "\r", "")
	line = strings.ReplaceAll(line, "\n", "")
	numbs := strings.Split(line, " ")
	return numbs
}

func readArrInt(in *bufio.Reader) []int {
	numbs := readLineNumbs(in)
	arr := make([]int, len(numbs))
	for i, n := range numbs {
		val, _ := strconv.Atoi(n)
		arr[i] = val
	}
	return arr
}

func readArrInt64(in *bufio.Reader) []int64 {
	numbs := readLineNumbs(in)
	arr := make([]int64, len(numbs))
	for i, n := range numbs {
		val, _ := strconv.ParseInt(n, 10, 64)
		arr[i] = val
	}
	return arr
}

func run_test_case(in *bufio.Reader) {

	line1 := readArrInt(in)
	contests := line1[0]
	start_iq := line1[1]

	contest_difficulty := readArrInt(in)
	contest_tested := make([]int, 0, 10)
	for i := 0; i < contests; i++ {
		contest_tested = append(contest_tested, 0)
	}

	// Work backwards from the end, from an IQ of 0
	current_iq := 0

	for i := contests - 1; i >= 0; i-- {
		if contest_difficulty[i] > current_iq {
			if current_iq < start_iq {
				contest_tested[i] = 1
				current_iq++
			} else {
				contest_tested[i] = 0
			}
		} else {
			contest_tested[i] = 1
		}
	}

	for i := 0; i < contests; i++ {
		fmt.Printf("%d", contest_tested[i])
	}
	fmt.Printf("\n")
}

func main() {
	in := bufio.NewReader(os.Stdin)
	number_of_cases := readInt(in)

	for i := 0; i < number_of_cases; i++ {
		run_test_case(in)
	}

}

package main

import (
	"bufio"
	. "fmt"
	"os"
)

const mod = 998244353
const mx = int64(1e9 + 7)

func solve(in *bufio.Reader, out *bufio.Writer) {
	defer out.Flush()
	var n, iq int
	Fscan(in, &n, &iq)
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		Fscan(in, &arr[i])
	}
	ans := make([]byte, n)
	cq := 0
	for i := n - 1; i >= 0; i-- {
		if cq >= arr[i] {
			ans[i] = '1'
		} else if iq != 0 {
			ans[i] = '1'
			cq++
			iq--
		} else {
			ans[i] = '0'
		}
	}
	Fprintln(out, string(ans))
}

func abs(a int64) int64 {
	if a > 0 {
		return a
	}
	return -a
}
func sum(a, b int64) int64 {
	return (b + a) * (b - a + 1) / 2
}

func max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}
func min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func gcd(a, b int) int {
	if a%b == 0 {
		return b
	}
	return gcd(b, a%b)
}

func main() {
	stdin := os.Stdin
	stdout := os.Stdout
	in := bufio.NewReader(stdin)
	out := bufio.NewWriter(stdout)
	n := 1
	Fscan(in, &n)
	for i := 0; i < n; i++ {
		solve(in, out)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	var count int
	fmt.Fscan(reader, &count)

	for i := 0; i < count; i++ {
		var n, q int
		fmt.Fscan(reader, &n, &q)
		bin := make([]string, n)
		a := make([]int, n)
		for j := 0; j < n; j++ {
			fmt.Fscan(reader, &a[j])
		}

		ns := 0
		for j := n - 1; j >= 0; j-- {
			if a[j] <= ns {
				bin[j] = "1"
			} else if ns < q {
				ns++
				bin[j] = "1"
			} else {
				bin[j] = "0"
			}
		}
		for j := 0; j < n; j++ {
			fmt.Fprint(writer, bin[j])
		}

		fmt.Fprint(writer, "\n")
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var T int
	fmt.Fscan(in, &T)
	for t := 0; t < T; t++ {
		var n, q int
		fmt.Fscan(in, &n, &q)

		aa := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &aa[i])
		}

		bb := make([]rune, n)
		var g int
		for i := n - 1; i >= 0; i-- {
			if aa[i] <= g {
				bb[i] = '1'
			} else if g < q {
				bb[i] = '1'
				g++
			} else {
				bb[i] = '0'
			}
		}
		fmt.Fprintln(out, string(bb))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var in = bufio.NewReader(os.Stdin)

func canSkip(k, q int, a []int) bool {
	skipLeft := k
	for _, ai := range a {
		if ai > q {
			if skipLeft > 0 {
				skipLeft--
			} else if q > 0 {
				q--
			} else {
				return false
			}
		}
	}
	return true
}

func solve() {
	var n, q int
	fmt.Fscan(in, &n)
	fmt.Fscan(in, &q)

	a := make([]int, n)
	for i := range a {
		fmt.Fscan(in, &a[i])
	}

	result := -1
	left, right := 0, n
	for left <= right {
		mid := left + (right-left)/2
		if canSkip(mid, q, a) {
			result = mid
			right = mid - 1
		} else {
			left = mid + 1
		}
	}

	trials := make([]byte, n)
	skipLeft := result
	curQ := q
	for i, ai := range a {
		if ai > curQ && skipLeft > 0 {
			trials[i] = '0'
			skipLeft--
		} else {
			trials[i] = '1'
		}
	}
	fmt.Println(string(trials))
}

func main() {
	var t int
	fmt.Fscan(in, &t)

	for i := 0; i < t; i++ {
		solve()
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

func main() {
	CF1708C(os.Stdin, os.Stdout)
}

func CF1708C(in io.Reader, out io.Writer) {
	_r := bufio.NewReader(in)
	_w := bufio.NewWriter(out)
	defer _w.Flush()

	var T int64
	fmt.Fscan(_r, &T)
	for ; T > 0; T-- {
		var n, q int64
		fmt.Fscan(_r, &n, &q)
		arr := make([]int64, n)
		for i := int64(0); i < n; i++ {
			fmt.Fscan(_r, &arr[i])
		}
		s,cq := make([]byte, n), int64(0)
		for i := n-1; i >= 0; i-- {
			if cq >= arr[i] {
				s[i] = '1'
			} else if cq < q {
				cq++
				s[i] = '1'
			} else {
				s[i] = '0'
			}
		}
		fmt.Fprintln(_w, string(s))
	}

}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

func main() {
	a1707(os.Stdin, os.Stdout)
}

//1
//11
//110
//1110
//01111

func a1707(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var T int
	var n int
	var q int
	var x int

	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &q)
		a := make([]int, n)
		for i := 0; i < n; i++ {
			Fscan(in, &x)
			a[i] = x
		}

		ans := make([]byte, n)
		t := 0 // 到i之前
		for i := n - 1; i >= 0; i-- {
			if a[i] > t {
				if t < q {
					t++
					ans[i] = '1'
				} else {
					ans[i] = '0'
				}
			} else {
				ans[i] = '1'
			}
		}
		Fprintln(out, string(ans))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var rr = bufio.NewReader(os.Stdin)
var ww = bufio.NewWriter(os.Stdout)

func slove() {
	var n, q int
	fmt.Fscan(rr, &n, &q)
	nums := make([]int, n)
	for i:=0;i<len(nums);i++ {
		fmt.Fscan(rr, &nums[i])
	}
	i := sort.Search(n, func(i int) bool {
		cur := q
		j := i
		for ;j<n&&cur>0;j++ {
			if nums[j] > cur {
				cur--
			}
		}
		if j == n {
			return true
		} else {
			return false
		}
	})
	ans := make([]byte, n)
	for j:=0;j<i;j++ {
		if nums[j] <= q {
			ans[j] = '1'
		} else {
			ans[j] = '0'
		}
	}
	for j:=i;j<n;j++ {
		ans[j] = '1'
	}
	fmt.Fprintln(ww, string(ans))
}

func main() {
	defer ww.Flush()
	var n int
	fmt.Fscan(rr, &n)
	for i:=1;i<=n;i++ {
		slove()
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

const cf = true

func solve() {
	var n, q int
	fmt.Fscan(in, &n, &q)
	diff := make([]int, n)
	for i := range diff {
		fmt.Fscan(in, &diff[i])
	}
	curQ := 0
	ans := make([]int, n)
	for i := n - 1; i >= 0; i-- {
		if curQ < q {
			ans[i] = 1
			if diff[i] > curQ {
				curQ++
			}
		} else {
			if diff[i] <= curQ {
				ans[i] = 1
			}
		}
	}
	for i := range ans {
		fmt.Fprint(out, ans[i])
	}
	fmt.Fprintln(out)
}

func main() {
	defer out.Flush()
	t := 1
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		solve()
	}
}

func ConvertInt(val string, base, toBase int) (string, error) {
	i, err := strconv.ParseInt(val, base, 64)
	if err != nil {
		return "", err
	}
	return strconv.FormatInt(i, toBase), nil
}

type set[T Ordered] struct {
	itms map[T]struct{}
}

func (s *set[T]) init() {
	if s.itms == nil {
		s.itms = make(map[T]struct{})
	}
}

func (s *set[T]) add(item T) *set[T] {
	s.init()
	s.itms[item] = exists
	return s
}

func (s *set[T]) remove(item T) *set[T] {
	s.init()
	delete(s.itms, item)
	return s
}

func (s *set[T]) has(item T) bool {
	s.init()
	_, c := s.itms[item]
	return c
}

func (s *set[T]) sortedItems() []T {
	s.init()
	items := make([]T, 0, s.size())
	for item := range s.itms {
		items = append(items, item)
	}
	sort.Slice(items, func(i, j int) bool {
		return items[i] < items[j]
	})
	return items
}

func (s *set[T]) items() []T {
	s.init()
	items := make([]T, 0, s.size())
	for item := range s.itms {
		items = append(items, item)
	}
	return items
}

func (s *set[T]) size() int {
	s.init()
	return len(s.itms)
}

var exists = struct{}{}

const MaxUint = ^uint(0)
const MinUint = 0
const MaxInt = int(MaxUint >> 1)
const MinInt = -MaxInt - 1

func reverseStr(s string) string {
	r := []rune(s)
	for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
		r[i], r[j] = r[j], r[i]
	}
	return string(r)
}

type Float interface {
	~float32 | ~float64
}

type Integer interface {
	Signed | Unsigned
}

type Signed interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

type Unsigned interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}

type Ordered interface {
	Integer | Float | ~string
}

func abs[T Signed](x T) T {
	if x < 0 {
		return -x
	}
	return x
}

func min[T Ordered](x, y T) T {
	if x < y {
		return x
	}
	return y
}

func max[T Ordered](x, y T) T {
	if x > y {
		return x
	}
	return y
}

var (
	in  = getReader()
	out = getWriter()
)

func getReader() *bufio.Reader {
	if cf {
		return bufio.NewReader(os.Stdin)
	} else {
		in, _ := os.Open("input.txt")
		return bufio.NewReader(in)
	}
}

func getWriter() *bufio.Writer {
	if cf {
		return bufio.NewWriter(os.Stdout)
	} else {
		out, _ := os.Create("output.txt")
		return bufio.NewWriter(out)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

const cf = true

func solve() {
	var n, q int
	fmt.Fscan(in, &n, &q)
	diff := make([]int, n)
	for i := range diff {
		fmt.Fscan(in, &diff[i])
	}
	l, r := 0, n
	for l <= r {
		mid := (l + r) / 2
		curQ := q
		for i := range diff {
			if i >= mid {
				if diff[i] > curQ {
					curQ--
				}
			}
		}
		if curQ >= 0 {
			r = mid - 1
		} else {
			l = mid + 1
		}
	}
	r++
	ansArr := make([]int, n)
	for i := range diff {
		if i < r {
			if diff[i] <= q {
				ansArr[i] = 1
			}
		} else {
			if diff[i] <= q {
				ansArr[i] = 1
			} else if q > 0 {
				q--
				ansArr[i] = 1
			}
		}
	}
	for _, item := range ansArr {
		fmt.Fprint(out, item)
	}
	fmt.Fprintln(out)
}

func main() {
	defer out.Flush()
	t := 1
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		solve()
	}
}

func ConvertInt(val string, base, toBase int) (string, error) {
	i, err := strconv.ParseInt(val, base, 64)
	if err != nil {
		return "", err
	}
	return strconv.FormatInt(i, toBase), nil
}

type set[T Ordered] struct {
	itms map[T]struct{}
}

func (s *set[T]) init() {
	if s.itms == nil {
		s.itms = make(map[T]struct{})
	}
}

func (s *set[T]) add(item T) *set[T] {
	s.init()
	s.itms[item] = exists
	return s
}

func (s *set[T]) remove(item T) *set[T] {
	s.init()
	delete(s.itms, item)
	return s
}

func (s *set[T]) has(item T) bool {
	s.init()
	_, c := s.itms[item]
	return c
}

func (s *set[T]) sortedItems() []T {
	s.init()
	items := make([]T, 0, s.size())
	for item := range s.itms {
		items = append(items, item)
	}
	sort.Slice(items, func(i, j int) bool {
		return items[i] < items[j]
	})
	return items
}

func (s *set[T]) items() []T {
	s.init()
	items := make([]T, 0, s.size())
	for item := range s.itms {
		items = append(items, item)
	}
	return items
}

func (s *set[T]) size() int {
	s.init()
	return len(s.itms)
}

var exists = struct{}{}

const MaxUint = ^uint(0)
const MinUint = 0
const MaxInt = int(MaxUint >> 1)
const MinInt = -MaxInt - 1

func reverseStr(s string) string {
	r := []rune(s)
	for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
		r[i], r[j] = r[j], r[i]
	}
	return string(r)
}

type Float interface {
	~float32 | ~float64
}

type Integer interface {
	Signed | Unsigned
}

type Signed interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

type Unsigned interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}

type Ordered interface {
	Integer | Float | ~string
}

func abs[T Signed](x T) T {
	if x < 0 {
		return -x
	}
	return x
}

func min[T Ordered](x, y T) T {
	if x < y {
		return x
	}
	return y
}

func max[T Ordered](x, y T) T {
	if x > y {
		return x
	}
	return y
}

var (
	in  = getReader()
	out = getWriter()
)

func getReader() *bufio.Reader {
	if cf {
		return bufio.NewReader(os.Stdin)
	} else {
		in, _ := os.Open("input.txt")
		return bufio.NewReader(in)
	}
}

func getWriter() *bufio.Writer {
	if cf {
		return bufio.NewWriter(os.Stdout)
	} else {
		out, _ := os.Create("output.txt")
		return bufio.NewWriter(out)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		t--
		var n, q int
		fmt.Fscan(in, &n, &q)
		a := make([]int, n+5)
		for i := 1; i <= n; i++ {
			fmt.Fscan(in, &a[i])
		}

		vis := make([]int, n+5)
		iq := 0
		for i := n; i >= 1; i-- {
			if a[i] <= iq {
				iq++
				vis[i] = 1
			} else if iq < q {
				vis[i] = 1
				iq++
			} else {
				vis[i] = 0
			}
		}
		ret := []byte{}
		for i := 1; i <= n; i++ {
			if vis[i] == 1 {
				ret = append(ret, '1')
			} else {
				ret = append(ret, '0')
			}
		}
		fmt.Fprintln(out, string(ret))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		t--
		var n, q int
		fmt.Fscan(in, &n, &q)
		a := make([]int, n+5)
		for i := 1; i <= n; i++ {
			fmt.Fscan(in, &a[i])
		}

		vis := make([]int, n+5)
		iq := 0
		for i := n; i >= 1; i-- {
			if a[i] <= iq {
				iq++
				vis[i] = 1
			} else if iq < q {
				vis[i] = 1
				iq++
				continue
			}
		}
		ret := []byte{}
		for i := 1; i <= n; i++ {
			if vis[i] == 1 {
				ret = append(ret, '1')
			} else {
				ret = append(ret, '0')
			}
		}
		fmt.Fprintln(out, string(ret))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		t--
		var n, q int
		fmt.Fscan(in, &n, &q)
		a := make([]int, n+5)
		for i := 1; i <= n; i++ {
			fmt.Fscan(in, &a[i])
		}

		vis := make([]int, n+5)
		iq := 0
		for i := n; i >= 1; i-- {
			if iq < q && a[i] > iq {
				vis[i] = 1
				iq++
				continue
			}
			if a[i] <= iq {
				iq++
				vis[i] = 1
			}
		}
		ret := []byte{}
		for i := 1; i <= n; i++ {
			if vis[i] == 1 {
				ret = append(ret, '1')
			} else {
				ret = append(ret, '0')
			}
		}
		fmt.Fprintln(out, string(ret))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	x := 0
	for t > 0 {
		x++
		var n, q int
		fmt.Fscan(in, &n, &q)
		a := make([]int, n+5)
		for i := 1; i <= n; i++ {
			fmt.Fscan(in, &a[i])
		}
		if x == 5509 {
			fmt.Fprintln(out, q)
			break
		}
		//1 1 1 3 1 2
		mi := make([]int, n+5)
		ma := make([]int, n+5)
		for i := n; i >= 1; i-- {
			if i == n {
				mi[i] = a[i]
				ma[i] = a[i]
			} else {
				mi[i] = min(a[i], mi[i+1])
				ma[i] = max(a[i], ma[i+1])
			}
		}

		ans := 0
		vis := make([]int, n+5)
		for i := 1; i <= n; i++ {
			if q == 0 {
				break
			}
			if i == n-1 || i == n {
				if q < a[i] {
					q--
				}
				ans++
				vis[i] = 1
				continue
			}
			if a[i] <= q {
				vis[i] = 1
				ans++
				continue
			}
			if mi[i+1] > q || ma[i+1] < q || n-i+1 <= q {
				q--
				ans++
				vis[i] = 1
			}
		}
		t--
		ret := []byte{}
		for i := 1; i <= n; i++ {
			if vis[i] == 0 {
				ret = append(ret, '0')
			} else {
				ret = append(ret, '1')
			}
		}
		fmt.Fprintln(out, string(ret))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	x := 0
	for t > 0 {
		x++
		var n, q int
		fmt.Fscan(in, &n, &q)
		a := make([]int, n+5)
		for i := 1; i <= n; i++ {
			fmt.Fscan(in, &a[i])
		}
		if x == 5509 {
			fmt.Fprintln(out, a[6])
			break
		}
		//1 1 1 3 1
		mi := make([]int, n+5)
		ma := make([]int, n+5)
		for i := n; i >= 1; i-- {
			if i == n {
				mi[i] = a[i]
				ma[i] = a[i]
			} else {
				mi[i] = min(a[i], mi[i+1])
				ma[i] = max(a[i], ma[i+1])
			}
		}

		ans := 0
		vis := make([]int, n+5)
		for i := 1; i <= n; i++ {
			if q == 0 {
				break
			}
			if i == n-1 || i == n {
				if q < a[i] {
					q--
				}
				ans++
				vis[i] = 1
				continue
			}
			if a[i] <= q {
				vis[i] = 1
				ans++
				continue
			}
			if mi[i+1] > q || ma[i+1] < q || n-i+1 <= q {
				q--
				ans++
				vis[i] = 1
			}
		}
		t--
		ret := []byte{}
		for i := 1; i <= n; i++ {
			if vis[i] == 0 {
				ret = append(ret, '0')
			} else {
				ret = append(ret, '1')
			}
		}
		fmt.Fprintln(out, string(ret))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	x := 0
	for t > 0 {
		x++
		var n, q int
		fmt.Fscan(in, &n, &q)
		a := make([]int, n+5)
		for i := 1; i <= n; i++ {
			fmt.Fscan(in, &a[i])
		}
		if x == 5509 {
			fmt.Fprintln(out, a[5])
			break
		}
		//1 1 1 3
		mi := make([]int, n+5)
		ma := make([]int, n+5)
		for i := n; i >= 1; i-- {
			if i == n {
				mi[i] = a[i]
				ma[i] = a[i]
			} else {
				mi[i] = min(a[i], mi[i+1])
				ma[i] = max(a[i], ma[i+1])
			}
		}

		ans := 0
		vis := make([]int, n+5)
		for i := 1; i <= n; i++ {
			if q == 0 {
				break
			}
			if i == n-1 || i == n {
				if q < a[i] {
					q--
				}
				ans++
				vis[i] = 1
				continue
			}
			if a[i] <= q {
				vis[i] = 1
				ans++
				continue
			}
			if mi[i+1] > q || ma[i+1] < q || n-i+1 <= q {
				q--
				ans++
				vis[i] = 1
			}
		}
		t--
		ret := []byte{}
		for i := 1; i <= n; i++ {
			if vis[i] == 0 {
				ret = append(ret, '0')
			} else {
				ret = append(ret, '1')
			}
		}
		fmt.Fprintln(out, string(ret))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	x := 0
	for t > 0 {
		x++
		var n, q int
		fmt.Fscan(in, &n, &q)
		a := make([]int, n+5)
		for i := 1; i <= n; i++ {
			fmt.Fscan(in, &a[i])
		}
		if x == 5509 {
			fmt.Fprintln(out, a[4])
			break
		}
		//1 1 1
		mi := make([]int, n+5)
		ma := make([]int, n+5)
		for i := n; i >= 1; i-- {
			if i == n {
				mi[i] = a[i]
				ma[i] = a[i]
			} else {
				mi[i] = min(a[i], mi[i+1])
				ma[i] = max(a[i], ma[i+1])
			}
		}

		ans := 0
		vis := make([]int, n+5)
		for i := 1; i <= n; i++ {
			if q == 0 {
				break
			}
			if i == n-1 || i == n {
				if q < a[i] {
					q--
				}
				ans++
				vis[i] = 1
				continue
			}
			if a[i] <= q {
				vis[i] = 1
				ans++
				continue
			}
			if mi[i+1] > q || ma[i+1] < q || n-i+1 <= q {
				q--
				ans++
				vis[i] = 1
			}
		}
		t--
		ret := []byte{}
		for i := 1; i <= n; i++ {
			if vis[i] == 0 {
				ret = append(ret, '0')
			} else {
				ret = append(ret, '1')
			}
		}
		fmt.Fprintln(out, string(ret))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	x := 0
	for t > 0 {
		x++
		var n, q int
		fmt.Fscan(in, &n, &q)
		a := make([]int, n+5)
		for i := 1; i <= n; i++ {
			fmt.Fscan(in, &a[i])
		}
		if x == 5509 {
			fmt.Fprintln(out, a[3])
			break
		}
		//1 1
		mi := make([]int, n+5)
		ma := make([]int, n+5)
		for i := n; i >= 1; i-- {
			if i == n {
				mi[i] = a[i]
				ma[i] = a[i]
			} else {
				mi[i] = min(a[i], mi[i+1])
				ma[i] = max(a[i], ma[i+1])
			}
		}

		ans := 0
		vis := make([]int, n+5)
		for i := 1; i <= n; i++ {
			if q == 0 {
				break
			}
			if i == n-1 || i == n {
				if q < a[i] {
					q--
				}
				ans++
				vis[i] = 1
				continue
			}
			if a[i] <= q {
				vis[i] = 1
				ans++
				continue
			}
			if mi[i+1] > q || ma[i+1] < q || n-i+1 <= q {
				q--
				ans++
				vis[i] = 1
			}
		}
		t--
		ret := []byte{}
		for i := 1; i <= n; i++ {
			if vis[i] == 0 {
				ret = append(ret, '0')
			} else {
				ret = append(ret, '1')
			}
		}
		fmt.Fprintln(out, string(ret))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	x := 0
	for t > 0 {
		x++
		var n, q int
		fmt.Fscan(in, &n, &q)
		a := make([]int, n+5)
		for i := 1; i <= n; i++ {
			fmt.Fscan(in, &a[i])
		}
		if x == 5509 {
			fmt.Fprintln(out, a[2])
			break
		}
		//1 1
		mi := make([]int, n+5)
		ma := make([]int, n+5)
		for i := n; i >= 1; i-- {
			if i == n {
				mi[i] = a[i]
				ma[i] = a[i]
			} else {
				mi[i] = min(a[i], mi[i+1])
				ma[i] = max(a[i], ma[i+1])
			}
		}

		ans := 0
		vis := make([]int, n+5)
		for i := 1; i <= n; i++ {
			if q == 0 {
				break
			}
			if i == n-1 || i == n {
				if q < a[i] {
					q--
				}
				ans++
				vis[i] = 1
				continue
			}
			if a[i] <= q {
				vis[i] = 1
				ans++
				continue
			}
			if mi[i+1] > q || ma[i+1] < q || n-i+1 <= q {
				q--
				ans++
				vis[i] = 1
			}
		}
		t--
		ret := []byte{}
		for i := 1; i <= n; i++ {
			if vis[i] == 0 {
				ret = append(ret, '0')
			} else {
				ret = append(ret, '1')
			}
		}
		fmt.Fprintln(out, string(ret))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	x := 0
	for t > 0 {
		x++
		var n, q int
		fmt.Fscan(in, &n, &q)
		a := make([]int, n+5)
		for i := 1; i <= n; i++ {
			fmt.Fscan(in, &a[i])
		}
		if x == 5509 {
			fmt.Fprintln(out, a[2])
			break
		}
		//1
		mi := make([]int, n+5)
		ma := make([]int, n+5)
		for i := n; i >= 1; i-- {
			if i == n {
				mi[i] = a[i]
				ma[i] = a[i]
			} else {
				mi[i] = min(a[i], mi[i+1])
				ma[i] = max(a[i], ma[i+1])
			}
		}

		ans := 0
		vis := make([]int, n+5)
		for i := 1; i <= n; i++ {
			if q == 0 {
				break
			}
			if i == n-1 || i == n {
				if q < a[i] {
					q--
				}
				ans++
				vis[i] = 1
				continue
			}
			if a[i] <= q {
				vis[i] = 1
				ans++
				continue
			}
			if mi[i+1] > q || ma[i+1] < q || n-i+1 <= q {
				q--
				ans++
				vis[i] = 1
			}
		}
		t--
		ret := []byte{}
		for i := 1; i <= n; i++ {
			if vis[i] == 0 {
				ret = append(ret, '0')
			} else {
				ret = append(ret, '1')
			}
		}
		fmt.Fprintln(out, string(ret))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	x := 0
	for t > 0 {
		x++
		var n, q int
		fmt.Fscan(in, &n, &q)
		a := make([]int, n+5)
		for i := 1; i <= n; i++ {
			fmt.Fscan(in, &a[i])
		}
		if x == 5509 {
			fmt.Fprintln(out, a[1])
			break
		}
		mi := make([]int, n+5)
		ma := make([]int, n+5)
		for i := n; i >= 1; i-- {
			if i == n {
				mi[i] = a[i]
				ma[i] = a[i]
			} else {
				mi[i] = min(a[i], mi[i+1])
				ma[i] = max(a[i], ma[i+1])
			}
		}

		ans := 0
		vis := make([]int, n+5)
		for i := 1; i <= n; i++ {
			if q == 0 {
				break
			}
			if i == n-1 || i == n {
				if q < a[i] {
					q--
				}
				ans++
				vis[i] = 1
				continue
			}
			if a[i] <= q {
				vis[i] = 1
				ans++
				continue
			}
			if mi[i+1] > q || ma[i+1] < q || n-i+1 <= q {
				q--
				ans++
				vis[i] = 1
			}
		}
		t--
		ret := []byte{}
		for i := 1; i <= n; i++ {
			if vis[i] == 0 {
				ret = append(ret, '0')
			} else {
				ret = append(ret, '1')
			}
		}
		fmt.Fprintln(out, string(ret))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	x := 0
	for t > 0 {
		x++
		var n, q int
		fmt.Fscan(in, &n, &q)
		a := make([]int, n+5)
		for i := 1; i <= n; i++ {
			fmt.Fscan(in, &a[i])
		}
		if x == 5509 {
			fmt.Fprintln(out, a)
			break
		}
		mi := make([]int, n+5)
		ma := make([]int, n+5)
		for i := n; i >= 1; i-- {
			if i == n {
				mi[i] = a[i]
				ma[i] = a[i]
			} else {
				mi[i] = min(a[i], mi[i+1])
				ma[i] = max(a[i], ma[i+1])
			}
		}

		ans := 0
		vis := make([]int, n+5)
		for i := 1; i <= n; i++ {
			if q == 0 {
				break
			}
			if i == n-1 || i == n {
				if q < a[i] {
					q--
				}
				ans++
				vis[i] = 1
				continue
			}
			if a[i] <= q {
				vis[i] = 1
				ans++
				continue
			}
			if mi[i+1] > q || ma[i+1] < q || n-i+1 <= q {
				q--
				ans++
				vis[i] = 1
			}
		}
		t--
		ret := []byte{}
		for i := 1; i <= n; i++ {
			if vis[i] == 0 {
				ret = append(ret, '0')
			} else {
				ret = append(ret, '1')
			}
		}
		fmt.Fprintln(out, string(ret))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		var n, q int
		fmt.Fscan(in, &n, &q)
		a := make([]int, n+5)
		for i := 1; i <= n; i++ {
			fmt.Fscan(in, &a[i])
		}
		mi := make([]int, n+5)
		ma := make([]int, n+5)
		for i := n; i >= 1; i-- {
			if i == n {
				mi[i] = a[i]
				ma[i] = a[i]
			} else {
				mi[i] = min(a[i], mi[i+1])
				ma[i] = max(a[i], ma[i+1])
			}
		}

		ans := 0
		vis := make([]int, n+5)
		for i := 1; i <= n; i++ {
			if q == 0 {
				break
			}
			if i == n-1 || i == n {
				if q < a[i] {
					q--
				}
				ans++
				vis[i] = 1
				continue
			}
			if a[i] <= q {
				vis[i] = 1
				ans++
				continue
			}
			if mi[i+1] > q || ma[i+1] < q || n-i+1 <= q {
				q--
				ans++
				vis[i] = 1
			}
		}
		t--
		ret := []byte{}
		for i := 1; i <= n; i++ {
			if vis[i] == 0 {
				ret = append(ret, '0')
			} else {
				ret = append(ret, '1')
			}
		}
		fmt.Fprintln(out, string(ret))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		var n, q int
		fmt.Fscan(in, &n, &q)
		a := make([]int, n+5)
		for i := 1; i <= n; i++ {
			fmt.Fscan(in, &a[i])
		}
		mi := make([]int, n+5)
		ma := make([]int, n+5)
		for i := n; i >= 1; i-- {
			if i == n {
				mi[i] = a[i]
				ma[i] = a[i]
			} else {
				mi[i] = min(a[i], mi[i+1])
				ma[i] = max(a[i], ma[i+1])
			}
		}

		ans := 0
		vis := make([]int, n+5)
		for i := 1; i <= n; i++ {
			if q == 0 {
				break
			}
			if i == n-1 || i == n {
				if q < a[i] {
					q--
				}
				ans++
				vis[i] = 1
				continue
			}
			if a[i] <= q {
				vis[i] = 1
				ans++
				continue
			}
			if mi[i+1] > q || ma[i+1] < q {
				q--
				ans++
				vis[i] = 1
			}
		}
		t--
		ret := []byte{}
		for i := 1; i <= n; i++ {
			if vis[i] == 0 {
				ret = append(ret, '0')
			} else {
				ret = append(ret, '1')
			}
		}
		fmt.Fprintln(out, string(ret))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		var n, q int
		fmt.Fscan(in, &n, &q)
		a := make([]int, n+5)
		for i := 1; i <= n; i++ {
			fmt.Fscan(in, &a[i])
		}
		mi := make([]int, n+5)
		for i := n; i >= 1; i-- {
			if i == n {
				mi[i] = a[i]
			} else {
				mi[i] = min(a[i], mi[i+1])
			}
		}
		ans := 0
		vis := make([]int, n+5)
		for i := 1; i <= n; i++ {
			if q > n-i+1 {
				q--
				vis[i] = 1
				continue
			}
			if q == 0 {
				break
			}
			if i == n-1 || i == n {
				if q < a[i] {
					q--
				}
				ans++
				vis[i] = 1
				continue
			}
			if a[i] <= q {
				vis[i] = 1
				ans++
				continue
			}
			if mi[i+1] > q {
				q--
				ans++
				vis[i] = 1
			}
		}
		t--
		ret := []byte{}
		for i := 1; i <= n; i++ {
			if vis[i] == 0 {
				ret = append(ret, '0')
			} else {
				ret = append(ret, '1')
			}
		}
		fmt.Fprintln(out, string(ret))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		var n, q int
		fmt.Fscan(in, &n, &q)
		a := make([]int, n+5)
		for i := 1; i <= n; i++ {
			fmt.Fscan(in, &a[i])
		}
		mi := make([]int, n+5)
		for i := n; i >= 1; i-- {
			if i == n {
				mi[i] = a[i]
			} else {
				mi[i] = min(a[i], mi[i+1])
			}
		}
		ans := 0
		vis := make([]int, n+5)
		for i := 1; i <= n; i++ {
			if q > n-i+1 {
				q--
				vis[i] = 1
			}
			if q == 0 {
				break
			}
			if i == n-1 || i == n {
				if q < a[i] {
					q--
				}
				ans++
				vis[i] = 1
				continue
			}
			if a[i] <= q {
				vis[i] = 1
				ans++
				continue
			}
			if mi[i+1] > q {
				q--
				ans++
				vis[i] = 1
			}
		}
		t--
		ret := []byte{}
		for i := 1; i <= n; i++ {
			if vis[i] == 0 {
				ret = append(ret, '0')
			} else {
				ret = append(ret, '1')
			}
		}
		fmt.Fprintln(out, string(ret))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		var n, q int
		fmt.Fscan(in, &n, &q)
		a := make([]int, n+5)
		for i := 1; i <= n; i++ {
			fmt.Fscan(in, &a[i])
		}
		mi := make([]int, n+5)
		for i := n; i >= 1; i-- {
			if i == n {
				mi[i] = a[i]
			} else {
				mi[i] = min(a[i], mi[i+1])
			}
		}
		ans := 0
		vis := make([]int, n+5)
		for i := 1; i <= n; i++ {
			if q == 0 {
				break
			}
			if i == n-1 || i == n {
				if q < a[i] {
					q--
				}
				ans++
				vis[i] = 1
				continue
			}
			if a[i] <= q {
				vis[i] = 1
				ans++
				continue
			}
			if mi[i+1] > q {
				q--
				ans++
				vis[i] = 1
			}
		}
		t--
		ret := []byte{}
		for i := 1; i <= n; i++ {
			if vis[i] == 0 {
				ret = append(ret, '0')
			} else {
				ret = append(ret, '1')
			}
		}
		fmt.Fprintln(out, string(ret))
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		var n, q int
		fmt.Fscan(in, &n, &q)
		a := make([]int, n+5)
		for i := 1; i <= n; i++ {
			fmt.Fscan(in, &a[i])
		}
		mi := make([]int, n+5)
		for i := n; i >= 1; i-- {
			if i == n {
				mi[i] = a[i]
			} else {
				mi[i] = min(a[i], mi[i+1])
			}
		}
		ans := 0
		vis := make([]int, n+5)
		for i := 1; i <= n; i++ {

			fmt.Println(i, q)
			if q == 0 {
				break
			}
			if i == n-1 || i == n {
				if q < a[i] {
					q--
				}
				ans++
				vis[i] = 1
				continue
			}
			if a[i] <= q {
				vis[i] = 1
				ans++
				continue
			}
			if mi[i+1] > q {
				q--
				ans++
				vis[i] = 1
			}
		}
		t--
		ret := []byte{}
		for i := 1; i <= n; i++ {
			if vis[i] == 0 {
				ret = append(ret, '0')
			} else {
				ret = append(ret, '1')
			}
		}
		fmt.Fprintln(out, string(ret))
	}
}

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)

	var buf bytes.Buffer

	tc := readNum(reader)

	for tc > 0 {
		tc--
		n, k := readTwoNums(reader)
		A := readNNums(reader, n)
		res := solve(A, k)
		buf.WriteString(fmt.Sprintf("%s\n", res))
	}

	fmt.Print(buf.String())
}

func readString(reader *bufio.Reader) string {
	s, _ := reader.ReadString('\n')
	for i := 0; i < len(s); i++ {
		if s[i] == '\n' || s[i] == '\r' {
			return s[:i]
		}
	}
	return s
}

func normalize(s string) string {

	for i := len(s); i > 0; i-- {
		if s[i-1] >= 'a' && s[i-1] <= 'z' {
			return s[:i]
		}
	}
	return ""
}

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func solve(A []int, iq int) string {
	// when iq > A[i], always to test
	// when iq <= A[i], may test, but iq--, else not stay no change
	// only when iq > 0, can test
	n := len(A)

	cnt := make(map[int]int)

	for i := 0; i < n; i++ {
		cnt[A[i]]++
	}
	res := make([]byte, n)
	for i := 0; i < n; i++ {
		res[i] = '0'
	}
	var delete []int
	for i := 0; i < n && iq > 0; i++ {
		cnt[A[i]]--
		if iq >= A[i] {
			res[i] = '1'
			continue
		}
		// iq <=  A[i]
		if cnt[iq] == 0 {
			// use it no problem
			res[i] = '1'
			iq--
			delete = append(delete, i)
		}
		// else no change
	}

	for _, i := range delete {
		if iq == 0 {
			break
		}
		res[i] = '1'
		iq--
	}

	return string(res)
}

func min(a, b int) int {
	if a <= b {
		return a
	}
	return b
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	var count int
	fmt.Fscan(reader, &count)

	for i := 0; i < count; i++ {
		var n, q int
		fmt.Fscan(reader, &n, &q)
		for j := 0; j < n; j++ {
			var u int
			fmt.Fscan(reader, &u)
			if q == 0 {
				fmt.Fprint(writer, "0")
			} else if u > q {
				fmt.Fprint(writer, "1")
				q--
			} else {
				fmt.Fprint(writer, "1")
			}
		}
		fmt.Fprint(writer, "\n")
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

const cf = true

func solve() {
	var n, q int
	fmt.Fscan(in, &n, &q)
	diff := make([]int, n)
	for i := range diff {
		fmt.Fscan(in, &diff[i])
	}
	l, r := -1, n+1
	ans := 0
	for i := range diff {
		if diff[i] <= q {
			ans++
		}
	}
	for l < r-1 {
		mid := (l + r) / 2
		curQ := q
		curAns := 0
		for i := range diff {
			if i < mid {
				if diff[i] <= q {
					curAns++
				}
			} else {
				if diff[i] <= curQ {
					curAns++
				} else if curQ > 0 {
					curQ--
					curAns++
				}
			}
		}
		if curAns > ans {
			ans = curAns
			r = mid
		} else {
			l = mid
		}
	}
	ansArr := make([]int, n)
	for i := range diff {
		if i < r {
			if diff[i] <= q {
				ansArr[i] = 1
			}
		} else {
			if diff[i] <= q {
				ansArr[i] = 1
			} else if q > 0 {
				q--
				ansArr[i] = 1
			}
		}
	}
	for _, item := range ansArr {
		fmt.Fprint(out, item)
	}
	fmt.Fprintln(out)
}

func main() {
	defer out.Flush()
	t := 1
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		solve()
	}
}

func ConvertInt(val string, base, toBase int) (string, error) {
	i, err := strconv.ParseInt(val, base, 64)
	if err != nil {
		return "", err
	}
	return strconv.FormatInt(i, toBase), nil
}

type set[T Ordered] struct {
	itms map[T]struct{}
}

func (s *set[T]) init() {
	if s.itms == nil {
		s.itms = make(map[T]struct{})
	}
}

func (s *set[T]) add(item T) *set[T] {
	s.init()
	s.itms[item] = exists
	return s
}

func (s *set[T]) remove(item T) *set[T] {
	s.init()
	delete(s.itms, item)
	return s
}

func (s *set[T]) has(item T) bool {
	s.init()
	_, c := s.itms[item]
	return c
}

func (s *set[T]) sortedItems() []T {
	s.init()
	items := make([]T, 0, s.size())
	for item := range s.itms {
		items = append(items, item)
	}
	sort.Slice(items, func(i, j int) bool {
		return items[i] < items[j]
	})
	return items
}

func (s *set[T]) items() []T {
	s.init()
	items := make([]T, 0, s.size())
	for item := range s.itms {
		items = append(items, item)
	}
	return items
}

func (s *set[T]) size() int {
	s.init()
	return len(s.itms)
}

var exists = struct{}{}

const MaxUint = ^uint(0)
const MinUint = 0
const MaxInt = int(MaxUint >> 1)
const MinInt = -MaxInt - 1

func reverseStr(s string) string {
	r := []rune(s)
	for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
		r[i], r[j] = r[j], r[i]
	}
	return string(r)
}

type Float interface {
	~float32 | ~float64
}

type Integer interface {
	Signed | Unsigned
}

type Signed interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

type Unsigned interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}

type Ordered interface {
	Integer | Float | ~string
}

func abs[T Signed](x T) T {
	if x < 0 {
		return -x
	}
	return x
}

func min[T Ordered](x, y T) T {
	if x < y {
		return x
	}
	return y
}

func max[T Ordered](x, y T) T {
	if x > y {
		return x
	}
	return y
}

var (
	in  = getReader()
	out = getWriter()
)

func getReader() *bufio.Reader {
	if cf {
		return bufio.NewReader(os.Stdin)
	} else {
		in, _ := os.Open("input.txt")
		return bufio.NewReader(in)
	}
}

func getWriter() *bufio.Writer {
	if cf {
		return bufio.NewWriter(os.Stdout)
	} else {
		out, _ := os.Create("output.txt")
		return bufio.NewWriter(out)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

const cf = true

func solve() {
	var n, q int
	fmt.Fscan(in, &n, &q)
	diff := make([]int, n)
	for i := range diff {
		fmt.Fscan(in, &diff[i])
	}
	l, r := 0, n
	ans := 0
	for i := range diff {
		if diff[i] <= q {
			ans++
		}
	}
	for l < r-1 {
		mid := (l + r) / 2
		curQ := q
		curAns := 0
		for i := range diff {
			if i < mid {
				if diff[i] <= q {
					curAns++
				}
			} else {
				if diff[i] <= curQ {
					curAns++
				} else if curQ > 0 {
					curQ--
					curAns++
				}
			}
		}
		if curAns > ans {
			ans = curAns
			r = mid
		} else {
			l = mid
		}
	}
	ansArr := make([]int, n)
	for i := range diff {
		if i < r {
			if diff[i] <= q {
				ansArr[i] = 1
			}
		} else {
			if diff[i] <= q {
				ansArr[i] = 1
			} else if q > 0 {
				q--
				ansArr[i] = 1
			}
		}
	}
	for _, item := range ansArr {
		fmt.Fprint(out, item)
	}
	fmt.Fprintln(out)
}

func main() {
	defer out.Flush()
	t := 1
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		solve()
	}
}

func ConvertInt(val string, base, toBase int) (string, error) {
	i, err := strconv.ParseInt(val, base, 64)
	if err != nil {
		return "", err
	}
	return strconv.FormatInt(i, toBase), nil
}

type set[T Ordered] struct {
	itms map[T]struct{}
}

func (s *set[T]) init() {
	if s.itms == nil {
		s.itms = make(map[T]struct{})
	}
}

func (s *set[T]) add(item T) *set[T] {
	s.init()
	s.itms[item] = exists
	return s
}

func (s *set[T]) remove(item T) *set[T] {
	s.init()
	delete(s.itms, item)
	return s
}

func (s *set[T]) has(item T) bool {
	s.init()
	_, c := s.itms[item]
	return c
}

func (s *set[T]) sortedItems() []T {
	s.init()
	items := make([]T, 0, s.size())
	for item := range s.itms {
		items = append(items, item)
	}
	sort.Slice(items, func(i, j int) bool {
		return items[i] < items[j]
	})
	return items
}

func (s *set[T]) items() []T {
	s.init()
	items := make([]T, 0, s.size())
	for item := range s.itms {
		items = append(items, item)
	}
	return items
}

func (s *set[T]) size() int {
	s.init()
	return len(s.itms)
}

var exists = struct{}{}

const MaxUint = ^uint(0)
const MinUint = 0
const MaxInt = int(MaxUint >> 1)
const MinInt = -MaxInt - 1

func reverseStr(s string) string {
	r := []rune(s)
	for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
		r[i], r[j] = r[j], r[i]
	}
	return string(r)
}

type Float interface {
	~float32 | ~float64
}

type Integer interface {
	Signed | Unsigned
}

type Signed interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

type Unsigned interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}

type Ordered interface {
	Integer | Float | ~string
}

func abs[T Signed](x T) T {
	if x < 0 {
		return -x
	}
	return x
}

func min[T Ordered](x, y T) T {
	if x < y {
		return x
	}
	return y
}

func max[T Ordered](x, y T) T {
	if x > y {
		return x
	}
	return y
}

var (
	in  = getReader()
	out = getWriter()
)

func getReader() *bufio.Reader {
	if cf {
		return bufio.NewReader(os.Stdin)
	} else {
		in, _ := os.Open("input.txt")
		return bufio.NewReader(in)
	}
}

func getWriter() *bufio.Writer {
	if cf {
		return bufio.NewWriter(os.Stdout)
	} else {
		out, _ := os.Create("output.txt")
		return bufio.NewWriter(out)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

const cf = true

func solve() {
	var n, q int
	fmt.Fscan(in, &n, &q)
	diff := make([]int, n)
	for i := range diff {
		fmt.Fscan(in, &diff[i])
	}
	l, r := 0, n
	ans := 0
	for i := range diff {
		if diff[i] <= q {
			ans++
		}
	}
	for l < r-1 {
		mid := (l + r) / 2
		curQ := q
		curAns := 0
		for i := range diff {
			if i < mid {
				if diff[i] <= q {
					curAns++
				}
			} else {
				if diff[i] <= curQ {
					curAns++
				} else if curQ > 0 {
					curQ--
					curAns++
				}
			}
		}
		if curAns >= ans {
			ans = curAns
			r = mid
		} else {
			l = mid
		}
	}
	ansArr := make([]int, n)
	for i := range diff {
		if i < r {
			if diff[i] <= q {
				ansArr[i] = 1
			}
		} else {
			if diff[i] <= q {
				ansArr[i] = 1
			} else if q > 0 {
				q--
				ansArr[i] = 1
			}
		}
	}
	for _, item := range ansArr {
		fmt.Fprint(out, item)
	}
	fmt.Fprintln(out)
}

func main() {
	defer out.Flush()
	t := 1
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		solve()
	}
}

func ConvertInt(val string, base, toBase int) (string, error) {
	i, err := strconv.ParseInt(val, base, 64)
	if err != nil {
		return "", err
	}
	return strconv.FormatInt(i, toBase), nil
}

type set[T Ordered] struct {
	itms map[T]struct{}
}

func (s *set[T]) init() {
	if s.itms == nil {
		s.itms = make(map[T]struct{})
	}
}

func (s *set[T]) add(item T) *set[T] {
	s.init()
	s.itms[item] = exists
	return s
}

func (s *set[T]) remove(item T) *set[T] {
	s.init()
	delete(s.itms, item)
	return s
}

func (s *set[T]) has(item T) bool {
	s.init()
	_, c := s.itms[item]
	return c
}

func (s *set[T]) sortedItems() []T {
	s.init()
	items := make([]T, 0, s.size())
	for item := range s.itms {
		items = append(items, item)
	}
	sort.Slice(items, func(i, j int) bool {
		return items[i] < items[j]
	})
	return items
}

func (s *set[T]) items() []T {
	s.init()
	items := make([]T, 0, s.size())
	for item := range s.itms {
		items = append(items, item)
	}
	return items
}

func (s *set[T]) size() int {
	s.init()
	return len(s.itms)
}

var exists = struct{}{}

const MaxUint = ^uint(0)
const MinUint = 0
const MaxInt = int(MaxUint >> 1)
const MinInt = -MaxInt - 1

func reverseStr(s string) string {
	r := []rune(s)
	for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
		r[i], r[j] = r[j], r[i]
	}
	return string(r)
}

type Float interface {
	~float32 | ~float64
}

type Integer interface {
	Signed | Unsigned
}

type Signed interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

type Unsigned interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}

type Ordered interface {
	Integer | Float | ~string
}

func abs[T Signed](x T) T {
	if x < 0 {
		return -x
	}
	return x
}

func min[T Ordered](x, y T) T {
	if x < y {
		return x
	}
	return y
}

func max[T Ordered](x, y T) T {
	if x > y {
		return x
	}
	return y
}

var (
	in  = getReader()
	out = getWriter()
)

func getReader() *bufio.Reader {
	if cf {
		return bufio.NewReader(os.Stdin)
	} else {
		in, _ := os.Open("input.txt")
		return bufio.NewReader(in)
	}
}

func getWriter() *bufio.Writer {
	if cf {
		return bufio.NewWriter(os.Stdout)
	} else {
		out, _ := os.Create("output.txt")
		return bufio.NewWriter(out)
	}
}

// 00
package main

import (
	"bufio"
	"fmt"
	"os"
)

func max(a int, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n, q int
		fmt.Fscan(reader, &n, &q)
		a := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &a[i])
		}
		mx := make([]int, n)
		b := make([]byte, n)
		if a[n-1] <= q {
			mx[n-1] = a[n-1]
		}
		for i := n - 2; i >= 0; i-- {
			if a[i] <= q {
				mx[i] = max(a[i], mx[i+1])
			} else {
				mx[i] = mx[i+1]
			}
		}
		//fmt.Println(mx)
		for i := 0; i < n; i++ {
			if q >= a[i] {
				b[i] = '1'
			} else {
				if q > mx[i] {
					b[i] = '1'
					q--
				} else {
					b[i] = '0'
				}
			}
		}
		for i := 0; i < n; i++ {
			if q > 0 && b[i] == '0' {
				b[i] = '1'
				q--
			}
		}
		fmt.Println(string(b))
	}
}

// 00
package main

import (
	"bufio"
	"fmt"
	"os"
)

func max(a int, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n, q int
		fmt.Fscan(reader, &n, &q)
		a := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &a[i])
		}
		mx := make([]int, n)
		b := make([]byte, n)
		if a[n-1] <= q {
			mx[n-1] = a[n-1]
		}
		for i := n - 2; i >= 0; i-- {
			if a[i] <= q {
				mx[i] = max(a[i], mx[i+1])
			} else {
				mx[i] = mx[i+1]
			}
		}
		//fmt.Println(mx)
		for i := 0; i < n; i++ {
			if q >= a[i] {
				b[i] = '1'
			} else {
				if q > mx[i] {
					b[i] = '1'
					q--
				} else {
					b[i] = '0'
				}
			}
		}
		fmt.Println(string(b))
	}
}


package main

import (
	"bufio"
	"fmt"
	"os"
)

func cost(a, b string) int {
	c := [2]int{}
	for i := 0; i < len(a); i++ {
		c[a[i]-'0']++
		c[b[i]-'0']++
	}

	if c[0] == 0 {
		return 0
	} else if c[1] == 0 {
		return 1
	}
	return 2
}

func main() {
	r := bufio.NewReaderSize(os.Stdin, 1024*1024)

	var T int

	fmt.Fscanf(r, "%d\n", &T)

	for t := 0; t < T; t++ {
		var n int
		s := [2]string{}
		fmt.Fscanf(r, "%d\n", &n)
		fmt.Fscanf(r, "%s\n%s\n", &s[0], &s[1])

		f := make([]int, n)
		for i := 0; i < n; i++ {
			for j := 0; j <= 10 && i-j >= 0; j++ {
				x := cost(s[0][i-j:i+1], s[1][i-j:i+1])

				if i-j-1 >= 0 {
					x += f[i-j-1]
				}
				if x > f[i] {
					f[i] = x
				}
			}
		}

		fmt.Println(f[n-1])
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)

// var m []int
// err = json.Unmarshal([]byte(r.FormValue("example")), &m)

// for i := 0; i < len(m); i++ {
// 	fmt.Println(m[i])
// }

// sort.Slice(arr, func(i, j int) bool {
// 	return arr[i] > arr[j]
// })

func MIN(x, y int64) int64 {
	if x > y {
		return y
	} else {
		return x
	}
}

func MINN(x, y int) int {
	if x > y {
		return y
	} else {
		return x
	}
}

func MKO(x, y int64) int64 {
	if x < y {
		return 0
	} else {
		return x - y + 1
	}
}

func MAX(x, y int64) int64 {
	if x > y {
		return x
	} else {
		return y
	}
}

func MAXX(x, y int) int {
	if x > y {
		return x
	} else {
		return y
	}
}

func LCM(x, y int) int {
	if x >= y {
		initial := x
		for i := 1; i < y+2; i++ {
			if initial%y == 0 {
				break
			} else {
				initial = initial + x
			}

		}
		return initial
	} else {
		initial := y
		for i := 1; i < x+2; i++ {
			if initial%x == 0 {
				break
			} else {
				initial = initial + y
			}

		}
		return initial
	}
}

func GCD(x, y int64) int64 {
	if x*y == 0 {
		return MAX(x, y)
	} else {
		var l, q int64
		l = MAX(x, y)
		q = MIN(x, y)
		var m int64
		for l*q > 0 {
			a := l % q
			b := l - a
			cc := int64(b / q)
			remain := l - cc*q
			l = MAX(remain, q)
			q = MIN(remain, q)
			if l*q == 0 {
				m = l + q
				break
			}

		}
		return m
	}
}

func IsItPrime(x int) bool {
	if x < 10 {
		if x == 2 || x == 3 || x == 5 || x == 7 {
			return true
		} else {
			return false
		}
	} else {
		j := 0
		k := math.Sqrt(float64(x))
		for m := 3; m <= int(k); {
			if x%m == 0 {
				j = 1
				break
			}
			m = m + 2
		}
		if j == 1 {
			return false
		} else {
			return true
		}
	}
}

func PrimeFactorization(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

func NumberOfDivisors(n int) int {
	pfs := PrimeFactorization(n)

	num := 1
	for _, exponents := range pfs {
		num *= (exponents + 1)
	}

	return num
}

func KthPrime(x int) (y int) {
	if x == 1 {
		y = 2
	}
	if x == 2 {
		y = 3
	}
	if x > 2 {
		var sum int = 2
		begin := 5
		for sum < x+1 {
			if IsItPrime(begin) == true {
				sum++
			}
			if sum == x {
				y = begin
				break
			} else {
				if begin%6 == 1 {
					begin = begin + 4
				} else {
					begin = begin + 2
				}
			}
		}
	}
	return
}

func MODULE(x, y int) int {
	if x > y {
		return x - y
	} else {
		return y - x
	}
}

func BITAND(x, y int64) int64 {
	var ans int64
	begin := x
	sec := y
	var count int64 = 1
	for 1 == 1 {
		if (begin%2)*(sec%2) == 1 {
			ans = ans + count
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}

		} else {
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}
		}
	}
	return ans
}

func Sum(n, m int) int {
	var ans int

	if n == 1 {
		return 0
	} else {
		for i := 2; i < n; i++ {
			ans = (ans + Sum(i, m)) % m
		}
		for j := 2; j < n+1; j++ {
			ans = (ans + Sum(n/j, m)) % m
		}
		return ans
	}
}

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)
	for o := 0; o < t; o++ {
		var n int
		fmt.Fscan(input, &n)

		First := make([]byte, 0)
		Second := make([]byte, 0)

		fmt.Fscan(input, &First)

		fmt.Fscan(input, &Second)
		var Ans int

		ARRAY := make([]int, n)

		for i := 0; i < n-1; {
			if First[i]+Second[i] == 97 {
				Ans = Ans + 2
				ARRAY[i] = 1
				i = i + 1
			} else {
				if First[i]+Second[i] == 96 {
					if First[i+1]+Second[i+1] == 98 {
						Ans = Ans + 2
						ARRAY[i] = 1
						ARRAY[i+1] = 2
						i = i + 2
					} else {
						Ans = Ans + 1
						ARRAY[i] = 1

						i = i + 1
					}

				} else {
					if First[i]+Second[i] == 98 {
						if First[i+1]+Second[i+1] == 96 {
							Ans = Ans + 2
							ARRAY[i] = 1
							ARRAY[i+1] = 2
							i = i + 2
						} else {
							ARRAY[i] = 1
							i = i + 1

						}
					}
				}

			}
		}
		if First[n-1]+Second[n-1] == 97 {
			Ans = Ans + 2
		}
		if n == 1 {
			if First[n-1]+Second[n-1] == 96 {
				Ans = Ans + 1
			}
		} else {
			if First[n-1]+Second[n-1] == 96 {
				if First[n-2]+Second[n-2] == 98 {
					if ARRAY[n-1] != 2 {
						Ans = Ans + 1
					}
				} else {
					Ans = Ans + 1

				}
			}
		}
		fmt.Println(Ans)

	}
}

// 00
package main

import (
	"bufio"
	"fmt"
	"os"
)

func write(f *bufio.Writer, a ...interface{}) {
	f.Write([]byte(fmt.Sprint(a...)))
}

type Number interface {
	int64 | float64 | int
}

func min[K Number](a K, b K) K {
	if a < b {
		return a
	}
	return b
}
func max[K Number](a K, b K) K {
	if a > b {
		return a
	}
	return b
}
func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		var s1, s2 string
		fmt.Fscan(reader, &n, &s1, &s2)

		ans := 0
		found_zero := 0
		found_one := 0
		for i := 0; i < n; i++ {
			if s1[i] == '0' && s2[i] == '1' || s1[i] == '1' && s2[i] == '0' {
				ans += found_zero + 2
				found_one = 0
				found_zero = 0
			} else if found_zero > 0 && s1[i] == '1' && s2[i] == '1' {
				ans += found_zero + 1
				found_zero = 0
				found_one = 0
			} else if found_one > 0 && s1[i] == '0' && s2[i] == '0' {
				ans += 2
				found_zero = 0
				found_one = 0
			} else if s1[i] == '0' && s2[i] == '0' {
				found_zero++
			} else if s1[i] == '1' && s2[i] == '1' {
				found_one++
			}
		}
		ans += found_zero
		write(f, ans, "\n")
	}
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func CF1566C(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var T, n int
	var s0, s1 []byte
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &s0, &s1)
		ans := 0
		use := -1
		for i, b := range s0 {
			if b != s1[i] {
				ans += 2
			} else if b == '0' || i > 0 && s0[i-1] == '0' && s1[i-1] == '0' && use != i-1 {
				ans++
			} else if i < n-1 && s0[i+1] == '0' && s1[i+1] == '0' {
				ans++
				use = i + 1
			}
		}
		Fprintln(out, ans)
	}
}

func main() { CF1566C(os.Stdin, os.Stdout) }

// 00
package main

import (
	"bufio"
	"fmt"
	"os"
)

func write(f *bufio.Writer, a ...interface{}) {
	f.Write([]byte(fmt.Sprint(a...)))
}

type Number interface {
	int64 | float64 | int
}

func min[K Number](a K, b K) K {
	if a < b {
		return a
	}
	return b
}
func max[K Number](a K, b K) K {
	if a > b {
		return a
	}
	return b
}
func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		var s1, s2 string
		fmt.Fscan(reader, &n, &s1, &s2)
		if t == 102 {
			fmt.Println(n, s1, s2)
		}
		ans := 0
		found_zero := 0
		found_one := 0
		for i := 0; i < n; i++ {
			if s1[i] == '0' && s2[i] == '1' || s1[i] == '1' && s2[i] == '0' {
				ans += found_zero + 2
				found_one = 0
				found_zero = 0
			} else if found_zero > 0 && s1[i] == '1' && s2[i] == '1' {
				ans += found_zero + 1
				found_zero = 0
				found_one = 0
			} else if found_one > 0 && s1[i] == '0' && s2[i] == '0' {
				ans += 2
				found_zero = 0
				found_one = 0
			} else if s1[i] == '0' && s2[i] == '0' {
				found_zero++
			} else if s1[i] == '1' && s2[i] == '1' {
				found_one++
			}
		}
		ans += found_zero
		write(f, ans, "\n")
	}
}

// 00
package main

import (
	"bufio"
	"fmt"
	"os"
)

func write(f *bufio.Writer, a ...interface{}) {
	f.Write([]byte(fmt.Sprint(a...)))
}

type Number interface {
	int64 | float64 | int
}

func min[K Number](a K, b K) K {
	if a < b {
		return a
	}
	return b
}
func max[K Number](a K, b K) K {
	if a > b {
		return a
	}
	return b
}
func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		var s1, s2 string
		fmt.Fscan(reader, &n, &s1, &s2)
		if t == 102 {
			fmt.Println(n, s1, s2)
		}
		ans := 0
		found_zero := 0
		found_one := 0
		for i := 0; i < n; i++ {
			if s1[i] == '0' && s2[i] == '1' || s1[i] == '1' && s2[i] == '0' {
				ans += found_zero + 2
				found_one = 0
				found_zero = 0
			} else if found_zero > 0 && s1[i] == '1' && s2[i] == '1' {
				if found_zero == 2 {
					ans += 3
				} else {
					ans += 2
				}
				found_zero = 0
				found_one = 0
			} else if found_one > 0 && s1[i] == '0' && s2[i] == '0' {
				ans += 2
				found_zero = 0
				found_one = 0
			} else if s1[i] == '0' && s2[i] == '0' {
				found_zero++
			} else if s1[i] == '1' && s2[i] == '1' {
				found_one++
			}
		}
		ans += found_zero
		write(f, ans, "\n")
	}
}

// 00
package main

import (
	"bufio"
	"fmt"
	"os"
)

func write(f *bufio.Writer, a ...interface{}) {
	f.Write([]byte(fmt.Sprint(a...)))
}

type Number interface {
	int64 | float64 | int
}

func min[K Number](a K, b K) K {
	if a < b {
		return a
	}
	return b
}
func max[K Number](a K, b K) K {
	if a > b {
		return a
	}
	return b
}
func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		var s1, s2 string
		fmt.Fscan(reader, &n, &s1, &s2)
		ans := 0
		found_zero := 0
		found_one := 0
		for i := 0; i < n; i++ {
			if s1[i] == '0' && s2[i] == '1' || s1[i] == '1' && s2[i] == '0' {
				ans += found_zero + 2
				found_one = 0
				found_zero = 0
			} else if found_zero > 0 && s1[i] == '1' && s2[i] == '1' {
				if found_zero == 2 {
					ans += 3
				} else {
					ans += 2
				}
				found_zero = 0
				found_one = 0
			} else if found_one > 0 && s1[i] == '0' && s2[i] == '0' {
				ans += 2
				found_zero = 0
				found_one = 0
			} else if s1[i] == '0' && s2[i] == '0' {
				found_zero++
			} else if s1[i] == '1' && s2[i] == '1' {
				found_one++
			}
		}
		ans += found_zero
		write(f, ans, "\n")
	}
}

// 00
package main

import (
	"bufio"
	"fmt"
	"os"
)

func write(f *bufio.Writer, a ...interface{}) {
	f.Write([]byte(fmt.Sprint(a...)))
}

type Number interface {
	int64 | float64 | int
}

func min[K Number](a K, b K) K {
	if a < b {
		return a
	}
	return b
}
func max[K Number](a K, b K) K {
	if a > b {
		return a
	}
	return b
}
func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		var s1, s2 string
		fmt.Fscan(reader, &n, &s1, &s2)
		ans := 0
		found_zero := 0
		found_one := 0
		for i := 0; i < n; i++ {
			if s1[i] == '0' && s2[i] == '1' || s1[i] == '1' && s2[i] == '0' {
				if found_zero > 0 {
					ans += 3
				} else {
					ans += 2
				}
				found_one = 0
				found_zero = 0
			} else if found_zero > 0 && s1[i] == '1' && s2[i] == '1' {
				if found_zero == 2 {
					ans += 3
				} else {
					ans += 2
				}
				found_zero = 0
				found_one = 0
			} else if found_one > 0 && s1[i] == '0' && s2[i] == '0' {
				ans += 2
				found_zero = 0
				found_one = 0
			} else if s1[i] == '0' && s2[i] == '0' {
				found_zero++
			} else if s1[i] == '1' && s2[i] == '1' {
				found_one++
			}
		}
		ans += found_zero
		write(f, ans, "\n")
	}
}

// 00
package main

import (
	"bufio"
	"fmt"
	"os"
)

func write(f *bufio.Writer, a ...interface{}) {
	f.Write([]byte(fmt.Sprint(a...)))
}

type Number interface {
	int64 | float64 | int
}

func min[K Number](a K, b K) K {
	if a < b {
		return a
	}
	return b
}
func max[K Number](a K, b K) K {
	if a > b {
		return a
	}
	return b
}
func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		var s1, s2 string
		fmt.Fscan(reader, &n, &s1, &s2)
		ans := 0
		found_zero := false
		found_one := false
		for i := 0; i < n; i++ {
			if s1[i] == '0' && s2[i] == '1' || s1[i] == '1' && s2[i] == '0' {
				if found_zero {
					ans += 3
				} else {
					ans += 2
				}
				found_one = false
				found_zero = false
			} else if found_zero && s1[i] == '1' && s2[i] == '1' {
				ans += 2
				found_zero = false
				found_one = false
			} else if (found_one || found_zero) && s1[i] == '0' && s2[i] == '0' {
				ans += 2
				found_zero = false
				found_one = false
			} else if s1[i] == '0' && s2[i] == '0' {
				found_zero = true
			} else if s1[i] == '1' && s2[i] == '1' {
				found_one = true
			}
		}
		if found_zero {
			ans++
		}
		write(f, ans, "\n")
	}
}

// 00
package main

import (
	"bufio"
	"fmt"
	"os"
)

func write(f *bufio.Writer, a ...interface{}) {
	f.Write([]byte(fmt.Sprint(a...)))
}

type Number interface {
	int64 | float64 | int
}

func min[K Number](a K, b K) K {
	if a < b {
		return a
	}
	return b
}
func max[K Number](a K, b K) K {
	if a > b {
		return a
	}
	return b
}
func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		var s1, s2 string
		fmt.Fscan(reader, &n, &s1, &s2)
		ans := 0
		found_zero := false
		found_one := false
		for i := 0; i < n; i++ {
			if s1[i] == '0' && s2[i] == '1' || s1[i] == '1' && s2[i] == '0' {
				ans += 2
				found_one = false
				found_zero = false
			} else if found_zero && s1[i] == '1' && s2[i] == '1' {
				ans += 2
				found_zero = false
				found_one = false
			} else if (found_one || found_zero) && s1[i] == '0' && s2[i] == '0' {
				ans += 2
				found_zero = false
				found_one = false
			} else if s1[i] == '0' && s2[i] == '0' {
				found_zero = true
			} else if s1[i] == '1' && s2[i] == '1' {
				found_one = true
			}
		}
		if found_zero {
			ans++
		}
		write(f, ans, "\n")
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)

// var m []int
// err = json.Unmarshal([]byte(r.FormValue("example")), &m)

// for i := 0; i < len(m); i++ {
// 	fmt.Println(m[i])
// }

// sort.Slice(arr, func(i, j int) bool {
// 	return arr[i] > arr[j]
// })

func MIN(x, y int64) int64 {
	if x > y {
		return y
	} else {
		return x
	}
}

func MINN(x, y int) int {
	if x > y {
		return y
	} else {
		return x
	}
}

func MKO(x, y int64) int64 {
	if x < y {
		return 0
	} else {
		return x - y + 1
	}
}

func MAX(x, y int64) int64 {
	if x > y {
		return x
	} else {
		return y
	}
}

func MAXX(x, y int) int {
	if x > y {
		return x
	} else {
		return y
	}
}

func LCM(x, y int) int {
	if x >= y {
		initial := x
		for i := 1; i < y+2; i++ {
			if initial%y == 0 {
				break
			} else {
				initial = initial + x
			}

		}
		return initial
	} else {
		initial := y
		for i := 1; i < x+2; i++ {
			if initial%x == 0 {
				break
			} else {
				initial = initial + y
			}

		}
		return initial
	}
}

func GCD(x, y int64) int64 {
	if x*y == 0 {
		return MAX(x, y)
	} else {
		var l, q int64
		l = MAX(x, y)
		q = MIN(x, y)
		var m int64
		for l*q > 0 {
			a := l % q
			b := l - a
			cc := int64(b / q)
			remain := l - cc*q
			l = MAX(remain, q)
			q = MIN(remain, q)
			if l*q == 0 {
				m = l + q
				break
			}

		}
		return m
	}
}

func IsItPrime(x int) bool {
	if x < 10 {
		if x == 2 || x == 3 || x == 5 || x == 7 {
			return true
		} else {
			return false
		}
	} else {
		j := 0
		k := math.Sqrt(float64(x))
		for m := 3; m <= int(k); {
			if x%m == 0 {
				j = 1
				break
			}
			m = m + 2
		}
		if j == 1 {
			return false
		} else {
			return true
		}
	}
}

func PrimeFactorization(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

func NumberOfDivisors(n int) int {
	pfs := PrimeFactorization(n)

	num := 1
	for _, exponents := range pfs {
		num *= (exponents + 1)
	}

	return num
}

func KthPrime(x int) (y int) {
	if x == 1 {
		y = 2
	}
	if x == 2 {
		y = 3
	}
	if x > 2 {
		var sum int = 2
		begin := 5
		for sum < x+1 {
			if IsItPrime(begin) == true {
				sum++
			}
			if sum == x {
				y = begin
				break
			} else {
				if begin%6 == 1 {
					begin = begin + 4
				} else {
					begin = begin + 2
				}
			}
		}
	}
	return
}

func MODULE(x, y int) int {
	if x > y {
		return x - y
	} else {
		return y - x
	}
}

func BITAND(x, y int64) int64 {
	var ans int64
	begin := x
	sec := y
	var count int64 = 1
	for 1 == 1 {
		if (begin%2)*(sec%2) == 1 {
			ans = ans + count
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}

		} else {
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}
		}
	}
	return ans
}

func Sum(n, m int) int {
	var ans int

	if n == 1 {
		return 0
	} else {
		for i := 2; i < n; i++ {
			ans = (ans + Sum(i, m)) % m
		}
		for j := 2; j < n+1; j++ {
			ans = (ans + Sum(n/j, m)) % m
		}
		return ans
	}
}

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)
	for o := 0; o < t; o++ {
		var n int
		fmt.Fscan(input, &n)

		First := make([]byte, 0)
		Second := make([]byte, 0)

		fmt.Fscan(input, &First)

		fmt.Fscan(input, &Second)
		var Ans int

		ARRAY := make([]int, n)

		for i := 0; i < n-1; {
			if First[i]+Second[i] == 97 {
				Ans = Ans + 2
				ARRAY[i] = 1
				i = i + 1
			} else {
				if First[i]+Second[i] == 96 {
					if First[i+1]+Second[i+1] == 98 {
						Ans = Ans + 2
						ARRAY[i] = 1
						ARRAY[i+1] = 2
						i = i + 2
					} else {
						Ans = Ans + 1
						ARRAY[i] = 1

						i = i + 1
					}

				} else {
					if First[i]+Second[i] == 98 {
						if First[i+1]+Second[i+1] == 96 {
							Ans = Ans + 2
							ARRAY[i] = 1
							ARRAY[i+1] = 2
							i = i + 2
						} else {
							ARRAY[i] = 1
							i = i + 1

						}
					}
				}

			}
		}
		if First[n-1]+Second[n-1] == 97 {
			Ans = Ans + 2
		}
		if n == 1 {
			if First[n-1]+Second[n-1] == 96 {
				Ans = Ans + 2
			}
		} else {
			if First[n-1]+Second[n-1] == 96 {
				if First[n-2]+Second[n-2] == 98 {
					if ARRAY[n-1] != 2 {
						Ans = Ans + 1
					}
				} else {
					Ans = Ans + 1

				}
			}
		}
		fmt.Println(Ans)

	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)

// var m []int
// err = json.Unmarshal([]byte(r.FormValue("example")), &m)

// for i := 0; i < len(m); i++ {
// 	fmt.Println(m[i])
// }

// sort.Slice(arr, func(i, j int) bool {
// 	return arr[i] > arr[j]
// })

func MIN(x, y int64) int64 {
	if x > y {
		return y
	} else {
		return x
	}
}

func MINN(x, y int) int {
	if x > y {
		return y
	} else {
		return x
	}
}

func MKO(x, y int64) int64 {
	if x < y {
		return 0
	} else {
		return x - y + 1
	}
}

func MAX(x, y int64) int64 {
	if x > y {
		return x
	} else {
		return y
	}
}

func MAXX(x, y int) int {
	if x > y {
		return x
	} else {
		return y
	}
}

func LCM(x, y int) int {
	if x >= y {
		initial := x
		for i := 1; i < y+2; i++ {
			if initial%y == 0 {
				break
			} else {
				initial = initial + x
			}

		}
		return initial
	} else {
		initial := y
		for i := 1; i < x+2; i++ {
			if initial%x == 0 {
				break
			} else {
				initial = initial + y
			}

		}
		return initial
	}
}

func GCD(x, y int64) int64 {
	if x*y == 0 {
		return MAX(x, y)
	} else {
		var l, q int64
		l = MAX(x, y)
		q = MIN(x, y)
		var m int64
		for l*q > 0 {
			a := l % q
			b := l - a
			cc := int64(b / q)
			remain := l - cc*q
			l = MAX(remain, q)
			q = MIN(remain, q)
			if l*q == 0 {
				m = l + q
				break
			}

		}
		return m
	}
}

func IsItPrime(x int) bool {
	if x < 10 {
		if x == 2 || x == 3 || x == 5 || x == 7 {
			return true
		} else {
			return false
		}
	} else {
		j := 0
		k := math.Sqrt(float64(x))
		for m := 3; m <= int(k); {
			if x%m == 0 {
				j = 1
				break
			}
			m = m + 2
		}
		if j == 1 {
			return false
		} else {
			return true
		}
	}
}

func PrimeFactorization(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

func NumberOfDivisors(n int) int {
	pfs := PrimeFactorization(n)

	num := 1
	for _, exponents := range pfs {
		num *= (exponents + 1)
	}

	return num
}

func KthPrime(x int) (y int) {
	if x == 1 {
		y = 2
	}
	if x == 2 {
		y = 3
	}
	if x > 2 {
		var sum int = 2
		begin := 5
		for sum < x+1 {
			if IsItPrime(begin) == true {
				sum++
			}
			if sum == x {
				y = begin
				break
			} else {
				if begin%6 == 1 {
					begin = begin + 4
				} else {
					begin = begin + 2
				}
			}
		}
	}
	return
}

func MODULE(x, y int) int {
	if x > y {
		return x - y
	} else {
		return y - x
	}
}

func BITAND(x, y int64) int64 {
	var ans int64
	begin := x
	sec := y
	var count int64 = 1
	for 1 == 1 {
		if (begin%2)*(sec%2) == 1 {
			ans = ans + count
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}

		} else {
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}
		}
	}
	return ans
}

func Sum(n, m int) int {
	var ans int

	if n == 1 {
		return 0
	} else {
		for i := 2; i < n; i++ {
			ans = (ans + Sum(i, m)) % m
		}
		for j := 2; j < n+1; j++ {
			ans = (ans + Sum(n/j, m)) % m
		}
		return ans
	}
}

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)
	for o := 0; o < t; o++ {
		var n int
		fmt.Fscan(input, &n)

		First := make([]byte, 0)
		Second := make([]byte, 0)

		fmt.Fscan(input, &First)

		fmt.Fscan(input, &Second)
		var Ans int

		ARRAY := make([]int, n)

		for i := 0; i < n-1; {
			if First[i]+Second[i] == 97 {
				Ans = Ans + 2
				ARRAY[i] = 1
				i = i + 1
			} else {
				if First[i]+Second[i] == 96 {
					if First[i+1]+Second[i+1] == 98 {
						Ans = Ans + 2
						ARRAY[i] = 1
						ARRAY[i+1] = 2
						i = i + 2
					} else {
						Ans = Ans + 1
						ARRAY[i] = 1

						i = i + 1
					}

				} else {
					if First[i]+Second[i] == 98 {
						if First[i+1]+Second[i+1] == 96 {
							Ans = Ans + 2
							ARRAY[i] = 1
							ARRAY[i+1] = 2
							i = i + 2
						} else {
							ARRAY[i] = 1
							i = i + 1

						}
					}
				}

			}
		}
		if First[n-1]+Second[n-1] == 97 {
			Ans = Ans + 2
		}
		if n == 1 {
			if First[n-1]+Second[n-1] == 96 {
				Ans = Ans + 2
			}
		} else {
			if First[n-1]+Second[n-1] == 96 {
				if First[n-2]+Second[n-2] == 98 {
					if ARRAY[n-2] == 2 {
						Ans = Ans + 1
					}
				} else {
					Ans = Ans + 1

				}
			}
		}
		fmt.Println(Ans)

	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)

// var m []int
// err = json.Unmarshal([]byte(r.FormValue("example")), &m)

// for i := 0; i < len(m); i++ {
// 	fmt.Println(m[i])
// }

// sort.Slice(arr, func(i, j int) bool {
// 	return arr[i] > arr[j]
// })

func MIN(x, y int64) int64 {
	if x > y {
		return y
	} else {
		return x
	}
}

func MINN(x, y int) int {
	if x > y {
		return y
	} else {
		return x
	}
}

func MKO(x, y int64) int64 {
	if x < y {
		return 0
	} else {
		return x - y + 1
	}
}

func MAX(x, y int64) int64 {
	if x > y {
		return x
	} else {
		return y
	}
}

func MAXX(x, y int) int {
	if x > y {
		return x
	} else {
		return y
	}
}

func LCM(x, y int) int {
	if x >= y {
		initial := x
		for i := 1; i < y+2; i++ {
			if initial%y == 0 {
				break
			} else {
				initial = initial + x
			}

		}
		return initial
	} else {
		initial := y
		for i := 1; i < x+2; i++ {
			if initial%x == 0 {
				break
			} else {
				initial = initial + y
			}

		}
		return initial
	}
}

func GCD(x, y int64) int64 {
	if x*y == 0 {
		return MAX(x, y)
	} else {
		var l, q int64
		l = MAX(x, y)
		q = MIN(x, y)
		var m int64
		for l*q > 0 {
			a := l % q
			b := l - a
			cc := int64(b / q)
			remain := l - cc*q
			l = MAX(remain, q)
			q = MIN(remain, q)
			if l*q == 0 {
				m = l + q
				break
			}

		}
		return m
	}
}

func IsItPrime(x int) bool {
	if x < 10 {
		if x == 2 || x == 3 || x == 5 || x == 7 {
			return true
		} else {
			return false
		}
	} else {
		j := 0
		k := math.Sqrt(float64(x))
		for m := 3; m <= int(k); {
			if x%m == 0 {
				j = 1
				break
			}
			m = m + 2
		}
		if j == 1 {
			return false
		} else {
			return true
		}
	}
}

func PrimeFactorization(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

func NumberOfDivisors(n int) int {
	pfs := PrimeFactorization(n)

	num := 1
	for _, exponents := range pfs {
		num *= (exponents + 1)
	}

	return num
}

func KthPrime(x int) (y int) {
	if x == 1 {
		y = 2
	}
	if x == 2 {
		y = 3
	}
	if x > 2 {
		var sum int = 2
		begin := 5
		for sum < x+1 {
			if IsItPrime(begin) == true {
				sum++
			}
			if sum == x {
				y = begin
				break
			} else {
				if begin%6 == 1 {
					begin = begin + 4
				} else {
					begin = begin + 2
				}
			}
		}
	}
	return
}

func MODULE(x, y int) int {
	if x > y {
		return x - y
	} else {
		return y - x
	}
}

func BITAND(x, y int64) int64 {
	var ans int64
	begin := x
	sec := y
	var count int64 = 1
	for 1 == 1 {
		if (begin%2)*(sec%2) == 1 {
			ans = ans + count
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}

		} else {
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}
		}
	}
	return ans
}

func Sum(n, m int) int {
	var ans int

	if n == 1 {
		return 0
	} else {
		for i := 2; i < n; i++ {
			ans = (ans + Sum(i, m)) % m
		}
		for j := 2; j < n+1; j++ {
			ans = (ans + Sum(n/j, m)) % m
		}
		return ans
	}
}

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)
	for o := 0; o < t; o++ {
		var n int
		fmt.Fscan(input, &n)

		First := make([]byte, 0)
		Second := make([]byte, 0)

		fmt.Fscan(input, &First)

		fmt.Fscan(input, &Second)
		var Ans int

		for i := 0; i < n-1; {
			if First[i]+Second[i] == 97 {
				Ans = Ans + 2
				i = i + 1
			} else {
				if First[i]+Second[i] == 96 {
					if First[i+1]+Second[i+1] == 98 {
						Ans = Ans + 2
						i = i + 2
					} else {
						Ans = Ans + 1
						i = i + 1
					}

				} else {
					if First[i]+Second[i] == 98 {
						if First[i+1]+Second[i+1] == 96 {
							Ans = Ans + 2
							i = i + 2
						} else {
							i = i + 1

						}
					}
				}

			}
		}
		if First[n-1]+Second[n-1] == 97 {
			Ans = Ans + 2
		}
		if n == 1 {
			if First[n-1]+Second[n-1] == 96 {
				Ans++
			}
		} else {
			if First[n-1]+Second[n-1] == 96 {
				if First[n-2]+Second[n-2] != 98 {
					Ans++
				}
			}
		}
		fmt.Println(Ans)

	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)

// var m []int
// err = json.Unmarshal([]byte(r.FormValue("example")), &m)

// for i := 0; i < len(m); i++ {
// 	fmt.Println(m[i])
// }

// sort.Slice(arr, func(i, j int) bool {
// 	return arr[i] > arr[j]
// })

func MIN(x, y int64) int64 {
	if x > y {
		return y
	} else {
		return x
	}
}

func MINN(x, y int) int {
	if x > y {
		return y
	} else {
		return x
	}
}

func MKO(x, y int64) int64 {
	if x < y {
		return 0
	} else {
		return x - y + 1
	}
}

func MAX(x, y int64) int64 {
	if x > y {
		return x
	} else {
		return y
	}
}

func MAXX(x, y int) int {
	if x > y {
		return x
	} else {
		return y
	}
}

func LCM(x, y int) int {
	if x >= y {
		initial := x
		for i := 1; i < y+2; i++ {
			if initial%y == 0 {
				break
			} else {
				initial = initial + x
			}

		}
		return initial
	} else {
		initial := y
		for i := 1; i < x+2; i++ {
			if initial%x == 0 {
				break
			} else {
				initial = initial + y
			}

		}
		return initial
	}
}

func GCD(x, y int64) int64 {
	if x*y == 0 {
		return MAX(x, y)
	} else {
		var l, q int64
		l = MAX(x, y)
		q = MIN(x, y)
		var m int64
		for l*q > 0 {
			a := l % q
			b := l - a
			cc := int64(b / q)
			remain := l - cc*q
			l = MAX(remain, q)
			q = MIN(remain, q)
			if l*q == 0 {
				m = l + q
				break
			}

		}
		return m
	}
}

func IsItPrime(x int) bool {
	if x < 10 {
		if x == 2 || x == 3 || x == 5 || x == 7 {
			return true
		} else {
			return false
		}
	} else {
		j := 0
		k := math.Sqrt(float64(x))
		for m := 3; m <= int(k); {
			if x%m == 0 {
				j = 1
				break
			}
			m = m + 2
		}
		if j == 1 {
			return false
		} else {
			return true
		}
	}
}

func PrimeFactorization(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

func NumberOfDivisors(n int) int {
	pfs := PrimeFactorization(n)

	num := 1
	for _, exponents := range pfs {
		num *= (exponents + 1)
	}

	return num
}

func KthPrime(x int) (y int) {
	if x == 1 {
		y = 2
	}
	if x == 2 {
		y = 3
	}
	if x > 2 {
		var sum int = 2
		begin := 5
		for sum < x+1 {
			if IsItPrime(begin) == true {
				sum++
			}
			if sum == x {
				y = begin
				break
			} else {
				if begin%6 == 1 {
					begin = begin + 4
				} else {
					begin = begin + 2
				}
			}
		}
	}
	return
}

func MODULE(x, y int) int {
	if x > y {
		return x - y
	} else {
		return y - x
	}
}

func BITAND(x, y int64) int64 {
	var ans int64
	begin := x
	sec := y
	var count int64 = 1
	for 1 == 1 {
		if (begin%2)*(sec%2) == 1 {
			ans = ans + count
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}

		} else {
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}
		}
	}
	return ans
}

func Sum(n, m int) int {
	var ans int

	if n == 1 {
		return 0
	} else {
		for i := 2; i < n; i++ {
			ans = (ans + Sum(i, m)) % m
		}
		for j := 2; j < n+1; j++ {
			ans = (ans + Sum(n/j, m)) % m
		}
		return ans
	}
}

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)
	for o := 0; o < t; o++ {
		var n int
		fmt.Fscan(input, &n)

		First := make([]byte, 0)
		Second := make([]byte, 0)

		fmt.Fscan(input, &First)

		fmt.Fscan(input, &Second)
		var Ans int
		var B int

		for i := 0; i < n-1; {
			if First[i]+Second[i] == 97 {
				Ans = Ans + 2
				i = i + 1

			} else {
				if First[i]+Second[i] == 96 {
					if First[i+1]+Second[i+1] == 98 {
						Ans = Ans + 1
						B++
						i = i + 2
					} else {
						Ans = Ans + 1

						i = i + 1
					}

				} else {
					if First[i]+Second[i] == 98 {
						if First[i+1]+Second[i+1] == 96 {
							B++
							Ans = Ans + 1
							i = i + 2
						} else {
							i = i + 1

						}
					}
				}

			}
		}
		if First[n-1]+Second[n-1] == 97 {
			Ans = Ans + 2
		}

		if First[n-1]+Second[n-1] == 96 {
			Ans = Ans + 1
		}
		fmt.Println(Ans + B)

	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)

// var m []int
// err = json.Unmarshal([]byte(r.FormValue("example")), &m)

// for i := 0; i < len(m); i++ {
// 	fmt.Println(m[i])
// }

// sort.Slice(arr, func(i, j int) bool {
// 	return arr[i] > arr[j]
// })

func MIN(x, y int64) int64 {
	if x > y {
		return y
	} else {
		return x
	}
}

func MINN(x, y int) int {
	if x > y {
		return y
	} else {
		return x
	}
}

func MKO(x, y int64) int64 {
	if x < y {
		return 0
	} else {
		return x - y + 1
	}
}

func MAX(x, y int64) int64 {
	if x > y {
		return x
	} else {
		return y
	}
}

func MAXX(x, y int) int {
	if x > y {
		return x
	} else {
		return y
	}
}

func LCM(x, y int) int {
	if x >= y {
		initial := x
		for i := 1; i < y+2; i++ {
			if initial%y == 0 {
				break
			} else {
				initial = initial + x
			}

		}
		return initial
	} else {
		initial := y
		for i := 1; i < x+2; i++ {
			if initial%x == 0 {
				break
			} else {
				initial = initial + y
			}

		}
		return initial
	}
}

func GCD(x, y int64) int64 {
	if x*y == 0 {
		return MAX(x, y)
	} else {
		var l, q int64
		l = MAX(x, y)
		q = MIN(x, y)
		var m int64
		for l*q > 0 {
			a := l % q
			b := l - a
			cc := int64(b / q)
			remain := l - cc*q
			l = MAX(remain, q)
			q = MIN(remain, q)
			if l*q == 0 {
				m = l + q
				break
			}

		}
		return m
	}
}

func IsItPrime(x int) bool {
	if x < 10 {
		if x == 2 || x == 3 || x == 5 || x == 7 {
			return true
		} else {
			return false
		}
	} else {
		j := 0
		k := math.Sqrt(float64(x))
		for m := 3; m <= int(k); {
			if x%m == 0 {
				j = 1
				break
			}
			m = m + 2
		}
		if j == 1 {
			return false
		} else {
			return true
		}
	}
}

func PrimeFactorization(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

func NumberOfDivisors(n int) int {
	pfs := PrimeFactorization(n)

	num := 1
	for _, exponents := range pfs {
		num *= (exponents + 1)
	}

	return num
}

func KthPrime(x int) (y int) {
	if x == 1 {
		y = 2
	}
	if x == 2 {
		y = 3
	}
	if x > 2 {
		var sum int = 2
		begin := 5
		for sum < x+1 {
			if IsItPrime(begin) == true {
				sum++
			}
			if sum == x {
				y = begin
				break
			} else {
				if begin%6 == 1 {
					begin = begin + 4
				} else {
					begin = begin + 2
				}
			}
		}
	}
	return
}

func MODULE(x, y int) int {
	if x > y {
		return x - y
	} else {
		return y - x
	}
}

func BITAND(x, y int64) int64 {
	var ans int64
	begin := x
	sec := y
	var count int64 = 1
	for 1 == 1 {
		if (begin%2)*(sec%2) == 1 {
			ans = ans + count
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}

		} else {
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}
		}
	}
	return ans
}

func Sum(n, m int) int {
	var ans int

	if n == 1 {
		return 0
	} else {
		for i := 2; i < n; i++ {
			ans = (ans + Sum(i, m)) % m
		}
		for j := 2; j < n+1; j++ {
			ans = (ans + Sum(n/j, m)) % m
		}
		return ans
	}
}

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)
	for o := 0; o < t; o++ {

		var n int
		fmt.Fscan(input, &n)

		First := make([]byte, 0)
		Second := make([]byte, 0)

		fmt.Fscan(input, &First)

		fmt.Fscan(input, &Second)
		var Ans int

		if n > 1 {
			for i := 0; i < n-1; {
				if First[i]+Second[i] == 97 {
					Ans = Ans + 2
					i = i + 1
				} else {
					if First[i]+Second[i] == 96 {
						if First[i+1]+Second[i+1] == 98 {
							Ans = Ans + 2
							i = i + 2
						} else {
							Ans = Ans + 1
							i = i + 1
						}
					} else {
						if First[i+1]+Second[i+1] == 96 {
							Ans = Ans + 2
							i = i + 2
						} else {
							i = i + 1
						}

					}
				}

			}
			if First[n-1]+Second[n-1] == 96 {
				if First[n-2]+Second[n-2] != 98 {
					Ans = Ans + 1
				}
			}

			if First[n-1]+Second[n-1] == 97 {
				Ans = Ans + 2
			}
			fmt.Println(Ans)

		} else {
			if First[0]+Second[0] == 96 {
				fmt.Println(1)
			}
			if First[0]+Second[0] == 97 {
				fmt.Println(2)
			}
			if First[0]+Second[0] == 98 {
				fmt.Println(0)
			}
		}
	}
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	scanner.Scan()
	s := string(scanner.Text())

	scanner.Scan()
	k, err := strconv.Atoi(scanner.Text())
	if err != nil {
		return
	}

	ws := make([]int, 26)
	max_w := 0
	for i := 0; scanner.Scan(); i++ {
		a, err := strconv.Atoi(scanner.Text())
		if err != nil {
			return
		}
		ws[i] = a
		if ws[i] > max_w {
			max_w = ws[i]
		}
	}

	var value int = 0
	idx := 0
	for ; idx < len(s); idx++ {
		value += (ws[int(s[idx]-'a')] * (idx + 1))
	}
	for i := 0; i < k; i++ {
		idx++
		value += max_w * idx
	}

	fmt.Println(value)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

//Wrong
func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	s := []uint8(next())
	k := nextInt()
	w := make([]int, 26)
	value, max := 0, 0

	for i := 0; i < 26; i++ {
		w[i] = nextInt()
		if w[i] > max {
			max = w[i]
		}
	}

	for i := 0; i < len(s); i++ {
		value += w[s[i] - 'a'] * (i + 1)
	}

	for i := 0; i < k; i++ {
		value += max * (i + len(s) + 1)
	}

	println(value)
}

func next() string {
	if !scanner.Scan() {
		panic("Scan error")
	}
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(next())
	if err != nil {
		panic(err)
	}
	return n
}

func nextFloat() float64 {
	n, err := strconv.ParseFloat(next(), 64)
	if err != nil {
		panic(err)
	}
	return n
}

func println(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}

func print(a ...interface{}) {
	fmt.Fprint(writer, a...)
}

func printf(format string, a ...interface{}) {
	fmt.Fprintf(writer, format, a...)
}

package main

import "fmt"

func main() {
    var s string
    var k int
    var w [26]int
    fmt.Scan(&s)
    fmt.Scan(&k)
    max := -1
    for i := 0; i < 26; i++ {
        fmt.Scan(&w[i])
        if max < w[i] { max = w[i] }
    }
    ans := 0
    for i := 0; i < len(s); i++ {
        ans += (i+1)*w[s[i]-'a']
    }
    for i := 0; i < k; i++ {
        ans += (i+len(s)+1)*max
    }
    fmt.Println(ans)
}

package main

import (
	"fmt"
)

func main() {
	var s string
	var n, max, ans int
	val := make([]int, 26)
	fmt.Scan(&s, &n)
	for i := 0; i < 26; i++ {
		fmt.Scan(&val[i])
		if val[i] > max {
			max = val[i]
		}
	}
	for i, c := range s {
		ans += (i + 1) * val[c-'a']
	}
	for i := 1; i <= n; i++ {
		ans += (i + len(s)) * max
	}
	fmt.Println(ans)
}

package main

import (
	"fmt"
)

func main() {
	s := ""
	fmt.Scan(&s)

	k := 0
	fmt.Scan(&k)

	w := make([]int, 26, 26)
	m := 0
	for i := 0; i < 26; i++ {
		fmt.Scan(&w[i])
		if m < w[i] {
			m = w[i]
		}
	}

	ans := 0
	for i := 0; i < len(s); i++ {
		ans += (i + 1) * w[int(s[i]-'a')]
	}
	for i := 0; i < k; i++ {
		ans += m * (len(s) + i + 1)
	}

	fmt.Println(ans)
}

// 447B-mic
package main

import (
	"fmt"
	"math"
)

func main() {
	var s string
	var k, m int
	var w [26]int
	fmt.Scan(&s, &k)
	for i := 0; i < 26; i++ {
		fmt.Scan(&w[i])
		m = int(math.Max(float64(m), float64(w[i])))
	}

	l := int(len(s))
	res := 0
	for i := 1; i <= l; i++ {
		res += i * w[(int(s[i-1])-97)]
	}

	for i := (l + 1); i <= l+k; i++ {
		res += i * m
	}
	fmt.Println(res)
}

// cf447b project main.go
package main

import (
	"fmt"
)

func main() {
	var s string
	var n int
	var o [26]int
	fmt.Scan(&s, &n)
	for i := 0; i < 26; i++ {
		fmt.Scan(&o[i])
	}
	m := 0
	f := 0
	for i := 1; i <= len(s); i++ {
		f += i * o[s[i-1]-97]
	}
	for _, a := range o {
		if a > m {
			m = a
		}
	}

	for i := len(s) + 1; i <= len(s)+n; i++ {
		f += i * m
	}
	fmt.Println(f)
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

func main() {
	var s string

	reader := bufio.NewReader(os.Stdin)
	if _s, err := reader.ReadString('\n'); err != nil {
		if err != io.EOF {
			return
		}
	} else {
		s = _s
	}

	var k int
	if _, err := fmt.Scanf("%d\n", &k); err != nil {
		return
	}

	ws := make([]int, 26)
	max_w := 0
	for i := 0; i < 25; i++ {
		if _, err := fmt.Scanf("%d", &ws[i]); err != nil {
			return
		}
		if ws[i] > max_w {
			max_w = ws[i]
		}
	}
	if _, err := fmt.Scanf("%d\n", &ws[25]); err != nil {
		return
	}
	if ws[25] > max_w {
		max_w = ws[25]
	}

	var value int = 0
	idx := 0
	for ; s[idx] >= 'a' && s[idx] <= 'z'; idx++ {
		value += (ws[int(s[idx]-'a')] * (idx + 1))
	}
	for i := 0; i < k; i++ {
		idx++
		value += max_w * idx
	}

	fmt.Println(value)
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

func main() {
	var s string

	reader := bufio.NewReader(os.Stdin)
	if _s, err := reader.ReadString('\n'); err != nil {
		if err != io.EOF {
			return
		}
	} else {
		s = _s
	}

	var k int
	if _, err := fmt.Scanf("%d\n", &k); err != nil {
		return
	}

	ws := make([]int, 26)
	max_w := 0
	for i := 0; i < 26; i++ {
		if _, err := fmt.Scanf("%d", &ws[i]); err != nil {
			return
		}
		if ws[i] > max_w {
			max_w = ws[i]
		}
	}

	var value int = 0
	idx := 0
	for ; s[idx] >= 'a' && s[idx] <= 'z'; idx++ {
		value += (ws[int(s[idx]-'a')] * (idx + 1))
	}
	for i := 0; i < k; i++ {
		idx++
		value += max_w * idx
	}

	fmt.Println(value)
}

package main

import (
	"fmt"
)

func main() {
	var s string
	var n, max, ans int
	val := make([]int, 26)
	fmt.Scan(&s, &n)
	for i := 0; i < 26; i++ {
		fmt.Scan(&val[i])
		if val[i] > max {
			max = val[i]
		}
	}
	for i, c := range s {
		ans += (i + 1) * val[c-'a']
	}
	for i := 1; i <= n; i++ {
		ans += (i + len(s)) * max
	}
	fmt.Println(max)
	fmt.Println(ans)
}

package main

import (
	"fmt"
)

func main() {
	var s string
	var n, max, ans int
	val := make([]int, 26)
	fmt.Scan(&s, &n)
	for i := 0; i < 26; i++ {
		fmt.Scan(&val[i])
		if val[i] > max {
			max = val[i]
		}
	}
	for i, c := range s {
		ans += (i + 1) * val[c-'a']
	}
	for i := 1; i <= n; i++ {
		ans += (i + n) * max
	}
	fmt.Println(ans)
}