iidai/codenet huggingface dataset:
Language: Go

package main

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

var (
	a   []int
	ans = 0
)

func dfs(left, i, res int) {
	if left == 0 {
		ans += res
		return
	}
	for j := i; j < len(a); j++ {
		dfs(left-1, j+1, res*a[j])
	}
}

func main() {
	io := newIo()
	n := io.nextInt()
	dic := map[rune]int{}

	for range make([]struct{}, n) {
		c := io.nextString()[0]
		switch c {
		case 'M', 'A', 'R', 'C', 'H':
			dic[rune(c)]++
		}
	}

	for _, v := range dic {
		a = append(a, v)
	}

	dfs(3, 0, 1)
	fmt.Println(ans)
}

type io struct {
	reader    *bufio.Reader
	tokens    []string
	nextToken int
}

func newIo() *io {
	return &io{reader: bufio.NewReader(os.Stdin)}
}

func (io *io) nextLine() string {
	var buffer []byte
	for {
		line, isPrefix, _ := io.reader.ReadLine()
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *io) nextString() string {
	for io.nextToken >= len(io.tokens) {
		line := io.nextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *io) nextInt() int {
	i, _ := strconv.Atoi(io.nextString())
	return i
}


Example test case(s):
input: 5
MASHIKE
RUMOI
OBIRA
HABORO
HOROKANAI

output: 2
Language: Go

package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	ar := make([]int, 3*n)
	for i := range ar {
		ar[i] = nextInt()
	}
	sort.Ints(ar)
	sum := 0
	for i := 0; i < n; i++ {
		sum += ar[3*n-(i+1)*2]
	}
	fmt.Println(sum)
}

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


Example test case(s):
input: 2
5 2 8 5 1 5

output: 10
Language: Go

package main

import (
	"fmt"
)

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

	fmt.Println(3 * a * a)
}


Example test case(s):
input: 4

output: 48
Language: Go

package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)
	for i := 0; i < len(s); i++ {
		fmt.Print("x")
	}
	fmt.Println("")
}


Example test case(s):
input: sardine

output: xxxxxxx
Language: Go

package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func reva(b []int) {
	for i := 0; i < len(b)/2; i++ {
		b[i], b[len(b)-1-i] = b[len(b)-1-i], b[i]
	}
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n := nextInt(sc)
	a := make([]int, n)
	for i := range a {
		a[i] = nextInt(sc)
	}
	q := nextInt(sc)
	for i := 0; i < q; i++ {
		b := nextInt(sc)
		e := nextInt(sc)
		reva(a[b:e])
	}
	wtr := bufio.NewWriter(os.Stdout)
	for i := 0; i < n; i++ {
		if i > 0 {
			fmt.Fprint(wtr, " ")
		}
		fmt.Fprint(wtr, a[i])
	}
	fmt.Fprintln(wtr)
	wtr.Flush()
}


Example test case(s):
input: 8
1 2 3 4 5 6 7 8
2
1 6
3 8

output: 1 6 5 8 7 2 3 4
Language: Go

package main

import "fmt"

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

	for i := 0; i < 3; i++ {
		if n[i] == '7' {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}


Example test case(s):
input: 117

output: Yes
Language: Go

package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

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

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

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

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

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

type shop struct {
	a, b int
}

type Datas []shop

func (p Datas) Len() int {
	return len(p)
}

func (p Datas) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Datas) Less(i, j int) bool {
	return p[i].a < p[j].a
}

func main() {
	sc.Split(bufio.ScanWords)

	N, M := getInt(), getInt()
	s := make(Datas, N)
	for i := 0; i < N; i++ {
		a, b := getInt(), getInt()
		s[i] = shop{a, b}
	}
	sort.Sort(s)

	total := 0
	for _, e := range s {
		n := min(e.b, M)
		total += n * e.a
		M -= n
		if M == 0 {
			break
		}
	}
	out(total)
}


Example test case(s):
input: 2 5
4 9
2 4

output: 12
Language: Go

package main

import (
	"fmt"
	"sort"
)

func main() {

	var n int
	fmt.Scan(&n)
	var ws works = make([]work, n)
	for i := 0; i < n; i++ {
		var a, n int
		fmt.Scan(&a, &n)
		ws[i] = work{a, n}
	}
	sort.Sort(ws)

	sum := int64(0)
	for _, w := range ws {
		sum += int64(w.time)
		if sum > int64(w.limit) {
			fmt.Println("No")
			return
		}
	}
	fmt.Println("Yes")
}

type work struct{ time, limit int }
type works []work

func (w works) Len() int           { return len(w) }
func (w works) Swap(i, j int)      { w[i], w[j] = w[j], w[i] }
func (w works) Less(i, j int) bool { return w[i].limit < w[j].limit }


Example test case(s):
input: 5
2 4
1 9
1 8
4 9
3 12

output: Yes
Language: Go

package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}
	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	m := getNextInt(scanner)
	seg := Segment{}
	seg.init(n)
	for i := 0; i < n; i++ {
		seg.maximize(i, getNextInt(scanner))
	}
	for i := 0; i < m; i++ {
		seg.maximize(seg.top(), seg.bucket[seg.h-1][0]>>1)
	}

	var ans int64
	for i := 0; i < n; i++ {
		ans += int64(seg.bucket[0][i])
	}

	fmt.Fprintln(writer, ans)
	writer.Flush()
}

type Segment struct {
	n, h, i, chunk int
	unit           []int
	bucket         [][]int
}

func (seg *Segment) init(n int) {
	seg.n = n
	seg.unit = make([]int, 1)
	seg.unit[0] = 1
	seg.bucket = make([][]int, 1)
	seg.bucket[0] = make([]int, n)

	chunk := 8
	for i := 0; n > 1; i++ {
		n = (n-1)/chunk + 1
		seg.bucket = append(seg.bucket, make([]int, n))
		seg.unit = append(seg.unit, seg.unit[i]*chunk)
	}
	seg.h = len(seg.unit)
	seg.chunk = chunk
}

func (seg *Segment) maximize(index, value int) {
	seg.bucket[0][index] = value
	for seg.i = 0; seg.i < seg.h-1; seg.i++ {
		s := index - index%seg.chunk
		t := s + seg.chunk
		if t > len(seg.bucket[seg.i]) {
			t = len(seg.bucket[seg.i])
		}
		parent := index / seg.chunk
		max := 0
		for i := s; i < t; i++ {
			if max < seg.bucket[seg.i][i] {
				max = seg.bucket[seg.i][i]
			}
		}
		seg.bucket[seg.i+1][parent] = max
		index /= seg.chunk
	}
}

func (seg *Segment) top() int {
	index := 0
	for seg.i = seg.h - 2; seg.i >= 0; seg.i-- {
		s := index * seg.chunk
		t := s + seg.chunk
		if t > len(seg.bucket[seg.i]) {
			t = len(seg.bucket[seg.i])
		}
		for i := s; i < t; i++ {
			if seg.bucket[seg.i][i] == seg.bucket[seg.i+1][index] {
				index = i
				break
			}
		}
	}

	return index
}


Example test case(s):
input: 3 3
2 13 8

output: 9
Language: Go

package main

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

func main() {
	S, T := ReadString(), ReadString()
	max := 0
	for i := 0; i <= len(S)-len(T); i++ {
		c := 0
		for j := 0; j < len(T); j++ {
			if S[i+j] == T[j] {
				c++
			}
		}
		if max < c {
			max = c
		}
	}
	fmt.Println(len(T) - max)
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Example test case(s):
input: cabacc
abc

output: 1
Language: Go

package main

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

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

	dd := strings.Split(ds, " ")
	dn := make([]int, len(dd))
	for i, d := range dd {
		dn[i], _ = strconv.Atoi(d)
	}

	sum := 0
	for i := 0; i < len(dn); i++ {
		for j := i + 1; j < len(dn); j++ {
			sum += dn[i] * dn[j]
		}
	}

	fmt.Println(sum)
}


Example test case(s):
input: 3
3 1 2

output: 11
Language: Go

package main

import "fmt"

func main() {
	const MX = 10000
	sieve := make([]int, MX)
	primes := make([]int, 0, MX)
	for i := 2; i < MX; i++ {
		if sieve[i] != 0 {
			continue
		}
		primes = append(primes, i)
		for j := i + i; j < MX; j += i {
			sieve[j] = i
		}
	}

	var n int
	fmt.Scan(&n)
	ans := 0
	for i := 0; i < n; i++ {
		var x int
		fmt.Scan(&x)
		ans++
		for j := 0; j < len(primes); j++ {
			if x > primes[j] && x%primes[j] == 0 {
				ans--
				break
			}
		}
	}
	fmt.Println(ans)
}


Example test case(s):
input: 5
2
3
4
5
6

output: 3
Language: Go

package main

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

func main() {
	log.SetFlags(log.Lshortfile)
	sc := newScanner()
	x := sc.nextInt()
	y := sc.nextInt()
	var xt, yt int
	a := [3][]int{{1, 3, 5, 7, 8, 10, 12}, {4, 6, 9, 11}, {2}}
	for i, t := range a {
		for _, n := range t {

			if x == n {
				xt = i
			}
			if y == n {
				yt = i
			}
		}
	}
	if xt == yt {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

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

type scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func newScanner() *scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &scanner{r: rdr}
}
func (s *scanner) 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 *scanner) nextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *scanner) nextInt() int {
	v, _ := strconv.Atoi(s.next())
	return v
}

func (s *scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Example test case(s):
input: 1 3

output: Yes
Language: Go

package main

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

func main() {
	sc := NewScanner()
	H, W, N := sc.NextInt(), sc.NextInt(), sc.NextInt()

	A := max(H, W)

	fmt.Println((N + A - 1) / A)

}

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

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) 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 *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Example test case(s):
input: 3
7
10

output: 2
Language: Go

package main

import "fmt"

var N, K int
var d, a int

func main() {
	fmt.Scan(&N, &K)
	as := make(map[int]int)
	for i := 1; i <= N; i++ {
		as[i] = 0
	}
	for i := 0; i < K; i++ {
		fmt.Scan(&d)
		for j := 0; j < d; j++ {
			fmt.Scan(&a)
			as[a]++
		}
	}
	ans := 0
	for _, v := range as {
		if v == 0 {
			ans++
		}
	}
	fmt.Println(ans)
}


Example test case(s):
input: 3 2
2
1 3
1
3

output: 1
Language: Go

package main

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

type bufReader struct {
	r   *bufio.Reader
	buf []byte
	i   int
}

var reader = &bufReader{
	bufio.NewReader(os.Stdin),
	make([]byte, 0),
	0,
}

func (r *bufReader) readLine() {
	if r.i < len(r.buf) {
		return
	}
	r.buf = make([]byte, 0)
	r.i = 0
	for {
		line, isPrefix, err := r.r.ReadLine()
		if err != nil {
			panic(err)
		}
		r.buf = append(r.buf, line...)
		if !isPrefix {
			break
		}
	}
}

func (r *bufReader) next() string {
	r.readLine()
	from := r.i
	for ; r.i < len(r.buf); r.i++ {
		if r.buf[r.i] == ' ' {
			break
		}
	}
	s := string(r.buf[from:r.i])
	r.i++
	return s
}

func (r *bufReader) nextLine() string {
	r.readLine()
	s := string(r.buf[r.i:])
	r.i = len(r.buf)
	return s
}

var writer = bufio.NewWriter(os.Stdout)

func next() string {
	return reader.next()
}

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

func nextLine() string {
	return reader.nextLine()
}

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

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

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

func joinInts(a []int64, sep string) string {
	b := make([]string, len(a))
	for i, v := range a {
		b[i] = strconv.FormatInt(v, 10)
	}
	return strings.Join(b, sep)
}

func divUp(x, y int64) int64 {
	return (x + y - 1) / y
}

func main() {
	solve()
	writer.Flush()
}

func solve() {
	N := nextInt()
	T, A := make([]int64, N), make([]int64, N)
	for i := 0; i < int(N); i++ {
		T[i], A[i] = nextInt(), nextInt()
	}
	t, a := T[0], A[0]
	for i := 1; i < int(N); i++ {
		r := max(divUp(t, T[i]), divUp(a, A[i]))
		t, a = T[i]*r, A[i]*r
	}
	out(t + a)
}


Example test case(s):
input: 3
2 3
1 1
3 2

output: 10
Language: Go

package main

import "fmt"

func main() {
	var x, y int
	fmt.Scan(&x, &y)

	fmt.Println(x + y/2)
}


Example test case(s):
input: 81 58

output: 110
Language: Go

package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
		if len(os.Args) > 2 {
			wfp, _ = os.Create(os.Args[2])
		}
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	n := getNextInt(scanner)

	ans := "second"
	for i := 0; i < n; i++ {
		a := getNextInt(scanner)
		if a%2 == 1 {
			ans = "first"
			break
		}
	}
	fmt.Fprintln(writer, ans)
	writer.Flush()
}


Example test case(s):
input: 2
1
2

output: first
Language: Go

package main

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

func main() {
	R := nextInt()
	G := nextInt()
	B := nextInt()
	N := nextInt()

	var ans int
	for x := 0; x <= N; x++ {
		for y := 0; y <= N; y++ {
			tmp := N - R*x - G*y
			if tmp >= 0 && tmp%B == 0 {
				ans++
			}
		}
	}

	fmt.Println(ans)
}

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}

	return i
}

func nextFloat() float64 {
	sc.Scan()
	f64, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}

	return f64
}

func nextString() string {
	sc.Scan()
	if err := sc.Err(); err != nil {
		panic(err)
	}

	return sc.Text()
}

func abs(x int) int {
	return int(math.Abs(float64(x)))
}

func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}


Example test case(s):
input: 1 2 3 4

output: 4
Language: Go

package main

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

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

	d := 'a' - 'A'
	for _, r := range s {
		rr := r
		if 'A' <= r && r <= 'Z' {
			rr = r + d
		} else if 'a' <= r && r <= 'z' {
			rr = r - d
		}
		fmt.Printf("%c", rr)
	}
	fmt.Println()
}


Example test case(s):
input: fAIR, LATER, OCCASIONALLY CLOUDY.

output: Fair, later, occasionally cloudy.
Language: Go

package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

type Node struct {
	to []int
}

func main() {
	sc.Split(bufio.ScanWords)

	N, M := getInt(), getInt()
	n := make([]Node, N)
	for i := 0; i < M; i++ {
		from, to := getInt()-1, getInt()-1
		n[from].to = append(n[from].to, to)
		n[to].to = append(n[to].to, from)
	}

	for i := 0; i < N; i++ {
		out(len(n[i].to))
	}

}


Example test case(s):
input: 4 3
1 2
2 3
1 4

output: 2
2
1
1
Language: Go

package main

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

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func readFloat64() float64 {
	sc.Scan()
	f, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

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

func main() {
	sc.Split(bufio.ScanWords)
	n, m := readInt(), readInt()
	a := make([]int, n)
	sum := 0
	for i := 0; i < m; i++ {
		a[i] = readInt()
		sum += a[i]
	}
	if sum > n {
		fmt.Println("-1")
		return
	}

	fmt.Println(n - sum)
}


Example test case(s):
input: 41 2
5 6

output: 30
Language: Go

package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)

	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)

	aa := make([]int, n+2)
	sum := 0
	for i := 0; i < n; i++ {
		aa[i+1] = getNextInt(scanner)
		sum += absint(aa[i+1] - aa[i])
	}
	sum += absint(aa[n+1] - aa[n])

	for i := 1; i < n+1; i++ {
		ans := sum - absint(aa[i+1]-aa[i]) - absint(aa[i]-aa[i-1]) + absint(aa[i+1]-aa[i-1])
		fmt.Fprintln(writer, ans)
	}

	writer.Flush()
}

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


Example test case(s):
input: 3
3 5 -1

output: 12
8
10
Language: Python

s = list(input())
mods = [0]*(len(s))
countRemainder = [0] * 2019
cnt = 0


m = 1
mod = 0
for i in range(len(s)):
    mod += int(s[len(s) - i - 1]) * m

    mod %= 2019
    m *= 10
    m %= 2019

    countRemainder[mod] += 1

countRemainder[0] += 1

for i in range(2019):
    cnt += int(countRemainder[i] * (countRemainder[i] - 1) / 2)

print(cnt)


Example test case(s):
input: 1817181712114

output: 3
Language: Python

A, B = input().split()
A = int(A)
B = int(B.replace(".", ""))
print(A * B // 100)


Example test case(s):
input: 198 1.10

output: 217
Language: Python

a = int(input())


def func(a):
    digits = []
    temp = a
    while temp != 0:
        digits.append(temp % 10)
        temp = int(temp/10)
    result = sum(digits)
    if result == 1:
        print('10')
    else:
        print(result)


func(a)


Example test case(s):
input: 15

output: 6
Language: Python

import collections
N = int(input())
a = list(map(int, input().split()))
B = collections.Counter(a)
k = list(B.keys())
v = list(B.values())

if len(B) == 3 and k[0] ^ k[1] ^ k[2] == 0 and v[0] == v[1] == v[2]:
    print("Yes")
elif len(B) == 2 and 0 in k and (v[0] == 2*v[1] or v[1] == 2*v[0]):
    print("Yes")
elif len(B) == 1 and 0 in k:
    print("Yes")
else:
    print("No")


Example test case(s):
input: 3
1 2 3

output: Yes
Language: Python

n = int(input())
t = list(map(int, input().split()))
m = int(input())
for i in range(m):
    p, x = map(int, input().split())
    s = 0
    for j in range(len(t)):
        if j == p-1:
            s += x
        else:
            s += t[j]
    print(s)


Example test case(s):
input: 3
2 1 4
2
1 1
2 3

output: 6
9
Language: Python

a, b = map(int, input().split())

if a <= b:
    print(a)
else:
    print(a-1)


Example test case(s):
input: 5 5

output: 5
Language: Python

N, R = map(int, input().split())
if N >= 10:
    print(R)
else:
    print(R+100*(10-N))


Example test case(s):
input: 2 2919

output: 3719
Language: Python

N, M = map(int, input().split())
*A, = map(int, input().split())
A = sorted(A)

while M:
    A[-1] //= 2
    M -= 1
    i = -2
    while M and (-N <= i and A[i] >= A[-1]):
        A[i] //= 2
        M -= 1
        i -= 1
    A.sort()

print(sum(A))


Example test case(s):
input: 3 3
2 13 8

output: 9