← Home
For problem statement at 1000-1999/1100-1199/1100-1109/1103/problemC.txt this is a correct solution, but verifier at 1000-1999/1100-1199/1100-1109/1103/verifierC.go ends with REFERENCE_SOURCE_PATH not set
exit status 1 can you fix the verifier? ```go
package main

import (
	"bytes"
	"io"
	"os"
	"strconv"
)

func main() {
	buf, _ := io.ReadAll(os.Stdin)
	var pos int
	nextInt := func() int {
		for pos < len(buf) && buf[pos] <= ' ' {
			pos++
		}
		if pos >= len(buf) {
			return 0
		}
		res := 0
		for pos < len(buf) && buf[pos] > ' ' {
			res = res*10 + int(buf[pos]-'0')
			pos++
		}
		return res
	}

	n := nextInt()
	if n == 0 {
		return
	}
	m := nextInt()
	k := nextInt()

	adj := make([][]int, n+1)
	for i := 0; i < m; i++ {
		u := nextInt()
		v := nextInt()
		adj[u] = append(adj[u], v)
		adj[v] = append(adj[v], u)
	}

	depth := make([]int, n+1)
	parent := make([]int, n+1)
	isLeaf := make([]bool, n+1)
	for i := 1; i <= n; i++ {
		isLeaf[i] = true
	}

	var dfs func(int, int, int)
	dfs = func(u, p, d int) {
		depth[u] = d
		parent[u] = p
		for _, v := range adj[u] {
			if depth[v] == 0 {
				isLeaf[u] = false
				dfs(v, u, d+1)
			}
		}
	}
	dfs(1, 0, 1)

	maxDepth := 0
	maxNode := 0
	for i := 1; i <= n; i++ {
		if depth[i] > maxDepth {
			maxDepth = depth[i]
			maxNode = i
		}
	}

	target := (n + k - 1) / k

	var out bytes.Buffer

	if maxDepth >= target {
		out.WriteString("PATH\n")
		out.WriteString(strconv.Itoa(maxDepth) + "\n")
		curr := maxNode
		for curr != 0 {
			out.WriteString(strconv.Itoa(curr))
			if parent[curr] != 0 {
				out.WriteByte(' ')
			}
			curr = parent[curr]
		}
		out.WriteByte('\n')
	} else {
		out.WriteString("CYCLES\n")
		cyclesFound := 0
		for i := 1; i <= n; i++ {
			if isLeaf[i] {
				u := i
				x, y := 0, 0
				count := 0
				for _, v := range adj[u] {
					if v != parent[u] {
						if count == 0 {
							x = v
							count++
						} else if count == 1 {
							y = v
							count++
							break
						}
					}
				}

				if depth[x] < depth[y] {
					x, y = y, x
				}

				L1 := depth[u] - depth[x] + 1
				L2 := depth[u] - depth[y] + 1

				var cycle []int
				if L1%3 != 0 {
					curr := u
					for {
						cycle = append(cycle, curr)
						if curr == x {
							break
						}
						curr = parent[curr]
					}
				} else if L2%3 != 0 {
					curr := u
					for {
						cycle = append(cycle, curr)
						if curr == y {
							break
						}
						curr = parent[curr]
					}
				} else {
					cycle = append(cycle, u)
					curr := x
					for {
						cycle = append(cycle, curr)
						if curr == y {
							break
						}
						curr = parent[curr]
					}
				}

				out.WriteString(strconv.Itoa(len(cycle)) + "\n")
				for j, v := range cycle {
					out.WriteString(strconv.Itoa(v))
					if j < len(cycle)-1 {
						out.WriteByte(' ')
					}
				}
				out.WriteByte('\n')

				cyclesFound++
				if cyclesFound == k {
					break
				}
			}
		}
	}

	os.Stdout.Write(out.Bytes())
}
```