You are living on an infinite plane with the Cartesian coordinate system on it. In one move you can go to any of the four adjacent points (left, right, up, down).More formally, if you are standing at the point $$$(x, y)$$$, you can:   go left, and move to $$$(x - 1, y)$$$, or  go right, and move to $$$(x + 1, y)$$$, or  go up, and move to $$$(x, y + 1)$$$, or  go down, and move to $$$(x, y - 1)$$$. There are $$$n$$$ boxes on this plane. The $$$i$$$-th box has coordinates $$$(x_i,y_i)$$$. It is guaranteed that the boxes are either on the $$$x$$$-axis or the $$$y$$$-axis. That is, either $$$x_i=0$$$ or $$$y_i=0$$$.You can collect a box if you and the box are at the same point. Find the minimum number of moves you have to perform to collect all of these boxes if you have to start and finish at the point $$$(0,0)$$$.

The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of boxes. The $$$i$$$-th line of the following $$$n$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$ ($$$-100 \le x_i, y_i \le 100$$$) — the coordinate of the $$$i$$$-th box. It is guaranteed that either $$$x_i=0$$$ or $$$y_i=0$$$. Do note that the sum of $$$n$$$ over all test cases is not bounded.

NoteIn the first test case, a possible sequence of moves that uses the minimum number of moves required is shown below.  $$$$$$(0,0) \to (1,0) \to (1,1) \to (1, 2) \to (0,2) \to (-1,2) \to (-1,1) \to (-1,0) \to (-1,-1) \to (-1,-2) \to (0,-2) \to (0,-1) \to (0,0)$$$$$$ In the second test case, a possible sequence of moves that uses the minimum number of moves required is shown below.  $$$$$$(0,0) \to (0,1) \to (0,2) \to (-1, 2) \to (-2,2) \to (-3,2) \to (-3,1) \to (-3,0) \to (-3,-1) \to (-2,-1) \to (-1,-1) \to (0,-1) \to (0,0)$$$$$$ In the third test case, we can collect all boxes without making any moves.

package main

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

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

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

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

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

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

/**
Run solve the problem CF1713A
Date: 8/13/2022
User: wotan
URL: https://codeforces.com/problemset/problem/1713/A
Problem: CF1713A
**/
var arr [][]int

func (in *CF1713A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()

		minX := 0
		minY := 0
		maxX := 0
		maxY := 0

		for i := 0; i < n; i++ {
			x := in.NextInt()
			y := in.NextInt()
			if x > maxX {
				maxX = x
			}

			if y > maxY {
				maxY = y
			}

			if x < minX {
				minX = x
			}
			if y < minY {
				minY = y
			}
		}
		ans := 2 * (maxX + maxY - minX - minY)
		fmt.Println(ans)
	}
}

func f(x, y int, v []bool) int {
	min := -1
	for i := 0; i < len(v); i++ {
		if !v[i] {
			v[i] = true
			ans := f(arr[i][0], arr[i][1], v) + distance(x, y, arr[i][0], arr[i][1])
			if ans < min || min == -1 {
				min = ans
			}
			v[i] = false
		}
	}

	if min == -1 {
		return distance(x, y, 100, 100)
	}

	return min
}

func distance(x1, y1, x2, y2 int) int {
	return int(math.Abs(float64(x1)-float64(x2))) + int(math.Abs(float64(y1)-float64(y2)))
}

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

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

package main

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

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
}

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

	var t, n, x, y int
	fmt.Fscan(in, &t)

	for i := 0; i < t; i++ {
		var maxX, maxY, minX, minY = 0, 0, 0, 0
		fmt.Fscan(in, &n)

		for j := 0; j < n; j++ {
			fmt.Fscan(in, &x, &y)

			maxX = max(x, maxX)
			minX = min(x, minX)

			maxY = max(y, maxY)
			minY = min(y, minY)

		}
		fmt.Fprintln(out, 2*(maxX-minX+maxY-minY))
	}
}

package main

import (
	"fmt"
)

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
}

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

	for i := 0; i < t; i++ {
		var maxX, maxY, minX, minY = 0, 0, 0, 0
		fmt.Scanf("%d\n", &n)

		for j := 0; j < n; j++ {
			fmt.Scanf("%d %d\n", &x, &y)

			maxX = max(x, maxX)
			minX = min(x, minX)

			maxY = max(y, maxY)
			minY = min(y, minY)

		}
		fmt.Println(2 * (maxX - minX + maxY - minY))
	}
}

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

// 1713A - Traveling Salesman Problem

// You are living on an infinite plane with the Cartesian coordinate system on it. In one move you can go to any of the four adjacent points (left, right, up, down).
// More formally, if you are standing at the point (x,y), you can:
//  • go left, and move to (x−1,y), or
//  • go right, and move to (x+1,y), or
//  • go up, and move to (x,y+1), or
//  • go down, and move to (x,y−1).
// There are n boxes on this plane. The i-th box has coordinates (xi,yi). It is guaranteed that the boxes are either on the x-axis or the y-axis. That is, either xi=0 or yi=0.
// You can collect a box if you and the box are at the same point. Find the minimum number of moves you have to perform to collect all of these boxes if you have to start and finish at the point (0,0).

// Input
// The first line contains a single integer t (1≤t≤100) — the number of test cases.
// The first line of each test case contains a single integer n (1≤n≤100) — the number of boxes.
// The i-th line of the following n lines contains two integers xi and yi (−100≤xi,yi≤100) — the coordinate of the i-th box. It is guaranteed that either xi=0 or yi=0.
// Do note that the sum of n over all test cases is not bounded.

// Output
// For each test case output a single integer — the minimum number of moves required.

// Example
// input
// 3
// 4
// 0 -2
// 1 0
// -1 0
// 0 2
// 3
// 0 2
// -3 0
// 0 -1
// 1
// 0 0
// output
// 12
// 12
// 0

// Note

// In the first test case, a possible sequence of moves that uses the minimum number of moves required is shown below.
// (0,0)→(1,0)→(1,1)→(1,2)→(0,2)→(−1,2)→(−1,1)→(−1,0)→(−1,−1)→(−1,−2)→(0,−2)→(0,−1)→(0,0)
// In the second test case, a possible sequence of moves that uses the minimum number of moves required is shown below.
// (0,0)→(0,1)→(0,2)→(−1,2)→(−2,2)→(−3,2)→(−3,1)→(−3,0)→(−3,−1)→(−2,−1)→(−1,−1)→(0,−1)→(0,0)
// In the third test case, we can collect all boxes without making any moves.

// Editorial

// Hint 1
// Do we actually need to go off the axis?

// Hint 2
// How to avoid visiting an axis more than once?

// Tutorial
// Suppose we only have boxes on the Ox+ axis, then the optimal strategy is going in the following way: (0,0),(xmax,0),(0,0). There is no way to do in less than 2⋅|xmax| moves.
// What if we have boxes on two axis? Let's assume it is Oy+, suppose we have a strategy to go in the following way: (0,0),(xmax,0),...,(0,ymax),(0,0). In this case it is optimal to fill the three dots with (0,0), which is just solving each axis independently.
// Therefore, the number of axis does not matters. For each axis that has at least one box, go from (0,0) to the farthest one, then come back to (0,0).
// Time complexity: O(n)

package main

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

func main() {
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	var c int
	var t, n, i uint
	var x, y, min_x, max_x, min_y, max_y int

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

			min_x, max_x, min_y, max_y = 0, 0, 0, 0
			for i = 0; i < n; i++ {
				fmt.Fscan(reader, &x, &y)

				if min_x > x {
					min_x = x
				}
				if max_x < x {
					max_x = x
				}
				if min_y > y {
					min_y = y
				}
				if max_y < y {
					max_y = y
				}
			}

			fmt.Fprintln(writer, 2*(max_x-min_x+max_y-min_y))
		}
	}

	writer.Flush()
}

package main

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

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

func scan(a ...interface{}) {
	fmt.Fscan(in, a...)
}
func printf(f string, a ...interface{}) {
	fmt.Fprintf(out, f, a...)
}
func solve() {
	var n int
	var x, y float64
	scan(&n)
	arr := [4]float64{0, 0, 0, 0}
	for i := 0; i < n; i++ {
		scan(&x, &y)
		arr[0] = math.Min(arr[0], x)
		arr[1] = math.Min(arr[1], y)

		arr[2] = math.Max(arr[2], x)
		arr[3] = math.Max(arr[3], y)
	}
	a := arr[2] - arr[0]
	b := arr[3] - arr[1]
	printf("%d\n", int64(a+b)*2)
}
func main() {
	defer out.Flush()
	n := 0
	scan(&n)
	for i := 0; i < n; i++ {
		solve()
	}
}

/*
You are living on an infinite plane with the Cartesian coordinate system on it. In one move you can go to any of the four adjacent points (left, right, up, down).

More formally, if you are standing at the point (x,y)

, you can:

    go left, and move to (x−1,y)

, or
go right, and move to (x+1,y)
, or
go up, and move to (x,y+1)
, or
go down, and move to (x,y−1)

    .

There are n
boxes on this plane. The i-th box has coordinates (xi,yi). It is guaranteed that the boxes are either on the x-axis or the y-axis. That is, either xi=0 or yi=0

.

You can collect a box if you and the box are at the same point. Find the minimum number of moves you have to perform to collect all of these boxes if you have to start and finish at the point (0,0)

.
Input

The first line contains a single integer t
(1≤t≤100

) — the number of test cases.

The first line of each test case contains a single integer n
(1≤n≤100

) — the number of boxes.

The i
-th line of the following n lines contains two integers xi and yi (−100≤xi,yi≤100) — the coordinate of the i-th box. It is guaranteed that either xi=0 or yi=0

.

Do note that the sum of n

over all test cases is not bounded.
Output

For each test case output a single integer — the minimum number of moves required.
*/

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	scanner.Scan()
	t, _ := strconv.Atoi(scanner.Text())
	for i := 0; i < t; i++ {
		scanner.Scan()
		n, _ := strconv.Atoi(scanner.Text())
		var numOfMoves int
		var minx, miny, maxx, maxy int
		for j := 0; j < n; j++ {
			scanner.Scan()
			xystr := strings.Split(scanner.Text(), " ")
			x, _ := strconv.Atoi(xystr[0])
			y, _ := strconv.Atoi(xystr[1])
			if x < minx {
				minx = x
			} else if x > maxx {
				maxx = x
			} else if y < miny {
				miny = y
			} else if y > maxy {
				maxy = y
			}
		}
		numOfMoves += -minx*2 - miny*2 + maxx*2 + maxy*2
		writer.WriteString(strconv.Itoa(numOfMoves) + "\n")
	}
	writer.Flush()
}

package main

import "fmt"

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}
func main() {
	var T int
	fmt.Scan(&T)
	for i := 0; i < T; i++ {
		var n int
		fmt.Scan(&n)
		res := 0
		mx1, mx2, my1, my2 := 0, 0, 0, 0
		for j := 0; j < n; j++ {
			var x, y int
			fmt.Scan(&x, &y)
			mx1 = min(x, mx1)
			my1 = min(y, my1)
			mx2 = max(x, mx2)
			my2 = max(y, my2)
		}
		res = abs(mx1) + abs(mx2) + abs(my1) + abs(my2)
		fmt.Println(res * 2)
	}
}

package main

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

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

func solve(n int, x []int, y []int) int {
	x_min := 0
	y_min := 0
	x_max := 0
	y_max := 0
	for i := 0; i < n; i++ {
		x_min = min(x[i], x_min)
		x_max = max(x[i], x_max)
		y_min = min(y[i], y_min)
		y_max = max(y[i], y_max)
	}
	return (x_max - x_min + y_max - y_min) * 2
}

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

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

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

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

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

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

package main

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

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

	var buf bytes.Buffer

	tc := readNum(reader)

	for tc > 0 {
		tc--

		n := readNum(reader)
		boxes := make([][]int, n)
		for i := 0; i < n; i++ {
			boxes[i] = readNNums(reader, 2)
		}
		res := solve(boxes)
		buf.WriteString(fmt.Sprintf("%d\n", res))
	}

	fmt.Print(buf.String())
}

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

func normalize(s string) string {

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

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

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

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

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

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

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

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

	return i
}

func solve(boxes [][]int) int {
	max_val := make([]int, 4)

	for i := 0; i < len(boxes); i++ {
		x, y := boxes[i][0], boxes[i][1]
		if x > 0 {
			max_val[0] = max(max_val[0], x)
		}
		if x < 0 {
			max_val[1] = min(max_val[1], x)
		}
		if y > 0 {
			max_val[2] = max(max_val[2], y)
		}

		if y < 0 {
			max_val[3] = min(max_val[3], y)
		}
	}

	var res int

	for i := 0; i < 4; i++ {
		res += 2 * abs(max_val[i])
	}

	return res
}

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

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

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

package main
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Fscan(in,&n)
		list_x:= make([]int,n)
		list_y:= make([]int,n)
		for j:=0;j<n;j++{
			fmt.Fscan(in,&list_x[j],&list_y[j])
		}
		for j:=1;j<n;j++{
			if list_x[j] < list_x[j-1] {
				list_x[j],list_x[j-1]= list_x[j-1],list_x[j]
				j-=2
				if j<0{
					j=0
				}
			}
		}
		for j:=1;j<n;j++ {
			if list_y[j] < list_y[j-1] {
				list_y[j],list_y[j-1]= list_y[j-1],list_y[j]
				j-=2
				if j<0{
					j=0
				}
			}
		}
		sum:=0
		if list_x[n-1] > 0 {
			sum+= (list_x[n-1]*2)
		}
		if list_x[0] < 0 {
			sum+= ((list_x[0]*-1)*2)
		}
		if list_y[n-1] > 0 {
			sum+= (list_y[n-1]*2)
		}
		if list_y[0] < 0 {
			sum+= ((list_y[0]*-1)*2)
		}
		fmt.Fprintln(out,sum)
	}
}

package main

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

func Min(v ...int) int {
	mn := v[0]
	for k := 1; k < len(v); k++ {
		if v[k] < mn {
			mn = v[k]
		}
	}
	return mn
}

func Max(v ...int) int {
	mx := v[0]
	for k := 1; k < len(v); k++ {
		if v[k] > mx {
			mx = v[k]
		}
	}
	return mx
}

func Solve(testCaseIdx int, reader io.Reader) {
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	var n int
	fmt.Fscan(reader, &n)
	mn_x := 0
	mx_x := 0
	mn_y := 0
	mx_y := 0
	for k := 0; k < n; k++ {
		var x, y int
		fmt.Fscan(reader, &x, &y)
		mn_x = Min(mn_x, x)
		mx_x = Max(mx_x, x)
		mn_y = Min(mn_y, y)
		mx_y = Max(mx_y, y)
	}
	dx := mx_x - mn_x
	dy := mx_y - mn_y
	fmt.Fprintln(writer, dx + dx + dy + dy)
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	var testCaseCount int
	fmt.Fscan(reader, &testCaseCount)
	for t := 0; t < testCaseCount; t++ {
		Solve(t, reader)
	}
}

package main

import (
	"fmt"
	"os"
)

func main() {
	in := os.Stdin
	var t int
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		var n int
		fmt.Fscan(in, &n)
		temp := [4][101]bool{}
		for j := 0; j < n; j++ {
			var x, y int
			fmt.Fscan(in, &x)
			fmt.Fscan(in, &y)
			if y == 0 {
				if x > 0 { // 右
					temp[0][x] = true
				} else { // 左
					temp[2][-x] = true
				}
			} else if x == 0 {
				if y > 0 { // 上
					temp[1][y] = true
				} else { // 下
					temp[3][-y] = true
				}
			}
		}
		ans := 0
		sx, sy := 0, 0
		for k := 0; k < 4; k++ {
			for j := 0; j < 101; j++ {
				if temp[k][j] {
					switch k {
					case 0:
						ans += abs(j-sx) + abs(sy)
						sx, sy = j, 0
					case 1:
						ans += abs(sx) + abs(j-sy)
						sx, sy = 0, j
					case 2:
						ans += abs(-j-sx) + abs(sy)
						sx, sy = -j, 0
					case 3:
						ans += abs(sx) + abs(-j-sy)
						sx, sy = 0, -j
					}
					//fmt.Println("path: ", ans, ": ", sx, ",", sy)
				}
			}
		}
		ans += abs(sx) + abs(sy)
		fmt.Println(ans)
	}
}

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

package main

import (
	"fmt"
)

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

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

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

	for varr := 0; varr <t; varr++ {
		minx, miny, maxx, maxy := 0,0,0,0
		var n int
		fmt.Scanln(&n)

		for i := 0; i < n; i++ {
			var x, y int
			fmt.Scanln(&x, &y)
			minx = Min(minx, x)
			miny = Min(miny, y)
			maxx = Max(maxx, x)
			maxy = Max(maxy, y)
		}

		fmt.Println(2*(maxy - miny + maxx - minx))
	}

}

package main

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

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

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

func solution(in *bufio.Reader, out *bufio.Writer) {
	v := readArrInt(in)
	n := v[0]
	maxX := 0
	maxY := 0
	minX := 0
	minY := 0

	for i := 1; i <= n; i++ {
		arr := readArrInt(in)
		x := arr[0]
		y := arr[1]
		maxX = Max(x, maxX)
		maxY = Max(y, maxY)
		minX = Min(x, minX)
		minY = Min(y, minY)
	}
	out.WriteString(strconv.Itoa(Abs(maxX*2) + Abs(minX*2) + Abs(maxY*2) + Abs(minY*2)))
	out.WriteString("\n")

}

func Max(sum int, sum2 int) int {
	if sum > sum2 {
		return sum
	}
	return sum2

}

func Min(sum int, sum2 int) int {
	if sum < sum2 {
		return sum
	}
	return sum2
}

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

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

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

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

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

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

package main

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

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	scanner.Scan()
	t, _ := strconv.Atoi(scanner.Text())
	for i := 0; i < t; i++ {
		scanner.Scan()
		n, _ := strconv.Atoi(scanner.Text())
		var minX, maxX, minY, maxY int
		for j := 0; j < n; j++ {
			scanner.Scan()
			xyArray := strings.Split(scanner.Text(), " ")
			xTemp, _ := strconv.Atoi(xyArray[0])
			yTemp, _ := strconv.Atoi(xyArray[1])
			if xTemp < minX {
				minX = xTemp
			}
			if xTemp > maxX {
				maxX = xTemp
			}
			if yTemp < minY {
				minY = yTemp
			}
			if yTemp > maxY {
				maxY = yTemp
			}
		}
		ans := (maxX - minX + maxY - minY) << 1
		writer.WriteString(strconv.Itoa(ans) + "\n")
	}
	writer.Flush()
}

package main

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

var pre [105]int
var x, y int

func IntAbs(v int) int {
	if v < 0 {
		return -v
	}
	return v
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t, n, x1, x2, y1, y2 int
	fmt.Fscan(in, &t)
	for t != 0 {
		fmt.Fscan(in, &n)
		x1, x2, y1, y2 = 0, 0, 0, 0
		for i := 1; i <= n; i++ {
			fmt.Fscan(in, &x, &y)
			if x1 < x {
				x1 = x
			}
			if x2 > x {
				x2 = x
			}
			if y1 < y {
				y1 = y
			}
			if y2 > y {
				y2 = y
			}
		}
		fmt.Fprintln(out, (IntAbs(x1)+IntAbs(x2)+IntAbs(y1)+IntAbs(y2))*2)
		t--
	}
}

package main

import "fmt"

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

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

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

	for t := 0; t < times; t++ {
		var count int
		fmt.Scanf("%d\n", &count)
		maxX, maxY, minX, minY := 0, 0, 0, 0

		for i := 0; i < count; i++ {
			var x, y int
			fmt.Scanf("%d %d\n", &x, &y)
			maxX = MaxValue(maxX, x)
			minX = MinValue(minX, x)
			maxY = MaxValue(maxY, y)
			minY = MinValue(minY, y)
		}
		fmt.Println(2 * (maxX + maxY - minY - minX))
	}
}

package main

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

func solve() {
	n := get()
	var xmin, xmax, ymin, ymax int
	for i := n; i > 0; i-- {
		x := get()
		y := get()
		xmin = min1(xmin, x)
		xmax = max1(xmax, x)
		ymin = min1(ymin, y)
		ymax = max1(ymax, y)
	}
	xmin = abs(xmin)
	ymin = abs(ymin)
	putln(2 * (xmin + xmax + ymin + ymax))
}

const (
	once       = false
	useBuf     = false
	maxBufSize = 10_000_000
	YES        = "YES"
	NO         = "NO"
)

var (
	splitFunc = bufio.ScanWords
)

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

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

	if once {
		solve()
		return
	}

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

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

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

func geta(n int) []int {
	a := make([]int, n)
	for i := range a {
		a[i] = get()
	}
	return a
}

func geta1(n int) []int {
	a := make([]int, n)
	for i := range a {
		a[i] = get() - 1
	}
	return a
}

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

func get64a(n int) []int64 {
	a := make([]int64, n)
	for i := range a {
		a[i] = get64()
	}
	return a
}

func get64a1(n int) []int64 {
	a := make([]int64, n)
	for i := range a {
		a[i] = get64() - 1
	}
	return a
}

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

func getfa(n int) []float64 {
	a := make([]float64, n)
	for i := range a {
		a[i] = getf()
	}
	return a
}

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

func scanN(n int) {
	for n > 0 {
		scan()
		n--
	}
}

func scan() {
	in.Scan()
}

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

func line() {
	putc('\n')
}

func space() {
	putc(' ')
}

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

func putln(i int) {
	put(i)
	line()
}

func puta(a []int) {
	for _, v := range a {
		put(v)
		space()
	}
	line()
}

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

func put64ln(x int64) {
	put64(x)
	line()
}

func put64a(a []int64) {
	for _, v := range a {
		put64(v)
		space()
	}
	line()
}

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

func putsln(s string) {
	puts(s)
	line()
}

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

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

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

func putf(x float64) {
	out.WriteString(strconv.FormatFloat(x, 'f', -1, 64))
}

func putfln(x float64) {
	putf(x)
	line()
}

func putfa(a []float64) {
	for _, v := range a {
		putf(v)
		space()
	}
	line()
}

type IntTp interface {
	int | int64
}

type Tp interface {
	IntTp | float64
}

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

func fabs(x float64) float64 {
	return math.Abs(x)
}

func max1[T Tp](x T, y T) T {
	if x > y {
		return x
	}
	return y
}

func max[T Tp](xs ...T) T {
	r := xs[0]
	for _, x := range xs[1:] {
		r = max1(r, x)
	}
	return r
}

func maxa[T Tp](a []T) (i int, val T) {
	i, val = 0, a[0]
	for j := 1; j < len(a); j++ {
		if a[j] <= val {
			continue
		}
		i = j
		val = a[j]
	}
	return
}

func min1[T Tp](x T, y T) T {
	if x < y {
		return x
	}
	return y
}

func min[T Tp](xs ...T) T {
	r := xs[0]
	for _, x := range xs[1:] {
		r = min1(r, x)
	}
	return r
}

func mina[T Tp](a []T) (i int, val T) {
	i, val = 0, a[0]
	for j := 1; j < len(a); j++ {
		if a[j] >= val {
			continue
		}
		i = j
		val = a[j]
	}
	return
}

func L(i int) int64 {
	return int64(i)
}

func F(i int) float64 {
	return float64(i)
}

func ints(n int, val int) (a []int) {
	a = make([]int, n)
	if val == 0 {
		return
	}
	for i := range a {
		a[i] = val
	}
	return
}

func int64s(n int, val int64) (a []int64) {
	a = make([]int64, n)
	if val == 0 {
		return
	}
	for i := range a {
		a[i] = val
	}
	return
}

func floats(n int, val float64) (a []float64) {
	a = make([]float64, n)
	if val == 0 {
		return
	}
	for i := range a {
		a[i] = val
	}
	return
}

const heapBase = 4

func children(i int) (int, int) {
	start := heapBase * i
	return start + 1, start + (1 + heapBase)
}

func parent(i int) int {
	return (i - 1) / heapBase
}

package main

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

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

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

		var x1, x2, y1, y2 int
		for i := 0; i < n; i++ {
			var x, y int
			fmt.Fscan(in, &x, &y)
			if x < x1 {
				x1 = x
			}
			if x > x2 {
				x2 = x
			}
			if y < y1 {
				y1 = y
			}
			if y > y2 {
				y2 = y
			}

		}
		fmt.Fprintln(out, x2+(x2+y2)+(x1*-1+y2)+(x1*-1+y1*-1)+y1*-1)
	}
}

package main

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

const cf = true

func solve() {
	var n, x, y int
	fmt.Fscan(in, &n)
	yMx, yMn, xMx, xMn := 0, 0, 0, 0
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &x, &y)
		yMn = min(yMn, y)
		yMx = max(yMx, y)
		xMn = min(xMn, x)
		xMx = max(xMx, x)
	}
	arr := []int{yMx, -yMn, xMx, -xMn}
	sort.Ints(arr)
	ans := arr[0]*2 + arr[1]*2 + arr[2]*2 + arr[3]*2
	fmt.Fprintln(out, ans)
}

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

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

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

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

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

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

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

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

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

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

var exists = struct{}{}

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

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

type Float interface {
	~float32 | ~float64
}

type Integer interface {
	Signed | Unsigned
}

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

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

type Ordered interface {
	Integer | Float | ~string
}

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

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

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

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

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

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

package main

import (

	"bufio"
	"os"
	"fmt"
)

var (

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

func min(a, b int) int {

	if a < b {

		return a
	}
	return b
}

func max(a, b int) int {

	if a > b {

		return a
	}
	return b
}

func main() {

	defer out.Flush()
	var T int
	fmt.Fscan(in, &T)

	for i := 0; i < T; i++ {

		var n int
		mx, my, nx, ny := 0, 0, 0, 0
		fmt.Fscan(in, &n)
		for j := 0; j < n; j++ {

			var x, y int
			fmt.Fscan(in, &x, &y)
			if x == 0 {

				if y < 0 {

					my = min(my, y)
				} else {

					ny = max(ny, y)
				}
			} else {

				if x < 0 {

					mx = min(mx, x)
				} else {

					nx = max(nx, x)
				}
			}
		}
		fmt.Fprintln(out, (nx - mx) * 2 + (ny - my) * 2)
	}
}

package main

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

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

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var niter int
	fmt.Fscan(in, &niter)
	for iiter := 0; iiter < niter; iiter++ {
		var n int
		fmt.Fscan(in, &n)
		xmin, xmax, ymin, ymax := 101, -101, 101, -101
		for i := 0; i < n; i++ {
			var a, b int
			fmt.Fscan(in, &a, &b)
			xmin = min(xmin, a)
			xmax = max(xmax, a)
			ymin = min(ymin, b)
			ymax = max(ymax, b)
		}
		//fmt.Println("!!!", xmin, xmax, ymin, ymax)
		res := 0
		res += max(0, xmax) * 2
		res += max(0, ymax) * 2
		res += min(0, xmin) * -2
		res += min(0, ymin) * -2
		fmt.Fprintln(out, res)
	}
}

package main

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

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

func main() {
	defer out.Flush()

	var tc int
	for fmt.Fscan(in, &tc); tc > 0; tc-- {
		var n int
		var lt, rt, up, down int
		for fmt.Fscan(in, &n); n > 0; n-- {
			var x, y int
			fmt.Fscan(in, &x, &y)
			switch {
			case x < 0 && x < lt:
				lt = x
			case x > 0 && x > rt:
				rt = x
			case y < 0 && y < up:
				up = y
			case y > 0 && y > down:
				down = y
			}
		}
		fmt.Fprintln(out, 2*(rt+down-lt-up))
	}
}

package main

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

func readLine() string {
	s, err := in.ReadString('\n')
	if err != nil {
		panic(err)
	}
	s = strings.ReplaceAll(s, "\n", "")
	s = strings.ReplaceAll(s, "\r", "")
	return s
}

func readLines(n int) []string {
	res := make([]string, n)
	for i := 0; i < n; i++ {
		res[i] = readLine()
	}
	return res
}

func readInt() int {
	n, err := strconv.ParseInt(readLine(), 10, 32)
	if err != nil {
		panic(err)
	}
	return int(n)
}

func readInt2() (int, int) {
	as := readInts(2)
	return as[0], as[1]
}

func readInt3() (int, int, int) {
	as := readInts(3)
	return as[0], as[1], as[2]
}

func readUint() uint64 {
	n, err := strconv.ParseUint(readLine(), 10, 64)
	if err != nil {
		panic(err)
	}
	return n
}

func readInts(n int) []int {
	s := readLine()
	as := strings.SplitN(s, " ", n)
	if len(as) != n {
		panic("invalid len")
	}
	arr := make([]int, n)
	for k, a := range as {
		x, _ := strconv.ParseInt(a, 10, 64)
		arr[k] = int(x)
	}
	return arr
}

func readStrings(n int) []string {
	s := readLine()
	as := strings.SplitN(s, " ", n)
	if len(as) != n {
		panic("invalid len")
	}
	return as
}

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

var in = bufio.NewReader(os.Stdin)

func main() {
	t := readInt()

	for i := 0; i < t; i++ {
		n := readInt()
		m1, m2, m3, m4 := 0, 0, 0, 0
		for j := 0; j < n; j++ {
			x, y := readInt2()
			if x == 0 {
				if y > 0 {
					if y > m1 {
						m1 = y
					}
				} else {
					if -y > m3 {
						m3 = -y
					}
				}
			} else {
				if x > 0 {
					if x > m2 {
						m2 = x
					}
				} else {
					if -x > m4 {
						m4 = -x
					}
				}
			}
		}
		fmt.Println((m1 + m2 + m3 + m4) * 2)
	}
}

package main

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

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

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

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

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

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

/**
Run solve the problem CF1713A
Date: 8/13/2022
User: wotan
URL: https://codeforces.com/problemset/problem/1713/A
Problem: CF1713A
**/
var arr [][]int

func (in *CF1713A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		arr = make([][]int, n)
		for i := 0; i < n; i++ {
			arr[i] = []int{in.NextInt() + 100, in.NextInt() + 100}
		}
		visited := make([]bool, n)

		ans := f(100, 100, visited)
		fmt.Println(ans)
	}
}

func f(x, y int, v []bool) int {
	min := -1
	for i := 0; i < len(v); i++ {
		if !v[i] {
			v[i] = true
			ans := f(arr[i][0], arr[i][1], v) + distance(x, y, arr[i][0], arr[i][1])
			if ans < min || min == -1 {
				min = ans
			}
		}
	}

	if min == -1 {
		return distance(x, y, 100, 100)
	}

	return min
}

func distance(x1, y1, x2, y2 int) int {
	return int(math.Abs(float64(x1)-float64(x2))) + int(math.Abs(float64(y1)-float64(y2)))
}

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

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

package main

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

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

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

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

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

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

/**
Run solve the problem CF1713A
Date: 8/13/2022
User: wotan
URL: https://codeforces.com/problemset/problem/1713/A
Problem: CF1713A
**/
func (in *CF1713A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		arr := make([][]int, n)
		for i := 0; i < n; i++ {
			arr[i] = []int{in.NextInt() + 100, in.NextInt() + 100}
		}
		visited := make([]bool, n)
		cX := 100
		cY := 100
		ans := 0
		for {
			min := -1
			index := -1
			for i := 0; i < n; i++ {
				if !visited[i] {
					dis := int(math.Abs(float64(cX)-float64(arr[i][0]))) + int(math.Abs(float64(cY)-float64(arr[i][1])))
					if min == -1 || dis < min {
						min = dis
						index = i
					}
				}
			}
			if index == -1 {
				break
			}
			visited[index] = true
			ans += min
			cX = arr[index][0]
			cY = arr[index][1]
		}
		ans += int(math.Abs(float64(cX)-float64(100))) + int(math.Abs(float64(cY)-float64(100)))
		fmt.Println(ans)
	}
}

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

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

package main

import (
	"fmt"
)

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
}

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

	for i := 0; i < t; i++ {
		var maxX, maxY, minX, minY = -101, -101, 101, 101
		fmt.Scanf("%d\n", &n)

		for j := 0; j < n; j++ {
			fmt.Scanf("%d %d\n", &x, &y)

			maxX = max(x, maxX)
			minX = min(x, minX)

			maxY = max(y, maxY)
			minY = min(y, minY)

		}
		fmt.Println(2 * (maxX - minX + maxY - minY))
	}
}

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

// 1713A - Traveling Salesman Problem

// You are living on an infinite plane with the Cartesian coordinate system on it. In one move you can go to any of the four adjacent points (left, right, up, down).
// More formally, if you are standing at the point (x,y), you can:
//  • go left, and move to (x−1,y), or
//  • go right, and move to (x+1,y), or
//  • go up, and move to (x,y+1), or
//  • go down, and move to (x,y−1).
// There are n boxes on this plane. The i-th box has coordinates (xi,yi). It is guaranteed that the boxes are either on the x-axis or the y-axis. That is, either xi=0 or yi=0.
// You can collect a box if you and the box are at the same point. Find the minimum number of moves you have to perform to collect all of these boxes if you have to start and finish at the point (0,0).

// Input
// The first line contains a single integer t (1≤t≤100) — the number of test cases.
// The first line of each test case contains a single integer n (1≤n≤100) — the number of boxes.
// The i-th line of the following n lines contains two integers xi and yi (−100≤xi,yi≤100) — the coordinate of the i-th box. It is guaranteed that either xi=0 or yi=0.
// Do note that the sum of n over all test cases is not bounded.

// Output
// For each test case output a single integer — the minimum number of moves required.

// Example
// input
// 3
// 4
// 0 -2
// 1 0
// -1 0
// 0 2
// 3
// 0 2
// -3 0
// 0 -1
// 1
// 0 0
// output
// 12
// 12
// 0

// Note

// In the first test case, a possible sequence of moves that uses the minimum number of moves required is shown below.
// (0,0)→(1,0)→(1,1)→(1,2)→(0,2)→(−1,2)→(−1,1)→(−1,0)→(−1,−1)→(−1,−2)→(0,−2)→(0,−1)→(0,0)
// In the second test case, a possible sequence of moves that uses the minimum number of moves required is shown below.
// (0,0)→(0,1)→(0,2)→(−1,2)→(−2,2)→(−3,2)→(−3,1)→(−3,0)→(−3,−1)→(−2,−1)→(−1,−1)→(0,−1)→(0,0)
// In the third test case, we can collect all boxes without making any moves.

// Editorial

// Hint 1
// Do we actually need to go off the axis?

// Hint 2
// How to avoid visiting an axis more than once?

// Tutorial
// Suppose we only have boxes on the Ox+ axis, then the optimal strategy is going in the following way: (0,0),(xmax,0),(0,0). There is no way to do in less than 2⋅|xmax| moves.
// What if we have boxes on two axis? Let's assume it is Oy+, suppose we have a strategy to go in the following way: (0,0),(xmax,0),...,(0,ymax),(0,0). In this case it is optimal to fill the three dots with (0,0), which is just solving each axis independently.
// Therefore, the number of axis does not matters. For each axis that has at least one box, go from (0,0) to the farthest one, then come back to (0,0).
// Time complexity: O(n)

package main

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

func main() {
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	var c int
	var t, n, i uint
	var x, y, min_x, max_x, min_y, max_y int

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

			for i = 0; i < n; i++ {
				fmt.Fscan(reader, &x, &y)

				if i == 0 {
					min_x = x
					max_x = x
					min_y = y
					max_y = y
				} else {
					if min_x > x {
						min_x = x
					}
					if max_x < x {
						max_x = x
					}
					if min_y > y {
						min_y = y
					}
					if max_y < y {
						max_y = y
					}
				}
			}

			fmt.Fprintln(writer, 2*(max_x-min_x+max_y-min_y))
		}
	}

	writer.Flush()
}

package main

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

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

func scan(a ...interface{}) {
	fmt.Fscan(in, a...)
}
func printf(f string, a ...interface{}) {
	fmt.Fprintf(out, f, a...)
}
func solve() {
	var n int
	var x, y float64
	scan(&n)
	arr := [4]float64{100, 100, -100, -100}
	for i := 0; i < n; i++ {
		scan(&x, &y)
		arr[0] = math.Min(arr[0], x)
		arr[1] = math.Min(arr[1], y)

		arr[2] = math.Max(arr[2], x)
		arr[3] = math.Max(arr[3], y)
	}
	a := arr[2] - arr[0]
	b := arr[3] - arr[1]
	printf("%d\n", int64(a+b)*2)
}
func main() {
	defer out.Flush()
	n := 0
	scan(&n)
	for i := 0; i < n; i++ {
		solve()
	}
}

/*
You are living on an infinite plane with the Cartesian coordinate system on it. In one move you can go to any of the four adjacent points (left, right, up, down).

More formally, if you are standing at the point (x,y)

, you can:

    go left, and move to (x−1,y)

, or
go right, and move to (x+1,y)
, or
go up, and move to (x,y+1)
, or
go down, and move to (x,y−1)

    .

There are n
boxes on this plane. The i-th box has coordinates (xi,yi). It is guaranteed that the boxes are either on the x-axis or the y-axis. That is, either xi=0 or yi=0

.

You can collect a box if you and the box are at the same point. Find the minimum number of moves you have to perform to collect all of these boxes if you have to start and finish at the point (0,0)

.
Input

The first line contains a single integer t
(1≤t≤100

) — the number of test cases.

The first line of each test case contains a single integer n
(1≤n≤100

) — the number of boxes.

The i
-th line of the following n lines contains two integers xi and yi (−100≤xi,yi≤100) — the coordinate of the i-th box. It is guaranteed that either xi=0 or yi=0

.

Do note that the sum of n

over all test cases is not bounded.
Output

For each test case output a single integer — the minimum number of moves required.
*/

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	scanner.Scan()
	t, _ := strconv.Atoi(scanner.Text())
	for i := 0; i < t; i++ {
		scanner.Scan()
		n, _ := strconv.Atoi(scanner.Text())
		var numOfMoves int
		for j := 0; j < n; j++ {
			scanner.Scan()
			xystr := strings.Split(scanner.Text(), " ")
			x, _ := strconv.Atoi(xystr[0])
			y, _ := strconv.Atoi(xystr[1])
			numOfMoves += int(math.Abs(float64(x*2)) + math.Abs(float64(y*2)))
		}
		writer.WriteString(strconv.Itoa(numOfMoves) + "\n")
	}
	writer.Flush()
}

package main

import "fmt"

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}
func main() {
	var T int
	fmt.Scan(&T)
	for i := 0; i < T; i++ {
		var n int
		fmt.Scan(&n)
		res := 0
		for j := 0; j < n; j++ {
			var x, y int
			fmt.Scan(&x, &y)
			res += abs(x) + abs(y)
		}
		fmt.Println(res * 2)
	}
}

package main

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

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

func solve(n int, x []int, y []int) int {
	x_min := 1000000
	y_min := 1000000
	x_max := -1000000
	y_max := -1000000
	for i := 0; i < n; i++ {
		x_min = min(x[i], x_min)
		x_max = max(x[i], x_max)
		y_min = min(y[i], y_min)
		y_max = max(y[i], y_max)
	}
	return (x_max - x_min + y_max - y_min) * 2
}

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

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

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

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

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

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


The German University in Cairo (GUC) dorm houses are numbered from 1 to n. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa), and diameter (which characterizes the maximal amount of water it can handle).For each house, there is at most one pipe going into it and at most one pipe going out of it. With the new semester starting, GUC student and dorm resident, Lulu, wants to install tanks and taps at the dorms. For every house with an outgoing water pipe and without an incoming water pipe, Lulu should install a water tank at that house. For every house with an incoming water pipe and without an outgoing water pipe, Lulu should install a water tap at that house. Each tank house will convey water to all houses that have a sequence of pipes from the tank to it. Accordingly, each tap house will receive water originating from some tank house.In order to avoid pipes from bursting one week later (like what happened last semester), Lulu also has to consider the diameter of the pipes. The amount of water each tank conveys should not exceed the diameter of the pipes connecting a tank to its corresponding tap. Lulu wants to find the maximal amount of water that can be safely conveyed from each tank to its corresponding tap.

The first line contains two space-separated integers n and p (1 ≤ n ≤ 1000, 0 ≤ p ≤ n) — the number of houses and the number of pipes correspondingly.  Then p lines follow — the description of p pipes. The i-th line contains three integers ai bi di, indicating a pipe of diameter di going from house ai to house bi (1 ≤ ai, bi ≤ n, ai ≠ bi, 1 ≤ di ≤ 106). It is guaranteed that for each house there is at most one pipe going into it and at most one pipe going out of it.

Print integer t in the first line — the number of tank-tap pairs of houses. For the next t lines, print 3 integers per line, separated by spaces: tanki, tapi, and diameteri, where tanki ≠ tapi (1 ≤ i ≤ t). Here tanki and tapi are indexes of tank and tap houses respectively, and diameteri is the maximum amount of water that can be conveyed. All the t lines should be ordered (increasingly) by tanki.

package main

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

func main() {
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewBuffer(bs)
	var n, p int
	fmt.Fscanf(reader, "%d %d\n", &n, &p)
	next := make([]int, n + 1)
	prev := make([]int, n + 1)
	pipe := make([]int, n + 1)
	for i := 0;i < n;i ++ {
		var a, b, d int
		fmt.Fscanf(reader, "%d %d %d\n", &a, &b, &d)
		next[a] = b
		prev[b] = a
		pipe[a] = d
	}
	count := 0
	for i := 1;i <= n;i ++ {
		if prev[i] == 0 && next[i] != 0 {
			count ++
		}
	}
	fmt.Printf("%d\n", count)
	for i := 1;i <= n;i ++ {
		if prev[i] == 0 && next[i] != 0 {
			min := 1000000
			var j int
			for j = i;next[j] != 0;j = next[j] {
				if min > pipe[j] {
					min = pipe[j]
				}
			}
			fmt.Printf("%d %d %d\n", i, j, min)
		}
	}
}

package main

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

func main() {
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewBuffer(bs)
	var n, p int
	fmt.Fscanf(reader, "%d %d\n", &n, &p)
	next := make([]int, n + 1)
	prev := make([]int, n + 1)
	pipe := make([]int, n + 1)
	for i := 0;i < n;i ++ {
		var a, b, d int
		fmt.Fscanf(reader, "%d %d %d\n", &a, &b, &d)
		next[a] = b
		prev[b] = a
		pipe[a] = d
	}
	count := 0
	for i := 1;i <= n;i ++ {
		if prev[i] == 0 && next[i] != 0 {
			count ++
		}
	}
	fmt.Printf("%d\n", count)
	for i := 1;i <= n;i ++ {
		if prev[i] == 0 && next[i] != 0 {
			min := 1000000
			var j int
			for j = i;next[j] != 0;j = next[j] {
				if min > pipe[i] {
					min = pipe[i]
				}
			}
			fmt.Printf("%d %d %d\n", i, j, min)
		}
	}
}


You are given two integers $$$n$$$ and $$$m$$$ ($$$m < n$$$). Consider a convex regular polygon of $$$n$$$ vertices. Recall that a regular polygon is a polygon that is equiangular (all angles are equal in measure) and equilateral (all sides have the same length).  Examples of convex regular polygons Your task is to say if it is possible to build another convex regular polygon with $$$m$$$ vertices such that its center coincides with the center of the initial polygon and each of its vertices is some vertex of the initial polygon.You have to answer $$$t$$$ independent test cases.

The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. Each test case is given as two space-separated integers $$$n$$$ and $$$m$$$ ($$$3 \le m < n \le 100$$$) — the number of vertices in the initial polygon and the number of vertices in the polygon you want to build.

For each test case, print the answer — "YES" (without quotes), if it is possible to build another convex regular polygon with $$$m$$$ vertices such that its center coincides with the center of the initial polygon and each of its vertices is some vertex of the initial polygon and "NO" otherwise.

Note  The first test case of the example It can be shown that the answer for the second test case of the example is "NO".

package main

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

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

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int;
	fmt.Fscanf(in, "%d\n", &t)
	for ; t > 0; t-- {
		var n, m int
		fmt.Fscanf(in, "%d %d\n", &n, &m)
		if(n % m == 0) {
			fmt.Fprintf(out, "YES\n")
		} else {
			fmt.Fprintf(out, "NO\n")
		}
	}
}

package main

import "fmt"

func main() {
	var t int
	fmt.Scan(&t)
	for ; t > 0; t-- {
		var n, m int
		fmt.Scan(&n, &m)
		if n%m == 0 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := int64(1)
	fmt.Fscanf(in, "%d\n", &t)
	//fmt.Println("debug", t)
	for tt := int64(0); tt < t; tt++ {
		n, m := 0, 0
		fmt.Fscanf(in, "%d %d\n", &n, &m)
		if n%m == 0 {
			fmt.Fprintf(out, "YES\n")
		} else {
			fmt.Fprintf(out, "NO\n")
		}
	}
	return
}

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

func same(s string, ss string) bool {
	a := make([]int, 26)
	for i := 0; i < len(s); i++ {
		b := int(s[i] - 'a')
		a[b]++
	}
	for i := 0; i < len(ss); i++ {
		b := int(ss[i] - 'a')
		a[b]--
		if a[b] == -1 {
			return false
		}
	}
	for i := 0; i < 26; i++ {
		if a[i] != 0 {
			return false
		}
	}
	return true
}

package main

import ("fmt")

func calculate(y,d int32){
	answer := y%d
	if answer==0{
		fmt.Println("YES")
	}else{
		fmt.Println("NO")
	}
}

func main(){
	var t int
	fmt.Scanln(&t)
	for i:=0;i<t;i++{
		var x int32
		var y int32
		fmt.Scan(&x,&y)
		calculate(x,y)
	}
}

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.Fscanf(reader,"%d\n",&t)

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

		if n % x == 0 {
			fmt.Fprint(writer,"YES\n")
		}else {
			fmt.Fprint(writer,"NO\n")
		}
	}
}

package main

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

func main() {
	defer writer.Flush()

	var tests int
	Input(&tests)

	for t := 1; t <= tests; t++ {
		var n, m int
		Input(&n, &m)

		if n < m {
			n, m = m, n
		}

		if n % m == 0 {
			Print("YES\n")
		} else {
			Print("NO\n")
		}

	}
}

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

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

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

package main

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

func main() {
	defer writer.Flush()

	var tests int
	Input("%d\n", &tests)

	for t := 1; t <= tests; t++ {
		var n, m int
		Input("%d %d\n", &n, &m)

		if n < m {
			n, m = m, n
		}

		if n % m == 0 {
			Print("YES\n")
		} else {
			Print("NO\n")
		}

	}
}

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

func Input(f string, a ...interface{}) {
	_, _ = fmt.Fscanf(reader, f, a...)
}

func Print(f string, a ...interface{}) {
	_, _ = fmt.Fprintf(writer, f, a...)
}

package main

import (
	"fmt"
)

func main() {
	var cases int
	fmt.Scanf("%d\n", &cases)
	for i := 0; i < cases; i++ {
		var n,m int
		fmt.Scanf("%d %d\n", &n, &m)
		if n % m == 0 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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.Fscanf(r, "%d\n", &t)

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

		if n%m == 0 {
			fmt.Fprint(w, "YES\n")
		} else {
			fmt.Fprint(w, "NO\n")
		}
	}
}

package main

import "fmt"

func main(){
	var T ,n,m int
	fmt.Scanf("%d\n",&T)
	for i:=0; i<T; i++ {
		fmt.Scanf("%d %d\n", &n, &m)
		if n%m == 0 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

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

	var t, n, m int
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &n, &m)
		Fprintln(out, map[bool]string{true: "YES", false: "NO"} [n%m == 0])
	}
}

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

package main

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

func main() {
	for testCase := scanInt(); testCase > 0; testCase--{
		n , m := scanInt(), scanInt()
		if m > n {
			printFmt("NO")
		}else{
			if n % m == 0{
				printFmt("YES")
			}else{
				printFmt("NO")
			}
		}

	}
	close(channelType)
	oWg.Wait()
}

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

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

func init() {
	printFmt = fmt.Println

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

	channelType = 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 channelType {
			writer.WriteString(line + "\n")
		}
	}()
}

func scanString() string {in.Scan(); return in.Text() }
func scanInt() int {i, _ := strconv.Atoi(scanString()); return i}
func scanInt64() int64 {i, _ := strconv.ParseInt(scanString(), 10, 64); return i}
func scanStringSlice(n int) []string {s := make([]string, n); for i := 0; i < n; i++ {s[i] = scanString()}; 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 stringEquivalent(v interface{}) string {return fmt.Sprintf("%v", v)}
func spaceSeperatedStringFromArray(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 spaceSeperatedStringFromArray64(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 minMaxFromArray(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 minElementFromArray(args ...int64) int64 { mn, _ := minMaxFromArray(args...); return mn }
func maxElementFromArray(args ...int64) int64 { _, mx := minMaxFromArray(args...); return mx }
func lcmCalculation(a, b int64) int64 {return a / gcdCalculation(a, b) * b}
func gcdCalculation(a, b int64) int64 {if (a == 0) {return b}; return gcdCalculation(b%a, a)}
func sortInt64Slice(a []int64) {sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })}
func absoluteValue(x int64) int64 {if x < 0 {return -x}; return x}
func min(args ...int) int { mn, _ := minMaxFinder(args...); return mn }
func max(args ...int) int { _, mx := minMaxFinder(args...); return mx }
func minMaxFinder(args ...int) (int, int) { minVal, maxVal := int(math.MaxInt32), int(math.MinInt32); for _, v := range args { if v < minVal { minVal = v }; if v > maxVal { maxVal = v } }; return minVal, maxVal }

package main

import "fmt"

func main() {
	var n, a, b int

	fmt.Scanf("%d\n", &n)

	for i := 1; i <= n; i++ {
		fmt.Scanf("%d %d\n", &a, &b)
		if a%b == 0 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

func main() {
	for t := ReadInt(); t > 0; t-- {
		n:=ReadInt()
		m:=ReadInt()
		if n%m==0{
			fmt.Println("YES")
		} else{
			fmt.Println("NO")
		}
	}
}

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

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

var out chan string
var in *bufio.Scanner
var outWg *sync.WaitGroup

func ReadString() string {
	in.Scan()
	return in.Text()
}
func ReadStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ReadString()
	}
	return s
}
func ReadInt() int {
	intStr := ReadString()
	i, _ := strconv.ParseInt(intStr, 10, 32)
	return int(i)
}
func ReadInt64() int64 {
	intstr := ReadString()
	i, _ := strconv.ParseInt(intstr, 10, 64)
	return int64(i)
}
func ReadIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ReadInt()
	}
	return arr
}
func init() {
	//set input
	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(2e+5))
	in.Split(bufio.ScanWords)

	//set output
	out = make(chan string, 16)
	outWg = &sync.WaitGroup{}
	outWg.Add(1)

	writer := bufio.NewWriterSize(os.Stdout, int(2e+5))
	go func(write *bufio.Writer) {
		defer outWg.Done()
		defer write.Flush()

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

package main

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

const INFINITY = math.MaxInt32/2 - 1

func exec(stdin *Stdin, stdout *Stdout) {
	t := stdin.ReadInt()
	for i := 0; i < t; i++ {
		n := stdin.ReadInt()
		m := stdin.ReadInt()
		if n%m == 0 {
			stdout.Println("YES")
		} else {
			stdout.Println("NO")
		}
	}
}

func main() {
	stdout := NewStdout()
	defer stdout.Flush()
	exec(NewStdin(bufio.ScanWords), stdout)
}

type Stdin struct {
	stdin *bufio.Scanner
}

func NewStdin(split bufio.SplitFunc) *Stdin {
	s := Stdin{bufio.NewScanner(os.Stdin)}
	s.stdin.Split(split)
	s.stdin.Buffer(make([]byte, bufio.MaxScanTokenSize), INFINITY)
	return &s
}

func (s *Stdin) Read() string {
	s.stdin.Scan()
	return s.stdin.Text()
}

func (s *Stdin) ReadInt() int {
	n, _ := strconv.Atoi(s.Read())
	return n
}

func (s *Stdin) ReadFloat64() float64 {
	n, _ := strconv.ParseFloat(s.Read(), 64)
	return n
}

func (s *Stdin) ReadIntSlice(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = s.ReadInt()
	}
	return a
}

func (s *Stdin) ReadStringSlice(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = s.Read()
	}
	return a
}

func (s *Stdin) ReadFloat64Slice(n int) []float64 {
	a := make([]float64, n)
	for i := 0; i < n; i++ {
		a[i] = s.ReadFloat64()
	}
	return a
}

type Stdout struct {
	stdout *bufio.Writer
}

func NewStdout() *Stdout {
	return &Stdout{bufio.NewWriter(os.Stdout)}
}

func (s *Stdout) Flush() {
	s.stdout.Flush()
}

func (s *Stdout) Println(a ...interface{}) {
	fmt.Fprintln(s.stdout, a...)
}

func Min(a int, b ...int) int {
	for _, v := range b {
		if v < a {
			a = v
		}
	}
	return a
}

func Max(a int, b ...int) int {
	for _, v := range b {
		if a < v {
			a = v
		}
	}
	return a
}

func Abs(x int) int {
	if x > 0 {
		return x
	} else {
		return x * -1
	}
}

func Pow(x, y int) int {
	z := 1
	for y > 0 {
		if y%2 == 0 {
			x *= x
			y /= 2
		} else {
			z *= x
			y -= 1
		}
	}
	return z
}

func IsPrime(x int) bool {
	if x < 2 {
		return false
	}

	for i := 2; i*i <= x; i++ {
		if x%i == 0 {
			return false
		}
	}
	return true
}

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

	for y > 0 {
		x, y = y, x%y
	}

	return x
}

func Lcm(x, y int) int {
	return x * y / Gcd(x, y)
}

func CeilDiv(x, y int) int {
	if x%y == 0 {
		return x / y
	} else {
		return x/y + 1
	}
}

func LCS(s, t string) string {
	n := len(s)
	m := len(t)
	dp := make([][]int, n+1)
	for i := 0; i <= n; i++ {
		dp[i] = make([]int, m+1)
	}

	for i := 1; i <= n; i++ {
		for j := 1; j <= m; j++ {
			if s[i-1] == t[j-1] {
				dp[i][j] = dp[i-1][j-1] + 1
			} else {
				dp[i][j] = Max(dp[i-1][j], dp[i][j-1])
			}
		}
	}

	x := n
	y := m
	u := make([]byte, dp[n][m])
	i := dp[n][m] - 1
	for x > 0 && y > 0 {
		if dp[x][y] == dp[x-1][y] {
			x--
		} else if dp[x][y] == dp[x][y-1] {
			y--
		} else {
			x--
			y--
			u[i] = s[x]
			i--
		}
	}

	return string(u)
}

// [0..n) から r個選んだ組合せを生成する。
// r < 0 の場合はすべての組合せを生成する。
func Combinations(n int, r int) [][]int {
	a := [][]int{}
	for i := uint(0); i < (1 << uint(n)); i++ {
		b := []int{}
		for j := uint(0); j < uint(n); j++ {
			if i&(uint(1)<<j) != 0 {
				b = append(b, int(j))
			}
		}

		if r < 0 || len(b) == r {
			a = append(a, b)
		}
	}
	return a
}

// [0..n)の順列を生成する。
func Permutations(n int) [][]int {
	type e struct {
		bit uint
		a   []int
	}

	q := []*e{}
	for i := 0; i < n; i++ {
		q = append(q, &e{bit: 1 << uint(i), a: []int{i}})
	}

	p := [][]int{}
	for x := 0; x < len(q); x++ {
		cur := q[x]
		if cur.bit == (1<<uint(n) - 1) {
			p = append(p, cur.a)
			continue
		}

		for i := 0; i < n; i++ {
			if cur.bit&(1<<uint(i)) != 0 {
				continue
			}

			m := len(cur.a) + 1
			b := make([]int, m)
			copy(b, cur.a)
			b[m-1] = i
			q = append(q, &e{bit: cur.bit | (1 << uint(i)), a: b})
		}
	}
	return p
}

func ReverseSlice(v interface{}) {
	if reflect.TypeOf(v).Kind() == reflect.Slice {
		slice := reflect.ValueOf(v)
		for i1, n := 0, slice.Len(); i1 < n/2; i1++ {
			i2 := n - i1 - 1
			v1 := reflect.ValueOf(slice.Index(i1).Interface())
			slice.Index(i1).Set(slice.Index(i2))
			slice.Index(i2).Set(v1)
		}
	}
}

func ReverseString(s string) string {
	t := []rune(s)
	ReverseSlice(t)
	return string(t)
}

func ToStringSlice(slice interface{}) []string {
	// 本来はerrを返却すべき。 利用する側(=自分)は引数がsliceであることを知っている。
	if reflect.TypeOf(slice).Kind() != reflect.Slice {
		panic(fmt.Sprintf("%v is not slice", slice))
	}

	src := reflect.ValueOf(slice)
	n := src.Len()
	dst := make([]string, n)
	for i := 0; i < n; i++ {
		dst[i] = fmt.Sprintf("%v", src.Index(i))
	}
	return dst
}

func CreateMatrix(x, y int) [][]int {
	matrix := make([][]int, x)
	for i := 0; i < x; i++ {
		matrix[i] = make([]int, y)
	}
	return matrix
}

package main

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

const INFINITY = math.MaxInt32/2 - 1

func exec(stdin *Stdin, stdout *Stdout) {
	stdout.Println(32 << (^uint(0) >> 63))

	t := stdin.ReadInt()
	for i := 0; i < t; i++ {
		n := stdin.ReadInt()
		m := stdin.ReadInt()
		if n%m == 0 {
			stdout.Println("YES")
		} else {
			stdout.Println("NO")
		}
	}
}

func main() {
	stdout := NewStdout()
	defer stdout.Flush()
	exec(NewStdin(bufio.ScanWords), stdout)
}

type Stdin struct {
	stdin *bufio.Scanner
}

func NewStdin(split bufio.SplitFunc) *Stdin {
	s := Stdin{bufio.NewScanner(os.Stdin)}
	s.stdin.Split(split)
	s.stdin.Buffer(make([]byte, bufio.MaxScanTokenSize), INFINITY)
	return &s
}

func (s *Stdin) Read() string {
	s.stdin.Scan()
	return s.stdin.Text()
}

func (s *Stdin) ReadInt() int {
	n, _ := strconv.Atoi(s.Read())
	return n
}

func (s *Stdin) ReadFloat64() float64 {
	n, _ := strconv.ParseFloat(s.Read(), 64)
	return n
}

func (s *Stdin) ReadIntSlice(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = s.ReadInt()
	}
	return a
}

func (s *Stdin) ReadStringSlice(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = s.Read()
	}
	return a
}

func (s *Stdin) ReadFloat64Slice(n int) []float64 {
	a := make([]float64, n)
	for i := 0; i < n; i++ {
		a[i] = s.ReadFloat64()
	}
	return a
}

type Stdout struct {
	stdout *bufio.Writer
}

func NewStdout() *Stdout {
	return &Stdout{bufio.NewWriter(os.Stdout)}
}

func (s *Stdout) Flush() {
	s.stdout.Flush()
}

func (s *Stdout) Println(a ...interface{}) {
	fmt.Fprintln(s.stdout, a...)
}

func Min(a int, b ...int) int {
	for _, v := range b {
		if v < a {
			a = v
		}
	}
	return a
}

func Max(a int, b ...int) int {
	for _, v := range b {
		if a < v {
			a = v
		}
	}
	return a
}

func Abs(x int) int {
	if x > 0 {
		return x
	} else {
		return x * -1
	}
}

func Pow(x, y int) int {
	z := 1
	for y > 0 {
		if y%2 == 0 {
			x *= x
			y /= 2
		} else {
			z *= x
			y -= 1
		}
	}
	return z
}

func IsPrime(x int) bool {
	if x < 2 {
		return false
	}

	for i := 2; i*i <= x; i++ {
		if x%i == 0 {
			return false
		}
	}
	return true
}

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

	for y > 0 {
		x, y = y, x%y
	}

	return x
}

func Lcm(x, y int) int {
	return x * y / Gcd(x, y)
}

func CeilDiv(x, y int) int {
	if x%y == 0 {
		return x / y
	} else {
		return x/y + 1
	}
}

func LCS(s, t string) string {
	n := len(s)
	m := len(t)
	dp := make([][]int, n+1)
	for i := 0; i <= n; i++ {
		dp[i] = make([]int, m+1)
	}

	for i := 1; i <= n; i++ {
		for j := 1; j <= m; j++ {
			if s[i-1] == t[j-1] {
				dp[i][j] = dp[i-1][j-1] + 1
			} else {
				dp[i][j] = Max(dp[i-1][j], dp[i][j-1])
			}
		}
	}

	x := n
	y := m
	u := make([]byte, dp[n][m])
	i := dp[n][m] - 1
	for x > 0 && y > 0 {
		if dp[x][y] == dp[x-1][y] {
			x--
		} else if dp[x][y] == dp[x][y-1] {
			y--
		} else {
			x--
			y--
			u[i] = s[x]
			i--
		}
	}

	return string(u)
}

// [0..n) から r個選んだ組合せを生成する。
// r < 0 の場合はすべての組合せを生成する。
func Combinations(n int, r int) [][]int {
	a := [][]int{}
	for i := uint(0); i < (1 << uint(n)); i++ {
		b := []int{}
		for j := uint(0); j < uint(n); j++ {
			if i&(uint(1)<<j) != 0 {
				b = append(b, int(j))
			}
		}

		if r < 0 || len(b) == r {
			a = append(a, b)
		}
	}
	return a
}

// [0..n)の順列を生成する。
func Permutations(n int) [][]int {
	type e struct {
		bit uint
		a   []int
	}

	q := []*e{}
	for i := 0; i < n; i++ {
		q = append(q, &e{bit: 1 << uint(i), a: []int{i}})
	}

	p := [][]int{}
	for x := 0; x < len(q); x++ {
		cur := q[x]
		if cur.bit == (1<<uint(n) - 1) {
			p = append(p, cur.a)
			continue
		}

		for i := 0; i < n; i++ {
			if cur.bit&(1<<uint(i)) != 0 {
				continue
			}

			m := len(cur.a) + 1
			b := make([]int, m)
			copy(b, cur.a)
			b[m-1] = i
			q = append(q, &e{bit: cur.bit | (1 << uint(i)), a: b})
		}
	}
	return p
}

func ReverseSlice(v interface{}) {
	if reflect.TypeOf(v).Kind() == reflect.Slice {
		slice := reflect.ValueOf(v)
		for i1, n := 0, slice.Len(); i1 < n/2; i1++ {
			i2 := n - i1 - 1
			v1 := reflect.ValueOf(slice.Index(i1).Interface())
			slice.Index(i1).Set(slice.Index(i2))
			slice.Index(i2).Set(v1)
		}
	}
}

func ReverseString(s string) string {
	t := []rune(s)
	ReverseSlice(t)
	return string(t)
}

func ToStringSlice(slice interface{}) []string {
	// 本来はerrを返却すべき。 利用する側(=自分)は引数がsliceであることを知っている。
	if reflect.TypeOf(slice).Kind() != reflect.Slice {
		panic(fmt.Sprintf("%v is not slice", slice))
	}

	src := reflect.ValueOf(slice)
	n := src.Len()
	dst := make([]string, n)
	for i := 0; i < n; i++ {
		dst[i] = fmt.Sprintf("%v", src.Index(i))
	}
	return dst
}

func CreateMatrix(x, y int) [][]int {
	matrix := make([][]int, x)
	for i := 0; i < x; i++ {
		matrix[i] = make([]int, y)
	}
	return matrix
}


Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras. Inspired by this adventure and an accidentally found plasticine pack (represented as a sequence of black and white stripes), Grisha now wants to select several consequent (contiguous) pieces of alternating colors to create a zebra. Let's call the number of selected pieces the length of the zebra.Before assembling the zebra Grisha can make the following operation $$$0$$$ or more times. He splits the sequence in some place into two parts, then reverses each of them and sticks them together again. For example, if Grisha has pieces in the order "bwbbw" (here 'b' denotes a black strip, and 'w' denotes a white strip), then he can split the sequence as bw|bbw (here the vertical bar represents the cut), reverse both parts and obtain "wbwbb".Determine the maximum possible length of the zebra that Grisha can produce.

The only line contains a string $$$s$$$ ($$$1 \le |s| \le 10^5$$$, where $$$|s|$$$ denotes the length of the string $$$s$$$) comprised of lowercase English letters 'b' and 'w' only, where 'w' denotes a white piece and 'b' denotes a black piece.

Print a single integer — the maximum possible zebra length.

NoteIn the first example one of the possible sequence of operations is bwwwbww|bw $$$\to$$$ w|wbwwwbwb $$$\to$$$ wbwbwwwbw, that gives the answer equal to $$$5$$$.In the second example no operation can increase the answer.

package main

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

func main()  {

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

	var s string
	fmt.Fscan(in, &s)

	n := len(s)
	max, cnt := 1, 1

	for i := 1; i < 2 * n; i++ {
		if  i == n {
			if s[0] != s[n - 1] {
				cnt++
			} else {
				break
			}
		} else if i > n {
			if s[i - n] != s[i - n - 1] {
				cnt++
			} else {
				break
			}
		} else {
			if s[i] != s[i - 1] {
				cnt++
			} else {
				if max < cnt {
					max = cnt
				}
				cnt = 1
			}
		}

	}
	if max < cnt {
		max = cnt
	}
	if max > n {
		max = n
	}

	fmt.Fprintln(out, max)

}