Skip to content

Instantly share code, notes, and snippets.

View icub3d's full-sized avatar

Joshua Marsh icub3d

  • Optum
  • USA
View GitHub Profile
@icub3d
icub3d / day07.rs
Created December 7, 2025 21:46
Solution for Advent of Code 2025 Day 7
use std::time::Instant;
use rustc_hash::{FxHashMap, FxHashSet};
const INPUT: &[u8] = include_bytes!("inputs/day07.txt");
const INPUT_STR: &str = include_str!("inputs/day07.txt");
fn parse(input: &str) -> Vec<Vec<char>> {
input.lines().map(|l| l.chars().collect()).collect()
}
@icub3d
icub3d / day06.rs
Created December 6, 2025 20:17
Solution for Advent of Code 2025 Day 6
use std::time::Instant;
// TODO we could read numbers from the right hand side of the "grid" and when we get an operator, we simply perform that operation on the stack of numbers and then add it to our total.
// This would involve p1 being different. We just have a vec of iterators of all the "numbers" and "operators" and solve one column at a time.
const INPUT: &[u8] = include_bytes!("inputs/day06.txt");
#[derive(Debug)]
enum Operator {
Add,
@icub3d
icub3d / nastyhacks.rs
Created December 5, 2025 19:43
Kattis nastyhacks
use std::{
cmp::Ordering,
io::{Read, stdin},
};
fn main() {
let mut s = String::new();
stdin().read_to_string(&mut s).unwrap();
for m in s.lines().skip(1) {
@icub3d
icub3d / leftbeehind.rs
Created December 5, 2025 19:43
Kattis leftbeehind
use std::io::{Read, stdin};
fn main() {
let mut s = String::new();
stdin().read_to_string(&mut s).unwrap();
for m in s.lines() {
if m == "0 0" {
break;
}
@icub3d
icub3d / helpaphd.rs
Created December 5, 2025 19:43
Kattis helpaphd
use std::io::{Read, stdin};
fn main() {
let mut s = String::new();
stdin().read_to_string(&mut s).unwrap();
for m in s.lines().skip(1) {
if m == "P=NP" {
println!("skipped");
continue;
@icub3d
icub3d / eligibility.rs
Created December 5, 2025 19:43
Kattis eligibility
use std::io::{Read, stdin};
fn main() {
let mut s = String::new();
stdin().read_to_string(&mut s).unwrap();
for m in s.lines().skip(1) {
let pp = m.split_whitespace().collect::<Vec<_>>();
let (name, studies, dob, courses) = (
pp[0],
@icub3d
icub3d / oddities.rs
Created December 5, 2025 19:43
Kattis oddities
use std::io::{Read, stdin};
fn main() {
let mut s = String::new();
stdin().read_to_string(&mut s).unwrap();
for m in s.lines().skip(1).map(|l| l.parse::<isize>().unwrap()) {
if m % 2 == 0 {
println!("{m} is even");
} else {
@icub3d
icub3d / temperature.rs
Created December 5, 2025 19:43
Kattis temperature
use std::io::{Read, stdin};
fn main() {
let mut s = String::new();
stdin().read_to_string(&mut s).unwrap();
let (x, y) = s.trim().split_once(' ').unwrap();
let (x, y) = (x.parse::<f32>().unwrap(), y.parse::<f32>().unwrap());
// n = n*y + x
// 0 = yn - n + x
@icub3d
icub3d / quadrant.rs
Created December 5, 2025 19:43
Kattis quadrant
use std::{
cmp::Ordering,
io::{Read, stdin},
};
fn main() {
let mut s = String::new();
stdin().read_to_string(&mut s).unwrap();
let mut s = s.lines();
@icub3d
icub3d / day05.rs
Created December 5, 2025 15:59
Solution for Advent of Code 2025 Day 5
use std::{ops::RangeInclusive, time::Instant};
const INPUT: &str = include_str!("inputs/day05.txt");
fn parse(input: &str) -> (Vec<RangeInclusive<usize>>, impl Iterator<Item = usize>) {
let (ranges, ingredients) = input.split_once("\n\n").unwrap();
// Collect our ranges.
let ranges = ranges
.lines()