Semyon participates in the most prestigious competition of the world ocean for the title of the most dangerous shark. During this competition sharks compete in different subjects: speed swimming, masking, map navigation and many others. Now Semyon is taking part in «destruction» contest.During it, $$$m$$$ dominoes are placed in front of the shark. All dominoes are on the same line, but the height of the dominoes may vary. The distance between adjacent dominoes is $$$1$$$. Moreover, each Domino has its own cost value, expressed as an integer. The goal is to drop all the dominoes. To do this, the shark can push any domino to the left or to the right, and it will begin falling in this direction. If during the fall the domino touches other dominoes, they will also start falling in the same direction in which the original domino is falling, thus beginning a chain reaction, as a result of which many dominoes can fall. A falling domino touches another one, if and only if the distance between them was strictly less than the height of the falling domino, the dominoes do not necessarily have to be adjacent.Of course, any shark can easily drop all the dominoes in this way, so the goal is not to drop all the dominoes, but do it with a minimum cost. The cost of the destruction is the sum of the costs of dominoes that the shark needs to push to make all the dominoes fall.Simon has already won in the previous subjects, but is not smart enough to win in this one. Help Semyon and determine the minimum total cost of the dominoes he will have to push to make all the dominoes fall.

In order to reduce input size, the heights and costs of the dominoes are described with blocks. The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 250\,000, 1 \leq m \leq 10^7$$$) — the number of the blocks and the total number of the dominoes Semyon must drop. Then descriptions of $$$n$$$ blocks follow. Description of every block consists of three lines. The first line of block's description contains a single integer $$$k_i$$$ ($$$1 \leq k_i \leq 250\,000, \sum_{i = 1}^{n}{k_i} \leq 250\,000$$$) — the number of dominoes in the block. The second line of block's description contains $$$k_i$$$ integers $$$a_j$$$ ($$$1 \leq a_j \leq m$$$) — the heights of the dominoes in the blocks. The third line contains $$$k_i$$$ integers $$$c_j$$$ ($$$1 \leq c_j \leq 100\,000$$$) — the costs of the dominoes in the block. Then the domino sequence is described (from left to right). The first line of this description contains a single integer $$$q$$$ ($$$n \leq q \leq 250\,000$$$) — the number of blocks in the sequence of domino sequence. Each of the following $$$q$$$ lines contains integers $$$id_i, mul_i$$$ ($$$1 \leq id_i \leq n$$$, $$$1 \leq mul_i \leq 100\,000$$$), denoting that the next $$$k_{id_i}$$$ dominoes are dominoes of the block $$$id_i$$$, with their cost multiplied by $$$mul_i$$$. It's guaranteed, that $$$\sum_{i = 1}^{q}{k_{id_i}} = m$$$, and that's every block is used in the sequence at least once.

Print exactly one integer — the minimum cost to make all the dominoes fall.

NoteIn the first example, there are $$$7$$$ dominoes in front of the Semyon. Their heights are equal to $$$[3, 1, 2, 2, 1, 2, 2]$$$, and their costs are equal to $$$[4, 3, 6, 3, 1, 2, 1]$$$. Semyon should drop the domino with index $$$7$$$ to the left, it will fall and drop the domino $$$6$$$ as well. The domino $$$6$$$ during the fall will drop the domino $$$5$$$, however the latter will not drop any more dominoes. Then Semyon should drop domino with number $$$1$$$ to the right and it will drop dominoes $$$2$$$ and $$$3$$$ after falling. And the domino $$$3$$$ will drop the domino $$$4$$$ after falling. Hence all dominoes are fallen this way.In the second example, there is a single domino of cost $$$10000000000$$$.

package main

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

var (
	que    []*Qpair
	height []int
	cost   []int64
	qf     int
	qr     int
)

type block struct {
	len int
	h   []int
	c   []int
}

type Qpair struct {
	w int
	v int64
}

func addQue(w int, v int64) {
	if qr == qf {
		que[qr] = &Qpair{
			w: w,
			v: v,
		}
		qr++
		return
	}
	if que[qr-1].w == w {
		if v < que[qr-1].v {
			que[qr-1].v = v
		}
		return
	}
	if que[qr-1].v > v {
		que[qr] = &Qpair{
			w: w,
			v: v,
		}
		qr++
		return
	}
	return
}
func findQue(w int) int64 {
	for qf < qr && que[qr-1].w < w {
		qr--
	}
	if qf == qr {
		return -1
	}
	return que[qr-1].v
}

func main() {
	buf := bufio.NewReader(os.Stdin)
	var n, m, k, q int
	fmt.Fscanf(buf, "%d %d\n", &n, &m)
	dp := make([]int64, m+1)
	que = make([]*Qpair, m+1)
	height = make([]int, m+1)
	cost = make([]int64, m+1)
	blocks := make([]*block, n+1)

	for i := 0; i < n; i++ {
		fmt.Fscanf(buf, "%d\n", &k)
		b := &block{
			len: k,
			h:   make([]int, k),
			c:   make([]int, k),
		}
		for j := 0; j < k; j++ {
			fmt.Fscanf(buf, "%d", &b.h[j])
		}
		fmt.Fscanf(buf, "\n")
		for j := 0; j < k; j++ {
			fmt.Fscanf(buf, "%d", &b.c[j])
		}
		fmt.Fscanf(buf, "\n")
		blocks[i+1] = b

	}
	fmt.Fscanf(buf, "%d\n", &q)
	var mul int64
	front := 1
	for i := 0; i < q; i++ {
		fmt.Fscanf(buf, "%d %d\n", &k, &mul)
		for j := 0; j < blocks[k].len; j++ {
			height[front] = blocks[k].h[j]
			cost[front] = int64(blocks[k].c[j]) * mul
			front++
		}
	}
	left := make([]int, m+1)
	right := make([]int, m+1)
	var pre int64
	qr = 0
	for i := 1; i <= m; i++ {
		if height[i] == 1 {
			left[i] = i
			continue
		}
		pre = int64(i - height[i] + 1)
		if pre < 1 {
			pre = 1
		}
		for pre > 1 && qr > 0 && que[qr-1].w >= int(pre) {
			if que[qr-1].v < pre {
				pre = que[qr-1].v
			}
			qr--
		}
		if que[qr] == nil {
			que[qr] = &Qpair{}
		}
		que[qr].w = i
		que[qr].v = pre
		qr++
		left[i] = int(pre)
	}
	var int64m int64 = int64(m)
	qr = 0
	for i := m; i >= 1; i-- {
		if height[i] == 1 {
			right[i] = i
			continue
		}
		pre = int64(i + height[i] - 1)
		if pre > int64m {
			pre = int64m
		}
		for pre < int64m && qr > 0 && que[qr-1].w <= int(pre) {
			if que[qr-1].v > pre {
				pre = que[qr-1].v
			}
			qr--
		}
		if que[qr] == nil {
			que[qr] = &Qpair{}
		}
		que[qr].w = i
		que[qr].v = pre
		right[i] = int(pre)
		qr++
	}
	//fmt.Printf("h== %v\n", height)
	//fmt.Printf("c== %v\n", cost)
	//fmt.Printf("left== %v\n", left)
	//fmt.Printf("right== %v\n", right)
	qr=0
	qf=0
	for i := 1; i <= m; i++ {

		addQue(right[i], dp[i-1]+cost[i])
		if qr == qf {
			if que[qr] == nil {
				que[qr] = &Qpair{

				}
			}
			que[qr].w = right[i]
			que[qr].v = dp[i-1] + cost[i]
			qr++

		} else if que[qr-1].w == right[i] {
			if dp[i-1]+cost[i] < que[qr-1].v {
				que[qr-1].v = dp[i-1] + cost[i]
			}

		} else if que[qr-1].v > dp[i-1]+cost[i] {
			if que[qr] == nil {
				que[qr] = &Qpair{

				}
			}
			que[qr].w = right[i]
			que[qr].v = dp[i-1] + cost[i]
			qr++

		}

		dp[i] = -1
		if qr > qf {
			dp[i] = que[qr-1].v
		}

		var lv int64 = cost[i]
		//	fmt.Printf("i=%d front=%d add = %d dp=%d lv=%d\n", i, right[i],  dp[i-1]+int64(cost[i]), dp[i], lv)
	//	pre = left[i]
		if  left[i]-1 > 0 {
			lv += dp[left[i]-1]
		}
		if dp[i] <= 0 || dp[i] > lv {
			dp[i] = lv
		}
		for qr > qf && que[qr-1].w <= i {
			qr--
		}
	}
	//	fmt.Printf("dp=%d\n", dp)
	fmt.Printf("%d\n", dp[m])

}

/*
1 10
10
1 1 2 1 1 1 2 1 1 1
1 1 1 1 1 1 1 1 1 1
1
1 1
*/

package main

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

var (
	que    []*Qpair
	height []int
	cost   []int64
	qf     int
	qr     int
)

type block struct {
	len int
	h   []int
	c   []int
}

type Qpair struct {
	w int
	v int64
}

func addQue(w int, v int64) {
	if qr == qf {
		que[qr] = &Qpair{
			w: w,
			v: v,
		}
		qr++
		return
	}
	if que[qr-1].w == w {
		if v < que[qr-1].v {
			que[qr-1].v = v
		}
		return
	}
	if que[qr-1].v > v {
		que[qr] = &Qpair{
			w: w,
			v: v,
		}
		qr++
		return
	}
	return
}
func findQue(w int) int64 {
	for qf < qr && que[qr-1].w < w {
		qr--
	}
	if qf == qr {
		return -1
	}
	return que[qr-1].v
}

func main() {
	buf := bufio.NewReader(os.Stdin)
	var n, m, k, q int
	fmt.Fscanf(buf, "%d %d\n", &n, &m)
	dp := make([]int64, m+1)
	que = make([]*Qpair, m+1)
	height = make([]int, m+1)
	cost = make([]int64, m+1)
	blocks := make([]*block, n+1)

	for i := 0; i < n; i++ {
		fmt.Fscanf(buf, "%d\n", &k)
		b := &block{
			len: k,
			h:   make([]int, k),
			c:   make([]int, k),
		}
		for j := 0; j < k; j++ {
			fmt.Fscanf(buf, "%d", &b.h[j])
		}
		fmt.Fscanf(buf, "\n")
		for j := 0; j < k; j++ {
			fmt.Fscanf(buf, "%d", &b.c[j])
		}
		fmt.Fscanf(buf, "\n")
		blocks[i+1] = b

	}
	fmt.Fscanf(buf, "%d\n", &q)
	var mul int64
	front := 1
	for i := 0; i < q; i++ {
		fmt.Fscanf(buf, "%d %d\n", &k, &mul)
		for j := 0; j < blocks[k].len; j++ {
			height[front] = blocks[k].h[j]
			cost[front] = int64(blocks[k].c[j]) * mul
			front++
		}
	}
	left := make([]int, m+1)
	right := make([]int, m+1)
	pre := m
	for i := 1; i <= m; i++ {
		if i == 1 || height[i] == 1 {
			pre = i
			left[i] = i
			continue
		}
		if pre > 1 && i-height[i]+1 < pre {
			minf := i - height[i] + 1
			for j := pre - 1; minf > 1 && j >= minf; j-- {
				if j-height[j]+1 < minf {
					minf = j - height[j] + 1
				}
			}
			if minf <= 1 {
				minf = 1
			}
			pre = minf
		}
		left[i] = pre
	}
	front = m
	for i := m; i >= 1; i-- {
		if height[i] == 1 {
			front = i
			right[i] = i
			continue
		}
		if front < m && i+height[i]-1 > front {
			maxf := i + height[i] - 1
			for j := front + 1; maxf < m && j <= maxf; j++ {
				if j+height[j]-1 > maxf {
					maxf = j + height[j] - 1
				}
			}
			if maxf > m {
				maxf = m
			}
			front = maxf
		}
		right[i] = front
	}
	//fmt.Printf("h== %v\n", height)
	//fmt.Printf("c== %v\n", cost)
	//fmt.Printf("left== %v\n", left)
	//fmt.Printf("right== %v\n", right)
	for i := 1; i <= m; i++ {

		addQue(right[i], dp[i-1]+int64(cost[i]))
		dp[i] = findQue(i)

		var lv int64 = int64(cost[i])
	//	fmt.Printf("i=%d front=%d add = %d dp=%d lv=%d\n", i, right[i],  dp[i-1]+int64(cost[i]), dp[i], lv)
		pre = left[i]
		if pre-1 > 0 {
			lv += dp[pre-1]
		}
		if dp[i] <= 0 || dp[i] > lv {
			dp[i] = lv
		}
		if height[i] == 1{
			qr =0
			qf = 0

		}
	}
//	fmt.Printf("dp=%d\n", dp)
	fmt.Printf("%d\n", dp[m])

}

/*
1 10
10
1 1 2 1 1 1 2 1 1 1
1 1 1 1 1 1 1 1 1 1
1
1 1
*/

package main

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

var (
	que    []*Qpair
	height []int
	cost   []int64
	qf     int
	qr     int
)

type block struct {
	len int
	h   []int
	c   []int
}

type Qpair struct {
	w int
	v int64
}

func addQue(w int, v int64) {
	if qr == qf {
		que[qr] = &Qpair{
			w: w,
			v: v,
		}
		qr++
		return
	}
	if que[qr-1].w == w {
		if v < que[qr-1].v {
			que[qr-1].v = v
		}
		return
	}
	if que[qr-1].v > v {
		que[qr] = &Qpair{
			w: w,
			v: v,
		}
		qr++
		return
	}
	return
}
func findQue(w int) int64 {
	for qf < qr && que[qr-1].w < w {
		qr--
	}
	if qf == qr {
		return -1
	}
	return que[qr-1].v
}

func main() {
	buf := bufio.NewReader(os.Stdin)
	var n, m, k, q int
	fmt.Fscanf(buf, "%d %d\n", &n, &m)
	dp := make([]int64, m+1)
	que = make([]*Qpair, m+1)
	height = make([]int, m+1)
	cost = make([]int64, m+1)
	blocks := make([]*block, n+1)

	for i := 0; i < n; i++ {
		fmt.Fscanf(buf, "%d\n", &k)
		b := &block{
			len: k,
			h:   make([]int, k),
			c:   make([]int, k),
		}
		for j := 0; j < k; j++ {
			fmt.Fscanf(buf, "%d", &b.h[j])
		}
		fmt.Fscanf(buf, "\n")
		for j := 0; j < k; j++ {
			fmt.Fscanf(buf, "%d", &b.c[j])
		}
		fmt.Fscanf(buf, "\n")
		blocks[i+1] = b

	}
	fmt.Fscanf(buf, "%d\n", &q)
	var mul int64
	front := 1
	for i := 0; i < q; i++ {
		fmt.Fscanf(buf, "%d %d\n", &k, &mul)
		for j := 0; j < blocks[k].len; j++ {
			height[front] = blocks[k].h[j]
			cost[front] = int64(blocks[k].c[j]) * mul
			front++
		}
	}
	left := make([]int, m+1)
	right := make([]int, m+1)
	pre := m
	for i := 1; i <= m; i++ {
		if i == 1 || height[i] == 1 {
			pre = i
			left[i] = i
			continue
		}
		if pre > 1 && i-height[i]+1 < pre {
			minf := i - height[i] + 1
			for j := pre - 1; minf > 1 && j >= minf; j-- {
				if j-height[j]+1 < minf {
					minf = j - height[j] + 1
				}
			}
			if minf <= 1 {
				minf = 1
			}
			pre = minf
		}
		left[i] = pre
	}
	front = m
	for i := m; i >= 1; i-- {
		if height[i] == 1 {
			front = i
			right[i] = i
			continue
		}
		if front < m && i+height[i]-1 > front {
			maxf := i + height[i] - 1
			for j := front + 1; maxf < m && j <= maxf; j++ {
				if j+height[j]-1 > maxf {
					maxf = j + height[j] - 1
				}
			}
			if maxf > m {
				maxf = m
			}
			front = maxf
		}
		right[i] = front
	}
	//fmt.Printf("h== %v\n", height)
	//fmt.Printf("c== %v\n", cost)
	//fmt.Printf("left== %v\n", left)
	//fmt.Printf("right== %v\n", right)
	for i := 1; i <= m; i++ {

		addQue(right[i], dp[i-1]+int64(cost[i]))
		dp[i] = findQue(i)

		var lv int64 = int64(cost[i])
	//	fmt.Printf("i=%d front=%d re = %d dp=%d lv=%d\n", i, right[i], pre, dp[i], lv)
		pre = left[i]
		if pre-1 > 0 {
			lv += dp[pre-1]
		}
		if dp[i] <= 0 || dp[i] > lv {
			dp[i] = lv
		}
	}
//	fmt.Printf("dp=%d\n", dp)
	fmt.Printf("%d\n", dp[m])

}

/*
209761007
933100336
1142861343
*/

package main

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

var (
	que    []*Qpair
	height []int
	cost   []int64
	qf     int
	qr     int
)

type block struct {
	len int
	h   []int
	c   []int
}

type Qpair struct {
	w int
	v int64
}

func addQue(w int, v int64) {
	for qr > qf && que[qr-1].v >= v {
		qr--
	}
	if qr > qf && que[qr-1].w == w {
		return
	}
	if que[qr] == nil {
		que[qr] = &Qpair{
		}
	}
	que[qr].v = v
	que[qr].w = w
	qr++

}
func findQue(w int) int64 {
	for qf < qr && que[qf].w < w {
		qf++
	}
	if qf == qr {
		return -1
	}
	return que[qf].v
}

func main() {
	buf := bufio.NewReader(os.Stdin)
	var n, m, k, q int
	fmt.Fscanf(buf, "%d %d\n", &n, &m)
	dp := make([]int64, m+1)
	que = make([]*Qpair, m+1)
	height = make([]int, m+1)
	cost = make([]int64, m+1)
	blocks := make([]*block, n+1)

	for i := 0; i < n; i++ {
		fmt.Fscanf(buf, "%d\n", &k)
		b := &block{
			len: k,
			h:   make([]int, k),
			c:   make([]int, k),
		}
		for j := 0; j < k; j++ {
			fmt.Fscanf(buf, "%d", &b.h[j])
		}
		fmt.Fscanf(buf, "\n")
		for j := 0; j < k; j++ {
			fmt.Fscanf(buf, "%d", &b.c[j])
		}
		fmt.Fscanf(buf, "\n")
		blocks[i+1] = b

	}
	fmt.Fscanf(buf, "%d\n", &q)
	var mul int64
	front := 1
	for i := 0; i < q; i++ {
		fmt.Fscanf(buf, "%d %d\n", &k, &mul)
		for j := 0; j < blocks[k].len; j++ {
			height[front] = blocks[k].h[j]
			cost[front] = int64(blocks[k].c[j]) * mul
			front++
		}
	}
//	fmt.Printf("h== %v\n", height)
//	fmt.Printf("c== %v\n", cost)
	front = 0
	pre := m
	for i := 1; i <= m; i++ {
		if front < m && i+height[i]-1 > front {
			maxf := i + height[i] - 1
			for j := front + 1; maxf < m && j <= maxf; j++ {
				if j+height[j]-1 > maxf {
					maxf = j + height[j] - 1
					if maxf > m {
						maxf = m
					}
				}
			}
			front = maxf
		}
		if height[i] == 1 {
			pre = i
		}
		if pre > 1 && i-height[i]+1 < pre {
			minf := pre
			for j := pre - 1; minf > 1 && j >= minf; j-- {
				if j-height[j]+1 < minf {
					minf = j - height[j] + 1
					if minf <= 1 {
						minf = 1
					}
				}
			}
			pre = minf

		}

		addQue(front, dp[i-1]+int64(cost[i]))
		dp[i] = findQue(i)
	//	fmt.Printf("i=%d front=%d dp=%d\n", i, front, dp[i])
		var lv int64 = int64(cost[i])

		if pre-1 > 0 {
			lv += dp[pre]
		}
		if dp[i] <= 0 || dp[i] > lv {
			dp[i] = lv
		}
	}
//	fmt.Printf("dp=%d\n", dp)
	fmt.Printf("%d\n", dp[m])

}

/*
209761007
933100336
1142861343
*/

package main

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

var (
	que    []*Qpair
	height []int
	cost   []int64
	qf     int
	qr     int
)

type block struct {
	len int
	h   []int
	c   []int
}

type Qpair struct {
	w int
	v int64
}

func addQue(w int, v int64) {
	for qr > qf && que[qr-1].v >= v {
		qr--
	}
	if qr > qf && que[qr-1].w == w {
		return
	}
	if que[qr] == nil {
		que[qr] = &Qpair{
		}
	}
	que[qr].v = v
	que[qr].w = w
	qr++

}
func findQue(w int) int64 {
	for qf < qr && que[qf].w < w {
		qf++
	}
	if qf == qr {
		return -1
	}
	return que[qf].v
}

func main() {
	buf := bufio.NewReader(os.Stdin)
	var n, m, k, q int
	fmt.Fscanf(buf, "%d %d\n", &n, &m)
	dp := make([]int64, m+1)
	que = make([]*Qpair, m+1)
	height = make([]int, m+1)
	cost = make([]int64, m+1)
	blocks := make([]*block, n+1)

	for i := 0; i < n; i++ {
		fmt.Fscanf(buf, "%d\n", &k)
		b := &block{
			len: k,
			h:   make([]int, k),
			c:   make([]int, k),
		}
		for j := 0; j < k; j++ {
			fmt.Fscanf(buf, "%d", &b.h[j])
		}
		fmt.Fscanf(buf, "\n")
		for j := 0; j < k; j++ {
			fmt.Fscanf(buf, "%d", &b.c[j])
		}
		fmt.Fscanf(buf, "\n")
		blocks[i+1] = b

	}
	fmt.Fscanf(buf, "%d\n", &q)
	var mul int64
	front := 1
	for i := 0; i < q; i++ {
		fmt.Fscanf(buf, "%d %d\n", &k, &mul)
		for j := 0; j < blocks[k].len; j++ {
			height[front] = blocks[k].h[j]
			cost[front] = int64(blocks[k].c[j]) * mul
			front++
		}
	}
//	fmt.Printf("h== %v\n", height)
//	fmt.Printf("c== %v\n", cost)
	front = 0
	pre := m
	for i := 1; i <= m; i++ {
		if front < m && i+height[i]-1 > front {
			maxf := i + height[i] - 1
			for j := front + 1; maxf < m && j <= maxf; j++ {
				if j+height[j]-1 > maxf {
					maxf = j + height[j] - 1
				}
			}
			if maxf > m {
				maxf = m
			}
			front = maxf
		}
		if height[i] == 1 {
			pre = i
		}
		if pre > 1 && i-height[i]+1 < pre {
			minf := i-height[i]+1
			for j := pre - 1; minf > 1 && j >= minf; j-- {
				if j-height[j]+1 < minf {
					minf = j - height[j] + 1

				}
			}
			if minf <= 1 {
				minf = 1
			}
			pre = minf

		}

		addQue(front, dp[i-1]+int64(cost[i]))
		dp[i] = findQue(i)
		var lv int64 = int64(cost[i])
	//	fmt.Printf("i=%d front=%d re = %d dp=%d lv=%d\n", i, front,pre, dp[i],lv)

		if pre-1 > 0 {
			lv += dp[pre-1]
		}

		if dp[i] <= 0 || dp[i] > lv {
			dp[i] = lv
		}
	}
//	fmt.Printf("dp=%d\n", dp)
	fmt.Printf("%d\n", dp[m])

}

/*
209761007
933100336
1142861343
*/

package main

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

var (
	que    []*Qpair
	height []int
	cost   []int64
	qf     int
	qr     int
)

type block struct {
	len int
	h   []int
	c   []int
}

type Qpair struct {
	w int
	v int64
}

func addQue(w int, v int64) {
	for qr > qf && que[qr-1].v >= v {
		qr--
	}
	if qr > qf && que[qr-1].w == w {
		return
	}
	if que[qr] == nil {
		que[qr] = &Qpair{
		}
	}
	que[qr].v = v
	que[qr].w = w
	qr++

}
func findQue(w int) int64 {
	for qf < qr && que[qf].w < w {
		qf++
	}
	if qf == qr {
		return -1
	}
	return que[qf].v
}

func main() {
	buf := bufio.NewReader(os.Stdin)
	var n, m, k, q int
	fmt.Fscanf(buf, "%d %d\n", &n, &m)
	dp := make([]int64, m+1)
	que = make([]*Qpair, m+1)
	height = make([]int, m+1)
	cost = make([]int64, m+1)
	blocks := make([]*block, n+1)

	for i := 0; i < n; i++ {
		fmt.Fscanf(buf, "%d\n", &k)
		b := &block{
			len: k,
			h:   make([]int, k),
			c:   make([]int, k),
		}
		for j := 0; j < k; j++ {
			fmt.Fscanf(buf, "%d", &b.h[j])
		}
		fmt.Fscanf(buf, "\n")
		for j := 0; j < k; j++ {
			fmt.Fscanf(buf, "%d", &b.c[j])
		}
		fmt.Fscanf(buf, "\n")
		blocks[i+1] = b

	}
	fmt.Fscanf(buf, "%d\n", &q)
	var mul int64
	front := 1
	for i := 0; i < q; i++ {
		fmt.Fscanf(buf, "%d %d\n", &k, &mul)
		for j := 0; j < blocks[k].len; j++ {
			height[front] = blocks[k].h[j]
			cost[front] = int64(blocks[k].c[j]) * mul
			front++
		}
	}
//	fmt.Printf("h== %v\n",height)
//	fmt.Printf("c== %v\n",cost)
	front = 0
	for i := 1; i <= m; i++ {
		if i == 1 || height[i-1] == 1 {
			maxf := i
			for j := i; j <= maxf; j++ {
				if j+height[j] > maxf {
					maxf = j + height[j] - 1
					if maxf > m{
						maxf=m
					}
				}
			}
			front = maxf
		}
		addQue(front, dp[i-1]+int64(cost[i]))
		dp[i] = findQue(i)
	//	fmt.Printf("i=%d front=%d dp=%d\n",i,front,dp[i])
		var lv int64 = int64(cost[i])
		if i-height[i] > 0 {
			lv += dp[i-height[i]]
		}
		if dp[i] <= 0 || dp[i] > lv {
			dp[i] = lv
		}
	}
//	fmt.Printf("dp=%d\n",dp)
	fmt.Printf("%d\n", dp[m])

}


Authors have come up with the string $$$s$$$ consisting of $$$n$$$ lowercase Latin letters.You are given two permutations of its indices (not necessary equal) $$$p$$$ and $$$q$$$ (both of length $$$n$$$). Recall that the permutation is the array of length $$$n$$$ which contains each integer from $$$1$$$ to $$$n$$$ exactly once.For all $$$i$$$ from $$$1$$$ to $$$n-1$$$ the following properties hold: $$$s[p_i] \le s[p_{i + 1}]$$$ and $$$s[q_i] \le s[q_{i + 1}]$$$. It means that if you will write down all characters of $$$s$$$ in order of permutation indices, the resulting string will be sorted in the non-decreasing order.Your task is to restore any such string $$$s$$$ of length $$$n$$$ consisting of at least $$$k$$$ distinct lowercase Latin letters which suits the given permutations.If there are multiple answers, you can print any of them.

The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5, 1 \le k \le 26$$$) — the length of the string and the number of distinct characters required. The second line of the input contains $$$n$$$ integers $$$p_1, p_2, \dots, p_n$$$ ($$$1 \le p_i \le n$$$, all $$$p_i$$$ are distinct integers from $$$1$$$ to $$$n$$$) — the permutation $$$p$$$. The third line of the input contains $$$n$$$ integers $$$q_1, q_2, \dots, q_n$$$ ($$$1 \le q_i \le n$$$, all $$$q_i$$$ are distinct integers from $$$1$$$ to $$$n$$$) — the permutation $$$q$$$.

If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$s$$$ on the second line. It should consist of $$$n$$$ lowercase Latin letters, contain at least $$$k$$$ distinct characters and suit the given permutations. If there are multiple answers, you can print any of them.

package main
import "fmt"
import "os"
import "bufio"

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

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

    var n, k int
    fmt.Fscanf(input, "%d%d\n", &n, &k)

    p := make([]int, n+1)
    q := make([]int, n+1)
    pos := make([]int, n+1)

    for i:=1; i<=n; i++ {
        fmt.Fscanf(input, "%d", &p[i])
    }
    fmt.Fscanf(input, "\n")
    for i:=1; i<=n; i++ {
        fmt.Fscanf(input, "%d", &q[i])
        pos[q[i]] = i
    }

    var r int = 1
    var ans []int
    for i:=1; i<=n; i++ {
        r = max(r, pos[p[i]])
        if r==i {
            ans = append(ans, i)
            r = i+1
        }
    }

    if len(ans)<k {
        fmt.Printf("NO\n")
        return
    }

    l := 1
    ans[k-1] = n
    str := make([]byte, n)
    for i:=0; i<k; i++ {
        ch := byte(i+97)
        for j:=l; j<=ans[i]; j++ {
            str[p[j]-1] = ch
        }
        l = ans[i]+1
    }
    fmt.Printf("YES\n")
    fmt.Println(string(str))
}


There is a string $$$s$$$ of length $$$3$$$, consisting of uppercase and lowercase English letters. Check if it is equal to "YES" (without quotes), where each letter can be in any case. For example, "yES", "Yes", "yes" are all allowable.

The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^3$$$) — the number of testcases. The description of each test consists of one line containing one string $$$s$$$ consisting of three characters. Each character of $$$s$$$ is either an uppercase or lowercase English letter.

For each test case, output "YES" (without quotes) if $$$s$$$ satisfies the condition, and "NO" (without quotes) otherwise. You can output "YES" and "NO" in any case (for example, strings "yES", "yes" and "Yes" will be recognized as a positive response).

10

YES

yES

yes

Yes

YeS

Noo

orZ

yEz

Yas

XES

NoteThe first five test cases contain the strings "YES", "yES", "yes", "Yes", "YeS". All of these are equal to "YES", where each character is either uppercase or lowercase.

package main

import (
	"fmt"
	"strings"
)

import (
	"bufio"
	"os"
)

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

func ReadInt() int{
	var i int
	fmt.Fscan(in, &i)
	return i
}

func ReadIntArray(N int) []int{
	ans := make([]int, N)
	for i := 0; i < N; i++{
		fmt.Fscan(in, &ans[i])
	}
	return ans
}

func ReadString() string{
	var s string
	fmt.Fscan(in, &s)
	return s
}

func ReadStringArray(N int) []string{
	ans := make([]string, N)
	for i := 0; i < N; i++{
		fmt.Fscan(in, &ans[i])
	}
	return ans
}

func main(){
	defer out.Flush()
	testCases := ReadInt()
	for ; testCases > 0; testCases--{
		S := ReadString()
		ans := "YES"
		if strings.ToLower(S) != "yes"{
			ans = "NO"
		}
		fmt.Fprintln(out, ans)
	}
}

package main

import (
	"fmt"
	"strings"
)

func ReadInt() int{
	var i int
	fmt.Scanf("%d\n", &i)
	return i
}

func ReadArray(N int) []int{
	ans := make([]int, N)
	for i := 0; i < N; i++{
		fmt.Scanf("%d", &ans[i])
	}
	return ans
}

func ReadString() string{
	var s string
	fmt.Scanf("%s\n", &s)
	return s
}

func main(){
	testCases := ReadInt()
	for ; testCases > 0; testCases--{
		s := ReadString()
		ans := "NO"
		if strings.ToLower(s) == "yes"{
			ans = "YES"
		}
		fmt.Println(ans)
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	input := make([]string, t)
	for i := range input {
		fmt.Scanf("%s\n", &input[i])
	}
	for _, v := range input {
		if strings.ToLower(v) == "yes" {
			fmt.Println("YES")
			continue
		}
		fmt.Println("NO")
	}
}

package main

import (
    "fmt"
    "strings"
)

func main() {
    tt := 0
    fmt.Scan(&tt)
    var s string
    for i := 1; i <= tt; i++ {
        fmt.Scan(&s)
        s = strings.ToLower(s)
        if s == "yes" {
            fmt.Println("YES")
        } else {
            fmt.Println("NO")
        }
    }

}

package main

import (
    "fmt"
    "strings"
)

func main() {
    tt := 0
    fmt.Scan(&tt)
    var str string
    for i := 1; i <= tt; i++ {
        fmt.Scan(&str)
        str = strings.ToLower(str)
        if str == "yes" {
            fmt.Println("YES")
        } else {
            fmt.Println("NO")
        }
    }

}

// To execute Go code, please declare a func main() in a package "main"

package main

import (
	"fmt"
	"strings"
)

func main() {
	n := 0
	fmt.Scanln(&n)
	 result := []string{}
	for i := 0; i < n; i++ {
		var input string
		fmt.Scanln(&input)
		if strings.ToLower(input) == "yes" {
			result = append(result, "YES")
		} else {
			result = append(result, "NO")
		}
	}

	for i := 0; i < n; i++ {
		fmt.Printf("%s\n",result[i])
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var a int
	var b string
	fmt.Scan(&a)
	for i := 0; i < a; i++ {
		fmt.Scan(&b)
		if strings.ToUpper(b) == "YES" {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

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

func solve() {
	s := _readStr()
	if strings.EqualFold(s, "yes") {
		_print("YES")
	} else {
		_print("NO")
	}
}

func main() {
	defer out.Flush()
	var t int
	for fmt.Fscanln(in, &t); t > 0; t-- {
		solve()
	}
}

// ====
func _readInt() int {
	var x int
	fmt.Fscan(in, &x)
	return x
}
func _readStr() string {
	var x string
	fmt.Fscan(in, &x)
	return x
}
func _readArr() (int, []int) {
	var n int
	fmt.Fscan(in, &n)
	var v = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &v[i])
	}
	return n, v
}
func _print(x ...any) {
	fmt.Fprintln(out, x...)
}
func _max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func _min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func _abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}
func _sortStr(x string) string {
	r := []rune(x)
	sort.Slice(r, func(i, j int) bool {
		return r[i] < r[j]
	})
	return string(r)
}
func _reverseInts(x []int) {
	n := len(x)
	for i := 0; i < n/2; i++ {
		x[i], x[n-1-i] = x[n-1-i], x[i]
	}
}
func _reverseStr(s string) string {
	x := []rune(s)
	n := len(x)
	for i := 0; i < n/2; i++ {
		x[i], x[n-1-i] = x[n-1-i], x[i]
	}
	return string(x)
}

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

import (
	"fmt"
	"strings"
)

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

	for i := 0; i < n; i++ {
		var s string
		fmt.Scan(&s)
		if strings.ToUpper(s) == "YES" {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var i int
	fmt.Scan(&i)
	var lawda string
	for i != 0 {
		fmt.Scan(&lawda)
		if strings.ToLower(lawda) == "yes" {
			fmt.Println("YES")
		}else {
			fmt.Println("NO")
		}
		i--
	}
}

package main

import (
	"fmt"
	"strings"
)

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

	for i := 0; i < t; i++ {
		var s string

		fmt.Scan(&s)

		if strings.ToUpper(s) == "YES" {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var (
		t int
		s string
	)
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		fmt.Scanf("%s\n", &s)
		s = strings.ToLower(s)
		if s == "yes" {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var n int
	var s string
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&s)
		s = strings.ToLower(s)
		if s == "yes" {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
	"strings"
)

// https://codeforces.com/problemset/problem/1703/A
func main() {
	var t int
	_, _ = fmt.Scan(&t)
	for t > 0 {
		var s string
		_, _ = fmt.Scan(&s)
		if strings.ToLower(s) == "yes" {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
		t--
	}
}

package main
import (
	"fmt"
	"strings"
)
func main() {
	var n int
	fmt.Scan(&n)
	for i:=0;i<n;i++{
		var x string
		fmt.Scan(&x)
		if strings.ToLower(x) == "yes" {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var str string
	var T int
	fmt.Scan(&T)
	for Case := 1; Case <= T; Case++ {
		fmt.Scan(&str)
		str = strings.ToLower(str)
		if str == "yes" {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

func solve(r *bufio.Reader) {
	var n string
	fmt.Fscan(r, &n)

	if strings.EqualFold(n, "yes") {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}
func main() {
	r := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(r, &n)
	for i := 0; i < n; i++ {
		solve(r)
	}
}

package main

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

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

	var buf bytes.Buffer

	tc := readNum(reader)

	for tc > 0 {
		tc--
		word := readString(reader)
		res := solve(word)
		if res {
			buf.WriteString("YES\n")
		} else {
			buf.WriteString("NO\n")
		}
	}

	fmt.Print(buf.String())
}

func readString(reader *bufio.Reader) string {
	s, _ := reader.ReadString('\n')
	for i := 0; i < len(s); i++ {
		if s[i] == '\n' || s[i] == '\r' {
			return s[:i]
		}
	}
	return s
}

func normalize(s string) string {

	for i := len(s); i > 0; i-- {
		if s[i-1] >= 'a' && s[i-1] <= 'z' {
			return s[:i]
		}
	}
	return ""
}

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 solve(word string) bool {
	word = strings.ToLower(word)
	return word == "yes"
}

package main

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

func main() {
	cin := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(cin, &t)
	for i := 0; i < t; i++ {
		var s string
		fmt.Fscan(cin, &s)
		s = strings.ToUpper(s)
		if s == "YES" {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

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

	var t int
	var s string

	fmt.Fscan(in, &t)

	for i := 0; i < t; i++ {
		fmt.Fscan(in, &s)

		if (s[0] == 'Y' || s[0] == 'y') && (s[1] == 'E' || s[1] == 'e') && (s[2] == 'S' || s[2] == 's') {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}

}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	var n int
	fmt.Scan(&n)
	for n>0 {
		fmt.Scan(&s)
		s=strings.ToLower(s)
		if s=="yes"{
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
		n--
	}

}

package main

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

var (
	reader = bufio.NewReader(os.Stdin)
	t      int
	s      string
)

func solve(s string) string {
	var x = strings.ToLower(s)
	if x == "yes" {
		return "YES"
	}
	return "NO"
}

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		fmt.Fscan(reader, &s)
		fmt.Println(solve(s))
	}
}

package main

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

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

func scan(a ...interface{}) {
	fmt.Fscan(in, a...)
}
func printf(f string, a ...interface{}) {
	fmt.Fprintf(out, f, a...)
}

func solve() {
	var s string
	scan(&s)
	if "YES" == strings.ToUpper(s) {
		printf("YES\n")
	} else {
		printf("NO\n")
	}

}
func main() {
	defer out.Flush()
	n := 0
	scan(&n)
	for i := 0; i < n; i++ {
		solve()
	}
}

package main

import (
	"fmt"
	"strings"
)

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

	for i := 0; i < t; i++ {
		var c string
		fmt.Scan(&c)

		c = strings.ToLower(c)
		if c == "yes" {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

const mod = 998244353
const mx = int64(1e9 + 7)

func solve(in *bufio.Reader, out *bufio.Writer) {
	defer out.Flush()
	var s string
	fmt.Fscan(in, &s)
	compare := strings.Compare(strings.ToLower(s), "yes")
	if compare == 0 {
		fmt.Fprintln(out, "Yes")
	} else {
		fmt.Fprintln(out, "No")
	}
}

func abs(a int64) int64 {
	if a > 0 {
		return a
	}
	return -a
}
func sum(a, b int64) int64 {
	return (b + a) * (b - a + 1) / 2
}

func max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}
func min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func gcd(a, b int) int {
	if a%b == 0 {
		return b
	}
	return gcd(b, a%b)
}

func main() {
	stdin := os.Stdin
	stdout := os.Stdout
	in := bufio.NewReader(stdin)
	out := bufio.NewWriter(stdout)
	n := 1
	fmt.Fscan(in, &n)
	for i := 0; i < n; i++ {
		solve(in, out)
	}
}

package main

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

func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	// 读入一行数据
	// s, _ := in.ReadString('\n')
	out := bufio.NewWriter(_w)
	defer out.Flush()
	solve := func() {
		var s string
		fmt.Fscan(in, &s)
		if strings.EqualFold("yes", s) {
			fmt.Fprintln(out, "YES")
		}else{
			fmt.Fprintln(out, "NO")
		}
	}

	var t int
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		solve()
	}
}
func main() {
	run(os.Stdin, os.Stdout)
}

package main

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

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

func (in *CF1703A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1703A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

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

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

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

/**
Run solve the problem CF1703A
Date: 13/07/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1703/A
Problem: CF1703A
**/
func (in *CF1703A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		if strings.ToLower(in.NextString()) == "yes" {
			fmt.Println("YES")
		}else {
			fmt.Println("NO")
		}
	}
}

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

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

package main

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

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

func slove() {
	var s string
	fmt.Fscan(rr, &s)
	if strings.ToLower(s) == "yes" {
		fmt.Fprintln(ww, "YES")
	} else {
		fmt.Fprintln(ww, "NO")
	}
}

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

package main

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

// https://space.bilibili.com/206214
func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var T int
	var s string
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &s)
		if strings.ToLower(s) == "yes" {
			Fprintln(out, "YES")
		} else {
			Fprintln(out, "NO")
		}
	}
}

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

package main

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

func setOs() {
	//os.Stdin, err = os.OpenFile("input.txt", os.RDONLY|os.O_CREATE, 0666)
	//os.Stdout, err = os.OpenFile("output.txt", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)
	_, err := os.Stat("input.txt")
	if err == nil {
		os.Stdin, _ = os.OpenFile("input.txt", os.O_RDONLY|os.O_CREATE, 0666)
	}
}

func main() {
	setOs()
	var t int
	fmt.Scan(&t)
	for i := 0; i < t; i++ {
		var s string
		fmt.Scan(&s)
		if strings.ToUpper(s) == "YES" {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

func check(s string) bool {
	return strings.ToLower(s) == "yes"
}

func main() {
	// f, _ := os.Open("input.txt")
	t := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(t, &n)
	for i := 0; i < n; i++ {
		var s string
		fmt.Fscan(t, &s)
		if check(s) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}

	}
}

package main

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

func main() {
	var(
		t int
		input string
	)
	reader := bufio.NewReader(os.Stdin)
	fmt.Fscanf(reader, "%d\n", &t)

	for i:=0;i<t;i++ {
		fmt.Fscanf(reader, "%s\n", &input)
		Arr := []byte(input)
		if (Arr[0] == 89 || Arr[0] == 121) && (Arr[1] == 69 || Arr[1] == 101) && (Arr[2] == 83 || Arr[2] == 115) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

//package main
//
//import (
//	"context"
//	"gerRpc"
//	"gerRpc/xclient"
//	"log"
//	"sync"
//
//	"net"
//	"time"
//)
//
////
////func startServer(addr chan string)  {
////	l, err := net.Listen("tcp", ":0")
////	if err != nil{
////		log.Fatal("network error:", err)
////	}
////	log.Println("start rpc server on:", l.Addr())
////	addr <- l.Addr().String()
////	gerRpc.Accept(l)
////}
////
////func main()  {
////
////	//addr := make(chan string)
////	//go startServer(addr)
////	//client, _ := gerRpc.Dial("tcp", <-addr)
////	//defer func() {_ = client.Close()}()
////
////	//time.Sleep(time.Second)
////	//var wg sync.WaitGroup
////	//for i := 0; i < 5; i ++{
////	//	wg.Add(1)
////	//	go func(i int) {
////	//		defer wg.Done()
////	//		args := fmt.Sprintf("geerpc req %d", i)
////	//		var reply string
////	//		if err := client.Call("Foo.sum", args, &reply); err != nil{
////	//			log.Fatal("call Foo.Sum error:", err)
////	//		}
////	//		log.Println("reply")
////	//	}(i)
////	//}
////	//wg.Wait()
////}
//
////
////func main() {
////	addr := make(chan string)
////	go startServer(addr)
////
////	// in fact, following code is like a simple geerpc client
////	conn, _ := net.Dial("tcp", <-addr)
////	defer func() { _ = conn.Close() }()
////
////	time.Sleep(time.Second)
////	// send options
////	_ = json.NewEncoder(conn).Encode(gerRpc.DefaultOption)
////	cc := codec.NewGobCodec(conn)
////	// send request & receive response
////	for i := 0; i < 5; i++ {
////		h := &codec.Header{
////			ServiceMethod: "Foo.Sum",
////			Seq:           uint64(i),
////		}
////		_ = cc.Write(h, fmt.Sprintf("geerpc req %d", h.Seq))
////		_ = cc.ReadHeader(h)
////		var reply string
////		_ = cc.ReadBody(&reply)
////		log.Println("reply:", reply)
////	}
////}
////
////
////type Foo int
////
////type Args struct {
////	Num1, Num2 int
////}
////
////func (f Foo)Sum(args Args, reply *int)error  {
////	*reply = args.Num1 + args.Num2
////	return nil
////}
////func startServer(addr chan string) {
////	var foo Foo
////	if err := gerRpc.Register(&foo); err != nil {
////		log.Fatal("register error:", err)
////	}
////	// pick a free port
////	l, err := net.Listen("tcp", ":0")
////	if err != nil {
////		log.Fatal("network error:", err)
////	}
////	log.Println("start rpc server on", l.Addr())
////	addr <- l.Addr().String()
////	gerRpc.Accept(l)
////}
////
////func main()  {
////	log.SetFlags(0)
////	addr := make(chan string)
////	go startServer(addr)
////	client, _ := gerRpc.Dial("tcp", <-addr)
////	defer func() {_ = client.Close()}()
////
////	time.Sleep(time.Second)
////	var wg sync.WaitGroup
////	for i := 0; i < 5; i ++{
////		wg.Add(1)
////		go func(i int) {
////			defer wg.Done()
////			args := &Args{
////				Num1: i,
////				Num2: i * i,
////			}
////			ctx, _ := context.WithTimeout(context.Background(), time.Second)
////			var reply int
////			if err := client.Call(ctx,"Foo.Sum", args, &reply); err != nil{
////				log.Fatal("call Foo.Sum error:", err)
////			}
////			log.Printf("%d + %d = %d", args.Num1, args.Num2, reply)
////		}(i)
////	}
////	wg.Wait()
////}
//type Foo int
//
//type Args struct{ Num1, Num2 int }
//
//func (f Foo) Sum(args Args, reply *int) error {
//	*reply = args.Num1 + args.Num2
//	return nil
//}
//
//func (f Foo) Sleep(args Args, reply *int) error {
//	time.Sleep(time.Second * time.Duration(args.Num1))
//	*reply = args.Num1 + args.Num2
//	return nil
//}
//
//func startServer(addrCh chan string) {
//	var foo Foo
//	l, _ := net.Listen("tcp", ":0")
//	server := gerRpc.NewServer()
//	_ = server.Register(&foo)
//	addrCh <- l.Addr().String()
//	server.Accept(l)
//}
//
//func foo(xc *xclient.Xclient, ctx context.Context, typ, serviceMethod string, args *Args)  {
//	var reply int
//	var err error
//	switch typ {
//	case "call":
//		err = xc.Call(ctx, serviceMethod, args, &reply)
//	case "broadcast":
//		err = xc.Broadcast(ctx, serviceMethod, args, &reply)
//	}
//	if err != nil{
//		log.Printf("%s %s error: %v", typ, serviceMethod, err)
//	}else{
//		log.Printf("%s %s success: %d + %d = %d", typ, serviceMethod, args.Num1, args.Num2, reply)
//	}
//}
//
//func call(addr1, addr2 string)  {
//	d := xclient.NewMultiServerDiscovery([]string{"tcp@"+addr1, "tcp@"+addr2})
//	xc := xclient.NewXClient(d, xclient.RandomSelect, nil)
//	defer func() {_ = xc.Close()}()
//
//	var wg sync.WaitGroup
//	for i := 0; i < 5; i ++{
//		wg.Add(1)
//		go func(i int) {
//			defer wg.Done()
//			foo(xc, context.Background(), "call", "Foo.Sum", &Args{
//				Num1: i,
//				Num2: i * i,
//			})
//		}(i)
//	}
//	wg.Wait()
//}
//
//func broadcast(addr1, addr2 string) {
//	d := xclient.NewMultiServerDiscovery([]string{"tcp@" + addr1, "tcp@" + addr2})
//	xc := xclient.NewXClient(d, xclient.RandomSelect, nil)
//	defer func() { _ = xc.Close() }()
//	var wg sync.WaitGroup
//	for i := 0; i < 5; i++ {
//		wg.Add(1)
//		go func(i int) {
//			defer wg.Done()
//			foo(xc, context.Background(), "broadcast", "Foo.Sum", &Args{Num1: i, Num2: i * i})
//			// expect 2 - 5 timeout
//			ctx, _ := context.WithTimeout(context.Background(), time.Second*2)
//			foo(xc, ctx, "broadcast", "Foo.Sleep", &Args{Num1: i, Num2: i * i})
//		}(i)
//	}
//	wg.Wait()
//}
//
//
//func main() {
//	log.SetFlags(0)
//	ch1 := make(chan string)
//	ch2 := make(chan string)
//	// start two servers
//	go startServer(ch1)
//	go startServer(ch2)
//
//	addr1 := <-ch1
//	addr2 := <-ch2
//
//	time.Sleep(time.Second)
//	call(addr1, addr2)
//	broadcast(addr1, addr2)
//}

package main

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

var in = bufio.NewReader(os.Stdin)

func main()  {
	var T int
	fmt.Fscan(in, &T)
	for ;T > 0; T--{
		var str string
		fmt.Fscan(in, &str)

		if strings.EqualFold(strings.ToLower(str), "yes"){
			fmt.Println("YES")
		}else{
			fmt.Println("NO")
		}
	}
}

package main

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

func checkYes(str string) string {
	if (str[0] == 'y' || str[0] == 'Y') &&
		(str[1] == 'e' || str[1] == 'E') &&
		(str[2] == 's' || str[2] == 'S') {
		return "YES"
	}
	return "NO"
}

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 16*1024*1024)
	T, err := strconv.Atoi(strings.TrimSpace(readLine(reader)))
	checkError(err)
	var results = make([]string, T)
	for i := 0; i < T; i++ {
		str := strings.TrimSpace(readLine(reader))
		results[i] = checkYes(str)
	}
	for _, result := range results {
		fmt.Println(result)
	}
}

func readLine(reader *bufio.Reader) string {
	str, _, err := reader.ReadLine()
	if err != nil {
		return ""
	}
	return strings.TrimRight(string(str), "\r\n")
}

func checkError(err error) {
	if err != nil {
		panic(err)
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var (
		n int
		s string
	)
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&s)
		s = strings.ToLower(s)
		if s == "yes" {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

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

	var T int
	for fmt.Fscan(in, &T); T > 0; T-- {
		var s string
		fmt.Fscan(in, &s)
		if (s == "yES") || (s == "Yes") || (s == "yes") || (s == "YEs") || (s == "YES") || (s == "yEs") || (s == "yeS" || (s == "YeS")) {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

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

package main

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

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

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

		if strings.ToUpper(s) == "YES" {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}
	}
}

package main

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

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

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

func rw(r io.Reader, w io.Writer) {
	var t int
	fmt.Fscan(r, &t)
	for ti := 0; ti < t; ti++ {
		var s string
		fmt.Fscan(r, &s)
		w1 := do(s)
		fmt.Fprintln(w, w1)
	}
}

func do(m string) string {
	s := strings.ToUpper(m)
	if s == "YES" {
		return s
	}
	return "NO"
}

// 1703A. YES or YES?
package main

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

func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var s string
		fmt.Fscan(reader, &s)
		if strings.ToLower(s) == "yes" {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

import (
	"fmt"
	"strings"
)

func ReadInt() int{
	var i int
	fmt.Scanf("%d\n ", &i)
	return i
}

func ReadArray(N int) []int{
	ans := make([]int, N)
	for i := 0; i < N; i++{
		fmt.Scanf("%d", &ans[i])
	}
	return ans
}

func ReadString() string{
	var s string
	fmt.Scanf("%s\n", &s)
	return s
}

func main(){
	testCases := ReadInt()
	for ; testCases > 0; testCases--{
		s := ReadString()
		ans := "NO"
		if strings.ToLower(s) == "yes"{
			ans = "YES"
		}
		fmt.Println(ans)
	}
}

package main

import (
	"fmt"
	"strings"
)

func ReadInt() int{
	var i int
	fmt.Scanf("%d", &i)
	return i
}

func ReadArray(N int) []int{
	ans := make([]int, N)
	for i := 0; i < N; i++{
		ans[i] = ReadInt()
	}
	return ans
}

func ReadString() string{
	var s string
	fmt.Scanf("%s", &s)
	return s
}

func main(){
	testCases := ReadInt()
	for ; testCases > 0; testCases--{
		s := ReadString()
		ans := "NO"
		if strings.ToLower(s) == "yes"{
			ans = "YES"
		}
		fmt.Println(ans)
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	input := make([]string, t)
	for i := range input {
		fmt.Scanf("%d\n", &input[i])
	}
	for _, v := range input {
		if strings.ToLower(v) == "yes" {
			fmt.Println("YES")
			continue
		}
		fmt.Println("NO")
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	input := make([]string, t)
	for _, v := range input {
		if strings.ToLower(v) == "yes" {
			fmt.Println("YES")
			continue
		}
		fmt.Println("NO")
	}
}

package main

import (
    "fmt"
    "strings"
)

func main() {
    tt := 0
    fmt.Scan(&tt)
    var str string
    for i := 1; i <= tt; i++ {
        fmt.Scan(&str)
        str = strings.ToLower(str)
        if str == "yes" {
            println("YES")
        } else {
            println("NO")
        }
    }

}

// To execute Go code, please declare a func main() in a package "main"

package main

import (
	"fmt"
	"strings"
)

func main() {
	n := 0
	fmt.Scanln(&n)
	var result = make([]string, n)
	for i := 0; i < n; i++ {
		var input string
		fmt.Scanln(&input)
		if strings.ToLower(input) == "yes" {
			result = append(result, "YES")
		} else {
			result = append(result, "NO")
		}
	}

	for i := 0; i < n; i++ {
		fmt.Println(result[i])
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var a int
	var b string
	fmt.Scan(&a, &b)
	for i := 0; i < a; i++ {
		fmt.Scan(&b)
		if strings.ToUpper(b) == "YES" {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

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

func solve() {
	s := _readStr()
	if strings.EqualFold(s, "yes") {
		_print("YES")
	} else {
		_print("NO")
	}
}

func main() {
	defer out.Flush()
	var t int
	for fmt.Fscanln(in, &t); t > 0; t-- {
		solve()
	}
}

// ====
func _readInt() int {
	var x int
	fmt.Fscan(in, &x)
	return x
}
func _readStr() string {
	var x string
	fmt.Fscan(in, &x)
	return x
}
func _readArr() (int, []int) {
	var n int
	fmt.Fscan(in, &n)
	var v = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &v[i])
	}
	return n, v
}
func _print(x ...any) {
	fmt.Fprintln(out, x)
}
func _max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func _min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func _abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}
func _sortStr(x string) string {
	r := []rune(x)
	sort.Slice(r, func(i, j int) bool {
		return r[i] < r[j]
	})
	return string(r)
}
func _reverseInts(x []int) {
	n := len(x)
	for i := 0; i < n/2; i++ {
		x[i], x[n-1-i] = x[n-1-i], x[i]
	}
}
func _reverseStr(s string) string {
	x := []rune(s)
	n := len(x)
	for i := 0; i < n/2; i++ {
		x[i], x[n-1-i] = x[n-1-i], x[i]
	}
	return string(x)
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var i int
	fmt.Scan(&i)
	var lawda string
	for i != 0 {
		fmt.Scan(&lawda)
		if strings.ToLower(lawda) == "yes" {
			fmt.Println("YES")
		}else {
			println("NO")
		}
		i--
	}
}


An African crossword is a rectangular table n × m in size. Each cell of the table contains exactly one letter. This table (it is also referred to as grid) contains some encrypted word that needs to be decoded.To solve the crossword you should cross out all repeated letters in rows and columns. In other words, a letter should only be crossed out if and only if the corresponding column or row contains at least one more letter that is exactly the same. Besides, all such letters are crossed out simultaneously.When all repeated letters have been crossed out, we should write the remaining letters in a string. The letters that occupy a higher position follow before the letters that occupy a lower position. If the letters are located in one row, then the letter to the left goes first. The resulting word is the answer to the problem.You are suggested to solve an African crossword and print the word encrypted there.

The first line contains two integers n and m (1 ≤ n, m ≤ 100). Next n lines contain m lowercase Latin letters each. That is the crossword grid.

Print the encrypted word on a single line. It is guaranteed that the answer consists of at least one letter.

package main

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

var scanner *bufio.Scanner

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

func main() {
  scanner = bufio.NewScanner(os.Stdin)
  scanner.Split(bufio.ScanWords)
  writer := bufio.NewWriter(os.Stdout)
  defer writer.Flush()

  n, m := getI(), getI()
  mark := make([][]bool, n)
  rows := make([]string, n)
  for r := range rows {
    rows[r] = getS()
    mark[r] = make([]bool, m)
  }
  for r := range rows {
    seen := map[byte]int{}
    for c := 0; c < m; c++ {
      ch := rows[r][c]
      if seen[ch] != 0 {
        mark[r][seen[ch]-1] = true
        mark[r][c] = true
      } else {
        seen[ch] = c+1
      }
    }
  }
  for c := 0; c < m; c++ {
    seen := map[byte]int{}
    for r := range rows {
      ch := rows[r][c]
      if seen[ch] != 0 {
        mark[seen[ch]-1][c] = true
        mark[r][c] = true
      } else {
        seen[ch] = r+1
      }
    }
  }
  chars := []byte{}
  for r := range rows {
    for c := 0; c < m; c++ {
      if !mark[r][c] {
        chars = append(chars, rows[r][c])
      }
    }
  }
  writer.WriteString(fmt.Sprintf("%s\n", string(chars)))
}

package main

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

const MAX_NM = 100
const MAX_CHAR = int('z') + 1

func main() {
	reader := NewStdReader(os.Stdin)

	n, m := reader.ReadInt(), reader.ReadInt()

	countRow := [MAX_NM][MAX_CHAR]byte{}
	countCol := [MAX_NM][MAX_CHAR]byte{}

	table := [MAX_NM][MAX_NM]byte{}

	for i := 0; i < n; i++ {
		for j := 0; j < m; j++ {
			c := reader.ReadChar()
			table[i][j] = c
			countRow[i][c]++
			countCol[j][c]++
		}
	}

	for i := 0; i < n; i++ {
		for j := 0; j < m; j++ {
			c := table[i][j]

			if countRow[i][c] == 1 && countCol[j][c] == 1 {
				fmt.Print(string(c))
			}
		}
	}
}

type StdReader struct {
	buf *bufio.Reader
}

func NewStdReader(reader io.Reader) *StdReader {
	return &StdReader{bufio.NewReaderSize(reader, 20*1024*1024)}
}

func (std *StdReader) ReadInt() int {

	r := 0
	sign := 1
	ok := false

	for {
		b, e := std.buf.ReadByte()

		if e != nil {
			break
		}
		if b >= '0' && b <= '9' {
			r = r*10 + int(b-'0')
			ok = true
		} else {
			if ok {
				break
			} else {
				if b == '-' {
					sign = -sign
				}
			}
		}
	}

	return sign * r
}

func (std *StdReader) ReadChar() byte {
	for {
		b, e := std.buf.ReadByte()

		if e != nil {
			break
		}

		if b >= 'a' && b <= 'z' {
			return b
		}
	}

	return 0
}


Let's call a number k-good if it contains all digits not exceeding k (0, ..., k). You've got a number k and an array a containing n numbers. Find out how many k-good numbers are in a (count each number every time it occurs in array a).

The first line contains integers n and k (1 ≤ n ≤ 100, 0 ≤ k ≤ 9). The i-th of the following n lines contains integer ai without leading zeroes (1 ≤ ai ≤ 109).

Print a single integer — the number of k-good numbers in a.

package main

import (
	"fmt"
)

func main() {
	var n,k int
	var s string
	var c [10]int

	fmt.Scan(&n,&k)
	t:=0
	for i:=0;i<n;i++ {
		fmt.Scan(&s)
		b:=1
		for j:=0;j<10;j++ {
			c[j]=0
		}
		for k:=0;k<len(s);k++ {
			c[s[k]-'0']=1
		}
		for j:=0;j<=k;j++ {
			if c[j]==0 {
				b=0
				break
			}
		}
		t+=b
	}
	fmt.Println(t)
}

// http://codeforces.com/problemset/problem/365/A
// A. Good Number

package main

import (
	"fmt"
)

var (
	frek [11]byte
)

func isGood(x string, k int32) bool {
	var i int32
	for i = 0; i < 10; i++ {
		frek[i] = 0
	}
	for _, xi := range x {
		frek[xi-'0']++
	}
	for i = 0; frek[i] > 0; i++ {
	}
	return i > k
}

func main() {
	var (
		n, k, ng, i int32
		x           string
	)

	fmt.Scan(&n)
	fmt.Scan(&k)
	for i = 0; i < n; i++ {
		fmt.Scan(&x)
		if isGood(x, k) {
			ng++
		}
	}
	fmt.Println(ng)

}

package main

import "fmt"

func main() {
    var n,k int
    var s string
    fmt.Scan(&n,&k)
    ans := 0
    for i := 0; i < n; i++ {
        fmt.Scan(&s)
        digit, ok := [10]bool{}, true
        for _, v := range s { digit[v-'0'] = true }
        for i := 0; i <= k; i++ {
            if !digit[i] { ok = false; break }
        }
        if ok { ans++ }
    }
    fmt.Println(ans)
}

package main

import (
    "fmt"
)

func is_k(v, k int) bool {
    var has [11]int
    for ;; {
        var idx int
        idx = v % 10
        v /= 10
        //if idx > k { return false}
        has[idx] = 1
        if (v == 0) { break }

    }

    for i := 0; i <= k;i++ {
        if (has[i] == 0) { return false }
    }
    return true
}

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

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

        if is_k(v, k) { ans++ }
    }

    fmt.Printf("%d\n", ans)
}

package main

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

type Scanner struct {
	r            io.Reader
	split        bufio.SplitFunc
	maxTokenSize int
	token, buf   []byte
	start, end   int
}

func NewScanner(r io.Reader) *Scanner {
	return &Scanner{
		r:            r,
		split:        bufio.ScanWords,
		maxTokenSize: 16777216,
		buf:          make([]byte, 4096),
	}
}

func (s *Scanner) advance(n int) bool {
	if n < 0 || n > s.end-s.start {
		return false
	}
	s.start += n
	return true
}

func (s *Scanner) Text() string {
	return string(s.token)
}

func (s *Scanner) Scan() bool {
	for {
		if s.end > s.start {
			advance, token, err := s.split(s.buf[s.start:s.end], false)
			if err != nil || !s.advance(advance) {
				return false
			}
			s.token = token
			if token != nil {
				return true
			}
		}
		if s.start > 0 && (s.end == len(s.buf) || s.start > len(s.buf)/2) {
			copy(s.buf, s.buf[s.start:s.end])
			s.end -= s.start
			s.start = 0
		}
		if s.end == len(s.buf) {
			if len(s.buf) >= s.maxTokenSize {
				return false
			}
			newSize := len(s.buf) * 2
			if newSize > s.maxTokenSize {
				newSize = s.maxTokenSize
			}
			newBuf := make([]byte, newSize)
			copy(newBuf, s.buf[s.start:s.end])
			s.buf = newBuf
			s.end -= s.start
			s.start = 0
			continue
		}
		for loop := 0; ; {
			n, _ := s.r.Read(s.buf[s.end:len(s.buf)])
			s.end += n
			if n > 0 {
				break
			}
			loop++
			if loop > 100 {
				break
			}
		}
	}
}

func (s *Scanner) Split(split bufio.SplitFunc) {
	s.split = split
}

var w *bufio.Writer = bufio.NewWriter(os.Stdout)
var sc *Scanner = NewScanner(os.Stdin)

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

func ni32() int {
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	return n
}

func ni64() int64 {
	sc.Scan()
	n, _ := strconv.ParseInt(sc.Text(), 10, 64)
	return n
}

func pri32(i ...int) {
	for _, ii := range i {
		w.WriteString(strconv.Itoa(ii))
		sp()
	}
}
func pri64(i ...int64) {
	for _, ii := range i {
		w.WriteString(strconv.FormatInt(ii, 10))
		sp()
	}
}
func sp()   { w.WriteByte(' ') }
func endl() { w.WriteByte('\n') }

func min(i, j int) int {
	if i < j {
		return i
	}
	return j
}

func max(i, j int64) int64 {
	if i > j {
		return i
	}
	return j
}

func main() {
	defer w.Flush()
	n, k := ni32(), uint(ni32())
	ans := 0
	goodmask := int(1<<(k+1) - 1)

	good := func(n int) bool {
		mask := 0
		for ; n > 0; n /= 10 {
			mask |= 1 << uint(n%10)
		}
		return mask&goodmask == goodmask
	}

	for i := 0; i < n; i++ {
		if good(ni32()) {
			ans++
		}
	}
	pri32(ans)
}

package main

import (
	"fmt"
)

func main() {
	var n,k int
	var s string
	var c [10]int

	fmt.Scan(&n,&k)
	t:=0
	for i:=0;i<n;i++ {
		fmt.Scan(&s)
		b:=1
		for j:=0;j<10;j++ {
			c[j]=0
		}
		for k,_ =range s {
			c[s[k]-'0']=1
		}
		for j:=0;j<=k;j++ {
			if c[j]==0 {
				b=0
				break
			}
		}
		t+=b
	}
	fmt.Println(t)
}

package main

import (
	"fmt"
)

func main() {
	var n,k int
	var s string
	var c [10]int

	fmt.Scan(&n,&k)
	t:=0
	for i:=0;i<n;i++ {
		fmt.Scan(&s)
		b:=1
		for j:=0;j<10;j++ {
			c[j]=0
		}
		for k,_ =range s {
			c[s[k]-'0']=1
		}
		for j:=0;j<=k;j++ {
			if c[j]!=0 {
				b=0
				break
			}
		}
		t+=b
	}
	fmt.Println(t)
}

package main

import (
    "fmt"
)

func is_k(v, k int) bool {
    var has [11]int
    for ;; {
        var idx int
        idx = v % 10
        v /= 10
        if idx > k { return false}
        has[idx] = 1
        if (v == 0) { break }

    }

    for i := 0; i <= k;i++ {
        if (has[i] == 0) { return false }
    }
    return true
}

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

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

        if is_k(v, k) { ans++ }
    }

    fmt.Printf("%d\n", ans)
}

package main

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

type Scanner struct {
	r            io.Reader
	split        bufio.SplitFunc
	maxTokenSize int
	token, buf   []byte
	start, end   int
}

func NewScanner(r io.Reader) *Scanner {
	return &Scanner{
		r:            r,
		split:        bufio.ScanWords,
		maxTokenSize: 16777216,
		buf:          make([]byte, 4096),
	}
}

func (s *Scanner) advance(n int) bool {
	if n < 0 || n > s.end-s.start {
		return false
	}
	s.start += n
	return true
}

func (s *Scanner) Text() string {
	return string(s.token)
}

func (s *Scanner) Scan() bool {
	for {
		if s.end > s.start {
			advance, token, err := s.split(s.buf[s.start:s.end], false)
			if err != nil || !s.advance(advance) {
				return false
			}
			s.token = token
			if token != nil {
				return true
			}
		}
		if s.start > 0 && (s.end == len(s.buf) || s.start > len(s.buf)/2) {
			copy(s.buf, s.buf[s.start:s.end])
			s.end -= s.start
			s.start = 0
		}
		if s.end == len(s.buf) {
			if len(s.buf) >= s.maxTokenSize {
				return false
			}
			newSize := len(s.buf) * 2
			if newSize > s.maxTokenSize {
				newSize = s.maxTokenSize
			}
			newBuf := make([]byte, newSize)
			copy(newBuf, s.buf[s.start:s.end])
			s.buf = newBuf
			s.end -= s.start
			s.start = 0
			continue
		}
		for loop := 0; ; {
			n, _ := s.r.Read(s.buf[s.end:len(s.buf)])
			s.end += n
			if n > 0 {
				break
			}
			loop++
			if loop > 100 {
				break
			}
		}
	}
}

func (s *Scanner) Split(split bufio.SplitFunc) {
	s.split = split
}

var w *bufio.Writer = bufio.NewWriter(os.Stdout)
var sc *Scanner = NewScanner(os.Stdin)

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

func ni32() int {
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	return n
}

func ni64() int64 {
	sc.Scan()
	n, _ := strconv.ParseInt(sc.Text(), 10, 64)
	return n
}

func pri32(i ...int) {
	for _, ii := range i {
		w.WriteString(strconv.Itoa(ii))
		sp()
	}
}
func pri64(i ...int64) {
	for _, ii := range i {
		w.WriteString(strconv.FormatInt(ii, 10))
		sp()
	}
}
func sp()   { w.WriteByte(' ') }
func endl() { w.WriteByte('\n') }

func min(i, j int) int {
	if i < j {
		return i
	}
	return j
}

func max(i, j int64) int64 {
	if i > j {
		return i
	}
	return j
}

func main() {
	defer w.Flush()
	n, k := ni32(), uint(ni32())
	ans := 0
	goodmask := int(1<<(k+1) - 1)

	good := func(n int) bool {
		mask := 0
		for ; n > 0; n /= 10 {
			mask |= 1 << uint(n%10)
		}
		return mask == goodmask
	}

	for i := 0; i < n; i++ {
		if good(ni32()) {
			ans++
		}
	}
	pri32(ans)
}


You are given a non-empty string s consisting of lowercase English letters. You have to pick exactly one non-empty substring of s and shift all its letters 'z'  'y'  'x'  'b'  'a'  'z'. In other words, each character is replaced with the previous character of English alphabet and 'a' is replaced with 'z'.What is the lexicographically minimum string that can be obtained from s by performing this shift exactly once?

The only line of the input contains the string s (1 ≤ |s| ≤ 100 000) consisting of lowercase English letters.

Print the lexicographically minimum string that can be obtained from s by shifting letters of exactly one non-empty substring.

NoteString s is lexicographically smaller than some other string t of the same length if there exists some 1 ≤ i ≤ |s|, such that s1 = t1, s2 = t2, ..., si - 1 = ti - 1, and si < ti.

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	re := regexp.MustCompile(`\r?\n`)

	if s, err := reader.ReadString('\n'); err != nil {
		if err != io.EOF {
			return
		}
	} else {
		s = re.ReplaceAllString(s, "")

		start := false
		stop := false

		for i := 0; i < len(s); i++ {
			if !start && i == len(s)-1 {
				p := s[i] - 1
				if p < 'a' {
					p = 'z'
				}
				fmt.Printf("%c", p)
				break
			}
			if stop {
				fmt.Printf("%c", s[i])
				continue
			}
			p := s[i] - 1
			if p < 'a' {
				p = s[i]
				if start {
					stop = true
				}
			} else {
				start = true
			}
			fmt.Printf("%c", p)
		}
		fmt.Println()
	}
}

package main

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

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

	in.Split(bufio.ScanWords)
	defer out.Flush()

	var x string
	fmt.Scan(&x)
	s := []byte(x)
	n := len(s)
	i := 0
	for (i < n) && (s[i] == 'a') {
		i++
	}
	if i >= n {
		s[i-1] = 'z'
	} else {
		for (i < n) && (s[i] != 'a') {
			s[i]--
			i++
		}
	}
	r := string(s)
	fmt.Print(r)
}

// Heap
type Node struct {
	name  int
	value int64
	index int
}

type NodeList []*Node

func (nodes NodeList) Len() int {
	return len(nodes)
}

func (nodes NodeList) Less(i int, j int) bool {
	return nodes[i].value < nodes[j].value
}

func (nodes NodeList) Swap(i int, j int) {
	nodes[i], nodes[j] = nodes[j], nodes[i]
	nodes[i].index = i
	nodes[j].index = j
}

func (nodes *NodeList) Push(x interface{}) {
	node := x.(*Node)
	node.index = len(*nodes)
	*nodes = append(*nodes, node)
}

func (nodes *NodeList) Pop() interface{} {
	s := *nodes
	last := len(s) - 1
	r := s[last]
	*nodes = s[:last]
	r.index = -1
	return r
}

// Int64Slice Sort
type Int64Slice []int64

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

// Input and Output
var in *bufio.Scanner
var out *bufio.Writer

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

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

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

func readFloat64() float64 {
	in.Scan()
	val, _ := strconv.ParseFloat(in.Text(), 64)
	return val
}

func write(args ...interface{}) {
	for i, e := range args {
		switch e.(type) {
		case string:
			out.WriteString(e.(string))
		case int:
			out.WriteString(strconv.Itoa(e.(int)))
		case int64:
			out.WriteString(strconv.FormatInt(e.(int64), 10))
		case float64:
			out.WriteString(strconv.FormatFloat(e.(float64), 'f', -1, 64))
		case []string:
			a := e.([]string)
			for j, x := range a {
				out.WriteString(x)
				if j+1 < len(a) {
					out.WriteByte(' ')
				}
			}
		case []int:
			a := e.([]int)
			for j, x := range a {
				out.WriteString(strconv.Itoa(x))
				if j+1 < len(a) {
					out.WriteByte(' ')
				}

			}
		case []int64:
			a := e.([]int64)
			for j, x := range a {
				out.WriteString(strconv.FormatInt(x, 10))
				if j+1 < len(a) {
					out.WriteByte(' ')
				}

			}
		case []float64:
			a := e.([]float64)
			for j, x := range a {
				out.WriteString(strconv.FormatFloat(x, 'f', -1, 64))
				if j+1 < len(a) {
					out.WriteByte(' ')
				}

			}
		default:
			out.WriteString("###")
		}
		if i+1 < len(args) {
			out.WriteByte(' ')
		}
	}
	out.WriteByte('\n')
}

package main

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

func main() {
	defer out.Flush()

	var x string
	read(&x)

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

	i := 0
	for (i < n) && (s[i] == 'a') {
		i++
	}

	if i >= n {
		s[i-1] = 'z'
	} else {
		for (i < n) && (s[i] != 'a') {
			s[i]--
			i++
		}
	}

	r := string(s)
	writeln(r)
}

// Heap
type Node struct {
	name  int
	value int64
	index int
}

type NodeList []*Node

func (nodes NodeList) Len() int {
	return len(nodes)
}

func (nodes NodeList) Less(i int, j int) bool {
	return nodes[i].value < nodes[j].value
}

func (nodes NodeList) Swap(i int, j int) {
	nodes[i], nodes[j] = nodes[j], nodes[i]
	nodes[i].index = i
	nodes[j].index = j
}

func (nodes *NodeList) Push(x interface{}) {
	node := x.(*Node)
	node.index = len(*nodes)
	*nodes = append(*nodes, node)
}

func (nodes *NodeList) Pop() interface{} {
	s := *nodes
	last := len(s) - 1
	r := s[last]
	*nodes = s[:last]
	r.index = -1
	return r
}

// Sort
type Int64Slice []int64

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

// Input output
var out *bufio.Writer
var iPointer int
var nPointer int
var iBuffer []byte

func init() {
	out = bufio.NewWriter(os.Stdout)
	iPointer = 0
	iBuffer, _ = ioutil.ReadAll(os.Stdin)
	nPointer = len(iBuffer)
}

func isLine(c byte) bool {
	return (c == '\n') || (c == '\r')
}

func isSpace(c byte) bool {
	return (c == ' ') || (c == '\t') || (c == '\n') || (c == '\r')
}

func isDigit(c byte) bool {
	return (c >= '0') && (c <= '9')
}

func readByte(v *byte) bool {
	if iPointer >= nPointer {
		return false
	}
	*v = iBuffer[iPointer]
	iPointer++
	return true
}

func readString(v *string) bool {
	for (iPointer < nPointer) && isSpace(iBuffer[iPointer]) {
		iPointer++
	}
	if iPointer >= nPointer {
		return false
	}
	var a []byte
	for (iPointer < nPointer) && !isSpace(iBuffer[iPointer]) {
		a = append(a, iBuffer[iPointer])
		iPointer++
	}
	*v = string(a)
	return true
}

func readInt(v *int) bool {
	neg := false
	for (iPointer < nPointer) && !isDigit(iBuffer[iPointer]) {
		neg = (iBuffer[iPointer] == '-')
		iPointer++
	}
	if iPointer >= nPointer {
		return false
	}
	var a int
	for (iPointer < nPointer) && isDigit(iBuffer[iPointer]) {
		a = a*10 + int(iBuffer[iPointer]-'0')
		iPointer++
	}
	if neg {
		*v = -a
	} else {
		*v = a
	}
	return true
}

func readInt64(v *int64) bool {
	neg := false
	for (iPointer < nPointer) && !isDigit(iBuffer[iPointer]) {
		neg = (iBuffer[iPointer] == '-')
		iPointer++
	}
	if iPointer >= nPointer {
		return false
	}
	var a int64
	for (iPointer < nPointer) && isDigit(iBuffer[iPointer]) {
		a = a*10 + int64(iBuffer[iPointer]-'0')
		iPointer++
	}
	if neg {
		*v = -a
	} else {
		*v = a
	}
	return true
}

func readFloat64(v *float64) bool {
	neg := false
	for (iPointer < nPointer) && !isDigit(iBuffer[iPointer]) {
		if iBuffer[iPointer] != '.' {
			neg = (iBuffer[iPointer] == '-')
		}
		iPointer++
	}
	if iPointer >= nPointer {
		return false
	}
	var a []byte
	if neg {
		a = append(a, '-')
	}
	if iPointer > 0 && iBuffer[iPointer-1] == '.' {
		a = append(a, '.')
	} else {
		for (iPointer < nPointer) && isDigit(iBuffer[iPointer]) {
			a = append(a, iBuffer[iPointer])
			iPointer++
		}
		if (iPointer < nPointer) && (iBuffer[iPointer] == '.') {
			a = append(a, iBuffer[iPointer])
			iPointer++
		}
	}
	for (iPointer < nPointer) && isDigit(iBuffer[iPointer]) {
		a = append(a, iBuffer[iPointer])
		iPointer++
	}
	var ok error
	*v, ok = strconv.ParseFloat(string(a), 64)
	return ok == nil
}

func readln(v *string) bool {
	for (iPointer < nPointer) && isLine(iBuffer[iPointer]) {
		iPointer++
	}
	if iPointer >= nPointer {
		return false
	}
	var a []byte
	for (iPointer < nPointer) && !isLine(iBuffer[iPointer]) {
		a = append(a, iBuffer[iPointer])
		iPointer++
	}
	*v = string(a)
	for (iPointer < nPointer) && isLine(iBuffer[iPointer]) {
		iPointer++
	}
	return true
}

func read(arg interface{}) bool {
	switch v := arg.(type) {
	case *byte:
		return readByte(v)
	case *string:
		return readString(v)
	case *int:
		return readInt(v)
	case *int64:
		return readInt64(v)
	case *float64:
		return readFloat64(v)
	default:
		return false
	}
}

func writeBool(v bool) {
	if v {
		out.WriteString("true")
	} else {
		out.WriteString("false")
	}
}

func writeByte(v byte) {
	out.WriteByte(v)
}

func writeString(v string) {
	out.WriteString(v)
}

func writeInt(v int) {
	out.WriteString(strconv.Itoa(v))
}

func writeInt64(v int64) {
	out.WriteString(strconv.FormatInt(v, 10))
}

func writeFloat64(v float64) {
	out.WriteString(strconv.FormatFloat(v, 'f', -1, 64))
}

func writeln(args ...interface{}) {
	write(args...)
	out.WriteByte('\n')
}

func write(args ...interface{}) {
	for _, a := range args {
		switch v := a.(type) {
		case bool:
			writeBool(v)
		case byte:
			writeByte(v)
		case rune:
			writeByte(byte(v))
		case string:
			writeString(v)
		case int:
			writeInt(v)
		case int64:
			writeInt64(v)
		case float64:
			writeFloat64(v)
		default:
			out.WriteString("###")
		}
	}
}

package main

import (
	"bufio"
	"io/ioutil"
	"os"
	"strconv"
	"time"
)

func main() {
	defer out.Flush()
	defer writeln(">>> " + time.Since(startTime).String())

	var x string
	read(&x)

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

	i := 0
	for (i < n) && (s[i] == 'a') {
		i++
	}

	if i >= n {
		s[i-1] = 'z'
	} else {
		for (i < n) && (s[i] != 'a') {
			s[i]--
			i++
		}
	}

	r := string(s)
	writeln(r)
}

// Heap
type Node struct {
	name  int
	value int64
	index int
}

type NodeList []*Node

func (nodes NodeList) Len() int {
	return len(nodes)
}

func (nodes NodeList) Less(i int, j int) bool {
	return nodes[i].value < nodes[j].value
}

func (nodes NodeList) Swap(i int, j int) {
	nodes[i], nodes[j] = nodes[j], nodes[i]
	nodes[i].index = i
	nodes[j].index = j
}

func (nodes *NodeList) Push(x interface{}) {
	node := x.(*Node)
	node.index = len(*nodes)
	*nodes = append(*nodes, node)
}

func (nodes *NodeList) Pop() interface{} {
	s := *nodes
	last := len(s) - 1
	r := s[last]
	*nodes = s[:last]
	r.index = -1
	return r
}

// Sort
type Int64Slice []int64

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

// Input output
var out *bufio.Writer
var startTime time.Time
var iPointer int
var nPointer int
var iBuffer []byte

func init() {
	startTime = time.Now()
	out = bufio.NewWriter(os.Stdout)
	iPointer = 0
	iBuffer, _ = ioutil.ReadAll(os.Stdin)
	nPointer = len(iBuffer)
}

func isLine(c byte) bool {
	return (c == '\n') || (c == '\r')
}

func isSpace(c byte) bool {
	return (c == ' ') || (c == '\t') || (c == '\n') || (c == '\r')
}

func isDigit(c byte) bool {
	return (c >= '0') && (c <= '9')
}

func readByte(v *byte) bool {
	if iPointer >= nPointer {
		return false
	}
	*v = iBuffer[iPointer]
	iPointer++
	return true
}

func readString(v *string) bool {
	for (iPointer < nPointer) && isSpace(iBuffer[iPointer]) {
		iPointer++
	}
	if iPointer >= nPointer {
		return false
	}
	var a []byte
	for (iPointer < nPointer) && !isSpace(iBuffer[iPointer]) {
		a = append(a, iBuffer[iPointer])
		iPointer++
	}
	*v = string(a)
	return true
}

func readInt(v *int) bool {
	neg := false
	for (iPointer < nPointer) && !isDigit(iBuffer[iPointer]) {
		neg = (iBuffer[iPointer] == '-')
		iPointer++
	}
	if iPointer >= nPointer {
		return false
	}
	var a int
	for (iPointer < nPointer) && isDigit(iBuffer[iPointer]) {
		a = a*10 + int(iBuffer[iPointer]-'0')
		iPointer++
	}
	if neg {
		*v = -a
	} else {
		*v = a
	}
	return true
}

func readInt64(v *int64) bool {
	neg := false
	for (iPointer < nPointer) && !isDigit(iBuffer[iPointer]) {
		neg = (iBuffer[iPointer] == '-')
		iPointer++
	}
	if iPointer >= nPointer {
		return false
	}
	var a int64
	for (iPointer < nPointer) && isDigit(iBuffer[iPointer]) {
		a = a*10 + int64(iBuffer[iPointer]-'0')
		iPointer++
	}
	if neg {
		*v = -a
	} else {
		*v = a
	}
	return true
}

func readFloat64(v *float64) bool {
	neg := false
	for (iPointer < nPointer) && !isDigit(iBuffer[iPointer]) {
		if iBuffer[iPointer] != '.' {
			neg = (iBuffer[iPointer] == '-')
		}
		iPointer++
	}
	if iPointer >= nPointer {
		return false
	}
	var a []byte
	if neg {
		a = append(a, '-')
	}
	if iPointer > 0 && iBuffer[iPointer-1] == '.' {
		a = append(a, '.')
	} else {
		for (iPointer < nPointer) && isDigit(iBuffer[iPointer]) {
			a = append(a, iBuffer[iPointer])
			iPointer++
		}
		if (iPointer < nPointer) && (iBuffer[iPointer] == '.') {
			a = append(a, iBuffer[iPointer])
			iPointer++
		}
	}
	for (iPointer < nPointer) && isDigit(iBuffer[iPointer]) {
		a = append(a, iBuffer[iPointer])
		iPointer++
	}
	var ok error
	*v, ok = strconv.ParseFloat(string(a), 64)
	return ok == nil
}

func readln(v *string) bool {
	for (iPointer < nPointer) && isLine(iBuffer[iPointer]) {
		iPointer++
	}
	if iPointer >= nPointer {
		return false
	}
	var a []byte
	for (iPointer < nPointer) && !isLine(iBuffer[iPointer]) {
		a = append(a, iBuffer[iPointer])
		iPointer++
	}
	*v = string(a)
	for (iPointer < nPointer) && isLine(iBuffer[iPointer]) {
		iPointer++
	}
	return true
}

func read(arg interface{}) bool {
	switch v := arg.(type) {
	case *byte:
		return readByte(v)
	case *string:
		return readString(v)
	case *int:
		return readInt(v)
	case *int64:
		return readInt64(v)
	case *float64:
		return readFloat64(v)
	default:
		return false
	}
}

func writeBool(v bool) {
	if v {
		out.WriteString("true")
	} else {
		out.WriteString("false")
	}
}

func writeByte(v byte) {
	out.WriteByte(v)
}

func writeString(v string) {
	out.WriteString(v)
}

func writeInt(v int) {
	out.WriteString(strconv.Itoa(v))
}

func writeInt64(v int64) {
	out.WriteString(strconv.FormatInt(v, 10))
}

func writeFloat64(v float64) {
	out.WriteString(strconv.FormatFloat(v, 'f', -1, 64))
}

func writeln(arg interface{}) {
	write(arg)
	out.WriteByte('\n')
}

func write(arg interface{}) {
	switch v := arg.(type) {
	case bool:
		writeBool(v)
	case byte:
		writeByte(v)
	case string:
		writeString(v)
	case int:
		writeInt(v)
	case int64:
		writeInt64(v)
	case float64:
		writeFloat64(v)
	default:
		out.WriteString("###")
	}
}