Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct Node {
int value;
struct Node *next;
} Node;
typedef struct Circle {
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
use std::fs;
use std::io;
use std::str::FromStr;
#[derive(Debug, Clone)]
enum Pattern {
Char {
c: u8,
},
And {
use std::fs;
use std::io;
use std::str::FromStr;
#[derive(Debug, Clone)]
enum Pattern {
Char {
c: u8,
},
And {
use std::collections::{HashMap, HashSet};
use std::convert::Into;
use std::fs;
use std::io;
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
struct Point {
d: [i64; 4],
}
use std::collections::{HashMap, HashSet};
use std::convert::Into;
use std::fs;
use std::io;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
struct Point {
d: [i64; 4],
}
use std::io;
use regex::Regex;
use std::fs;
use std::str::FromStr;
use std::convert::Into;
use std::ops::RangeInclusive;
use std::collections::{HashMap, VecDeque};
type Ticket = Vec<u32>;
use std::io;
use std::fs;
use std::str::FromStr;
use std::convert::TryInto;
use std::collections::HashMap;
#[derive(Debug, Clone)]
enum Instruction {
Mask(u64, u64, u64),
Set(u64, u64),
@whiter4bbit
whiter4bbit / day4.rs
Last active December 4, 2020 14:05
AOC-2020: Day 4
use regex::Regex;
use std::io;
use std::ops::RangeInclusive;
use std::fs;
use std::collections::HashMap;
use std::str::FromStr;
fn match_re(re: &str, text: &str, captured_range: Option<RangeInclusive<i32>>) -> bool {
Regex::new(re).ok().and_then(|re|
use std::fs::File;
use std::io::{BufRead, BufReader, Result};
use std::collections::HashSet;
type Grid = (i32, isize, isize);
fn load_grid(path: &str) -> Result<Grid> {
let f = File::open(path)?;
let f = BufReader::new(f);