This is the hard version of this problem. The difference between easy and hard versions is only the constraints on $$$a_i$$$ and on $$$n$$$. You can make hacks only if both versions of the problem are solved.Burenka is the crown princess of Buryatia, and soon she will become the $$$n$$$-th queen of the country. There is an ancient tradition in Buryatia — before the coronation, the ruler must show their strength to the inhabitants. To determine the strength of the $$$n$$$-th ruler, the inhabitants of the country give them an array of $$$a$$$ of exactly $$$n$$$ numbers, after which the ruler must turn all the elements of the array into zeros in the shortest time. The ruler can do the following two-step operation any number of times:   select two indices $$$l$$$ and $$$r$$$, so that $$$1 \le l \le r \le n$$$ and a non-negative integer $$$x$$$, then  for all $$$l \leq i \leq r$$$ assign $$$a_i := a_i \oplus x$$$, where $$$\oplus$$$ denotes the bitwise XOR operation. It takes $$$\left\lceil \frac{r-l+1}{2} \right\rceil$$$ seconds to do this operation, where $$$\lceil y \rceil$$$ denotes $$$y$$$ rounded up to the nearest integer. Help Burenka calculate how much time she will need.

The first line contains a single integer $$$t$$$ $$$(1 \le t \le 500)$$$  — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ - the size of the array The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \cdots , a_n$$$ $$$(0 \le a_i < 2^{30})$$$ — elements of the array. It is guaranteed that the sum of $$$n$$$ in all tests does not exceed $$$10^5$$$.

For each test case, output a single number  — the minimum time that Burenka will need.

NoteIn the first test case, Burenka can choose segment $$$l = 1$$$, $$$r = 4$$$, and $$$x=5$$$. so it will fill the array with zeros in $$$2$$$ seconds.In the second test case, Burenka first selects segment $$$l = 1$$$, $$$r = 2$$$, and $$$x = 1$$$, after which $$$a = [0, 2, 2]$$$, and then the segment $$$l = 2$$$, $$$r = 3$$$, and $$$x=2$$$, which fills the array with zeros. In total, Burenka will spend $$$2$$$ seconds.

package main

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

const MOD int64 = 1000000007

const INF = 1e9 + 300

var n int

var a[]int

// ByAge implements sort.Interface based on the Age field.
type ByV []*pair

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

func main() {

	read := bufio.NewReader(os.Stdin)

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

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

		fmt.Fscan(read, &n)

		a = make([]int,  n)

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

		fmt.Println(solve())
	}
}

type pair struct {
	v int
	idx []int
}

func solve() int {

	dp := make([]int, n + 1)
	for i := 0; i <= n; i++ {
		dp[i] = -1
	}

	mp := make(map[int]int)

	mp[0] = -1
	pref := 0

	for i := 0; i < n; i++ {
		pref = pref ^ a[i]

		if v, ok := mp[pref]; ok {
			dp[v + 1] = i
		}
		mp[pref] = i
	}

	dp2 := make([]int, n + 1)
	for i := 0; i <= n; i++ {
		dp2[i] = INF
	}

	dp2[0] = 1

	if dp[0] != -1 {

		v := dp[0]
		dp2[v] = v
	}

	for i := 1; i < n; i++ {
		dp2[i] = min(dp2[i], dp2[i - 1] + 1)

		if dp[i] != -1 {

			v := dp[i]

			dp2[v] = min(dp2[v], dp2[i - 1] + (v - i))
		}

	}

	return dp2[n - 1]
}

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

	return b
}

//1 2 4 4 3

//0 - 1
//3 - 1

//IQ = 87

//........105....99...87..87..87..87.87.......87....

//            86

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

package main

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

var _, _, _ = main, rw, do

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

func rw(r io.Reader, w io.Writer) {
	var t int
	fmt.Fscan(r, &t)
	for ti := 0; ti < t; ti++ {
		var n int
		fmt.Fscan(r, &n)
		a := make([]int, n)
		for i := range a {
			fmt.Fscan(r, &a[i])
		}
		w1 := do(n, a)
		fmt.Fprintln(w, w1)
	}
}

func do(n int, a []int) int {
	m := make(map[int]bool)
	s := 0
	d := 0
	for i := range a {
		m[s] = true
		s ^= a[i]
		if m[s] {
			d++
			s = 0
			m = make(map[int]bool)
		}
	}
	return n - d
}


You are given an array $$$a_1, a_2, \dots , a_n$$$, which is sorted in non-decreasing order ($$$a_i \le a_{i + 1})$$$. Find three indices $$$i$$$, $$$j$$$, $$$k$$$ such that $$$1 \le i < j < k \le n$$$ and it is impossible to construct a non-degenerate triangle (a triangle with nonzero area) having sides equal to $$$a_i$$$, $$$a_j$$$ and $$$a_k$$$ (for example it is possible to construct a non-degenerate triangle with sides $$$3$$$, $$$4$$$ and $$$5$$$ but impossible with sides $$$3$$$, $$$4$$$ and $$$7$$$). If it is impossible to find such triple, report it.

The first line contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \le n \le 5 \cdot 10^4$$$) — the length of the array $$$a$$$. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \dots , a_n$$$ ($$$1 \le a_i \le 10^9$$$; $$$a_{i - 1} \le a_i$$$) — the array $$$a$$$. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^5$$$.

For each test case print the answer to it in one line. If there is a triple of indices $$$i$$$, $$$j$$$, $$$k$$$ ($$$i < j < k$$$) such that it is impossible to construct a non-degenerate triangle having sides equal to $$$a_i$$$, $$$a_j$$$ and $$$a_k$$$, print that three indices in ascending order. If there are multiple answers, print any of them. Otherwise, print -1.

NoteIn the first test case it is impossible with sides $$$6$$$, $$$11$$$ and $$$18$$$. Note, that this is not the only correct answer.In the second test case you always can construct a non-degenerate triangle.

package main

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

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

func printf(x string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(out, x, a...)
}

func scanf(x string, a ...interface{}) (n int, err error) {
	return fmt.Fscanf(in, x, a...)
}

var err error

func next() (n string) {
	for {
		_, err = scanf("%v", &n)
		if err == nil {
			return n
		}
		if err.Error() == "EOF" {
			return ""
		}
	}
}

func nextInt() (n int) {
	for {
		_, err = scanf("%v", &n)
		if err == nil {
			return n
		}
		if err.Error() == "EOF" {
			return 0
		}
	}
}

func nextLong() (n int64) {
	for {
		_, err = scanf("%v", &n)
		if err == nil {
			return n
		}
		if err.Error() == "EOF" {
			return 0
		}
	}
}

func nextDouble() (n float64) {
	for {
		_, err = scanf("%v", &n)
		if err == nil {
			return n
		}
		if err.Error() == "EOF" {
			return 0
		}
	}
}

func Fill(a []int, v int) {
	for i := range a {
		a[i] = v
	}
}

func FillB(a []bool, v bool) {
	for i := range a {
		a[i] = v
	}
}

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 Abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

const (
	oo  = 100000000
	mod = 1
)

func mult(a, b int64) int64 {
	return (a * b) % mod
}
func add(a, b int64) int64 {
	return (a + b) % mod
}
func sub(a, b int64) int64 {
	return (a - b + mod) % mod
}

var (
	base, a, b map[string]string
	dp         []map[string]int
	pat        string
)

func dfs(i int, x string) int {
	{
		a, test := dp[i][x]
		if test {
			return a
		}
	}
	res := i
	if base[x] != "" {
		for _, c := range []byte(base[x]) {
			if res < len(pat) && pat[res] == c {
				res++
			}
		}
	} else {
		res = dfs(dfs(i, a[x]), b[x])
	}
	dp[i][x] = res
	return res
}

func solve() {
	n := nextInt()
	arr := make([]int, n)
	for i := range arr {
		arr[i] = nextInt()
	}
	if arr[0]+arr[1] <= arr[n-1] {
		printf("%d %d %d\n", 1, 2, n)
	} else {
		printf("-1\n")
	}
}

func main() {
	in = bufio.NewReaderSize(os.Stdin, 8192)
	out = bufio.NewWriterSize(os.Stdout, 8192)
	if false {
		file1, err := os.Open("input.txt")
		if err != nil {
			log.Fatal(err)
		}
		file2, err := os.Create("output.txt")
		if err != nil {
			log.Fatal(err)
		}
		in = bufio.NewReaderSize(file1, 8192)
		out = bufio.NewWriterSize(file2, 8192)
	}
	defer out.Flush()

	// start := time.Now()

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

	// printf("%v\n", time.Now().Sub(start))
}

package main

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

func main() {
	var t, n, a, b, c int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &n)
		fmt.Fscan(in, &a)
		fmt.Fscan(in, &b)
		for j := 0; j < n-2; j++ {
			fmt.Fscan(in, &c)
		}
		if a+b <= c {
			fmt.Println(1, 2, n)
		} else {
			fmt.Println(-1)
		}
	}
}

package main

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

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

func nextInt() (res int) {
	for {
		res = 0
		_, err := fmt.Fscanf(in, "%v", &res)
		if err == nil {
			return
		}
		if err.Error() == "EOF" {
			return
		}
		// fmt.Printf("read err: %v\n", err)
	}
	return
}

func solve(idx int) {
	n := nextInt()
	a := make([]int, n)
	// fmt.Printf("n: %v\n", n)
	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}
	if n < 3 {
		fmt.Println(-1)
		return
	}
	if a[0]+a[1] <= a[n-1] {
		fmt.Printf("%d %d %d\n", 1, 2, n)
	} else {
		fmt.Println(-1)
	}
}

func main() {
	out = bufio.NewWriterSize(os.Stdout, 8192)
	in = bufio.NewReaderSize(os.Stdin, 8192)
	defer out.Flush()
	idx := 0
	for t := nextInt(); t > 0; t-- {
		solve(idx)
		idx++
	}
}

package main

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

type Anode struct {
	idx int
	ans string
}

type Anodes []Anode

func (this Anodes) Len() int {
	return len(this)
}

func (this Anodes) Less(i, j int) bool {
	return this[i].idx < this[j].idx
}

func (this Anodes) Swap(i, j int) {
	this[i], this[j] = this[j], this[i]
}

var (
	wg   sync.WaitGroup
	out  *bufio.Writer
	in   *bufio.Reader
	ans  Anodes
	lock sync.Mutex
)

func appendAns(n Anode) {
	lock.Lock()
	defer lock.Unlock()
	ans = append(ans, n)
}

func nextInt() (res int) {
	for {
		res = 0
		_, err := fmt.Fscanf(in, "%v", &res)
		if err == nil {
			return
		}
		if err.Error() == "EOF" {
			return
		}
		// fmt.Printf("read err: %v\n", err)
	}
	return
}

func solve(idx int) {
	defer wg.Done()
	n := nextInt()
	a := make([]int, n)
	// fmt.Printf("n: %v\n", n)
	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}
	if n < 3 {
		// fmt.Println(-1)
		appendAns(Anode{idx, "-1"})
		return
	}
	if a[0]+a[1] <= a[n-1] {
		appendAns(Anode{idx, fmt.Sprintf("%d %d %d", 1, 2, n)})
		// fmt.Printf("%d %d %d\n", 1, 2, n)
	} else {
		// fmt.Println(-1)
		appendAns(Anode{idx, "-1"})
	}
}

func main() {
	out = bufio.NewWriterSize(os.Stdout, 8192)
	in = bufio.NewReaderSize(os.Stdin, 8192)
	defer out.Flush()
	t := nextInt()
	wg.Add(t)
	idx := 0
	for ; t > 0; t-- {
		go solve(idx)
		idx++
	}
	wg.Wait()
	for _, a := range ans {
		fmt.Println(a.ans)
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		var n int
		var a1, a2, a3 int
		fmt.Fscan(in, &n)
		found := false
		for j := 0; j < n; j++ {
			fmt.Fscan(in, &a3)
			if j == 0 {
				a1 = a3
				continue
			} else if j == 1 {
				a2 = a3
				continue
			} else if found {
				continue
			}

			if a1+a2 <= a3 {
				found = true
				fmt.Println(1, 2, j+1)
			}
		}
		if !found {
			fmt.Println(-1)
		}
	}
}

package main

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

type kv struct {
	Key   int
	Value int
}

func main() {
	//rd, _ := os.Open("input")
	io := bufio.NewReader(os.Stdin)

	var t, n int
	var a []kv

	fmt.Fscan(io, &t)
	for ; t > 0; t-- {
		fmt.Fscan(io, &n)
		a = make([]kv, n)
		for i, elem := 0, 0; i < n; i++ {
			fmt.Fscan(io, &elem)
			a[i] = kv{Key: i + 1, Value: elem}
		}

		sort.Slice(a, func(i, j int) bool {
			return a[i].Value < a[j].Value
		})

		if a[0].Value+a[1].Value <= a[n-1].Value {
			fmt.Println(a[0].Key, a[1].Key, a[n-1].Key)
		} else {
			fmt.Println(-1)
		}
	}
}

package main

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

func main() {
	var t, n, a, b, c int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &n)
		fmt.Fscan(in, &a)
		fmt.Fscan(in, &b)
		for j := 0; j < n-2; j++ {
			fmt.Fscan(in, &c)
		}
		if c+b > a {
			fmt.Println(1, 2, n)
		} else {
			fmt.Println(-1)
		}
	}
}

package main

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

func main() {
	var t, n, a, b, c int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &n)
		fmt.Fscan(in, &a)
		fmt.Fscan(in, &b)
		for j := 0; j < n-2; j++ {
			fmt.Fscan(in, &c)
		}
		if a+b < c {
			fmt.Println(1, 2, n)
		} else {
			fmt.Println(-1)
		}
	}
}

package main

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

func main() {
	var t, n, a, b, c int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &n)
		fmt.Fscan(in, &a)
		fmt.Fscan(in, &b)
		for j := 0; j < n-2; j++ {
			fmt.Fscan(in, &c)
		}
		if a+b > c {
			fmt.Println(1, 2, n)
		} else {
			fmt.Println(-1)
		}
	}
}

package main

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

func main() {
	var t, n, a, b, c int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &n)
		fmt.Fscan(in, &a)
		fmt.Fscan(in, &b)
		for j := 0; j < n-2; j++ {
			fmt.Fscan(in, &c)
		}
		if a+b < c {
			fmt.Println(a, b, c)
		} else {
			fmt.Println(-1)
		}
	}
}

package main

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

var out *bufio.Writer

func nextInt() (res int) {
	res = 0
	_, err := fmt.Scanf("%v", &res)
	if err != nil {
		res = 0
	}
	return
}

func solve(idx int) {
	n := nextInt()
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}
	if n < 3 {
		fmt.Println(-1)
		return
	}
	if a[0]+a[1] <= a[n-1] {
		fmt.Printf("%d %d %d\n", 1, 2, n)
	} else {
		fmt.Println(-1)
	}
}

func main() {
	out = bufio.NewWriterSize(os.Stdout, 8192)
	defer out.Flush()
	idx := 0
	for t := nextInt(); t > 0; t-- {
		solve(idx)
		idx++
	}
}

package main

import (
	"fmt"
)

func nextInt() (res int) {
	res = 0
	_, err := fmt.Scanf("%v", &res)
	if err != nil {
		res = 0
	}
	return
}

func solve(idx int) {
	n := nextInt()
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}
	if n < 3 {
		fmt.Println(-1)
		return
	}
	if a[0]+a[1] <= a[n-1] {
		fmt.Printf("%d %d %d\n", 1, 2, n)
	} else {
		fmt.Println(-1)
	}
}

func main() {
	idx := 0
	for t := nextInt(); t > 0; t-- {
		solve(idx)
		idx++
	}
}


Casimir has a string $$$s$$$ which consists of capital Latin letters 'A', 'B', and 'C' only. Each turn he can choose to do one of the two following actions:  he can either erase exactly one letter 'A' and exactly one letter 'B' from arbitrary places of the string (these letters don't have to be adjacent);  or he can erase exactly one letter 'B' and exactly one letter 'C' from arbitrary places in the string (these letters don't have to be adjacent). Therefore, each turn the length of the string is decreased exactly by $$$2$$$. All turns are independent so for each turn, Casimir can choose any of two possible actions.For example, with $$$s$$$ $$$=$$$ "ABCABC" he can obtain a string $$$s$$$ $$$=$$$ "ACBC" in one turn (by erasing the first occurrence of 'B' and the second occurrence of 'A'). There are also many other options for a turn aside from this particular example.For a given string $$$s$$$ determine whether there is a sequence of actions leading to an empty string. In other words, Casimir's goal is to erase all letters from the string. Is there a way to do this?

The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Each test case is described by one string $$$s$$$, for which you need to determine if it can be fully erased by some sequence of turns. The string $$$s$$$ consists of capital letters 'A', 'B', 'C' and has a length from $$$1$$$ to $$$50$$$ letters, inclusive.

Print $$$t$$$ lines, each line containing the answer to the corresponding test case. The answer to a test case should be YES if there is a way to fully erase the corresponding string and NO otherwise. You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes, and YES will all be recognized as positive answers).

6
ABACAB
ABBA
AC
ABC
CABCBB
BCBCBCBCBCBCBCBC

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	var s string
	for ; n > 0; n-- {
		fmt.Scan(&s)
		var a, b, c int
		for _, ch := range s {
			if ch == 'A' {
				a++
			}
			if ch == 'B' {
				b++
			}
			if ch == 'C' {
				c++
			}
		}
		if a+c == b {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main
import(
    "fmt"
)
func main() {
	var t int
	fmt.Scan(&t)
	for i:=0;i<t;i++{
		var x string
		fmt.Scan(&x)
		if len(x)%2 != 0 {
			fmt.Println("NO")
		} else {
			var a,b,c int
			for j:=0;j<len(x);j++{
				if string(x[j]) == "A" {
					a++
				} else if string(x[j]) == "B" {
					b++
				} else {
					c++
				}
			}
			if b == (a+c) {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		}
	}
}

package main

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

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

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

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

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

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

/**
Run solve the problem CF1579A
Date: 11/10/21
User: epradere
URL: https://codeforces.com/problemset/problem/1579/A
Problem: CF1579A
**/
func (in *CF1579A) Run() {
	n := in.NextInt()
	for ; n > 0; n-- {
		s := in.NextString()
		a, b, c := 0, 0, 0
		for i := 0; i < len(s); i++ {
			if s[i] == 'A' {
				a++
			} else if s[i] == 'B' {
				b++
			} else {
				c++
			}
		}

		if a > 0 {
			b -= a
		}

		if c > 0 {
			b -= c
		}

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

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

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

package main

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

//problem A

func main() {
	reader := bufio.NewReader(os.Stdin)
	var t, ac, b int
	var str []byte
	fmt.Fscanf(reader, "%d\n", &t)
	for ; t > 0; t-- {
		ac = 0
		b = 0
		str, _, _ = reader.ReadLine()

		//fmt.Fscanf(reader, "%s\n", &str)
		for i := 0; i < len(str); i++ {
			switch str[i] {
			case 'A', 'C':
				ac++
			case 'B':
				b++
			}
		}
		if ac == b {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

//problem A

func main() {
	reader := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscanf(reader, "%d\n", &t)
	for ; t > 0; t-- {
		var str string
		var ac, b int
		fmt.Fscanf(reader, "%s\n", &str)
		for i := 0; i < len(str); i++ {
			switch str[i] {
			case 'A', 'C':
				ac++
			case 'B':
				b++
			}
		}
		if ac == b {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

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

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

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

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

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

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

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

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

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

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

		}
		return initial
	}
}

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

		}
		return m
	}
}

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

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

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

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

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

	return
}

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

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

	return num
}

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

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

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

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

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

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

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

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

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)

	for o := 0; o < t; o++ {
		String := make([]byte, 0)
		fmt.Fscan(input, &String)

		var A, B, C int
		q := len(String)
		for i := 0; i < q; i++ {
			if string(String[i]) == "A" {
				A++
			}
			if string(String[i]) == "B" {
				B++
			}
			if string(String[i]) == "C" {
				C++
			}
		}

		if B != A+C {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")

		}
	}

}

package main

import (
    "fmt"
)

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

    for t > 0 {
        t--
        var s string
        fmt.Scanf("%s\n", &s)
        //fmt.Println(s)
        cntB := 0
        for _, x := range s {
            if x == 'B' {
                cntB++
            }
        }

        if (cntB * 2 == len(s)) {
            fmt.Println("YES")
        } else {
            fmt.Println("NO")
        }
    }
}

package main

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

func main() {
	var (
		t  int
		s  string
		an int
		bn int
		cn int
	)
	fmt.Scanf("%d\n", &t)
	scanner := bufio.NewScanner(os.Stdin)
	for i := 0; i < t; i++ {
		an, bn, cn = 0, 0, 0
		scanner.Scan()
		s = scanner.Text()
		for j := 0; j < len(s); j++ {
			if s[j] == 'A' {
				an++
			} else if s[j] == 'B' {
				bn++
			} else if s[j] == 'C' {
				cn++
			}
		}
		if bn == an+cn {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import "fmt"

func main() {
	var (
		n int
		s string
	)
	fmt.Scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%s\n", &s)
		if len(s)%2 == 1 {
			fmt.Print("NO\n")
		} else {
			cntA, cntB, cntC := 0, 0, 0
			for i := range s {
				if s[i] == 'A' {
					cntA++
				} else if s[i] == 'B' {
					cntB++
				} else {
					cntC++
				}
			}
			if cntA+cntC != cntB {
				fmt.Print("NO\n")
			} else {
				fmt.Print("YES\n")
			}
		}
	}

}

package main

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

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

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

		tally := make([]int, 3)
		for _, ch := range s {
			tally[ch-'A']++
		}

		if tally[0]+tally[2] == tally[1] {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

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

	test := parseInt(getString(reader))

	for ; test > 0; test-- {
		occurence := make(map[rune]int)
		s := getString(reader)

		for _, v := range s {
			occurence[v]++
		}

		if occurence['A']+occurence['C'] == occurence['B'] {
			writer.WriteString("YES\n")
		} else {
			writer.WriteString("NO\n")
		}
	}
	writer.Flush()
}

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

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

package main

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

func solve() {
	f := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	N := 0
	fmt.Fscan(f, &N)
	for i := 0; i < N; i++ {
		s, A, B, C := "", 0, 0, 0
		fmt.Fscan(f, &s)
		for j := 0; j < len(s); j++ {
			switch {
			case string(s[j]) == "A":
				A++
			case string(s[j]) == "B":
				B++
			case string(s[j]) == "C":
				C++
			}
		}
		if B == A+C || (A == B && C == 0) || (B == C && A == 0) {
			fmt.Fprintln(w, "YES")
		} else {
			fmt.Fprintln(w, "NO")
		}
	}
	w.Flush()
}

func main() {
	solve()
}

package main

import "fmt"

func Answ(str string) string {
	counter := 0
	for _, let := range str {
		switch let {
		case 'A':
			counter--
		case 'B':
			counter++
		case 'C':
			counter--
		default:
			return "NO"
		}
	}

	if counter == 0 {
		return "YES"
	}
	return "NO"
}

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

	for i := 0; i < in_count; i++ {
		var tmp_str string

		fmt.Scan(&tmp_str)
		fmt.Println(Answ(tmp_str))
	}
}

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

package main

import "fmt"

func main() {
	var lengthOfArray int
	var element string

	inputArray := make([]string, 0)

	// taking the input array's length
	fmt.Scanln(&lengthOfArray)

	// taking the input array
	for i := 0; i < lengthOfArray; i++ {
		fmt.Scanln(&element)
		inputArray = append(inputArray, element)
	}

	for _, ele := range inputArray {
		checkValidity(ele)
	}

}

func checkValidity(ele string) {

	chars := make(map[rune]int)
	for _, char := range ele {
		chars[char] = chars[char] + 1
	}

	if (chars['A'] + chars['C']) == chars['B'] {
		fmt.Println("YES")
		return
	}

	fmt.Println("NO")
}

package main

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

var (
	reader = bufio.NewReader(os.Stdin)
	// writer  = bufio.NewWriter(os.Stdout)
	t int
	s string
)

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		var a, b, c int
		fmt.Fscan(reader, &s)
		for _, char := range s {
			if char == 'A' {
				a++
			}
			if char == 'B' {
				b++
			}
			if char == 'C' {
				c++
			}
		}
		if a+c == b {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import "fmt"

func main() {
	var T int
	fmt.Scanf("%d\n", &T)
	for ; T > 0; T-- {
		var str string
		fmt.Scanf("%s\n", &str)

		a, b, c := 0, 0, 0
		for _, ch := range str {
			if ch == 'A' {
				a++
			} else if ch == 'B' {
				b++
			} else {
				c++
			}
		}

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

package main

import (
	"fmt"
	"strings"
)

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

	for i := 0; i < n; i++ {
		var s string
		bCount := 0
		acCount := 0

		fmt.Scan(&s)

		bCount += strings.Count(s, "B")
		acCount += strings.Count(s, "A")
		acCount += strings.Count(s, "C")

		if bCount == acCount {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		solve()
	}
}
func solve() {
	var str string
	fmt.Scan(&str)
	arr := [3]rune{}
	for _, v := range str {
		if v == 'A' {
			arr[0]++
		} else if v == 'B' {
			arr[1]++
		} else {
			arr[2]++
		}
	}
	if arr[1] == arr[0]+arr[2] {
		fmt.Println("YES")
		return
	}
	fmt.Println("NO")

}

package main

import "fmt"

func main() {
	var s string
	var t int

	fmt.Scanln(&t)
	for ; t>0; t-- {
		fmt.Scanln(&s)
		a := []int{0, 0, 0}
		for _, e := range s {
			a[e-'A'] += 1
			// println("e-A: ", e-'A', ", ", "a[e-A]: ", a[e-'A'])
		}
		if a[1]!=0 && a[0] + a[2] == a[1] {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
	return
}

package main
import ("fmt")

func main() {
    var t int
    fmt.Scanln(&t)
    for i:=0; i<t; i++ {
        var s string
        c1,c2,c3:=0,0,0
        fmt.Scanln(&s)
        for j:=range s {
            if s[j]=='A' { c1++
            } else if s[j]=='B' { c2++
            } else { c3++
            }
        }
        if c2==c1+c3 { fmt.Println("YES")
        } else { fmt.Println("NO") }
    }
}

package main

import "fmt"

func solve() {
	var (
		s       string
		A, B, C int
	)
	fmt.Scan(&s)

	for _, l := range s {
		if l == 'A' {
			A++
		} else if l == 'B' {
			B++
		} else {
			C++
		}
	}
	if B-C-A == 0 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}

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

package main

import (
	"fmt"
)

func main() {
	var n int
	var s string
	fmt.Scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%s\n", &s)
		// fmt.Println("->", s)
		a, b, c := 0, 0, 0
		for j := 0; j < len(s); j++ {
			switch s[j] {
			case 'A':
				a++
			case 'B':
				b++
			case 'C':
				c++
			}
		}
		if a+c == b {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main
import "fmt"
import "bufio"
import "strconv"
import "strings"
import "os"
/*
*/

func main() {
  /*
  */
  f := true
  if f {
    reader := bufio.NewReader(os.Stdin)
    ns, _ := reader.ReadString('\n')
    n, _  := strconv.Atoi(strings.TrimSpace(ns))
    for i:=0;i<n;i++ {
      s, _ := reader.ReadString('\n')
      run(strings.TrimSpace(s))
    }
  }else {
    run("CABCBB")
  }
}

func run(s string) {
  var a, b, c int
  for _, rn := range s {
    if rn == 'A'{ a ++ }
    if rn == 'B'{ b ++ }
    if rn == 'C'{ c ++ }
  }
  if b - a -c == 0  {
    fmt.Println("YES")
  }else{
    fmt.Println("NO")
  }
}

package main

import (
	"fmt"
)

func checkInput(s string) string {
	if len(s) == 1 {
		return "NO"
	}
	letters := map[string]int{"A": 0, "B": 0, "C": 0}
	for _, c := range s {
		letters[string(c)]++
	}
	if letters["A"]+letters["C"] == letters["B"] {
		return "YES"
	}
	return "NO"
}

func main() {
	var count int
	fmt.Scanln(&count)
	res := []string{}

	for i := 0; i < count; i++ {
		var input string
		fmt.Scanln(&input)
		res = append(res, checkInput(input))
	}

	for _, s := range res {
		fmt.Println(s)
	}
}

package main

import (
	"fmt"
	"strings"
)

func f(s string) string {
	if strings.Count(s, "A")+strings.Count(s, "C") == strings.Count(s, "B") {
		return "YES"
	}
	return "NO"
}

func main() {
	var (
		t int
		s string
	)

	fmt.Scan(&t)
	for ; t > 0; t-- {
		fmt.Scan(&s)
		fmt.Println(f(s))
	}
}

package main

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

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

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

	for t := 0; t < T; t++ {
		var s string
		fmt.Fscanf(r, "%s\n", &s)
		c := make(map[byte]int)

		for i := 0; i < len(s); i++ {
			c[s[i]]++
		}

		if c['A']+c['C'] == c['B'] {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

func main()  {
	var t,a,b,c int
	var s string
	in:=bufio.NewReader(os.Stdin)
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		fmt.Fscan(in,&s)
		a,b,c=0,0,0
		for j:=0;j<len(s);j++{
			if s[j]=='A'{
				a++
			}
			if s[j]=='B'{
				b++
			}
			if s[j]=='C'{
				c++
			}
		}
		if b==a+c{
			fmt.Println("YES")
		}else{
			fmt.Println("NO")
		}
	}

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

package main

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

var s string

func main() {

	read := bufio.NewReader(os.Stdin)

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

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

		fmt.Fscan(read, &s)

		fmt.Println(solve())
	}
}

func solve() string {
	if len(s) % 2 == 1 {
		return "NO"
	}

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

	for i := 0; i < len(s); i++ {
		if s[i] == 'A' {
			A++
		} else if s[i] == 'B' {
			B++
		} else {
			C++
		}
	}

	if B == A + C {
		return "YES"
	}
	return "NO"
}

package main

import "fmt"

func main() {
	var iterations int
	fmt.Scanf("%d", &iterations)
	var s string
	for ; iterations > 0; iterations-- {
		fmt.Scanf("%s\n", &s)
		var a, b, c int
		for _, ch := range s {
			if ch == 'A' {
				a++
			}
			if ch == 'B' {
				b++
			}
			if ch == 'C' {
				c++
			}
		}
		if a+c == b {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import "fmt"

func main() {
	var iterations int
	fmt.Scanf("%d", &iterations)
	var s string
	for ; iterations > 0; iterations-- {
		fmt.Scanf("%s", &s)
		var a, b, c int
		for _, ch := range s {
			if ch == 'A' {
				a++
			}
			if ch == 'B' {
				b++
			}
			if ch == 'C' {
				c++
			}
		}
		fmt.Println(s)
	}
}

package main

import "fmt"

func main() {
	var iterations int
	fmt.Scan(iterations)
	for ; iterations > 0; iterations-- {
		var s string
		fmt.Scan(s)
		var a, b, c int
		for _, ch := range s {
			if ch == 'A' {
				a++
			}
			if ch == 'B' {
				b++
			}
			if ch == 'C' {
				c++
			}
		}
		if a+c == b {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import "fmt"

func main() {
	var iterations int
	fmt.Scanf("%d", &iterations)
	var s string
	for ; iterations > 0; iterations-- {
		fmt.Scanf("%s", &s)
		var a, b, c int
		for _, ch := range s {
			if ch == 'A' {
				a++
			}
			if ch == 'B' {
				b++
			}
			if ch == 'C' {
				c++
			}
		}
		if a+c == b {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main
import(
    "fmt"
)
func main() {
	var t int
	fmt.Scan(&t)
	for i:=0;i<t;i++{
		var x string
		fmt.Scan(&x)
		if len(x)%2 != 0 {
			fmt.Println("NO")
		} else {
			var a,b,c int
			for j:=0;j<len(x);j++{
				if string(x[j]) == "A" {
					a++
				} else if string(x[j]) == "B" {
					b++
				} else {
					c++
				}
			}
			if b >= (a+c) {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		}
	}
}

package main

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

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

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

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

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

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

/**
Run solve the problem CF1579A
Date: 11/10/21
User: epradere
URL: https://codeforces.com/problemset/problem/1579/A
Problem: CF1579A
**/
func (in *CF1579A) Run() {
	n := in.NextInt()
	for ; n > 0; n-- {
		s := in.NextString()
		a, b, c := 0, 0, 0
		for i := 0; i < len(s); i++ {
			if s[i] == 'A' {
				a++
			} else if s[i] == 'B' {
				b++
			} else {
				c++
			}
		}
		if a == 1 && b == 1 && c == 0 {
			b = -1
		}

		if a == 0 && b == 1 && c == 1 {
			b = -1
		}

		if a > 0 {
			b -= a
		}

		if c > 0 {
			b -= c
		}

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

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

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

package main

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

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

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

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

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

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

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

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

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

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

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

		}
		return initial
	}
}

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

		}
		return m
	}
}

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

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

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

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

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

	return
}

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

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

	return num
}

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

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

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

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

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

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

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

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

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)

	for o := 0; o < t; o++ {
		String := make([]byte, 0)
		fmt.Fscan(input, &String)

		var A, B, C int
		q := len(String)
		for i := 0; i < q; i++ {
			if string(String[i]) == "A" {
				A++
			}
			if string(String[i]) == "B" {
				B++
			}
			if string(String[i]) == "C" {
				C++
			}
		}

		if B != A+C {
			fmt.Println("NO")
		} else {
			if B == 1 {
				fmt.Println("NO")
			}
			if B == 2 {
				arr := make([]int, 0)
				for i := 0; i < 4; i++ {
					if string(String[i]) == "B" {
						arr = append(arr, i+1)
					}
				}
				if arr[1]-arr[0] == 2 {
					fmt.Println("NO")
				} else {
					fmt.Println("YES")
				}
			}

			if B > 2 {
				fmt.Println("YES")
			}
		}
	}

}

package main

import (
    "fmt"
)

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

    for t > 0 {
        t--
        var s string
        fmt.Scanf("%s\n", &s)
        //fmt.Println(s)
        cntB := 0
        for _, x := range s {
            if x == 'B' {
                cntB++
            }
        }

        if (cntB * 2 == len(s)) {
            fmt.Println("YES")
        } else {
            fmt.Println("NO")
        }
    }
}


Are you going to Scarborough Fair?Parsley, sage, rosemary and thyme.Remember me to one who lives there.He once was the true love of mine.Willem is taking the girl to the highest building in island No.28, however, neither of them knows how to get there.Willem asks his friend, Grick for directions, Grick helped them, and gave them a task.Although the girl wants to help, Willem insists on doing it by himself.Grick gave Willem a string of length n.Willem needs to do m operations, each operation has four parameters l, r, c1, c2, which means that all symbols c1 in range [l, r] (from l-th to r-th, including l and r) are changed into c2. String is 1-indexed.Grick wants to know the final string after all the m operations.

The first line contains two integers n and m (1 ≤ n, m ≤ 100). The second line contains a string s of length n, consisting of lowercase English letters. Each of the next m lines contains four parameters l, r, c1, c2 (1 ≤ l ≤ r ≤ n, c1, c2 are lowercase English letters), separated by space.

NoteFor the second example:After the first operation, the string is wxxak.After the second operation, the string is waaak.After the third operation, the string is gaaak.

// A. Scarborough Fair
/*

Are you going to Scarborough Fair?

Parsley, sage, rosemary and thyme.

Remember me to one who lives there.

He once was the true love of mine.

Willem is taking the girl to the highest building in island No.28, however, neither of them knows how to get there.

Willem asks his friend, Grick for directions, Grick helped them, and gave them a task.

Although the girl wants to help, Willem insists on doing it by himself.

Grick gave Willem a string of length n.

Willem needs to do m operations, each operation has four parameters l, r, c 1, c 2, which means that all symbols c 1 in range [l, r] (from l-th to r-th, including l and r) are changed into c 2. String is 1-indexed.

Grick wants to know the final string after all the m operations.

Input
The first line contains two integers n and m (1 ≤ n, m ≤ 100).

The second line contains a string s of length n, consisting of lowercase English letters.

Each of the next m lines contains four parameters l, r, c 1, c 2 (1 ≤ l ≤ r ≤ n, c 1, c 2 are lowercase English letters), separated by space.

Output
Output string s after performing m operations described above.

Examples
Input
3 1
ioi
1 1 i n

Output
noi

Input
5 3
wxhak
3 3 h x
1 5 x a
1 3 w g

Output
gaaak

Note
For the second example:

After the first operation, the string is wxxak.

After the second operation, the string is waaak.

After the third operation, the string is gaaak.
*/
package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	input1, _ := reader.ReadString('\n')
	arr := strings.Split(strings.TrimSpace(input1), " ")

	m, _ := strconv.Atoi(arr[1])

	input2, _ := reader.ReadString('\n')
	s := strings.TrimSpace(input2)
	sArr := strings.Split(s, "")

	for ; m > 0; m-- {
		input3, _ := reader.ReadString('\n')
		arr := strings.Split(strings.TrimSpace(input3), " ")
		l, _ := strconv.Atoi(arr[0])
		r, _ := strconv.Atoi(arr[1])

		for i := l - 1; i < r; i++ {
			if sArr[i] == arr[2] {
				sArr[i] = arr[3]
			}
		}
	}
	fmt.Println(strings.Join(sArr, ""))
}

package main

import "fmt"

func main() {

	var n, m int
	fmt.Scan(&n, &m)

	var s string
	fmt.Scan(&s)

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

		var l, r int
		var c1, c2 string

		fmt.Scan(&l, &r, &c1, &c2)

		for i := l - 1; i < r; i++ {
			if s[i] == c1[0] {
				s = s[:i] + c2 + s[i+1:]
			}
		}

	}

	fmt.Println(s)

}

package main

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

func solve() {
	_ = readInt()
	m := readInt()
	s := []byte(readString())
	for i := 0; i < m; i++ {
		l := readInt() - 1
		r := readInt() - 1
		c1 := ([]byte(readString()))[0]
		c2 := ([]byte(readString()))[0]
		for j := l; j <= r; j++ {
			if s[j] == c1 {
				s[j] = c2
			}
		}
	}
	fmt.Println(string(s))
}

var scanner *bufio.Scanner

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

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

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

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

package main

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

func solve() {
	_ = readInt()
	m := readInt()
	s := []byte(readString())

	for i := 0; i < m; i++ {
		l := readInt() - 1
		r := readInt() - 1
		c1s := readString()
		c2s := readString()
		for j := l; j <= r; j++ {
			if s[j] == c1s[0] {
				s[j] = c2s[0]
			}
		}
	}
	fmt.Println(string(s))
}

var scanner *bufio.Scanner

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

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

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

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

package main

import (
	"fmt"
	"strings"
)

func main() {
	var n, m int
	var s string
	fmt.Scanf("%d %d\n%s\n", &n, &m, &s)
	result := strings.Split(s, "")
	for i := 0; i < m; i++ {
		var l, r int
		var c1, c2 string
		fmt.Scanf("%d %d %s %s\n", &l, &r, &c1, &c2)
		for j := l; j <= r; j++ {
			if result[j-1] == c1 {
				result[j-1] = c2
			}
		}
	}
	fmt.Println(strings.Join(result, ""))
}

package main

import (
	"fmt"
)

func main() {
	var n, m int
	fmt.Scanln(&n, &m) // no format

	var s string
	fmt.Scanln(&s)

	i2 := []rune(s)

	var l, r int
	var c1, c2 byte
	for i := 0; i < m; i++ {
		fmt.Scanf("%d %d %c %c\n", &l, &r, &c1, &c2)

		for k, v := range i2 {
			//i2[k] = rune(c2)
			if (k+1 >= l) && (k+1 <= r) {
				if v == rune(c1) {
					i2[k] = rune(c2)
				}
			}
		}
	}

	fmt.Println(string(i2))
}

package main

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

func solve() {
	readInt()
	m := readInt()
	s := []byte(readString())
	for i := 0; i < m; i++ {
		l := readInt() - 1
		r := readInt() - 1
		from := []byte(readString())[0]
		to := []byte(readString())[0]
		for j := l; j <= r; j++ {
			if s[j] == from {
				s[j] = to
			}
		}
	}
	fmt.Println(string(s))
}

var scanner *bufio.Scanner

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

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

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

// IO

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

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

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

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

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

package main
import "fmt"
import "strings"
func main() {
	var n, m, l, r int
	var a, c1, c2 string
	fmt.Scan(&n,&m,&a)
	for i:=0;i<m;i++ {
		fmt.Scan(&l,&r,&c1,&c2)
		l--
		a = a[:l] + strings.Replace(a[l:r],c1,c2,-1) + a[r:]
	}
	fmt.Print(a)
}

package main

import (
	"fmt"
)

func main() {
	var n, m int
	var s0 string
	fmt.Scan(&n, &m, &s0)
	s := ([]byte)(s0) // new and copy
	for i := 0; i < m; i++ {
		var l, r int
		var s1, s2 string
		fmt.Scan(&l, &r, &s1, &s2)
		c1 := s1[0]
		c2 := s2[0]
		for j := l - 1; j <= r - 1; j++ {
			if s[j] == c1 {
				s[j] = c2
			}
		}
	}

	fmt.Println(string(s)) // new and copy
}

package main

import (
	"fmt"
)

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	s := make([]byte, n)
	fmt.Scan(&s)
	for i := 0; i < m; i++ {
		var l, r int
		var s1, s2 string
		fmt.Scan(&l, &r, &s1, &s2)
		for j := l - 1; j <= r - 1; j++ {
			if s[j] == s1[0] {
				s[j] = s2[0]
			}
		}
	}

	fmt.Println(string(s))
}

package main

import (
	//"os"
	//"time"
	"fmt"
)

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	//var s string // string不能更改
	s := make([]byte, n)
	fmt.Scan(&s)
	//fmt.Println("s = ", s)
	//fmt.Println(n, m, s)
	for i := 0; i < m; i++ { // 不存在++i
		var l, r int
		//fmt.Scan(&l, &r)
		var s1, s2 string
		//var c1, c2 byte // byte不能用来输入？值为0
		//fmt.Scanf("%c", &c1)
		//fmt.Scanf("%c", &c2)
		fmt.Scan(&l, &r, &s1, &s2)
		c1 := s1[0]
		c2 := s2[0]
		//fmt.Println("l = ", l, "r = ", r, "c1 = ", c1, "c2 = ", c2)
		for j := l - 1; j <= r - 1; j++ {
			if s[j] == c1 {
				s[j] = c2
			}
		}
	}

	//fmt.Println(s);
	for _, v := range s {
		fmt.Printf("%c", v)
	}
	fmt.Println("")
}

package main

import (
  "fmt"
)

func main() {
  var n, m int
  fmt.Scan(&n, &m)
  var str string
  fmt.Scan(&str)
  var s = make([]string, n)
  for i := 0; i < n; i++ {
    s[i] = string(str[i])
  }
  for i := 0; i < m; i++ {
    var l, r int
    var c1, c2 string
    fmt.Scan(&l, &r, &c1, &c2)
    for j := l - 1; j < r; j++ {
      if s[j] == c1 {
        s[j] = c2
      }
    }
  }
  for i := 0; i < n; i++ {
    fmt.Print(s[i])
  }
}

package main

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

func main() {
	sc := NewScanner()
	_, M := sc.NextInt(), sc.NextInt()
	S := []byte(sc.NextLine())
	for i := 0; i < M; i++ {
		a, b := sc.NextInt()-1, sc.NextInt()-1
		z, x := sc.Next(), sc.Next()
		for p := a; p <= b; p++ {
			if S[p] == z[0] {
				S[p] = x[0]
			}
		}
	}
	fmt.Println(string(S))
}

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

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

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

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

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

	return mp
}

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

package main

import (
	"fmt"
	"strings"
)

func main() {
	var n, m int
	var s string
	fmt.Scanf("%d %d\n%s\n", &n, &m, &s)
	result := strings.Split(s, "")
	for i := 0; i < m; i++ {
		var l, r int
		var c1, c2 string
		fmt.Scanf("%d %d %s %s\n", &l, &r, &c1, &c2)
		for j := l; j < r; j++ {
			if result[j-1] == c1 {
				result[j-1] = c2
			}
		}
	}
	fmt.Println(strings.Join(result, ""))
}

package main

import (
	"fmt"
)

func main() {
	var n, m int
	fmt.Scanln(&n, &m) // no format

	var s string
	fmt.Scanf("%s", &s)

	i2 := []rune(s)

	var l, r int
	var c1, c2 byte
	for i := 0; i < m; i++ {
		fmt.Scanf("%d %d %c %c\n", &l, &r, &c1, &c2)

		for k, v := range i2 {
			//i2[k] = rune(c2)
			if (k+1 >= l) && (k+1 <= r) {
				if v == rune(c1) {
					i2[k] = rune(c2)
				}
			}
		}
	}

	fmt.Println(string(i2))
}


There are $$$n$$$ pieces of cake on a line. The $$$i$$$-th piece of cake has weight $$$a_i$$$ ($$$1 \leq i \leq n$$$).The tastiness of the cake is the maximum total weight of two adjacent pieces of cake (i. e., $$$\max(a_1+a_2,\, a_2+a_3,\, \ldots,\, a_{n-1} + a_{n})$$$).You want to maximize the tastiness of the cake. You are allowed to do the following operation at most once (doing more operations would ruin the cake):   Choose a contiguous subsegment $$$a[l, r]$$$ of pieces of cake ($$$1 \leq l \leq r \leq n$$$), and reverse it. The subsegment $$$a[l, r]$$$ of the array $$$a$$$ is the sequence $$$a_l, a_{l+1}, \dots, a_r$$$.If you reverse it, the array will become $$$a_1, a_2, \dots, a_{l-2}, a_{l-1}, \underline{a_r}, \underline{a_{r-1}}, \underline{\dots}, \underline{a_{l+1}}, \underline{a_l}, a_{r+1}, a_{r+2}, \dots, a_{n-1}, a_n$$$.For example, if the weights are initially $$$[5, 2, 1, 4, 7, 3]$$$, you can reverse the subsegment $$$a[2, 5]$$$, getting $$$[5, \underline{7}, \underline{4}, \underline{1}, \underline{2}, 3]$$$. The tastiness of the cake is now $$$5 + 7 = 12$$$ (while before the operation the tastiness was $$$4+7=11$$$).Find the maximum tastiness of the cake after doing the operation at most once.

The first line contains a single integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — the number of pieces of cake. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 10^9$$$) — $$$a_i$$$ is the weight of the $$$i$$$-th piece of cake.

For each test case, print a single integer: the maximum tastiness of the cake after doing the operation at most once.

NoteIn the first test case, after reversing the subsegment $$$a[2, 5]$$$, you get a cake with weights $$$[5, \underline{7}, \underline{4}, \underline{1}, \underline{2}, 3]$$$. The tastiness of the cake is now $$$\max(5+7, 7+4, 4+1, 1+2, 2+3) = 12$$$. This is the maximum possible tastiness of the cake one can obtain by performing the operation at most once.In the second test case, it's optimal not to do any operation. The tastiness is $$$78+78 = 156$$$.In the third test case, after reversing the subsegment $$$a[1, 2]$$$, you get a cake with weights $$$[\underline{54}, \underline{69}, 91]$$$. The tastiness of the cake is now $$$\max(54+69, 69+91) = 160$$$. There is no way to make the tastiness of the cake greater than $$$160$$$ by performing at most one operation.

package main

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

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

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

	for i := 0; i < t; i++ {
		var n, m1, m2 int
		fmt.Fscan(r, &n)
		for j := 0; j < n; j++ {
			var t int
			fmt.Fscan(r, &t)
			if t > m1 {
				m1, m2 = t, m1
			} else if t > m2 {
				m2 = t
			}
		}
		fmt.Fprintln(w, m1+m2)
	}
}

package main

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

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

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

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

		max := func(start int) {
			index := start
			for i, v := range nums[start:] {
				if v > nums[index] {
					index = i + start
				}
			}
			nums[index], nums[start] = nums[start], nums[index]
		}
		max(0)
		max(1)
		fmt.Fprintln(w, nums[0]+nums[1])
	}
}

package main

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

func solve(nums []int) int {
	// if we sort the slice then T: O(N LogN)
	// instead find Two max in   T: O(N)
	max := func(start int) {
		index := start
		for i, v := range nums[start:] {
			if v > nums[index] {
				index = i + start
			}
		}
		nums[index], nums[start] = nums[start], nums[index]
	}
	max(0)
	max(1)
	return nums[0] + nums[1]
}

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 int
		fmt.Fscanf(r, "%d\n", &n)
		nums := make([]int, n)
		for j := 0; j < n; j++ {
			fmt.Fscanf(r, "%d", &nums[j])
		}
		fmt.Fscanf(r, "\n")
		fmt.Fprintf(w, "%d\n", solve(nums))
	}
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var t, n int
	fmt.Scan(&t)
	for i := 1; i <= t; i++ {
		fmt.Scan(&n)
		a := make([]int, n+1)
		for j := 1; j <= n; j++ {
			fmt.Scan(&a[j])
		}
		sort.Ints(a)
		fmt.Println(a[len(a)-1] + a[len(a)-2])
	}
}

package main

import "fmt"

func main() {
  var jumlah_soal int;
  var jumlah_kue int;
  var max_2_kue int;
  var dua_kue int;
  var result int;
  var max_kue int;
  var max_kue_2 int;
  var jumlah_kue_max int;

fmt.Scan(&jumlah_soal);
for z:=0;z<jumlah_soal;z++ {

  dua_kue = 0;
  max_2_kue = 0;
  max_kue = 0;
  jumlah_kue_max = 1;
  max_kue_2 = 0;

  fmt.Scan(&jumlah_kue);

  kue := make([]int,jumlah_kue);

  for i:=0; i<jumlah_kue; i++ {
    fmt.Scan(&kue[i]);

    if max_kue < kue[i] {
      max_kue_2 = max_kue;
      max_kue = kue[i];
      jumlah_kue_max = 1;
    } else if max_kue == kue[i] {
      jumlah_kue_max++;
    } else if max_kue_2 < kue[i] {
      max_kue_2 = kue[i];
    }

    if i!=0 {
      dua_kue = kue[i]+kue[i-1];
      if max_2_kue < dua_kue {
        max_2_kue = dua_kue;
      }
    }
  }

  if jumlah_kue_max > 1 {
    result = max_kue + max_kue;
  }else{
    result = max_kue + max_kue_2;
  }

  fmt.Println(result)
}
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	// fmt.Println("hello")
	var t int
	fmt.Scan(&t)
	for tc := 0; tc < t; tc++ {
		var n int
		fmt.Scan(&n)

		var arr = make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Scan(&arr[i])
		}
		sort.Ints((arr))
		fmt.Println(arr[n-1] + arr[n-2])
	}
}

package main

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

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

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

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

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

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

/**
Run solve the problem CF1654A
Date: 16/05/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1654/A
Problem: CF1654A
**/
func (in *CF1654A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		arr := make([]int, n)
		for i:=0;i<n;i++{
			arr[i] = in.NextInt()
		}
		sort.Ints(arr)
		fmt.Println(arr[n-1]+arr[n-2])
	}
}

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

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

package main

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

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

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

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

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

func solve(istream *bufio.Reader) {
	n := readInt(istream)
	values := readArrInt(istream)
	maxValue := 0
	for i := 0; i < n; i++ {
		if i > 0 {
			maxValue = max(values[i]+values[i-1], maxValue)
		}
		for j := i + 1; j < n; j++ {
			if i > 0 {
				maxValue = max(values[j]+values[i-1], maxValue)
			}
			if j+1 < n {
				maxValue = max(values[i]+values[j+1], maxValue)
			}
		}
	}
	fmt.Println(maxValue)
}

func main() {
	istream := bufio.NewReader(os.Stdin)
	t := readInt(istream)
	for i := 0; i < t; i++ {
		solve(istream)
	}
}

package main

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

// 1 2 3 4
func main() {
	in, out := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ii := 0; ii < t; ii++ {
		var n int
		fmt.Fscan(in, &n)
		max1, max2 := 0, 0
		for i := 0; i < n; i++ {
			num := 0
			fmt.Fscan(in, &num)
			if num >= max1 {
				max1, max2 = num, max1
			} else if num > max2 {
				max2 = num
			}
		}
		fmt.Fprintln(out, max1+max2)
	}
}

// (k-1 + X*2)*k

package main

import (
	"fmt"
	"sort"
)

var x [][]int

func main() {
	times := 0
	fmt.Scanf("%d\n", &times)
	x = make([][]int, times)
	for i := 0; i < times; i++ {
		var l int
		fmt.Scanf("%d\n", &l)
		x[i] = make([]int, l)
		for j := 0; j < l; j++ {
			fmt.Scanf("%d", &x[i][j])
		}
		fmt.Scanln()
	}
	for i := 0; i < times; i++ {
		fmt.Println(solution(x[i]))
	}
}

func solution(nums []int) int {
	sort.Ints(nums)
	return nums[len(nums)-1] + nums[len(nums)-2]
}

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 a, b int
		for i := 0; i < n; i++ {
			var v int
			fmt.Fscan(in, &v)

			if v >= a {
				a, b = v, a
			} else if v > b {
				b = v
			}
		}

		fmt.Fprintln(out, a+b)
	}
}

package main

import (
	"fmt"
)

func main() {
	var (
		t, n int
		a    [1001]int
	)
	for fmt.Scan(&t); t > 0; t-- {
		fmt.Scan(&n)
		s1, s2 := 0, 0

		for i := 1; i <= n; i++ {
			fmt.Scan(&a[i])
			if a[i] > s2 {
				s2 = a[i]
			}
			if s1 < s2 {
				s1, s2 = s2, s1
			}
		}
		fmt.Println(s1 + s2)
	}

}

package main

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

func main() {
	var (
		t int
	)

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

	for t > 0 {
		t--

		text, _ := reader.ReadString('\n')
		ninps := strings.Fields(text)
		//n, _ := strconv.Atoi(ninps[0])

		text, _ = reader.ReadString('\n')
		ninps = strings.Fields(text)

		largest := -1
		largestId := -1
		for i, val := range ninps {
			a, _ := strconv.Atoi(val)
			if a > largest {
				largest = a
				largestId = i
			}
		}

		secondLargest := -1
		for i, val := range ninps {
			a, _ := strconv.Atoi(val)
			if a > secondLargest && largestId != i {
				secondLargest = a
			}
		}

		fmt.Println( (largest+secondLargest) )
	}
}

package main

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

/*

 */

//goland:noinspection GoUnhandledErrorResult
func solve() {
	var n int
	scanf("%d\n", &n)

	a := make([]int, n)

	for i := range a {
		scanf("%d", &a[i])
	}
	scanf("\n")

	sort.Ints(a)

	ans := a[n-1]

	if n > 1 {
		ans += a[n-2]
	}

	fmt.Fprintln(writer, ans)
}

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	t := 1
	scanf("%d\n", &t)

	for ; t > 0; t-- {
		solve()
	}
}

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

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

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func reversed(s string) string {
	input := []rune(s)
	li := len(input)
	ret := make([]rune, li)
	for i, r := range input {
		ret[li-i-1] = r
	}
	return string(ret)
}

//goland:noinspection GoUnusedFunction
func divCeil(num, div int64) int64 {
	quot := num / div
	if num%div > 0 {
		quot++
	} else if num%div < 0 {
		quot--
	}
	return quot
}

//goland:noinspection GoUnusedFunction
func min(nums ...int64) int64 {
	minNumIdx := 0
	for i, num := range nums {
		if num < nums[minNumIdx] {
			minNumIdx = i
		}
	}

	return nums[minNumIdx]
}

//goland:noinspection GoUnusedFunction
func maxIdx(nums ...int) int {
	maxNumIdx := 0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = i
		}
	}

	return maxNumIdx
}

//goland:noinspection GoUnusedFunction
func abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

//goland:noinspection GoUnusedFunction
func isPrime(num int) bool {
	if num == 2 || num == 3 {
		return true
	}

	if num <= 1 || num%2 == 0 || num%3 == 0 {
		return false
	}

	for i := 5; i*i <= num; i += 6 {
		if num%i == 0 || num%(i+2) == 0 {
			return false
		}
	}

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	if num == 0 {
		return 0
	}

	num = abs(num)

	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}

package main

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

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}
func main() {
	_r, _w := os.Stdin, os.Stdout
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	var solve func()

	/*-------------------------------Todo-----------------------------------------*/

	solve = func() {
		var n, max1, max2 int
		Fscan(in, &n)
		for i := 0; i < n; i++ {
			var t int
			Fscan(in, &t)
			if t > max1 {
				max2 = max1
				max1 = t
			} else if t > max2 {
				max2 = t
			}
		}

		Fprintln(out, max1+max2)
	}

	/*----------------------------------------------------------------------------*/
	var T int = 1
	Fscan(in, &T)
	for i := 0; i < T; i++ {
		solve()
	}
}

package main

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

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

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

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

		for j := 0; j < n-2; j++ {
			var t int
			fmt.Fscan(r, &t)
			if t > m1 {
				m1, m2 = t, m1
			} else if t > m2 {
				m2 = t
			}
		}
		fmt.Fprintln(w, m1+m2)
	}
}

package main

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

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

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

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

		max := func(start int) {
			index := start
			for i, v := range nums[start:] {
				if v > nums[index] {
					index = i + start
				}
			}
			nums[index], nums[start] = nums[start], nums[index]
		}
		max(0)
		max(1)
		fmt.Fprint(w, nums[0]+nums[1])
	}
}

package main

import (
	"fmt"
)

func solve(nums []int) {
	l1, l2 := -1, -1
	for i := 0; i < len(nums); i++ {
		if l1 < nums[i] {
			l2 = l1
			l1 = nums[i]
		} else if l2 < nums[i] {
			l2 = nums[i]
		}
	}
	fmt.Println(l1 + l2)
}

func main() {
	var cases int
	fmt.Scanf("%d\n", &cases)
	for caseID := 1; caseID <= cases; caseID++ {
		var n int
		fmt.Scanf("%d\n", &n)
		nums := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Scanf("%d", &nums[i])
		}
		solve(nums)
	}
}

package main

import "fmt"

func main() {
  var jumlah_kue int;
  var max_2_kue int;
  var dua_kue int;
  var result int;
  var max_kue int;
  var max_kue_2 int;
  var jumlah_kue_max int;
  dua_kue = 0;
  max_2_kue = 0;
  max_kue = 0;
  jumlah_kue_max = 1;
  max_kue_2 = 0;

  fmt.Scan(&jumlah_kue);

  kue := make([]int,jumlah_kue);

  for i:=0; i<jumlah_kue; i++ {
    fmt.Scan(&kue[i]);

    if max_kue < kue[i] {
      max_kue_2 = max_kue;
      max_kue = kue[i];
      jumlah_kue_max = 1;
    } else if max_kue == kue[i] {
      jumlah_kue_max++;
    } else if max_kue_2 < kue[i] {
      max_kue_2 = kue[i];
    }

    if i!=0 {
      dua_kue = kue[i]+kue[i-1];
      if max_2_kue < dua_kue {
        max_2_kue = dua_kue;
      }
    }
  }

  if jumlah_kue_max > 1 {
    result = max_kue + max_kue;
  }else{
    result = max_kue + max_kue_2;
  }

  fmt.Println(result)
}


Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it:  pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range;  stick some of the elements together in the same order they were in the array;  end up with multiple pieces, where every piece contains some of the elements and every element belongs to some piece. More formally, he partitions the sequence $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ into subsequences. He thinks a partitioning is beautiful if for every piece (subsequence) it holds that, if it has length $$$x$$$, then no value occurs strictly more than $$$\lceil \frac{x}{2} \rceil$$$ times in it.He didn't pick a range yet, so he's wondering: for $$$q$$$ ranges $$$(l, r)$$$, what is the minimum number of pieces he needs to partition the elements $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ into so that the partitioning is beautiful.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly zero) elements. Note that it does not have to be contiguous.

The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le n$$$) — the range of this query.

For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists.

NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs more than $$$2$$$ times. However, you can partition it into two subsequences: $$$[3]$$$ and $$$[2,3,3]$$$.

package main

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

// github.com/EndlessCheng/codeforces-go
var (
	_i  = 1 << 12
	buf = make([]byte, 1<<12)
	ps  [][]int
)

func rc() byte {
	if _i == 1<<12 {
		os.Stdin.Read(buf)
		_i = 0
	}
	b := buf[_i]
	_i++
	return b
}
func ri() (x int) {
	b := rc()
	for ; '0' > b; b = rc() {
	}
	for ; '0' <= b; b = rc() {
		x = x*10 + int(b&15)
	}
	return
}

type seg []struct{ l, r, v, c int }

func (t seg) do(v, c, w, d int) (int, int) {
	if v == w {
		return v, c + d
	}
	if c > d {
		return v, c - d
	}
	return w, d - c
}

func (t seg) maintain(o int) {
	lo, ro := t[o<<1], t[o<<1|1]
	t[o].v, t[o].c = t.do(lo.v, lo.c, ro.v, ro.c)
}

func (t seg) build(o, l, r int) {
	t[o].l, t[o].r = l, r
	if l == r {
		v := ri()
		t[o].v, t[o].c = v, 1
		ps[v] = append(ps[v], l)
		return
	}
	m := (l + r) >> 1
	t.build(o<<1, l, m)
	t.build(o<<1|1, m+1, r)
	t.maintain(o)
}

func (t seg) query(o, l, r int) (int, int) {
	if l <= t[o].l && t[o].r <= r {
		return t[o].v, t[o].c
	}
	m := (t[o].l + t[o].r) >> 1
	if r <= m {
		return t.query(o<<1, l, r)
	}
	if m < l {
		return t.query(o<<1|1, l, r)
	}
	a, b := t.query(o<<1, l, r)
	c, d := t.query(o<<1|1, l, r)
	return t.do(a, b, c, d)
}

func main() {
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	n, q := ri(), ri()
	ps = make([][]int, n+1)
	t := make(seg, 4*n)
	t.build(1, 1, n)
	for ; q > 0; q-- {
		l, r := ri(), ri()
		v, _ := t.query(1, l, r)
		cnt := sort.SearchInts(ps[v][sort.SearchInts(ps[v], l):], r+1)
		if sz := r - l + 1; cnt > (sz+1)/2 {
			Fprintln(out, cnt*2-sz)
		} else {
			Fprintln(out, 1)
		}
	}
}

package main

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

// github.com/EndlessCheng/codeforces-go

type seg []struct {
	l, r int
	v, c int
}

func (t seg) do(v, c, w, d int) (int, int) {
	if v == w {
		return v, c + d
	}
	if c > d {
		return v, c - d
	}
	return w, d - c
}

func (t seg) maintain(o int) {
	lo, ro := t[o<<1], t[o<<1|1]
	t[o].v, t[o].c = t.do(lo.v, lo.c, ro.v, ro.c)
}

func (t seg) build(a []int, o, l, r int) {
	t[o].l, t[o].r = l, r
	if l == r {
		t[o].v, t[o].c = a[l-1], 1
		return
	}
	m := (l + r) >> 1
	t.build(a, o<<1, l, m)
	t.build(a, o<<1|1, m+1, r)
	t.maintain(o)
}

func (t seg) query(o, l, r int) (int, int) {
	if l <= t[o].l && t[o].r <= r {
		return t[o].v, t[o].c
	}
	m := (t[o].l + t[o].r) >> 1
	if r <= m {
		return t.query(o<<1, l, r)
	}
	if m < l {
		return t.query(o<<1|1, l, r)
	}
	a, b := t.query(o<<1, l, r)
	c, d := t.query(o<<1|1, l, r)
	return t.do(a, b, c, d)
}

func newSegmentTree(a []int) seg {
	t := make(seg, 4*len(a))
	t.build(a, 1, 1, len(a))
	return t
}

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

	var n, q, l, r int
	Fscan(in, &n, &q)
	a := make([]int, n)
	ps := make([][]int, n+1)
	for i := range a {
		Fscan(in, &a[i])
		ps[a[i]] = append(ps[a[i]], i+1)
	}
	t := newSegmentTree(a)
	for ; q > 0; q-- {
		Fscan(in, &l, &r)
		v, _ := t.query(1, l, r)
		pos := ps[v]
		ll := sort.SearchInts(pos, l)
		rr := sort.SearchInts(pos, r+1)
		c := rr - ll
		sz := r - l + 1

		if c > (sz+1)/2 {
			or := sz - c
			c -= or +1
			Fprintln(out, c+1)
		} else {
			Fprintln(out, 1)
		}
	}
}

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

package main

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

type segment struct {
	ls, rs []int
	sum    []int
	cnt    int
}

func (t *segment) pushup(pos int) {
	t.sum[pos] = t.sum[t.ls[pos]] + t.sum[t.rs[pos]]
}
func (t *segment) insert(pos *int, lst, l, r, v int) {
	t.cnt++
	*pos = t.cnt
	t.ls[*pos] = t.ls[lst]
	t.rs[*pos] = t.rs[lst]
	t.sum[*pos] = t.sum[lst]
	if l == r {
		t.sum[*pos]++
		return
	}
	mid := (l + r) / 2
	if v <= mid {
		t.insert(&t.ls[*pos], t.ls[lst], l, mid, v)
	} else {
		t.insert(&t.rs[*pos], t.rs[lst], mid+1, r, v)
	}
	t.pushup(*pos)
}
func (t *segment) query(pos, lst, l, r, lim int) int {
	if t.sum[pos]-t.sum[lst] <= lim {
		return 0
	}
	if l == r {
		return t.sum[pos]-t.sum[lst]
	}
	mid := (l + r) / 2
	if t.sum[t.ls[pos]]-t.sum[t.ls[lst]] > lim {
		return t.query(t.ls[pos], t.ls[lst], l, mid, lim)
	} else {
		return t.query(t.rs[pos], t.rs[lst], mid+1, r, lim)
	}
}
func newSegmentTree(n int) segment {
	var t segment
	t.ls = make([]int, n*40)
	t.rs = make([]int, n*40)
	t.sum = make([]int, n*40)
	t.cnt = 0
	return t
}
func run(or io.Reader, ow io.Writer) {
	in := bufio.NewReader(or)
	out := bufio.NewWriter(ow)
	defer out.Flush()
	solve := func() {
		var n, q int
		fmt.Fscan(in, &n, &q)
		a := make([]int, n+1)
		for i := 1; i <= n; i++ {
			fmt.Fscan(in, &a[i])
		}
		t := newSegmentTree(n)
		rt := make([]int, n+1)
		rt[0] = 0
		for i := 1; i <= n; i++ {
			t.insert(&rt[i], rt[i-1], 1, n, a[i])
		}
		for q > 0 {
			q--
			var l, r int
			fmt.Fscan(in, &l, &r)
			res := t.query(rt[r], rt[l-1], 1, n, (r-l+2)/2)
			if res == 0 {
				fmt.Fprintln(out, 1)
			} else {
				fmt.Fprintln(out, 2*res-(r-l+1))
			}
		}
	}
	var T int = 1
	// fmt.Fscan(in, &T)
	for o := 0; o < T; o++ {
		solve()
	}
}
func main() { run(os.Stdin, os.Stdout) }

package main

import (
	"bufio"
	"fmt"
	"math"
	"math/rand"
	"os"
	"strconv"
)

type Scanner struct {
	bScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	bScanner := bufio.NewScanner(os.Stdin)
	bScanner.Split(bufio.ScanWords)
	bScanner.Buffer([]byte{}, math.MaxInt32)
	return &Scanner{
		bScanner,
	}
}
func (s *Scanner) Next() string {
	s.bScanner.Scan()
	return s.bScanner.Text()
}
func (s *Scanner) NextInt() int {
	s.bScanner.Scan()
	res, err := strconv.Atoi(s.bScanner.Text())
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) NextInt64() int64 {
	s.bScanner.Scan()
	res, err := strconv.ParseInt(s.bScanner.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) NextFloat() float64 {
	s.bScanner.Scan()
	res, err := strconv.ParseFloat(s.bScanner.Text(), 64)
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) NextInts(N int) []int {
	res := make([]int, N)
	for i := 0; i < N; i++ {
		res[i] = s.NextInt()
	}
	return res
}
func (s *Scanner) NextInt64s(N int) []int64 {
	res := make([]int64, N)
	for i := 0; i < N; i++ {
		res[i] = s.NextInt64()
	}
	return res
}
func Min(nums ...int) int {
	ans := math.MaxInt32
	for _, num := range nums {
		if num < ans {
			ans = num
		}
	}
	return ans
}
func Max(nums ...int) int {
	ans := math.MinInt32
	for _, num := range nums {
		if num > ans {
			ans = num
		}
	}
	return ans
}

func InitInts1D(n int, val int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = val
	}
	return res
}
func InitInts2D(n, m int, val int) [][]int {
	res := make([][]int, n)
	for i := 0; i < n; i++ {
		res[i] = InitInts1D(m, val)
	}
	return res
}
func InitInts3D(n, m, k int, val int) [][][]int {
	res := make([][][]int, n)
	for i := 0; i < n; i++ {
		res[i] = InitInts2D(m, k, val)
	}
	return res
}

type StepState struct {
	step, dist int
}
type PriorityQueue []*StepState

func (pq PriorityQueue) Len() int { return len(pq) }
func (pq PriorityQueue) Less(i, j int) bool {
	if pq[i].step != pq[j].step {
		return pq[i].step < pq[j].step
	}
	return pq[i].dist < pq[j].dist
}
func (pq PriorityQueue) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
}
func (pq *PriorityQueue) Push(x interface{}) {
	item := x.(*StepState)
	*pq = append(*pq, item)
}
func (pq *PriorityQueue) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	*pq = old[0 : n-1]
	return item
}

var (
	N, Q int
	arr  []int
	idx  [][]int
)

func findOcc(num, l, r int) int {
	l1, r1 := 0, len(idx[num])
	for l1 < r1 {
		m1 := (l1 + r1) / 2
		if idx[num][m1] < l {
			l1 = m1 + 1
		} else {
			r1 = m1
		}
	}

	l2, r2 := 0, len(idx[num])
	for l2 < r2 {
		m2 := (l2 + r2) / 2
		if idx[num][m2] > r {
			r2 = m2
		} else {
			l2 = m2 + 1
		}
	}

	return r2 - r1
}

func findMode(l, r int) (int, int) {
	mode, occ := -1, -1
	for i := 0; i < 50; i++ {
		toTest := arr[rand.Intn((r-l+1)*i/50+1)+l]
		curOcc := findOcc(toTest, l, r)
		if curOcc > occ {
			mode = toTest
			occ = curOcc
		}
	}
	return mode, occ
}

func main() {
	sc := NewScanner()
	wr := bufio.NewWriter(os.Stdout)
	defer wr.Flush()

	N = sc.NextInt()
	Q = sc.NextInt()
	arr = sc.NextInts(N)

	idx = make([][]int, N+1)
	for i := 0; i < N; i++ {
		idx[arr[i]] = append(idx[arr[i]], i)
	}

	for q := 0; q < Q; q++ {
		l := sc.NextInt()
		r := sc.NextInt()
		l--
		r--
		_, cntOcc := findMode(l, r)
		// fmt.Fprintln(wr, mode, cntOcc)
		n := r - l + 1
		ans := Max(1, cntOcc-(n-cntOcc))
		fmt.Fprintln(wr, ans)
	}

}

package main

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

// github.com/EndlessCheng/codeforces-go

type seg []struct {
	l, r int
	v, c int
}

func (t seg) do(v, c, w, d int) (int, int) {
	if v == w {
		return v, c + d
	}
	if c > d {
		return v, c - d
	}
	return w, d - c
}

func (t seg) maintain(o int) {
	lo, ro := t[o<<1], t[o<<1|1]
	t[o].v, t[o].c = t.do(lo.v, lo.c, ro.v, ro.c)
}

func (t seg) build(a []int, o, l, r int) {
	t[o].l, t[o].r = l, r
	if l == r {
		t[o].v, t[o].c = a[l-1], 1
		return
	}
	m := (l + r) >> 1
	t.build(a, o<<1, l, m)
	t.build(a, o<<1|1, m+1, r)
	t.maintain(o)
}

func (t seg) query(o, l, r int) (int, int) {
	if l <= t[o].l && t[o].r <= r {
		return t[o].v, t[o].c
	}
	m := (t[o].l + t[o].r) >> 1
	if r <= m {
		return t.query(o<<1, l, r)
	}
	if m < l {
		return t.query(o<<1|1, l, r)
	}
	a, b := t.query(o<<1, l, r)
	c, d := t.query(o<<1|1, l, r)
	return t.do(a, b, c, d)
}

func newSegmentTree(a []int) seg {
	t := make(seg, 4*len(a))
	t.build(a, 1, 1, len(a))
	return t
}

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

	var n, q, l, r int
	Fscan(in, &n, &q)
	a := make([]int, n)
	ps := make([][]int, n+1)
	for i := range a {
		Fscan(in, &a[i])
		ps[a[i]] = append(ps[a[i]], i+1)
	}
	t := newSegmentTree(a)
	for ; q > 0; q-- {
		Fscan(in, &l, &r)
		v, _ := t.query(1, l, r)
		pos := ps[v]
		ll := sort.SearchInts(pos, l)
		rr := sort.SearchInts(pos, r+1)
		c := rr - ll
		sz := r - l + 1

		if c > (sz+1)/2 {
			or := sz - c
			c -= or * 2
			Fprintln(out, c+1)
		} else {
			Fprintln(out, 1)
		}
	}
}

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

package main

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

// github.com/EndlessCheng/codeforces-go

type seg []struct {
	l, r int
	v, c int
}

func (t seg) do(v, c, w, d int) (int, int) {
	if v == w {
		return v, c + d
	}
	if c > d {
		return v, c-d
	}
	return w, d-c
}

func (t seg) maintain(o int) {
	lo, ro := t[o<<1], t[o<<1|1]
	t[o].v, t[o].c = t.do(lo.v, lo.c, ro.v, ro.c)
}

func (t seg) build(a []int, o, l, r int) {
	t[o].l, t[o].r = l, r
	if l == r {
		t[o].v,t[o].c = a[l-1],1
		return
	}
	m := (l + r) >> 1
	t.build(a, o<<1, l, m)
	t.build(a, o<<1|1, m+1, r)
	t.maintain(o)
}

// o=1  [l,r] 1<=l<=r<=n
func (t seg) query(o, l, r int) (int, int) {
	if l <= t[o].l && t[o].r <= r {
		return t[o].v, t[o].c
	}
	m := (t[o].l + t[o].r) >> 1
	if r <= m {
		return t.query(o<<1, l, r)
	}
	if m < l {
		return t.query(o<<1|1, l, r)
	}
	a, b := t.query(o<<1, l, r)
	c, d := t.query(o<<1|1, l, r)
	return t.do(a, b, c, d)
}

func newSegmentTree(a []int) seg {
	t := make(seg, 4*len(a))
	t.build(a, 1, 1, len(a))
	return t
}

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

	var n, q, l, r int
	Fscan(in, &n, &q)
	a := make([]int, n)
	ps := make([][]int, n+1)
	for i := range a {
		Fscan(in, &a[i])
		ps[a[i]] = append(ps[a[i]], i+1)
	}
	t := newSegmentTree(a)
	for ; q > 0; q-- {
		Fscan(in, &l, &r)
		v,_ := t.query(1, l, r)
		//Fprintln(out, v)

		pos := ps[v]
		ll := sort.SearchInts(pos, l)
		rr := sort.SearchInts(pos, r+1)
		c := rr-ll
		sz := r - l + 1
		if c > (sz+1)/2 {
			Fprintln(out, c-(sz+1)/2+1)
		} else {
			Fprintln(out, 1)
		}
	}
}

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

package main

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

type segment struct {
	ls, rs []int
	sum    []int
	cnt    int
}

func (t *segment) pushup(pos int) {
	t.sum[pos] = t.sum[t.ls[pos]] + t.sum[t.rs[pos]]
}
func (t *segment) insert(pos *int, lst, l, r, v int) {
	t.cnt++
	*pos = t.cnt
	t.ls[*pos] = t.ls[lst]
	t.rs[*pos] = t.rs[lst]
	t.sum[*pos] = t.sum[lst]
	if l == r {
		t.sum[*pos]++
		return
	}
	mid := (l + r) / 2
	if v <= mid {
		t.insert(&t.ls[*pos], t.ls[lst], l, mid, v)
	} else {
		t.insert(&t.rs[*pos], t.rs[lst], mid+1, r, v)
	}
	t.pushup(*pos)
}
func (t *segment) query(pos, lst, l, r, lim int) int {
	if t.sum[pos]-t.sum[lst] <= lim {
		return 0
	}
	if l == r {
		return t.sum[pos]
	}
	mid := (l + r) / 2
	if t.sum[t.ls[pos]]-t.sum[t.ls[lst]] > lim {
		return t.query(t.ls[pos], t.ls[lst], l, mid, lim)
	} else {
		return t.query(t.rs[pos], t.rs[lst], mid+1, r, lim)
	}
}
func newSegmentTree(n int) segment {
	var t segment
	t.ls = make([]int, n*40)
	t.rs = make([]int, n*40)
	t.sum = make([]int, n*40)
	t.cnt = 0
	return t
}
func run(or io.Reader, ow io.Writer) {
	in := bufio.NewReader(or)
	out := bufio.NewWriter(ow)
	defer out.Flush()
	solve := func() {
		var n, q int
		fmt.Fscan(in, &n, &q)
		a := make([]int, n+1)
		for i := 1; i <= n; i++ {
			fmt.Fscan(in, &a[i])
		}
		t := newSegmentTree(n)
		rt := make([]int, n+1)
		rt[0] = 0
		for i := 1; i <= n; i++ {
			t.insert(&rt[i], rt[i-1], 1, n, a[i])
		}
		for q > 0 {
			q--
			var l, r int
			fmt.Fscan(in, &l, &r)
			res := t.query(rt[r], rt[l-1], 1, n, (r-l+2)/2)
			if res == 0 {
				fmt.Fprintln(out, 1)
			} else {
				fmt.Fprintln(out, 2*res-(r-l+1))
			}
		}
	}
	var T int = 1
	// fmt.Fscan(in, &T)
	for o := 0; o < T; o++ {
		solve()
	}
}
func main() { run(os.Stdin, os.Stdout) }


A recently found Ancient Prophesy is believed to contain the exact Apocalypse date. The prophesy is a string that only consists of digits and characters "-".We'll say that some date is mentioned in the Prophesy if there is a substring in the Prophesy that is the date's record in the format "dd-mm-yyyy". We'll say that the number of the date's occurrences is the number of such substrings in the Prophesy. For example, the Prophesy "0012-10-2012-10-2012" mentions date 12-10-2012 twice (first time as "0012-10-2012-10-2012", second time as "0012-10-2012-10-2012").The date of the Apocalypse is such correct date that the number of times it is mentioned in the Prophesy is strictly larger than that of any other correct date.A date is correct if the year lies in the range from 2013 to 2015, the month is from 1 to 12, and the number of the day is strictly more than a zero and doesn't exceed the number of days in the current month. Note that a date is written in the format "dd-mm-yyyy", that means that leading zeroes may be added to the numbers of the months or days if needed. In other words, date "1-1-2013" isn't recorded in the format "dd-mm-yyyy", and date "01-01-2013" is recorded in it.Notice, that any year between 2013 and 2015 is not a leap year.

The first line contains the Prophesy: a non-empty string that only consists of digits and characters "-". The length of the Prophesy doesn't exceed 105 characters.

In a single line print the date of the Apocalypse. It is guaranteed that such date exists and is unique.

package main

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

const timeFormat = "2006-01-02"

func main() {
	fsc := NewFastScanner()
	S := fsc.Next()
	N := len(S)
	cnt := map[string]int{}
	for i := 0; i < N; i++ {
		if i+9 >= N {
			break
		}
		if S[i+2] != '-' && S[i+5] != '-' {
			continue
		}

		day := S[i : i+2]
		month := S[i+3 : i+5]
		year := S[i+6 : i+10]
		_, err := time.Parse(timeFormat, year+"-"+month+"-"+day)
		if err != nil {
			continue
		}
		if day == "00" || month == "00" {
			continue
		}
		if year == "2015" || year == "2014" || year == "2013" {
			cnt[S[i:i+10]]++
		}
	}
	maxCnt := -1
	res := ""
	for key, value := range cnt {
		if maxCnt < value {
			maxCnt = value
			res = key
		}
	}
	fmt.Println(res)
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

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

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

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

func Int64Max(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func Float64Max(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

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

func Int64Min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func Float64Min(a, b float64) float64 {
	if a > b {
		return b
	}
	return a
}

package main

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

const timeFormat = "2006-01-02"

func main() {
	fsc := NewFastScanner()
	S := fsc.Next()
	N := len(S)
	cnt := map[string]int{}
	for i := 0; i < N; i++ {
		if i+9 >= N {
			break
		}
		if S[i+2] != '-' && S[i+5] != '-' {
			continue
		}

		day := S[i : i+2]
		month := S[i+3 : i+5]
		year := S[i+6 : i+10]
		_, err := time.Parse(timeFormat, year+"-"+month+"-"+day)
		if err != nil {
			continue
		}
		if year == "2015" || year == "2014" || year == "2013" {
			cnt[S[i:i+10]]++
		}
	}
	maxCnt := -1
	res := ""
	for key, value := range cnt {
		if maxCnt < value {
			maxCnt = value
			res = key
		}
	}
	fmt.Println(res)
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

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

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

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

func Int64Max(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func Float64Max(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

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

func Int64Min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func Float64Min(a, b float64) float64 {
	if a > b {
		return b
	}
	return a
}

package main

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

const timeFormat = "2006-01-02"

func main() {
	fsc := NewFastScanner()
	S := fsc.Next()
	N := len(S)
	cnt := map[string]int{}
	for i := 0; i < N; i++ {
		if i+9 >= N {
			break
		}
		if S[i+2] != '-' && S[i+5] != '-' {
			continue
		}

		day := S[i : i+2]
		month := S[i+3 : i+5]
		year := S[i+6 : i+10]
		_, err := time.Parse(timeFormat, year+"-"+month+"-"+day)
		if err != nil {
			continue
		}
		if year == "2015" || year == "2014" || year == "2013" {
			cnt[S[i:i+10]]++
		}
	}
	maxCnt := -1
	res := ""
	for key, value := range cnt {
		if maxCnt < value {
			maxCnt = value
			res = key
		}
	}
	fmt.Println(res)
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

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

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

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

func Int64Max(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func Float64Max(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

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

func Int64Min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func Float64Min(a, b float64) float64 {
	if a > b {
		return b
	}
	return a
}