Skip to content

Commit 7edeaa4

Browse files
committed
add templates and day 1
1 parent 34d033a commit 7edeaa4

File tree

4 files changed

+244
-0
lines changed

4 files changed

+244
-0
lines changed

2020/Python/templates/load_input.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from pathlib import Path
2+
3+
4+
def get_input():
5+
input_file = Path(__file__).resolve().parent.parent.parent / "input.txt"
6+
with open(input_file, "r") as file:
7+
input_list = file.readlines()
8+
9+
lines = []
10+
for line in input_list:
11+
result = []
12+
for character in line.strip():
13+
result.append(character)
14+
lines.append(result)
15+
16+
return lines

2020/day_01/Python/empty.txt

Whitespace-only changes.

2020/day_01/input.txt

+201
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
1941
2+
1887
3+
1851
4+
1874
5+
1612
6+
1960
7+
1971
8+
1983
9+
1406
10+
1966
11+
1554
12+
1892
13+
1898
14+
1926
15+
1081
16+
1992
17+
1073
18+
1603
19+
177
20+
1747
21+
1063
22+
1969
23+
1659
24+
1303
25+
1759
26+
1853
27+
1107
28+
1818
29+
1672
30+
1352
31+
2002
32+
1838
33+
1985
34+
1860
35+
1141
36+
1903
37+
1334
38+
1489
39+
1178
40+
1823
41+
1499
42+
1951
43+
1225
44+
1503
45+
1417
46+
1724
47+
1165
48+
1339
49+
1816
50+
1504
51+
1588
52+
1997
53+
1946
54+
1324
55+
1771
56+
1982
57+
1272
58+
1367
59+
1439
60+
1252
61+
1902
62+
1940
63+
1333
64+
1750
65+
1512
66+
1538
67+
1168
68+
2001
69+
1797
70+
1233
71+
972
72+
1306
73+
1835
74+
1825
75+
1822
76+
1880
77+
1732
78+
1785
79+
1727
80+
1275
81+
1355
82+
1793
83+
1485
84+
1297
85+
1932
86+
1519
87+
1587
88+
1382
89+
1914
90+
1745
91+
1087
92+
1996
93+
1746
94+
1962
95+
1573
96+
2008
97+
1868
98+
1278
99+
1386
100+
1238
101+
1242
102+
1170
103+
1476
104+
1161
105+
1754
106+
1807
107+
1514
108+
1189
109+
1916
110+
1884
111+
1535
112+
1217
113+
1911
114+
1861
115+
1493
116+
1409
117+
1783
118+
1222
119+
1955
120+
1673
121+
1502
122+
607
123+
2010
124+
1846
125+
1819
126+
1500
127+
1799
128+
1475
129+
1146
130+
1608
131+
1806
132+
1660
133+
1618
134+
1904
135+
978
136+
1762
137+
1925
138+
1185
139+
1154
140+
1239
141+
1843
142+
1986
143+
533
144+
1509
145+
1913
146+
287
147+
1707
148+
1115
149+
1699
150+
1859
151+
1077
152+
1915
153+
1412
154+
1360
155+
1646
156+
1973
157+
1627
158+
1755
159+
1748
160+
1769
161+
1886
162+
1422
163+
1686
164+
950
165+
100
166+
1372
167+
1068
168+
1370
169+
1428
170+
1870
171+
1108
172+
190
173+
1891
174+
1794
175+
1228
176+
1128
177+
1365
178+
1740
179+
1888
180+
1460
181+
1758
182+
1906
183+
1917
184+
1989
185+
1251
186+
1866
187+
1560
188+
1921
189+
1777
190+
1102
191+
1850
192+
1498
193+
683
194+
1840
195+
1800
196+
1112
197+
1908
198+
1442
199+
1082
200+
1071
201+

2020/day_01/instructions_part1.txt

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--- Day 1: Report Repair ---
2+
3+
After saving Christmas five years in a row, you've decided to take a vacation at a nice resort on a tropical island. Surely, Christmas will go on without you.
4+
5+
The tropical island has its own currency and is entirely cash-only. The gold coins used there have a little picture of a starfish; the locals just call them stars. None of the currency exchanges seem to have heard of them, but somehow, you'll need to find fifty of these coins by the time you arrive so you can pay the deposit on your room.
6+
7+
To save your vacation, you need to get all fifty stars by December 25th.
8+
9+
Collect stars by solving puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants one star. Good luck!
10+
11+
Before you leave, the Elves in accounting just need you to fix your expense report (your puzzle input); apparently, something isn't quite adding up.
12+
13+
Specifically, they need you to find the two entries that sum to 2020 and then multiply those two numbers together.
14+
15+
For example, suppose your expense report contained the following:
16+
17+
1721
18+
979
19+
366
20+
299
21+
675
22+
1456
23+
24+
In this list, the two entries that sum to 2020 are 1721 and 299. Multiplying them together produces 1721 * 299 = 514579, so the correct answer is 514579.
25+
26+
Of course, your expense report is much larger. Find the two entries that sum to 2020; what do you get if you multiply them together?
27+

0 commit comments

Comments
 (0)