Polycarp has an integer $$$n$$$ that doesn't contain the digit 0. He can do the following operation with his number several (possibly zero) times: Reverse the prefix of length $$$l$$$ (in other words, $$$l$$$ leftmost digits) of $$$n$$$. So, the leftmost digit is swapped with the $$$l$$$-th digit from the left, the second digit from the left swapped with ($$$l-1$$$)-th left, etc. For example, if $$$n=123456789$$$ and $$$l=5$$$, then the new value of $$$n$$$ will be $$$543216789$$$.Note that for different operations, the values of $$$l$$$ can be different. The number $$$l$$$ can be equal to the length of the number $$$n$$$ — in this case, the whole number $$$n$$$ is reversed.Polycarp loves even numbers. Therefore, he wants to make his number even. At the same time, Polycarp is very impatient. He wants to do as few operations as possible.Help Polycarp. Determine the minimum number of operations he needs to perform with the number $$$n$$$ to make it even or determine that this is impossible.You need to answer $$$t$$$ independent test cases.

The first line contains the number $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each of the following $$$t$$$ lines contains one integer $$$n$$$ ($$$1 \le n < 10^9$$$). It is guaranteed that the given number doesn't contain the digit 0.

Print $$$t$$$ lines. On each line print one integer — the answer to the corresponding test case. If it is impossible to make an even number, print -1.

NoteIn the first test case, $$$n=3876$$$, which is already an even number. Polycarp doesn't need to do anything, so the answer is $$$0$$$.In the second test case, $$$n=387$$$. Polycarp needs to do $$$2$$$ operations: Select $$$l=2$$$ and reverse the prefix $$$\underline{38}7$$$. The number $$$n$$$ becomes $$$837$$$. This number is odd. Select $$$l=3$$$ and reverse the prefix $$$\underline{837}$$$. The number $$$n$$$ becomes $$$738$$$. This number is even.It can be shown that $$$2$$$ is the minimum possible number of operations that Polycarp needs to do with his number to make it even.In the third test case, $$$n=4489$$$. Polycarp can reverse the whole number (choose a prefix of length $$$l=4$$$). It will become $$$9844$$$ and this is an even number.In the fourth test case, $$$n=3$$$. No matter how hard Polycarp tried, he would not be able to make an even number.

package main

import (
	"fmt"
	"strconv"
)

//func hashCode(key interface{}) int {
//	value, _ := key.(int)
//	return value
//}
//
//func equals(s interface{}, t interface{}) bool {
//	return s == t
//}
//
//func testMap() {
//	{
//		hashMap := imap.Factory.NewHashMap(hashCode, equals)
//		for i := 0; i < 10000; i++ {
//			hashMap.Put(i, strconv.Itoa(i))
//		}
//		for i := 0; i < 10000; i++ {
//			if i&4 != 0 {
//				hashMap.Remove(i)
//			} else if i&1 != 0 {
//				hashMap.Put(i, strconv.Itoa(i)+"ahaha")
//			}
//		}
//		fmt.Println("hashMap =>size ", hashMap.Size())
//	}
//	{
//		hashMap := imap.Factory.NewObjectHashMap()
//		for i := 0; i < 10000; i++ {
//			hashMap.Put(base.NewInteger(i), strconv.Itoa(i))
//		}
//		for i := 0; i < 10000; i++ {
//			if i&4 != 0 {
//				hashMap.Remove(base.NewInteger(i))
//			} else if i&1 != 0 {
//				hashMap.Put(base.NewInteger(i), strconv.Itoa(i)+"ahaha")
//			}
//		}
//		fmt.Println("hashMap =>size ", hashMap.Size())
//		value := hashMap.Get(base.NewInteger(129))
//		if value != nil {
//			intValue, _ := value.(string)
//
//			fmt.Println(base.NewInteger(129), intValue+"123")
//		}
//	}
//}
//
//func testBinTree() {
//	{
//		binaryTree := itree.Factory.NewBinaryTree(func(s interface{}, t interface{}) int {
//			ss, _ := s.(int)
//			tt, _ := t.(int)
//			if ss < tt {
//				return -1
//			} else if ss > tt {
//				return 1
//			} else {
//				return 0
//			}
//		}, true)
//		for i := 0; i < 10; i++ {
//			binaryTree.Insert(i)
//		}
//		binaryTree.ForEachMiddle(func(data interface{}) {
//			fmt.Println(data)
//		})
//	}
//}
//
//

func MakeEven(number int) int {
	if number%2 == 0 {
		return 0
	}
	numStr := strconv.Itoa(number)
	if isEven(numStr[:1]) {
		return 1
	}

	if hasEven(numStr) {
		return 2
	}

	return -1
}

func hasEven(numStr string) bool {
	for i := 0; i < len(numStr); i++ {
		if isEven(numStr[i : i+1]) {
			return true
		}
	}
	return false
}

func isEven(numStr string) bool {
	first, _ := strconv.Atoi(numStr)
	return first%2 == 0
}

func main() {
	var times, number int
	fmt.Scan(&times)

	for i := 0; i < times; i++ {
		fmt.Scan(&number)
		fmt.Println(MakeEven(number))
	}
}

package main

import (
	"fmt"
)

//func hashCode(key interface{}) int {
//	value, _ := key.(int)
//	return value
//}
//
//func equals(s interface{}, t interface{}) bool {
//	return s == t
//}
//
//func testMap() {
//	{
//		hashMap := imap.Factory.NewHashMap(hashCode, equals)
//		for i := 0; i < 10000; i++ {
//			hashMap.Put(i, strconv.Itoa(i))
//		}
//		for i := 0; i < 10000; i++ {
//			if i&4 != 0 {
//				hashMap.Remove(i)
//			} else if i&1 != 0 {
//				hashMap.Put(i, strconv.Itoa(i)+"ahaha")
//			}
//		}
//		fmt.Println("hashMap =>size ", hashMap.Size())
//	}
//	{
//		hashMap := imap.Factory.NewObjectHashMap()
//		for i := 0; i < 10000; i++ {
//			hashMap.Put(base.NewInteger(i), strconv.Itoa(i))
//		}
//		for i := 0; i < 10000; i++ {
//			if i&4 != 0 {
//				hashMap.Remove(base.NewInteger(i))
//			} else if i&1 != 0 {
//				hashMap.Put(base.NewInteger(i), strconv.Itoa(i)+"ahaha")
//			}
//		}
//		fmt.Println("hashMap =>size ", hashMap.Size())
//		value := hashMap.Get(base.NewInteger(129))
//		if value != nil {
//			intValue, _ := value.(string)
//
//			fmt.Println(base.NewInteger(129), intValue+"123")
//		}
//	}
//}
//
//func testBinTree() {
//	{
//		binaryTree := itree.Factory.NewBinaryTree(func(s interface{}, t interface{}) int {
//			ss, _ := s.(int)
//			tt, _ := t.(int)
//			if ss < tt {
//				return -1
//			} else if ss > tt {
//				return 1
//			} else {
//				return 0
//			}
//		}, true)
//		for i := 0; i < 10; i++ {
//			binaryTree.Insert(i)
//		}
//		binaryTree.ForEachMiddle(func(data interface{}) {
//			fmt.Println(data)
//		})
//	}
//}

func MakeEven(number int) int {
	if number & 1 == 0 {
		return 0
	}

	var intArray []int
	for ;number != 0; number = number / 10{
		in := number % 10
		intArray = append(intArray, in)
	}
	length := len(intArray)
	if intArray[length - 1] & 1 == 0 {
		return 1
	}
	for i := 0 ; i < length ; i++ {
		if intArray[i] & 1 == 0 {
			return 2
		}
	}
	return -1
}

func main() {
	var times, number int
	fmt.Scan(&times)
	for i := 0; i < times; i++ {
		fmt.Scan(&number)
		fmt.Println(MakeEven(number))
	}
}

package main

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

func main(){
	var N_INPS int
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	fmt.Sscanf(scanner.Text(), "%d\n", &N_INPS)
	var inputs []string
//	var inp string
	for i:=0; i< N_INPS; i++{
		scanner.Scan()
		inputs = append(inputs, scanner.Text())
	}
	for _, input := range inputs{
		fmt.Println(num_steps(input))
	}
}

func num_steps (numstr string) int{
	var digit int
	fmt.Sscanf(numstr[len(numstr)-1:],"%d", &digit)
	if digit%2 == 0 {
		return 0
	}
	for idx, _ := range numstr{
		fmt.Sscanf(numstr[idx:idx+1], "%d", &digit)
		if digit%2 == 0 {
			if idx == 0{
				return 1
			} else {
				return 2
			}
		}
	}
	return -1
}

package main

import "fmt"

func main(){
	var N_INPS int
	fmt.Scanf("%d\n", &N_INPS)
	var inputs []string
	var inp string
	for i:=0; i< N_INPS; i++{
		fmt.Scanf("%s\n", &inp)
		inputs = append(inputs, inp)
	}
	for _, input := range inputs{
		fmt.Println(num_steps(input))
	}
}

func num_steps (numstr string) int{
	var digit int
	fmt.Sscanf(numstr[len(numstr)-1:],"%d", &digit)
	if digit%2 == 0 {
		return 0
	}
	for idx, _ := range numstr{
		fmt.Sscanf(numstr[idx:idx+1], "%d", &digit)
		if digit%2 == 0 {
			if idx == 0{
				return 1
			} else {
				return 2
			}
		}
	}
	return -1
}

package main

import (
	"fmt"
	"strconv"
)

func MakeEven(number int) int {
	if number%2 == 0 {
		return 0
	}
	numStr := strconv.Itoa(number)

	if isEven(numStr[:1]) {
		return 1
	}

	if hasEven(numStr) {
		return 2
	}

	return -1
}

func hasEven(numStr string) bool {
	for i := 0; i < len(numStr); i++ {
		if isEven(numStr[i : i+1]) {
			return true
		}
	}
	return false
}

func isEven(numStr string) bool {
	first, _ := strconv.Atoi(numStr)
	return first%2 == 0
}

func main() {
	var times, number int
	fmt.Scan(&times)
	for i := 0; i < times; i++ {
		fmt.Scan( &number)
		fmt.Println(MakeEven(number))
	}
}

package main

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

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

	var T int
	var N string
	for fmt.Fscan(in, &T); T > 0; T-- {
		fmt.Fscan(in, &N)
		if IsEven(N[len(N)-1]) {
			fmt.Fprintln(out, 0)
			continue
		} else if IsEven(N[0]) {
			fmt.Fprintln(out, 1)
			continue
		} else {
			found := false
			for i := 1; i < len(N)-1 && !found; i++ {
				if IsEven(N[i]) {
					fmt.Fprintln(out, 2)
					found = true
				}
			}
			if found {
				continue
			}
		}
		fmt.Fprintln(out, -1)
	}
}

func IsEven(n byte) bool {
	return (n-'0')&1 == 0
}

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

package main

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

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

	var T int
	var N string
	for fmt.Fscan(in, &T); T > 0; T-- {
		fmt.Fscan(in, &N)
		if IsEven(N[len(N)-1]) {
			fmt.Fprintln(out, 0)
			continue
		} else if IsEven(N[0]) {
			fmt.Fprintln(out, 1)
			continue
		} else {
			found := false
			for i := 1; i < len(N)-1 && !found; i++ {
				if IsEven(N[i]) {
					fmt.Fprintln(out, 2)
					found = true
				}
			}
			if found {
				continue
			}
		}
		fmt.Fprintln(out, -1)
	}
}

func IsEven(n byte) bool {
	return (n-'0')%2 == 0
}

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

package main

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

func (in *A) run() {
	t := in.nextInt()
	arr := make([]bool, 128)
	arr['2'] = true
	arr['4'] = true
	arr['6'] = true
	arr['8'] = true
	for T := 0; T < t; T++ {
		str := in.nextString()
		if arr[str[len(str)-1]] {
			fmt.Println(0)
		} else if arr[str[0]] {
			fmt.Println(1)
		} else {
			x := -1
			for i := 0; i < len(str); i++ {
				if arr[str[i]] {
					x = 1
					if !arr[str[0]] && !arr[str[len(str)-1]] {
						x = 2
					}
				}
			}
			fmt.Println(x)
		}
	}
}

func main() {
	file, err := os.Open("input.txt")
	var F *bufio.Reader
	if err == nil {
		F = bufio.NewReader(file)
		os.Stdin = file
	} else {
		F = bufio.NewReader(os.Stdin)
	}
	defer func(file *os.File) {
		_ = file.Close()
	}(file)
	NewA(F).run()
}

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

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

func (in *A) 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 *A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

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

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

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

//come on golang

func reverse(arr []byte, start, end int) {
	for i, j := start, end-1; i < end/2; i, j = i+1, j-1 {
		arr[i], arr[j] = arr[j], arr[i]
	}
}

package main

import (
	"fmt"
)

func main() {
	var caseNum int
	fmt.Scanf("%d\n", &caseNum)
	for i := 0; i < caseNum; i++ {
		fmt.Println(solve())
	}
}

func solve() int {
	var str string
	fmt.Scanf("%s\n", &str)
	if str[len(str)-1] == '0' || str[len(str)-1] == '2' || str[len(str)-1] == '4' || str[len(str)-1] == '6' || str[len(str)-1] == '8' {
		return 0
	}
	if str[0] == '0' || str[0] == '2' || str[0] == '4' || str[0] == '6' || str[0] == '8' {
		return 1
	}
	for _, v := range str {
		if v == '0' || v == '2' || v == '4' || v == '6' || v == '8' {
			return 2
		}
	}
	return -1
}

package main

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

func solve() {
	f := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	N, s := 0, ""
	fmt.Fscan(f, &N)
	for i := 0; i < N; i++ {
		fmt.Fscan(f, &s)
		noEven := true
		for i := 0; i < len(s); i++ {
			p, _ := strconv.Atoi(string(s[i]))
			if p%2 == 0 {
				noEven = false
			}
		}
		if noEven {
			fmt.Fprintln(w, -1)
		} else {
			front, _ := strconv.Atoi(string(s[0]))
			back, _ := strconv.Atoi(string(s[len(s)-1]))
			if back%2 == 0 {
				fmt.Fprintln(w, 0)
			} else if front%2 == 0 {
				fmt.Fprintln(w, 1)
			} else {
				fmt.Fprintln(w, 2)
			}
		}
	}
	w.Flush()
}

func main() {
	solve()
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var t int
	_, er := fmt.Scan(&t)
	if er != nil {
		return
	}
	scanner.Scan()
	for i := 0; i < t; i++ {
		var n string
		if scanner.Scan() {
			n = scanner.Text()
		}
		if (n[len(n)-1]-'0')%2 == 0 {
			fmt.Println("0")
		} else if n[0] == '2' || n[0] == '4' || n[0] == '6' || n[0] == '8' {
			fmt.Println("1")
		} else if strings.Contains(n, "2") || strings.Contains(n, "4") || strings.Contains(n, "6") || strings.Contains(n, "8") {
			fmt.Println("2")
		} else {
			fmt.Println("-1")
		}
	}
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scan(&t)

	for t > 0 {
		t--

		var s string
		fmt.Scan(&s)

		var firstDigit, lastDigit, ind int
		firstDigit = int(s[0] - '0')
		lastDigit = int(s[len(s)-1] - '0')
		ind = 0
		for i := range s {
			if s[i]%2 == 0 {
				ind = 1
				break
			}
		}
		if lastDigit%2 == 0 {
			fmt.Println(0)
		} else if firstDigit%2 == 0 {
			fmt.Println(1)
		} else if ind == 1 {
			fmt.Println(2)
		} else {
			fmt.Println(-1)
		}
	}

}

package main

import (
	"fmt"
)

func solve(){
	n := 0
	fmt.Scan(&n)
	if n % 2 == 0{
		fmt.Println(0)
		return
	}
	ret := 1e9 + 7
	for n > 0 {
		next := n % 10
		if next % 2 == 0{
			ret = 2
			if n < 10{
				ret = 1
			}
		}
		n /= 10
	}
	if ret > 3{
		fmt.Println(-1)
	}else{
		fmt.Println(ret)
	}
}

func main(){
	n := 0
	fmt.Scan(&n)
	for i := 0;i < n;i++{
		solve()
	}
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	t, _ := strconv.Atoi(scanner.Text())
	for i := 0; i < t; i++ {
		a := -1
		scanner.Scan()
		s := scanner.Text()
		n, _ := strconv.Atoi(s)
		if n%2 == 0 {
			a++
		} else {
			o := 0
			for j := 0; j < len(s); j++ {
				temp, _ := strconv.Atoi(string(s[j]))
				if temp%2 == 0 {
					o++
				}
			}
			if o != 0 {
				temp, _ := strconv.Atoi(string(s[0]))
				a += 2
				if temp%2 == 1 {
					a++
				}
			}
		}
		fmt.Println(a)
	}
}

package main
import(
    "fmt"
    "strconv"
)
func main() {
	var t int
	fmt.Scan(&t)
	for i:=0;i<t;i++{
		var x string
		fmt.Scan(&x)
		x_int,_ := strconv.Atoi(x)
		if x_int%2 == 0 {
			fmt.Println(0)
			goto out
		} else {
			for j:=0;j<len(x);j++{
				current,_ := strconv.Atoi(string(x[j]))
				if current%2 == 0 {
					if j == 0 {
						fmt.Println(1)
						goto out
					} else {
						fmt.Println(2)
						goto out

					}
				}
			}
		}
		fmt.Println(-1)
		out:
	}
}

package main

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

type block struct {
	id, gang int
}

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

		v := -1
		if int(s[len(s)-1]-'0')%2 == 0 {
			v = 0
		} else if int(s[0]-'0')%2 == 0 {
			v = 1
		} else {
			var even bool
			for _, ch := range s {
				if int(ch-'0')%2 == 0 {
					even = true
					break
				}
			}

			if even {
				v = 2
			}
		}

		fmt.Fprintln(out, v)
	}
}

package main

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

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

func (in *CF1611A) 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 *CF1611A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

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

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

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

/**

Run solve the problem CF1611A
Date: 1/01/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1611/A
Problem: CF1611A
**/
func (in *CF1611A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		num := in.NextInt()
		ans := 0
		if num%2 != 0 {
			ans = -1
			str := strconv.Itoa(num)
			if (str[0]-'0')%2 == 0 {
				ans = 1
			} else {
				for i := 0; i < len(str); i++ {
					if (str[i]-'0')%2 == 0 {
						ans = 2
					}
				}
			}
		}
		fmt.Println(ans)

	}
}

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

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

package main

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

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

	cases := int(parseNumber(reader, '\n'))
	for c := 0; c < cases; c++ {
		num, _ := reader.ReadString('\n')
		fmt.Println(process(num))
	}
}

func process(num string) int {
	num = strings.Trim(num, "\n\r ")
	if intNum, _ := strconv.Atoi(num); intNum%2 == 0 {
		return 0
	}

	if first, _ := strconv.Atoi(string(num[0])); first%2 == 0 {
		return 1
	}

	for _, digit := range []byte(num) {
		digit, _ := strconv.Atoi(string(digit))
		if digit%2 == 0 {
			return 2
		}
	}

	return -1
}

func parseNumber(reader *bufio.Reader, delimiter byte) int64 {
	stringVal, err := reader.ReadString(delimiter)

	if err != nil {
		panic(err)
	}

	stringVal = strings.Trim(stringVal, "\n\r "+string(delimiter))
	value, err := strconv.ParseInt(stringVal, 10, 64)

	if err != nil {
		panic(err)
	}

	return value
}

package main
import (
	"bufio"
	"fmt"
	"os"

)
func main(){
	r := bufio.NewReader(os.Stdin)
    w := bufio.NewWriter(os.Stdout)
    defer w.Flush()
    var t int
    fmt.Fscan(r, &t)
    for j := 0; j < t; j++ {
		var a int
		fmt.Fscan(r, &a)
		var x int
		if (a % 2 != 0){
			flag := false
			for a > 10 {
				if a % 2 == 0 {
					flag = true
				}
				a /= 10
			}

			if a % 2 == 0 {
				x++
			}else if flag {
				x += 2
			}
			if x == 0 {
				x--
			}
		}
	   fmt.Fprintln(w, x);
	}

}

package main

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

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

var (
	T int
	n string
)

func solve(n string) int {
	if (n[len(n)-1]-'0')&1 == 0 {
		return 0
	}

	if (n[0]-'0')&1 == 0 {
		return 1
	}

	for _, c := range n {
		if (c-'0')&1 == 0 {
			return 2
		}
	}

	return -1
}

func main() {
	_, _ = fmt.Fscan(rr, &T)
	for iCase := 0; iCase < T; iCase++ {
		_, _ = fmt.Fscan(rr, &n)
		_, _ = fmt.Fprintln(ww, solve(n))
	}
	_ = ww.Flush()
}

package main

import (
	"fmt"
)

func main() {
	var cnt int
	fmt.Scan(&cnt)
	for idx := 0; idx < cnt; idx++ {
		var value string
		fmt.Scan(&value)
		if (value[len(value)-1]-'0')%2 == 0 {
			fmt.Printf("%d\n", 0)
		} else if (value[0]-'0')%2 == 0 {
			fmt.Printf("%d\n", 1)
		} else {
			var f = false
			for _, ch := range value {
				if (ch-'0')%2 == 0 {
					f = true
					break
				}
			}
			if f {
				fmt.Printf("%d\n", 2)
			} else {
				fmt.Printf("%d\n", -1)
			}
		}
	}
}

package main

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

type Building struct {
	number     int
	coordinate int
	visit      int
}

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

func solve(n string) int {
	l := len(n)
	if (n[l-1]-'0')%2 == 0 {
		return 0
	}
	for i, x := range n {
		if (x-'0')%2 == 0 {
			if i == 0 {
				return 1
			} else {
				return 2
			}
		}
	}
	return -1
}

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		fmt.Fscan(reader, &n)
		fmt.Println(solve(n))
	}
}

package main

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

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func main() {
	var n, ntc int
	fmt.Fscan(in, &ntc)
	for t := 0; t < ntc; t += 1 {
		fmt.Fscan(in, &n)
		if n%2 == 0 {
			fmt.Fprintln(out, "0")
			continue
		}
		isFirstDigitEven := false
		containsEvenDigit := false
		for n > 0 {
			isFirstDigitEven = (n%2 == 0)
			containsEvenDigit = containsEvenDigit || (n%2 == 0)
			n = n / 10
		}
		if isFirstDigitEven {
			fmt.Fprintln(out, "1")
		} else if containsEvenDigit {
			fmt.Fprintln(out, "2")
		} else {
			fmt.Fprintln(out, "-1")
		}
	}
	out.Flush()
}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func is_even(x byte) bool {
    return ((x-'0')%2 == 0)
}

func solve() {
    var s string
    scanf("%s\n", &s)
    if is_even(s[len(s)-1]){
        printf("%d\n", 0)
        return
    }
    if is_even(s[0]) {
        printf("%d\n", 1)
        return
    }
    for j:=1; j<len(s); j++ {
        if is_even(s[j]) {
            printf("%d\n", 2)
            return;
        }
    }
    printf("-1\n");
}

func main() {

    defer writer.Flush()

    var tc int
    scanf("%d\n", &tc)
    for ;tc>0;tc-- {
        solve()
    }
}

package main

import (
	"fmt"
)

func isEven(r byte) bool {
	return int(r-'0')%2 == 0
}

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		var s string
		fmt.Scanf("%s\n", &s)

		// Already even.
		if isEven(s[len(s)-1]) {
			fmt.Println("0")
			continue
		}

		// No even digit.
		hasEven := false
		for _, c := range s {
			if isEven(byte(c)) {
				hasEven = true
				break
			}
		}
		if !hasEven {
			fmt.Println("-1")
			continue
		}

		// First one is even.
		if isEven(s[0]) {
			fmt.Println("1")
			continue
		}

		fmt.Println("2")
	}
}

package main

import "fmt"

func main() {
	var n int
	_, _ = fmt.Scanln(&n)
	for i := 0; i < n; i++ {
		var x string
		_, _ = fmt.Scanln(&x)
		switch x[len(x)-1] {
		case '2','4','6','8':
			fmt.Println(0)
		default:
			switch x[0] {
			case '2','4','6','8':
				fmt.Println(1)
			default:
				var found bool
				for j := 1; j < len(x)-1; j++ {
					switch x[j]{
					case '2','4','6','8':
						found = true
					}
					if found {
						break
					}
				}
				if found {
					fmt.Println(2)
				} else {
					fmt.Println(-1)
				}
			}
		}
	}
}

package main

import "fmt"

func main() {
	var n int

	fmt.Scan(&n)

	for n>0 {
		n--

		var s string
		fmt.Scan(&s)

		if s[len(s)-1] % 2 == 0 {
			fmt.Println(0)
		} else if s[0] % 2 == 0 {
			fmt.Println(1)
		} else {
			flag := false
			for i:=0; i<len(s); i++ {
				if s[i] % 2 == 0 {
					fmt.Println(2)
					flag = true
					break
				}
			}

			if !flag {
				fmt.Println(-1)
			}
		}
	}
}

package main

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

var sc = bufio.NewScanner(os.Stdin)

func scan() string {
	for sc.Scan() {
		break
	}
	return sc.Text()
}

func scanInt() int {
	i, err := strconv.Atoi(scan())
	if err != nil {
		panic(err)
	}
	return i
}

func scanInt64() int64 {
	i, err := strconv.ParseInt(scan(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

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

func isEven(c byte) bool {
	return c == '2' || c == '4' || c == '6' || c == '8'
}

func main() {
	sc.Split(bufio.ScanWords)
	t := scanInt()
	for i := 0; i < t; i++ {
		s := scan()
		n := len(s)
		if isEven(s[n-1]) {
			fmt.Println("0")
		} else if isEven(s[0]) {
			fmt.Println("1")
		} else if n > 2 && strings.ContainsAny(s[1:n-1], "2468") {
			fmt.Println("2")
		} else {
			fmt.Println("-1")
		}
	}
}

package main

import (
	"fmt"
)

//func hashCode(key interface{}) int {
//	value, _ := key.(int)
//	return value
//}
//
//func equals(s interface{}, t interface{}) bool {
//	return s == t
//}
//
//func testMap() {
//	{
//		hashMap := imap.Factory.NewHashMap(hashCode, equals)
//		for i := 0; i < 10000; i++ {
//			hashMap.Put(i, strconv.Itoa(i))
//		}
//		for i := 0; i < 10000; i++ {
//			if i&4 != 0 {
//				hashMap.Remove(i)
//			} else if i&1 != 0 {
//				hashMap.Put(i, strconv.Itoa(i)+"ahaha")
//			}
//		}
//		fmt.Println("hashMap =>size ", hashMap.Size())
//	}
//	{
//		hashMap := imap.Factory.NewObjectHashMap()
//		for i := 0; i < 10000; i++ {
//			hashMap.Put(base.NewInteger(i), strconv.Itoa(i))
//		}
//		for i := 0; i < 10000; i++ {
//			if i&4 != 0 {
//				hashMap.Remove(base.NewInteger(i))
//			} else if i&1 != 0 {
//				hashMap.Put(base.NewInteger(i), strconv.Itoa(i)+"ahaha")
//			}
//		}
//		fmt.Println("hashMap =>size ", hashMap.Size())
//		value := hashMap.Get(base.NewInteger(129))
//		if value != nil {
//			intValue, _ := value.(string)
//
//			fmt.Println(base.NewInteger(129), intValue+"123")
//		}
//	}
//}
//
//func testBinTree() {
//	{
//		binaryTree := itree.Factory.NewBinaryTree(func(s interface{}, t interface{}) int {
//			ss, _ := s.(int)
//			tt, _ := t.(int)
//			if ss < tt {
//				return -1
//			} else if ss > tt {
//				return 1
//			} else {
//				return 0
//			}
//		}, true)
//		for i := 0; i < 10; i++ {
//			binaryTree.Insert(i)
//		}
//		binaryTree.ForEachMiddle(func(data interface{}) {
//			fmt.Println(data)
//		})
//	}
//}

func MakeEven(number int) int {
	if number & 1 == 0 {
		return 0
	}

	var intArray []int
	for ;number != 0; number = number / 10{
		in := number % 10
		intArray = append(intArray, in)
	}
	length := len(intArray)
	if intArray[length - 1] & 1 == 0 {
		return 1
	}
	for i := 0 ; i < length ; i++ {
		if intArray[i] & 1 == 0 {
			return 2
		}
	}
	return -1
}

func main() {
	var times, number int
	fmt.Scanf("%d", &times)
	for i := 0; i < times; i++ {
		fmt.Scanf("%d", &number)
		fmt.Printf("%d", MakeEven(number))
	}
}

package main

import (
	"fmt"
)

//func hashCode(key interface{}) int {
//	value, _ := key.(int)
//	return value
//}
//
//func equals(s interface{}, t interface{}) bool {
//	return s == t
//}
//
//func testMap() {
//	{
//		hashMap := imap.Factory.NewHashMap(hashCode, equals)
//		for i := 0; i < 10000; i++ {
//			hashMap.Put(i, strconv.Itoa(i))
//		}
//		for i := 0; i < 10000; i++ {
//			if i&4 != 0 {
//				hashMap.Remove(i)
//			} else if i&1 != 0 {
//				hashMap.Put(i, strconv.Itoa(i)+"ahaha")
//			}
//		}
//		fmt.Println("hashMap =>size ", hashMap.Size())
//	}
//	{
//		hashMap := imap.Factory.NewObjectHashMap()
//		for i := 0; i < 10000; i++ {
//			hashMap.Put(base.NewInteger(i), strconv.Itoa(i))
//		}
//		for i := 0; i < 10000; i++ {
//			if i&4 != 0 {
//				hashMap.Remove(base.NewInteger(i))
//			} else if i&1 != 0 {
//				hashMap.Put(base.NewInteger(i), strconv.Itoa(i)+"ahaha")
//			}
//		}
//		fmt.Println("hashMap =>size ", hashMap.Size())
//		value := hashMap.Get(base.NewInteger(129))
//		if value != nil {
//			intValue, _ := value.(string)
//
//			fmt.Println(base.NewInteger(129), intValue+"123")
//		}
//	}
//}
//
//func testBinTree() {
//	{
//		binaryTree := itree.Factory.NewBinaryTree(func(s interface{}, t interface{}) int {
//			ss, _ := s.(int)
//			tt, _ := t.(int)
//			if ss < tt {
//				return -1
//			} else if ss > tt {
//				return 1
//			} else {
//				return 0
//			}
//		}, true)
//		for i := 0; i < 10; i++ {
//			binaryTree.Insert(i)
//		}
//		binaryTree.ForEachMiddle(func(data interface{}) {
//			fmt.Println(data)
//		})
//	}
//}

func MakeEven(number int) int {
	if number & 1 == 0 {
		return 0
	}

	var intArray []int
	for ;number != 0; number = number / 10{
		in := number % 10
		intArray = append(intArray, in)
	}
	length := len(intArray)
	if intArray[length - 1] & 1 == 0 {
		return 1
	}
	for i := 0 ; i < length ; i++ {
		if intArray[i] & 1 == 0 {
			return 2
		}
	}
	return -1
}

func main() {
	var times, number int
	fmt.Scanf("%d", &times)
	for i := 0; i < times; i++ {
		fmt.Scanf("%d", &number)
		fmt.Println(MakeEven(number))
	}
}

package main

import (
	"fmt"
	"strconv"
)

//func hashCode(key interface{}) int {
//	value, _ := key.(int)
//	return value
//}
//
//func equals(s interface{}, t interface{}) bool {
//	return s == t
//}
//
//func testMap() {
//	{
//		hashMap := imap.Factory.NewHashMap(hashCode, equals)
//		for i := 0; i < 10000; i++ {
//			hashMap.Put(i, strconv.Itoa(i))
//		}
//		for i := 0; i < 10000; i++ {
//			if i&4 != 0 {
//				hashMap.Remove(i)
//			} else if i&1 != 0 {
//				hashMap.Put(i, strconv.Itoa(i)+"ahaha")
//			}
//		}
//		fmt.Println("hashMap =>size ", hashMap.Size())
//	}
//	{
//		hashMap := imap.Factory.NewObjectHashMap()
//		for i := 0; i < 10000; i++ {
//			hashMap.Put(base.NewInteger(i), strconv.Itoa(i))
//		}
//		for i := 0; i < 10000; i++ {
//			if i&4 != 0 {
//				hashMap.Remove(base.NewInteger(i))
//			} else if i&1 != 0 {
//				hashMap.Put(base.NewInteger(i), strconv.Itoa(i)+"ahaha")
//			}
//		}
//		fmt.Println("hashMap =>size ", hashMap.Size())
//		value := hashMap.Get(base.NewInteger(129))
//		if value != nil {
//			intValue, _ := value.(string)
//
//			fmt.Println(base.NewInteger(129), intValue+"123")
//		}
//	}
//}
//
//func testBinTree() {
//	{
//		binaryTree := itree.Factory.NewBinaryTree(func(s interface{}, t interface{}) int {
//			ss, _ := s.(int)
//			tt, _ := t.(int)
//			if ss < tt {
//				return -1
//			} else if ss > tt {
//				return 1
//			} else {
//				return 0
//			}
//		}, true)
//		for i := 0; i < 10; i++ {
//			binaryTree.Insert(i)
//		}
//		binaryTree.ForEachMiddle(func(data interface{}) {
//			fmt.Println(data)
//		})
//	}
//}
//
//

func MakeEven(number int) int {
	if number%2 == 0 {
		return 0
	}
	numStr := strconv.Itoa(number)
	if isEven(numStr[:1]) {
		return 1
	}

	if hasEven(numStr) {
		return 2
	}

	return -1
}

func hasEven(numStr string) bool {
	for i := 0; i < len(numStr); i++ {
		if isEven(numStr[i : i+1]) {
			return true
		}
	}
	return false
}

func isEven(numStr string) bool {
	first, _ := strconv.Atoi(numStr)
	return first%2 == 0
}

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

	for i := 0; i < times; i++ {
		fmt.Scanf("%d", &number)
		fmt.Println(MakeEven(number))
	}
}

package main

import "fmt"

func main(){
	var N_INPS int
	fmt.Scanf("%d\n", &N_INPS)
	var inputs []string
	var inp string
	for i:=0; i< N_INPS; i++{
		fmt.Scanf("%s", &inp)
		inputs = append(inputs, inp)
	}
	for _, input := range inputs{
		fmt.Println(num_steps(input))
	}
}

func num_steps (numstr string) int{
	var digit int
	fmt.Sscanf(numstr[len(numstr)-1:len(numstr)],"%d", &digit)
	if digit%2 == 0 {
		return 0
	}
	for idx, _ := range numstr{
		fmt.Sscanf(numstr[idx:idx+1], "%d", &digit)
		if digit%2 == 0 {
			if idx == 0{
				return 1
			} else {
				return 2
			}
		}
	}
	return -1
}

package main

import "fmt"

func main(){
	var N_INPS int
	fmt.Scanf("%d\n", &N_INPS)
	var inputs []string
	var inp string
	for i:=0; i< N_INPS; i++{
		fmt.Scanf("%s", &inp)
		inputs = append(inputs, inp)
	}
	for _, input := range inputs{
		fmt.Println(num_steps(input))
	}
}

func num_steps (numstr string) int{
	var digit int
	fmt.Sscanf(numstr[len(numstr)-1:],"%d", &digit)
	if digit%2 == 0 {
		return 0
	}
	for idx, _ := range numstr{
		fmt.Sscanf(numstr[idx:idx+1], "%d", &digit)
		if digit%2 == 0 {
			if idx == 0{
				return 1
			} else {
				return 2
			}
		}
	}
	return -1
}

package main

import (
	"fmt"
	"strconv"
)

func MakeEven(number int) int {
	if number%2 == 0 {
		return 0
	}
	numStr := strconv.Itoa(number)

	if isEven(numStr[:1]) {
		return 1
	}

	if hasEven(numStr) {
		return 2
	}

	return -1
}

func hasEven(numStr string) bool {
	for i := 0; i < len(numStr); i++ {
		if isEven(numStr[i : i+1]) {
			return true
		}
	}
	return false
}

func isEven(numStr string) bool {
	first, _ := strconv.Atoi(numStr)
	return first%2 == 0
}

func main() {
	var times, number int
	var numbers []int
	fmt.Scanf("%d", &times)

	for i := 0; i < times; i++ {
		fmt.Scanf("%d", &number)
		numbers = append(numbers, number)
	}

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

package main

import (
	"fmt"
	"os"
)

func setupIO() *os.File {
	file, err := os.Open("input.txt")
	if err == nil {
		os.Stdin = file
	}
	return file
}

func main() {
	defer func(io *os.File) {
		_ = io.Close()
	}(setupIO())

	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var str string
		fmt.Scan(&str)
		count := -1
		if str[len(str)-1]&1 == 0 {
			count = 0
		} else {
			for j := 0; j < len(str); j++ {
				if (str[j]-'0')&1 == 0 {
					count = j + 1
					break
				}
			}
		}
		println(count)
	}
}

package main

import (
	"fmt"
)

func main() {
	var caseNum int
	fmt.Scanf("%d\n", &caseNum)
	for i := 0; i < caseNum; i++ {
		fmt.Println(solve())
	}
}

func solve() int {
	var str string
	fmt.Scanf("%s\n", &str)
	if str[0] == '0' || str[0] == '2' || str[0] == '4' || str[0] == '6' || str[0] == '8' {
		return 1
	}
	if str[len(str)-1] == '0' || str[len(str)-1] == '2' || str[len(str)-1] == '4' || str[len(str)-1] == '6' || str[len(str)-1] == '8' {
		return 0
	}
	for _, v := range str {
		if v == '0' || v == '2' || v == '4' || v == '6' || v == '8' {
			return 2
		}
	}
	return -1
}

package main

import (
	"bufio"
	"container/list"
	"fmt"
	"os"
	"strconv"
)

func solve() {
	f := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	N, s := 0, ""
	fmt.Fscan(f, &N)
	for i := 0; i < N; i++ {
		fmt.Fscan(f, &s)
		l, foundEven, noEven := list.New(), true, true
		for i := 0; i < len(s); i++ {
			p, _ := strconv.Atoi(string(s[i]))
			l.PushBack(p)
			if p%2 == 0 {
				noEven = false
			}
			if i%2 == 0 && p%2 == 0 {
				foundEven = false
			}
		}
		if noEven {
			fmt.Fprintln(w, -1)
		} else {
			if l.Back().Value.(int)%2 == 0 {
				fmt.Fprintln(w, 0)
			} else if foundEven {
				fmt.Fprintln(w, 2)
			} else {
				fmt.Fprintln(w, 1)
			}
		}
	}
	w.Flush()
}

func main() {
	solve()
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scan(&t)

	for t > 0 {
		t--

		var s string
		fmt.Scan(&s)

		var firstDigit, lastDigit, ind int
		firstDigit = int(s[0] - '0')
		lastDigit = int(s[len(s)-1] - '0')
		ind = 0
		for i := range s {
			if s[i]%2 == 0 {
				ind = 1
				break
			}
		}
		if lastDigit%2 == 0 {
			println(0)
		} else if firstDigit%2 == 0 {
			println(1)
		} else if ind == 1 {
			println(2)
		} else {
			println(-1)
		}
	}

}


You are given sequence a1, a2, ..., an of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.Subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements.You should write a program which finds sum of the best subsequence.

The first line contains integer number n (1 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, ..., an ( - 104 ≤ ai ≤ 104). The sequence contains at least one subsequence with odd sum.

NoteIn the first example sum of the second and the fourth elements is 3.

package main

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

func I(i ...interface{}) error {
	_, err := fmt.Fscan(r, i...)
	return err
}

func O(o ...interface{}) {
	fmt.Fprint(w, o...)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.goC"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n) == nil {
		solve(n)
	}
}

func solve(n int) {
	var ans int64
	var min int64 = 1e14
	var max int64 = -1e14
	for i := 0; i < n; i++ {
		var t int64
		I(&t)
		if t > 0 {
			ans += t
			if t%2 != 0 && t < min {
				min = t
			}
		} else if t%2 != 0 && t > max {
			max = t
		}
	}
	if ans%2 == 0 {
		t1 := ans - min
		t2 := ans + max
		if t1 > t2 {
			ans = t1
		} else {
			ans = t2
		}
	}
	O(ans, "\n")
}

package main

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

func I(i ...interface{}) error {
	_, err := fmt.Fscan(r, i...)
	return err
}

func O(o ...interface{}) {
	fmt.Fprint(w, o...)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.goC"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n) == nil {
		solve(n)
	}
}

func solve(n int) {
	var even, odd arr
	for i := 0; i < n; i++ {
		var t int64
		I(&t)
		if t%2 != 0 {
			odd = append(odd, t)
		} else {
			even = append(even, t)
		}
	}
	sort.Sort(odd)
	sort.Sort(even)
	var ans int64
	for _, i := range even {
		if ans+i > ans {
			ans += i
		} else {
			break
		}
	}
	for i, v := range odd {
		if ans+v > ans {
			ans += v
		} else {
			if ans%2 == 0 {
				if i == 0 {
					ans += v
				} else {
					t1 := ans + v
					t2 := ans - odd[i-1]
					if t1 > t2 {
						ans = t1
					} else {
						ans = t2
					}
				}
			}
			break
		}
	}
	if ans%2 == 0 {
		ans -= odd[len(odd)-1]
	}
	O(ans, "\n")
}

type arr []int64

func (a arr) Len() int           { return len(a) }
func (a arr) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a arr) Less(i, j int) bool { return a[i] > a[j] }

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Scan()
	n, _ := strconv.Atoi(scanner.Text())
	x := make([]int, 0, n)
	for i := 0; i < n; i++ {
		scanner.Scan()
		y, _ := strconv.Atoi(scanner.Text())
		x = append(x, y)
	}
	sort.Ints(x)
	oddH := NewMaxHeap()
	evenH := NewMaxHeap()

	for _, el := range x {
		if el%2 == 0 {
			curOddMax, errOdd := oddH.Top()
			if errOdd == nil {
				oddH.Insert(curOddMax + el)
			}
			curEvenMax, errEven := evenH.Top()
			if errEven == nil {
				evenH.Insert(curEvenMax + el)
			}
			evenH.Insert(el)
		} else {
			curEvenMax, errEven := evenH.Top()
			curOddMax, errOdd := oddH.Top()
			if errEven == nil {
				oddH.Insert(curEvenMax + el)
			}
			if errOdd == nil {
				evenH.Insert(curOddMax + el)
			}
			oddH.Insert(el)
		}
		// fmt.Println(el, evenH, oddH)
	}
	max, _ := oddH.Top()
	fmt.Println(max)
}

type Heap struct {
	arr []int // supplementary array of elements
	cmp cmp
}

func NewMaxHeap() *Heap {
	arr := []int{}
	return &Heap{
		arr: arr,
		cmp: &max{},
	}
}

func NewMinHeap() *Heap {
	arr := []int{}
	return &Heap{
		arr: arr,
		cmp: &min{},
	}
}

func (h *Heap) Insert(x int) {
	h.arr = append(h.arr, x)
	i := len(h.arr) - 1
	for i > 0 {
		p := h.parent(i)
		if h.pushUp(i, p) {
			i = p
			continue
		}
		break
	}
}

func (h *Heap) Pop() (int, error) {
	if len(h.arr) == 0 {
		return 0, errors.New("heap is empty")
	}

	popped := h.arr[0]
	h.arr[0], h.arr[len(h.arr)-1] = h.arr[len(h.arr)-1], h.arr[0]
	h.arr = h.arr[0 : len(h.arr)-1]
	i := 0
	for i < len(h.arr) {
		lc := h.leftChild(i)
		if lc < len(h.arr) && h.pushUp(lc, i) {
			i = lc
			continue
		}

		rc := h.rightChild(i)
		if rc < len(h.arr) && h.pushUp(rc, i) {
			i = rc
			continue
		}

		break
	}
	return popped, nil
}

func (h *Heap) Top() (int, error) {
	if len(h.arr) == 0 {
		return 0, errors.New("heap is empty")
	}
	return h.arr[0], nil
}

func (h *Heap) parent(i int) int {
	return int(math.Ceil(float64(i)/2)) - 1
}

func (h *Heap) leftChild(i int) int {
	return 2*i + 1
}

func (h *Heap) rightChild(i int) int {
	return 2*i + 2
}

func (h *Heap) pushUp(child, parent int) bool {
	if h.cmp.NeedSwap(h.arr[child], h.arr[parent]) {
		h.arr[child], h.arr[parent] = h.arr[parent], h.arr[child]
		return true
	}
	return false
}

type cmp interface {
	NeedSwap(child, parent int) bool
}

type max struct{}

func (m *max) NeedSwap(child, parent int) bool {
	return child > parent
}

type min struct{}

func (m *min) NeedSwap(child, parent int) bool {
	return child < parent
}

package main

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

func solve() {
	n := readInt()
	a := make([]int, n)
	for i := 0; i < len(a); i++ {
		a[i] = readInt()
	}
	sort.Ints(a)
	sum := int64(0)
	minPos := int64(-1)
	minNeg := int64(1)
	for i := len(a) - 1; i >= 0; i-- {
		if a[i] > 0 {
			sum += int64(a[i])
			if a[i]%2 != 0 {
				minPos = int64(a[i])
			}
		} else {
			if a[i]%2 != 0 {
				minNeg = int64(a[i])
				break
			}
		}
	}
	if sum%2 == 0 {
		if minNeg != 1 && minPos != -1 {
			if sum-minPos > sum+minNeg {
				fmt.Println(sum - minPos)
			} else {
				fmt.Println(sum + minNeg)
			}
		} else if minNeg != 1 {
			fmt.Println(sum + minNeg)
		} else {
			fmt.Println(sum - minPos)
		}
	} else {
		fmt.Println(sum)
	}
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

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

// IO

func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

func readInt64Array(n int) []int64 {
	res := make([]int64, n)
	for i := 0; i < n; i++ {
		res[i] = readInt64()
	}
	return res
}

package main

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

func I(i ...interface{}) error {
	_, err := fmt.Fscan(r, i...)
	return err
}

func O(o ...interface{}) {
	fmt.Fprint(w, o...)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.goC"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n) == nil {
		solve(n)
	}
}

func solve(n int) {
	var even, odd arr
	for i := 0; i < n; i++ {
		var t int64
		I(&t)
		if t%2 != 0 {
			odd = append(odd, t)
		} else {
			even = append(even, t)
		}
	}
	sort.Sort(odd)
	sort.Sort(even)
	var ans int64
	for _, i := range even {
		if ans+i > ans {
			ans += i
		} else {
			break
		}
	}
	var last, lastt int64
	var ii int
	for i, v := range odd {
		last = v
		if i > 0 {
			lastt = odd[i-1]
		}
		if ans+v > ans {
			ans += v
			ii = i
		} else if i == 0 {
			break
		}
	}
	if ans%2 == 0 {
		if ii == 0 {
			ans += last
		} else if ii == len(odd)-1 {
			ans -= last
		} else {
			t1 := ans + last
			t2 := ans - lastt
			t3 := ans + last - lastt
			if t1 >= t2 && t1 >= t3 {
				ans = t1
			} else if t2 >= t1 && t2 >= t3 {
				ans = t2
			} else {
				ans = t3
			}
		}
	}
	O(ans, "\n")
}

type arr []int64

func (a arr) Len() int           { return len(a) }
func (a arr) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a arr) Less(i, j int) bool { return a[i] > a[j] }

package main

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

func I(i ...interface{}) error {
	_, err := fmt.Fscan(r, i...)
	return err
}

func O(o ...interface{}) {
	fmt.Fprint(w, o...)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.goC"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n) == nil {
		solve(n)
	}
}

func solve(n int) {
	var even, odd arr
	for i := 0; i < n; i++ {
		var t int64
		I(&t)
		if t%2 != 0 {
			odd = append(odd, t)
		} else {
			even = append(even, t)
		}
	}
	sort.Sort(odd)
	sort.Sort(even)
	var ans int64
	for _, i := range even {
		if ans+i > ans {
			ans += i
		} else {
			break
		}
	}
	var last, lastt int64
	var ii int
	for i, v := range odd {
		last = v
		if i > 0 {
			lastt = odd[i-1]
		}
		if ans+v > ans {
			ans += v
			ii = i
		} else if i == 0 {
			break
		}
	}
	if ans%2 == 0 {
		if ii == 0 {
			ans += last
		} else if ii == len(odd)-1 {
			ans -= last
		} else {
			t1 := ans + last
			t2 := ans - lastt
			if t1 >= t2 {
				ans = t1
			} else {
				ans = t2
			}
		}
	}
	O(ans, "\n")
}

type arr []int64

func (a arr) Len() int           { return len(a) }
func (a arr) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a arr) Less(i, j int) bool { return a[i] > a[j] }

package main

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

func I(i ...interface{}) error {
	_, err := fmt.Fscan(r, i...)
	return err
}

func O(o ...interface{}) {
	fmt.Fprint(w, o...)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.goC"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n) == nil {
		solve(n)
	}
}

func solve(n int) {
	var even, odd arr
	for i := 0; i < n; i++ {
		var t int64
		I(&t)
		if t%2 != 0 {
			odd = append(odd, t)
		} else {
			even = append(even, t)
		}
	}
	sort.Sort(odd)
	sort.Sort(even)
	var ans int64
	for _, i := range even {
		if ans+i > ans {
			ans += i
		} else {
			break
		}
	}
	for i, v := range odd {
		if ans+v > ans {
			ans += v
		} else {
			if i%2 == 0 {
				if i == 0 {
					ans += v
				} else {
					t1 := ans + v
					t2 := ans - odd[i-1]
					if t1 > t2 {
						ans = t1
					} else {
						ans = t2
					}
				}
			}
			break
		}
	}
	O(ans, "\n")
}

type arr []int64

func (a arr) Len() int           { return len(a) }
func (a arr) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a arr) Less(i, j int) bool { return a[i] > a[j] }

package main

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

func I(i ...interface{}) error {
	_, err := fmt.Fscan(r, i...)
	return err
}

func O(o ...interface{}) {
	fmt.Fprint(w, o...)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.goC"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n) == nil {
		solve(n)
	}
}

func solve(n int) {
	var even, odd arr
	for i := 0; i < n; i++ {
		var t int64
		I(&t)
		if abs(t%2) == 1 {
			odd = append(odd, t)
		} else {
			even = append(even, t)
		}
	}
	sort.Sort(odd)
	sort.Sort(even)
	var ans int64
	for _, i := range even {
		if ans+i > ans {
			ans += i
		} else {
			break
		}
	}
	var last, lastt int64
	var ii int
	for i, v := range odd {
		last = v
		if i > 0 {
			lastt = odd[i-1]
		}
		if ans+v > ans {
			ans += v
			ii = i
		} else if i == 0 {
			break
		}
	}
	if ans%2 != 1 {
		if ii == 0 {
			ans += last
		} else if ii == len(odd)-1 {
			ans -= last
		} else {
			t1 := ans + last
			t2 := ans - lastt
			if t1 >= t2 {
				ans = t1
			} else {
				ans = t2
			}
		}
	}
	O(ans, "\n")
}

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

type arr []int64

func (a arr) Len() int           { return len(a) }
func (a arr) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a arr) Less(i, j int) bool { return a[i] > a[j] }

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Scan()
	n, _ := strconv.Atoi(scanner.Text())
	x := make([]int, 0, n)
	for i := 0; i < n; i++ {
		scanner.Scan()
		y, _ := strconv.Atoi(scanner.Text())
		x = append(x, y)
	}
	sort.Ints(x)
	oddH := NewMaxHeap()
	evenH := NewMaxHeap()

	for _, el := range x {
		if el%2 == 0 {
			if curOddMax, err := oddH.Top(); err == nil {
				oddH.Insert(curOddMax + el)
			}
			if curEvenMax, err := evenH.Top(); err == nil {
				evenH.Insert(curEvenMax + el)
			}
			evenH.Insert(el)
		} else {
			if curEvenMax, err := evenH.Top(); err == nil {
				oddH.Insert(curEvenMax + el)
			}
			if curOddMax, err := oddH.Top(); err == nil {
				evenH.Insert(curOddMax + el)
			}
			oddH.Insert(el)
		}
		// fmt.Println(el, evenH, oddH)
	}
	max, _ := oddH.Top()
	fmt.Println(max)
}

type Heap struct {
	arr []int // supplementary array of elements
	cmp cmp
}

func NewMaxHeap() *Heap {
	arr := []int{}
	return &Heap{
		arr: arr,
		cmp: &max{},
	}
}

func NewMinHeap() *Heap {
	arr := []int{}
	return &Heap{
		arr: arr,
		cmp: &min{},
	}
}

func (h *Heap) Insert(x int) {
	h.arr = append(h.arr, x)
	i := len(h.arr) - 1
	for i > 0 {
		p := h.parent(i)
		if h.pushUp(i, p) {
			i = p
			continue
		}
		break
	}
}

func (h *Heap) Pop() (int, error) {
	if len(h.arr) == 0 {
		return 0, errors.New("heap is empty")
	}

	popped := h.arr[0]
	h.arr[0], h.arr[len(h.arr)-1] = h.arr[len(h.arr)-1], h.arr[0]
	h.arr = h.arr[0 : len(h.arr)-1]
	i := 0
	for i < len(h.arr) {
		lc := h.leftChild(i)
		if lc < len(h.arr) && h.pushUp(lc, i) {
			i = lc
			continue
		}

		rc := h.rightChild(i)
		if rc < len(h.arr) && h.pushUp(rc, i) {
			i = rc
			continue
		}

		break
	}
	return popped, nil
}

func (h *Heap) Top() (int, error) {
	if len(h.arr) == 0 {
		return 0, errors.New("heap is empty")
	}
	return h.arr[0], nil
}

func (h *Heap) parent(i int) int {
	return int(math.Ceil(float64(i)/2)) - 1
}

func (h *Heap) leftChild(i int) int {
	return 2*i + 1
}

func (h *Heap) rightChild(i int) int {
	return 2*i + 2
}

func (h *Heap) pushUp(child, parent int) bool {
	if h.cmp.NeedSwap(h.arr[child], h.arr[parent]) {
		h.arr[child], h.arr[parent] = h.arr[parent], h.arr[child]
		return true
	}
	return false
}

type cmp interface {
	NeedSwap(child, parent int) bool
}

type max struct{}

func (m *max) NeedSwap(child, parent int) bool {
	return child > parent
}

type min struct{}

func (m *min) NeedSwap(child, parent int) bool {
	return child < parent
}

package main

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

func solve() {
	n := readInt()
	a := make([]int, n)
	// b := make([]int, 0)
	// sumB := make([]int, 0)
	for i := 0; i < len(a); i++ {
		a[i] = readInt()
	}
	sort.Ints(a)
	sum := int64(0)
	minPos := int64(-1)
	minNeg := int64(1)
	for i := len(a) - 1; i >= 0; i-- {
		if a[i] > 0 {
			sum += int64(a[i])
			if a[i]%2 != 0 {
				minPos = int64(a[i])
			}
		} else {
			if int64(a[i]%2) != 0 {
				minNeg = int64(a[i])
				break
			}
		}
	}
	if sum%2 == 0 {
		if minNeg != 1 && minPos != -1 {
			if sum-minPos > sum+minNeg {
				fmt.Println(sum - minPos)
			} else {
				fmt.Println(sum + minNeg)
			}
		} else if minNeg != 1 {
			fmt.Println(sum + minNeg)
		} else {
			fmt.Println(sum + minNeg)
		}
	} else {
		fmt.Println(sum)
	}
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

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

// IO

func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

func readInt64Array(n int) []int64 {
	res := make([]int64, n)
	for i := 0; i < n; i++ {
		res[i] = readInt64()
	}
	return res
}

package main

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

func solve() {
	n := readInt()
	a := make([]int, n)
	// b := make([]int, 0)
	// sumB := make([]int, 0)
	for i := 0; i < len(a); i++ {
		a[i] = readInt()
	}
	sort.Ints(a)
	sum := 0
	minPos := -1
	minNeg := 1
	for i := len(a) - 1; i >= 0; i-- {
		if a[i] > 0 {
			sum += a[i]
			if a[i]%2 != 0 {
				minPos = a[i]
			}
		} else {
			if a[i]%2 != 0 {
				minNeg = a[i]
				break
			}
		}
	}
	if sum%2 == 0 {
		if minNeg != 1 && minPos != -1 {
			if sum-minPos > sum+minNeg {
				fmt.Println(sum - minPos)
			} else {
				fmt.Println(sum + minNeg)
			}
		} else if minNeg != 1 {
			fmt.Println(sum + minNeg)
		} else {
			fmt.Println(sum + minNeg)
		}
	} else {
		fmt.Println(sum)
	}
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

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

// IO

func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

func readInt64Array(n int) []int64 {
	res := make([]int64, n)
	for i := 0; i < n; i++ {
		res[i] = readInt64()
	}
	return res
}


A group of $$$n$$$ friends decide to go to a restaurant. Each of the friends plans to order meals for $$$x_i$$$ burles and has a total of $$$y_i$$$ burles ($$$1 \le i \le n$$$). The friends decide to split their visit to the restaurant into several days. Each day, some group of at least two friends goes to the restaurant. Each of the friends visits the restaurant no more than once (that is, these groups do not intersect). These groups must satisfy the condition that the total budget of each group must be not less than the amount of burles that the friends in the group are going to spend at the restaurant. In other words, the sum of all $$$x_i$$$ values in the group must not exceed the sum of $$$y_i$$$ values in the group.What is the maximum number of days friends can visit the restaurant?For example, let there be $$$n = 6$$$ friends for whom $$$x$$$ = [$$$8, 3, 9, 2, 4, 5$$$] and $$$y$$$ = [$$$5, 3, 1, 4, 5, 10$$$]. Then:   first and sixth friends can go to the restaurant on the first day. They will spend $$$8+5=13$$$ burles at the restaurant, and their total budget is $$$5+10=15$$$ burles. Since $$$15 \ge 13$$$, they can actually form a group.  friends with indices $$$2, 4, 5$$$ can form a second group. They will spend $$$3+2+4=9$$$ burles at the restaurant, and their total budget will be $$$3+4+5=12$$$ burles ($$$12 \ge 9$$$). It can be shown that they will not be able to form more groups so that each group has at least two friends and each group can pay the bill.So, the maximum number of groups the friends can split into is $$$2$$$. Friends will visit the restaurant for a maximum of two days. Note that the $$$3$$$-rd friend will not visit the restaurant at all.Output the maximum number of days the friends can visit the restaurant for given $$$n$$$, $$$x$$$ and $$$y$$$.

The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the test. The descriptions of the test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the number of friends. The second line of each test case contains exactly $$$n$$$ integers $$$x_1, x_2, \dots, x_n$$$ ($$$1 \le x_i \le 10^9$$$). The value of $$$x_i$$$ corresponds to the number of burles that the friend numbered $$$i$$$ plans to spend at the restaurant. The third line of each test case contains exactly $$$n$$$ integers $$$y_1, y_2, \dots, y_n$$$ ($$$1 \le y_i \le 10^9$$$). The value $$$y_i$$$ corresponds to the number of burles that the friend numbered $$$i$$$ has. It is guaranteed that the sum of $$$n$$$ values over all test cases does not exceed $$$10^5$$$.

For each test case, print the maximum number of days to visit the restaurant. If friends cannot form even one group to visit the restaurant, print 0.

NoteThe first test case in explained in the problem statement.In the second test case, friends cannot form at least one group of two or more people.In the third test case, one way to visit the restaurant in one day is to go in a group of all three friends ($$$1+3+10 \ge 2+3+7$$$). Note that they do not have the option of splitting into two groups.

package main

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

var (
	LineBreak byte = '\n'
	shift          = 2
)

func init() {
	if runtime.GOOS == "windows" {
		return
	}

	shift--

}

// ReadLine ...
func ReadLine(buf *bufio.Reader) (line string) {
	line, _ = buf.ReadString(LineBreak)
	line = line[:len(line)-shift] // eliline "\r\n" in window
	line = strings.Trim(line, " ")
	return
}

func fillSliceBySplitStr(split []string, slice []int) []int {
	for i := 0; i < len(split); i++ {
		slice[i], _ = strconv.Atoi(split[i])
	}

	return slice
}

// parseInput ...
func parseInput(buf *bufio.Reader) ([]int, []int) {
	size, _ := strconv.Atoi(ReadLine(buf))
	// fmt.Printf("size:%v", size)
	xSlice := make([]int, size)
	ySlice := make([]int, size)

	xSlice = fillSliceBySplitStr(strings.Split(ReadLine(buf), " "), xSlice)
	ySlice = fillSliceBySplitStr(strings.Split(ReadLine(buf), " "), ySlice)

	return xSlice, ySlice
}

func FindMaximumGroup(x []int, y []int) {
	for i := 0; i < len(x); i++ {
		y[i] -= x[i]
	}

	sort.Ints(y)

	l, r := 0, len(y)-1
	var count int
	for l < r && y[r] > -1 {
		if y[r]+y[l] < 0 {
			l++
			continue
		}

		count++
		r--
		l++
	}

	fmt.Println(count)
}

func main() {
	buf := bufio.NewReader(os.Stdin)
	defer os.Stdin.Close()

	queSize, _ := strconv.Atoi(ReadLine(buf))

	for queSize > 0 {
		x, y := parseInput(buf)
		FindMaximumGroup(x, y)
		queSize--
	}
}

package main

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

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

func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanws(a ...interface{})           { fmt.Fscan(reader, a...) }

func main() {

	defer writer.Flush()
	var tc, n int
	var x, y, c []int

	scanws(&tc)
	for t := 0; t < tc; t++ {

		x, y, c = nil, nil, nil

		scanws(&n)

		for i := 0; i < n; i++ {
			var a int
			scanws(&a)

			x = append(x, a)
		}

		for i := 0; i < n; i++ {
			var a int
			scanws(&a)

			y = append(y, a)
		}

		for i := 0; i < n; i++ {
			p := y[i] - x[i]

			c = append(c, p)
		}

		sort.Ints(c)

		nn := n - 1
		idx := 0
		ans := 0

		for idx < nn {
			if c[idx] + c[nn] >= 0 {
				ans++
				nn--
			}
			idx++
		}

		printf("%d\n", ans)

	}

}

package main

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

type it struct {
	x, y int
}

var x = [100005]int{}
var y = [100005]int{}

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

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	var t, n int
	scanf("%d \n", &t)
	for t > 0 {
		t--
		scanf("%d \n", &n)
		a := []it{}
		for i := 1; i <= n; i++ {
			scanf("%d", &x[i])
		}
		scanf("\n")
		for i := 1; i <= n; i++ {
			scanf("%d", &y[i])
		}
		scanf("\n")
		for i := 1; i <= n; i++ {
			a = append(a, it{
				x: x[i],
				y: y[i],
			})
		}
		sort.Slice(a, func(i, j int) bool {
			return (a[i].y - a[i].x) < (a[j].y - a[j].x)
		})
		res := 0
		u, v := 0, len(a)-1
		for u < v {
			if a[u].x+a[v].x <= a[u].y+a[v].y {
				res++
				u++
				v--
			} else {
				u++
			}
		}
		fmt.Println(res)
	}
}

package main

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

type it struct {
	x, y int
}

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 main() {
	var t, n int
	in := bufio.NewReader(os.Stdin)
	t = readInt(in)
	for t > 0 {
		t--
		n = readInt(in)
		a := []it{}
		x := readArrInt(in)
		y := readArrInt(in)
		for i := 0; i < n; i++ {
			a = append(a, it{
				x: x[i],
				y: y[i],
			})
		}
		sort.Slice(a, func(i, j int) bool {
			return (a[i].y - a[i].x) < (a[j].y - a[j].x)
		})
		res := 0
		u, v := 0, len(a)-1
		for u < v {
			if a[u].x+a[v].x <= a[u].y+a[v].y {
				res++
				u++
				v--
			} else {
				u++
			}
		}
		fmt.Println(res)
	}
}

package main

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

func solve() {
	n := get()
	x := make([]int, n)
	y := make([]int, n)
	delta := make([]int, n)
	for i := 0; i < n; i++ {
		x[i] = get()
	}
	for i := 0; i < n; i++ {
		y[i] = get()
	}
	for i := 0; i < n; i++ {
		delta[i] = y[i] - x[i]
	}
	sort.Ints(delta)
	l, r := 0, n-1
	cnt := 0
	for l < r {
		if delta[l]+delta[r] >= 0 {
			cnt++
			r--
			l++
		} else {
			l++
		}
	}
	put(cnt)
	puts("\n")

}

const (
	maxBufSize = 10000000
)

func main() {
	in = bufio.NewScanner(bufio.NewReader(os.Stdin))
	in.Split(bufio.ScanWords)
	in.Buffer(make([]byte, maxBufSize), maxBufSize)
	out = bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := get()
	for i := 0; i < t; i++ {
		solve()
	}
}

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 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 line() {
	out.WriteRune('\n')
}

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

package main

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

func main() {
	var testCases int

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

	defer writer.Flush()

	fmt.Fscan(reader, &testCases)

	for testCase := 0; testCase < testCases; testCase++ {
		var n int
		fmt.Fscan(reader, &n)
		friendsSpendings := make([]int, n)
		friendsBudgets := make([]int, n)

		for xi := 0; xi < n; xi++ {
			var x int
			fmt.Fscan(reader, &x)
			friendsSpendings[xi] = x
		}
		for yi := 0; yi < n; yi++ {
			var x int
			fmt.Fscan(reader, &x)
			friendsBudgets[yi] = x
		}

		output := solveD(&friendsSpendings, &friendsBudgets, n)
		fmt.Fprintln(writer, output)
	}
}

func solveD(fs, fb *[]int, n int) int {
	noOfDays := 0
	diffs := make([]int, n)
	visited := make([]int, n)
	for i, v := range *fs {
		diffs[i] = (*fb)[i] - v
	}
	sort.Ints(diffs)

	for rigthPtr := n - 1; rigthPtr > 0; rigthPtr-- {
		if diffs[rigthPtr] >= 0 {

			leftPtr := 0
			for i, v := range visited {
				if v == 0 {
					leftPtr = i
					break
				}
			}
			for leftPtr < rigthPtr {
				bal := diffs[rigthPtr] + diffs[leftPtr]
				if bal >= 0 && visited[leftPtr] == 0 {
					visited[leftPtr] = 1
					noOfDays++
					break
				}
				leftPtr++
			}
		}
	}

	return noOfDays
}

package main

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

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

func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanws(a ...interface{})           { fmt.Fscan(reader, a...) }

func main() {

	defer writer.Flush()
	var tc, n int
	var x, y []int
	var cst []int

	scanws(&tc)
	for t := 1; t <= tc; t++ {
		scanws(&n)
		x = nil
		y = nil
		cst = nil
		for i := 0; i < n; i++ {
			var a int
			scanws(&a)
			x = append(x, a)
		}
		for i := 0; i < n; i++ {
			var a int
			scanws(&a)
			y = append(y, a)
		}
		for i := 0; i < n; i++ {
			c := y[i] - x[i]
			cst = append(cst, c)
		}
		sort.Slice(cst, func(i, j int) bool {
			return cst[i] < cst[j]
		})
		nn := n - 1
		idx := 0
		ans := 0
		for idx < nn {
			if cst[idx]+cst[nn] >= 0 {
				ans++
				nn--
			}
			idx++
		}
		printf("%d\n", ans)
	}

}

package main

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

func main() {
	// f, err := os.OpenFile("data.txt", os.O_RDONLY, 0644)
	// if err != nil {
	// 	os.Exit(-2)
	// }

	// r := bufio.NewReader(f)
	w := bufio.NewWriter(os.Stdout)
	r := bufio.NewReader(os.Stdin)
	Solve(r, w, w.Flush)
}

func Solve(reader io.Reader, writer io.Writer, Flush func() error) {
	var t int
	fmt.Fscanln(reader, &t)

	for ; t > 0; t-- {
		var n int
		fmt.Fscanln(reader, &n)
		X := make([]int, n)
		Y := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscanf(reader, "%d", &X[i])
		}
		fmt.Fscanln(reader)
		for i := 0; i < n; i++ {
			fmt.Fscanf(reader, "%d", &Y[i])
		}
		fmt.Fscanln(reader)
		vs := make(VS, n)
		for i := 0; i < n; i++ {
			vs[i] = &V{x: X[i], y: Y[i]}
		}
		sort.Sort(&vs)
		// fmt.Fprintln(writer, n)
		// for i := 0; i < len(vs); i++ {
		// 	fmt.Fprintln(writer, vs[i].x, vs[i].y)
		// }

		count := 0
		for i, j := 0, len(vs)-1; i < j; {
			a, b := vs[i], vs[j]
			if a.y+b.y >= a.x+b.x {
				count++
				i++
				j--
				continue
			}
			j--
		}
		fmt.Fprintln(writer, count)
		Flush()
	}

}

type V struct {
	x, y int
}

type VS []*V

func (v *VS) Len() int           { return len(*v) }
func (v *VS) Less(a, b int) bool { return (*v)[a].y-(*v)[a].x > (*v)[b].y-(*v)[b].x }
func (v *VS) Swap(a, b int)      { (*v)[a], (*v)[b] = (*v)[b], (*v)[a] }

package main

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

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func main() {

	defer out.Flush()

	t := 0
	if _, err := fmt.Fscan(in, &t); err != nil {
		return
	}

	for ; t > 0; t-- {
		n := 0
		if _, err := fmt.Fscan(in, &n); err != nil {
			return
		}
		x := make([]int, n)
		for i := 0; i < n; i++ {
			if _, err := fmt.Fscan(in, &x[i]); err != nil {
				return
			}
		}
		y := make([]int, n)
		for i := 0; i < n; i++ {
			if _, err := fmt.Fscan(in, &y[i]); err != nil {
				return
			}
		}
		a := make([]int, 0, n)
		b := make([]int, 0, n)
		for i := 0; i < n; i++ {
			tmp := y[i] - x[i]
			if tmp >= 0 {
				b = append(b, tmp)
			} else {
				a = append(a, tmp)
			}
		}
		// reverse sort a
		sort.Slice(a, func(i, j int) bool {
			return a[i] > a[j]
		})
		sort.Ints(b)
		//fmt.Fprintln(out, a)
		//fmt.Fprintln(out, b)
		ans := 0
		l, r := 0, 0
		for l < len(a) && r < len(b) {
			for r < len(b) && b[r] < -a[l] {
				r++
			}
			if r < len(b) && b[r] >= -a[l] {
				ans++
				l++
				r++
			}
		}
		ans += (len(b) - ans) / 2
		fmt.Fprintln(out, ans)
	}
}

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)

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

		cc := make([]int, n)
		for i := range cc {
			cc[i] = bb[i] - aa[i]
		}
		sort.Ints(cc)
		p1, p2 := 0, n-1
		var tot int
		for p2 > p1 {
			if cc[p2]+cc[p1] >= 0 {
				tot++
				p2--
			}
			p1++
		}
		fmt.Fprintln(out, tot)
	}
}

package main

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

func main() {
	in, out := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var tests = 1
	Fscan(in, &tests)

	var run_case func()
	run_case = func() {
		var n, ans int
		Fscan(in, &n)
		a := make([]int, n)
		for i := 0; i < n; i++ {
			Fscan(in, &a[i])
		}
		b := make([]int, n)
		for i := 0; i < n; i++ {
			Fscan(in, &b[i])
		}
		c := make([]int, n)
		for i := 0; i < n; i++ {
			c[i] = b[i] - a[i]
		}
		sort.Ints(c)
		i, j := 0, n-1
		for i < j {
			if c[i]+c[j] >= 0 {
				i++
				j--
				ans++
			} else {
				i++
			}
		}
		Fprintln(out, ans)
	}

	for i := 0; i < tests; i++ {
		run_case()
	}
}

package main

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

var in *bufio.Reader
var out *bufio.Writer

////////////////////////////////////////////////

func f(a []int, m int) bool {
	n := len(a)
	for i := 0; i < m; i++ {
		if a[n-i-1]+a[n-2*m+i] < 0 {
			return false
		}
	}
	return true
}

func solve() {
	n := ReadInt()
	x := ReadInts(n)
	y := ReadInts(n)

	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = y[i] - x[i]
	}

	sort.Ints(a)

	l := 0
	r := n/2 + 1
	for l < r {
		m := (l + r) / 2

		if f(a, m) {
			l = m + 1
		} else {
			r = m
		}
	}
	Println(l - 1)
}

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

	t := 1
	t = ReadInt()

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

func ReadInt() int {
	var x int
	fmt.Fscan(in, &x)
	return x
}

func ReadInts(n int) []int {
	a := make([]int, n)
	for i, _ := range a {
		a[i] = ReadInt()
	}
	return a
}

func ReadString() string {
	var x string
	fmt.Fscan(in, &x)
	return x
}

func Print(a ...any) {
	fmt.Fprint(out, a...)
}

func Println(a ...any) {
	fmt.Fprintln(out, a...)
}

type IntPair struct {
	x int
	y int
}

func Iota(a []int, start int) {
	for i := 0; i < len(a); i++ {
		a[i] = start
		start++
	}
}

func NextPermutation(a []int) bool {
	n := len(a)
	pos := n - 2
	for ; pos >= 0; pos-- {
		if a[pos] < a[pos+1] {
			break
		}
	}
	if pos == -1 {
		return false
	}
	for i := n - 1; i >= 0; i-- {
		if a[i] > a[pos] {
			a[i], a[pos] = a[pos], a[i]
			Reverse(a[pos+1 : n])
			break
		}
	}
	return true
}

func Reverse(a []int) {
	n := len(a)
	for i := 0; i < n/2; i++ {
		a[i], a[n-i-1] = a[n-i-1], a[i]
	}
}

func RemoveIf(a []int, cond func(int) bool) []int {
	n := len(a)
	pos := 0
	for i := 0; i < n; i++ {
		if !cond(a[i]) {
			a[pos] = a[i]
			pos++
		}
	}
	return a[0:pos]
}

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

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

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

package main

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

var (
	LineBreak byte = '\n'
	shift          = 2
)

func init() {
	if runtime.GOOS == "windows" {
		return
	}

	shift--

}

// ReadLine ...
func ReadLine(buf *bufio.Reader) (line string) {
	line, _ = buf.ReadString(LineBreak)
	line = line[:len(line)-shift] // eliline "\r\n" in window
	line = strings.Trim(line, " ")
	return
}

func fillSliceBySplitStr(split []string, slice []int) []int {
	for i := 0; i < len(split); i++ {
		slice[i], _ = strconv.Atoi(split[i])
	}

	return slice
}

// parseInput ...
func parseInput() ([]int, []int) {
	buf := bufio.NewReader(os.Stdin)
	defer os.Stdin.Close()

	size, _ := strconv.Atoi(ReadLine(buf))
	// fmt.Printf("size:%v", size)
	xSlice := make([]int, size)
	ySlice := make([]int, size)

	xSlice = fillSliceBySplitStr(strings.Split(ReadLine(buf), " "), xSlice)
	ySlice = fillSliceBySplitStr(strings.Split(ReadLine(buf), " "), ySlice)

	return xSlice, ySlice
}

func FindMaximumGroup(x []int, y []int) {
	for i := 0; i < len(x); i++ {
		y[i] -= x[i]
	}

	sort.Ints(y)

	l, r := 0, len(y)-1
	var count int
	for l < r && y[r] > -1 {
		if y[r]+y[l] < 0 {
			l++
			continue
		}

		count++
		r--
		l++
	}

	fmt.Println(count)
}

func main() {
	x, y := parseInput()
	FindMaximumGroup(x, y)
}

package main

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

var (
	LineBreak byte = '\n'
	shift          = 2
)

func init() {
	if runtime.GOOS == "windows" {
		return
	}

	shift--

}

// ReadLine ...
func ReadLine(buf *bufio.Reader) (line string) {
	line, _ = buf.ReadString(LineBreak)
	line = line[:len(line)-shift] // eliline "\r\n" in window
	line = strings.Trim(line, " ")
	return
}

func fillSliceBySplitStr(split []string, slice []int) []int {
	for i := 0; i < len(split); i++ {
		slice[i], _ = strconv.Atoi(split[i])
	}

	return slice
}

// parseInput ...
func parseInput() ([]int, []int) {
	buf := bufio.NewReader(os.Stdin)
	defer os.Stdin.Close()

	size, _ := strconv.Atoi(ReadLine(buf))
	// fmt.Printf("size:%v", size)
	xSlice := make([]int, size)
	ySlice := make([]int, size)

	xSlice = fillSliceBySplitStr(strings.Split(ReadLine(buf), " "), xSlice)
	ySlice = fillSliceBySplitStr(strings.Split(ReadLine(buf), " "), ySlice)

	return xSlice, ySlice
}

func FindMaximumGroup(x []int, y []int) {
	for i := 0; i < len(x); i++ {
		y[i] -= x[i]
	}

	sort.Ints(y)

	l, r := 0, len(y)-1
	var count int
	for l < r && y[r] > 0 {
		if y[r]+y[l] < 0 {
			l++
			continue
		}

		count++
		r--
		l++
	}

	fmt.Println(count)
}

func main() {
	x, y := parseInput()
	FindMaximumGroup(x, y)
}

package main

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

var (
	LineBreak byte = '\n'
	shift          = 2
)

func init() {
	if runtime.GOOS == "window" {
		return
	}

	shift--

	if runtime.GOOS == "mac" {
		LineBreak = '\r'
	}
}

// ReadLine ...
func ReadLine(buf *bufio.Reader) (line string) {
	line, _ = buf.ReadString(LineBreak)
	line = line[:len(line)-shift] // eliline "\r\n" in window
	return
}

func fillSliceBySplitStr(split []string, slice []int) []int {
	for i := 0; i < len(split); i++ {
		slice[i], _ = strconv.Atoi(split[0])
	}

	return slice
}

// parseInput ...
func parseInput() ([]int, []int) {
	buf := bufio.NewReader(os.Stdin)

	size, _ := strconv.Atoi(ReadLine(buf))
	xSlice := make([]int, size)
	ySlice := make([]int, size)

	xSlice = fillSliceBySplitStr(strings.SplitN(ReadLine(buf), " ", size), xSlice)
	ySlice = fillSliceBySplitStr(strings.SplitN(ReadLine(buf), " ", size), ySlice)

	return xSlice, ySlice
}

func FindMaximumGroup(x []int, y []int) {
	var ySum, xSum int
	for i := 0; i < len(x); i++ {
		xSum += x[i]
		ySum += y[i]
		y[i] -= x[i]
	}

	if ySum < xSum {
		fmt.Println(0)
		return
	}

	sort.Ints(y)

	l, r := 0, len(y)
	var count int
	for l < r && y[r] > 0 {
		if y[r]+y[l] < 0 {
			l++
			continue
		}

		count++
		r--
		l++
	}

	fmt.Println(count)
}

func main() {
	x, y := parseInput()
	FindMaximumGroup(x, y)
}

package main

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

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

func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanws(a ...interface{})           { fmt.Fscan(reader, a...) }

func main() {

	defer writer.Flush()
	var tc, n int
	var x, y, c []int

	scanws(&tc)
	for t := 0; t < tc; t++ {

		x, y, c = nil, nil, nil

		scanws(&n)

		for i := 0; i < n; i++ {
			var a int
			scanws(&a)

			x = append(x, a)
		}

		for i := 0; i < n; i++ {
			var a int
			scanws(&a)

			y = append(y, a)
		}

		for i := 0; i < n; i++ {
			p := x[i] - y[i]

			c = append(c, p)
		}

		sort.Ints(c)

		nn := n -1
		idx := 0
		ans := 0

		for idx < nn {
			if c[idx] + c[nn] >= 0 {
				ans++
				nn--
			}
			idx++
		}

		printf("%d\n", ans)

	}

}

package main

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

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

func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanws(a ...interface{})           { fmt.Fscan(reader, a...) }

func main() {

	defer writer.Flush()
	var tc, n int
	var x, y, c []int
	x, y, c = nil, nil, nil

	scanws(&tc)
	for t := 0; t < tc; t++ {

		scanws(&n)

		for i := 0; i < n; i++ {
			var a int
			scanws(&a)

			x = append(x, a)
		}

		for i := 0; i < n; i++ {
			var a int
			scanws(&a)

			y = append(y, a)
		}

		for i := 0; i < n; i++ {
			p := x[i] - y[i]

			c = append(c, p)
		}

		sort.Ints(c)

		nn := n -1
		idx := 0
		ans := 0

		for idx < nn {
			if c[idx] + c[nn] >= 0 {
				ans++
				nn--
			}
			idx++
		}

		printf("%d\n", ans)

	}

}

package main

import (
    "fmt"
)

func main() {
    fmt.Println("prova")
}


The title is a reference to the very first Educational Round from our writers team, Educational Round 18.There is a bag, containing colored balls. There are $$$n$$$ different colors of balls, numbered from $$$1$$$ to $$$n$$$. There are $$$\mathit{cnt}_i$$$ balls of color $$$i$$$ in the bag. The total amount of balls in the bag is odd (e. g. $$$\mathit{cnt}_1 + \mathit{cnt}_2 + \dots + \mathit{cnt}_n$$$ is odd).In one move, you can choose two balls with different colors and take them out of the bag.At some point, all the remaining balls in the bag will have the same color. That's when you can't make moves anymore.Find any possible color of the remaining balls.

The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of testcases. The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 20$$$) — the number of colors. The second line contains $$$n$$$ integers $$$\mathit{cnt}_1, \mathit{cnt}_2, \dots, \mathit{cnt}_n$$$ ($$$1 \le \mathit{cnt}_i \le 100$$$) — the amount of balls of each color in the bag. The total amount of balls in the bag is odd (e. g. $$$\mathit{cnt}_1 + \mathit{cnt}_2 + \dots + \mathit{cnt}_n$$$ is odd).

For each testcase, print a single integer — any possible color of the remaining balls, after you made some moves and can't make moves anymore.

NoteIn the first testcase, your first and only move can be one of the following:   take balls with colors $$$1$$$ and $$$2$$$;  take balls with colors $$$1$$$ and $$$3$$$;  take balls with colors $$$2$$$ and $$$3$$$. After the move, exactly one ball will remain. Its color can be $$$3, 2$$$ or $$$1$$$ depending on the move.In the second testcase, you can't make moves at all — there is only color of balls already. This color is $$$1$$$.In the third testcase, you can keep removing one ball of color $$$1$$$ and one ball of color $$$2$$$ until there are no more balls of color $$$1$$$. At the end, three balls of color $$$2$$$ remain.

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Scan()
	n, _ := strconv.Atoi(scanner.Text())

	for i := 0;i < n;i++ {
		scanner.Scan()
		color, _ := strconv.Atoi(scanner.Text())
		if color == 1 {
			scanner.Scan()
			fmt.Println(1)
			continue
		}

		arr := make([]int, color)
		sum := 0
		for j := 0;j < color;j++ {
			scanner.Scan()
			arr[j], _ = strconv.Atoi(scanner.Text())
			sum += arr[j]
		}
		//fmt.Println(arr)
		_, j := max(arr)
		fmt.Println(j + 1)

		//res := 0
		//for j := 0;j < color;j++ {
		//	arr[j]--
		//	m := max(arr)
		//	if m <= sum - m {
		//		//res++
		//		fmt.Println(j+1)
		//		break
		//	}
		//	arr[j]++
		//}

		//fmt.Println(res)
	}
}

func max(arr []int) (int, int) {
	m, i := 0, 0
	for j, a := range arr {
		if a > m {
			m = a
			i = j
		}
	}
	return m, i
}

package main

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

type testCase struct {
	numOfColors int
	balls       []int
}

func main() {
	input := bufio.NewReader(os.Stdin)
	data, _, _ := input.ReadLine()
	numOfTestCases, _ := strconv.Atoi(string(data))
	testCases := make([]testCase, numOfTestCases)
	// each testcase
	for i := 0; i < numOfTestCases; i++ {
		// amount
		data, _, _ = input.ReadLine()
		testCases[i].numOfColors, _ = strconv.Atoi(string(data))
		testCases[i].balls = make([]int, testCases[i].numOfColors)
		// balls
		data, _, _ = input.ReadLine()
		ballStrArr := strings.Fields(string(data))
		for j := 0; j < testCases[i].numOfColors; j++ {
			testCases[i].balls[j], _ = strconv.Atoi(ballStrArr[j])
		}
	}
	// start
	for _, tc := range testCases {
		// find max
		max, maxIdx := -1, -1
		for i, num := range tc.balls {
			if num > max {
				maxIdx, max = i, num
			}
		}
		fmt.Println(maxIdx + 1)
	}
}

package main
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 int
		fmt.Fscan(in,&n)
		list:= make([]int,n)
		for j:=0;j<n;j++{
			fmt.Fscan(in,&list[j])
		}
		largest:=0
		index:=0
		for j:=0;j<n;j++{
			if list[j] >= largest {
				largest= list[j]
				index= j+1
			}
		}
		fmt.Fprintln(out,index)
	}
}

package main

import (
	"fmt"
)

func main() {
	codeForces()

}

func codeForces() {
	var t int
	fmt.Scan(&t)
	for i := 0; i < t; i++ {
		solve()
	}
}

func solve() {
	var n int
	fmt.Scan(&n)
	var arr []int
	for j := 0; j < n; j++ {
		var value int
		fmt.Scan(&value)
		arr = append(arr, value)
	}
	var indexMax = 0
	for i := 0; i < len(arr); i++ {
		if arr[indexMax] < arr[i] {
			indexMax = i
		}
	}
	fmt.Println(indexMax + 1)
}

package main

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

func value(arr []int) int {
	x := 0
	for _, z := range arr {
		if x < z {
			x += z
		} else {
			x = 0
		}
	}
	return x
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	nrTests, _ := strconv.Atoi(scanner.Text())
	for i := 0; i < nrTests; i++ {
		var answer, cur int
		scanner.Scan()
		scanner.Text()
		//nrCols, _ := strconv.Atoi(scanner.Text())
		scanner.Scan()
		numCols := strings.Split(scanner.Text(), " ")
		for i, nc := range numCols {
			x, _ := strconv.Atoi(nc)
			if x > cur {
				answer = i + 1
				cur = x
			}
		}
		fmt.Println(answer)
	}
}

package main

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

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func scan(a ...interface{}) {
	fmt.Fscan(in, a...)
}
func printf(f string, a ...interface{}) {
	fmt.Fprintf(out, f, a...)
}
func solve() {
	var n int
	scan(&n)
	a := make([]int, n+1)
	r := -1
	max := -1
	for i := 1; i <= n; i++ {
		scan(&a[i])
		if a[i] > max {
			max = a[i]
			r = i
		}
	}
	printf("%d\n", r)
}
func main() {
	defer out.Flush()
	n := 0
	scan(&n)
	for i := 0; i < n; i++ {
		solve()
	}
}

package main

import "fmt"

func main() {
	var t, n, x, mx, id int
	fmt.Scan(&t)
	for ; t > 0; t-- {
	    mx=0
		fmt.Scan(&n)
		for i := 0; i < n; i++ {
			fmt.Scan(&x)
			if mx < x {
				mx = x
				id = i + 1
			}
		}
		fmt.Println(id)
	}
}

package main

import (
    "fmt"
)

func main() {
    var t int
    fmt.Scan(&t)
    for t != 0  {
        t--
        var n int
        fmt.Scan(&n)
        a := make([]int, n)
        mx := 0
        index := 0
        for i := 0; i < n; i++ {
            fmt.Scan(&a[i])
            if mx < a[i] {
                mx = a[i]
                index = i
            }
        }
        fmt.Println(index + 1)
    }
}

package main

import (
	"fmt"
	"os"
)

func solve() {
	n := readInt()

	mx := 0
	ans := 0
	for i := 0; i < n; i++ {
		x := readInt()
		if x > mx {
			mx = x
			ans = i + 1
		}
	}

	fmt.Println(ans)
}

func main() {
	t := readInt()

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

func readInt() int {
	var x int
	fmt.Fscan(os.Stdin, &x)
	return x
}

package main

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

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

	var t, n, max_cnt, max_cnt_index, temp int

	for fmt.Fscan(r, &t); t > 0; t-- {
		fmt.Fscan(r, &n)
		max_cnt = 0
		max_cnt_index = 1
		for i := 1; i <= n; i++ {
			fmt.Fscan(r, &temp)
			if temp > max_cnt {
				max_cnt = temp
				max_cnt_index = i
			}
		}
		fmt.Fprintln(w, max_cnt_index)
	}
}

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 main() {
	var t, n int
	in := bufio.NewReader(os.Stdin)
	t = readInt(in)
	for t > 0 {
		t--
		n = readInt(in)
		x := readArrInt(in)
		res := x[0]
		vt := 1
		for i := 0; i < n; i++ {
			if x[i] > res {
				res = x[i]
				vt = i + 1
			}
		}
		fmt.Println(vt)
	}
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scan(&t)
	for t != 0 {
		t--
		var n int
		fmt.Scan(&n)
		var m int
		var mi int
		var i int = 1
		for n != 0 {
			n--
			var ai int
			fmt.Scan(&ai)
			if ai > m {
				m = ai
				mi = i
			}
			i++
		}
		fmt.Println(mi)
	}
}

// https://codeforces.com/contest/1728/problem/A

package main

import (
	"fmt"
	"math"
)

func main() {
	var t int
	fmt.Scan(&t)
	for i := 0; i < t; i++ {
		var n int
		fmt.Scan(&n)
		a := make([]int, n)
		maxn := math.MinInt
		temp := math.MinInt
		for j := 0; j < n; j++ {
			fmt.Scan(&a[j])
			if a[j] >= maxn {
				maxn = a[j]
				temp = j
			}
		}
		fmt.Println(temp + 1)
	}
}

package main

import (
	"fmt"
)

const N = 3e1
const inf = 1e9

func main() {
	var t int
	fmt.Scan(&t)
	for t > 0 {
		t--
		var n int
		fmt.Scan(&n)
		var a [N]int
		ma := 0
		o := 0
		for i := 0; i < n; i++ {
			fmt.Scan(&a[i])
			if a[i] > ma {
				ma = a[i]
				o = i + 1
			}
		}
		fmt.Println(o)
	}
}

package main

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

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

func (in *CF1728A) 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 *CF1728A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

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

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

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

/**
Run solve the problem CF1728A
Date: 9/9/2022
User: wotan
URL: https://codeforces.com/problemset/problem/1728/A
Problem: CF1728A
**/
func (in *CF1728A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()

		max := -1
		color := 0
		for i := 0; i < n; i++ {
			val := in.NextInt()
			if val > max {
				max = val
				color = i + 1
			}
		}

		fmt.Println(color)
	}
}

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

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

package main

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

var in = bufio.NewReader(os.Stdin)

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

	for ; t > 0; t-- {
		var n int
		fmt.Fscan(in, &n)
		var max int
		var maxIdx int
		for i := 0; i < n; i++ {
			var tmp int
			fmt.Fscan(in, &tmp)
			if tmp > max {
				max = tmp
				maxIdx = i
			}
		}
		fmt.Println(maxIdx + 1)
	}
}

package main

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

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

func solve(n int, cnt []int) int {
	var m, pm int
	for x, y := range cnt {
		if y > m {
			m = y
			pm = x
		}
	}
	return pm + 1
}

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

package main

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

func main() {
	defer writer.Flush()
	Solve()
}

func Solve() {
	var t, n, tot uint
	var cnt []uint
	scanws(&t)
	for t > 0 {
		scanws(&n)
		cnt = make([]uint, n)
		for i := range cnt {
			scanws(&cnt[i])
			tot += cnt[i]
		}
		switch {
		case n == 1:
			printf("%d\n", 1)
		default:
			idx:=getMaxIndex(cnt)
			printf("%d\n", idx)
		}
		t--
	}

}

func getMaxIndex(arr []uint) int {
	var currMaxIdx, i int
	n := len(arr)
	for i = 1; i < n; i++ {
		if arr[i] > arr[currMaxIdx] {
			currMaxIdx = i
		}
	}
	return currMaxIdx + 1
}

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanws(a ...interface{}) { fmt.Fscan(reader, a...) }

package main

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

var a [200005]int

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

package main

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

func solution(reader io.Reader, writer io.Writer) {
	var t int
	fmt.Fscan(reader, &t)

	for i := 0; i < t; i++ {
		var n, res, max int
		fmt.Fscan(reader, &n)

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

			if a[j] > max {
				max = a[j]
				res = j
			}
		}

		fmt.Fprintln(writer, res+1)

	}
}

func timeTrack(start time.Time) {
	elapsed := time.Since(start)
	fmt.Printf("Execution time %f", elapsed.Seconds())
}

func main() {
	var stdin *os.File
	var stdout *os.File

	LOCAL, _ := strconv.ParseBool(os.Getenv("LOCAL"))

	if LOCAL {
		defer timeTrack(time.Now())

		stdin, _ = os.Open("file.in")
		defer stdin.Close()

		stdout, _ = os.Create("file.out")
		defer stdout.Close()
	} else {
		stdin = os.Stdin
		stdout = os.Stdout
	}

	reader := bufio.NewReaderSize(stdin, 64*1024)
	writer := bufio.NewWriterSize(stdout, 64*1024)
	defer writer.Flush()

	solution(reader, writer)
}

package main

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

var in, out = bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)

func main() {
	defer out.Flush()

	var tc, n, a, b, acolor int
	for fmt.Fscan(in, &tc); tc > 0; tc-- {
		fmt.Fscan(in, &n, &a)
		if n == 1 {
			fmt.Fprintln(out, "1")
			continue
		}
		acolor = 1
		for i := 2; i <= n; i++ {
			fmt.Fscan(in, &b)
			if b < a {
				a -= b
			} else {
				a, acolor = b-a, i
			}
		}
		fmt.Fprintln(out, acolor)
	}
}

package main

import "fmt"

func main() {
	var t, n, q int
	fmt.Scan(&t)
	for i := 0; i < t; i++ {
		maxx, max_j := -1, 0
		fmt.Scan(&n)
		for j := 0; j < n; j++ {
			fmt.Scan(&q)
			if q > maxx {
				maxx = q
				max_j = j
			}
		}
		fmt.Println(max_j + 1)
	}
}

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)

		var idx, max int
		for i := 0; i < n; i++ {
			var v int
			fmt.Fscan(in, &v)

			if v > max {
				idx = i
				max = v
			}
		}
		fmt.Fprintln(out, idx+1)
	}
}

package main

import (
	"fmt"
)

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

	for i := 0;i < n;i++ {
		var color int
		fmt.Scanf("%d", &color)
		fmt.Println(color)
		if color == 1 {
			fmt.Scanf("%d", &color)
			fmt.Println(color)
			fmt.Println(1)
			continue
		}

		arr := make([]int, color)
		sum := 0
		for j := 0;j < color;j++ {
			fmt.Scanf("%d", &arr[j])
			sum += arr[j]
		}
		fmt.Println(arr)
		_, j := max(arr)
		fmt.Println(j + 1)

		//res := 0
		//for j := 0;j < color;j++ {
		//	arr[j]--
		//	m := max(arr)
		//	if m <= sum - m {
		//		//res++
		//		fmt.Println(j+1)
		//		break
		//	}
		//	arr[j]++
		//}

		//fmt.Println(res)
	}
}

func max(arr []int) (int, int) {
	m, i := 0, 0
	for j, a := range arr {
		if a > m {
			m = a
			i = j
		}
	}
	return m, i
}

package main

import (
	"fmt"
)

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

	for i := 0;i < n;i++ {
		var color int
		fmt.Scanf("%d\n", &color)
		fmt.Println(color)
		if color == 1 {
			fmt.Scanf("%d\n", &color)
			fmt.Println(1)
			continue
		}

		arr := make([]int, color)
		sum := 0
		for j := 0;j < color;j++ {
			fmt.Scanf("%d", &arr[j])
			sum += arr[j]
		}
		fmt.Println(arr)
		_, j := max(arr)
		fmt.Println(j + 1)

		//res := 0
		//for j := 0;j < color;j++ {
		//	arr[j]--
		//	m := max(arr)
		//	if m <= sum - m {
		//		//res++
		//		fmt.Println(j+1)
		//		break
		//	}
		//	arr[j]++
		//}

		//fmt.Println(res)
	}
}

func max(arr []int) (int, int) {
	m, i := 0, 0
	for j, a := range arr {
		if a > m {
			m = a
			i = j
		}
	}
	return m, i
}

package main

import (
	"fmt"
)

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

	for i := 0;i < n;i++ {
		var color int
		fmt.Scanf("%d", &color)
		if color == 1 {
			fmt.Scanf("%d", &color)
			fmt.Println(1)
			continue
		}

		arr := make([]int, color)
		sum := 0
		for j := 0;j < color;j++ {
			fmt.Scanf("%d", &arr[j])
			sum += arr[j]
		}
		fmt.Println(arr)
		_, j := max(arr)
		fmt.Println(j + 1)

		//res := 0
		//for j := 0;j < color;j++ {
		//	arr[j]--
		//	m := max(arr)
		//	if m <= sum - m {
		//		//res++
		//		fmt.Println(j+1)
		//		break
		//	}
		//	arr[j]++
		//}

		//fmt.Println(res)
	}
}

func max(arr []int) (int, int) {
	m, i := 0, 0
	for j, a := range arr {
		if a > m {
			m = a
			i = j
		}
	}
	return m, i
}

package main

import (
	"fmt"
)

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

	for i := 0;i < n;i++ {
		var color int
		fmt.Scanf("%d", &color)
		if color == 1 {
			fmt.Scanf("%d", &color)
			fmt.Println(1)
			continue
		}

		arr := make([]int, color)
		sum := 0
		for j := 0;j < color;j++ {
			fmt.Scanf("%d", &arr[j])
			sum += arr[j]
		}
		_, j := max(arr)
		fmt.Println(j + 1)

		//res := 0
		//for j := 0;j < color;j++ {
		//	arr[j]--
		//	m := max(arr)
		//	if m <= sum - m {
		//		//res++
		//		fmt.Println(j+1)
		//		break
		//	}
		//	arr[j]++
		//}

		//fmt.Println(res)
	}
}

func max(arr []int) (int, int) {
	m, i := 0, 0
	for j, a := range arr {
		if a > m {
			m = a
			i = j
		}
	}
	return m, i
}

package main

import (
	"fmt"
)

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

	for i := 0;i < n;i++ {
		var color int
		fmt.Scanf("%d", &color)
		if color == 1 {
			fmt.Println(1)
			continue
		}

		arr := make([]int, color)
		sum := 0
		for j := 0;j < color;j++ {
			fmt.Scanf("%d", &arr[j])
			sum += arr[j]
		}

		res := 0
		for j := 0;j < color;j++ {
			arr[j]--
			m := max(arr)
			if m <= sum - m {
				res++
			}
			arr[j]++
		}

		fmt.Println(res)
	}
}

func max(arr []int) int {
	m := 0
	for _, a := range arr {
		if a > m {
			m = a
		}
	}
	return m
}

package main
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 int
		fmt.Fscan(in,&n)
		for j:=0;j<n;j++{
			var x int
			fmt.Fscan(in,&x)
		}
		fmt.Fprintln(out,n)
	}
}

package main

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

func value(arr []int) int {
	x := 0
	for _, z := range arr {
		if x < z {
			x += z
		} else {
			x = 0
		}
	}
	return x
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	nrTests, _ := strconv.Atoi(scanner.Text())
	for i := 0; i < nrTests; i++ {
		var answer, cur int
		scanner.Scan()
		scanner.Text()
		//nrCols, _ := strconv.Atoi(scanner.Text())
		scanner.Scan()
		numCols := strings.Split(scanner.Text(), " ")
		for i, nc := range numCols {
			x, _ := strconv.Atoi(nc)
			if x > cur {
				answer = i + 1
			}
		}
		fmt.Println(answer)
	}
}

package main

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

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func scan(a ...interface{}) {
	fmt.Fscan(in, a...)
}
func printf(f string, a ...interface{}) {
	fmt.Fprintf(out, f, a...)
}
func solve() {
	var n int
	scan(&n)
	a := make([]int, n+1)
	r := -1
	for i := 1; i <= n; i++ {
		scan(&a[i])
		if a[i]%2 == 1 {
			r = i
		}
	}
	printf("%d\n", r)
}
func main() {
	defer out.Flush()
	n := 0
	scan(&n)
	for i := 0; i < n; i++ {
		solve()
	}
}

package main

import "fmt"

func main() {
	var t, n, x, mx, id int
	fmt.Scan(&t)
	for ; t > 0; t-- {
		fmt.Scan(&n)
		for i := 0; i < n; i++ {
			fmt.Scan(&x)
			if mx < x {
				mx = x
				id = i + 1
			}
		}
		fmt.Println(id)
	}
}

package main

import (
    "fmt"
)

func main() {
    var t int
    fmt.Scanf("%d", &t)
    for t != 0  {
        t--
        var n int
        fmt.Scanf("%d", &n)
        a := make([]int, n)
        mx := 0
        index := 0
        for i := 0; i < n; i++ {
            fmt.Scanf("%d", &a[i])
            if mx < a[i] {
                mx = a[i]
                index = i
            }
        }
        fmt.Println(index + 1)
    }
}

package main

import (
	"fmt"
	"os"
)

func solve() {
	n := readInt()
	fmt.Println(n)

	mx := 0
	ans := 0
	for i := 0; i < n; i++ {
		x := readInt()
		if x > mx {
			mx = x
			ans = i + 1
		}
	}

	fmt.Println(ans)
}

func main() {
	t := readInt()

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

func readInt() int {
	var x int
	fmt.Fscan(os.Stdin, &x)
	return x
}