package main

import "fmt"

func solve(one, two, three, four int) int {
	sum := one + two + three + four

	if sum == 0 {
		return 0
	}
	if sum == 4 {
		return 2
	}

	return 1
}

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

	for test > 0 {
		test--
		var one, two, three, four int
		fmt.Scanln(&one, &two)
		fmt.Scanln(&three, &four)

		fmt.Println(solve(one, two, three, four))
	}
}

package main

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

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

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

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

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

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

/**
Run solve the problem CF1701A
Date: 17/07/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1701/A
Problem: CF1701A
**/
func (in *CF1701A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		a := in.NextString()+" "+in.NextString()
		b := in.NextString()+" "+in.NextString()

		ans := 0
		if a == "0 0" && b == "0 0" {
			ans = 0
		}else if a == "1 1" && b == "1 1" {
			ans = 2
		}else {
			ans  = 1
		}
		fmt.Println(ans)
	}
}

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

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

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1701A(in io.Reader, out io.Writer) {
	var T, v int
	for Fscan(in, &T); T > 0; T-- {
		c := 0
		for i := 0; i < 4; i++ {
			Fscan(in, &v)
			c += v
		}
		if c == 0 {
			Fprintln(out, 0)
		} else if c < 4 {
			Fprintln(out, 1)
		} else {
			Fprintln(out, 2)
		}
	}
}

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

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1701A(in io.Reader, out io.Writer) {
	var T, v int
	for Fscan(in, &T); T > 0; T-- {
		c := 0
		for i := 0; i < 4; i++ {
			Fscan(in, &v)
			c += v
		}
		if c == 0 {
			Fprintln(out, 0)
		} else if c < 4 {
			Fprintln(out, 1)
		} else {
			Fprintln(out, 2)
		}
	}
}

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

    // You can edit this code!
    // Click here and start typing.
    package main

    import "fmt"

    func main() {
    	var t int
    	fmt.Scanf("%d", &t)
    	for j := 0; j < t; j++ {
    		cnt := 0
    		for i := 0; i < 4; i++ {
    				var x,y int
    				fmt.Scanf("%d %d", &x,&y)
    				//fmt.Printf("x==> %v and y ==> %v \n",x,y)
    				if x == 1 {
    					cnt++
    				}
    				if y == 1 {
    				  cnt++
    				}
    		}
    		//fmt.Printf("cnt==> %v\n",cnt)
    		if cnt == 4 {
    			fmt.Printf("2\n")
    		} else if cnt == 0 {
    			fmt.Printf("0\n")
    		} else {
    			fmt.Printf("1\n")
    		}
    	}
    }

package main
import "fmt"

func main() {
    var testCase int;
    fmt.Scanf("%d ", &testCase);
    for testCase > 0 {
        v := 0
        for i:=0; i<2; i++ {
            var x, y int
            fmt.Scanf("%d %d ", &x, &y)
            v += x
            v += y
        }
        if (v == 0) {
            fmt.Println(0);
        } else if (v == 1 || v == 3 || v == 2) {
            fmt.Println(1);
        } else {
            fmt.Println(2);
        }
        testCase--;
    }

}

package main
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var x,y,x2,y2 int
		fmt.Fscan(in,&x,&y,&x2,&y2)
		if x == 1 && y == 1 && x2 == 1 && y2 == 1 {
			fmt.Fprintln(out,2)
		} else if x == 1 || y == 1 || x2 == 1 || y2 == 1 {
			fmt.Fprintln(out,1)
		} else {
			fmt.Fprintln(out,0)
		}
	}
}

package main

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

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

func main() {
	defer out.Flush()
	var t, a, cnt, ans int
	for fmt.Fscan(in, &t); t > 0; t-- {
		cnt = 0
		for i := 0; i < 4; i++ {
			fmt.Fscan(in, &a)
			if a > 0 {
				cnt++
			}
		}
		if cnt == 0 {
			ans = 0
		} else if cnt < 4 {
			ans = 1
		} else {
			ans = 2
		}
		fmt.Fprintln(out, ans)
	}
}

package main

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

var (
	reader = bufio.NewReader(os.Stdin)
	t      int
	a      []int
)

func solve(a []int) int {
	var c int
	for _, x := range a {
		c += x
	}
	if c == 0 {
		return 0
	}
	if c == 4 {
		return 2
	}
	return 1
}

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

package main

import "fmt"

func main() {
	var t, a, b, c, d int

	fmt.Scanln(&t)

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

		fmt.Scanln(&a, &b)
		fmt.Scanln(&c, &d)
		if a+b+c+d == 4 {
			fmt.Println("2")
		} else if a+b+c+d == 0 {
			fmt.Println("0")
		} else {
			fmt.Println("1")
		}
	}
}

package main

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

func Solve(testCaseIdx int, reader io.Reader, writer io.Writer) {
	sum := 0
	for k := 0; k < 4; k++ {
		var ak int
		fmt.Fscan(reader, &ak)
		sum += ak
	}
	switch {
	case sum == 0:
		fmt.Fprintln(writer, "0")
	case sum == 4:
		fmt.Fprintln(writer, "2")
	default:
		fmt.Fprintln(writer, "1")
	}
}

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

	var testCaseCount int
	fmt.Fscan(reader, &testCaseCount)
	for t := 0; t < testCaseCount; t++ {
		Solve(t, reader, writer)
	}
}

package main

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

var rr = bufio.NewReader(os.Stdin)
var ww = bufio.NewWriter(os.Stdout)

func slove() {
	var a, b, c, d int
	fmt.Fscan(rr, &a, &b, &c, &d)
	if a + b + c + d ==0 {
		fmt.Fprintln(ww, 0)
	} else if a + b + c + d == 4 {
		fmt.Fprintln(ww, 2)
	} else {
		fmt.Fprintln(ww, 1)
	}
}

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

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

		if tot == 0 {
			fmt.Fprintln(out, 0)
		} else if tot == 4 {
			fmt.Fprintln(out, 2)
		} else {
			fmt.Fprintln(out, 1)
		}
	}
}

// 1701A. Grass Field
package main

import (
	"fmt"
)

func main() {
	var T int
	fmt.Scan(&T)
	for t := 0; t < T; t++ {
		sum := 0
		curr := 0
		for i := 0; i < 4; i++ {
			fmt.Scan(&curr)
			sum += curr
		}
		if sum == 4 {
			fmt.Println(2)
		} else if sum == 0 {
			fmt.Println(0)
		} else {
			fmt.Println(1)
		}
	}
}

package main

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

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

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

	var T int
	var x int

	for Fscan(in, &T); T > 0; T-- {
		a := []int{}
		s := 0
		for i := 0; i < 4; i++ {
			Fscan(in, &x)
			s += x
			a = append(a, x)
		}

		ans := 0
		if s == 4 {
			ans = 2
		} else if s != 0 {
			ans = 1
		}

		Fprintln(out, ans)
	}
}

package main

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

var (
	writer  = bufio.NewWriter(os.Stdout)
	scanner = bufio.NewScanner(os.Stdin)
)

func init() {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 4096), 1e9)
}

func printf(f string, a ...interface{}) {
	fmt.Fprintf(writer, f, a...)
}

func _int() int {
	s := _string()
	i := 0
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int(r - '0')
	}
	return i
}

func _int64() int64 {
	s := _string()
	i := int64(0)
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int64(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int64(r - '0')
	}
	return i
}

func _string() string {
	if !scanner.Scan() {
		panic(scanner.Err())
	}
	return scanner.Text()
}

func main() {
	defer writer.Flush()
	for t := _int(); t > 0; t-- {
		a := _int()
		b := _int()
		c := _int()
		d := _int()
		printf("%d\n", solve(a, b, c, d))
	}
}

func solve(a, b, c, d int) int {
	if a == 1 && b == 1 && c == 1 && d == 1 {
		return 2
	}
	if a == 1 || b == 1 || c == 1 || d == 1 {
		return 1
	}
	return 0
}

package main

import(
	"fmt"
)

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

	for i := 0; t > i; i++ {
		var a []int
		for j := 0; 2 > j; j++ {
			var v1 int
			var v2 int
			_, err := fmt.Scan(&v1)
			if err != nil {
				panic(err)
			}
			_, err2 := fmt.Scan(&v2)
			if err2 != nil {
				panic(err)
			}
			a = append(a, v1, v2)
		}

		if a[0] + a[1] + a[2] + a[3] == 4 {
			fmt.Println("2")
		} else if a[0] + a[1] + a[2] + a[3] == 0 {
			fmt.Println("0")
		} else {
			fmt.Println("1")
		}
	}

}

package main

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

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

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

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

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

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

/**
Run solve the problem CF1701A
Date: 17/07/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1701/A
Problem: CF1701A
**/
func (in *CF1701A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		a := in.NextString()+" "+in.NextString()
		b := in.NextString()+" "+in.NextString()

		ans := 0
		if a == "0 0" && b == "0 0" {
			ans = 0
		}else if a == "0 1" && b == "0 1" {
			ans = 1
		}else if a == "1 0" && b == "0 1" {
			ans = 1
		} else if a == "0 1" && b == "1 0" {
			ans = 1
		}else if a == "1 0" && b == "1 0" {
			ans = 1
		}else if a == "1 1" && b == "1 1" {
			ans = 2
		}
		fmt.Println(ans)
	}
}

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

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

package main

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

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

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

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

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

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

/**
Run solve the problem CF1701A
Date: 17/07/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1701/A
Problem: CF1701A
**/
func (in *CF1701A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		a := in.GetLine()
		a = a[0:len(a)-1]
		b := in.GetLine()
		b = b[0:len(b)-1]

		ans := 0
		if a == "0 0" && b == "0 0" {
			ans = 0
		}else if a == "0 1" && b == "0 1" {
			ans = 1
		}else if a == "1 0" && b == "0 1" {
			ans = 1
		} else if a == "0 1" && b == "1 0" {
			ans = 1
		}else if a == "1 0" && b == "1 0" {
			ans = 1
		}else if a == "1 1" && b == "1 1" {
			ans = 2
		}
		fmt.Println(ans)
	}
}

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

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

// You can edit this code!
// Click here and start typing.
package main

import "fmt"

func main() {
	var t int
	fmt.Scanf("%d", &t)
	for j := 0; j < t; j++ {
		cnt := 0
		for i := 0; i < 2; i++ {
			for j := 0; j < 2; j++ {
				var x int
				fmt.Scanf("%d", &x)
				if x == 1 {
					cnt++
				}
			}
		}
		if cnt == 4 {
			fmt.Printf("2\n")
		} else if cnt == 0 {
			fmt.Printf("0\n")
		} else {
			fmt.Printf("1\n")
		}
	}
}

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

                            Online Go Lang Compiler.
                Code, Compile, Run and Debug Go Lang program online.
Write your code in this editor and press "Run" button to execute it.

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

package main
import "fmt"

func main() {
    var testCase int;
    fmt.Scanf("%d ", &testCase);
    for testCase > 0 {
        v := 0
        for i:=0; i<4; i++ {
            var x int
            fmt.Scanf("%d ", &x)
            v += x
        }
        if (v == 0) {
            fmt.Println(0);
        } else if (v == 1 || v == 3) {
            fmt.Println(1);
        } else {
            fmt.Println(2);
        }
        testCase--;
    }

}


//112B
package main
import "fmt"

func main() {
	var nn, xx, yy int
	fmt.Scan(&nn, &xx, &yy)
	nn/=2
	if (nn==xx || (nn+1)==xx) && (nn==yy || nn+1==yy){
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
	}
}

// 112B-mic
package main

import (
	"fmt"
)

func main() {
	var n,x,y int
	fmt.Scan(&n, &x, &y)
    if n==2 {
		fmt.Println("NO")
        return
    }else if n==4 && (y==2 || y==3) {
        fmt.Println("NO")
		return
    }else if (y==n/2 || y==(n/2)+1) && (x==n/2 || x==(n/2)+1) {
        fmt.Println("NO")
		return
	}
	fmt.Println("YES")
}

package main

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

func scanInt(scanner *bufio.Scanner) int {
  scanner.Scan()
  x, _ := strconv.Atoi(scanner.Text())
  return x
}

func main() {
  scanner := bufio.NewScanner(os.Stdin)
  scanner.Split(bufio.ScanWords)
  writer := bufio.NewWriter(os.Stdout)
  defer writer.Flush()
  side, x, y := scanInt(scanner), scanInt(scanner), scanInt(scanner)
  a, b := side/2, side/2+1
  if (x == a || x == b) && (y == a || y == b) {
    writer.WriteString("NO\n")
  } else {
    writer.WriteString("YES\n")
  }
}

package main

import "fmt"

func main() {
    var nn,x,y int
    fmt.Scan(&nn,&x,&y)
    n := nn/2
    if ((x == n) || (x == (n+1))) && ((y == n) || (y == (n+1))) {
        fmt.Println("NO")
    } else {
        fmt.Println("YES")
    }
}

// 112B-Andre,Dikai,Eric
package main

import (
    "fmt"
)

func main() {
    var n,x,y int
    fmt.Scan(&n,&x,&y)
    if n==2{
        fmt.Println("NO")
    }else{
        if ((x == (n / 2) || x == (n / 2 + 1)) && (y == (n / 2) || y == (n / 2 + 1))){
        fmt.Println("NO")
        }else
        {fmt.Println("YES")}
    }

}

// 112B
package main

import (
	"fmt"
)

func main() {
	var n, x, y int
	fmt.Scan(&n, &x, &y)
	if (x == n/2 || x == n/2+1) && (y == n/2 || y == n/2+1) {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
	}
}

package main

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

func scanInt(scanner *bufio.Scanner) int {
  scanner.Scan()
  x, _ := strconv.Atoi(scanner.Text())
  return x
}

func main() {
  scanner := bufio.NewScanner(os.Stdin)
  scanner.Split(bufio.ScanWords)
  writer := bufio.NewWriter(os.Stdout)
  defer writer.Flush()
  side, x, y := scanInt(scanner), scanInt(scanner), scanInt(scanner)
  a, b := side/2, side/2+1
  if x == a || x == b || y == a || y == b {
    writer.WriteString("NO\n")
  } else {
    writer.WriteString("YES\n")
  }
}

// 112B-Andre,Dikai,Eric
package main

import (
    "fmt"
)

func main() {
    var n,x,y int
    fmt.Scan(&n,&x,&y)
    if n==2{
        fmt.Println("NO")
    }else
    {if x == n/2 || x == (n/2)+1 && y == n/2 || y == (n/2)+1{
        fmt.Println("NO")
    }else
    {fmt.Println("YES")}
    }

}

// 112B-Andre,Dikai,Eric
package main

import (
	"fmt"
)

func main() {
	var n,x,y int
	fmt.Scan(&n,&x,&y)
	if n==2{
		fmt.Println("NO")
	}else
	{if x == n/2 || x == n/2+1 && y == n/2 || y == n/2+1{
		fmt.Println("NO")
	}else
	{fmt.Println("YES")}
	}

}


package main

import "fmt"

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

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	tabs := make([]int, n)
	sum := 0
	for i := range tabs {
		fmt.Scan(&tabs[i])
		sum += tabs[i]
	}
	ans := 0
	for b := 0; b < k; b++ {
		cur := 0
		for i := b; i < n; i += k {
			cur += tabs[i]
		}
		if x := abs(sum - cur); ans < x {
			ans = x
		}
	}

	fmt.Println(ans)
}

package main

import (
	"fmt"
	"math"
)

func main() {
	var n, k int
	var types []int

	fmt.Scan(&n, &k)
	for i := 0; i < n; i++ {
		var t int
		fmt.Scan(&t)
		types = append(types, t)
	}

	maxDiff := 0
	for i := 0; i < k; i++ {
		countTest := 0
		countSocialNetwork := 0
		for j := 0; j < n; j++ {
			if (j-i)%k != 0 {
				if types[j] == 1 {
					countTest++
				} else {
					countSocialNetwork++
				}
			}
		}
		diff := int(math.Abs(float64(countSocialNetwork - countTest)))
		if maxDiff < diff {
			maxDiff = diff
		}
	}
	fmt.Println(maxDiff)
}

package main

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

var scanner = bufio.NewScanner(os.Stdin)

func init() {
	scanner.Split(bufio.ScanWords)
}

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

func scanBytes() []byte {
	scanner.Scan()
	return scanner.Bytes()
}

func scanInt64() int64 {
	scanner.Scan()
	v, _ := strconv.ParseInt(scanner.Text(), 10, 64)
	return v
}

func scanInt() int {
	scanner.Scan()
	v, _ := strconv.Atoi(scanner.Text())
	return v
}

func scanInts(n int) []int {
	l := make([]int, n)
	for i := 0; i < n; i++ {
		scanner.Scan()
		l[i], _ = strconv.Atoi(scanner.Text())
	}

	return l
}

func scanInts64(n int64) []int64 {
	l := make([]int64, n)
	for i := int64(0); i < n; i++ {
		scanner.Scan()
		l[i], _ = strconv.ParseInt(scanner.Text(), 10, 64)
	}

	return l
}

func scanBool() bool {
	scanner.Scan()
	v, _ := strconv.ParseInt(scanner.Text(), 10, 64)
	return v == 1
}

func scanBools(n int64) []bool {
	l := make([]bool, n)
	for i := int64(0); i < n; i++ {
		scanner.Scan()
		v, _ := strconv.ParseInt(scanner.Text(), 10, 64)
		l[i] = v == 1
	}

	return l
}

func scanUint64() uint64 {
	scanner.Scan()
	v, _ := strconv.ParseUint(scanner.Text(), 10, 64)
	return v
}

type ByAge []uint64

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

func main() {
	n, k := scanInt(), scanInt()

	a := make([]int, n+1)
	for i := 0; i < n; i++ {
		scanner.Scan()
		a[i+1], _ = strconv.Atoi(scanner.Text())
	}

	// fmt.Println(a)

	best := 0
	for b := 1; b <= n; b++ {
		tmp := make([]int, len(a))
		copy(tmp, a)

		// fmt.Println("b = ", b)
		for i := -100; i < 100; i++ {
			c := b + i*k
			if c < 1 || c > n {
				continue
			}

			// fmt.Println("remove = ", c)
			tmp[c] = 0
		}

		// fmt.Println(tmp)

		e, s := 0, 0 // e - экзамен (1), s - социалки (-1)
		for i := 1; i <= n; i++ {
			if tmp[i] == 1 {
				e++
			}

			if tmp[i] == -1 {
				s++
			}
		}
		// fmt.Println("e=", e, "s=", s, "abs(e-s)=", abs(e-s))
		best = max(best, abs(e-s))
	}

	fmt.Println(best)
}

func skipZero(a []uint64) []uint64 {
	for len(a) > 0 && a[0] == 0 {
		a = a[1:]
	}

	return a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}

	return -a
}

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

	return b
}

package main

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

type CaseInput struct {
	K int64
	Tabs []int64
}

func readCaseInput(scanner *bufio.Scanner) CaseInput {
	size := readInt64(scanner)
	k := readInt64(scanner)
	tabs := make([]int64, size)
	for i := range tabs {
		tabs[i] = readInt64(scanner)
	}
	return CaseInput{k, tabs}
}

type CaseOutput struct {
	MaxDiff int64
}

func writeCaseOutput(writer *bufio.Writer, out CaseOutput) {
	writef(writer, "%d\n", abs64(out.MaxDiff))
}

func solveCase(in CaseInput) CaseOutput {
	diffs := make([]int64, in.K)
	diffsTotal := int64(0)
	for i, t := range in.Tabs {
		diffs[int64(i) % in.K] += t
		diffsTotal += t
	}

	maxDiff := abs64(diffsTotal - diffs[0])
	for b := int64(1); b < in.K; b++ {
		maxDiff = max64(abs64(diffsTotal - diffs[b]), maxDiff)
	}
	return CaseOutput{maxDiff}
}

func solveSequential(scanner *bufio.Scanner, writer *bufio.Writer) {
	writeCaseOutput(writer, solveCase(readCaseInput(scanner)))
}

func main() {
	var scanner *bufio.Scanner
	if len(os.Args) > 1 {
		reader, err := os.Open(os.Args[1])
		if err != nil {
			panic(err)
		}
		defer reader.Close()
		scanner = bufio.NewScanner(reader)
	} else {
		scanner = bufio.NewScanner(os.Stdin)
	}
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 0, 1024*1024), 1024*1024)

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

	solveSequential(scanner, writer)
}

func readInt64(sc *bufio.Scanner) int64 {
	if !sc.Scan() {
		panic("failed to scan next token")
	}

	res, err := strconv.ParseInt(sc.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return res
}

func writef(writer *bufio.Writer, formatStr string, values ...interface{}) {
	out := fmt.Sprintf(formatStr, values...)
	_, err := writer.WriteString(out)
	if err != nil {
		panic(err)
	}
}

func max64(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

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

package main

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

func solve(mat []int, t1, t2, n, b, k int) int {
	for b < n {
		if mat[b] == 1 {
			t1--
		} else {
			t2--
		}
		b += k
	}
	ans := t1 - t2
	if ans < 0 {
		ans = 0 - ans
	}
	return ans
}
func main() {
	buf := bufio.NewReader(os.Stdin)
	var n, k int
	fmt.Fscanf(buf, "%d %d\n", &n, &k)
	mat := make([]int, n+1)
	var t1 int = 0
	var t2 int = 0
	for i := 0; i < n; i++ {
		fmt.Fscanf(buf, "%d", &mat[i])
		if mat[i] == 1 {
			t1++
		} else {
			t2++
		}
	}
	max := -1
	for b := 0; b < k; b++ {
		tmp := solve(mat, t1, t2, n, b, k)
		if max == -1 || max < tmp {
			max = tmp
		}
	}
	fmt.Printf("%d\n", max)
}

package main

import (
	"fmt"
	"math"
)

const maxn = 105

var a [maxn] int

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

func main() {
	var k, n int
	fmt.Scan(&n, &k)
	cnta, cntb := 0, 0
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
		if a[i] == 1 {
			cnta++
		} else {
			cntb++
		}
	}
	best := 0
	for i := 0; i < k; i++ {
		tcnta, tcntb := cnta, cntb
		for j := i; j < n; j += k {
			if a[j] == 1 {
				tcnta--
			} else {
				tcntb--
			}
		}
		best = max(best, int(math.Abs(float64(tcnta-tcntb))))
	}
	fmt.Println(best)
}

// Codeforces 1101 B Accordion train done 3 attempts
package main

import (
	"bufio"
	"fmt"
	"strings"
	"strconv"
	"os"
)
var in *bufio.Reader

func readFive() (int,int,int,int,int) {
	var a [5]int
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("first read failure", err)
		panic(err)
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
	for i:=0; i<len(ss); i++ {
		a[i], err = strconv.Atoi(ss[i])
		if err != nil {
			fmt.Println("n atoi failure", err)
			panic(err)
		}
	}
	return a[0],a[1],a[2],a[3],a[4]
}

func readLineNumbs(n int) []int {
	a := make([]int, n)
	delim := byte(' ')
	for i:=0; i<n; i++ {
		if i==(n-1) {
			delim = byte('\n')
		}
		s, err := in.ReadString(delim)
		s = strings.Trim(s, " \n\r")
		if err != nil {
			fmt.Println("read failure", err)
			panic(err)
		}
		aa,err := strconv.Atoi(s)
		if err != nil {
			fmt.Println("aa conv failed", err)
			panic(err)
		}
		a[i] = aa
	}
	return a
}

var n,k int
var t []int
var maxdif int

func readData() {
	in = bufio.NewReader(os.Stdin)
	n,k,_,_,_ = readFive()
	t = readLineNumbs(n)
}

func solve() {
	ge,gs := 0,0
	for i:=0; i<n; i++ {
		if t[i]>0 {
			ge++
		} else {
			gs++
		}
	}
	ea := make([]int,k)
	sa := make([]int,k)
	for b:=0; b<k; b++ {
		for i:=b; i<n; i+=k {
			if t[i]>0 {
				ea[b]++
			} else {
				sa[b]++
			}
		}
	}
	maxdif = -1
	for b:=0; b<k; b++ {
		d := ((ge-ea[b]) - (gs-sa[b]))
		if d<0 {
			d = -d
		}
		if d > maxdif {
			maxdif = d
		}
	}
}

func printRes() {
	fmt.Println(maxdif)
}

func main() {
	readData()
	solve()
	printRes()
}

package main

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

type in struct {
	Scanner *bufio.Scanner
}

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

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

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

const maxn = 2e5 + 7
const inf = 0x3f3f3f3f

func main() {
	in := stdin()
	n, k := in.i(), in.i()
	re := make([]int, k)
	sum := 0
	for i := 0; i < n; i++ {
		x := in.i()
		re[i%k] += x
		sum += x
	}
	ans := 0
	for _, v := range re {
		tp := abs(sum - v)
		if tp > ans {
			ans = tp
		}
	}
	fmt.Println(ans)
}

package main

import (
	"fmt"
	"math"
	//"strings"
	//"sort"
)

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

	var browse []int
	var e, s int

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

		if each > 0 {
			e ++
		} else {
			s ++
		}

		browse = append(browse, each)
	}

	max := -1

	for i := 0; i < k; i++ {
		var e1, s1 int
		var j int = i

		for j < n {
			if browse[j] > 0 {
				e1 ++
			} else {
				s1 ++
			}

			j += k
		}

		result := ((e - e1) - (s - s1))
		if result < 0 {
			result = -result
		}

		max = int(math.Max(float64(max), float64(result)))
	}

	fmt.Println(max)
}

package main

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

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

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

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	defer writer.Flush()
	var n, k, t1, t2 int
	scanf("%d %d\n", &n, &k)
	var arr []int
	arr = []int{}

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

	ans := 0

	for i := 0; i < k; i++ {
		t1, t2 = 0, 0
		for j := 0; j < n; j++ {
			if (j-i)%k != 0 {
				if arr[j] == 1 {
					t1++
				} else {
					t2++
				}
			}
		}
		if abs(t1-t2) > ans {
			ans = abs(t1 - t2)
		}
	}

	printf("%d", ans)

}

package main

import (
	"fmt"
	"math"
)

var ns [200]int

func main() {
	var n, k int
	fmt.Scanf("%d %d\n", &n, &k)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &ns[i])
	}
	var allE, allS int
	for idx := 0; idx < n; idx++ {
		if ns[idx] > 0 {
			allE++
		} else {
			allS++
		}
	}
	maxDist := float64(-1)
	for b := 0; b < n; b++ {
		currE := float64(allE)
		currS := float64(allS)
		for i := -100; i < 100; i++ {
			c := b + i*k
			if c >= 0 && c < n {
				if ns[c] > 0 {
					currE--
				} else {
					currS--
				}
			}
		}
		maxDist = math.Max(maxDist, math.Abs(currE-currS))
	}
	fmt.Printf("%0.f\n", maxDist)
}

package main

import (
	"fmt"
	"math"
)

var ns [200]int

func main() {
	var n, k int
	fmt.Scanf("%d %d", &n, &k)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &ns[i])
	}
	var allE, allS int
	for idx := 0; idx < n; idx++ {
		if ns[idx] > 0 {
			allE++
		} else {
			allS++
		}
	}
	maxDist := float64(-1)
	for b := 0; b < n; b++ {
		currE := float64(allE)
		currS := float64(allS)
		for i := -100; i < 100; i++ {
			c := b + i*k
			if c >= 0 && c < n {
				if ns[c] > 0 {
					currE--
				} else {
					currS--
				}
			}
		}
		maxDist = math.Max(maxDist, math.Abs(currE-currS))
	}
	fmt.Printf("%0.f\n", maxDist)
}

package main

import (
	"fmt"
	"math"
)

func main() {
	var n, k int
	var types []int

	fmt.Scan(&n, &k)
	for i := 0; i < n; i++ {
		var t int
		fmt.Scan(&t)
		types = append(types, t)
	}

	maxDiff := 0
	for i := 0; i < k; i++ {
		countTest := 0
		countSocialNetwork := 0
		for j := 0; j < n; j++ {
			if (j-i)%k != 0 {
				if types[j] == 1 {
					countTest++
				} else {
					countSocialNetwork++
				}
			}
		}
		diff := int(math.Abs(float64(countSocialNetwork - countTest)))
		fmt.Println(i)
		fmt.Println(diff)
		if maxDiff < diff {
			maxDiff = diff
		}
	}
	fmt.Println(maxDiff)
}


package main

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

func scanInt(scanner *bufio.Scanner) int {
  scanner.Scan()
  x, _ := strconv.Atoi(scanner.Text())
  return x
}

func score(p, t int) int {
  x, y := 3*p, 10*p - p/25*t
  if x > y {
    return x
  } else {
    return y
  }
}

func main() {
  scanner := bufio.NewScanner(os.Stdin)
  scanner.Split(bufio.ScanWords)
  writer := bufio.NewWriter(os.Stdout)
  defer writer.Flush()
  a := scanInt(scanner)
  b := scanInt(scanner)
  c := scanInt(scanner)
  d := scanInt(scanner)
  misha, vasya := score(a, c), score(b, d)
  if misha > vasya {
    writer.WriteString("Misha\n")
  } else if misha < vasya {
    writer.WriteString("Vasya\n")
  } else {
    writer.WriteString("Tie\n")
  }
}

package main

import (
    "fmt"
)

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

func score(p int, t int) int {
	return max(3 * p / 10, p - p * t / 250)
}

func main() {
	var a, b, c, d int
    fmt.Scanf("%d %d %d %d", &a, &b, &c, &d)

	score1 := score(a, c)
	score2 := score(b, d)
	switch {
	case score1 > score2:
		fmt.Printf("Misha\n")
	case score1 < score2:
		fmt.Printf("Vasya\n")
	default:
		fmt.Printf("Tie\n")
	}
}

package main

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

var scanner = bufio.NewScanner(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

//Wrong
func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	a, b, c, d := nextInt(), nextInt(), nextInt(), nextInt()
	mPoint, vPoint := max(a * 3 / 10, a - a * c / 250), max(b * 3 / 10, b - b * d / 250)

	if mPoint == vPoint {
		println("Tie")
	} else if mPoint > vPoint {
		println("Misha")
	} else {
		println("Vasya")
	}
}

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

	return b
}

func next() string {
	if !scanner.Scan() {
		panic("Scan error")
	}
	return scanner.Text()
}

func nextInt() int {
	n, _ := strconv.Atoi(next())
	return n
}

func nextFloat() float64 {
	n, _ := strconv.ParseFloat(next(), 64)
	return n
}

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

package main

import "fmt"

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

func score(p, t int) int {
	return max(3*p/10, p-p/250*t)
}

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)
	m := score(a, c)
	v := score(b, d)
	if m > v {
		fmt.Println("Misha")
	} else if m < v {
		fmt.Println("Vasya")
	} else {
		fmt.Println("Tie")
	}
}

package main

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

func reader(a []string) func() int {
	var ptr int = -1
	return func() int {
		ptr += 1
		ret, _ := strconv.Atoi(a[ptr])
		return ret
	}
}

func getPoint(p, t int) int {
	a, b := 3 * p / 10, p - p * t / 250
	if a > b {
		return a
	}
	return b
}

func main() {
	in := bufio.NewReader(os.Stdin)
	s, _ := in.ReadString('\n')
	str := strings.Fields(s)
	nextInt := reader(str)
	a, b, c, d := nextInt(), nextInt(), nextInt(), nextInt()

	p1, p2 := getPoint(a, c), getPoint(b, d)
	if p1 > p2 {
		fmt.Println("Misha")
	}else if p1 < p2 {
		fmt.Println("Vasya")
	}else {
		fmt.Println("Tie")
	}
}

package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b, c, d float64
	fmt.Scanf("%f %f %f %f", &a, &b, &c, &d)
	mishaPoints := math.Max(3*a/10, a-c*a/250)
	vasyaPoints := math.Max(3*b/10, b-d*b/250)

	if mishaPoints > vasyaPoints {
		fmt.Print("Misha")
	} else if vasyaPoints > mishaPoints {
		fmt.Print("Vasya")
	} else {
		fmt.Print("Tie")
	}
}

package main

import (
	"fmt"
)

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

func main() {
	var a, b, c, d int

	fmt.Scan(&a, &b, &c, &d)

	m := max(3*a/10, a-a/250*c)
	v := max(3*b/10, b-b/250*d)

	var res string

	if m > v {
		res = "Misha"
	} else if m < v {
		res = "Vasya"
	} else {
		res = "Tie"
	}

	fmt.Println(res)
}

package main

import (
	"fmt"
)

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

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)

	misha := max(3*a/10, a-a/250*c)
	vasya := max(3*b/10, b-b/250*d)

	if misha > vasya {
		fmt.Println("Misha")
	} else if misha < vasya {
		fmt.Println("Vasya")
	} else {
		fmt.Println("Tie")
	}
}

package main

import (
	"fmt"
)

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

func score(p int, t int) int {
	return max(3*p/10, p-p/250*t)
}

func main() {
	for {
		var a,b,c,d int
		num, _ := fmt.Scanf("%d%d%d%d", &a, &b, &c, &d)
		if num != 4 {
			break
		}
		s1 := score(a,c)
		s2 := score(b,d)
		if s1 > s2 {
			fmt.Println("Misha")
		} else if s1 < s2 {
			fmt.Println("Vasya")
		} else {
			fmt.Println("Tie")
		}
	}
}

package main

import (
	"fmt"
)

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

func main() {
	var a, b, c, d int

	fmt.Scan(&a, &b, &c, &d)

	m := max(3*a/10, a/250*c)
	v := max(3*b/10, b/250*d)

	var res string

	if m > v {
		res = "Misha"
	} else if m < v {
		res = "Vasya"
	} else {
		res = "Tie"
	}

	fmt.Println(res)
}

package main

import (
	"fmt"
)

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

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)

	misha := max(3*a/10, a/250*c)
	vasya := max(3*b/10, b/250*d)

	if misha > vasya {
		fmt.Println("Misha")
	} else if misha < vasya {
		fmt.Println("Vasya")
	} else {
		fmt.Println("Tie")
	}
}


package main

import (
	"fmt"
)

func main() {
	var n, m, a int
	fmt.Scan(&n)
	fmt.Scan(&m)
	var z, t int
	for i := 0; i < n; i++ {
		fmt.Scan(&a)
		x := (a + m - 1) / m
		if x >= t {
			t = x
			z = i
		}
	}
	fmt.Println(z + 1)
}

package main

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

var scanner = bufio.NewScanner(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

//Wrong
func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	n, m := nextInt(), nextInt()

	maxline, line, pos, a := 0, 0, 0, 0

	for i := 0; i < n; i++ {
		a = nextInt()

		line = a / m

		if a % m > 0 {
			line++
		}

		if line >= maxline {
			maxline = line
			pos = i
		}
	}

	println(pos + 1)
}

func next() string {
	if !scanner.Scan() {
		panic("Scan error")
	}
	return scanner.Text()
}

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

func nextFloat() float64 {
	n, err := strconv.ParseFloat(next(), 64)
	if err != nil {
		panic(err)
	}
	return n
}

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

func print(a ...interface{}) {
	fmt.Fprint(writer, a...)
}

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

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	n, m := 0, 0
	if scanner.Scan() {
		line := scanner.Text()
		fmt.Sscanf(line, "%d %d", &n, &m)
	}

	if scanner.Scan() {
		line := scanner.Text()
		tokens := strings.Fields(line)
		childRequirement := make([]int, n)

		for i := 0; i < n; i++ {
			childRequirement[i], _ = strconv.Atoi(tokens[i])
		}

		childGet := make([]int, n)

		lastChild := 0
		for {
			finishes := true
			for i := 0; i < n; i++ {
				if childGet[i] < childRequirement[i] {
					childGet[i] = childGet[i] + m
					lastChild = i
				}

				if childGet[i] < childRequirement[i] {
					finishes = false
				}
			}
			if finishes {
				break
			}
		}
		fmt.Println(lastChild + 1)
	}
}

package main

import "fmt"

func main() {

	var a, n, m, num int

	fmt.Scan(&n)
	fmt.Scan(&m)

	max := 0
	for i := 1; i <= n; i++ {
		fmt.Scan(&a)

		if ((a + m - 1) / m) >= max {
			max = (a + m - 1) / m
			num = i
		}

	}
	fmt.Println(num)
}

package main

import (
    "fmt"
    )

type child struct {
    index   int
    left    int
}

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

    an := make([]child, 2*n, 2*n)
    for i := 0; i < n; i++ {
        var a int
        fmt.Scan(&a)
        an[i].left = a
        an[i].index = i+1
    }

    left := n
    ans := n
    for left > 0 {
        tmp := left
        left = 0
        for i := 0; i < tmp; i++ {
            if an[i].left > m {
                an[n+left].index, an[n+left].left = an[i].index, an[i].left-m
                left++
            }
        }
        if left == 0 {
            ans = an[tmp-1].index
            break
        }
        for i := n; i < left+n; i++ {
            an[i-n].index, an[i-n].left = an[i].index, an[i].left
        }
    }

    fmt.Println(ans)
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	n, m := 0, 0
	if scanner.Scan() {
		line := scanner.Text()
		fmt.Sscanf(line, "%d %d", &n, &m)
	}

	if scanner.Scan() {
		line := scanner.Text()
		tokens := strings.Fields(line)
		childRequirement := make([]int, n)

		for i := 0; i < n; i++ {
			childRequirement[i], _ = strconv.Atoi(tokens[i])
		}

		childGet := make([]int, n)

		lastChild := 0
		for {
			finishes := true
			for i := 0; i < n; i++ {
				if childGet[i] < childRequirement[i] {
					childGet[i] = childGet[i] + m
					lastChild = i
				}

				if childGet[i] < childRequirement[i] {
					finishes = false
				}
			}
			if finishes {
				break
			}
		}
		fmt.Println(childGet)
		fmt.Println(lastChild + 1)
	}
}

package main

import "fmt"

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

	fmt.Scan(&a)
	fmt.Scan(&b)

	for i := 1; a <= b; i++ {
		a = a * 3
		b = b * 2
		year = i
	}
	fmt.Println(year)
}


package main

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

var all = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

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

	var strin string
	fmt.Fscanf(bufin, "%s\n", &strin)
	in := []byte(strin)
	var needa [26]int
	leftlen := len(in)
	base := 0
	f := 0
	b := 0
	if leftlen < 26 {
		fmt.Println(-1)
		return
	}

	// once
	for {
		if in[b] == '?' {
			base++
		} else {
			needa[in[b]-'A']++
			if needa[in[b]-'A'] == 1 {
				base++
			}
		}
		if b == 25 {
			break
		}
		b++
	}
	var ok bool
	for {
		var empty int
		if base == 26 {
			ok = true
			// for idx := 0; idx != f; idx++ {
			// 	if in[idx] == '?' {
			// 		fmt.Print("A")
			// 	} else {
			// 		fmt.Print(string(in[idx]))
			// 	}
			// }
			for idx := f; idx != b+1; idx++ {
				if in[idx] == '?' {
					for k := empty; ; k++ {
						if needa[k] == 0 {
							in[idx] = all[k]
							empty = k + 1
							break
						}
					}
				}
			}
			for idx := b + 1; idx != len(in); idx++ {
				if in[idx] == '?' {
					in[idx] = 'A'
				}
			}
			break
		}
		f++
		b++
		leftlen--
		if leftlen < 26 {
			fmt.Println(-1)
			break
		}
		if in[f-1] == '?' {
			in[f-1] = 'A'
			base--
		} else {
			needa[in[f-1]-'A']--
			if needa[in[f-1]-'A'] == 0 {
				base--
			}
		}

		if in[b] == '?' {
			base++
		} else {
			if needa[in[b]-'A'] == 0 {
				base++
			}
			needa[in[b]-'A']++
		}
	}
	if ok {
		fmt.Fprintf(bufout, "%s\n", in)
	}
}

package main

import "fmt"
import "bufio"
import "os"

var bufin *bufio.Reader
var bufout *bufio.Writer

func good(a []byte, n int, pos int) bool {
	var has [26]bool
	for c := 0; c < 26; c++ {
		has[c] = false
	}

	for i := 0; i < 26; i++ {
		x := a[pos+i]
		if x != '?' {
			c := x - 'A'
			if has[c] {
				return false
			}
			has[c] = true
		}
	}

	c := 0
	for i := 0; i < 26; i++ {
		if a[pos+i] == '?' {
			for has[c] {
				c++
			}
			has[c] = true
			a[pos+i] = byte(c + 'A')
		}
	}

	for i := 0; i < n; i++ {
		if a[i] == '?' {
			a[i] = 'A'
		}
	}

	return true
}

func main() {
	bufin = bufio.NewReader(os.Stdin)
	bufout = bufio.NewWriter(os.Stdout)
	defer bufout.Flush()

	var s string
	fmt.Fscanf(bufin, "%s\n", &s)

	a := []byte(s)
	n := len(a)

	found := false
	for i := 0; i+26 <= n; i++ {
		if good(a, n, i) {
			found = true
			break
		}
	}

	if found {
		fmt.Fprintf(bufout, "%s\n", a)
	} else {
		fmt.Fprintf(bufout, "%d\n", -1)
	}

}

package main

import "fmt"

var all = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

func main() {
	in := ScanLine()
	needa := make(map[byte]int)
	noyou := make(map[byte]int)
	for idx := range all {
		noyou[all[idx]]++
	}
	leftlen := len(in)
	base := 0
	f := 0
	b := 0
	if leftlen < 26 {
		fmt.Println(-1)
		return
	}

	// once
	for {
		if in[b] == '?' {
			base++
		} else {
			delete(noyou, in[b])
			needa[in[b]]++
			if needa[in[b]] == 1 {
				base++
			}
		}
		if b == 25 {
			break
		}
		b++
	}
	for {
		if base == 26 {
			for idx := 0; idx != f; idx++ {
				if in[idx] == '?' {
					fmt.Print("A")
				} else {
					fmt.Print(string(in[idx]))
				}
			}
			for idx := f; idx != b+1; idx++ {
				if in[idx] == '?' {
					for k := range noyou {
						fmt.Print(string(k))
						delete(noyou, k)
						break
					}
				} else {
					fmt.Print(string(in[idx]))
				}
			}
			for idx := b + 1; idx != len(in); idx++ {
				if in[idx] == '?' {
					fmt.Print("A")
				} else {
					fmt.Print(string(in[idx]))
				}
			}
			fmt.Println()
			break
		}
		f++
		b++
		leftlen--
		if leftlen < 26 {
			fmt.Println(-1)
			break
		}
		if in[f-1] == '?' {
			base--
		} else {
			needa[in[f-1]]--
			if needa[in[f-1]] == 0 {
				noyou[in[f-1]] = 1
				base--
			}
		}

		if in[b] == '?' {
			base++
		} else {
			if needa[in[b]] == 0 {
				base++
				delete(noyou, in[b])
			}
			needa[in[b]]++
		}
	}
}

func ScanLine() string {
	var c byte
	var err error
	var b []byte
	for err == nil {
		_, err = fmt.Scanf("%c", &c)

		if c != '\n' && c != byte(13) {
			b = append(b, c)
		} else {
			break
		}
	}

	return string(b)
}

package main

import "fmt"

var all = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

func main() {
	in := ScanLine()
	var needa [26]int
	leftlen := len(in)
	base := 0
	f := 0
	b := 0
	if leftlen < 26 {
		fmt.Println(-1)
		return
	}

	// once
	for {
		if in[b] == '?' {
			base++
		} else {
			needa[in[b]-'A']++
			if needa[in[b]-'A'] == 1 {
				base++
			}
		}
		if b == 25 {
			break
		}
		b++
	}
	for {
		var empty int
		if base == 26 {
			for idx := 0; idx != f; idx++ {
				if in[idx] == '?' {
					fmt.Print("A")
				} else {
					fmt.Print(string(in[idx]))
				}
			}
			for idx := f; idx != b+1; idx++ {
				if in[idx] == '?' {
					for k := empty; ; k++ {
						if needa[k] == 0 {
							fmt.Print(string(all[k]))
							empty = k + 1
							break
						}
					}
				} else {
					fmt.Print(string(in[idx]))
				}
			}
			for idx := b + 1; idx != len(in); idx++ {
				if in[idx] == '?' {
					fmt.Print("A")
				} else {
					fmt.Print(string(in[idx]))
				}
			}
			fmt.Println()
			break
		}
		f++
		b++
		leftlen--
		if leftlen < 26 {
			fmt.Println(-1)
			break
		}
		if in[f-1] == '?' {
			base--
		} else {
			needa[in[f-1]-'A']--
			if needa[in[f-1]-'A'] == 0 {
				base--
			}
		}

		if in[b] == '?' {
			base++
		} else {
			if needa[in[b]-'A'] == 0 {
				base++
			}
			needa[in[b]-'A']++
		}
	}
}

func ScanLine() string {
	var c byte
	var err error
	var b []byte
	for err == nil {
		_, err = fmt.Scanf("%c", &c)

		if c != '\n' && c != byte(13) {
			b = append(b, c)
		} else {
			break
		}
	}

	return string(b)
}

package main

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

func main() {
	marks := make([]bool, 26)
	letter := 0
	question := 0
	ok := false

	reader := bufio.NewReader(os.Stdin)
	re := regexp.MustCompile(`\r?\n`)
	if _in, err := reader.ReadString('\n'); err != nil {
		if err != io.EOF {
			return
		}
	} else {
		in := re.ReplaceAllString(_in, "")

		if len(in) < 26 {
			fmt.Println(-1)
			return
		}

		s := 0
		p := 0
		for s <= len(in)-25 {
			if in[s] == '?' {
				letter = 0
				question = 1
			} else {
				marks[in[s]-'A'] = true
				letter = 1
				question = 0
			}
			p = s + 1
			for p < len(in) && p-s < 26 {
				if in[p] == '?' {
					question++
				} else if marks[in[p]-'A'] {
					for i := 0; i < 26; i++ {
						marks[i] = false
					}
					j := p - 1
					for j > s && j < len(in) && (in[j] == '?' || in[j] != in[p]) {
						j--
					}
					s = j + 1
					break
				} else {
					marks[in[p]-'A'] = true
					letter++
				}
				p++
			}
			if letter+question == 26 {
				ok = true
				break
			}
		}
		if ok {
			i := 0
			for ; i < s; i++ {
				if in[i] == '?' {
					fmt.Printf("A")
				} else {
					fmt.Printf("%c", in[i])
				}
			}
			for ; i < p; i++ {
				if in[i] == '?' {
					for j := 0; j < 26; j++ {
						if !marks[j] {
							marks[j] = true
							fmt.Printf("%c", 'A'+j)
							break
						}
					}
				} else {
					fmt.Printf("%c", in[i])
				}
			}
			for ; i < len(in); i++ {
				if in[i] == '?' {
					fmt.Printf("A")
				} else {
					fmt.Printf("%c", in[i])
				}
			}
			fmt.Printf("\n")
		} else {
			fmt.Println(-1)
		}
	}
}

// Codeforces 716 B Complete the Word
// int - 32 bit type !!!!
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
	"strconv"
)
var in *bufio.Reader

func readFive() (int,int,int,int,int) {
    var a [5]int
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("first read failure", err)
		panic(err)
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
    for i:=0; i<len(ss); i++ {
        a[i], err = strconv.Atoi(ss[i])
        if err != nil {
            fmt.Println("n atoi failure", err)
            panic(err)
        }
    }
    return a[0],a[1],a[2],a[3],a[4]
}

func readLineNumbs(n int) []int {
    a := make([]int, n)
    s, err := in.ReadString('\n')
    if err != nil {
        fmt.Println("read failure", err)
        panic(err)
    }
    ss := strings.Split(strings.Trim(s, " \n\r"), " ")
    for j:=0; j<n; j++ {
        aa,err := strconv.Atoi(ss[j])
        if err != nil {
            fmt.Println("aa conv failed", err)
            panic(err)
        }
        a[j] = aa
    }
    return a
}

var n int
var s string
var ok bool
var aout []byte

func readData() {
 	in = bufio.NewReader(os.Stdin)
	// reading s
    s,_ = in.ReadString('\n')
    s = strings.Trim(s, " \n\r")
    n = len(s)
}

func solve() {
    nch := make([]int, 26)
    n2 := 0
    var ich int
    ok = false

    for i:=0; i<n; i++ {
        if s[i]!='?' {
            ich = int(s[i] - 'A')
            if ich>=26 {
                fmt.Println("Error, ich,i = ",ich,i)
            }
            nch[ich] ++
            //fmt.Println("++ich,nch=",nch,ich)
            if nch[ich] == 2 {
                n2++
            }
        }
        if i>=26 {
            if s[i-26] != '?' {
                ich = int(s[i-26] - 'A')
                nch[ich]--
               //fmt.Println("--ich,nch=",nch,ich)
               if nch[ich]==1 {
                    n2--
                }
            }
        }
        //fmt.Println("i,n2=",i,n2)
        if i>=25 && n2==0 {
            // we found solution, copy to aout
            aout = make([]byte, n)
            for ii:=0; ii<n; ii++ {
                if s[ii] != '?' {
                    aout[ii] = s[ii]
                }
            }
            for ii:=0; ii<i-25; ii++ {
                if s[ii]=='?' {
                    aout[ii] = 'A'
                }
            }
            iich := 0
            for ii:=i-25; ii<=i; ii++ {
                if s[ii] == '?' {
                    for nch[iich] > 0 {
                        iich ++
                    }
                    aout[ii] = byte(iich+'A')
                    iich++
                }
            }
            for ii:=i+1; ii<n; ii++ {
                if s[ii]=='?' {
                    aout[ii] = 'A'
                }
            }
            ok = true
            break
        }
    }
}

func printRes() {
    if ok {
        fmt.Println(string(aout))
    } else {
        fmt.Println(-1)
    }
}

func main() {
 	readData()
    solve()
    printRes()
}

package main

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

func main() {
	var alphabet map[string]bool = map[string]bool{}

	reader := bufio.NewReader(os.Stdin)
	input, _ := reader.ReadString('\n')

	if len(input) < 26 {
		fmt.Println(-1)
		return
	} else {
		for i := 0; i <= (len(input) - 26); i++ {
			testString := input[i : i+26]
			for _, key := range strings.Split("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "") {
				alphabet[key] = false
			}
			questions := []int{}
			failed := false

			for j, s := range testString {
				if string(s) == "?" {
					questions = append(questions, j)
					continue
				}
				if !alphabet[string(s)] {
					alphabet[string(s)] = true
				} else {
					failed = true
					break
				}
			}

			if !failed {
				notFoundKeys := []string{}
				for k, v := range alphabet {
					if !v {
						notFoundKeys = append(notFoundKeys, k)
					}
				}
				if len(notFoundKeys) == len(questions) {
					for qi, qidx := range questions {
						testString = testString[:qidx] + notFoundKeys[qi] + testString[qidx+1:]
					}
					input = strings.Replace(input, input[i:i+26], testString, 1)
					input = strings.Replace(input, "?", "A", -1)
					fmt.Println(input)
					return
				}
			}
		}
		fmt.Println(-1)
		return
	}
}

package main

import "fmt"

var all = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

func main() {
	in := ScanLine()
	needa := make(map[byte]int)
	noyou := make(map[byte]int)
	for idx := range all {
		noyou[all[idx]]++
	}
	leftlen := len(in)
	base := 0
	f := 0
	b := 0
	if leftlen < 26 {
		fmt.Println(-1)
		return
	}

	// once
	for {
		if in[b] == '?' {
			base++
		} else {
			delete(noyou, in[b])
			needa[in[b]]++
			if needa[in[b]] == 1 {
				base++
			}
		}
		if b == 25 {
			break
		}
		b++
	}
	for {
		if base == 26 {
			for idx := 0; idx != f; idx++ {
				if in[idx] == '?' {
					fmt.Print("A")
				} else {
					fmt.Print(string(in[idx]))
				}
			}
			for idx := f; idx != b+1; idx++ {
				if in[idx] == '?' {
					for k := range noyou {
						fmt.Print(string(k))
						delete(noyou, k)
						break
					}
				} else {
					fmt.Print(string(in[idx]))
				}
			}
			for idx := b + 1; idx != len(in); idx++ {
				if in[idx] == '?' {
					fmt.Print("A")
				} else {
					fmt.Print(string(in[idx]))
				}
			}
			fmt.Println()
			break
		}
		f++
		b++
		leftlen--
		if leftlen < 26 {
			fmt.Println(-1)
			break
		}
		if in[f-1] == '?' {
			base--
		} else {
			needa[in[f-1]]--
			if needa[in[f-1]] == 0 {
				noyou[in[f-1]] = 1
				base--
			}
		}

		if in[b] == '?' {
			base++
		} else {
			if needa[in[b]] == 0 {
				base++
				delete(noyou, in[b])
			}
			needa[in[b]]++
		}
	}
}

func ScanLine() string {
	var c byte
	var err error
	var b []byte
	for err == nil {
		_, err = fmt.Scanf("%c", &c)

		if c != '\n' {
			b = append(b, c)
		} else {
			break
		}
	}

	return string(b)
}

package main

import "fmt"

var all = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

func main() {
	in := ScanLine()
	needa := make(map[byte]int)
	noyou := make(map[byte]int)
	for idx := range all {
		noyou[all[idx]]++
	}
	leftlen := len(in)
	base := 0
	f := 0
	b := 0
	if leftlen < 26 {
		fmt.Println(-1)
		return
	}

	// once
	for {
		if in[b] == '?' {
			base++
		} else {
			delete(noyou, in[b])
			needa[in[b]]++
			if needa[in[b]] == 1 {
				base++
			}
		}
		if b == 25 {
			break
		}
		b++
	}

	for {
		if base == 26 {
			for idx := f; idx != b+1; idx++ {
				if in[idx] == '?' {
					for k := range noyou {
						fmt.Print(string(k))
						delete(noyou, k)
					}
				} else {
					fmt.Print(string(in[idx]))
				}
			}
			fmt.Println()
			break
		}
		f++
		b++
		leftlen--
		if leftlen < 26 {
			fmt.Println(-1)
			break
		}
		needa[in[f-1]]--
		if needa[in[f-1]] == 0 {
			noyou[in[f-1]] = 1
		}
		if needa[in[b]] == 0 {
			delete(noyou, in[b])
		}
		needa[in[b]]++
	}
}

func ScanLine() string {
	var c byte
	var err error
	var b []byte
	for err == nil {
		_, err = fmt.Scanf("%c", &c)

		if c != '\n' {
			b = append(b, c)
		} else {
			break
		}
	}

	return string(b)
}

package main

import "fmt"

var all = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

func main() {
	in := ScanLine()
	needa := make(map[byte]int)
	noyou := make(map[byte]int)
	for idx := range all {
		noyou[all[idx]]++
	}
	leftlen := len(in)
	base := 0
	f := 0
	b := 0
	if leftlen < 26 {
		fmt.Println(-1)
		return
	}

	// once
	for {
		if in[b] == '?' {
			base++
		} else {
			delete(noyou, in[b])
			needa[in[b]]++
			if needa[in[b]] == 1 {
				base++
			}
		}
		if b == 25 {
			break
		}
		b++
	}

	for {
		if base == 26 {
			for idx := f; idx != b+1; idx++ {
				if in[idx] == '?' {
					for k := range noyou {
						fmt.Print(string(k))
						delete(noyou, k)
						break
					}
				} else {
					fmt.Print(string(in[idx]))
				}
			}
			fmt.Println()
			break
		}
		f++
		b++
		leftlen--
		if leftlen < 26 {
			fmt.Println(-1)
			break
		}
		needa[in[f-1]]--
		if needa[in[f-1]] == 0 {
			noyou[in[f-1]] = 1
		}
		if needa[in[b]] == 0 {
			delete(noyou, in[b])
		}
		needa[in[b]]++
	}
}

func ScanLine() string {
	var c byte
	var err error
	var b []byte
	for err == nil {
		_, err = fmt.Scanf("%c", &c)

		if c != '\n' {
			b = append(b, c)
		} else {
			break
		}
	}

	return string(b)
}

package main

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

func main() {
	marks := make([]bool, 26)
	letter := 0
	question := 0
	ok := false

	reader := bufio.NewReader(os.Stdin)
	re := regexp.MustCompile(`\r?\n`)
	if _in, err := reader.ReadString('\n'); err != nil {
		if err != io.EOF {
			return
		}
	} else {
		in := re.ReplaceAllString(_in, "")

		s := 0
		p := 0
		for s <= len(in)-25 {
			if in[s] == '?' {
				letter = 0
				question = 1
			} else {
				marks[in[s]-'A'] = true
				letter = 1
				question = 0
			}
			p = s + 1
			for p < len(in) && p-s < 26 {
				if in[p] == '?' {
					question++
				} else if marks[in[p]-'A'] {
					for i := 0; i < 26; i++ {
						marks[i] = false
					}
					j := p - 1
					for in[j] == '?' {
						j--
					}
					s = j + 1
					break
				} else {
					marks[in[p]-'A'] = true
					letter++
				}
				p++
			}
			if letter+question == 26 {
				ok = true
				break
			}
		}
		if ok {
			i := 0
			for ; i < s; i++ {
				if in[i] == '?' {
					fmt.Printf("A")
				} else {
					fmt.Printf("%c", in[i])
				}
			}
			for ; i < p; i++ {
				if in[i] == '?' {
					for j := 0; j < 26; j++ {
						if !marks[j] {
							marks[j] = true
							fmt.Printf("%c", 'A'+j)
							break
						}
					}
				} else {
					fmt.Printf("%c", in[i])
				}
			}
			for ; i < len(in); i++ {
				if in[i] == '?' {
					fmt.Printf("A")
				} else {
					fmt.Printf("%c", in[i])
				}
			}
			fmt.Printf("\n")
		} else {
			fmt.Println(-1)
		}
	}
}

package main

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

func main() {
	marks := make([]bool, 26)
	letter := 0
	question := 0
	ok := false

	reader := bufio.NewReader(os.Stdin)
	re := regexp.MustCompile(`\r?\n`)
	if _in, err := reader.ReadString('\n'); err != nil {
		if err != io.EOF {
			return
		}
	} else {
		in := re.ReplaceAllString(_in, "")

		s := 0
		p := 0
		for s <= len(in)-25 {
			if in[s] == '?' {
				letter = 0
				question = 1
			} else {
				marks[in[s]-'A'] = true
				letter = 1
				question = 0
			}
			p = s + 1
			for p < len(in) && p-s < 26 {
				if in[p] == '?' {
					question++
				} else if marks[in[p]-'A'] {
					for i := 0; i < 26; i++ {
						marks[i] = false
					}
					s = p
					break
				} else {
					marks[in[p]-'A'] = true
					letter++
				}
				p++
			}
			if letter+question == 26 {
				ok = true
				break
			}
		}
		if ok {
			i := 0
			for ; i < s; i++ {
				if in[i] == '?' {
					fmt.Printf("A")
				} else {
					fmt.Printf("%c", in[i])
				}
			}
			for ; i < p; i++ {
				if in[i] == '?' {
					for j := 0; j < 26; j++ {
						if !marks[j] {
							marks[j] = true
							fmt.Printf("%c", 'A'+j)
							break
						}
					}
				} else {
					fmt.Printf("%c", in[i])
				}
			}
			for ; i < len(in); i++ {
				if in[i] == '?' {
					fmt.Printf("A")
				} else {
					fmt.Printf("%c", in[i])
				}
			}
			fmt.Printf("\n")
		} else {
			fmt.Println(-1)
		}
	}
}

package main

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

func main() {
	marks := make([]bool, 26)
	letter := 0
	question := 0
	ok := false

	reader := bufio.NewReader(os.Stdin)
	re := regexp.MustCompile(`\r?\n`)
	if _in, err := reader.ReadString('\n'); err != nil {
		if err != io.EOF {
			return
		}
	} else {
		in := re.ReplaceAllString(_in, "")

		s := 0
		p := 0
		for s <= len(in)-25 {
			p = s
			for p < len(in) && p-s < 26 {
				if in[p] == '?' {
					question++
				} else if marks[in[p]-'A'] {
					for i := 0; i < 26; i++ {
						marks[i] = false
					}
					marks[in[p]-'A'] = true
					letter = 1
					question = 0
					s = p
					break
				} else {
					marks[in[p]-'A'] = true
					letter++
				}
				p++
			}
			if letter+question == 26 {
				ok = true
				break
			}
			s++
		}
		if ok {
			i := 0
			for ; i < s; i++ {
				if in[i] == '?' {
					fmt.Printf("A")
				} else {
					fmt.Printf("%c", in[i])
				}
			}
			for ; i < p; i++ {
				if in[i] == '?' {
					for j := 0; j < 26; j++ {
						if !marks[j] {
							marks[j] = true
							fmt.Printf("%c", 'A'+j)
							break
						}
					}
				} else {
					fmt.Printf("%c", in[i])
				}
			}
			for ; i < len(in); i++ {
				if in[i] == '?' {
					fmt.Printf("A")
				} else {
					fmt.Printf("%c", in[i])
				}
			}
			fmt.Printf("\n")
		} else {
			fmt.Println(-1)
		}
	}
}

package main

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

func main() {
	var alphabet map[string]bool = map[string]bool{}
	for _, key := range strings.Split("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "") {
		alphabet[key] = false
	}

	reader := bufio.NewReader(os.Stdin)
	input, _ := reader.ReadString('\n')

	//var input string = "AABCDEFGHIJKLMNOPQRSTUVW??M"

	if len(input) < 26 {
		fmt.Println(-1)
		return
	} else {
		for i := 0; i <= (len(input) - 26); i++ {
			testString := input[i : i+26]
			testAlphabet := alphabet
			questions := []int{}
			failed := false

			for j, s := range testString {
				if string(s) == "?" {
					questions = append(questions, j)
					continue
				}
				if !alphabet[string(s)] {
					alphabet[string(s)] = true
				} else {
					failed = true
					break
				}
			}

			if !failed {
				notFoundKeys := []string{}
				for k, v := range testAlphabet {
					if !v {
						notFoundKeys = append(notFoundKeys, k)
					}
				}
				if len(notFoundKeys) == len(questions) {
					for qi, qidx := range questions {
						testString = testString[:qidx] + notFoundKeys[qi] + testString[qidx+1:]
					}
					fmt.Println(testString)
					return
				}
			}
		}
		fmt.Println(-1)
		return
	}
}

package main

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

func main() {
	var alphabet map[string]bool = map[string]bool{}

	reader := bufio.NewReader(os.Stdin)
	input, _ := reader.ReadString('\n')

	input = "ABABABBAB????????????ABABABABA???????????ABABABABA?????????KLCSJB?????????Z"

	if len(input) < 26 {
		fmt.Println(-1)
		return
	} else {
		for i := 0; i <= (len(input) - 26); i++ {
			testString := input[i : i+26]
			for _, key := range strings.Split("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "") {
				alphabet[key] = false
			}
			questions := []int{}
			failed := false

			for j, s := range testString {
				if string(s) == "?" {
					questions = append(questions, j)
					continue
				}
				if !alphabet[string(s)] {
					alphabet[string(s)] = true
				} else {
					failed = true
					break
				}
			}

			if !failed {
				notFoundKeys := []string{}
				for k, v := range alphabet {
					if !v {
						notFoundKeys = append(notFoundKeys, k)
					}
				}
				if len(notFoundKeys) == len(questions) {
					for qi, qidx := range questions {
						testString = testString[:qidx] + notFoundKeys[qi] + testString[qidx+1:]
					}
					input = strings.Replace(input, input[i:i+26], testString, 1)
					input = strings.Replace(input, "?", "A", -1)
					fmt.Println(input)
					return
				}
			}
		}
		fmt.Println(-1)
		return
	}
}

package main

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

func main() {
	var alphabet map[string]bool = map[string]bool{}
	for _, key := range strings.Split("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "") {
		alphabet[key] = false
	}

	reader := bufio.NewReader(os.Stdin)
	input, _ := reader.ReadString('\n')

	//var input string = "AABCDEFGHIJKLMNOPQRSTUVW??M"

	if len(input) < 26 {
		fmt.Println(-1)
		return
	} else {
		for i := 0; i <= (len(input) - 26); i++ {
			testString := input[i : i+26]
			testAlphabet := alphabet
			questions := []int{}
			failed := false

			for j, s := range testString {
				if string(s) == "?" {
					questions = append(questions, j)
					continue
				}
				if !alphabet[string(s)] {
					alphabet[string(s)] = true
				} else {
					failed = true
					break
				}
			}

			if !failed {
				notFoundKeys := []string{}
				for k, v := range testAlphabet {
					if !v {
						notFoundKeys = append(notFoundKeys, k)
					}
				}
				if len(notFoundKeys) == len(questions) {
					for qi, qidx := range questions {
						testString = testString[:qidx] + notFoundKeys[qi] + testString[qidx+1:]
					}
					input = strings.Replace(input, input[i:i+26], testString, 1)
					input = strings.Replace(input, "?", "A", -1)
					fmt.Println(input)
					return
				}
			}
		}
		fmt.Println(-1)
		return
	}
}


package main

import "fmt"

/*
  Hmm..., if we analyze the worst case problem: 10^9 if we use naive method
  using sum of quadratic formula, we could get n = ~31622, since vladik & valera
  taking turns to give each other, then the n for naive method would be
  2 * ~31622 = ~63244, which is still within feasible number of looping I guess,
  so let's try using naive approach :D!! --> but really this is unreliable approach
*/

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

  var i int = 1
  for vladik >= 0 && valera >= 0 {
    if i % 2 == 1 {
      vladik -= i
    } else {
      valera -= i
    }
    i += 1
  }

  // fmt.Printf("i: %d\n", i)
  // fmt.Printf("Vladik: %d, Valera: %d\n", vladik, valera)

  if vladik < 0 {
    fmt.Println("Vladik")
  } else {
    fmt.Println("Valera")
  }
}

package main

import "fmt"

func calc(first,second int){

	for i:=1;i<1000000000;i++{
		if i&1==1{
			first -= i
			if first<0{
				fmt.Print( "Vladik")
				return
			}
		}else{
			second -= i
			if second<0{
				fmt.Print("Valera")
				return
			}
		}
	}
	return
}

func main(){
	var vladik int
	var valera int
	fmt.Scan(&vladik,&valera)
	calc(vladik,valera)
}

// Try Codeforces
// author: Leonardone @ NEETSDKASU
package main

import "fmt"

func main(){
	var a, b int
	fmt.Scan(&a, &b)
	c := 0
	for {
	    c++
	    a -= c
	    if a < 0 {
	        fmt.Println("Vladik")
	        break
	    }

	    c++
	    b -= c
	    if b < 0 {
	        fmt.Println("Valera")
	        break
	    }
	}
}

package main

import (
	"fmt"
)

func main() {
	var a, b int
	if _, err := fmt.Scanf("%d %d\n", &a, &b); err != nil {
		return
	}

	ab := [2]int{a, b}
	people := 0
	amount := 1
	for ab[people] >= amount {
		ab[people] -= amount
		people = (people + 1) % 2
		amount++
	}

	if people == 0 {
		fmt.Println("Vladik")
	} else {
		fmt.Println("Valera")
	}
}

package main

import "fmt"

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

  var i int = 1
  for vladik >= 0 && valera >= 0 {
    if i % 2 == 1 {
      vladik -= i
    } else {
      valera -= i
    }
    i += 1
  }

  if vladik < 0 {
    fmt.Println("Vladik")
  } else {
    fmt.Println("Valera")
  }
}

package main

import "fmt"

func main() {
	var a, b int
	fmt.Scanf("%d %d", &a, &b)
	i := 1
	for {
		if a-i < 0 {
			fmt.Println("Vladik")
			return
		}
		a = a - i
		if b-i-1 < 0 {
			fmt.Println("Valera")
			return
		}
		b = b - i - 1
		i += 2
	}
}

// Codeforces helper functions
// 20 Jan 18
// samadhi

package main

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

const debug = true

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

	in := gsli(reader)
	a := in[0]
	b := in[1]

	i := 1

	for true {
		a -= i
		if a < 0 {
			fmt.Println("Vladik")
			return
		}
		i++
		b -= i
		if b < 0 {
			fmt.Println("Valera")
			return
		}
		i++
	}

}

// Input helpers

// If you don't pass in a reference to the reader, and just instantiate a new
// one every time, it will work locally, with IO typed at human-speed, but not
// on Codeforces.

// Get Space-separated Line as Strings
//
// Example input:
// 1 test 382.0
// Example output:
// ["1", "test", "382.0"]

func gsls(reader *bufio.Reader) (arr []string) {
	// Get a full line
	input, _ := reader.ReadString('\n')

	//Strip newline and return chars, if any
	input = strings.TrimSuffix(input, "\n")
	input = strings.TrimSuffix(input, "\r")

	// Split at the spaces into an array
	arr = strings.Split(input, " ")

	return
}

// Get Space-separated Line as Integers
// Any non-valid integers will be 0
//
// Example input:
// test 1 12.3 -117
// Example output:
// [0, 1, 0, -117]

func gsli(reader *bufio.Reader) (arr []int) {
	stringArr := gsls(reader)

	for _, e := range stringArr {
		cur, _ := strconv.Atoi(e)
		arr = append(arr, cur)
	}

	return
}

// Get Space-separated Line as 64-bit Floats
// Any non-valid floats will be 0
//
// Example input:
// test 128.328 12 -11.0
// Example output:
// [0, 128.328, 12, -11]

func gslf(reader *bufio.Reader) (arr []float64) {
	stringArr := gsls(reader)

	for _, e := range stringArr {
		cur, _ := strconv.ParseFloat(e, 64)
		arr = append(arr, cur)
	}

	return
}

// String helpers

// Is Lowercase
// Given some string[i], return whether it is lower case or not.

func isl(b byte) bool {
	var r rune
	r = rune(b)
	return unicode.IsLower(r)
}

// Math helpers

// Positve Modulo
// Returns x mod y, but always positive

func posMod(x, y int) int {
	return (x%y + y) % y
}

// Max Int
// Returns the max of two ints

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

// Distance formule
// Calculates the distance to the origin

func dist(x, y float64) float64 {
	return math.Sqrt(math.Pow(x, 2) + math.Pow(y, 2))
}

// Output helpers

func yes() {
	fmt.Println("Yes")
}

func no() {
	fmt.Println("No")
}

// Debug helpers

// From https://groups.google.com/forum/#!topic/golang-nuts/Qlxs3V77nss

func dbg(s string, a ...interface{}) {
	if debug {
		fmt.Printf(s, a...)
	}
}

package main

import "fmt"

func main() {
	var n, m int
	fmt.Scanf("%d %d", &n, &m)
	p := 1
	for {
		if n < p {
			fmt.Printf("Vladik\n")
			break
		}
		n -= p
		p++
		if m < p {
			fmt.Printf("Valera\n")
			break
		}
		m -= p
		p++
	}
}

package main

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

func getLooser(vladik int64, valera int64) {
	maxStep := 1000000000
	for index := 0; index < maxStep; index++ {
		if vladik < 0 {
			fmt.Println("Vladik")
			break
		} else if valera < 0 {
			fmt.Println("Valera")
			break
		}
		if index != 0 {
			if index%2 == 0 {
				valera = valera - int64(index)
			} else {
				temp := vladik - int64(index)
				vladik = temp
			}
		}
	}
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	text, _ := reader.ReadString('\n')
	numbers := strings.Fields(text)
	// fmt.Println(numbers)
	vladik, _ := strconv.ParseInt(numbers[0], 10, 64)
	valera, _ := strconv.ParseInt(numbers[1], 10, 64)
	getLooser(vladik, valera)
}

package main

import "fmt"

func main() {
	var vladik, valera int
	var k int
	k = 1
	fmt.Scanf("%d %d\n", &vladik, &valera)
	for {
		if vladik-k < 0 {
			fmt.Println("Vladik")
			break
		} else {
			vladik = vladik - k
		}
		k++
		if valera-k < 0 {
			fmt.Println("Valera")
			break
		} else {
			valera = valera - k
		}
		k++
	}
}

package main

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

func solve(s string) string {
	return s
}

func output(i int, ans string) {
	fmt.Printf("Case #%d: %s\n", i, ans)
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]byte, 1000000), 1000000)

	scanner.Scan()
	x := strings.Split(scanner.Text(), " ")
	a, _ := strconv.Atoi(x[0])
	b, _ := strconv.Atoi(x[1])
	da := 1
	for a >= 0 && b >= 0 {
		a -= da
		b -= (da + 1)
		da += 2
	}

	if a < 0 {
		fmt.Println("Vladik")
	} else {
		fmt.Println("Valera")
	}
}

package main

import "fmt"

//func calc(t int) string {
//	var a int
//	var b int
//	fmt.Scanln(&a,&b)
//	var prev int = a
//	var sum1 int = a
//	var sum2 int = b
//	var flag bool = false
//
//	if a!=b{
//		return "rated"
//	}
//	for i:=1;i<t;i++{
//		var c int
//		var d int
//		fmt.Scanln(&c,&d)
//		if c!=d{
//			return "rated"
//		}
//		sum1 += c
//		sum2 += d
//		if prev<c{
//			flag = true
//		}
//		prev  = c
//	}
//
//	if sum1!=sum2{
//		return "rated"
//	}else{
//		if flag==true{
//			return "unrated"
//		}
//	}
//	return "maybe"
//}

func test(t,x int) string{
	if t<=x{
		return "Valera"
	}
	return "Vladik"
}

func main(){
	var t int
	var x int
	fmt.Scanln(&t,&x)
	fmt.Print(test(t,x))
}

package main

import "fmt"

//func calc(t int) string {
//	var a int
//	var b int
//	fmt.Scanln(&a,&b)
//	var prev int = a
//	var sum1 int = a
//	var sum2 int = b
//	var flag bool = false
//
//	if a!=b{
//		return "rated"
//	}
//	for i:=1;i<t;i++{
//		var c int
//		var d int
//		fmt.Scanln(&c,&d)
//		if c!=d{
//			return "rated"
//		}
//		sum1 += c
//		sum2 += d
//		if prev<c{
//			flag = true
//		}
//		prev  = c
//	}
//
//	if sum1!=sum2{
//		return "rated"
//	}else{
//		if flag==true{
//			return "unrated"
//		}
//	}
//	return "maybe"
//}

func main(){
	var t int
	var x int
	fmt.Scanln(&t,&x)
	if (x+t)&1 == 0 {
		fmt.Print("Valera")
	}else{
		fmt.Print("Vladik")
	}
}

package main

import "fmt"

//func calc(t int) string {
//	var a int
//	var b int
//	fmt.Scanln(&a,&b)
//	var prev int = a
//	var sum1 int = a
//	var sum2 int = b
//	var flag bool = false
//
//	if a!=b{
//		return "rated"
//	}
//	for i:=1;i<t;i++{
//		var c int
//		var d int
//		fmt.Scanln(&c,&d)
//		if c!=d{
//			return "rated"
//		}
//		sum1 += c
//		sum2 += d
//		if prev<c{
//			flag = true
//		}
//		prev  = c
//	}
//
//	if sum1!=sum2{
//		return "rated"
//	}else{
//		if flag==true{
//			return "unrated"
//		}
//	}
//	return "maybe"
//}

func test(t,x int) string{
	index := 1
	for {
		if t<=index{
			return "Valera"
		}
		if x<=index+1{
			return "Vladik"
		}
		t -= index
		x -= index+1
		index += 2
	}
}

func main(){
	var t int
	var x int
	fmt.Scanln(&t,&x)
	fmt.Print(test(t,x))
}

package main

import "fmt"

func calc(t int) string {
	var a int
	var b int
	fmt.Scanln(&a,&b)
	var prev int = a
	var sum1 int = a
	var sum2 int = b
	var flag bool = false

	if a!=b{
		return "rated"
	}
	for i:=1;i<t;i++{
		var c int
		var d int
		fmt.Scanln(&c,&d)
		if c!=d{
			return "rated"
		}
		sum1 += c
		sum2 += d
		if prev<c{
			flag = true
		}
		prev  = c
	}

	if sum1!=sum2{
		return "rated"
	}else{
		if flag==true{
			return "unrated"
		}
	}
	return "maybe"
}

func main(){
	var t int
	fmt.Scanln(&t)
	ans := calc(t)
	fmt.Print(ans)
}

// Try Codeforces
// author: Leonardone @ NEETSDKASU
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	ca := 0
	cb := 0
	for {
		givetob := ca + 1
		a -= givetob
		if a <= 0 {
			fmt.Println("Valera")
			break
		}
		cb += givetob

		givetoa := cb + 1
		b -= givetoa
		if b <= 0 {
			fmt.Println("Vladik")
			break
		}
		ca += givetoa
	}
}

// Try Codeforces
// author: Leonardone @ NEETSDKASU
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	c := 0
	for {
		c++
		a -= c
		if a <= 0 {
			fmt.Println("Valera")
			break
		}
		c++
		b -= c
		if b <= 0 {
			fmt.Println("Vladik")
			break
		}
	}
}

package main

import "fmt"

func main() {
	var a, b int
	var k int
	fmt.Scanf("%d %d\n", &a, &b)
	for {
		if a-k < 0 {
			fmt.Println("Valera")
			break
		} else {
			a = a - k
			k++
		}
		if b-k < 0 {
			fmt.Println("Vladik")
			break
		} else {
			b = b - k
			k++
		}
	}
}

package main

import "fmt"

func main() {
	var a, b int
	var k int
	fmt.Scanf("%d %d\n", &a, &b)
	for {
		if a-k < 0 {
			fmt.Println("Valera")
			break
		} else if b-k < 0 {
			fmt.Println("Vladik")
			break
		} else {
			a = a - k
			k++
		}
		if a-k < 0 {
			fmt.Println("Valera")
			break
		} else if b-k < 0 {
			fmt.Println("Vladik")
			break
		} else {
			b = b - k
			k++
		}
	}
}


package main

import . "fmt"

// github.com/EndlessCheng/codeforces-go
func main() {
	var n int
	Scan(&n)
	a := make([]int, n)
	for i := range a {
		Scan(&a[i])
	}
	u := []int{}
	vis := [1001]bool{}
	for i := n - 1; i >= 0; i-- {
		if !vis[a[i]] {
			vis[a[i]] = true
			u = append(u, a[i])
		}
	}
	Println(len(u))
	for i := len(u) - 1; i >= 0; i-- {
		Print(u[i], " ")
	}
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	m := make(map[int]bool)
	k := make([]int,n)
	var l []int
	for i:=0;i<n;i++{
		fmt.Scan(&k[i])
	}

	for i := n-1; i>=0;i-- {
		_,ok := m[k[i]]
		if !ok {
			l = append(l,k[i])
			m[k[i]] = true
		}
	}
	for i :=0;i<len(l)/2;i++{
		l[i],l[len(l)-i-1]=l[len(l)-i-1],l[i]
	}
	fmt.Println(len(l))
	s := fmt.Sprint(l)
	fmt.Println(s[1:len(s)-1])
}

package main

import "fmt"

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

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

	m := make(map[int]bool)
	cnt := 0
	for i := n - 1; i >= 0; i-- {
		v, _ := m[a[i]]
		if v {
			a[i] = -1
		} else {
			m[a[i]] = true
			cnt++
		}
	}

	fmt.Println(cnt)
	for i := 0; i < n; i++ {
		if a[i] != -1 {
			fmt.Print(a[i], " ")
			//fmt.Printf("%d ", a[i])
		}
	}

	fmt.Println()
}

package main

import "fmt"

func main() {
	var n int
	var a [50]string
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[n-i-1])
	}
	var len_result int
	var result [50]string
	for i := 0; i < n; i++ {
		exists := false
		for j := 0; j < len_result; j++ {
			if result[j] == a[i] {
				exists = true
				break
			}
		}
		if !exists {
			result[len_result] = a[i]
			len_result++
		}
	}
	fmt.Println(len_result)
	for j := 0; j < len_result; j++ {
		fmt.Print(result[len_result-j-1], " ")
	}
}

package main

import "fmt"

func Process(a []int64) (int64, []int64) {
	var m = map[int64]bool{}
	var r = make([]int64, 0)

	for i := len(a) - 1; i >= 0; i-- {
		if _, exist := m[a[i]]; !exist {
			r = append([]int64{a[i]}, r...)
		}

		m[a[i]] = true
	}

	return int64(len(r)), r
}

func main() {
	var n int64

	fmt.Scanln(&n)

	var a, _ = ScanN(n)

	var r1, r2 = Process(a)

	fmt.Println(r1)

	PrintSlice(r2)
}

func ScanN(n int64) ([]int64, error) {
	in := make([]int64, n)
	for i := range in {
		_, err := fmt.Scan(&in[i])
		if err != nil {
			return in[:i], err
		}
	}
	return in, nil
}

func PrintSlice(a []int64) {
	for i := 0; i < len(a); i++ {
		if i == len(a)-1 {
			fmt.Print(a[i])
		} else {
			fmt.Print(a[i], " ")
		}
	}
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]byte, 2048*2048), 2048*2048)
	scanner.Split(bufio.ScanWords)

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

	a := make([]int, n)

	for i := 0; i < n; i++ {
		scanner.Scan()
		a[i], _ = strconv.Atoi(scanner.Text())
	}

	total := 0
	set := make([]int, 1001)

	for i := 0; i < 1001; i++ {
		set[i] = -1
	}

	for i, el := range a {
		if set[el] == -1 {
			total++
		} else {
			a[set[el]] = -1
		}
		set[el] = i
	}
	fmt.Println(total)

	for _, el := range a {
		if el == -1 {
			continue
		}
		if set[el] == -1 {
			continue
		}
		fmt.Printf("%d ", el)
	}
	fmt.Printf("\n")
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	ans := make([]int, 0)
	mp := make(map[int]bool)
	for i := n-1; i >= 0; i-- {
		if _, ok := mp[a[i]]; ok {
			continue
		}
		mp[a[i]] = true
		ans = append(ans, a[i])
	}
	fmt.Printf("%d\n%d", len(ans), ans[len(ans)-1])
	for i := len(ans)-2; i >= 0; i-- {
		fmt.Printf(" %d", ans[i])
	}
	fmt.Println()
}

package main

import "fmt"

const (
	maxn = 55
)

var (
	n int
	a [maxn]int
	m map[int]bool
	ans []int
)

func main() {
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}

	m = make(map[int]bool)
	for i := n - 1; i >= 0; i-- {
		_, inMap := m[a[i]]
		if !inMap {
			ans = append(ans, a[i])
			m[a[i]] = true
		}
	}

	fmt.Println(len(ans))
	for i := len(ans) - 1; i >= 0; i-- {
		fmt.Printf("%v ", ans[i])
	}
}

package main
import (
	"fmt"
	"sort"
)

var set, no []int
func check(f int) int{
	 var r int
	 for i, a := range no {
	 	  if a == f {
	 	  	 r = i
	 	  }
	 }

	 return r
}
func main() {
	 var n int
	 var used = make(map[int]bool)
	 fmt.Scanf("%d", &n)

	 for i:=0; i<n; i ++ {
	 		var x int
	 		fmt.Scan(&x)
	 		no = append(no, x)
	 }

	 for _, x := range no {
	 	    if used[x] == false {
	 			  set = append(set, check(x))
	 			  used[x] = true
	 		}
	 }

	 fmt.Printf("%d\n", len(set))
	 sort.Ints(set)
	 for _, a := range set {
	 	    fmt.Printf("%d ", no[a])
	 }
}

package main

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

func main() {
	var line string
	reader := bufio.NewReader(os.Stdin)
	line, _ = reader.ReadString('\n')
	arrStartStrings := strings.Split(strings.TrimSpace(line), " ")
	_, _ = strconv.Atoi(arrStartStrings[0])
	start := make([]int, 0)
	line, _ = reader.ReadString('\n')
	arrStartStrings = strings.Split(strings.TrimSpace(line), " ")
	m := make(map[int]bool)
	sl := len(arrStartStrings)
	for i := sl - 1; i >= 0; i-- {
		tmp, _ := strconv.Atoi(arrStartStrings[i])
		if m[tmp] == false {
			start = append(start, tmp)
			m[tmp] = true
		}
	}
	for i, j := 0, len(start)-1; i < j; i, j = i+1, j-1 {
		start[i], start[j] = start[j], start[i]
	}
	fmt.Println(len(start))
	for i := 0; i < len(start); i++ {
		if i == 0 {
			fmt.Printf("%d", start[i])
		} else {
			fmt.Printf(" %d", start[i])
		}
	}
}

package main

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

func Init() {
}

func Solve(io *FastIO) {
	N := io.NextInt()
	A := io.NextIntArray(N)

	cnt := 0
	seen := make(map[int]bool)
	good := make([]bool, N)
	for i := N - 1; i >= 0; i-- {
		if !seen[A[i]] {
			cnt++
			seen[A[i]] = true
			good[i] = true
		}
	}

	io.Println(cnt)
	for i, v := range A {
		if good[i] {
			io.Printf("%d ", v)
		}
	}
	io.Println()
}

type FastIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}

func (io *FastIO) NextChar() byte {
	c, _ := io.reader.ReadByte()
	return c
}

func (io *FastIO) NextInt() int {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := 1
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := 0
	for !IsSpaceChar(c) {
		res = (res * 10) + int(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = (res * 10) + int64(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextIntArray(size int) []int {
	return io.NextIntArrayOffset(size, 0)
}

func (io *FastIO) NextIntArrayOffset(size, offset int) []int {
	arr := make([]int, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextInt()
	}
	return arr
}

func (io *FastIO) NextLongArray(size int) []int64 {
	return io.NextLongArrayOffset(size, 0)
}

func (io *FastIO) NextLongArrayOffset(size, offset int) []int64 {
	arr := make([]int64, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextLong()
	}
	return arr
}

func (io *FastIO) NextString() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsSpaceChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) NextLine() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsLineBreakChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) Println(args ...interface{}) {
	io.writer.WriteString(fmt.Sprintln(args...))
}

func (io *FastIO) Printf(format string, args ...interface{}) {
	io.writer.WriteString(fmt.Sprintf(format, args...))
}

func (io *FastIO) FlushOutput() {
	io.writer.Flush()
}

func IsSpaceChar(c byte) bool {
	switch c {
	case 0, '\t', '\n', '\r', ' ':
		return true
	default:
		return false
	}
}

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

func main() {
	io := FastIO{reader: bufio.NewReader(os.Stdin), writer: bufio.NewWriter(os.Stdout)}
	Init()
	Solve(&io)
	io.FlushOutput()
}

package main

import "fmt"

func Process(a []int64) (int64, []int64) {
	var m = map[int64]bool{}
	var r = make([]int64, 0)

	for i := len(a) - 1; i >= 0; i-- {
		if _, exist := m[a[i]]; !exist {
			r = append([]int64{a[i]}, r...)
		}

		m[a[i]] = true
	}

	return int64(len(r)), r
}

func main() {
	var n int64

	fmt.Scanln(&n)

	var a, _ = ScanN(n)

	var r1, r2 = Process(a)

	fmt.Println(r1)
	PrintSlice(r2)
}

func ScanN(n int64) ([]int64, error) {
	in := make([]int64, n)
	for i := range in {
		_, err := fmt.Scan(&in[i])
		if err != nil {
			return in[:i], err
		}
	}
	return in, nil
}

func PrintSlice(a []int64) {
	for i := 0; i < len(a); i++ {
		if i == len(a)-1 {
			fmt.Print(a[i])
		} else {
			fmt.Print(a, " ")
		}
	}
}

package main

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

func Init() {
}

func Solve(io *FastIO) {
	N := io.NextInt()
	A := io.NextIntArray(N)

	seen := make(map[int]bool)
	good := make([]bool, N)
	for i := N - 1; i >= 0; i-- {
		if !seen[A[i]] {
			seen[A[i]] = true
			good[i] = true
		}
	}

	for i, v := range A {
		if good[i] {
			io.Printf("%d ", v)
		}
	}
	io.Println()
}

type FastIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}

func (io *FastIO) NextChar() byte {
	c, _ := io.reader.ReadByte()
	return c
}

func (io *FastIO) NextInt() int {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := 1
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := 0
	for !IsSpaceChar(c) {
		res = (res * 10) + int(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = (res * 10) + int64(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextIntArray(size int) []int {
	return io.NextIntArrayOffset(size, 0)
}

func (io *FastIO) NextIntArrayOffset(size, offset int) []int {
	arr := make([]int, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextInt()
	}
	return arr
}

func (io *FastIO) NextLongArray(size int) []int64 {
	return io.NextLongArrayOffset(size, 0)
}

func (io *FastIO) NextLongArrayOffset(size, offset int) []int64 {
	arr := make([]int64, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextLong()
	}
	return arr
}

func (io *FastIO) NextString() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsSpaceChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) NextLine() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsLineBreakChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) Println(args ...interface{}) {
	io.writer.WriteString(fmt.Sprintln(args...))
}

func (io *FastIO) Printf(format string, args ...interface{}) {
	io.writer.WriteString(fmt.Sprintf(format, args...))
}

func (io *FastIO) FlushOutput() {
	io.writer.Flush()
}

func IsSpaceChar(c byte) bool {
	switch c {
	case 0, '\t', '\n', '\r', ' ':
		return true
	default:
		return false
	}
}

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

func main() {
	io := FastIO{reader: bufio.NewReader(os.Stdin), writer: bufio.NewWriter(os.Stdout)}
	Init()
	Solve(&io)
	io.FlushOutput()
}


package main

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return res
}

/*********** DP sub-functions ***********/

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

// ChMax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMax(updatedValue *int, target int) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

// NthBit returns nth bit value of an argument.
// n starts from 0.
func NthBit(num, nth int) int {
	return num >> uint(nth) & 1
}

// OnBit returns the integer that has nth ON bit.
// If an argument has nth ON bit, OnBit returns the argument.
func OnBit(num, nth int) int {
	return num | (1 << uint(nth))
}

// OffBit returns the integer that has nth OFF bit.
// If an argument has nth OFF bit, OffBit returns the argument.
func OffBit(num, nth int) int {
	return num & ^(1 << uint(nth))
}

// PopCount returns the number of ON bit of an argument.
func PopCount(num int) int {
	res := 0

	for i := 0; i < 70; i++ {
		if ((num >> uint(i)) & 1) == 1 {
			res++
		}
	}

	return res
}

/*********** Arithmetic ***********/

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

// Min returns the min integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Min(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m > integer {
			m = integer
		}
	}
	return m
}

// Sum returns multiple integers sum.
func Sum(integers ...int) int {
	s := 0

	for _, i := range integers {
		s += i
	}

	return s
}

// PowInt is integer version of math.Pow
// PowInt calculate a power by Binary Power (二分累乗法(O(log e))).
func PowInt(a, e int) int {
	if a < 0 || e < 0 {
		panic(errors.New("[argument error]: PowInt does not accept negative integers"))
	}

	if e == 0 {
		return 1
	}

	if e%2 == 0 {
		halfE := e / 2
		half := PowInt(a, halfE)
		return half * half
	}

	return a * PowInt(a, e-1)
}

// AbsInt is integer version of math.Abs
func AbsInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// Gcd returns the Greatest Common Divisor of two natural numbers.
// Gcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Gcd uses the Euclidean Algorithm.
func Gcd(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}
	if a < b {
		a, b = b, a
	}

	// Euclidean Algorithm
	for b > 0 {
		div := a % b
		a, b = b, div
	}

	return a
}

// Lcm returns the Least Common Multiple of two natural numbers.
// Lcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Lcd uses the Euclidean Algorithm indirectly.
func Lcm(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}

	// a = a'*gcd, b = b'*gcd, a*b = a'*b'*gcd^2
	// a' and b' are relatively prime numbers
	// gcd consists of prime numbers, that are included in a and b
	gcd := Gcd(a, b)

	// not (a * b / gcd), because of reducing a probability of overflow
	return (a / gcd) * b
}

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

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

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

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

	return string(res)
}

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

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

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

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

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

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

const MOD = 1000000000 + 7
const ALPHABET_NUM = 26
const INF_INT64 = math.MaxInt64
const INF_BIT60 = 1 << 60

var n int
var S []rune

func main() {
	n = ReadInt()
	S = ReadRuneSlice()

	// S[4], S[9] = S[9], S[4]
	// sub()

	ans := 0
	l, r := 0, 0
	for i := 0; i < n; i++ {
		for j := i; j < n; j++ {
			// 入れ替える
			S[i], S[j] = S[j], S[i]

			tmp := sub()
			if ans < tmp {
				ans = tmp
				l, r = i, j
			}

			// もとに戻す
			S[i], S[j] = S[j], S[i]
		}
	}
	fmt.Println(ans)
	fmt.Println(l+1, r+1)
}

type Char struct {
	idx int
	c   rune
}

func sub() int {
	// スタックで字句解析する
	s := make([]Char, 0, 1000)
	memo := []int{}
	for i := 0; i < n; i++ {
		r := S[i]
		char := Char{idx: i, c: r}

		if len(s) == 0 || r == '(' {
			s = append(s, char)
			continue
		}

		if r == ')' && s[len(s)-1].c == '(' {
			popped := s[len(s)-1]
			s = s[:len(s)-1]
			if len(s) == 0 || s[len(s)-1].c == ')' {
				memo = append(memo, popped.idx)
			}
		} else {
			s = append(s, char)
		}
	}

	// スタックに何も残っていないときはmemoの長さ
	if len(s) == 0 {
		return len(memo)
	}

	// 残ったカッコの数をチェック
	op, cl := 0, 0
	for i := 0; i < len(s); i++ {
		if s[i].c == '(' {
			op++
		} else {
			cl++
		}
	}
	// 数が一致しないとダメ
	if op != cl {
		return 0
	}

	l, r := 0, 0
	for i := 0; i < len(s); i++ {
		if s[i].c == '(' {
			r = s[i].idx
			break
		}
	}
	for i := len(s) - 1; i >= 0; i-- {
		if s[i].c == ')' {
			l = s[i].idx
			break
		}
	}

	// fmt.Println(memo)
	// for i := 0; i < len(s); i++ {
	// 	fmt.Printf("%d: %c\n", s[i].idx, s[i].c)
	// }
	// fmt.Printf("lidx: %d, ridx: %d\n", l, r)

	ans := 0
	for i := 0; i < len(memo); i++ {
		if l < memo[i] && memo[i] <= r {
			ans++
		}
	}

	return ans + 1
}

// MODはとったか？
// 遷移だけじゃなくて最後の最後でちゃんと取れよ？

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

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n int
	var s string
	fmt.Fscanf(reader, "%d\n%s\n", &n, &s)
	sum := make([]int, n+1)
	for i := n - 1; i >= 0; i-- {
		if s[i] == ')' {
			sum[i] = sum[i+1] + 1
		} else {
			sum[i] = sum[i+1] - 1
		}
	}

	if sum[0] != 0 {
		fmt.Printf("0\n1 1\n")
		return
	}

	min := 2 * n
	total := 0
	a := 1
	b := 1

	for i := 0; i < n; i++ {
		if sum[i] < min {
			min = sum[i]
			total = 1
		} else if sum[i] == min {
			total++
		}
	}

	//fmt.Printf("%d %d\n%d %d\n", min, total, a, b)

	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			if s[i] == s[j] {
				continue
			}

			sub := 0
			if s[i] == ')' {
				sub = 2
			} else {
				sub = -2
			}
			cha := 0
			tmin := 2 * n
			ttotal := 0

			for k := 0; k < n; k++ {
				if k > i && k <= j {
					cha = sub
				} else {
					cha = 0
				}

				if sum[k]+cha < tmin {
					tmin = sum[k]
					ttotal = 1
				} else if sum[k]+cha == tmin {
					ttotal++
				}
			}

			if ttotal > total {
				total = ttotal
				a = i
				b = j
			}
		}
	}

	fmt.Printf("%d\n%d %d\n", total, a+1, b+1)
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n int
	var s string
	fmt.Fscanf(reader, "%d\n%s\n", &n, &s)
	sum := make([]int, n+1)
	for i := n - 1; i >= 0; i-- {
		if s[i] == ')' {
			sum[i] = sum[i+1] + 1
		} else {
			sum[i] = sum[i+1] - 1
		}
	}

	if sum[0] != 0 {
		fmt.Printf("0\n1 1\n")
		return
	}

	min := 2 * n
	total := 0
	a := 1
	b := 1

	for i := 0; i < n; i++ {
		if sum[i] < min {
			min = sum[i]
			total = 1
		} else if sum[i] == min {
			total++
		}
	}

	//fmt.Printf("%d %d\n%d %d\n", min, total, a, b)

	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			if s[i] == s[j] {
				continue
			}

			sub := 0
			if s[i] == ')' {
				sub = 2
			} else {
				sub = -2
			}
			cha := 0
			tmin := 2 * n
			ttotal := 0

			for k := 0; k < n; k++ {
				if k > i && k <= j {
					cha = sub
				} else {
					cha = 0
				}

				if sum[i]+cha < tmin {
					tmin = sum[k]
					ttotal = 1
				} else if sum[k]+cha == tmin {
					ttotal++
				}
			}

			if ttotal > total {
				total = ttotal
				a = i
				b = j
			}
		}
	}

	fmt.Printf("%d\n%d %d\n", total, a+1, b+1)
}