For problem statement at 1000-1999/1900-1999/1950-1959/1951/problemB.txt this is a correct solution, but verifier at 1000-1999/1900-1999/1950-1959/1951/verifierB.go ends with All 100 tests passed can you fix the verifier? package main
import (
"bytes"
"io"
"os"
"strconv"
)
func main() {
data, _ := io.ReadAll(os.Stdin)
idx := 0
nextInt := func() int {
for idx < len(data) && data[idx] <= ' ' {
idx++
}
val := 0
for idx < len(data) && data[idx] > ' ' {
val = val*10 + int(data[idx]-'0')
idx++
}
return val
}
t := nextInt()
var out bytes.Buffer
for tc := 0; tc < t; tc++ {
n := nextInt()
k := nextInt()
a := make([]int, n+1)
for i := 1; i <= n; i++ {
a[i] = nextInt()
}
x := a[k]
p1, p2 := n+1, n+1
for i := 1; i <= n; i++ {
if a[i] > x {
if p1 == n+1 {
p1 = i
} else {
p2 = i
break
}
}
}
ans := 0
if p1 == 1 {
q := p2
if k < q {
q = k
}
ans = q - 2
} else {
ans = p1 - 2
if p1 < k {
q := p2
if k < q {
q = k
}
cand := q - p1
if cand > ans {
ans = cand
}
}
}
if ans < 0 {
ans = 0
}
out.WriteString(strconv.Itoa(ans))
if tc+1 < t {
out.WriteByte('\n')
}
}
os.Stdout.Write(out.Bytes())
}