← Home
For problem statement at 0-999/0-99/50-59/52/problemB.txt this is a correct solution, but verifier at 0-999/0-99/50-59/52/verifierB.go ends with All tests passed can you fix the verifier? ```go
package main

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

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

	var n, m int
	fmt.Fscan(reader, &n, &m)

	grid := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(reader, &grid[i])
	}

	// rowCount[i] = number of '*' in row i
	rowCount := make([]int64, n)
	// colCount[j] = number of '*' in col j
	colCount := make([]int64, m)

	for i := 0; i < n; i++ {
		for j := 0; j < m; j++ {
			if grid[i][j] == '*' {
				rowCount[i]++
				colCount[j]++
			}
		}
	}

	// For each '*' at (i,j), it can be the right angle vertex.
	// The number of triangles with right angle at (i,j) is:
	// (rowCount[i] - 1) * (colCount[j] - 1)
	var total int64
	for i := 0; i < n; i++ {
		for j := 0; j < m; j++ {
			if grid[i][j] == '*' {
				total += (rowCount[i] - 1) * (colCount[j] - 1)
			}
		}
	}

	fmt.Fprintln(writer, total)
}
```