Logical quantifiers are very useful tools for expressing claims about a set. For this problem, let's focus on the set of real numbers specifically. The set of real numbers includes zero and negatives. There are two kinds of quantifiers: universal ($$$\forall$$$) and existential ($$$\exists$$$). You can read more about them here.The universal quantifier is used to make a claim that a statement holds for all real numbers. For example:  $$$\forall x,x<100$$$ is read as: for all real numbers $$$x$$$, $$$x$$$ is less than $$$100$$$. This statement is false.  $$$\forall x,x>x-1$$$ is read as: for all real numbers $$$x$$$, $$$x$$$ is greater than $$$x-1$$$. This statement is true. The existential quantifier is used to make a claim that there exists some real number for which the statement holds. For example:  $$$\exists x,x<100$$$ is read as: there exists a real number $$$x$$$ such that $$$x$$$ is less than $$$100$$$. This statement is true.  $$$\exists x,x>x-1$$$ is read as: there exists a real number $$$x$$$ such that $$$x$$$ is greater than $$$x-1$$$. This statement is true. Moreover, these quantifiers can be nested. For example:  $$$\forall x,\exists y,x<y$$$ is read as: for all real numbers $$$x$$$, there exists a real number $$$y$$$ such that $$$x$$$ is less than $$$y$$$. This statement is true since for every $$$x$$$, there exists $$$y=x+1$$$.  $$$\exists y,\forall x,x<y$$$ is read as: there exists a real number $$$y$$$ such that for all real numbers $$$x$$$, $$$x$$$ is less than $$$y$$$. This statement is false because it claims that there is a maximum real number: a number $$$y$$$ larger than every $$$x$$$. Note that the order of variables and quantifiers is important for the meaning and veracity of a statement.There are $$$n$$$ variables $$$x_1,x_2,\ldots,x_n$$$, and you are given some formula of the form $$$$$$ f(x_1,\dots,x_n):=(x_{j_1}<x_{k_1})\land (x_{j_2}<x_{k_2})\land \cdots\land (x_{j_m}<x_{k_m}), $$$$$$where $$$\land$$$ denotes logical AND. That is, $$$f(x_1,\ldots, x_n)$$$ is true if every inequality $$$x_{j_i}<x_{k_i}$$$ holds. Otherwise, if at least one inequality does not hold, then $$$f(x_1,\ldots,x_n)$$$ is false.Your task is to assign quantifiers $$$Q_1,\ldots,Q_n$$$ to either universal ($$$\forall$$$) or existential ($$$\exists$$$) so that the statement $$$$$$ Q_1 x_1, Q_2 x_2, \ldots, Q_n x_n, f(x_1,\ldots, x_n) $$$$$$is true, and the number of universal quantifiers is maximized, or determine that the statement is false for every possible assignment of quantifiers.Note that the order the variables appear in the statement is fixed. For example, if $$$f(x_1,x_2):=(x_1<x_2)$$$ then you are not allowed to make $$$x_2$$$ appear first and use the statement $$$\forall x_2,\exists x_1, x_1<x_2$$$. If you assign $$$Q_1=\exists$$$ and $$$Q_2=\forall$$$, it will only be interpreted as $$$\exists x_1,\forall x_2,x_1<x_2$$$.

The first line contains two integers $$$n$$$ and $$$m$$$ ($$$2\le n\le 2\cdot 10^5$$$; $$$1\le m\le 2\cdot 10^5$$$) — the number of variables and the number of inequalities in the formula, respectively. The next $$$m$$$ lines describe the formula. The $$$i$$$-th of these lines contains two integers $$$j_i$$$,$$$k_i$$$ ($$$1\le j_i,k_i\le n$$$, $$$j_i\ne k_i$$$).

If there is no assignment of quantifiers for which the statement is true, output a single integer $$$-1$$$. Otherwise, on the first line output an integer, the maximum possible number of universal quantifiers. On the next line, output a string of length $$$n$$$, where the $$$i$$$-th character is "A" if $$$Q_i$$$ should be a universal quantifier ($$$\forall$$$), or "E" if $$$Q_i$$$ should be an existential quantifier ($$$\exists$$$). All letters should be upper-case. If there are multiple solutions where the number of universal quantifiers is maximum, print any.

NoteFor the first test, the statement $$$\forall x_1, \exists x_2, x_1<x_2$$$ is true. Answers of "EA" and "AA" give false statements. The answer "EE" gives a true statement, but the number of universal quantifiers in this string is less than in our answer.For the second test, we can show that no assignment of quantifiers, for which the statement is true exists.For the third test, the statement $$$\forall x_1, \forall x_2, \exists x_3, (x_1<x_3)\land (x_2<x_3)$$$ is true: We can set $$$x_3=\max\{x_1,x_2\}+1$$$.

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)

	n, m := readTwoNums(reader)

	F := make([][]int, m)

	for i := 0; i < m; i++ {
		F[i] = readNNums(reader, 2)
	}

	cnt, res := solve(n, m, F)

	if cnt == 0 {
		fmt.Println(res)
	} else {
		fmt.Println(cnt)
		fmt.Println(res)
	}
}

func solve(n, m int, F [][]int) (int, string) {
	// if F has loop, there there is no answer
	vis := make([]int, n+1)

	outs := make([][]int, n+1)
	ins := make([][]int, n+1)
	for i := 1; i <= n; i++ {
		outs[i] = make([]int, 0, 10)
		ins[i] = make([]int, 0, 10)
	}

	for _, f := range F {
		u, v := f[0], f[1]
		outs[u] = append(outs[u], v)
		ins[v] = append(ins[v], u)
	}

	var dfs func(u int) bool

	dfs = func(u int) bool {
		if vis[u] == 1 {
			// a loop
			return false
		}

		if vis[u] > 0 {
			return true
		}

		vis[u] = 1

		for _, v := range outs[u] {
			if !dfs(v) {
				return false
			}
		}

		vis[u] = 2

		return true
	}

	for i := 1; i <= n; i++ {
		if vis[i] == 0 {
			if !dfs(i) {
				return 0, "-1"
			}
		}
	}

	for i := 1; i <= n; i++ {
		if vis[i] == 0 {
			return 0, "-1"
		}
	}

	seq := make([]int, n)

	var topo func(u int)

	order := n - 1

	topo = func(u int) {

		for _, v := range outs[u] {
			if vis[v] == 0 {
				topo(v)
			}
		}

		seq[order] = u
		vis[u] = order + 1
		order--
	}

	for i := 1; i <= n; i++ {
		vis[i] = 0
	}

	for i := 1; i <= n; i++ {
		if vis[i] == 0 {
			topo(i)
		}
	}

	dp := make([]int, n+1)
	fp := make([]int, n+1)

	for i := 1; i <= n; i++ {
		dp[i] = i
		fp[i] = i
	}

	for _, u := range seq {
		for _, v := range outs[u] {
			dp[v] = min(dp[v], dp[u])
		}
	}

	for i := n - 1; i >= 0; i-- {
		u := seq[i]
		for _, v := range ins[u] {
			fp[v] = min(fp[v], fp[u])
		}
	}

	res := make([]byte, n)
	var cnt int
	for i := 1; i <= n; i++ {
		j := min(dp[i], fp[i])
		if i == j {
			res[i-1] = 'A'
			cnt++
		} else {
			res[i-1] = 'E'
		}
	}

	return cnt, string(res)
}

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

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)

	n, m := readTwoNums(reader)

	F := make([][]int, m)

	for i := 0; i < m; i++ {
		F[i] = readNNums(reader, 2)
	}

	fmt.Println(solve(n, m, F))
}

func solve(n, m int, F [][]int) string {
	// if F has loop, there there is no answer
	vis := make([]int, n+1)

	outs := make([][]int, n+1)
	ins := make([][]int, n+1)
	for i := 1; i <= n; i++ {
		outs[i] = make([]int, 0, 10)
		ins[i] = make([]int, 0, 10)
	}

	degree := make([]int, n+1)

	for _, f := range F {
		u, v := f[0], f[1]
		outs[u] = append(outs[u], v)
		degree[v]++
		ins[v] = append(ins[v], u)
	}

	var dfs func(u int, x int) bool

	dfs = func(u int, x int) bool {
		if vis[u] == x {
			// a loop
			return false
		}

		if vis[u] > 0 {
			// another path
			return true
		}

		vis[u] = x

		for _, v := range outs[u] {
			if !dfs(v, x) {
				return false
			}
		}
		return true
	}

	for i := 1; i <= n; i++ {
		if degree[i] == 0 {
			if !dfs(i, i+1) {
				return "-1"
			}
		}
	}

	for i := 1; i <= n; i++ {
		if vis[i] == 0 {
			return "-1"
		}
	}

	seq := make([]int, n)

	var topo func(u int)

	order := n - 1

	topo = func(u int) {

		for _, v := range outs[u] {
			if vis[v] == 0 {
				topo(v)
			}
		}

		seq[order] = u
		vis[u] = order + 1
		order--
	}

	for i := 1; i <= n; i++ {
		vis[i] = 0
	}

	for i := 1; i <= n; i++ {
		if vis[i] == 0 {
			topo(i)
		}
	}

	dp := make([]int, n+1)
	fp := make([]int, n+1)

	for i := 1; i <= n; i++ {
		dp[i] = i
		fp[i] = i
	}

	for _, u := range seq {
		for _, v := range outs[u] {
			dp[v] = min(dp[v], dp[u])
		}
	}

	for i := n - 1; i >= 0; i-- {
		u := seq[i]
		for _, v := range ins[u] {
			fp[v] = min(fp[v], fp[u])
		}
	}

	res := make([]byte, n)

	for i := 1; i <= n; i++ {
		j := min(dp[i], fp[i])
		if i == j {
			res[i-1] = 'A'
		} else {
			res[i-1] = 'E'
		}
	}

	return string(res)
}

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

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)

	n, m := readTwoNums(reader)

	F := make([][]int, m)

	for i := 0; i < m; i++ {
		F[i] = readNNums(reader, 2)
	}

	cnt, res := solve(n, m, F)

	if cnt == 0 {
		fmt.Println(res)
	} else {
		fmt.Println(cnt)
		fmt.Println(res)
	}
}

func solve(n, m int, F [][]int) (int, string) {
	// if F has loop, there there is no answer
	vis := make([]int, n+1)

	outs := make([][]int, n+1)
	ins := make([][]int, n+1)
	for i := 1; i <= n; i++ {
		outs[i] = make([]int, 0, 10)
		ins[i] = make([]int, 0, 10)
	}

	degree := make([]int, n+1)

	for _, f := range F {
		u, v := f[0], f[1]
		outs[u] = append(outs[u], v)
		degree[v]++
		ins[v] = append(ins[v], u)
	}

	var dfs func(u int, x int) bool

	dfs = func(u int, x int) bool {
		if vis[u] == x {
			// a loop
			return false
		}

		if vis[u] > 0 {
			// another path
			return true
		}

		vis[u] = x

		for _, v := range outs[u] {
			if !dfs(v, x) {
				return false
			}
		}
		return true
	}

	for i := 1; i <= n; i++ {
		if degree[i] == 0 {
			if !dfs(i, i+1) {
				return 0, "-2"
			}
		}
	}

	for i := 1; i <= n; i++ {
		if vis[i] == 0 {
			return 0, "-1"
		}
	}

	seq := make([]int, n)

	var topo func(u int)

	order := n - 1

	topo = func(u int) {

		for _, v := range outs[u] {
			if vis[v] == 0 {
				topo(v)
			}
		}

		seq[order] = u
		vis[u] = order + 1
		order--
	}

	for i := 1; i <= n; i++ {
		vis[i] = 0
	}

	for i := 1; i <= n; i++ {
		if vis[i] == 0 {
			topo(i)
		}
	}

	dp := make([]int, n+1)
	fp := make([]int, n+1)

	for i := 1; i <= n; i++ {
		dp[i] = i
		fp[i] = i
	}

	for _, u := range seq {
		for _, v := range outs[u] {
			dp[v] = min(dp[v], dp[u])
		}
	}

	for i := n - 1; i >= 0; i-- {
		u := seq[i]
		for _, v := range ins[u] {
			fp[v] = min(fp[v], fp[u])
		}
	}

	res := make([]byte, n)
	var cnt int
	for i := 1; i <= n; i++ {
		j := min(dp[i], fp[i])
		if i == j {
			res[i-1] = 'A'
			cnt++
		} else {
			res[i-1] = 'E'
		}
	}

	return cnt, string(res)
}

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

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)

	n, m := readTwoNums(reader)

	F := make([][]int, m)

	for i := 0; i < m; i++ {
		F[i] = readNNums(reader, 2)
	}

	cnt, res := solve(n, m, F)

	if res == "-1" {
		fmt.Println(res)
	} else {
		fmt.Println(cnt)
		fmt.Println(res)
	}
}

func solve(n, m int, F [][]int) (int, string) {
	// if F has loop, there there is no answer
	vis := make([]int, n+1)

	outs := make([][]int, n+1)
	ins := make([][]int, n+1)
	for i := 1; i <= n; i++ {
		outs[i] = make([]int, 0, 10)
		ins[i] = make([]int, 0, 10)
	}

	degree := make([]int, n+1)

	for _, f := range F {
		u, v := f[0], f[1]
		outs[u] = append(outs[u], v)
		degree[v]++
		ins[v] = append(ins[v], u)
	}

	var dfs func(u int, x int) bool

	dfs = func(u int, x int) bool {
		if vis[u] == x {
			// a loop
			return false
		}

		if vis[u] > 0 {
			// another path
			return true
		}

		vis[u] = x

		for _, v := range outs[u] {
			if !dfs(v, x) {
				return false
			}
		}
		return true
	}

	for i := 1; i <= n; i++ {
		if degree[i] == 0 {
			if !dfs(i, i+1) {
				return 0, "-1"
			}
		}
	}

	for i := 1; i <= n; i++ {
		if vis[i] == 0 {
			return 0, "-1"
		}
	}

	seq := make([]int, n)

	var topo func(u int)

	order := n - 1

	topo = func(u int) {

		for _, v := range outs[u] {
			if vis[v] == 0 {
				topo(v)
			}
		}

		seq[order] = u
		vis[u] = order + 1
		order--
	}

	for i := 1; i <= n; i++ {
		vis[i] = 0
	}

	for i := 1; i <= n; i++ {
		if vis[i] == 0 {
			topo(i)
		}
	}

	dp := make([]int, n+1)
	fp := make([]int, n+1)

	for i := 1; i <= n; i++ {
		dp[i] = i
		fp[i] = i
	}

	for _, u := range seq {
		for _, v := range outs[u] {
			dp[v] = min(dp[v], dp[u])
		}
	}

	for i := n - 1; i >= 0; i-- {
		u := seq[i]
		for _, v := range ins[u] {
			fp[v] = min(fp[v], fp[u])
		}
	}

	res := make([]byte, n)
	var cnt int
	for i := 1; i <= n; i++ {
		j := min(dp[i], fp[i])
		if i == j {
			res[i-1] = 'A'
			cnt++
		} else {
			res[i-1] = 'E'
		}
	}

	return cnt, string(res)
}

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

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)

	n, m := readTwoNums(reader)

	F := make([][]int, m)

	for i := 0; i < m; i++ {
		F[i] = readNNums(reader, 2)
	}

	cnt, res := solve(n, m, F)

	if cnt == 0 {
		fmt.Println(res)
	} else {
		fmt.Println(cnt)
		fmt.Println(res)
	}
}

func solve(n, m int, F [][]int) (int, string) {
	// if F has loop, there there is no answer
	vis := make([]int, n+1)

	outs := make([][]int, n+1)
	ins := make([][]int, n+1)
	for i := 1; i <= n; i++ {
		outs[i] = make([]int, 0, 10)
		ins[i] = make([]int, 0, 10)
	}

	degree := make([]int, n+1)

	for _, f := range F {
		u, v := f[0], f[1]
		outs[u] = append(outs[u], v)
		degree[v]++
		ins[v] = append(ins[v], u)
	}

	var dfs func(u int, x int) bool

	dfs = func(u int, x int) bool {
		if vis[u] == x {
			// a loop
			return false
		}

		if vis[u] > 0 {
			// another path
			return true
		}

		vis[u] = x

		for _, v := range outs[u] {
			if !dfs(v, x) {
				return false
			}
		}
		return true
	}

	for i := 1; i <= n; i++ {
		if degree[i] == 0 {
			if !dfs(i, i+1) {
				return 0, "-1"
			}
		}
	}

	for i := 1; i <= n; i++ {
		if vis[i] == 0 {
			return 0, "-2"
		}
	}

	seq := make([]int, n)

	var topo func(u int)

	order := n - 1

	topo = func(u int) {

		for _, v := range outs[u] {
			if vis[v] == 0 {
				topo(v)
			}
		}

		seq[order] = u
		vis[u] = order + 1
		order--
	}

	for i := 1; i <= n; i++ {
		vis[i] = 0
	}

	for i := 1; i <= n; i++ {
		if vis[i] == 0 {
			topo(i)
		}
	}

	dp := make([]int, n+1)
	fp := make([]int, n+1)

	for i := 1; i <= n; i++ {
		dp[i] = i
		fp[i] = i
	}

	for _, u := range seq {
		for _, v := range outs[u] {
			dp[v] = min(dp[v], dp[u])
		}
	}

	for i := n - 1; i >= 0; i-- {
		u := seq[i]
		for _, v := range ins[u] {
			fp[v] = min(fp[v], fp[u])
		}
	}

	res := make([]byte, n)
	var cnt int
	for i := 1; i <= n; i++ {
		j := min(dp[i], fp[i])
		if i == j {
			res[i-1] = 'A'
			cnt++
		} else {
			res[i-1] = 'E'
		}
	}

	return cnt, string(res)
}

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


Codeforces separates its users into $$$4$$$ divisions by their rating:  For Division 1: $$$1900 \leq \mathrm{rating}$$$  For Division 2: $$$1600 \leq \mathrm{rating} \leq 1899$$$  For Division 3: $$$1400 \leq \mathrm{rating} \leq 1599$$$  For Division 4: $$$\mathrm{rating} \leq 1399$$$ Given a $$$\mathrm{rating}$$$, print in which division the $$$\mathrm{rating}$$$ belongs.

The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of testcases. The description of each test consists of one line containing one integer $$$\mathrm{rating}$$$ ($$$-5000 \leq \mathrm{rating} \leq 5000$$$).

For each test case, output a single line containing the correct division in the format "Division X", where $$$X$$$ is an integer between $$$1$$$ and $$$4$$$ representing the division for the corresponding rating.

Division 4
Division 4
Division 4
Division 4
Division 3
Division 2
Division 1

NoteFor test cases $$$1-4$$$, the corresponding ratings are $$$-789$$$, $$$1299$$$, $$$1300$$$, $$$1399$$$, so all of them are in division $$$4$$$.For the fifth test case, the corresponding rating is $$$1400$$$, so it is in division $$$3$$$.For the sixth test case, the corresponding rating is $$$1679$$$, so it is in division $$$2$$$.For the seventh test case, the corresponding rating is $$$2300$$$, so it is in division $$$1$$$.

package main

import (
	"fmt"
)

func runCase(rating int) string {
	if rating <= 1399 {
		return "Division 4"
	}

	if rating <= 1599 {
		return "Division 3"
	}

	if rating <= 1899 {
		return "Division 2"
	}

	return "Division 1"
}

func main() {

	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var rating int
		fmt.Scan(&rating)
		fmt.Printf("%s\n", runCase(rating))
	}
}

package main

import "fmt"

func main() {
	var (
		testcases int
		input     int
		output    string = "Division "
	)
	fmt.Scan(&testcases)

	for testcases > 0 {
		testcases -= 1
        output = "Division "

		fmt.Scan(&input)
		if input >= 1900 {
			output += "1"
		} else if input > 1599 {
			output += "2"
		} else if input > 1399 {
			output += "3"
		} else {
			output += "4"
		}

		fmt.Println(output)
	}

}

package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a)
	for i := 0; i < a; i++ {
		fmt.Scan(&b)
		if 1900 <= b {
			fmt.Println("Division 1")
		} else if 1600 <= b && b <= 1899 {
			fmt.Println("Division 2")
		} else if 1400 <= b && b <= 1599 {
			fmt.Println("Division 3")
		} else if b <= 1399 {
			fmt.Println("Division 4")
		}
	}
}

package main

import "fmt"

var division string = "Division"
func main(){
    var t int

    fmt.Scan(&t)
    var rating int

    for i:= 0; i<t; i++{
        fmt.Scan(&rating)
        fmt.Println(Rating(rating))
    }

}
func Rating(elo int) string{

    if(elo<=1399){
        return division + " 4"
    }
    if(elo <= 1599){
        return division + " 3"
    }
    if(elo<= 1899){
        return division + " 2"
    }
        return division + " 1"
}

package main

import "fmt"

func solve(x int) string {
	if x <= 1399 {
		return "Division 4"
	} else if x <= 1599 {
		return "Division 3"
	} else if x <= 1899 {
		return "Division 2"
	} else {
		return "Division 1"
	}
}
func main() {
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var x int
		fmt.Scan(&x)
		fmt.Println(solve(x))
	}

}

package main

import "fmt"

func solve(x int) string {
	if x <= 1399 {
		return "Division 4"
	} else if 1400 <= x && x <= 1599 {
		return "Division 3"
	} else if 1600 <= x && x <= 1899 {
		return "Division 2"
	} else {
		return "Division 1"
	}
}
func main() {
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var x int
		fmt.Scan(&x)
		fmt.Println(solve(x))
	}

}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	str, _ := reader.ReadString('\n')
	t, _ := strconv.ParseInt(strings.TrimSpace(str), 10, 32)
	tt := int(t)
	for i := 0; i < tt; i++ {
		rate, _ := reader.ReadString('\n')
		rate_, _ := strconv.ParseInt(strings.TrimSpace(rate), 10, 32)
		if rate_ < 1400 {
			fmt.Println("Division 4")
		} else if rate_ < 1600 {
			fmt.Println("Division 3")
		} else if rate_ < 1900 {
			fmt.Println("Division 2")
		} else {
			fmt.Println("Division 1")
		}
	}
}

/*
func main() {
	/*	fmt.Println("HELLO PRO")
		var user string
		user = "ahmed"
		fmt.Println(user)
		fmt.Printf("Var Type: %T\n", user)

		var logged bool = true
		fmt.Println(logged)

		var num int = 15
		fmt.Println(num)

		fmt.Println(here)
*/

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

	num, err := strconv.ParseInt(strings.TrimSpace(input), 10, 64)
	//	num2, err := strconv.ParseFloat(strings.TrimSpace(input2), 64)
	num2 := strconv.FormatInt(num, 10)
	if err == nil {
		fmt.Printf("%s", num2)
	} else {
		fmt.Println(err)
	}

*/

/*
	var x int = 5
	var ptr *int = &x

	fmt.Println(ptr, *ptr)

*/

/*
	var x [3]int = [3]int{1, 2, 3}
	x[0] = 5

	fmt.Println(x)
*/

// Slices
/*
		var arr = []int{1, 3, 2, 4, 7}
		arr = append(arr[:2], arr[3:]...)

		var x User = User{"Ahmed", true}
		fmt.Println(x)

		if 7 > 5 && 3 < 5 || 2 > 3 {
			fmt.Printf("A")
		} else {
			fmt.Printf("B")
		}
	fmt.Println("HELLO")
	defer fmt.Println("1")
	defer fmt.Println("2")

}

type User struct {
	Name  string
	Email bool
}
*/

package main

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

var sc = bufio.NewScanner(os.Stdin)
var wr = bufio.NewWriter(os.Stdout)

func out(x ...interface{}) {
	fmt.Fprintln(wr, x...)
}

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

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

func nextInt64() int64 {
	i, e := strconv.ParseInt(next(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	defer wr.Flush()
	sc.Buffer(make([]byte, 0), 1000000009)
	sc.Split(bufio.ScanWords)

	t := nextInt()
	for i := 0; i < t; i++ {
		solve()
	}
}

func solve() {
	rating := nextInt()

	if rating <= 1399 {
		out("Division 4")
	} else if rating <= 1599 {
		out("Division 3")
	} else if rating <= 1899 {
		out("Division 2")
	} else {
		out("Division 1")
	}
}

package main

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

var sc = bufio.NewScanner(os.Stdin)
var wr = bufio.NewWriter(os.Stdout)

func out(x ...interface{}) {
	fmt.Fprint(wr, x...)
}

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

func nextInt64() int64 {
	i, e := strconv.ParseInt(next(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

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

func main() {
	defer wr.Flush()
	sc.Buffer(make([]byte, 0), 1000000009)
	sc.Split(bufio.ScanWords)

	solve()
}

func solve() {
	t := nextInt()
	for i := 0; i < t; i++ {
		rating := nextInt()
		if rating <= 1399 {
			fmt.Println("Division 4")
		} else if rating <= 1599 {
			fmt.Println("Division 3")
		} else if rating <= 1899 {
			fmt.Println("Division 2")
		} else {
			fmt.Println("Division 1")
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var n int

	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		var r int
		fmt.Scan(&r)
		switch {
		case r >= 1900:
			fmt.Println("Division", 1)
		case r <= 1899 && r >= 1600:
			fmt.Println("Division", 2)
		case r <= 1599 && r >= 1400:
			fmt.Println("Division", 3)
		case r <= 1399:
			fmt.Println("Division", 4)
		}
	}
}

package main

import "fmt"

func main() {
	var T int
	fmt.Scanln(&T)
	for Case:=0;Case<T;Case++{
		var a int
		fmt.Scanln(&a)
		if a <=1399{
			fmt.Println("Division 4")
		}else if(a<=1599){
			fmt.Println("Division 3")
		}else if (a<=1899){
			fmt.Println("Division 2")
		}else{
			fmt.Println("Division 1")
		}

	}
}

package main

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

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

func main(){
    defer writer.Flush()

    var n int
    fmt.Fscan(reader,&n)
    for i := 1; i <= n;i++ {
        var rating int
        fmt.Fscan(reader,&rating)
        div := 1
        if rating <= 1399 {
            div = 4
        } else if rating <= 1599 {
            div = 3
        } else if rating <= 1899 {
            div = 2
        }
        fmt.Printf("Division %d\n",div)
    }
}

// @Title
// @Description
// @Author
// @Update
package main

import (
        "fmt"
)

func main() {
        var n int
        fmt.Scanln(&n)
        for i := 0; i < n; i++ {
                var st int
                fmt.Scanln(&st)
                switch {
                case st <= 1399:
                        fmt.Println("Division 4")
                case st <= 1599:
                        fmt.Println("Division 3")
                case st <= 1899:
                        fmt.Println("Division 2")
                case st >= 1900:
                        fmt.Println("Division 1")
                }
        }
}

package main
import "fmt"

func solve() {
    var rating int
    fmt.Scanln(&rating)
    fmt.Print("Division ")
    if rating < 1400 {
        fmt.Println(4)
    } else if rating < 1600 {
        fmt.Println(3)
    } else if rating < 1900 {
        fmt.Println(2)
    } else {
        fmt.Println(1)
    }
}

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

package main

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

func solve(cin *scanner, cout *writer, cerr *writer) {
	x := cin.NextInt()
	switch {
	case x <= 1399:
		cout.Println("Division 4")
	case x <= 1599:
		cout.Println("Division 3")
	case x <= 1899:
		cout.Println("Division 2")
	default:
		cout.Println("Division 1")
	}
}

func main() {
	cin := NewScanner(os.Stdin)
	cout, cerr := NewWriter(os.Stdout), NewWriter(os.Stderr)
	defer cout.Flush()
	defer cerr.Flush()
	t := cin.NextInt()
	// t := 1
	for ti := 0; ti < t; ti++ {
		solve(cin, cout, cerr)
	}
}

// Template Bolierplate {{{
type scanner struct {
	*bufio.Scanner
}

func NewScanner(r io.Reader) *scanner {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	s.Buffer(nil, 1024*1024)
	return &scanner{s}
}

func (i *scanner) Next() string {
	i.Scan()
	return i.Text()
}

func (i *scanner) Nexts(n int) []string {
	res := make([]string, n)
	for j := range res {
		res[j] = i.Next()
	}
	return res
}

func (i *scanner) NextInt() int {
	v, _ := strconv.Atoi(i.Next())
	return v
}

func (i *scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(i.Next(), 10, 64)
	return v
}

func (i *scanner) NextInts(n int) []int {
	res := make([]int, n)
	for j := range res {
		res[j] = i.NextInt()
	}
	return res
}

func (i *scanner) NextInt64s(n int) []int64 {
	res := make([]int64, n)
	for j := range res {
		res[j] = i.NextInt64()
	}
	return res
}

type writer struct {
	w *bufio.Writer
}

func NewWriter(w io.Writer) *writer {
	return &writer{bufio.NewWriter(w)}
}

func (i *writer) Print(a ...interface{}) {
	fmt.Fprint(i.w, a...)
}

func (i *writer) Println(a ...interface{}) {
	fmt.Fprintln(i.w, a...)
}

func (i *writer) Printf(format string, a ...interface{}) {
	fmt.Fprintf(i.w, format, a...)
}

func (i *writer) Flush() {
	i.w.Flush()
}

// }}}

// vim: fdm=marker

package main

import (
	"fmt"
)

func main(){
	//var v []int = make([] int, 200000)
	var t int
	fmt.Scan(&t)
	for ;t>0; t--{
		var rating int
		//var toint [int]int
		//reader := bufio.NewReader(os.Stdin)
		//rating = reader.Read
		fmt.Scan(&rating)
		if rating >= 1900{
			fmt.Println("Division 1")
		}else if rating >= 1600{
			fmt.Println("Division 2")
		}else if rating >= 1400{
			fmt.Println("Division 3")
		}else{
			fmt.Println("Division 4")
		}
	}
}

package main

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

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

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

	var T, x int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &x)
		o := "Division "
		if x < 1400 {
			o += "4"
		} else if x < 1600 {
			o += "3"
		} else if x < 1900 {
			o += "2"
		} else {
			o += "1"
		}

		Fprintln(out, o)

	}
}

package main

import (
	"fmt"
)

func main() {
	var (
		t int
		r int
	)
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		fmt.Scanf("%d\n", &r)
		if r > 1899 {
			fmt.Println("Division 1")
		} else if r > 1599 {
			fmt.Println("Division 2")
		} else if r > 1399 {
			fmt.Println("Division 3")
		} else {
			fmt.Println("Division 4")
		}
	}
}

package main
import (
	"fmt"
)
func main() {
	var t int
	fmt.Scan(&t)
	for i:=0;i<t;i++ {
		var x int
		fmt.Scan(&x)
		if x >= 1900 {
			fmt.Println("Division 1")
		} else if x >= 1600 && x <= 1899 {
			fmt.Println("Division 2")
		} else if x >= 1400 && x <= 1599 {
			fmt.Println("Division 3")
		} else {
			fmt.Println("Division 4")
		}
	}
}

package main

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

var in = bufio.NewReader(os.Stdin)

func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

func pl(a ...interface{})                { fmt.Println(a...) }
func pf(format string, a ...interface{}) { fmt.Printf(format, a...) }
func scan(a ...interface{})              { fmt.Fscan(in, a...) }

func solve() {
	var n int
	scan(&n)
	var d = 4
	if n >= 1900 {
		d = 1
	} else if n >= 1600 && n <= 1899 {
		d = 2
	} else if n >= 1400 && n <= 1599 {
		d = 3
	}
	pf("Division %d\n", d)
}

func main() {
	var T int
	scan(&T)
	for ; T > 0; T-- {
		solve()
	}
}

func ys(b bool) string { return map[bool]string{true: "YES", false: "NO"}[b] }

package main

import (
	"fmt"
	//"strconv"
)

func main() {
	var t int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		var rating int
		fmt.Scanf("%d\n", &rating)
		if rating <= 1399 {
			fmt.Println("Division 4")
		} else if rating <= 1599 {
			fmt.Println("Division 3")
		} else if rating <= 1899 {
			fmt.Println("Division 2")
		} else {
			fmt.Println("Division 1")
		}
	}

	// Printing

    //fmt.Println(text)
	/*fmt.Println(Hello("Nerd"));

	// For loop + if condition

	for i := 0; i < 10; i++ {
		if i % 2 == 0 {
			fmt.Println(strconv.Itoa(i)); // int to an ASCII string is itoa
		}
	}

	var a int
	a = 3
	fmt.Print(a);

	var b [5]int
	fmt.Println("emp:", b) // returns emp: [0 0 0 0 0]
	b[3] = -2;
	fmt.Println("emp:", b, len(b)) // returns emp: [0 0 0 0 0]

	// You can't add strings to int, but keeping them as separate inputs as above works just as well
	var twoD [2][3]int
    for i := 0; i < 2; i++ {
        for j := 0; j < 3; j++ {
            twoD[i][j] = i + j
        }
    }
	fmt.Println("2d: ", twoD)*/

}

package main

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

func solve(r *bufio.Reader) {
	var n int
	fmt.Fscan(r, &n)
	switch {
	case n >= 1900:
		fmt.Println("Division 1")
	case n >= 1600:
		fmt.Println("Division 2")
	case n >= 1400:
		fmt.Println("Division 3")
	default:
		fmt.Println("Division 4")
	}
}
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 "fmt"

func main() {
	var t int
	var a int
	divi := []int{}

	fmt.Scanln(&t)
	r := []string{}
	for i := 0; i < t; i++ {
		fmt.Scanln(&a)
		divi = append(divi, a)
	}
	for i := 0; i < len(divi); i++ {
		if divi[i] <= 1399 {
			r = append(r, "Division 4")
		}
		if 1400 <= divi[i] && divi[i] <= 1599 {
			r = append(r, "Division 3")
		}
		if 1600 <= divi[i] && divi[i] <= 1899 {
			r = append(r, "Division 2")
		}
		if 1900 <= divi[i] {
			r = append(r, "Division 1")
		}

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

package main

import "fmt"

func main() {
	var x, r int
	fmt.Scan(&x)
	for i := 0; i < x; i++ {
		fmt.Scan(&r)
		fmt.Print("Division ")
		switch {
		case r <= 1399:
			fmt.Print("4\n")
		case r <= 1599:
			fmt.Print("3\n")
		case r <= 1899:
			fmt.Print("2\n")
		case r >= 1900:
			fmt.Print("1\n")
		}
	}
}

package main

import "fmt"

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

	var nums = make([]int, t)
	for i := range nums {
		fmt.Scanln(&nums[i])
	}

	for i := range nums {
		switch {
		case nums[i] <= 1399:
			fmt.Println("Division 4")
		case 1400 <= nums[i] && nums[i] <= 1599:
			fmt.Println("Division 3")
		case 1600 <= nums[i] && nums[i] <= 1899:
			fmt.Println("Division 2")
		case 1900 <= nums[i]:
			fmt.Println("Division 1")
		}
	}

}

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 rating int
		fmt.Fscan(in, &rating)

		if rating <= 1399 {
			fmt.Fprintln(out, "Division 4")
			continue
		}

		if rating <= 1599 {
			fmt.Fprintln(out, "Division 3")
			continue
		}

		if rating <= 1899 {
			fmt.Fprintln(out, "Division 2")
			continue
		}

		fmt.Fprintln(out, "Division 1")
		/*
			Для 1-го дивизиона: 1900≤rating
			Для 2-го ивизиона: 1600≤rating≤1899
			Для 3-го дивизиона: 1400≤rating≤1599
			Для 4-го дивизиона: rating≤1399
		*/
	}
}

package main

import "fmt"

func f(rating int){
	if rating >= 1900 {
		fmt.Println("Division 1")
	}else if rating >= 1600{
		fmt.Println("Division 2")
	}else if rating >= 1400 {
		fmt.Println("Division 3")
	}else{
		fmt.Println("Division 4")
	}
}

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

package main

import "fmt"

func main() {
	nIn, tempI := 0, 0

	fmt.Scan(&nIn)

	for i := 0; i < nIn; i++ {
		fmt.Scan(&tempI)

		div := 4

		if tempI >= 1900 {
			div = 1
		} else if tempI >= 1600 {
			div = 2
		} else if tempI >= 1400 {
			div = 3
		}

		fmt.Println("Division ", div)
	}
}

package main

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

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

func main() {
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		var rating int
		fmt.Fscan(in, &rating)
		div := 1
		if rating >= 1900 {
			div = 1
		} else if 1600 <= rating && rating <= 1899 {
			div = 2
		} else if 1400 <= rating && rating <= 1599 {
			div = 3
		} else {
			div = 4
		}
		fmt.Fprintln(out, "Division", div)
	}

}

package main

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

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

	var T, rating int
	for Fscan(in, &T);T > 0; T-- {
		Fprint(out, "Division ")
		if Fscan(in, &rating); rating >= 1900 {
			Fprintln(out, 1)
		} else if rating >= 1600 {
			Fprintln(out, 2)
		} else if rating >= 1400 {
			Fprintln(out, 3)
		} else {
			Fprintln(out, 4)
		}
	}
}

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

package main

import (
	"fmt"
)

func main() {
	var test_case int
	var rating int
	fmt.Scanln(&test_case)

	for i := 0; i < test_case; i++ {
		fmt.Scanln(&rating)

		if rating <= 1399 {
			fmt.Println("Division 4")
		} else if rating <= 1599 && rating >= 1400 {
			fmt.Println("Division 3")
		} else if rating <= 1899 && rating >= 1600 {
			fmt.Println("Division 2")
		} else if rating >= 1900 {
			fmt.Println("Division 1")
		}
	}
}

package main

import (
	"fmt"
	"os"
)

func main() {
	f, err := os.Open("inA.txt")
	if err != nil {
		f = os.Stdin
	}
	var t uint16
	_, _ = fmt.Fscanln(f, &t)
	for ; t > 0; t-- {
		var rating int16
		_, _ = fmt.Fscanln(f, &rating)
		switch {
		case rating < 1400:
			fmt.Println("Division", 4)
		case rating < 1600:
			fmt.Println("Division", 3)
		case rating < 1900:
			fmt.Println("Division", 2)
		default:
			fmt.Println("Division", 1)
		}
	}
}

package main

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

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

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

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

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

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

/**
Run solve the problem CF1669A
Date: 23/04/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1669/A
Problem: CF1669A
**/
func (in *CF1669A) Run() {
	var ans strings.Builder
	for t := in.NextInt(); t > 0; t-- {
		r := in.NextInt()
		if r <= 1399 {
			ans.WriteString("Division 4\n")
		} else if r <= 1599 {
			ans.WriteString("Division 3\n")
		} else if r <= 1899{
			ans.WriteString("Division 2\n")
		} else {
			ans.WriteString("Division 1\n")
		}

	}
	fmt.Print(ans.String())
}

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

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

package main

import "fmt"

// 对于超过10的长度的字符串缩写
func suoxie(n int) {
	for i := 0; i < n; i++ {
		var s string
		fmt.Scanln(&s)
		a := len(s)
		// fmt.Println(s)
		// fmt.Println(s[0])
		if a > 10 {
			fmt.Print(string(s[0]))
			fmt.Print(a - 2)
			fmt.Println(string(s[a-1]))
		} else {
			fmt.Println(s)
		}
	}
}

// 三人中至少两人才做题
func teamSolveProblem(n int) {
	res := 0
	for i := 0; i < n; i++ {
		cnt := 0
		for j := 0; j < 3; j++ {
			var sc int
			fmt.Scan(&sc)
			if sc == 1 {
				cnt++
			}
		}
		if cnt >= 2 {
			res++
		}
	}
	fmt.Println(res)
}

// func nextRound(n, k int) {
// 	res, kth := k, -1
// 	var cur, last int
// 	fmt.Scanln(&last)
// 	end := false
// 	for i := 0; i < n; i++ {
// 		fmt.Scanln(&cur)
// 		if !end {

// 		}
// 	}
// 	fmt.Print(res)
// }
func main() {
	var n, k int
	fmt.Scanln(&n)
	// fmt.Scanln(&k)
	// nextRound(n, k)
	for i := 0; i < n; i++ {
		fmt.Scanln(&k)
		rate := 4
		if k >= 1900 {
			rate = 1
		} else if k >= 1600 {
			rate = 2
		} else if k >= 1400 {
			rate = 3
		}
		fmt.Print("Division ")
		fmt.Println(rate)
	}

	// return
}

package main

import "fmt"

func solve() {
	var rating int
	fmt.Scanln(&rating)
	switch {
	case rating >= 1900:
		fmt.Println("Division 1")
	case rating >= 1600 && rating <= 1899:
		fmt.Println("Division 2")
	case rating >= 1400 && rating <= 1599:
		fmt.Println("Division 3")
	case rating <= 1399:
		fmt.Println("Division 4")
	}
}

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

package main

import (
	"fmt"
	"os"
)

func readInt() int {
	var i int
	fmt.Fscan(os.Stdin, &i)
	return i
}

func main() {
	count := readInt()
	for i := 0; i < count; i++ {
		rating := readInt()
		if rating < 1400 {
			fmt.Println("Division 4")
		} else if rating < 1600 {
			fmt.Println("Division 3")
		} else if rating < 1900 {
			fmt.Println("Division 2")
		} else {
			fmt.Println("Division 1")
		}
	}
}

package main

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

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

	// Toss first line
	scanner.Scan()

	for scanner.Scan() {
		var div int

		r, err := strconv.Atoi(scanner.Text())
		if err != nil {
			r = 0
		}

		switch {
		case r <= 1399:
			div = 4
		case 1400 <= r && r <= 1599:
			div = 3
		case 1600 <= r && r <= 1899:
			div = 2
		case 1900 <= r:
			div = 1
		}

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

package main

import "fmt"

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

		fmt.Print("Division ")
		if x >= 1900 {
			fmt.Println(1)
		} else if x <= 1899 && x >= 1600 {
			fmt.Println(2)
		} else if x <= 1599 && x >= 1400 {
			fmt.Println(3)
		} else {
			fmt.Println(4)
		}
	}
}

package main

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

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

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

	t := 0
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		n := 0
		fmt.Fscan(in, &n)
		if n >= 1900 {
			fmt.Fprintln(out, "Division 1")
		} else if n <= 1899 && n >= 1600 {
			fmt.Fprintln(out, "Division 2")
		} else if n >= 1400 && n <= 1599 {
			fmt.Fprintln(out, "Division 3")
		} else if n <= 1399 {
			fmt.Fprintln(out, "Division 4")
		}
	}
}

package main

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

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

func Scan(a ...interface{}) { fmt.Fscan(in, a...) }
func Scanln(s *string) {
	for *s, _ = in.ReadString('\n'); *s == "\n"; {
		*s, _ = in.ReadString('\n')
	}
	*s = (*s)[:len(*s)-1]
}
func Print(a ...interface{})                 { fmt.Fprint(out, a...) }
func Printf(format string, a ...interface{}) { fmt.Fprintf(out, format, a...) }
func Log(a ...interface{}) {
	pc, _, line, _ := runtime.Caller(1)
	fmt.Fprint(out, "log ", runtime.FuncForPC(pc).Name(), ":", line, " ")
	fmt.Fprint(out, a...)
	fmt.Fprint(out, "\n")
}

func solve() {
	var n, r int
	Scan(&n)
	if n >= 1900 {
		r = 1
	} else if n >= 1600 {
		r = 2
	} else if n >= 1400 {
		r = 3
	} else {
		r = 4
	}
	Printf("Division %d\n", r)
}

func main() {
	defer out.Flush()

	T := 1
	Scan(&T)
	for test := 0; test < T; test++ {
		solve()
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var N,a int
	fmt.Fscan(in, &N)
	for i := 0;i < N;i++{
		fmt.Fscan(in, &a)
		if a >= 1900{
			fmt.Println("Division 1")
		}else if a >= 1600{
			fmt.Println("Division 2")
		}else if a >= 1400{
			fmt.Println("Division 3")
		}else{
			fmt.Println("Division 4")
		}
	}
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var x int
		fmt.Scan(&x)
		if x <= 1399 {
			fmt.Println("Division 4")
		} else if x >= 1400 && x <= 1599 {
			fmt.Println("Division 3")
		} else if x >= 1600 && x <= 1899 {
			fmt.Println("Division 2")
		} else {
			fmt.Println("Division 1")
		}
	}

}

package main

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

/*

 */

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

	switch {
	case n <= 1399:
		fmt.Fprintln(writer, "Division 4")
	case n <= 1599:
		fmt.Fprintln(writer, "Division 3")
	case n <= 1899:
		fmt.Fprintln(writer, "Division 2")
	default:
		fmt.Fprintln(writer, "Division 1")
	}
}

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

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

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

const maxUint = ^uint(0)

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

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

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

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

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

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

//goland:noinspection GoUnusedFunction
func min(nums ...int) int {
	return nums[minIdx(nums...)]
}

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

	return minNumIdx
}

//goland:noinspection GoUnusedFunction
func max(nums ...int) int {
	return nums[maxIdx(nums...)]
}

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

	return maxNumIdx
}

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

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

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

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

	return true
}

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

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

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

	num = abs(num)

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

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

//goland:noinspection GoUnhandledErrorResult
func factorize(num int) []int {
	factors := []int{1}

	sqrtA := int(math.Sqrt(float64(num)))

	for ftr := 2; ftr <= sqrtA; ftr++ {
		for num%ftr == 0 {
			num /= ftr
			factors = append(factors, ftr)
		}
	}

	if num > sqrtA {
		factors = append(factors, num)
	}

	return factors
}

package main

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

const MOD int64 = 1000000007

var rate int

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

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

func main() {

	read := bufio.NewReader(os.Stdin)

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

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

		fmt.Fscan(read, &rate)

		solve()
	}
}

type pair struct {
	v int
	idx []int
}

//a b c d

//20 12 -- 4
//4  2  -- 4

func solve()  {
	if rate <= 1399 {
		fmt.Println("Division 4")
		return
	}
	if rate >= 1400 && rate <= 1599 {
		fmt.Println("Division 3")
		return
	}
	if rate >= 1600 && rate <= 1899 {
		fmt.Println("Division 2")
		return
	}
	fmt.Println("Division 1")
}

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

package main

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

var r = bufio.NewReader(os.Stdin)
var w = bufio.NewWriter(os.Stdout)

func slove() {
	defer w.Flush()
	var rat int
	fmt.Fscan(r, &rat)
	if rat <= 1399 {
		fmt.Fprintln(w, "Division 4")
	} else if rat <=1599 {
		fmt.Fprintln(w, "Division 3")

	} else if rat <= 1899 {
		fmt.Fprintln(w, "Division 2")
	} else {
		fmt.Fprintln(w, "Division 1")
	}
}

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

func main() {
	var n int
	fmt.Fscan(r, &n)
	for i:=0;i<n;i++ {
		slove()
	}
}

package main

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

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

func solve() {
	var n int
	scanf("%d\n", &n)
	if n <= 1399 {
		printf("Division 4\n")
	} else if n <= 1599 {
		printf("Division 3\n")
	} else if n <= 1899 {
		printf("Division 2\n")
	} else {
		printf("Division 1\n")
	}
}

func main() {
	defer writer.Flush()
	var cases int

	scanf("%d\n", &cases)
	// cases = 1

	for c := 0; c < cases; c++ {
		solve()
	}
}

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

func IntArray(size int) []int {
	arr := make([]int, size)
	for i := 0; i < size; i++ {
		scanf("%d", &arr[i])
	}
	scanf("\n")
	return arr
}

func Max(args ...int) int {
	m := args[0]
	for i := range args {
		if args[i] > m {
			m = args[i]
		}
	}
	return m
}

func Min(args ...int) int {
	m := args[0]
	for i := range args {
		if args[i] < m {
			m = args[i]
		}
	}
	return m
}

package main

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

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

	var T int
	fmt.Fscan(in, &T)

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

		var d int
		if n <= 1399 {
			d = 4
		} else if n <= 1599 {
			d = 3
		} else if n <= 1899 {
			d = 2
		} else {
			d = 1
		}

		fmt.Fprintln(out, "Division ", d)
	}
}

package main

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

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

	solve := func(curCase int) {
		var n int
		Fscan(in, &n)
		Fprint(out, "Division ")
		if n < 1400 {
			Fprintln(out, 4)
		} else if n < 1600 {
			Fprintln(out, 3)
		} else if n < 1900 {
			Fprintln(out, 2)
		} else {
			Fprintln(out, 1)
		}
	}

	cases := 1
	Fscan(in, &cases)
	for curCase := 1; curCase <= cases; curCase++ {
		solve(curCase)
	}

	leftData, _ := ioutil.ReadAll(in)
	if s := strings.TrimSpace(string(leftData)); s != "" {
		panic("有未读入的数据：\n" + s)
	}

}

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

package main

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

func main() {
	in, out := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)

	for ii := 0; ii < t; ii++ {
		var n int
		fmt.Fscan(in, &n)
		if n >= 1900 {
			fmt.Fprintln(out, "Division 1")
		} else if n >= 1600 {
			fmt.Fprintln(out, "Division 2")
		} else if n >= 1400 {
			fmt.Fprintln(out, "Division 3")
		} else {
			fmt.Fprintln(out, "Division 4")
		}
	}
}

package main

import (
	"fmt"
)

func runCase(rating int) string {
	if rating <= 1399 {
		return "Division 4"
	}

	if rating <= 1599 {
		return "Division 3"
	}

	if rating <= 1899 {
		return "Division 2"
	}

	return "Division 1"
}

func main() {

	var n int
	fmt.Scanln("%d", &n)

	var nums = make([]int, n)
	for i := range nums {
		fmt.Scanln(&nums[i])
	}

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

package main

import (
	"fmt"
)

func runCase(rating int) string {
	if rating <= 1399 {
		return "Division 4"
	}

	if rating <= 1599 {
		return "Division 3"
	}

	if rating <= 1899 {
		return "Division 2"
	}

	return "Division 1"
}

func main() {

	var n int
	fmt.Scanf("%d", &n)

	for i := 0; i < n; i++ {
		var rating int
		fmt.Scanf("%d", &rating)
		fmt.Printf("%s\n", runCase(rating))
	}
}

package main

import (
	"fmt"
)

func runCase()  string {
	var rating int
	fmt.Scanf("%d", &rating)

	if rating <= 1399 {
		return "Division 4"
	}

	if rating <= 1599 {
		return "Division 3"
	}

	if rating <= 1899 {
		return "Division 2"
	}

	return "Division 1"
}

func main ()  {

	var n int
	fmt.Scanf("%d", &n)

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

package main

import "fmt"

func main() {
	var (
		testcases int
		input     int
		output    string = "Division "
	)
	fmt.Scan(&testcases)

	for testcases > 0 {
		testcases -= 1

		fmt.Scan(&input)
		if input >= 1900 {
			output += "1"
		} else if input > 1599 {
			output += "2"
		} else if input > 1399 {
			output += "3"
		} else {
			output += "4"
		}

		fmt.Println(output)
	}

}

package main

import "fmt"

func main() {
	var (
		testcases int
		input     int
		output    string = "Division "
	)
	fmt.Scan(&testcases)

	for testcases > 0 {
		testcases -= 1
        output = "Division "
		fmt.Scan(&input)
		if input > 1900 {
			output += "1"
		} else if input > 1599 {
			output += "2"
		} else if input > 1399 {
			output += "3"
		} else {
			output += "4"
		}

		fmt.Println(output)
	}

}

package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a)
	for i := 0; i < a; i++ {
		fmt.Scan(&b)
		if 1900 <= b {
			fmt.Print("Division 1")
		} else if 1600 <= b && b <= 1899 {
			fmt.Print("Division 2")
		} else if 1400 <= b && b <= 1599 {
			fmt.Print("Division 3")
		} else if b <= 1399 {
			fmt.Print("Division 4")
		}
	}
}

package main

import "fmt"

var division string = "Division"
func main(){
    var t int

    fmt.Scan(&t)
    var rating int

    for i:= 0; i<t; i++{
        fmt.Scan(&rating)
        fmt.Println(Rating(rating))
    }

}
func Rating(elo int) string{

    if(elo<=1399){
        return division + "4"
    }
    if(elo <= 1599){
        return division + "3"
    }
    if(elo<= 1899){
        return division + "2"
    }
    if(elo<= 1900){
        return division + "1"
    }
    return division
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	str, _ := reader.ReadString('\n')
	t, _ := strconv.ParseInt(strings.TrimSpace(str), 10, 32)
	tt := int(t)
	for i := 0; i < tt; i++ {
		rate, _ := reader.ReadString('\n')
		rate_, _ := strconv.ParseInt(strings.TrimSpace(rate), 10, 32)
		if rate_ < 1400 {
			fmt.Println("Divison 4")
		} else if rate_ < 1600 {
			fmt.Println("Divison 3")
		} else if rate_ < 1900 {
			fmt.Println("Divison 2")
		} else {
			fmt.Println("Divison 1")
		}
	}
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		var r int
		fmt.Scanf("%d", &r)
		switch {
		case r >= 1900:
			fmt.Println("Division", 1)
		case r <= 1899 && r >= 1600:
			fmt.Println("Division", 2)
		case r <= 1599 && r >= 1400:
			fmt.Println("Division", 3)
		case r <= 1399:
			fmt.Println("Division", 4)
		}
	}
}

package main

import (
    "fmt"
)

func main(){
    var n int
    fmt.Scanf("%d",&n)
    for i := 1; i <= n;i++ {
        var rating int
        fmt.Scanf("%d",&rating)
        div := 1
        if rating <= 1399 {
            div = 4
        } else if rating <= 1599 {
            div = 3
        } else if rating <= 1899 {
            div = 2
        }
        fmt.Printf("Division %d\n",div)
    }
}

// @Title
// @Description
// @Author
// @Update
package main

import (
        "fmt"
)

func main() {
        var n int
        fmt.Scanln(&n)
        for i := 0; i < n; i++ {
                var st int
                fmt.Scanln(&st)
                switch {
                case st <= 1399:
                        fmt.Println("For Division 4")
                case st <= 1599:
                        fmt.Println("For Division 3")
                case st <= 1899:
                        fmt.Println("For Division 2")
                case st >= 1900:
                        fmt.Println("For Division 1")
                }
        }
}

package main
import "fmt"

func solve() {
    var rating int
    fmt.Scanln(&rating)
    fmt.Print("Divison ")
    if rating < 1400 {
        fmt.Println(4)
    } else if rating < 1600 {
        fmt.Println(3)
    } else if rating < 1900 {
        fmt.Println(2)
    } else {
        fmt.Println(1)
    }
}

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

package main

import (
	"fmt"
)

func main(){
	var rating int
	//reader := bufio.NewReader(os.Stdin)
	//rating = reader.Read
	fmt.Scan(&rating)
	if rating >= 1900{
		fmt.Println("Division 1")
	}else if rating >= 1600{
		fmt.Println("Division 2")
	}else if rating >= 1400{
		fmt.Println("Division 3")
	}else{
		fmt.Println("Division 4")
	}
}

package main

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

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

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

	var T, x int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &x)
		o := "Division "
		if x < 1400 {
			o += "1"
		} else if x < 1600 {
			o += "2"
		} else if x < 1900 {
			o += "3"
		} else {
			o += "4"
		}

		Fprintln(out, o)

	}
}


Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour, and last lesson is during j-th hour, then he spends j - i + 1 hours in the university during this day. If there are no lessons during some day, then Ivan stays at home and therefore spends 0 hours in the university.Ivan doesn't like to spend a lot of time in the university, so he has decided to skip some lessons. He cannot skip more than k lessons during the week. After deciding which lessons he should skip and which he should attend, every day Ivan will enter the university right before the start of the first lesson he does not skip, and leave it after the end of the last lesson he decides to attend. If Ivan skips all lessons during some day, he doesn't go to the university that day at all.Given n, m, k and Ivan's timetable, can you determine the minimum number of hours he has to spend in the university during one week, if he cannot skip more than k lessons?

The first line contains three integers n, m and k (1 ≤ n, m ≤ 500, 0 ≤ k ≤ 500) — the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-th line is 1, then Ivan has a lesson on i-th day during j-th hour (if it is 0, there is no such lesson).

Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons.

NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day.

package main

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

const (
  INF = 1234567890
)

func Init() {
}

func Solve(io *FastIO) {
	N := io.NextInt()
	M := io.NextInt()
	K := io.NextInt()

	S := make([]string, N)
	for i := range S {
	  S[i] = io.NextLine()
	}

	skips := MakeIntMatrix(N, M + 1)
	for ln, line := range S {
	  total := 0
	  for _, c := range line {
	    if c == '1' {
	      total++
	    }
	  }
	 // fmt.Printf("ln = %d, line = %s, total = %d\n", ln, line, total)
	  FillIntArray(skips[ln], INF)
	  for i := 0; i < M; i++ {
	    classes := 0
	    for j := i; j < M; j++ {
	      if line[j] == '1' {
	        classes++
	        skipped := total - classes
	       // fmt.Println(i, j, total, classes, skipped)
	        skips[ln][skipped] = Min(skips[ln][skipped], j - i + 1)
	      }
	    }
	  }
	  for i := 0; i <= M; i++ {
	    if skips[ln][i] == INF {
	      skips[ln][i] = 0
	    }
	  }
    // fmt.Println(ln, skips[ln])
	}

	dp := make([]int, K + 1)
	FillIntArray(dp, INF)
	dp[0] = 0
	for i := 0; i < N; i++ {
	  next := make([]int, K + 1)
	  FillIntArray(next, INF)
	  for j := 0; j <= K; j++ {
	    for k := 0; j + k <= K && k <= M; k++ {
	     // fmt.Println(i, j, k, len(skips), len(dp), len(next))
	      next[j + k] = Min(next[j + k], dp[j] + skips[i][k])
	     // fmt.Printf("i = %d, j = %d, k = %d, next = %d\n", i, j, k, next[j + k])
	    }
	  }
	  dp = next
	 // fmt.Println(i, dp)
	}

	best := INF
	for i := 0; i <= K; i++ {
	  best = Min(best, dp[i])
	}
	io.Println(best)
}

func MakeIntMatrix(rows, cols int) [][]int {
	mat := make([][]int, rows)
	for i := range mat {
		mat[i] = make([]int, cols)
	}
	return mat
}

func Min(args ...int) int {
	min := args[0]
	for i := 1; i < len(args); i++ {
		if args[i] < min {
			min = args[i]
		}
	}
	return min
}

func FillIntArray(arr []int, val int) {
	for i := range arr {
		arr[i] = val
	}
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

package main

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

const (
  INF = 1234567890
)

func Init() {
}

func Solve(io *FastIO) {
	N := io.NextInt()
	M := io.NextInt()
	K := io.NextInt()

	S := make([]string, N)
	for i := range S {
	  S[i] = io.NextLine()
	}

	skips := MakeIntMatrix(N, M + 1)
	for ln, line := range S {
	  total := 0
	  for _, c := range line {
	    if c == '1' {
	      total++
	    }
	  }
	  FillIntArray(skips[ln], INF)
	  for i := 0; i < M; i++ {
	    classes := 0
	    for j := i; j < M; j++ {
	      if line[j] == '1' {
	        classes++
	        skipped := total - classes
	        skips[ln][skipped] = Min(skips[ln][skipped], j - i + 1)
	      }
	    }
	  }
	  for i := 0; i <= M; i++ {
	    if skips[ln][i] == INF {
	      skips[ln][i] = 0
	    }
	  }
	}

	dp := make([]int, K + 1)
	FillIntArray(dp, INF)
	dp[0] = 0
	for i := 0; i < N; i++ {
	  next := make([]int, K + 1)
	  FillIntArray(next, INF)
	  for j := 0; j <= K; j++ {
	    for k := 0; j + k <= K && k <= M; k++ {
	      next[j + k] = Min(next[j + k], dp[j] + skips[i][k])
	    }
	  }
	  dp = next
	}

	best := INF
	for i := 0; i <= K; i++ {
	  best = Min(best, dp[i])
	}
	io.Println(best)
}

func MakeIntMatrix(rows, cols int) [][]int {
	mat := make([][]int, rows)
	for i := range mat {
		mat[i] = make([]int, cols)
	}
	return mat
}

func Min(args ...int) int {
	min := args[0]
	for i := 1; i < len(args); i++ {
		if args[i] < min {
			min = args[i]
		}
	}
	return min
}

func FillIntArray(arr []int, val int) {
	for i := range arr {
		arr[i] = val
	}
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

package main

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

const (
	MaxN = 512
	MaxK = 512
	Inf  = MaxN * MaxK
)

var n, m, k int
var f, dp [MaxN][MaxK]int

func main() {
	buf := bufio.NewReader(os.Stdin)
	fmt.Fscanf(buf, "%d %d %d\n", &n, &m, &k)
	for i := 0; i < n; i++ {
		var tmp string
		fmt.Fscanf(buf, "%s\n", &tmp)
		t := make([]int, 0)
		for j := 0; j < m; j++ {
			if tmp[j] == '1' {
				t = append(t, j)
			}
		}
		tlen := len(t)
		if tlen > 0 {
			for k1 := 0; k1 < tlen; k1++ {
				f[i][k1] = Inf
			}
			for k1 := 0; k1 < tlen; k1++ {
				for x := 0; x <= k1; x++ {
					y := tlen - (k1 - x) - 1
					m := t[y] - t[x] + 1
					if f[i][k1] > m {
						f[i][k1] = m
					}
				}
			}
		}
	}

	for i := 0; i <= n; i++ {
		for j := 0; j <= k; j++ {
			dp[i][j] = Inf
		}
	}

	dp[0][0] = 0
	for i := 1; i <= n; i++ {
		for j := 0; j <= k; j++ {
			for l := 0; l <= j; l++ {
				t := dp[i-1][j-l] + f[i-1][l]
				if dp[i][j] > t {
					dp[i][j] = t
				}
			}
		}
	}

	fmt.Println(dp[n][k])
}

package main

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

const (
  INF = 1234567890
)

func Init() {
}

func Solve(io *FastIO) {
	N := io.NextInt()
	M := io.NextInt()
	K := io.NextInt()

	S := make([]string, N)
	for i := range S {
	  S[i] = io.NextLine()
	}

	skips := MakeIntMatrix(N, M + 1)
	for ln, line := range S {
	  total := 0
	  for _, c := range line {
	    if c == '1' {
	      total++
	    }
	  }
	 // fmt.Printf("ln = %d, line = %s, total = %d\n", ln, line, total)
	  FillIntArray(skips[ln], INF)
	  for i := 0; i < M; i++ {
	    classes := 0
	    for j := i; j < M; j++ {
	      if line[j] == '1' {
	        classes++
	        skipped := total - classes
	       // fmt.Println(i, j, total, classes, skipped)
	        skips[ln][skipped] = Min(skips[ln][skipped], j - i + 1)
	      }
	    }
	  }
	  for i := 0; i <= M; i++ {
	    if skips[ln][i] == INF {
	      skips[ln][i] = 0
	    }
	  }
    // fmt.Println(ln, skips[ln])
	}

	dp := make([]int, K + 1)
	FillIntArray(dp, INF)
	dp[0] = 0
	for i := 0; i < N; i++ {
	  next := make([]int, K + 1)
	  FillIntArray(next, INF)
	  for j := 0; j <= M && j <= K; j++ {
	    for k := 0; j + k <= K && k <= M; k++ {
	     // fmt.Println(i, j, k, len(skips), len(dp), len(next))
	      next[j + k] = Min(next[j + k], dp[j] + skips[i][k])
	     // fmt.Printf("i = %d, j = %d, k = %d, next = %d\n", i, j, k, next[j + k])
	    }
	  }
	  dp = next
	 // fmt.Println(i, dp)
	}

	best := INF
	for i := 0; i <= K; i++ {
	  best = Min(best, dp[i])
	}
	io.Println(best)
}

func MakeIntMatrix(rows, cols int) [][]int {
	mat := make([][]int, rows)
	for i := range mat {
		mat[i] = make([]int, cols)
	}
	return mat
}

func Min(args ...int) int {
	min := args[0]
	for i := 1; i < len(args); i++ {
		if args[i] < min {
			min = args[i]
		}
	}
	return min
}

func FillIntArray(arr []int, val int) {
	for i := range arr {
		arr[i] = val
	}
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


You are wandering in the explorer space of the 2050 Conference.The explorer space can be viewed as an undirected weighted grid graph with size $$$n\times m$$$. The set of vertices is $$$\{(i, j)|1\le i\le n, 1\le j\le m\}$$$. Two vertices $$$(i_1,j_1)$$$ and $$$(i_2, j_2)$$$ are connected by an edge if and only if $$$|i_1-i_2|+|j_1-j_2|=1$$$.At each step, you can walk to any vertex connected by an edge with your current vertex. On each edge, there are some number of exhibits. Since you already know all the exhibits, whenever you go through an edge containing $$$x$$$ exhibits, your boredness increases by $$$x$$$.For each starting vertex $$$(i, j)$$$, please answer the following question: What is the minimum possible boredness if you walk from $$$(i, j)$$$ and go back to it after exactly $$$k$$$ steps?You can use any edge for multiple times but the boredness on those edges are also counted for multiple times. At each step, you cannot stay on your current vertex. You also cannot change direction while going through an edge. Before going back to your starting vertex $$$(i, j)$$$ after $$$k$$$ steps, you can visit $$$(i, j)$$$ (or not) freely.

The first line contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2\leq n, m\leq 500, 1\leq k\leq 20$$$). The $$$j$$$-th number ($$$1\le j \le m - 1$$$) in the $$$i$$$-th line of the following $$$n$$$ lines is the number of exibits on the edge between vertex $$$(i, j)$$$ and vertex $$$(i, j+1)$$$.  The $$$j$$$-th number ($$$1\le j\le m$$$) in the $$$i$$$-th line of the following $$$n-1$$$ lines is the number of exibits on the edge between vertex $$$(i, j)$$$ and vertex $$$(i+1, j)$$$.  The number of exhibits on each edge is an integer between $$$1$$$ and $$$10^6$$$.

Output $$$n$$$ lines with $$$m$$$ numbers each. The $$$j$$$-th number in the $$$i$$$-th line, $$$answer_{ij}$$$, should be the minimum possible boredness if you walk from $$$(i, j)$$$ and go back to it after exactly $$$k$$$ steps. If you cannot go back to vertex $$$(i, j)$$$ after exactly $$$k$$$ steps, $$$answer_{ij}$$$ should be $$$-1$$$.

NoteIn the first example, the answer is always $$$10$$$ no matter how you walk.In the second example, $$$answer_{21} = 10$$$, the path is $$$(2,1) \to (1,1) \to (1,2) \to (2,2) \to (2,1)$$$, the boredness is $$$4 + 1 + 2 + 3 = 10$$$.

package main

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

type Scanner struct {
	bScanner *bufio.Scanner
}

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

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

const (
	inf = 1000000000
)

var (
	wrow [][]int
	wcol [][]int
	dist [][][]int
	dr   = []int{1, 0, -1, 0}
	dc   = []int{0, 1, 0, -1}
)

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

	N := sc.NextInt()
	M := sc.NextInt()
	K := sc.NextInt()

	wrow = make([][]int, N)
	wcol = make([][]int, N-1)
	for i := 0; i < N; i++ {
		wrow[i] = sc.NextInts(M - 1)
	}
	for i := 0; i < N-1; i++ {
		wcol[i] = sc.NextInts(M)
	}

	ans := InitInts2D(N, M, -1)
	if K%2 == 0 {
		dist = InitInts3D(N, M, K/2+1, 0)
		for k := 1; k <= K/2; k++ {
			for i := 0; i < N; i++ {
				for j := 0; j < M; j++ {
					dist[i][j][k] = inf

					for l := 0; l < 4; l++ {
						ii := i + dr[l]
						jj := j + dc[l]
						if 0 <= ii && ii < N && 0 <= jj && jj < M {
							w := 0
							if dr[l] != 0 {
								w = wcol[Min(i, ii)][jj]
							} else if dc[l] != 0 {
								w = wrow[ii][Min(j, jj)]
							}
							dist[i][j][k] = Min(dist[i][j][k], dist[ii][jj][k-1]+w)
						}
					}
				}
			}
		}

		for i := 0; i < N; i++ {
			for j := 0; j < M; j++ {
				ans[i][j] = 2 * dist[i][j][K/2]
			}
		}
	}

	for i := 0; i < N; i++ {
		for j := 0; j < M; j++ {
			fmt.Fprint(wr, ans[i][j], " ")
		}
		fmt.Fprintln(wr)
	}
}

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1517D(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	type edge struct{ x, y, wt int }

	var n, m, k, wt int
	Fscan(in, &n, &m, &k)
	if k&1 > 0 {
		for s := strings.Repeat("-1 ", m); n > 0; n-- {
			Fprintln(out, s)
		}
		return
	}
	k /= 2
	g := make([][][]edge, n)
	for i := range g {
		g[i] = make([][]edge, m)
		for j := 1; j < m; j++ {
			Fscan(in, &wt)
			g[i][j-1] = append(g[i][j-1], edge{i, j, wt})
			g[i][j] = append(g[i][j], edge{i, j - 1, wt})
		}
	}
	for i := 1; i < n; i++ {
		for j := 0; j < m; j++ {
			Fscan(in, &wt)
			g[i-1][j] = append(g[i-1][j], edge{i, j, wt})
			g[i][j] = append(g[i][j], edge{i - 1, j, wt})
		}
	}

	dp := make([][][]int, n)
	for i := range dp {
		dp[i] = make([][]int, m)
		for j := range dp[i] {
			dp[i][j] = make([]int, k+1)
			for k := range dp[i][j] {
				dp[i][j][k] = -1
			}
		}
	}
	var f func(x, y, k int) int
	f = func(x, y, k int) (res int) {
		if k == 0 {
			return
		}
		dv := &dp[x][y][k]
		if *dv != -1 {
			return *dv
		}
		defer func() { *dv = res }()
		res = 1e9
		for _, e := range g[x][y] {
			if r := f(e.x, e.y, k-1) + e.wt; r < res {
				res = r
			}
		}
		return
	}
	for i := 0; i < n; i++ {
		for j := 0; j < m; j++ {
			Fprint(out, f(i, j, k)*2, " ")
		}
		Fprintln(out)
	}
}

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

package main

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

type Scanner struct {
	bScanner *bufio.Scanner
}

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

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

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

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

const (
	inf = 1000000000
)

var (
	wrow [][]int
	wcol [][]int
	dist [][][]int
	dr   = []int{1, 0, -1, 0}
	dc   = []int{0, 1, 0, -1}
)

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

	n := sc.NextInt()
	m := sc.NextInt()
	k := sc.NextInt()

	wrow = make([][]int, n)
	wcol = make([][]int, n-1)
	for i := 0; i < n; i++ {
		wrow[i] = sc.NextInts(m - 1)
	}
	for i := 0; i < n-1; i++ {
		wcol[i] = sc.NextInts(m)
	}

	ans := InitInts2D(n, m, -1)
	if k%2 == 0 {
		dist = InitInts3D(n, m, k, inf)

		for i := 0; i < n; i++ {
			for j := 0; j < m; j++ {
				ans[i][j] = inf

				trace := make([]*StepState, 0)
				pq := PriorityQueue{&StepState{step: 0, dist: 0, row: i, col: j}}
				for len(pq) > 0 {
					from := heap.Pop(&pq).(*StepState)
					if dist[from.row][from.col][from.step] < from.dist {
						continue
					}
					// fmt.Fprintln(wr, from)

					if from.step == k/2 {
						ans[i][j] = 2 * from.dist
						for _, stepState := range trace {
							dist[stepState.row][stepState.col][stepState.step] = inf
						}
						pq = nil
						break
					}

					for k := 0; k < 4; k++ {
						to := &StepState{step: from.step + 1, dist: inf, row: from.row + dr[k], col: from.col + dc[k]}
						if 0 <= to.row && to.row < n && 0 <= to.col && to.col < m {
							if dr[k] != 0 {
								to.dist = from.dist + wcol[Min(from.row, to.row)][to.col]
							} else if dc[k] != 0 {
								to.dist = from.dist + wrow[to.row][Min(from.col, to.col)]
							}

							if dist[to.row][to.col][to.step] > to.dist {
								dist[to.row][to.col][to.step] = to.dist
								pq = append(pq, to)
								trace = append(trace, to)
							}
						}
					}
				}
			}
		}
	}

	for i := 0; i < n; i++ {
		for j := 0; j < m; j++ {
			fmt.Fprint(wr, ans[i][j], " ")
		}
		fmt.Fprintln(wr)
	}
}

package main

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

type Scanner struct {
	bScanner *bufio.Scanner
}

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

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

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

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

const (
	inf = 1000000000
)

var (
	wrow [][]int
	wcol [][]int
	dist [][][]int
	dr   = []int{1, 0, -1, 0}
	dc   = []int{0, 1, 0, -1}
)

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

	n := sc.NextInt()
	m := sc.NextInt()
	k := sc.NextInt()

	wrow = make([][]int, n)
	wcol = make([][]int, n-1)
	for i := 0; i < n; i++ {
		wrow[i] = sc.NextInts(m - 1)
	}
	for i := 0; i < n-1; i++ {
		wcol[i] = sc.NextInts(m)
	}

	ans := InitInts2D(n, m, -1)
	if k%2 == 0 {
		dist = InitInts3D(n, m, k, inf)

		for i := 0; i < n; i++ {
			for j := 0; j < m; j++ {
				ans[i][j] = inf

				trace := make([]*StepState, 0)
				pq := PriorityQueue{&StepState{step: 0, dist: 0, row: i, col: j}}
				for len(pq) > 0 {
					from := heap.Pop(&pq).(*StepState)
					if dist[from.row][from.col][from.step] < from.dist {
						continue
					}
					// fmt.Fprintln(wr, from)

					trace = append(trace, from)

					if from.step == k/2 {
						ans[i][j] = 2 * from.dist
						for _, stepState := range trace {
							dist[stepState.row][stepState.col][stepState.step] = inf
						}
						pq = nil
						break
					}

					for k := 0; k < 4; k++ {
						to := &StepState{step: from.step + 1, dist: inf, row: from.row + dr[k], col: from.col + dc[k]}
						if 0 <= to.row && to.row < n && 0 <= to.col && to.col < m {
							if dr[k] != 0 {
								to.dist = from.dist + wcol[Min(from.row, to.row)][to.col]
							} else if dc[k] != 0 {
								to.dist = from.dist + wrow[to.row][Min(from.col, to.col)]
							}

							if dist[to.row][to.col][to.step] > to.dist {
								dist[to.row][to.col][to.step] = to.dist
								pq = append(pq, to)
							}
						}
					}
				}
			}
		}
	}

	for i := 0; i < n; i++ {
		for j := 0; j < m; j++ {
			fmt.Fprint(wr, ans[i][j], " ")
		}
		fmt.Fprintln(wr)
	}
}

package main

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

type Scanner struct {
	bScanner *bufio.Scanner
}

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

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

const (
	inf  = 1000000000
	maxn = 100005
)

var (
	n, q                 int
	arr, smallestDivider []int
	memo                 [][]int
)

func primeFacts(num int) []int {
	result := make([]int, 0)
	for num > 1 {
		curSmallestDivider := smallestDivider[num]
		if len(result) == 0 || result[len(result)-1] != curSmallestDivider {
			result = append(result, curSmallestDivider)
		}
		num /= curSmallestDivider
	}
	return result
}

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

	smallestDivider = InitInts1D(maxn, -1)
	for i := 2; i < maxn; i++ {
		if smallestDivider[i] != -1 {
			continue
		}
		smallestDivider[i] = i
		for j := int64(i) * int64(i); j < maxn; j += int64(i) {
			if smallestDivider[j] == -1 {
				smallestDivider[j] = i
			}
		}
	}

	n = sc.NextInt()
	q = sc.NextInt()
	arr = sc.NextInts(n)

	idxPrime := make([][]int, maxn)
	memo = InitInts2D(n+5, 20, n)
	memo[n][0] = n
	for i := n - 1; i >= 0; i-- {
		curPrimeFacts := primeFacts(arr[i])

		minStartIdx := n
		for _, primeFact := range curPrimeFacts {
			curIdxPrime := idxPrime[primeFact]
			if len(curIdxPrime) > 0 {
				minStartIdx = Min(minStartIdx, curIdxPrime[len(curIdxPrime)-1])
			}
			curIdxPrime = append(curIdxPrime, i)
			idxPrime[primeFact] = curIdxPrime
		}
		memo[i][0] = Min(minStartIdx, memo[i+1][0])
	}

	for i := 1; i < 20; i++ {
		for j := 0; j < n; j++ {
			memo[j][i] = memo[memo[j][i-1]][i-1]
		}
	}

	for i := 0; i < q; i++ {
		l := sc.NextInt()
		r := sc.NextInt()
		l--
		r--

		now := l
		ans := 0
		for j := 19; j >= 0; j-- {
			if memo[now][j] <= r {
				now = memo[now][j]
				ans += (1 << j)
			}
		}
		ans++
		fmt.Fprintln(wr, ans)
	}

}


A little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sausage and cheese sandwiches, but first, he needs to buy a sausage and some cheese.The town where Laurenty lives in is not large. The houses in it are located in two rows, n houses in each row. Laurenty lives in the very last house of the second row. The only shop in town is placed in the first house of the first row.The first and second rows are separated with the main avenue of the city. The adjacent houses of one row are separated by streets.Each crosswalk of a street or an avenue has some traffic lights. In order to cross the street, you need to press a button on the traffic light, wait for a while for the green light and cross the street. Different traffic lights can have different waiting time.The traffic light on the crosswalk from the j-th house of the i-th row to the (j + 1)-th house of the same row has waiting time equal to aij (1 ≤ i ≤ 2, 1 ≤ j ≤ n - 1). For the traffic light on the crossing from the j-th house of one row to the j-th house of another row the waiting time equals bj (1 ≤ j ≤ n). The city doesn't have any other crossings.The boy wants to get to the store, buy the products and go back. The main avenue of the city is wide enough, so the boy wants to cross it exactly once on the way to the store and exactly once on the way back home. The boy would get bored if he had to walk the same way again, so he wants the way home to be different from the way to the store in at least one crossing.    Figure to the first sample. Help Laurenty determine the minimum total time he needs to wait at the crossroads.

The first line of the input contains integer n (2 ≤ n ≤ 50) — the number of houses in each row.  Each of the next two lines contains n - 1 space-separated integer — values aij (1 ≤ aij ≤ 100).  The last line contains n space-separated integers bj (1 ≤ bj ≤ 100).

Print a single integer — the least total time Laurenty needs to wait at the crossroads, given that he crosses the avenue only once both on his way to the store and on his way back home.

NoteThe first sample is shown on the figure above. In the second sample, Laurenty's path can look as follows:   Laurenty crosses the avenue, the waiting time is 3;  Laurenty uses the second crossing in the first row, the waiting time is 2;  Laurenty uses the first crossing in the first row, the waiting time is 1;  Laurenty uses the first crossing in the first row, the waiting time is 1;  Laurenty crosses the avenue, the waiting time is 1;  Laurenty uses the second crossing in the second row, the waiting time is 3.  In total we get that the answer equals 11.In the last sample Laurenty visits all the crossings, so the answer is 4.

package main

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

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

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

	n := nextInt()
	a := make([][]int, 2)
	b := make([]int, n)
	c := make([]int, n)
	totalTime := 0

	for i := range a {
		a[i] = make([]int, n-1)

		for j := range a[i] {
			a[i][j] = nextInt()
			if i == 1 {
				totalTime += a[i][j]
			}
		}
	}

	for i := range b {
		b[i] = nextInt()
	}

	for i := range b {
		if i > 0 {
			totalTime += a[0][i-1] - b[i-1] - a[1][i-1]
		}

		totalTime += b[i]

		c[i] = totalTime
	}

	sort.Ints(c)
	println(c[0] + c[1])
}

func scan(a ...interface{}) {
	fmt.Fscan(reader, a...)
}

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

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

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...) }
func print(a ...interface{})                 { fmt.Fprint(writer, a...) }
func printf(format string, a ...interface{}) { fmt.Fprintf(writer, format, a...) }

package main

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

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

func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func getLine2Int() (n int) {
	scanf("%d\n", &n)
	return
}
func getLine2Ints(n int) []int {
	ans := make([]int, n)
	for i := 0; i < n-1; i++ {
		scanf("%d ", &ans[i])
	}
	scanf("%d\n", &ans[n-1])
	return ans
}

func main() {
	defer writer.Flush()

	n := getLine2Int()
	a1 := getLine2Ints(n - 1)
	a2 := getLine2Ints(n - 1)
	b := getLine2Ints(n)
	cost1 := make([]int, n)
	for i := 1; i < n; i++ {
		cost1[i] = cost1[i-1] + a1[i-1]
	}
	cost2 := make([]int, n)
	for i := n - 2; i >= 0; i-- {
		cost2[i] = cost2[i+1] + a2[i]
	}
	cost3 := make([]int, n)
	for i := 0; i < n; i++ {
		cost3[i] = cost1[i] + b[i] + cost2[i]
	}
	min, second := cost3[0], cost3[1]
	if second < min {
		min, second = second, min
	}
	for i := 2; i < n; i++ {
		if cost3[i] < min {
			second, min = min, cost3[i]
		} else if cost3[i] < second {
			second = cost3[i]
		}
	}
	printf("%d\n", min+second)
}