Skip to content

Instantly share code, notes, and snippets.

@dvolk
Last active December 1, 2021 14:42
Show Gist options
  • Select an option

  • Save dvolk/bcfa97c6e6777f18aba96bb2f3767d92 to your computer and use it in GitHub Desktop.

Select an option

Save dvolk/bcfa97c6e6777f18aba96bb2f3767d92 to your computer and use it in GitHub Desktop.
import itertools
def slide(xs, k=2):
xs = list(xs)
for i in range(len(xs) - k + 1):
yield xs[i : i + k]
print(
sum(
[
b > a
for a, b in itertools.pairwise(
[sum(y) for y in slide((map(int, open("input1").readlines())), k=3)]
)
]
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment