The 9-th grade student Gabriel noticed a caterpillar on a tree when walking around in a forest after the classes. The caterpillar was on the height h1 cm from the ground. On the height h2 cm (h2 > h1) on the same tree hung an apple and the caterpillar was crawling to the apple.Gabriel is interested when the caterpillar gets the apple. He noted that the caterpillar goes up by a cm per hour by day and slips down by b cm per hour by night.In how many days Gabriel should return to the forest to see the caterpillar get the apple. You can consider that the day starts at 10 am and finishes at 10 pm. Gabriel's classes finish at 2 pm. You can consider that Gabriel noticed the caterpillar just after the classes at 2 pm.Note that the forest is magic so the caterpillar can slip down under the ground and then lift to the apple.

The first line contains two integers h1, h2 (1 ≤ h1 < h2 ≤ 105) — the heights of the position of the caterpillar and the apple in centimeters. The second line contains two integers a, b (1 ≤ a, b ≤ 105) — the distance the caterpillar goes up by day and slips down by night, in centimeters per hour.

Print the only integer k — the number of days Gabriel should wait to return to the forest and see the caterpillar getting the apple. If the caterpillar can't get the apple print the only integer  - 1.

NoteIn the first example at 10 pm of the first day the caterpillar gets the height 26. At 10 am of the next day it slips down to the height 14. And finally at 6 pm of the same day the caterpillar gets the apple.Note that in the last example the caterpillar was slipping down under the ground and getting the apple on the next day.

package main

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

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

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

	h1, h2 := nextInt(), nextInt()
	a, b := nextInt(), nextInt()

	h1 += a * 8

	if a <= b {
		if h1 < h2 {
			println(-1)
			return
		}
	}

	day := 0

	for h1 < h2 {
		h1 += (a - b) * 12
		day++
	}

	println(day)
}

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"
	"strconv"
	"strings"
)

func main() {

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	init := scanner.Text()
	heights := strings.Split(init, " ")

	cater, _ := strconv.Atoi(heights[0])
	apple, _ := strconv.Atoi(heights[1])

	scanner.Scan()
	input := scanner.Text()
	ins := strings.Split(input, " ")

	upS, _ := strconv.Atoi(ins[0])
	dS, _ := strconv.Atoi(ins[1])

	diffDay := (upS - dS) * 12
	days := 0
	// lets move for day1 first
	cater = (cater + 8*upS)
	if cater >= apple {
		fmt.Println(days)
		return
	}
	if dS >= upS {
		fmt.Println(-1)
		return
	}
	for {
		if cater >= apple {
			fmt.Println(days)
			return
		}

		days++
		cater += diffDay
	}

}


There is a field of size $$$2 \times 2$$$. Each cell of this field can either contain grass or be empty. The value $$$a_{i, j}$$$ is $$$1$$$ if the cell $$$(i, j)$$$ contains grass, or $$$0$$$ otherwise.In one move, you can choose one row and one column and cut all the grass in this row and this column. In other words, you choose the row $$$x$$$ and the column $$$y$$$, then you cut the grass in all cells $$$a_{x, i}$$$ and all cells $$$a_{i, y}$$$ for all $$$i$$$ from $$$1$$$ to $$$2$$$. After you cut the grass from a cell, it becomes empty (i. e. its value is replaced by $$$0$$$).Your task is to find the minimum number of moves required to cut the grass in all non-empty cells of the field (i. e. make all $$$a_{i, j}$$$ zeros).You have to answer $$$t$$$ independent test cases.

The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 16$$$) — the number of test cases. Then $$$t$$$ test cases follow. The test case consists of two lines, each of these lines contains two integers. The $$$j$$$-th integer in the $$$i$$$-th row is $$$a_{i, j}$$$. If $$$a_{i, j} = 0$$$ then the cell $$$(i, j)$$$ is empty, and if $$$a_{i, j} = 1$$$ the cell $$$(i, j)$$$ contains grass.

For each test case, print one integer — the minimum number of moves required to cut the grass in all non-empty cells of the field (i. e. make all $$$a_{i, j}$$$ zeros) in the corresponding test case.

package main

import(
	"fmt"
)

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

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

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

}

package main

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

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

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

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

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

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

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

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

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

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

package main

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

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

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

package main

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

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

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

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

    import "fmt"

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

package main
import "fmt"

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

}

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

package main

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

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

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

package main

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

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

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

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

package main

import "fmt"

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

	fmt.Scanln(&t)

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

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

package main

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

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

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

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

package main

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

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

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

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

package main

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

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

	var T int
	fmt.Fscan(in, &T)
	for t := 0; t < T; t++ {
		var tot int
		for i := 0; i < 4; i++ {
			var v int
			fmt.Fscan(in, &v)
			tot += v
		}

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

// 1701A. Grass Field
package main

import (
	"fmt"
)

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

package main

import "fmt"

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

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

	return 1
}

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

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

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

package main

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

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

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

	var T int
	var x int

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

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

		Fprintln(out, ans)
	}
}

package main

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

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

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

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

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

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

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

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

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

package main

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

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

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

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

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

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

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

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

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

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

package main

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

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

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

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

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

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

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

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

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

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

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

import "fmt"

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

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

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

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

package main
import "fmt"

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

}


Vasya started working in a machine vision company of IT City. Vasya's team creates software and hardware for identification of people by their face.One of the project's know-how is a camera rotating around its optical axis on shooting. People see an eye-catching gadget — a rotating camera — come up to it to see it better, look into it. And the camera takes their photo at that time. What could be better for high quality identification?But not everything is so simple. The pictures from camera appear rotated too (on clockwise camera rotation frame the content becomes rotated counter-clockwise). But the identification algorithm can work only with faces that are just slightly deviated from vertical.Vasya was entrusted to correct the situation — to rotate a captured image so that image would be minimally deviated from vertical. Requirements were severe. Firstly, the picture should be rotated only on angle divisible by 90 degrees to not lose a bit of information about the image. Secondly, the frames from the camera are so huge and FPS is so big that adequate rotation speed is provided by hardware FPGA solution only. And this solution can rotate only by 90 degrees clockwise. Of course, one can apply 90 degrees turn several times but for the sake of performance the number of turns should be minimized.Help Vasya implement the program that by the given rotation angle of the camera can determine the minimum number of 90 degrees clockwise turns necessary to get a picture in which up direction deviation from vertical is minimum.The next figure contains frames taken from an unrotated camera, then from rotated 90 degrees clockwise, then from rotated 90 degrees counter-clockwise. Arrows show direction to "true up".  The next figure shows 90 degrees clockwise turn by FPGA hardware.

The only line of the input contains one integer x ( - 1018 ≤ x ≤ 1018) — camera angle in degrees. Positive value denotes clockwise camera rotation, negative — counter-clockwise.

Output one integer — the minimum required number of 90 degrees clockwise turns.

NoteWhen the camera is rotated 60 degrees counter-clockwise (the second example), an image from it is rotated 60 degrees clockwise. One 90 degrees clockwise turn of the image result in 150 degrees clockwise total rotation and deviation from "true up" for one turn is 150 degrees. Two 90 degrees clockwise turns of the image result in 240 degrees clockwise total rotation and deviation from "true up" for two turns is 120 degrees because 240 degrees clockwise equal to 120 degrees counter-clockwise. Three 90 degrees clockwise turns of the image result in 330 degrees clockwise total rotation and deviation from "true up" for three turns is 30 degrees because 330 degrees clockwise equal to 30 degrees counter-clockwise.From 60, 150, 120 and 30 degrees deviations the smallest is 30, and it it achieved in three 90 degrees clockwise turns.

// Codeforces 635 E, with podskazki, done
package main

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

func miconv(s string) int64 {
    iret,err := strconv.ParseInt(s, 10, 64)
    if err != nil {
        fmt.Println("error in converting " + s)
    }
    return iret
}

var x int64
var pov int64

func main() {
    // reading n
    in    := bufio.NewReader(os.Stdin)
    s,err := in.ReadString('\n')
    if err != nil {
        fmt.Println("first read failure", err)
    }
    ss := strings.Split(strings.Trim(s," \n\r")," ")
    x = miconv(ss[0])

    if x > 0 {
        x = x % 360
    } else {
        x = -(-x % 360)
        x = (x + 360) % 360
    }
    // fmt.Printf("converted x = %d\n", x)

    if x<=45 {
        pov = 0
    } else if x<=135 {
        pov = 1
    } else if x<=225 {
        pov = 2
    } else if x>=315 {
        pov = 0
    } else {
        pov = 3
    }

	// print result
	fmt.Printf("%d\n", pov)
}

// Codeforces 635 E, with podskazki, done
package main

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

func miconv(s string) int64 {
    i,err := strconv.Atoi(s)
    if err != nil {
        fmt.Println("error in converting " + s)
    }
    iret := int64(i)
    return iret
}

var x int64
var pov int64

func main() {
    // reading n
    in    := bufio.NewReader(os.Stdin)
    s,err := in.ReadString('\n')
    if err != nil {
        fmt.Println("first read failure", err)
    }
    ss := strings.Split(strings.Trim(s," \n\r")," ")
    x = miconv(ss[0])

    if x > 0 {
        x = x % 360
    } else {
        x = -(-x % 360)
        x = (x + 360) % 360
    }
    // fmt.Printf("converted x = %d\n", x)

    if x<=45 {
        pov = 0
    } else if x<=135 {
        pov = 1
    } else if x<=225 {
        pov = 2
    } else if x>=315 {
        pov = 0
    } else {
        pov = 3
    }

	// print result
	fmt.Printf("%d\n", pov)
}


Little Petya loves playing with squares. Mum bought him a square 2n × 2n in size. Petya marked a cell inside the square and now he is solving the following task.The task is to draw a broken line that would go along the grid lines and that would cut the square into two equal parts. The cutting line should not have any common points with the marked cell and the resulting two parts should be equal up to rotation.Petya wants to determine whether it is possible to cut the square in the required manner given the sizes of the square side and the coordinates of the marked cell. Help him.

The first line contains three space-separated integers 2n, x and y (2 ≤ 2n ≤ 100, 1 ≤ x, y ≤ 2n), representing the length of a square's side and the coordinates of the marked cell. It is guaranteed that 2n is even. The coordinates of the marked cell are represented by a pair of numbers x y, where x represents the number of the row and y represents the number of the column. The rows and columns are numbered by consecutive integers from 1 to 2n. The rows are numbered from top to bottom and the columns are numbered from the left to the right.

If the square is possible to cut, print "YES", otherwise print "NO" (without the quotes).

NoteA sample test from the statement and one of the possible ways of cutting the square are shown in the picture:

package main

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

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

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

package main

import "fmt"

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

//112B
package main
import "fmt"

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

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

import (
    "fmt"
)

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

}

// 112B
package main

import (
	"fmt"
)

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

// 112B-mic
package main

import (
	"fmt"
)

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

package main

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

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

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

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

import (
    "fmt"
)

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

}

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

import (
	"fmt"
)

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

}


This morning, Roman woke up and opened the browser with $$$n$$$ opened tabs numbered from $$$1$$$ to $$$n$$$. There are two kinds of tabs: those with the information required for the test and those with social network sites. Roman decided that there are too many tabs open so he wants to close some of them.He decided to accomplish this by closing every $$$k$$$-th ($$$2 \leq k \leq n - 1$$$) tab. Only then he will decide whether he wants to study for the test or to chat on the social networks. Formally, Roman will choose one tab (let its number be $$$b$$$) and then close all tabs with numbers $$$c = b + i \cdot k$$$ that satisfy the following condition: $$$1 \leq c \leq n$$$ and $$$i$$$ is an integer (it may be positive, negative or zero).For example, if $$$k = 3$$$, $$$n = 14$$$ and Roman chooses $$$b = 8$$$, then he will close tabs with numbers $$$2$$$, $$$5$$$, $$$8$$$, $$$11$$$ and $$$14$$$.After closing the tabs Roman will calculate the amount of remaining tabs with the information for the test (let's denote it $$$e$$$) and the amount of remaining social network tabs ($$$s$$$). Help Roman to calculate the maximal absolute value of the difference of those values $$$|e - s|$$$ so that it would be easy to decide what to do next.

The first line contains two integers $$$n$$$ and $$$k$$$ ($$$2 \leq k < n \leq 100$$$) — the amount of tabs opened currently and the distance between the tabs closed. The second line consists of $$$n$$$ integers, each of them equal either to $$$1$$$ or to $$$-1$$$. The $$$i$$$-th integer denotes the type of the $$$i$$$-th tab: if it is equal to $$$1$$$, this tab contains information for the test, and if it is equal to $$$-1$$$, it's a social network tab.

Output a single integer — the maximum absolute difference between the amounts of remaining tabs of different types $$$|e - s|$$$.

NoteIn the first example we can choose $$$b = 1$$$ or $$$b = 3$$$. We will delete then one tab of each type and the remaining tabs are then all contain test information. Thus, $$$e = 2$$$ and $$$s = 0$$$ and $$$|e - s| = 2$$$.In the second example, on the contrary, we can leave opened only tabs that have social networks opened in them.

package main

import "fmt"

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

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

	fmt.Println(ans)
}

package main

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

type CaseInput struct {
	K int64
	Tabs []int64
}

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

type CaseOutput struct {
	MaxDiff int64
}

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

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

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

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

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

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

	solveSequential(scanner, writer)
}

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

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

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

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

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

package main

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

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

package main

import (
	"fmt"
	"math"
)

const maxn = 105

var a [maxn] int

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

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

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

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

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

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

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

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

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

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

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

package main

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

type in struct {
	Scanner *bufio.Scanner
}

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

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

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

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

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

package main

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

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

	var browse []int
	var e, s int

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

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

		browse = append(browse, each)
	}

	max := -1

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

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

			j += k
		}

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

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

	fmt.Println(max)
}

package main

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

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

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

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

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

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

	ans := 0

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

	printf("%d", ans)

}

package main

import (
	"fmt"
	"math"
)

var ns [200]int

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

package main

import (
	"fmt"
	"math"
)

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

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

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

package main

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

var scanner = bufio.NewScanner(os.Stdin)

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

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

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

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

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

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

	return l
}

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

	return l
}

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

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

	return l
}

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

type ByAge []uint64

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

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

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

	// fmt.Println(a)

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

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

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

		// fmt.Println(tmp)

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

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

	fmt.Println(best)
}

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

	return a
}

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

	return -a
}

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

	return b
}

package main

import (
	"fmt"
	"math"
)

var ns [200]int

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

package main

import (
	"fmt"
	"math"
)

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

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

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


Misha and Vasya participated in a Codeforces contest. Unfortunately, each of them solved only one problem, though successfully submitted it at the first attempt. Misha solved the problem that costs a points and Vasya solved the problem that costs b points. Besides, Misha submitted the problem c minutes after the contest started and Vasya submitted the problem d minutes after the contest started. As you know, on Codeforces the cost of a problem reduces as a round continues. That is, if you submit a problem that costs p points t minutes after the contest started, you get  points. Misha and Vasya are having an argument trying to find out who got more points. Help them to find out the truth.

The first line contains four integers a, b, c, d (250 ≤ a, b ≤ 3500, 0 ≤ c, d ≤ 180).  It is guaranteed that numbers a and b are divisible by 250 (just like on any real Codeforces round).

Output on a single line:  "Misha" (without the quotes), if Misha got more points than Vasya. "Vasya" (without the quotes), if Vasya got more points than Misha. "Tie" (without the quotes), if both of them got the same number of points.

package main

import (
    "fmt"
)

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

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

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

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

package main

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

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

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

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

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

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

	return b
}

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

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

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

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

package main

import "fmt"

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

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

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

package main

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

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

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

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

package main

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

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

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

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

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

package main

import (
	"fmt"
	"math"
)

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

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

package main

import (
	"fmt"
)

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

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

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

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

	var res string

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

	fmt.Println(res)
}

package main

import (
	"fmt"
)

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

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

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

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

package main

import (
	"fmt"
)

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

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

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

package main

import (
	"fmt"
)

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

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

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

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

	var res string

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

	fmt.Println(res)
}

package main

import (
	"fmt"
)

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

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

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

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


There are n children in Jzzhu's school. Jzzhu is going to give some candies to them. Let's number all the children from 1 to n. The i-th child wants to get at least ai candies.Jzzhu asks children to line up. Initially, the i-th child stands at the i-th place of the line. Then Jzzhu start distribution of the candies. He follows the algorithm:  Give m candies to the first child of the line.  If this child still haven't got enough candies, then the child goes to the end of the line, else the child go home.  Repeat the first two steps while the line is not empty. Consider all the children in the order they go home. Jzzhu wants to know, which child will be the last in this order?

The first line contains two integers n, m (1 ≤ n ≤ 100; 1 ≤ m ≤ 100). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 100).

Output a single integer, representing the number of the last child.

NoteLet's consider the first sample. Firstly child 1 gets 2 candies and go home. Then child 2 gets 2 candies and go to the end of the line. Currently the line looks like [3, 4, 5, 2] (indices of the children in order of the line). Then child 3 gets 2 candies and go home, and then child 4 gets 2 candies and goes to the end of the line. Currently the line looks like [5, 2, 4]. Then child 5 gets 2 candies and goes home. Then child 2 gets two candies and goes home, and finally child 4 gets 2 candies and goes home.Child 4 is the last one who goes home.

package main

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

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

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

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

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

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

		line = a / m

		if a % m > 0 {
			line++
		}

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

	println(pos + 1)
}

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

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

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

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

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

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

package main

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

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

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

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

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

		childGet := make([]int, n)

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

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

package main

import "fmt"

func main() {

	var a, n, m, num int

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

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

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

	}
	fmt.Println(num)
}

package main

import (
	"fmt"
)

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

package main

import (
    "fmt"
    )

type child struct {
    index   int
    left    int
}

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

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

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

    fmt.Println(ans)
}

package main

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

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

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

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

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

		childGet := make([]int, n)

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

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

package main

import "fmt"

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

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

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


ZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists a substring (contiguous segment of letters) of it of length 26 where each letter of English alphabet appears exactly once. In particular, if the string has length strictly less than 26, no such substring exists and thus it is not nice.Now, ZS the Coder tells you a word, where some of its letters are missing as he forgot them. He wants to determine if it is possible to fill in the missing letters so that the resulting word is nice. If it is possible, he needs you to find an example of such a word as well. Can you help him?

The first and only line of the input contains a single string s (1 ≤ |s| ≤ 50 000), the word that ZS the Coder remembers. Each character of the string is the uppercase letter of English alphabet ('A'-'Z') or is a question mark ('?'), where the question marks denotes the letters that ZS the Coder can't remember.

If there is no way to replace all the question marks with uppercase letters such that the resulting word is nice, then print  - 1 in the only line. Otherwise, print a string which denotes a possible nice word that ZS the Coder learned. This string should match the string from the input, except for the question marks replaced with uppercase English letters. If there are multiple solutions, you may print any of them.

NoteIn the first sample case, ABCDEFGHIJKLMNOPQRZTUVWXYS is a valid answer beacuse it contains a substring of length 26 (the whole string in this case) which contains all the letters of the English alphabet exactly once. Note that there are many possible solutions, such as ABCDEFGHIJKLMNOPQRSTUVWXYZ or ABCEDFGHIJKLMNOPQRZTUVWXYS.In the second sample case, there are no missing letters. In addition, the given string does not have a substring of length 26 that contains all the letters of the alphabet, so the answer is  - 1.In the third sample case, any string of length 26 that contains all letters of the English alphabet fits as an answer.

package main

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

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

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

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

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

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

	return true
}

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

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

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

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

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

}

package main

import "fmt"

var all = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

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

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

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

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

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

	return string(b)
}

package main

import "fmt"

var all = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

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

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

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

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

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

	return string(b)
}

package main

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

var all = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

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

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

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

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

package main

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

package main

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

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

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

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

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

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

package main

import "fmt"

var all = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

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

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

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

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

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

	return string(b)
}

package main

import "fmt"

var all = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

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

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

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

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

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

	return string(b)
}

package main

import "fmt"

var all = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

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

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

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

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

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

	return string(b)
}

package main

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

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

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

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

package main

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

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

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

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

package main

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

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

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

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

package main

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

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

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

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

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

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

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

package main

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

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

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

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

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

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

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

package main

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

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

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

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

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

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

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


At regular competition Vladik and Valera won a and b candies respectively. Vladik offered 1 his candy to Valera. After that Valera gave Vladik 2 his candies, so that no one thought that he was less generous. Vladik for same reason gave 3 candies to Valera in next turn.More formally, the guys take turns giving each other one candy more than they received in the previous turn.This continued until the moment when one of them couldn’t give the right amount of candy. Candies, which guys got from each other, they don’t consider as their own. You need to know, who is the first who can’t give the right amount of candy.

Single line of input data contains two space-separated integers a, b (1 ≤ a, b ≤ 109) — number of Vladik and Valera candies respectively.

Pring a single line "Vladik’’ in case, if Vladik first who can’t give right amount of candy, or "Valera’’ otherwise.

NoteIllustration for first test case:Illustration for second test case:

package main

import "fmt"

func calc(first,second int){

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

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

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

import "fmt"

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

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

package main

import (
	"fmt"
)

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

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

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

package main

import "fmt"

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

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

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

package main

import "fmt"

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

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

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

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

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

package main

import "fmt"

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

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

package main

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

const debug = true

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

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

	i := 1

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

}

// Input helpers

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

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

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

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

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

	return
}

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

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

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

	return
}

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

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

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

	return
}

// String helpers

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

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

// Math helpers

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

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

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

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

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

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

// Output helpers

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

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

// Debug helpers

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

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

package main

import "fmt"

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

package main

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

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

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

package main

import "fmt"

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

package main

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

func solve(s string) string {
	return s
}

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

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

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

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

package main

import "fmt"

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

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

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

package main

import "fmt"

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

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

package main

import "fmt"

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

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

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

package main

import "fmt"

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

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

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

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

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

import "fmt"

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

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

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

import "fmt"

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

package main

import "fmt"

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

package main

import "fmt"

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