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)
	used := make([]bool, n)
	totalc := make(map[int][]int)
	ac := make(map[int][]int)
	ec := make(map[int][]int)
	ic := make(map[int][]int)
	oc := make(map[int][]int)
	uc := make(map[int][]int)
	a := make([]string, n)
	for i := 0; i < n; i++ {
		s := ""
		fmt.Fscanf(in, "%s\n", &s)
		a[i] = s
		cnt := 0
		lv := 'a'
		for _, c := range s {
			if c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' {
				cnt++
				lv = c
			}
		}
		totalc[cnt] = append(totalc[cnt], i)
		if lv == 'a' {
			ac[cnt] = append(ac[cnt], i)
		} else if lv == 'e' {
			ec[cnt] = append(ec[cnt], i)
		} else if lv == 'i' {
			ic[cnt] = append(ic[cnt], i)
		} else if lv == 'o' {
			oc[cnt] = append(oc[cnt], i)
		} else if lv == 'u' {
			uc[cnt] = append(uc[cnt], i)
		}
	}

	tp := 0
	for _, v := range totalc {
		tp += len(v) / 2
	}

	canLast := [][]string{}
	for _, v := range ac {
		for j := 0; j < len(v); j += 2 {
			if j+1 == len(v) {
				continue
			}
			if len(canLast) >= tp/2 {
				break
			}
			canLast = append(canLast, []string{a[v[j]], a[v[j+1]]})
			used[v[j]] = true
			used[v[j+1]] = true
		}
	}
	for _, v := range ec {
		for j := 0; j < len(v); j += 2 {
			if j+1 == len(v) {
				continue
			}
			if len(canLast) >= tp/2 {
				break
			}
			canLast = append(canLast, []string{a[v[j]], a[v[j+1]]})
			used[v[j]] = true
			used[v[j+1]] = true
		}
	}
	for _, v := range ic {
		for j := 0; j < len(v); j += 2 {
			if j+1 == len(v) {
				continue
			}
			if len(canLast) >= tp/2 {
				break
			}
			canLast = append(canLast, []string{a[v[j]], a[v[j+1]]})
			used[v[j]] = true
			used[v[j+1]] = true
		}
	}
	for _, v := range oc {
		for j := 0; j < len(v); j += 2 {
			if j+1 == len(v) {
				continue
			}
			if len(canLast) >= tp/2 {
				break
			}
			canLast = append(canLast, []string{a[v[j]], a[v[j+1]]})
			used[v[j]] = true
			used[v[j+1]] = true
		}
	}
	for _, v := range uc {
		for j := 0; j < len(v); j += 2 {
			if j+1 == len(v) {
				continue
			}
			if len(canLast) >= tp/2 {
				break
			}
			canLast = append(canLast, []string{a[v[j]], a[v[j+1]]})
			used[v[j]] = true
			used[v[j+1]] = true
		}
	}

	// fmt.Println(used)
	// fmt.Println(canLast)

	first := [][]string{}
	for _, v := range totalc {
		valid := []int{}
		for j := 0; j < len(v); j++ {
			if !used[v[j]] {
				valid = append(valid, v[j])
			}
		}
		for j := 0; j < len(valid); j += 2 {
			if j+1 == len(valid) {
				break
			}
			first = append(first, []string{a[valid[j]], a[valid[j+1]]})
		}
	}
	fmt.Fprintf(out, "%d\n", len(canLast))
	for i := 0; i < len(canLast); i++ {
		fmt.Fprintf(out, "%s %s\n", first[i][0], canLast[i][0])
		fmt.Fprintf(out, "%s %s\n", first[i][1], canLast[i][1])
	}
	return
}

// find num of elem >= k
func find(a []int, k int) int {
	if len(a) == 0 {
		return 0
	}
	n := len(a)
	if a[0] > k {
		return n
	}
	if a[n-1] < k {
		return 0
	}
	l := 0
	r := len(a) - 1
	for l < r {
		mid := (l + r) / 2
		if a[mid] < k {
			l = mid + 1
		} else {
			r = mid
		}
	}
	return n - l
}

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
}

// Author: sighduck
// URL: https://codeforces.com/contest/1182/problem/C

package main

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

type VowelData struct {
	vowelCount int
	lastVowel  string
}

type Pair struct {
	word1 string
	word2 string
}

type Lyrics struct {
	line1word1 string
	line1word2 string
	line2word1 string
	line2word2 string
}

func parseString(s string) VowelData {
	vowelData := VowelData{}
	for i := 0; i < len(s); i++ {
		if strings.Contains("aeiou", string(s[i])) {
			vowelData.vowelCount += 1
			vowelData.lastVowel = string(s[i])
		}
	}
	return vowelData
}

func processPairs(lastVowelPairs []Pair, vowelCountPairs []Pair, results []Lyrics) []Lyrics {
	if len(lastVowelPairs) == 0 {
		return results
	}
	if len(vowelCountPairs) > 0 {
		var lastVowelPair, vowelCountPair Pair
		lastVowelPair, lastVowelPairs = lastVowelPairs[len(lastVowelPairs)-1], lastVowelPairs[:len(lastVowelPairs)-1]
		vowelCountPair, vowelCountPairs = vowelCountPairs[len(vowelCountPairs)-1], vowelCountPairs[:len(vowelCountPairs)-1]
		lyrics := Lyrics{
			line1word1: vowelCountPair.word1,
			line1word2: lastVowelPair.word1,
			line2word1: vowelCountPair.word2,
			line2word2: lastVowelPair.word2,
		}
		results = append(results, lyrics)
		return processPairs(lastVowelPairs, vowelCountPairs, results)
	}
	if len(lastVowelPairs) >= 2 {
		var lastVowelPair1, lastVowelPair2 Pair
		lastVowelPair1, lastVowelPairs = lastVowelPairs[len(lastVowelPairs)-1], lastVowelPairs[:len(lastVowelPairs)-1]
		lastVowelPair2, lastVowelPairs = lastVowelPairs[len(lastVowelPairs)-1], lastVowelPairs[:len(lastVowelPairs)-1]
		lyrics := Lyrics{
			line1word1: lastVowelPair1.word1,
			line1word2: lastVowelPair2.word1,
			line2word1: lastVowelPair1.word2,
			line2word2: lastVowelPair2.word2,
		}
		results = append(results, lyrics)
		return processPairs(lastVowelPairs, vowelCountPairs, results)
	}
	return results
}

func Solve(n int, stringList []string) []Lyrics {
	vowelMap := make(map[int]map[string][]string)
	for _, s := range stringList {
		vowelData := parseString(s)
		if vowelMap[vowelData.vowelCount] == nil {
			vowelMap[vowelData.vowelCount] = make(map[string][]string)
		}
		vowelMap[vowelData.vowelCount][vowelData.lastVowel] = append(
			vowelMap[vowelData.vowelCount][vowelData.lastVowel],
			s,
		)
	}
	var lastVowelPairs []Pair
	for count, vowelWordMap := range vowelMap {
		for vowel, _ := range vowelWordMap {
			if len(vowelMap[count][vowel]) != 1 {
				for len(vowelMap[count][vowel]) > 1 {
					var word1, word2 string
					word1, vowelMap[count][vowel] = vowelMap[count][vowel][len(vowelMap[count][vowel])-1], vowelMap[count][vowel][:len(vowelMap[count][vowel])-1]
					word2, vowelMap[count][vowel] = vowelMap[count][vowel][len(vowelMap[count][vowel])-1], vowelMap[count][vowel][:len(vowelMap[count][vowel])-1]
					lastVowelPairs = append(lastVowelPairs, Pair{word1: word1, word2: word2})
				}
			}
		}
	}
	var vowelCountPairs []Pair
	for _, vowelWordMap := range vowelMap {
		var wordList []string
		for _, words := range vowelWordMap {
			if len(words) == 1 {
				wordList = append(wordList, words[0])
			}
		}
		for len(wordList) > 1 {
			var word1, word2 string
			word1, wordList = wordList[len(wordList)-1], wordList[:len(wordList)-1]
			word2, wordList = wordList[len(wordList)-1], wordList[:len(wordList)-1]
			vowelCountPairs = append(vowelCountPairs, Pair{word1: word1, word2: word2})
		}
	}
	return processPairs(lastVowelPairs, vowelCountPairs, []Lyrics{})
}

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

	var n int
	fmt.Fscanf(reader, "%d\n", &n)
	stringList := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(reader, "%s\n", &stringList[i])
	}
	solution := Solve(n, stringList)
	fmt.Fprintf(writer, "%d\n", len(solution))
	for _, lyrics := range solution {
		fmt.Fprintf(writer, "%s %s\n", lyrics.line1word1, lyrics.line1word2)
		fmt.Fprintf(writer, "%s %s\n", lyrics.line2word1, lyrics.line2word2)
	}
}

// Author: sighduck
// URL: https://codeforces.com/contest/1182/problem/C

package main

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

type VowelData struct {
	vowelCount int
	lastVowel  string
}

type Pair struct {
	word1 string
	word2 string
}

type Lyrics struct {
	line1word1 string
	line1word2 string
	line2word1 string
	line2word2 string
}

func parseString(s string) VowelData {
	vowelData := VowelData{}
	for i := 0; i < len(s); i++ {
		if strings.Contains("aeiou", string(s[i])) {
			vowelData.vowelCount += 1
			vowelData.lastVowel = string(s[i])
		}
	}
	return vowelData
}

func processPairs(lastVowelPairs []Pair, vowelCountPairs []Pair, results []Lyrics) []Lyrics {
	if len(lastVowelPairs) == 0 {
		return results
	}
	if len(vowelCountPairs) > 0 {
		var lastVowelPair, vowelCountPair Pair
		lastVowelPair, lastVowelPairs = lastVowelPairs[len(lastVowelPairs)-1], lastVowelPairs[:len(lastVowelPairs)-1]
		vowelCountPair, vowelCountPairs = vowelCountPairs[len(vowelCountPairs)-1], vowelCountPairs[:len(vowelCountPairs)-1]
		lyrics := Lyrics{
			line1word1: vowelCountPair.word1,
			line1word2: lastVowelPair.word1,
			line2word1: vowelCountPair.word2,
			line2word2: lastVowelPair.word2,
		}
		results = append(results, lyrics)
		return processPairs(lastVowelPairs, vowelCountPairs, results)
	}
	if len(lastVowelPairs) == 2 {
		var lastVowelPair1, lastVowelPair2 Pair
		lastVowelPair1, lastVowelPairs = lastVowelPairs[len(lastVowelPairs)-1], lastVowelPairs[:len(lastVowelPairs)-1]
		lastVowelPair2, lastVowelPairs = lastVowelPairs[len(lastVowelPairs)-1], lastVowelPairs[:len(lastVowelPairs)-1]
		lyrics := Lyrics{
			line1word1: lastVowelPair1.word1,
			line1word2: lastVowelPair2.word1,
			line2word1: lastVowelPair1.word2,
			line2word2: lastVowelPair2.word2,
		}
		results = append(results, lyrics)
		return processPairs(lastVowelPairs, vowelCountPairs, results)
	}
	return results
}

func Solve(n int, stringList []string) []Lyrics {
	vowelMap := make(map[int]map[string][]string)
	for _, s := range stringList {
		vowelData := parseString(s)
		if vowelMap[vowelData.vowelCount] == nil {
			vowelMap[vowelData.vowelCount] = make(map[string][]string)
		}
		vowelMap[vowelData.vowelCount][vowelData.lastVowel] = append(
			vowelMap[vowelData.vowelCount][vowelData.lastVowel],
			s,
		)
	}
	var lastVowelPairs []Pair
	for count, vowelWordMap := range vowelMap {
		for vowel, _ := range vowelWordMap {
			if len(vowelMap[count][vowel]) != 1 {
				for len(vowelMap[count][vowel]) > 1 {
					var word1, word2 string
					word1, vowelMap[count][vowel] = vowelMap[count][vowel][len(vowelMap[count][vowel])-1], vowelMap[count][vowel][:len(vowelMap[count][vowel])-1]
					word2, vowelMap[count][vowel] = vowelMap[count][vowel][len(vowelMap[count][vowel])-1], vowelMap[count][vowel][:len(vowelMap[count][vowel])-1]
					lastVowelPairs = append(lastVowelPairs, Pair{word1: word1, word2: word2})
				}
			}
		}
	}
	var vowelCountPairs []Pair
	for _, vowelWordMap := range vowelMap {
		var wordList []string
		for _, words := range vowelWordMap {
			if len(words) == 1 {
				wordList = append(wordList, words[0])
			}
		}
		for len(wordList) > 1 {
			var word1, word2 string
			word1, wordList = wordList[len(wordList)-1], wordList[:len(wordList)-1]
			word2, wordList = wordList[len(wordList)-1], wordList[:len(wordList)-1]
			vowelCountPairs = append(vowelCountPairs, Pair{word1: word1, word2: word2})
		}
	}
	return processPairs(lastVowelPairs, vowelCountPairs, []Lyrics{})
}

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

	var n int
	fmt.Fscanf(reader, "%d\n", &n)
	stringList := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(reader, "%s\n", &stringList[i])
	}
	solution := Solve(n, stringList)
	fmt.Fprintf(writer, "%d\n", len(solution))
	for _, lyrics := range solution {
		fmt.Fprintf(writer, "%s %s\n", lyrics.line1word1, lyrics.line1word2)
		fmt.Fprintf(writer, "%s %s\n", lyrics.line2word1, lyrics.line2word2)
	}
}


package main

import (
	"fmt"
)

func main() {
	var n, x int
	fmt.Scanf("%d %d\n", &n, &x)
	prev := make([]int, n + 1)
	next := make([]int, n + 1)
	for i := 1;i <= n;i ++ {
		fmt.Scanf("%d", &prev[i])
		if prev[i] != 0 {
			next[prev[i]] = i
		}
	}

	queue := make([]int, 0, n)
	var wisePos int

	for i := 1;i <= n;i ++ {
		var isWise bool
		var length int
		if prev[i] == 0 {
			for cur := i; cur != 0; cur, length = next[cur], length + 1 {
				if x == cur {
					isWise = true
					wisePos = length + 1
					break
				}
			}
			if !isWise {
				queue = append(queue, length)
			}
		}
	}

	dp := make([]bool, n + 1)
	dp[0] = true
	for i := 0;i < len(queue);i ++ {
		for j := len(dp) - 1;j >= queue[i];j -- {
			if dp[j - queue[i]] {
				dp[j] = true
			}
		}
	}
	for i := 0;i < len(dp);i ++ {
		if dp[i] {
			fmt.Printf("%d\n", i + wisePos)
		}
	}
}


package main

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

var scanner *bufio.Scanner

func getI64() int64 {
  scanner.Scan()
  x, _ := strconv.ParseInt(scanner.Text(), 10, 64)
  return x
}
func getI() int {
  return int(getI64())
}
func getF() float64 {
  scanner.Scan()
  x, _ := strconv.ParseFloat(scanner.Text(), 64)
  return x
}
func getS() string {
  scanner.Scan()
  return scanner.Text()
}

func main() {
  inFile, _ := os.Open("input.txt")
  outFile, _ := os.Create("output.txt")
  scanner = bufio.NewScanner(inFile)
  scanner.Split(bufio.ScanWords)
  writer := bufio.NewWriter(outFile)
  defer writer.Flush()

  n := 2 * getI()
  count := map[int][]int{}
  for i := 1; i <= n; i++ {
    x := getI()
    count[x] = append(count[x], i)
  }
  for _, list := range count {
    if len(list) % 2 == 1 {
      writer.WriteString("-1\n")
      return
    }
  }
  for _, list := range count {
    for i := 0; i < len(list); i += 2 {
      writer.WriteString(fmt.Sprintf("%d %d\n", list[i], list[i+1]))
    }
  }
}

package main

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

func main() {
    var flag [50001]int
    var ans [300001][2]int
    var n int
    now:=0
    input, _ := os.Open("input.txt")
    defer input.Close()
    scanner := bufio.NewScanner(input)
    scanner.Split(bufio.ScanWords)
    output, _ := os.Create("output.txt")
    defer output.Close()
    writer := bufio.NewWriter(output)
    scanner.Scan()
    aa, _ := strconv.Atoi(scanner.Text())
    n=aa
    for i:=1;i<=2*n;i++ {
    	var x int
    	scanner.Scan()
    	bb, _ := strconv.Atoi(scanner.Text())
    	x=bb
    	if flag[x]!=0 {
    		ans[now][0]=flag[x]
    		ans[now][1]=i
    		now++
    		flag[x]=0
    	} else {
    		flag[x]=i
    	}
    }
    if now!=n {
    	writer.WriteString("-1")
    } else {
    	for i:=0;i<now;i++ {
    		writer.WriteString(strconv.Itoa(ans[i][0])+" "+strconv.Itoa(ans[i][1]))
    		    writer.WriteString("\n")
    	}
    }

    writer.Flush()
}

package main

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

type Card struct {
    v,p int
}

type CardSlice []Card

func (c CardSlice) Len() int { return len(c) }
func (c CardSlice) Swap(i,j int) { c[i], c[j] = c[j], c[i] }
func (c CardSlice) Less(i,j int) bool { return c[i].v < c[j].v }

func main() {
    input, _ := os.Open("input.txt")
    defer input.Close()
    output, _ := os.Create("output.txt")
    defer output.Close()
    scanner := bufio.NewScanner(input)
    scanner.Split(bufio.ScanWords)
    writer := bufio.NewWriter(output)

    ScanInts := func(a... *int) {
        for i := 0; i < len(a); i++ {
            scanner.Scan()
            *(a[i]), _ = strconv.Atoi(scanner.Text())
        }
    }

    var n int
    ScanInts(&n)
    a := make(CardSlice,2*n)
    for i := 0; i < 2*n; i++ {
        ScanInts(&a[i].v)
        a[i].p = i+1
    }
    sort.Sort(a)
    ok, ans := true, make([]string,0,n)
    for i := 0; i < (2*n); i += 2 {
        if a[i].v != a[i+1].v {
            ok = false
            break
        } else {
            ans = append(ans,strconv.Itoa(a[i].p)+" "+strconv.Itoa(a[i+1].p)+"\n")
        }
    }
    if ok {
        for i := 0; i < len(ans); i++ {
            writer.WriteString(ans[i])
        }
    } else {
        writer.WriteString("-1\n")
    }
    writer.Flush()
}

package main

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

func main() {
    var flag [50001]int
    var ans [300001][2]int
    var n int
    now:=0
    input, _ := os.Open("input.txt")
    defer input.Close()
    scanner := bufio.NewScanner(input)
    scanner.Split(bufio.ScanWords)
    output, _ := os.Create("output.txt")
    defer output.Close()
    writer := bufio.NewWriter(output)
    scanner.Scan()
    aa, _ := strconv.Atoi(scanner.Text())
    n=aa
    for i:=1;i<=2*n;i++ {
    	var x int
    	scanner.Scan()
    	bb, _ := strconv.Atoi(scanner.Text())
    	x=bb
    	if flag[x]!=0 {
    		ans[now][0]=flag[x]
    		now++
    		ans[now][1]=i
    		flag[x]=0
    	} else {
    		flag[x]=i
    	}
    }
    if now!=n {
    	writer.WriteString("-1")
    } else {
    	for i:=0;i<now;i++ {
    		writer.WriteString(strconv.Itoa(ans[i][0])+" "+strconv.Itoa(ans[i][1]))
    	}
    }
    writer.WriteString("\n")
    writer.Flush()
}


package main

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

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

	var T, n int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n)
		a := make([]int, n)
		for i := range a {
			Fscan(in, &a[i])
		}
		b := []int{}
		for i := 1; i < n; {
			st := i
			for i++; i < n && a[i] > a[i-1]; i++ {
			}
			b = append(b, i-st)
		}
		q := []int{b[0]}
		b = b[1:]
		ans := 1
		for len(q) > 0 && len(b) > 0 {
			ans++
			qq := q
			q = nil
			for _, sz := range qq {
				for ; sz > 0 && len(b) > 0; sz-- {
					q = append(q, b[0])
					b = b[1:]
				}
			}
		}
		Fprintln(out, ans)
	}
}

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

package main
import (
	"fmt"
	"bufio"
	"os"
)
func main() {
	rd := bufio.NewReader(os.Stdin)
	q := 0
	fmt.Fscan(rd, &q)
	for t := 0; t < q; t++ {
		n := 0
		fmt.Fscan(rd, &n)
		a := make([]int, n)
		for i := range a {
			fmt.Fscan(rd, &a[i])
		}
		var seg [][]int
		i := 1
		for i < n {
			j := i
			for j + 1 < n && a[j + 1] > a[j] {
				j++
			}
			seg = append(seg, []int{i, j})
			i = j + 1
		}
		res, cur, k, nxt := 1, 1, 0, 0
		for i, v := range seg {
			k++
			nxt += v[1] - v[0] + 1
			if k == cur {
				k, cur = 0, nxt
				nxt = 0
				if i < len(seg) - 1 {
					res++
				}
			}
  		}
  		fmt.Println(res)
	}
}

package main

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

// OutputBuffer implements a faster way to print values
type OutputBuffer struct {
	i      int
	memo   []byte
	writer io.Writer
}

// NewOutputBuffer returns an OutputBuffer initialized instance
func NewOutputBuffer(out io.Writer) *OutputBuffer {
	return &OutputBuffer{
		memo:   make([]byte, 1024*1024),
		writer: out,
	}
}

func (o *OutputBuffer) println(x int) {
	aux := make([]byte, 6)
	i := 0

	for x > 9 {
		aux[i] = byte(x%10) + '0'
		i++
		x /= 10
	}

	aux[i] = byte(x%10) + '0'
	i++

	for i > 0 {
		i--
		o.memo[o.i] = aux[i]
		o.i++
	}

	o.memo[o.i] = '\n'
	o.i++

	if o.i >= len(o.memo)-16 {
		o.flush()
	}
}

func (o *OutputBuffer) flush() {
	if o.i > 0 {
		o.writer.Write(o.memo[:o.i])
		o.i = 0
	}
}

// Test has each test definition
type Test struct {
	n   int
	arr []int
}

func readInt(b []byte, i int) (int, int) {
	var x int
	l := len(b)

	for ; b[i] < '0' || b[i] > '9'; i++ {
	}

	for ; i < l && b[i] >= '0' && b[i] <= '9'; i++ {
		x = (x << 3) + (x << 1) + int(b[i]&15)
	}

	return x, i
}

func processInput(in io.Reader) (int, []*Test) {
	buff, _ := ioutil.ReadAll(in)
	k := 0

	var t int
	t, k = readInt(buff, k)
	tests := make([]*Test, t)

	for i := 0; i < t; i++ {
		var n int
		n, k = readInt(buff, k)
		arr := make([]int, n)

		for j := 0; j < n; j++ {
			arr[j], k = readInt(buff, k)
		}

		tests[i] = &Test{
			n:   n,
			arr: arr[:],
		}
	}

	return t, tests
}

type node struct {
	x        int
	children []*node
}

func newNode(x int) *node {
	return &node{
		x:        x,
		children: make([]*node, 0),
	}
}

func maxDepth(u *node, depth int) int {
	max := depth
	for _, v := range u.children {
		vDepth := maxDepth(v, depth+1)
		if vDepth > max {
			max = vDepth
		}
	}
	return max
}

// Solution to Minimal Height Tree problem
func Solution(reader io.Reader, writer io.Writer) {
	out := NewOutputBuffer(writer)

	t, tests := processInput(reader)

	for _t := 0; _t < t; _t++ {
		test := tests[_t]
		n, arr := test.n, test.arr[:]

		ord := append(make([]*node, 0), newNode(1))
		cur := 0

		for i := 1; i < n; i++ {
			if arr[i] < arr[i-1] {
				cur++
			}
			x := newNode(arr[i])
			ord[cur].children = append(ord[cur].children, x)
			ord = append(ord, x)
		}

		ans := maxDepth(ord[0], 0)
		out.println(ans)
	}

	out.flush()
}

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

package main

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

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

	var T, n int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n)
		a := make([]int, n)
		for i := range a {
			Fscan(in, &a[i])
		}
		b := []int{}
		for i := 1; i < n; {
			st := i
			for i++; i < n && a[i] > a[i-1]; i++ {
			}
			b = append(b, i-st)
		}
		q := []int{b[0]}
		ans := 1
		for i, n := 1, len(b); i < n; {
			ans++
			qq := q
			q = nil
			for _, sz := range qq {
				for ; sz > 0 && i < n; sz-- {
					q = append(q, b[i])
					i++
				}
			}
		}
		Fprintln(out, ans)
	}
}

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

package main

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

// OutputBuffer implements a faster way to print values
type OutputBuffer struct {
	i      int
	memo   []byte
	writer io.Writer
}

// NewOutputBuffer returns an OutputBuffer initialized instance
func NewOutputBuffer(out io.Writer) *OutputBuffer {
	return &OutputBuffer{
		memo:   make([]byte, 1024*1024),
		writer: out,
	}
}

func (o *OutputBuffer) println(x int) {
	aux := make([]byte, 6)
	i := 0

	for x > 10 {
		aux[i] = byte(x%10) + '0'
		i++
		x /= 10
	}

	aux[i] = byte(x%10) + '0'
	i++

	for i > 0 {
		i--
		o.memo[o.i] = aux[i]
		o.i++
	}

	o.memo[o.i] = '\n'
	o.i++

	if o.i >= len(o.memo)-16 {
		o.flush()
	}
}

func (o *OutputBuffer) flush() {
	if o.i > 0 {
		o.writer.Write(o.memo[:o.i])
		o.i = 0
	}
}

// Test has each test definition
type Test struct {
	n   int
	arr []int
}

func readInt(b []byte, i int) (int, int) {
	var x int
	l := len(b)

	for ; b[i] < '0' || b[i] > '9'; i++ {
	}

	for ; i < l && b[i] >= '0' && b[i] <= '9'; i++ {
		x = (x << 3) + (x << 1) + int(b[i]&15)
	}

	return x, i
}

func processInput(in io.Reader) (int, []*Test) {
	buff, _ := ioutil.ReadAll(in)
	k := 0

	var t int
	t, k = readInt(buff, k)
	tests := make([]*Test, t)

	for i := 0; i < t; i++ {
		var n int
		n, k = readInt(buff, k)
		arr := make([]int, n)

		for j := 0; j < n; j++ {
			arr[j], k = readInt(buff, k)
		}

		tests[i] = &Test{
			n:   n,
			arr: arr[:],
		}
	}

	return t, tests
}

// Solution to Minimal Height Tree problem
func Solution(reader io.Reader, writer io.Writer) {
	out := NewOutputBuffer(writer)

	t, tests := processInput(reader)

	for _t := 0; _t < t; _t++ {
		test := tests[_t]
		n, arr := test.n, test.arr[:]

		depth := 1
		gapByDepth := make([]int, 2)

		for i := 2; i < n; i++ {
			if arr[i] > arr[i-1] {
				gapByDepth[depth]++
			} else {
				if gapByDepth[depth-1] == 0 {
					depth++
					gapByDepth = append(gapByDepth, 0)
				} else {
					gapByDepth[depth-1]--
				}
			}
		}

		out.println(depth)
	}

	out.flush()
}

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

package main

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

// OutputBuffer implements a faster way to print values
type OutputBuffer struct {
	i      int
	memo   []byte
	writer io.Writer
}

// NewOutputBuffer returns an OutputBuffer initialized instance
func NewOutputBuffer(out io.Writer) *OutputBuffer {
	return &OutputBuffer{
		memo:   make([]byte, 1024*1024),
		writer: out,
	}
}

func (o *OutputBuffer) println(x int) {
	aux := make([]byte, 6)
	i := 0

	for x > 10 {
		aux[i] = byte(x%10) + '0'
		i++
		x /= 10
	}

	aux[i] = byte(x%10) + '0'
	i++

	for i > 0 {
		i--
		o.memo[o.i] = aux[i]
		o.i++
	}

	o.memo[o.i] = '\n'
	o.i++

	if o.i >= len(o.memo)-16 {
		o.flush()
	}
}

func (o *OutputBuffer) flush() {
	if o.i > 0 {
		o.writer.Write(o.memo[:o.i])
		o.i = 0
	}
}

// Test has each test definition
type Test struct {
	n   int
	arr []int
}

func readInt(b []byte, i int) (int, int) {
	var x int
	l := len(b)

	for ; b[i] < '0' || b[i] > '9'; i++ {
	}

	for ; i < l && b[i] >= '0' && b[i] <= '9'; i++ {
		x = (x << 3) + (x << 1) + int(b[i]&15)
	}

	return x, i
}

func processInput(in io.Reader) (int, []*Test) {
	buff, _ := ioutil.ReadAll(in)
	k := 0

	var t int
	t, k = readInt(buff, k)
	tests := make([]*Test, t)

	for i := 0; i < t; i++ {
		var n int
		n, k = readInt(buff, k)
		arr := make([]int, n)

		for j := 0; j < n; j++ {
			arr[j], k = readInt(buff, k)
		}

		tests[i] = &Test{
			n:   n,
			arr: arr[:],
		}
	}

	return t, tests
}

// Solution to Minimal Height Tree problem
func Solution(reader io.Reader, writer io.Writer) {
	out := NewOutputBuffer(writer)

	t, tests := processInput(reader)

	for _t := 0; _t < t; _t++ {
		test := tests[_t]
		n, arr := test.n, test.arr[:]

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

		out.println(ans)
	}

	out.flush()
}

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

package main

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

// OutputBuffer implements a faster way to print values
type OutputBuffer struct {
	i      int
	memo   []byte
	writer io.Writer
}

// NewOutputBuffer returns an OutputBuffer initialized instance
func NewOutputBuffer(out io.Writer) *OutputBuffer {
	return &OutputBuffer{
		memo:   make([]byte, 1024*1024),
		writer: out,
	}
}

func (o *OutputBuffer) println(x int) {
	aux := make([]byte, 6)
	i := 0

	for x > 10 {
		aux[i] = byte(x%10) + '0'
		i++
		x /= 10
	}

	aux[i] = byte(x%10) + '0'
	i++

	for i > 0 {
		i--
		o.memo[o.i] = aux[i]
		o.i++
	}

	o.memo[o.i] = '\n'
	o.i++

	if o.i >= len(o.memo)-16 {
		o.flush()
	}
}

func (o *OutputBuffer) flush() {
	if o.i > 0 {
		o.writer.Write(o.memo[:o.i])
		o.i = 0
	}
}

// Test has each test definition
type Test struct {
	n   int
	arr []int
}

func readInt(b []byte, i int) (int, int) {
	var x int
	l := len(b)

	for ; b[i] < '0' || b[i] > '9'; i++ {
	}

	for ; i < l && b[i] >= '0' && b[i] <= '9'; i++ {
		x = (x << 3) + (x << 1) + int(b[i]&15)
	}

	return x, i
}

func processInput(in io.Reader) (int, []*Test) {
	buff, _ := ioutil.ReadAll(in)
	k := 0

	var t int
	t, k = readInt(buff, k)
	tests := make([]*Test, t)

	for i := 0; i < t; i++ {
		var n int
		n, k = readInt(buff, k)
		arr := make([]int, n)

		for j := 0; j < n; j++ {
			arr[j], k = readInt(buff, k)
		}

		tests[i] = &Test{
			n:   n,
			arr: arr[:],
		}
	}

	return t, tests
}

// Solution to Minimal Height Tree problem
func Solution(reader io.Reader, writer io.Writer) {
	out := NewOutputBuffer(writer)

	t, tests := processInput(reader)

	for _t := 0; _t < t; _t++ {
		test := tests[_t]
		n, arr := test.n, test.arr[:]

		ans := 1
		gap := 0

		for i := 2; i < n; i++ {
			if arr[i] < arr[i-1] {
				if gap > 0 {
					gap--
				} else {
					ans++
				}
			} else {
				gap++
			}
		}

		out.println(ans)
	}

	out.flush()
}

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

package main

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

// OutputBuffer implements a faster way to print values
type OutputBuffer struct {
	i      int
	memo   []byte
	writer io.Writer
}

// NewOutputBuffer returns an OutputBuffer initialized instance
func NewOutputBuffer(out io.Writer) *OutputBuffer {
	return &OutputBuffer{
		memo:   make([]byte, 1024*1024),
		writer: out,
	}
}

func (o *OutputBuffer) println(x int) {
	aux := make([]byte, 6)
	i := 0

	for x > 10 {
		aux[i] = byte(x%10) + '0'
		i++
		x /= 10
	}

	aux[i] = byte(x%10) + '0'
	i++

	for i > 0 {
		i--
		o.memo[o.i] = aux[i]
		o.i++
	}

	o.memo[o.i] = '\n'
	o.i++

	if o.i >= len(o.memo)-16 {
		o.flush()
	}
}

func (o *OutputBuffer) flush() {
	if o.i > 0 {
		o.writer.Write(o.memo[:o.i])
		o.i = 0
	}
}

// Test has each test definition
type Test struct {
	n   int
	arr []int
}

func readInt(b []byte, i int) (int, int) {
	var x int
	l := len(b)

	for ; b[i] < '0' || b[i] > '9'; i++ {
	}

	for ; i < l && b[i] >= '0' && b[i] <= '9'; i++ {
		x = (x << 3) + (x << 1) + int(b[i]&15)
	}

	return x, i
}

func processInput(in io.Reader) (int, []*Test) {
	buff, _ := ioutil.ReadAll(in)
	k := 0

	var t int
	t, k = readInt(buff, k)
	tests := make([]*Test, t)

	for i := 0; i < t; i++ {
		var n int
		n, k = readInt(buff, k)
		arr := make([]int, n)

		for j := 0; j < n; j++ {
			arr[j], k = readInt(buff, k)
		}

		tests[i] = &Test{
			n:   n,
			arr: arr[:],
		}
	}

	return t, tests
}

type node struct {
	x        int
	children []*node
}

func newNode(x int) *node {
	return &node{
		x:        x,
		children: make([]*node, 0),
	}
}

func maxDepth(u *node, depth int) int {
	max := depth
	for _, v := range u.children {
		vDepth := maxDepth(v, depth+1)
		if vDepth > max {
			max = vDepth
		}
	}
	return max
}

// Solution to Minimal Height Tree problem
func Solution(reader io.Reader, writer io.Writer) {
	out := NewOutputBuffer(writer)

	t, tests := processInput(reader)

	for _t := 0; _t < t; _t++ {
		test := tests[_t]
		n, arr := test.n, test.arr[:]

		ord := append(make([]*node, 0), newNode(1))
		cur := 0

		for i := 1; i < n; i++ {
			if arr[i] < arr[i-1] {
				cur++
			}
			x := newNode(arr[i])
			ord[cur].children = append(ord[cur].children, x)
			ord = append(ord, x)
		}

		ans := maxDepth(ord[0], 0)
		out.println(ans)
	}

	out.flush()
}

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

package main

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

// OutputBuffer implements a faster way to print values
type OutputBuffer struct {
	i      int
	memo   []byte
	writer io.Writer
}

// NewOutputBuffer returns an OutputBuffer initialized instance
func NewOutputBuffer(out io.Writer) *OutputBuffer {
	return &OutputBuffer{
		memo:   make([]byte, 1024*1024),
		writer: out,
	}
}

func (o *OutputBuffer) println(x int) {
	aux := make([]byte, 6)
	i := 0

	for x > 10 {
		aux[i] = byte(x%10) + '0'
		i++
		x /= 10
	}

	aux[i] = byte(x%10) + '0'
	i++

	for i > 0 {
		i--
		o.memo[o.i] = aux[i]
		o.i++
	}

	o.memo[o.i] = '\n'
	o.i++

	if o.i >= len(o.memo)-16 {
		o.flush()
	}
}

func (o *OutputBuffer) flush() {
	if o.i > 0 {
		o.writer.Write(o.memo[:o.i])
		o.i = 0
	}
}

// Test has each test definition
type Test struct {
	n   int
	arr []int
}

func readInt(b []byte, i int) (int, int) {
	var x int
	l := len(b)

	for ; b[i] < '0' || b[i] > '9'; i++ {
	}

	for ; i < l && b[i] >= '0' && b[i] <= '9'; i++ {
		x = (x << 3) + (x << 1) + int(b[i]&15)
	}

	return x, i
}

func processInput(in io.Reader) (int, []*Test) {
	buff, _ := ioutil.ReadAll(in)
	k := 0

	var t int
	t, k = readInt(buff, k)
	tests := make([]*Test, t)

	for i := 0; i < t; i++ {
		var n int
		n, k = readInt(buff, k)
		arr := make([]int, n)

		for j := 0; j < n; j++ {
			arr[j], k = readInt(buff, k)
		}

		tests[i] = &Test{
			n:   n,
			arr: arr[:],
		}
	}

	return t, tests
}

// Solution to Minimal Height Tree problem
func Solution(reader io.Reader, writer io.Writer) {
	out := NewOutputBuffer(writer)

	t, tests := processInput(reader)

	for _t := 0; _t < t; _t++ {
		test := tests[_t]
		n, arr := test.n, test.arr[:]

		depth := 1
		gapByDepth := make([]int, 2)

		for i := 1; i < n; i++ {
			if arr[i] > arr[i-1] {
				gapByDepth[depth]++
			} else {
				if gapByDepth[depth-1] == 0 {
					gapByDepth[depth]--
					depth++
					gapByDepth = append(gapByDepth, 1)
				} else {
					gapByDepth[depth-1]--
				}
			}
		}

		out.println(depth)
	}

	out.flush()
}

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

package main

import (
	"bufio"
	"container/heap"
	. "fmt"
	"io"
	"os"
)

// github.com/EndlessCheng/codeforces-go
type vdPair struct{ v, dis int }
type vdHeap []vdPair

func (h vdHeap) Len() int              { return len(h) }
func (h vdHeap) Less(i, j int) bool    { return h[i].dis < h[j].dis }
func (h vdHeap) Swap(i, j int)         { h[i], h[j] = h[j], h[i] }
func (h *vdHeap) Push(v interface{})   { *h = append(*h, v.(vdPair)) }
func (h *vdHeap) Pop() (v interface{}) { a := *h; *h, v = a[:len(a)-1], a[len(a)-1]; return }
func (h *vdHeap) push(v vdPair)        { heap.Push(h, v) }
func (h *vdHeap) pop() vdPair          { return heap.Pop(h).(vdPair) }

func CF1437C(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	const inf int = 1e9
	abs := func(x int) int {
		if x < 0 {
			return -x
		}
		return x
	}

	var T, n, t int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n)
		type neighbor struct{ to, rid, cap, cost int }
		g := make([][]neighbor, 3*n+2)
		addEdge := func(from, to, cap, cost int) {
			g[from] = append(g[from], neighbor{to, len(g[to]), cap, cost})
			g[to] = append(g[to], neighbor{from, len(g[from]) - 1, 0, -cost})
		}
		st, end := 0, 3*n+1
		for i := 1; i <= n; i++ {
			addEdge(st, i, 1, 0)
		}
		for i := 1; i <= n; i++ {
			Fscan(in, &t)
			for j := 1; j <= 2*n; j++ {
				addEdge(i, n+j, inf, abs(t-j))
			}
		}
		for i := n + 1; i <= 3*n; i++ {
			addEdge(i, end, 1, 0)
		}

		n = 3*n + 2
		const inf int = 1e9
		h := make([]int, n)
		dist := make([]int, n)
		type pair struct{ v, i int }
		fa := make([]pair, n)
		dijkstra := func() bool {
			for i := range dist {
				dist[i] = inf
			}
			dist[st] = 0
			q := vdHeap{{st, 0}}
			for len(q) > 0 {
				p := q.pop()
				v := p.v
				if dist[v] < p.dis {
					continue
				}
				for i, e := range g[v] {
					if e.cap == 0 {
						continue
					}
					w := e.to
					if newD := dist[v] + int(e.cost) + h[v] - h[w]; newD < dist[w] {
						dist[w] = newD
						fa[w] = pair{v, i}
						q.push(vdPair{w, newD})
					}
				}
			}
			return dist[end] < inf
		}
		minCost := 0
		for dijkstra() {
			for i, d := range dist {
				h[i] += d
			}
			for v := end; v != st; {
				p := fa[v]
				e := &g[p.v][p.i]
				e.cap--
				g[v][e.rid].cap++
				v = p.v
			}
			minCost += h[end]
		}
		Fprintln(out, minCost)
	}
}

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

package main

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

// OutputBuffer implements a faster way to print values
type OutputBuffer struct {
	i      int
	memo   []byte
	writer io.Writer
}

// NewOutputBuffer returns an OutputBuffer initialized instance
func NewOutputBuffer(out io.Writer) *OutputBuffer {
	return &OutputBuffer{
		memo:   make([]byte, 1024*1024),
		writer: out,
	}
}

func (o *OutputBuffer) println(x int) {
	aux := make([]byte, 6)
	i := 0

	for x > 10 {
		aux[i] = byte(x%10) + '0'
		i++
		x /= 10
	}

	aux[i] = byte(x%10) + '0'
	i++

	for i > 0 {
		i--
		o.memo[o.i] = aux[i]
		o.i++
	}

	o.memo[o.i] = '\n'
	o.i++

	if o.i >= len(o.memo)-16 {
		o.flush()
	}
}

func (o *OutputBuffer) flush() {
	if o.i > 0 {
		o.writer.Write(o.memo[:o.i])
		o.i = 0
	}
}

// Test has each test definition
type Test struct {
	n   int
	arr []int
}

func readInt(b []byte, i int) (int, int) {
	var x int
	l := len(b)

	for ; b[i] < '0' || b[i] > '9'; i++ {
	}

	for ; i < l && b[i] >= '0' && b[i] <= '9'; i++ {
		x = (x << 3) + (x << 1) + int(b[i]&15)
	}

	return x, i
}

func processInput(in io.Reader) (int, []*Test) {
	buff, _ := ioutil.ReadAll(in)
	k := 0

	var t int
	t, k = readInt(buff, k)
	tests := make([]*Test, t)

	for i := 0; i < t; i++ {
		var n int
		n, k = readInt(buff, k)
		arr := make([]int, n)

		for j := 0; j < n; j++ {
			arr[j], k = readInt(buff, k)
		}

		tests[i] = &Test{
			n:   n,
			arr: arr[:],
		}
	}

	return t, tests
}

// Solution to Minimal Height Tree problem
func Solution(reader io.Reader, writer io.Writer) {
	out := NewOutputBuffer(writer)

	t, tests := processInput(reader)

	for _t := 0; _t < t; _t++ {
		test := tests[_t]
		n, arr := test.n, test.arr[:]

		depth := 1
		gapByDepth := make([]int, 2)

		for i := 1; i < n; i++ {
			if arr[i] > arr[i-1] {
				gapByDepth[depth]++
			} else {
				if gapByDepth[depth-1] == 0 {
					gapByDepth[depth]--
					depth++
					gapByDepth = append(gapByDepth, 0)
				} else {
					gapByDepth[depth-1]--
				}
			}
		}

		out.println(depth)
	}

	out.flush()
}

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


package main

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

func main() {
	for t := ScanInt(); t > 0; t-- {
		a, b, c := ScanInt(), ScanInt(), ScanInt()
		aValue, bValue, cValue := -1, -1, -1
		answer := 10005
		for i := 1; i <= c+10; i++{
			for j := i; j <= c+10; j+=i{
				cost := abs(i - a) + abs(j-b)
				if cost < answer{
					cModified := (c + j/2) / j*j
					cost += abs(cModified - c)
					if cost < answer {
						answer = cost
						aValue = i
						bValue = j
						cValue = cModified
					}
				}
			}
		}
		fmt.Println(answer)
		fmt.Println(aValue, bValue, cValue)
	}

	close(O)
	oWg.Wait()
}

/*********************** 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 int) int {
	if x < 0 {
		return -x
	}
	return x
}

package main

import (
	"fmt"
)

const MaxInt = 10000000

var(
	test int
	a int
	b int
	c int
)

func abs(n int) int {
	y := n >> 63
	return (n ^ y) - y
}

func valid(i , j ,k int) (int){
	if( j%i != 0 || k%j != 0){
		return MaxInt
	}
	return abs(a-i) + abs(b-j) + abs(c-k)
}

func main(){
	fmt.Scan(&test)
	var ans[3] int
	for ; test > 0 ; test-- {
		fmt.Scan(&a,&b,&c)
		cost := MaxInt
		for i:=1 ; i <= 12000 ; i++{
			for j:=i ; j <= 12000 ; j+=i{
				for k:= j ; k <= 12000 ; k+=j{
					cur := valid(i,j,k)
					if(cur < cost){
						cost = cur
						ans = [3]int {i,j,k}
					}
				}
			}
		}
		fmt.Println(cost)
		fmt.Println(ans[0],ans[1],ans[2])
	}
}

package main

import (
	"fmt"
	"math"
)

func main() {
	var cases int
	fmt.Scanf("%d\n", &cases)
	for i := 0; i < cases; i++ {
		var a, b, c int
		fmt.Scanf("%d %d %d\n", &a, &b, &c)
		distance, aa, bb, cc := 50000.0, 0, 0, 0
		for i := 1; i <= 10000; i++ {
			for j := i; j <= 20000; j += i {
				left := c / j
				if (c - left*j) < (left+1)*j-c {
					left = left*j
				} else {
					left = (left+1)*j
				}
				d := math.Abs(float64(a-i)) + math.Abs(float64(b-j)) + math.Abs(float64(c-left))
				if d < distance {
					distance = d
					aa = i
					bb = j
					cc = left
				}

			}
		}
		fmt.Println(int(distance))
		fmt.Println(aa, bb, cc)
	}
}

package main

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

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

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

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

		var ta, tb, tc int
		best := int(1e9)

		for i := 1; i <= c; i++ {
			for j := i; j <= c+i; j += i {
				cc := Abs(a-i) + Abs(b-j)
				if j >= c {
					cc += Abs(c - j)
				} else {
					cc += min(c-(c/j)*j, ((c+j-1)/j)*j-c)
				}

				if best > cc {
					best = cc
					ta = i
					tb = j
					if c-(c/j)*j <= ((c+j-1)/j)*j-c {
						tc = (c / j) * j
					} else {
						tc = ((c + j - 1) / j) * j
					}
				}
			}
		}

		fmt.Fprintf(w, "%d\n", best)
		fmt.Fprintf(w, "%d %d %d\n", ta, tb, tc)
	}
}

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

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

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1311D(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	abs := func(x int) int {
		if x < 0 {
			return -x
		}
		return x
	}

	var t, a, b, c, ti, tj, tk int
	for Fscan(in, &t); t > 0; t-- {
		ans := int(1e9)
		Fscan(in, &a, &b, &c)
		for i := 1; i < 2*a; i++ {
			for j := i; j < 2*b; j += i {
				k := c / j
				if k == 0 {
					k = j
				} else {
					k *= j
					if abs(k+j-c) < abs(k-c) {
						k += j
					}
				}
				if v := abs(i-a) + abs(j-b) + abs(k-c); v < ans {
					ans, ti, tj, tk = v, i, j, k
				}
			}
		}
		Fprintln(out, ans)
		Fprintln(out, ti, tj, tk)
	}
}

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

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1311D(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	abs := func(x int) int {
		if x < 0 {
			return -x
		}
		return x
	}

	var t, a, b, c, ti, tj, tk int
	for Fscan(in, &t); t > 0; t-- {
		ans := int(1e9)
		Fscan(in, &a, &b, &c)
		for i := 1; i < 2*a; i++ {
			for j := i; j < 2*b; j += i {
				k := c - c%j
				if k == 0 {
					k = j
				} else if abs(k+j-c) < abs(k-c) {
					k += j
				}
				if v := abs(i-a) + abs(j-b) + abs(k-c); v < ans {
					ans, ti, tj, tk = v, i, j, k
				}
			}
		}
		Fprintln(out, ans)
		Fprintln(out, ti, tj, tk)
	}
}

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

package main

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

func main() {

	for t := ScanInt(); t > 0; t-- {
		a, b, c := ScanInt(), ScanInt(), ScanInt()
		diff := math.MaxInt32

		A, B, C := -1, -1, -1

		for i := 1; i <= 2*a; i++ {
			for j := i; j <= 2*b; j += i {
				for k := 0; k < 2; k++ {

					cc := j*(c/j) + (k * j)

					res := abs(a-i) + abs(b-j) + abs(c-cc)
					if res < diff {
						diff = res
						A, B, C = i, j, cc
					}
				}
			}
		}
		P(diff)
		P(A, B, C)
	}
	close(O)
	oWg.Wait()
}

/*********************** 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 int) int {
	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-- {
		a, b, c := ScanInt(), ScanInt(), ScanInt()
		aValue, bValue, cValue := -1, -1, -1
		ultraMax := 20005
		answer := 10005
		for i := 1; i <= ultraMax; i++{
			for j := i; j <= ultraMax; j+=i{
				cost := abs(i - a) + abs(j-b)
				if cost < answer{
					cModified := (c + j/2) / j*j
					cost += abs(cModified - c)
					if cost < answer {
						answer = cost
						aValue = i
						bValue = j
						cValue = cModified
					}
				}
			}
		}
		fmt.Println(answer)
		fmt.Println(aValue, bValue, cValue)
	}

	close(O)
	oWg.Wait()
}

/*********************** 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 int) int {
	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-- {
		a, b, c := ScanInt(), ScanInt(), ScanInt()
		aValue, bValue, cValue := -1, -1, -1
		answer := 10005
		for i := 1; i <= c+100; i++{
			for j := i; j <= c+100; j+=i{
				cost := abs(i - a) + abs(j-b)
				if cost < answer{
					cModified := (c + j/2) / j*j
					cost += abs(cModified - c)
					if cost < answer {
						answer = cost
						aValue = i
						bValue = j
						cValue = cModified
					}
				}
			}
		}
		fmt.Println(answer)
		fmt.Println(aValue, bValue, cValue)
	}

	close(O)
	oWg.Wait()
}

/*********************** 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 int) int {
	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-- {
		a, b, c := ScanInt(), ScanInt(), ScanInt()
		aValue, bValue, cValue := -1, -1, -1
		//ultraMax := 20005
		answer := 10005
		for i := 1; i <= 2*a; i++{
			for j := i; j <= 2*b; j+=i{
				cost := abs(i - a) + abs(j-b)
				if cost < answer{
					cModified := (c + j/2) / j*j
					cost += abs(cModified - c)
					if cost < answer {
						answer = cost
						aValue = i
						bValue = j
						cValue = cModified
					}
				}
			}
		}
		fmt.Println(answer)
		fmt.Println(aValue, bValue, cValue)
	}

	close(O)
	oWg.Wait()
}

/*********************** 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 int) int {
	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-- {
		a, b, c := ScanInt(), ScanInt(), ScanInt()
		aValue, bValue, cValue := -1, -1, -1
		answer := 10005
		for i := 1; i <= c+50; i++{
			for j := i; j <= c+50; j+=i{
				cost := abs(i - a) + abs(j-b)
				if cost < answer{
					cModified := (c + j/2) / j*j
					cost += abs(cModified - c)
					if cost < answer {
						answer = cost
						aValue = i
						bValue = j
						cValue = cModified
					}
				}
			}
		}
		fmt.Println(answer)
		fmt.Println(aValue, bValue, cValue)
	}

	close(O)
	oWg.Wait()
}

/*********************** 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 int) int {
	if x < 0 {
		return -x
	}
	return x
}

package main

import (
	"fmt"
	"math"
)

func main() {
	var cases int
	fmt.Scanf("%d\n", &cases)
	for i := 0; i < cases; i++ {
		var a, b, c int
		fmt.Scanf("%d %d %d\n", &a, &b, &c)
		distance, aa, bb, cc := 40000.0, 0, 0, 0
		for i := 1; i <= 10000; i++ {
			for j := i; j <= 10000; j += i {
				left := c / j
				if (c - left*j) < (left+1)*j-c {
					left = left*j
				} else {
					left = (left+1)*j
				}
				d := math.Abs(float64(a-i)) + math.Abs(float64(b-j)) + math.Abs(float64(c-left))
				if d < distance {
					distance = d
					aa = i
					bb = j
					cc = left
				}

			}
		}
		fmt.Println(int(distance))
		fmt.Println(aa, bb, cc)
	}
}

package main

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

func main() {

	for t := ScanInt(); t > 0; t-- {
		a, b, c := ScanInt(), ScanInt(), ScanInt()
		diff := math.MaxInt32

		A, B, C := 0, 0, 0

		for i := 1; i < 2*a; i++ {
			for j := 1; j < 2*b; j++ {
				for k := 0; k < 2; k++ {
					cc := j*(c/j) + (k * i)

					res := abs(a-i) + abs(b-j) + abs(c-cc)
					if res < diff {
						diff = res
						A, B, C = i, j, cc
					}
				}
			}
		}
		P(diff)
		P(A, B, C)
	}
	close(O)
	oWg.Wait()
}

/*********************** 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 int) int {
	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-- {
		a, b, c := ScanInt(), ScanInt(), ScanInt()
		diff := math.MaxInt32

		A, B, C := -1, -1, -1

		for i := 1; i <= 2*a; i++ {
			for j := i; j <= 2*b; j += i {
				for k := 0; k < 2; k++ {

					cc := j*(c/j) + (k * i)

					res := abs(a-i) + abs(b-j) + abs(c-cc)
					if res < diff {
						diff = res
						A, B, C = i, j, cc
					}
				}
			}
		}
		P(diff)
		P(A, B, C)
	}
	close(O)
	oWg.Wait()
}

/*********************** 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 int) int {
	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-- {
		a, b, c := ScanInt(), ScanInt(), ScanInt()
		aValue, bValue, cValue := -1, -1, -1
		answer := 10005
		for i := 1; i <= c+1; i++{
			for j := i; j <= c+1; j+=i{
				cost := abs(i - a) + abs(j-b)
				if cost < answer{
					cModified := (c + j/2) / j*j
					cost += abs(cModified - c)
					if cost < answer {
						answer = cost
						aValue = i
						bValue = j
						cValue = cModified
					}
				}
			}
		}
		fmt.Println(answer)
		fmt.Println(aValue, bValue, cValue)
	}

	close(O)
	oWg.Wait()
}

/*********************** 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 int) int {
	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-- {
		a, b, c := ScanInt(), ScanInt(), ScanInt()
		aValue, bValue, cValue := -1, -1, -1
		ultraMax := 20005
		answer := 10005
		for i := 1; i <= ultraMax; i++{
			for j := i; j <= ultraMax; j+=i{
				cost := abs(i - a) + abs(j-b)
				if cost < answer{
					cModified := (c + j/2) / j*j
					cost += abs(cModified - c)
					fmt.Println(cost)
					fmt.Println(answer)
					fmt.Println()
					if cost < answer {
						answer = cost
						aValue = i
						bValue = j
						cValue = cModified
					}
				}
			}
		}
		fmt.Println(answer)
		fmt.Println(aValue, bValue, cValue)
	}

	close(O)
	oWg.Wait()
}

/*********************** 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 int) int {
	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-- {
		a, b, c := ScanInt(), ScanInt(), ScanInt()
		aValue, bValue, cValue := -1, -1, -1
		answer := 10005
		for i := 1; i <= c; i++{
			for j := i; j <= c; j+=i{
				cost := abs(i - a) + abs(j-b)
				if cost < answer{
					cModified := (c + j/2) / j*j
					cost += abs(cModified - c)
					if cost < answer {
						answer = cost
						aValue = i
						bValue = j
						cValue = cModified
					}
				}
			}
		}
		fmt.Println(answer)
		fmt.Println(aValue, bValue, cValue)
	}

	close(O)
	oWg.Wait()
}

/*********************** 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 int) int {
	if x < 0 {
		return -x
	}
	return x
}


package main

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

func main() {
    reader := bufio.NewReader(os.Stdin)
    var a,b string
    fmt.Fscan(reader,&a,&b)
    ans := false
    if len(a) == len(b) {
        ina, inb := 0, 0
        for i := 0; i < len(a); i++ {
            if (ina == i) && (a[ina] == '0') { ina++ }
            if (inb == i) && (b[inb] == '0') { inb++ }
        }
        if ((ina == len(a)) && (inb == len(b))) || ((ina != len(a)) && (inb != len(b))) { ans = true }
    }
    if ans { fmt.Println("YES") } else { fmt.Println("NO") }
}

package main

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

var in = bufio.NewReader(os.Stdin)

func xor(x, y bool) bool {
	if x == y {
		return false
	}
	return true
}

func main() {
	a, _ := in.ReadString('\n')
	b, _ := in.ReadString('\n')
	if len(a) != len(b) || xor(!strings.Contains(a, "1"), !strings.Contains(b, "1")) {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
	}
}

package main

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

var in = bufio.NewReader(os.Stdin)

func main() {
	a, _ := in.ReadString('\n')
	b, _ := in.ReadString('\n')
	if len(a) != len(b) || strings.Contains(a, "1") != strings.Contains(b, "1") {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
	}
}

// 282C
package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	a, _ := in.ReadString('\n')
	b, _ := in.ReadString('\n')
	al, bl := len(a), len(b)
	if strings.Contains(a, "1") != strings.Contains(b, "1") || al != bl {
		fmt.Print("NO")
	} else {
		fmt.Print("YES")
	}
}

// 282C-mic_rizal
package main

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

func main() {
    var s1, s2 string
    z := bufio.NewReader(os.Stdin)
    var l1, l2, o1, o2 int
    fmt.Fscan(z, &s1, &s2)
    l1 = len(s1)
    l2 = len(s2)
    if l1 != l2 {
        fmt.Println("NO")
    } else {
        for i := 0; i < l1; i++ {
            if s1[i] == '1' {
                o1 = 1
            }
        }
        for i := 0; i < l2; i++ {
            if s2[i] == '1' {
                o2 = 1
            }
        }
        if (o1 ^ o2) > 0 {
            fmt.Println("NO")
        } else {
            fmt.Println("YES")
        }
    }
}

// Author: sighduck
// URL: https://codeforces.com/problemset/problem/282/C

package main

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

func allZeros(s string) bool {
	for _, elem := range s {
		if string(elem) == "1" {
			return false
		}
	}
	return true
}

func Solve(a string, b string) string {
	if len(a) != len(b) {
		return "NO"
	}
	if allZeros(a) != allZeros(b) {
		return "NO"
	}
	return "YES"
}

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

	var a, b string
	fmt.Fscanf(reader, "%s\n", &a)
	fmt.Fscanf(reader, "%s\n", &b)

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

package main

import "os"
import "bufio"

func main(){
	var a string
	var b string
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	a, _ = r.ReadString('\n')
	b, _ = r.ReadString('\n')

	lena := len(a)
	lenb := len(b)

	found1 := 0
	found2 := 0
	if lena != lenb {
		w.WriteString("NO")
		w.Flush()
	} else {
		for i:=0; i<lena; i++ {
			if string(a[i]) == "1" {
				found1 = 1
			}
			if string(b[i]) == "1" {
				found2 = 1
			}
			if found1 == 1 && found2 == 1 {
				break
			}
		}
		if found1^found2 == 0 {
			w.WriteString("YES")
			w.Flush()
		} else {
			w.WriteString("NO")
			w.Flush()
		}
	}

	w.WriteString("\n")
	w.Flush()
}

package main

import "os"
import "bufio"
import "strings"
//import "strconv"

func cari(x, a string) bool {
	ketemu := false
	for i:=0; i<len(a); i++ {
		if string(a[i]) == x {
			ketemu = true
			return ketemu
		}
	}
	return ketemu
}

func main(){
	var a string
	var b string
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	a = r.Text()
	r.Scan()
	b = r.Text()
	if a == b {
		w.WriteString("YES")
		w.Flush()
	} else if len(a) != len(b) || strings.Contains(a, "1") != strings.Contains(b, "1") {
		w.WriteString("NO")
		w.Flush()
	} else {
		w.WriteString("YES")
		w.Flush()
	}
	w.WriteString("\n")
	w.Flush()
}

package main

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

func cari(x, a, b string) bool {
	ketemu := false
	for i:=0; i<len(a); i++ {
		if string(a[i]) == x {
			for j:=0; j<len(b); j++ {
				if string(b[j]) == x {
					ketemu = true
					return ketemu
				}
			}
		}
	}
	return ketemu
}

func main(){
	var a string
	var b string
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	a = r.Text()
	r.Scan()
	b = r.Text()
	if len(a) != len(b) {
		w.WriteString("NO")
		w.Flush()
	} else if string(a) == "0" && string(b) == "0" {
		w.WriteString("YES")
		w.Flush()
	} else if cari("1", a, b) {
		w.WriteString("YES")
		w.Flush()
	} else {
		w.WriteString("NO")
		w.Flush()
	}
	w.WriteString("\n")
	w.Flush()
}

package main

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

func cari(x, a, b string) bool {
	ketemu := false
	for i:=0; i<len(a); i++ {
		if string(a[i]) == x {
			for j:=0; j<len(b); j++ {
				if string(b[j]) == x {
					ketemu = true
					return ketemu
				}
			}
		}
	}
	return ketemu
}

func main(){
	var a string
	var b string
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	a = r.Text()
	r.Scan()
	b = r.Text()
	if len(a) != len(b) {
		w.WriteString("NO")
		w.Flush()
	} else if string(a) == "0" && string(b) == "0" {
		w.WriteString("NO")
		w.Flush()
	} else if cari("1", a, b) {
		w.WriteString("YES")
		w.Flush()
	} else {
		w.WriteString("NO")
		w.Flush()
	}
	w.WriteString("\n")
	w.Flush()
}

package main

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

func cari(x, a string) bool {
	ketemu := false
	for i:=0; i<len(a); i++ {
		if string(a[i]) == x {
			ketemu = true
			return ketemu
		}
	}
	return ketemu
}

func main(){
	var a string
	var b string
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	a = r.Text()
	r.Scan()
	b = r.Text()
	if len(a) != len(b) || cari("1", a) != cari("1", b) {
		w.WriteString("NO")
		w.Flush()
	} else {
		w.WriteString("YES")
		w.Flush()
	}
	w.WriteString("\n")
	w.Flush()
}

package main

import "os"
import "bufio"
import "strings"
//import "strconv"

func cari(x, a string) bool {
	ketemu := false
	for i:=0; i<len(a); i++ {
		if string(a[i]) == x {
			ketemu = true
			return ketemu
		}
	}
	return ketemu
}

func main(){
	var a string
	var b string
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	a = r.Text()
	r.Scan()
	b = r.Text()
	con := strings.Contains(a, "1") != strings.Contains(b, "1")
	if a == b {
		w.WriteString("YES")
		w.Flush()
	} else if len(a) != len(b) || con == true {
		w.WriteString("NO")
		w.Flush()
	} else {
		w.WriteString("YES")
		w.Flush()
	}
	w.WriteString("\n")
	w.Flush()
}

package main

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

func cari(x, a, b string) bool {
	ketemu := false
	for i:=0; i<len(a); i++ {
		if string(a[i]) == x {
			for j:=0; j<len(b); j++ {
				if string(b[j]) == x {
					ketemu = true
					return ketemu
				}
			}
		}
	}
	return ketemu
}

func main(){
	var a string
	var b string
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	a = r.Text()
	r.Scan()
	b = r.Text()
	if len(a) != len(b) || !cari("1", a, b) {
		w.WriteString("NO")
		w.Flush()
	} else {
		w.WriteString("YES")
		w.Flush()
	}
	w.WriteString("\n")
	w.Flush()
}

package main

import "fmt"
import "os"
import "bufio"
//import "strconv"

func cari(x, a string) bool {
	ketemu := false
	for i:=0; i<len(a); i++ {
		if string(a[i]) == x {
			ketemu = true
			return ketemu
		}
	}
	return ketemu
}

func main(){
	var a string
	var b string
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	a = r.Text()
	r.Scan()
	b = r.Text()
	con := cari("1", a) != cari("1", b)
	if len(a) != len(b) || con == true {
		fmt.Print("NO")
	} else {
		fmt.Print("YES")
	}
	w.WriteString("\n")
	w.Flush()
}

package main

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

func cari(x, a, b string) bool {
	ketemu := false
	for i:=0; i<len(a); i++ {
		if string(a[i]) == x {
			for j:=0; j<len(b); j++ {
				if string(b[j]) == x {
					ketemu = true
					return ketemu
				}
			}
		}
	}
	return ketemu
}

func main(){
	var a string
	var b string
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	a = r.Text()
	r.Scan()
	b = r.Text()
	if len(a) != len(b) {
		w.WriteString("NO")
		w.Flush()
	} else if cari("1", a, b) {
		w.WriteString("YES")
		w.Flush()
	} else {
		w.WriteString("NO")
		w.Flush()
	}
	w.WriteString("\n")
	w.Flush()
}

package main

import "os"
import "bufio"

func main(){
	var a string
	var b string
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	a = r.Text()
	r.Scan()
	b = r.Text()

	lena := len(a)
	lenb := len(b)

	found1 := 0
	found2 := 0
	if lena != lenb {
		w.WriteString("NO")
		w.Flush()
	} else {
		for i:=0; i<lena; i++ {
			if string(a[i]) == "1" {
				found1 = 1
			}
			if string(b[i]) == "1" {
				found2 = 1
			}
			if found1 == 1 && found2 == 1 {
				break
			}
		}
		if found1^found2 == 0 {
			w.WriteString("YES")
			w.Flush()
		} else {
			w.WriteString("NO")
			w.Flush()
		}
	}

	w.WriteString("\n")
	w.Flush()
}

package main

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

func cari(x, a, b string) bool {
	ketemu := false
	for i:=0; i<len(a); i++ {
		if string(a[i]) == x {
			for j:=0; j<len(b); j++ {
				if string(b[j]) == x {
					ketemu = true
					return ketemu
				}
			}
		}
	}
	return ketemu
}

func main(){
	var a string
	var b string
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	a = r.Text()
	r.Scan()
	b = r.Text()
	if len(a) != len(b) {
		w.WriteString("NO")
		w.Flush()
	} else if a == b {
		w.WriteString("YES")
		w.Flush()
	} else if cari("1", a, b) {
		w.WriteString("YES")
		w.Flush()
	} else {
		w.WriteString("NO")
		w.Flush()
	}
	w.WriteString("\n")
	w.Flush()
}

package main

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

func cari(x, a, b string) bool {
	ketemu := false
	for i:=0; i<len(a); i++ {
		if string(a[i]) == x {
			for j:=0; j<len(b); j++ {
				if string(b[j]) == x {
					ketemu = true
					return ketemu
				}
			}
		}
	}
	return ketemu
}

func main(){
	var a string
	var b string
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	a = r.Text()
	r.Scan()
	b = r.Text()
	if a == b {
		w.WriteString("YES")
		w.Flush()
	} else if len(a) != len(b) || !cari("1", a, b) {
		w.WriteString("NO")
		w.Flush()
	} else {
		w.WriteString("YES")
		w.Flush()
	}
	w.WriteString("\n")
	w.Flush()
}

package main

import "fmt"
import "os"
import "bufio"
//import "strconv"

func cari(x, a string) bool {
	ketemu := false
	for i:=0; i<len(a); i++ {
		if string(a[i]) == x {
			ketemu = true
			return ketemu
		}
	}
	return ketemu
}

func main(){
	var a string
	var b string
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	a = r.Text()
	r.Scan()
	b = r.Text()
	if len(a) != len(b) || cari("1", a) != cari("1", b) {
		fmt.Print("NO")
	} else {
		fmt.Print("YES")
	}
	w.WriteString("\n")
	w.Flush()
}

package main

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

func cari(x, a, b string) bool {
	ketemu := false
	for i:=0; i<len(a); i++ {
		if string(a[i]) == x {
			for j:=0; j<len(b); j++ {
				if string(b[j]) == x {
					ketemu = true
					return ketemu
				}
			}
		}
	}
	return ketemu
}

func main(){
	var a string
	var b string
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	a = r.Text()
	r.Scan()
	b = r.Text()
	if a == b {
		w.WriteString("YES")
		w.Flush()
	} else if len(a) != len(b) {
		w.WriteString("NO")
		w.Flush()
	} else if !cari("1", a, b) {
		w.WriteString("NO")
		w.Flush()
	} else {
		w.WriteString("YES")
		w.Flush()
	}
	w.WriteString("\n")
	w.Flush()
}

// 282C
package main

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

func main() {
	var (
		a, b [1000005]int
		m, n int
	)
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	fmt.Fscan(in, &a)
	fmt.Fscan(in, &b)
	m = len(a)
	n = len(b)

	if m != n {
		fmt.Print("NO")
		return
	}
	p, q := 0, 0
	for i := 0; i < n; i++ {
		if a[i] == '1' {
			p = 1
		}
		if b[i] == '1' {
			q = 1
		}
	}
	if p == q {
		fmt.Fprint(out, "YES")
	} else {
		fmt.Fprint(out, "NO")
	}
	out.Flush()
}

// 282C
package main

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

func main() {
	var (
		a, b [1000005]int
		m, n int
	)
	in := bufio.NewScanner(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	in.Split(bufio.ScanWords)
	in.Scan()
	a[m], _ = strconv.Atoi(in.Text())
	in.Scan()
	b[n], _ = strconv.Atoi(in.Text())
	m = len(a)
	n = len(b)

	if m != n {
		fmt.Print("NO")
		return
	}
	p, q := 0, 0
	for i := 0; i < n; i++ {
		if a[i] == '1' {
			p = 1
		}
		if b[i] == '1' {
			q = 1
		}
	}
	if p == q {
		fmt.Fprint(out, "YES")
	} else {
		fmt.Fprint(out, "NO")
	}
	out.Flush()
}


package main

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

	"math"
	"sort"
)

func main() {
	n, k, m := readInt3()
	a := readInts()

	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	if m < k {
		k = m
	}
	var s float64
	var r float64

	for i := 1; i <= n; i++ {
		s += float64(a[i-1])
		ds := math.Min(float64(m-(n-i)), float64(k)*float64(i))
		r1 := (s+ds) / float64(i)
		if ds >= 0 && r1 > r {
			r = r1
		}
	}

	fmt.Println(r)
}

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

func readLine() string {
	s, _ := stdin.ReadString('\n')
	return s
}

func readInts() (r []int) {
	reader := strings.NewReader(readLine())
	for {
		var x int
		_, err := fmt.Fscan(reader, &x)
		if err != nil {
			break
		}
		r = append(r, x)
	}
	return
}

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

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 min(x, y int64) int64 {
	if x < y {
		return x
	}
	return y
}

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

func main() {
	defer writer.Flush()
	var n, k, m int
	var t1, tot, cum, mm int64
	arr := []int64{}
	scanf("%d %d %d\n", &n, &k, &m)

	for i := 0; i < n; i++ {
		scanf("%d", &t1)
		arr = append(arr, t1)
		tot += t1
	}
	sort.Slice(arr, func(i, j int) bool {
		return arr[i] < arr[j]
	})

	ansf := float64(0)
	tem := float64(0)

	for i := 0; i < n; i++ {
		mm = int64(m - i)
		if mm < 0 {
			break
		}
		canInc := min(mm, int64(n-i)*int64(k))
		t1 = tot - cum + canInc

		tem = float64(t1)
		tem /= float64(n - i)

		if tem > ansf {
			ansf = tem
		}
		cum += arr[i]
	}

	printf("%.10f", ansf)
}

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 min(x, y int64) int64 {
	if x < y {
		return x
	}
	return y
}

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

func main() {
	defer writer.Flush()
	var n, k, m int
	var t1, tot, cum, mm int64
	arr := []int64{}
	scanf("%d %d %d\n", &n, &k, &m)

	for i := 0; i < n; i++ {
		scanf("%d", &t1)
		arr = append(arr, t1)
		tot += t1
	}
	sort.Slice(arr, func(i, j int) bool {
		return arr[i] < arr[j]
	})

	ansf := float64(0)
	tem := float64(0)

	for i := 0; i < n; i++ {
		mm = int64(m - i)
		canInc := min(mm, int64(n-i)*int64(k))
		t1 = tot - cum + canInc

		tem = float64(t1)
		tem /= float64(n - i)

		if tem > ansf {
			ansf = tem
		}
		cum += arr[i]
	}

	printf("%.10f", ansf)
}


//http://codeforces.com/problemset/problem/180/C
//C. Letter

package main

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

func main() {
	var (
		s0, s1, b0, b1 int32 // small,big
		in             *bufio.Reader
		c              byte
		tc             int8
	)

	in = bufio.NewReader(os.Stdin)

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

	readltr := func() {
		c, _ = in.ReadByte()
		if 'a' <= c && c <= 'z' {
			tc = -1
			return
		}
		if 'A' <= c && c <= 'Z' {
			tc = 1
			return
		}
		tc = 0
	}

	for {
		readltr()
		if tc != 0 {
			break
		}
	}

	//fmt.Printf("%c\n", c)

	if tc > 0 {
		s1 = 1
		b1 = 0
	} else {
		s1 = 0
		b1 = 1
	}

LOOP:
	for {
		b0, s0 = b1, s1
		readltr()
		//fmt.Printf("%c\n", c)

		switch tc {
		case 1:
			b1, s1 = b0, 1+min(b0, s0)
		case -1:
			b1, s1 = 1+b0, min(b0, s0)
		case 0:
			break LOOP
		}
	}

	fmt.Println(min(s1, b1))
}

package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scanf("%s", &s)
	prefix := make([]int, len(s) + 1)
	suffix := make([]int, len(s) + 2)
	for i := 1;i <= len(s);i ++ {
		if s[i - 1] >= 'a' && s[i - 1] <= 'z' {
			prefix[i] = prefix[i - 1] + 1
		} else {
			prefix[i] = prefix[i - 1]
		}
	}
	for i := len(s);i > 0;i -- {
		if s[i - 1] >= 'A' && s[i - 1] <= 'Z' {
			suffix[i] = suffix[i + 1] + 1
		} else {
			suffix[i] = suffix[i + 1]
		}
	}
	min := 9999999
	for i := 1;i <= len(s);i ++ {
		if prefix[i] + suffix[i] < min {
			min = prefix[i] + suffix[i]
		}
	}
	fmt.Printf("%d", min - 1)
}

//http://codeforces.com/problemset/problem/180/C
//C. Letter

package main

import (
	"fmt"
)

func main() {
	var (
		i, lmsg, s0, s1, b0, b1 int32 // small,big
		msg                     string
	)

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

	fmt.Scan(&msg)
	lmsg = int32(len(msg))
	if msg[0] <= 'Z' {
		s0 = 1
		b0 = 0
	} else {
		s0 = 0
		b0 = 1
	}

	for i = 1; i < lmsg; i++ {
		if msg[i] <= 'Z' {
			b1, s1 = b0, 1+min(b0, s0)
		} else {
			b1, s1 = 1+b0, min(b0, s0)
		}
		b0, s0 = b1, s1
	}

	fmt.Println(min(s1, b1))
}

//http://codeforces.com/problemset/problem/180/C
//C. Letter

package main

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

func main() {
	var (
		i, lmsg, s0, s1, b0, b1 int32 // small,big
		msg                     string
		in                      *bufio.Reader
	)

	in = bufio.NewReader(os.Stdin)

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

	msg, _ = in.ReadString('\n')
	lmsg = int32(len(msg))
	if msg[0] <= 'Z' {
		s0 = 1
		b0 = 0
	} else {
		s0 = 0
		b0 = 1
	}

	for i = 1; i < lmsg; i++ {
		if msg[i] <= 'Z' {
			b1, s1 = b0, 1+min(b0, s0)
		} else {
			b1, s1 = 1+b0, min(b0, s0)
		}
		b0, s0 = b1, s1
	}

	fmt.Println(min(s1, b1))
}