For problem statement at 1000-1999/1500-1599/1570-1579/1579/problemD.txt this is a correct solution, but verifier at 1000-1999/1500-1599/1570-1579/1579/verifierD.go ends with All tests passed can you fix the verifier? ```go
package main
import (
"bufio"
"fmt"
"os"
)
type MaxHeap struct {
id []int
val []int
}
func (h *MaxHeap) Len() int { return len(h.id) }
func (h *MaxHeap) less(i, j int) bool {
if h.val[i] != h.val[j] {
return h.val[i] > h.val[j]
}
return h.id[i] < h.id[j]
}
func (h *MaxHeap) swap(i, j int) {
h.id[i], h.id[j] = h.id[j], h.id[i]
h.val[i], h.val[j] = h.val[j], h.val[i]
}
func (h *MaxHeap) up(i int) {
for i > 0 {
p := (i - 1) / 2
if !h.less(i, p) {
break
}
h.swap(i, p)
i = p
}
}
func (h *MaxHeap) down(i int) {
n := h.Len()
for {
l := i*2 + 1
if l >= n {
break
}
best := l
r := l + 1
if r < n && h.less(r, l) {
best = r
}
if !h.less(best, i) {
break
}
h.swap(i, best)
i = best
}
}
func (h *MaxHeap) Push(id, val int) {
h.id = append(h.id, id)
h.val = append(h.val, val)
h.up(h.Len() - 1)
}
func (h *MaxHeap) Pop() (id, val int) {
n := h.Len()
id, val = h.id[0], h.val[0]
last := n - 1
h.id[0], h.val[0] = h.id[last], h.val[last]
h.id = h.id[:last]
h.val = h.val[:last]
if h.Len() > 0 {
h.down(0)
}
return
}
type Pair struct{ i, j int }
func main() {
in := bufio.NewReaderSize(os.Stdin, 1<<20)
out := bufio.NewWriterSize(os.Stdout, 1<<20)
defer out.Flush()
var t int
fmt.Fscan(in, &t)
for ; t > 0; t-- {
var n int
fmt.Fscan(in, &n)
h := &MaxHeap{}
for i := 1; i <= n; i++ {
var a int
fmt.Fscan(in, &a)
if a > 0 {
h.Push(i, a)
}
}
res := make([]Pair, 0)
for h.Len() >= 2 {
i1, v1 := h.Pop()
i2, v2 := h.Pop()
res = append(res, Pair{i1, i2})
v1--
v2--
if v1 > 0 {
h.Push(i1, v1)
}
if v2 > 0 {
h.Push(i2, v2)
}
}
fmt.Fprintln(out, len(res))
for _, p := range res {
fmt.Fprintln(out, p.i, p.j)
}
}
}
```