Browse Source

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

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

2
Cargo.toml

@ -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]

0
data/day1/input → data/day1

0
data/day10/input → data/day10

0
data/day11/input → data/day11

0
data/day12/input → data/day12

0
data/day13/input → data/day13

0
data/day14/input → data/day14

1
data/day15

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

0
data/day16/input → data/day16

0
data/day17/input → data/day17

0
data/day18/input → data/day18

0
data/day19/input → data/day19

0
data/day2/input → data/day2

0
data/day20/input → data/day20

0
data/day21/input → data/day21

0
data/day22/input → data/day22

1
data/day23

@ -0,0 +1 @@
315679824

0
data/day24/input → data/day24

0
data/day25/input → data/day25

0
data/day3/input → data/day3

0
data/day4/input → data/day4

0
data/day5/input → data/day5

0
data/day6/input → data/day6

0
data/day7/input → data/day7

0
data/day8/input → data/day8

0
data/day9/input → data/day9

2
src/bin/day1.rs

@ -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();

2
src/bin/day10.rs

@ -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] {

2
src/bin/day11.rs

@ -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 {

2
src/bin/day12.rs

@ -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 {

2
src/bin/day13.rs

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

2
src/bin/day14.rs

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

4
src/bin/day15.rs

@ -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);

2
src/bin/day16.rs

@ -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 {

2
src/bin/day17.rs

@ -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 {

2
src/bin/day18.rs

@ -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 {

2
src/bin/day19.rs

@ -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 {

2
src/bin/day2.rs

@ -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,

2
src/bin/day20.rs

@ -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 {

2
src/bin/day21.rs

@ -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>,

2
src/bin/day22.rs

@ -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();

6
src/bin/day23.rs

@ -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()

2
src/bin/day24.rs

@ -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 {

2
src/bin/day25.rs

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

2
src/bin/day3.rs

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

2
src/bin/day4/main.rs

@ -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);

2
src/bin/day5.rs

@ -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 {

2
src/bin/day6.rs

@ -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 {

2
src/bin/day7.rs

@ -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);

2
src/bin/day8.rs

@ -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 {

2
src/bin/day9.rs

@ -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