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

import (
	"bufio"
	"fmt"
	"os"
	"strings"
	"unicode"
)

func tokenize(s string) []string {
	var tokens []string
	var current strings.Builder
	for _, r := range s {
		if unicode.IsSpace(r) {
			if current.Len() > 0 {
				tokens = append(tokens, current.String())
				current.Reset()
			}
		} else if strings.ContainsRune("+-*/()#", r) {
			if current.Len() > 0 {
				tokens = append(tokens, current.String())
				current.Reset()
			}
			tokens = append(tokens, string(r))
		} else {
			current.WriteRune(r)
		}
	}
	if current.Len() > 0 {
		tokens = append(tokens, current.String())
	}
	return tokens
}

type Macro struct {
	name    string
	tokens  []string
	has_add bool
	has_mul bool
}

type State struct {
	name string
	L    string
	R    string
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var lines []string
	for scanner.Scan() {
		line := strings.TrimSpace(scanner.Text())
		if line != "" {
			lines = append(lines, line)
		}
	}

	if len(lines) == 0 {
		return
	}

	var n int
	fmt.Sscanf(lines[0], "%d", &n)

	macros := make(map[string]Macro)
	lineIdx := 1

	for i := 0; i < n; i++ {
		if lineIdx >= len(lines) {
			break
		}
		toks := tokenize(lines[lineIdx])
		lineIdx++
		
		if len(toks) < 3 {
			i--
			continue
		}
		
		name := toks[2]
		expr := toks[3:]

		parenDepth := 0
		hasAdd := false
		hasMul := false
		for _, t := range expr {
			if t == "(" {
				parenDepth++
			} else if t == ")" {
				parenDepth--
			} else if parenDepth == 0 {
				if t == "+" || t == "-" {
					hasAdd = true
				} else if t == "*" || t == "/" {
					hasMul = true
				}
			}
		}

		macros[name] = Macro{
			name:    name,
			tokens:  expr,
			has_add: hasAdd,
			has_mul: hasMul,
		}
	}

	if lineIdx >= len(lines) {
		return
	}
	finalToks := tokenize(lines[lineIdx])

	memo := make(map[State]bool)

	var check func(name, L, R string) bool
	check = func(name, L, R string) bool {
		state := State{name, L, R}
		if res, ok := memo[state]; ok {
			return res
		}

		var toks []string
		if name == "__FINAL__" {
			toks = finalToks
		} else {
			mac := macros[name]
			if mac.has_add && (L == "*" || L == "/" || L == "-" || R == "*" || R == "/") {
				memo[state] = true
				return true
			}
			if mac.has_mul && L == "/" {
				memo[state] = true
				return true
			}
			toks = mac.tokens
		}

		for i, t := range toks {
			if _, isMac := macros[t]; isMac {
				leftContext := L
				if i > 0 {
					leftContext = toks[i-1]
				}
				rightContext := R
				if i < len(toks)-1 {
					rightContext = toks[i+1]
				}
				if check(t, leftContext, rightContext) {
					memo[state] = true
					return true
				}
			}
		}

		memo[state] = false
		return false
	}

	if check("__FINAL__", "", "") {
		fmt.Println("Suspicious")
	} else {
		fmt.Println("OK")
	}
}
```