Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the i-th person is equal to ai.Consider the width of the person walking as usual to be equal to 1, while the width of the bent person is equal to 2. Friends want to talk to each other while walking, so they would like to walk in a single row. What is the minimum width of the road, such that friends can walk in a row and remain unattended by the guard?

Print a single integer — the minimum possible valid width of the road.

NoteIn the first sample, only person number 3 must bend down, so the required width is equal to 1 + 1 + 2 = 4.In the second sample, all friends are short enough and no one has to bend, so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.In the third sample, all the persons have to bend, except the last one. The required minimum width of the road is equal to 2 + 2 + 2 + 2 + 2 + 1 = 11.

package main

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

func main() {
	var n, h, m, a int
	var scanner *bufio.Scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	//var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

	scanner.Scan()
	n, _ = strconv.Atoi(scanner.Text())
	scanner.Scan()
	h, _ = strconv.Atoi(scanner.Text())

	for m = n; n > 0; n-- {
		scanner.Scan()
		a, _ = strconv.Atoi(scanner.Text())
		if a > h {
			m++
		}
	}

	fmt.Println(m)
}

package main

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

func main() {
	var n, h, m, a int
	var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
	var scanner *bufio.Scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	scanner.Scan()
	n, _ = strconv.Atoi(scanner.Text())
	scanner.Scan()
	h, _ = strconv.Atoi(scanner.Text())

	for m = n; n > 0; n-- {
		scanner.Scan()
		a, _ = strconv.Atoi(scanner.Text())
		if a > h {
			m++
		}
	}

	writer.WriteString(strconv.Itoa(m))
	writer.Flush()
}

package main

import "fmt"

func main() {
	var n, h, m, a int

	fmt.Scan(&n, &h)

	for m = n; n > 0; n-- {
		fmt.Scan(&a)
		if a > h {
			m++
		}
	}

	fmt.Println(m)
}

package main

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

func main() {
	var h, d, n, cnt int64

	scr := bufio.NewReader(os.Stdin)
	// ocr := bufio.NewWriter(os.Stdout)

	fmt.Fscanln(scr, &n, &h)

	for i := int64(0); i < n; i++ {
		fmt.Fscanf(scr, "%d", &d)
		if d > h {
			cnt += 2
		} else {
			cnt++
		}
	}
	fmt.Println(cnt)
}

package main

import "fmt"

func main() {
	var n, h, a int
	fmt.Scanf("%d %d\n", &n, &h)
	count := 0
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a)
		if a > h {
			count++
		}
	}
	fmt.Println(count + n)
}

	package main

	import "fmt"

	func main() {

		var number, height,i int16
		_, _ = fmt.Scan(&number)
		_, _ = fmt.Scan(&height)

		var oned = make([]int16,number)

		for i=0;i<number;i++ {
			_, _ = fmt.Scan(&oned[i])
		}

		count :=0
		for i=0;i<number;i++ {
			for oned[i] > 0{
				count++
				oned[i] = oned[i] - height
			}
		}
		fmt.Print(count)

	}

// A. Vanya and Fence
/*
Vanya and his friends are walking along the fence of height h and they do not
want the guard to notice them. In order to achieve this the height of each of
the friends should not exceed h. If the height of some person is greater
than h he can bend down and then he surely won't be noticed by the guard.
The height of the i-th person is equal to ai.

Consider the width of the person walking as usual to be equal to 1, while the
width of the bent person is equal to 2. Friends want to talk to each other
while walking, so they would like to walk in a single row. What is the
minimum width of the road, such that friends can walk in a row and remain
unattended by the guard?

Input
The first line of the input contains two integers n and h
(1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the
fence, respectively.

The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is
equal to the height of the i-th person.

Output
Print a single integer — the minimum possible valid width of the road.
Examples
Input
3 7
4 5 14

Output
4

Input
6 1
1 1 1 1 1 1

Output
6

Input
6 5
7 6 8 9 10 5

Output
11

Note
In the first sample, only person number 3 must bend down, so the required
width is equal to 1 + 1 + 2 = 4.

In the second sample, all friends are short enough and no one has to bend,
so the width 1 + 1 + 1 + 1 + 1 + 1 = 6 is enough.

In the third sample, all the persons have to bend, except the last one.
The required minimum width of the road is equal to 2 + 2 + 2 + 2 + 2 + 1 = 11.
*/
package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	input1, _ := reader.ReadString('\n')
	s1 := strings.Split(strings.TrimSpace(input1), " ")

	n, _ := strconv.Atoi(s1[0])
	h, _ := strconv.Atoi(s1[1])

	input2, _ := reader.ReadString('\n')
	s2 := strings.Split(strings.TrimSpace(input2), " ")

	width := n
	for i := 0; i < n; i++ {
		a, _ := strconv.Atoi(s2[i])
		if a > h {
			width++
		}
	}
	fmt.Print(width)
}

package main

import(
    "fmt"
)

type u32 uint32

func main(){
    var (
        n,h,i,res,temp u32
    )
    fmt.Scan(&n,&h)
    for i=0;i<n;i++{
        fmt.Scan(&temp)
        if temp > h{
            res +=2
        }else{
            res+=1
        }
    }
    fmt.Println(res)
}

package main

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

func main() {
	var n, h int
	var count = 0
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	str := strings.Fields(scanner.Text())
	n , _ = strconv.Atoi(str[0])
	h , _ = strconv.Atoi(str[1])
	scanner.Scan()
	arr := strings.Fields(scanner.Text())
	array := make([]int, n, n)
	for num, element := range arr {
		el, _ := strconv.Atoi(element)
		array[num] = el
	}
	for _, num := range array {
		if num > h {
			count += 2
		} else {
			count++
		}
	}
	fmt.Println(count)
}

package main

import "fmt"

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

	ans := n
	for range make([]struct{}, n) {
		fmt.Scan(&a)
		if a > h {
			ans++
		}
	}
	fmt.Println(ans)
}

package main

import (
  "fmt"
)

func main() {
  var n,h,a,s int
  fmt.Scan(&n,&h)
  for i := 0; i < n; i++ {
    fmt.Scan(&a)
    if a <= h {
      s += 1
    } else {
      s += 2
    }
  }
  fmt.Print(s)
}

package main

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

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() {
  // STDOUT MUST BE FLUSHED MANUALLY!!!
  defer writer.Flush()

  var n, h int
  sum := 0
  scanf("%d%d\n", &n, &h)
  for i := 0; i < n; i++ {
    var a int
    scanf("%d", &a)
    if a > h {
        sum += 1
    }
  }
  printf("%d", sum + n)
}

package main

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

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

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

func Println(a ...interface{}) {
	fmt.Println(a...)
}

func main() {
	var n, h int
	scan(&n, &h)
	width := 0
	for i := 0; i < n; i++ {
		var k int
		scan(&k)
		if k > h {
			width += 2
		} else {
			width++
		}
		//Println(k)
	}
	Println(width)
}

package main

import "fmt"

func main() {
	n, h, a, sum := 0,0,0,0
	fmt.Scan(&n, &h)

	for i := 0; i < n; i++ {
		fmt.Scan(&a)
		if (a > h) {
			sum++
		}
		sum++
	}
	fmt.Println(sum)
}

package main

import (
	"fmt"
)

func main() {
	var n, h, temp int
	fmt.Scanf("%d %d \n", &n, &h)
	result := n
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &temp)
		if temp > h {
			result++
		}
	}
	fmt.Print(result)
}

package main

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

func main() {
	var scanner *bufio.Scanner
	var lines []string
	var n, h int
	var heights []int
	var bent int = 0

	scanner = bufio.NewScanner(os.Stdin)

	for scanner.Scan() {
		lines = append(lines, scanner.Text())
	}

	var nh = strings.Fields(lines[0])
	n, _ = strconv.Atoi(nh[0])
	h, _ = strconv.Atoi(nh[1])

	var height int
	for _, element := range strings.Fields(lines[1]) {
		height, _ = strconv.Atoi(element)
		heights = append(heights, height)
	}

	for _, height := range heights {
		if height > h {
			bent++
		}
	}

	fmt.Println((bent + n))
}

package main

import "fmt"

func main() {
	var (
		n,max,x,sum	 int
	)
	sum = 0
	fmt.Scan(&n,&max)
	for i := 0; i < n; i++{
		fmt.Scan(&x)
		if x>max {
			sum+=2
		}else{
			sum++
		}
	  }
	fmt.Println(sum)
}

package main

import "fmt"

func main() {
	var (
		n            int
		heightOfWall int
	)
	fmt.Scanf("%d %d\n", &n, &heightOfWall)
// 	fmt.Println(n, heightOfWall)
	var heights []int
	for i := 0; i < n; i++ {
		var h int
		fmt.Scanf("%d", &h)
		heights = append(heights, h)
	}
// 	fmt.Println(heights)
	var width int
	for _, h := range heights {
	   // fmt.Println(h, heightOfWall, h > heightOfWall)
		width += 1
		if h > heightOfWall {
			width += 1
		}
	}
	fmt.Println(width)
}

package main
import "fmt"

func main() {
	var n int
	var h int
	fmt.Scan(&n,&h)
	var ai int
	 sum :=0
	for i:= 0;i<n;i++ {
		fmt.Scan(&ai)
		if ai>h {
				sum=sum+2
			}else {
				sum=sum+1
			}
		}
			fmt.Print(sum)
}

package main

import "fmt"

func main() {
	var n, h, x int
	total:= 0
	fmt.Scanf("%d %d\n", &n, &h)

	for i:=0; i < n; i++ {
		fmt.Scanf("%d", &x)
		total++
		if x > h {
			total++
		}
	}

	fmt.Println(total)
}

package main

import "fmt"

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

	var sum int
	sum = 0
	for i := 0; i < n; i++ {
		var ai int
		fmt.Scan(&ai)
		if ai > h {
			sum += 2
		} else {
			sum += 1
		}
	}
	fmt.Println(sum)

}

package main

import (
	"fmt"
)

func main() {
	var n , a int
	res := 0
	fmt.Scanf("%d %d\n", &n, &a)
	for i := 0; i < n; i++ {
		var tmp int
		fmt.Scanf("%d", &tmp)
		if tmp > a {
			res += 2
		}else{
			res += 1
		}

	}
	fmt.Println(res)
}

package main

import "fmt"

func main() {
	var n, h, a int
	var count int = 0
	fmt.Scan(&n, &h)
	for i := 0; i < n; i++ {
		fmt.Scan(&a)
		if a <= h {
			count += 1
		} else if a > h {
			count += 2
		}
	}
	fmt.Print(count)
}

package main

import "fmt"

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

	var x int
	output := 0
	for i := 0; i < n; i++ {
		fmt.Scan(&x)
		if x <= h {
			output++
		} else {
			output += 2
		}
	}
	fmt.Println(output)
}

package main

import "fmt"

func main ()  {
	var n, h int
	minWidth := 0
	fmt.Scan(&n, &h)
	for i := 0; i < n; i ++ {
		var currentHight int
		fmt.Scan(&currentHight)
		if currentHight > h {
			minWidth += 2
		} else {
			minWidth ++
		}
	}
	fmt.Println(minWidth)
}

package main

import 	"fmt"

func main() {
	var n, h int
	var a [1001]int
	x:=0
	fmt.Scanf("%d%d", &n, &h)

	for i:=0; i<n + 1; i++{
		fmt.Scanf("%d", &a[i])
		if a[i] > h {
			x +=2
		}else{
			x++
		}
	}

	fmt.Println(x-1)
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var n, h, o,s uint16
	fmt.Fscanf(in, "%d %d\n", &n, &h)
	for i:=0; uint16(i) < n; i++{
		fmt.Fscanf(in, "%d", &o)
		if o > h{
			s+=2
		}else{
			s++
		}
	}
	fmt.Println(s)
}

package main

import (
	"fmt"
)

func main() {
	var n,h,temp,bend int
	fmt.Scanf("%d %d\n",&n,&h)
	for i:= 0 ; i < n ; i++{
		fmt.Scanf("%d",&temp)
		if(temp > h){
			bend+=1
		}
	}
	fmt.Println((n-bend) + (bend*2))
}

// MIT License
//
// Copyright (c) 2017 Nobi Hoang <nobi.hoa@gmail.com>
//
// http://codeforces.com/problemset/problem/677/A
//

package main

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

// ReadLine reads a line from the command line.
// It returns the line and an error if that fails.
func ReadLine() (string, error) {
  line, err := bufio.NewReader(os.Stdin).ReadString('\n')
  if err != nil {
    return "", err
  }
  return strings.TrimSpace(string(line)), nil
}

// Execute run
func Execute() {
  var n, h int
  fmt.Scanf("%d %d\n", &n, &h)

  var a = make([]int, n)
  s, _ := ReadLine()
  for i, str := range strings.Split(s, " ") {
    num, _ := strconv.Atoi(str)
    a[i] = num
  }

  sum := 0
  for i := 0; i < n; i++ {
    if a[i] > h  {
      sum += 2
    } else {
      sum++
    }
  }
  fmt.Println(sum)
}

func main() {
  Execute()
}

package main

import "fmt"

func main() {
	var n, h, a int
	var count int = 0
	fmt.Scan(&n, &h)
	for i := 1; i <= n; i++ {
		fmt.Scan(&a)
		if a <= h {
			count += 1
		} else if a > h {
			count += 2
		}
	}
	fmt.Print(count)
}

package main

import "fmt"

func main() {
	var n, t int
	fmt.Scan(&n, &t)
	ans := 0
	for ; n > 0; n-- {
		var x int
		fmt.Scan(&x)
		if x <= t {
			ans++
		} else {
			ans += 2
		}
	}
	fmt.Println(ans)
}

package main

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

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    int
		h    int
		a    int
		road int
	)

	scanf("%d %d\n", &n, &h)

	for i := 0; i < n; i++ {
		scanf("%d", &a)

		if a > h {
			road += 2
		} else {
			road++
		}
	}

	printf("%d\n", road)
}

package main
import "fmt"
func main() {
	var a,ct,n,h int
	fmt.Scan(&n,&h)
	for i := 0; i < n; i++ {
	    fmt.Scan(&a)
	    if a>h {
	        ct += 2
	    }else {
	        ct += 1
	    }
	}
	fmt.Println(ct)
}

package main

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

var scanner *bufio.Scanner
func read() string {
    if !scanner.Scan() {
		panic("Scan returned false")
	}
	return scanner.Text()
}
func readInt() int {
	num, _ := strconv.Atoi(read())
	return num
}
func main() {
    scanner = bufio.NewScanner(os.Stdin)
    scanner.Split(bufio.ScanWords)
    n := readInt()
    h := readInt()

    cnt := n
    for i := 0 ; i < n; i++ {
        ai := readInt()

        if ai > h {
            cnt++
        }
    }

    fmt.Println(cnt)
}

package main
import (
	 "fmt"
)

func main() {
	 var n, x, kol int

	 fmt.Scanf("%d%d", &n, &x)
	 for i := 0; i<n; i ++ {
	 	   var a int
	 	   fmt.Scan(&a)

	 	   if a > x {
	 	   	kol += 2
	 	   } else {
	 	   	kol ++
	 	   }
	 }

	 fmt.Printf("%d", kol)
}

package main

import "fmt"

func main() {
	var n, h int
	fmt.Scan(&n, &h)
	var total int
	for i := 0; i < n; i++ {
		var height int
		fmt.Scan(&height)
		if height > h {
			total += 2
		} else {
			total++
		}
	}
	fmt.Print(total)
}

package main

import "fmt"

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

	var a int
	w := 0
	for i := 0; i < n; i++ {
		fmt.Scan(&a)
		if a > h {
			w += 2
		} else {
			w++
		}
	}
	fmt.Print(w)
}

package main

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

func main() {
	var myStrings [2]string
	scanner := bufio.NewScanner(os.Stdin)
	for i := 0; i < 2; i++ {
		scanner.Scan()
		myStrings[i] = scanner.Text()
	}

	initialization := strings.Split(myStrings[0], " ")
	listOfFriendsHeights := strings.Split(myStrings[1], " ")
	h, _ := strconv.Atoi(initialization[1])
	var roadWidth int
	for _, friendHeight := range listOfFriendsHeights {
		friendHeight, _ := strconv.Atoi(friendHeight)
		if friendHeight > h {
			roadWidth++
		}
		roadWidth++
	}
	fmt.Println(roadWidth)
}

package main
import "fmt"

func main(){
	    var n, h, counter, value int
		fmt.Scan(&n)
		fmt.Scan(&h)

		for i := 0; i < n; i++ {
	    	fmt.Scan(&value)
	    	if value > h {
	    		counter += 2
	    	} else {
	    		counter += 1
	    	}
	    }
	    fmt.Println(counter)
}

package main

import "fmt"

func main() {
	var n, h int
	fmt.Scanf("%d %d\n", &n, &h)
	ret := 0

	for i := 0; i < n; i++ {
		var tmp = 0
		fmt.Scanf("%d", &tmp)
		if tmp > h {
			ret += 2
		} else {
			ret += 1
		}
	}

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

package main

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

func main() {
	var result int64
	reader := bufio.NewReader(os.Stdin)
	tmp := readInt64Slice(reader, 2)
	n, h := tmp[0], tmp[1]
	tmp = readInt64Slice(reader, int(n))
	for i := 0; i < len(tmp); i++ {
		if tmp[i] > h {
			result += 2
		} else {
			result++
		}
	}
	fmt.Println(result)
}

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

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

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

package main

import "fmt"

func main() {
	var n, h, w, a int

	fmt.Scan(&n, &h)
	for i := 0; i < n; i++ {
		fmt.Scan(&a)
		if a > h {
			w += 2
		} else {
			w += 1
		}
	}

	fmt.Println(w)
}

package main

import "fmt"

func main() {
	n := 0
	h := 0

	fmt.Scan(&n, &h)

	a := 0
	w := 0
	for i:= 0; i < n; i ++ {
		fmt.Scan(&a)
		if a <= h {
			w += 1
		} else {
			w += 2
		}
	}
	fmt.Print(w)
}

package main

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

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() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()

	var p, fh, w int
	scanf("%d %d\n", &p, &fh)
	for i := 0; i < p; i++ {
		var height int
		scanf("%d", &height)
		if height > fh {
			w += 2
		} else {
			w++
		}
	}
	printf("%d\n", w)
}

package main

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

func main() {
	fsc := NewFastScanner()
	N, K := fsc.NextInt(), fsc.NextInt()
	ans := 0
	for i := 0; i < N; i++ {
		var height int
		height = fsc.NextInt()
		if height > K {
			ans += 2
		} else {
			ans += 1
		}
	}
	fmt.Println(ans)
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 2028)
	return &FastScanner{r: rdr}
}

func (s *FastScanner) next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}

func (s *FastScanner) NextInt() int {
	val, err := strconv.Atoi(s.next())
	if err != nil {
		panic(err)
	}
	return val
}
func (s *FastScanner) NextInt64() int64 {
	val, err := strconv.ParseInt(s.next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return val
}
func (s *FastScanner) pre() {
	if s.p >= len(s.buf) {
		s.ReadLine()
		s.p = 0
	}
}

func (s *FastScanner) ReadLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, err := s.r.ReadLine()
		if err != nil {
			panic(err.Error())
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

package main

import (
	"fmt"
)

func solve(a []int, h int) int {
	w := len(a)
	for _, ai := range a {
		if ai > h {
			w ++
		}
	}
	return w
}

func main() {
	n, h := 0, 0
	_, err := fmt.Scanln(&n, &h)
	if err != nil {
		panic(err)
	}
	a := make([]int, n)
	pa := make([]interface{}, n)
	for i := range a {
		pa[i] = &a[i]
	}
	_, err = fmt.Scanln(pa...)
	if err != nil {
		panic(err)
	}
	w := solve(a, h)
	fmt.Println(w)
}

package main;

import "fmt"

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

	w = 0
	for i:=0;i<n;i++ {
		var t int
		fmt.Scan(&t)
		if t>h {
			w += 2
		} else {
			w += 1
		}
	}
	fmt.Println(w)
}

package main

import "fmt"

// https://codeforces.com/problemset/problem/677/A
// A. Vanya and Fence
// time limit per test
// 1 second
// memory limit per test
// 256 megabytes
// input
// standard input
// output
// standard output

// Vanya and his friends are walking along the fence of height h and they do not want the guard to notice them. In order to achieve this the height of each of the friends should not exceed h. If the height of some person is greater than h he can bend down and then he surely won't be noticed by the guard. The height of the i-th person is equal to ai.

// Consider the width of the person walking as usual to be equal to 1, while the width of the bent person is equal to 2. Friends want to talk to each other while walking, so they would like to walk in a single row. What is the minimum width of the road, such that friends can walk in a row and remain unattended by the guard?
// Input

// The first line of the input contains two integers n and h (1 ≤ n ≤ 1000, 1 ≤ h ≤ 1000) — the number of friends and the height of the fence, respectively.

// The second line contains n integers ai (1 ≤ ai ≤ 2h), the i-th of them is equal to the height of the i-th person.
// Output

// Print a single integer — the minimum possible valid width of the road.

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

	peoplesHeights := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&peoplesHeights[i])
	}

	var minWidth int
	for _, height := range peoplesHeights {
		if height > h {
			minWidth += 2
		} else {
			minWidth++
		}
	}
	fmt.Print(minWidth)
}

package main

import "fmt"

func main()  {
	var n, h, res int
	fmt.Scanf("%d %d\n", &n, &h)
	for i, tmp := 0, 0; i < n; i++ {
		fmt.Scanf("%d", &tmp)
		if tmp > h {
			res += 2
		} else {
			res++
		}
	}
	fmt.Println(res)

}

package main

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

func main() {
	n := getInt()
	h := getInt()
	ans := n
	for i := 0; i < n; i++ {
		a := getInt()
		if a > h {
			ans++
		}
	}
	fmt.Println(ans)
}

type Input struct {
	*bufio.Scanner
}

var globalInput = wrapStdin()

func wrapStdin() Input {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return Input{Scanner: sc}
}
func getInt() int {
	globalInput.Scan()
	x, _ := strconv.Atoi(globalInput.Text())
	return x
}
func getIntOk() (int, bool) {
	ok := globalInput.Scan()
	x, _ := strconv.Atoi(globalInput.Text())
	return x, ok
}
func getNint(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		v[i] = getInt()
	}
	return v
}
func getVint(v []int) bool {
	var ok bool
	for i := 0; i < len(v); i++ {
		v[i], ok = getIntOk()
	}
	return ok
}
func getWord() string {
	globalInput.Scan()
	return globalInput.Text()
}
func getWordOk() (string, bool) {
	ok := globalInput.Scan()
	return globalInput.Text(), ok
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}
func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}
func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func minStr(a, b string) string {
	if a < b {
		return a
	}
	return b
}
func maxStr(a, b string) string {
	if a < b {
		return b
	}
	return a
}
func remin(a *int, b int) bool {
	if b < *a {
		*a = b
		return true
	}
	return false
}
func remax(a *int, b int) bool {
	if b > *a {
		*a = b
		return true
	}
	return false
}
func remin64(a *int64, b int64) bool {
	if b < *a {
		*a = b
		return true
	}
	return false
}
func remax64(a *int64, b int64) bool {
	if b > *a {
		*a = b
		return true
	}
	return false
}
func reminStr(a *string, b string) bool {
	if b < *a {
		*a = b
		return true
	}
	return false
}
func remaxStr(a *string, b string) bool {
	if b > *a {
		*a = b
		return true
	}
	return false
}

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

type (
	FLess    func(i, j int) bool
	FSwap    func(i, j int)
	wrapSort struct {
		Length int
		FLess
		FSwap
	}
)

func (w *wrapSort) Len() int           { return w.Length }
func (w *wrapSort) Less(i, j int) bool { return w.FLess(i, j) }
func (w *wrapSort) Swap(i, j int)      { w.FSwap(i, j) }
func wsort(length int, fless func(i, j int) bool, fswap func(i, j int)) {
	sort.Sort(&wrapSort{length, fless, fswap})
}

package main

// https://codeforces.com/problemset/problem/677/A

import "fmt"

func taskSolution(a []int, h int) int {
	ans := len(a)
	for _, ai := range a {
		if ai > h {
			ans += 1
		}
	}
	return ans
}

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

	a := []int{}
	for i := 0; i < n; i += 1 {
		var ai int
		if _, err := fmt.Scan(&ai); err != nil {
			panic(err)
		}
		a = append(a, ai)
	}

	fmt.Println(taskSolution(a, h))
}

package main

import (
	"fmt"
)

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

		r += z/x
		if (z%x) >0{
			r++
		}
	}

	fmt.Println(r)

}

package main

import (
	"fmt"
	"math"
)

func main() {
	var r float64
	var i int
	fmt.Scan(&i)
	var x int
	fmt.Scan(&x)
	for  q:=0;q<i ;q++  {
		var z int
		fmt.Scan(&z)

		r += math.Ceil(float64(z)/float64(x))
	}

	fmt.Println(r)

}

package main

import "fmt"

func main() {
	var noPersons int
	var fenceHeight int
	var heightOfPerson int
	fmt.Scan(&noPersons, &fenceHeight)
	var minRoadWidth int = noPersons
	for index := 0; index < noPersons; index++ {
		fmt.Scan(&heightOfPerson)
		if heightOfPerson > fenceHeight {
			minRoadWidth = minRoadWidth + 1
		}
	}
	fmt.Print(minRoadWidth)
}

package main

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

var (
	reader *bufio.Reader = bufio.NewReader(os.Stdin)
	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, mh int64
    scanf("%d %d\n", &n, &mh)
    heights := []int64{}
    for ; n > 0; n-- {
        var h int64
        scanf("%d", &h)
        heights = append(heights, h)
    }
    res := 0
    for _, h := range heights {
        if h <= mh {
            res += 1
        } else {
            res += 2
        }
    }
    printf("%d", res)
}

package main

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

var (
	reader *bufio.Reader = bufio.NewReader(os.Stdin)
	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, mh, h int64
    scanf("%d %d\n", &n, &mh)
    res := 0
    for ; n > 0; n-- {
        scanf("%d", &h)
        if h <= mh {
            res += 1
        } else {
            res += 2
        }
    }
    printf("%d", res)
}

package main

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

func main() {
	heights, maxHeight := in3()
	res := sol(heights, maxHeight)
	out1(res)
}

// 31ms
func in1() ([]int64, int64) {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	l1 := scanner.Text()
	scanner.Scan()
	l2 := scanner.Text()
	maxHeight, _ := strconv.Atoi(strings.Split(l1, " ")[1])
	heights := []int64{}
	for _, h := range strings.Split(l2, " ") {
		hint, _ := strconv.Atoi(h)
		heights = append(heights, int64(hint))
	}
	return heights, int64(maxHeight)
}

// 46ms
func in2() ([]int64, int64) {
	var n, maxHeight int64
	fmt.Scanf("%d %d\n", &n, &maxHeight)
	heights := []int64{}
	for ; n > 0; n-- {
		var h int64
		fmt.Scanf("%d", &h)
		heights = append(heights, h)
	}
	return heights, maxHeight
}

func scanf(reader *bufio.Reader, f string, a ...interface{}) {
	fmt.Fscanf(reader, f, a...)
}

func in3() ([]int64, int64) {
	reader := bufio.NewReader(os.Stdin)
	var n, maxHeight int64
	scanf(reader, "%d %d\n", &n, &maxHeight)
	heights := []int64{}
	for ; n > 0; n-- {
		var h int64
		scanf(reader, "%d", &h)
		heights = append(heights, h)
	}
	return heights, maxHeight
}

func out1(i int64) {
	fmt.Println(i)
}

func sol(heights []int64, max int64) int64 {
	ret := int64(0)
	for _, h := range heights {
		if h <= max {
			ret += 1
		} else {
			ret += 2
		}
	}
	return ret
}

package main

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

func main() {
    heights, maxHeight := in2()
    res := sol(heights, maxHeight)
    out1(res)
}

func in1() ([]int64, int64) {
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Scan()
    l1 := scanner.Text()
    scanner.Scan()
    l2 := scanner.Text()
    maxHeight, _ := strconv.Atoi(strings.Split(l1, " ")[1])
    heights := []int64{}
    for _, h := range(strings.Split(l2, " ")) {
        hint, _ := strconv.Atoi(h)
        heights = append(heights, int64(hint))
    }
    return heights, int64(maxHeight)
}

func in2() ([]int64, int64) {
    var n, maxHeight int64
    fmt.Scanf("%d %d\n", &n, &maxHeight)
    heights := []int64{}
    for ; n > 0; n-- {
        var h int64
        fmt.Scanf("%d", &h)
        heights = append(heights, h)
    }
    return heights, maxHeight
}

func out1(i int64) {
    fmt.Println(i)
}

func sol(heights []int64, max int64) int64 {
    ret := int64(0)
    for _, h := range heights {
        if h <= max {
            ret += 1
        } else {
            ret += 2
        }
    }
    return ret
}

package main

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

var (
	reader *bufio.Reader = bufio.NewReader(os.Stdin)
	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, mh int64
    scanf("%d %d\n", &n, &mh)
    heights := make([]int64, n)
    for ; n > 0; n-- {
        var h int64
        scanf("%d", &h)
        heights[n-1] = h
    }
    res := 0
    for _, h := range heights {
        if h <= mh {
            res += 1
        } else {
            res += 2
        }
    }
    printf("%d", res)
}

package main

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

func main() {
    heights, maxHeight := in1()
    res := sol(heights, maxHeight)
    out1(res)
}

func in1() ([]int64, int64) {
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Scan()
    l1 := scanner.Text()
    scanner.Scan()
    l2 := scanner.Text()
    maxHeight, _ := strconv.Atoi(strings.Split(l1, " ")[1])
    heights := []int64{}
    for _, h := range(strings.Split(l2, " ")) {
        hint, _ := strconv.Atoi(h)
        heights = append(heights, int64(hint))
    }
    return heights, int64(maxHeight)
}

func out1(i int64) {
    fmt.Println(i)
}

func sol(heights []int64, max int64) int64 {
    ret := int64(0)
    for _, h := range heights {
        if h <= max {
            ret += 1
        } else {
            ret += 2
        }
    }
    return ret
}

package main

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

var (
	reader *bufio.Reader = bufio.NewReader(os.Stdin)
	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, mh int64
    scanf("%d %d\n", &n, &mh)
    res := 0
    for ; n > 0; n-- {
        var h int64
        scanf("%d", &h)
        if h <= mh {
            res += 1
        } else {
            res += 2
        }
    }
    printf("%d", res)
}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)

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

func main() {

	var number, height, i int16
	_, _ = fmt.Scan(&number)
	_, _ = fmt.Scan(&height)

	var oned = make([]int16, number, number+4)

	for i = 0; i < number; i++ {
		scanf("%d", &oned[i])
	}

	var count int = 0
	for i = 0; i < number; i++ {
		for oned[i] > 0 {
			count++
			oned[i] = oned[i] - height
		}
	}
	fmt.Print(count)

}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)

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

func main() {

	var number, height, i int16 = 0, 0, 0
	scanf("%d", number)
	scanf("%d", height)

	var oned = make([]int16, number, number+4)

	for i = 0; i < number; i++ {
		scanf("%d ", &oned[i])
	}

	var count int = 0
	for i = 0; i < number; i++ {
		for oned[i] > 0 {
			count++
			oned[i] = oned[i] - height
		}
	}
	fmt.Print(count)

}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)

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

func main() {

	var number, height, i int16 = 0, 0, 0
	_, _ = fmt.Scan(&number)
	_, _ = fmt.Scan(&height)

	var oned = make([]int16, number, number+4)

	for i = 0; i < number; i++ {
		scanf("%d ", &oned[i])
	}

	var count int = 0
	for i = 0; i < number; i++ {
		for oned[i] > 0 {
			count++
			oned[i] = oned[i] - height
		}
	}
	fmt.Print(count)

}

package main

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

func main() {
	var n, h int
	var count = 0
	_, _ = fmt.Scan(&n, &h)
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	arr := strings.Fields(scanner.Text())
	array := make([]int, n, n)
	for num, element := range arr {
		el, _ := strconv.Atoi(element)
		array[num] = el
	}
	for _, num := range array {
		if num > h {
			count += 2
		} else {
			count++
		}
	}
	fmt.Println(count)
}

package main

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

func main() {
	var (
		n, h, h1 int
		str  string
		arr  []string

	)
	_, _ = fmt.Scan(&n, &h)
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	arr = strings.Fields(scanner.Text())
	iarr := make([]int, 0, n)
	for _, str = range arr {
		h1, _ = strconv.Atoi(str)
		iarr = append(iarr, h1)
	}
	for _, element := range iarr {
		if element > h {
			n++
		}
	}
	fmt.Println(n)
}

package main

import "fmt"

func main() {
	var (
		n            int
		heightOfWall int
	)
	fmt.Scanf("%d %d", &n, &heightOfWall)
	// fmt.Println(n, h)
	var heights []int
	for i := 0; i < n; i++ {
		var h int
		fmt.Scanf("%d", &h)
		heights = append(heights, h)
	}
	// fmt.Println(heights)
	var width int
	for _, h := range heights {
		width += 1
		if h > heightOfWall {
			width += 1
		}
	}
	fmt.Println(width)
}

package main

import "fmt"

func main() {
	var (
		n            int
		heightOfWall int
	)
	fmt.Scanf("%d %d", &n, &heightOfWall)

	var heights []int
	for i := 0; i < n; i++ {
		var h int
		fmt.Scanf("%d", &h)
		heights = append(heights, h)
	}

	var width int
	for _, h := range heights {
		if h <= heightOfWall {
			width += 1
		} else {
			width += 2
		}
	}
	fmt.Println(width)
}

package main

import "fmt"

func main() {
	var (
		n            int
		heightOfWall int
	)
	fmt.Scanf("%d %d", &n, &heightOfWall)
	// fmt.Println(n, h)
	var heights []int
	for i := 0; i < n; i++ {
		var h int
		fmt.Scanf("%d", &h)
		heights = append(heights, h)
	}
	// fmt.Println(heights)
	var width int
	for _, h := range heights {
		if h <= heightOfWall {
			width += 1
		} else {
			width += 2
		}
	}
	fmt.Println(width)
}

package main

import "fmt"

func main() {
	var (
		n            int
		heightOfWall int
	)
	fmt.Scanf("%d %d", &n, &heightOfWall)
	// fmt.Println(n, h)
	var heights []int
	for i := 0; i < n; i++ {
		var h int
		fmt.Scanf("%d", &h)
		heights = append(heights, h)
	}
	// fmt.Println(heights)
	var width int
	for _, h := range heights {
		if h <= heightOfWall {
			width += 1
		} else {
			width += 2
		}
	}
	fmt.Println(width+1)
}

// MIT License
//
// Copyright (c) 2017 Nobi Hoang <nobi.hoa@gmail.com>
//
// http://codeforces.com/problemset/problem/677/A
//

package main

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

// ReadLine reads a line from the command line.
// It returns the line and an error if that fails.
func ReadLine() (string, error) {
  line, err := bufio.NewReader(os.Stdin).ReadString('\n')
  if err != nil {
    return "", err
  }
  return strings.TrimSpace(string(line)), nil
}

// Execute run
func Execute() {
  var n, h int
  fmt.Scanf("%d %d\n", &n, &h)

  var a = make([]int, n)
  s, _ := ReadLine()
  for i, str := range strings.Split(s, " ") {
    num, _ := strconv.Atoi(str)
    a[i] = num
  }

  sum := 0
  for i := 0; i < n; i++ {
    if a[i] >= h  {
      sum += 2
    } else {
      sum++
    }
  }
  fmt.Println(sum)
}

func main() {
  Execute()
}

package main

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

func main() {
	var myStrings [2]string
	scanner := bufio.NewScanner(os.Stdin)
	for i := 0; i < 2; i++ {
		scanner.Scan()
		myStrings[i] = scanner.Text()
	}

	initialization := strings.Split(myStrings[0], " ")
	listOfFriendsHeights := strings.Split(myStrings[1], " ")
	h, _ := strconv.Atoi(initialization[1])
	var roadWidth int
	//
	for _, friendHeight := range listOfFriendsHeights {
		friendHeight, _ := strconv.Atoi(friendHeight)
		if friendHeight > h {
			roadWidth++
		}
		roadWidth++
	}
	println(roadWidth)
}

package main

import "fmt"

func main() {
	var n, h int
	fmt.Scanf("%d %d", &n, &h)
	ret := 0

	for i := 0; i < n; i++ {
		var tmp = 0
		fmt.Scanf("%d", &tmp)
		if tmp > h {
			ret += 2
		} else {
			ret += 1
		}
	}

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

package main

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

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() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()

	var p, fh, w int
	scanf("%d\n", &p)
	scanf("%d\n", &fh)
	fmt.Println(p)
	for i := 0; i < p; i++ {
		var height int
		scanf("%d\n", &height)
		if height > fh {
			w += 2
		} else {
			w++
		}
	}
	printf("%d\n", w)
}

package main

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

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() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()

	var p, fh, w int
	scanf("%d %d\n", &p, &fh)
	for i := 0; i < p; i++ {
		var height int
		scanf("%d\n", &height)
		if height > fh {
			w += 2
		} else {
			w++
		}
	}
	printf("%d\n", w)
}

package main

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

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() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()

	var a, b int
	scanf("%d %d\n", &a, &b)
	printf("%d\n", a+b)
}

package main

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

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() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()

	var a, b int
	scanf("%d %d\n", &a, &b)
	printf("%d\n", a+b)
	printf("%d\n", a+b)
}

package main

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

func main() {
	fsc := NewFastScanner()
	N, K := fsc.NextInt(), fsc.NextInt()
	ans := 0
	for i := 0; i < N; i++ {
		var height int
		height = fsc.NextInt()
		if height > K {
			ans++
		}
	}
	fmt.Println(ans)
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 2028)
	return &FastScanner{r: rdr}
}

func (s *FastScanner) next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}

func (s *FastScanner) NextInt() int {
	val, err := strconv.Atoi(s.next())
	if err != nil {
		panic(err)
	}
	return val
}
func (s *FastScanner) NextInt64() int64 {
	val, err := strconv.ParseInt(s.next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return val
}
func (s *FastScanner) pre() {
	if s.p >= len(s.buf) {
		s.ReadLine()
		s.p = 0
	}
}

func (s *FastScanner) ReadLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, err := s.r.ReadLine()
		if err != nil {
			panic(err.Error())
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

package main

import "fmt"

func main()  {
	var n, h, res int
	fmt.Scanf("%d %d", &n, &h)
	for i, tmp := 0, 0; i < n; i++ {
		fmt.Scanf("%d", &tmp)
		if tmp > h {
			res += 2
		} else {
			res++
		}
	}
	fmt.Println(res)

}


There are $$$n$$$ astronauts working on some space station. An astronaut with the number $$$i$$$ ($$$1 \le i \le n$$$) has power $$$a_i$$$.An evil humanoid has made his way to this space station. The power of this humanoid is equal to $$$h$$$. Also, the humanoid took with him two green serums and one blue serum.In one second , a humanoid can do any of three actions:  to absorb an astronaut with power strictly less humanoid power;  to use green serum, if there is still one left;  to use blue serum, if there is still one left. When an astronaut with power $$$a_i$$$ is absorbed, this astronaut disappears, and power of the humanoid increases by $$$\lfloor \frac{a_i}{2} \rfloor$$$, that is, an integer part of $$$\frac{a_i}{2}$$$. For example, if a humanoid absorbs an astronaut with power $$$4$$$, its power increases by $$$2$$$, and if a humanoid absorbs an astronaut with power $$$7$$$, its power increases by $$$3$$$.After using the green serum, this serum disappears, and the power of the humanoid doubles, so it increases by $$$2$$$ times.After using the blue serum, this serum disappears, and the power of the humanoid triples, so it increases by $$$3$$$ times.The humanoid is wondering what the maximum number of astronauts he will be able to absorb if he acts optimally.

The first line of each test contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — number of test cases. The first line of each test case contains integers $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — number of astronauts and $$$h$$$ ($$$1 \le h \le 10^6$$$) — the initial power of the humanoid. The second line of each test case contains $$$n$$$ integers $$$a_i$$$ ($$$1 \le a_i \le 10^8$$$) — powers of astronauts. It is guaranteed that the sum of $$$n$$$ for all test cases does not exceed $$$2 \cdot 10^5$$$.

For each test case, in a separate line, print the maximum number of astronauts that a humanoid can absorb.

NoteIn the first case, you can proceed as follows:   use green serum. $$$h = 1 \cdot 2 = 2$$$  absorb the cosmonaut $$$2$$$. $$$h = 2 + \lfloor \frac{1}{2} \rfloor = 2$$$  use green serum. $$$h = 2 \cdot 2 = 4$$$  absorb the spaceman $$$1$$$. $$$h = 4 + \lfloor \frac{2}{2} \rfloor = 5$$$  use blue serum. $$$h = 5 \cdot 3 = 15$$$  absorb the spaceman $$$3$$$. $$$h = 15 + \lfloor \frac{8}{2} \rfloor = 19$$$  absorb the cosmonaut $$$4$$$. $$$h = 19 + \lfloor \frac{9}{2} \rfloor = 23$$$

package main

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

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

func main() {
	defer writer.Flush()

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

	perm := [3][]int{
		[]int{2, 2, 3},
		[]int{2, 3, 2},
		[]int{3, 2, 2},
	}

	for ; T > 0; T-- {
		var n int
		var h uint64
		fmt.Fscan(reader, &n, &h)

		a := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &a[i])
		}
		sort.Slice(a, func(i, j int) bool {
			return a[i] < a[j]
		})

		pref := make([]uint64, n)
		for i := 0; i < n; i++ {
			if i > 0 {
				pref[i] += pref[i-1]
			}
			pref[i] += uint64(a[i] >> 1)
		}

		try := func(c int) int {
			lo, hi := c, n-1
			pos := -1

			for lo <= hi {
				mid := (lo + hi) >> 1
				if uint64(a[mid]) < h {
					pos = mid
					lo = mid + 1
				} else {
					hi = mid - 1
				}
			}

			if pos != -1 {
				h += pref[pos]
				if c > 0 {
					h -= pref[c-1]
				}
			}

			return pos
		}

		ans := 0
		for _, strategy := range perm {
			cur := 0
			j := 0
			tmp := 0
			rollback := h
			for cur < n {
				pos := try(cur)
				if pos == -1 && j == 3 {
					break
				}
				if pos != -1 {
					tmp += pos - cur + 1
					cur = pos + 1
				} else {
					h *= uint64(strategy[j])
					j += 1
				}
			}

			if ans < tmp {
				ans = tmp
			}
			h = rollback
		}

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

package main

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

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

func readInt(delim byte) (int, error) {
	s, err := in.ReadString(delim)
	if err != nil {
		return 0, err
	}
	s = strings.TrimRight(s, " \r\n")
	n, err := strconv.Atoi(s)
	if err != nil {
		return 0, err
	}
	return n, nil
}

func calc(a []int, b []int, h int) int {
	n := len(a)
	j := 0
	for i := 0; i < n; i++ {
		for ; h <= a[i] && j < 3; j++ {
			h *= b[j]
		}
		if h <= a[i] {
			return i
		}
		h += a[i] / 2
	}
	return n

}

func main() {
	defer out.Flush()
	t, err := readInt('\n')
	if err != nil {
		out.WriteString(err.Error())
		return
	}
	for ; t > 0; t-- {
		n, err := readInt(' ')
		h, err := readInt('\n')
		a := make([]int, n)
		for i := 0; i < n; i++ {
			if i < n-1 {
				a[i], err = readInt(' ')

			} else {
				a[i], err = readInt('\n')
			}
			if err != nil {
				out.WriteString(err.Error())
				return
			}
		}
		sort.Ints(a)
		res := calc(a, []int{2, 2, 3}, h)
		res2 := calc(a, []int{2, 3, 2}, h)
		if res2 > res {
			res = res2
		}
		res2 = calc(a, []int{3, 2, 2}, h)
		if res2 > res {
			res = res2
		}
		out.WriteString(strconv.Itoa(res))
		out.WriteString("\n")
	}
}

package main

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

func Solve(reader *bufio.Reader, writer *bufio.Writer) {
	var n, h int
	fmt.Fscan(reader, &n, &h)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(reader, &a[i])
	}
	sort.Ints(a)
	fmt.Fprintf(writer, "%v\n", eat(a, h, 2, 1))
}

func eat(a []int, h, g, b int) int {
	var i int
	for i = 0; i < len(a) && h > a[i]; i++ {
		h += a[i] / 2
	}
	if i == len(a) {
		return len(a)
	}
	ans, mx := i, 0
	if g > 0 {
		mx = max(eat(a[i:], h*2, g-1, b), mx)
	}
	if b > 0 {
		mx = max(eat(a[i:], h*3, g, b-1), mx)
	}
	return ans + mx
}

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

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

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

func main() {
	var reader *bufio.Reader
	var writer *bufio.Writer

	filename_in := "data.in"
	filename_out := "data.out"

	stdinout := true
	readtests := true
	tests := 1

	if (!stdinout || inArgs("local")) && !inArgs("std") {
		infile, inerr := os.Open(filename_in)
		if inerr != nil {
			if os.IsNotExist(inerr) {
				os.Create(filename_in)
			}
			fmt.Println(inerr)
			return
		}
		defer infile.Close()

		outfile, outerr := os.OpenFile(filename_out, os.O_WRONLY, os.ModeAppend)
		if outerr != nil {
			if os.IsNotExist(outerr) {
				outfile, outerr = os.Create(filename_out)
				if outerr != nil {
					fmt.Println(outerr)
					return
				}
			}
		}
		defer outfile.Close()

		reader = bufio.NewReader(infile)
		writer = bufio.NewWriter(outfile)
	} else if stdinout || inArgs("std") {
		reader = bufio.NewReader(os.Stdin)
		writer = bufio.NewWriter(os.Stdout)
	}
	defer func() {
		err := writer.Flush()
		if err != nil {
			fmt.Println(err)
		}
	}()

	if readtests || inArgs("local") {
		fmt.Fscanf(reader, "%d\n", &tests)
	}

	for i := 0; i < tests; i++ {
		Solve(reader, writer)
		fmt.Fscanf(reader, "\n")
	}

}

func inArgs(arg string) bool {
	for _, a := range os.Args {
		if a == arg {
			return true
		}
	}
	return false
}


You are given two arrays of integers $$$a_1,\ldots,a_n$$$ and $$$b_1,\ldots,b_m$$$.Your task is to find a non-empty array $$$c_1,\ldots,c_k$$$ that is a subsequence of $$$a_1,\ldots,a_n$$$, and also a subsequence of $$$b_1,\ldots,b_m$$$. If there are multiple answers, find one of the smallest possible length. If there are still multiple of the smallest possible length, find any. If there are no such arrays, you should report about it.A sequence $$$a$$$ is a subsequence of a sequence $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly, zero) elements. For example, $$$[3,1]$$$ is a subsequence of $$$[3,2,1]$$$ and $$$[4,3,1]$$$, but not a subsequence of $$$[1,3,3,7]$$$ and $$$[3,10,4]$$$.

The first line contains a single integer $$$t$$$ ($$$1\le t\le 1000$$$)  — the number of test cases. Next $$$3t$$$ lines contain descriptions of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1\le n,m\le 1000$$$)  — the lengths of the two arrays. The second line of each test case contains $$$n$$$ integers $$$a_1,\ldots,a_n$$$ ($$$1\le a_i\le 1000$$$)  — the elements of the first array. The third line of each test case contains $$$m$$$ integers $$$b_1,\ldots,b_m$$$ ($$$1\le b_i\le 1000$$$)  — the elements of the second array. It is guaranteed that the sum of $$$n$$$ and the sum of $$$m$$$ across all test cases does not exceed $$$1000$$$ ($$$\sum\limits_{i=1}^t n_i, \sum\limits_{i=1}^t m_i\le 1000$$$).

For each test case, output "YES" if a solution exists, or "NO" otherwise. If the answer is "YES", on the next line output an integer $$$k$$$ ($$$1\le k\le 1000$$$)  — the length of the array, followed by $$$k$$$ integers $$$c_1,\ldots,c_k$$$ ($$$1\le c_i\le 1000$$$)  — the elements of the array. If there are multiple solutions with the smallest possible $$$k$$$, output any.

NoteIn the first test case, $$$[4]$$$ is a subsequence of $$$[10, 8, 6, 4]$$$ and $$$[1, 2, 3, 4, 5]$$$. This array has length $$$1$$$, it is the smallest possible length of a subsequence of both $$$a$$$ and $$$b$$$.In the third test case, no non-empty subsequences of both $$$[3]$$$ and $$$[2]$$$ exist, so the answer is "NO".

package main

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

func main() {
	var t, n, m, a int
	in := bufio.NewReader(os.Stdin)

	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &n, &m)
		data := make(map[int]bool, 0)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &a)
			data[a] = true
		}
		hasAns := false
		ans := -1
		for i := 0; i < m; i++ {
			fmt.Fscan(in, &a)
			if data[a] {
				hasAns = true
				ans = a
			}
		}
		if hasAns {
			fmt.Println("YES")
			fmt.Println(1, ans)
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

func main() {
	io := newFastIO(os.Stdin, os.Stdout)
	defer io.Flush()

	for t := io.nextInt(); t > 0; t-- {
		n, m := io.nextInt(), io.nextInt()
		a := io.nextInts(n)
		b := io.nextInts(m)

		s := map[int]bool{}
		for _, x := range b {
			s[x] = true
		}
		ans := -1
		for _, x := range a {
			if _, ok := s[x]; ok {
				ans = x
			}
		}
		if ans != -1 {
			io.println("YES")
			io.printlnInts(1, ans)
		} else {
			io.println("NO")
		}
	}
}

type fastIO struct {
	*bufio.Reader
	*bufio.Writer
	p [1]byte
}

func newFastIO(r io.Reader, w io.Writer) *fastIO {
	return &fastIO{Reader: bufio.NewReader(r), Writer: bufio.NewWriter(w)}
}

func (f *fastIO) nextInt() int {
	f.Read(f.p[:])
	for !('0' <= f.p[0] && f.p[0] <= '9') {
		f.Read(f.p[:])
	}
	n := 0
	for '0' <= f.p[0] && f.p[0] <= '9' {
		n = n*10 + int(f.p[0]) - '0'
		f.Read(f.p[:])
	}
	return n
}

func (f *fastIO) nextInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = f.nextInt()
	}
	return a
}

func (f *fastIO) next() string {
	f.Read(f.p[:])
	for f.p[0] <= ' ' {
		f.Read(f.p[:])
	}
	var s []byte
	for f.p[0] > ' ' {
		s = append(s, f.p[0])
		f.Read(f.p[:])
	}
	return string(s)
}

func (f *fastIO) println(a ...interface{}) {
	fmt.Fprintln(f.Writer, a...)
}

func (f *fastIO) print(a ...interface{}) {
	fmt.Fprint(f.Writer, a...)
}

func (f *fastIO) printInts(a ...int) {
	if len(a) > 0 {
		f.print(a[0])
		for _, x := range a[1:] {
			f.print(" ", x)
		}
	}
}

func (f *fastIO) printlnInts(a ...int) {
	f.printInts(a...)
	f.println()
}

package main

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

func main() {
	io := newFastIO(os.Stdin, os.Stdout)
	defer io.Flush()

	for t := io.nextInt(); t > 0; t-- {
		n, m := io.nextInt(), io.nextInt()
		a := io.nextInts(n)
		b := io.nextInts(m)

		s := map[int]bool{}
		for _, x := range b {
			s[x] = true
		}
		ans := -1
		for _, x := range a {
			if s[x] {
				ans = x
			}
		}
		if ans != -1 {
			io.println("YES")
			io.printlnInts(1, ans)
		} else {
			io.println("NO")
		}
	}
}

type fastIO struct {
	*bufio.Reader
	*bufio.Writer
	p [1]byte
}

func newFastIO(r io.Reader, w io.Writer) *fastIO {
	return &fastIO{Reader: bufio.NewReader(r), Writer: bufio.NewWriter(w)}
}

func (f *fastIO) nextInt() int {
	f.Read(f.p[:])
	for !('0' <= f.p[0] && f.p[0] <= '9') {
		f.Read(f.p[:])
	}
	n := 0
	for '0' <= f.p[0] && f.p[0] <= '9' {
		n = n*10 + int(f.p[0]) - '0'
		f.Read(f.p[:])
	}
	return n
}

func (f *fastIO) nextInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = f.nextInt()
	}
	return a
}

func (f *fastIO) next() string {
	f.Read(f.p[:])
	for f.p[0] <= ' ' {
		f.Read(f.p[:])
	}
	var s []byte
	for f.p[0] > ' ' {
		s = append(s, f.p[0])
		f.Read(f.p[:])
	}
	return string(s)
}

func (f *fastIO) println(a ...interface{}) {
	fmt.Fprintln(f.Writer, a...)
}

func (f *fastIO) print(a ...interface{}) {
	fmt.Fprint(f.Writer, a...)
}

func (f *fastIO) printInts(a ...int) {
	if len(a) > 0 {
		f.print(a[0])
		for _, x := range a[1:] {
			f.print(" ", x)
		}
	}
}

func (f *fastIO) printlnInts(a ...int) {
	f.printInts(a...)
	f.println()
}

package main

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

func main() {
	var cases int
	fmt.Scanf("%d\n", &cases)
	reader := bufio.NewReader(os.Stdin)
	for i := 0; i < cases; i++ {
		readLine(reader)
		s := readLine(reader)
		ai := strings.Split(string(s), " ")
		m := make(map[int]struct{})
		for i:=0;i<len(ai);i++ {
			c, _ := strconv.Atoi(ai[i])
			m[c] = struct{}{}
		}
		s = readLine(reader)
		bi := strings.Split(string(s), " ")
		flag := false
		number := 0
		for i:=0; i < len(bi); i++ {
			c,_ := strconv.Atoi(bi[i])
			if _, ok := m[c]; ok {
				flag = true
				number = c
				break
			}
		}
		if flag {
			fmt.Println("YES")
			fmt.Println(1, number)
		} else {
			fmt.Println("NO")
		}
	}
}

func readLine(reader *bufio.Reader) []byte {
	result := make([]byte, 0)
	for {
		s, isPrefix, err := reader.ReadLine()
		if err != nil {
			fmt.Printf("error=%+v\n", err)
			break
		}
		result = append(result, s...)
		if !isPrefix {
			break
		}
	}
	return result
}

package main

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

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

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	var n, m int
Loop:
	for i := 0; i < t; i++ {
		scanner.Scan()
		n = toInt(scanner.Bytes())

		scanner.Scan()
		m = toInt(scanner.Bytes())

		a := make(map[int]int)
		b := make(map[int]int)

		for j := 0; j < n; j++ {
			scanner.Scan()
			in := toInt(scanner.Bytes())
			if _, ok := a[in]; !ok {
				a[in] = 1
			}
		}

		for k := 0; k < m; k++ {
			scanner.Scan()
			in := toInt(scanner.Bytes())
			if _, ok := b[in]; !ok {
				b[in] = 1
			}
		}

		if n < m {
			for v, _ := range a {
				if _, ok := b[v]; ok {
					fmt.Printf("YES\n%d %d\n", 1, v)
					continue Loop
				}
			}
			fmt.Println("NO")
		} else {
			for v, _ := range b {
				if _, ok := a[v]; ok {
					fmt.Printf("YES\n%d %d\n", 1, v)
					continue Loop
				}
			}
			fmt.Println("NO")
		}

	}
}

func toInt(buf []byte) (n int) {
	for _, v := range buf {
		n = n*10 + int(v-'0')
	}
	return
}

package main

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

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)

	var t, n, m int

	var A [1005]int
	var B [1005]int

	fmt.Fscan(input, &t)

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

		fmt.Fscan(input, &n, &m)

		for i := 0; i < n; i++ {
			fmt.Fscan(input, &A[i])
		}

		for i := 0; i < m; i++ {
			fmt.Fscan(input, &B[i])
		}

		var ans int = 0
		for i := 0; i < n; i++ {
			for j := 0; j < m; j++ {
				if A[i] == B[j] {
					ans = A[i]
				}
			}
		}

		if ans > 0 {
			fmt.Println("YES")
			fmt.Println("1", ans)
		} else {
			fmt.Println("NO")
		}

	}
}

package main

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

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)

	var t, n, m int

	fmt.Fscan(input, &t)

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

		fmt.Fscan(input, &n, &m)

		var A [1005]int
		var B [1005]int

		for i := 0; i < n; i++ {
			fmt.Fscan(input, &A[i])
		}

		for i := 0; i < m; i++ {
			fmt.Fscan(input, &B[i])
		}

		var ans int = 0
		for i := 0; i < n; i++ {
			for j := 0; j < m; j++ {
				if A[i] == B[j] {
					ans = A[i]
				}
			}
		}

		if ans > 0 {
			fmt.Println("YES")
			fmt.Println("1", ans)
		} else {
			fmt.Println("NO")
		}

	}
}

// https://codeforces.com/contest/1374/problem/A
package main

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

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 min2(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func min3(a, b, c int) int {
	return min2(a, min2(b, c))
}

func main() {
	defer writer.Flush()

	var t int
	scanf("%d\n", &t)

	for k := 0; k < t; k++ {
		// Read input
		var n, m int
		scanf("%d %d\n", &n, &m)

		a := make([]int, n)
		for i := 0; i < n; i++ {
			scanf("%d", &a[i])
		}
		scanf("\n")
		b := make([]int, m)
		for i := 0; i < m; i++ {
			scanf("%d", &b[i])
		}
		scanf("\n")

		var same int
		var has bool

		has = false

		for i := 0; i < n; i++ {
			for j := 0; j < m; j++ {
				if a[i] == b[j] {
					has = true
					same = a[i]
					break
				}
			}
		}

		if has {
			printf("YES\n")
			printf("1 %d\n", same)
		} else {
			printf("NO\n")
		}
	}
}

package main

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

const (
	SCANNER_BUF_SIZE = 2 << 20

	INF = int64(math.MaxInt64)
	MOD = 1e9 + 7
)

var (
	writer  *bufio.Writer
	scanner *bufio.Scanner
)

func init() {
	writer = bufio.NewWriter(os.Stdout)
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, SCANNER_BUF_SIZE), SCANNER_BUF_SIZE)
}

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

func sint64() int64 {
	scanner.Scan()
	bb := scanner.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func suint64() uint64 {
	scanner.Scan()
	bb := scanner.Bytes()
	i := uint64(0)
	for _, b := range bb {
		i *= 10
		i += uint64(b - '0')
	}
	return i
}

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

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

func lcm(a, b int64) int64 {
	return a * b / gcd(a, b)
}

func abs(a int64) int64 {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r < a {
			a = r
		}
	}
	return a
}

func max(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r > a {
			a = r
		}
	}
	return a
}

func main() {
	defer writer.Flush()
	t := sint64()
	for ; t > 0; t-- {
		n := sint64()
		m := sint64()
		a := map[int64]bool{}
		for i := int64(0); i < n; i++ {
			a[sint64()] = true
		}
		b := map[int64]bool{}
		for i := int64(0); i < m; i++ {
			b[sint64()] = true
		}
		res := int64(0)
		for i := range a {
			if b[i] {
				res = i
				break
			}
		}
		if res == 0 {
			printf("NO\n")
		} else {
			printf("YES\n")
			printf("1 %d\n", res)
		}
	}
}


Little Paul wants to learn how to play piano. He already has a melody he wants to start with. For simplicity he represented this melody as a sequence $$$a_1, a_2, \ldots, a_n$$$ of key numbers: the more a number is, the closer it is to the right end of the piano keyboard.Paul is very clever and knows that the essential thing is to properly assign fingers to notes he's going to play. If he chooses an inconvenient fingering, he will then waste a lot of time trying to learn how to play the melody by these fingers and he will probably not succeed.Let's denote the fingers of hand by numbers from $$$1$$$ to $$$5$$$. We call a fingering any sequence $$$b_1, \ldots, b_n$$$ of fingers numbers. A fingering is convenient if for all $$$1\leq i \leq n - 1$$$ the following holds:  if $$$a_i < a_{i+1}$$$ then $$$b_i < b_{i+1}$$$, because otherwise Paul needs to take his hand off the keyboard to play the $$$(i+1)$$$-st note;  if $$$a_i > a_{i+1}$$$ then $$$b_i > b_{i+1}$$$, because of the same;  if $$$a_i = a_{i+1}$$$ then $$$b_i\neq b_{i+1}$$$, because using the same finger twice in a row is dumb. Please note that there is $$$\neq$$$, not $$$=$$$ between $$$b_i$$$ and $$$b_{i+1}$$$. Please provide any convenient fingering or find out that there is none.

The first line contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) denoting the number of notes. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 2\cdot10^5$$$) denoting the positions of notes on the keyboard.

If there is no convenient fingering, print $$$-1$$$. Otherwise, print $$$n$$$ numbers $$$b_1, b_2, \ldots, b_n$$$, each from $$$1$$$ to $$$5$$$, denoting a convenient fingering, separated by spaces.

NoteThe third sample test is kinda "Non stop" song by Reflex.

package main

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

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

	var n int
	Fscan(in, &n)
	if n == 1 {
		Fprint(out, 1)
		return
	}
	a := make([]int, n)
	for i := range a {
		Fscan(in, &a[i])
	}
	b := make([]int, n)
	if a[0] < a[1] {
		b[0] = 1
	} else {
		b[0] = 5
	}
	for i := 1; i < n; i++ {
		if a[i] > a[i-1] {
			if i > 1 && a[i-1] <= a[i-2] {
				b[i-1] = 1
				if b[i-2] == 1 {
					b[i-1] = 2
				}
			}
			b[i] = b[i-1] + 1
		} else if a[i] < a[i-1] {
			if i > 1 && a[i-1] >= a[i-2] {
				b[i-1] = 5
				if b[i-2] == 5 {
					b[i-1] = 4
				}
			}
			b[i] = b[i-1] - 1
		} else {
			b[i] = (b[i-1]-1)%3 + 2
		}
		if b[i] < 1 || b[i] > 5 {
			Fprint(out, -1)
			return
		}
	}
	for _, v := range b {
		Fprint(out, v, " ")
	}
}

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

package main

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

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

	var n int
	Fscan(in, &n)
	if n == 1 {
		Fprint(out, 1)
		return
	}
	a := make([]int, n)
	for i := range a {
		Fscan(in, &a[i])
	}
	b := make([]int, n)
	if a[0] < a[1] {
		b[0] = 1
	} else {
		b[0] = 5
	}
	for i := 1; i < n; i++ {
		if a[i] > a[i-1] {
			if i > 1 && a[i-1] <= a[i-2] {
				b[i-1] = 1
			}
			b[i] = b[i-1] + 1
		} else if a[i] < a[i-1] {
			if i > 1 && a[i-1] >= a[i-2] {
				b[i-1] = 5
			}
			b[i] = b[i-1] - 1
		} else {
			b[i] = b[i-1]%5 + 1
		}
		if b[i] < 1 || b[i] > 5 {
			Fprint(out, -1)
			return
		}
	}
	for _, v := range b {
		Fprint(out, v, " ")
	}
}

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

package main

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

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

	var n int
	Fscan(in, &n)
	if n == 1 {
		Fprint(out, 1)
		return
	}
	a := make([]int, n)
	for i := range a {
		Fscan(in, &a[i])
	}
	b := make([]int, n)
	if a[0] < a[1] {
		b[0] = 1
	} else {
		b[0] = 5
	}
	for i := 1; i < n; i++ {
		if a[i] > a[i-1] {
			if i > 1 && a[i-1] <= a[i-2] {
				b[i-1] = 1
			}
			b[i] = b[i-1] + 1
		} else if a[i] < a[i-1] {
			if i > 1 && a[i-1] >= a[i-2] {
				b[i-1] = 5
			}
			b[i] = b[i-1] - 1
		} else {
			b[i] = (b[i-1]-1)%3 + 2
		}
		if b[i] < 1 || b[i] > 5 {
			Fprint(out, -1)
			return
		}
	}
	for _, v := range b {
		Fprint(out, v, " ")
	}
}

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


AmShZ has traveled to Italy from Iran for the Thom Yorke concert. There are $$$n$$$ cities in Italy indexed from $$$1$$$ to $$$n$$$ and $$$m$$$ directed roads indexed from $$$1$$$ to $$$m$$$. Initially, Keshi is located in the city $$$1$$$ and wants to go to AmShZ's house in the city $$$n$$$. Since Keshi doesn't know the map of Italy, AmShZ helps him to see each other as soon as possible.In the beginning of each day, AmShZ can send one of the following two messages to Keshi: AmShZ sends the index of one road to Keshi as a blocked road. Then Keshi will understand that he should never use that road and he will remain in his current city for the day. AmShZ tells Keshi to move. Then, Keshi will randomly choose one of the cities reachable from his current city and move there. (city $$$B$$$ is reachable from city $$$A$$$ if there's an out-going road from city $$$A$$$ to city $$$B$$$ which hasn't become blocked yet). If there are no such cities, Keshi will remain in his current city.Note that AmShZ always knows Keshi's current location. AmShZ and Keshi want to find the smallest possible integer $$$d$$$ for which they can make sure that they will see each other after at most $$$d$$$ days. Help them find $$$d$$$.

The first line of the input contains two integers $$$n$$$ and $$$m$$$ $$$(2 \le n \le 2 \cdot 10^5, 1 \le m \le 2 \cdot 10^5)$$$  — the number of cities and roads correspondingly. The $$$i$$$-th line of the following $$$m$$$ lines contains two integers $$$v_i$$$ and $$$u_i$$$ $$$(1 \le v_i , u_i \le n,v_i \neq u_i)$$$, denoting a directed road going from city $$$v_i$$$ to city $$$u_i$$$. It is guaranteed that there is at least one route from city $$$1$$$ to city $$$n$$$. Note that there may be more than one road between a pair of cities in each direction.

Output the smallest possible integer $$$d$$$ to make sure that AmShZ and Keshi will see each other after at most $$$d$$$ days.

NoteIn the first sample, it's enough for AmShZ to send the second type of message.In the second sample, on the first day, AmShZ blocks the first road. So the only reachable city from city $$$1$$$ will be city $$$4$$$. Hence on the second day, AmShZ can tell Keshi to move and Keshi will arrive at AmShZ's house.It's also possible for AmShZ to tell Keshi to move for two days.

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)
var wrtr = bufio.NewWriterSize(os.Stdout, 10_000_000)
var rdr = bufio.NewScanner(os.Stdin)
func gs() string  { rdr.Scan(); return rdr.Text() }
func gi() int     { i,e := strconv.Atoi(gs()); if e != nil {panic(e)}; return i }
func gi2() (int,int) { return gi(),gi() }
func gi3() (int,int,int) { return gi(),gi(),gi() }
func gi4() (int,int,int,int) { return gi(),gi(),gi(),gi() }
func gis(n int) []int  { res := make([]int,n); for i:=0;i<n;i++ { res[i] = gi() }; return res }
func gf() float64 { f,e := strconv.ParseFloat(gs(),64); if e != nil {panic(e)}; return f }
func gbs() []byte { return []byte(gs()) }
func gfs(n int) []float64  { res := make([]float64,n); for i:=0;i<n;i++ { res[i] = gf() }; return res }
func gss(n int) []string  { res := make([]string,n); for i:=0;i<n;i++ { res[i] = gs() }; return res }
func ia(m int) []int { return make([]int,m) }
func iai(m int,v int) []int { a := make([]int,m); for i:=0;i<m;i++ { a[i] = v }; return a }
func twodi(n int,m int,v int) [][]int {
	r := make([][]int,n); for i:=0;i<n;i++ { x := make([]int,m); for j:=0;j<m;j++ { x[j] = v }; r[i] = x }; return r
}
func fill2(m int) ([]int,[]int) { a,b := ia(m),ia(m); for i:=0;i<m;i++ {a[i],b[i] = gi(),gi()}; return a,b }
func fill3(m int) ([]int,[]int,[]int) { a,b,c := ia(m),ia(m),ia(m); for i:=0;i<m;i++ {a[i],b[i],c[i] = gi(),gi(),gi()}; return a,b,c }
func fill4(m int) ([]int,[]int,[]int,[]int) { a,b,c,d := ia(m),ia(m),ia(m),ia(m); for i:=0;i<m;i++ {a[i],b[i],c[i],d[i] = gi(),gi(),gi(),gi()}; return a,b,c,d }
func abs(a int) int { if a < 0 { return -a }; return a }
func rev(a []int) { i,j := 0,len(a)-1; for i < j { a[i],a[j] = a[j],a[i]; i++; j-- } }
func max(a,b int) int { if a > b { return a }; return b }
func min(a,b int) int { if a > b { return b }; return a }
func tern(cond bool, a int, b int) int { if cond { return a }; return b }
func terns(cond bool, a string, b string) string { if cond { return a }; return b }
func maxarr(a []int) int { ans := a[0]; for _,aa := range(a) { if aa > ans { ans = aa } }; return ans }
func minarr(a []int) int { ans := a[0]; for _,aa := range(a) { if aa < ans { ans = aa } }; return ans }
func sumarr(a []int) int { ans := 0; for _,aa := range(a) { ans += aa }; return ans }
func zeroarr(a []int) { for i:=0; i<len(a); i++ { a[i] = 0 } }
func powmod(a,e,mod int) int { res, m := 1, a; for e > 0 { if e&1 != 0 { res = res * m % mod }; m = m * m % mod; e >>= 1 }; return res }
func powint(a,e int) int { res, m := 1, a; for e > 0 { if e&1 != 0 { res = res * m }; m = m * m; e >>= 1 }; return res }
func gcd(a,b int) int { for b != 0 { t:=b; b=a%b; a=t }; return a }
func gcdExtended(a,b int) (int,int,int) { if a == 0 { return b,0,1 }; gcd,x1,y1 := gcdExtended(b%a,a); return gcd, y1-(b/a)*x1,x1 }
func modinv(a,m int) (int,bool) { g,x,_ := gcdExtended(a,m); if g != 1 { return 0,false }; return (x % m + m) % m,true  }
func makefact(n int,mod int) ([]int,[]int) {
	fact,factinv := make([]int,n+1),make([]int,n+1)
	fact[0] = 1; for i:=1;i<=n;i++ { fact[i] = fact[i-1] * i % mod }
	factinv[n] = powmod(fact[n],mod-2,mod); for i:=n-1;i>=0;i-- { factinv[i] = factinv[i+1] * (i+1) % mod }
	return fact,factinv
}
func vecintstring(a []int) string { astr := make([]string,len(a)); for i,a := range a { astr[i] = strconv.Itoa(a) }; return strings.Join(astr," ") }
const inf = 1000000000
type dnode struct { d,n2 int }
type minheap struct { buf []dnode; less func(dnode, dnode) bool }
func Newminheap(f func(dnode, dnode) bool) *minheap { buf := make([]dnode, 0); return &minheap{buf, f} }
func (q *minheap) IsEmpty() bool { return len(q.buf) == 0 }
func (q *minheap) Clear() { q.buf = q.buf[:0] }
func (q *minheap) Len() int { return len(q.buf) }
func (q *minheap) Push(v dnode) { q.buf = append(q.buf, v); q.siftdown(0, len(q.buf)-1) }
func (q *minheap) Head() dnode { return q.buf[0] }
func (q *minheap) Pop() dnode {
	v1 := q.buf[0]; l := len(q.buf)
	if l == 1 { q.buf = q.buf[:0] } else { l--; q.buf[0] = q.buf[l]; q.buf = q.buf[:l]; q.siftup(0) }; return v1
}
func (q *minheap) Heapify(pri []dnode) {
	q.buf = append(q.buf, pri...); n := len(q.buf); for i := n/2 - 1; i >= 0; i-- { q.siftup(i) }
}
func (q *minheap) siftdown(startpos, pos int) {
	newitem := q.buf[pos]
	for pos > startpos {
		ppos := (pos - 1) >> 1; p := q.buf[ppos]; if !q.less(newitem, p) { break }; q.buf[pos], pos = p, ppos
	}
	q.buf[pos] = newitem
}
func (q *minheap) siftup(pos int) {
	endpos, startpos, newitem, chpos := len(q.buf), pos, q.buf[pos], 2*pos+1
	for chpos < endpos {
		rtpos := chpos + 1; if rtpos < endpos && !q.less(q.buf[chpos], q.buf[rtpos]) { chpos = rtpos }
		q.buf[pos], pos = q.buf[chpos], chpos; chpos = 2*pos + 1
	}
	q.buf[pos] = newitem; q.siftdown(startpos, pos)
}
func main() {
	//f1, _ := os.Create("cpu.prof"); pprof.StartCPUProfile(f1); defer pprof.StopCPUProfile()
	defer wrtr.Flush()
	infn := ""; if infn == "" && len(os.Args) > 1 {	infn = os.Args[1] }
	if infn != "" {	f, e := os.Open(infn); if e != nil { panic(e) }; rdr = bufio.NewScanner(f) }
	rdr.Split(bufio.ScanWords); rdr.Buffer(make([]byte,1024),1_000_000_000)
	// PROGRAM STARTS HERE
	N,M := gi(),gi(); V,U := fill2(M); for i:=0;i<M;i++ { V[i]--; U[i]-- }
	gr := make([][]int,N); grev := make([][]int,N)
	for i:=0;i<M;i++ { v,u := V[i],U[i]; gr[v] = append(gr[v],u); grev[u] = append(grev[u],v) }
	// Calculate out degree of every node
	deg := ia(N); for i:=0;i<N;i++ { deg[i] = len(gr[i]) }
	dist := iai(N,inf)
	mh := Newminheap(func(a,b dnode) bool { return a.d < b.d } )
	mh.Push(dnode{0,N-1})
	for !mh.IsEmpty() {
		xx := mh.Pop(); d,u := xx.d,xx.n2
		if dist[u] != inf { continue }
		dist[u] = d
		for _,v := range grev[u] { mh.Push(dnode{d+deg[v],v}); deg[v]-- }
	}
	fmt.Println(dist[0])
}


You are given two sequences $$$a_1, a_2, \dots, a_n$$$ and $$$b_1, b_2, \dots, b_n$$$. Each element of both sequences is either $$$0$$$, $$$1$$$ or $$$2$$$. The number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$a$$$ is $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ respectively, and the number of elements $$$0$$$, $$$1$$$, $$$2$$$ in the sequence $$$b$$$ is $$$x_2$$$, $$$y_2$$$, $$$z_2$$$ respectively.You can rearrange the elements in both sequences $$$a$$$ and $$$b$$$ however you like. After that, let's define a sequence $$$c$$$ as follows:$$$c_i = \begin{cases} a_i b_i & \mbox{if }a_i > b_i \\ 0 & \mbox{if }a_i = b_i \\ -a_i b_i & \mbox{if }a_i < b_i \end{cases}$$$You'd like to make $$$\sum_{i=1}^n c_i$$$ (the sum of all elements of the sequence $$$c$$$) as large as possible. What is the maximum possible sum?

The first line contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Each test case consists of two lines. The first line of each test case contains three integers $$$x_1$$$, $$$y_1$$$, $$$z_1$$$ ($$$0 \le x_1, y_1, z_1 \le 10^8$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the sequence $$$a$$$. The second line of each test case also contains three integers $$$x_2$$$, $$$y_2$$$, $$$z_2$$$ ($$$0 \le x_2, y_2, z_2 \le 10^8$$$; $$$x_1 + y_1 + z_1 = x_2 + y_2 + z_2 > 0$$$) — the number of $$$0$$$-s, $$$1$$$-s and $$$2$$$-s in the sequence $$$b$$$.

For each test case, print the maximum possible sum of the sequence $$$c$$$.

package main

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

func main() {
	io := NewFastIO(os.Stdin, os.Stdout)
	defer io.Flush()

	pref := [][]int{
		{2, 1},
		{2, 2},
		{2, 0},
		{1, 1},
		{1, 0},
		{0, 0},
		{0, 1},
		{0, 2},
		{1, 2},
	}
	for t := io.NextInt(); t > 0; t-- {
		a, b := io.NextInts(3), io.NextInts(3)
		ans := 0
		for _, r := range pref {
			i, j := r[0], r[1]
			c := min(a[i], b[j])
			a[i] -= c
			b[j] -= c
			if i > j {
				ans += c * i * j
			} else if i < j {
				ans -= c * i * j
			}
		}
		io.Println(ans)
	}
}

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

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

type FastIO struct {
	*bufio.Writer
	r    io.Reader
	buf  [8192]byte
	i, n int
}

func NewFastIO(r io.Reader, w io.Writer) *FastIO {
	return &FastIO{r: r, Writer: bufio.NewWriter(w)}
}

func (f *FastIO) readC() byte {
	if f.i == f.n {
		f.n, _ = f.r.Read(f.buf[:])
		if f.n == 0 {
			panic("EOF")
		}
		f.i = 0
	}
	f.i++
	return f.buf[f.i-1]
}

func (f *FastIO) NextInt() int {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	neg := false
	if c == '-' {
		neg = true
		c = f.readC()
	}
	n := 0
	for ; '0' <= c && c <= '9'; c = f.readC() {
		n = n*10 + int(c) - '0'
	}
	if neg {
		return -n
	}
	return n
}

func (f *FastIO) NextInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = f.NextInt()
	}
	return a
}

func (f *FastIO) Next() string {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	var s []byte
	for ; c > ' '; c = f.readC() {
		s = append(s, c)
	}
	return string(s)
}

func (f *FastIO) Println(a ...interface{}) {
	fmt.Fprintln(f, a...)
}

func (f *FastIO) Print(a ...interface{}) {
	fmt.Fprint(f, a...)
}

func (f *FastIO) PrintInts(a ...int) {
	if len(a) > 0 {
		f.Print(a[0])
		for _, x := range a[1:] {
			f.Print(" ", x)
		}
	}
}

func (f *FastIO) PrintlnInts(a ...int) {
	f.PrintInts(a...)
	f.Println()
}

package main

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

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		var x1, x2, y1, y2, z1, z2 int
		fmt.Fscan(in, &x1)
		fmt.Fscan(in, &y1)
		fmt.Fscan(in, &z1)

		fmt.Fscan(in, &x2)
		fmt.Fscan(in, &y2)
		fmt.Fscan(in, &z2)

		if x1 >= z2 {
			x1 -= z2
			z2 = 0
		} else {
			z2 -= x1
			x1 = 0
		}

		if z1 >= z2 {
			z1 -= z2
			z2 = 0
		} else {
			z2 -= z1
			z1 = 0
		}

		ans := 0
		ans += 2 * min(z1, y2)
		ans -= 2 * min(z2, y1)
		fmt.Println(ans)
	}
}

package main

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

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

	buff := make([]byte, 2 * 1024 * 1024)

	scanner.Buffer(buff, 1024 * 1024)

	scanner.Scan()

	t := scanner.Text()

	testCases, err := strconv.Atoi(t)

	if err != nil {
		panic(err)
	}

	for j := 0; j < int(testCases); j ++ {
		scanner.Scan()

		xyz := MustParseFieldsB(scanner.Text())

		x1 := xyz[0]
		y1 := xyz[1]
		z1 := xyz[2]

		scanner.Scan()

		xyz2 := MustParseFieldsB(scanner.Text())

		x2 := xyz2[0]
		y2 := xyz2[1]
		z2 := xyz2[2]

		ans := solveB(x1, y1, z1, x2, y2, z2)

		fmt.Println(ans)
	}
}

func solveB(x1, y1, z1, x2, y2, z2 int) int {
	if x1 >= z2 {
		return 2 * min(z1, y2)
	}
	second2Left := z2 - x1

	if z1 >= second2Left {
		one2Left := z1 - second2Left
		return 2 * min(one2Left, y2)
	}
	return - 2 * min(second2Left - z1, y1)
}

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

func MustParseFieldsB(str string) []int {
	parts := strings.Fields(str)

	var ints []int

	for i := 0; i < len(parts); i++ {
		v, err := strconv.Atoi(parts[i])

		if err != nil {
			panic(err)
		}
		ints = append(ints, v)
	}
	return ints
}

package main

import (
	"fmt"
)

type Seq struct {
	Zero int
	One  int
	Two  int
}

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

	return b
}

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

	for i := 0; i < t; i++ {
		var p1, p2 Seq
		if _, err := fmt.Scanf("%d %d %d\n", &p1.Zero, &p1.One, &p1.Two); err != nil {
			panic(err)
		}

		if _, err := fmt.Scanf("%d %d %d\n", &p2.Zero, &p2.One, &p2.Two); err != nil {
			panic(err)
		}

		c := 0

		{
			count := min(p1.Two, p2.One)
			c += count * 2 // + 2 * 1
			p1.Two -= count
			p2.One -= count
		}

		{
			count := min(p1.Two, p2.Two)
			p1.Two -= count
			p2.Two -= count
		}

		{
			count := min(p1.Two, p2.Zero)
			p1.Two -= count
			p2.Zero -= count
		}

		{
			count := min(p1.Zero, p2.Two)
			p1.Zero -= count
			p2.Two -= count
		}

		{
			count := min(p1.Zero, p2.One)
			p1.Zero -= count
			p2.One -= count
		}

		{
			count := min(p1.Zero, p2.Zero)
			p1.Zero -= count
			p2.Zero -= count
		}

		{
			count := min(p1.One, p2.Zero)
			p1.One -= count
			p2.Zero -= count
		}

		{
			count := min(p1.One, p2.One)
			p1.One -= count
			p2.One -= count
		}

		{
			count := min(p1.One, p2.Two)
			c -= count * 2
			p1.One -= count
			p2.Two -= count
		}

		fmt.Println(c)
	}
}

package main
import (
        "fmt"
        "os"
        "bufio"
)
func min(a, b int) int {
    if a < b {
        return a
    }
    return b
}
func main(){
    var t, x1, y1, z1, x2, y2, z2, ans int
    in := bufio.NewReader(os.Stdin)
    out := bufio.NewWriter(os.Stdout)
    defer out.Flush()

    fmt.Fscan(in, &t)
    for ; t > 0; t-- {
        fmt.Fscan(in, &x1, &y1, &z1)
        fmt.Fscan(in, &x2, &y2, &z2)

        ans = min(z1, y2) * 2
        z1 -= min(z1, y2)
        ans += min(z2 - min(z2, x1+z1), y1) * -2
        fmt.Fprintln(out, ans)
    }
}

package main

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

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

	if err := run(os.Args[1:], s); err != nil {
		fmt.Println(err)
	}
}

type Seq struct {
	x, y, z int
}

func run(args []string, s *bufio.Scanner) error {
	// Problem Logic Here... 😊
	s.Split(bufio.ScanWords)
	s.Scan()
	tc, err := strconv.Atoi(s.Text())
	if err != nil {
		return err
	}

	for tc > 0 && s.Scan() {
		ax, err := strconv.Atoi(s.Text())
		if err != nil {
			return err
		}

		s.Scan()
		ay, err := strconv.Atoi(s.Text())
		if err != nil {
			return err
		}

		s.Scan()
		az, err := strconv.Atoi(s.Text())
		if err != nil {
			return err
		}

		s.Scan()
		bx, err := strconv.Atoi(s.Text())
		if err != nil {
			return err
		}

		s.Scan()
		by, err := strconv.Atoi(s.Text())
		if err != nil {
			return err
		}

		s.Scan()
		bz, err := strconv.Atoi(s.Text())
		if err != nil {
			return err
		}

		fmt.Println(solve(int64(ax), int64(ay), int64(az), int64(bx), int64(by), int64(bz), big.NewInt(0)))
		tc--
	}

	return nil
}

func solve(ax, ay, az, bx, by, bz int64, score *big.Int) *big.Int {
	canIncreaseScore := az > 0 && by > 0
	canDecreaseScore := ay > 0 && bz > 0

	if canIncreaseScore {
		if az <= by {
			return solve(ax, ay, 0, bx, by - ax, bz, score.Add(score, big.NewInt(az * 2)))
		}
		return solve(ax, ay, az - by, bx, 0, bz, score.Add(score, big.NewInt(by * 2)))
	}

	haveToDecrease := bz > 0 && bz > ax + az && canDecreaseScore

	if !haveToDecrease {
		return score
	}

	if ax != 0 || az != 0 {
		return solve(0, ay, 0, bx, by, bz - (ax + az), score)
	}

	if canDecreaseScore {
		if bz <= ay {
			return solve(ax, ay - bz, az, bx, by, 0, score.Sub(score, big.NewInt(bz * 2)))
		}
		return solve(ax, 0, az, bx, by, bz - ay, score.Sub(score, big.NewInt(ay * 2)))
	}

	return score
}

package main

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

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

func main() {
	r := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(r, &t)
	for tc := 0; tc < t; tc++ {
		var x1, y1, z1 int64
		fmt.Fscan(r, &x1, &y1, &z1)
		var x2, y2, z2 int64
		fmt.Fscan(r, &x2, &y2, &z2)

		tmp := min(z1, y2)
		z1, y2 = z1-tmp, y2-tmp
		rls := 2 * tmp

		tmp = min(x1+z1, z2)
		rls -= 2 * (z2 - tmp)
		fmt.Println(rls)
	}
}

package main

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

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

func main() {
	r := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(r, &t)
	for tc := 0; tc < t; tc++ {
		var x1, y1, z1 int64
		fmt.Fscan(r, &x1, &y1, &z1)
		var x2, y2, z2 int64
		fmt.Fscan(r, &x2, &y2, &z2)

		tmp := min(z1, y2)
		rls := 2 * tmp
		z1 -= tmp
		y2 -= tmp

		tmp = min(x1+z1, z2)
		rls -= 2 * (z2 - tmp)
		fmt.Println(rls)
	}
}

package main

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

var rw = NewFastIO(os.Stdin, os.Stdout)

func main() {
	defer rw.Flush()
	nTest := rw.NextInt()
	for i := 0; i < nTest; i++ {
		solveCase()
	}
}

func solveCase() {
	a := rw.NextInts(3)
	b := rw.NextInts(3)
	ans := 2 * Min(a[2], b[1])
	a[2] -= ans / 2
	b[1] -= ans / 2
	a[1] -= b[1]
	a[1] -= b[0]
	if a[1] > 0 {
		ans -= 2 * a[1]
	}
	rw.Println(ans)
}

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

// @meooow template uwu
type FastIO struct {
	*bufio.Writer
	r    io.Reader
	buf  [8192]byte
	i, n int
}

func NewFastIO(r io.Reader, w io.Writer) *FastIO {
	return &FastIO{r: r, Writer: bufio.NewWriter(w)}
}

func (f *FastIO) readC() byte {
	if f.i == f.n {
		f.n, _ = f.r.Read(f.buf[:])
		if f.n == 0 {
			panic("EOF")
		}
		f.i = 0
	}
	f.i++
	return f.buf[f.i-1]
}

func (f *FastIO) Next() string {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	var s []byte
	for ; c > ' '; c = f.readC() {
		s = append(s, c)
	}
	return string(s)
}

func (f *FastIO) NextInt() int {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	neg := false
	if c == '-' {
		neg = true
		c = f.readC()
	}
	n := 0
	for ; '0' <= c && c <= '9'; c = f.readC() {
		n = n*10 + int(c) - '0'
	}
	if neg {
		return -n
	}
	return n
}
func (f *FastIO) NextInt64() int64 {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	neg := false
	if c == '-' {
		neg = true
		c = f.readC()
	}
	n := int64(0)
	for ; '0' <= c && c <= '9'; c = f.readC() {
		n = n*10 + int64(c) - '0'
	}
	if neg {
		return -n
	}
	return n
}

func (f *FastIO) NextInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = f.NextInt()
	}
	return a
}
func (f *FastIO) NextInt64s(n int) []int64 {
	a := make([]int64, n)
	for i := 0; i < n; i++ {
		a[i] = f.NextInt64()
	}
	return a
}

func (f *FastIO) Println(a ...interface{}) {
	fmt.Fprintln(f, a...)
}

func (f *FastIO) Print(a ...interface{}) {
	fmt.Fprint(f, a...)
}
func (f *FastIO) PrintInts(a ...int) {
	if len(a) > 0 {
		f.Print(a[0])
		for _, x := range a[1:] {
			f.Print(" ", x)
		}
	}
}
func (f *FastIO) PrintlnInts(a ...int) {
	f.PrintInts(a...)
	f.Println()
}
func (f *FastIO) PrintInt64s(a ...int64) {
	if len(a) > 0 {
		f.Print(a[0])
		for _, x := range a[1:] {
			f.Print(" ", x)
		}
	}
}
func (f *FastIO) PrintlnInt64s(a ...int64) {
	f.PrintInt64s(a...)
	f.Println()
}

package main

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

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

	buff := make([]byte, 2 * 1024 * 1024)

	scanner.Buffer(buff, 1024 * 1024)

	scanner.Scan()

	t := scanner.Text()

	testCases, err := strconv.Atoi(t)

	if err != nil {
		panic(err)
	}

	for j := 0; j < int(testCases); j ++ {
		scanner.Scan()

		xyz := MustParseFieldsB(scanner.Text())

		x1 := xyz[0]
		y1 := xyz[1]
		z1 := xyz[2]

		scanner.Scan()

		xyz2 := MustParseFieldsB(scanner.Text())

		x2 := xyz2[0]
		y2 := xyz2[1]
		z2 := xyz2[2]

		ans := solveB(x1, y1, z1, x2, y2, z2)

		fmt.Println(ans)
	}
}

func solveB(x1, y1, z1, x2, y2, z2 int) int {
	if x1 >= z2 {
		return 2 * min(z1, y2)
	}
	second2Left := z2 - x1

	if z1 >= second2Left {
		one2Left := z1 - second2Left
		return 2 * min(one2Left, y2)
	}
	return - 2 * min(second2Left, y1)
}

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

func MustParseFieldsB(str string) []int {
	parts := strings.Fields(str)

	var ints []int

	for i := 0; i < len(parts); i++ {
		v, err := strconv.Atoi(parts[i])

		if err != nil {
			panic(err)
		}
		ints = append(ints, v)
	}
	return ints
}

package main
import (
        "fmt"
        "os"
        "bufio"
)
func min(a, b int) int {
    if a < b {
        return a
    }
    return b
}
func main(){
    var t, x1, y1, z1, x2, y2, z2, ans int
    in := bufio.NewReader(os.Stdin)
    out := bufio.NewWriter(os.Stdout)
    defer out.Flush()

    fmt.Fscan(in, &t)
    for ; t > 0; t-- {
        fmt.Fscan(in, &x1, &y1, &z1)
        fmt.Fscan(in, &x2, &y2, &z2)

        ans = min(z1, y2) * 2
        ans += min(z2 - min(z2, x1), y1) * -2
        fmt.Fprintln(out, ans)
    }
}

package main

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

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

	if err := run(os.Args[1:], s); err != nil {
		fmt.Println(err)
	}
}

type Seq struct {
	x, y, z int
}

func run(args []string, s *bufio.Scanner) error {
	// Problem Logic Here... 😊
	s.Split(bufio.ScanWords)
	s.Scan()
	tc, err := strconv.Atoi(s.Text())
	if err != nil {
		return err
	}

	for tc > 0 && s.Scan() {
		ax, err := strconv.Atoi(s.Text())
		if err != nil {
			return err
		}

		s.Scan()
		ay, err := strconv.Atoi(s.Text())
		if err != nil {
			return err
		}

		s.Scan()
		az, err := strconv.Atoi(s.Text())
		if err != nil {
			return err
		}

		s.Scan()
		bx, err := strconv.Atoi(s.Text())
		if err != nil {
			return err
		}

		s.Scan()
		by, err := strconv.Atoi(s.Text())
		if err != nil {
			return err
		}

		s.Scan()
		bz, err := strconv.Atoi(s.Text())
		if err != nil {
			return err
		}

		fmt.Println(solve(int64(ax), int64(ay), int64(az), int64(bx), int64(by), int64(bz), big.NewInt(0)))
		tc--
	}

	return nil
}

func solve(ax, ay, az, bx, by, bz int64, score *big.Int) *big.Int {
	canIncreaseScore := az > 0 && by > 0
	canDecreaseScore := ay > 0 && bz > 0
	if !canIncreaseScore && !canDecreaseScore {
		return score
	}

	haveToDecrease := bz > 0 && ax == 0 && az == 0

	if !haveToDecrease && !canIncreaseScore {
		return score
	}

	if az > 0 && by > 0 {
		if az <= by {
			return solve(ax, ay, 0, bx, by - ax, bz, score.Add(score, big.NewInt(az * 2)))
		}
		return solve(ax, ay, az - by, bx, 0, bz, score.Add(score, big.NewInt(by * 2)))
	}

	if ay > 0 && bz > 0 {
		if bz <= ay {
			return solve(ax, ay - bz, az, bx, by, 0, score.Sub(score, big.NewInt(bz * 2)))
		}
		return solve(ax, 0, az, bx, by, bz - ay, score.Sub(score, big.NewInt(ay * 2)))
	}

	return score
}

package main

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

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

	if err := run(os.Args[1:], s); err != nil {
		fmt.Println(err)
	}
}

type Seq struct {
	x, y, z int
}

func run(args []string, s *bufio.Scanner) error {
	// Problem Logic Here... 😊
	s.Split(bufio.ScanWords)
	s.Scan()
	tc, err := strconv.Atoi(s.Text())
	if err != nil {
		return err
	}

	for tc > 0 && s.Scan() {
		ax, err := strconv.Atoi(s.Text())
		if err != nil {
			return err
		}

		s.Scan()
		ay, err := strconv.Atoi(s.Text())
		if err != nil {
			return err
		}

		s.Scan()
		az, err := strconv.Atoi(s.Text())
		if err != nil {
			return err
		}

		s.Scan()
		bx, err := strconv.Atoi(s.Text())
		if err != nil {
			return err
		}

		s.Scan()
		by, err := strconv.Atoi(s.Text())
		if err != nil {
			return err
		}

		s.Scan()
		bz, err := strconv.Atoi(s.Text())
		if err != nil {
			return err
		}

		fmt.Println(solve(int64(ax), int64(ay), int64(az), int64(bx), int64(by), int64(bz), big.NewInt(0)))
		tc--
	}

	return nil
}

func solve(ax, ay, az, bx, by, bz int64, score *big.Int) *big.Int {
	canIncreaseScore := az > 0 && by > 0
	canDecreaseScore := ay > 0 && bz > 0
	if !canIncreaseScore && !canDecreaseScore {
		return score
	}

	//haveToDecrease := bz > 0 && ax == 0 && az == 0
	haveToDecrease := bz > 0 && bz > ax + az

	if !haveToDecrease && !canIncreaseScore {
		return score
	}

	if haveToDecrease && !canIncreaseScore && ax != 0 && az != 0 {
		return solve(0, ay, 0, bx, by, bz - (ax + az), score)
	}

	if canIncreaseScore {
		if az <= by {
			return solve(ax, ay, 0, bx, by - ax, bz, score.Add(score, big.NewInt(az * 2)))
		}
		return solve(ax, ay, az - by, bx, 0, bz, score.Add(score, big.NewInt(by * 2)))
	}

	if canDecreaseScore {
		if bz <= ay {
			return solve(ax, ay - bz, az, bx, by, 0, score.Sub(score, big.NewInt(bz * 2)))
		}
		return solve(ax, 0, az, bx, by, bz - ay, score.Sub(score, big.NewInt(ay * 2)))
	}

	return score
}

package main

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

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

	if err := run(os.Args[1:], s); err != nil {
		fmt.Println(err)
	}
}

type Seq struct {
	x, y, z int
}

func run(args []string, s *bufio.Scanner) error {
	// Problem Logic Here... 😊
	s.Split(bufio.ScanWords)
	s.Scan()
	tc, err := strconv.Atoi(s.Text())
	if err != nil {
		return err
	}

	for tc > 0 && s.Scan() {
		ax, err := strconv.Atoi(s.Text())
		if err != nil {
			return err
		}

		s.Scan()
		ay, err := strconv.Atoi(s.Text())
		if err != nil {
			return err
		}

		s.Scan()
		az, err := strconv.Atoi(s.Text())
		if err != nil {
			return err
		}

		s.Scan()
		bx, err := strconv.Atoi(s.Text())
		if err != nil {
			return err
		}

		s.Scan()
		by, err := strconv.Atoi(s.Text())
		if err != nil {
			return err
		}

		s.Scan()
		bz, err := strconv.Atoi(s.Text())
		if err != nil {
			return err
		}

		fmt.Println(solve(int64(ax), int64(ay), int64(az), int64(bx), int64(by), int64(bz), big.NewInt(0)))
		tc--
	}

	return nil
}

func solve(ax, ay, az, bx, by, bz int64, score *big.Int) *big.Int {
	canIncreaseScore := az > 0 && by > 0
	canDecreaseScore := ay > 0 && bz > 0

	if canIncreaseScore {
		if az <= by {
			return solve(ax, ay, 0, bx, by - ax, bz, score.Add(score, big.NewInt(az * 2)))
		}
		return solve(ax, ay, az - by, bx, 0, bz, score.Add(score, big.NewInt(by * 2)))
	}

	haveToDecrease := bz > 0 && bz > ax + az && canDecreaseScore

	if !haveToDecrease {
		return score
	}

	if ax != 0 && az != 0 {
		return solve(0, ay, 0, bx, by, bz - (ax + az), score)
	}

	if canDecreaseScore {
		if bz <= ay {
			return solve(ax, ay - bz, az, bx, by, 0, score.Sub(score, big.NewInt(bz * 2)))
		}
		return solve(ax, 0, az, bx, by, bz - ay, score.Sub(score, big.NewInt(ay * 2)))
	}

	return score
}

package main

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

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

func main() {
	r := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(r, &t)
	for tc := 0; tc < t; tc++ {
		var x1, y1, z1 int
		fmt.Fscan(r, &x1, &y1, &z1)
		var x2, y2, z2 int
		fmt.Fscan(r, &x2, &y2, &z2)

		tmp := min(z1, y2)
		rls := 2 * tmp

		tmp = min(x1+z1, z2)
		rls -= 2 * (z2 - tmp)
		fmt.Println(rls)
	}
}