package main

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

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

	for i := 0; i < tc; i++ {
        n := readInt(in)
        a := readArrInt(in)
        i := 1
        for !isSorted(a) {
            if i % 2 == 1 {
                for j := 0; j < n-2; j += 2 {
                    if a[j] > a[j+1] {
                        a[j], a[j+1] = a[j+1], a[j]
                    }
                }
            } else {
                for j := 1; j < n-1; j += 2 {
                    if a[j] > a[j+1] {
                        a[j], a[j+1] = a[j+1], a[j]
                    }
                }
            }
            i++
        }
        fmt.Println(i-1)
	}
}

//Yeap this is faster
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 abs(a int) int {
    if a < 0 {
        return -a
    }
    return a
}

func isSorted(a []int) bool {
    for i := 0; i < len(a)-1; i++ {
        if a[i] > a[i+1] {
            return false
        }
    }
    return true
}

package main

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

type CF1561A struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1561A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1561A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1561A) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1561A) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1561A) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1561A
Date: 11/04/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1561/A
Problem: CF1561A
**/
func (in *CF1561A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()

		sol := 0
		arr := make([]int, n)

		order := true
		for i := 0; i < n; i++ {
			arr[i] = in.NextInt()
			if arr[i] != i+1 {
				order = false
			}
		}

		ite := 0

		for {
			ws := true
			for i:= 0;i<n;i++{
				if arr[i] != i+1{
					ws = false
				}
			}
			for i := ite; i < n-1; i += 2 {

				if arr[i] > arr[i+1] {
					arr[i], arr[i+1] = arr[i+1], arr[i]

				}
			}
			if ite == 0 {
				ite = 1
			} else {
				ite = 0
			}

			sol++
			if ws{
				break
			}

		}

		if order {
			fmt.Println(0)
		} else {
			fmt.Println(sol-1)
		}

	}
}

func NewCF1561A(r *bufio.Reader) *CF1561A {
	return &CF1561A{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1561A(bufio.NewReader(os.Stdin)).Run()
}

package main

import(
	"fmt"
)

func main(){
	var testcase int
	fmt.Scanf("%d\n", &testcase)

	for t:=0; t<testcase; t++{
		var n int
		fmt.Scanf("%d\n", &n)

		a := make([]int, n)
		for i:=0; i<n; i++{
			if i < n-1{
				fmt.Scanf("%d", &a[i])
			}else{
				fmt.Scanf("%d\n", &a[i])
			}
		}

		cnt := 0
		for i:=0; i<n; i++{
			flg := false
			for index, val := range a{
				if index+1 != val{
					flg = true
					cnt++
					break
				}
			}

			if !flg{
				break
			}

			for j:=i%2; j<n-1; j+= 2{
				if a[j] > a[j+1]{
					a[j], a[j+1] = a[j+1], a[j]
				}
			}
		}
		fmt.Printf("%d\n", cnt)
	}
}

package main

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

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 int
		fmt.Fscan(in, &n)

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

		var t int
		k := 1
		for !sort.IntsAreSorted(arr) {
			var i int
			if k%2 != 0 {
				i = 1
			} else {
				i = 2
			}

			for ; i < n; i += 2 {
				if arr[i-1] > arr[i] {
					arr[i], arr[i-1] = arr[i-1], arr[i]
				}
			}

			t++
			k++
		}

		fmt.Fprintln(out, t)
	}
}

package main

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

var in = NewIn()
var out = NewOut()

func main() {
	defer out.flush()

	tests()
	// solve()
}

/* --- Solution A --- */
func solve() {
	n := in.nextInt()

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

	cnt := 0
	for i := 0; ; i++ {
		ok := false
		if i%2 == 0 {
			for j := 0; j < n-1; j += 2 {
				if a[j] > a[j+1] {
					a[j], a[j+1] = a[j+1], a[j]
					ok = true
				}
			}
		} else {
			for j := 1; j < n-1; j += 2 {
				if a[j] > a[j+1] {
					a[j], a[j+1] = a[j+1], a[j]
					ok = true
				}
			}
		}
		if !ok && cnt == 0 {
			cnt++
		} else if !ok && cnt == 1 {
			out.println(i - 1)
			return
		} else if ok && cnt == 1 {
			cnt--
		}
	}
}

func tests() {
	tt := in.nextInt()
	for ; tt > 0; tt-- {
		solve()
	}
}

/* --- I/O --- */
type In struct {
	scanner *bufio.Scanner
}

func NewIn() *In {
	in := In{bufio.NewScanner(os.Stdin)}
	in.scanner.Split(bufio.ScanWords)
	return &in
}

func (in *In) nextInt() int {
	in.scanner.Scan()
	i, _ := strconv.Atoi(in.scanner.Text())
	return i
}

func (in *In) nextLong() int64 {
	in.scanner.Scan()
	i, _ := strconv.ParseInt(in.scanner.Text(), 10, 64)
	return i
}

func (in *In) next() string {
	in.scanner.Scan()
	return in.scanner.Text()
}

type Out struct {
	writer *bufio.Writer
}

func NewOut() *Out {
	out := Out{bufio.NewWriter(os.Stdout)}
	return &out
}

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

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

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

func (out *Out) flush() {
	out.writer.Flush()
}

package main

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

var (
	in = bufio.NewReader(os.Stdin)
)

func main() {
	var test int
	fmt.Fscan(in, &test)
	for i := 0; i < test; i++ {
		solve()
	}

}

func solve() {
	var ans = 0
	var currentInteration = 1
	var n int
	fmt.Fscan(in, &n)
	var arr = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &arr[i])
	}
	for {
		if sort.IntsAreSorted(arr) {
			fmt.Println(ans)
			return
		}
		if currentInteration%2 != 0 {
			for j := 0; j < len(arr)-2; j += 2 {
				do(j, arr)
			}

		} else {
			for j := 1; j < len(arr)-1; j+=2 {
				do(j, arr)
			}
		}
		currentInteration++
		ans++
	}
}

func do(i int, arr []int) {
	if i+1 < len(arr) && arr[i] > arr[i+1] {
		arr[i], arr[i+1] = arr[i+1], arr[i]
	}
}

//x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-TEMPLATE_STARTING-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-

type pair struct {
	a int64
	b int64
}

func sortPair(pairs []pair) {
	sort.Slice(pairs, func(i, j int) bool {
		return pairs[i].a < pairs[j].a
	})
}
func min(a int64, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func printArray(arr []int) {
	for i := 1; i < len(arr); i++ {
		fmt.Print(arr[i], " ")
	}
	fmt.Println()
}

type runeSort []rune

func (r runeSort) Len() int           { return len(r) }
func (r runeSort) Swap(i, j int)      { r[i], r[j] = r[j], r[i] }
func (r runeSort) Less(i, j int) bool { return r[i] < r[j] }

package main

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

func main() {
	defer wr.Flush()
	t := scanInt()
	for i := 0; i < t; i++ {
		n := scanInt()
		a := make([]int, n)
		for i := range a {
			a[i] = scanInt()
		}
		fmt.Fprintln(wr, solve(a))
	}
}

func solve(a []int) int {
	f := func(i int) {
		if a[i] > a[i+1] {
			a[i], a[i+1] = a[i+1], a[i]
		}
	}

	if sort.IntsAreSorted(a) {
		return 0
	}

	n := len(a)
	for i := 1; ; i++ {
		if i%2 == 1 {
			for j := 0; j <= n-3; j += 2 {
				f(j)
			}
		} else {
			for j := 1; j <= n-2; j += 2 {
				f(j)
			}
		}
		if sort.IntsAreSorted(a) {
			return i
		}
	}
}

var (
	sc *bufio.Scanner
	wr *bufio.Writer
)

func init() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	wr = bufio.NewWriter(os.Stdout)
}

func scanInt() int {
	sc.Scan()
	ret, _ := strconv.Atoi(sc.Text())
	return ret
}

package main

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

var (
	reader = bufio.NewReader(os.Stdin)
	t, n   int
)

func isSorted(a []int) bool {
	for i := range a {
		if a[i] != i+1 {
			return false
		}
	}
	return true
}

func solve(n int, a []int) int {
	var swap = 0
	for !isSorted(a) {
		for i := swap % 2; i+1 < n; i += 2 {
			if a[i] > a[i+1] {
				a[i], a[i+1] = a[i+1], a[i]
			}
		}
		swap++
	}
	return swap
}

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		fmt.Fscan(reader, &n)
		a := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &a[i])
		}
		fmt.Println(solve(n, a))
	}
}

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
}

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
		var OverAllDegrees int
		fmt.Fscan(input, &n)
		ARR := make([]int, n+1)
		Degree := make([]int, n+1)

		for i := 1; i < n+1; i++ {
			fmt.Fscan(input, &ARR[i])
			Degree[i] = MODULE(ARR[i], i)
			OverAllDegrees = OverAllDegrees + Degree[i]
		}

		var count int
		for j := 1; OverAllDegrees > 0; j++ {
			if j%2 == 1 {
				for m := 1; m <= n-2; {
					if ARR[m] > ARR[m+1] {
						OverAllDegrees = OverAllDegrees - Degree[m] - Degree[m+1]
						q := ARR[m]
						p := ARR[m+1]
						ARR[m] = p
						ARR[m+1] = q

						Degree[m] = MODULE(p, m)
						Degree[m+1] = MODULE(q, m+1)
						OverAllDegrees = OverAllDegrees + Degree[m] + Degree[m+1]

					}
					m = m + 2
				}
				count++

			}
			if j%2 == 0 {
				for m := 2; m <= n-1; {
					if ARR[m] > ARR[m+1] {
						OverAllDegrees = OverAllDegrees - Degree[m] - Degree[m+1]
						q := ARR[m]
						p := ARR[m+1]
						ARR[m] = p
						ARR[m+1] = q

						Degree[m] = MODULE(p, m)
						Degree[m+1] = MODULE(q, m+1)
						OverAllDegrees = OverAllDegrees + Degree[m] + Degree[m+1]

					}
					m = m + 2

				}
				count++

			}

			if OverAllDegrees == 0 {
				break
			}
		}
		fmt.Println(count)

	}
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		dd(a)
	}
}
func dd(a int) {
	arr := make([]int, a+1)
	for i := 1; i <= a; i++ {
		fmt.Scan(&arr[i])
	}
	if cc(arr) {
		fmt.Println("0")
		return
	}
	for i := 1; ; i++ {
		if i%2 != 0 {
			for j := 1; j <= a; j += 2 {
				if j+1 <= a && arr[j] > arr[j+1] {
					arr[j], arr[j+1] = arr[j+1], arr[j]
				}
			}
		} else {
			for j := 2; j <= a; j += 2 {
				if j+1 <= a && arr[j] > arr[j+1] {
					arr[j], arr[j+1] = arr[j+1], arr[j]
				}
			}
		}
		if cc(arr) {
			fmt.Println(i)
			return
		}
	}
}

//检验是否为排序好的
func cc(arr []int) bool {
	for i := 1; i < len(arr); i++ {
		if arr[i-1] > arr[i] {
			return false
		}
	}
	return true
}

package main

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

var _, _, _ = main, rw, do

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()
	rw(r, w)
}

func rw(r io.Reader, w io.Writer) {
	var t int
	var n int
	var a = make([]int, 1e3+1)
	fmt.Fscan(r, &t)
	for ti := 0; ti < t; ti++ {
		fmt.Fscan(r, &n)
		for i := 1; i <= n; i++ {
			fmt.Fscan(r, &a[i])
		}
		w1 := do(n, a)
		fmt.Fprintln(w, w1)
	}
}

func sorted(n int, a []int) bool {
	for i := 1; i <= n; i++ {
		if a[i] != i {
			return false
		}
	}
	return true
}

func do(n int, a []int) int {
	r := 0
	for !sorted(n, a) {
		r++
		k1, k2 := 1, 2
		if r%2 == 0 {
			k1, k2 = 2, 1
		}
		for i := k1; i <= n-k2; i += 2 {
			if a[i] > a[i+1] {
				a[i], a[i+1] = a[i+1], a[i]
			}
		}
	}
	return r
}

package main

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

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

	var T, n int

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

	for t := 0; t < T; t++ {
		fmt.Fscanf(r, "%d\n", &n)

		arr := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscanf(r, "%d", &arr[i])
		}
		fmt.Fscanf(r, "\n")

		i := 0
		for {
			j := 1
			for ; j < n; j++ {
				if arr[j-1] > arr[j] {
					break
				}
			}

			if j == n {
				break
			}

			for j := i % 2; j < n-1; j += 2 {
				if arr[j] > arr[j+1] {
					arr[j], arr[j+1] = arr[j+1], arr[j]
				}
			}

			i++
		}

		fmt.Println(i)
	}
}

package main

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

type CF1561A struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1561A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1561A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1561A) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1561A) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1561A) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1561A
Date: 11/04/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1561/A
Problem: CF1561A
**/
func (in *CF1561A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()

		sol := 0
		arr := make([]int, n)

		order := true
		for i := 0; i < n; i++ {
			arr[i] = in.NextInt()
			if arr[i] != i+1 {
				order = false
			}
		}

		ite := 0

		for {
			ws := true
			for i := ite; i < n-1; i += 2 {
				if arr[i] > arr[i+1] {
					arr[i], arr[i+1] = arr[i+1], arr[i]
					ws = false

				}
			}
			if ite == 0 {
				ite = 1
			} else {
				ite = 0
			}

			sol++
			if ws {
				break
			}

		}

		if order {
			fmt.Println(0)
		} else {
			fmt.Println(sol-1)
		}

	}
}

func NewCF1561A(r *bufio.Reader) *CF1561A {
	return &CF1561A{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1561A(bufio.NewReader(os.Stdin)).Run()
}

package main

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

type CF1561A struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1561A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1561A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1561A) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1561A) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1561A) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1561A
Date: 11/04/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1561/A
Problem: CF1561A
**/
func (in *CF1561A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()

		sol := 0
		arr := make([]int, n)
		for i := 0; i < n; i++ {
			arr[i] = in.NextInt()
		}

		ite := 0
		order := false
		for {
			ws := true
			for i := ite; i < n-1; i += 2 {
				if arr[i] > arr[i+1] {
					arr[i], arr[i+1] = arr[i+1], arr[i]
					ws = false

				}
			}
			if ite == 0 {
				ite = 1
			} else {
				ite = 0
			}
			if ws && sol == 0 {
				order = true
			}
			sol++
			if ws {
				break
			}

		}

		if order {
			fmt.Println(0)
		} else {
			fmt.Println(sol-1)
		}

	}
}

func NewCF1561A(r *bufio.Reader) *CF1561A {
	return &CF1561A{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1561A(bufio.NewReader(os.Stdin)).Run()
}

package main

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

type CF1561A struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1561A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1561A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1561A) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1561A) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1561A) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1561A
Date: 11/04/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1561/A
Problem: CF1561A
**/
func (in *CF1561A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()

		sol := 0
		arr := make([]int, n)
		for i := 0; i < n; i++ {
			arr[i] = in.NextInt()
		}

		for {
			ws := true
			for i := 1; i < n; i++ {
				if arr[i-1] > arr[i] {
					arr[i-1], arr[i] = arr[i], arr[i-1]
					ws = false
				}
			}

			if ws {
				break
			}
			sol++
		}

		if sol > 0 {
			sol++
		}
		fmt.Println(sol)

	}
}

func NewCF1561A(r *bufio.Reader) *CF1561A {
	return &CF1561A{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1561A(bufio.NewReader(os.Stdin)).Run()
}

package main

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

type CF1561A struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1561A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1561A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1561A) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1561A) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1561A) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1561A
Date: 11/04/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1561/A
Problem: CF1561A
**/
func (in *CF1561A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()

		sol := 0
		for i := 0; i < n; i++ {
			val := in.NextInt()
			s := int(math.Abs(float64(i + 1 - val)))
			if s > sol {
				sol = s
			}
		}

		if sol ==0 {
			fmt.Println(sol)
		}else {
			fmt.Println(sol+1)
		}

	}
}

func NewCF1561A(r *bufio.Reader) *CF1561A {
	return &CF1561A{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1561A(bufio.NewReader(os.Stdin)).Run()
}

package main

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

type CF1561A struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1561A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1561A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1561A) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1561A) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1561A) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1561A
Date: 11/04/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1561/A
Problem: CF1561A
**/
func (in *CF1561A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		index := 1
		max := 0
		for i := 0; i < n; i++ {
			val := in.NextInt()
			if max < val {
				max = val
				index = i + 1
			}
		}

		if index != n{
			fmt.Println(n - index+1)
		}else {
			fmt.Println(0)
		}

	}
}

func NewCF1561A(r *bufio.Reader) *CF1561A {
	return &CF1561A{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1561A(bufio.NewReader(os.Stdin)).Run()
}

package main

import(
	"fmt"
)

func main(){
	var testcase int
	fmt.Scanf("%d\n", &testcase)

	for t:=0; t<testcase; t++{
		var n int
		fmt.Scanf("%d\n", &n)

		a := make([]int, n)
		for i:=0; i<n; i++{
			if i < n-1{
				fmt.Scanf("%d", &a[i])
			}else{
				fmt.Scanf("%d\n", &a[i])
			}
		}

		cnt := 0
		for i:=0; i<n; i++{
			flg := 0
			for j:=i%2; j<n-1; j+= 2{
				if a[j] > a[j+1]{
					a[j], a[j+1] = a[j+1], a[j]
					flg = 1
				}
			}
			if flg == 1{
				cnt++
			}
		}
		fmt.Printf("%d\n", cnt)
	}
}

package main

import(
	"fmt"
)

func main(){
	var testcase int
	fmt.Scanf("%d\n", &testcase)

	for t:=0; t<testcase; t++{
		var n int
		fmt.Scanf("%d\n", &n)

		a := make([]int, n)
		for i:=0; i<n; i++{
			fmt.Scanf("%d\n", &a[i])
		}

		cnt := 0
		for i:=0; i<n; i++{
			flg := 0
			for j:=i%2; j<n-1; j+= 2{
				if a[j] > a[j+1]{
					a[j], a[j+1] = a[j+1], a[j]
					flg = 1
				}
			}
			if flg == 1{
				cnt++
			}
		}
		fmt.Println(cnt)
	}
}

package main

import(
	"fmt"
)

func main(){
	var testcase int
	fmt.Scanf("%d ", &testcase)

	for t:=0; t<testcase; t++{
		var n int
		fmt.Scanf("%d ", &n)

		a := make([]int, n)
		for i:=0; i<n; i++{
			fmt.Scanf("%d ", &a[i])
		}

		cnt := 0
		for i:=0; i<n; i++{
			flg := 0
			for j:=i%2; j<n-1; j+= 2{
				if a[j] > a[j+1]{
					a[j], a[j+1] = a[j+1], a[j]
					flg = 1
				}
			}
			if flg == 1{
				cnt++
			}
		}
		fmt.Println(cnt)
	}
}

package main

import(
	"fmt"
)

func main(){
	var testcase int
	fmt.Scanf("%d", &testcase)

	for t:=0; t<testcase; t++{
		var n int
		fmt.Scanf("%d", &n)

		a := make([]int, n)
		for i:=0; i<n; i++{
			fmt.Scanf("%d", &a[i])
		}

		cnt := 0
		for i:=0; i<n; i++{
			flg := 0
			for j:=i%2; j<n-1; j+= 2{
				if a[j] > a[j+1]{
					a[j], a[j+1] = a[j+1], a[j]
					flg = 1
				}
			}
			if flg == 1{
				cnt++
			}
		}
		fmt.Println(cnt)
	}
}

package main

import(
	"fmt"
)

func main(){
	var testcase int
	fmt.Scanln(&testcase)

	for t:=0; t<testcase; t++{
		var n int
		fmt.Scanf("%v", &n)

		a := make([]int, n)
		for i:=0; i<n; i++{
			fmt.Scanf("%v", &a[i])
		}

		cnt := 0
		for i:=0; i<n; i++{
			flg := false
			for j:=i%2; j<n-1; j+= 2{
				if a[j] > a[j+1]{
					a[j], a[j+1] = a[j+1], a[j]
					flg = true;
				}
			}
			if flg{
				cnt++
			}
		}
		fmt.Println(cnt)
	}
}

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 < T; t++ {
		var n int
		fmt.Fscan(in, &n)

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

		var t int
		k := 1
		swapped := true
		for swapped {
			swapped = false
			var i int
			if k%2 != 0 {
				i = 1
			} else {
				i = 2
			}

			for ; i < n; i += 2 {
				if arr[i-1] > arr[i] {
					arr[i], arr[i-1] = arr[i-1], arr[i]
					swapped = true
				}
			}

			if swapped {
				t++
				k++
			}
		}

		fmt.Fprintln(out, t)
	}
}

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 < T; t++ {
		var n int
		fmt.Fscan(in, &n)

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

		var t int
		swapped := true
		for swapped {
			swapped = false
			for i := 1; i < n; i++ {
				if arr[i-1] > arr[i] {
					arr[i], arr[i-1] = arr[i-1], arr[i]
					swapped = true
					i++
				}
			}

			if swapped {
				t++
			}
		}

		fmt.Fprintln(out, t)
	}
}

package main

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

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

	for i := 0; i < tc; i++ {
        n := readInt(in)
        track := make([]int, n)
        arr := readArrInt(in)
        for j, a := range arr {
            track[j] = abs(a-j)
        }
        max := track[0]
        for _, t := range track {
            if t > max {
                max = t
            }
        }
        if max == 1 {
            fmt.Println(0)
        } else {
            fmt.Println(max)
        }
	}
}

//Yeap this is faster
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 abs(a int) int {
    if a < 0 {
        return -a
    }
    return a
}

package main

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

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

	for i := 0; i < tc; i++ {
        n := readInt(in)
        track := make([]int, n)
        arr := readArrInt(in)
        for j, a := range arr {
            track[j] = a-j
        }
        max := track[0]
        for _, t := range track {
            if t > max {
                max = t
            }
        }
        if max == 1 {
            fmt.Println(0)
        } else {
            fmt.Println(max)
        }
	}
}

//Yeap this is faster
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
}

package main

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

var in = NewIn()
var out = NewOut()

func main() {
	defer out.flush()

	tests()
	// solve()
}

/* --- Solution A --- */
func solve() {
	n := in.nextInt()

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

	for i := 0; ; i++ {
		ok := false
		if i%2 == 0 {
			for j := 0; j < n-1; j += 2 {
				if a[j] > a[j+1] {
					a[j], a[j+1] = a[j+1], a[j]
					ok = true
				}
			}
		} else {
			for j := 1; j < n-1; j += 2 {
				if a[j] > a[j+1] {
					a[j], a[j+1] = a[j+1], a[j]
					ok = true
				}
			}
		}
		if !ok {
			out.println(i)
			return
		}
	}
}

func tests() {
	tt := in.nextInt()
	for ; tt > 0; tt-- {
		solve()
	}
}

/* --- I/O --- */
type In struct {
	scanner *bufio.Scanner
}

func NewIn() *In {
	in := In{bufio.NewScanner(os.Stdin)}
	in.scanner.Split(bufio.ScanWords)
	return &in
}

func (in *In) nextInt() int {
	in.scanner.Scan()
	i, _ := strconv.Atoi(in.scanner.Text())
	return i
}

func (in *In) nextLong() int64 {
	in.scanner.Scan()
	i, _ := strconv.ParseInt(in.scanner.Text(), 10, 64)
	return i
}

func (in *In) next() string {
	in.scanner.Scan()
	return in.scanner.Text()
}

type Out struct {
	writer *bufio.Writer
}

func NewOut() *Out {
	out := Out{bufio.NewWriter(os.Stdout)}
	return &out
}

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

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

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

func (out *Out) flush() {
	out.writer.Flush()
}

package main

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

var in = NewIn()
var out = NewOut()

func main() {
	defer out.flush()

	tests()
	// solve()
}

/* --- Solution A --- */
func solve() {
	n := in.nextInt()

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

	answer := 0
	for i := 0; i < n; i++ {
		if a[i]-1 != i {
			abs := int(math.Abs(float64(a[i] - i)))
			if abs > answer {
				answer = abs
			}
		}
	}

	out.println(answer)
}

func tests() {
	tt := in.nextInt()
	for ; tt > 0; tt-- {
		solve()
	}
}

/* --- I/O --- */
type In struct {
	scanner *bufio.Scanner
}

func NewIn() *In {
	in := In{bufio.NewScanner(os.Stdin)}
	in.scanner.Split(bufio.ScanWords)
	return &in
}

func (in *In) nextInt() int {
	in.scanner.Scan()
	i, _ := strconv.Atoi(in.scanner.Text())
	return i
}

func (in *In) nextLong() int64 {
	in.scanner.Scan()
	i, _ := strconv.ParseInt(in.scanner.Text(), 10, 64)
	return i
}

func (in *In) next() string {
	in.scanner.Scan()
	return in.scanner.Text()
}

type Out struct {
	writer *bufio.Writer
}

func NewOut() *Out {
	out := Out{bufio.NewWriter(os.Stdout)}
	return &out
}

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

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

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

func (out *Out) flush() {
	out.writer.Flush()
}

package main

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

var (
	out = bufio.NewWriter(os.Stdout)
	in  = bufio.NewReader(os.Stdin)
	arr []string
)

func main() {
	var test int
	fmt.Fscan(in, &test)
	for i := 0; i < test; i++ {
		solve()
	}

}

func solve() {
	var n int
	fmt.Fscan(in, &n)
	var arr = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &arr[i])
	}
	var isSorted = false
	var ans = 0
	for isSorted == false {
		tempIsSorted := true
		for i := 1; i < n; i++ {
			if arr[i] < arr[i-1] {
				arr[i-1], arr[i] = arr[i], arr[i-1]
				tempIsSorted = false
				i++
			}
		}
		//fmt.Println(arr)
		if tempIsSorted == false {
			ans++
		}
		isSorted = tempIsSorted
	}
	//fmt.Println(arr)
	fmt.Println(ans)
}

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

func lcsMethod(s1 string, s2 string, s1Index int, s2Index int, tempAns int) int {
	if s1Index >= len(s1) || s2Index >= len(s2) {
		return tempAns
	}
	if s1[s1Index] == s2[s2Index] {
		tempAns = lcsMethod(s1, s2, s2Index+1, s2Index+1, tempAns+1)
	} else {
		tempAns = int(math.Max(float64(tempAns), math.Max(float64(lcsMethod(s1, s2, s1Index+1, s2Index, tempAns)), float64(lcsMethod(s1, s2, s1Index, s2Index+1, tempAns)))))
	}
	return tempAns
}

func printArray(arr []int) {
	for i := 1; i < len(arr); i++ {
		fmt.Print(arr[i], " ")
	}
	fmt.Println()
}

type runeSort []rune

func (r runeSort) Len() int           { return len(r) }
func (r runeSort) Swap(i, j int)      { r[i], r[j] = r[j], r[i] }
func (r runeSort) Less(i, j int) bool { return r[i] < r[j] }

package main

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

func main() {
	defer wr.Flush()
	t := scanInt()
	for i := 1; i < t; i++ {
		n := scanInt()
		a := make([]int, n)
		for i := range a {
			a[i] = scanInt()
		}
		fmt.Fprintln(wr, solve(a))
	}
}

func solve(a []int) int {
	f := func(i int) {
		if a[i] > a[i+1] {
			a[i], a[i+1] = a[i+1], a[i]
		}
	}

	if sort.IntsAreSorted(a) {
		return 0
	}

	n := len(a)
	for i := 1; ; i++ {
		if i%2 == 1 {
			for j := 0; j <= n-3; j += 2 {
				f(j)
			}
		} else {
			for j := 1; j <= n-2; j += 2 {
				f(j)
			}
		}
		if sort.IntsAreSorted(a) {
			return i
		}
	}
}

var (
	sc *bufio.Scanner
	wr *bufio.Writer
)

func init() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	wr = bufio.NewWriter(os.Stdout)
}

func scanInt() int {
	sc.Scan()
	ret, _ := strconv.Atoi(sc.Text())
	return ret
}


// Author: sighduck
// URL: https://codeforces.com/contest/1121/problem/B

package main

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

func Solve(n int, a []int) int {
	sumCount := make(map[int]int)
	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			sum := a[i] + a[j]
			sumCount[sum] += 1
		}
	}
	maxCount := 0
	for _, count := range sumCount {
		if count > maxCount {
			maxCount = count
		}
	}
	return maxCount
}

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

	var n int
	fmt.Fscanf(reader, "%d\n", &n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(reader, "%d", &a[i])
	}

	fmt.Fprintf(writer, "%d\n", Solve(n, a))
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	n := 0
	fmt.Fscanf(in, "%d\n", &n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(in, "%d", &a[i])
	}
	sum := make(map[int]int)
	ans := 0
	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			if i != j {
				sum[a[i]+a[j]]++
				if sum[a[i]+a[j]] > ans {
					ans = sum[a[i]+a[j]]
				}
			}
		}
	}
	fmt.Fprintf(out, "%d\n", ans)
	return
}

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

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


package main

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

func abs(n int) int {
	if n < 0 {
		return n * -1
	}
	return n
}

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 int
		var s1, s2 string
		fmt.Fscan(in, &n, &s1, &s2)

		comp := func(s string) [][]int {
			res := [][]int{}
			r := []int{0, 0}
			for i := 1; i < len(s); i++ {
				if s[i] != s[i-1] {
					res = append(res, r)
					r = []int{i, i}
				}
				r[1] = i
			}
			res = append(res, r)
			return res
		}

		r1 := comp(s1)
		r2 := comp(s2)
		if s1[0] != s2[0] || len(r1) != len(r2) {
			fmt.Fprintln(out, -1)
			continue
		}

		var tot int
		for i := range r1 {
			tot += abs(r1[i][0]-r2[i][0]) + abs(r1[i][1]-r2[i][1])
		}
		fmt.Fprintln(out, tot/2)
	}
}

package main

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

func island(a []rune, i int) (int, int) {
	for i < len(a) && a[i] == '0' {
		i++
	}
	j := i
	for j < len(a) && a[j] == '1' {
		j++
	}
	return i, j
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func solve() {
	n := get()
	s := []rune(gets())
	t := []rune(gets())

	defer line()

	if s[0] != t[0] || s[n-1] != t[n-1] {
		put(-1)
		return
	}

	var i, j, it, jt int
	var count int64
	for {
		i, j = island(s, j)
		it, jt = island(t, jt)
		if i == n || it == n {
			if i == n && it == n {
				put64(count)
				return
			}
			put(-1)
			return
		}

		count += int64(abs(i-it) + abs(j-jt))
	}
}

const (
	once       = false
	maxBufSize = 10000000
)

var (
	splitFunc = bufio.ScanWords
)

func main() {
	in = bufio.NewScanner(bufio.NewReader(os.Stdin))
	in.Split(splitFunc)
	in.Buffer(make([]byte, maxBufSize), maxBufSize)

	out = bufio.NewWriter(os.Stdout)
	defer out.Flush()

	if once {
		solve()
		return
	}

	t := get()
	for t > 0 {
		solve()
		t--
	}
}

var (
	in  *bufio.Scanner
	out *bufio.Writer
)

func get() int {
	x, _ := strconv.Atoi(gets())
	return x
}

func get64() int64 {
	x, _ := strconv.ParseInt(gets(), 10, 64)
	return x
}

func getf() float64 {
	x, _ := strconv.ParseFloat(gets(), 64)
	return x
}

func gets() string {
	in.Scan()
	return in.Text()
}

func putc(c rune) {
	out.WriteRune(c)
}

func put(x int) {
	out.WriteString(strconv.Itoa(x))
}

func put64(x int64) {
	out.WriteString(strconv.FormatInt(x, 10))
}

func puts(s string) {
	out.WriteString(s)
}

func yn(y bool) {
	if y {
		yes()
		return
	}
	no()
}

func yes() {
	puts("YES")
	line()
}

func no() {
	puts("NO")
	line()
}

//func putf(x float64) {
//	out.WriteString(strconv.FormatFloat(x))
//}

func line() {
	out.WriteRune('\n')
}

func space() {
	out.WriteRune(' ')
}

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 := readNum(reader)
		s := readString(reader)
		x := readString(reader)
		res := solve(s[:n], x[:n])
		buf.WriteString(fmt.Sprintf("%d\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 readNInt64s(reader *bufio.Reader, n int) []int64 {
	res := make([]int64, n)
	s, _ := reader.ReadBytes('\n')

	var pos int

	for i := 0; i < n; i++ {
		pos = readInt64(s, pos, &res[i]) + 1
	}

	return res
}

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

func solve(s string, t string) int {
	// s[i-1] != s[i+1], then can toggle it s[i]
	// no way to change s[0] & s[n-1], otherwise seems always has a solution?
	n := len(s)

	if s == t {
		return 0
	}

	if s[0] != t[0] || s[n-1] != t[n-1] {
		return -1
	}

	if !can_change(s) {
		return -1
	}

	// 每次变化影响的是什么呢？
	// 在变化前 s[i] = s[i-1], 变化后肯定 s[i] = s[i+1]， 且 s[i] != s[i-1], 反之亦然
	// 也就是说无论怎么变化 s[i] != s[i-1] 的个数不会减少，
	// 似乎就是在移动 s[i] != s[i-1]的关系到正确的位置
	// 构造两个新的字符串 a[i] = 1, when s[i+1] != s[i]
	//             和  b[i] = 1, when t[i+1] != t[i]

	var a []int

	for i := 1; i < n; i++ {
		if s[i] != s[i-1] {
			a = append(a, i)
		}
	}

	var b []int

	for i := 1; i < n; i++ {
		if t[i] != t[i-1] {
			b = append(b, i)
		}
	}

	if len(a) != len(b) {
		return -1
	}

	var res int

	for i := 0; i < len(a); i++ {
		res += abs(a[i] - b[i])
	}
	return res
}

func abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

func can_change(s string) bool {
	for i := 1; i+1 < len(s); i++ {
		if s[i-1] != s[i+1] {
			return true
		}
	}
	return false
}

package main

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

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

	var T, n int
	var s, t string
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &s, &t)
		if s[0] != t[0] || s[n-1] != t[n-1] {
			Fprintln(out, -1)
			continue
		}
		ans := int64(0)
		i, j := 0, 0
		for i < n && j < n {
			i0 := i
			for i++; i < n && s[i] == s[i-1]; i++ {
			}
			j0 := j
			for j++; j < n && t[j] == t[j-1]; j++ {
			}
			if t[j-1] == '1' {
				ans += int64(abs(i0-j0) + abs(i-j))
			}
		}
		if i < n || j < n {
			ans = -1
		}
		Fprintln(out, ans)
	}
}

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

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

package main

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

func main() {
	CF1705D(os.Stdin, os.Stdout)
}
func CF1705D(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 int64
		fmt.Fscan(r, &n)
		a, b := make([]byte, n), make([]byte, n)
		fmt.Fscan(r, &a, &b)

		if a[0] != b[0] || a[n-1] != b[n-1] {
			fmt.Fprintln(w, "-1")
			continue
		}
		num, ans := int64(0), int64(0)
		for i := int64(1); i < n; i++ {
			if a[i] != a[i-1] {
				num++
			}
			if b[i] != b[i-1] {
				num--
			}
			ans += abs(num)
		}
		if num != 0 {
			fmt.Fprintln(w, "-1")
		} else {
			fmt.Fprintln(w, ans)
		}

	}
}

func abs(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

package main

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

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

func CF1705D(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 int64
		fmt.Fscan(r, &n)
		a, b := make([]byte, n), make([]byte, n)
		fmt.Fscan(r, &a, &b)

		if a[0] != b[0] || a[n-1] != b[n-1] {
			fmt.Fprintln(w, "-1")
			continue
		}
		num, ans := int64(0), int64(0)
		for i := int64(1); i < n-2; i++ {
			if a[i] != a[i-1] {
				num++
			}
			if b[i] != b[i-1] {
				num--
			}
			ans += abs(num)
		}
		if num != 0 {
			fmt.Fprintln(w, "-1")
		} else {
			fmt.Fprintln(w, ans)
		}

	}
}

func abs(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

package main

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

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

func CF1705D(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 int64
		fmt.Fscan(r, &n)
		a, b := make([]byte, n), make([]byte, n)
		fmt.Fscan(r, &a, &b)

		if a[0] != b[0] || a[n-1] != b[n-1] {
			fmt.Fprintln(w, "-1")
			continue
		}
		num, ans := int64(0), int64(0)
		for i := int64(1); i < n-1; i++ {
			if a[i] != a[i-1] {
				num++
			}
			if b[i] != b[i-1] {
				num--
			}
			ans += abs(num)

		}
		if num != 0 {
			fmt.Fprintln(w, "-1")
		} else {
			fmt.Fprintln(w, "ans")
		}

	}
}

func abs(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

package main

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

func island(a []rune, i int) (int, int) {
	for i < len(a) && a[i] == '0' {
		i++
	}
	j := i
	for j < len(a) && a[j] == '1' {
		j++
	}
	return i, j
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func solve() {
	n := get()
	s := []rune(gets())
	t := []rune(gets())

	defer line()

	if s[0] != t[0] || s[n-1] != t[n-1] {
		put(-1)
		return
	}

	var i, j, it, jt, count int
	for {
		i, j = island(s, j)
		it, jt = island(t, jt)
		if i == n || it == n {
			if i == n && it == n {
				put(count)
				return
			}
			put(-1)
			return
		}

		count += abs(i-it) + abs(j-jt)
	}
}

const (
	once       = false
	maxBufSize = 10000000
)

var (
	splitFunc = bufio.ScanWords
)

func main() {
	in = bufio.NewScanner(bufio.NewReader(os.Stdin))
	in.Split(splitFunc)
	in.Buffer(make([]byte, maxBufSize), maxBufSize)

	out = bufio.NewWriter(os.Stdout)
	defer out.Flush()

	if once {
		solve()
		return
	}

	t := get()
	for t > 0 {
		solve()
		t--
	}
}

var (
	in  *bufio.Scanner
	out *bufio.Writer
)

func get() int {
	x, _ := strconv.Atoi(gets())
	return x
}

func get64() int64 {
	x, _ := strconv.ParseInt(gets(), 10, 64)
	return x
}

func getf() float64 {
	x, _ := strconv.ParseFloat(gets(), 64)
	return x
}

func gets() string {
	in.Scan()
	return in.Text()
}

func putc(c rune) {
	out.WriteRune(c)
}

func put(x int) {
	out.WriteString(strconv.Itoa(x))
}

func put64(x int64) {
	out.WriteString(strconv.FormatInt(x, 10))
}

func puts(s string) {
	out.WriteString(s)
}

func yn(y bool) {
	if y {
		yes()
		return
	}
	no()
}

func yes() {
	puts("YES")
	line()
}

func no() {
	puts("NO")
	line()
}

//func putf(x float64) {
//	out.WriteString(strconv.FormatFloat(x))
//}

func line() {
	out.WriteRune('\n')
}

func space() {
	out.WriteRune(' ')
}


package main

import (
	"bytes"
	"fmt"
	"io/ioutil"
	"os"
	"sort"
)

func main() {
	var n int
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewReader(bs)
	fmt.Fscanf(reader, "%d", &n)
	primes := make([]int, 0, n+1)
	sieve := make([]int, n+1)
	writer := bytes.NewBuffer(make([]byte, 0, 10000000))
	for i := 2; i <= n; i++ {
		if sieve[i] == 0 {
			sieve[i] = 1
			primes = append(primes, i)
		}
		for j := 0; j < len(primes); j++ {
			comp := i * primes[j]
			if comp > n {
				break
			}
			sieve[comp] = i
			if i%primes[j] == 0 {
				break
			}
		}
	}
	sort.Ints(sieve)
	for i := 2; i <= n; i++ {
		fmt.Fprintf(writer, "%d ", sieve[i])
	}
	writer.WriteTo(os.Stdout)
}

package main

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

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

	var n int
	Fscan(in, &n)
	vis := make([]bool, n+1)
	cnts := make([]int, n/2+1)
	for i := 2; i <= n; i++ {
		if !vis[i] {
			for j := i; j <= n; j += i {
				if !vis[j] {
					vis[j] = true
					cnts[j/i]++
				}
			}
		}
	}
	for i, c := range cnts {
		for ; c > 0; c-- {
			Fprint(out, i, " ")
		}
	}
}

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

package main

import (
	"bytes"
	"fmt"
	"io/ioutil"
	"os"
	"sort"
)

func main() {
	var n int
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewReader(bs)
	fmt.Fscanf(reader, "%d", &n)
	primes := make([]int, 0, n+1)
	sieve := make([]int, n+1)
	writer := bytes.NewBuffer(make([]byte, 1000000))
	for i := 2; i <= n; i++ {
		if sieve[i] == 0 {
			sieve[i] = 1
			primes = append(primes, i)
		}
		for j := 0; j < len(primes); j++ {
			comp := i * primes[j]
			if comp > n {
				break
			}
			sieve[comp] = i
			if i%primes[j] == 0 {
				break
			}
		}
	}
	sort.Ints(sieve)
	for i := 2; i <= n; i++ {
		fmt.Fprintf(writer, "%d ", sieve[i])
	}
	writer.WriteTo(os.Stdout)
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)
var wrtr = bufio.NewWriterSize(os.Stdout, 10_000_000)
var rdr = bufio.NewScanner(os.Stdin)
func gs() string  { rdr.Scan(); return rdr.Text() }
func gi() int     { i,e := strconv.Atoi(gs()); if e != nil {panic(e)}; return i }
func gis(n int) []int  { res := make([]int,n); for i:=0;i<n;i++ { res[i] = gi() }; return res }
func gf() float64 { f,e := strconv.ParseFloat(gs(),64); if e != nil {panic(e)}; return f }
func gbs() []byte { return []byte(gs()) }
func gfs(n int) []float64  { res := make([]float64,n); for i:=0;i<n;i++ { res[i] = gf() }; return res }
func gss(n int) []string  { res := make([]string,n); for i:=0;i<n;i++ { res[i] = gs() }; return res }
func gi64() int64     { i,e := strconv.ParseInt(gs(),10,64); if e != nil {panic(e)}; return i }
func gis64(n int) []int64  { res := make([]int64,n); for i:=0;i<n;i++ { res[i] = gi64() }; return res }

func ia(m int) []int { return make([]int,m) }
func iai(m int,v int) []int { a := make([]int,m); for i:=0;i<m;i++ { a[i] = v }; return a }
func twodi(n int,m int,v int) [][]int {
	r := make([][]int,n); for i:=0;i<n;i++ { x := make([]int,m); for j:=0;j<m;j++ { x[j] = v }; r[i] = x }; return r
}
func fill2(m int) ([]int,[]int) { a,b := ia(m),ia(m); for i:=0;i<m;i++ {a[i],b[i] = gi(),gi()}; return a,b }
func fill3(m int) ([]int,[]int,[]int) { a,b,c := ia(m),ia(m),ia(m); for i:=0;i<m;i++ {a[i],b[i],c[i] = gi(),gi(),gi()}; return a,b,c }
func fill4(m int) ([]int,[]int,[]int,[]int) { a,b,c,d := ia(m),ia(m),ia(m),ia(m); for i:=0;i<m;i++ {a[i],b[i],c[i],d[i] = gi(),gi(),gi(),gi()}; return a,b,c,d }
func abs(a int) int { if a < 0 { return -a }; return a }
func rev(a []int) { i,j := 0,len(a)-1; for i < j { a[i],a[j] = a[j],a[i]; i++; j-- } }
func max(a,b int) int { if a > b { return a }; return b }
func min(a,b int) int { if a > b { return b }; return a }
func maxarr(a []int) int { ans := a[0]; for _,aa := range(a) { if aa > ans { ans = aa } }; return ans }
func minarr(a []int) int { ans := a[0]; for _,aa := range(a) { if aa < ans { ans = aa } }; return ans }
func sumarr(a []int) int { ans := 0; for _,aa := range(a) { ans += aa }; return ans }
func zeroarr(a []int) { for i:=0; i<len(a); i++ { a[i] = 0 } }
func powmod(a,e,mod int) int { res, m := 1, a; for e > 0 { if e&1 != 0 { res = res * m % mod }; m = m * m % mod; e >>= 1 }; return res }
func powint(a,e int) int { res, m := 1, a; for e > 0 { if e&1 != 0 { res = res * m }; m = m * m; e >>= 1 }; return res }
func gcd(a,b int) int { for b != 0 { t:=b; b=a%b; a=t }; return a }
func gcdExtended(a,b int) (int,int,int) { if a == 0 { return b,0,1 }; gcd,x1,y1 := gcdExtended(b%a,a); return gcd, y1-(b/a)*x1,x1 }
func modinv(a,m int) (int,bool) { g,x,_ := gcdExtended(a,m); if g != 1 { return 0,false }; return (x % m + m) % m,true  }
func vecintstring(a []int) string { astr := make([]string,len(a)); for i,a := range a { astr[i] = strconv.Itoa(a) }; return strings.Join(astr," ") }
func makefact(n int,mod int) ([]int,[]int) {
	fact,factinv := make([]int,n+1),make([]int,n+1)
	fact[0] = 1; for i:=1;i<=n;i++ { fact[i] = fact[i-1] * i % mod }
	factinv[n] = powmod(fact[n],mod-2,mod); for i:=n-1;i>=0;i-- { factinv[i] = factinv[i+1] * (i+1) % mod }
	return fact,factinv
}

func ia64(m int) []int64 { return make([]int64,m) }
func iai64(m int,v int64) []int64 { a := make([]int64,m); for i:=0;i<m;i++ { a[i] = v }; return a }
func twodi64(n int,m int,v int64) [][]int64 {
	r := make([][]int64,n); for i:=0;i<n;i++ { x := make([]int64,m); for j:=0;j<m;j++ { x[j] = v }; r[i] = x }; return r
}
func fill264(m int) ([]int64,[]int64) { a,b := ia64(m),ia64(m); for i:=0;i<m;i++ {a[i],b[i] = gi64(),gi64()}; return a,b }
func fill364(m int) ([]int64,[]int64,[]int64) { a,b,c := ia64(m),ia64(m),ia64(m); for i:=0;i<m;i++ {a[i],b[i],c[i] = gi64(),gi64(),gi64()}; return a,b,c }
func fill464(m int) ([]int64,[]int64,[]int64,[]int64) { a,b,c,d := ia64(m),ia64(m),ia64(m),ia64(m); for i:=0;i<m;i++ {a[i],b[i],c[i],d[i] = gi64(),gi64(),gi64(),gi64()}; return a,b,c,d }
func abs64(a int64) int64 { if a < 0 { return -a }; return a }
func rev64(a []int64) { i,j := 0,len(a)-1; for i < j { a[i],a[j] = a[j],a[i]; i++; j-- } }
func max64(a,b int64) int64 { if a > b { return a }; return b }
func min64(a,b int64) int64 { if a > b { return b }; return a }
func maxarr64(a []int64) int64 { ans := a[0]; for _,aa := range(a) { if aa > ans { ans = aa } }; return ans }
func minarr64(a []int64) int64 { ans := a[0]; for _,aa := range(a) { if aa < ans { ans = aa } }; return ans }
func sumarr64(a []int64) int64 { ans := int64(0); for _,aa := range(a) { ans += aa }; return ans }
func zeroarr64(a []int64) { for i:=0; i<len(a); i++ { a[i] = 0 } }
func powmod64(a,e,mod int64) int64 { res, m := int64(1), a; for e > 0 { if e&1 != 0 { res = res * m % mod }; m = m * m % mod; e >>= 1 }; return res }
func powint64(a,e int64) int64 { res, m := int64(1), a; for e > 0 { if e&1 != 0 { res = res * m }; m = m * m; e >>= 1 }; return res }
func gcd64(a,b int64) int64 { for b != 0 { t:=b; b=a%b; a=t }; return a }
func gcdExtended64(a,b int64) (int64,int64,int64) { if a == 0 { return b,0,1 }; gcd,x1,y1 := gcdExtended64(b%a,a); return gcd, y1-(b/a)*x1,x1 }
func modinv64(a,m int64) (int64,bool) { g,x,_ := gcdExtended64(a,m); if g != 1 { return 0,false }; return (x % m + m) % m,true  }
func vecint64string(a []int64) string { astr := make([]string,len(a)); for i,a := range a { astr[i] = strconv.FormatInt(a,10) }; return strings.Join(astr," ") }
func makefact64(n int,mod int64) ([]int64,[]int64) {
	fact,factinv := make([]int64,n+1),make([]int64,n+1)
	fact[0] = 1; for i:=1;i<=n;i++ { fact[i] = fact[i-1] * int64(i) % mod }
	factinv[n] = powmod64(fact[n],mod-2,mod); for i:=n-1;i>=0;i-- { factinv[i] = factinv[i+1] * int64(i+1) % mod }
	return fact,factinv
}
func main() {
	//f1, _ := os.Create("cpu.prof"); pprof.StartCPUProfile(f1); defer pprof.StopCPUProfile()
	defer wrtr.Flush()
	infn := ""; if infn == "" && len(os.Args) > 1 {	infn = os.Args[1] }
	if infn != "" {	f, e := os.Open(infn); if e != nil { panic(e) }; rdr = bufio.NewScanner(f) }
	rdr.Split(bufio.ScanWords); rdr.Buffer(make([]byte,1024),1_000_000_000)
	// PROGRAM STARTS HERE
	T := gi()
	for tt:=1;tt<=T;tt++ {
		N := gi(); K := gi(); A := gis(N)
		if K == 1 {
			fmt.Fprintln(wrtr,(N-1)/2)
		} else {
			ans := 0
			for i:=1;i+1<N;i++ { if A[i] > A[i-1]+A[i+1] { ans++ } }
			fmt.Fprintln(wrtr,ans)
		}
	}
}

package main

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

var r = bufio.NewReader(os.Stdin)

func tc() {
	var w = bufio.NewWriter(os.Stdout)
	defer w.Flush()
	var n, k int
	fmt.Fscan(r, &n, &k)

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

	if k > 1 {
		sol := 0
		for i := 1; i < n-1; i++ {
			if a[i] > a[i-1]+a[i+1] {
				sol++
			}
		}
		fmt.Fprintln(w, sol)
	} else {
		fmt.Fprintln(w, (n+1)/2-1)
	}
}

func main() {

	var t int
	fmt.Fscan(r, &t)

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

package main

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

var r = bufio.NewReader(os.Stdin)
var w = bufio.NewWriter(os.Stdout)

func tc() {
	var n, k int
	fmt.Fscan(r, &n, &k)

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

	if k > 1 {
		sol := 0
		for i := 1; i < n-1; i++ {
			if a[i] > a[i-1]+a[i+1] {
				sol++
			}
		}
		fmt.Fprintln(w, sol)
	} else {
		fmt.Fprintln(w, (n+1)/2-1)
	}
}

func main() {
	defer w.Flush()

	var t int
	fmt.Fscan(r, &t)

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

package main

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

var r = bufio.NewReader(os.Stdin)
var w = bufio.NewWriter(os.Stdout)

func tc() {
	var n, k int
	fmt.Fscan(r, &n, &k)

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

	if k > 1 {
		sol := 0
		for i := 1; i < n-1; i++ {
			if a[i] > a[i-1]+a[i+1] {
				sol++
			}
		}
		fmt.Println(sol)
	} else {
		fmt.Println((n+1)/2 - 1)
	}
}

func main() {
	defer w.Flush()

	var t int
	fmt.Fscan(r, &t)

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

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 main() {
	in := bufio.NewReader(os.Stdin)
	t := readInt(in)
	for ; t > 0; t-- {
		arr := readArrInt(in)
		n, k := arr[0], arr[1]
		piles := readArrInt(in)
		if k == 1 {
			fmt.Println((n - 1) / 2)
		} else {
			ans := 0
			for i := 1; i < n-1; i++ {
				if piles[i] > piles[i+1]+piles[i-1] {
					ans++
				}
			}
			fmt.Println(ans)
		}
	}
}

package main

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

type CF1698B struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1698B) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1698B) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1698B) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1698B) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1698B) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1698B
Date: 4/07/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1698/B
Problem: CF1698B
**/
func (in *CF1698B) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n, k := in.NextInt(), in.NextInt()
		arr := make([]int, n)
		for i := 0; i < n; i++ {
			arr[i] = in.NextInt()
		}

		ans := 0

		if k == 1 {
			ans = int(math.Ceil(float64(n-2) / 2))
		}else {
			for i := 1; i < n-1; i++ {
				if arr[i-1]+arr[i+1] < arr[i] {
					ans++
				}
			}
		}

		fmt.Println(ans)

	}
}

func NewCF1698B(r *bufio.Reader) *CF1698B {
	return &CF1698B{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1698B(bufio.NewReader(os.Stdin)).Run()
}

package main
// github.com/jamesgrimard/codeforces
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n,k int
		fmt.Fscan(in,&n,&k)
		list:= make([]int,n)
		for j:=0;j<n;j++{
			fmt.Fscan(in,&list[j])
		}
		var tally int
		for j:=0;j<n-2;j++{
			if list[j]+list[j+2] < list[j+1] {
				tally++
			}
		}
		if k == 1 {
			if n%2 == 0 {
				fmt.Fprintln(out,(n-2)/2)
			} else {
				fmt.Fprintln(out,n/2)
			}
		} else {
			fmt.Fprintln(out,tally)
		}
	}
}

package main

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

var (
	reader  = bufio.NewReader(os.Stdin)
	t, n, k int
	a       []int
)

func solve(n, k int, a []int) int {
	if k == 1 {
		return (n - 1) / 2
	}
	var cnt int
	for i := 1; i < n-1; i++ {
		if a[i] > a[i-1]+a[i+1] {
			cnt++
		}
	}
	return cnt
}

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		fmt.Fscan(reader, &n, &k)
		a = make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &a[i])
		}
		fmt.Println(solve(n, k, a))
	}
}

package main

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

func main() {
	input := bufio.NewReader(os.Stdin)
	cases := readInt(input)
	for asdf := 0; asdf < cases; asdf++ {
		tmp := readArrInt(input)
		n := tmp[0]
		k := tmp[1]
		arr := readArrInt(input)
		fmt.Println(solve(n, k, arr))
	}
}

func solve(n int, k int, arr []int) int {
	if k == 1 {
		return (n - 1) / 2
	} else {
		answer := 0
		for i := 1; i < n-1; i++ {
			if arr[i] > arr[i-1]+arr[i+1] {
				answer++
			}
		}
		return answer
	}
	return -1
}

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
}

package main

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

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

	var nSets int

	_, err := fmt.Fscan(in, &nSets)
	if err != nil {
		os.Exit(2)
	}

	for i := 0; i < nSets; i++ {
		arr, k := ReadSetN(in)
		fmt.Fprintln(out, MaxHuge(arr, k))
	}

	out.Flush()
}

func ReadSetN(in io.Reader) (arr []int, k int) {
	var n int

	_, err := fmt.Fscan(in, &n, &k)
	if err != nil {
		os.Exit(2)
	}

	for i := 0; i < n; i++ {
		tmp := 0
		if _, err = fmt.Fscan(in, &tmp); err != nil {
			os.Exit(2)
		}
		arr = append(arr, tmp)
	}

	return
}

func MaxHuge(arr []int, k int) (res int) {
	if k == 1 {
		return (len(arr) - 1) / 2
	}

	for i := 1; i < len(arr)-1; i++ {
		if arr[i] > arr[i-1]+arr[i+1] {
			res++
		}
	}

	return
}

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 < T; t++ {
		var n, k int
		fmt.Fscan(in, &n, &k)

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

		var tot int
		for i := 1; i < n-1; i++ {
			if aa[i] > aa[i-1]+aa[i+1] {
				tot++
			}
		}
		if k == 1 {
			fmt.Fprintln(out, (n-1)/2)
		} else {
			fmt.Fprintln(out, tot)

		}

	}
}

package main

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

var r = bufio.NewReader(os.Stdin)
var w = bufio.NewWriter(os.Stdout)

func solve() {
	var n, k int
	fmt.Fscan(r, &n, &k)
	piles := make([]int, n)
	for i := range piles {
		fmt.Fscan(r, &piles[i])
	}
	ans := 0
	for i := 1; i < n-1; i++ {
		if piles[i] > piles[i-1]+piles[i+1] {
			ans++
		}
	}
	if k == 1 {
		ans = (n - 1) / 2
	}
	fmt.Fprintln(w, ans)

}
func main() {
	defer w.Flush()
	var t int
	fmt.Fscan(r, &t)
	for ; t > 0; t-- {
		solve()
	}
}

package main

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

var r = bufio.NewReader(os.Stdin)
var w = bufio.NewWriter(os.Stdout)

func slove() {
	var n, k int
	fmt.Fscan(r, &n, &k)
	nums := make([]int, n)
	for i:=0;i<n;i++ {
		fmt.Fscan(r, &nums[i])
	}
	if k == 1 {
		fmt.Fprintln(w, (n-1)/2)
	} else {
		cnt := 0
		for i:=1;i<n-1;i++ {
			if nums[i] > nums[i-1] + nums[i+1] {
				cnt++
			}
		}
		fmt.Fprintln(w, cnt)
	}
}

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

package main

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

func tc() {
	var n, k int
	n = readInt()
	k = readInt()

	a := readInts()
	if k > 1 {
		sol := 0
		for i := 1; i < n-1; i++ {
			if a[i] > a[i-1]+a[i+1] {
				sol++
			}
		}
		fmt.Println(sol)
	} else {
		fmt.Println((n+1)/2 - 1)
	}
}

func main() {
	t := 1
	t = readInt()
	for i := 0; i < t; i++ {
		tc()
	}
}

var in = bufio.NewReader(os.Stdin)

type float = float32
type double = float64
type long = int64
type ulong = uint64

func typeOf(arg interface{}) string {
	switch reflect.TypeOf(arg).Kind() {
	case reflect.Int:
		return "int"
	case reflect.Int8:
		return "int8"
	case reflect.Int16:
		return "int16"
	case reflect.Int32:
		return "int32"
	case reflect.Int64:
		return "int64"
	case reflect.Uint:
		return "uint"
	case reflect.Uint8:
		return "uint8"
	case reflect.Uint16:
		return "uint16"
	case reflect.Uint32:
		return "uint32"
	case reflect.Uint64:
		return "uint64"
	case reflect.Float32:
		return "float32"
	case reflect.Float64:
		return "float64"
	case reflect.Complex64:
		return "complex64"
	case reflect.Complex128:
		return "complex128"
	case reflect.Bool:
		return "bool"
	case reflect.String:
		return "string"
	case reflect.Chan:
		return "chan"
	case reflect.Ptr:
		return "ptr"
	case reflect.Uintptr:
		return "uintptr"
	case reflect.UnsafePointer:
		return "unsafeptr"
	case reflect.Interface:
		return "interface"
	case reflect.Array:
		return "array"
	case reflect.Slice:
		return "slice"
	case reflect.Map:
		return "map"
	case reflect.Struct:
		return "struct"
	case reflect.Func:
		return "func"
	case reflect.Invalid:
		return "invalid"
	default:
		return "nil"
	}
}

/* ~~~~~~~~~~ */

func _scln() string {
	ln, _ := in.ReadString('\n')
	return strings.Trim(ln, " \r\n")
}
func _sc(s []string) string {
	if len(s) == 0 {
		return _scln()
	}
	return s[0]
}

func readLine() string              { return _scln() }
func readString() string            { return _scln() }
func readStrings() []string         { return strings.Split(_scln(), " ") }
func readBool(s ...string) bool     { t, _ := strconv.ParseBool(_sc(s)); return t }
func readByte(s ...string) byte     { t, _ := strconv.ParseUint(_sc(s), 10, 8); return byte(t) }
func readDouble(s ...string) double { t, _ := strconv.ParseFloat(_sc(s), 64); return t }
func readFloat(s ...string) float   { t, _ := strconv.ParseFloat(_sc(s), 32); return float32(t) }
func readInt(s ...string) int       { t, _ := strconv.Atoi(_sc(s)); return t }
func readLong(s ...string) long     { t, _ := strconv.ParseInt(_sc(s), 10, 64); return t }
func readULong(s ...string) ulong   { t, _ := strconv.ParseUint(_sc(s), 10, 64); return t }

/* ~~~~~~~~~~ */

// Too much overhead with universal method using interface{}, wait for the generics,
// but for now — just don't look at the redundancy of the code after that commentary :)

func readBools() []bool {
	strs := readStrings()
	arr := make([]bool, len(strs))
	for i, s := range strs {
		arr[i] = readBool(s)
	}
	return arr
}
func readBytes() []byte {
	strs := readStrings()
	arr := make([]byte, len(strs))
	for i, s := range strs {
		arr[i] = readByte(s)
	}
	return arr
}
func readDoubles() []double {
	strs := readStrings()
	arr := make([]double, len(strs))
	for i, s := range strs {
		arr[i] = readDouble(s)
	}
	return arr
}
func readFloats() []float {
	strs := readStrings()
	arr := make([]float, len(strs))
	for i, s := range strs {
		arr[i] = readFloat(s)
	}
	return arr
}
func readInts() []int {
	strs := readStrings()
	arr := make([]int, len(strs))
	for i, s := range strs {
		arr[i] = readInt(s)
	}
	return arr
}
func readLongs() []long {
	strs := readStrings()
	arr := make([]long, len(strs))
	for i, s := range strs {
		arr[i] = readLong(s)
	}
	return arr
}
func readULongs() []ulong {
	strs := readStrings()
	arr := make([]ulong, len(strs))
	for i, s := range strs {
		arr[i] = readULong(s)
	}
	return arr
}

package main

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

var in = bufio.NewReader(os.Stdin)

func readInt() int {
	res := 0
	for c, _ := in.ReadByte(); c >= '0' && c <= '9'; c, _ = in.ReadByte() {
		res = res*10 + int(c-'0')
	}
	return res
}

func main() {
	t := readInt()
	for ; t > 0; t-- {
		n, k := readInt(), readInt()
		piles := make([]int, n)
		for i := range piles {
			piles[i] = readInt()
		}
		if k == 1 {
			fmt.Println((n - 1) / 2)
		} else {
			ans := 0
			for i := 1; i < n-1; i++ {
				if piles[i] > piles[i+1]+piles[i-1] {
					ans++
				}
			}
			fmt.Println(ans)
		}
	}
}

package main

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

var in = bufio.NewReader(os.Stdin)

func readInt() int {
	res := 0
	for c, _ := in.ReadByte(); c >= '0' && c <= '9'; c, _ = in.ReadByte() {
		res = res*10 + int(c-'0')
	}
	return res
}

func main() {
	var t int
	fmt.Scan(&t)
	for ; t > 0; t-- {
		var n, k int
		fmt.Scan(&n, &k)
		piles := make([]int, n)
		for i := range piles {
			piles[i] = readInt()
		}
		if k == 1 {
			fmt.Println((n - 1) / 2)
		} else {
			ans := 0
			for i := 1; i < n-1; i++ {
				if piles[i] > piles[i+1]+piles[i-1] {
					ans++
				}
			}
			fmt.Println(ans)
		}
	}
}

package main

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

type CF1698B struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1698B) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1698B) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1698B) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1698B) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1698B) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1698B
Date: 4/07/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1698/B
Problem: CF1698B
**/
func (in *CF1698B) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n, k := in.NextInt(), in.NextInt()
		arr := make([]int, n)
		for i := 0; i < n; i++ {
			arr[i] = in.NextInt()
		}

		ans := 0

		if k == 1 {
			ans = int(math.Ceil(float64(n) / 3))
		}else {
			for i := 1; i < n-1; i++ {
				if arr[i-1]+arr[i+1] < arr[i] {
					ans++
				}
			}
		}

		fmt.Println(ans)

	}
}

func NewCF1698B(r *bufio.Reader) *CF1698B {
	return &CF1698B{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1698B(bufio.NewReader(os.Stdin)).Run()
}

package main

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

type CF1698B struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1698B) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1698B) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1698B) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1698B) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1698B) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1698B
Date: 4/07/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1698/B
Problem: CF1698B
**/
func (in *CF1698B) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n, k := in.NextInt(), in.NextInt()
		arr := make([]int, n)
		for i := 0; i < n; i++ {
			arr[i] = in.NextInt()
		}

		ans := 0
		for i := 1; i < n-1; i++ {
			if arr[i-1]+arr[i+1] < arr[i] {
				ans++
			} else if  arr[i-1]+arr[i+1] == arr[i]  && k == 1{
				ans++
			}
		}

		fmt.Println(ans)

	}
}

func NewCF1698B(r *bufio.Reader) *CF1698B {
	return &CF1698B{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1698B(bufio.NewReader(os.Stdin)).Run()
}

package main
// github.com/jamesgrimard/codeforces
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n,k int
		fmt.Fscan(in,&n,&k)
		list:= make([]int,n)
		for j:=0;j<n;j++{
			fmt.Fscan(in,&list[j])
		}
		var tally int
		for j:=0;j<n-2;j++{
			if list[j]+list[j+2] < list[j+1] {
				tally++
			}
		}
		if k == 1 {
			fmt.Fprintln(out,n-2)
		} else {
			fmt.Fprintln(out,tally)
		}
	}
}


package main

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

const BASE = 7
const mod = 1e9 + 7
const N = 1000005

var n, m int
var s string
var dp[N] int
var M map[int] string

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

func getLowerValue(x uint8) int {
	if x >= 'A' && x <= 'Z' {
		return int(x - 'A') + 1
	}
	return int(x - 'a') + 1
}

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

func tracing(indx int)  {
	defer writer.Flush()

	if indx == 0 {
		return
	}
	var ans = M[dp[indx]]

	tracing(indx - len(ans))
	fmt.Fprintf(writer, "%s ", ans)
}

func main()  {

	defer writer.Flush()

	fmt.Fscanf(reader, "%d\n", &n)
	fmt.Fscanf(reader, "%s\n", &s)

	M = make(map[int]string)

	fmt.Fscanf(reader, "%d\n", &m)

	for i := 0; i < m; i++ {
		var t string
		fmt.Fscanf(reader, "%s\n", &t)

		var hashValue = 0
		for j := 0; j < len(t); j++ {
			hashValue = int(int64(hashValue) * int64(BASE) % mod)
			hashValue = (hashValue + getLowerValue(t[j])) % mod
		}
		M[hashValue] = t
	}

	dp[0] = 0
	for i := 1; i <= n; i++ {
		dp[i] = -1
		var hashValue = 0
		for j := i; j >= max(i - 999, 1); j-- {
			hashValue = int(int64(hashValue) * int64(BASE) % mod)
			hashValue = (hashValue + int(s[j - 1] - 'a') + 1) % mod
			_, ok := M[hashValue]
			if ok && dp[j - 1] != -1 {
				dp[i] = hashValue
				break
			}
		}
	}

	tracing(n)
}

package main

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

// github.com/EndlessCheng/codeforces-go
func CF633C(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	type node struct {
		son [26]*node
		s   []byte
	}

	var n, m int
	var s, t []byte
	root := &node{}
	for Fscan(in, &n, &s, &m); m > 0; m-- {
		Fscan(in, &t)
		o := root
		for _, c := range t {
			if c < 'a' {
				c += 32
			}
			c -= 'a'
			if o.son[c] == nil {
				o.son[c] = &node{}
			}
			o = o.son[c]
		}
		o.s = t
	}

	dp := make([]int8, n)
	var f func(int) int8
	f = func(p int) (res int8) {
		if p < 0 {
			return 1
		}
		dv := &dp[p]
		if *dv != 0 {
			return *dv
		}
		defer func() { *dv = res }()
		o := root
		for i := p; i >= 0; i-- {
			o = o.son[s[i]-'a']
			if o == nil {
				return -1
			}
			if o.s != nil && f(i-1) == 1 {
				Fprint(out, string(o.s), " ")
				return 1
			}
		}
		return -1
	}
	f(n - 1)
}

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

package main

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

type node struct {
	son [26]*node
	s   string
}

// github.com/EndlessCheng/codeforces-go
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var n, m int
	var s, w string
	root := &node{}
	for Fscan(in, &n, &s, &m); m > 0; m-- {
		Fscan(in, &w)
		o := root
		for _, c := range w {
			if c < 'a' {
				c += 32
			}
			c -= 'a'
			if o.son[c] == nil {
				o.son[c] = &node{}
			}
			o = o.son[c]
		}
		o.s = w
	}

	dp := make([]int8, n)
	var f func(int) int8
	f = func(p int) (res int8) {
		if p < 0 {
			return 1
		}
		dv := &dp[p]
		if *dv != 0 {
			return *dv
		}
		defer func() { *dv = res }()
		o := root
		for i := p; i >= 0; i-- {
			o = o.son[s[i]-'a']
			if o == nil {
				return -1
			}
			if o.s != "" && f(i-1) == 1 {
				Fprint(out, o.s, " ")
				return 1
			}
		}
		return -1
	}
	f(n - 1)
}

package main

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

// github.com/EndlessCheng/codeforces-go
func CF633C(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	type node struct {
		son [26]*node
		s   []byte
	}

	var n, m int
	var s, t []byte
	root := &node{}
	for Fscan(in, &n, &s, &m); m > 0; m-- {
		Fscan(in, &t)
		o := root
		for i := len(t) - 1; i >= 0; i-- {
			c := t[i]
			if c < 'a' {
				c += 32
			}
			c -= 'a'
			if o.son[c] == nil {
				o.son[c] = &node{}
			}
			o = o.son[c]
		}
		o.s = t
	}

	ans := [][]byte{}
	dp := make([]int8, n)
	var f func(int) int8
	f = func(p int) (res int8) {
		if p == n {
			return 1
		}
		dv := &dp[p]
		if *dv != 0 {
			return *dv
		}
		defer func() { *dv = res }()
		o := root
		for i := p; i < len(s); i++ {
			o = o.son[s[i]-'a']
			if o == nil {
				return -1
			}
			if o.s != nil && f(i+1) == 1 {
				ans = append(ans, o.s)
				return 1
			}
		}
		return -1
	}
	f(0)
	for i := len(ans) - 1; i >= 0; i-- {
		Fprint(out, string(ans[i]), " ")
	}
}

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

package main

import (
	"bufio"
	. "fmt"
	"os"
	"runtime/debug"
)

type node struct {
	son [26]*node
	s   string
}

// github.com/EndlessCheng/codeforces-go
func main() {
	debug.SetGCPercent(-1)
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var n, m int
	var s, w string
	root := &node{}
	for Fscan(in, &n, &s, &m); m > 0; m-- {
		Fscan(in, &w)
		o := root
		for _, c := range w {
			if c < 'a' {
				c += 32
			}
			c -= 'a'
			if o.son[c] == nil {
				o.son[c] = &node{}
			}
			o = o.son[c]
		}
		o.s = w
	}

	dp := make([]int8, n)
	var f func(int) int8
	f = func(p int) (res int8) {
		if p < 0 {
			return 1
		}
		dv := &dp[p]
		if *dv != 0 {
			return *dv
		}
		defer func() { *dv = res }()
		o := root
		for i := p; i >= 0; i-- {
			o = o.son[s[i]-'a']
			if o == nil {
				return -1
			}
			if o.s != "" && f(i-1) == 1 {
				Fprint(out, o.s, " ")
				return 1
			}
		}
		return -1
	}
	f(n - 1)
}

package main

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

const BASE = 240496
const mod = 1e9 + 7
const N = 1000005

var n, m int
var s string
var dp[N] int
var M map[int] string

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

func getLowerValue(x uint8) int {
	if x >= 'A' && x <= 'Z' {
		return int(x - 'A') + 1
	}
	return int(x - 'a') + 1
}

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

func tracing(indx int)  {
	defer writer.Flush()

	if indx == 0 {
		return
	}
	var ans = M[dp[indx]]

	tracing(indx - len(ans))
	fmt.Fprintf(writer, "%s ", ans)
}

func main()  {

	defer writer.Flush()

	fmt.Fscanf(reader, "%d\n", &n)
	fmt.Fscanf(reader, "%s\n", &s)

	M = make(map[int]string)

	fmt.Fscanf(reader, "%d\n", &m)

	for i := 0; i < m; i++ {
		var t string
		fmt.Fscanf(reader, "%s\n", &t)

		var hashValue = 0
		for j := 0; j < len(t); j++ {
			hashValue = int(int64(hashValue) * int64(BASE) % mod)
			hashValue = (hashValue + getLowerValue(t[j])) % mod
		}
		M[hashValue] = t
	}

	dp[0] = 0
	for i := 1; i <= n; i++ {
		dp[i] = -1
		var hashValue = 0
		for j := i; j >= max(i - 999, 1); j-- {
			hashValue = int(int64(hashValue) * int64(BASE) % mod)
			hashValue = (hashValue + int(s[j - 1] - 'a') + 1) % mod
			_, ok := M[hashValue]
			if ok && dp[j - 1] != -1 {
				dp[i] = hashValue
				break
			}
		}
	}

	tracing(n)
}


package main

import "fmt"

func sgn(x int) int {
	if x < 0 {
		return -1
	}
	return 1
}

func main() {
	var n, ax, ay, bx, by, cx, cy int
	fmt.Scan(&n, &ax, &ay, &bx, &by, &cx, &cy)
	if bx < ax && ax < cx || bx > ax && ax > cx || by < ay && ay < cy || by > ay && ay > cy {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
	}
}

package main

import (
	"fmt"
	"log"
)

func main() {
	var n int
	var ax, ay int
	var bx, by int
	var cx, cy int

	_, err := fmt.Scan(&n)
	if err != nil {
		log.Fatal(err)
	} else {
		_, err := fmt.Scan(&ax, &ay)
		if err != nil {
			log.Fatal(err)
		}

		_, err = fmt.Scan(&bx, &by)
		if err != nil {
			log.Fatal(err)
		}

		_, err = fmt.Scan(&cx, &cy)
		if err != nil {
			log.Fatal(err)
		}

		res := checkSameQuads(ax, ay, bx, by, cx, cy)

		if res {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}

	}
}

func checkSameQuads(ax, ay, bx, by, cx, cy int) bool {
	if cx < ax {
		if cy < ay {
			if bx < ax && by < ay {
				return true
			}
		} else {
			if bx < ax && by > ay {
				return true
			}
		}
	} else {
		if cy < ay {
			if bx > ax && by < ay {
				return true
			}
		} else {
			if bx > ax && by > ay {
				return true
			}
		}
	}
	return false
}

package main

import (
	"fmt"
)

type coord struct {
	x int64
	y int64
}

func (c1 coord) Add(c2 coord) coord {
	return coord{c1.x + c2.x, c1.y + c2.y}
}

func (c1 coord) Equal(c2 coord) bool {
	return c1.x == c2.x && c1.y == c2.y
}

func (c coord) Valid(n int64, q coord) bool {
	if c.x < 1 || c.y < 1 || c.x > n || c.y > n || c.x == q.x || c.y == q.y || c.x-q.x == c.y-q.y || c.x-q.x == -(c.y-q.y) {
		return false
	}
	return true
}

func (c coord) Neighbors(n int64) []coord {
	ret := []coord{}
	dirs := []coord{{1, 1}, {1, 0}, {1, -1}, {0, 1}, {0, -1}, {-1, 1}, {-1, 0}, {-1, -1}}
	for _, co := range dirs {
		ret = append(ret, c.Add(co))
	}
	return ret
}

type stack []coord

func (s *stack) Push(c coord) {
	*s = append(*s, c)
}

func (s *stack) Pop() coord {
	res := (*s)[len(*s)-1]
	*s = (*s)[:len(*s)-1]
	return res
}

func sol(n int64, a coord, b coord, c coord) string {
	visited := map[coord]bool{}
	tovisit := stack{b}
	for len(tovisit) > 0 {
		curr := tovisit.Pop()
		if visited[curr] {
			continue
		}
		visited[curr] = true
		for _, co := range curr.Neighbors(n) {
			if co.Equal(c) {
				return "YES"
			}
			if co.Valid(n, a) {
				tovisit = append(tovisit, co)
			}
		}

	}
	return "NO"
}

func main() {
	var n, a1, a2, b1, b2, c1, c2 int64
	fmt.Scanf("%d\n", &n)
	fmt.Scanf("%d %d\n", &a1, &a2)
	fmt.Scanf("%d %d\n", &b1, &b2)
	fmt.Scanf("%d %d\n", &c1, &c2)
	res := sol(n, coord{a1, a2}, coord{b1, b2}, coord{c1, c2})
	fmt.Println(res)
}


package main

import (
	"fmt"
)

func readArr(n int) []int{
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&arr[i])
	}
	return arr
}

var (
	n int
	a []int
	m int
	l, r []int
)

func read() {
	fmt.Scan(&n)
	a = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	fmt.Scan(&m)
	r = make([]int, m)
	l = make([]int, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&l[i], &r[i])
	}
}

func main() {
	read()
	sum := 0
	for i := 0; i < n; i++ {
		sum += a[i]
	}
	for i := 0; i < m; i++ {
		if sum >= l[i] && sum <= r[i] {
			fmt.Println(sum)
			return
		}
		if sum < l[i] {
			fmt.Println(l[i])
			return
		}
	}
	fmt.Println(-1)
}

package main

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

func check(a []int, t int) bool {
	fmt.Println(a)
	tmp := a[t]
	sort.Ints(a)
	fmt.Println(a)
	if tmp == a[t] {
		return true
	}
	return false
}

func main() {
	var n, summ int
	var input [2]int
	var line string
	reader := bufio.NewReader(os.Stdin)
	line, _ = reader.ReadString('\n')
	//n, _ = strconv.Atoi(strings.TrimRight(line, "\n\r\t "))
	line, _ = reader.ReadString('\n')
	for _, j := range strings.Split(strings.TrimRight(line, "\n\r\t "), " ") {
		tmp, _ := strconv.Atoi(j)
		summ += tmp
	}
	line, _ = reader.ReadString('\n')
	n, _ = strconv.Atoi(strings.TrimRight(line, "\n\r\t "))
	for i := 0; i < n; i++ {
		line, _ = reader.ReadString('\n')
		for i, j := range strings.Split(strings.TrimRight(line, "\n\r\t "), " ") {
			input[i], _ = strconv.Atoi(j)
		}
		if input[0] <= summ && summ <= input[1] {
			fmt.Println(summ)
			os.Exit(0)
		} else if input[0] >= summ {
			fmt.Println(input[0])
			os.Exit(0)
		}
	}
	fmt.Println("-1")
}

package main

import (
	"fmt"
)

func readArr(n int) []int{
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&arr[i])
	}
	return arr
}

var (
	n int
	a []int
	m int
	l, r []int
)

func read() {
	fmt.Scan(&n)
	a = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	fmt.Scan(&m)
	r = make([]int, m)
	l = make([]int, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&l[i], &r[i])
	}
}

func main() {
	read()
	sum := 0
	for i := 0; i < n; i++ {
		sum += a[i]
	}
	for i := 0; i < m; i++ {
		if sum <= r[i] {
			fmt.Println(sum)
			return
		}
	}
	fmt.Println(-1)
}

package main

import (
	"fmt"
)

func readArr(n int) []int{
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&arr[i])
	}
	return arr
}

var (
	n int
	a []int
	m int
	l, r []int
)

func read() {
	fmt.Scan(&n)
	a = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	fmt.Scan(&m)
	r = make([]int, m)
	l = make([]int, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&l[i], &r[i])
	}
}

func main() {
	read()
	sum := 0
	for i := 0; i < n; i++ {
		sum += a[i]
	}
	for i := 0; i < m; i++ {
		if (sum >= l[i] && sum <= r[i]) || sum < l[i] {
			fmt.Println(sum)
			return
		}
	}
	fmt.Println(-1)
}

package main

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

func check(a []int, t int) bool {
	fmt.Println(a)
	tmp := a[t]
	sort.Ints(a)
	fmt.Println(a)
	if tmp == a[t] {
		return true
	}
	return false
}

func main() {
	var n, summ int
	var input [2]int
	var line string
	reader := bufio.NewReader(os.Stdin)
	line, _ = reader.ReadString('\n')
	//n, _ = strconv.Atoi(strings.TrimRight(line, "\n\r\t "))
	line, _ = reader.ReadString('\n')
	for _, j := range strings.Split(strings.TrimRight(line, "\n\r\t "), " ") {
		tmp, _ := strconv.Atoi(j)
		summ += tmp
	}
	line, _ = reader.ReadString('\n')
	n, _ = strconv.Atoi(strings.TrimRight(line, "\n\r\t "))
	for i := 0; i < n; i++ {
		line, _ = reader.ReadString('\n')
		for i, j := range strings.Split(strings.TrimRight(line, "\n\r\t "), " ") {
			input[i], _ = strconv.Atoi(j)
		}
		if input[0] <= summ && summ <= input[1] {
			fmt.Println(summ)
			os.Exit(0)
		}
	}
	fmt.Println("-1")
}

package main

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

func check(a []int, t int) bool {
	fmt.Println(a)
	tmp := a[t]
	sort.Ints(a)
	fmt.Println(a)
	if tmp == a[t] {
		return true
	}
	return false
}

func main() {
	var n, summ int
	var input [2]int
	var line string
	reader := bufio.NewReader(os.Stdin)
	line, _ = reader.ReadString('\n')
	//n, _ = strconv.Atoi(strings.TrimRight(line, "\n\r\t "))
	line, _ = reader.ReadString('\n')
	for _, j := range strings.Split(strings.TrimRight(line, "\n\r\t "), " ") {
		tmp, _ := strconv.Atoi(j)
		summ += tmp
	}
	line, _ = reader.ReadString('\n')
	n, _ = strconv.Atoi(strings.TrimRight(line, "\n\r\t "))
	for i := 0; i < n; i++ {
		line, _ = reader.ReadString('\n')
		for i, j := range strings.Split(strings.TrimRight(line, "\n\r\t "), " ") {
			input[i], _ = strconv.Atoi(j)
		}
		if input[0] <= summ && summ <= input[1] {
			fmt.Println(summ)
			os.Exit(0)
		} else if input[0] >= summ {
			fmt.Println(summ)
			os.Exit(0)
		}
	}
	fmt.Println("-1")
}

package main

import (
	"fmt"
)

func readArr(n int) []int{
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&arr[i])
	}
	return arr
}

var (
	n int
	a []int
	m int
	l, r []int
)

func read() {
	fmt.Scan(&n)
	a = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	fmt.Scan(&m)
	r = make([]int, m)
	l = make([]int, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&l[i], &r[i])
	}
}

func main() {
	read()
	sum := 0
	for i := 0; i < n; i++ {
		sum += a[i]
	}
	for i := 0; i < m; i++ {
		if sum >= l[i] && sum <= r[i] {
			fmt.Println(sum)
			return
		}
	}
	fmt.Println(-1)
}


package main

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

// github.com/EndlessCheng/codeforces-go
func CF691C(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	s := ""
	Fscan(in, &s)
	if !Contains(s, ".") {
		s += "."
	}
	s = Trim(s, "0")
	o := Index(s, ".")
	i := IndexAny(s, "123456789")
	e := o - i
	if e > 0 {
		e--
	}
	s = Trim(s[:o]+s[o+1:], "0")
	if len(s) > 1 {
		s = s[:1] + "." + s[1:]
	}
	Fprint(out, s)
	if e != 0 {
		Fprint(out, "E", e)
	}
}

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

package main

import (
	"bufio"
	"fmt"
	"io/ioutil"
	"log"
	"os"
	"strconv"
	// "sort"
	"strings"
)

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

func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)
	log.SetOutput(ioutil.Discard)
	// log.SetOutput(os.Stderr)

	var s string

	fmt.Fscan(reader, &s)
	s = strings.TrimLeft(s, "0")
	dotIndex := strings.Index(s, ".")
	a := ""
	exp := 0

	// println(s, dotIndex)
	if dotIndex == 0 {
		i := 1

		for i < len(s) && s[i] == '0' {
			i++
		}

		a = s[i : i+1]
		s = s[i+1:]
		exp = -i
	} else {
		a = s[:1]

		if dotIndex == -1 {
			exp = len(s) - 1
			s = s[1:]
		} else {
			s = s[1:dotIndex] + s[dotIndex+1:]
			exp = dotIndex - 1
		}
	}

	print(a)

	s = strings.TrimRight(s, "0")
	if len(s) > 0 {
		print(".", s)
	}

	if exp != 0 {
		print("E", exp)
	}

	println()
}

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

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

func nextInt() int {
	n, _ := strconv.Atoi(next())
	return n
}

func nextFloat() float64 {
	n, _ := strconv.ParseFloat(next(), 64)
	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...) }