Solutions for problems in Advent of Code 2020: https://adventofcode.com/2020
Constraints used:
- Everything in base R, i.e. no loading of packages;
- Exception: day 13 uses
as.bigz,divq.bigz, andmod.bigzfromgmpfor modular arithmetic with integers too large for base R's%/%and%%to cope with. I must still write my own implementations of GCD and modular multiplicative inverse, instead of usinggcd.bigzandgcdex.
- Exception: day 13 uses
- No regex.
I started out writing for brevity/clarity rather than execution speed, but this would have lead to very long running times for some of the later days.
Some days have two scripts:
- the "short" one focuses on brevity / ease of reading;
- the "quick" one focuses on fast execution.