package day04 import ( "math" "regexp" "strings" "fmt" "adventofcode2023/utils" mapset "github.com/deckarep/golang-set/v2" ) type Game struct { ID int matches int count int winners mapset.Set[int] cards mapset.Set[int] } func Part1(input string) int { games, err := parseGames(input) if err != nil { fmt.Println("Error:", err) return -1 } points := 0.0 for _, game := range games { matches := len(game.cards.Intersect(game.winners).ToSlice()) if matches > 0 { points += math.Pow(2, float64(matches - 1)) } } return int(points) } func Part2(input string) int { games, err := parseGames(input) if err != nil { fmt.Println("Error:", err) return -1 } for i, game := range games { matches := game.cards.Intersect(game.winners).ToSlice() games[i].matches = len(matches) games[i].count = 1 } for i:=0;i