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 / day05.rs
Created January 21, 2026 18:18
Solution for Advent of Code 2017 Day 5
use std::time::Instant;
const INPUT: &str = include_str!("inputs/day05.txt");
fn parse(input: &str) -> Vec<isize> {
input.lines().map(|l| l.parse::<isize>().unwrap()).collect()
}
fn p1(input: &str) -> usize {
let mut input = parse(input);
@icub3d
icub3d / day04.rs
Created January 21, 2026 18:18
Solution for Advent of Code 2017 Day 4
use std::time::Instant;
use rustc_hash::FxHashSet;
const INPUT: &str = include_str!("inputs/day04.txt");
fn parse(input: &str) -> impl Iterator<Item = Vec<&str>> {
input.lines().map(|l| l.split_whitespace().collect())
}
@icub3d
icub3d / vote.rs
Created January 20, 2026 16:17
Kattis vote
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 t = ss.next().unwrap().parse::<usize>().unwrap();
@icub3d
icub3d / peasoup.rs
Created January 20, 2026 16:17
Kattis peasoup
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 n = ss.next().unwrap().parse::<usize>().unwrap();
@icub3d
icub3d / driversdilemma.rs
Created January 20, 2026 16:17
Kattis driversdilemma
use std::io::{Read, stdin};
fn main() {
let mut s = String::new();
stdin().read_to_string(&mut s).unwrap();
let mut lines = s.lines();
let mut pp = lines
.next()
@icub3d
icub3d / deathtaxes.rs
Created January 20, 2026 16:17
Kattis deathtaxes
use std::io::{Read, stdin};
fn main() {
let mut s = String::new();
stdin().read_to_string(&mut s).unwrap();
let mut shares = 0.0f64;
let mut avg = 0.0f64;
for m in s.lines() {
@icub3d
icub3d / climbingstairs.rs
Created January 20, 2026 16:17
Kattis climbingstairs
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 n = ss.next().unwrap();
let r = ss.next().unwrap();
let k = ss.next().unwrap();
@icub3d
icub3d / boundingrobots.rs
Created January 20, 2026 16:17
Kattis boundingrobots
use std::io::{Read, stdin};
fn main() {
let mut s = String::new();
stdin().read_to_string(&mut s).unwrap();
let mut lines = s.lines();
while let Some(l) = lines.next() {
if l == "0 0" {
@icub3d
icub3d / bossbattle.rs
Created January 20, 2026 16:17
Kattis bossbattle
use std::io::{Read, stdin};
fn main() {
let mut s = String::new();
stdin().read_to_string(&mut s).unwrap();
let n = s.trim().parse::<i32>().unwrap();
// <= 3 == 1
println!("{}", (n - 2).max(1));
@icub3d
icub3d / day03.rs
Created January 17, 2026 22:55
Solution for Advent of Code 2017 Day 3
use std::time::Instant;
use itertools::Itertools;
use rustc_hash::FxHashMap;
const INPUT: &str = include_str!("inputs/day03.txt");
fn parse(input: &str) -> usize {
input.trim().parse::<usize>().unwrap()
}