← Home
For problem statement at 0-999/500-599/590-599/592/problemE.txt this is a correct solution, but verifier at 0-999/500-599/590-599/592/verifierE.go ends with All tests passed can you fix the verifier? ```go
package main

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

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

func abs(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

type Point struct {
	x, y int64
}

func half(p Point) int {
	if p.y > 0 || (p.y == 0 && p.x > 0) {
		return 0
	}
	return 1
}

func cross(p1, p2 Point) int64 {
	return p1.x*p2.y - p1.y*p2.x
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n, c, d int64
	if _, err := fmt.Fscan(reader, &n, &c, &d); err != nil {
		return
	}

	counts := make(map[Point]int64)
	for i := int64(0); i < n; i++ {
		var r, w int64
		fmt.Fscan(reader, &r, &w)
		x := r - c
		y := w - d
		g := gcd(abs(x), abs(y))
		if g > 0 {
			x /= g
			y /= g
		}
		counts[Point{x, y}]++
	}

	var pts []Point
	for p := range counts {
		pts = append(pts, p)
	}

	sort.Slice(pts, func(i, j int) bool {
		h1 := half(pts[i])
		h2 := half(pts[j])
		if h1 != h2 {
			return h1 < h2
		}
		return cross(pts[i], pts[j]) > 0
	})

	M := len(pts)
	C := make([]int64, M)
	for i := 0; i < M; i++ {
		C[i] = counts[pts[i]]
	}

	pts = append(pts, pts...)
	C = append(C, C...)

	var strictlyHalfPlane int64 = 0
	right := 0
	var sumC, sumSq int64 = 0, 0

	for i := 0; i < M; i++ {
		if right <= i {
			right = i + 1
			sumC = 0
			sumSq = 0
		}
		for right < i+M && cross(pts[i], pts[right]) > 0 {
			sumC += C[right]
			sumSq += C[right] * C[right]
			right++
		}

		pairs := (sumC*sumC - sumSq) / 2
		strictlyHalfPlane += C[i] * pairs

		if right > i+1 {
			sumC -= C[i+1]
			sumSq -= C[i+1] * C[i+1]
		}
	}

	var opp3 int64 = 0
	for p, count := range counts {
		oppP := Point{-p.x, -p.y}
		if oppCount, exists := counts[oppP]; exists {
			opp3 += count * oppCount * (n - count - oppCount)
		}
	}
	opp3 /= 2

	var p2, p3 int64 = 0, 0
	for _, count := range counts {
		p2 += count * count
		p3 += count * count * count
	}

	total3 := (n*n*n - 3*n*p2 + 2*p3) / 6
	good := total3 - strictlyHalfPlane - opp3

	fmt.Println(good)
}
```