The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of testcases. The description of each test consists of one line containing one string consisting of six digits.

Output $$$t$$$ lines, each of which contains the answer to the corresponding test case. Output "YES" if the given ticket is lucky, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).

NoteIn the first test case, the sum of the first three digits is $$$2 + 1 + 3 = 6$$$ and the sum of the last three digits is $$$1 + 3 + 2 = 6$$$, they are equal so the answer is "YES".In the second test case, the sum of the first three digits is $$$9 + 7 + 3 = 19$$$ and the sum of the last three digits is $$$8 + 9 + 4 = 21$$$, they are not equal so the answer is "NO".In the third test case, the sum of the first three digits is $$$0 + 4 + 5 = 9$$$ and the sum of the last three digits is $$$2 + 0 + 7 = 9$$$, they are equal so the answer is "YES".

package main

import "fmt"

func main() {
	var T int
	var a string
	fmt.Scanln(&T)
	for T > 0 {
		fmt.Scanln(&a)
		sum1 := 0
		for i := 0; i < len(a)/2; i++ {
			sum1 += int(a[i] - '0')
		}
		sum2 := 0
		for i := len(a) / 2; i < len(a); i++ {
			sum2 += int(a[i] - '0')
		}

		if sum1 == sum2 {
			fmt.Printf("YES\n")
		} else {
			fmt.Printf("NO\n")
		}
		T--
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	var str string
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		fmt.Scanf("%s\n", &str)
		sum1 := 0
		sum2 := 0
		for j := 0; j < len(str); j++ {
			if j < 3 {
				sum1 = sum1 + int(str[j]) - '0'
			} else {
				sum2 = sum2 + int(str[j]) - '0'
			}
		}
		if sum1 == sum2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanln(&n)
	for i := 0; i < n; i++ {
		var s string
		fmt.Scanln(&s)
		if s[0]+s[1]+s[2] == s[3]+s[4]+s[5] {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

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

func sum(i int) (ans int) {
	for i != 0 {
		ans += i % 10
		i /= 10
	}
	return
}

func slove() {
	defer w.Flush()
	var nn string
	fmt.Fscan(r, &nn)
	n, _ := strconv.Atoi(nn)
	if sum(n/1000) == sum(n%1000) {
		fmt.Fprintln(w, "Yes")
	} else {
		fmt.Fprintln(w, "No")
	}
}

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

package main

import (
	"fmt"
	"strconv"
)

func main() {
	var (
		t int
		n string
	)
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		var (
			p1 int
			p2 int
		)
		fmt.Scanf("%s\n", &n)
		n1, _ := strconv.Atoi(string(n[0]))
		n2, _ := strconv.Atoi(string(n[1]))
		n3, _ := strconv.Atoi(string(n[2]))
		n4, _ := strconv.Atoi(string(n[3]))
		n5, _ := strconv.Atoi(string(n[4]))
		n6, _ := strconv.Atoi(string(n[5]))
		p1 = n1 + n2 + n3
		p2 = n4 + n5 + n6
		if p1 == p2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

var sc = bufio.NewScanner(os.Stdin)
var wr = bufio.NewWriter(os.Stdout)

func out(x ...interface{}) {
	fmt.Fprint(wr, x...)
}

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

func nextInt64() int64 {
	i, e := strconv.ParseInt(next(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	defer wr.Flush()
	sc.Buffer(make([]byte, 0), 1000000009)
	sc.Split(bufio.ScanWords)

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

func digitsSum(x string) int {
	res := 0

	n, e := strconv.Atoi(x)
	if e != nil {
		panic(e)
	}

	for n != 0 {
		res += n % 10
		n /= 10
	}
	return res
}

func solve() {
	digits := next()

	head := digitsSum(digits[:3])
	tail := digitsSum(digits[3:])

	if head == tail {
		out("YES\n")
	} else {
		out("NO\n")
	}
}

package main
import (
	"fmt"
	"strconv"
)
func main() {
	var n int
	fmt.Scan(&n)
	for i:=0;i<n;i++{
		var x string
		fmt.Scan(&x)
		first_3:= 0
		last_3:= 0
		for j:=0;j<3;j++{
			z1,_:= strconv.Atoi(string(x[j]))
			first_3+=z1
		}
		for j:=len(x)-3;j<len(x);j++{
			z2,_:= strconv.Atoi(string(x[j]))
			last_3+=z2
		}
		if first_3 == last_3 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

// https://codeforces.com/problemset/problem/1676/A

// 1676A - Lucky?

// A ticket is a string consisting of six digits. A ticket is considered lucky if the sum of the first three digits is equal to the sum of the last three digits. Given a ticket, output if it is lucky or not. Note that a ticket can have leading zeroes.

// Input
// The first line of the input contains an integer t (1≤t≤10^3) — the number of testcases.
// The description of each test consists of one line containing one string consisting of six digits.

// Output
// Output t lines, each of which contains the answer to the corresponding test case. Output "YES" if the given ticket is lucky, and "NO" otherwise.
// You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).

// Example
// input
// 5
// 213132
// 973894
// 045207
// 000000
// 055776
// output
// YES
// NO
// YES
// YES
// NO

// Note

// In the first test case, the sum of the first three digits is 2+1+3=6 and the sum of the last three digits is 1+3+2=6, they are equal so the answer is "YES".
// In the second test case, the sum of the first three digits is 9+7+3=19 and the sum of the last three digits is 8+9+4=21, they are not equal so the answer is "NO".
// In the third test case, the sum of the first three digits is 0+4+5=9 and the sum of the last three digits is 2+0+7=9, they are equal so the answer is "YES".

// Tutorial

// We need to check if the sum of the first three digits is equal to the sum of the last three digits. This is doable by scanning the input as a string, then comparing the sum of the first three characters with the sum of the last three characters using the if statement and the addition operation.

package main

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

func main() {
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	var c int
	var t uint
	var s string

	for c, _ = fmt.Fscan(reader, &t); c == 1; c, _ = fmt.Fscan(reader, &t) {
		for ; t > 0; t-- {
			fmt.Fscan(reader, &s)

			if s[0]+s[1]+s[2] == s[3]+s[4]+s[5] {
				fmt.Fprintln(writer, "YES")
			} else {
				fmt.Fprintln(writer, "NO")
			}
		}
	}

	writer.Flush()
}

package main

import "fmt"

var b2s = map[bool]string{false: "NO", true: "YES"}

func main() {
	var i int
	var s string
	for fmt.Scanln(&i); i > 0; i-- {
		fmt.Scanln(&s)
		fmt.Println(b2s[s[0]+s[1]+s[2] == s[3]+s[4]+s[5]])
	}
}

package main

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

func solve(r *bufio.Reader) {
	var n string
	fmt.Fscan(r, &n)

	ll, rr := 0, 0

	for i := 0; i < 3; i++ {
		ll += int(n[i] - '0')
	}
	for i := 3; i < 6; i++ {
		rr += int(n[i] - '0')
	}

	if ll == rr {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}
func main() {
	r := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(r, &n)
	for i := 0; i < n; i++ {
		solve(r)
	}
}

package main

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

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

func main() {
	defer out.Flush()
	var t int64
	fmt.Fscan(in, &t)
	for t != 0 {
		var s string
		fmt.Fscan(in, &s)
		arrStr := strings.Split(s, "")
		i := 0
		j := len(arrStr) - 1
		var lsum, rsum int64
		for i <= j {
			li, _ := strconv.Atoi(arrStr[i])
			ri, _ := strconv.Atoi(arrStr[j])
			lsum += int64(li)
			rsum += int64(ri)
			i++
			j--
		}
		if lsum == rsum {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
		t--
	}

}

package main

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

func main() {
	var t int
	fmt.Fscan(os.Stdin, &t)
	for t != 0 {
		var s string
		fmt.Fscan(os.Stdin, &s)
		sl, sr := 0, 0
		for i := 0; i < 3; i++ {
			n1, _ := strconv.Atoi(string(s[i]))
			n2, _ := strconv.Atoi(string(s[i+3]))
			sl += n1
			sr += n2
		}
		if sl == sr {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}

		t -= 1
	}
}

package main

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

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

	n := readInt(in)
	for i := 0; i < n; i++ {
		solution(in, out)
	}
}

func solution(in *bufio.Reader, out *bufio.Writer) {
	str := readLine(in)
	a, _ := strconv.Atoi(str[0:1])
	b, _ := strconv.Atoi(str[1:2])
	c, _ := strconv.Atoi(str[2:3])
	d, _ := strconv.Atoi(str[3:4])
	e, _ := strconv.Atoi(str[4:5])
	f, _ := strconv.Atoi(str[5:6])

	if a+b+c == d+e+f {
		out.WriteString("YES\n")
	} else {
		out.WriteString("NO\n")
	}

}

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 readLine(in *bufio.Reader) string {
	line, _ := in.ReadString('\n')
	line = strings.ReplaceAll(line, "\r", "")
	line = strings.ReplaceAll(line, "\n", "")
	return line
}

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

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

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

package main

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

func main() {
	cin := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(cin, &n)
	var s string
	for i := 0; i < n; i++ {
		fmt.Fscan(cin, &s)
		var s1 = s[0] + s[1] + s[2]
		var s2 = s[3] + s[4] + s[5]
		if s1 == s2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

const (
	MaxInt32 = 1 << 31 - 1
)

func main(){
	cin := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(cin, &t)
	for t > 0 {
		var ticket string
		fmt.Fscan(cin, &ticket)
		left, right := 0, 0
		for i := 0; i < 6; i++ {
			if i < 3 {
				n, _ := strconv.Atoi(string(ticket[i]))
				left += n
			}
			if i >= 3 {
				n, _ := strconv.Atoi(string(ticket[i]))
				right += n
			}
		}
		if left == right {
			fmt.Println("YES")
		}else {
			fmt.Println("NO")
		}
		 t -= 1
	}
}

package main

import "fmt"

func main() {
  var t int
  fmt.Scan(&t)
  for ; t > 0; t-- {
    solve();
  }
}

func solve() {
  var s string
  fmt.Scan(&s)

  var b []byte = []byte(s)

  if sumOfThreeElements(b) == sumOfThreeElements(b[3:]) {
    fmt.Println("YES")
  } else {
    fmt.Println("NO")
  }
}

func sumOfThreeElements(b []byte) int {
  var res int = 0
  res += int(b[0]) - int('0')
  res += int(b[1]) - int('0')
  res += int(b[2]) - int('0')
  return res
}

package main

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

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

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

func main() {
	defer out.Flush()

	var tc int
	fmt.Fscan(in, &tc)
	for ; tc > 0; tc-- {
		var s string
		fmt.Fscan(in, &s)
		var a, b int
		for j, x := range s {
			if j < 3 {
				a += int(x - '0')
			} else {
				b += int(x - '0')
			}
		}
		if a == b {
			fmt.Println("yES")
		} else {
			fmt.Println("no")
		}
	} //fim do loop de test cases
} // fim main

package main
import "fmt"
func main() {
    var t int
    fmt.Scan(&t)
    for i:=0;i<t;i++ {
        var s string
        fmt.Scan(&s)
        if s[0]+s[1]+s[2]==s[3]+s[4]+s[5] {
            fmt.Println("YES")
        } else {
            fmt.Println("NO")
        }
    }
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	for n > 0 {
		var s string
		fmt.Scanf("%s\n", &s)
		le := s[0] - '0' + s[1] - '0' + s[2] - '0'
		ri := s[3] - '0' + s[4] - '0' + s[5] - '0'
		if le == ri {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
		n--
	}
}

package main

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

func isLuckyTicket(ticket string) bool {
	sum1 := 0
	for i := 0; i < 3; i++ {
		tmp, _ := strconv.Atoi(string(ticket[i]))
		sum1 += tmp
	}
	sum2 := 0
	for i := 3; i < 6; i++ {
		tmp, _ := strconv.Atoi(string(ticket[i]))
		sum2 += tmp
	}
	if sum1 == sum2 {
		return true
	}
	return false
}

func main() {
	var t int
	fmt.Scanf("%d", &t)
	reader := bufio.NewReader(os.Stdin)
	str, _ := reader.ReadString('\n')
	for i := 0; i < t; i++ {
		str, _ = reader.ReadString('\n')
		if isLuckyTicket(str) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import "fmt"

func solve(input string) string {
	c_a, c_b := 0, 0
	c_a = int(input[0]) + int(input[1]) + int(input[2])
	c_b = int(input[3]) + int(input[4]) + int(input[5])

	if c_a == c_b {
		return "YES"
	}
	return "NO"
}

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

	for testcases > 0 {
		testcases -= 1
		fmt.Scanf("%s\n", &input)
		fmt.Println(solve(input))
	}
}

package main

import (
	"fmt"
)

func main() {
	var T int
	for fmt.Scanln(&T); T > 0; T-- {
		var s string
		fmt.Scanln(&s)
		if s[0]+s[1]+s[2] == s[3]+s[4]+s[5] {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

func main_edu_128_A() {
	_in, _out := os.Stdin, os.Stdout
	in, out := bufio.NewReader(_in), bufio.NewWriter(_out)
	defer out.Flush()
	var cas int = 1
	Fscan(in, &cas)
	var sol func()
	// Coding...beg!
	sol = func() {
		var n string
		Fscan(in, &n)
		if n[0]+n[1]+n[2] == n[3]+n[4]+n[5] {
			Fprintln(out, "Yes")
		} else {
			Fprintln(out, "No")
		}
	}
	// Coding...ove!
	for i := 0; i < cas; i++ {
		sol()
	}
}

func main() {
	main_edu_128_A()
}

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 main() {
	defer writer.Flush()

	var n int
	var a string
	scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		scanf("%s\n", &a)
		if a[0]+a[1]+a[2] == a[3]+a[4]+a[5] {
			printf("YES\n")
		} else {
			printf("NO\n")
		}
	}
}

package main

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

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

	var T int
	for fmt.Fscan(in, &T); T > 0; T-- {
		var s string
		fmt.Fscan(in, &s)
		if s[0]+s[1]+s[2] == s[3]+s[4]+s[5] {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

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

package main

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

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

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

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

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

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

/**
Run solve the problem CF1676A
Date: 11/05/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1676/A
Problem: CF1676A
**/
func (in *CF1676A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		str := in.NextString()
		s := 0
		a := 0
		for i := 0; i < len(str); i++ {
			if i < 3 {
				s += int(str[i] - '0')
			}
			a += int(str[i] - '0')
		}

		if s == (a - s) {
			fmt.Println("YES")
		}else {
			fmt.Println("NO")
		}
	}
}

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

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

package main

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

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

func solve(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	var t int
	for fmt.Fscan(in, &t); t > 0; t-- {
		var s string
		fmt.Fscan(in, &s)
		var s1, s2 int
		for i := 0; i < 3; i++ {
			s1 += int(s[i])
			s2 += int(s[5-i])
		}
		if s1 == s2 {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	for fmt.Fscan(in, &t); t > 0; t-- {
		var s string
		fmt.Fscan(in, &s)
		if s[0]-'0'+s[1]-'0'+s[2]-'0' == s[3]-'0'+s[4]-'0'+s[5]-'0' {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	testCases, _ := strconv.Atoi(scanner.Text())
	for i := 0; i < testCases; i++ {
		scanner.Scan()
		txt := scanner.Text()
		idx := 0
		totalFirst := 0
		for idx < 3 {
			c, _ := strconv.Atoi(string(txt[idx]))
			totalFirst += c
			idx++
		}

		totalSecond := 0
		for idx < 6 {
			c, _ := strconv.Atoi(string(txt[idx]))
			totalSecond += c
			idx++
		}
		if totalFirst == totalSecond {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

func main() {
	var (
		t int
	)

	reader := bufio.NewReader(os.Stdin)
	fmt.Scanf("%d\n", &t)

	for t > 0 {
		t--

		s, _ := reader.ReadString('\n')
		if s[len(s)-1] == 10 {
			s = s[:len(s)-1]
		}
		if s[len(s)-1] == 13 {
			s = s[:len(s)-1]
		}

		n := len(s)

		a, _ := strconv.Atoi(string(s[0]))
		b, _ := strconv.Atoi(string(s[1]))
		c, _ := strconv.Atoi(string(s[2]))
		x, _ := strconv.Atoi(string(s[n-1]))
		y, _ := strconv.Atoi(string(s[n-2]))
		z, _ := strconv.Atoi(string(s[n-3]))

		if a+b+c == x+y+z {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"bufio"
	"flag"
	"fmt"
	"log"
	"os"
	"runtime/pprof"
	"strconv"
	"strings"
)

var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")

func main() {
	flag.Parse()
	if *cpuprofile != "" {
		f, err := os.Create(*cpuprofile)
		if err != nil {
			log.Fatal(err)
		}
		pprof.StartCPUProfile(f)
		defer pprof.StopCPUProfile()
	}

	in := bufio.NewReader(os.Stdin)
	testCases := readInt(in)

	for i := 0; i < testCases; i++ {
		digits := readStrToInts(in)
		result := 0
		for i := 0; i < len(digits)/2; i++ {
			result += digits[i] - digits[i+3]
		}

		if result == 0 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

func stringToInts(s string) []int {
	result := []int{}
	for _, r := range s {
		val, _ := strconv.Atoi(string(r))
		result = append(result, val)
	}

	return result
}

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 readStr(in *bufio.Reader) string {
	nStr, _ := in.ReadString('\n')
	nStr = strings.ReplaceAll(nStr, "\r", "")
	nStr = strings.ReplaceAll(nStr, "\n", "")
	return nStr
}

func readStrToInts(in *bufio.Reader) []int {
	nStr, _ := in.ReadString('\n')
	nStr = strings.ReplaceAll(nStr, "\r", "")
	nStr = strings.ReplaceAll(nStr, "\n", "")
	return stringToInts(nStr)
}

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 readInts(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 readInt64s(in *bufio.Reader) []int64 {
	numbs := readLineNumbs(in)
	arr := make([]int64, len(numbs))
	for i, n := range numbs {
		val, _ := strconv.ParseInt(n, 10, 64)
		arr[i] = val
	}
	return arr
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var N int
	var Q string
	var A,B int32

	fmt.Fscan(in, &N)
	//m := make([]int,N)
	//num := make(map[int]int)
	for i := 0;i < N;i++{
		fmt.Fscan(in, &Q)

		for num, i := range Q{
			if num < 3{
				A += i
			}else{
				B += i
			}
		}

		if A == B {
			fmt.Println("YES")
		}else{
			fmt.Println("NO")
		}
		A = 0
		B = 0
	}

}

package main

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

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

func A(_r io.Reader, _w io.Writer) {
	in, out := bufio.NewReader(_r), bufio.NewWriter(_w)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for k := 0; k < t; k++ {
		str := ""
		fmt.Fscan(in, &str)
		s1 := 0
		s2 := 0
		for i := 0; i < 6; i++ {
			if i < 3 {
				v, _ := strconv.Atoi(string(str[i]))
				s1 += v
			} else {
				v, _ := strconv.Atoi(string(str[i]))
				s2 += v
			}
		}
		if s1 == s2 {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

//goland:noinspection GoUnusedFunction
func min(a int, nums ...int) int {
	min := a

	for _, num := range nums {
		if num < min {
			min = num
		}
	}
	return min
}

//goland:noinspection GoUnusedFunction
func max(a int, nums ...int) int {
	max := a

	for _, num := range nums {
		if num > max {
			max = num
		}
	}
	return max
}

//goland:noinspection GoUnusedFunction
func maxFloat(a float64, nums ...float64) float64 {
	max := a

	for _, num := range nums {
		if num > max {
			max = num
		}
	}
	return max
}

//goland:noinspection GoUnusedFunction
func fprintlnArr(w io.Writer, arr []int) {
	for _, val := range arr {
		fmt.Fprint(w, val, " ")
	}
	fmt.Fprintln(w)
}

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

	var t int
	for fmt.Fscan(in, &t); t > 0; t-- {
		var s string
		fmt.Fscan(in, &s)
		sum1, sum2 := 0, 0

		for i := 0; i < 3; i++ {
			num, _ := strconv.Atoi(string(s[i]))
			sum1 += num
		}

		for i := 3; i < 6; i++ {
			num, _ := strconv.Atoi(string(s[i]))
			sum2 += num
		}

		if sum1 == sum2 {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

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

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

	var T int
	var x string

	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &x)
		a,b := 0, 0
		for i := 0;i <3; i++ {
			a += int(x[i]-'0')
		}
		for i := 3;i <6; i++ {
			b += int(x[i]-'0')
		}

		ans := "NO"
		if a == b {
			ans = "YES"
		}
		Fprintln(out, ans)
	}
}

package main

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

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

func solve() string {
	var s string
	fmt.Fscan(in, &s)
	var lsum, rsum int

	for _, r := range s[:3] {
		lsum += int(r - 'a')
	}
	for _, r := range s[3:] {
		rsum += int(r - 'a')
	}
	if lsum == rsum {
		return "YES"
	}

	return "NO"
}

func main() {
	defer out.Flush()
	var t int
	for fmt.Fscanln(in, &t); t > 0; t-- {
		fmt.Fprintln(out, solve())
	}
}

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

		var a1 int
		for i := 0; i < 3; i++ {
			a1 += int(s[i] - '0')
		}

		var a2 int
		for i := 3; i < 6; i++ {
			a2 += int(s[i] - '0')
		}

		if a1 == a2 {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

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

	solve := func(curCase int)bool {
		var s string
		Fscan(in, &s)
		s1 := 0
		for _, b := range s[:3] {
			s1+=int(b&15)
		}
		for _, b := range s[3:] {
			s1-=int(b&15)
		}
		return s1==0
	}

	cases := 1
	Fscan(in, &cases)
	for curCase := 1; curCase <= cases; curCase++ {
		if solve(curCase){
			Fprintln(out, "YES")
		} else {
			Fprintln(out, "NO")
		}
	}

	leftData, _ := ioutil.ReadAll(in)
	if s := strings.TrimSpace(string(leftData)); s != "" {
		panic("有未读入的数据：\n" + s)
	}

}

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

package main

import "fmt"

func main() {
	var T int
	var a string
	fmt.Scan(&T)
	for T > 0 {
		fmt.Scanf("%s", &a)
		sum1 := 0
		for i := 0; i < len(a)/2; i++ {
			sum1 += int(a[i] - '0')
		}
		sum2 := 0
		for i := len(a) / 2; i < len(a); i++ {
			sum2 += int(a[i] - '0')
		}

		if sum1 == sum2 {
			fmt.Printf("YES\n")
		} else {
			fmt.Printf("NO\n")
		}
		T--
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	var str string
	fmt.Scanf("%d", &t)
	for i := 0; i < t; i++ {
		fmt.Scanf("%s", &str)
		sum1 := 0
		sum2 := 0
		for j := 0; j < len(str); j++ {
			if j < 3 {
				sum1 = sum1 + int(str[j]) - '0'
			} else {
				sum2 = sum2 + int(str[j]) - '0'
			}
		}
		if sum1 != sum2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	var str string
	fmt.Scanf("%d", &t)
	for i := 0; i < t; i++ {
		fmt.Scanf("%s", &str)
		sum1 := 0
		sum2 := 0
		for j := 0; j < len(str); j++ {
			if j < 3 {
				sum1 = sum1 + int(str[j]) - '0'
			} else {
				sum2 = sum2 + int(str[j]) - '0'
			}
		}
		if sum1 == sum2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}


Dima worked all day and wrote down on a long paper strip his favorite number $$$n$$$ consisting of $$$l$$$ digits. Unfortunately, the strip turned out to be so long that it didn't fit in the Dima's bookshelf.To solve the issue, Dima decided to split the strip into two non-empty parts so that each of them contains a positive integer without leading zeros. After that he will compute the sum of the two integers and write it down on a new strip.Dima wants the resulting integer to be as small as possible, because it increases the chances that the sum will fit it in the bookshelf. Help Dima decide what is the minimum sum he can obtain.

The first line contains a single integer $$$l$$$ ($$$2 \le l \le 100\,000$$$) — the length of the Dima's favorite number. The second line contains the positive integer $$$n$$$ initially written on the strip: the Dima's favorite number. The integer $$$n$$$ consists of exactly $$$l$$$ digits and it does not contain leading zeros. Dima guarantees, that there is at least one valid way to split the strip.

Print a single integer — the smallest number Dima can obtain.

NoteIn the first example Dima can split the number $$$1234567$$$ into integers $$$1234$$$ and $$$567$$$. Their sum is $$$1801$$$.In the second example Dima can split the number $$$101$$$ into integers $$$10$$$ and $$$1$$$. Their sum is $$$11$$$. Note that it is impossible to split the strip into "1" and "01" since the numbers can't start with zeros.

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

package main

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

func addStrings(a string, b string) *big.Int {
	i := new(big.Int)
	i.SetString(a, 10)
	j := new(big.Int)
	j.SetString(b, 10)
	return i.Add(i, j)
}

func minBigInt(a *big.Int, b *big.Int) *big.Int {
	if a.Cmp(b) == 1 {
		return b
	}
	return a
}

func _Solve(l int, n string, m int) string {
	left1, right1 := n[:m], n[m:]
	left2, right2 := n[:l-m], n[l-m:]
	if string(right1[0]) == "0" && string(right2[0]) == "0" {
		return _Solve(l, n, m+1)
	}
	if string(right1[0]) == "0" {
		return addStrings(left2, right2).String()
	}
	if string(right2[0]) == "0" {
		return addStrings(left1, right1).String()
	}
	return minBigInt(addStrings(left1, right1), addStrings(left2, right2)).String()
}

func Solve(l int, n string) string {
	return _Solve(l, n, l/2)
}

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

	var l int
	var n string
	fmt.Fscanf(reader, "%d\n%s\n", &l, &n)

	fmt.Fprintf(writer, "%s\n", Solve(l, n))
}

package main

import (
	"fmt"
)

func main() {
	var a int
	var c string

	fmt.Scanln(&a)
	fmt.Scanln(&c)

	min := make([]byte, len(c))
	for i := 0; i < len(c); i++ {
		min[i] = c[i] - '0'
	}

	for i := a / 2; i > 0; i-- {
		if c[i] == '0' {
			continue
		}

		l := i + 1

		if len(c[i:])+1 > l {
			l = len(c[i:]) + 1
		}

		e := make([]byte, l)

		for j := 0; j < l-1; j++ {
			if j < i {
				e[l-j-1] += c[0:i][i-j-1] - '0'
			}

			if j < len(c[i:]) {
				e[l-j-1] += c[i:][len(c[i:])-j-1] - '0'
			}

			if e[l-j-1] > 9 {
				e[l-j-2]++
				e[l-j-1] -= 10
			}
		}

		if e[0] == 0 {
			e = e[1:]
		}

		if len(e) < len(min) {
			min = e
		} else if len(e) == len(min) {
			for j := 0; j < len(e); j++ {
				if e[j] > min[j] {
					break
				}

				if e[j] < min[j] {
					min = e
					break
				}

				if j == len(e)-1 {
					min = e
				}
			}
		}
		break
	}

	for i := a/2 + 1; i < a; i++ {
		if c[i] == '0' {
			continue
		}

		l := i + 1

		if len(c[i:])+1 > l {
			l = len(c[i:]) + 1
		}

		e := make([]byte, l)

		for j := 0; j < l-1; j++ {
			if j < i {
				e[l-j-1] += c[0:i][i-j-1] - '0'
			}

			if j < len(c[i:]) {
				e[l-j-1] += c[i:][len(c[i:])-j-1] - '0'
			}

			if e[l-j-1] > 9 {
				e[l-j-2]++
				e[l-j-1] -= 10
			}
		}

		if e[0] == 0 {
			e = e[1:]
		}

		if len(e) < len(min) {
			min = e
		} else if len(e) == len(min) {
			for j := 0; j < len(e); j++ {
				if e[j] > min[j] {
					break
				}

				if e[j] < min[j] {
					min = e
					break
				}

				if j == len(e)-1 {
					min = e
				}
			}
		}
		break
	}

	for i := 0; i < len(min); i++ {
		fmt.Print(min[i])
	}
}

package main

import (
	"fmt"
	"math/big"
)

func main() {
	var a int
	var b, d big.Int
	var c string

	fmt.Scanln(&a)
	fmt.Scanln(&c)

	var min big.Int
	min.SetString(c, 10)

	for i := a / 2; i > 0; i-- {
		if c[i] == '0' {
			continue
		}

		b.SetString(c[0:i], 10)
		d.SetString(c[i:], 10)

		e := b.Add(&b, &d)

		if min.Cmp(e) == 1 {
			min = *e
		}
		break
	}

	for i := a/2 + 1; i < a; i++ {
		if c[i] == '0' {
			continue
		}

		b.SetString(c[0:i], 10)
		d.SetString(c[i:], 10)

		e := b.Add(&b, &d)

		if min.Cmp(e) == 1 {
			min = *e
		}
		break
	}

	fmt.Print(min.String())
}


You are given a sequence $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ pairwise distinct positive integers.Find $$$\left\lfloor \frac n 2 \right\rfloor$$$ different pairs of integers $$$x$$$ and $$$y$$$ such that:   $$$x \neq y$$$;  $$$x$$$ and $$$y$$$ appear in $$$a$$$;  $$$x~mod~y$$$ doesn't appear in $$$a$$$. Note that some $$$x$$$ or $$$y$$$ can belong to multiple pairs.$$$\lfloor x \rfloor$$$ denotes the floor function — the largest integer less than or equal to $$$x$$$. $$$x~mod~y$$$ denotes the remainder from dividing $$$x$$$ by $$$y$$$.If there are multiple solutions, print any of them. It can be shown that at least one solution always exists.

The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of the sequence. The second line of each testcase contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$). All numbers in the sequence are pairwise distinct. The sum of $$$n$$$ over all testcases doesn't exceed $$$2 \cdot 10^5$$$.

The answer for each testcase should contain $$$\left\lfloor \frac n 2 \right\rfloor$$$ different pairs of integers $$$x$$$ and $$$y$$$ such that $$$x \neq y$$$, $$$x$$$ and $$$y$$$ appear in $$$a$$$ and $$$x~mod~y$$$ doesn't appear in $$$a$$$. Print the pairs one after another. You can print the pairs in any order. However, the order of numbers in the pair should be exactly such that the first number is $$$x$$$ and the second number is $$$y$$$. All pairs should be pairwise distinct. If there are multiple solutions, print any of them.

NoteIn the first testcase there are only two pairs: $$$(1, 4)$$$ and $$$(4, 1)$$$. $$$\left\lfloor \frac 2 2 \right\rfloor=1$$$, so we have to find one pair. $$$1~mod~4=1$$$, and $$$1$$$ appears in $$$a$$$, so that pair is invalid. Thus, the only possible answer is a pair $$$(4, 1)$$$.In the second testcase, we chose pairs $$$8~mod~2=0$$$ and $$$8~mod~4=0$$$. $$$0$$$ doesn't appear in $$$a$$$, so that answer is valid. There are multiple possible answers for that testcase.In the third testcase, the chosen pairs are $$$9~mod~5=4$$$ and $$$7~mod~5=2$$$. Neither $$$4$$$, nor $$$2$$$, appears in $$$a$$$, so that answer is valid.

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)

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

		sort.Ints(nums)
		for i := 1; i <= n/2; i++ {
			fmt.Fprintf(out, "%d %d\n", nums[i], nums[0])
		}
	}
}

// 00
package main

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

func write_int(f *bufio.Writer, a int) {
	f.Write([]byte(strconv.Itoa(a)))
}
func write_string(f *bufio.Writer, a string) {
	f.Write([]byte(a))
}

func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		fmt.Fscan(reader, &n)
		a := make([]int, n)
		mi := 1000000000
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &a[i])
			if a[i] < mi {
				mi = a[i]
			}
		}
		total := n / 2
		for i := 0; i < total; i++ {
			if mi != a[i] {
				//fmt.Println(a[i], mi)
				write_int(f, a[i])
				write_string(f, " ")
				write_int(f, mi)
				write_string(f, "\n")
			} else {
				total++
			}
		}

	}
}

// 00
package main

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

func write_int(f *bufio.Writer, a int) {
	f.Write([]byte(strconv.Itoa(a)))
}
func write_string(f *bufio.Writer, a string) {
	f.Write([]byte(a))
}

func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		fmt.Fscan(reader, &n)
		a := make([]int, n)
		mi := 1000000000
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &a[i])
			if a[i] < mi {
				mi = a[i]
			}
		}
		total := n / 2
		for i := 0; i < total; i++ {
			if mi != a[i] {
				fmt.Println(a[i], mi)
				// write_int(f, a[i])
				// write_string(f, " ")
				// write_int(f, mi)
				// write_string(f, "\n")
			} else {
				total++
			}
		}

	}
}

// 00
package main

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

func write_int(f *bufio.Writer, a int) {
	f.Write([]byte(strconv.Itoa(a)))
}
func write_string(f *bufio.Writer, a string) {
	f.Write([]byte(a))
}

func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		fmt.Fscan(reader, &n)
		a := make([]int, n)
		mi := 1000000000
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &a[i])
			if a[i] < mi {
				mi = a[i]
			}
		}
		total := n / 2
		for i := 0; i < total; i++ {
			if mi != a[i] {
				write_int(f, a[i])
				write_string(f, " ")
				write_int(f, mi)
				write_string(f, "\n")
			} else {
				total++
			}
		}

	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		t-=1
		var n int
		fmt.Fscan(in, &n)
		var a []int
		for i := 1; i <= n; i++ {
			var x int
			fmt.Fscan(in, &x)
			a = append(a, x)
		}
		sort.Ints(a)
		for i := 1; i <= n/2; i++ {
			fmt.Println(a[i], a[0])
		}
	}
}

package main

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

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

func gcd(x, y int) int {
	if y > x {
		return gcd(y, x)
	}
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func solve(n int, a []int) string {
	sort.Ints(a)
	var s []string
	for i := 0; i < n/2; i++ {
		s = append(s, fmt.Sprint(a[n-1-i], a[0]))
	}
	return strings.Join(s, "\n")
}

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

package main

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

func solve() {
	f := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	N, n := 0, 0
	fmt.Fscan(f, &N)
	for i := 0; i < N; i++ {
		fmt.Fscan(f, &n)
		tot, o, m, p := n/2, []int{}, math.MaxInt32, 0
		for j := 0; j < n; j++ {
			fmt.Fscan(f, &p)
			o = append(o, p)
			if p < m {
				m = p
			}
		}
		for j := 0; j < n; j++ {
			if o[j] != m && tot > 0 {
				fmt.Fprintln(w, o[j], m)
				tot--
			}
			if tot == 0 {
				break
			}
		}
	}
	w.Flush()
}

func main() {
	solve()
}

package main

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

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

var a [2e5 + 10]int

func main() {
	var ntc int
	fmt.Fscan(in, &ntc)
	for t := 0; t < ntc; t++ {
		var n int
		var minAi int = math.MaxInt32
		fmt.Fscan(in, &n)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &a[i])
			if minAi > a[i] {
				minAi = a[i]
			}
		}
		var left = n / 2
		for i := 0; left > 0; i++ {
			if a[i] == minAi {
				continue
			}
			left--
			fmt.Fprintf(out, "%d %d\n", a[i], minAi)
		}
	}
	out.Flush()
}

package main

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

func main() {
	defer _w.Flush()
	t := ReadInt()
	for i := 0; i < t; i++ {
		solve()
	}
}
func solve() {
	n := ReadInt()
	a := ReadInts(n)
	sort.Ints(a)

	j := 1
	for i := 0; i < n/2; i++ {
		println(a[j], a[0])
		j++
	}
}

var _r, _w = bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)

func ReadString() (s string) { fmt.Fscan(_r, &s); return }
func ReadInt() (i int)       { fmt.Fscan(_r, &i); return }
func ReadInts(n int) (a []int) {
	for ; n > 0; n-- {
		a = append(a, ReadInt())
	}
	return
}
func print(a ...interface{})   { fmt.Fprint(_w, a...) }
func println(a ...interface{}) { fmt.Fprintln(_w, a...) }
func prints(s []int)           { v := fmt.Sprint(s); println(v[1 : len(v)-1]) }

package main

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

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

func main() {
	defer out.Flush()

	var tc int
	for fmt.Fscan(in, &tc); tc > 0; tc-- {
		var n int
		fmt.Fscan(in, &n)
		a := make([]int, n)
		for i := range a {
			fmt.Fscan(in, &a[i])
		}
		sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })
		for i := 0; i < n/2; i++ {
			fmt.Fprintln(out, a[i+1], a[0])
		}
	}
}

package main

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

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

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

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

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

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

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

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

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

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

		}
		return initial
	}
}

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

		}
		return m
	}
}

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

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

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

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

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

	return
}

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

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

	return num
}

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

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

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

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

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

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

func ChangeStringToDate(x string) (t time.Time, err error) {
	t, err = time.Parse("2006-01-02", x)
	return
}

func DiffrenceBetweenTwoDates(first, second time.Time) int64 {
	date := first
	date2 := second
	k := date.Unix() - date2.Unix()
	return k
}

func Union(a, b []int) []int {
	m := make(map[int]bool)

	for _, item := range a {
		m[item] = true
	}

	for _, item := range b {
		if _, ok := m[item]; !ok {
			a = append(a, item)
		}
	}
	return a
}

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

func DIVI(x []int) string {
	if len(x) == 1 {
		if x[0]%2 == 0 {
			return "NO"
		} else {
			return "YES"

		}
	} else {
		q := len(x)
		if DIVI(x[:q-1]) == "YES" {
			b := 0
			for j := 2; j < q+2; j++ {
				if x[q-1]%j != 0 {
					b = 1
					break
				}
			}
			if b == 1 {
				return "YES"
			} else {
				return "NO"

			}
		} else {
			return "NO"
		}
	}
}

var t int

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

		var n int
		fmt.Fscan(input, &n)
		ARRAY := make([]int, n)

		for i := 0; i < n; i++ {
			fmt.Fscan(input, &ARRAY[i])

		}

		sort.Ints(ARRAY)
		k := n / 2
		for i := 1; i <= k; i++ {
			fmt.Println(ARRAY[i])
			fmt.Println(ARRAY[0])
		}

	}
}

package main

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

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 scanInt8() int8 {
	i, err := strconv.ParseInt(scan(), 10, 8)
	if err != nil {
		panic(err)
	}
	return int8(i)
}

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

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

func min(ints ...int) int {
	a := ints[0]
	n := len(ints)
	for i := 1; i < n; i++ {
		if ints[i] < a {
			a = ints[i]
		}
	}
	return a
}

func max(ints ...int) int {
	a := ints[0]
	n := len(ints)
	for i := 1; i < n; i++ {
		if ints[i] > a {
			a = ints[i]
		}
	}
	return a
}

func proc() {
	n := scanInt()
	mas := make([]int, n)
	for i := 0; i < n; i++ {
		mas[i] = scanInt()
	}
	sort.Ints(mas)
	for i := 0; i < n/2; i++ {
		fmt.Printf("%d %d\n", mas[i+1], mas[0])
	}
}

func main() {
	sc.Split(bufio.ScanWords)
	t := scanInt()
	for i := 0; i < t; i++ {
		proc()
	}
}

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)

		nums := make([]int, n)
		var max int
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &nums[i])
			if nums[i] > max {
				max = nums[i]
			}
		}

		sort.Ints(nums)

		c := n / 2
	Loop:
		for j := len(nums) - 1; j >= 0; j-- {
			seen := make([]bool, max+1)
			for k := 0; k < j; k++ {
				if seen[k] {
					continue
				}

				idx := sort.SearchInts(nums, nums[j]%nums[k])
				if nums[idx] == nums[j]%nums[k] {
					continue
				}

				for p := nums[k]; p < nums[j]; p = p * nums[k] {
					seen[p] = true
					idx = sort.SearchInts(nums, p)
					if idx >= len(nums) || p == nums[idx] {
						fmt.Fprintf(out, "%d %d\n", nums[j], p)
						c--
						if c <= 0 {
							break Loop
						}
					}

					if p == 1 {
						break
					}
				}
			}
		}
	}
}

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)

		nums := make([]int, n)
		var max int
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &nums[i])
			if nums[i] > max {
				max = nums[i]
			}
		}

		sort.Ints(nums)

		c := n / 2
	Loop:
		for j := len(nums) - 1; j >= 0; j-- {
			seen := make([]bool, max+1)
			for k := 0; k < j; k++ {
				if seen[k] {
					continue
				}

				idx := sort.SearchInts(nums, nums[j]%nums[k])
				if nums[idx] == nums[j]%nums[k] {
					continue
				}

				for p := nums[k]; p < nums[j]; p = p * nums[k] {
					seen[p] = true
					idx = sort.SearchInts(nums, p)
					if idx >= len(nums) || p == nums[idx] {
						fmt.Fprintf(out, "%d %d\n", nums[j], p)
						c--
						if c <= 0 {
							break Loop
						}
					}
				}
			}
		}
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		t-=1
		var n int
		fmt.Fscan(in, &n)
		var a []int
		for i := 1; i <= n; i++ {
			var x int
			fmt.Fscan(in, &x)
			a = append(a, x)
		}
		sort.Ints(a)
		for i := n - 2; i >= (n-1)/2; i-- {
			fmt.Println(a[n-1], a[i])
		}
	}
}

package main

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

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

func gcd(x, y int) int {
	if y > x {
		return gcd(y, x)
	}
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func solve(n int, a []int) string {
	sort.Ints(a)
	var s []string
	for i := 0; i < n/2; i++ {
		s = append(s, fmt.Sprint(a[0], a[n-1-i]))
	}
	return strings.Join(s, "\n")
}

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


Leo Jr. draws pictures in his notebook with checkered sheets (that is, each sheet has a regular square grid printed on it). We can assume that the sheets are infinitely large in any direction.To draw a picture, Leo Jr. colors some of the cells on a sheet gray. He considers the resulting picture beautiful if the following conditions are satisfied: The picture is connected, that is, it is possible to get from any gray cell to any other by following a chain of gray cells, with each pair of adjacent cells in the path being neighbours (that is, sharing a side). Each gray cell has an even number of gray neighbours. There are exactly $$$n$$$ gray cells with all gray neighbours. The number of other gray cells can be arbitrary (but reasonable, so that they can all be listed).Leo Jr. is now struggling to draw a beautiful picture with a particular choice of $$$n$$$. Help him, and provide any example of a beautiful picture.To output cell coordinates in your answer, assume that the sheet is provided with a Cartesian coordinate system such that one of the cells is chosen to be the origin $$$(0, 0)$$$, axes $$$0x$$$ and $$$0y$$$ are orthogonal and parallel to grid lines, and a unit step along any axis in any direction takes you to a neighbouring cell.

The only line contains a single integer $$$n$$$ ($$$1 \leq n \leq 500$$$) — the number of gray cells with all gray neighbours in a beautiful picture.

In the first line, print a single integer $$$k$$$ — the number of gray cells in your picture. For technical reasons, $$$k$$$ should not exceed $$$5 \cdot 10^5$$$. Each of the following $$$k$$$ lines should contain two integers — coordinates of a gray cell in your picture. All listed cells should be distinct, and the picture should satisdfy all the properties listed above. All coordinates should not exceed $$$10^9$$$ by absolute value. One can show that there exists an answer satisfying all requirements with a small enough $$$k$$$.

NoteThe answer for the sample is pictured below:

package main

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

// github.com/EndlessCheng/codeforces-go
func main() {
	o := bufio.NewWriter(os.Stdout)
	defer o.Flush()
	p := Fprintln

	n := 0
	Scan(&n)
	p(o, 3*n+4)
	p(o, 0, 0)
	p(o, 1, 0)
	for i := 0; i < n; i++ {
		for j := 0; j < 3; j++ {
			p(o, i+j, i+1)
		}
	}
	p(o, n, n+1)
	p(o, n+1, n+1)
}

package main

import (
	"fmt"
)

func main(){
	var n int
	fmt.Scan(&n)
	fmt.Println(3*n + 4)
	fmt.Println(0, 0)
	fmt.Println(1, 0)
	for i := 1; i <= n; i++ {
		fmt.Println(i-1, i)
		fmt.Println(i, i)
		fmt.Println(i+1, i)
	}
	fmt.Println(n, n+1)
	fmt.Println(n+1, n+1)
}

package main

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

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

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

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

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

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

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

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

	return i
}

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

	n := readNum(reader)

	res := solve(n)

	// fmt.Println(len(res))

	var buf bytes.Buffer
	buf.WriteString(fmt.Sprintf("%d\n", len(res)))

	for i := 0; i < len(res); i++ {
		buf.WriteString(fmt.Sprintf("%d %d\n", res[i][0], res[i][1]))
	}
	fmt.Print(buf.String())
}

func solve(n int) [][]int {
	res := make([][]int, 0, 3*(n-1)+7)

	res = append(res, []int{0, 0})
	res = append(res, []int{1, 0})
	res = append(res, []int{0, 1})
	res = append(res, []int{1, 1})
	res = append(res, []int{1, 2})
	res = append(res, []int{2, 1})
	res = append(res, []int{2, 2})
	x, y := 3, 3
	for i := 2; i <= n; i++ {
		res = append(res, []int{x - 1, y})
		res = append(res, []int{x, y})
		res = append(res, []int{x, y - 1})
		x++
		y++
	}

	return res
}

package main

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

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 1
	//fmt.Fscanf(in, "%d\n", &t)
	for tt := 0; tt < t; tt++ {
		n := 0
		fmt.Fscanf(in, "%d\n", &n)
		ans := [][]int{{0, 0}, {0, 1}, {1, 0}, {1, 1}, {2, 1}, {1, 2}, {2, 2}}
		for i := 2; i <= n; i++ {
			ans = append(ans, []int{i + 1, i})
			ans = append(ans, []int{i, i + 1})
			ans = append(ans, []int{i + 1, i + 1})
		}
		fmt.Fprintf(out, "%d\n", len(ans))
		for i := 0; i < len(ans); i++ {
			fmt.Fprintf(out, "%d %d\n", ans[i][0], ans[i][1])
		}
	}
	return
}

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

/*
URL:
https://codeforces.com/problemset/problem/1368/C
*/

package main

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

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n int

	A [][2]int
)

func main() {
	n = ReadInt()

	A = [][2]int{
		[2]int{0, 0}, [2]int{0, 1}, [2]int{1, 0}, [2]int{1, 1},
		[2]int{1, 2}, [2]int{2, 1}, [2]int{2, 2},
	}
	i, j := 2, 2

	for t := 1; t < n; t++ {
		A = append(A, [2]int{i, j + 1}, [2]int{i + 1, j}, [2]int{i + 1, j + 1})
		i++
		j++
	}

	PrintfBufStdout("%d\n", len(A))
	for _, a := range A {
		PrintfBufStdout("%d %d\n", a[0], a[1])
	}
	stdout.Flush()
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

package main

import "fmt"

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

	fmt.Println(3*(n+1) + 1)
	for i := 0; i < n+1; i++ {
		fmt.Println(i+1, i)
		fmt.Println(i, i)
		fmt.Println(i, i+1)
	}
	fmt.Println(n+1, n+1)
}

package main

import (
	"fmt"
)

func main(){
	var n int
	fmt.Scan(&n)
	fmt.Println(3*n + 2)
	fmt.Println(0, 0)
	for i := 1; i <= n; i++ {
		fmt.Println(n-1, n+1)
		fmt.Println(n, n)
		fmt.Println(n+1, n-1)
	}
	fmt.Println(n+1, n+1)
}

package main

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

// github.com/EndlessCheng/codeforces-go
func main() {
	o := bufio.NewWriter(os.Stdout)
	defer o.Flush()
	p := Fprintln

	n := 0
	Scan(&n)
	p(o, 3*n+4)
	p(o, 0, 0)
	p(o, 1, 0)
	for i := 1; i <= n; i++ {
		for j := 0; j < 3; j++ {
			p(o, i+j, i)
		}
	}
	p(o, n+1, n+1)
	p(o, n+2, n+1)
}


The Department of economic development of IT City created a model of city development till year 2100.To prepare report about growth perspectives it is required to get growth estimates from the model.To get the growth estimates it is required to solve a quadratic equation. Since the Department of economic development of IT City creates realistic models only, that quadratic equation has a solution, moreover there are exactly two different real roots.The greater of these roots corresponds to the optimistic scenario, the smaller one corresponds to the pessimistic one. Help to get these estimates, first the optimistic, then the pessimistic one.

The only line of the input contains three integers a, b, c ( - 1000 ≤ a, b, c ≤ 1000) — the coefficients of ax2 + bx + c = 0 equation.

In the first line output the greater of the equation roots, in the second line output the smaller one. Absolute or relative error should not be greater than 10 - 6.

package main

import (
	"fmt"
	"math"
)

func main() {
	var a float64
	var b float64
	var c float64
	fmt.Scan(&a)
	fmt.Scan(&b)
	fmt.Scan(&c)
	output := math.Sqrt((math.Pow(b, 2)) - (4 * a * c))
	output1 := (-b + output) / (2 * a)
	output2 := (-b - output) / (2 * a)
	if output1 > output2 {
		fmt.Println(output1, output2)
	} else {
		fmt.Println(output2, output1)
	}

}


A divisor tree is a rooted tree that meets the following conditions:   Each vertex of the tree contains a positive integer number.  The numbers written in the leaves of the tree are prime numbers.  For any inner vertex, the number within it is equal to the product of the numbers written in its children. Manao has n distinct integers a1, a2, ..., an. He tries to build a divisor tree which contains each of these numbers. That is, for each ai, there should be at least one vertex in the tree which contains ai. Manao loves compact style, but his trees are too large. Help Manao determine the minimum possible number of vertices in the divisor tree sought.

The first line contains a single integer n (1 ≤ n ≤ 8). The second line contains n distinct space-separated integers ai (2 ≤ ai ≤ 1012).

Print a single integer — the minimum number of vertices in the divisor tree that contains each of the numbers ai.

NoteSample 1. The smallest divisor tree looks this way: Sample 2. In this case you can build the following divisor tree: Sample 3. Note that the tree can consist of a single vertex.

package main

import "fmt"

var (
	n           int
	num         []int64
	par         []int
	rem         []int64
	minCount    int = 1e9
	delimsCache     = make(map[int64]int)
)

func countPrimeDelims(n int64) (count int) {
	if val, ok := delimsCache[n]; ok {
		count = val
		return
	}
	n0 := n
	for ; n%2 == 0; n /= 2 {
		count++
	}
	for p := int64(3); p*p <= n; p += 2 {
		for ; n%p == 0; n /= p {
			count++
		}
	}
	if n > 1 {
		count++
	}
	delimsCache[n0] = count
	return
}

func eval() {
	count := 0
	withPar0 := 0
	for p := 1; p <= n; p++ {
		delimCount := countPrimeDelims(rem[p])
		if delimCount == 1 && num[p] == rem[p] { // rem[p] is prime and p does not have kids
			count += 1
		} else {
			count += delimCount + 1
		}
		if par[p] == 0 {
			withPar0++
		}
	}
	if withPar0 > 1 {
		count++
	}
	if count < minCount {
		minCount = count
	}
}

func brute(i int) {
	if i == n+1 {
		eval()
		return
	}
	par[i] = 0
	brute(i + 1)

	for p := 1; p <= n; p++ {
		if p != i && num[i] <= rem[p] && rem[p]%num[i] == 0 {
			par[i] = p
			rem[p] /= num[i]
			brute(i + 1)
			rem[p] *= num[i]
		}
	}
}

func main() {
	fmt.Scan(&n)
	num = make([]int64, n+1)
	par = make([]int, n+1)
	rem = make([]int64, n+1)
	for i := 1; i <= n; i++ {
		fmt.Scan(&num[i])
		rem[i] = num[i]
	}
	brute(1)
	fmt.Println(minCount)
}


You are given $$$n$$$ chips on a number line. The $$$i$$$-th chip is placed at the integer coordinate $$$x_i$$$. Some chips can have equal coordinates.You can perform each of the two following types of moves any (possibly, zero) number of times on any chip:  Move the chip $$$i$$$ by $$$2$$$ to the left or $$$2$$$ to the right for free (i.e. replace the current coordinate $$$x_i$$$ with $$$x_i - 2$$$ or with $$$x_i + 2$$$);  move the chip $$$i$$$ by $$$1$$$ to the left or $$$1$$$ to the right and pay one coin for this move (i.e. replace the current coordinate $$$x_i$$$ with $$$x_i - 1$$$ or with $$$x_i + 1$$$). Note that it's allowed to move chips to any integer coordinate, including negative and zero.Your task is to find the minimum total number of coins required to move all $$$n$$$ chips to the same coordinate (i.e. all $$$x_i$$$ should be equal after some sequence of moves).

The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of chips. The second line of the input contains $$$n$$$ integers $$$x_1, x_2, \dots, x_n$$$ ($$$1 \le x_i \le 10^9$$$), where $$$x_i$$$ is the coordinate of the $$$i$$$-th chip.

Print one integer — the minimum total number of coins required to move all $$$n$$$ chips to the same coordinate.

NoteIn the first example you need to move the first chip by $$$2$$$ to the right and the second chip by $$$1$$$ to the right or move the third chip by $$$2$$$ to the left and the second chip by $$$1$$$ to the left so the answer is $$$1$$$.In the second example you need to move two chips with coordinate $$$3$$$ by $$$1$$$ to the left so the answer is $$$2$$$.

package main

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

/* solution */

func solve() {

	n := readInt()
	odd := 0
	for i := 0; i < n; i++ {
		if readInt()%2 == 1 {
			odd++
		}
	}

	if odd < n-odd {
		printInt(odd)
	} else {
		printInt(n - odd)
	}

}

/* stubs */

func main() {

	var f *os.File
	if runtime.GOROOT() == "C:\\Soft\\Go" {
		f, _ = os.Open("input.txt")
		defer f.Close()
	} else {
		f = os.Stdin
	}

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

	reader = bufio.NewScanner(f)

	const maxCapacity = 1024 * 1024
	buf := make([]byte, maxCapacity)
	reader.Buffer(buf, maxCapacity)

	reader.Split(bufio.ScanWords)

	solve()

}

var reader *bufio.Scanner
var writer *bufio.Writer

func read() string {
	reader.Scan()
	return reader.Text()
}

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

func print(s string) {
	writer.WriteString(s)
	writer.WriteString("\n")
}

func printInt(i int) {
	print(strconv.Itoa(i))
}

func printInt64(i int64) {
	print(strconv.FormatInt(i, 10))
}

func readInt64() int64 {
	reader.Scan()
	ret, _ := strconv.ParseInt(reader.Text(), 10, 64)
	return ret
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, k int

	// scr := bufio.NewReader(os.Stdin)
	// ocr := bufio.NewWriter(os.Stdout)

	fmt.Scanln(&n)
	a := make([]int, 2)

	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &k)

		a[k%2]++

	}

	sort.Ints(a)

	fmt.Println(a[0])

}

package main

import "fmt"

func main() {
	var n, a, even, odd int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a)
		if a%2 == 0 {
			even++
		} else {
			odd++
		}
	}
	if even < odd {
		fmt.Println(even)
	} else {
		fmt.Println(odd)
	}

}

package main

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

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

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

	n, err := strconv.ParseInt(readLine(reader), 10, 64)
	checkError(err)

	xTemp := strings.Split(readLine(reader), " ")
	zero := 0
	one := 0
	for i := 0; i < int(n); i++ {
		scoresItem, err := strconv.ParseInt(xTemp[i], 10, 64)
		checkError(err)
		if scoresItem&1 == 0 {
			zero++
		} else {
			one++
		}
	}
	fmt.Println(min(zero, one))
}

func readLine(reader *bufio.Reader) string {
	str, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}

	return strings.TrimRight(string(str), "\r\n")
}

func checkError(err error) {
	if err != nil {
		panic(err)
	}
}

package main

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

func main() {
	inputreader := bufio.NewReader(os.Stdin)
	var str string
	str,_= inputreader.ReadString('\n')
	str=strings.TrimSpace(str)
	temp:=strings.Split(str," ")
	N,_:= strconv.Atoi(temp[0])
	odd:=0
	even:=0
	str,_= inputreader.ReadString('\n')
	str=strings.TrimSpace(str)
	temp=strings.Split(str," ")
	for i:=0;i<N;i++{
		a,_:= strconv.Atoi(temp[i])
		if a%2==0{
			even++
		}else{
				odd++
		}
	}
ans:=even
if ans>odd{
	ans=odd
}
fmt.Println(ans)

}

package main

import "fmt"

func main() {
	var n int
	t1, t2 := 0, 0
	_, _ = fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var x int
		_, _ = fmt.Scan(&x)
		if x&1 == 1 {
			t1++
		} else {
			t2++
		}
	}
	if t1 > t2 {
		fmt.Println(t2)
	} else {
		fmt.Println(t1)
	}
}

//HOWDY! IT'S ME! A HARD BLACKISH DICK MOVE!
package main

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

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := PrintlnInts(X...)

/*******************************************************************/

func main() {
	n := ReadInt()
	x := ReadIntSlice(n)
	var parities [2]int
	for _, v := range x {
		parities[v%2]++
	}
	fmt.Println(min(parities[0], parities[1]))
}

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

func min(args ...int) int {
	if len(args) == 0 {
		panic("empty!")
	}
	min := args[0]
	for i := 1; i < len(args); i++ {
		if args[i] < min {
			min = args[i]
		}
	}
	return min
}

func max(args ...int) int {
	if len(args) == 0 {
		panic("empty!")
	}
	max := args[0]
	for i := 1; i < len(args); i++ {
		if args[i] > max {
			max = args[i]
		}
	}
	return max
}

func _gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return _gcd(b, a%b)
}

func gcd(args ...int) int {
	if len(args) == 0 {
		panic("empty!")
	}
	gcd := args[0]
	for i := 1; i < len(args); i++ {
		gcd = _gcd(gcd, args[i])
	}
	return gcd
}

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func init() {
	ReadString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9))
	// Split sets the split function for the Scanner. The default split function is ScanLines.
	// Split panics if it is called after scanning has started.
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return readInt()
}
func ReadInt2() (int, int) {
	return readInt(), readInt()
}
func ReadInt3() (int, int, int) {
	return readInt(), readInt(), readInt()
}
func ReadInt4() (int, int, int, int) {
	return readInt(), readInt(), readInt(), readInt()
}

func readInt64() int64 {
	return readIntNbits(64)
}

func readInt() int {
	return int(readIntNbits(32))
}

func readIntNbits(n int) int64 {
	i, err := strconv.ParseInt(ReadString(), 0, n)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

// PrintIntsLine returns integers string delimited by a space.
func PrintlnInts(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

package main

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

// -----------------------------------------------------------------------------

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

func IsNewLine(c byte) bool {
	switch c {
	case '\n', '\r':
		return true
	}
	return false
}

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

// -----------------------------------------------------------------------------

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// -----------------------------------------------------------------------------

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

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

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

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

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

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

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

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	// SetInteractive(os.Stdout, os.Stdin)
}

func main() {
	defer Flush()

	n := readi()
	x := make([]int, n)
	for i := range x {
		x[i] = readi()
	}
	var odd, even int
	for _, v := range x {
		if v%2 == 0 {
			even++
		} else {
			odd++
		}
	}
	println(min(odd, even))
}

package main

import "fmt"

func min(x, y int) int {
	if x <= y {
		return x
	}
	return y
}

func main() {
	var n, x int
	fmt.Scan(&n)
	cnt := 0
	for i := 0; i < n; i++ {
		fmt.Scan(&x)
		if x%2 == 0 {
			cnt++
		}
	}
	fmt.Println(min(cnt, n-cnt))
}

package main

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

func main() {
	sc := NewScanner()
	_ = sc.NextInt()
	A := sc.NextIntArray()
	mn := -1
	for _, v := range A {
		count := 0
		for _, q := range A {
			if (v+q)%2 == 1 {
				count++
			}
		}
		if mn == -1 || count < mn {
			mn = count
		}
	}

	fmt.Println(mn)
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

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

var input *bufio.Reader

func main(){
	input = bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanf(input, "%d\n", &n)
	ans := 0
	for i:=0; i<n; i++ {
		var x int
		fmt.Fscanf(input, "%d", &x)
		if x%2==0 {
			ans++
		}
	}
	if ans>n-ans {
		ans=n-ans
	}
	fmt.Println(ans)
}

package main

import "fmt"

func solve(n int, x []int) int {
	var co int = 0
	var ce int = 0
    for i := 0; i < n; i++ {
		if x[i] % 2 == 0 {
			co += 1
		} else{
			ce += 1
		}
	}
	if co >= ce {
		return ce
	}
	return co
}

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

package main

import (
	"fmt"
	"sort"
)

// reusable

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

func valueCounts(arr []int) map[int]int {
	dict := make(map[int]int)
	for _, num := range arr {
		dict[num] = dict[num] + 1
	}
	return dict
}

func minArray(arr []int) int {
	sort.Ints(arr)
	return arr[0]
}

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

// solution

func movePrice(elem int, elemCount int, elemTo int) int {
	posDiff := abs(elemTo - elem)
	price := 0
	if posDiff%2 != 0 {
		price++
	}
	price *= elemCount
	return price
}

func solve(input []int) int {
	// initialization
	coinCounts := valueCounts(input)
	coins := make([]int, 0, len(coinCounts))
	for k := range coinCounts {
		coins = append(coins, k)
	}
	movePrices := make([]int, len(coinCounts))
	// calculate final price for each target coin
	for i, targetCoin := range coins {
		for otherCoin, otherCoinCount := range coinCounts {
			if targetCoin != otherCoin {
				movePrices[i] += movePrice(otherCoin, otherCoinCount, targetCoin)
			}
		}
	}
	ans := minArray(movePrices)
	return ans
}

func main() {
	input := read()
	fmt.Println(solve(input))
}

package main

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

func main() {

	//stdin, err := os.Open("in.txt")
	//if err != nil {
	//	panic(err)
	//}
	//defer stdin.Close()
	stdin := os.Stdin
	reader := bufio.NewReaderSize(stdin, 1024*1024)

	//stdout, err := os.Create("test.txt")
	//if err != nil {
	//	panic(err)
	//}
	//defer stdout.Close()
	stdout := os.Stdout
	writer := bufio.NewWriterSize(stdout, 1024*1024)

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

	var a, odd, even int
	for i := 0; i < n; i++ {
		fmt.Fscanf(reader, "%d", &a)
		if a%2 == 0 {
			even++
		} else {
			odd++
		}
	}

	if odd < even {
		fmt.Fprintf(writer, "%d\n", odd)
	} else {
		fmt.Fprintf(writer, "%d\n", even)
	}

	writer.Flush()
}

package main

import "fmt"

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

func main() {
	var n int
	fmt.Scan(&n)
	count := 0
	var x int
	for i := 0; i < n; i++ {
		fmt.Scan(&x)
		if x%2 == 0 {
			count++
		}
	}
	fmt.Println(min(count, n-count))
}

// Codeforces 1.12.6
// AtCoder 1.6
// Paiza 1.7.3

package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
	"strconv"
	"strings"
)

type in struct {
	Scanner *bufio.Scanner
}

func (in *in) s() string {
	in.Scanner.Scan()
	return in.Scanner.Text()
}
func (in *in) i() int64 {
	return in.ibase(10)
}
func (in *in) ibase(base int) int64 {
	i, _ := strconv.ParseInt(in.s(), base, 64)
	return i
}
func (in *in) f() float64 {
	i, _ := strconv.ParseFloat(in.s(), 64)
	return i
}
func (in *in) ss(n int64) []string {
	a := make([]string, n)
	for i := range a {
		a[i] = in.s()
	}
	return a
}
func (in *in) is(n int64) []int64 {
	a := make([]int64, n)
	for i := range a {
		a[i] = in.i()
	}
	return a
}
func (in *in) fs(n int64) []float64 {
	a := make([]float64, n)
	for i := range a {
		a[i] = in.f()
	}
	return a
}
func (in *in) imat(h int64, w int64) [][]int64 {
	a := make([][]int64, h)
	for y := range a {
		a[y] = make([]int64, w)
		for x := range a[y] {
			a[y][x] = in.i()
		}
	}
	return a
}

func stdin() in {
	scn := bufio.NewScanner(os.Stdin)
	scn.Split(bufio.ScanWords)
	max := 1048576
	buf := make([]byte, max)
	scn.Buffer(buf, max)
	return in{Scanner: scn}
}

type lm struct{}

func (*lm) max(a ...int64) int64 {
	t := a[0]
	for _, v := range a {
		if t < v {
			t = v
		}
	}
	return t
}
func (*lm) min(a ...int64) int64 {
	t := a[0]
	for _, v := range a {
		if t > v {
			t = v
		}
	}
	return t
}
func (*lm) sum(a ...int64) int64 {
	t := int64(0)
	for _, v := range a {
		t += v
	}
	return t
}
func (*lm) abs(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}
func (lm *lm) gcd(a, b int64) int64 {
	// returns greatest common divisor.
	if a < b {
		a, b = b, a
	}
	if b == 0 {
		return a
	}
	return lm.gcd(b, a%b)
}
func (lm *lm) lcm(a, b int64) int64 {
	// returns least common multiple.
	gcd := lm.gcd(a, b)
	return gcd * (a / gcd) * (b / gcd)
}

type su struct{}

func (*su) iarr(arr []int64) string {
	// int slice to string.
	ret := make([]string, len(arr))
	for i, x := range arr {
		ret[i] = strconv.FormatInt(x, 10)
	}
	return strings.Join(ret, " ")
}
func (*su) ilns(arr []int64) string {
	// int slice to string.
	ret := make([]string, len(arr))
	for i, x := range arr {
		ret[i] = strconv.FormatInt(x, 10)
	}
	return strings.Join(ret, "\n")
}
func (su *su) imat(matrix [][]int64) string {
	// int slice matrix to string.
	ret := make([]string, len(matrix))
	for i := range matrix {
		ret[i] = su.iarr(matrix[i])
	}
	return strings.Join(ret, "\n")
}
func (*su) bool(b bool) str {
	if b {
		return "Yes"
	}
	return "No"
}

type str string

func (s str) upper() string { return strings.ToUpper(string(s)) }
func (s str) lower() string { return strings.ToLower(string(s)) }

type runes []rune

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

type comps [][]int64

func (p comps) Len() int { return len(p) }
func (p comps) Less(i, j int) bool {
	for x := range p[0] {
		// Yes, every row in matrix must have the same length.
		if p[i][x] < p[j][x] {
			return true
		}
	}
	return false
}

func (p comps) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
func (p *comps) Push(arr interface{}) {
	x := arr.([]int64)
	*p = append(*p, x)
}
func (p *comps) Pop() interface{} {
	// https://golang.org/pkg/container/heap/
	var ret []int64
	n := len(*p)
	ret, *p = (*p)[n-1], (*p)[0:n-1]
	return ret
}
func (p *comps) pop() []int64 {
	x := heap.Pop(p).([]int64)
	return x
}

func main() {
	// utilities.
	const zr int64 = int64(0)
	const mod int64 = int64(1000000007)
	in, lm, su := stdin(), lm{}, su{}
	_, _, _ = in, lm, su

	// --- read here.
	n := in.i()
	x := in.is(n)

	// --- solve here.
	odds := zr
	for _, v := range x {
		odds += v % 2
	}
	ans := lm.min(n-odds, odds)

	// --- print here.
	fmt.Println(ans)
}

package main

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

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

//	fmt.Println(len(array));
	var x int
	juft,toq := 0,0
	for i := 0 ; i < n ;i ++{
		fmt.Fscan(in,&x)
		if x % 2 == 0{
			juft ++
		}else{
			toq ++
		}

	}
	if juft < toq{
		fmt.Fprint(out,juft)
	}else{
		fmt.Fprint(out,toq)
	}

}

package main

import (
	"fmt"
)

func main() {
	var q, n, k, cnt int

	// scr := bufio.NewReader(os.Stdin)
	// ocr := bufio.NewWriter(os.Stdout)

	fmt.Scanln(&n)

	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &k)

		if i == 0 {
			if k%2 == 0 {
				q = 1
			} else {
				q = 0
			}
		} else {
			if q == 1 && k%2 == 1 {
				cnt++
			} else if q == 0 && k%2 == 0 {
				cnt++
			}
		}

	}

	fmt.Println(cnt)

}

package main

import "fmt"

func main() {
	var n int
	t1, t2 := 0, 0
	_, _ = fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		var x int
		_, _ = fmt.Scanf("%d", &x)
		if x&1 != 0 {
			t1++
		} else {
			t2++
		}
	}
	if t1 > t2 {
		fmt.Println(t2)
	} else {
		fmt.Println(t1)
	}
}

package main

import "fmt"

func solve(n int, x []int) int {
	var co int = 0
	var ce int = 0
    for i := 0; i < n; i++ {
		if x[i] & 1 != 0 {
			co += 1
		} else{
			ce += 1
		}
	}
	if co > ce {
		return ce
	}
	return co
}

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

package main

import "fmt"

func solve(n int, x []int) int {
    var co, ce int
    for i := 0; i < n; i++ {
		tmp := x[i] & 1
		if tmp == 1 {
			co += 1
		} else{
			ce += 1
		}
	}
	if co > ce {
		return ce
	}
	return co
}

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

package main

import "fmt"

func solve(n int, x []int) int {
    var co, ce int
    for i := 0; i < n; i++ {
		if x[i] & 1 != 0 {
			co += 1
		} else{
			ce += 1
		}
	}
	if co > ce {
		return ce
	}
	return co
}

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

package main

import "fmt"

func solve(n int, x []int) int {
	var co int = 0
	var ce int = 0
    for i := 0; i < n; i++ {
		if x[i] % 2 != 0 {
			co += 1
		} else{
			ce += 1
		}
	}
	if co > ce {
		return ce
	}
	return co
}

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

package main

import (
	"fmt"
	)

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

//	fmt.Println(len(array));
	var x int
	juft,toq := 0,0
	for i := 0 ; i < n ;i ++{
		fmt.Scanf("%d",&x)
		if x % 2 == 0{
			juft ++
		}else{
			toq ++
		}

	}
	if juft < toq{
		fmt.Print(juft)
	}else{
		fmt.Print(toq)
	}

}

package main

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

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

//	fmt.Println(len(array));
	var x int
	juft,toq := 0,0
	for i := 0 ; i < n ;i ++{
		fmt.Scanf("%d",&x)
		if x % 2 == 0{
			juft ++
		}else{
			toq ++
		}

	}
	ans := 0
	if juft < toq{
		ans = juft
	}else{
		ans = toq
	}
	fmt.Fprint(out,ans)

}

package main

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

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

//	fmt.Println(len(array));
	var x int
	juft,toq := 0,0
	for i := 0 ; i < n ;i ++{
		fmt.Scanf("%d",&x)
		if x % 2 == 0{
			juft ++
		}else{
			toq ++
		}

	}
	if juft < toq{
		fmt.Fprint(out,juft)
	}else{
		fmt.Fprint(out,toq)
	}

}