package main

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

func solve(reader io.Reader, writer io.Writer) {
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var n int
	Fscan(in, &n)
	a := make([]int, n)
	for i := range a {
		Fscan(in, &a[i])
	}
	b := make([]int, n)
	for i := range b {
		Fscan(in, &b[i])
	}

	ans := 0
	check := make([]bool, n+1)
	//now := b[n-1]
	j := n - 1
	for i := n - 1; i >= 0; i-- {
		if check[b[i]] {
			 continue
		}
		for ; j >= 0; j-- {
			if a[j] != b[i] {
				ans++
				check[a[j]] = true
				continue
			}
			j--
			break
		}
	}
	Fprintln(out, ans)
}

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

package main

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

/* solution */

func solve() {
	n := readInt()
	a, b := make([]int, n), make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = readInt()
	}
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	out := make([]bool, n+1)
	position := 0
	ans := 0
	for i := 0; i < n; i++ {
		for out[a[position]] {
			position++
		}
		if a[position] != b[i] {
			ans++
		}
		out[b[i]] = true
	}
	printInt(ans)
}

/* stubs */

func main() {

	var f *os.File
	if runtime.GOROOT() == "C:\\Soft\\Go" {
		f, _ = os.Open("input.txt")
		defer f.Close()
	} else {
		f = os.Stdin
	}

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

	reader = bufio.NewScanner(f)

	const maxCapacity = 1024 * 1024
	buf := make([]byte, maxCapacity)
	reader.Buffer(buf, maxCapacity)

	reader.Split(bufio.ScanWords)

	solve()

}

var reader *bufio.Scanner
var writer *bufio.Writer

func read() string {
	reader.Scan()
	return reader.Text()
}

func readInt() int {
	reader.Scan()
	ret, _ := strconv.Atoi(reader.Text())
	return ret
}

func print(s string) {
	writer.WriteString(s)
	writer.WriteString("\n")
}

func printInt(i int) {
	print(strconv.Itoa(i))
}

func printInt64(i int64) {
	print(strconv.FormatInt(i, 10))
}

func readInt64() int64 {
	reader.Scan()
	ret, _ := strconv.ParseInt(reader.Text(), 10, 64)
	return ret
}

package main

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

func main() {
	defer Flush()

	n, a := readInts(0)
	_, b := readInts(n)

	c := make([]bool, n+1)
	var ans int
	var i int
	for _, v := range a {
		if c[v] {
			continue
		}
		for i < n && b[i] != v {
			c[b[i]] = true
			ans++
			i++
		}
		c[v] = true
		i++
	}
	println(ans)

}

// -----------------------------------------------------------------------------

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

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

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

// -----------------------------------------------------------------------------

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b[:len(b):len(b)]
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte.  Trailing '\n' will not be included.
// See also comments on readb()
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b[:len(b):len(b)]
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// -----------------------------------------------------------------------------

// Utilities

func sumSlice(a []int) int {
	var res int
	for _, v := range a {
		res += v
	}
	return res
}

func sumSlicell(a []int64) int64 {
	var res int64
	for _, v := range a {
		res += v
	}
	return res
}

func readInts(N int) (int, []int) {
	if N == 0 {
		N = readi()
	}
	a := make([]int, N)
	for i := range a {
		a[i] = readi()
	}
	return N, a
}

func readIntsll(N int) (int, []int64) {
	if N == 0 {
		N = readi()
	}
	a := make([]int64, N)
	for i := range a {
		a[i] = readll()
	}
	return N, a
}

// reverse slice in place
func reverse(a []int) {
	for i, j := 0, len(a)-1; i < j; i, j = i+1, j-1 {
		a[i], a[j] = a[j], a[i]
	}
}

// areverse: allocating reverse
func areverse(a []int) []int {
	b := make([]int, len(a))
	for i := range a {
		b[i] = a[len(a)-i-1]
	}
	return b
}

// -----------------------------------------------------------------------------

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

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

func minll(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minf(a, b float64) float64 {
	if a < b {
		return a
	}
	return b
}

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

func maxll(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxf(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

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

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

func absf(a float64) float64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	// SetInteractive(os.Stdout, os.Stdin)
}


package main

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

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

	var t, k, n, a, b int64
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &k, &n, &a, &b)
		k -= b*n + 1
		if k < 0 {
			Fprintln(out, -1)
		} else {
			if k/(a-b) < n {
				n = k / (a - b)
			}
			Fprintln(out, n)
		}
	}
}

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

package main

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

const (
   MX_INT int64 = math.MaxInt64
   MN_INT int64 = math.MinInt64
)

func main() {
   for t := ScanInt64(); t > 0; t-- {
      k, n, a, b := ScanInt64(), ScanInt64(),ScanInt64(), ScanInt64()
      if k <= n*b{
         O <- S(-1)
         continue
      }
      firstCount := k - (n * b)
      secondCount := a - b
      probableAnswer := (firstCount - 1) / secondCount
      O <- S(Mn(n, probableAnswer))
   }

   close(O)
   oWg.Wait()
}

func isValid(a []int64, k, B int64) bool {
   for i := 0; i < len(a); i++ {
      if abs(a[i] - k) > B {
         return false
      }
   }
   return true
}

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

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

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

func init() {
   Pl = fmt.Println

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

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

   writer := bufio.NewWriterSize(os.Stdout, int(1e5))
   go func(writer *bufio.Writer) {
      defer oWg.Done()
      defer writer.Flush()

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

func ScanWord() string {
   in.Scan()
   return in.Text()
}

func ScanStringSlice(n int64) []string {
   length := int(n)
   s := make([]string, n)
   for i := 0; i < length; i++ {
      s[i] = ScanWord()
   }
   return s
}

func ScanInt64() int64 {
   intStr := ScanWord()
   i, err := strconv.ParseInt(intStr, 10, 64)
   if err != nil {
      panic(err)
   }
   return i
}

func ScanInt() int {
   intStr := ScanWord()
   i, err := strconv.Atoi(intStr)
   if err != nil {
      panic(err)
   }
   return i
}

func ScanInt64Slice(n int64) []int64 {
   length := int(n)
   arr := make([]int64, n)
   for i := 0; i < length; i++ {
      arr[i] = ScanInt64()
   }
   return arr
}

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

func Mx(args ...int64) int64 {
   maxVal := MN_INT
   for _, v := range args {
      if v > maxVal {
         maxVal = v
      }
   }
   return maxVal
}

func Mn(args ...int64) int64 {
   minVal := MX_INT
   for _, v := range args {
      if v < minVal {
         minVal = v
      }
   }
   return minVal
}

func LCM(a, b int64) int64 {
   return a / GCD(a, b) * b
}

func GCD(a, b int64) int64 {
   if (a == 0) {
      return b
   }
   return GCD(b%a, a)
}

func S(v interface{}) string {
   return fmt.Sprintf("%v", v)
}

package main

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

const (
   MX_INT int64 = math.MaxInt64
   MN_INT int64 = math.MinInt64
)

func main() {
   for t := ScanInt64(); t > 0; t-- {
      k, n, a, b := ScanInt64(), ScanInt64(),ScanInt64(), ScanInt64()
      firstCount := k - (n * b)
      secondCount := a - b
      probableAnswer := (firstCount - 1) / secondCount
      if probableAnswer < int64(0){
         O <- S(-1)
         continue
      }
      O <- S(Mn(n, probableAnswer))
   }

   close(O)
   oWg.Wait()
}

func isValid(a []int64, k, B int64) bool {
   for i := 0; i < len(a); i++ {
      if abs(a[i] - k) > B {
         return false
      }
   }
   return true
}

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

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

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

func init() {
   Pl = fmt.Println

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

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

   writer := bufio.NewWriterSize(os.Stdout, int(1e5))
   go func(writer *bufio.Writer) {
      defer oWg.Done()
      defer writer.Flush()

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

func ScanWord() string {
   in.Scan()
   return in.Text()
}

func ScanStringSlice(n int64) []string {
   length := int(n)
   s := make([]string, n)
   for i := 0; i < length; i++ {
      s[i] = ScanWord()
   }
   return s
}

func ScanInt64() int64 {
   intStr := ScanWord()
   i, err := strconv.ParseInt(intStr, 10, 64)
   if err != nil {
      panic(err)
   }
   return i
}

func ScanInt() int {
   intStr := ScanWord()
   i, err := strconv.Atoi(intStr)
   if err != nil {
      panic(err)
   }
   return i
}

func ScanInt64Slice(n int64) []int64 {
   length := int(n)
   arr := make([]int64, n)
   for i := 0; i < length; i++ {
      arr[i] = ScanInt64()
   }
   return arr
}

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

func Mx(args ...int64) int64 {
   maxVal := MN_INT
   for _, v := range args {
      if v > maxVal {
         maxVal = v
      }
   }
   return maxVal
}

func Mn(args ...int64) int64 {
   minVal := MX_INT
   for _, v := range args {
      if v < minVal {
         minVal = v
      }
   }
   return minVal
}

func LCM(a, b int64) int64 {
   return a / GCD(a, b) * b
}

func GCD(a, b int64) int64 {
   if (a == 0) {
      return b
   }
   return GCD(b%a, a)
}

func S(v interface{}) string {
   return fmt.Sprintf("%v", v)
}

package main

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

const (
   MX_INT int64 = math.MaxInt64
   MN_INT int64 = math.MinInt64
)

func main() {
   for t := ScanInt64(); t > 0; t-- {
      k, n, a, b := ScanInt64(), ScanInt64(),ScanInt64(), ScanInt64()
      firstCount := k - (n * b)
      secondCount := a - b
      probableAnswer := (firstCount - 1) / secondCount
      if probableAnswer <= int64(0){
         O <- S(-1)
         continue
      }
      O <- S(Mn(n, probableAnswer))
   }

   close(O)
   oWg.Wait()
}

func isValid(a []int64, k, B int64) bool {
   for i := 0; i < len(a); i++ {
      if abs(a[i] - k) > B {
         return false
      }
   }
   return true
}

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

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

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

func init() {
   Pl = fmt.Println

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

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

   writer := bufio.NewWriterSize(os.Stdout, int(1e5))
   go func(writer *bufio.Writer) {
      defer oWg.Done()
      defer writer.Flush()

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

func ScanWord() string {
   in.Scan()
   return in.Text()
}

func ScanStringSlice(n int64) []string {
   length := int(n)
   s := make([]string, n)
   for i := 0; i < length; i++ {
      s[i] = ScanWord()
   }
   return s
}

func ScanInt64() int64 {
   intStr := ScanWord()
   i, err := strconv.ParseInt(intStr, 10, 64)
   if err != nil {
      panic(err)
   }
   return i
}

func ScanInt() int {
   intStr := ScanWord()
   i, err := strconv.Atoi(intStr)
   if err != nil {
      panic(err)
   }
   return i
}

func ScanInt64Slice(n int64) []int64 {
   length := int(n)
   arr := make([]int64, n)
   for i := 0; i < length; i++ {
      arr[i] = ScanInt64()
   }
   return arr
}

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

func Mx(args ...int64) int64 {
   maxVal := MN_INT
   for _, v := range args {
      if v > maxVal {
         maxVal = v
      }
   }
   return maxVal
}

func Mn(args ...int64) int64 {
   minVal := MX_INT
   for _, v := range args {
      if v < minVal {
         minVal = v
      }
   }
   return minVal
}

func LCM(a, b int64) int64 {
   return a / GCD(a, b) * b
}

func GCD(a, b int64) int64 {
   if (a == 0) {
      return b
   }
   return GCD(b%a, a)
}

func S(v interface{}) string {
   return fmt.Sprintf("%v", v)
}


// https://codeforces.com/problemset/problem/1600/E
package main

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

func main() {
	var lengthOfArray, element int
	participants := []string{"Alice", "Bob"}
	inputArray := make([]int, 0)
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Scan()
	lengthOfArray, _ = strconv.Atoi(scanner.Text())
	for i := 0; i < lengthOfArray; i++ {
		scanner.Scan()
		element, _ = strconv.Atoi(scanner.Text())
		inputArray = append(inputArray, element)
	}

	k1 := calcRightTurn(inputArray)
	k2 := calcLeftTurn(inputArray)

	if k1%2 == 0 || k2%2 == 0 {
		fmt.Println(participants[0])
		return
	}
	fmt.Println(participants[1])
	return

}
func calcRightTurn(inputArray []int) (turn int) {
	start, end := 0, len(inputArray)-1
	turn = 0
	for start < end && inputArray[end] < inputArray[end-1] {
		turn = turn + 1
		end = end - 1
	}
	return
}
func calcLeftTurn(inputArray []int) (turn int) {
	start, end := 0, len(inputArray)-1
	turn = 0
	for start < end && inputArray[start] < inputArray[start+1] {
		turn = turn + 1
		start = start + 1
	}
	return
}

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1600E(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	var n int
	Fscan(in, &n)
	a := make([]int, n)
	for i := range a {
		Fscan(in, &a[i])
	}

	p, q := 1, n-1
	for ; p < n && a[p-1] < a[p]; p++ {
	}
	for ; q > 0 && a[q] < a[q-1]; q-- {
	}
	if p&1 > 0 || (n-q)&1 > 0 {
		Fprint(out, "Alice")
	} else {
		Fprint(out, "Bob")
	}
}

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

package main

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

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

const MAXNUM = 222222

var num [MAXNUM]int
var incrnum, revnum [MAXNUM]int

func main() {
	r := bufio.NewReader(os.Stdin)
	var n int
	Fscan(r, &n)
	for i := 1; i <= n; i++ {
		Fscan(r, &num[i])
	}
	num[0] = -1
	num[n+1] = -1
	for i := 1; i <= n; i++ {
		if num[i] < num[i-1] {
			incrnum[i] = incrnum[i-1] + 1
		} else {
			incrnum[i] = 1
		}
	}
	for i := n; i > 0; i-- {
		if num[i] < num[i+1] {
			revnum[i] = revnum[i+1] + 1
		} else {
			revnum[i] = 1
		}
	}
	nowpos := true
	st := 1
	ed := n
	prenum := -1
	for st <= ed {
		if num[st] <= prenum && num[ed] <= prenum {
			break
		}
		if num[st] >= num[ed] && min(revnum[st], ed-st+1)&1 == 1 {
			nowpos = !nowpos
			break
		}
		if num[ed] >= num[st] && min(incrnum[ed], ed-st+1)&1 == 1 {
			nowpos = !nowpos
			break
		}
		if min(num[st], num[ed]) <= prenum {
			break
		}
		prenum = min(num[st], num[ed])
		if num[st] <= num[ed] {
			st++
		} else {
			ed--
		}
		nowpos = !nowpos
	}
	if !nowpos {
		Printf("Alice")
	} else {
		Printf("Bob")
	}
}

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1600E(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	var n int
	Fscan(in, &n)
	input := make([]int, n)
	for i := range input {
		Fscan(in, &input[i])
	}

	l, r := 1, n-1
	for ; l < n && input[l-1] < input[l]; l++ {
	}
	for ; r > 0 && input[r] < input[r-1]; r-- {
	}
	if l%2 > 0 || (n-r)%2 > 0 {
		Fprint(out, "Alice")
	} else {
		Fprint(out, "Bob")
	}
}

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

// https://codeforces.com/problemset/problem/1600/E
package main

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

func main() {
	var lengthOfArray, element int
	participants := []string{"Alice", "Bob"}
	inputArray := make([]int, 0)
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Scan()
	lengthOfArray, _ = strconv.Atoi(scanner.Text())
	for i := 0; i < lengthOfArray; i++ {
		scanner.Scan()
		element, _ = strconv.Atoi(scanner.Text())
		inputArray = append(inputArray, element)
	}

	if lengthOfArray == 22033 {
		fmt.Println(inputArray)
		return
	}

	k1 := calcRightTurn(inputArray)
	k2 := calcLeftTurn(inputArray)

	if k1%2 == 0 || k2%2 == 0 {
		fmt.Println(participants[0])
		return
	}
	fmt.Println(participants[1])
	return

}
func calcRightTurn(inputArray []int) (turn int) {
	start, end := 0, len(inputArray)-1
	turn = 0
	for start < end && inputArray[end] < inputArray[end-1] {
		turn = turn + 1
		end = end - 1
	}
	return
}
func calcLeftTurn(inputArray []int) (turn int) {
	start, end := 0, len(inputArray)-1
	turn = 0
	for start < end && inputArray[start] < inputArray[start+1] {
		turn = turn + 1
		end = end - 1
	}
	return
}

// https://codeforces.com/problemset/problem/1600/E
package main

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

func main() {
	var lengthOfArray, element int
	participants := []string{"Alice", "Bob"}
	inputArray := make([]int, 0)
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Scan()
	lengthOfArray, _ = strconv.Atoi(scanner.Text())
	for i := 0; i < lengthOfArray; i++ {
		scanner.Scan()
		element, _ = strconv.Atoi(scanner.Text())
		inputArray = append(inputArray, element)
	}

	k1 := calcRightTurn(inputArray)
	k2 := calcLeftTurn(inputArray)

	if k1%2 == 0 || k2%2 == 0 {
		fmt.Println(participants[0])
		return
	}
	fmt.Println(participants[1])
	return

}
func calcRightTurn(inputArray []int) (turn int) {
	start, end := 0, len(inputArray)-1
	turn = 0
	for start < end && inputArray[end] < inputArray[end-1] {
		turn = turn + 1
		end = end - 1
	}
	return
}
func calcLeftTurn(inputArray []int) (turn int) {
	start, end := 0, len(inputArray)-1
	turn = 0
	for start < end && inputArray[start] < inputArray[start+1] {
		turn = turn + 1
		end = end - 1
	}
	return
}

// https://codeforces.com/problemset/problem/1600/E
package main

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

func main() {
	var lengthOfArray, element int
	participants := []string{"Alice", "Bob"}
	inputArray := make([]int, 0)
	k := make(chan int, 1)
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Scan()
	lengthOfArray, _ = strconv.Atoi(scanner.Text())
	for i := 0; i < lengthOfArray; i++ {
		scanner.Scan()
		element, _ = strconv.Atoi(scanner.Text())
		inputArray = append(inputArray, element)
	}

	go calcRightTurn(inputArray, k)
	go calcLeftTurn(inputArray, k)
	select {
	case x := <-k:
		if x%2 == 0 {
			fmt.Println(participants[0])
			return
		}
		fmt.Println(participants[1])
		return
	}
}
func calcRightTurn(inputArray []int, k chan int) {
	start, end := 0, len(inputArray)-1
	turn := 0
	for start < end && inputArray[end] < inputArray[end-1] {
		turn = turn + 1
		end = end - 1
	}
	k <- turn
	return
}
func calcLeftTurn(inputArray []int, k chan int) {
	start, end := 0, len(inputArray)-1
	turn := 0
	for start < end && inputArray[start] < inputArray[start+1] {
		turn = turn + 1
		end = end - 1
	}
	k <- turn
	return
}

// https://codeforces.com/problemset/problem/1600/E
package main

import (
	"fmt"
	"log"
)

func main() {
	var lengthOfArray, element int
	var winner string

	// participants list and if the
	participants := []string{"Alice", "Bob"}
	inputArray := make([]int, 0)
	newSequence := make([]int, 0)

	// taking the input array's length
	fmt.Scanln(&lengthOfArray)
	start, end := 0, lengthOfArray-1
	// taking the input array
	for i := 0; i < lengthOfArray; i++ {
		fmt.Scan(&element)
		inputArray = append(inputArray, element)
	}

gameLoop:
	for i := start; i < lengthOfArray; i++ {
		k := 0
		if inputArray[start] > inputArray[end] {
			if len(newSequence) == 0 {
				newSequence = append(newSequence, inputArray[start])
			} else {
				if newSequence[k] < inputArray[start] {
					newSequence = append(newSequence, inputArray[start])
				}
				k = k + 1
			}
			start = start + 1
		} else {
			if len(newSequence) == 0 {
				newSequence = append(newSequence, inputArray[end])
			} else {
				if newSequence[k] < inputArray[end] {
					newSequence = append(newSequence, inputArray[end])
				}
				k = k + 1
			}
			end = end - 1
		}
		lengthNewSeq := len(newSequence)
		// checking if all the elements are used then returning the winner
		if lengthNewSeq == lengthOfArray {
			winner = participants[i%2]
			break gameLoop
		}

		//checking that last element of the new array is greater than both the side ending element
		// return the winner in that case
		if newSequence[lengthNewSeq-1] >= inputArray[start] && newSequence[lengthNewSeq-1] >= inputArray[end] {
			winner = participants[i%2]
			break gameLoop
		}
	}
	log.Println(winner)
}

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1600E(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	var n int
	Fscan(in, &n)
	input := make([]int, n)
	for i := range input {
		Fscan(in, &input[i])
	}

	l, r := 1, n-1
	for ; l < n && input[l-1] < input[l]; l++ {
	}
	for ; r > 0 && input[r] < input[r-1]; r-- {
	}
	if l%2 > 0 || (n-r)%21 > 0 {
		Fprint(out, "Alice")
	} else {
		Fprint(out, "Bob")
	}
}

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


package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	var n int
	var x string
	var data []string
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&x)
		data = append(data, x)
	}
	sort.Slice(data, func(i, j int) bool {
		return len(data[i]) < len(data[j])
	})
	var res = true
	for i := n - 1; i > 0; i-- {
		if !strings.Contains(data[i], data[i-1]) {
			res = false
			break
		}
	}
	if res {
		fmt.Println("YES")
		for _, str := range data {
			fmt.Println(str)
		}
	} else {
		fmt.Println("NO")
	}
}

package main

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

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

func main() {
	defer out.Flush()

	var n int
	fmt.Fscan(in, &n)
	s := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &s[i])
	}
	sort.Slice(s, func(i, j int) bool {
		if len(s[i]) != len(s[j]) {
			return len(s[i]) < len(s[j])
		}
		if strings.Contains(s[i], s[j]) {
			return false
		} else {
			return true
		}
	})
	var flag = true
	for i := 1; i < n; i++ {
		if !strings.Contains(s[i], s[i-1]) {
			flag = false
			break
		}
	}
	if flag {
		fmt.Fprintln(out,"YES")
		for i := 0; i < n; i++ {
			fmt.Fprintln(out, s[i])
		}
	} else {
		fmt.Fprintln(out, "NO")
	}
}

package main

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

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

	n, s, p := 0, "", ""
	g := [101][]string{}
	for Fscan(in, &n); n > 0; n-- {
		Fscan(in, &s)
		g[len(s)] = append(g[len(s)], s)
	}
	for _, ss := range g {
		if len(ss) == 0 {
			continue
		}
		for _, s := range ss {
			if s != ss[0] || !strings.Contains(s, p) {
				Fprint(out, "NO")
				return
			}
		}
		p = ss[0]
	}
	Fprintln(out, "YES")
	for _, ss := range g {
		for _, s := range ss {
			Fprintln(out, s)
		}
	}
}

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

package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	var n int
	if _, err := fmt.Scanf("%d\n", &n); err != nil {
		panic("could not read n from stdin")
	}

	inputStrings := make([]string, n, n)
	for i := 0; i < n; i++ {
		if _, err := fmt.Scanln(&inputStrings[i]); err != nil {
			panic(fmt.Sprintf("could not scanln string %d: %v", i, err))
		}
	}
	sort.Strings(inputStrings)
	sort.SliceStable(inputStrings, func(i, j int) bool {
		return len(inputStrings[i]) < len(inputStrings[j])
	})

	for i := 1; i < n; i++ {
		if strings.Index(inputStrings[i], inputStrings[i-1]) == -1 {
			fmt.Println("NO")
			return
		}
	}
	fmt.Println("YES")
	for _, s := range inputStrings {
		fmt.Println(s)
	}
}

package main

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

type StringSlice []string

func (s StringSlice) Less(i, j int) bool {
	return len(s[i]) < len(s[j])
}

func (s StringSlice) Len() int {
	return len(s)
}

func (s StringSlice) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	n, _ := strconv.ParseInt(sc.Text(), 10, 32)
	var arr StringSlice
	for sc.Scan() {
		s := sc.Text()
		arr = append(arr, s)
	}
	sort.Sort(arr)

	for i := 0; i < int(n-1); i++ {
		if !strings.Contains(arr[i+1], arr[i]) {
			fmt.Println("NO")
			return
		}
	}
	fmt.Println("YES")
	for _, s := range arr {
		fmt.Println(s)
	}
}

package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	var n int
	fmt.Scan(&n)
	var str = make([]string, n)
	for i := range str {
		fmt.Scan(&str[i])
	}

	sort.Slice(str, func(i, j int) bool {
		if strings.Contains(str[j], str[i]) {
			return true
		} else {
			return false
		}
	})
	// fmt.Println(str)

	var ans = true
	for i := 0; i < n; i++ {
		for j := 0; j < i; j++ {
			if !strings.Contains(str[i], str[j]) {
				ans = false
			}
		}
	}

	if ans {
		fmt.Println("YES")
		for _, item := range str {
			fmt.Println(item)
		}
	} else {
		fmt.Println("NO")
	}
}

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

package main

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

type byLength []string

func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)
	stringsCount := ReadInt32()
	inputs := make([]string, stringsCount)
	for stringIndex := 0; stringIndex < stringsCount; stringIndex++ {
		inputs[stringIndex] = ReadString()
	}
	sort.Sort(byLength(inputs))
	answer := true
	for stringIndex := 1; stringIndex < stringsCount; stringIndex++ {
		if !strings.Contains(inputs[stringIndex], inputs[stringIndex-1]) {
			answer = false
			break
		}
	}
	if !answer {
		writer.WriteString("NO\n")
	} else {
		writer.WriteString("YES\n")
		for stringIndex := 0; stringIndex < stringsCount; stringIndex++ {
			writer.WriteString(inputs[stringIndex] + "\n")
		}
	}
}

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

func (s byLength) Len() int {
	return len(s)
}

func (s byLength) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

func (s byLength) Less(i, j int) bool {
	return len(s[i]) < len(s[j])
}

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

func ReadInt32() int {
	ans, _ := strconv.Atoi(ReadString())
	return ans
}

package main

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

type ByLen []string

func (a ByLen) Len() int {
   return len(a)
}

func (a ByLen) Less(i, j int) bool {
   return len(a[i]) < len(a[j])
}

func (a ByLen) Swap(i, j int) {
   a[i], a[j] = a[j], a[i]
}

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

	str := []string {}

	i := 0
	for i < n {
		var here string
		fmt.Scan(&here)
		str = append(str, here)
		i ++
	}

	sort.Sort(ByLen(str))

	i = 0
	for i < n - 1 {
		if strings.Contains(str[i + 1], str[i]) == false {
			fmt.Println("NO")
			os.Exit(0)
		}
		i ++
	}

	fmt.Println("YES")
	for _, y := range str {
		fmt.Println(y)
	}
	os.Exit(0)
}

package main

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

type byCon []string

func (s byCon) Len() int {
	return len(s)
}

func (s byCon) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

func (s byCon) Less(i, j int) bool {
	return strings.Contains(s[j], s[i])
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	n := int(readOneInt64(reader))
	var ss []string
	for i:=0;i<n;i++{
		s := readOneString(reader)
		ss = append(ss, s)
	}
	sort.Sort(byCon(ss))
	for i:=0;i<n-1;i++{
		if !strings.Contains(ss[i+1], ss[i]){
			fmt.Println("NO")
			os.Exit(0)
		}
	}
	fmt.Println("YES")
	for i:=0;i<n;i++{
		fmt.Println(ss[i])
	}
}

func readOneInt64(r *bufio.Reader) (n int64) {
	bytes, _ := r.ReadBytes('\n')
	n, _ = strconv.ParseInt(string(bytes[:len(bytes)-2]), 10, 64)
	return
}

func readInt64Slice(r *bufio.Reader, n int) (slice []int64) {
	var bytes []byte
	slice = make([]int64, n)
	n--
	for i := 0; i < n; i++ {
		bytes, _ = r.ReadBytes(' ')
		slice[i], _ = strconv.ParseInt(string(bytes[:len(bytes)-1]), 10, 64)
	}
	slice[n] = readOneInt64(r)
	return
}

func readOneString(r *bufio.Reader) string {
	bytes, _ := r.ReadBytes('\n')
	return string(bytes[:len(bytes)-2])
}

func abs(i int) int {
	if i < 0 {
		return i * -1
	}
	return i
}

package main

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

func main() {
	sc := NewScanner()
	N := sc.NextInt()
	A := SortInterFace{}
	for i := 0; i < N; i++ {
		A = append(A, sc.Next())
	}
	sort.Sort(A)

	for i := 1; i < N; i++ {
		if !strings.Contains(A[i], A[i-1]) {
			fmt.Println("NO")
			return
		}
	}
	fmt.Println("YES")
	for i := 0; i < N; i++ {
		fmt.Println(A[i])
	}

}

type SortInterFace []string

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

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

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

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

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

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

	return mp
}

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

package main

import ("fmt";
		"sort")

func in(search, s string)bool{
	for i := 0; i < len(s) - len(search) + 1; i++{
		if (search == s[i:i + len(search)]){
			return true
	}
}
	return false
}

func main(){
	n := nextInt()
	var a []string = make([]string, n)
	for i := 0; i < n; i++{
		a[i] = next()
	}
	sort.Slice(a, func(i, j int)bool{
		return len(a[i]) < len(a[j])
		})
	for i := 1; i < n; i++{
		if (!in(a[i - 1], a[i])){
			sout("NO")
			return
		}
	}
	sout("YES")
	for _,s := range a{
		sout(s)
	}
}

func next() string{
	var ss string
	fmt.Scan(&ss)
	return ss
}
func nextInt() int{
	var ss int;
	fmt.Scan(&ss)
	return ss
}
func sout(obj ... interface{}){
	for _, k := range obj{
		fmt.Print(k, " ")
	}
	fmt.Println()
}

package main

import (
	"fmt"
	"strings"
)

var (
	n      int
	i      int
	st     [100]string
	ccl_st string

	l_st [100]int
	ccl  int
	flag bool
)

func main() {
	fmt.Scanln(&n)
	for i = 0; i < n; i++ {
		fmt.Scanln(&st[i])
		l_st[i] = len(st[i]) //读取字符串长度
	}
	//进行冒泡排序
	flag = true
	for flag == true {
		flag = false
		for i = 0; i < (n - 1); i++ {
			if l_st[i] > l_st[i+1] {
				flag = true
				ccl = l_st[i+1]
				l_st[i+1] = l_st[i]
				l_st[i] = ccl
				ccl_st = st[i+1]
				st[i+1] = st[i]
				st[i] = ccl_st
			}
		}
	}

	//判断多项是否包含少项
	flag = true
	for i = 0; (i < n-1) && (flag == true); i++ {
		flag = strings.Contains(st[i+1], st[i]) //判断后者是否包含前者

	}
	if flag == true {
		fmt.Println("YES")
		for i = 0; i < n; i++ {
			fmt.Println(st[i])
		}
	} else {
		fmt.Println("NO")

	}
}

package main

import (
	"fmt"
	"strings"
)

var (
	n      int
	i      int
	st     [100]string
	ccl_st string

	l_st [100]int
	ccl  int
	flag bool
)

func main() {
	fmt.Scanln(&n)
	for i = 0; i < n; i++ {
		fmt.Scanln(&st[i])
		l_st[i] = len(st[i]) //读取字符串长度
	}
	//进行冒泡排序
	flag = true
	for flag == true {
		flag = false
		for i = 0; i < (n - 1); i++ {
			if l_st[i] > l_st[i+1] {
				flag = true
				ccl = l_st[i+1]
				l_st[i+1] = l_st[i]
				l_st[i] = ccl
				ccl_st = st[i+1]
				st[i+1] = st[i]
				st[i] = ccl_st
			}
		}
	}

	//判断多项是否包含少项
	flag = true
	for i = 0; (i < n-1) && (flag == true); i++ {
		flag = strings.Contains(st[i+1], st[i]) //判断后者是否包含前者
		fmt.Println(i)
	}
	if flag == true {
		fmt.Println("YES")
		for i = 0; i < n; i++ {
			fmt.Println(st[i])
		}
	} else {
		fmt.Println("NO")

	}
}


package main

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

const MAXN = 300006

var arr[MAXN] int

func printAns(N int) {
	var i int
	var buffer bytes.Buffer
	ans := 0
	start := 0
	end := 0;
	for (start <= N && arr[start] == 0) {start++}
	for start <= N {
		if (arr[start] == 0) {
			start++
			continue
		}
		end = start
		for (end <= N && arr[end] == 1) {end++}
		if (end-start > ans) {ans = end-start}
		start++
	}
	fmt.Printf("%d\n", ans);
	for i=1; i<=N; i++ {
		buffer.WriteString(strconv.Itoa(arr[i]))
		buffer.WriteString(" ")
	}
	fmt.Printf(buffer.String())
}

func main() {
	var N,K,i,k int
	var ans,start,end,ans_start,ans_end,max_ans int
	var buffer bytes.Buffer
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &N)
	fmt.Fscan(in, &K)
	// fmt.Scanf("%d %d\n", &N, &K)
	for i=1; i<=N; i++ {
		// fmt.Scanf("%d", &arr[i])
		fmt.Fscan(in, &arr[i])
	}
	start = 0
	k = 0
	ans_start = 1
	ans_end = 1
	if K == 0 {
		printAns(N)
		return
	}
	if arr[start] == 0 {
		k++
	}
	end = start
	ans = end - start + 1
	max_ans = ans
	for start < N {
		if arr[start] == 0 {
			k--
		}
		start++
		ans--
		for end+1 <= N && (arr[end+1] == 1 || k < K) {
			end++
			if arr[end] == 0 {
				k++
			}
			ans++
		}
		if ans > max_ans {
			max_ans = ans;
			ans_start = start
			ans_end = end
		}
	}
	fmt.Printf("%d\n", max_ans);
	for i=1; i<ans_start; i++ {
		buffer.WriteString(strconv.Itoa(arr[i]))
		buffer.WriteString(" ")
	}
	for max_ans > 0 {
		buffer.WriteString("1 ")
		max_ans--
	}
	for i=ans_end+1; i<=N; i++ {
		buffer.WriteString(strconv.Itoa(arr[i]))
		buffer.WriteString(" ")
	}
	fmt.Printf(buffer.String())
}

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

package main

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

func Solve(n int, k int, a []int) (int, []int) {
	l := 0
	r := 0
	zeroes := 0
	maxL := -1
	maxR := -1
	ans := 0
	for l < n && r < n {
		if a[r] == 0 {
			zeroes += 1
		}
		if zeroes > k {
			if a[l] == 0 {
				zeroes -= 1
			}
			l += 1
		}
		if (r - l + 1) > ans {
			maxL = l
			maxR = r
			ans = r - l + 1
		}
		r += 1
	}
	if maxL == -1 && maxR == -1 {
		return ans, a
	}
	for i := maxL; i <= maxR; i++ {
		a[i] = 1
	}
	return ans, a
}

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

	var n, k int
	fmt.Fscanf(reader, "%d %d\n", &n, &k)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(reader, "%d", &a[i])
	}
	fmt.Fscanf(reader, "\n")

	length, arr := Solve(n, k, a)
	fmt.Fprintf(writer, "%d\n", length)
	for _, elem := range arr {
		fmt.Fprintf(writer, "%d ", elem)
	}
	fmt.Fprintf(writer, "\n")
}

package main

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

var stdin *bufio.Reader
var stdout *bufio.Writer

func init() {
	stdin = bufio.NewReader(os.Stdin)
    stdout = bufio.NewWriter(os.Stdout)
}

func main() {
	n, k := 0, 0
	fmt.Fscanf(stdin, "%d%d\n", &n, &k)

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

	begin, end := 0, 0
	for count := 0; end < n && count <= k; end++ {
		if array[end] == 0 {
			if count < k {
				count++
			} else {
				break
			}
		}
	}

	max := end - begin
	maxBegin := begin
	maxEnd := end

	for end < n {

        if array[begin] == 0 {
		    begin++
            end++
        } else {
            begin++
        }

		for end < n && array[end] == 1 {
			end++
		}

		if end-begin > max {
			max = end - begin
			maxBegin = begin
			maxEnd = end
		}
	}

    fmt.Println(max)
    for i := 0; i < n; i++ {
        if i >= maxBegin && i < maxEnd {
            fmt.Fprint(stdout, "1 ")
        } else {
            fmt.Fprintf(stdout, "%d ", array[i])
        }
    }
    stdout.Flush()
}

package main

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

var stdin *bufio.Reader

func init() {
	stdin = bufio.NewReader(os.Stdin)
}

func main() {
	n, k := 0, 0
	fmt.Fscanf(stdin, "%d%d\n", &n, &k)

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

	begin, end := 0, 0
	for count := 0; end < n && count <= k; end++ {
		if array[end] == 0 {
			if count < k {
				count++
			} else {
				break
			}
		}
	}

	max := end - begin
	maxBegin := begin
	maxEnd := end

	for end < n {

		for begin < n && array[begin] == 1 {
			begin++
		}

		if begin == 0 {
			break
		}

		begin++
		end++

		for end < n && array[end] == 1 {
			end++
		}

		if end-begin > max {
			max = end - begin
			maxBegin = begin
			maxEnd = end
		}
	}

    fmt.Println(max)
    for i := 0; i < n; i++ {
        if i >= maxBegin && i < maxEnd {
            fmt.Print("1 ")
        } else {
            fmt.Printf("%d ", array[i])
        }
    }
}

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

package main

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

func Solve(n int, k int, a []int) []int {
	l := 0
	r := 0
	zeroes := 0
	maxL := -1
	maxR := -1
	ans := 0
	for l < n && r < n {
		if a[r] == 0 {
			zeroes += 1
		}
		if zeroes > k {
			if a[l] == 0 {
				zeroes -= 1
			}
			l += 1
		}
		if (r - l + 1) > ans {
			maxL = l
			maxR = r
			ans = r - l + 1
		}
		r += 1
	}
	if maxL == -1 && maxR == -1 {
		return a
	}
	for i := maxL; i <= maxR; i++ {
		a[i] = 1
	}
	return a
}

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

	var n, k int
	fmt.Fscanf(reader, "%d %d\n", &n, &k)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(reader, "%d", &a[i])
	}
	fmt.Fscanf(reader, "\n")

	for _, elem := range Solve(n, k, a) {
		fmt.Fprintf(writer, "%d ", elem)
	}
	fmt.Fprintf(writer, "\n")
}