← Home
For problem statement at 0-999/400-499/470-479/475/problemD.txt this is a correct solution, but verifier at 0-999/400-499/470-479/475/verifierD.go ends with oracle failure on case 1: runtime error: fork/exec .//home/ubuntu/codeforces/0-999/400-499/470-479/475/oracleD: no such file or directory

input:
7
41 20 17 91 47 36 50
1
79
exit status 1 can you fix the verifier? ```go
package main

import (
	"bufio"
	"os"
)

type pair struct {
	g int
	c int64
}

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	readInt := func() int {
		var n int
		c, err := in.ReadByte()
		for err == nil && c <= ' ' {
			c, err = in.ReadByte()
		}
		if err != nil {
			return 0
		}
		for err == nil && c > ' ' {
			n = n*10 + int(c-'0')
			c, err = in.ReadByte()
		}
		return n
	}

	n := readInt()
	if n == 0 {
		return
	}

	ans := make(map[int]int64)
	var current []pair

	for i := 0; i < n; i++ {
		x := readInt()
		next := make([]pair, 0, len(current)+1)
		next = append(next, pair{x, 1})
		for _, p := range current {
			next = append(next, pair{gcd(p.g, x), p.c})
		}

		current = current[:0]
		for _, p := range next {
			if len(current) > 0 && current[len(current)-1].g == p.g {
				current[len(current)-1].c += p.c
			} else {
				current = append(current, p)
			}
		}

		for _, p := range current {
			ans[p.g] += p.c
		}
	}

	q := readInt()
	for i := 0; i < q; i++ {
		x := readInt()
		v := ans[x]
		if v == 0 {
			out.WriteByte('0')
			out.WriteByte('\n')
		} else {
			var buf [20]byte
			idx := 19
			for v > 0 {
				buf[idx] = byte(v%10) + '0'
				v /= 10
				idx--
			}
			out.Write(buf[idx+1:])
			out.WriteByte('\n')
		}
	}
}
```