Skip to content

Instantly share code, notes, and snippets.

@FeepingCreature
Created December 1, 2021 13:49
Show Gist options
  • Save FeepingCreature/3c86901efb7fef5a6ab6d49d9e798090 to your computer and use it in GitHub Desktop.
Save FeepingCreature/3c86901efb7fef5a6ab6d49d9e798090 to your computer and use it in GitHub Desktop.
module day1;
macro import neat.macros.listcomprehension;
import std.stdio;
import std.file;
import std.string;
void main() {
[depth.atoi for depth in "day1.txt".readText.split("\n")]
.([(depth, that[i + 1]) for i, depth in that[0 .. $ - 1]])
.([count pair in that where pair[0] < pair[1]])
.(print("$that increases."));
}
@dvolk
Copy link

dvolk commented Dec 1, 2021

import itertools
print(sum([b > a for a, b in itertools.pairwise(map(int, open("input1").readlines()))]))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment