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

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	// Read n (though we just loop n times, we need to consume the token)
	if scanner.Scan() {
		// n is read here but used primarily to define loop count logic if needed,
		// or we can just rely on the count given. 
		// We parse it to integer to loop exactly n times.
		n, _ := strconv.Atoi(scanner.Text())

		var ans int64 = 0
		var prev int64 = 0

		for i := 0; i < n; i++ {
			scanner.Scan()
			curr, _ := strconv.ParseInt(scanner.Text(), 10, 64)

			diff := curr - prev
			if diff < 0 {
				ans -= diff
			} else {
				ans += diff
			}

			prev = curr
		}

		fmt.Println(ans)
	}
}
```