package main import ( "fmt" "os" "strconv" "strings" ) func is_invalid(id int) bool { idstr := strconv.Itoa(id) size_idstr := len(idstr) if (size_idstr % 2) != 0 { return false } return idstr[:size_idstr/2] == idstr[size_idstr/2:] } func count_invalids(lb, ub int) int{ res := 0 for i:=lb; i <= ub; i++ { if is_invalid(i) { res += i } } return res } func main() { fmt.Println("Advent of Code 2025 - Day 2 - Part 1") f, _ := os.ReadFile("2/input") l := strings.Split(string(f), ",") var ranges []string var lower_bound, upper_bound int res:=0 for _,value := range l { ranges = strings.Split(value,"-") lower_bound, _ = strconv.Atoi(ranges[0]) upper_bound, _ = strconv.Atoi(ranges[1]) res += count_invalids(lower_bound, upper_bound) } fmt.Println(res) }