Compare commits

...

42 Commits

Author SHA1 Message Date
810b3b945a Non-working, archival purpose 2023-12-08 23:46:47 +01:00
ab1ca11011 Updated README.md 2023-12-08 13:14:18 +00:00
8b15f34960 Working day07, huge mess 2023-12-08 13:12:41 +00:00
dc2cb20d36 Working part 1, I forgot to properly sort an array 2023-12-08 07:57:17 +01:00
0cdc898118 Added debug prints 2023-12-08 01:00:01 +01:00
31cc223170 Removed one bug, many to go 2023-12-08 00:39:40 +01:00
be248b81a0 Non-working prototype 2023-12-08 00:33:30 +01:00
e14b5277fa WIP: every type of hand has its array 2023-12-07 22:10:27 +01:00
4ca1366d87 Initial commit for day 7 2023-12-07 14:16:41 +00:00
752a4cdde1 Updated README.md 2023-12-07 13:58:44 +00:00
61a5da832e Working d6p2, multithreaded 2023-12-07 10:32:55 +00:00
895dc50813 Working day6 part1 2023-12-07 00:30:24 +01:00
7932dc6a5c First draft of day 6 2023-12-06 22:52:25 +01:00
b713c68be9 Unoptimized and unhinged d5p2, parallel bruteforce 2023-12-06 22:05:18 +01:00
77f0c659d3 Working d5p1, but I don't know what my code does 2023-12-06 20:00:08 +01:00
96dfe53951 Implemented function to gather the different items 2023-12-06 16:43:03 +00:00
1c7bdb3486 Early draft of day 5, archival 2023-12-05 23:20:45 +01:00
64f57a7d3a Merge branch 'day03' 2023-12-05 20:16:07 +01:00
50aa50c83d Working version of d3p2, code needs refactoring 2023-12-05 20:13:44 +01:00
f5b884d374 Non-working code, archival purpose 2023-12-04 23:54:13 +01:00
54196d6f05 Fix refactoring causing errors during compiling 2023-12-04 21:49:35 +01:00
4fcd19158e Merge branch 'day03' 2023-12-04 16:02:56 +00:00
c237b25d84 Starting to refactor day03 2023-12-04 15:29:27 +00:00
0893ba08e0 Updated README.md 2023-12-04 13:55:43 +00:00
52fd824390 Merge branch 'day04' 2023-12-04 13:54:03 +00:00
506faccd6a Merge branch 'day03' 2023-12-04 13:53:56 +00:00
4a20d4ac12 Optimized my code by 140300% just by doing things correctly 2023-12-04 13:49:18 +00:00
46f1dddeb1 First draft of working part two, heavily unoptimized 2023-12-04 13:34:48 +00:00
9315824a04 Working first part of day04 2023-12-04 09:57:37 +00:00
5076013fc4 Merge branch 'day03' into day04 2023-12-04 08:49:24 +00:00
4e86c2e0a7 Merge branch 'change-inputs-folder' into day04 2023-12-04 08:44:37 +00:00
4d34f508d5 The worst code I've ever written, but somehow it works 2023-12-03 21:35:05 +01:00
eceddf1284 Working code, terrible code, debug prints 2023-12-03 21:33:46 +01:00
858c57647f Merge remote-tracking branch 'gitea/change-inputs-folder' 2023-12-03 18:53:33 +01:00
5f2c093e72 WIP of new approach 2023-12-03 16:52:32 +00:00
99db2b88a2 Scrapping the current approach. Archival purpose 2023-12-03 16:10:23 +00:00
bacc1855ab Initial draft of day03, non-working, archival purpose 2023-12-03 13:24:33 +00:00
7467fb2fba Merge branch 'change-inputs-folder' into day03 2023-12-03 08:08:16 +00:00
df779eb510 Fixed a small oversight in folder structure
All checks were successful
Build / gobuild (push) Successful in 1m27s
2023-12-02 16:59:44 +00:00
79f63b0bf0 Truying to do something really silly with symlinks
Some checks failed
Build / gobuild (push) Failing after 1m22s
2023-12-02 16:56:35 +00:00
492d2a602a Trying to run the code for day01
Some checks failed
Build / gobuild (push) Failing after 51s
2023-12-02 16:50:46 +00:00
fc9a332e63 Changed folder structure 2023-12-02 16:49:56 +00:00
31 changed files with 2727 additions and 2 deletions

View File

@ -17,6 +17,8 @@ jobs:
run: go build -v ./day01/*.go
- name: Build day two
run: go build -v ./day02/*.go
- name: Run day one
run: go run -v ./day01/*.go
- name: Display Go version
run: go version
- name: List files in the repository

View File

@ -4,5 +4,11 @@ An attempt to start programming again.
- [Day 1](./day01/trebuchet.go)
- [Day 2](./day02/lottacubes.go)
- [Day 3](./day03/engine-schema.go)
- [Day 4](./day04/scratchcards.go)
- [Day 5](./day05/seeds.go)
- [Day 6](./day06/race.go)
- [Day 7](./day07/cards.go)
This repo gets automatically mirrored to [Github](https://github.com/Doddophonique/aoc2023).

1
day01/inputs Symbolic link
View File

@ -0,0 +1 @@
../inputs

View File

@ -109,7 +109,7 @@ func CombineIndexes(s string) int {
}
func main() {
file, err := os.Open("input")
file, err := os.Open("./inputs/day01_input")
check(err)
defer file.Close()

1
day02/inputs Symbolic link
View File

@ -0,0 +1 @@
../inputs

View File

@ -140,7 +140,7 @@ func PrintAndWait[T any](x T) {
}
func main() {
file, err := os.Open("input")
file, err := os.Open("./inputs/day02_input")
check(err)
defer file.Close()

220
day03/engine-schema.go Normal file
View File

@ -0,0 +1,220 @@
package main
import (
"fmt"
// "strings"
"bufio"
"os"
"regexp"
"strconv"
)
func check(e error) {
if e != nil {
panic(e)
}
}
func PrintAndWait(x ...any) {
fmt.Print(x)
fmt.Scanln()
}
func MatchNumbers(lines []string, index int, ast []int, total *int) {
// Regex that finds the numbers in a row
renum := regexp.MustCompile("[0-9]+")
// Gather numbers in prev line
prevLine := renum.FindAllStringIndex(lines[index-1], -1)
// Gather numbers in this line
thisLine := renum.FindAllStringIndex(lines[index], -1)
// Gather numbers in next line
nextLine := renum.FindAllStringIndex(lines[index+1], -1)
// Calculate the number of numbers in three lines
totalNumbers := len(prevLine) + len(thisLine) + len(nextLine)
// Now we create a big array with all the indexes
allIndexes := prevLine
for i := range thisLine {
allIndexes = append(allIndexes, thisLine[i])
}
for i := range nextLine {
allIndexes = append(allIndexes, nextLine[i])
}
// Now we create a big array with all the numbers
// We start from the previous line
allNumbers := renum.FindAllString(lines[index-1], -1)
thisNums := renum.FindAllString(lines[index], -1)
for i := range thisNums {
allNumbers = append(allNumbers, thisNums[i])
}
nextNums := renum.FindAllString(lines[index+1], -1)
for i := range nextNums {
allNumbers = append(allNumbers, nextNums[i])
}
// When we start, we have zero matches
matches := 0
// We will stop when we encounter two numbers
twoNums := [2]int{0, 0}
_ = twoNums
// Cycling through all numbers, but stopping at two matches
for i := 0; i < totalNumbers && matches < 2; i++ {
if (ast[0] >= allIndexes[i][0] - 1 && ast[0] <= allIndexes[i][1]) {
matches += 1
num, _ := strconv.Atoi(allNumbers[i])
twoNums[matches - 1] = num
}
}
if(matches == 2) {
tempGears := twoNums[0] * twoNums[1]
*total += tempGears
}
}
func CheckGears(lines []string) {
total := 0
totalPoint := &total
// Regex that finds the numbers in a row
//renum := regexp.MustCompile("[0-9]+")
// Regex that finds the asterisks in a row
resym := regexp.MustCompile("[*]")
// For every line starting from the second
for i := 0; i < len(lines) - 1; i++ {
// Take the index of the asterisks
asteriskIndex := resym.FindAllStringIndex(lines[i], - 1)
// For every index we get
for j := range asteriskIndex {
MatchNumbers(lines, i, asteriskIndex[j], totalPoint)
}
}
// firstLineNums := renum.FindAllStringIndex(lines[index], -1)
// firstLineSymbolsIndex := resym.FindAllStringIndex(lines[index], -1)
// secondLineSymbolsIndex := resym.FindAllStringIndex(lines[index + 1], -1)
// For every *number index range*, check if in the same line there is a
// symbol on (first - 1) or (last + 1), check in other lines if there is
// a symbol in a specific interval of numbers. If you find a match, you
// can break as you just need one symbol
fmt.Printf("Total of gears is: %d\n", total)
}
func main() {
file, err := os.Open("./inputs/day03_input")
check(err)
defer file.Close()
// This regex find the numbers inside strings
renum := regexp.MustCompile("[0-9]+")
resym := regexp.MustCompile("[^0-9.]+")
scanner := bufio.NewScanner(file)
var lines []string
var totalSum int = 0
// Read the whole file into an array of strings
for scanner.Scan() {
lines = append(lines, scanner.Text())
}
numLines := len(lines)
numbers := make([][]int, numLines)
// The 2D array of numbers will hold all the numbers to easily
// match them with corresponding strings in the file using the index
// For every line in the file, create an array of numbers
for i := 0; i < numLines; i++ {
tempNums := renum.FindAllString(lines[i], -1)
for j := 0; j < len(tempNums); j++ {
num, _ := strconv.Atoi(tempNums[j])
numbers[i] = append(numbers[i], num)
}
}
/* Line [0] needs to check only line 1 for symbols.
Similarly, the last line needs to check only
(last line index - 1) for symbols.
So we first check the line [0], then start a loop
from 1 to (last line index - 1)
*/
firstLineNums := renum.FindAllStringIndex(lines[0], -1)
firstLineSymbolsIndex := resym.FindAllStringIndex(lines[0], -1)
secondLineSymbolsIndex := resym.FindAllStringIndex(lines[1], -1)
// For every *number index range*, check if in the same line there is a
// symbol on (first - 1) or (last + 1), check in other lines if there is
// a symbol in a specific interval of numbers. If you find a match, you
// can break as you just need one symbol
for i := range firstLineNums {
for j := range firstLineSymbolsIndex {
if firstLineSymbolsIndex[j][0] >= firstLineNums[i][0] - 1 &&
(firstLineSymbolsIndex[j][0] <= firstLineNums[i][1]) {
totalSum += numbers[0][i]
break
}
}
for j := range secondLineSymbolsIndex {
if (secondLineSymbolsIndex[j][0] >= firstLineNums[i][0] - 1) &&
(secondLineSymbolsIndex[j][0] <= firstLineNums[i][1]) {
totalSum += numbers[0][i]
break
}
}
}
// Now we loop from 1 to (last index - i)
for i := 1; i < len(lines) - 1; i++ {
// We need to check the current line against an interval of three lines
// breaking the loop for a single number as soon as we find a match
// (we don't want duplicate matches)
currentLineNums := renum.FindAllStringIndex(lines[i], -1)
previousLineIndex := resym.FindAllStringIndex(lines[i - 1], -1)
currentLineIndex := resym.FindAllStringIndex(lines[i], -1)
nextLineIndex := resym.FindAllStringIndex(lines[i + 1], -1)
OuterLoop:
for k := range currentLineNums {
for j := range previousLineIndex {
if previousLineIndex[j][0] >= currentLineNums[k][0] - 1 &&
previousLineIndex[j][0] <= currentLineNums[k][1] {
totalSum += numbers[i][k]
continue OuterLoop
}
}
for j := range currentLineIndex {
if currentLineIndex[j][0] >= currentLineNums[k][0] - 1 &&
currentLineIndex[j][0] <= currentLineNums[k][1] {
totalSum += numbers[i][k]
continue OuterLoop
}
}
for j := range nextLineIndex {
if nextLineIndex[j][0] >= currentLineNums[k][0] - 1 &&
nextLineIndex[j][0] <= currentLineNums[k][1] {
totalSum += numbers[i][k]
continue OuterLoop
}
}
}
}
// Now we need to loop the last line and confront it with previous
// and itself
lastLineNums := renum.FindAllStringIndex(lines[len(lines) - 1], -1)
lastLineSymbolsIndex := resym.FindAllStringIndex(lines[len(lines) - 1], -1)
notLastLineSymbolsIndex := resym.FindAllStringIndex(lines[len(lines) - 2], -1)
// For every *number index range*, check if in the same line there is a
// symbol on (last - 1) or (last + 1), check in other lines if there is
// a symbol in a specific interval of numbers. If you find a match, you
// can break as you just need one symbol
for i := range lastLineNums {
for j := range lastLineSymbolsIndex {
if lastLineSymbolsIndex[j][0] >= lastLineNums[i][0] - 1 &&
(lastLineSymbolsIndex[j][0] <= lastLineNums[i][1]) {
totalSum += numbers[len(lines) - 1][i]
break
}
}
for j := range notLastLineSymbolsIndex {
if (notLastLineSymbolsIndex[j][0] >= lastLineNums[i][0] - 1) &&
(notLastLineSymbolsIndex[j][0] <= lastLineNums[i][1]) {
totalSum += numbers[len(lines) - 1][i]
break
}
}
}
fmt.Printf("The total sum is: %d\n", totalSum)
CheckGears(lines)
}

1
day03/inputs Symbolic link
View File

@ -0,0 +1 @@
../inputs

1
day04/inputs Symbolic link
View File

@ -0,0 +1 @@
../inputs

115
day04/scratchcards.go Normal file
View File

@ -0,0 +1,115 @@
package main
import (
"fmt"
"strings"
"bufio"
"os"
// "strconv"
"regexp"
)
func check(e error) {
if e != nil {
panic(e)
}
}
func PrintAndWait(x ...any) {
fmt.Print(x)
fmt.Scanln()
}
func SplitSets(s []string) ([]string, []string) {
// Split the two sets into winning and my numbers
tempwinningNumbers := s[0]
tempMyNumbers := s[1]
// Regex to populate a string with numbers
renum := regexp.MustCompile("[0-9]+")
myNumbers := renum.FindAllString(tempMyNumbers, -1)
winningNumbers := renum.FindAllString(tempwinningNumbers, -1)
return myNumbers, winningNumbers
}
func FindMatches(myNum []string, winNum []string) int {
matches := 0
for i := range myNum {
for j := range winNum {
if (myNum[i] == winNum[j]) {
matches += 1
continue
}
}
}
return matches
}
func CalcTickets(s []string, index int, tpr []int ) {
myNumbers, winningNumbers := SplitSets(s)
matches := FindMatches(myNumbers, winningNumbers)
if (matches > 0) {
for j := 0; j < tpr[index]; j++ {
for i := index; i < index + matches; i++ {
tpr[i+1] += 1
}
}
}
}
func CalcScore (s []string, t *int) {
myNumbers, winningNumbers := SplitSets(s)
matches := FindMatches(myNumbers, winningNumbers)
if(matches > 0) {
tempTotal := 1
for i := 0; i < matches - 1; i++ {
tempTotal *= 2
}
*t += tempTotal
}
}
func main() {
file, err := os.Open("./inputs/day04_input")
check(err)
defer file.Close()
// The total is a simple sum
var total int = 0
var totalPoint *int = &total
// To keep track of the amount of tickets, an array as long
// as the number of lines
var lines []string
scanner := bufio.NewScanner(file)
for scanner.Scan() {
lines = append(lines, scanner.Text())
}
ticketsPerRow := make([]int, len(lines))
tprPoint := ticketsPerRow[0:len(lines)]
for i := range ticketsPerRow {
ticketsPerRow[i] = 1
}
// Scan every line
for i := 0; i < len(lines); i++ {
// e.g.: Card 1: 41 48 83 86 17 | 83 86 6 31 17 9 48 53
cardAndNumbers := strings.Split(lines[i], ":")
// At this point, cardAndNumbers has "Card N"
// We don't need this information (yet?)
allNumbers := strings.Split(cardAndNumbers[1], "|")
CalcScore(allNumbers, totalPoint)
CalcTickets(allNumbers, i, tprPoint)
}
numTickets := 0
for i := range ticketsPerRow {
numTickets += ticketsPerRow[i]
}
fmt.Printf("The scratchcards are worth %d points.\n", total)
fmt.Printf("In total, I have %d scratchcards.", numTickets)
}

1
day05/inputs Symbolic link
View File

@ -0,0 +1 @@
../inputs

158
day05/seeds.go Normal file
View File

@ -0,0 +1,158 @@
package main
import (
"fmt"
// "strings"
"bufio"
"math"
"os"
"strconv"
"regexp"
"sync"
)
type Minimum struct {
mu sync.Mutex
minimum int
}
func check(e error) {
if e != nil {
panic(e)
}
}
func PrintAndWait(x ...any) {
fmt.Print(x...)
fmt.Scanln()
}
func GetMaps(scanner *bufio.Scanner, re *regexp.Regexp) [][]int {
// Scan until there is an empty line
var tempNums int = 0
tempArray := make([][]int, 0)
for i := 0; scanner.Scan() && scanner.Text() != ""; i++ {
tempString := re.FindAllString(scanner.Text(), -1)
temp := make([]int, 0)
for j := range tempString {
tempNums, _ = strconv.Atoi(tempString[j])
temp = append(temp, tempNums)
}
tempArray = append(tempArray, temp)
}
// Prepare for next line
scanner.Scan()
return tempArray
}
func (min *Minimum) ParallelMinimum(start, finish int, atrocity [][][]int, wg *sync.WaitGroup) {
// We check the array one by one, need a temp array because
// SeedToLocation wants it
tempNum := make([]int, 1)
tempMin := []int{0}
_ = tempMin
for i := 0; i < finish; i++ {
tempNum[0] = start + i
tempMin := SeedToLocation(tempNum, atrocity)
// Need to modify a shared variable, lock
min.mu.Lock()
if tempMin[0] < min.minimum {
min.minimum = tempMin[0]
}
min.mu.Unlock()
}
// We finished with the Goroutine
wg.Done()
}
func SeedToLocation(seeds []int, atrocity [][][]int) []int {
tempRes := seeds
for i := range atrocity {
tempRes = NextResource(tempRes, atrocity[i])
}
return tempRes
}
func NextResource(previous []int, resource [][]int) []int {
tempRes := make([]int, 0)
// [0] is dest, [1] is source, [2] is range
for i := range previous {
for j := range resource {
if previous[i] >= resource[j][1] &&
previous[i] <= (resource[j][1] + resource[j][2] - 1) {
tempRes = append(tempRes, previous[i] + (resource[j][0] - resource[j][1]))
}
}
// If we didn't add an element to the array
if len(tempRes) == i {
tempRes = append(tempRes, previous[i])
}
}
return tempRes
}
func main () {
file, err := os.Open("./inputs/day05_input")
check(err)
defer file.Close()
min := Minimum{
minimum: math.MaxInt,
}
var wg sync.WaitGroup
// Regex that finds the numbers in a row
renum := regexp.MustCompile("[0-9]+")
var seeds []int
var soils, fertilizers, waters, lights, temperatures,
humidities, locations [][]int
scanner := bufio.NewScanner(file)
// We know that the seeds only have one row
scanner.Scan()
// Put all the numbers in an array of strings
seedsNums := renum.FindAllString(scanner.Text(), -1)
// Extract every number from the string
for i := 0; i < len(seedsNums); i++ {
num, _ := strconv.Atoi(seedsNums[i])
seeds = append(seeds, num)
}
// We know we have an empty string and just a title, skip them
scanner.Scan()
scanner.Scan()
// Should be possible to just pass the scanner
soils = GetMaps(scanner, renum)
fertilizers = GetMaps(scanner, renum)
waters = GetMaps(scanner, renum)
lights = GetMaps(scanner, renum)
temperatures = GetMaps(scanner, renum)
humidities = GetMaps(scanner, renum)
locations = GetMaps(scanner, renum)
tempRes := make([]int, 0)
// Actually insane behaviour
monster := [][][]int{
soils, fertilizers, waters,
lights, temperatures, humidities,
locations,
}
// Send the seeds, receive
tempRes = SeedToLocation(seeds, monster)
minimum := math.MaxInt
for i := range tempRes {
if tempRes[i] < minimum {
minimum = tempRes[i]
}
}
fmt.Printf("Minimum of first part: %d\n", minimum)
// Actual madness
for i := 0; i < len(seeds); i += 2 {
wg.Add(1)
go min.ParallelMinimum(seeds[i], seeds[i+1], monster, &wg)
}
wg.Wait()
//tempRes = SeedToLocation(allSeeds, monster)
fmt.Printf("Minimum of second part: %d\n", min.minimum)
}

1
day06/inputs Symbolic link
View File

@ -0,0 +1 @@
../inputs

126
day06/race.go Normal file
View File

@ -0,0 +1,126 @@
package main
import (
"fmt"
// "strings"
"bufio"
// "math"
"os"
"strconv"
"regexp"
"sync"
)
type Race struct {
mu sync.Mutex
total int
}
func (r *Race) WeRaceBoys(time, distance int, wg *sync.WaitGroup) {
// As we just need to find the minimum necessary and then subtract it from
// the maximum, probably a good idea starting form the middle
tempTime := 0
for i := int(time/2); i > 0; i-- {
tempDist := i * (time - i)
if tempDist <= distance {
tempTime = i + 1
break
}
}
// If the minimum is tempTime, then the maximum is time - tempTime
// time - 2*tempTime is the number of possible victories
r.mu.Lock()
r.total *= (time - (2 * tempTime - 1))
r.mu.Unlock()
wg.Done()
}
func MultRaceDist(time, dist []string) ([]int, []int){
tempT, tempD := make([]int, 0), make([]int, 0)
for i := range time {
num, _ := strconv.Atoi(time[i])
tempT = append(tempT, num)
num, _ = strconv.Atoi(dist[i])
tempD = append(tempD, num)
}
return tempT, tempD
}
func SingleRaceDist(time, dist []string) (int, int) {
strT, strD := "", ""
numT, numD := 0, 0
// Create two big strings
for i := range time {
strT += time[i]
strD += dist[i]
}
numT, _ = strconv.Atoi(strT)
numD, _ = strconv.Atoi(strD)
return numT, numD
}
func check(e error) {
if e != nil {
panic(e)
}
}
func PrintAndWait(x ...any) {
fmt.Print(x...)
fmt.Scanln()
}
func main() {
file, err := os.Open("./inputs/day06_input")
check(err)
defer file.Close()
// Struct for multiple races
rMult := Race{
total: 1,
}
// Struct for a single race
rSing := Race{
total: 1,
}
_ = &rSing
var wg sync.WaitGroup
// Regex that finds the numbers in a row
renum := regexp.MustCompile("[0-9]+")
scanner := bufio.NewScanner(file)
time, distance := make([]int, 0), make([]int, 0)
tempStrings := make([]string, 0)
// Generic, would work for more rows
for scanner.Scan() {
tempStrings = append(tempStrings, scanner.Text())
}
// Now populate time and distance
timeStr := renum.FindAllString(tempStrings[0], - 1)
distStr := renum.FindAllString(tempStrings[1], - 1)
time, distance = MultRaceDist(timeStr, distStr)
// E.g.: if I hold the button for 1ms and then release it, it will travel at
// 1mm/ms fo the remaining amount of seconds.
// We can skip the holding down 0 and tMAX ms.
// Once we find the MIN amount of ms necessary to win, the limit is
// MAX - MIN
wg.Add(len(time))
for i := 0; i < len(time); i++ {
go rMult.WeRaceBoys(time[i], distance[i], &wg)
}
// Silly implementation of the single race
singT, singD := SingleRaceDist(timeStr, distStr)
wg.Add(1)
go rSing.WeRaceBoys(singT, singD, &wg)
wg.Wait()
fmt.Printf("Multiple races result: %d.\n", rMult.total)
fmt.Printf("Single race result: %d.\n", rSing.total)
}

366
day07/cards.go Normal file
View File

@ -0,0 +1,366 @@
package main
import (
"bufio"
"fmt"
"math"
"strings"
"os"
"strconv"
"sync"
)
var mapSeedsFirst = map[string]int{
"A": 12,
"K": 11,
"Q": 10,
"J": 9,
"T": 8,
"9": 7,
"8": 6,
"7": 5,
"6": 4,
"5": 3,
"4": 2,
"3": 1,
"2": 0,
}
var mapSeedsSecond = map[string]int{
"A": 12,
"K": 11,
"Q": 10,
"T": 9,
"9": 8,
"8": 7,
"7": 6,
"6": 5,
"5": 4,
"4": 3,
"3": 2,
"2": 1,
"J": 0,
}
type Game struct {
mu sync.Mutex
ranks []int
// 0: High card, 1: One pair, 2: Two pair, 3: Three of a kind
// 4: Full house, 5: Four of a kind, 6: Five of a kind
typeOfHand [7][]string
indexOfHand [7][]int
baseThirteen [7][]int
}
func (g *Game) ChangeBase(hType, index int, mapSeeds map[string]int, wg *sync.WaitGroup) {
// Starting from the first char [0], we create the base13 num
chars := len(g.typeOfHand[hType][index])
baseTN := g.typeOfHand[hType][index]
decNum := 0
for i := 0; i < chars; i++ {
// This should be refactored to be a bit more legible
// It just computes N * 13^i and adds it over
decNum += int(float64(mapSeeds[string(baseTN[i])]) * math.Pow(13, float64(chars-i)))
}
g.baseThirteen[hType][index] = decNum
wg.Done()
}
func (g *Game) AnalyzeMap(cards string, index, mapSize, offset int) {
// The offset defaults to 0 for the regular game
// it is +1 for a game with Jokers\
mapSeed := mapSeedsFirst
if offset != 0 {
mapSeed = mapSeedsSecond
}
switch mapSize {
// Five of a kind
case 1:
g.mu.Lock()
g.typeOfHand[6] = append(g.typeOfHand[6], cards)
g.indexOfHand[6] = append(g.indexOfHand[6], index)
g.mu.Unlock()
// Four of a kind || Full House
case 2:
i := FullOrFour(cards, offset, mapSeed)
g.mu.Lock()
g.typeOfHand[i] = append(g.typeOfHand[i], cards)
g.indexOfHand[i] = append(g.indexOfHand[i], index)
g.mu.Unlock()
// Three of a kind || Two pair
case 3:
i := ThreeOrTwo(cards, offset, mapSeed)
g.mu.Lock()
g.typeOfHand[i] = append(g.typeOfHand[i], cards)
g.indexOfHand[i] = append(g.indexOfHand[i], index)
g.mu.Unlock()
// One pair
case 4:
g.mu.Lock()
g.typeOfHand[1] = append(g.typeOfHand[1], cards)
g.indexOfHand[1] = append(g.indexOfHand[1], index)
g.mu.Unlock()
// High card
case 5:
g.mu.Lock()
g.typeOfHand[0] = append(g.typeOfHand[0], cards)
g.indexOfHand[0] = append(g.indexOfHand[0], index)
g.mu.Unlock()
}
}
func (g *Game) DetermineType(cards string, index int, wg *sync.WaitGroup) {
// We create a map and we check the length. Depending on the length, we
// insert the string in a specific type
m := make(map[string]int)
for i := 0; i < len(cards); i++ {
key := string(cards[i])
m[key] = mapSeedsFirst[key]
}
// Now, depending on the number of elements in the map, we can assign
// append cards to a specific rank
mapSize := len(m)
g.AnalyzeMap(cards, index, mapSize, 0)
wg.Done()
}
func (g *Game) SecondGame(cards string, index int, wg *sync.WaitGroup) {
// If I don't have Js, run the standard DetermineType
m := make(map[string]int)
n := make(map[string]int)
for i := 0; i < len(cards); i++ {
key := string(cards[i])
// We need to track the number of Js
m[key] += 1
// This is to track the type of hand, knowing the number of Js
n[key] = mapSeedsSecond[key]
}
mapSize := len(n)
switch m["J"] {
case 0:
// We have a hand without Js
wg.Add(1)
g.DetermineType(cards, index, wg)
case 1:
// If there is a J, J can be use is not adding information, therefore -1
g.AnalyzeMap(cards, index, (mapSize - 1), 1)
case 2:
g.AnalyzeMap(cards, index, (mapSize - 1), 2)
case 3:
g.AnalyzeMap(cards, index, (mapSize - 1), 3)
case 4:
g.AnalyzeMap(cards, index, (mapSize - 1), 4)
case 5:
wg.Add(1)
g.DetermineType(cards, index, wg)
}
wg.Done()
}
func ThreeOrTwo(cards string, offset int, mapSeed map[string]int) int {
m := make(map[string]int)
for i := 0; i < len(cards); i++ {
key := string(cards[i])
m[key] += 1
}
// If we are in the second game, remove J
if mapSeed["J"] == 0 {
m["J"] = 0
}
// m[i] returns 0 if the element is not in the map. I take advantage
// of that
tempNum := 0
for i := range mapSeed {
if m[i] > tempNum {
tempNum = m[i]
}
}
// If an element has 3 values, we have a three of a kind
if tempNum+offset == 3 {
return 3
/// If an element has 2 values, we have a two pair
} else if tempNum+offset == 2 {
return 2
}
PrintAndWait("This has run for ", cards)
return -1
}
func FullOrFour(cards string, offset int, mapSeed map[string]int) int {
m := make(map[string]int)
for i := 0; i < len(cards); i++ {
key := string(cards[i])
m[key] += 1
}
// If we are in the second game, remove J
if mapSeed["J"] == 0 {
m["J"] = 0
}
// m[i] returns 0 if the element is not in the map. I take advantage
// of that
// Better to save the maximum number
tempNum := 0
for i := range mapSeed {
if m[i] > tempNum {
tempNum = m[i]
}
}
// If an element has four values, we have a Four of a kind
if tempNum+offset == 4 {
return 5
/// If an element has 3 values, we have a Full House
} else if tempNum+offset == 3 {
return 4
}
return -1
}
func check(e error) {
if e != nil {
panic(e)
}
}
func PrintAndWait(x ...any) {
fmt.Print(x...)
fmt.Scanln()
}
// https://www.golangprograms.com/golang-program-for-implementation-of-quick-sort.html
// I need to learn how this shing works
func quicksort(a, h []int, hType int) []int {
if len(a) < 2 {
return a
}
left, right := 0, len(a)-1
pivot := 0
a[pivot], a[right] = a[right], a[pivot]
h[pivot], h[right] = h[right], h[pivot]
for i, _ := range a {
if a[i] < a[right] {
a[left], a[i] = a[i], a[left]
h[left], h[i] = h[i], h[left]
left++
}
}
a[left], a[right] = a[right], a[left]
h[left], h[right] = h[right], h[left]
quicksort(a[:left], h[:left], hType)
quicksort(a[left+1:], h[left+1:], hType)
return a
}
func main() {
file, err := os.Open("./inputs/day07_input")
check(err)
defer file.Close()
// Struct for regular game
g := Game{}
// Struct for the Joker game
jo := Game{}
// Variable where we store every line in the file
lines := make([]string, 0)
scanner := bufio.NewScanner(file)
for scanner.Scan() {
lines = append(lines, scanner.Text())
}
// Array of strings, set of cards
var cards []string
// Array of int, bet
var bet []int
// Now, split the lines
for i := 0; i < len(lines); i++ {
tempString := strings.Split(lines[i], " ")
cards = append(cards, tempString[0])
tempNum, _ := strconv.Atoi(tempString[1])
bet = append(bet, tempNum)
}
// Rank will be from 1 to len(lines)
g.ranks = make([]int, len(lines))
jo.ranks = make([]int, len(lines))
// What do we know for sure? 5 identical seeds are the highest ranks,
// 5 completely different seeds are the lowest ranks.
// We can iterate for every set of cards, and do different things
// if the map we build has one element, five elements or the worst
// case (two, three or four elements).
//
// Two identical: 4oK or FH
// Three identical: 3oK or 22
// Four identical: 12
//
// With this, I put every typeOfHand in a different array
var wg sync.WaitGroup
wg.Add(2 * len(lines))
for i := 0; i < len(lines); i++ {
g.DetermineType(cards[i], i, &wg)
jo.SecondGame(cards[i], i, &wg)
}
wg.Wait()
// Now that g.typeOfHand has every type of hand separated, the rank
// is determined by the first card(s). I can convert every number
// to a base 13 representation and sort.
// In g.indexOfHand I have the index of the corresponding type.
// For every type of hand
for i := range g.typeOfHand {
// As many wait groups as the element we will iterate
wg.Add(len(g.typeOfHand[i]))
wg.Add(len(jo.typeOfHand[i]))
// We also need to initialize the array g.baseThirteen so we can
// keep the same index
g.baseThirteen[i] = make([]int, len(g.typeOfHand[i]))
jo.baseThirteen[i] = make([]int, len(jo.typeOfHand[i]))
// For every element in a single type of hand
for j := range g.typeOfHand[i] {
g.ChangeBase(i, j, mapSeedsFirst, &wg)
}
for j := range jo.typeOfHand[i] {
jo.ChangeBase(i, j, mapSeedsSecond, &wg)
}
}
wg.Wait()
// A sort of some kind. Important is to also move the index with the number as
// well.
for i := range g.baseThirteen {
quicksort(g.baseThirteen[i], g.indexOfHand[i], i)
quicksort(jo.baseThirteen[i], jo.indexOfHand[i], i)
}
curRank := 1
rank := 0
// Iter every array
for i := range g.typeOfHand {
for j := range g.typeOfHand[i] {
index := g.indexOfHand[i][j]
rank += curRank * bet[index]
curRank++
}
}
fmt.Printf("Rank: %d\n", rank)
curRank = 1
rank = 0
// Iter every array
for i := range jo.typeOfHand {
for j := range jo.typeOfHand[i] {
index := jo.indexOfHand[i][j]
rank += curRank * bet[index]
curRank++
}
}
fmt.Printf("Rank: %d\n", rank)
}

1
day07/inputs Symbolic link
View File

@ -0,0 +1 @@
../inputs

95
day08/charpath.go Normal file
View File

@ -0,0 +1,95 @@
package main
import(
"fmt"
"bufio"
"os"
"sync"
"regexp"
"context"
)
const LEFT = 'L'
type Nodes struct {
mu sync.Mutex
commands []int32
singleN []int32
leftN []int32
rightN []int32
steps uint64
}
func check(e error) {
if e != nil {
panic(e)
}
}
func PrintAndWait(x ...any) {
fmt.Print(x...)
fmt.Scanln()
}
func (n *Nodes) toByteSingle(s string) {
// I've just received something like AAA
var temp int32
for i := 0; i < len(s); i++ {
a := int32(s[i])
temp += a << (i*8)
}
n.singleN = append(n.singleN, temp)
}
func (n *Nodes) toByteDuet(s, r string) {
// I've just received something like AAA BBB
var tempL, tempR int32
for i := 0; i < len(s); i++ {
tempL += int32(s[i]) << (i*8)
tempR += int32(s[i]) << (i*8)
}
n.leftN = append(n.leftN, tempL)
n.rightN = append(n.rightN, tempR)
}
func (n *Nodes) findNext(direction int32, index int, ctx context.Context) {
}
func main() {
file, err := os.Open("./inputs/day08_test_input")
check(err)
defer file.Close()
// Struct with my node
n := Nodes{}
// Prepare the regex
repath := regexp.MustCompile("([A-Z]{3})")
scanner := bufio.NewScanner(file)
scanner.Scan()
// First line, RL commands
strCommands := scanner.Text()
// Get every char inside the string just obtained
for i := 0; i < len(strCommands); i++ {
n.commands = append(n.commands, int32(strCommands[i]))
}
// One empty line
scanner.Scan()
// X = (Y, Z)
// We regex this one
for scanner.Scan() {
tempNodes := repath.FindAllString(scanner.Text(), -1)
n.toByteSingle(tempNodes[0])
n.toByteDuet(tempNodes[1], tempNodes[2])
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
// We start from 0, we find the match
for i, j := 0, 0; ; i++ {
// We do a circular loop
i = i % len(n.commands)
// A function that has the context as an argument
n.findNext(int32(i), j, ctx)
j++
}
}

1
day08/inputs Symbolic link
View File

@ -0,0 +1 @@
../inputs

140
inputs/day03_input Normal file
View File

@ -0,0 +1,140 @@
...............307............130..................969...601...186.........................................312....628..........878..........
......479#../..*..............................#.....*......*............../309.....484........................*......-..........+.....89....
...........726..352...461..69..............435.....390...625....................................459.........152...-....580............*.....
.......................*.......454*674.448......65................257....104*762....&..............*269.........558.&.....*907.........652..
.....................164.....-..............532*.....................................484......108........955.........252..........321.......
.......270....*..............470.......................632....................*...................$............352...................*......
820........782.347...................*838..*371..475.......607...557.......201.29..............814....=.....15*....893..............143.....
...*..796...........449..138......991.....2........*....28....*.....*588.............................353..................*.................
582...../..333.............@..224............%....4.....*.....399........883..#859.........*341...........583*40.......366.951......170*814.
...............................*....*.....252......................551.....*.......91...374.....665.804*..........938...........694.........
...549.769..............527..466.169.712.......898.......408......*............-...*............*.......912.......*.......771%.../..........
.....*...=.875*342......$........................@........-.....846.........610..829.934*508...79............&691..48...................483.
....402.............................423-..............................465.........................342.....................@.................
..............837..................................264..................................*823.180....@.........%.........538............634..
..........807*....990+.................453............*277........657..379...........200.......*.............296..............767..885......
744...611................@........+.............500........866.....*......*..717............656..80...254................&775...%..*........
.......%.......*.2....878..793.97..143.413.&856......329*...*...732......878./.........191...............*..........+..............584......
.........535.506..............*.........-.................368.......................#.+........*.........429.......363......................
..564....*................966........................189......=............/24....939......26...547.......................193*241...........
.....*......................-..........................*...204........156......7............*................/.717*..................296....
..826.....924.......................956..............920..................259.-......$......286........6..955.........................=..457
......124*......................48.....=...435..............12.....886....*........411..........*170..%............90..-295.624.............
...........................290....*375.............747.....................175..........................653........*...........*............
..........642*157...........*.............................218.945..949&...................864+....720..*...........883.786-.....434..-..&...
...118.................@.....309...586............698.152....*..............250......*954........*......932...414...................239.39..
......@..999..574.......302..................53..=......*......933.69..............21.........538.............@................143..........
........*........+...........267..587*........*...........25......*..........241......289.........436.........................*.............
.......448.............437....*.......334...605......../..=...........689...%.........*...25.........*....97........171.780....813..836.....
......................*........169...............427...94.........389..$........360............/....692.....*......*......*.........%.......
......641...-..679.541..56.606...............490*.............871..........757.................612........64.....256...*...281..............
...........419...*......*..*..........................................*705...-.......................*.........@.......121..................
.......*.......786....738...28.........83.550........980...........915...............475..@.........524...=..145.349.................331....
....215.922.......................766.%....*.............993.................-.968..*.....301............205............................*...
............775..............273..*.........168.....504...$.....179.....+..466...*....352........850................771-.........-.......729
..699@........................*..174...............#........573*.......191.......567..*....925*....$......825..................543....&.....
........#....................939.......137...#..........474......../.................975........$.....219*............935............94.....
.....508...547....+.455..347.....593....&...56...140.......*246.198.....@....41...........46.476...........539...........+.15...............
...............210..........-.......*...............*773.............336....*..............+..........847.....*.............*.....957.......
...435...........................736...987.....573........32*............135.....60*405.........802*6...$......252....@...208.129*..........
.............187....353...............*..........*..504......276.........................#.........................838.............604......
..202...79....$........*..82-.............../.580......*..............181.......288......925.939....292......158..................*.........
.....................746.................381.......211..272...........*.....890....*215.........=...........*............953....22..........
.........................957......#..................*......../.......240....*............18.................294...766...............*......
.......483..434$........*.........184......#.....&..561.......354.........445....*626.......*174......................*54....603..432.457...
......#..........916.231..*178..........967...902........895..................135.............................207...............*...........
..941.....600...*...................31...............*.../............138*559.......19.803..........396.........&..377.....261...904........
...........*...146....#........626....*............809......199................@........*..............+.....#.......*.275*............%....
...........181.......459.486.....*.....912....787..........*..................847.....160.433.728.........901......404................899...
..........................*.....97...........*..............252..............................*.......+.........451........434..*............
...621...294..10.........913..........5..318.349.......749.......457......594........................326.........*..........%.884........494
.....*...*...-.........................$...........157.@........*..........*....&..951....524..869#..............405.................416....
....864.631....=......958..........................*....../.....953.......690..144..$.......*..........................204.&....%.......+...
750.............868....*.....430............882...98.......655..........................98.961...674........*.........*....955..530.........
...*..................459.......*929..........$...................281....-...............*......*.....38...688........878...................
.779....494.................+........-725............978..............134......2.......465....685.929*............759............351..291...
.....51*.......244....173..222..233........153*......*....123..............*.....324......................#.456.#...%...............-..@....
.........&....*.......$.............................542...*......77.......288...*....*51.......624......68....*.888....507..................
...213.367.953................................-667.......225.......*285.......506.177....*32.....*..........43........../...................
...#.................753.%........506.................................................131.....793...-.....-....................917$.147.....
.........275.............372.....$..........$........679.407..674..205#....406............647.....297..642.........621...............*......
.........*...................................173........*.....................*721........*.......................*....#207..........533....
.........68..............&.........274............322*...................707............280...............188..272..+...........223.........
.....553..................289.534.....%...830.........927..................*.176............*.............*..........217.........*..........
...................$..-.......-..........*................796*..........606...%...756...-.994....252.694..351.793$........930..230.....611..
.841%..659.237..356...116.............683...860...............494................$....127..............*....................*.........*.....
......#....................558..#891........*........418............&.............................22..323.....540...92....792.........408...
.................231*780....*.........*452.82........*........940..709....................662....*..............*...@...........432.........
....456.91...............972.....=.523.............949.837#........................823....*....627..............880....511.............203..
...$......@.........190.......162........508..........................158..861..........533.............749............................=....
......................*.............117..@....608....967.10............../........................&........$....................800.........
..752/...988.....82..281....894........*......-..................533.............692...............524.............=....623......@....939...
.........*...217*..............*.......51.........400...............&........200..@......435..484&........2*648.95..416.....................
.........319..................788....................*..279.......*.....................*...........321.........*..........464...286*....311
................733...457............*.............65...*.........620...205....457.782..513..342..........561.670.160..899.*.........607....
...............*.....+............397.....613/..........938.171...............*....................869......$.........*.....589.............
.............85..............=324.................189.........#.......808..578..-.........170*........*..&..........461.....................
......................992.............555........=...............375.....=.....599............336...835.282.....714.........................
...@......622.........%...............-....%....................*.....................705.287................../....955.426..140............
..202.....*...365.........$8....636*....148....................720............648......+...*................%........*...................220
.........223...+....................554........629...........*......785..............&.....460....*...#..848...24.948....961............*...
....................274..........................*...........995...........92.823.....958........185.983...............=..*....566....33....
.............146#....+....865.307................797...411................./..............577.......................245....935..............
....150...................*......*..560.................+...+298...............*....213.......984.......103.811.......................&.....
.......*..297..-905.822.643.....452....*333............................527..911.......*.........=.........*....*...............834.76.410...
..........+........../.......*...............774.....................................228..764-...........806..621.............*.....=.......
.......83.......753.......664.36..371..132.........341.......347...267........@813.............341*322..............237%.....134......$.....
....66*...630......*.238.............$.$......609.....*673.........*...920-...............%................937*873................844.807...
.........*......410.....#.........90..........%....-............789.........316.........755.932..$....................*921....363..=........
.........524........-.........52..........422...349......................15....*............*....550.........384..9.22........*.............
..............752....809..........$........*............#......397.......*..147....666.....83................*..............747......@474...
.......995......*............898.753.....305...........306......*......344............#....................985./................206=........
......*......172...............*...........................-..603..........*771...870...260....609..............588.....+503................
.....475.....................412.634*480..155....$824...845........409..367..........@..........*..498...............................893....
317......737.654.............................*97............781...*..............#......184..252..*....@.564*347......312*..............*...
............*.............658..........91.............402..*.....929.....346.....912......=......825.412.........908..........&..........500
.889..%.............471*...*...........*.........685-...+..208.........................*..................*291..*.............926.826.......
.......647...@..........84.929........518.375.........+.............%...............139................467......813.690...........*.........
...........276...................165.........%......778............412....594.619...............768........401..........195*861..70...$.....
......................1.....584.........+.......954...........299@..............*..............*......./../............................759..
........886..356.&784.......*........414.............................702.......128...+315.....302.....283....+.......309*231.......316......
..........$.............811....................*.............237....*.....................426.....713.......638.442............957*.........
....572...........491&..*......46............41.362.............*..361.700...883..478.......%.......*............./.....245.................
655*.......720...................*............................211.........*....*....*.........502.862.........*............+.......137......
.....302....*...............762..668.....446.............................552.....488.......................415.622.113.437........%.........
.190*.......362...581......#...............*...803.14.............&61.................$......972...479......................................
......760............=................478..627....*.......34*..........................51......=....%.....828............................531
........*.....764#...................*..............529............................356...........*.........-...................996*271..*...
220...58............721...508.872.634...........300*.........507.....290...........*..........356.780...36.....553.......................875
...............292.@......*............833.71...................*305.......382.....273................../.............998.........679.......
.........616..*......../..524.885.....-......*..527*538...794......../.....=....$........=....................812........*..........*.+297..
....579....*...629....666.................982...................467...468........292.....67........398...........*..283..225......550.......
241*.....415.....................832............................&...........&.................481..*.....444*826.....*......................
.....*..........................*.......$...920......600-..323#............930....591....357...*...653..............182.............816..575
..178.157...............186=..568.../...134....#....................292............*.....+....438..........+824...........859.814..#........
..........*209...462................606......%......405............*........*..334.623................*...................+...@.............
.......784......*............................632...@.......*....597........320.........219............210...........805.....................
595............664............&..%847.................$.749.434.....*894..........757...*..................$813......*.......&.%....278.191.
............................311.....................156.........244...............*....163....$...................706.....893..115...*......
.......451-...215...474.............610.687......................*..............535........424..........727*411.....................314.....
..............*................82.....*./....-.....482*307.....502.......595...................490..............590....*406.............309.
.............97.............................860...................................................*.......395...#...656.....................
......732........516......486......662*............*739...........=....579.............754......821..718...&..............609...753..103.62.
.908...*...........*.........*...........*824...197.....$......227...........956............331.......*......390.................*....*.....
....*...210......284.........821......148................644....................*....533.......*.....280....*.......-..........904.....748..
....368.......$.........542....................................*.411...........982...*....958.671........975.........610....................
...........820...358$....&..298........$....62...@....983..+..49.....254............784...*......................947.....................776
.....766.......................*......68.....#..477...$...428....209*.......*...265.......191......*........268...=....81...618#........=...
........*847.....661.474......624.........................................223...#....*...........74...................*.....................
.................*......%.574.....................976.475*618.@.....=..27.........975.280.....*......=...............13.....757-.......112..
.....721.........748.........*......392&.........../..........636.911......................359.......857.656....72-.....................*...
........*...................405..40...........87+..............................%89..............237.........#...................83....632...
........108...............................................172.54*.................................&...................%........*............
............736........3....727.....=.40...................*.........877.........=191.......................+...139.903........151.....%....
...725...56..%..410...$..@.....*...2...*....969.............207...../.......831........977.........158....946...*...................967.....
.....-....*......+......346..163......8........*..........@..................*.....509*.....458...*..............834...636@.....304......357
...-.......790......308........................453......396...........871..712..*.......625...%.426......777.423............................
..810.................%....355.421.....36.........................151...........935.774*........................#.......619.390.............
.............360*201..........*.......%...794...-..70......./24..*..........................765......*303.167.........*..&....-.........*...
.........*.......................273......%...198..*..............967................724=...*.....776........@.120.696......=.........37.301
......333.588.........205..........................572......................................673.........876..................893............

10
inputs/day03_test_input Normal file
View File

@ -0,0 +1,10 @@
467..114..
...*......
..35..633.
......#...
617*......
.....+.58.
..592.....
......755.
...$.*....
.664.598..

199
inputs/day04_input Normal file
View File

@ -0,0 +1,199 @@
Card 1: 66 92 4 54 39 76 49 27 61 56 | 66 59 85 54 61 86 37 49 6 18 81 39 4 56 2 48 76 72 71 25 27 67 10 92 13
Card 2: 8 9 21 99 15 84 39 47 63 18 | 10 50 55 75 78 28 47 19 63 81 8 61 5 66 3 7 12 27 33 9 16 39 17 4 64
Card 3: 85 17 43 97 49 48 24 72 64 42 | 91 94 18 23 45 95 77 8 5 13 65 66 96 47 86 93 90 98 67 50 20 73 99 32 15
Card 4: 54 82 19 99 2 28 7 86 41 55 | 14 55 23 88 98 57 79 28 13 34 53 86 39 41 54 99 19 42 25 10 4 47 8 94 2
Card 5: 49 11 83 64 89 40 19 39 7 9 | 89 43 23 57 24 49 27 37 50 42 58 55 6 81 8 12 2 39 70 94 83 90 4 74 67
Card 6: 65 11 96 47 25 57 89 88 71 24 | 6 33 38 45 84 74 8 93 67 13 64 2 43 61 15 88 30 22 20 39 68 91 37 18 10
Card 7: 96 55 17 61 88 8 54 50 22 30 | 61 38 17 74 41 32 1 22 19 50 97 57 86 58 96 4 76 54 55 90 34 85 8 88 30
Card 8: 70 93 31 55 11 16 69 98 41 64 | 69 11 1 6 48 77 16 88 19 70 42 64 65 43 85 79 98 44 12 55 36 41 13 14 93
Card 9: 5 95 64 30 40 39 21 51 52 69 | 45 78 12 5 76 49 59 62 41 43 87 47 52 98 61 40 17 55 29 90 54 85 15 79 88
Card 10: 44 32 54 74 50 77 13 35 95 65 | 22 74 60 18 88 25 73 45 69 47 50 13 99 65 4 16 77 14 81 56 54 58 44 28 61
Card 11: 68 49 41 59 70 17 56 33 15 63 | 27 12 37 85 39 41 69 86 81 78 87 74 19 68 13 8 50 59 22 98 23 93 91 90 46
Card 12: 85 46 97 69 87 33 47 92 80 54 | 66 78 7 6 9 87 73 29 81 93 4 97 24 14 13 31 52 74 79 28 18 83 51 10 61
Card 13: 23 75 54 97 92 4 41 99 95 56 | 63 92 71 99 25 53 57 97 4 23 34 40 22 27 59 41 70 75 46 10 67 65 29 95 7
Card 14: 4 43 73 89 85 41 60 58 47 42 | 56 42 1 94 33 43 47 50 79 12 90 91 65 88 60 63 53 55 27 59 85 41 78 72 9
Card 15: 72 4 73 56 11 26 45 23 89 14 | 9 40 30 55 69 95 72 3 49 88 61 71 13 67 38 59 23 36 87 89 93 53 8 73 14
Card 16: 90 34 79 48 37 99 63 10 2 13 | 13 74 83 75 8 59 40 25 26 47 66 41 23 82 10 89 43 38 56 96 94 90 42 5 88
Card 17: 55 78 73 65 49 48 15 11 16 4 | 14 98 80 73 82 21 88 22 72 85 99 42 57 78 62 77 29 11 8 86 74 30 91 95 48
Card 18: 53 33 61 49 46 45 66 10 16 35 | 45 3 63 52 55 97 10 60 11 21 33 24 65 17 30 58 77 56 13 62 44 82 6 5 29
Card 19: 85 19 4 3 80 28 39 20 35 30 | 2 63 32 12 21 15 77 13 6 55 27 81 49 74 99 20 72 94 60 37 41 50 24 69 17
Card 20: 22 34 49 33 29 11 39 30 84 32 | 86 9 25 18 54 13 80 94 32 11 69 61 48 7 64 70 43 56 74 35 87 12 38 4 89
Card 21: 73 8 49 77 69 29 42 32 80 91 | 93 47 14 28 2 18 86 87 62 85 57 64 50 3 67 1 95 19 71 9 31 44 52 58 25
Card 22: 70 27 22 21 28 51 89 62 77 7 | 6 49 36 94 64 61 52 41 99 86 32 47 53 54 69 12 84 58 57 81 23 63 4 55 38
Card 23: 31 22 64 50 3 18 34 41 67 47 | 22 64 81 3 73 19 18 80 50 85 48 31 70 8 34 47 43 41 69 6 67 75 74 83 92
Card 24: 54 93 70 46 83 26 61 49 30 87 | 16 97 22 80 54 49 55 70 56 46 83 59 26 93 21 14 30 87 4 84 33 61 81 98 9
Card 25: 74 11 97 31 5 24 52 27 51 76 | 95 51 11 27 87 60 5 53 50 63 45 97 6 74 66 84 75 31 24 52 99 56 76 17 10
Card 26: 22 1 7 80 31 15 69 91 19 48 | 25 97 21 74 24 7 15 77 75 76 52 37 80 28 89 36 65 32 33 91 10 22 48 70 59
Card 27: 82 95 44 42 7 68 83 43 86 47 | 64 50 47 13 15 92 94 65 25 57 46 95 2 77 32 28 14 85 81 90 52 83 22 19 53
Card 28: 14 13 12 27 98 60 92 79 49 66 | 68 75 94 54 47 58 28 36 72 90 73 2 4 79 59 97 20 33 55 63 99 65 19 81 86
Card 29: 50 3 21 88 22 78 29 99 45 18 | 37 58 60 99 55 49 63 50 47 54 8 77 88 15 84 9 26 1 3 79 24 14 22 97 28
Card 30: 95 62 97 61 40 48 46 22 73 2 | 19 68 46 74 82 57 99 90 49 79 61 26 77 88 33 94 13 98 16 63 40 4 14 15 59
Card 31: 93 95 81 21 34 9 6 47 96 94 | 95 89 31 94 21 59 86 48 64 81 28 5 71 47 84 51 11 79 15 91 98 29 23 24 6
Card 32: 99 57 79 76 88 34 85 35 3 81 | 12 38 52 20 9 86 54 77 48 93 71 45 92 69 32 59 13 18 50 87 56 4 73 39 96
Card 33: 64 36 39 42 81 70 57 22 19 83 | 7 18 17 84 61 94 72 52 55 44 39 49 6 74 76 45 85 30 48 20 33 83 34 98 73
Card 34: 58 27 41 83 17 92 89 86 60 43 | 55 37 70 68 39 86 13 92 18 40 60 38 89 41 28 43 3 2 30 95 45 51 74 17 7
Card 35: 54 84 96 24 41 30 75 53 3 49 | 68 53 47 12 67 3 29 35 81 42 19 23 45 52 8 96 9 5 87 15 90 40 62 77 33
Card 36: 43 13 23 87 80 4 45 17 97 22 | 34 13 79 53 45 74 17 44 28 40 97 87 60 43 46 4 25 27 11 56 31 5 93 18 99
Card 37: 78 2 47 82 7 66 64 14 16 81 | 29 67 3 47 18 58 57 25 39 10 15 56 86 13 72 34 74 61 79 26 31 38 81 89 71
Card 38: 51 74 98 82 79 13 90 3 38 69 | 16 41 7 4 90 22 58 18 51 79 13 74 3 45 47 82 40 69 54 1 89 78 70 84 23
Card 39: 50 70 52 29 69 11 86 73 5 18 | 87 62 27 68 47 28 99 92 85 9 88 31 30 17 25 59 69 51 66 61 16 5 1 80 13
Card 40: 82 61 98 72 81 93 15 50 68 48 | 57 86 1 39 22 62 3 35 24 69 67 94 90 41 9 70 82 87 56 92 97 21 7 30 17
Card 41: 96 24 98 53 19 1 84 32 90 2 | 18 14 31 83 34 99 71 79 50 61 2 54 62 89 25 45 29 35 44 98 76 38 86 20 85
Card 42: 49 37 17 74 38 87 66 73 68 7 | 5 49 84 26 62 23 14 7 68 34 25 65 39 16 44 61 82 87 69 10 45 74 97 81 13
Card 43: 77 37 23 93 2 48 54 61 81 74 | 5 44 86 83 38 15 49 13 80 40 65 16 4 62 85 25 8 58 66 45 7 87 75 33 30
Card 44: 76 35 10 55 88 26 1 48 33 22 | 52 30 61 62 9 20 86 90 3 96 1 22 99 67 95 66 11 31 94 38 21 47 16 89 80
Card 45: 1 28 48 62 99 21 9 45 30 10 | 13 20 4 58 66 72 14 41 85 7 8 31 69 22 64 67 32 91 59 57 27 50 23 89 38
Card 46: 45 17 4 97 37 92 71 56 81 95 | 28 43 40 64 33 35 10 83 65 38 41 95 72 15 73 19 23 24 26 87 11 98 18 48 79
Card 47: 44 11 20 5 3 64 78 60 41 84 | 81 62 45 99 59 75 8 13 82 88 35 83 30 87 96 21 2 49 1 48 77 73 71 43 51
Card 48: 25 45 65 44 55 16 27 48 81 64 | 65 31 3 18 15 68 71 44 62 42 48 49 27 34 75 89 84 35 93 73 29 99 55 32 98
Card 49: 42 94 97 36 96 18 19 69 98 22 | 77 58 40 53 57 97 91 6 86 20 35 78 26 93 85 9 68 10 96 99 21 62 29 16 81
Card 50: 81 45 6 37 19 72 40 23 65 71 | 99 12 71 25 34 40 18 32 48 37 43 9 14 98 77 45 42 90 74 96 92 53 97 72 89
Card 51: 47 57 22 48 44 15 85 93 81 54 | 69 55 11 87 49 14 78 22 10 7 68 53 43 38 48 94 28 18 30 9 56 44 91 85 15
Card 52: 20 34 38 61 62 17 50 33 59 7 | 93 35 67 7 61 62 95 6 42 40 50 80 13 88 72 37 32 59 53 71 18 96 58 86 55
Card 53: 65 41 5 79 67 35 55 25 45 42 | 65 96 1 5 11 98 92 15 4 45 86 63 8 20 6 72 26 97 25 21 78 87 2 7 61
Card 54: 79 12 1 74 8 85 25 69 29 59 | 97 26 71 79 82 1 61 5 4 59 29 69 6 31 8 75 85 2 12 19 72 70 32 39 55
Card 55: 72 98 84 44 37 56 75 42 68 8 | 91 32 82 44 4 52 59 30 55 18 8 79 36 61 72 20 58 9 69 84 54 68 63 60 77
Card 56: 43 80 7 27 66 79 26 50 63 72 | 26 52 17 41 5 79 11 9 1 2 57 72 60 33 54 22 7 4 27 82 85 47 12 8 10
Card 57: 81 93 2 31 20 34 53 98 90 1 | 30 69 32 65 9 80 84 94 37 78 26 18 13 15 12 17 91 74 34 73 81 43 4 46 38
Card 58: 86 8 51 30 44 81 62 10 95 91 | 31 15 45 2 11 52 99 87 49 55 21 53 66 88 70 28 61 74 38 80 67 69 43 14 32
Card 59: 67 60 59 87 52 39 7 65 98 30 | 51 53 4 27 14 25 88 8 41 39 86 96 38 75 9 11 76 10 55 78 93 18 85 35 84
Card 60: 58 39 34 31 66 40 80 24 78 71 | 89 33 91 60 16 35 18 70 22 41 54 75 37 99 53 32 2 55 46 19 84 63 15 72 25
Card 61: 26 53 99 43 93 9 37 38 65 46 | 97 68 54 87 24 78 88 19 91 90 95 2 7 84 67 29 22 27 28 23 8 51 42 31 16
Card 62: 71 32 42 7 68 17 29 93 99 55 | 16 88 85 40 11 49 75 9 15 46 70 31 58 22 18 64 79 86 28 1 27 35 54 50 43
Card 63: 78 58 70 40 11 62 24 19 16 68 | 62 59 44 31 97 11 94 78 83 64 43 40 58 36 98 16 20 68 19 1 84 46 29 24 70
Card 64: 88 7 39 76 19 53 35 28 20 1 | 46 20 66 1 44 39 60 30 7 76 56 18 42 61 14 57 84 23 89 54 10 2 93 58 80
Card 65: 20 12 95 39 73 7 48 67 28 62 | 60 1 69 81 63 47 25 10 76 27 12 20 28 48 52 16 89 95 57 59 17 62 72 61 99
Card 66: 46 93 50 57 53 62 8 69 7 23 | 6 34 82 29 71 45 60 61 25 8 1 85 98 83 13 46 4 42 59 43 44 11 16 28 81
Card 67: 9 32 39 18 15 33 16 84 34 35 | 18 39 52 46 84 60 9 32 35 79 16 77 80 72 15 6 36 88 65 34 78 67 83 33 87
Card 68: 29 99 33 41 36 3 43 60 27 72 | 95 16 85 72 36 40 29 69 41 27 14 97 20 84 33 90 75 99 60 81 43 58 3 74 45
Card 69: 2 31 13 80 84 15 5 66 40 26 | 19 86 55 9 46 5 39 96 64 58 54 48 26 32 2 53 62 77 79 94 70 16 35 92 68
Card 70: 15 13 48 63 82 71 19 11 51 1 | 18 95 50 67 13 97 96 73 41 60 86 64 42 72 82 3 94 85 69 31 36 17 2 76 39
Card 71: 58 50 73 38 41 6 98 34 90 28 | 81 90 47 25 94 59 36 75 89 63 28 58 6 83 43 85 29 19 53 73 49 98 41 50 4
Card 72: 13 6 65 15 77 12 97 4 93 56 | 36 3 67 74 10 20 26 22 39 84 31 98 71 38 79 62 87 2 70 25 46 50 27 53 5
Card 73: 67 29 98 90 80 25 65 42 14 47 | 78 12 88 41 86 16 48 89 47 79 29 58 39 57 80 37 98 24 14 18 67 90 62 1 11
Card 74: 37 77 62 93 28 75 97 21 2 88 | 73 10 89 57 70 29 36 1 65 59 82 26 75 63 66 4 44 20 90 28 50 93 15 2 33
Card 75: 34 50 51 23 67 91 95 37 92 89 | 17 90 35 32 87 53 40 79 81 27 1 24 8 45 75 46 4 52 62 3 43 86 25 94 41
Card 76: 34 98 36 50 53 80 82 56 29 67 | 13 21 27 11 39 7 34 78 37 41 56 77 82 12 29 64 35 65 76 96 73 68 20 58 53
Card 77: 38 39 60 78 43 76 24 86 79 87 | 93 89 43 91 83 25 82 69 86 59 5 18 60 65 72 99 22 74 3 50 24 85 6 73 26
Card 78: 23 70 14 53 65 6 44 85 71 99 | 95 82 73 81 40 32 49 75 47 11 1 57 39 34 74 13 42 45 79 6 37 69 20 76 56
Card 79: 76 55 94 36 70 84 5 27 86 29 | 26 60 9 46 7 12 65 54 8 68 6 16 85 28 21 49 72 62 3 43 61 67 24 66 33
Card 80: 48 8 42 24 83 87 44 90 4 68 | 68 34 84 1 9 41 79 67 22 91 32 28 11 53 35 83 43 98 40 95 38 50 57 30 45
Card 81: 35 8 64 4 98 87 31 71 14 74 | 92 68 73 77 59 93 27 21 18 13 2 39 52 1 63 55 82 34 32 90 26 23 37 47 10
Card 82: 99 84 98 14 29 78 17 24 94 92 | 4 70 73 3 60 55 76 71 79 50 58 7 61 40 38 46 43 56 90 42 22 54 16 15 32
Card 83: 93 64 53 42 71 56 66 13 65 40 | 53 42 51 62 94 39 9 71 64 13 7 93 85 46 55 56 83 88 66 75 65 58 5 30 40
Card 84: 64 83 75 15 84 35 71 4 36 51 | 89 83 75 4 22 32 16 17 88 23 10 81 93 99 67 53 51 84 66 64 30 28 39 36 71
Card 85: 63 32 2 22 30 96 37 60 93 86 | 44 11 59 51 40 73 64 63 20 42 68 90 49 52 77 38 70 28 76 61 65 47 83 58 92
Card 86: 60 68 98 62 30 44 61 91 72 75 | 30 54 1 10 38 25 40 15 81 83 39 16 36 79 52 72 37 35 46 61 95 32 31 64 56
Card 87: 63 26 7 44 97 19 20 23 34 58 | 86 62 1 81 53 32 39 76 55 31 41 96 94 2 43 33 88 73 92 5 67 91 36 74 46
Card 88: 2 26 86 57 37 30 50 14 8 62 | 26 4 88 14 57 22 2 50 8 43 98 70 30 62 94 77 92 37 6 49 76 85 65 86 18
Card 89: 71 40 38 74 67 33 56 21 89 64 | 4 32 84 96 41 47 3 81 86 49 29 68 55 92 72 30 69 90 27 10 59 28 71 24 78
Card 90: 2 7 41 33 48 69 70 99 17 30 | 84 75 2 62 50 7 34 4 85 48 33 74 13 40 11 31 99 17 70 58 59 18 30 32 88
Card 91: 22 48 46 16 20 42 59 62 71 50 | 66 21 85 62 38 4 53 74 47 27 35 2 50 9 29 28 48 63 34 78 10 59 12 42 91
Card 92: 99 90 59 33 24 52 15 62 43 54 | 50 49 71 45 6 31 42 38 23 54 70 4 59 24 72 91 15 3 60 66 33 90 65 20 5
Card 93: 18 58 48 84 25 83 92 1 5 15 | 40 23 92 67 64 7 42 80 94 88 45 81 13 60 84 31 66 65 27 39 74 50 79 32 59
Card 94: 26 31 95 29 75 82 46 51 67 91 | 95 26 3 72 80 67 96 27 81 15 18 77 58 39 51 34 45 44 37 24 84 63 31 12 46
Card 95: 25 98 20 59 29 24 62 16 74 3 | 59 25 40 9 10 53 34 51 33 80 22 15 14 19 98 36 27 16 13 32 86 65 18 60 35
Card 96: 23 13 48 91 43 70 21 94 10 31 | 24 52 69 17 51 28 72 60 1 76 79 71 45 49 82 63 5 96 13 9 98 75 26 66 34
Card 97: 80 98 77 42 27 29 86 60 97 59 | 37 72 48 14 64 80 62 30 27 2 50 17 77 40 41 11 51 70 55 4 87 86 61 26 12
Card 98: 64 27 56 90 14 92 69 17 79 3 | 47 2 40 32 62 80 5 8 35 88 7 91 20 4 75 61 19 42 13 98 66 65 85 74 11
Card 99: 96 64 28 89 69 79 15 1 70 26 | 24 64 92 28 17 47 5 86 66 36 7 57 12 80 2 50 27 91 68 29 48 10 87 51 8
Card 100: 98 63 40 41 13 24 95 70 25 51 | 44 49 91 93 96 4 69 18 36 29 32 57 61 66 82 6 9 99 7 39 20 90 38 58 21
Card 101: 85 67 80 27 33 81 55 71 99 74 | 4 98 95 64 63 34 15 59 79 82 72 84 39 70 2 32 49 41 13 56 17 97 42 57 9
Card 102: 95 17 65 25 96 8 92 69 2 52 | 37 36 78 8 32 58 82 89 9 25 17 92 52 83 88 10 87 76 96 12 95 65 69 22 2
Card 103: 43 55 38 59 96 36 6 7 69 1 | 65 68 17 70 38 67 3 83 47 94 55 74 91 20 43 96 6 34 36 53 69 25 1 7 59
Card 104: 34 76 55 64 54 28 52 60 24 25 | 25 55 28 73 45 84 47 53 79 27 49 91 66 54 64 7 76 39 83 24 34 60 97 8 52
Card 105: 85 32 71 95 81 33 51 91 35 65 | 32 76 85 35 75 74 5 65 81 49 84 91 62 19 30 95 69 51 96 33 71 80 41 15 14
Card 106: 64 66 4 41 49 19 28 74 85 59 | 74 5 15 8 80 20 67 28 84 41 24 19 40 35 66 51 64 34 37 10 59 49 30 85 4
Card 107: 34 78 82 54 88 36 87 70 38 91 | 70 54 78 17 40 89 92 99 11 66 32 72 62 87 91 88 34 2 73 82 12 23 30 75 96
Card 108: 55 19 97 86 8 87 14 54 13 95 | 65 19 43 15 79 23 21 8 95 54 86 81 96 55 85 1 14 87 97 64 11 35 12 13 52
Card 109: 12 8 9 85 37 36 28 6 62 94 | 12 83 8 47 94 26 91 62 18 6 20 9 36 28 48 37 45 93 88 77 74 13 85 5 49
Card 110: 55 22 9 30 57 77 21 84 2 67 | 36 23 67 22 33 15 27 95 53 98 63 31 50 25 96 54 87 52 59 74 5 91 2 21 41
Card 111: 73 64 4 67 5 41 66 70 74 98 | 99 82 67 2 45 60 4 75 29 81 70 87 68 63 74 41 86 78 31 38 28 89 3 98 65
Card 112: 29 93 48 19 39 99 96 31 25 63 | 12 18 90 82 20 93 63 34 81 19 31 37 99 36 42 48 2 8 39 49 96 54 25 92 29
Card 113: 42 32 64 9 38 37 6 20 88 65 | 35 31 86 5 99 2 52 20 93 11 74 92 27 62 37 26 58 60 46 18 94 39 59 87 56
Card 114: 45 27 68 81 95 54 70 98 88 99 | 75 10 18 70 31 85 68 86 48 39 69 81 94 54 97 56 46 57 62 25 91 98 65 12 45
Card 115: 47 23 97 32 52 25 51 35 10 5 | 4 83 49 42 80 25 86 6 57 93 36 82 59 1 56 66 73 89 14 8 71 39 20 95 97
Card 116: 36 41 79 63 21 49 40 58 95 97 | 49 79 32 88 21 82 75 28 98 77 15 64 23 18 44 85 36 50 40 26 97 22 95 63 2
Card 117: 53 74 43 3 22 42 13 36 54 59 | 34 77 10 57 74 70 42 22 14 69 46 54 5 3 12 35 8 56 78 36 80 86 92 85 98
Card 118: 53 26 17 38 92 76 83 58 90 31 | 78 85 52 42 58 95 88 30 15 71 17 73 6 92 38 91 10 31 19 72 40 51 68 76 94
Card 119: 55 67 27 20 5 11 80 98 21 97 | 83 31 11 62 75 10 14 7 97 98 96 36 16 18 45 55 44 81 27 9 69 80 43 41 66
Card 120: 42 81 4 82 50 16 66 25 35 74 | 46 88 97 52 40 27 2 70 49 79 8 18 20 11 78 58 26 28 24 61 30 68 72 6 14
Card 121: 74 73 20 11 50 94 56 46 19 6 | 7 26 74 6 93 15 51 91 47 35 19 84 29 69 96 92 88 24 82 31 12 71 85 65 55
Card 122: 7 38 60 84 4 10 6 95 76 19 | 33 67 73 12 96 97 78 62 4 42 29 20 77 32 52 2 23 19 72 93 7 81 55 82 76
Card 123: 71 88 20 45 38 28 27 37 52 49 | 53 5 85 42 80 41 89 14 47 98 83 68 17 8 32 12 90 71 55 30 82 16 33 77 59
Card 124: 17 47 72 21 32 23 40 39 43 84 | 75 63 13 54 80 45 71 55 38 34 89 36 46 15 6 82 2 99 98 35 73 25 22 79 41
Card 125: 98 88 35 63 62 60 58 61 1 97 | 1 71 41 67 86 16 93 74 95 64 91 12 79 6 80 20 31 25 44 33 26 55 87 7 47
Card 126: 9 99 24 63 52 60 62 85 98 64 | 47 54 91 58 35 78 77 38 10 94 34 65 86 95 7 44 61 90 92 4 31 48 13 6 49
Card 127: 88 55 26 91 34 38 46 79 92 12 | 7 88 67 82 94 93 63 6 47 49 57 52 32 38 61 77 69 51 81 25 92 36 5 39 11
Card 128: 19 72 9 81 37 93 6 22 53 3 | 60 26 22 47 72 9 40 98 53 50 37 49 88 93 6 82 89 81 16 84 51 75 28 56 3
Card 129: 53 28 43 67 89 2 9 83 82 14 | 53 68 42 4 92 69 95 2 33 78 97 1 72 14 45 46 13 44 26 90 8 34 20 81 77
Card 130: 41 5 12 24 37 59 45 20 74 68 | 94 30 19 12 45 5 62 74 48 73 59 20 50 25 41 26 96 66 37 7 55 44 24 68 88
Card 131: 49 35 40 4 15 12 13 28 70 81 | 38 70 31 2 12 4 74 15 13 50 81 29 99 9 42 65 46 54 40 32 11 34 49 28 86
Card 132: 71 89 67 34 66 24 18 17 80 36 | 55 77 17 22 16 98 47 54 56 2 48 89 43 91 95 66 9 20 40 37 42 29 25 27 34
Card 133: 87 59 6 34 33 73 26 72 17 60 | 75 60 58 22 19 31 79 52 72 71 21 33 73 35 51 18 8 2 64 57 74 81 76 87 32
Card 134: 5 65 81 19 87 84 4 28 86 90 | 46 83 98 49 1 29 13 76 23 38 74 50 37 30 25 16 73 84 53 3 47 85 77 95 75
Card 135: 73 71 76 33 38 61 88 4 91 97 | 83 5 27 80 37 43 28 2 12 82 62 90 38 7 25 76 34 85 29 89 9 71 54 95 49
Card 136: 93 1 31 90 94 15 87 79 14 78 | 82 41 93 25 15 78 70 27 90 55 87 34 80 31 4 86 72 51 77 94 75 56 20 2 99
Card 137: 44 5 82 35 71 81 1 60 55 32 | 36 46 86 9 65 16 78 28 35 70 15 55 66 42 7 14 23 26 75 24 88 87 38 12 92
Card 138: 31 28 92 12 4 47 70 20 55 44 | 76 85 73 92 61 27 36 90 53 78 79 18 10 63 95 15 74 20 39 4 60 91 47 19 87
Card 139: 46 42 19 87 2 24 31 63 26 47 | 14 87 76 16 69 77 17 30 32 24 80 28 45 64 26 47 67 13 82 57 55 88 37 15 41
Card 140: 32 99 2 23 14 89 51 54 8 69 | 46 15 32 62 30 92 71 47 49 96 44 80 98 10 67 27 93 76 87 19 18 40 64 31 72
Card 141: 88 59 11 19 95 39 31 43 79 94 | 9 93 3 49 33 8 10 61 35 71 51 20 13 69 91 30 27 23 84 40 60 76 29 55 66
Card 142: 63 97 79 19 30 45 33 14 64 13 | 85 83 73 36 9 8 43 88 72 90 48 35 33 5 98 93 39 46 91 20 69 34 80 77 23
Card 143: 16 32 97 62 81 76 21 79 86 42 | 4 82 59 99 96 49 52 56 6 1 92 91 94 10 48 15 69 18 24 72 83 47 34 77 65
Card 144: 25 96 44 94 8 37 57 58 41 80 | 72 94 25 13 8 70 26 43 60 58 9 66 37 57 96 51 67 41 88 22 73 44 34 82 80
Card 145: 94 41 79 86 90 78 85 2 95 24 | 57 71 95 79 25 85 41 18 75 43 47 63 46 28 64 89 48 55 17 70 2 54 8 16 81
Card 146: 31 2 38 95 65 35 40 36 16 9 | 68 38 28 15 7 65 90 31 79 71 2 35 9 70 16 62 58 57 60 17 36 95 40 6 59
Card 147: 46 26 34 79 51 76 57 45 52 41 | 46 47 33 79 69 59 32 16 28 99 93 44 39 90 45 48 51 75 9 66 22 86 25 58 12
Card 148: 83 60 57 71 59 61 76 75 96 82 | 34 76 25 38 31 71 59 12 82 1 61 29 37 62 21 77 63 57 75 83 24 97 60 96 46
Card 149: 47 35 60 76 40 11 63 34 79 73 | 73 70 48 58 78 37 89 20 95 17 46 66 57 99 98 19 51 65 69 13 62 6 61 11 63
Card 150: 76 17 13 40 36 24 27 32 77 4 | 76 80 63 77 92 89 69 37 48 54 73 6 82 22 46 62 14 13 75 10 88 60 24 40 99
Card 151: 90 98 22 69 67 14 39 85 3 57 | 67 87 18 22 74 13 33 46 68 85 24 15 14 5 98 17 30 36 77 66 16 89 48 39 3
Card 152: 58 76 44 63 94 36 78 30 34 47 | 21 70 67 5 75 34 83 6 18 53 36 65 19 28 88 55 61 42 92 11 48 23 96 63 9
Card 153: 20 11 24 87 38 45 1 19 57 83 | 83 89 71 21 31 96 55 34 88 53 51 18 15 82 24 92 87 59 17 67 43 20 68 45 57
Card 154: 85 57 93 38 35 8 59 67 6 30 | 97 7 98 69 91 58 24 78 46 75 62 89 55 20 51 95 17 74 72 49 27 45 36 52 83
Card 155: 14 72 37 30 47 58 44 21 74 11 | 66 38 83 88 64 10 57 18 30 9 82 28 17 61 15 48 20 34 14 7 79 26 63 44 8
Card 156: 38 93 54 22 40 12 63 80 55 8 | 36 32 71 52 17 97 64 80 38 47 34 22 63 24 62 84 98 23 54 8 76 5 45 61 20
Card 157: 76 81 52 37 46 82 47 5 60 26 | 28 20 83 40 71 68 84 66 72 5 69 79 29 52 81 51 64 2 55 63 26 56 76 32 31
Card 158: 12 89 2 74 11 28 94 83 85 68 | 63 32 35 52 19 44 66 87 70 99 38 95 53 82 16 30 29 21 59 3 25 50 26 69 18
Card 159: 62 82 61 8 23 18 25 14 68 95 | 51 13 11 36 56 29 92 79 19 49 28 77 82 96 8 58 97 73 95 72 6 2 67 91 48
Card 160: 55 80 19 90 66 63 59 89 73 23 | 39 91 10 61 1 69 20 93 60 9 99 72 26 45 52 74 5 64 83 24 14 22 15 27 86
Card 161: 9 11 72 31 24 68 3 36 16 59 | 56 92 7 75 80 91 44 78 84 12 22 4 17 37 42 63 49 67 70 26 43 39 66 90 27
Card 162: 18 99 9 68 64 81 42 24 47 91 | 80 29 96 98 33 83 27 43 4 10 61 48 44 35 8 59 30 72 54 14 50 22 74 6 13
Card 163: 77 29 4 87 21 68 53 98 45 95 | 32 50 1 6 23 97 64 61 36 47 86 60 92 15 78 74 75 37 90 72 28 73 55 3 35
Card 164: 31 52 49 7 85 47 68 50 71 46 | 74 91 52 37 35 60 71 50 7 29 43 82 47 34 63 94 49 85 3 28 68 31 97 46 95
Card 165: 76 50 46 25 96 45 65 55 57 7 | 56 44 52 61 3 69 72 90 86 91 87 53 95 68 83 84 82 59 23 73 48 88 81 66 28
Card 166: 77 59 67 43 64 4 82 56 98 76 | 59 61 16 72 82 52 76 90 44 54 32 67 64 33 80 97 35 8 56 4 92 21 77 98 43
Card 167: 43 14 22 45 58 46 5 3 86 37 | 86 65 22 24 25 80 97 3 32 69 31 5 14 66 58 87 46 21 37 59 99 43 28 45 91
Card 168: 18 22 61 21 45 33 49 96 83 38 | 18 38 83 48 87 6 20 91 23 28 11 45 30 21 17 33 96 61 95 49 74 77 69 22 80
Card 169: 99 12 78 48 92 51 8 6 14 45 | 46 64 80 60 9 78 54 45 1 83 59 3 14 22 11 12 29 44 5 8 61 37 49 74 38
Card 170: 9 3 45 53 23 13 43 34 76 44 | 59 60 20 91 64 65 52 13 6 44 29 12 25 66 63 3 62 72 68 76 77 43 34 31 53
Card 171: 27 50 54 11 90 17 80 74 7 34 | 90 40 57 15 50 74 26 53 7 80 52 31 38 54 34 17 5 46 47 27 39 48 19 11 32
Card 172: 26 88 29 44 70 90 51 91 43 39 | 66 85 26 6 43 44 74 84 4 39 89 8 40 22 7 2 3 54 75 29 20 55 34 60 88
Card 173: 82 41 1 85 80 29 53 47 73 37 | 12 96 90 36 33 68 92 57 71 65 63 76 3 84 43 35 28 22 97 88 94 5 73 7 4
Card 174: 10 32 78 50 4 89 14 41 70 19 | 10 19 71 77 21 24 13 36 69 74 32 47 37 41 57 75 70 17 4 60 14 22 64 2 88
Card 175: 48 73 37 77 1 62 3 90 16 82 | 98 25 86 30 97 46 55 31 23 78 40 27 43 71 1 18 29 92 77 70 73 15 57 37 45
Card 176: 9 24 81 66 77 87 71 63 76 69 | 67 79 49 57 40 77 80 36 24 69 76 83 2 72 97 63 42 87 33 39 20 35 61 66 13
Card 177: 28 1 81 43 11 14 85 16 22 96 | 7 59 48 34 26 55 13 61 84 30 39 35 88 42 71 52 24 32 89 80 5 29 94 40 97
Card 178: 86 83 31 11 98 17 40 36 62 24 | 19 26 46 43 73 81 68 75 9 55 44 92 61 57 96 99 62 58 17 98 72 38 64 32 59
Card 179: 57 18 30 56 69 39 54 20 16 96 | 49 94 24 8 62 79 56 43 4 77 23 76 74 55 82 98 28 65 89 2 5 87 34 13 71
Card 180: 96 90 19 27 25 64 33 46 42 45 | 29 77 54 45 40 11 66 38 9 80 32 60 42 51 47 4 15 23 87 26 27 57 14 28 2
Card 181: 33 2 97 78 52 35 53 34 87 46 | 56 23 9 59 60 75 13 24 27 68 76 98 12 2 63 54 47 16 69 85 71 79 3 93 64
Card 182: 16 26 4 13 81 34 5 90 11 65 | 52 72 86 38 59 46 18 76 33 66 99 87 45 36 69 43 35 27 97 37 77 62 12 67 96
Card 183: 29 30 38 95 42 14 91 33 69 36 | 66 39 75 12 92 47 94 17 13 73 99 54 89 16 68 41 10 7 48 25 20 24 61 31 60
Card 184: 87 62 63 51 65 26 96 5 72 28 | 90 62 21 87 51 96 3 66 32 63 45 11 38 28 5 83 67 75 65 26 74 13 72 7 98
Card 185: 19 76 22 24 34 98 56 90 70 49 | 34 70 2 50 23 9 90 28 64 19 17 73 39 76 8 22 49 77 56 24 27 55 75 98 91
Card 186: 28 26 65 98 88 50 44 83 47 24 | 92 80 91 51 87 58 31 46 48 39 76 29 14 56 42 36 79 67 2 78 20 72 62 35 19
Card 187: 10 39 36 96 21 90 9 3 29 69 | 57 39 1 96 90 2 95 29 32 74 53 84 70 22 26 12 9 38 81 50 80 62 75 10 97
Card 188: 53 32 89 13 31 50 1 3 70 99 | 91 78 23 65 20 63 70 13 66 99 34 54 3 14 27 44 71 28 53 19 50 89 32 31 61
Card 189: 53 87 69 96 46 70 90 18 23 93 | 91 39 79 69 71 70 5 88 12 53 56 65 74 36 64 18 24 45 31 35 77 96 7 86 66
Card 190: 63 35 27 25 78 43 86 53 29 74 | 60 72 33 19 53 96 43 84 83 5 29 81 65 22 46 30 41 27 26 42 50 97 64 7 21
Card 191: 91 93 37 42 76 2 69 89 66 80 | 45 19 24 92 38 21 76 7 60 14 75 81 32 65 12 53 58 35 67 33 3 68 42 22 34
Card 192: 17 5 29 67 35 41 14 52 97 10 | 71 76 61 93 20 41 94 16 3 31 26 95 78 64 82 38 92 85 7 43 24 89 8 28 4
Card 193: 17 77 69 4 96 22 99 56 93 85 | 50 97 82 8 54 40 91 83 65 24 88 16 12 67 17 22 45 15 93 63 27 23 78 10 85
Card 194: 42 64 40 85 20 26 76 29 34 56 | 12 34 41 57 55 15 27 47 67 50 31 86 7 18 25 43 3 48 85 64 9 71 17 37 73
Card 195: 33 68 37 22 85 4 25 99 41 26 | 69 78 34 31 40 66 9 35 1 29 46 91 25 56 88 86 38 75 3 28 20 97 53 41 42
Card 196: 35 6 57 59 13 92 46 22 84 80 | 72 66 22 77 63 74 51 34 53 99 47 68 6 96 88 32 83 93 52 78 56 89 4 11 28
Card 197: 75 37 74 76 59 12 58 39 84 45 | 50 97 32 99 3 56 81 68 11 75 93 53 96 66 12 21 35 25 77 18 72 13 80 98 71
Card 198: 90 56 5 35 91 61 7 20 68 40 | 17 47 66 10 73 8 51 13 53 58 45 36 34 54 23 92 64 28 27 71 22 52 18 69 24
Card 199: 16 23 27 61 14 11 89 80 98 88 | 57 48 25 66 72 45 2 33 93 9 73 58 94 79 40 6 47 19 78 69 70 8 30 29 34

6
inputs/day04_test_input Normal file
View File

@ -0,0 +1,6 @@
Card 1: 41 48 83 86 17 | 83 86 6 31 17 9 48 53
Card 2: 13 32 20 16 61 | 61 30 68 82 17 32 24 19
Card 3: 1 21 53 59 44 | 69 82 63 72 16 21 14 1
Card 4: 41 92 73 84 69 | 59 84 76 51 58 5 54 83
Card 5: 87 83 26 28 32 | 88 30 70 12 93 22 82 36
Card 6: 31 18 13 56 72 | 74 77 10 23 35 67 36 11

223
inputs/day05_input Normal file
View File

@ -0,0 +1,223 @@
seeds: 3136945476 509728956 1904897211 495273540 1186343315 66026055 1381149926 11379441 4060485949 190301545 444541979 351779229 1076140984 104902451 264807001 60556152 3676523418 44140882 3895155702 111080695
seed-to-soil map:
2122609492 2788703865 117293332
751770532 1940296486 410787026
2652142963 2905997197 464992562
3442443139 3721315963 573651333
3117135525 2356966701 133002244
742051533 3370989759 9718999
2239902824 720032349 393589935
1162557558 58715335 661317014
1823874572 2489968945 298734920
2633492759 2351083512 5883189
4016094472 3442443139 278872824
58715335 1256960288 683336198
3250137769 1126389299 130570989
2639375948 1113622284 12767015
soil-to-fertilizer map:
1839905294 2992775329 34548650
266781855 3027323979 163164353
1874453944 1681649719 388228515
671359508 847997583 161400465
0 2547368955 266781855
3203005759 3207454799 385245393
832759973 813886658 34110925
3671840261 3598096086 304246395
1377823717 351805081 65559824
1443383541 417364905 396521753
3985931590 3902342481 309035706
2954410911 2069878234 236077421
2262682459 2814150810 19476781
429946208 2305955655 241413300
3981482550 3203005759 4449040
3976086656 3592700192 5395894
1026018636 0 351805081
2282159240 1009398048 672251671
866870898 2833627591 159147738
3588251152 4211378187 83589109
fertilizer-to-water map:
2408925737 4214441342 80525954
1405678964 176700146 234310964
2103148712 0 114754845
289811242 411011110 140151672
19025194 1085844786 2698717
2799367899 3104502118 25793488
3686730518 3130295606 74796096
628099810 1273935988 19704264
1112219380 661022482 39037869
467844674 876473087 160255136
1356562401 1036728223 49116563
0 2195479548 19025194
1778400105 1801270370 10408868
3201290155 3772851666 86331548
1795901930 1713284032 67001953
1151257249 1907547144 205305152
4156855349 4121566803 26796069
160254887 2112852296 19696655
1788808973 114754845 7092957
1639989928 1780285985 20984385
3990635607 2938282376 166219742
2864292987 3316407580 74613579
3761526614 4148362872 26946870
2048296368 121847802 54852344
3054903767 3975180415 146386388
21723911 737942111 138530976
647804074 1811679238 95867906
3580274539 3391021159 106455979
2489451691 2628366168 309916208
1049288783 2132548951 62930597
4183651418 3205091702 111315878
3360834108 2408925737 219440431
743671980 1293640252 305616803
3287621703 3699639261 73212405
2938906566 3859183214 115997201
429962914 700060351 37881760
1775001290 2214504742 3398815
3788473484 3497477138 202162123
2825161387 4175309742 39131600
1660974313 1599257055 114026977
1862903883 1088543503 185392485
179951542 551162782 109859700
water-to-light map:
2182426048 2230942562 75597875
3871195410 3518497934 102047632
2258023923 1068663414 38503018
1376483871 1748535271 120845081
3267723970 3442138354 23090394
3687599530 4146748183 69194895
1687874044 1117179928 229976398
1024656105 0 9213951
2036492700 1503963494 145933348
1339060619 127856209 37423252
3600067928 3079307704 87531602
3778928632 3171781100 38997592
485121354 165279461 136305184
1266011073 1649896842 73049546
1917850442 9213951 118642258
2296526941 1107166432 10013496
3973243042 2847069441 75895604
3177917323 2989501057 89806647
136410837 1347156326 156807168
4049138646 3166839306 4941794
3817926224 3465228748 53269186
2631950731 2587548926 259520515
478937106 2064525337 6184248
3756794425 2922965045 22134207
621426538 487303746 242996590
3299937194 3372641330 69497024
1240422190 1722946388 25588883
1497328952 1873980245 190545092
2587548926 2945099252 44401805
864423128 2070709585 160232977
1033870056 1869380352 4599893
2891471246 3629668396 286446077
1158126414 866711173 82295776
4054080440 3210778692 62083789
1038469949 949006949 119656465
0 730300336 136410837
4116164229 3272862481 99778849
3290814364 3620545566 9122830
3369434218 3916114473 230633710
293218005 301584645 185719101
light-to-temperature map:
2047881931 2133163196 61773729
2768352591 2658645540 147815435
663892205 789634091 62723057
962320572 2260439344 13990400
4174477469 3668516433 35699725
3949428604 3175207948 225048865
2918680909 3704216158 118365848
976310972 47881164 71382440
736841121 215530327 84565848
1481137268 593966122 45807826
3406939292 2891251077 174249820
2916168026 3907788997 2512883
854252812 1457767969 108067760
2658645540 3065500897 109707051
0 1842095595 291067601
821406969 119263604 32845843
2182554848 897903253 121629531
1047693412 1565835729 166620621
3847603798 3400256813 16617815
1259860138 152109447 53195021
3581189112 3424865230 243651203
1470195525 1364566318 10941743
653613314 30205504 10278891
1430142037 1324512830 40053488
291067601 1773419829 68675766
2109655660 2194936925 65502419
1856219803 2274429744 191662128
359743367 300096175 293869947
3398948690 3416874628 7990602
3864221613 3822582006 85206991
2609164425 1750403060 23016769
1707010741 2466091872 49002444
1756013185 1732456350 17946710
1214314033 852357148 45546105
1313055159 2515094316 117086878
2175158079 40484395 7396769
3824840315 3910301880 22763483
1526945094 639773948 149860143
2304184379 1019532784 304980046
3037046757 3933065363 361901933
1773959895 1375508061 82259908
726615262 205304468 10225859
1676805237 0 30205504
4210177194 2806460975 84790102
temperature-to-humidity map:
2704404081 3383155981 190240562
3678765766 3078657339 304498642
2894644643 2740175301 304339717
3375985319 2704404081 35771220
3198984360 3840405770 142858638
3341842998 3044515018 34142321
3411756539 3573396543 267009227
humidity-to-location map:
3843755612 3461421206 53203349
3797023193 2837279508 46732419
1328442859 1820435049 165058603
2358032500 2069263501 110029787
776537476 129658954 20092280
2041812400 3514624555 271685061
4004991793 2179293288 239800545
1813819309 1372459189 171674343
890079235 609776153 19282104
129748073 629058257 107944033
2472688430 2519585064 209661612
1039983756 866750363 166281406
3896958961 2729246676 108032832
1004757286 149751234 35226470
850718450 90298169 39360785
3150066893 4231246292 63721004
0 737002290 129748073
909361339 1154885545 95395947
2682350042 2911243637 44822034
318816223 1586615093 233819956
796629756 531466240 54088694
705961941 460890705 70575535
3669300252 2884011927 27231710
4244792338 3015820858 50174958
3352063456 3786309616 317236796
552636179 0 75876832
3213787897 4103546412 55695414
294595004 585554934 24221219
2799176542 3110530855 350890351
1691965533 1033031769 121853776
2468062287 2956065671 4626143
2727172076 4159241826 72004466
1493501462 262426634 198464071
280173667 75876832 14421337
1986683356 2960691814 55129044
628513011 184977704 77448930
2313497461 3065995816 44535039
1206265162 1250281492 122177697
3269483311 1986683356 82580145
237692106 1544133532 42481561
3696531962 2419093833 100491231

33
inputs/day05_test_input Normal file
View File

@ -0,0 +1,33 @@
seeds: 79 14 55 13
seed-to-soil map:
50 98 2
52 50 48
soil-to-fertilizer map:
0 15 37
37 52 2
39 0 15
fertilizer-to-water map:
49 53 8
0 11 42
42 0 7
57 7 4
water-to-light map:
88 18 7
18 25 70
light-to-temperature map:
45 77 23
81 45 19
68 64 13
temperature-to-humidity map:
0 69 1
1 0 69
humidity-to-location map:
60 56 37
56 93 4

2
inputs/day06_input Normal file
View File

@ -0,0 +1,2 @@
Time: 59 79 65 75
Distance: 597 1234 1032 1328

2
inputs/day06_test_input Normal file
View File

@ -0,0 +1,2 @@
Time: 7 15 30
Distance: 9 40 200

1000
inputs/day07_input Normal file

File diff suppressed because it is too large Load Diff

5
inputs/day07_test_input Normal file
View File

@ -0,0 +1,5 @@
32T3K 765
T55J5 684
KK677 28
KTJJT 220
QQQJA 483

9
inputs/day08_test_input Normal file
View File

@ -0,0 +1,9 @@
RL
AAA = (BBB, CCC)
BBB = (DDD, EEE)
CCC = (ZZZ, GGG)
DDD = (DDD, DDD)
EEE = (EEE, EEE)
GGG = (GGG, GGG)
ZZZ = (ZZZ, ZZZ)