Browse Source

reorganize data files, use data files for all days (even when not provided as download)

master
Stefan Bühler 2 months ago
parent
commit
5215f3bb5f
51 changed files with 30 additions and 30 deletions
  1. +0
    -2
      Cargo.toml
  2. +0
    -0
      data/day1
  3. +0
    -0
      data/day10
  4. +0
    -0
      data/day11
  5. +0
    -0
      data/day12
  6. +0
    -0
      data/day13
  7. +0
    -0
      data/day14
  8. +1
    -0
      data/day15
  9. +0
    -0
      data/day16
  10. +0
    -0
      data/day17
  11. +0
    -0
      data/day18
  12. +0
    -0
      data/day19
  13. +0
    -0
      data/day2
  14. +0
    -0
      data/day20
  15. +0
    -0
      data/day21
  16. +0
    -0
      data/day22
  17. +1
    -0
      data/day23
  18. +0
    -0
      data/day24
  19. +0
    -0
      data/day25
  20. +0
    -0
      data/day3
  21. +0
    -0
      data/day4
  22. +0
    -0
      data/day5
  23. +0
    -0
      data/day6
  24. +0
    -0
      data/day7
  25. +0
    -0
      data/day8
  26. +0
    -0
      data/day9
  27. +1
    -1
      src/bin/day1.rs
  28. +1
    -1
      src/bin/day10.rs
  29. +1
    -1
      src/bin/day11.rs
  30. +1
    -1
      src/bin/day12.rs
  31. +1
    -1
      src/bin/day13.rs
  32. +1
    -1
      src/bin/day14.rs
  33. +2
    -2
      src/bin/day15.rs
  34. +1
    -1
      src/bin/day16.rs
  35. +1
    -1
      src/bin/day17.rs
  36. +1
    -1
      src/bin/day18.rs
  37. +1
    -1
      src/bin/day19.rs
  38. +1
    -1
      src/bin/day2.rs
  39. +1
    -1
      src/bin/day20.rs
  40. +1
    -1
      src/bin/day21.rs
  41. +1
    -1
      src/bin/day22.rs
  42. +3
    -3
      src/bin/day23.rs
  43. +1
    -1
      src/bin/day24.rs
  44. +1
    -1
      src/bin/day25.rs
  45. +1
    -1
      src/bin/day3.rs
  46. +1
    -1
      src/bin/day4/main.rs
  47. +1
    -1
      src/bin/day5.rs
  48. +1
    -1
      src/bin/day6.rs
  49. +1
    -1
      src/bin/day7.rs
  50. +1
    -1
      src/bin/day8.rs
  51. +1
    -1
      src/bin/day9.rs

+ 0
- 2
Cargo.toml View File

@ -4,6 +4,4 @@ version = "0.1.0"
authors = ["Stefan Bühler <stbuehler@web.de>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

data/day1/input → data/day1 View File


data/day10/input → data/day10 View File


data/day11/input → data/day11 View File


data/day12/input → data/day12 View File


data/day13/input → data/day13 View File


data/day14/input → data/day14 View File


+ 1
- 0
data/day15 View File

@ -0,0 +1 @@
5,2,8,16,18,0,1

data/day16/input → data/day16 View File


data/day17/input → data/day17 View File


data/day18/input → data/day18 View File


data/day19/input → data/day19 View File


data/day2/input → data/day2 View File


data/day20/input → data/day20 View File


data/day21/input → data/day21 View File


data/day22/input → data/day22 View File


+ 1
- 0
data/day23 View File

@ -0,0 +1 @@
315679824

data/day24/input → data/day24 View File


data/day25/input → data/day25 View File


data/day3/input → data/day3 View File


data/day4/input → data/day4 View File


data/day5/input → data/day5 View File


data/day6/input → data/day6 View File


data/day7/input → data/day7 View File


data/day8/input → data/day8 View File


data/day9/input → data/day9 View File


+ 1
- 1
src/bin/day1.rs View File

@ -1,4 +1,4 @@
const INPUT: &str = include_str!("../../data/day1/input");
const INPUT: &str = include_str!("../../data/day1");
fn main() {
let expenses: Vec<_> = INPUT.split_whitespace().map(|s| s.parse::<u32>().unwrap()).collect();


+ 1
- 1
src/bin/day10.rs View File

@ -1,4 +1,4 @@
const INPUT: &str = include_str!("../../data/day10/input");
const INPUT: &str = include_str!("../../data/day10");
fn calc(input: &[u32], cache: &mut [Option<u64>], ndx: usize) -> u64 {
if let Some(n) = cache[ndx] {


+ 1
- 1
src/bin/day11.rs View File

@ -1,4 +1,4 @@
const INPUT: &str = include_str!("../../data/day11/input");
const INPUT: &str = include_str!("../../data/day11");
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
enum Cell {


+ 1
- 1
src/bin/day12.rs View File

@ -1,4 +1,4 @@
const INPUT: &str = include_str!("../../data/day12/input");
const INPUT: &str = include_str!("../../data/day12");
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
enum Rotate {


+ 1
- 1
src/bin/day13.rs View File

@ -1,4 +1,4 @@
const INPUT: &str = include_str!("../../data/day13/input");
const INPUT: &str = include_str!("../../data/day13");
struct Input {
now: i128,


+ 1
- 1
src/bin/day14.rs View File

@ -1,4 +1,4 @@
const INPUT: &str = include_str!("../../data/day14/input");
const INPUT: &str = include_str!("../../data/day14");
use std::collections::HashMap;


+ 2
- 2
src/bin/day15.rs View File

@ -1,6 +1,6 @@
use std::collections::HashMap;
const INPUT: &str = "5,2,8,16,18,0,1";
const INPUT: &str = include_str!("../../data/day15");
struct Memory {
turn: usize,
@ -27,7 +27,7 @@ impl Memory {
}
fn main() {
let input: Vec<usize> = INPUT.split(",").map(|s| s.parse().unwrap()).collect();
let input: Vec<usize> = INPUT.trim().split(",").map(|s| s.parse().unwrap()).collect();
let mut mem = Memory::new();
for &value in &input {
mem.remember(value);


+ 1
- 1
src/bin/day16.rs View File

@ -1,7 +1,7 @@
use std::ops::RangeInclusive;
use std::collections::{HashSet, HashMap};
const INPUT: &str = include_str!("../../data/day16/input");
const INPUT: &str = include_str!("../../data/day16");
#[derive(Clone, Debug)]
struct Field {


+ 1
- 1
src/bin/day17.rs View File

@ -1,6 +1,6 @@
use std::ops::Range;
const INPUT: &str = include_str!("../../data/day17/input");
const INPUT: &str = include_str!("../../data/day17");
#[derive(Clone, Copy, Default)]
struct Dimension {


+ 1
- 1
src/bin/day18.rs View File

@ -1,4 +1,4 @@
const INPUT: &str = include_str!("../../data/day18/input");
const INPUT: &str = include_str!("../../data/day18");
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
enum Op {


+ 1
- 1
src/bin/day19.rs View File

@ -1,7 +1,7 @@
use std::collections::{HashMap, HashSet};
use std::sync::Arc;
const INPUT: &str = include_str!("../../data/day19/input");
const INPUT: &str = include_str!("../../data/day19");
#[derive(Clone, Debug)]
enum Rule {


+ 1
- 1
src/bin/day2.rs View File

@ -1,6 +1,6 @@
use std::convert::TryInto;
const INPUT: &str = include_str!("../../data/day2/input");
const INPUT: &str = include_str!("../../data/day2");
struct Policy {
min: usize,


+ 1
- 1
src/bin/day20.rs View File

@ -1,6 +1,6 @@
use std::collections::HashMap;
const INPUT: &str = include_str!("../../data/day20/input");
const INPUT: &str = include_str!("../../data/day20");
#[derive(Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash, Debug)]
enum Side {


+ 1
- 1
src/bin/day21.rs View File

@ -1,6 +1,6 @@
use std::collections::{BTreeMap, HashMap, HashSet};
const INPUT: &str = include_str!("../../data/day21/input");
const INPUT: &str = include_str!("../../data/day21");
struct FoodDescription<'a> {
ingredients: HashSet<&'a str>,


+ 1
- 1
src/bin/day22.rs View File

@ -2,7 +2,7 @@ use std::collections::{VecDeque, HashSet};
type Deck = VecDeque<u32>;
const INPUT: &str = include_str!("../../data/day22/input");
const INPUT: &str = include_str!("../../data/day22");
fn parse_player(block: &str) -> (u32, Deck) {
let block = block.strip_prefix("Player ").unwrap();


+ 3
- 3
src/bin/day23.rs View File

@ -1,6 +1,6 @@
use std::mem::replace;
const INPUT: &str = "315679824";
const INPUT: &str = include_str!("../../data/day23");
type Item = usize;
@ -200,14 +200,14 @@ impl Cups {
}
fn main() {
let mut cups = Cups::parse(INPUT);
let mut cups = Cups::parse(INPUT.trim());
for _ in 0..100 {
cups.mix();
}
cups.rotate_to_one();
println!("Cups: {}", cups.iter().skip(1).map(|c| format!("{}", c)).collect::<Vec<_>>().join(""));
let mut cups = Cups::parse(INPUT);
let mut cups = Cups::parse(INPUT.trim());
cups.extend(10..=1000000);
for _ in 0..10000000 {
cups.mix()


+ 1
- 1
src/bin/day24.rs View File

@ -1,6 +1,6 @@
use std::collections::HashSet;
const INPUT: &str = include_str!("../../data/day24/input");
const INPUT: &str = include_str!("../../data/day24");
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
enum Direction {


+ 1
- 1
src/bin/day25.rs View File

@ -1,4 +1,4 @@
const INPUT: &str = include_str!("../../data/day25/input");
const INPUT: &str = include_str!("../../data/day25");
const MOD: u32 = 20201227;


+ 1
- 1
src/bin/day3.rs View File

@ -1,4 +1,4 @@
const INPUT: &str = include_str!("../../data/day3/input");
const INPUT: &str = include_str!("../../data/day3");
struct Forest {
pub rows: usize,


+ 1
- 1
src/bin/day4/main.rs View File

@ -2,7 +2,7 @@ pub mod passport;
use passport::Passport;
const INPUT: &str = include_str!("../../../data/day4/input");
const INPUT: &str = include_str!("../../../data/day4");
fn main() {
let passports = Passport::parse_list(INPUT);


+ 1
- 1
src/bin/day5.rs View File

@ -1,4 +1,4 @@
const INPUT: &str = include_str!("../../data/day5/input");
const INPUT: &str = include_str!("../../data/day5");
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)]
struct Seat {


+ 1
- 1
src/bin/day6.rs View File

@ -1,4 +1,4 @@
const INPUT: &str = include_str!("../../data/day6/input");
const INPUT: &str = include_str!("../../data/day6");
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)]
struct Answers {


+ 1
- 1
src/bin/day7.rs View File

@ -1,6 +1,6 @@
use std::collections::{HashMap, HashSet, VecDeque};
const INPUT: &str = include_str!("../../data/day7/input");
const INPUT: &str = include_str!("../../data/day7");
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
struct BagId(usize);


+ 1
- 1
src/bin/day8.rs View File

@ -1,4 +1,4 @@
const INPUT: &str = include_str!("../../data/day8/input");
const INPUT: &str = include_str!("../../data/day8");
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
enum Instruction {


+ 1
- 1
src/bin/day9.rs View File

@ -1,4 +1,4 @@
const INPUT: &str = include_str!("../../data/day9/input");
const INPUT: &str = include_str!("../../data/day9");
// store sums of elems in different row and colum, but just once
// | 0 | 1 | 2 | 3 | ...


Loading…
Cancel
Save