You have decided to watch the best moments of some movie. There are two buttons on your player:   Watch the current minute of the movie. By pressing this button, you watch the current minute of the movie and the player automatically proceeds to the next minute of the movie.  Skip exactly x minutes of the movie (x is some fixed positive integer). If the player is now at the t-th minute of the movie, then as a result of pressing this button, it proceeds to the minute (t + x). Initially the movie is turned on in the player on the first minute, and you want to watch exactly n best moments of the movie, the i-th best moment starts at the li-th minute and ends at the ri-th minute (more formally, the i-th best moment consists of minutes: li, li + 1, ..., ri). Determine, what is the minimum number of minutes of the movie you have to watch if you want to watch all the best moments?

The first line contains two space-separated integers n, x (1 ≤ n ≤ 50, 1 ≤ x ≤ 105) — the number of the best moments of the movie and the value of x for the second button. The following n lines contain the descriptions of the best moments of the movie, the i-th line of the description contains two integers separated by a space li, ri (1 ≤ li ≤ ri ≤ 105). It is guaranteed that for all integers i from 2 to n the following condition holds: ri - 1 < li.

Output a single number — the answer to the problem.

NoteIn the first sample, the player was initially standing on the first minute. As the minutes from the 1-st to the 4-th one don't contain interesting moments, we press the second button. Now we can not press the second button and skip 3 more minutes, because some of them contain interesting moments. Therefore, we watch the movie from the 4-th to the 6-th minute, after that the current time is 7. Similarly, we again skip 3 minutes and then watch from the 10-th to the 12-th minute of the movie. In total, we watch 6 minutes of the movie.In the second sample, the movie is very interesting, so you'll have to watch all 100000 minutes of the movie.

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	var s int
	fmt.Scan(&s)
	a := make([][2]int, n)
	for i := range a {
		var p int
		fmt.Scan(&p)
		var q int
		fmt.Scan(&q)
		a[i] = [2]int{p, q}
	}
	c := 1
	dr := 0
	for _, p := range a {
		d := p[0] - c
		dr += p[1] - p[0] + 1 + (d % s)
		c = p[1] + 1
	}
	fmt.Println(dr)
}

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, x := nextInt(), nextInt()
	current := 1
	minute := 0

	for ; n > 0; n-- {
		l, r := nextInt(), nextInt() + 1

		for current + x <= l {
			current += x
		}

		minute += r - current
		current = r
	}

	println(minute)
}

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 main() {
	var n, x int
	if _, err := fmt.Scanf("%d %d\n", &n, &x); err != nil {
		return
	}

	var watch int = 0

	var pos int = 1
	var s, e int
	for i := 0; i < n; i++ {
		if _, err := fmt.Scanf("%d %d\n", &s, &e); err != nil {
			return
		}

		remain := (s - pos) % x
		watch += (remain + e - s + 1)

		pos = e + 1
	}

	fmt.Println(watch)
}

package main

import (
	"fmt"
)

var (
	n      int
	x      int
	left   []int
	right  []int
	result int
)

func in() {
	fmt.Scanf("%d %d\n", &n, &x)

	left = make([]int, n+1)
	right = make([]int, n+1)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d %d\n", &left[i+1], &right[i+1])
	}
}

func out() {
	fmt.Println(result)
}

func run() {
	result = 0
	left[0] = -1
	right[0] = 0
	for i := 1; i <= n; i++ {
		result += (left[i] - right[i-1] - 1) % x
		result += right[i] - left[i] + 1
	}
}

func main() {
	in()
	run()
	out()
}

package main

import "fmt"

// 1000
// 26.05.2020
// https://codeforces.com/problemset/problem/499/A
func main() {
	var n, x int
	fmt.Scanln(&n, &x)
	cur := 1
	var watched int
	for i := 0; i < n; i++ {
		var l, r int
		fmt.Scanln(&l, &r)

		watched += (l-cur)%x + r - l + 1
		cur = r + 1
	}
	fmt.Println(watched)
}

package main

import (
	"fmt"
	"os"
)

func main() {
	var n, x, ans int
	fmt.Fscan(os.Stdin, &n, &x)
	cur := 1
	for i := 0; i < n; i++ {
		var l, r int
		fmt.Fscan(os.Stdin, &l, &r)
		ans += (l-cur)%x + r - l + 1
		cur = r + 1
	}
	fmt.Println(ans)
}

package main

import (
	"fmt"
)

func main() {
	var n, x, l, r, c, res int

	c = 1

	fmt.Scan(&n, &x)

	for i := 0; i < n; i++ {
		fmt.Scan(&l, &r)

		c = c + ((l-c)/x)*x
		res += r + 1 - c
		c = r + 1
	}

	fmt.Println(res)
}

package main

import "os"
import "fmt"
import "strings"
import "strconv"
import "bufio"

func main() {
    bio := bufio.NewReader(os.Stdin)
    line, _, _ := bio.ReadLine()
    parts := strings.Split(string(line), " ")
    howManyBestPart, _ := strconv.ParseInt(parts[0], 10, 64)
    howLongSkip, _ := strconv.ParseInt(parts[1], 10, 64)

    minimunTimeMustBeSpent := 0
    for i, lastBestPartEndsHere := 0, 0; i < int(howManyBestPart); i++ {
        line, _, _ := bio.ReadLine()
        parts := strings.Split(string(line), " ")
        bestPartLeft, _ := strconv.ParseInt(parts[0], 10, 64)
        bestPartRight, _ := strconv.ParseInt(parts[1], 10, 64)

        howLongThisBestPartLast := int(bestPartRight) - int(bestPartLeft) + 1 // bound including
        howLongMustBeSeenWithoutSkip := (int(bestPartLeft) - 1 - lastBestPartEndsHere) % int(howLongSkip)
        minimunTimeMustBeSpent += howLongMustBeSeenWithoutSkip + howLongThisBestPartLast
        lastBestPartEndsHere = int(bestPartRight)
    }

    fmt.Println(minimunTimeMustBeSpent)
}

package main

import (
	"fmt"
)

func main() {
	var n, x int
	var l, r [50]int
	fmt.Scan(&n, &x)
	for i := 0; i < n; i++ {
		fmt.Scan(&l[i], &r[i])
	}

	z := 0
	for i, t := 0, 1; i < n; i++ {
		d := l[i] - t
		z += d%x + r[i] - l[i] + 1
		t = r[i] + 1
	}
	fmt.Println(z)
}

package main

import "fmt"

func main() {
	var n, x int
	fmt.Scan(&n, &x)
	point := 1
	r := 0
	for i := 0; i < n; i++ {
		var a, b int
		fmt.Scan(&a, &b)
		for ; a-point >= x; point += x {
		}
		r += b - point + 1
		point = b + 1
	}
	fmt.Println(r)
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	var s int
	fmt.Scan(&s)
	a := make([][2]int, n)
	for i := range a {
		var p int
		fmt.Scan(&p)
		var q int
		fmt.Scan(&q)
		a[i] = [2]int{p, q}
	}
	c := 0
	dr := 0
	for _, p := range a {
		d := p[0] - c
		dr += p[1] - p[0] + (d % s)
		c = p[1]
	}
	fmt.Println(dr)
}

package main

import (
	"fmt"
)

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

	var watch int = 0

	var pos int = 1
	var s, e int
	for i := 0; i < n; i++ {
		if _, err := fmt.Scanf("%d %d\n", &s, &e); err != nil {
			return
		}

		remain := (s - pos) % x
		watch += (remain + e - s + 1)
	}

	fmt.Println(watch)
}

package main

import (
	"fmt"
)

var (
	n      int
	x      int
	left   []int
	right  []int
	result int
)

func in() {
	fmt.Scanf("%d %d\n", &n, &x)

	left = make([]int, n+1)
	right = make([]int, n+1)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d %d\n", &left[i+1], &right[i+1])
	}
}

func out() {
	fmt.Println(result)
}

func run() {
	result = 0
	left[0] = -1
	right[0] = 0
	for i := 1; i < n; i++ {
		result += (left[i] - right[i-1] - 1) % x
		result += right[i] - left[i] + 1
	}
}

func main() {
	in()
	run()
	out()
}

package main

import (
	"fmt"
)

type Moment struct {
	Left  int
	Right int
}

func (m *Moment) getDuration() int {
	return m.Right - m.Left + 1
}

var (
	n       int
	x       int
	moments []Moment
	result  int
)

func in() {
	fmt.Scanf("%d %d\n", &n, &x)
	for i := 0; i < n; i++ {
		var l, r int
		fmt.Scanf("%d %d", &l, &r)
		moments = append(moments, Moment{l, r})
	}
}

func out() {
	fmt.Println(result)
}

func run() {
	result = (moments[0].Left-1)%x + moments[0].getDuration()
	for i := 1; i < n; i++ {
		result += (moments[i].Left - moments[i-1].Right - 1) % x
		result += moments[i].getDuration()
	}
}

func main() {
	in()
	run()
	out()
}

package main

import (
	"fmt"
)

var (
	n      int
	x      int
	left   []int
	right  []int
	result int
)

func in() {
	fmt.Scanf("%d %d\n", &n, &x)

	left = make([]int, n+1)
	right = make([]int, n+1)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d %d", &left[i+1], &right[i+1])
	}
}

func out() {
	fmt.Println(result)
}

func run() {
	result = 0
	left[0] = -1
	right[0] = 0
	for i := 1; i < n; i++ {
		result += (left[i] - right[i-1] - 1) % x
		result += right[i] - left[i] + 1
	}
}

func main() {
	in()
	run()
	out()
}

package main

import (
	"fmt"
)

type Moment struct {
	Left  int
	Right int
}

func (m *Moment) getDuration() int {
	return m.Right - m.Left + 1
}

var (
	n       int
	x       int
	moments []Moment
	result  int
)

func in() {
	fmt.Scanf("%d %d\n", &n, &x)
	for i := 0; i < n; i++ {
		m := new(Moment)
		fmt.Scanf("%d %d", &m.Left, &m.Right)
		moments = append(moments, *m)
	}
}

func out() {
	fmt.Println(result)
}

func run() {
	result = (moments[0].Left-1)%x + moments[0].getDuration()
	for i := 1; i < n; i++ {
		result += (moments[i].Left - moments[i-1].Right - 1) % x
		result += moments[i].getDuration()
	}
}

func main() {
	in()
	run()
	out()
}

package main

import "fmt"

// 1000
// 26.05.2020
// https://codeforces.com/problemset/problem/499/A
func main() {
	var n, x int
	fmt.Scanln(&n, &x)
	var watched, cur int
	for i := 0; i < n; i++ {
		var l, r int
		fmt.Scanln(&l, &r)

		watched += (l-cur)%x + r - l
		cur = r
	}
	fmt.Println(watched)
}

package main

import "fmt"

func main() {
    howManyBestPart := -1
    howLongSkip := -1
    fmt.Scanf("%d %d", &howManyBestPart, &howLongSkip)

    minimunTimeMustBeSpent := 0
    for i, lastBestPartEndsHere := 0, 0; i < howManyBestPart; i++ {
        bestPartLeft, bestPartRight := -1, -1
        fmt.Scanf("%d %d", &bestPartLeft, &bestPartRight)

        howLongThisBestPartLast := bestPartRight - bestPartLeft + 1 // bound including
        howLongMustBeSeenWithoutSkip := (bestPartLeft - 1 - lastBestPartEndsHere) % howLongSkip
        minimunTimeMustBeSpent = minimunTimeMustBeSpent + howLongMustBeSeenWithoutSkip + howLongThisBestPartLast
        lastBestPartEndsHere = bestPartRight
    }

    fmt.Println(minimunTimeMustBeSpent)
}

package main

import "fmt"

func main() {
    howManyBestPart := -1
    howLongSkip := -1
    fmt.Scanf("%d %d", &howManyBestPart, &howLongSkip)

    minimunTimeMustBeSpent := 0
    for i, lastBestPartEndsHere := 0, 0; i < howManyBestPart; i++ {
        bestPartLeft, bestPartRight := -1, -1
        fmt.Scanf("%d %d", &bestPartLeft, &bestPartRight)

        howLongThisBestPartLast := bestPartRight - bestPartLeft + 1 // bound including
        howLongMustBeSeenWithoutSkip := (bestPartLeft - 1 - lastBestPartEndsHere) % howLongSkip
        minimunTimeMustBeSpent += howLongMustBeSeenWithoutSkip + howLongThisBestPartLast
        lastBestPartEndsHere = bestPartRight
    }

    fmt.Println(minimunTimeMustBeSpent)
}

package main

import "fmt"

func main() {
    howManyBestPart := -1
    howLongSkip := -1
    fmt.Scanf("%d %d", &howManyBestPart, &howLongSkip)

    minimunTimeMustBeSpent := 0
    lastBestPartEndsHere := 0
    for i := 0; i < howManyBestPart; i++ {
        bestPartLeft, bestPartRight := -1, -1
        fmt.Scanf("%d %d", &bestPartLeft, &bestPartRight)

        howLongThisBestPartLast := bestPartRight - bestPartLeft + 1 // bound including
        howLongMustBeSeenWithoutSkip := (bestPartLeft - 1 - lastBestPartEndsHere) % howLongSkip
        minimunTimeMustBeSpent = minimunTimeMustBeSpent + howLongMustBeSeenWithoutSkip + howLongThisBestPartLast
        lastBestPartEndsHere = bestPartRight
    }

    fmt.Println(minimunTimeMustBeSpent)
}

package main

import "fmt"

func main() {
    howManyBestPart := -1
    howLongSkip := -1
    fmt.Scanf("%d %d", &howManyBestPart, &howLongSkip)

    minimunTimeMustBeSpent := 0
    for i, lastBestPartEndsHere := 0, 0; i < howManyBestPart; i++ {
        bestPartLeft, bestPartRight := -1, -1
        //fmt.Scanf("%d %d", &bestPartLeft, &bestPartRight)
        fmt.Scanf("%d", &bestPartLeft)
        fmt.Scanf("%d", &bestPartRight)

        howLongThisBestPartLast := bestPartRight - bestPartLeft + 1 // bound including
        howLongMustBeSeenWithoutSkip := (bestPartLeft - 1 - lastBestPartEndsHere) % howLongSkip
        minimunTimeMustBeSpent += howLongMustBeSeenWithoutSkip + howLongThisBestPartLast
        lastBestPartEndsHere = bestPartRight
    }

    fmt.Println(minimunTimeMustBeSpent)
}

package main

import (
	"fmt"
)

func main() {
	var n, x int
	var l, r [50]int
	fmt.Scan(&n, &x)
	for i := 0; i < n; i++ {
		fmt.Scan(&l[i], &r[i])
	}

	z := 0
	for i, t := 0, 1; i < n; i++ {
		d := l[i] - t
		z += d%x + r[i] - l[i]
		t = r[i]
	}
	fmt.Println(z + 1)
}


There are $$$n$$$ traps numbered from $$$1$$$ to $$$n$$$. You will go through them one by one in order. The $$$i$$$-th trap deals $$$a_i$$$ base damage to you.Instead of going through a trap, you can jump it over. You can jump over no more than $$$k$$$ traps. If you jump over a trap, it does not deal any damage to you. But there is an additional rule: if you jump over a trap, all next traps damages increase by $$$1$$$ (this is a bonus damage).Note that if you jump over a trap, you don't get any damage (neither base damage nor bonus damage). Also, the bonus damage stacks so, for example, if you go through a trap $$$i$$$ with base damage $$$a_i$$$, and you have already jumped over $$$3$$$ traps, you get $$$(a_i + 3)$$$ damage.You have to find the minimal damage that it is possible to get if you are allowed to jump over no more than $$$k$$$ traps.

The input consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \le k \le n$$$) — the number of traps and the number of jump overs that you are allowed to make. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — base damage values of all traps. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.

For each test case output a single integer — the minimal total damage that it is possible to get if you are allowed to jump over no more than $$$k$$$ traps.

NoteIn the first test case it is allowed to jump over all traps and take $$$0$$$ damage.In the second test case there are $$$5$$$ ways to jump over some traps:  Do not jump over any trap.Total damage: $$$5 + 10 + 11 + 5 = 31$$$. Jump over the $$$1$$$-st trap.Total damage: $$$\underline{0} + (10 + 1) + (11 + 1) + (5 + 1) = 29$$$. Jump over the $$$2$$$-nd trap.Total damage: $$$5 + \underline{0} + (11 + 1) + (5 + 1) = 23$$$. Jump over the $$$3$$$-rd trap.Total damage: $$$5 + 10 + \underline{0} + (5 + 1) = 21$$$. Jump over the $$$4$$$-th trap.Total damage: $$$5 + 10 + 11 + \underline{0} = 26$$$.To get minimal damage it is needed to jump over the $$$3$$$-rd trap, so the answer is $$$21$$$.In the third test case it is optimal to jump over the traps $$$1$$$, $$$3$$$, $$$4$$$, $$$5$$$, $$$7$$$:Total damage: $$$0 + (2 + 1) + 0 + 0 + 0 + (2 + 4) + 0 = 9$$$.

package main

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

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

	var T, n, k int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &k)
		ori := make([]int, n)
		type pair struct{ v, i int }
		a := make([]pair, n)
		for i := range a {
			Fscan(in, &ori[i])
			a[i] = pair{ori[i] + i, i}
		}
		sort.Slice(a, func(i, j int) bool { return a[i].v > a[j].v })
		del := make([]bool, n)
		for _, p := range a[:k] {
			del[p.i] = true
		}
		ans, ex := int64(0), 0
		for i, b := range del {
			if b {
				ex++
			} else {
				ans += int64(ori[i] + ex)
			}
		}
		Fprintln(out, ans)
	}
}

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

package main

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

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

	var T, n, k int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &k)
		ori := make([]int, n)
		type pair struct{ v, i int }
		a := make([]pair, n)
		for i := range a {
			Fscan(in, &ori[i])
			a[i] = pair{ori[i], i}
		}
		sort.Slice(a, func(i, j int) bool { return a[i].v+a[i].i > a[j].v+a[j].i })
		del := make([]bool, n)
		for _, p := range a[:k] {
			del[p.i] = true
		}
		ans, ex := int64(0), 0
		for i, b := range del {
			if b {
				ex++
			} else {
				ans += int64(ori[i] + ex)
			}
		}
		Fprintln(out, ans)
	}
}

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

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)
var wrtr = bufio.NewWriterSize(os.Stdout, 10_000_000)
var rdr = bufio.NewScanner(os.Stdin)
func gs() string  { rdr.Scan(); return rdr.Text() }
func gi() int     { i,e := strconv.Atoi(gs()); if e != nil {panic(e)}; return i }
func gi2() (int,int) { return gi(),gi() }
func gi3() (int,int,int) { return gi(),gi(),gi() }
func gi4() (int,int,int,int) { return gi(),gi(),gi(),gi() }
func gis(n int) []int  { res := make([]int,n); for i:=0;i<n;i++ { res[i] = gi() }; return res }
func gf() float64 { f,e := strconv.ParseFloat(gs(),64); if e != nil {panic(e)}; return f }
func gbs() []byte { return []byte(gs()) }
func gfs(n int) []float64  { res := make([]float64,n); for i:=0;i<n;i++ { res[i] = gf() }; return res }
func gss(n int) []string  { res := make([]string,n); for i:=0;i<n;i++ { res[i] = gs() }; return res }
func ia(m int) []int { return make([]int,m) }
func iai(m int,v int) []int { a := make([]int,m); for i:=0;i<m;i++ { a[i] = v }; return a }
func twodi(n int,m int,v int) [][]int {
	r := make([][]int,n); for i:=0;i<n;i++ { x := make([]int,m); for j:=0;j<m;j++ { x[j] = v }; r[i] = x }; return r
}
func fill2(m int) ([]int,[]int) { a,b := ia(m),ia(m); for i:=0;i<m;i++ {a[i],b[i] = gi(),gi()}; return a,b }
func fill3(m int) ([]int,[]int,[]int) { a,b,c := ia(m),ia(m),ia(m); for i:=0;i<m;i++ {a[i],b[i],c[i] = gi(),gi(),gi()}; return a,b,c }
func fill4(m int) ([]int,[]int,[]int,[]int) { a,b,c,d := ia(m),ia(m),ia(m),ia(m); for i:=0;i<m;i++ {a[i],b[i],c[i],d[i] = gi(),gi(),gi(),gi()}; return a,b,c,d }
func abs(a int) int { if a < 0 { return -a }; return a }
func rev(a []int) { i,j := 0,len(a)-1; for i < j { a[i],a[j] = a[j],a[i]; i++; j-- } }
func max(a,b int) int { if a > b { return a }; return b }
func min(a,b int) int { if a > b { return b }; return a }
func tern(cond bool, a int, b int) int { if cond { return a }; return b }
func terns(cond bool, a string, b string) string { if cond { return a }; return b }
func maxarr(a []int) int { ans := a[0]; for _,aa := range(a) { if aa > ans { ans = aa } }; return ans }
func minarr(a []int) int { ans := a[0]; for _,aa := range(a) { if aa < ans { ans = aa } }; return ans }
func sumarr(a []int) int { ans := 0; for _,aa := range(a) { ans += aa }; return ans }
func zeroarr(a []int) { for i:=0; i<len(a); i++ { a[i] = 0 } }
func powmod(a,e,mod int) int { res, m := 1, a; for e > 0 { if e&1 != 0 { res = res * m % mod }; m = m * m % mod; e >>= 1 }; return res }
func powint(a,e int) int { res, m := 1, a; for e > 0 { if e&1 != 0 { res = res * m }; m = m * m; e >>= 1 }; return res }
func gcd(a,b int) int { for b != 0 { t:=b; b=a%b; a=t }; return a }
func gcdExtended(a,b int) (int,int,int) { if a == 0 { return b,0,1 }; gcd,x1,y1 := gcdExtended(b%a,a); return gcd, y1-(b/a)*x1,x1 }
func modinv(a,m int) (int,bool) { g,x,_ := gcdExtended(a,m); if g != 1 { return 0,false }; return (x % m + m) % m,true  }
func makefact(n int,mod int) ([]int,[]int) {
	fact,factinv := make([]int,n+1),make([]int,n+1)
	fact[0] = 1; for i:=1;i<=n;i++ { fact[i] = fact[i-1] * i % mod }
	factinv[n] = powmod(fact[n],mod-2,mod); for i:=n-1;i>=0;i-- { factinv[i] = factinv[i+1] * (i+1) % mod }
	return fact,factinv
}
func vecintstring(a []int) string { astr := make([]string,len(a)); for i,a := range a { astr[i] = strconv.Itoa(a) }; return strings.Join(astr," ") }
func main() {
	//f1, _ := os.Create("cpu.prof"); pprof.StartCPUProfile(f1); defer pprof.StopCPUProfile()
	defer wrtr.Flush()
	infn := ""; if infn == "" && len(os.Args) > 1 {	infn = os.Args[1] }
	if infn != "" {	f, e := os.Open(infn); if e != nil { panic(e) }; rdr = bufio.NewScanner(f) }
	rdr.Split(bufio.ScanWords); rdr.Buffer(make([]byte,1024),1_000_000_000)
	// PROGRAM STARTS HERE
	// We are always going to jump over K traps (e.g. jumping over the last K traps is free)
	// To make the math easy, we first assume we will take damage from ALL subsequent traps (even the ones we jump over)
	// The undercount of the savings is always K choose 2 which we can deal with at the end
	// This allows us to be greedy
	T := gi()
	for tt:=1;tt<=T;tt++ {
		N,K := gi(),gi(); A := gis(N)
		suma := int64(0); for _,a := range A { suma += int64(a) }
		savea := ia(N); for i:=0;i<N;i++ { savea[i] = A[i] - (N-i-1) }
		sort.Slice(savea,func(i,j int) bool { return savea[i] > savea[j] } )
		sumsavea := int64(K) * int64(K-1) / 2;  for i:=0;i<K;i++ { sumsavea += int64(savea[i]) }
		ans := suma-sumsavea
		fmt.Fprintln(wrtr,ans)
	}
}

package main

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

type Int int64

const (
	INF = 3e5 + 10
	L0  = Int(0)
	L1  = Int(1)
)

type Segment struct {
	l, r, val, add, minIndex Int
}

type SegTree struct {
	st []Segment
}

func (segTree SegTree) Build(x, l, r Int) {
	segTree.st[x].l = l
	segTree.st[x].r = r
	if l == r {
		segTree.st[x].minIndex = l
		return
	}
	mid := (l + r) >> 1
	segTree.Build(x<<1, l, mid)
	segTree.Build(x<<1|1, mid+1, r)
}

func (segTree SegTree) push(x Int) {
	if segTree.st[x].add != 0 {
		segTree.modifyOne(x<<1, segTree.st[x].add)
		segTree.modifyOne(x<<1|1, segTree.st[x].add)
		segTree.st[x].add = 0
	}
}

func (segTree SegTree) update(x Int) {
	if segTree.st[x<<1].val < segTree.st[x<<1|1].val {
		segTree.st[x].val = segTree.st[x<<1].val
		segTree.st[x].minIndex = segTree.st[x<<1].minIndex
	} else {
		segTree.st[x].val = segTree.st[x<<1|1].val
		segTree.st[x].minIndex = segTree.st[x<<1|1].minIndex
	}
}

func (segTree SegTree) modifyOne(x, add Int) {
	segTree.st[x].val += add
	if segTree.st[x].l != segTree.st[x].r {
		segTree.st[x].add += add
	}
}

func (segTree SegTree) Modify(x, l, r, add Int) {
	if segTree.st[x].l >= l && segTree.st[x].r <= r {
		segTree.modifyOne(x, add)
		return
	}
	segTree.push(x)
	mid := (segTree.st[x].l + segTree.st[x].r) >> 1
	if mid >= l {
		segTree.Modify(x<<1, l, r, add)
	}
	if mid < r {
		segTree.Modify(x<<1|1, l, r, add)
	}
	segTree.update(x)
}

func updateRes(cRes, cIndex, res, index Int) (Int, Int) {
	if cRes > res {
		return res, index
	}
	return cRes, cIndex
}

func (segTree SegTree) Query(x, l, r Int) (Int, Int) {
	res := Int(math.MaxInt64)
	resInd := -L1
	if segTree.st[x].l >= l && segTree.st[x].r <= r {
		res, resInd = updateRes(res, resInd, segTree.st[x].val, segTree.st[x].minIndex)
		return res, resInd
	}
	mid := (segTree.st[x].l + segTree.st[x].r) >> 1
	if mid >= l {
		sonRes, sonInd := segTree.Query(x<<1, l, r)
		res, resInd = updateRes(res, resInd, sonRes, sonInd)
	}
	if mid < r {
		sonRes, sonInd := segTree.Query(x<<1|1, l, r)
		res, resInd = updateRes(res, resInd, sonRes, sonInd)
	}
	return res, resInd
}

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

	var T int
	Fscan(in, &T)

	for tt := 0; tt < T; tt++ {
		var n, k Int
		Fscan(in, &n, &k)

		segTree := SegTree{make([]Segment, n<<2)}
		segTree.Build(1, 1, n)

		ans := L0
		for i := L1; i <= n; i++ {
			var x Int
			Fscan(in, &x)
			segTree.Modify(1, i, i, n-i-x)
			ans += x
		}

		for k > 0 {
			mi, index := segTree.Query(1, 1, n)
			if mi < 0 {
				ans += mi
				segTree.Modify(1, index, index, math.MaxInt64>>1)
				segTree.Modify(1, 1, n, -1)
				k--
			} else {
				break
			}
		}
		Fprintln(out, ans)
	}

}

func MakeGrid(h, w int) [][]Int {
	index := make([][]Int, h)
	data := make([]Int, h*w)
	for i := 0; i < h; i++ {
		index[i] = data[i*w : (i+1)*w]
	}
	return index
}

func Abs(x Int) Int {
	if x > 0 {
		return x
	}
	return -x
}

func Min(nums ...Int) Int {
	return nums[MinIdx(nums...)]
}

func MinIdx(nums ...Int) Int {
	maxNumIdx := L0
	for i, num := range nums {
		if num < nums[maxNumIdx] {
			maxNumIdx = Int(i)
		}
	}
	return maxNumIdx
}

func Max(nums ...Int) Int {
	return nums[MaxIdx(nums...)]
}

func MaxIdx(nums ...Int) Int {
	maxNumIdx := L0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = Int(i)
		}
	}
	return maxNumIdx
}

var (
	mod  Int
	fmod func(Int) Int = doNothing
)

// SetMod sets the mod. It must be called first.
func SetMod(newMod Int) {
	mod = newMod
	fmod = dynamicMod
}

func dynamicMod(m Int) Int {
	m %= mod
	if m < 0 {
		return m + mod
	}
	return m
}

func doNothing(m Int) Int {
	return m
}

// Mod returns m % mod.
func (m Int) Mod() Int {
	return fmod(m)
}

// Inv returns modular multiplicative inverse
func (m Int) Inv() Int {
	return m.Pow(Int(0).Sub(2))
}

// Pow returns m^n
func (m Int) Pow(n Int) Int {
	p := Int(1)
	for n > 0 {
		if n&1 == 1 {
			p.MulAs(m)
		}
		m.MulAs(m)
		n >>= 1
	}
	return p
}

// Add returns m+x
func (m Int) Add(x Int) Int {
	return (m + x).Mod()
}

// Sub returns m-x
func (m Int) Sub(x Int) Int {
	return (m - x).Mod()
}

// Mul returns m*x
func (m Int) Mul(x Int) Int {
	return (m * x).Mod()
}

// Div returns m/x
func (m Int) Div(x Int) Int {
	return m.Mul(x.Inv())
}

// AddAs assigns *m + x to *m and returns m
func (m *Int) AddAs(x Int) *Int {
	*m = m.Add(x)
	return m
}

// SubAs assigns *m - x to *m and returns m
func (m *Int) SubAs(x Int) *Int {
	*m = m.Sub(x)
	return m
}

// MulAs assigns *m * x to *m and returns m
func (m *Int) MulAs(x Int) *Int {
	*m = m.Mul(x)
	return m
}

// DivAs assigns *m / x to *m and returns m
func (m *Int) DivAs(x Int) *Int {
	*m = m.Div(x)
	return m
}

func (m *Int) MaxAs(x ...Int) *Int {
	*m = Max(append(x, *m)...)
	return m
}

func (m *Int) MinAs(x ...Int) *Int {
	*m = Min(append(x, *m)...)
	return m
}

// An Item is something we manage in a priority queue.
type Item struct {
	value    string // The value of the item; arbitrary.
	priority int    // The priority of the item in the queue.
	// The index is needed by update and is maintained by the heap.Interface methods.
	index int // The index of the item in the heap.
}

// A PriorityQueue implements heap.Interface and holds Items.
type PriorityQueue []*Item

func (pq PriorityQueue) Len() int { return len(pq) }

func (pq PriorityQueue) Less(i, j int) bool {
	// We want Pop to give us the highest, not lowest, priority so we use greater than here.
	return pq[i].priority > pq[j].priority
}

func (pq PriorityQueue) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *PriorityQueue) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Item)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *PriorityQueue) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	old[n-1] = nil  // avoid memory leak
	item.index = -1 // for safety
	*pq = old[0 : n-1]
	return item
}

// update modifies the priority and value of an Item in the queue.
func (pq *PriorityQueue) update(item *Item, value string, priority int) {
	item.value = value
	item.priority = priority
	heap.Fix(pq, item.index)
}

package main

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

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

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

		var sum int64
		arr := make([]int64, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &arr[i])
			sum += arr[i]
			arr[i] += int64(i) + 1
		}

		sort.Slice(arr, func(i, j int) bool {
			return arr[i] > arr[j]
		})
		for i := 0; i < k; i++ {
			sum -= arr[i]
			sum += int64(n)
			sum -= int64(i)
		}

		fmt.Fprintln(out, sum)
	}
}

package main

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

// This example demonstrates an integer heap built using the heap interface.

// An IntHeap is a min-heap of ints.
/* type IntHeap []int64

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

func (h *IntHeap) Push(x interface{}) {
	// Push and Pop use pointer receivers because they modify the slice's length,
	// not just its contents.
	*h = append(*h, x.(int64))
}

func (h *IntHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}
*/

// // This example inserts several ints into an Int, checks the minimum,
// // and removes them in order of priority.
// func main() {
// 	h := &IntHeap{2, 1, 5}
// 	heap.Init(h)
// 	heap.Push(h, 3)
// 	fmt.Printf("minimum: %d\n", (*h)[0])
// 	for h.Len() > 0 {
// 		fmt.Printf("%d ", heap.Pop(h))
// 	}
// }
type ts struct {
	idx int
	d   int
}

func A2() {
	_in, _out := os.Stdin, os.Stdout
	in, out := bufio.NewReader(_in), bufio.NewWriter(_out)
	defer out.Flush()
	var cas int = 1
	Fscan(in, &cas)
	var sol func()
	// Coding...beg!
	sol = func() {
		var n, k int
		Fscan(in, &n, &k)
		dam := make([]int, n)
		ct := make([]ts, n)
		for i := 0; i < n; i++ {
			Fscan(in, &dam[i])
			ct[i] = ts{i, dam[i] - (n - i - 1)}
		}
		sort.Slice(ct, func(i, j int) bool {
			if ct[i].d == ct[j].d {
				return ct[i].idx > ct[j].idx
			}
			return ct[i].d > ct[j].d
		})
		jump := make([]int, k)
		for i := 0; i < k; i++ {
			jump[i] = ct[i].idx
		}
		sort.Ints(jump)
		var ans int64
		for i, j := n-1, k-1; i >= 0; i-- {
			if j >= 0 && i == jump[j] {
				j--
				// jump

			} else {
				ans += int64(dam[i])
				ans += int64(j + 1)
			}
		}
		Fprintln(out, ans)
	}
	// Coding...ove!
	for i := 0; i < cas; i++ {
		sol()
	}
}

func main() { A2() }


Shubham has an array $$$a$$$ of size $$$n$$$, and wants to select exactly $$$x$$$ elements from it, such that their sum is odd. These elements do not have to be consecutive. The elements of the array are not guaranteed to be distinct.Tell him whether he can do so.

The first line of the input contains a single integer $$$t$$$ $$$(1\le t \le 100)$$$ — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$x$$$ $$$(1 \le x \le n \le 1000)$$$ — the length of the array and the number of elements you need to choose. The next line of each test case contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 1000)$$$ — elements of the array.

For each test case, print "Yes" or "No" depending on whether it is possible to choose $$$x$$$ elements such that their sum is odd. You may print every letter in any case you want.

NoteFor $$$1$$$st case: We must select element $$$999$$$, and the sum is odd.For $$$2$$$nd case: We must select element $$$1000$$$, so overall sum is not odd.For $$$3$$$rd case: We can select element $$$51$$$.For $$$4$$$th case: We must select both elements $$$50$$$ and $$$51$$$  — so overall sum is odd.For $$$5$$$th case: We must select all elements  — but overall sum is not odd.

/*
URL:
https://codeforces.com/problemset/problem/1363/A
*/

package main

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

/********** 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 (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	t int

	n, x int
	A    []int
)

func main() {
	t = ReadInt()
	for i := 0; i < t; i++ {
		n, x = ReadInt2()
		A = ReadIntSlice(n)

		solve()
	}
}

func solve() {
	for i := 0; i < n; i++ {
		A[i] = A[i] % 2
	}
	sort.SliceStable(A, func(i, j int) bool { return A[i] < A[j] })
	// PrintfDebug("%v\n", A)

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

	for i := 0; i+x <= n; i++ {
		s := S[i+x] - S[i]
		if s%2 == 1 {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}

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

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

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

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	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
}

// 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])
		res = append(res, []rune(str)...)

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

	return string(res)
}

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

	for i := 0; i < len(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)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

package main

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

var nTest, n, x, a int

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

	fmt.Fscan(in, &nTest)
	for t := 0; t < nTest; t++ {
		fmt.Fscan(in, &n, &x)
		odd := 0
		even := 0

		for i := 0; i < n; i++ {
			fmt.Fscan(in, &a)
			if a&1 == 0 {
				even++
			} else {
				odd++
			}
		}

		odd--
		if odd < 0 {
			fmt.Fprintln(out, "No")
			continue
		}

		if x&1 == 0 {
			even--

			if even < 0 {
				fmt.Fprintln(out, "No")
				continue
			}
		}

		if (x-1)/2 > (odd/2 + even/2) {
			fmt.Fprintln(out, "No")
			continue
		}

		fmt.Fprintln(out, "Yes")
	}

	out.Flush()
}

package main

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

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

	var t, n, x, v int
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &n, &x)
		c := [2]int{}
		for i := 0; i < n; i++ {
			Fscan(in, &v)
			c[v&1]++
		}
		if c[1] == 0 || c[0] == 0 && x&1 == 0 || x == n && c[1]&1 == 0 {
			Fprintln(out, "No")
		} else {
			Fprintln(out, "Yes")
		}
	}
}

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

package main
import (
        "fmt"
        "os"
        "bufio"
)
func main(){
    var t, n, x, even, odd, tmp int
    var ans bool
    in := bufio.NewReader(os.Stdin)
    fmt.Fscan(in, &t)
    for ; t > 0; t-- {
        fmt.Fscan(in, &n, &x)
        even, odd = 0, 0
        for i:=0; i < n; i++ {
            fmt.Fscan(in, &tmp)
            if tmp % 2 == 0 {
                even++
            } else {
                odd++
            }
        }
        ans = false
        for i := 1; i <= odd; i+=2 {
            if z := x-i; z >= 0 && z <= even {
                ans = true
                break
            }
        }
        if ans {
            fmt.Println("Yes")
        } else {
            fmt.Println("No")
        }
    }
}

package main

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

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

func readIntSlice(scanner *bufio.Scanner) []int {
	scanner.Scan()
	nums := strings.Split(scanner.Text(), " ")
    var r []int
    for _, v := range nums {
        i, _ := strconv.Atoi(v)
        r = append(r, i)
    }
    return r
}

func main() {
	var q int
	scanner := bufio.NewScanner(os.Stdin)
	q = readInt(scanner)
	//fmt.Println(q)
	for qq := 0; qq < q; qq++ {
		sum := 0
		tmp := readIntSlice(scanner)
		n := tmp[0]
		x := tmp[1]
		haveOdd := false
		haveEven := false
		a := readIntSlice(scanner)
		for i := 0; i < n; i++ {
			if a[i] % 2 == 0 {
				haveEven = true
			} else {
				haveOdd = true
			}
			sum += a[i]
		}
		if !haveOdd {
			fmt.Println("No")
		} else if !haveEven {
			if x % 2 == 1 {
				fmt.Println("Yes")
			} else {
				fmt.Println("No")
			}
		} else {
			if x == n && sum % 2 == 0 {
				fmt.Println("No")
			} else {
				fmt.Println("Yes")
			}
		}
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	for fmt.Fscan(in, &t); t > 0; t-- {
		var n, x int
		fmt.Fscan(in, &n, &x)
		cntEven := 0
		cntOdd := 0
		var a int
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &a)
			if a%2 == 0 {
				cntEven++
			} else {
				cntOdd++
			}
		}
		x -= cntEven
		if cntOdd > 0 && (x < cntOdd && cntEven > 0 || x%2 != 0) {
			fmt.Fprintln(out, "Yes")
		} else {
			fmt.Fprintln(out, "No")
		}
	}
}

package main

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

func isOdd(a int) bool {
	if a&1 == 1 {
		return true
	}
	return false
}

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		cntOdd, cntEven := 0, 0
		n, x := 0, 0
		fmt.Fscan(in, &n, &x)
		for ; n > 0; n-- {
			a := 0
			fmt.Fscan(in, &a)
			if isOdd(a) {
				cntOdd++
			} else {
				cntEven++
			}
		}

		gapOdd := x - min(x, cntEven)
		if isOdd(gapOdd) && cntOdd > 0 || x > gapOdd && gapOdd < cntOdd {
			fmt.Fprintln(out, "Yes")
			continue
		}
		fmt.Fprintln(out, "No")
	}
}

package main

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

func isOdd(a int) bool {
	if a&1 == 1 {
		return true
	}
	return false
}

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		cntOdd, cntEven := 0, 0
		n, x := 0, 0
		fmt.Fscan(in, &n, &x)
		for ; n > 0; n-- {
			a := 0
			fmt.Fscan(in, &a)
			if isOdd(a) {
				cntOdd++
			} else {
				cntEven++
			}
		}
		gapOdd := x - min(x, cntEven)
		if !isOdd(gapOdd) {
			if gapOdd < x && cntOdd > gapOdd {
				fmt.Fprintln(out, "Yes")
				continue
			}
		} else if cntOdd > 0 {
			fmt.Fprintln(out, "Yes")
			continue
		}
		fmt.Fprintln(out, "No")
	}
}

package main

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

func isOdd(a int) bool {
	if a&1 == 1 {
		return true
	}
	return false
}

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		cntOdd, cntEven := 0, 0
		n, x := 0, 0
		fmt.Fscan(in, &n, &x)
		for ; n > 0; n-- {
			a := 0
			fmt.Fscan(in, &a)
			if isOdd(a) {
				cntOdd++
			} else {
				cntEven++
			}
		}
		gapOdd := x - min(x, cntEven)
		if isOdd(gapOdd) {
			if cntOdd > 0 {
				fmt.Fprintln(out, "Yes")
				continue
			}
		} else if x > gapOdd && gapOdd < cntOdd {
			fmt.Fprintln(out, "Yes")
			continue
		}
		fmt.Fprintln(out, "No")
	}
}

package main

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

func isOdd(a int) bool {
	if a&1 == 1 {
		return true
	}
	return false
}

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		cntOdd, cntEven := 0, 0
		n, x := 0, 0
		fmt.Fscan(in, &n, &x)
		for ; n > 0; n-- {
			a := 0
			fmt.Fscan(in, &a)
			if isOdd(a) {
				cntOdd++
			} else {
				cntEven++
			}
		}
		gapOdd := x - min(x, cntEven)
		if isOdd(gapOdd) && cntOdd > 0 || x > gapOdd && gapOdd < cntOdd {
			fmt.Fprintln(out, "Yes")
		} else {
			fmt.Fprintln(out, "No")
		}
	}
}

package main

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

func isOdd(a int) bool {
	if a&1 == 1 {
		return true
	}
	return false
}

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		cntOdd, cntEven := 0, 0
		n, x := 0, 0
		fmt.Fscan(in, &n, &x)
		for ; n > 0; n-- {
			a := 0
			fmt.Fscan(in, &a)
			if isOdd(a) {
				cntOdd++
			} else {
				cntEven++
			}
		}
		gapOdd := x - min(x, cntEven)

		if !isOdd(gapOdd) {
			if gapOdd != x && cntOdd > gapOdd {
				fmt.Fprintln(out, "Yes")
				continue
			}
		} else {
			if cntOdd > 0 {
				fmt.Fprintln(out, "Yes")
				continue
			}
		}
		fmt.Fprintln(out, "No")
	}
}

package main

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

func isOdd(a int) bool {
	if a&1 == 1 {
		return true
	}
	return false
}

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		cntOdd, cntEven := 0, 0
		n, x := 0, 0
		fmt.Fscan(in, &n, &x)
		for ; n > 0; n-- {
			a := 0
			fmt.Fscan(in, &a)
			if isOdd(a) {
				cntOdd++
			} else {
				cntEven++
			}
		}
		gapOdd := x - min(x, cntEven)

		if !isOdd(gapOdd) {
			if gapOdd != x && cntOdd > gapOdd {
				fmt.Fprintln(out, "Yes")
				continue
			}
		} else if cntOdd > 0 {
			fmt.Fprintln(out, "Yes")
			continue
		}
		fmt.Fprintln(out, "No")
	}
}

package main

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

func isOdd(a int) bool {
	if a&1 == 1 {
		return true
	}
	return false
}

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		cntOdd, cntEven := 0, 0
		n, x := 0, 0
		fmt.Fscan(in, &n, &x)
		for ; n > 0; n-- {
			a := 0
			fmt.Fscan(in, &a)
			if isOdd(a) {
				cntOdd++
			} else {
				cntEven++
			}
		}
		gapOdd := x - min(x, cntEven)
		if isOdd(gapOdd) && cntOdd > 0 {
			fmt.Fprintln(out, "Yes")
			continue
		} else if x > gapOdd && gapOdd < cntOdd {
			fmt.Fprintln(out, "Yes")
			continue
		}
		fmt.Fprintln(out, "No")
	}
}

package main

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

func isOdd(a int) bool {
	if a&1 == 1 {
		return true
	}
	return false
}

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		cntOdd, cntEven := 0, 0
		n, x := 0, 0
		fmt.Fscan(in, &n, &x)
		for ; n > 0; n-- {
			a := 0
			fmt.Fscan(in, &a)
			if isOdd(a) {
				cntOdd++
			} else {
				cntEven++
			}
		}
		//gapOdd := x - cntEven
		gapOdd := x - min(x, cntEven)

		if !isOdd(gapOdd) {
			if gapOdd != x && cntOdd > gapOdd {
				fmt.Fprintln(out, "Yes")
			} else {
				fmt.Fprintln(out, "No")
			}
		} else {
			if cntOdd > 0 {
				fmt.Fprintln(out, "Yes")
			} else {
				fmt.Fprintln(out, "No")
			}
		}
	}
}

package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()
	var t int
	fmt.Fscan(r, &t)
	for ; t > 0; t-- {
		var n, x int
		fmt.Fscan(r, &n, &x)
		var odd, even int
		for i := 0; i < n; i++ {
			var a int
			fmt.Fscan(r, &a)
			if a%2 == 1 {
				odd++
			} else {
				even++
			}
		}
		if odd == 0 {
			fmt.Fprintln(w, "No")
			continue
		}
		if odd%2 == 0 && x == n {
			fmt.Fprintln(w, "No")
			continue
		}
		if x%2 == 0 {
			if even > 0 {
				fmt.Fprintln(w, "Yes")
			} else {
				fmt.Fprintln(w, "No")
			}
		} else {
			fmt.Fprintln(w, "Yes")
		}
	}
}

package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()
	var t int
	fmt.Fscan(r, &t)
	for ; t > 0; t-- {
		var n, x int
		fmt.Fscan(r, &n, &x)
		var odd, even int
		for i := 0; i < n; i++ {
			var a int
			fmt.Fscan(r, &a)
			if a%2 == 1 {
				odd++
			} else {
				even++
			}
		}
		if odd == 0 {
			fmt.Fprintln(w, "No")
			continue
		}
		if odd == n && x%2 == 0 {
			fmt.Fprintln(w, "No")
			continue
		}
		if odd%2 == 0 && x == n {
			fmt.Fprintln(w, "No")
			continue
		}
		fmt.Fprintln(w, "Yes")
	}
}

package main

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

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

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

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

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

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

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

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

	return i
}

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

	tc := readNum(reader)

	for tc > 0 {
		tc--
		n, x := readTwoNums(reader)
		A := readNNums(reader, n)
		res := solve(n, x, A)
		if res {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}

func solve(n int, x int, A []int) bool {
	var odd int
	for i := 0; i < n; i++ {
		odd += A[i] & 1
	}

	if odd == 0 {
		return false
	}

	if x == n {
		return odd&1 == 1
	}
	// a + b = x & a is odd

	// 1, 1, 0, 0, 0, 0
	// x = 5
	if odd <= x {
		return true
	}
	// odd > x
	if x&1 == 1 {
		return true
	}
	// x is even, need at least one 0
	return odd < n
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := int64(1)
	fmt.Fscanf(in, "%d\n", &t)
	for tt := int64(0); tt < t; tt++ {
		n, m := 0, 0
		fmt.Fscanf(in, "%d %d\n", &n, &m)
		a := make([]int, n)
		odd := 0
		even := 0
		for i := 0; i < n; i++ {
			fmt.Fscanf(in, "%d", &a[i])
			if a[i]%2 == 1 {
				odd++
			} else {
				even++
			}
		}
		fmt.Fscanf(in, "\n")
		if odd < 1 {
			fmt.Fprintf(out, "No\n")
		} else {
			if m == n && odd%2 == 0 {
				fmt.Fprintf(out, "No\n")
			} else if m%2 == 0 && even == 0 {
				fmt.Fprintf(out, "No\n")
			} else {
				fmt.Fprintf(out, "Yes\n")
			}
		}
	}
	return
}

package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
var input io.Reader

func main() {
	var (
		T int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		fmt.Println(solver())
	}
}

func no() string {
	return "No"
}
func yes() string {
	return "Yes"
}
func solver() string {
	var n, x, tmp, odd, even int
	fmt.Fscan(input, &n, &x)
	for i := 0; i < n; i++ {
		fmt.Fscan(input, &tmp)
		if tmp & 1 > 0 {
			odd++
		} else {
			even++
		}
	}
	odd--
	x--
	if odd < 0  {
		return no()
	}
	x -= min(x,odd)/2*2
	//fmt.Println("X is:", x, odd, even)
	if x <= even {return yes()}
	return no()
}

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

package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
var input io.Reader

func main() {
	var (
		T int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		fmt.Println(solver())
	}
}

func no() string {
	return "No"
}
func yes() string {
	return "Yes"
}
func solver() string {
	var n, x, tmp, odd, even int
	fmt.Fscan(input, &n, &x)
	for i := 0; i < n; i++ {
		fmt.Fscan(input, &tmp)
		if tmp & 1 > 0 {
			odd++
		} else {
			even++
		}
	}
	odd--
	x--
	if odd < 0  {
		return no()
	}
	x -= (min(x,odd)>>1)<<1
	//fmt.Println("X is:", x, odd, even)
	if x <= even {return yes()}
	return no()
}

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

package main

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

func main() {
	t := nextInt()
	for i := 0; i < t; i++ {
		if answer() {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}

func answer() bool {
	n, x := nextInt(), nextInt()

	oddCount := 0
	evenCount := 0
	for i := 0; i < n; i++ {
		a := nextInt()
		if a%2 == 1 {
			oddCount++
		} else {
			evenCount++
		}
	}

	for i:=1; i <= x; i+=2 {
		if oddCount >= i {
			if evenCount + i >= x {
				return true
			}
		}
	}
	return false
}

var sc = bufio.NewScanner(os.Stdin)

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

func next() string {
	sc.Scan()
	return sc.Text()
}

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

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}

package main

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

func main() {
	t := nextInt()
	for i := 0; i < t; i++ {
		if answer() {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}

func answer() bool {
	n, x := nextInt(), nextInt()

	oddCount := 0
	evenCount := 0
	for i := 0; i < n; i++ {
		a := nextInt()
		if a%2 == 1 {
			oddCount++
		} else {
			evenCount++
		}
	}

	for i := 1; i <= x; i += 2 {
		if oddCount >= i {
			if evenCount+i >= x {
				return true
			}
		}
	}
	return false
}

var sc = bufio.NewScanner(os.Stdin)

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

func next() string {
	sc.Scan()
	return sc.Text()
}

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

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}

package main

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

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

	var t, n, x, v int
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &n, &x)
		c := [2]int{}
		for i := 0; i < n; i++ {
			Fscan(in, &v)
			c[v&1]++
		}
		if c[1] == 0 || c[0] == 1 && c[1]&1 == 0 {
			Fprintln(out, "No")
		} else {
			Fprintln(out, "Yes")
		}
	}
}

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

package main

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

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

	var t, n, x, v int
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &n, &x)
		c := [2]int{}
		for i := 0; i < n; i++ {
			Fscan(in, &v)
			c[v&1]++
		}
		if c[1] == 0 || x > c[0] && (x-c[0])&1 == 0 {
			Fprintln(out, "No")
		} else {
			Fprintln(out, "Yes")
		}
	}
}

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

package main

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

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

	var t, n, x, v int
	for Fscan(in, &t); t > 0; t-- {
		Fscan(in, &n, &x)
		c := [2]int{}
		for i := 0; i < n; i++ {
			Fscan(in, &v)
			c[v&1]++
		}
		if c[1] == 0 || (x == n || c[0] == 1) && c[1]&1 == 0 {
			Fprintln(out, "No")
		} else {
			Fprintln(out, "Yes")
		}
	}
}

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

package main
import (
        "fmt"
        "os"
        "bufio"
)
func main(){
    var t, n, x, even, odd, tmp int
    in := bufio.NewReader(os.Stdin)
    fmt.Fscan(in, &t)
    for ; t > 0; t-- {
        fmt.Fscan(in, &n, &x)
        even, odd = 0, 0
        for i:=0; i < n; i++ {
            fmt.Fscan(in, &tmp)
            if tmp % 2 == 0 {
                even++
            } else {
                odd++
            }
        }
        if odd > 0 {
            odd--
            x--
            if x == 1 {
                if even > 0 {
                    fmt.Println("Yes")
                } else {
                    fmt.Println("No")
                }
            } else {
                even += odd / 2
                if even >= x {
                    fmt.Println("Yes")
                } else {
                    fmt.Println("No")
                }
            }
        } else {
            fmt.Println("No")
        }
    }
}

package main
import (
        "fmt"
        "os"
        "bufio"
)
func main(){
    var t, n, x, even, odd, tmp int
    in := bufio.NewReader(os.Stdin)
    fmt.Fscan(in, &t)
    for ; t > 0; t-- {
        fmt.Fscan(in, &n, &x)
        even, odd = 0, 0
        for i:=0; i < n; i++ {
            fmt.Fscan(in, &tmp)
            if tmp % 2 == 0 {
                even++
            } else {
                odd++
            }
        }
        if odd > 0 {
            odd--
            x--
            even += odd / 2
            if even >= x {
                fmt.Println("Yes")
            } else {
                fmt.Println("No")
            }
        } else {
            fmt.Println("No")
        }
    }
}

package main
import (
        "fmt"
        "os"
        "bufio"
)
func main(){
    var t, n, x, even, odd, tmp int
    in := bufio.NewReader(os.Stdin)
    fmt.Fscan(in, &t)
    for ; t > 0; t-- {
        fmt.Fscan(in, &n, &x)
        even, odd = 0, 0
        for i:=0; i < n; i++ {
            fmt.Fscan(in, &tmp)
            if tmp % 2 == 0 {
                even++
            } else {
                odd++
            }
        }
        if odd > 0 {
            odd--
            x--
            if x <= even {
                fmt.Println("Yes")
            } else {
                x -= even
                even = 0
                if x % 2 == 0 {
                    fmt.Println("Yes")
                } else {
                    fmt.Println("No")
                }
            }
        } else {
            fmt.Println("No")
        }
    }
}

package main

import (
	"fmt"
)

func main() {
	var q int
	fmt.Scan(&q)
	for qq := 0; qq < q; qq++ {
		var n int
		var x int
		sum := 0
		fmt.Scanf("%d", &n)
		fmt.Scanf("%d", &x)
		a := make([]int, n)
		haveOdd := false
		haveEven := false
		for i := 0; i < n; i++ {
			fmt.Scanf("%d", &a[i])
			if a[i] % 2 == 0 {
				haveEven = true
			} else {
				haveOdd = true
			}
			sum += a[i]
		}
		if !haveOdd {
			fmt.Println("No")
		} else if !haveEven {
			if x % 2 == 1 {
				fmt.Println("Yes")
			} else {
				fmt.Println("No")
			}
		} else {
			if x == n && sum % 2 == 0 {
				fmt.Println("No")
			} else {
				fmt.Println("Yes")
			}
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var q int
	fmt.Scanf("%d\n", &q)
	for qq := 0; qq < q; qq++ {
		var n int
		var x int
		sum := 0
		fmt.Scanf("%d %d\n", &n, &x)
		a := make([]int, n)
		haveOdd := false
		haveEven := false
		for i := 0; i < n - 1; i++ {
			fmt.Scanf("%d ", &a[i])
		}
		fmt.Scanf("%d\n", &a[n-1])
		for i := 0; i < n; i++ {
			if a[i] % 2 == 0 {
				haveEven = true
			} else {
				haveOdd = true
			}
			sum += a[i]
		}
		if !haveOdd {
			fmt.Println("No")
		} else if !haveEven {
			if x % 2 == 1 {
				fmt.Println("Yes")
			} else {
				fmt.Println("No")
			}
		} else {
			if x == n && sum % 2 == 0 {
				fmt.Println("No")
			} else {
				fmt.Println("Yes")
			}
		}
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	for fmt.Fscan(in, &t); t > 0; t-- {
		var n, x int
		fmt.Fscan(in, &n, &x)
		cntEven := 0
		cntOdd := 0
		var a int
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &a)
			if a%2 == 0 {
				cntEven++
			} else {
				cntOdd++
			}
		}
		x -= cntEven
		if cntOdd > 0 && (x < cntOdd || cntOdd%2 != 0) {
			fmt.Fprintln(out, "Yes")
		} else {
			fmt.Fprintln(out, "No")
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var t int
	fmt.Scanf("%d", &t)
	for t > 0 {
		t--
		var n, x int
		fmt.Scanf("%d%d", &n, &x)
		var a int
		cntEven := 0
		cntOdd := 0
		for i := 0; i < n; i++ {
			fmt.Scanf("%d", &a)
			if a%2 == 0 {
				cntEven++
			} else {
				cntOdd++
			}
		}
		x -= cntEven
		if cntOdd > 0 && (x < cntOdd || cntOdd%2 != 0) {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}

package main

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

func isOdd(a int) bool {
	if a&1 == 1 {
		return true
	}
	return false
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		cntOdd, cntEven := 0, 0
		n, x := 0, 0
		fmt.Fscan(in, &n, &x)
		for ; n > 0; n-- {
			a := 0
			fmt.Fscan(in, &a)
			if isOdd(a) {
				cntOdd++
			} else {
				cntEven++
			}
		}
		gapOdd := x - cntEven
		if isOdd(gapOdd) || (isOdd(cntOdd) && cntOdd >= gapOdd+1) {
			fmt.Fprintln(out, "Yes")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

func isOdd(a int) bool {
	if a&1 == 1 {
		return true
	}
	return false
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		cntOdd, cntEven := 0, 0
		n, x := 0, 0
		fmt.Fscan(in, &n, &x)
		for ; n > 0; n-- {
			a := 0
			fmt.Fscan(in, &a)
			if isOdd(a) {
				cntOdd++
			} else {
				cntEven++
			}
		}
		gapOdd := x - cntEven
		if isOdd(gapOdd) || cntOdd >= gapOdd+1 {
			fmt.Fprintln(out, "Yes")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

func isOdd(a int) bool {
	if a&1 == 1 {
		return true
	}
	return false
}

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		cntOdd, cntEven := 0, 0
		n, x := 0, 0
		fmt.Fscan(in, &n, &x)
		for ; n > 0; n-- {
			a := 0
			fmt.Fscan(in, &a)
			if isOdd(a) {
				cntOdd++
			} else {
				cntEven++
			}
		}
		//gapOdd := x - cntEven
		gapOdd := min(x, cntEven)

		if !isOdd(gapOdd) {
			if gapOdd != x && cntOdd > gapOdd {
				fmt.Fprintln(out, "Yes")
			} else {
				fmt.Fprintln(out, "No")
			}
		} else {
			if cntOdd > 0 {
				fmt.Fprintln(out, "Yes")
			} else {
				fmt.Fprintln(out, "No")
			}
		}
	}
}

package main

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

func isOdd(a int) bool {
	if a&1 == 1 {
		return true
	}
	return false
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		cntOdd, cntEven := 0, 0
		n, x := 0, 0
		fmt.Fscan(in, &n, &x)
		for ; n > 0; n-- {
			a := 0
			fmt.Fscan(in, &a)
			if isOdd(a) {
				cntOdd++
			} else {
				cntEven++
			}
		}
		gapOdd := x - cntEven

		if !isOdd(gapOdd) {
			if gapOdd != x && cntOdd > gapOdd {
				fmt.Fprintln(out, "Yes")
			} else {
				fmt.Fprintln(out, "No")
			}
		} else {
			fmt.Fprintln(out, "Yes")
		}
	}
}

package main

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

func isOdd(a int) bool {
	if a&1 == 1 {
		return true
	}
	return false
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		cntOdd, cntEven := 0, 0
		n, x := 0, 0
		fmt.Fscan(in, &n, &x)
		for ; n > 0; n-- {
			a := 0
			fmt.Fscan(in, &a)
			if isOdd(a) {
				cntOdd++
			} else {
				cntEven++
			}
		}
		gapOdd := x - cntEven
		if isOdd(gapOdd) || (isOdd(gapOdd+1) && cntOdd >= gapOdd+1) {
			fmt.Fprintln(out, "Yes")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

func isOdd(a int) bool {
	if a&1 == 1 {
		return true
	}
	return false
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		cntOdd, cntEven := 0, 0
		n, x := 0, 0
		fmt.Fscan(in, &n, &x)
		for ; n > 0; n-- {
			a := 0
			fmt.Fscan(in, &a)
			if isOdd(a) {
				cntOdd++
			} else {
				cntEven++
			}
		}
		// zero OR an even number of odds = even number -> fail
		if !isOdd(cntOdd) {
			fmt.Fprintln(out, "No")
		} else {
			fmt.Fprintln(out, "Yes")
		}
	}
}

package main

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

func isOdd(a int) bool {
	if a&1 == 1 {
		return true
	}
	return false
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		cntOdd, cntEven := 0, 0
		n, x := 0, 0
		fmt.Fscan(in, &n, &x)
		for ; n > 0; n-- {
			a := 0
			fmt.Fscan(in, &a)
			if isOdd(a) {
				cntOdd++
			} else {
				cntEven++
			}
		}
		gapOdd := x - cntEven

		if !isOdd(gapOdd) {
			if cntOdd > gapOdd {
				fmt.Fprintln(out, "Yes")
			} else {
				fmt.Fprintln(out, "No")
			}
		} else {
			fmt.Fprintln(out, "Yes")
		}
	}
}

package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()
	var t int
	fmt.Fscan(r, &t)
	for ; t > 0; t-- {
		var n, x int
		fmt.Fscan(r, &n, &x)
		var odd, even int
		for i := 0; i < n; i++ {
			var a int
			fmt.Fscan(r, &a)
			if a%2 == 1 {
				odd++
			} else {
				even++
			}
		}
		if odd == 0 {
			fmt.Fprintln(w, "No")
			continue
		}
		if even+(odd-1)/2*2 >= x-1 {
			fmt.Fprintln(w, "Yes")
		} else {
			fmt.Fprintln(w, "No")
		}
	}
}

package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()
	var t int
	fmt.Fscan(r, &t)
	for ; t > 0; t-- {
		var n, x int
		fmt.Fscan(r, &n, &x)
		var odd, even int
		for i := 0; i < n; i++ {
			var a int
			fmt.Fscan(r, &a)
			if a%2 == 1 {
				odd++
			} else {
				even++
			}
		}
		if odd > 0 && (even >= x-1 || (x-even)%2 == 1) {
			fmt.Fprintln(w, "Yes")
		} else {
			fmt.Fprintln(w, "No")
		}

	}
}

package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()
	var t int
	fmt.Fscan(r, &t)
	for ; t > 0; t-- {
		var n, x int
		fmt.Fscan(r, &n, &x)
		var odd, even int
		for i := 0; i < n; i++ {
			var a int
			fmt.Fscan(r, &a)
			if a%2 == 1 {
				odd++
			} else {
				even++
			}
		}
		if odd == 0 {
			fmt.Fprintln(w, "No")
			continue
		}
		if odd%2 == 0 && x == n {
			fmt.Println(w, "No")
			continue
		}
		if x%2 == 0 {
			if even > 0 {
				fmt.Fprintln(w, "Yes")
			} else {
				fmt.Fprintln(w, "No")
			}
		} else {
			fmt.Fprintln(w, "Yes")
		}
	}
}

package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()
	var t int
	fmt.Fscan(r, &t)
	for ; t > 0; t-- {
		var n, x int
		fmt.Fscan(r, &n, &x)
		var odd, even int
		for i := 0; i < n; i++ {
			var a int
			fmt.Fscan(r, &a)
			if a%2 == 1 {
				odd++
			} else {
				even++
			}
		}
		if odd == 0 {
			fmt.Fprintln(w, "No")
			continue
		}
		if odd%2 == 0 {
			odd--
		}
		if odd+even >= x {
			fmt.Fprintln(w, "Yes")
		} else {
			fmt.Fprintln(w, "No")
		}
	}
}

package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()
	var t int
	fmt.Fscan(r, &t)
	for ; t > 0; t-- {
		var n, x int
		fmt.Fscan(r, &n, &x)
		var odd, even int
		for i := 0; i < n; i++ {
			var a int
			fmt.Fscan(r, &a)
			if a%2 == 1 {
				odd++
			} else {
				even++
			}
		}
		if odd == 0 {
			fmt.Fprintln(w, "No")
			continue
		}
		if even >= x-1 {
			fmt.Fprintln(w, "Yes")
			continue
		}
		if (x-even)%2 == 1 {
			fmt.Fprintln(w, "Yes")
		} else if odd >= x-even+1 {
			fmt.Fprintln(w, "Yes")
		} else {
			fmt.Fprintln(w, "No")
		}
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := int64(1)
	fmt.Fscanf(in, "%d\n", &t)
	for tt := int64(0); tt < t; tt++ {
		n, m := 0, 0
		fmt.Fscanf(in, "%d %d\n", &n, &m)
		a := make([]int, n)
		odd := 0
		even := 0
		for i := 0; i < n; i++ {
			fmt.Fscanf(in, "%d", &a[i])
			if a[i]%2 == 1 {
				odd++
			} else {
				even++
			}
		}
		fmt.Fscanf(in, "\n")
		if odd < 1 {
			fmt.Fprintf(out, "No\n")
		} else {
			if m == n && odd%2 == 0 {
				fmt.Fprintf(out, "No\n")
			} else {
				fmt.Fprintf(out, "Yes\n")
			}
		}
	}
	return
}

func minDigit(a int64) int64 {
	ans := a % 10
	for a > 0 {
		ans = min(ans, a%10)
		a /= 10
	}
	return ans
}

func maxDigit(a int64) int64 {
	ans := a % 10
	for a > 0 {
		ans = max(ans, a%10)
		a /= 10
	}
	return ans
}

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

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

package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
var input io.Reader

func main() {
	var (
		T int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		fmt.Println(solver())
	}
}

func no() string {
	return "No"
}
func yes() string {
	return "Yes"
}
func solver() string {
	var n, x, tmp, odd, even int
	fmt.Fscan(input, &n, &x)
	for i := 0; i < n; i++ {
		fmt.Fscan(input, &tmp)
		if tmp & 1 > 0 {
			odd++
		} else {
			even++
		}
	}
	if odd <= 0  {
		return no()
	}
	x-=even + 1
	odd--
	if x < 0 {
		x = 0
	}
	if x - odd/2 <= 0 {
		return yes()
	}

	return no()
}

package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
var input io.Reader

func main() {
	var (
		T int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		fmt.Println(solver())
	}
}

func no() string {
	return "No"
}
func yes() string {
	return "Yes"
}
func solver() string {
	var n, x, tmp, odd, even int
	fmt.Fscan(input, &n, &x)
	for i := 0; i < n; i++ {
		fmt.Fscan(input, &tmp)
		if tmp & 1 > 0 {
			odd++
		} else {
			even++
		}
	}
	odd--
	x--
	if odd < 0  {
		return no()
	}
	x-=even
	if x <= 0 { return yes() }
	if x % 2 == 0 && x <= odd {
		return yes()
	}
	return no()

}

package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
var input io.Reader

func main() {
	var (
		T int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		fmt.Println(solver())
	}
}

func no() string {
	return "No"
}
func yes() string {
	return "Yes"
}
func solver() string {
	var n, x, tmp, odd, even int
	fmt.Fscan(input, &n, &x)
	for i := 0; i < n; i++ {
		fmt.Fscan(input, &tmp)
		if tmp & 1 > 0 {
			odd++
		} else {
			even++
		}
	}
	odd--
	x--
	if odd < 0  {
		return no()
	}
	if x <= (even + odd/2) {
		return yes()
	}
	return no()

}

package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
var input io.Reader

func main() {
	var (
		T int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		fmt.Println(solver())
	}
}

func no() string {
	return "No"
}
func yes() string {
	return "Yes"
}
func solver() string {
	var n, x, tmp, odd, even int
	fmt.Fscan(input, &n, &x)
	for i := 0; i < n; i++ {
		fmt.Fscan(input, &tmp)
		if tmp & 1 > 0 {
			odd++
		} else {
			even++
		}
	}
	odd--
	x--
	if odd < 0  {
		return no()
	}
	//fmt.Println("X is:", x, odd)
	x-=even
	if x <= 0 {return yes()}
	if x % 2 == 0 && x <= (odd>>1)<<1 {
		return yes()
	}
	return no()
}

package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
var input io.Reader

func main() {
	var (
		T int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		fmt.Println(solver())
	}
}

func no() string {
	return "No"
}
func yes() string {
	return "Yes"
}
func solver() string {
	var n, x, tmp, odd, even int
	fmt.Fscan(input, &n, &x)
	for i := 0; i < n; i++ {
		fmt.Fscan(input, &tmp)
		if tmp & 1 > 0 {
			odd++
		} else {
			even++
		}
	}
	odd--
	x--
	if odd < 0  {
		return no()
	}
	x-=(odd>>1)<<1
	if x <= even {
		return yes()
	}
	return no()
}

package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
var input io.Reader

func main() {
	var (
		T int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		fmt.Println(solver())
	}
}

func no() string {
	return "No"
}
func yes() string {
	return "Yes"
}
func solver() string {
	var n, x, tmp, odd, even int
	fmt.Fscan(input, &n, &x)
	for i := 0; i < n; i++ {
		fmt.Fscan(input, &tmp)
		if tmp % 2 > 0 {
			odd++
		} else {
			even++
		}
	}
	if odd <= 0  {
		return no()
	}
	if odd % 2 == 0 {
		odd--
	}
	x-=even + odd/2
	if x <= 1 {
		return yes()
	}

	return no()
}

package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
var input io.Reader

func main() {
	var (
		T int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		fmt.Println(solver())
	}
}

func no() string {
	return "No"
}
func yes() string {
	return "Yes"
}
func solver() string {
	var n, x, tmp, odd, even int
	fmt.Fscan(input, &n, &x)
	for i := 0; i < n; i++ {
		fmt.Fscan(input, &tmp)
		if tmp & 1 > 0 {
			odd++
		} else {
			even++
		}
	}
	odd--
	x--
	if odd < 0  {
		return no()
	}
	x-=odd/2*2
	if x <= even {
		return yes()
	}
	return no()
}

package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
var input io.Reader

func main() {
	var (
		T int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		fmt.Println(solver())
	}
}

func no() string {
	return "No"
}
func yes() string {
	return "Yes"
}
func solver() string {
	var n, x, tmp, odd, even int
	fmt.Fscan(input, &n, &x)
	for i := 0; i < n; i++ {
		fmt.Fscan(input, &tmp)
		if tmp & 1 > 0 {
			odd++
		} else {
			even++
		}
	}
	odd--
	x--
	if odd < 0  {
		return no()
	}
	x-=odd/2*2
	if x <= 0 {return yes()}
	if x <= even {
		return yes()
	}
	return no()
}

package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
var input io.Reader

func main() {
	var (
		T int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		fmt.Println(solver())
	}
}

func no() string {
	return "No"
}
func yes() string {
	return "Yes"
}
func solver() string {
	var n, x, tmp, odd, even int
	fmt.Fscan(input, &n, &x)
	for i := 0; i < n; i++ {
		fmt.Fscan(input, &tmp)
		if tmp & 1 > 0 {
			odd++
		} else {
			even++
		}
	}
	odd--
	x--
	if odd < 0  {
		return no()
	}
	x-=even
	if x <= 0 { return yes() }
	if x % 2 == 0 && x <= odd/2 {
		return yes()
	}
	return no()

}

package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
var input io.Reader

func main() {
	var (
		T int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &T)
	for i := 0; i < T; i++ {
		fmt.Println(solver())
	}
}

func no() string {
	return "No"
}
func yes() string {
	return "Yes"
}
func solver() string {
	var n, x, tmp, odd, even int
	fmt.Fscan(input, &n, &x)
	for i := 0; i < n; i++ {
		fmt.Fscan(input, &tmp)
		if tmp & 1 > 0 {
			odd++
		} else {
			even++
		}
	}
	odd--
	x--
	if odd < 0  {
		return no()
	}
	x-=even
	if x <= 0 {return yes()}
	if x % 2 == 0 && x <= odd {
		return yes()
	}
	return no()
}


You've got a string $$$a_1, a_2, \dots, a_n$$$, consisting of zeros and ones.Let's call a sequence of consecutive elements $$$a_i, a_{i + 1}, \ldots, a_j$$$ ($$$1\leq i\leq j\leq n$$$) a substring of string $$$a$$$. You can apply the following operations any number of times:  Choose some substring of string $$$a$$$ (for example, you can choose entire string) and reverse it, paying $$$x$$$ coins for it (for example, «0101101» $$$\to$$$ «0111001»);  Choose some substring of string $$$a$$$ (for example, you can choose entire string or just one symbol) and replace each symbol to the opposite one (zeros are replaced by ones, and ones — by zeros), paying $$$y$$$ coins for it (for example, «0101101» $$$\to$$$ «0110001»). You can apply these operations in any order. It is allowed to apply the operations multiple times to the same substring.What is the minimum number of coins you need to spend to get a string consisting only of ones?

The first line of input contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \leq n \leq 300\,000, 0 \leq x, y \leq 10^9$$$) — length of the string, cost of the first operation (substring reverse) and cost of the second operation (inverting all elements of substring). The second line contains the string $$$a$$$ of length $$$n$$$, consisting of zeros and ones.

Print a single integer — the minimum total cost of operations you need to spend to get a string consisting only of ones. Print $$$0$$$, if you do not need to perform any operations.

NoteIn the first sample, at first you need to reverse substring $$$[1 \dots 2]$$$, and then you need to invert substring $$$[2 \dots 5]$$$. Then the string was changed as follows:«01000» $$$\to$$$ «10000» $$$\to$$$ «11111».The total cost of operations is $$$1 + 10 = 11$$$.In the second sample, at first you need to invert substring $$$[1 \dots 1]$$$, and then you need to invert substring $$$[3 \dots 5]$$$. Then the string was changed as follows:«01000» $$$\to$$$ «11000» $$$\to$$$ «11111».The overall cost is $$$1 + 1 = 2$$$.In the third example, string already consists only of ones, so the answer is $$$0$$$.

package main

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

func main() {
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewBuffer(bs)
	var n, x, y, count int64
	fmt.Fscanf(reader, "%d %d %d\n", &n, &x, &y)
	var s string
	fmt.Fscanf(reader, "%s", &s)
	var prev byte = '1'
	for i := 0;i < len(s);i ++ {
		if prev == '1' && s[i] == '0' {
			count ++
		}
		prev = s[i]
	}
	var cost1 int64 = x * (count - 1) + y
	var cost2 int64 = count * y
	if count == 0 {
		fmt.Printf("0")
	} else if cost1 < cost2 {
		fmt.Printf("%d", cost1)
	} else {
		fmt.Printf("%d", cost2)
	}
}

package main

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

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

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

func read(format string, a ...interface{}) {
	fmt.Fscanf(reader, format, a...)
}

func check(a, b []int, x, y int) int {
	n := len(a)
	for i := 0; i < n; i++ {
		if a[i] == x || b[i] == x {
			continue
		}
		if a[i] == y || b[i] == y {
			continue
		}
		return i
	}
	return -1
}

func main() {
	defer writer.Flush()

	var n, x, y int
	read("%d %d %d\n", &n, &x, &y)
	var s string
	read("%s\n", &s)

	blocks := 0

	j := -1
	for i := 0; i < n; i++ {
		if s[i] == '0' {
			if j == -1 {
				j = i
			}
		} else {
			if j != -1 {
				blocks++
				j = -1
			}
		}
	}
	if j != -1 {
		blocks++
		j = -1
	}

	if blocks == 0 {
		write("0\n")
		return
	}

	if x > y {
		write("%d\n", int64(y) * int64(blocks))
	} else {
		write("%d\n", int64(blocks - 1) * int64(x) + int64(y))
	}
}

package main

import (
	"fmt"
)

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

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

func main() {
	n, x, y := 0, 0, 0
	fmt.Scan(&n, &x, &y)
	s := ""
	fmt.Scan(&s)
	cnt := 1
	for i := 1; i < n; i++ {
		if s[i-1] != s[i] {
			cnt++
		}
	}
	if s[0] == '0' {
		cnt++
	}
	cnt /= 2
	ans := int64(0)
	if cnt > 1 {
		ans += int64(min(x, y)) * int64(cnt-1)
	}
	if cnt > 0 {
		ans += int64(y)
	}
	fmt.Println(ans)
}

package main

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

var n int
var a, b, ans int64
var s string

func main() {
	buf := bufio.NewReader(os.Stdin)
	fmt.Fscanf(buf, "%d %d %d\n%s", &n, &a, &b, &s)
	groups := int64(0)
	for i := 0; i < n; i++ {
		if s[i] == '0' {
			for ; i < n && s[i] == '0'; i++ {
			}
			groups++
		}
	}
	if groups == 0 {
		fmt.Println(0)
		return
	}
	if a < b {
		fmt.Println((groups-1)*a+b)
	} else {
		fmt.Println(groups*b)
	}
}

package main

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

func main() {
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewBuffer(bs)
	var n, x, y, count int64
	fmt.Fscanf(reader, "%d %d %d\n", &n, &x, &y)
	var s string
	fmt.Fscanf(reader, "%s", &s)
	var prev byte = '1'
	for i := 0;i < len(s);i ++ {
		if prev == '1' && s[i] == '0' {
			count ++
		}
		prev = s[i]
	}
	var cost1 int64 = x * (count - 1) + y
	var cost2 int64 = count * y
	if cost1 < cost2 {
		fmt.Printf("%d", cost1)
	} else {
		fmt.Printf("%d", cost2)
	}
}

package main

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

func main() {
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewBuffer(bs)
	var n, x, y int
	fmt.Fscanf(reader, "%d %d %d\n", &n, &x, &y)
	var s string
	fmt.Fscanf(reader, "%s", &s)
	var prev byte = '1'
	count := 0
	for i := 0;i < len(s);i ++ {
		if prev == '1' && s[i] == '0' {
			count ++
		}
		prev = s[i]
	}
	cost1 := x * (count - 1) + y
	cost2 := count * y
	if cost1 < cost2 {
		fmt.Printf("%d", cost1)
	} else {
		fmt.Printf("%d", cost2)
	}
}


You are given an integer array of length $$$n$$$.You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. In other words the required sequence should be equal to $$$[x, x + 1, \dots, x + k - 1]$$$ for some value $$$x$$$ and length $$$k$$$.Subsequence of an array can be obtained by erasing some (possibly zero) elements from the array. You can erase any elements, not necessarily going successively. The remaining elements preserve their order. For example, for the array $$$[5, 3, 1, 2, 4]$$$ the following arrays are subsequences: $$$[3]$$$, $$$[5, 3, 1, 2, 4]$$$, $$$[5, 1, 4]$$$, but the array $$$[1, 3]$$$ is not.

The first line of the input containing integer number $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the array. The second line of the input containing $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the array itself.

On the first line print $$$k$$$ — the maximum length of the subsequence of the given array that forms an increasing sequence of consecutive integers. On the second line print the sequence of the indices of the any maximum length subsequence of the given array that forms an increasing sequence of consecutive integers.

NoteAll valid answers for the first example (as sequences of indices):   $$$[1, 3, 5, 6]$$$  $$$[2, 3, 5, 6]$$$ All valid answers for the second example:   $$$[1, 4]$$$  $$$[2, 5]$$$  $$$[3, 6]$$$ All valid answers for the third example:   $$$[1]$$$  $$$[2]$$$  $$$[3]$$$  $$$[4]$$$ All valid answers for the fourth example:   $$$[1, 2, 3, 7, 8, 9]$$$

package main

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

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

func main() {
	defer out.Flush()

	var n int
	fmt.Fscan(in, &n)
	a := make([]int, n+1)
	mp := make(map[int]int)
	mx, ret := -1, -1
	for i := 1; i <= n; i++ {
		fmt.Fscan(in, &a[i])
		mp[a[i]] = mp[a[i]-1] + 1
		if mp[a[i]] > mx {
			mx = mp[a[i]]
			ret = a[i]
		}
	}
	fmt.Fprintln(out, mx)
	t := ret - mx + 1
	for i := 1; i <= n && t <= ret; i++ {
		if a[i] == t {
			fmt.Fprintf(out, "%d ", i)
			t++
		}
	}
}

package main

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

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

	dp := map[int]int{}
	var n, end int
	Fscan(in, &n)
	a := make([]int, n)
	for i := range a {
		Fscan(in, &a[i])
		if dp[a[i]] = dp[a[i]-1] + 1; dp[a[i]] > dp[end] {
			end = a[i]
		}
	}
	st := end - dp[end] + 1
	ans := []interface{}{}
	for i, v := range a {
		if v == st {
			st++
			ans = append(ans, i+1)
		}
	}
	Fprintln(out, len(ans))
	Fprint(out, ans...)
}

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

package main

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

// github.com/EndlessCheng/codeforces-go
func main() {
	I := bufio.NewReader(os.Stdin)
	O := bufio.NewWriter(os.Stdout)
	defer O.Flush()

	f := map[int]int{}
	var n, e int
	Fscan(I, &n)
	a := make([]int, n)
	for i := range a {
		Fscan(I, &a[i])
		if f[a[i]] = f[a[i]-1] + 1; f[a[i]] > f[e] {
			e = a[i]
		}
	}
	t := e - f[e] + 1
	p := []interface{}{}
	for i, v := range a {
		if v == t {
			t++
			p = append(p, i+1)
		}
	}
	Fprintln(O, len(p))
	Fprint(O, p...)
}

package main

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

const (
	MaxN = 200005
)

var n int
var a []int
var m map[int][]int
var dp []int
var b []int

func bt(ind int) {
	if ind == -1 {
		return
	}
	bt(b[ind])
	fmt.Printf("%d ", ind + 1)
}

func main() {
	buf := bufio.NewReader(os.Stdin)
	fmt.Fscanf(buf, "%d\n", &n)
	a = make([]int, n)
	m = make(map[int][]int, n)
	dp = make([]int, n)
	b = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(buf, "%d", &a[i])
		if _, ok := m[a[i]]; !ok {
			m[a[i]] = make([]int, 0)
		}
		m[a[i]] = append(m[a[i]], i)
	}

	dp[0] = 1
	b[0] = -1
	for i := 1; i < n; i++ {
		dp[i] = 1
		b[i] = -1
		if arr, ok := m[a[i] - 1]; ok {
			index := sort.Search(len(arr), func(ind int) bool {
				return arr[ind] >= i
			})
			if index == 0 {
				continue
			} else {
				dp[i] = dp[arr[index - 1]] + 1
				b[i] = arr[index - 1]
			}
		}
	}

	ind := 0
	for i := 1; i < n; i++ {
		if dp[ind] < dp[i] {
			ind = i
		}
	}
	fmt.Println(dp[ind])
	bt(ind)
}

package main

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

const (
	MaxN = 200005
)

var n int
var a []int
var m map[int][]int
var dp []int
var b []int

func bt(ind int) {
	if ind == -1 {
		return
	}
	bt(b[ind])
	fmt.Printf("%d ", ind + 1)
}

func main() {
	buf := bufio.NewReader(os.Stdin)
	fmt.Fscanf(buf, "%d\n", &n)
	a = make([]int, n)
	m = make(map[int][]int, n)
	dp = make([]int, n)
	b = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(buf, "%d", &a[i])
		if _, ok := m[a[i]]; !ok {
			m[a[i]] = make([]int, 0)
		}
		m[a[i]] = append(m[a[i]], i)
	}
	fmt.Println(m)

	dp[0] = 1
	b[0] = -1
	for i := 1; i < n; i++ {
		dp[i] = 1
		b[i] = -1
		if arr, ok := m[a[i] - 1]; ok {
			index := sort.Search(len(arr), func(ind int) bool {
				return arr[ind] >= i
			})
			if index == 0 {
				continue
			} else {
				dp[i] = dp[arr[index - 1]] + 1
				b[i] = arr[index - 1]
			}
		}
	}

	ind := 0
	for i := 1; i < n; i++ {
		if dp[ind] < dp[i] {
			ind = i
		}
	}
	fmt.Println(dp[ind])
	bt(ind)
}

package main

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

const (
	MaxN = 200005
)

type num struct {
	v, index int
}
type sortable []num

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

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

func (s sortable) Less(i, j int) bool {
	return a[i].v < a[j].v
}

var n int
var a []num
var i1, i2 int

func main() {
	buf := bufio.NewReader(os.Stdin)
	fmt.Fscanf(buf, "%d\n", &n)
	a = make([]num, 0)
	m := make(map[int]bool)
	for i := 0; i < n; i++ {
		var t int
		fmt.Fscanf(buf, "%d", &t)
		if m[t] {
			continue
		}
		m[t] = true
		a = append(a, num{t, i + 1})
	}
	sort.Sort(sortable(a))
	i1 = 0
	i2 = 0
	k := 0
	for {
		if k == len(a) {
			break
		}
		var j int
		for j = k + 1; j < len(a); j++ {
			if a[j - 1].v + 1 == a[j].v && a[j - 1].index < a[j].index {
				if j - k > i2 - i1 {
					i1 = k
					i2 = j
				}
			} else {
				break
			}
		}
		k = j
	}
	fmt.Println(i2 - i1 + 1)
	for i := i1; i <= i2; i++ {
		fmt.Printf("%d ", a[i].index)
	}
	fmt.Println()
}

package main

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

const (
	MaxN = 200005
)

var n int
var a []int
var m map[int]int
var dp []int
var b []int

func bt(ind int) {
	if ind == -1 {
		return
	}
	bt(b[ind])
	fmt.Printf("%d ", ind + 1)
}

func main() {
	buf := bufio.NewReader(os.Stdin)
	fmt.Fscanf(buf, "%d\n", &n)
	a = make([]int, n)
	m = make(map[int]int, n)
	dp = make([]int, n)
	b = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(buf, "%d", &a[i])
		if _, ok := m[a[i]]; !ok {
			m[a[i]] = i
		}
	}

	dp[0] = 1
	b[0] = -1
	for i := 1; i < n; i++ {
		dp[i] = 1
		b[i] = -1
		if k, ok := m[a[i] - 1]; ok && k < i {
			dp[i] = 1 + dp[k]
			b[i] = k
		}
	}

	ind := 0
	for i := 1; i < n; i++ {
		if dp[ind] < dp[i] {
			ind = i
		}
	}
	fmt.Println(dp[ind])
	bt(ind)
}


Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.Petya has two strings a and b of the same length n. The strings consist only of lucky digits. Petya can perform operations of two types:   replace any one digit from string a by its opposite (i.e., replace 4 by 7 and 7 by 4);  swap any pair of digits in string a. Petya is interested in the minimum number of operations that are needed to make string a equal to string b. Help him with the task.

The first and the second line contains strings a and b, correspondingly. Strings a and b have equal lengths and contain only lucky digits. The strings are not empty, their length does not exceed 105.

Print on the single line the single number — the minimum number of operations needed to convert string a into string b.

NoteIn the first sample it is enough simply to swap the first and the second digit.In the second sample we should replace the second digit with its opposite.In the third number we should replace all three digits with their opposites.

package main

import "fmt"

func main(){
	var a, b string
	fmt.Scan(&a)
	fmt.Scan(&b)
	aa := make([]int, len(a))
	bb := make([]int, len(a))
	hasil := 0
	hasil2 := 0
	for i:=0; i<len(a); i++ {
		aa[i] = int(a[i] - '0')
		bb[i] = int(b[i] - '0')
		if aa[i] != bb[i] {
			if aa[i] == 7 {
				hasil += 1
			} else {
				hasil2 +=1
			}
		}
	}
	if hasil > hasil2 {
		fmt.Println(hasil)
	} else {
		fmt.Println(hasil2)
	}
}

package main

import "fmt"

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

func main() {
    var a,b string
    fmt.Scan(&a)
    fmt.Scan(&b)
    four, seven := 0, 0
    for i := 0; i < len(a); i++ {
        if a[i] != b[i] {
            if a[i] == '4' { four++ }
            if a[i] == '7' { seven++ }
        }
    }
    fmt.Println(max(four,seven))
}

// 145A
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b string
	var x, y float64
	fmt.Scan(&a, &b)
	for i := 0; i < len(a); i++ {
		if a[i] == b[i] {
			continue
		}
		if a[i] == '4' {
			x++
		} else {
			y++
		}
	}
	fmt.Println(math.Max(x, y))
}

// 145A-mic_rizal
package main

import (
    "fmt"
    "math"
)

func main() {
    var str1, str2 string
    fmt.Scan(&str1, &str2)
    var a, b int
    for i := 0; i < len(str1); i++ {
        if str1[i] != str2[i] {
            if str1[i] == '4' {
                a++
            } else {
                b++
            }
        }
    }
    fmt.Println(int(math.Min(float64(a), float64(b))) + int(math.Abs(float64(a)-float64(b))))
}

package main

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

var scanner *bufio.Scanner

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

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

  r, _ := reader.ReadString('\n')
  r = strings.Trim(r, "\r\n")
  s, _ := reader.ReadString('\n')
  s = strings.Trim(s, "\r\n")
  n := len(r)

  a, b := 0, 0
  for i := 0; i < n; i++ {
    if r[i] != s[i] {
      if r[i] == '4' {
        a++
      } else {
        b++
      }
    }
  }
  result := 0
  if a < b {
    result = b
  } else {
    result = a
  }

  writer.WriteString(fmt.Sprintf("%d\n", result))
}

package main

import (
	"fmt"
	"math"
)

func main() {
	var count, a7, a4, b7, b4 int
	count = 0
	var a, b string
	fmt.Scanf("%s\n%s", &a, &b)
	for i := 0; i < len(a); i++ {
		if a[i] != b[i] {
			count ++

			if a[i] == '7' {
				a7 ++
			} else {
				a4++
			}
			if b[i] == '7' {
				b7++
			} else {
				b4++
			}
		}
	}
	result := math.Max(float64(a7),float64(a4))
	//result += float64(count)
	fmt.Println(result)
}

package main

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

func main(){
	var a, b string
	r := bufio.NewScanner(os.Stdin)
	r.Scan()
	a = r.Text()
	r.Scan()
	b = r.Text()
	len := len(a)
	aa := make([]int, len)
	bb := make([]int, len)
	for i:=0; i<len; i++ {
		aa[i] = int(a[i] - '0')
		bb[i] = int(b[i] - '0')
	}
	hasil := 0
	swap := 0
	for i:=0; i<len; i++ {
		if aa[i] != bb[i] {
			hasil += 1
		}
	}

	for j:=0; j<len; j++ {
		if aa[j] != bb[j] {
			if j < len-1 {
				for k:=j+1; k<len; k++ {
					if aa[j] == bb[k] && bb[j] == aa[k] {
						swap += 1
						aa[j], aa[k] = aa[k], aa[j]
						break
					} else {
						swap = swap
					}
				}
			}
		}
	}
	fmt.Println(hasil-swap)
}

package main

import "fmt"

func main(){
	var a, b string
	fmt.Scanln(&a)
	fmt.Scanln(&b)
	len := len(a)
	hasil := 0
	swap := 0
	for i:=0; i<len; i++ {
		if a[i] != b[i] {
			hasil += 1
		}
	}
	for j:=0; j<len; j++ {
		if a[j] != b[j] {
			if j<len-1 {
				for k:=0; k<len-1; k++ {
					if a[j] == b[k+1] && b[j] == a[k+1] {
						swap += 1
					} else {
						swap = swap
					}
				}
			}
		}
	}
	if swap < hasil {
		fmt.Println(hasil-swap)
	} else {
		fmt.Println(hasil)
	}
}

package main

import "fmt"

func main(){
	var a, b string
	fmt.Scanln(&a)
	fmt.Scanln(&b)
	len := len(a)
	hasil := 0
	swap := 0
	for i:=0; i<len; i++ {
		if a[i] != b[i] {
			hasil += 1
		}
	}
	for j:=0; j<len-1; j++ {
		if a[j] == b[j+1] && b[j] == a[j+1] {
			swap += 1
		} else {
			swap = swap
		}
	}
	fmt.Println(hasil-swap)
}

package main

import "fmt"

func main(){
	var a, b string
	fmt.Scanln(&a)
	fmt.Scanln(&b)
	len := len(a)
	hasil := 0
	swap := 0
	for i:=0; i<len; i++ {
		if a[i] != b[i] {
			hasil += 1
		}
	}
	for j:=0; j<len-1; j++ {
		if a[j] == b[j+1] && b[j] == a[j+1] {
			swap += 1
		} else {
			swap = swap
		}
	}
	if swap < hasil {
		fmt.Println(hasil-swap)
	} else {
		fmt.Println(hasil)
	}
}

package main

import "fmt"

func main() {
    var a,b string
    fmt.Scan(&a)
    fmt.Scan(&b)
    ans := 0
    for i := 0; i < len(a); i++ {
        if a[i] != b[i] {
            ans++
            if (i != 0) && (a[i-1] != b[i-1]) && (a[i] != a[i-1]) {
                ans--
            }
        }
    }
    fmt.Println(ans)
}


A team of three programmers is going to play a contest. The contest consists of $$$n$$$ problems, numbered from $$$1$$$ to $$$n$$$. Each problem is printed on a separate sheet of paper. The participants have decided to divide the problem statements into three parts: the first programmer took some prefix of the statements (some number of first paper sheets), the third contestant took some suffix of the statements (some number of last paper sheets), and the second contestant took all remaining problems. But something went wrong — the statements were printed in the wrong order, so the contestants have received the problems in some random order.The first contestant has received problems $$$a_{1, 1}, a_{1, 2}, \dots, a_{1, k_1}$$$. The second one has received problems $$$a_{2, 1}, a_{2, 2}, \dots, a_{2, k_2}$$$. The third one has received all remaining problems ($$$a_{3, 1}, a_{3, 2}, \dots, a_{3, k_3}$$$).The contestants don't want to play the contest before they redistribute the statements. They want to redistribute them so that the first contestant receives some prefix of the problemset, the third contestant receives some suffix of the problemset, and the second contestant receives all the remaining problems.During one move, some contestant may give one of their problems to other contestant. What is the minimum number of moves required to redistribute the problems?It is possible that after redistribution some participant (or even two of them) will not have any problems.

The first line contains three integers $$$k_1, k_2$$$ and $$$k_3$$$ ($$$1 \le k_1, k_2, k_3 \le 2 \cdot 10^5, k_1 + k_2 + k_3 \le 2 \cdot 10^5$$$) — the number of problems initially taken by the first, the second and the third participant, respectively. The second line contains $$$k_1$$$ integers $$$a_{1, 1}, a_{1, 2}, \dots, a_{1, k_1}$$$ — the problems initially taken by the first participant. The third line contains $$$k_2$$$ integers $$$a_{2, 1}, a_{2, 2}, \dots, a_{2, k_2}$$$ — the problems initially taken by the second participant. The fourth line contains $$$k_3$$$ integers $$$a_{3, 1}, a_{3, 2}, \dots, a_{3, k_3}$$$ — the problems initially taken by the third participant. It is guaranteed that no problem has been taken by two (or three) participants, and each integer $$$a_{i, j}$$$ meets the condition $$$1 \le a_{i, j} \le n$$$, where $$$n = k_1 + k_2 + k_3$$$.

Print one integer — the minimum number of moves required to redistribute the problems so that the first participant gets the prefix of the problemset, the third participant gets the suffix of the problemset, and the second participant gets all of the remaining problems.

NoteIn the first example the third contestant should give the problem $$$2$$$ to the first contestant, so the first contestant has $$$3$$$ first problems, the third contestant has $$$1$$$ last problem, and the second contestant has $$$1$$$ remaining problem.In the second example the distribution of problems is already valid: the first contestant has $$$3$$$ first problems, the third contestant has $$$1$$$ last problem, and the second contestant has $$$2$$$ remaining problems.The best course of action in the third example is to give all problems to the third contestant.The best course of action in the fourth example is to give all problems to the second contestant.

package main

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

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

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

func Dprint(format string, a ...interface{}) {
	if Debug {
		fmt.Fprintf(os.Stderr, format+"\n", a...)
	}
}

var (
	k1, k2, k3 int
	a          []int
)

func main() {
	defer writer.Flush()

	Scanf("%d %d %d\n", &k1, &k2, &k3)
	n := k1 + k2 + k3
	a = make([]int, n)
	var s int
	for i := 0; i < k1; i++ {
		Scanf("%d", &s)
		a[s-1] = 1
	}
	Scanf("\n")
	for i := 0; i < k2; i++ {
		Scanf("%d", &s)
		a[s-1] = 2
	}
	Scanf("\n")
	for i := 0; i < k3; i++ {
		Scanf("%d", &s)
		a[s-1] = 3
	}

	// c1, c2, c3 is the number of ones, twos or threes in a[0:i]
	c1 := make([]int, n+1)
	c2 := make([]int, n+1)
	c3 := make([]int, n+1)
	for i := 0; i < n; i++ {
		switch a[i] {
		case 1:
			c1[i+1] = 1
		case 2:
			c2[i+1] = 1
		case 3:
			c3[i+1] = 1
		}
		c1[i+1] += c1[i]
		c2[i+1] += c2[i]
		c3[i+1] += c3[i]
	}

	// c1 is number of ones in a[0:i].
	// c2 is number of twos in a[0:i].
	// Minimize (c2 - c1)[0:i]
	// am[i] is index <= i where c2 - c1 for intervals [0:0], [0:1], ..., [0:i] is minimal.
	am := make([]int, n+1)
	minDiff := math.MaxInt32 // this could be 0.
	minIdx := 0
	for i := 0; i <= n; i++ {
		diff := c2[i] - c1[i]
		if diff < minDiff {
			minDiff = diff
			minIdx = i
		}
		am[i] = minIdx
	}
	// Dprint(

	// We will be splitting a into a[0:l], a[l:r], a[r:n]
	minScore := math.MaxInt32
	for r := 0; r <= n; r++ {
		okElts := c3[n] - c3[r] // number of threes in a[r:n]
		l := am[r]
		okElts += c1[l]         // number of ones in [0:l]
		okElts += c2[r] - c2[l] // number of twos in [l:r]
		score := n - okElts
		if score < minScore {
			minScore = score
		}
	}
	Printf("%d", minScore)
}