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 / day09.rs
Created January 30, 2026 01:44
Solution for Advent of Code 2017 Day 9
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);
@icub3d
icub3d / day08.rs
Created January 30, 2026 01:02
Solution for Advent of Code 2017 Day 8
use std::time::Instant;
use rustc_hash::FxHashMap;
const INPUT: &str = include_str!("inputs/day08.txt");
enum Modifier {
Increment(isize),
Decrement(isize),
}
@icub3d
icub3d / day07.rs
Created January 30, 2026 00:23
Solution for Advent of Code 2017 Day 7
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,
@icub3d
icub3d / day06.rs
Created January 30, 2026 00:19
Solution for Advent of Code 2017 Day 6
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())
@icub3d
icub3d / sok.rs
Created January 29, 2026 20:09
Kattis sok
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()
@icub3d
icub3d / prerequisites.rs
Last active January 29, 2026 20:09
Kattis prerequisites
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" {
@icub3d
icub3d / missingnumbers.rs
Created January 29, 2026 20:09
Kattis missingnumbers
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;
@icub3d
icub3d / exactlyelectrical.rs
Created January 29, 2026 20:09
Kattis exactlyelectrical
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(),
@icub3d
icub3d / eventplanning.rs
Created January 29, 2026 20:09
Kattis eventplanning
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()
@icub3d
icub3d / battlesimulation.rs
Created January 29, 2026 20:09
Kattis battlesimulation
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]) {