← Home
For problem statement at 1000-1999/1800-1899/1850-1859/1859/problemB.txt this is a correct solution, but verifier at 1000-1999/1800-1899/1850-1859/1859/verifierB.go ends with All tests passed can you fix the verifier? ```go
package main

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

type FastScanner struct {
	data []byte
	idx  int
	n    int
}

func (fs *FastScanner) nextInt() int {
	for fs.idx < fs.n && (fs.data[fs.idx] < '0' || fs.data[fs.idx] > '9') {
		fs.idx++
	}
	val := 0
	for fs.idx < fs.n && fs.data[fs.idx] >= '0' && fs.data[fs.idx] <= '9' {
		val = val*10 + int(fs.data[fs.idx]-'0')
		fs.idx++
	}
	return val
}

func main() {
	data, _ := io.ReadAll(os.Stdin)
	fs := FastScanner{data: data, n: len(data)}

	t := fs.nextInt()
	var out bytes.Buffer

	const inf int64 = 1 << 62

	for ; t > 0; t-- {
		n := fs.nextInt()
		globalMin := inf
		minSecond := inf
		var sumSecond int64

		for i := 0; i < n; i++ {
			m := fs.nextInt()
			mn1, mn2 := inf, inf
			for j := 0; j < m; j++ {
				x := int64(fs.nextInt())
				if x < mn1 {
					mn2 = mn1
					mn1 = x
				} else if x < mn2 {
					mn2 = x
				}
			}
			if mn1 < globalMin {
				globalMin = mn1
			}
			if mn2 < minSecond {
				minSecond = mn2
			}
			sumSecond += mn2
		}

		ans := globalMin + sumSecond - minSecond
		out.WriteString(strconv.FormatInt(ans, 10))
		out.WriteByte('\n')
	}

	w := bufio.NewWriterSize(os.Stdout, 1<<20)
	w.Write(out.Bytes())
	w.Flush()
}
```