This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Mathlib | |
| def InRect (p : ℚ × ℚ) : Prop := | |
| 0 ≤ p.1 ∧ p.1 ≤ 28 ∧ | |
| 0 ≤ p.2 ∧ p.2 ≤ 14 | |
| def dist_sq (p q : ℚ × ℚ) : ℚ := | |
| (p.1 - q.1)^2 + (p.2 - q.2)^2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #![allow(nonstandard_style)] | |
| use std::{array, fmt::{Debug, Display}, i32, ops::{AddAssign, Deref, DerefMut, Index, IndexMut, Mul, SubAssign}, u64}; | |
| advent_of_code::solution!(10); | |
| pub fn part_one(input: &str) -> Option<u64> { | |
| let mut sum = 0; | |
| for line in input.lines() { | |
| let split: Vec<_> = line.split(" ").collect(); | |
| let mut chars = split[0].chars(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::{collections::HashMap, env::args, fs}; | |
| use num_bigint::BigInt; | |
| fn h0(s: &str) -> i32 { | |
| let mut h = 0i32; | |
| for b in s.bytes() { | |
| h = h.wrapping_mul(31).wrapping_add(b as i32); | |
| } |