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::time::Instant; | |
| const INPUT: &str = include_str!("inputs/day09.txt"); | |
| fn parse(input: &str) -> &str { | |
| input.trim() | |
| } | |
| fn p1(input: &str) -> usize { | |
| let input = parse(input); |
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::time::Instant; | |
| use rustc_hash::FxHashMap; | |
| const INPUT: &str = include_str!("inputs/day08.txt"); | |
| enum Modifier { | |
| Increment(isize), | |
| Decrement(isize), | |
| } |
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::time::Instant; | |
| use rustc_hash::{FxHashMap, FxHashSet}; | |
| const INPUT: &str = include_str!("inputs/day07.txt"); | |
| #[derive(Clone)] | |
| struct Program<'a> { | |
| weight: isize, | |
| total_weight: isize, |
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::time::Instant; | |
| use rustc_hash::{FxHashMap, FxHashSet}; | |
| const INPUT: &str = include_str!("inputs/day06.txt"); | |
| fn parse(input: &str) -> Vec<usize> { | |
| input | |
| .split_whitespace() | |
| .map(|v| v.parse::<usize>().unwrap()) |
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::io::{Read, stdin}; | |
| fn main() { | |
| let mut s = String::new(); | |
| stdin().read_to_string(&mut s).unwrap(); | |
| let mut ss = s.lines(); | |
| let have = ss | |
| .next() | |
| .unwrap() |
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::io::{Read, stdin}; | |
| fn main() { | |
| let mut s = String::new(); | |
| stdin().read_to_string(&mut s).unwrap(); | |
| let mut ss = s.lines(); | |
| while let Some(n) = ss.next() { | |
| if n == "0" { |
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::io::{Read, stdin}; | |
| fn main() { | |
| let mut s = String::new(); | |
| stdin().read_to_string(&mut s).unwrap(); | |
| let nn = s.lines().skip(1).map(|n| n.parse::<usize>().unwrap()); | |
| let mut exp = 1; | |
| let mut missed = false; |
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::io::{Read, stdin}; | |
| fn main() { | |
| let mut s = String::new(); | |
| stdin().read_to_string(&mut s).unwrap(); | |
| let mut ss = s.split_whitespace().map(|v| v.parse::<isize>().unwrap()); | |
| let (x0, y0, x1, y1, t) = ( | |
| ss.next().unwrap(), |
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::io::{Read, stdin}; | |
| fn main() { | |
| let mut s = String::new(); | |
| stdin().read_to_string(&mut s).unwrap(); | |
| let mut ss = s.lines(); | |
| let mut ff = ss | |
| .next() |
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::io::{Read, stdin}; | |
| fn main() { | |
| let mut s = String::new(); | |
| stdin().read_to_string(&mut s).unwrap(); | |
| let s = s.trim().as_bytes(); | |
| let mut i = 0; | |
| while i < s.len() { | |
| if i + 2 < s.len() && (s[i] != s[i + 1] && s[i + 1] != s[i + 2] && s[i] != s[i + 2]) { |
NewerOlder