# Re: [tlaplus] Help with Advent of Code day 01


On 08.12.20 22:19, migu...@xxxxxxxxxxxxxxxx wrote:


Hello all!

This is my first attempt at seriuosly using PlusCal, and I'm trying to solve some small problems to warm up. I tried solving the first Advent of Code problem, but my PlusCal is quite rough.
Any help ?
The problem is, given a list, find 2 numbers that sum to 2020.

---- MODULE pcal ----
EXTENDS TLC, Integers, FiniteSets, Sequences

(*--algorithm pcal
variables
Sum = 2020,
Input = <<
1511,
1112,
1958,
1778,
1769,
1946,
1800,
1911,
1821,
1886,
285,
1649,
1952,
1428,
1779,
1822,
1735

;


begin
with x \in Input do
with y \in Input \ {x} do
assert x + y = Sum;
end with;
end with; end algorithm; *)


Hi,


although TLA+ and not PlusCal, it perhaps helps to study the solutions of Arnaud Bos [1] and Thomas Bracher [2].

Markus

[1] https://github.com/arnaudbos/aoc2020-tla-plus/tree/master/day1