package main

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

func toInt(buff []byte) (n int64) {
	for _, v := range buff {
		n = n*10 + int64(v - '0')
	}
	return
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	scanner.Scan()
	for scanner.Scan() {
		b := toInt(scanner.Bytes())
		if (b/2)%2 == 0 {
			numbers := make([]int64, b)
			sumEven := int64(0)
			sumOdd  := int64(0)
			for i := int64(1); i <= b / 2; i++ {
				numbers[i - 1] = 2 * i
				numbers[(b / 2) + i - 1] = (2 * i) - 1
				sumEven += numbers[i - 1]
				sumOdd += 2 * i - 1
			}
			diff := sumEven - sumOdd
			if diff % 2 == 0 {
				numbers[b - 1] += diff
				writer.WriteString("YES\n")
				for _, num := range numbers {
					writer.WriteString(strconv.FormatInt(num, 10) + " ")
				}
				writer.WriteString("\n")
				continue
			}
		}
		writer.WriteString("NO\n")
	}

}

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 i := 0; i < t; i++ {
		var n int
		fmt.Fscan(r, &n)
		if (n/2)%2 == 0 {
			fmt.Fprintln(w, "YES")
			for j := 2; j <= n; j += 2 {
				fmt.Fprintf(w, "%d ", j)
			}
			for j := 1; j < n-1; j += 2 {
				fmt.Fprintf(w, "%d ", j)
			}
			fmt.Fprintln(w, n + n/2 - 1)
		} else {
			fmt.Fprintln(w, "NO")
		}
	}

}

package main

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

// parse positive int from byte slice
func parseInt(a []byte, start int) (ans int) {
	for i := start; i < len(a) && a[i] >= '0' && a[i] <= '9'; i += 1 {
		// skip overflow check
		ans = 10*ans + int(a[i]-'0')
	}
	return ans
}

// left evens:
// (2 + n    )*(n/2)/2
// right odds without last:
// (1 + n - 3)*(n/2-1)/2
// last odd = left_sum - right_sum = 3*n/2-1
func generateNumbers(n int) []byte {
	ans := []byte{}
	for i := 2; i <= n; i += 2 {
		ans = append(ans, []byte(fmt.Sprintf("%d ", i))...)
	}
	for i := 1; i <= n-3; i += 2 {
		ans = append(ans, []byte(fmt.Sprintf("%d ", i))...)
	}
	ans = append(ans, []byte(fmt.Sprintln(3*n/2-1))...)
	return ans
}

// https://codeforces.com/problemset/problem/1343/B
// комментарии к решению
// Во первых для решения подходят только n кратные 4, т.к. нужна четная сумма нечетных
// Во вторых в самом простом решении при анализе примеров прослеживаются арифметические
// подпоследовательности в левой/правой частях решения для каждого n
// В третьих в виду ограничений по времени в 1 секунду лучше использовать bytes.ReadAll
// вместо fmt.Scan
func taskSolution(a []byte, t int) string {
	intStart := 0
	ans := []byte{}
	for i := 0; i < t; i += 1 {
		// find next
		// skip len check, because t value control number count
		for !(a[intStart] >= '0' && a[intStart] <= '9') {
			intStart += 1
		}
		cur := parseInt(a, intStart)
		if cur%4 != 0 {
			ans = append(ans, []byte("NO\n")...)
		} else {
			ans = append(ans, []byte("YES\n")...)
			ans = append(ans, generateNumbers(cur)...)
		}
		// skip parsed
		for a[intStart] >= '0' && a[intStart] <= '9' {
			intStart += 1
		}
	}
	return string(ans[:len(ans)-1])
}

func main() {
	var t int
	if _, err := fmt.Scan(&t); err != nil {
		panic(err)
	}

	inRaw, err := ioutil.ReadAll(os.Stdin)
	if err != nil {
		panic(err)
	}

	fmt.Println(taskSolution(inRaw, t))
}

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

package main

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

func Solve(n int) []int {
	if n/2%2 == 1 {
		return []int{}
	}
	ans := make([]int, n)
	for i := 0; i < n/2; i++ {
		ans[i] = 2 * (i + 1)
		ans[i+n/2] = 2*(i+1) - 1
	}
	ans[n-1] = n/2*(n/2+1) - (n/2-1)*(n/2-1)
	return ans
}

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

	var t int
	fmt.Fscanf(reader, "%d\n", &t)
	for i := 0; i < t; i++ {
		var n int
		fmt.Fscanf(reader, "%d\n", &n)
		ans := Solve(n)
		if len(ans) == 0 {
			fmt.Fprintf(writer, "NO\n")
		} else {
			fmt.Fprintf(writer, "YES\n")
			for _, elem := range ans {
				fmt.Fprintf(writer, "%d ", elem)
			}
			fmt.Fprintf(writer, "\n")
		}
	}
}

package main

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

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Split(bufio.ScanWords)
    writer := bufio.NewWriter(os.Stdout)
    defer writer.Flush()

    scanner.Scan()
    t, _ := strconv.Atoi(scanner.Text())

    for i := 0; i < t; i++ {
        scanner.Scan()
        n, _ := strconv.Atoi(scanner.Text())
        if n % 4 > 0 {
            fmt.Fprint(writer, "NO\n")
            continue
        }

        ar := make([]int, n, n)
        for k := range ar {
            if k < n / 2 {
                ar[k] = k * 2 + 2
            } else {
                ar[k] = (k - len(ar) / 2) * 2 + 1
            }
        }

        ar[len(ar)-1] += n / 2
        result := []rune(fmt.Sprintf("%v", ar))

        fmt.Fprintf(writer, "YES\n%s\n", string(result[1:len(result)-1]))
    }

}

package main

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

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	NextInt() int
	NextInt64() int64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	// adjust the following size as needed
	// 2 << 17 is good enough to scan strings of len 2*10^5
	// it could go as high as 2 << 26 before cf judge breaks
	size := 2 << 20
	buf := make([]byte, size)
	s.Buffer(buf, size)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt() int {
	impl.Scan()
	bb := impl.Bytes()
	i := 0
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

func main() {
	defer writer.Flush()
	t := reader.NextInt64()
	for ; t > 0; t-- {
		res := sol(reader.NextInt64())
		if res == nil {
			writer.Printf("NO\n")
		} else {
			writer.Printf("YES\n")
			for _, d := range res {
				writer.Printf("%d ", d)
			}
			writer.Printf("\n")
		}
	}
}

func sol(n int64) []int64 {
	if (n/2)&1 == 1 {
		return nil
	}
	ret := make([]int64, n)
	curr := int64(2)
	for i := int64(0); i < n/2; i++ {
		ret[i] = curr
		curr += 2
	}
	curr = int64(2)
	for i := n / 2; i < n; i++ {
		if i < n*3/4 {
			ret[i] = curr-1
		} else {
			ret[i] = curr+1
		}
		curr += 2
	}
	return ret
}

package main

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

func main() {
	var n, t int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for j := 0; j < t; j++ {
		fmt.Fscan(in, &n)
		m := n / 2
		if m%2 == 0 {
			fmt.Println("YES")
			sum := 0
			for i := 1; i <= m; i++ {
				fmt.Printf("%d ", i*2)
				sum += i * 2
			}
			sum2 := 0
			for i := 0; i < m-1; i++ {
				fmt.Printf("%d ", i*2+1)
				sum2 += i*2 + 1
			}
			fmt.Printf("%d\n", sum-sum2)
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

func toInt(buff []byte) (n int64) {
	for _, v := range buff {
		n = n*10 + int64(v - '0')
	}
	return
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	scanner.Scan()
	for scanner.Scan() {
		b := toInt(scanner.Bytes())
		if (b/2)%2 == 0 {
			sumEven := int64(0)
			sumOdd  := int64(0)
			writer.WriteString("YES\n")
			for i := int64(1); i < b; i++ {
				var num int64
				if i <= (b / 2) {
					num = 2 * i
					sumEven += num
				} else {
					num = 2 * ( i - (b / 2)) - 1
					sumOdd += num
				}
				writer.WriteString(strconv.FormatInt(num, 10) + " ")
			}
			num := 2 * (b / 2) - 1
			diff := sumEven - (sumOdd + num)
			if diff % 2 == 0 {
				num += diff
				writer.WriteString(strconv.FormatInt(num, 10) + "\n")
				continue
			}
		}
		writer.WriteString("NO\n")
	}

}

package main

import "fmt"

func main() {
	var t int
	fmt.Scanln(&t)
	for ; t>0; t-- {
		var n int
		fmt.Scanln(&n)
		if n/2%2==0 {
			fmt.Println("YES")
			for i:=1; i<=n/2; i++ {
				fmt.Printf("%d ", i*2)
			}
			for i:=n/2+1; i<n; i++ {
				fmt.Printf("%d ", (i-n/2-1)*2+1)
			}
			fmt.Printf("%d\n", n+n/2-1)
		} else {
			fmt.Println("NO")
		}
	}
	return
}

package main

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

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		var n int
		fmt.Fscan(in, &n)
		k := n / 2
		if k%2 == 1 {
			fmt.Fprintln(out, "NO")
			continue
		}
		fmt.Fprintln(out, "YES")
		for i := 1; i <= k; i++ {
			fmt.Fprintf(out, "%d ", i*2)
		}
		for i := 1; i <= k-1; i++ {
			fmt.Fprintf(out, "%d ", 2*i-1)
		}
		fmt.Fprintf(out, "%d\n", 3*k-1)
	}
}

package main

import (
	"bufio"
	"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)

	tc := readNum(reader)

	for tc > 0 {
		tc--
		n := readNum(reader)

		ok := solve(n)

		if ok {
			fmt.Println("YES")
			for i := 0; i < n; i++ {
				fmt.Printf("%d ", res[i])
			}
			fmt.Println()
		} else {
			fmt.Println("NO")
		}
	}
}

const MAX_N = 200001

var res []int

func init() {
	res = make([]int, MAX_N)
}

func solve(n int) bool {
	h := n >> 1

	if h&1 == 1 {
		return false
	}

	for i := 0; i < h; i++ {
		res[i] = (i + 1) << 1
	}

	for i := h; i < n; i++ {
		res[i] = ((i - h + 1) << 1) - 1
	}

	res[n-1] += h

	return true
}

package main

import "fmt"

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

	if n % 4 != 0 {
		fmt.Println("NO")
		return
	} else {
		fmt.Println("YES")
	}

	arr := make([]int, n)
	n_half := n / 2
	even := 2
	var odd int
	for i := 0; i < n_half; i++ {
		if i % 2 == 0 {
			odd = even - 1
		} else {
			odd = even + 1
		}

		arr[i] = even
		arr[n_half + i] = odd

		if i % 2 == 0 {
			even += 2
		} else {
			even += 4
		}
	}
	// fmt.Println(arr)
	for i := 0; i < n; i++ {
		fmt.Print(arr[i], " ")
	}
	fmt.Println()
}

func main() {
	var N int
	fmt.Scan(&N)
	for i := 0; i < N; i++ {
		do()
	}
}

// https://codeforces.com/contest/1343/problem/B

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
	scanf("%d\n", &n)
	for i:=0;i<n;i++ {
		var t int
		scanf("%d\n", &t)
		if (t/2)%2 != 0 || t == 2 {
			printf("%s\n", "NO")
		} else {
			printf("%s\n", "YES")
			var odd,even []int
			sumOdd, sumEven := 0, 0
			for j:=1;j<=t;j++ {
				if j%2!=0 {
					if j!=t-1 {
						sumOdd += j
						odd = append(odd, j)
					}
				} else {
					sumEven += j
					even = append(even, j)
				}
			}
			for _, v := range even {
				printf("%d ", v)
			}
			for _, v := range odd {
				printf("%d ", v)
			}
			printf("%d\n", sumEven - sumOdd)
		}
	}
}

package main

import (
	"fmt"
)

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

	for i := 0; i < t; i++ {
		var n int
		fmt.Scan(&n)

		if n/2%2 == 1 {
			fmt.Println("NO")
			continue
		}

		fmt.Println("YES")

		a := make([]int, n)
		for j := 1; j <= n/2; j++ {
			a[j-1] = 2 * j
			a[n/2+j-1] = 2*j - 1
		}

		a[n-1] += n / 2
		for j := 0; j < n; j++ {
			if j == n-1 {
				fmt.Printf("%d", a[j])
				continue
			}
			fmt.Printf("%d ", a[j])
		}
		fmt.Println()
	}
}

// https://acm.timus.ru/problem.aspx?space=1&num=1741
package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)

func main () {
	var (
		T, n int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input := bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		fmt.Fscan(input, &n)
		p := n / 2
		if p % 2 == 1 {
			fmt.Println("NO")
			continue
		}

		fmt.Println("YES")
		for k := 1; k < p; k++ {
			fmt.Print(2*k, " ")
		}
		fmt.Print(2*p + p)

		for k := 1; k <= p; k++ {
			fmt.Print(" ", 2*k + 1)
		}
		fmt.Println()
	}
}

package main

import (
	"fmt"
)

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

	for i := 0; i < t; i++ {
		var n int
		fmt.Scan(&n)
		n /= 2 // length of just one half
		if n % 2 == 1 {
			fmt.Println("NO")
			continue
		}

		// left half should just be n/2 even
		// n*(n+1)
		l := n*(n+1)
		// right half is n-1 odds + remainder
		// 2 4 6 = 12 => 1 3 5 = 12 - 3 = 9
		r := (n-1)*(n-1)
		fmt.Println("YES")
		for j := 1; j <= n; j++ {
			fmt.Printf("%d ", j*2)
		}
		for j := 1; j < n; j++ {
			fmt.Printf("%d ", j*2 - 1)
		}
		fmt.Println(l - r)
	}
}

package main

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

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

    var t int
    fmt.Fscan(in, &t)
    for ; t > 0; t-- {
        var n int
        fmt.Fscan(in, &n)
        if n % 4 == 0 {
            fmt.Fprintln(out, "YES")
        } else {
            fmt.Fprintln(out, "NO")
            continue
        }
        var s int64
        for i := 2; i <= n; i += 2 {
            s += int64(i)
            fmt.Fprint(out, i, " ")
        }
        for i := 1; i <= n - 3; i += 2 {
            s -= int64(i)
            fmt.Fprint(out, i, " ")
        }
        fmt.Fprintln(out, s)
    }
    out.Flush()
}

package main

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

func isEvenNumber(n int) bool {
	return n%2 == 0
}

func main() {
	r := bufio.NewReader(os.Stdin)
	var n, t, j, limit int
	fmt.Fscanf(r, "%d\n", &t)

	for tc := 0; tc < t; tc++ {
		fmt.Fscanf(r, "%d\n", &n)
		if !isEvenNumber(n / 2) {
			fmt.Fprintf(os.Stdout, "%s\n", "NO")
		} else {
			arr := make([]int, n)
			j = 2
			limit = n + 2
			fmt.Fprintf(os.Stdout, "%s\n", "YES")
			for i := 0; i < n/2; i += 2 {
				arr[i] = j
				arr[i+1] = limit - j
				j += 2
			}

			j = 1
			for i := n / 2; i < n; i += 2 {
				arr[i] = j
				arr[i+1] = limit - j
				j += 2
			}

			for i := range arr {
				fmt.Fprintf(os.Stdout, "%d ", arr[i])
			}
			fmt.Fprintln(os.Stdout)
		}
	}
}

package main

import "fmt"

func main() {
	var i int
	fmt.Scanln(&i)
	for ; i > 0; i-- {
		var n int
		fmt.Scanln(&n)
		if n/2%2 != 0 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
			var sum int = 0
			for t := 0; t < n/2; t++ {
				sum += (t + 1) * 2
				fmt.Printf("%d ", (t+1)*2)
			}
			for t := 0; t < n/2-1; t++ {
				sum -= t*2 + 1
				fmt.Printf("%d ", t*2+1)
			}
			fmt.Println(sum)
		}
	}
}

package main

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

func main() {
	var n,inp int
	// in := bufio.NewReader(os.Stdin)
	// fmt.Fscanf(in, "%d %d\n", &n, &m)
	fmt.Scan(&n)
	for i:=0; i < n; i++{
		fmt.Scan(&inp)
		if inp % 4 != 0{
			fmt.Println("NO")
		}else{
			var s []int
			var se, so int
			fmt.Println("YES")
			for j:=2; j <= inp; {
				s = append(s, j)
				se += j
				j += 2
			}
			for j:=1; j <= inp;{
				s = append(s, j)
				so += j
				j +=2
			}
			s[len(s) - 1] += se - so
			for k:=0; k < len(s); k++{
				fmt.Print(s[k], " ")
			}
			fmt.Println()
		}
	}

}

package main

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

func main() {
	for t := ScanInt(); t > 0; t-- {
		n := ScanInt()
		if (n/2)%2 == 1 {
			P("NO")
		} else {
			solv(n)
		}
	}
	close(O)
	oWg.Wait()
}

func solv(n int) {
	evenStr := strings.Builder{}
	oddStr := strings.Builder{}
	lastOdd := 0
	evenSum := int64(0)
	oddSum := int64(0)

	for i := 1; i <= n/2; i++ {
		evenStr.WriteString(strconv.Itoa(2*i) + " ")
		evenSum += int64(2 * i)

		if i == n/2 {
			lastOdd = (2 * i) - 1
		} else {
			oddStr.WriteString(strconv.Itoa((2*i)-1) + " ")
		}
		oddSum += int64((2 * i) - 1)
	}
	diff := evenSum - oddSum

	if diff%2 == 0 {
		lastOdd += int(diff)
		oddStr.WriteString(strconv.Itoa(lastOdd))
	} else {
		P("NO")
		return
	}
	P("YES")
	P(evenStr.String(), oddStr.String())
	return
}

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

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var P func(a ...interface{}) (n int, err error)

func init() {
	P = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}()
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanInt() int     { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInt64() int64 { i, _ := strconv.ParseInt(ScanWord(), 10, 64); return i }
func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt()
	}
	return arr
}
func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func S(v interface{}) string { return fmt.Sprintf("%v", v) }
func SArr(a []int) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.Itoa(a[i]) + " ")
	}
	return sb.String()
}
func SArr64(a []int64) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.FormatInt(a[i], 10) + " ")
	}
	return sb.String()
}
func MnMx(args ...int64) (int64, int64) {
	minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64)
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}
func Mn(args ...int64) int64 { mn, _ := MnMx(args...); return mn }
func Mx(args ...int64) int64 { _, mx := MnMx(args...); return mx }
func LCM(a, b int64) int64   { return a / GCD(a, b) * b }
func GCD(a, b int64) int64 {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func sortInt64Slice(a []int64) { sort.Slice(a, func(i, j int) bool { return a[i] < a[j] }) }
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

package main

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

func main() {
	for t := ScanInt(); t > 0; t-- {
		n := ScanInt()
		if (n/2)%2 == 1 {
			P("NO")
		} else {
			solv(n)
		}
	}
	close(O)
	oWg.Wait()
}

func solv(n int) {
	evenArr := make([]int, n/2)
	oddArr := make([]int, n/2)
	evenSum := int64(0)
	oddSum := int64(0)

	for i := 1; i <= n/2; i++ {
		evenArr[i-1] = 2 * i
		evenSum += int64(2 * i)

		oddArr[i-1] = (2 * i) - 1
		oddSum += int64((2 * i) - 1)
	}
	diff := evenSum - oddSum

	if diff%2 == 0 {
		oddArr[len(oddArr)-1] += int(diff)
	} else {
		P("NO")
		return
	}
	P("YES")
	P(SArr(evenArr) + SArr(oddArr))
	return
}

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

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var P func(a ...interface{}) (n int, err error)

func init() {
	P = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}()
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanInt() int     { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInt64() int64 { i, _ := strconv.ParseInt(ScanWord(), 10, 64); return i }
func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt()
	}
	return arr
}
func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func S(v interface{}) string { return fmt.Sprintf("%v", v) }
func SArr(a []int) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.Itoa(a[i]) + " ")
	}
	return sb.String()
}
func SArr64(a []int64) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.FormatInt(a[i], 10) + " ")
	}
	return sb.String()
}
func MnMx(args ...int64) (int64, int64) {
	minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64)
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}
func Mn(args ...int64) int64 { mn, _ := MnMx(args...); return mn }
func Mx(args ...int64) int64 { _, mx := MnMx(args...); return mx }
func LCM(a, b int64) int64   { return a / GCD(a, b) * b }
func GCD(a, b int64) int64 {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func sortInt64Slice(a []int64) { sort.Slice(a, func(i, j int) bool { return a[i] < a[j] }) }
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

package main

import "fmt"

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

	var n []int = make([]int, t)
	for i:=0; i< t ; i++ {
		fmt.Scanln(&n[i])
	}

	for i:=0; i< t ; i++ {
		if v := isBalanced(n[i]); v != nil {
			fmt.Println("YES")
			print(v)
		} else {
			fmt.Println("NO")
		}
	}
}

func print(arr []int) {
	for i:=0; i < len(arr); i++ {
		if i == len(arr)-1 {
			fmt.Println(arr[i])
		} else {
			fmt.Printf("%d ", arr[i])
		}
	}
}

func isBalanced(n int) []int {

	if (n/2)%2 == 1 {
		return nil
	}

	var left []int

	i := 1

	for i=2; i < n+1; i=i+2 {
		left = append(left, i)
	}
	for i=1; i < n-1; i=i+2 {
		left = append(left, i)
	}
	// fmt.Println("right ",right)

	left = append(left, (n+n/2 -1))

	return left
}

package main

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

//-------------------------------------27.4.2020--------------------------------------

func main() {
	inBuf := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscanf(inBuf,"%d\n", &t)

	format := "%d"
	for i := 0; i < t; i++ {
		var n int
		fmt.Fscanf(inBuf, format, &n)
		format = "\n%d"
		if arr, err := SolveAndMaybeGenerateArray(n/2); err != nil {
			fmt.Println(err.Error())
		} else {
			fmt.Println("YES")
			format1 := "%v"
			for _, v := range arr {
				fmt.Printf(format1, v)
				format1 = " %v"
			}
			fmt.Println()
		}
	}
}

func SolveAndMaybeGenerateArray(n int) ([]int, error) {
	res := make([]int, n*2)
	if n%2 != 0 {
		return nil, fmt.Errorf("NO")
	}

	i := 1
	for i <= n {
		res[i-1] = i*2
		i++
	}

	i-=1
	suma := res[0] + res[n-1]
	p := 1
	for i < n*2-n/2 {
		res[i] = p
		res[n*2-(i-n+1)] = suma - p
		i++
		p+=2
	}

	return res, nil
}

package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var a, b int
	fmt.Scan(&a)
	for i := 0; i < a; i++ {
		fmt.Scan(&b)
		if b%2 != 0 || (b/2)%2 != 0 {
			fmt.Println("No")
		} else {
			fmt.Println("Yes")
			var c []string
			sum := 0
			sum1 := 0
			for j := 0; j < b; j += 2 {
				c = append(c, strconv.Itoa(j+2))
				sum += j + 2
			}
			for j := 1; j < b-2; j += 2 {
				// b-2 to append last value in line 28
				c = append(c, strconv.Itoa(j))
				sum1 += j
			}
			c = append(c, strconv.Itoa(sum-sum1))
			fmt.Println(strings.Join(c, " "))
		}
	}
}

package main

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

func main() {
	var noEx int
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	fmt.Fscan(in, &noEx)
	for nE:=0; nE<noEx; nE++ {
		var n int
		fmt.Fscan(in, &n)
		if (n / 2) % 2 != 0 {fmt.Fprint(out, "NO\n"); continue}
		fmt.Fprint(out, "YES\n")
		for e,c:=2,0; c<n/2; c++ {
			fmt.Fprint(out, e)
			fmt.Fprint(out, " ")
			e += 4
		}
		for e,c,diff:=2,0,1; c<n/2; c++ {
			fmt.Fprint(out, e+diff)
			diff*=-1
			if c != n/2 -1 {fmt.Fprint(out, " ")}
			e += 4
		}
		fmt.Fprint(out, "\n")
	}
}

package main

import "fmt"

func main() {
	var t, n int
	fmt.Scan(&t)
	for i := 0; i < t; i++ {
		fmt.Scan(&n)
		if n%4 == 0 {
			fmt.Println("YES")
			for first := 2; first <= n; first += 2 {
				fmt.Printf("%v ", first)
			}
			for second := 1; second < n-2; second += 2 {
				fmt.Printf("%v ", second)
			}
			fmt.Printf("%v\n", n+n/2-1)
		} else {
			fmt.Println("NO")
		}
	}

}

package main

import (
	"fmt"
)

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

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

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

var mod int = 1000000007

func main() {
	var t int
	fmt.Scan(&t)
	for qt := 0; qt < t; qt++ {
		var n int
		fmt.Scan(&n)
		if (n/2)%2 == 1 {
			fmt.Println("NO")
		} else {
			arr := make([]int, n)
			j := 2
			sum := 0
			for i := 0; i < n/2; i++ {
				arr[i] = j
				sum += arr[i]
				j += 2
			}
			j = 1
			for i := n / 2; i < n-1; i++ {
				arr[i] = j
				sum -= arr[i]
				j += 2
			}
			arr[n-1] = sum
			fmt.Println("YES")
			for _, val := range arr {
				fmt.Printf("%d ", val)
			}
			fmt.Println()
		}
	}
}

package main

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

// https://codeforces.com/problemset/problem/1343/B
// B. Balanced Array
// time limit per test
// 1 second
// memory limit per test
// 256 megabytes
// input
// standard input
// output
// standard output

// You are given a positive integer n
// , it is guaranteed that n is even (i.e. divisible by 2

// ).

// You want to construct the array a
// of length n

// such that:

//     The first n2

// elements of a are even (divisible by 2
// );
// the second n2
// elements of a are odd (not divisible by 2
// );
// all elements of a
// are distinct and positive;
// the sum of the first half equals to the sum of the second half (∑i=1n2ai=∑i=n2+1nai

//     ).

// If there are multiple answers, you can print any. It is not guaranteed that the answer exists.

// You have to answer t

// independent test cases.
// Input

// The first line of the input contains one integer t
// (1≤t≤104) — the number of test cases. Then t

// test cases follow.

// The only line of the test case contains one integer n
// (2≤n≤2⋅105) — the length of the array. It is guaranteed that that n is even (i.e. divisible by 2

// ).

// It is guaranteed that the sum of n
// over all test cases does not exceed 2⋅105 (∑n≤2⋅105

// ).
// Output

// For each test case, print the answer — "NO" (without quotes), if there is no suitable answer for the given test case or "YES" in the first line and any suitable array a1,a2,…,an
// (1≤ai≤109) satisfying conditions from the problem statement on the second line.

var bufStdin = bufio.NewReader(os.Stdin)
var bufStdout = bufio.NewWriter(os.Stdout)

func main() {
	defer bufStdout.Flush()

	var t int
	_, _ = fmt.Fscan(bufStdin, &t)

	tests := make([]int, t)
	for i := 0; i < t; i++ {
		_, _ = fmt.Fscan(bufStdin, &tests[i])
	}

	for i := 0; i < t; i++ {
		v := tests[i]

		if v%4 != 0 {
			_, _ = fmt.Fprintln(bufStdout, "NO")
		} else {
			_, _ = fmt.Fprintln(bufStdout, "YES")
			arr := constructArray(v)
			for _, v := range arr {
				_, _ = fmt.Fprint(bufStdout, v, " ")
			}
			_, _ = fmt.Fprintln(bufStdout)
		}
	}
}

func constructArray(n int) []int {
	arr := make([]int, 0, n)

	for i := 0; i < n/2; i++ {
		arr = append(arr, (i+1)*2)
	}

	for i := 0; i < n/2; i++ {
		arr = append(arr, i*2+1)
	}
	arr[n-1] += n / 2

	return arr
}

package main

import "fmt"

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

	for i:=0; i< t ; i++ {
		fmt.Scanf("%d", &n)
		if v := isBalanced(n); v != nil {
			fmt.Println("YES")
			fmt.Println(v)
		} else {
			fmt.Println("NO")
		}
	}
}

func isBalanced(n int) []int {

	if (n/2)%2 == 1 {
		return nil
	}

	var left, right []int

	i := 1

	for i=1; i <= n/2; i++ {
		left = append(left, 2*i)
		if i < n/2 {
			right = append(right, 2*(i-1) +1)
		}
	}
	// fmt.Println("right ",right)

	right = append(right, 2*(i-2) + 1+ n/2)
	left = append(left, right...)

	return left
}

package main

import "fmt"

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

	for i:=0; i< t ; i++ {
		fmt.Scanln("%d", &n)
		if v := isBalanced(n); v != nil {
			fmt.Println("YES")
			fmt.Println(v)
		} else {
			fmt.Println("NO")
		}
	}
}

func isBalanced(n int) []int {

	if (n/2)%2 == 1 {
		return nil
	}

	var left []int

	i := 1

	for i=2; i < n+1; i=i+2 {
		left = append(left, i)
	}
	for i=1; i < n-1; i=i+2 {
		left = append(left, i)
	}
	// fmt.Println("right ",right)

	left = append(left, (n+n/2 -1))

	return left
}

package main

import "fmt"

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

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

	for i:=0; i< t ; i++ {
		if v := isBalanced(n[i]); v != nil {
			fmt.Println("YES")
			print(v)
		} else {
			fmt.Println("NO")
		}
	}
}

func print(arr []int) {
	for i:=0; i < len(arr); i++ {
		if i == 0 {
			fmt.Printf("%d", arr[i])
		} else {
			fmt.Printf(" %d", arr[i])
		}
	}
	fmt.Println("")
}

func isBalanced(n int) []int {

	if (n/2)%2 == 1 {
		return nil
	}

	var left []int

	i := 1

	for i=2; i < n+1; i=i+2 {
		left = append(left, i)
	}
	for i=1; i < n-1; i=i+2 {
		left = append(left, i)
	}
	// fmt.Println("right ",right)

	left = append(left, (n+n/2 -1))

	return left
}

package main

import "fmt"

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

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

	for i:=0; i< t ; i++ {
		if v := isBalanced(n[i]); v != nil {
			fmt.Println("Yes")
			print(v)
		} else {
			fmt.Println("No")
		}
	}
}

func print(arr []int) {
	for i:=0; i < len(arr); i++ {
		if i == len(arr)-1 {
			fmt.Println(arr[i])
		} else {
			fmt.Printf("%d ", arr[i])
		}
	}
}

func isBalanced(n int) []int {

	if (n/2)%2 == 1 {
		return nil
	}

	var left []int

	i := 1

	for i=2; i < n+1; i=i+2 {
		left = append(left, i)
	}
	for i=1; i < n-1; i=i+2 {
		left = append(left, i)
	}
	// fmt.Println("right ",right)

	left = append(left, (n+n/2 -1))

	return left
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scanln("%d", &t)

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

	for i:=0; i< t ; i++ {
		if v := isBalanced(n[i]); v != nil {
			fmt.Println("YES")
			print(v)
		} else {
			fmt.Println("NO")
		}
	}
}

func print(arr []int) {
	for i:=0; i < len(arr); i++ {
		if i == len(arr)-1 {
			fmt.Println(arr[i])
		} else {
			fmt.Printf("%d ", arr[i])
		}
	}
}

func isBalanced(n int) []int {

	if (n/2)%2 == 1 {
		return nil
	}

	var left []int

	i := 1

	for i=2; i < n+1; i=i+2 {
		left = append(left, i)
	}
	for i=1; i < n-1; i=i+2 {
		left = append(left, i)
	}
	// fmt.Println("right ",right)

	left = append(left, (n+n/2 -1))

	return left
}

package main

import "fmt"

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

	for i:=0; i< t ; i++ {
		fmt.Scanf("%d", &n)
		if v := isBalanced(n); v != nil {
			fmt.Println("YES")
			fmt.Println(v)
		} else {
			fmt.Println("NO")
		}
	}
}

func isBalanced(n int) []int {

	if (n/2)%2 == 1 {
		return nil
	}

	var left []int

	i := 1

	for i=2; i < n+1; i=i+2 {
		left = append(left, i)
	}
	for i=1; i < n-1; i=i+2 {
		left = append(left, i)
	}
	// fmt.Println("right ",right)

	left = append(left, (n+n/2 -1))

	return left
}

package main

import "fmt"

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

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

	for i:=0; i< t ; i++ {
		if v := isBalanced(n[i]); v != nil {
			fmt.Println("Yes")
			print(v)
		} else {
			fmt.Println("No")
		}
	}
}

func print(arr []int) {
	for i:=0; i < len(arr); i++ {
		if i == 0 {
			fmt.Printf("%d", arr[i])
		} else {
			fmt.Printf(" %d", arr[i])
		}
	}
	fmt.Println("")
}

func isBalanced(n int) []int {

	if (n/2)%2 == 1 {
		return nil
	}

	var left []int

	i := 1

	for i=2; i < n+1; i=i+2 {
		left = append(left, i)
	}
	for i=1; i < n-1; i=i+2 {
		left = append(left, i)
	}
	// fmt.Println("right ",right)

	left = append(left, (n+n/2 -1))

	return left
}

package main

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

//-------------------------------------27.4.2020--------------------------------------

func main() {
	inBuf := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscanf(inBuf,"%d\n", &t)

	format := "%d"
	for i := 0; i < t; i++ {
		var n int
		fmt.Fscanf(inBuf, format, &n)
		format = "\n%d"
		if arr, err := SolveAndMaybeGenerateArray(n/2); err != nil {
			fmt.Println(err.Error())
		} else {
			fmt.Println("YES")
			fmt.Println(arr)
		}
	}
}

func SolveAndMaybeGenerateArray(n int) ([]int, error) {
	res := make([]int, n*2)
	if n%2 != 0 {
		return nil, fmt.Errorf("NO")
	}

	i := 1
	for i <= n {
		res[i-1] = i*2
		i++
	}

	i-=1
	suma := res[0] + res[n-1]
	p := 1
	for i < n*2-n/2 {
		res[i] = p
		res[n*2-(i-n+1)] = suma - p
		i++
		p+=2
	}

	return res, nil
}

package main

import (
	"fmt"
)

func main() {
	var a, b int
	fmt.Scan(&a)
	for i := 0; i < a; i++ {
		fmt.Scan(&b)
		if b%2 != 0 || (b/2)%2 != 0 {
			fmt.Println("No")
		} else {
			fmt.Println("Yes")
			var c []int
			sum := 0
			sum1 := 0
			for j := 0; j < b; j += 2 {
				c = append(c, j+2)
				sum += j + 2
			}
			for j := 1; j < b-2; j += 2 {
				// b-2 to append last value in line 28
				c = append(c, j)
				sum1 += j
			}
			c = append(c, sum-sum1)
			fmt.Println(c)
		}
	}
}

package main

import "fmt"

func main() {
	var noEx int
	fmt.Scan(&noEx)
	for nE:=0; nE<noEx; nE++ {
		var n int
		fmt.Scan(&n)
		if (n / 2) % 2 != 0 {fmt.Println("NO"); continue}
		fmt.Println("YES")
		for e,c:=2,0; c<n/2; c++ {
			fmt.Print(e)
			fmt.Print(" ")
			e += 4
		}
		for e,c,diff:=2,0,1; c<n/2; c++ {
			fmt.Print(e+diff)
			diff*=-1
			if c != n/2 -1 {fmt.Print(" ")}
			e += 4
		}
	}
}

package main

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

func main() {
	var noEx int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &noEx)
	for nE:=0; nE<noEx; nE++ {
		var n int
		fmt.Fscan(in, &n)
		if (n / 2) % 2 != 0 {fmt.Fprint(os.Stdout, "NO"); continue}
		fmt.Fprint(os.Stdout, "YES")
		for e,c:=2,0; c<n/2; c++ {
			fmt.Fprint(os.Stdout, e)
			fmt.Fprint(os.Stdout, " ")
			e += 4
		}
		for e,c,diff:=2,0,1; c<n/2; c++ {
			fmt.Print(e+diff)
			diff*=-1
			if c != n/2 -1 {fmt.Fprint(os.Stdout, " ")}
			e += 4
		}
		fmt.Fprint(os.Stdout, "\n")
	}
}

package main

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

// https://codeforces.com/problemset/problem/1343/B
// B. Balanced Array
// time limit per test
// 1 second
// memory limit per test
// 256 megabytes
// input
// standard input
// output
// standard output

// You are given a positive integer n
// , it is guaranteed that n is even (i.e. divisible by 2

// ).

// You want to construct the array a
// of length n

// such that:

//     The first n2

// elements of a are even (divisible by 2
// );
// the second n2
// elements of a are odd (not divisible by 2
// );
// all elements of a
// are distinct and positive;
// the sum of the first half equals to the sum of the second half (∑i=1n2ai=∑i=n2+1nai

//     ).

// If there are multiple answers, you can print any. It is not guaranteed that the answer exists.

// You have to answer t

// independent test cases.
// Input

// The first line of the input contains one integer t
// (1≤t≤104) — the number of test cases. Then t

// test cases follow.

// The only line of the test case contains one integer n
// (2≤n≤2⋅105) — the length of the array. It is guaranteed that that n is even (i.e. divisible by 2

// ).

// It is guaranteed that the sum of n
// over all test cases does not exceed 2⋅105 (∑n≤2⋅105

// ).
// Output

// For each test case, print the answer — "NO" (without quotes), if there is no suitable answer for the given test case or "YES" in the first line and any suitable array a1,a2,…,an
// (1≤ai≤109) satisfying conditions from the problem statement on the second line.

var bufStdin = bufio.NewReader(os.Stdin)
var bufStdout = bufio.NewWriter(os.Stdout)

func main() {
	defer bufStdout.Flush()

	var t int
	_, _ = fmt.Fscan(bufStdin, &t)

	tests := make([]int, t)
	for i := 0; i < t; i++ {
		_, _ = fmt.Fscan(bufStdin, &tests[i])
	}

	for i := 0; i < t; i++ {
		doTestCase(tests[i])
	}
}

func doTestCase(n int) {
	if (n/2)%2 == 1 {
		_, _ = fmt.Fprintln(bufStdout, "NO")
		return
	}

	_, _ = fmt.Fprintln(bufStdout, "YES")

	for i := 0; i < n/2; i++ {
		_, _ = fmt.Fprint(bufStdout, (i+1)*2, " ")
	}

	for i := 0; i < n/2-1; i++ {
		_, _ = fmt.Fprint(bufStdout, i*2+1, " ")
	}
	_, _ = fmt.Fprint(bufStdout, (n/2+1)*2+1)

	_, _ = fmt.Fprintln(bufStdout)
}

package main

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

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	NextInt() int
	NextInt64() int64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	// adjust the following size as needed
	// 2 << 17 is good enough to scan strings of len 2*10^5
	// it could go as high as 2 << 26 before cf judge breaks
	size := 2 << 20
	buf := make([]byte, size)
	s.Buffer(buf, size)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt() int {
	impl.Scan()
	bb := impl.Bytes()
	i := 0
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

func main() {
	defer writer.Flush()
	t := reader.NextInt64()
	for ; t > 0; t-- {
		res := sol(reader.NextInt64())
		if res == nil {
			writer.Printf("NO\n")
		} else {
			writer.Printf("YES\n")
			for _, d := range res {
				writer.Printf("%d ", d)
			}
			writer.Printf("\n")
		}
	}
}

func sol(n int64) []int64 {
	if (n/2)&1 == 1 {
		return nil
	}
	ret := make([]int64, n)
	curr := int64(2)
	for i := int64(0); i < n/2; i++ {
		if i < n/4 {
			ret[i] = curr - 1
		} else {
			ret[i] = curr + 1
		}
		curr += 2
	}
	curr = int64(2)
	for i := n/2; i < n; i++ {
		ret[i] = curr
		curr += 2
	}
	return ret
}

package main

import (
	"fmt"
)

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

	for i := 0; i < t; i++ {
		var n int
		fmt.Scan(&n)

		if n/2%2 == 1 {
			fmt.Println("NO")
			continue
		}

		a := make([]int, n/2)
		b := make([]int, n/2)

		for j := 1; j <= n/2; j++ {
			a[j-1] = 2*j - 1
			b[j-1] = 2 * j
		}

		a[n/2-1] += n / 2

		fmt.Println("YES")
		for j := 0; j < n/2; j++ {
			fmt.Printf("%d ", a[j])
		}

		for j := 0; j < n/2; j++ {
			if j == n/2-1 {
				fmt.Printf("%d", b[j])
				continue
			}
			fmt.Printf("%d ", b[j])
		}
		fmt.Println()
	}
}


package main

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

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

func solve(n int, a []int) int {
	var (
		sum, avg, cl int
	)
	for i := 0; i < n; i++ {
		sum += a[i]
	}
	if sum%n > 0 {
		return -1
	}
	avg = sum / n
	for i := 0; i < n; i++ {
		if a[i] > avg {
			cl++
		}
	}
	return cl
}

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(
    "fmt"
    "bufio"
    "os"
)
func main() {
	var t int
	var in = bufio.NewReader(os.Stdin)
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n,sum int
		fmt.Fscan(in,&n)
		var list []int = make([]int,n)
		for j:=0;j<n;j++{
			fmt.Fscan(in,&list[j])
			sum+=list[j]
		}
		if n == 1 {
			fmt.Println(0)
		} else if sum%n != 0 {
			fmt.Println(-1)
		} else {
			count:=0
			for j:=0;j<n;j++{
				if list[j] > sum/n {
					count++
				}
			}
			fmt.Println(count)
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"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 Solve(in []int) int {
	var sum, res int

	for _, v := range in {
		sum += v
	}

	if sum%len(in) != 0 {
		return -1
	}

	for _, v := range in {
		if v > sum/len(in) {
			res++
		}
	}

	return res
}

func SolveSlow(in []int) int {
	var sumMax int

	if len(in) == 1 {
		return 0
	}

	sort.Slice(in, func(a, b int) bool {
		return in[b] < in[a]
	})

	if in[0] == in[len(in)-1] {
		return 0
	}

	for k := 0; k < len(in)-1; k++ {
		sumMax += in[k]

		var diff int
		var rem int

		for j := k + 1; j < len(in); j++ {
			diff += in[k+1] - in[j]
		}

		rem = sumMax - diff - in[k+1]*(k+1)

		if rem < 0 {
			continue
		}

		if rem%len(in) == 0 {
			return k + 1
		}
	}

	return -1
}

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

	for i := 0; i < n; i++ {
		_ = readInt(in)

		input := readArrInt(in)

		res := Solve(input)
		fmt.Printf("%d\n", res)
	}
}

package main

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

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
var a [200010]int

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Scan(&t)
	for i := 0; i < t; i ++ {
		solve := func() {
			var n, sum int
			fmt.Fscan(in, &n)
			for i := 0; i < n; i++ {
				fmt.Fscan(in, &a[i])
				sum += a[i]
			}
			if sum%n != 0 {
				fmt.Fprintln(out, -1)
			} else {
				sum /= n
				ans := 0
				for i := 0; i < n; i++ {
					if a[i] > sum {
						ans++
					}
				}
				fmt.Fprintln(out, ans)
			}
		}
		solve()
	}
}

package main

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

const Mod = 1000000007

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

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

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

	for tc := 1; tc <= t; tc++ {
		solveTest(tc)
	}

	out.Flush()
}

func solveTest(tc int) {
	var n int
	fmt.Fscan(in, &n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &a[i])
	}

	sum := 0
	for i := 0; i < n; i++ {
		sum += a[i]
	}
	if sum%n != 0 {
		fmt.Fprintln(out, -1)
		return
	}
	sum /= n

	ans := 0
	for i := 0; i < n; i++ {
		if a[i] > sum {
			ans += 1
		}
	}
	fmt.Fprintln(out, ans)
}

func min(xs ...int) int {
	result := xs[0]
	for i := 1; i < len(xs); i++ {
		if result > xs[i] {
			result = xs[i]
		}
	}
	return result
}

func max(xs ...int) int {
	result := xs[0]
	for i := 1; i < len(xs); i++ {
		if result < xs[i] {
			result = xs[i]
		}
	}
	return result
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"io/ioutil"
	"os"
	"sort"
	"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(Case int) {
		var n int
		Fscan(in, &n)
		a := make([]int, n)
		for i := range a {
			Fscan(in, &a[i])
		}
		sort.Ints(a)
		sum := 0
		for _, v := range a {
			sum += v
		}
		if sum % n > 0 {
			Fprintln(out, -1)
			return
		}
		c:=0
		for _, v := range a {
			if v > sum/n {
			c++
			}
		}
		Fprintln(out, c)
	}

	T := 1
	Fscan(in, &T) //
	for Case := 1; Case <= T; Case++ {
		solve(Case)
	}

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

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

package main

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

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

	for test := parseInt(getString(reader)); test > 0; test-- {
		n := parseInt(getString(reader))
		A := getIntln(reader)
		var sum, res int
		for _, v := range A {
			sum += v
		}
		if sum%n != 0 {
			res = -1
		} else {
			mean := sum / n
			for _, v := range A {
				if v > mean {
					res++
				}
			}
		}
		writer.WriteString(fmt.Sprintln(res))
	}
	writer.Flush()
}

func getString(in *bufio.Reader) string {
	res, _ := in.ReadString('\n')
	res = strings.ReplaceAll(res, "\n", "")
	res = strings.ReplaceAll(res, "\r", "")
	res = strings.TrimSpace(res)
	return res
}

func parseInt(str string) int {
	var res int
	size := len(str)
	for i := 0; i < size; i++ {
		digit := int(str[i] - '0')
		for j := (i + 1); j < size; j++ {
			digit = digit<<3 + digit<<1
		}
		res += digit
	}
	return res
}

func getIntln(in *bufio.Reader) []int {
	b := strings.Split(getString(in), " ")
	res := make([]int, len(b))
	for k, v := range b {
		res[k] = parseInt(v)
	}
	return res
}

package main

import (
	"bufio"
	"fmt"
	"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)
		o, p, sum := []int{}, 0, 0
		for j := 0; j < n; j++ {
			fmt.Fscan(f, &p)
			o = append(o, p)
			sum += p
		}
		if sum%n == 0 {
			quota, tot := sum/n, 0
			for j := 0; j < n; j++ {
				if o[j] > quota {
					tot++
				}
			}
			fmt.Fprintln(w, tot)
		} else {
			fmt.Fprintln(w, "-1")
		}
	}
	w.Flush()
}

func main() {
	solve()
}

package main

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

func run(r io.Reader, w io.Writer) {
	in := bufio.NewReader(r)
	out := bufio.NewWriter(w)
	defer out.Flush()

	type pair struct {
		x, y int
	}
	var t int
	for Fscan(in, &t); t > 0; t-- {
		var n int
		Fscan(in, &n)
		a := make([]int, n)

		sum := 0
		for i := range a {
			Fscan(in, &a[i])
			sum += a[i]
		}

		if sum % n != 0 {
			Fprintln(out, -1)
			continue
		}

		avg, ans := sum / n, 0
		for _, val := range a {
			if avg < val {
				ans++
			}
		}
		Fprintln(out, ans)
	}
}

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

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

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

package main

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

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

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

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

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

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

/**
 Run solve the problem CF1538B
 Date: 21/08/21
 User: pepradere
 URL: https://codeforces.com/problemset/problem/1538/B
 Problem: CF1538B
**/
func (in *CF1538B) Run() {
	N := in.NextInt()
	for ; N > 0; N-- {
		t := in.NextInt()
		arr := []int{}
		sum := 0
		for i:=0;i<t;i++{
			num := in.NextInt()
			arr = append(arr, num)
			sum += num
		}
		ans := -1
		values := sum / t
		if values * t == sum {
			k := 0
			for i:=0;i<t;i++{
				if arr[i] > values {
					k++
				}
			}
			ans = k
		}
		fmt.Println(ans)
	}
}

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

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

package main

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

func sum(arr []int32) int32 {
	output := int32(0)
	for _, value := range arr {
		output += value
	}
	return output
}

func solve(n int32, arr []int32) int32 {
	total := sum(arr)
	if total%n != 0 {
		return -1
	}
	avg := total / n
	output := int32(0)
	for _, value := range arr {
		if value > avg {
			output++
		}
	}
	return output
}

func arrayScanf(in *bufio.Reader, n int32, arr *[]int32) {
	m := int32(0)
	for i := int32(0); i < n; i++ {
		if i > 0 {
			fmt.Fscanf(in, " ")
		}
		fmt.Fscanf(in, "%d", &m)
		*arr = append(*arr, m)
	}
	fmt.Fscanf(in, "\n")
}

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

	tt := int32(0)
	fmt.Fscanf(in, "%d\n", &tt)
	for tt > 0 {
		n := int32(0)
		arr := []int32{}
		fmt.Fscanf(in, "%d\n", &n)
		arrayScanf(in, n, &arr)
		fmt.Fprintf(out, "%d\n", solve(n, arr))
		tt--
	}
	out.Flush()
}

package main

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

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

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

	var n, num int
	for ; t > 0; t-- {
		fmt.Fscan(reader, &n)
		sum := 0
		arr := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &num)
			arr[i] = num
			sum += num
		}
		if sum%n > 0 {
			fmt.Fprintln(writer, -1)
			continue
		}
		k := 0
		target := sum / n
		for _, num := range arr {
			if num > target {
				k++
			}
		}
		fmt.Fprintln(writer, k)
	}
}

package main

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

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...) }

type Array []int

func main() {
    defer writer.Flush()
    var T int
    scanf("%d\n", &T)
    for cas := 1; cas <= T; cas++ {
        var N int
        scanf("%d\n", &N)
        // var arr [N]int
        arr := make(Array, N)
        ans := 0
        for i := 0; i < N; i++ {
            scanf("%d", &arr[i])
            ans += arr[i]
        }
        scanf("\n")
        if ans % N > 0 {
            printf("-1\n")
        } else {
            sort.Ints(arr)
            res := arr.upper_bound(N, ans / N)
            printf("%d\n", N - res)
        }
    }
    return
}

func (i Array) upper_bound(sz int, key int) int {
    lo := 0
    hi := sz

    for lo < hi {
        mid := (lo + hi) / 2
        if i[mid] <= key {
            lo = mid + 1
        } else {
            hi = mid
        }
    }
    return lo
}

package main

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

func Readln(r *bufio.Reader) (string, error) {
	var (
		isPrefix bool  = true
		err      error = nil
		line, ln []byte
	)
	for isPrefix && err == nil {
		line, isPrefix, err = r.ReadLine()
		ln = append(ln, line...)
	}
	return string(ln), err
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	pk, _ := Readln(reader)
	k, _ := strconv.Atoi(pk)
	for oi := 0; oi < k; oi++ {
		Readln(reader)
		line,_  := Readln(reader)
		pln := strings.Split(line, " ")
		ln := make([] int, len(pln))
		tot := 0
		for i:= range ln {
			ln[i],_ = strconv.Atoi(pln[i])
			tot += ln[i]
		}

		if tot % len(pln) != 0 {
			fmt.Println("-1")
			continue
		}
		avg:= tot/len(pln)
		res := 0
		for _, v:= range ln {
			if v>avg {
				res++
			}
		}
		fmt.Println(res)

	}

}

package main

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

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

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

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

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

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

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

func 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 {
	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
}

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([]int64, n)
		var Sum int64
		for i := 0; i < n; i++ {
			fmt.Fscan(input, &ARRAY[i])
			Sum = Sum + ARRAY[i]

		}

		m := Sum % int64(n)
		if m != 0 {
			fmt.Println(-1)
		} else {
			q := int64(Sum / int64(n))
			aount := 0
			for i := 0; i < n; i++ {
				if ARRAY[i] > q {
					aount++
				}
			}
			fmt.Println(aount)
		}
	}

}

package main

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

const (
	MOD int = int(1e9 + 7)
)

type Int int64

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

	var t, n int
	fmt.Fscan(_r, &t)

	for tc := 0; tc < t; tc++ {
		fmt.Fscan(_r, &n)
		a := make([]int, n)
		sum := 0
		for i := 0; i < n; i++ {
			fmt.Fscan(_r, &a[i])
			sum += a[i]
		}
		if sum%n != 0 {
			fmt.Fprintf(_w, "-1\n")
			continue
		}
		sum /= n
		sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })
		ans := 0
		for i := n - 1; i >= 0; i-- {
			if a[i] > sum {
				ans++
			} else {
				break
			}
		}

		fmt.Fprintf(_w, "%d\n", ans)
	}
}

package main

import (
	"bufio"
	"fmt"
	"io/ioutil"
	"log"
	"os"
)

func init() {
	log.SetFlags(0)
	log.SetOutput(ioutil.Discard)

}
func sum(arr []int) int {
	sum := 0
	for _, v := range arr {
		sum += v
	}
	return sum
}

func solve(arr []int) int {
	log.Printf("arr = %+v\n", arr)
	log.Printf("sum(arr)/len(arr) = %+v\n", sum(arr)/len(arr))
	mid := sum(arr) / len(arr)
	// log.Printf("float(sum(arr)) = %+v\n", float32(sum(arr))/float32(len(arr)))
	if float32(sum(arr))/float32(len(arr))-float32(sum(arr)/len(arr)) > 0 {
		return -1
	}

	count := 0
	for _, v := range arr {
		if v > mid {
			count++
		}
	}

	return count
}

func main() {
	log.Println("start")

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

	num := 0
	fmt.Fscan(in, &num)
	for i := 0; i < num; i++ {
		size := 0
		fmt.Fscan(in, &size)
		arr := []int{}
		for i := 0; i < size; i++ {
			val := 0
			fmt.Fscan(in, &val)
			arr = append(arr, val)
		}
		fmt.Fprintf(out, "%d\n", solve(arr))

	}
	log.Println("__end__")
}

package main

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

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

func calc(arr []int, x int) int {
	cnt := 0
	for _, val := range arr {
		if val > x {
			cnt++
		}
	}
	return cnt
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		var n int
		fmt.Fscan(in, &n)
		arr := make([]int, n)
		sum := 0
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &arr[i])
			sum += arr[i]
		}
		ans := n + 1
		if sum % n == 0 {
			ans = min(ans, calc(arr, sum / n))
		}
		if ans == n + 1 {
			ans = -1
		}
		fmt.Fprintln(out, ans)
		t--
	}
	out.Flush()

}

package main

import (
	"bufio"
	"os"

	"fmt"
	"sort"
)

func main() {

	r := bufio.NewReader(os.Stdin)

	var t int

	fmt.Fscan(r, &t)

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

		a := make([]int, n)

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

		fmt.Println(solve(a, n))
	}
}

func solve(a []int, n int) int {

	var s int64

	for i := 0; i < n; i++ {
		s += int64(a[i])
	}

	if s % int64(n) != 0 {
		return -1
	}

	each := s/int64(n)

	sort.Ints(a)

	var k int

	for i := n - 1; i >= 0; i-- {
		if int64(a[i]) > each {
			k++
			continue
		}
		break
	}

	return k
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	solve := func(Case int) {
		var n int
		fmt.Fscan(in, &n)
		a := make([]int, n)
		sm := 0
		for i := range a {
			fmt.Fscan(in, &a[i])
			sm += a[i]
		}
		if sm%n != 0 {
			fmt.Fprintln(out, -1)
			return
		}
		div := int(sm / n)
		ans := 0
		for i := range a {
			if a[i] > div {
				ans++
			}
		}
		fmt.Fprintln(out, ans)

	}

	T := 1
	fmt.Fscan(in, &T) //
	for Case := 1; Case <= T; Case++ {
		solve(Case)
	}
}

func max(x, y int64) int64 {
	if x < y {
		return y
	}
	return x
}

func min(a []int) int {
	mn := int(1e9)
	for i := range a {
		if a[i] < mn {
			mn = a[i]
		}
	}
	return mn
}
func gcd(x, y int) int {
	for y != 0 {
		x, y = y, x%y
	}
	return x
}

func reverse(s []byte) []byte {
	a := []byte(s)
	for i, j := 0, len(a)-1; i < j; i, j = i+1, j-1 {
		a[i], a[j] = a[j], a[i]
	}
	return a
}

package main

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

func testcase(reader *bufio.Reader, writer *bufio.Writer) {
  var n int
  fmt.Fscan(reader, &n)

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

  if sum % n != 0 {
    fmt.Fprintln(writer, -1)
  } else {
    total := 0

    for _, v := range a {
      if (v > sum/n) {
        total++
      }
    }

    fmt.Fprintln(writer, total)
  }
}

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

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

  for i := 0; i < t; i++ {
    testcase(reader, writer)
  }
}

package main

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

var reader *bufio.Reader
var writer *bufio.Writer

func testcase() {
  var n int
  fmt.Fscan(reader, &n)

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

  if sum % n != 0 {
    fmt.Fprintln(writer, -1)
  } else {
    total := 0

    for _, v := range a {
      if (v > sum/n) {
        total++
      }
    }

    fmt.Fprintln(writer, total)
  }
}

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

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

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


package main

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

var DEBUG = false
var reader *bufio.Reader
var writer *bufio.Writer
var times [101]int
var n, M, val int

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

func Scanf(format string, a ...interface{}) {
	fmt.Fscanf(reader, format, a...)
}

func calc(x int) int {
	total, passes := x, 1
	for i := 1; i <= 100; i++ {
		if times[i]*i+total <= M {
			passes += times[i]
			total += times[i] * i
		} else {
			passes += (M - total) / i
			break
		}
	}
	return passes
}

func main() {
	if DEBUG {
		f, _ := os.Open("input")
		reader = bufio.NewReader(f)
	} else {
		reader = bufio.NewReader(os.Stdin)
	}
	writer = bufio.NewWriter(os.Stdout)
	Scanf("%d %d\n", &n, &M)
	for i := 1; i <= n; i++ {
		Scanf("%d", &val)
		Printf("%d ", i-calc(val))
		times[val]++
	}
	Printf("\n")
	writer.Flush()
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	n, m := 0, 0
	fmt.Fscanf(in, "%d %d\n", &n, &m)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(in, "%d", &a[i])
	}
	cnt := make([]int, 101)
	sum := 0
	for i := 0; i < n; i++ {
		ans := 0
		sum += a[i]
		tmp := sum
		//fmt.Println("begin", i)
		for j := 100; j >= 1; j-- {
			if tmp <= m {
				break
			}
			if cnt[j] == 0 {
				continue
			}
			//fmt.Println(j, cnt[j], tmp)
			need := (tmp - m) / j
			if (tmp-m)%j != 0 {
				need++
			}
			if need <= cnt[j] {
				ans += need
				tmp -= need * j
			} else {
				ans += cnt[j]
				tmp -= cnt[j] * j
			}
		}
		cnt[a[i]]++
		if i != 0 {
			fmt.Fprintf(out, " ")
		}
		fmt.Fprintf(out, "%d", ans)
	}
	fmt.Fprintf(out, "\n")
	return
}

func gcd(a, b uint64) uint64 {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

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

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

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

func ok(a, b int) bool {
	if min(abs(a-b), abs(a+b)) <= min(abs(a), abs(b)) && max(abs(a+b), abs(a-b)) >= max(abs(a), abs(b)) {
		return true
	}
	return false
}


package main

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

// github.com/EndlessCheng/codeforces-go
func CF903E(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	var n, m int
	Fscan(in, &n, &m)
	a := make([][]byte, n)
	cnt := make([][26]int, n)
	has2 := make([]bool, n)
	for i := range a {
		Fscan(in, &a[i])
		for _, b := range a[i] {
			if cnt[i][b-'a']++; cnt[i][b-'a'] > 1 {
				has2[i] = true
			}
		}
		if cnt[i] != cnt[0] {
			Fprint(out, -1)
			return
		}
	}

	s0 := a[0]
	dis := make([]int, n)
	for i, s := range a {
		for j, b := range s {
			if b != s0[j] {
				dis[i]++
			}
		}
	}
	for l := 0; l < m; l++ {
	o:
		for r := l + 1; r < m; r++ {
			for i := 1; i < n; i++ {
				s, d := a[i], dis[i]
				if s[l] != s0[r] {
					d++
				}
				if s[r] != s0[l] {
					d++
				}
				if s[l] != s0[l] {
					d--
				}
				if s[r] != s0[r] {
					d--
				}
				if d > 2 || d == 0 && !has2[i] {
					continue o
				}
			}
			s0[l], s0[r] = s0[r], s0[l]
			Fprint(out, string(s0))
			return
		}
	}
	Fprint(out, -1)
}

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

package main

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

// github.com/EndlessCheng/codeforces-go
func main() {
	in := bufio.NewReader(os.Stdin)
	var n, m int
	Fscan(in, &n, &m)
	a := make([][]byte, n)
	cnt := make([][26]int, n)
	has2 := make([]bool, n)
	for i := range a {
		Fscan(in, &a[i])
		for _, b := range a[i] {
			if cnt[i][b-'a']++; cnt[i][b-'a'] > 1 {
				has2[i] = true
			}
		}
		if cnt[i] != cnt[0] {
			Print(-1)
			return
		}
	}

	s0 := a[0]
	dis := make([]int, n)
	for i, s := range a {
		for j, b := range s {
			if b != s0[j] {
				dis[i]++
			}
		}
	}
	for l := 0; l < m; l++ {
	o:
		for r := l + 1; r < m; r++ {
			for i := 1; i < n; i++ {
				s, d := a[i], dis[i]
				if s[l] != s0[r] {
					d++
				}
				if s[r] != s0[l] {
					d++
				}
				if s[l] != s0[l] {
					d--
				}
				if s[r] != s0[r] {
					d--
				}
				if d > 2 || d == 0 && !has2[i] {
					continue o
				}
			}
			s0[l], s0[r] = s0[r], s0[l]
			Print(string(s0))
			return
		}
	}
	Print(-1)
}


package main

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

func main() {
	var n, rs int
	var tmp, min float64
	min = math.MaxFloat64
	reader := bufio.NewReader(os.Stdin)

	fmt.Fscan(reader, &n)

	for i := 0; i < n; i++ {
		fmt.Fscan(reader, &tmp)
		tmp = math.Ceil((tmp - float64(i)) / float64(n))

		if tmp <= 0 {
			min = tmp
			rs = i + 1
			break
		}

		if tmp < min {
			min = tmp
			rs = i + 1
		}
	}

	fmt.Println(rs)
}

package main

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

func main() {
	var door int
	var people string
	_, err := fmt.Scanf("%d\n", &door)
	if err != nil {
		log.Fatal(err)
	}
	in := bufio.NewReader(os.Stdin)
	people, err = in.ReadString('\n')
	if err != nil {
		log.Fatal(err)
	}
	people = strings.TrimRight(people, "\n\r")
	people2 := strings.Split(people, " ")
	people3 := make([]int, len(people2))
	for i, p := range people2 {
		people3[i], err = strconv.Atoi(p)
		if err != nil {
			log.Fatal(err)
		}
	}
	var min int
	for i, e := range people3 {
		if i==0 || e < min {
			min = e
		}
	}
	for i := min; ; i++ {
		if people3[i%door] - i <= 0 {
			fmt.Println(i%door+1)
			break
		}
	}
	//flag := people3[0]
	//var res int
	//for i, p := range people3 {
	//	if flag < (p - i) {
	//		flag = p
	//		res = i
	//	}
	//}
	//fmt.Println(res+1)
}

package main

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

const MaxN = 200005

var n int
var a [MaxN]int

func main() {
	stdin := bufio.NewReader(os.Stdin)
	fmt.Fscanf(stdin, "%d\n", &n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(stdin, "%d ", &a[i])
	}

	minVal := 1000000001.0
	index := 1
	for i := 0; i < n; i++ {
		k := float64(i) + math.Ceil(math.Max(float64(a[i] - i), 0.0) / float64(n)) * float64(n)
		if k < minVal {
			index = i + 1
			minVal = k
		}
	}
	fmt.Printf("%d\n", index)
}

package main

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

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

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

	in.Split(bufio.ScanWords)
	defer out.Flush()

	in.Scan();
	n, _ := strconv.ParseInt(in.Text(), 10, 64);

	var res int64;
	var temp int64 = math.MaxInt64;

	for i:=int64(1); i<=n; i++ {
		in.Scan();
		a, _ := strconv.ParseInt(in.Text(), 10, 64);
		if (temp > (a-i+n)/n) {
			temp = (a-i+n)/n;
			res = i;
		}
	}

	out.WriteString(strconv.FormatInt(res, 10));
}

package main

import "fmt"
import "strconv"
import "os"
import "bufio"
import "strings"

func CheckArray(wait []int,lens int) int {
	e :=0
	m :=0
	min := 0
	for i,val := range wait  {
		if i == 0 || val < min {
			min = val
		}
	}
	e = min
	m = min - (min/lens)*lens
	for {
		if m == lens {
			m = 0
		}
		if e >= wait[m] {
			return m+1
		}
		 e ++
		 m++
	}
}

func main() {
	var entrance int
	reader := bufio.NewReader(os.Stdin)
	text, _ := reader.ReadString('\n')
	text = strings.TrimRight(text, "\r\n")
	entrance, _ = strconv.Atoi(text)
	text, _ = reader.ReadString('\n')
	text = strings.TrimRight(text, "\r\n")
	lo1 := strings.Split(text, " ")
	lines := []int{}
	for _, i := range lo1 {
		k, _ := strconv.Atoi(i)
		lines = append(lines, k)
	}
	fmt.Println(CheckArray(lines,entrance))
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var num int64
	var result int64
	fmt.Fscan(reader, &num)
	arrQueues := make([]int64, num)
	arrResult := make([]int64, num)
	var k float64
	var i int64
	var min int64
	for i = 0; i < num; i++ {
		fmt.Fscan(reader, &arrQueues[i])
		k = math.Ceil(float64(arrQueues[i]-i)/float64(num)) + 1
		arrResult[i] = int64(k)
		if arrResult[i] < min || i == 0 {
			min = arrResult[i]
			result = i + 1
		}
	}
	fmt.Println(result)

}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var num int64
	var result int64
	fmt.Fscan(reader, &num)
	listQueues := make([]int64, num)
	listResult := make([]int64, num)
	var k float64
	var i int64
	var min int64
	for i = 0; i < num; i++ {
		fmt.Fscan(reader, &listQueues[i])
		k = math.Ceil(float64(listQueues[i]-i)/float64(num)) + 1
		listResult[i] = int64(k)
		if listResult[i] < min || i == 0 {
			min = listResult[i]
			result = i + 1
		}
	}
	fmt.Println(result)

}

package main

import (
	"fmt"
	"sort"
)

func binarySearch(arr []int, l int, r int, x int) int {
	result :=0
	if arr[0] > x {
		return 0
	}
	if arr[len(arr)-1] < x || arr[len(arr)-1] == x {
		return len(arr)
	}

	for l <= r {
		mid := l + (r-l)/2
		if arr[mid] == x || arr[mid] < x {
			result = mid+1
			l = mid + 1
		} else {
			r = mid - 1
		}
	}
	return result

}

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

	priceOfShop := make([]int, numOfShop)

	for i := 0; i < numOfShop; i++ {
		fmt.Scan(&priceOfShop[i])
	}
	sort.Ints(priceOfShop)
	var numOfDay int
	fmt.Scan(&numOfDay)
	var coins int
	for i := 0; i < numOfDay; i++ {
		fmt.Scan(&coins)
		result := binarySearch(priceOfShop, 0, numOfShop-1, coins)
		fmt.Println(result)
	}

}

package main

import (
	"fmt"
	"sort"
)

func binarySearch(arr []int, l int, r int, x int) int {
	if arr[0] > x {
		return 0
	}
	if arr[len(arr)-1] < x || arr[len(arr)-1] == x {
		return len(arr)
	}

	for l <= r {
		mid := l + (r-l)/2
		if (arr[mid] == x && arr[mid+1] > x) || (arr[mid] < x && arr[mid+1] > x){
			return mid + 1
		}
		if arr[mid] > x && arr[mid-1] < x {
			return mid
		}
		if arr[mid] > x {
			r = mid - 1
		} else {
			l = mid + 1
		}

	}
	return 0

}

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

	priceOfShop := make([]int, numOfShop)

	for i := 0; i < numOfShop; i++ {
		fmt.Scan(&priceOfShop[i])
	}
	sort.Ints(priceOfShop)
	var numOfDay int
	fmt.Scan(&numOfDay)
	var coins int
	for i := 0; i < numOfDay; i++ {
		fmt.Scan(&coins)
		result := binarySearch(priceOfShop, 0, numOfShop-1, coins)
		fmt.Println(result)
	}

}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var door int
	var line []int
	var min int
	fmt.Scan(&door)
	line = make([]int, door)
	for i := 0; i < door; i++ {
		fmt.Scan(&line[i])
		//if line[i] < min || i == 0 {
		//	min = line[i]
		//}

	}
	sort.Ints(line[:])
	min = line[0]
	for i := min; ; i++ {
		if line[i%door]-i <= 0 {
			fmt.Println(i%door + 1)
			break
		}
	}
}


package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	n := 0
	fmt.Fscanf(in, "%d\n", &n)
	for i := 0; i < n; i++ {
		l, r := 0, 0
		fmt.Fscanf(in, "%d %d\n", &l, &r)
		fmt.Fprintf(out, "%d %d\n", l, l*2)
	}
	return
}

package main

import "fmt"

func main() {
	var n, l, r int
	fmt.Scanln(&n)
	for i := 0; i < n; i++ {
		fmt.Scanln(&l, &r)
		fmt.Println(l, l*2)
	}

}

package main

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

func main(){
	buf := bufio.NewReader(os.Stdin)
	var l,r,t int
	fmt.Fscanf(buf, "%d\n", &t)
	for i:= 1;i <= t;i++{
		fmt.Fscanf(buf, "%d %d\n", &l,&r)

		fmt.Printf("%d %d\n",l,2*l)
	}

}

package main

import "fmt"

func main() {
	var T int
	var l, r int64
	fmt.Scanln(&T)
	for i := 0; i < T; i++ {
		fmt.Scanf("%d %d\n", &l, &r)
		fmt.Printf("%d %d\n", l, l*2)
	}
}

package main
import "fmt"
func main() {
	var t, a, b int
	fmt.Scan(&t)
	for i := 0; i < t; i++ {
		fmt.Scan(&a,&b)
		fmt.Println(a,a*2)
	}
}

package main

import(
	"fmt"
)

func main() {

	var n int

	fmt.Scan(&n)

	for ;n > 0; n-- {
		var l,r int
		fmt.Scan(&l, &r)

		fmt.Println(l, 2*l)
	}

}

package main

import "fmt"

func main() {
    T := 0
    fmt.Scanf("%d\n", &T)

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

        fmt.Printf("%d %d\n", l, l * 2)
    }
}

// Package main provides
//
// File:  a.go
// Author: ymiyamoto
//
// Created on Fri Dec 28 23:38:20 2018
//
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	for i := 0; i < N; i++ {
		var l, r int
		fmt.Scan(&l, &r)
		fmt.Println(l, 2*l)
	}
}

package main

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

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	stdin.Scan()
	n, _ := strconv.Atoi(stdin.Text())
	for i := 0; i < n; i++ {
		stdin.Scan()
		fields := strings.Fields(stdin.Text())
		input, _ := strconv.Atoi(fields[0])
		fmt.Println(input, input*2)
	}
}

// Package main provides
//
// File:  a.go
// Author: ymiyamoto
//
// Created on Fri Dec 28 23:38:20 2018
//
package main

import "fmt"

func main() {
	var l, r int
	fmt.Scan(&l, &r)
	fmt.Println(l, 2*l)
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	s := ""
	fmt.Fscanf(in, "%s\n", &s)
	fmt.Fprintf(out, "%s\n", recover(s))
	return
}

func recover(s string) string {
	if len(s) == 1 {
		return s
	}
	if len(s)%2 == 0 {
		return recover(s[:len(s)-1]) + string(s[len(s)-1])
	} else {
		return recover(s[1:]) + string(s[0])
	}
}

package main

import "fmt"

func main() {
	var T int
	var l, r int64
	fmt.Scan(&T)
	for i := 0; i < T; i++ {
		fmt.Scanf("%d %d\n", &l, &r)
		fmt.Printf("%d %d\n", l, l*2)
	}
}

package main

import "fmt"

func main() {
    T := 0
    fmt.Scanf("%d\n", &T)

    for i := 0; i < T; i++ {
        l := 0
        r := 0
        fmt.Scanf("%d %d", &l, &r)

        fmt.Printf("%d %d\n", l, l * 2)
    }
}

package main

import "fmt"

func main() {
    T := 0
    fmt.Scanf("%d", &T)

    for i := 0; i < T; i++ {
        l := 0
        r := 0
        fmt.Scanf("%d%d", &l, &r)

        fmt.Printf("%d %d\n", l, l * 2)
    }
}

package main

import "fmt"

func main() {
    T := 0
    fmt.Scanf("%d", &T)

    for i := 0; i < T; i++ {
        l := 0
        r := 0
        fmt.Scanf("%d %d", &l, &r)

        fmt.Printf("%d %d\n", l, l * 2)
    }
}


package main

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

var segNoOverlap [100000]int
var segLeftOverlap [100000]int
var segRightOverlap [100000]int

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

func insert(seg *[100000]int, index, l, r, pos, value int) {
	if l == pos && r == pos {
		seg[index] = value
		return
	}
	mid := (l + r) / 2
	if pos <= mid {
		insert(seg, index*2+1, l, mid, pos, value)
	} else {
		insert(seg, index*2+2, mid+1, r, pos, value)
	}
	seg[index] = max(seg[index*2+1], seg[index*2+2])
}

func query(seg *[100000]int, index, l, r, left, right int) int {
	if l == left && r == right {
		return seg[index]
	}
	mid := (l + r) / 2
	if right <= mid {
		return query(seg, index*2+1, l, mid, left, right)
	} else if left > mid {
		return query(seg, index*2+2, mid+1, r, left, right)
	} else {
		return max(query(seg, index*2+1, l, mid, left, mid), query(seg, index*2+2, mid+1, r, mid+1, right))
	}
}

func main() {
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewReader(bs)
	var n, m, k int
	fmt.Fscanf(reader, "%d %d %d\n", &n, &m, &k)
	prefixSum := make([][]int, n+1)
	for i := 0; i < n; i++ {
		prefixSum[i] = make([]int, m+1)
		for j := 1; j < m; j++ {
			fmt.Fscanf(reader, "%d ", &prefixSum[i][j])
			prefixSum[i][j] += prefixSum[i][j-1]
		}
		fmt.Fscanf(reader, "%d\n", &prefixSum[i][m])
		prefixSum[i][m] += prefixSum[i][m-1]
	}
	prefixSum[n] = make([]int, m+1)
	for i := 1; i <= m-k+1; i++ {
		sum := prefixSum[0][i+k-1] - prefixSum[0][i-1]
		insert(&segNoOverlap, 0, 1, m-k+1, i, sum+prefixSum[1][i+k-1]-prefixSum[1][i-1])
		insert(&segLeftOverlap, 0, 1, m-k+1, i, sum-prefixSum[1][i-1])
		insert(&segRightOverlap, 0, 1, m-k+1, i, sum+prefixSum[1][i+k-1])
	}
	dp := make([]int, m-k+2)
	for i := 1; i < n; i++ {
		for j := 1; j <= m-k+1; j++ {
			ans := -99999999
			if j > k {
				ans = max(ans, prefixSum[i][j+k-1]-prefixSum[i][j-1]+query(&segNoOverlap, 0, 1, m-k+1, 1, j-k))
			}
			if j+2*k-1 <= m {
				ans = max(ans, prefixSum[i][j+k-1]-prefixSum[i][j-1]+query(&segNoOverlap, 0, 1, m-k+1, j+k, m-k+1))
			}
			if j >= k {
				ans = max(ans, prefixSum[i][j+k-1]+query(&segLeftOverlap, 0, 1, m-k+1, j-k+1, j))
			} else {
				ans = max(ans, prefixSum[i][j+k-1]+query(&segLeftOverlap, 0, 1, m-k+1, 1, j))
			}
			if j+2*k-2 <= m {
				ans = max(ans, -prefixSum[i][j-1]+query(&segRightOverlap, 0, 1, m-k+1, j, j+k-1))
			} else {
				ans = max(ans, -prefixSum[i][j-1]+query(&segRightOverlap, 0, 1, m-k+1, j, m-k+1))
			}
			dp[j] = ans
		}
		for j := 1; j <= m-k+1; j++ {
			insert(&segNoOverlap, 0, 1, m-k+1, j, dp[j]+prefixSum[i+1][j+k-1]-prefixSum[i+1][j-1])
			insert(&segLeftOverlap, 0, 1, m-k+1, j, dp[j]-prefixSum[i+1][j-1])
			insert(&segRightOverlap, 0, 1, m-k+1, j, dp[j]+prefixSum[i+1][j+k-1])
		}
	}
	fmt.Printf("%d", segNoOverlap[0])
}

package main

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

var reader io.Reader
var scanner *bufio.Scanner

func Init(io io.Reader, max_token_size int) {
	reader = bufio.NewReader(io)
	scanner = bufio.NewScanner(reader)
	// max token size
	scanner.Split(bufio.ScanWords)
	scanner.Buffer([]byte{}, max_token_size)
}

func stderr(v ...interface{}) {
	fmt.Fprintln(os.Stderr, v...)
}

func die(v ...interface{}) {
	fmt.Fprintln(os.Stderr, v...)
	os.Exit(1)
}

func NextInt() int {
	bytes := NextBytes()
	i, err := Atoi(bytes)
	if err != nil {
		die(err)
	}
	return i
}

func NextBytes() []byte {
	if !scanner.Scan() {
		die(scanner.Err())
	}
	bytes := scanner.Bytes()
	copied := make([]byte, len(bytes))
	copy(copied, bytes)
	return copied
}

func Atoi(b []byte) (int, error) {
	neg := false
	if b[0] == '+' {
		b = b[1:]
	} else if b[0] == '-' {
		neg = true
		b = b[1:]
	}
	n := 0
	for _, v := range b {
		if v < '0' || v > '9' {
			return 0, strconv.ErrSyntax
		}
		n = n*10 + int(v-'0')
	}
	if neg {
		return -n, nil
	}
	return n, nil
}

func ExtendByteArray(a []byte, size int) []byte {
	if size <= len(a) {
		return a
	} else {
		return append(a, make([]byte, size-len(a))...)
	}
}

func ExtendIntArray(a []int, size int) []int {
	if size <= len(a) {
		return a
	} else {
		return append(a, make([]int, size-len(a))...)
	}
}

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

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

type Tree struct {
	a              []int
	propagate      []int
	sz             int
	undefinedValue int
}

func (t *Tree) Upd(v int) {
	if v < t.sz {
		t.a[v] = max(t.a[v<<1], t.a[(v<<1)|1])
	}
}

func (t *Tree) Propagate(v int) {
	prp := t.propagate[v]
	if prp == 0 {
		return
	}
	if v < t.sz {
		t.propagate[v<<1] += prp
		t.propagate[(v<<1)|1] += prp
	}
	t.a[v] += prp
	t.propagate[v] = 0
}

func (t *Tree) GoAdd(v, x, l, r, L, R int) {
	t.Propagate(v)
	if l > r {
		return
	}
	if r < L || l > R {
		return
	}
	if l <= L && R <= r {
		t.propagate[v] += x
		t.Propagate(v)
		return
	}
	t.GoAdd(v<<1, x, l, r, L, (L+R)>>1)
	t.GoAdd((v<<1)|1, x, l, r, (L+R)/2+1, R)
	t.Upd(v)
}

func (t *Tree) GoSet(v, value, k, L, R int) {
	t.Propagate(v)
	if k < L || k > R {
		return
	}
	if L == k && k == R {
		t.a[v] = value
		return
	}
	t.GoSet(v<<1, value, k, L, (L+R)>>1)
	t.GoSet((v<<1)|1, value, k, (L+R)/2+1, R)
	t.Upd(v)
}

func (t *Tree) GoMax(v, l, r, L, R int) int {
	t.Propagate(v)
	if l > r {
		return t.undefinedValue
	}
	if r < L || l > R {
		return t.undefinedValue
	}
	if l <= L && R <= r {
		return t.a[v]
	}
	r1 := t.GoMax(v<<1, l, r, L, (L+R)>>1)
	r2 := t.GoMax((v<<1)|1, l, r, (L+R)/2+1, R)
	t.Upd(v)
	return max(r1, r2)
}

func (t *Tree) Add(l, r int, value int) {
	l = max(l, 0)
	r = min(r, t.sz-1)
	if l > r {
		return
	}
	t.GoAdd(1, value, l, r, 0, t.sz-1)
}

func (t *Tree) Max(l, r int) int {
	if l > r {
		return 0
	}
	res := t.GoMax(1, l, r, 0, t.sz-1)
	if res == t.undefinedValue {
		return 0
	}
	return res
}

func (t *Tree) Set(k, v int) {
	if k < 0 || k >= t.sz {
		return
	}
	t.GoSet(1, v, k, 0, t.sz-1)
}

func (t *Tree) Get(k int) int {
	return t.Max(k, k)
}

func NewTree(n int) *Tree {
	sz := 1
	for sz < n {
		sz <<= 1
	}
	a := make([]int, 2*sz+1)
	propagate := make([]int, 2*sz+1)
	return &Tree{a, propagate, sz, -20000001}
}

func main() {
	inf := os.Stdin
	out := os.Stdout
	// f, err := os.Open("a.in")
	// if err != nil {
	// 	die(err)
	// }
	// out, err := os.Create("a.out")
	// if err != nil {
	// 	die(err)
	// }
	// defer out.Close()
	Init(inf, 1000010)
	n := NextInt()
	m := NextInt()
	k := NextInt()
	a := make([][]int, n)

	for i := 0; i < n; i++ {
		a[i] = make([]int, m)
		for j := 0; j < m; j++ {
			a[i][j] = NextInt()
		}
	}

	var f [2]*Tree
	f[0] = NewTree(m)
	f[1] = NewTree(m)
	total := 0

	for i := 0; i < n; i++ {
		ind := i & 1
		pind := ind ^ 1
		bs := 0
		ns := 0
		r := 0
		if i > 0 {
			for l := 0; l < k; l++ {
				f[pind].Add(l-k+1, l, -a[i][l])
			}
		}

		for l := 0; l < m; l++ {
			if l > 0 {
				bs -= a[i][l-1]
				if i+1 < n {
					ns -= a[i+1][l-1]
				}
			}
			for r < l+k && r < m {
				bs += a[i][r]
				if i+1 < n {
					ns += a[i+1][r]
				}
				r++
			}
			if l-1 >= 0 && i > 0 {
				// stderr("\tadd for left part", l-k, l-1, a[i][l-1])
				f[pind].Add(l-k, l-1, a[i][l-1])
			}
			if l+k-1 < m && l > 0 && i > 0 {
				// stderr("\tadd for right part", l, l+k-1, -a[i][l+k-1])
				f[pind].Add(l, l+k-1, -a[i][l+k-1])
			}

			res := f[pind].Max(0, m-1) + bs

			f[ind].Set(l, res+ns)

			// stderr("res", i, l, "is ", res, "bs", bs, "ns", ns, "k=", k)
			total = max(total, res+ns)
		}
	}
	fmt.Fprintln(out, total)
}


package main

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

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

	var n, v, w, q int
	Fscan(in, &n)
	g := make([][]int, n)
	for i := 1; i < n; i++ {
		Fscan(in, &v, &w)
		v--
		w--
		g[v] = append(g[v], w)
		g[w] = append(g[w], v)
	}

	const mx = 17
	pa := make([][mx]int, n)
	dep := make([]int, n)
	size := make([]int, n)
	var f func(v, p, d int) int
	f = func(v, p, d int) int {
		pa[v][0] = p
		dep[v] = d
		sz := 1
		for _, w := range g[v] {
			if w != p {
				sz += f(w, v, d+1)
			}
		}
		size[v] = sz
		return sz
	}
	f(0, -1, 0)
	for k := 0; k+1 < mx; k++ {
		for v := range pa {
			if p := pa[v][k]; p != -1 {
				pa[v][k+1] = pa[p][k]
			} else {
				pa[v][k+1] = -1
			}
		}
	}
	uptoDep := func(v, d int) int {
		for k := 0; k < mx; k++ {
			if (dep[v]-d)>>k&1 == 1 {
				v = pa[v][k]
			}
		}
		return v
	}
	_lca := func(v, w int) int {
		if dep[v] > dep[w] {
			v, w = w, v
		}
		w = uptoDep(w, dep[v])
		if v == w {
			return v
		}
		for k := mx - 1; k >= 0; k-- {
			if pa[v][k] != pa[w][k] {
				v, w = pa[v][k], pa[w][k]
			}
		}
		return pa[v][0]
	}

	for Fscan(in, &q); q > 0; q-- {
		Fscan(in, &v, &w)
		if v == w {
			Fprintln(out, n)
			continue
		}
		v--
		w--
		if dep[v] > dep[w] {
			v, w = w, v
		}
		lca := _lca(v, w)
		d := dep[v] + dep[w] - dep[lca]<<1
		if d&1 == 1 {
			Fprintln(out, 0)
			continue
		}
		uw := uptoDep(w, dep[w]-d>>1+1)
		if p := pa[uw][0]; p != lca {
			Fprintln(out, size[p]-size[uw])
		} else {
			uv := uptoDep(v, dep[v]-d>>1+1)
			Fprintln(out, n-size[uv]-size[uw])
		}
	}
}

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

package main

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

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

	var n, v, w, q int
	Fscan(in, &n)
	g := make([][]int, n)
	for i := 1; i < n; i++ {
		Fscan(in, &v, &w)
		v--
		w--
		g[v] = append(g[v], w)
		g[w] = append(g[w], v)
	}

	const mx = 18
	pa := make([][mx]int, n)
	dep := make([]int, n)
	size := make([]int, n)
	var f func(v, p, d int) int
	f = func(v, p, d int) int {
		pa[v][0] = p
		dep[v] = d
		sz := 1
		for _, w := range g[v] {
			if w != p {
				sz += f(w, v, d+1)
			}
		}
		size[v] = sz
		return sz
	}
	f(0, -1, 0)
	for k := 0; k+1 < mx; k++ {
		for v := range pa {
			if p := pa[v][k]; p != -1 {
				pa[v][k+1] = pa[p][k]
			} else {
				pa[v][k+1] = -1
			}
		}
	}
	uptoDep := func(v, d int) int {
		for k := 0; k < mx; k++ {
			if (dep[v]-d)>>k&1 == 1 {
				v = pa[v][k]
			}
		}
		return v
	}
	_lca := func(v, w int) int {
		if dep[v] > dep[w] {
			v, w = w, v
		}
		w = uptoDep(w, dep[v])
		if v == w {
			return v
		}
		for k := mx - 1; k >= 0; k-- {
			if pa[v][k] != pa[w][k] {
				v, w = pa[v][k], pa[w][k]
			}
		}
		return pa[v][0]
	}

	for Fscan(in, &q); q > 0; q-- {
		Fscan(in, &v, &w)
		if v == w {
			Fprintln(out, n)
			continue
		}
		v--
		w--
		if dep[v] > dep[w] {
			v, w = w, v
		}
		lca := _lca(v, w)
		d := dep[v] + dep[w] - dep[lca]<<1
		if d&1 == 1 {
			Fprintln(out, 0)
			continue
		}
		uw := uptoDep(w, dep[w]-d>>1+1)
		if p := pa[uw][0]; p == lca {
			uv := uptoDep(v, dep[v]-d>>1+1)
			Fprintln(out, n-size[uv]-size[uw])
		} else {
			Fprintln(out, size[p]-size[uw])
		}
	}
}

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

package main

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

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

	var n, v, w, q int
	Fscan(in, &n)
	g := make([][]int, n)
	for i := 1; i < n; i++ {
		Fscan(in, &v, &w)
		v--
		w--
		g[v] = append(g[v], w)
		g[w] = append(g[w], v)
	}

	const mx = 18
	pa := make([][mx]int, n)
	dep := make([]int, n)
	size := make([]int, n)
	var f func(v, p, d int) int
	f = func(v, p, d int) int {
		pa[v][0] = p
		dep[v] = d
		sz := 1
		for _, w := range g[v] {
			if w != p {
				sz += f(w, v, d+1)
			}
		}
		size[v] = sz
		return sz
	}
	f(0, -1, 0)
	for k := 0; k+1 < mx; k++ {
		for v := range pa {
			if p := pa[v][k]; p != -1 {
				pa[v][k+1] = pa[p][k]
			} else {
				pa[v][k+1] = -1
			}
		}
	}
	uptoDep := func(v, d int) int {
		for k := 0; k < mx; k++ {
			if (dep[v]-d)>>k&1 == 1 {
				v = pa[v][k]
			}
		}
		return v
	}
	_lca := func(v, w int) int {
		if dep[v] > dep[w] {
			v, w = w, v
		}
		w = uptoDep(w, dep[v])
		if v == w {
			return v
		}
		for k := mx - 1; k >= 0; k-- {
			if pa[v][k] != pa[w][k] {
				v, w = pa[v][k], pa[w][k]
			}
		}
		return pa[v][0]
	}

	for Fscan(in, &q); q > 0; q-- {
		Fscan(in, &v, &w)
		if v == w {
			Fprintln(out, n)
			continue
		}
		v--
		w--
		if dep[v] > dep[w] {
			v, w = w, v
		}
		lca := _lca(v, w)
		d := dep[v] + dep[w] - dep[lca]<<1
		if d&1 == 1 {
			Fprintln(out, 0)
			continue
		}
		m := uptoDep(w, dep[w]-d>>1+1)
		if p := pa[m][0]; p == lca {
			Fprintln(out, n-size[p]+1)
		} else {
			Fprintln(out, size[p]-size[m])
		}
	}
}

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


package main

import "os"
import "bufio"
import "strconv"

func main(){
	var n, k int
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	n, _ = strconv.Atoi(r.Text())
	r.Scan()
	k, _ = strconv.Atoi(r.Text())
	if n < 2*k+1 {
		w.WriteString("-1\n")
	} else {
		w.WriteString(strconv.Itoa(n*k)+"\n")
		for i:=1; i<=n; i++ {
			for j:=i+1; j<=i+k; j++ {
				w.WriteString(strconv.Itoa(i)+" ")
				if j>n {
					w.WriteString(strconv.Itoa(j-n)+"\n")
				} else {
					w.WriteString(strconv.Itoa(j)+"\n")
				}
			}
		}
	}
	w.Flush()
}

// 417C
package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	var n, i, j, k int64
	fmt.Fscan(in, &n, &k)
	if 2*k >= n {
		fmt.Println("-1")
		return
	}
	fmt.Fprintln(out, n*k)
	for i = 1; i <= n; i++ {
		for j = i + 1; j <= i+k; j++ {
			fmt.Fprintln(out, i, (j-1)%n+1)
		}
	}
	out.Flush()
}

package main

import "os"
import "bufio"
import "strconv"

func main(){
	var n, k int
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	n, _ = strconv.Atoi(r.Text())
	r.Scan()
	k, _ = strconv.Atoi(r.Text())
	if n < 2*k+1 {
		w.WriteString("-1\n")
	} else {
		w.WriteString(strconv.Itoa(n*k)+"\n")
		for i:=1; i<=n; i++ {
			for j:=i+1; j<=i+k; j++ {
				w.WriteString(strconv.Itoa(i)+" ")
				if j>n {
					w.WriteString(strconv.Itoa(j-n)+"\n")
				} else {
					w.WriteString(strconv.Itoa(j)+"\n")
				}
			}
		}
		w.Flush()
	}
}

// 417C
package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	var n, i, j, k int64
	fmt.Fscan(in, &n, &k)
	if 2*k >= n {
		fmt.Println("-1")
		return
	}
	fmt.Fprintln(out, n*k)
	for i = 1; i <= n; i++ {
		for j = i + 1; j <= i+k; j++ {
			fmt.Fprintln(out, i, (j-1)%n+1)
		}
	}
}


package main

import (
	"bufio"
	"flag"
	"fmt"
	"io"
	"math/big"
	"os"
	"sort"
)

var reader *bufio.Reader
var writer *bufio.Writer

var inputFile = flag.String("input", "", "")

func init() {
	flag.Parse()
	var i io.Reader
	if *inputFile != "" {
		i, _ = os.Open(*inputFile)
	} else {
		i = os.Stdin
	}
	reader = bufio.NewReaderSize(i, 1<<20)
	writer = bufio.NewWriterSize(os.Stdout, 1<<20)
}

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

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

func scanf(format string, a ...interface{}) {
	_, _ = fmt.Fscanf(reader, format, a...)
}

func scan(a interface{}) {
	_, _ = fmt.Fscan(reader, a)
}

func NextInt64() int64 {
	var res int64
	scan(&res)
	return res
}

func NextInt() int {
	var res int
	scan(&res)
	return res
}

func NextIntArray(n int) []int {
	res := make([]int, n)
	for i := range res {
		scan(&res[i])
	}
	return res
}

func NextString() string {
	var res string
	scan(&res)
	return res
}

func NextBigInt() *big.Int {
	n := new(big.Int)
	n, _ = n.SetString(NextString(), 10)
	return n
}

func main() {
	defer writer.Flush()

	n := NextInt()
	_ = NextInt()
	k := NextInt()

	answer := n

	a := NextIntArray(n)

	b := make([]int, n - 1)

	for i := 0; i + 1 < n; i++ {
		b[i] = a[i + 1] - a[i] - 1
	}

	sort.Ints(b)

	for ; len(b) >= k; {
		answer += b[0]
		b = b[1:]
	}

	println(answer)
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n, m, k int
	fmt.Fscan(reader, &n, &m, &k)
	list := make([]int, n-1)
	previous := 1
	for i := 0; i < n; i++ {
		var a int
		fmt.Fscan(reader, &a)
		if i == 0 {
			previous = a
			continue
		}
		list[i-1] = a - previous
		previous = a
	}
	sort.Ints(list)
	total := 0
	for i := 0; i < n-k; i++ {
		total += list[i]
	}
	total += 1 * k
	fmt.Println(total)
}

package main

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

type inputData struct {
	brokenCount   int
	stickLength   int
	maxPieceCount int
	brokenPos     []int
}

func main() {
	inputData, err := readInputData(os.Stdin)
	if err != nil {
		panic(err)
	}
	fmt.Println(minTapeLength(inputData))
}

func minTapeLength(data inputData) int {
	segments := make([]int, data.brokenCount-1)

	for i := 0; i < data.brokenCount-1; i++ {
		segments[i] = data.brokenPos[i+1] - data.brokenPos[i]
	}

	sort.Ints(segments)

	sum := data.brokenCount

	for i := 0; i < data.brokenCount-data.maxPieceCount; i++ {
		sum += segments[i] - 1
	}

	return sum
}

func readInputData(input io.Reader) (inputData, error) {
	reader := bufio.NewReader(input)

	firstLine, err := readInts(reader)
	if err != nil {
		return inputData{}, err
	}

	secondLine, err := readInts(reader)
	if err != nil {
		return inputData{}, err
	}

	return inputData{
		brokenCount:   firstLine[0],
		stickLength:   firstLine[1],
		maxPieceCount: firstLine[2],
		brokenPos:     secondLine,
	}, nil
}

func readInts(reader *bufio.Reader) ([]int, error) {
	var err error
	str, err := reader.ReadString('\n')
	if err != nil && err != io.EOF {
		return nil, fmt.Errorf("could not read line: %v", err)
	}
	fields := strings.Fields(str)

	count := len(fields)
	ints := make([]int, count)

	for i, s := range fields {
		if ints[i], err = strconv.Atoi(s); err != nil {
			return nil, fmt.Errorf("could not convert input line to ints: %v", err)
		}
	}
	return ints, nil
}

package main

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

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, m, k, t1, last int

	ans := 0

	scanf("%d %d %d\n", &n, &m, &k)

	ans = n

	scanf("%d", &last)

	arr := []int{}

	for i := 0; i < n-1; i++ {
		scanf("%d", &t1)
		arr = append(arr, t1-last-1)
		last = t1
	}

	sort.Ints(arr)

	cur := n

	for cur > k {
		cur--
		t1 = arr[0]
		arr = arr[1:]
		ans += t1
	}

	printf("%d", ans)

}

package main

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

var in = bufio.NewReaderSize(os.Stdin, 2<<16)

func main() {
	var n, m, k int
	fmt.Fscan(in, &n, &m, &k)
	var first, next int
	fmt.Fscan(in, &first)
	last := first
	var save []int
	for i := 1; i < n; i++ {
		fmt.Fscan(in, &next)
		if cur := next - last - 1; cur > 0 {
			save = append(save, -cur)
		}
		last = next
	}
	sort.Ints(save)
	ans := last - first + 1
	for i := range save {
		if k == 1 {
			break
		}
		ans += save[i]
		k--
	}
	fmt.Println(ans)
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n, m, k int
	fmt.Fscan(reader, &n, &m, &k)
	list := make([]int, n)
	previous := 0
	for i := 0; i < n; i++ {
		var a int
		fmt.Fscan(reader, &a)
		list[i] = a - previous
		previous = a
	}
	sort.Ints(list)
	total := 0
	for i := 0; i < n-k; i++ {
		total += list[i] - 1
	}
	total += 2 * k
	fmt.Println(total)
}

package main

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

type inputData struct {
	brokenCount   int
	stickLength   int
	maxPieceCount int
	brokenPos     []int
}

func main() {
	fmt.Println(minTapeLength(os.Stdin))
}

func minTapeLength(input io.Reader) int {
	data, err := readInputData(input)
	if err != nil {
		panic(err)
	}

	segments := make([]int, data.brokenCount-1)

	for i := 0; i < data.brokenCount-1; i++ {
		segments[i] = data.brokenPos[i+1] - data.brokenPos[i]
	}

	sort.Ints(segments)

	sum := data.brokenCount - data.maxPieceCount

	for i := 0; i < data.brokenCount-data.maxPieceCount; i++ {
		sum += segments[i]
	}

	return sum
}

func readInputData(input io.Reader) (inputData, error) {
	scanner := bufio.NewScanner(input)

	firstLine, err := readInts(scanner, 3)
	if err != nil {
		return inputData{}, err
	}

	secondLine, err := readInts(scanner, firstLine[0])
	if err != nil {
		return inputData{}, err
	}

	return inputData{
		brokenCount:   firstLine[0],
		stickLength:   firstLine[1],
		maxPieceCount: firstLine[2],
		brokenPos:     secondLine,
	}, nil
}

func readInts(scanner *bufio.Scanner, expected int) ([]int, error) {
	if !scanner.Scan() {
		return nil, errors.New("could not read line")
	}
	fields := strings.Fields(scanner.Text())

	count := len(fields)
	if count != expected {
		return nil, fmt.Errorf("invalid field count; expected %d, got %d", expected, count)
	}

	ints := make([]int, count)
	var err error

	for i, s := range fields {
		if ints[i], err = strconv.Atoi(s); err != nil {
			return nil, fmt.Errorf("could not convert input line to ints: %v", err)
		}
	}
	return ints, nil
}