Initial commit
This commit is contained in:
commit
5cf45c0a8f
16 changed files with 5521 additions and 0 deletions
200
Day 1/One/input
Normal file
200
Day 1/One/input
Normal file
|
@ -0,0 +1,200 @@
|
||||||
|
1429
|
||||||
|
1368
|
||||||
|
1661
|
||||||
|
1687
|
||||||
|
1593
|
||||||
|
1495
|
||||||
|
1565
|
||||||
|
1500
|
||||||
|
1635
|
||||||
|
1845
|
||||||
|
1645
|
||||||
|
1999
|
||||||
|
1415
|
||||||
|
1054
|
||||||
|
1930
|
||||||
|
1774
|
||||||
|
1405
|
||||||
|
1993
|
||||||
|
1757
|
||||||
|
1623
|
||||||
|
1675
|
||||||
|
1665
|
||||||
|
631
|
||||||
|
1950
|
||||||
|
1702
|
||||||
|
1311
|
||||||
|
1509
|
||||||
|
1790
|
||||||
|
1643
|
||||||
|
1884
|
||||||
|
226
|
||||||
|
1455
|
||||||
|
1679
|
||||||
|
1746
|
||||||
|
1284
|
||||||
|
1342
|
||||||
|
1684
|
||||||
|
1543
|
||||||
|
1396
|
||||||
|
1806
|
||||||
|
1523
|
||||||
|
1363
|
||||||
|
1011
|
||||||
|
1577
|
||||||
|
1767
|
||||||
|
1287
|
||||||
|
1885
|
||||||
|
1517
|
||||||
|
1556
|
||||||
|
1722
|
||||||
|
1260
|
||||||
|
1624
|
||||||
|
1466
|
||||||
|
1263
|
||||||
|
1162
|
||||||
|
1688
|
||||||
|
1202
|
||||||
|
1913
|
||||||
|
1964
|
||||||
|
1385
|
||||||
|
1970
|
||||||
|
1976
|
||||||
|
1431
|
||||||
|
858
|
||||||
|
1748
|
||||||
|
1544
|
||||||
|
1438
|
||||||
|
1300
|
||||||
|
1926
|
||||||
|
1587
|
||||||
|
1376
|
||||||
|
1939
|
||||||
|
1039
|
||||||
|
1639
|
||||||
|
1539
|
||||||
|
1491
|
||||||
|
1631
|
||||||
|
1521
|
||||||
|
1564
|
||||||
|
1507
|
||||||
|
1637
|
||||||
|
1534
|
||||||
|
1713
|
||||||
|
1533
|
||||||
|
1118
|
||||||
|
1356
|
||||||
|
2003
|
||||||
|
282
|
||||||
|
1079
|
||||||
|
1837
|
||||||
|
1259
|
||||||
|
1941
|
||||||
|
1836
|
||||||
|
1903
|
||||||
|
1433
|
||||||
|
1467
|
||||||
|
1027
|
||||||
|
1441
|
||||||
|
1048
|
||||||
|
1742
|
||||||
|
1087
|
||||||
|
1872
|
||||||
|
1476
|
||||||
|
1657
|
||||||
|
1361
|
||||||
|
1182
|
||||||
|
1494
|
||||||
|
1529
|
||||||
|
1822
|
||||||
|
1444
|
||||||
|
1330
|
||||||
|
1514
|
||||||
|
1723
|
||||||
|
1432
|
||||||
|
1683
|
||||||
|
1997
|
||||||
|
1443
|
||||||
|
1474
|
||||||
|
1932
|
||||||
|
1504
|
||||||
|
1313
|
||||||
|
1765
|
||||||
|
19
|
||||||
|
1784
|
||||||
|
1619
|
||||||
|
992
|
||||||
|
1560
|
||||||
|
1680
|
||||||
|
1626
|
||||||
|
1558
|
||||||
|
1899
|
||||||
|
1293
|
||||||
|
1676
|
||||||
|
1161
|
||||||
|
1140
|
||||||
|
1341
|
||||||
|
1597
|
||||||
|
1628
|
||||||
|
1611
|
||||||
|
1302
|
||||||
|
1269
|
||||||
|
1241
|
||||||
|
1952
|
||||||
|
1591
|
||||||
|
1726
|
||||||
|
428
|
||||||
|
1703
|
||||||
|
1289
|
||||||
|
1109
|
||||||
|
1478
|
||||||
|
1002
|
||||||
|
1817
|
||||||
|
1849
|
||||||
|
1838
|
||||||
|
1319
|
||||||
|
1641
|
||||||
|
583
|
||||||
|
1920
|
||||||
|
1453
|
||||||
|
1411
|
||||||
|
1870
|
||||||
|
1763
|
||||||
|
1469
|
||||||
|
1646
|
||||||
|
1719
|
||||||
|
1213
|
||||||
|
1462
|
||||||
|
1545
|
||||||
|
1682
|
||||||
|
1711
|
||||||
|
18
|
||||||
|
2004
|
||||||
|
1252
|
||||||
|
1620
|
||||||
|
1559
|
||||||
|
1315
|
||||||
|
781
|
||||||
|
1656
|
||||||
|
1987
|
||||||
|
1436
|
||||||
|
1630
|
||||||
|
1985
|
||||||
|
1897
|
||||||
|
1551
|
||||||
|
1296
|
||||||
|
1282
|
||||||
|
1735
|
||||||
|
1320
|
||||||
|
1659
|
||||||
|
1271
|
||||||
|
1380
|
||||||
|
1274
|
||||||
|
1876
|
||||||
|
1492
|
||||||
|
1298
|
||||||
|
1399
|
||||||
|
1692
|
||||||
|
1265
|
||||||
|
1555
|
||||||
|
1337
|
10
Day 1/One/solution.py
Executable file
10
Day 1/One/solution.py
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/python
|
||||||
|
|
||||||
|
with open("input", 'r') as input:
|
||||||
|
lines = [x.strip() for x in input.readlines()]
|
||||||
|
for x in lines:
|
||||||
|
x = int(x)
|
||||||
|
for y in lines:
|
||||||
|
y = int(y)
|
||||||
|
if x + y == 2020:
|
||||||
|
print(f"Found solution: x: {x}, y: {y}, result: {x*y}")
|
200
Day 1/Two/input
Normal file
200
Day 1/Two/input
Normal file
|
@ -0,0 +1,200 @@
|
||||||
|
1429
|
||||||
|
1368
|
||||||
|
1661
|
||||||
|
1687
|
||||||
|
1593
|
||||||
|
1495
|
||||||
|
1565
|
||||||
|
1500
|
||||||
|
1635
|
||||||
|
1845
|
||||||
|
1645
|
||||||
|
1999
|
||||||
|
1415
|
||||||
|
1054
|
||||||
|
1930
|
||||||
|
1774
|
||||||
|
1405
|
||||||
|
1993
|
||||||
|
1757
|
||||||
|
1623
|
||||||
|
1675
|
||||||
|
1665
|
||||||
|
631
|
||||||
|
1950
|
||||||
|
1702
|
||||||
|
1311
|
||||||
|
1509
|
||||||
|
1790
|
||||||
|
1643
|
||||||
|
1884
|
||||||
|
226
|
||||||
|
1455
|
||||||
|
1679
|
||||||
|
1746
|
||||||
|
1284
|
||||||
|
1342
|
||||||
|
1684
|
||||||
|
1543
|
||||||
|
1396
|
||||||
|
1806
|
||||||
|
1523
|
||||||
|
1363
|
||||||
|
1011
|
||||||
|
1577
|
||||||
|
1767
|
||||||
|
1287
|
||||||
|
1885
|
||||||
|
1517
|
||||||
|
1556
|
||||||
|
1722
|
||||||
|
1260
|
||||||
|
1624
|
||||||
|
1466
|
||||||
|
1263
|
||||||
|
1162
|
||||||
|
1688
|
||||||
|
1202
|
||||||
|
1913
|
||||||
|
1964
|
||||||
|
1385
|
||||||
|
1970
|
||||||
|
1976
|
||||||
|
1431
|
||||||
|
858
|
||||||
|
1748
|
||||||
|
1544
|
||||||
|
1438
|
||||||
|
1300
|
||||||
|
1926
|
||||||
|
1587
|
||||||
|
1376
|
||||||
|
1939
|
||||||
|
1039
|
||||||
|
1639
|
||||||
|
1539
|
||||||
|
1491
|
||||||
|
1631
|
||||||
|
1521
|
||||||
|
1564
|
||||||
|
1507
|
||||||
|
1637
|
||||||
|
1534
|
||||||
|
1713
|
||||||
|
1533
|
||||||
|
1118
|
||||||
|
1356
|
||||||
|
2003
|
||||||
|
282
|
||||||
|
1079
|
||||||
|
1837
|
||||||
|
1259
|
||||||
|
1941
|
||||||
|
1836
|
||||||
|
1903
|
||||||
|
1433
|
||||||
|
1467
|
||||||
|
1027
|
||||||
|
1441
|
||||||
|
1048
|
||||||
|
1742
|
||||||
|
1087
|
||||||
|
1872
|
||||||
|
1476
|
||||||
|
1657
|
||||||
|
1361
|
||||||
|
1182
|
||||||
|
1494
|
||||||
|
1529
|
||||||
|
1822
|
||||||
|
1444
|
||||||
|
1330
|
||||||
|
1514
|
||||||
|
1723
|
||||||
|
1432
|
||||||
|
1683
|
||||||
|
1997
|
||||||
|
1443
|
||||||
|
1474
|
||||||
|
1932
|
||||||
|
1504
|
||||||
|
1313
|
||||||
|
1765
|
||||||
|
19
|
||||||
|
1784
|
||||||
|
1619
|
||||||
|
992
|
||||||
|
1560
|
||||||
|
1680
|
||||||
|
1626
|
||||||
|
1558
|
||||||
|
1899
|
||||||
|
1293
|
||||||
|
1676
|
||||||
|
1161
|
||||||
|
1140
|
||||||
|
1341
|
||||||
|
1597
|
||||||
|
1628
|
||||||
|
1611
|
||||||
|
1302
|
||||||
|
1269
|
||||||
|
1241
|
||||||
|
1952
|
||||||
|
1591
|
||||||
|
1726
|
||||||
|
428
|
||||||
|
1703
|
||||||
|
1289
|
||||||
|
1109
|
||||||
|
1478
|
||||||
|
1002
|
||||||
|
1817
|
||||||
|
1849
|
||||||
|
1838
|
||||||
|
1319
|
||||||
|
1641
|
||||||
|
583
|
||||||
|
1920
|
||||||
|
1453
|
||||||
|
1411
|
||||||
|
1870
|
||||||
|
1763
|
||||||
|
1469
|
||||||
|
1646
|
||||||
|
1719
|
||||||
|
1213
|
||||||
|
1462
|
||||||
|
1545
|
||||||
|
1682
|
||||||
|
1711
|
||||||
|
18
|
||||||
|
2004
|
||||||
|
1252
|
||||||
|
1620
|
||||||
|
1559
|
||||||
|
1315
|
||||||
|
781
|
||||||
|
1656
|
||||||
|
1987
|
||||||
|
1436
|
||||||
|
1630
|
||||||
|
1985
|
||||||
|
1897
|
||||||
|
1551
|
||||||
|
1296
|
||||||
|
1282
|
||||||
|
1735
|
||||||
|
1320
|
||||||
|
1659
|
||||||
|
1271
|
||||||
|
1380
|
||||||
|
1274
|
||||||
|
1876
|
||||||
|
1492
|
||||||
|
1298
|
||||||
|
1399
|
||||||
|
1692
|
||||||
|
1265
|
||||||
|
1555
|
||||||
|
1337
|
12
Day 1/Two/solution.py
Executable file
12
Day 1/Two/solution.py
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/python
|
||||||
|
|
||||||
|
with open("input", 'r') as input:
|
||||||
|
lines = [x.strip() for x in input.readlines()]
|
||||||
|
for x in lines:
|
||||||
|
x = int(x)
|
||||||
|
for y in lines:
|
||||||
|
y = int(y)
|
||||||
|
for z in lines:
|
||||||
|
z = int(z)
|
||||||
|
if x + y + z == 2020:
|
||||||
|
print(f"Found solution: x: {x}, y: {y}, z: {z}, result: {x*y*z}")
|
1000
Day 2/One/input
Normal file
1000
Day 2/One/input
Normal file
File diff suppressed because it is too large
Load diff
18
Day 2/One/main.py
Executable file
18
Day 2/One/main.py
Executable file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/python
|
||||||
|
|
||||||
|
with open("input", 'r') as input:
|
||||||
|
counter = 0
|
||||||
|
for line in input:
|
||||||
|
parts = line.split(": ")
|
||||||
|
policy = parts[0].split(" ")
|
||||||
|
policy_amount = policy[0].split("-")
|
||||||
|
min_amount = int(policy_amount[0])
|
||||||
|
max_amount = int(policy_amount[1])
|
||||||
|
char = policy[1]
|
||||||
|
password = parts[1]
|
||||||
|
|
||||||
|
amount = password.count(char)
|
||||||
|
if amount >= min_amount and amount <= max_amount:
|
||||||
|
counter += 1
|
||||||
|
|
||||||
|
print(f"Counter: {counter}")
|
1000
Day 2/Two/input
Normal file
1000
Day 2/Two/input
Normal file
File diff suppressed because it is too large
Load diff
17
Day 2/Two/main.py
Executable file
17
Day 2/Two/main.py
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/python
|
||||||
|
|
||||||
|
with open("input", 'r') as input:
|
||||||
|
counter = 0
|
||||||
|
for line in input:
|
||||||
|
parts = line.split(": ")
|
||||||
|
policy = parts[0].split(" ")
|
||||||
|
policy_pos = policy[0].split("-")
|
||||||
|
pos_one = int(policy_pos[0]) - 1
|
||||||
|
pos_two = int(policy_pos[1]) - 1
|
||||||
|
char = policy[1]
|
||||||
|
password = parts[1]
|
||||||
|
|
||||||
|
if (password[pos_one] == char and not password[pos_two] == char) or (password[pos_two] == char and not password[pos_one] == char):
|
||||||
|
counter += 1
|
||||||
|
|
||||||
|
print(f"Counter: {counter}")
|
323
Day 3/One/input
Normal file
323
Day 3/One/input
Normal file
|
@ -0,0 +1,323 @@
|
||||||
|
...#....#.#...##......#.#...##.
|
||||||
|
.#..#...##..#....##........##..
|
||||||
|
..##.##...##.#.#....#..#......#
|
||||||
|
....#....#..#..#.#....#..###...
|
||||||
|
####.....##.#.##...##..#....#..
|
||||||
|
#........##...#..###..#.#.#.##.
|
||||||
|
.......###........##...#...#...
|
||||||
|
#.#...#..#..#...#...##.##......
|
||||||
|
..#...........#......##.#.#....
|
||||||
|
#..#.#......##.#...#..#.#..#...
|
||||||
|
.#....#....#..#.....#..###..#.#
|
||||||
|
.##....................#.###.#.
|
||||||
|
..#......#.#......#..###.......
|
||||||
|
#.###..##..###....#........#..#
|
||||||
|
.....#...#.......#.#.#...#....#
|
||||||
|
....##..#.##..#.##..#.#....#...
|
||||||
|
.#..#..#......#..##.#.#....##.#
|
||||||
|
.....#.....#.##...#.#.##.#.....
|
||||||
|
.#...#..##.....#.........#.#...
|
||||||
|
.....#........#........#..#..#.
|
||||||
|
#......##....#..#.#...#...#....
|
||||||
|
#......#.#.......##.#..#.#.#...
|
||||||
|
...###...##.#..........#...#...
|
||||||
|
...#.##...#......#.##....#.#...
|
||||||
|
#...#.....#........#..#....##.#
|
||||||
|
##.#....##...##.####.##.......#
|
||||||
|
..#..#...#.#.......#.##.#......
|
||||||
|
##.........#.##....#.#...#.....
|
||||||
|
##..#......#....#.....#...#....
|
||||||
|
......##.#.#.....#.#.###...#...
|
||||||
|
##.......#......#.#..#...#.##..
|
||||||
|
#....#....#..#.#..#.#..........
|
||||||
|
...#....#.#.#.#.....##.#..#.##.
|
||||||
|
......#.#.#....#...##.#..#.....
|
||||||
|
..##..#.##....#...#.....#..#.##
|
||||||
|
.#...#.#.##..##........#.#...#.
|
||||||
|
##.##.##....#.#....##.###......
|
||||||
|
#...........#....##..#......#..
|
||||||
|
...##..#.....#....#....#.#..##.
|
||||||
|
.#..#.##..##..#.........#.....#
|
||||||
|
.##......##.#.#......##....#...
|
||||||
|
.....##.#....#...#...........##
|
||||||
|
..#.....#..##...#.#..#.........
|
||||||
|
...#.####..#.###.....#.....##..
|
||||||
|
.....#..##..#.###........#.#...
|
||||||
|
#..#.#.....#.....#...#...#....#
|
||||||
|
.#...........#..#.........##...
|
||||||
|
...#.#.#.......#..............#
|
||||||
|
.##.#..#...#........#.##.#.#.#.
|
||||||
|
....#....#.......#......#.#....
|
||||||
|
##.#..##.....##..#...#....#..#.
|
||||||
|
#.........#.#..###...#....#..#.
|
||||||
|
....##.###...#........##...#.##
|
||||||
|
.#...#..##.##...........##...##
|
||||||
|
.....#.##........#.#.......##..
|
||||||
|
.....#......#..#..#...#.#...#..
|
||||||
|
.....#.....#.#..#.###......####
|
||||||
|
........#.......#...........#..
|
||||||
|
...#.##..#....######..#.#...#..
|
||||||
|
#...##...####..##.....##...#...
|
||||||
|
.#.......#.###..#.##..#..#.#.#.
|
||||||
|
....#..#....##.....#........#.#
|
||||||
|
.#..#....##..#........#...#...#
|
||||||
|
#.#..#.#...##...#..........#.#.
|
||||||
|
##.####....##....#...##.####...
|
||||||
|
..##......##....#.....#...#..#.
|
||||||
|
...#......#..#...#..#.#....#.#.
|
||||||
|
......#...#....##....#.##......
|
||||||
|
.##...#.........####..#....#..#
|
||||||
|
...#..#.#......#.....#.#.#.#...
|
||||||
|
...........#.......#........##.
|
||||||
|
#.#....#....#.##.#...#...#.#...
|
||||||
|
#..#.....#..#..#.#...#........#
|
||||||
|
.....#.#.##...#............#.##
|
||||||
|
..#.#.#...#...#..###.#.....#...
|
||||||
|
....#.....##.......#......#....
|
||||||
|
.#.#....#.##......##.#.#.....#.
|
||||||
|
.....#.##.....#.#...#....#....#
|
||||||
|
...#.......#..#.#.###.#.###....
|
||||||
|
.#...#..#..#....#...###.#.##...
|
||||||
|
.#....#........#..........##...
|
||||||
|
##.#......#..#.#..........#.#..
|
||||||
|
...#..#.......#.##..###....#.#.
|
||||||
|
.#.....#..........#..#.........
|
||||||
|
...##...##.#.......#..#....#...
|
||||||
|
.....#.##....#.#.#...#.......#.
|
||||||
|
...#.#..#.#.......#.....##..#..
|
||||||
|
.#.#.......#.#..........#...#.#
|
||||||
|
#........#...#....###.#...#....
|
||||||
|
..##....#.#.#.....###.#.#......
|
||||||
|
..#.....#.#...#.#.....#.#......
|
||||||
|
.#.....##......#....##.#.#....#
|
||||||
|
...##..........#.#####...#..#..
|
||||||
|
#....#......##.............#...
|
||||||
|
......#.....#...##..#.#....#..#
|
||||||
|
..###.#.###.#.##.#.##..#.....#.
|
||||||
|
#...#....#.#....#..##...#...#.#
|
||||||
|
...#....#...#.#......#......#..
|
||||||
|
#......#.....#.#..#........#...
|
||||||
|
...##...##...##..###...###.#...
|
||||||
|
#..#...#...#.....#..###...##...
|
||||||
|
.#.....#.......#....#....##....
|
||||||
|
......#......##.#.#......#.#...
|
||||||
|
..#....#.#..........#..#...#..#
|
||||||
|
###...#..............#.........
|
||||||
|
.###.##..#.#..#.....#.#.##....#
|
||||||
|
..#......#.##....##......#....#
|
||||||
|
.##....###.#..#.#.............#
|
||||||
|
..##..#..#.#.#....#..##.#..#..#
|
||||||
|
##.#.....##...#..#...#..#.#.#..
|
||||||
|
.#.#..............#.#...#......
|
||||||
|
#....##...#....#..#...#........
|
||||||
|
...#..#..#.#........#..#..#..##
|
||||||
|
...##.#.#.#....#.......#....#..
|
||||||
|
.##.#......#.##........#...##..
|
||||||
|
.#.##..#.....###..#.#......#..#
|
||||||
|
#....#..#......#....##...#..#.#
|
||||||
|
..##....#.##...#..#.##....##..#
|
||||||
|
#....#..#...#.......#...#......
|
||||||
|
#.#......#....#.#..............
|
||||||
|
..##..#..#.#.......#.#.#...##..
|
||||||
|
...##.##......#..#.##.#.......#
|
||||||
|
.##.........#............#.#...
|
||||||
|
........#...#.....#....#....#..
|
||||||
|
#....##...#........#......##...
|
||||||
|
.###....#..#.#......#....#.#...
|
||||||
|
#.#...........#...#....#..#.#.#
|
||||||
|
.#....##.###...#.##....##..#..#
|
||||||
|
........#.............#.#...#.#
|
||||||
|
#.##..#.##....##.......#.......
|
||||||
|
.#.....#..#.##..##.....#.......
|
||||||
|
....#.#......#.#.............#.
|
||||||
|
..#.#.......#...#......##..#...
|
||||||
|
......##..###....##.#.###..##.#
|
||||||
|
..#..#.##...#...#....#.##..#..#
|
||||||
|
#.##...##.##.#.#........#......
|
||||||
|
...#.#.......##....#.......#...
|
||||||
|
.#....#.##.#..#.......#.....##.
|
||||||
|
#..#...##.####..###.....#......
|
||||||
|
..#...##...#...#.#......#...#.#
|
||||||
|
.##.##.#...#.....#.##..##......
|
||||||
|
.#...#.#.##.###..#...#...#.....
|
||||||
|
.#..##..#....##.##....##....##.
|
||||||
|
..#...##....#..###........##...
|
||||||
|
.#..#..#.#....#.#...#.#......#.
|
||||||
|
.##.....#...#..#..#..#...###...
|
||||||
|
.#...#....#..#...........###...
|
||||||
|
.....#...........##.#......#...
|
||||||
|
.....#....##......##..#.#......
|
||||||
|
.#.#..#..#...#.#..#..##..#.#...
|
||||||
|
..#..#####.#..#.#.#.....#.#....
|
||||||
|
#......#.##.#......#.#......#..
|
||||||
|
.#...............#..#.#.......#
|
||||||
|
...##...##.....##.##......#..##
|
||||||
|
#.......##.#...........#....#..
|
||||||
|
#...##.#...#.#..#..###...##....
|
||||||
|
#..##..#..#......#.#...###..#.#
|
||||||
|
.#.#..###.##..##.....#.........
|
||||||
|
##.#..##.#..........#.......#..
|
||||||
|
.###..##....##..#..#...##......
|
||||||
|
........#..##.##....#....#.....
|
||||||
|
.....#.#.#........#...#....#.#.
|
||||||
|
..#..#.#.....#.##....##........
|
||||||
|
...#....................#....#.
|
||||||
|
..#....#..###.##......#..#.#.##
|
||||||
|
.....#.#....#......#...#......#
|
||||||
|
###...##.......#.#.#.....#....#
|
||||||
|
..#..###.##..#..#....##.......#
|
||||||
|
#...#.###..#...#.##..##........
|
||||||
|
..#..#....#...........##..#....
|
||||||
|
.#............##..#...##.#..#..
|
||||||
|
.#.......#.#.........##..#..#..
|
||||||
|
....#.###.#...##....#.#.##.....
|
||||||
|
#.......#........#..#.##......#
|
||||||
|
#.....###....#....#..#....#....
|
||||||
|
...........#...#........#.....#
|
||||||
|
..##...#...#.##...##.#.#..#...#
|
||||||
|
##.##..#.......##..........#..#
|
||||||
|
............#.....#...#..#....#
|
||||||
|
.....#.#......#...#..#.#...#..#
|
||||||
|
............##.##.....##...#..#
|
||||||
|
##.#..#..#.#......#......#..##.
|
||||||
|
..#..#.........#...#..#.#.#....
|
||||||
|
#..#........#.......###.#......
|
||||||
|
...#.#.#....#......#.#...#.....
|
||||||
|
#...............#...#......##..
|
||||||
|
###.#...#......##.....#..##.##.
|
||||||
|
#.##...##.......###.##.........
|
||||||
|
.#.#.........#..#.....#........
|
||||||
|
..##..#............#.....#...##
|
||||||
|
......###...#.#...#..#...##....
|
||||||
|
#.........#.#.##.........##....
|
||||||
|
.#....##....#....##....#.##....
|
||||||
|
.#...##.#...#.......#...#....##
|
||||||
|
#................#......##.....
|
||||||
|
##..#......#.#.........##...##.
|
||||||
|
...#.#.#...#..#..##..#....#.#..
|
||||||
|
.##........#.#......##...#..#..
|
||||||
|
...##....#.#.....##..#.........
|
||||||
|
........###.#.#....###.##.#....
|
||||||
|
.............#....###.#..#.#...
|
||||||
|
.#...........##....#...#.......
|
||||||
|
#..#.......#.....##..#.........
|
||||||
|
..#.#..#....##...##.#.......#.#
|
||||||
|
#.###.#.........#..#.........#.
|
||||||
|
.......#.........##....##.#..##
|
||||||
|
.##...###..........#....#.#..##
|
||||||
|
.#.....#......##..#...#........
|
||||||
|
##..#..###........#.......#....
|
||||||
|
........#...#.##...........#.#.
|
||||||
|
.....#..#..###.............#..#
|
||||||
|
...######.##.....#...#......#..
|
||||||
|
.#...#....###...###......#.##..
|
||||||
|
...##.####.........#...#...##..
|
||||||
|
..##....#.......#.....#..#.....
|
||||||
|
#.##....#.#........#.....##....
|
||||||
|
.....#.#.###...........#...##.#
|
||||||
|
.............###........#......
|
||||||
|
...#..#...##.#....#..##.#.....#
|
||||||
|
....#.#.....#...#......###..##.
|
||||||
|
........#.......#..#...........
|
||||||
|
....#.#...#......#.#.....###...
|
||||||
|
..#.............####.##.....#..
|
||||||
|
..........#...#.#..............
|
||||||
|
..#.#...........#.#..##...##..#
|
||||||
|
.......#...#........#..##....##
|
||||||
|
#...#.....#.#.##...#.#.#...#..#
|
||||||
|
.....#..#....#.###.#.....#.#..#
|
||||||
|
....#.#.#...#.................#
|
||||||
|
#..#........##.###....#....#...
|
||||||
|
..##...##..............##....#.
|
||||||
|
...#.#...#.#...##........#...#.
|
||||||
|
##..##.#..#.#.#..#.#...#.#.#.##
|
||||||
|
..#.#..#....#..#.###.........#.
|
||||||
|
..#.....#..#..#........#.......
|
||||||
|
...#...#......##...###.....##..
|
||||||
|
#....#.##.....#.##..##..#..#...
|
||||||
|
......##..#.#.#..#.###...#...#.
|
||||||
|
.##.....##............#.#......
|
||||||
|
..#.#........##....#..#.####.#.
|
||||||
|
.#....###..#.......#...........
|
||||||
|
##...........#..#...#.....#.#..
|
||||||
|
.#..#....#..#....#.#.........#.
|
||||||
|
.#.###....#.....##.....##......
|
||||||
|
.#.#.......#.......#.###.#...#.
|
||||||
|
...###..#..#....#..####.##....#
|
||||||
|
..........##...#...#...........
|
||||||
|
.#.....#.#..##..##...##..#.....
|
||||||
|
##.......#.#...#..###..#..##...
|
||||||
|
..#.##......###..#........#..##
|
||||||
|
....###...#..........#.#..#.#..
|
||||||
|
#..#.#..##.......##....#.#..##.
|
||||||
|
.#...#...#..#....#...###.......
|
||||||
|
.##.#.#.#.....#.....#.#.#.....#
|
||||||
|
...##.#.....#..#.#...#.####.#..
|
||||||
|
#...##.....####..#.###.##..#.##
|
||||||
|
..###..##....#####......##.....
|
||||||
|
###..............#.#..........#
|
||||||
|
#...##......##....#...#..##..#.
|
||||||
|
.#..#...#....##.##.....#....##.
|
||||||
|
...#.#...#..#..#.......#.##....
|
||||||
|
.#...#..#.......#.##.#..#...#.#
|
||||||
|
.#..#.##...#...#.............#.
|
||||||
|
.#.#.#....##..#.#.#.#.#......##
|
||||||
|
..#....#.#...##.##.#...#.#.#.#.
|
||||||
|
...#..#..##.........##..#.....#
|
||||||
|
....#..........#.#.......#.....
|
||||||
|
........#....#.#..#.....#.#.#..
|
||||||
|
.#...#.......#..#.##.........#.
|
||||||
|
##......#.....#...........#.#..
|
||||||
|
....#....##...#..#####.####...#
|
||||||
|
.....##....#....#..#.....#..##.
|
||||||
|
.#...#.#..###....#......#...#..
|
||||||
|
.#.#.#.#.....##..........#....#
|
||||||
|
...#.....#.....#..#............
|
||||||
|
...#.#..#.....#.............#..
|
||||||
|
......#....#.#.....#.##...#..#.
|
||||||
|
...#....#.#...##..#....###.....
|
||||||
|
...#..#............##...##.##..
|
||||||
|
..#....#..............#.....#..
|
||||||
|
.#..#.......#.#.##......#.###..
|
||||||
|
..#...#.........#..#.....#.....
|
||||||
|
#..........#.....##............
|
||||||
|
##.#.#.#....##......#..#....#.#
|
||||||
|
.#..#.....#.#..#.....#..##.....
|
||||||
|
...#.#.....#..#..#..#.##.###...
|
||||||
|
...##.#.....#.....#.......#....
|
||||||
|
.....................##.#...#..
|
||||||
|
...#.#...#...#...###..#..#.#...
|
||||||
|
#....##..###.#...##.#......#..#
|
||||||
|
.##...##..##...##......##.#....
|
||||||
|
............#.....#.##.#.##.#.#
|
||||||
|
.#...##.#..........###......#..
|
||||||
|
.....##.....##....#.#....##..#.
|
||||||
|
...#....#.....#....#.....#.#...
|
||||||
|
................##.#...#....##.
|
||||||
|
#..###.......#......###......#.
|
||||||
|
###..#.........#.#.#.....#....#
|
||||||
|
..#.#......#....#.#......##...#
|
||||||
|
#...#......#.#.#.#..#...#..###.
|
||||||
|
.#...#..#...##..#...##....###..
|
||||||
|
#.#.#.#..###................#.#
|
||||||
|
...#.####....##.#.....#..#.....
|
||||||
|
#.#...##..#.#...###.#..#...#...
|
||||||
|
#..####........#.#..#...##..##.
|
||||||
|
..#..###..#..........##.###...#
|
||||||
|
.....#..###.#.#....#....##....#
|
||||||
|
.###..#.#.#....#...##.......##.
|
||||||
|
#..#..........#...............#
|
||||||
|
.#.#...#.....#.###..##......##.
|
||||||
|
#...#...#...##...##.....##..#..
|
||||||
|
.....##..###...........#.......
|
||||||
|
........###..##........#..##..#
|
||||||
|
#....#...##..##..#.#.#.###...#.
|
||||||
|
.#..#......##.#..#...#.........
|
||||||
|
.#....#.##.....................
|
||||||
|
#.##.##...........#.####..#....
|
||||||
|
......##....#..#.....#.#....#..
|
||||||
|
....##.#........#.#.#.#.#..#..#
|
||||||
|
.#..##..##..#.....#...#.#.....#
|
||||||
|
...#..#.#.....#..#..##....##..#
|
||||||
|
..#....#.....#........#.....#..
|
||||||
|
#.#.#..#..#.#..#...###.#.#....#
|
22
Day 3/One/main.py
Executable file
22
Day 3/One/main.py
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/python
|
||||||
|
|
||||||
|
slope_x = 3
|
||||||
|
slope_y = 1
|
||||||
|
|
||||||
|
with open("input", 'r') as input:
|
||||||
|
lines = input.readlines()
|
||||||
|
wrapping_point = len(lines[0].strip())
|
||||||
|
trees = 0
|
||||||
|
for i in range(1, int(len(lines) / slope_y) - 1):
|
||||||
|
line = lines[i].strip()
|
||||||
|
index = (i*slope_x) % wrapping_point
|
||||||
|
char = line[index]
|
||||||
|
if char == "#":
|
||||||
|
print(line[:index] + "X" + line[index+1:])
|
||||||
|
trees += 1
|
||||||
|
else:
|
||||||
|
print(line[:index] + "O" + line[index+1:])
|
||||||
|
|
||||||
|
|
||||||
|
print(trees)
|
||||||
|
|
323
Day 3/Two/input
Normal file
323
Day 3/Two/input
Normal file
|
@ -0,0 +1,323 @@
|
||||||
|
...#....#.#...##......#.#...##.
|
||||||
|
.#..#...##..#....##........##..
|
||||||
|
..##.##...##.#.#....#..#......#
|
||||||
|
....#....#..#..#.#....#..###...
|
||||||
|
####.....##.#.##...##..#....#..
|
||||||
|
#........##...#..###..#.#.#.##.
|
||||||
|
.......###........##...#...#...
|
||||||
|
#.#...#..#..#...#...##.##......
|
||||||
|
..#...........#......##.#.#....
|
||||||
|
#..#.#......##.#...#..#.#..#...
|
||||||
|
.#....#....#..#.....#..###..#.#
|
||||||
|
.##....................#.###.#.
|
||||||
|
..#......#.#......#..###.......
|
||||||
|
#.###..##..###....#........#..#
|
||||||
|
.....#...#.......#.#.#...#....#
|
||||||
|
....##..#.##..#.##..#.#....#...
|
||||||
|
.#..#..#......#..##.#.#....##.#
|
||||||
|
.....#.....#.##...#.#.##.#.....
|
||||||
|
.#...#..##.....#.........#.#...
|
||||||
|
.....#........#........#..#..#.
|
||||||
|
#......##....#..#.#...#...#....
|
||||||
|
#......#.#.......##.#..#.#.#...
|
||||||
|
...###...##.#..........#...#...
|
||||||
|
...#.##...#......#.##....#.#...
|
||||||
|
#...#.....#........#..#....##.#
|
||||||
|
##.#....##...##.####.##.......#
|
||||||
|
..#..#...#.#.......#.##.#......
|
||||||
|
##.........#.##....#.#...#.....
|
||||||
|
##..#......#....#.....#...#....
|
||||||
|
......##.#.#.....#.#.###...#...
|
||||||
|
##.......#......#.#..#...#.##..
|
||||||
|
#....#....#..#.#..#.#..........
|
||||||
|
...#....#.#.#.#.....##.#..#.##.
|
||||||
|
......#.#.#....#...##.#..#.....
|
||||||
|
..##..#.##....#...#.....#..#.##
|
||||||
|
.#...#.#.##..##........#.#...#.
|
||||||
|
##.##.##....#.#....##.###......
|
||||||
|
#...........#....##..#......#..
|
||||||
|
...##..#.....#....#....#.#..##.
|
||||||
|
.#..#.##..##..#.........#.....#
|
||||||
|
.##......##.#.#......##....#...
|
||||||
|
.....##.#....#...#...........##
|
||||||
|
..#.....#..##...#.#..#.........
|
||||||
|
...#.####..#.###.....#.....##..
|
||||||
|
.....#..##..#.###........#.#...
|
||||||
|
#..#.#.....#.....#...#...#....#
|
||||||
|
.#...........#..#.........##...
|
||||||
|
...#.#.#.......#..............#
|
||||||
|
.##.#..#...#........#.##.#.#.#.
|
||||||
|
....#....#.......#......#.#....
|
||||||
|
##.#..##.....##..#...#....#..#.
|
||||||
|
#.........#.#..###...#....#..#.
|
||||||
|
....##.###...#........##...#.##
|
||||||
|
.#...#..##.##...........##...##
|
||||||
|
.....#.##........#.#.......##..
|
||||||
|
.....#......#..#..#...#.#...#..
|
||||||
|
.....#.....#.#..#.###......####
|
||||||
|
........#.......#...........#..
|
||||||
|
...#.##..#....######..#.#...#..
|
||||||
|
#...##...####..##.....##...#...
|
||||||
|
.#.......#.###..#.##..#..#.#.#.
|
||||||
|
....#..#....##.....#........#.#
|
||||||
|
.#..#....##..#........#...#...#
|
||||||
|
#.#..#.#...##...#..........#.#.
|
||||||
|
##.####....##....#...##.####...
|
||||||
|
..##......##....#.....#...#..#.
|
||||||
|
...#......#..#...#..#.#....#.#.
|
||||||
|
......#...#....##....#.##......
|
||||||
|
.##...#.........####..#....#..#
|
||||||
|
...#..#.#......#.....#.#.#.#...
|
||||||
|
...........#.......#........##.
|
||||||
|
#.#....#....#.##.#...#...#.#...
|
||||||
|
#..#.....#..#..#.#...#........#
|
||||||
|
.....#.#.##...#............#.##
|
||||||
|
..#.#.#...#...#..###.#.....#...
|
||||||
|
....#.....##.......#......#....
|
||||||
|
.#.#....#.##......##.#.#.....#.
|
||||||
|
.....#.##.....#.#...#....#....#
|
||||||
|
...#.......#..#.#.###.#.###....
|
||||||
|
.#...#..#..#....#...###.#.##...
|
||||||
|
.#....#........#..........##...
|
||||||
|
##.#......#..#.#..........#.#..
|
||||||
|
...#..#.......#.##..###....#.#.
|
||||||
|
.#.....#..........#..#.........
|
||||||
|
...##...##.#.......#..#....#...
|
||||||
|
.....#.##....#.#.#...#.......#.
|
||||||
|
...#.#..#.#.......#.....##..#..
|
||||||
|
.#.#.......#.#..........#...#.#
|
||||||
|
#........#...#....###.#...#....
|
||||||
|
..##....#.#.#.....###.#.#......
|
||||||
|
..#.....#.#...#.#.....#.#......
|
||||||
|
.#.....##......#....##.#.#....#
|
||||||
|
...##..........#.#####...#..#..
|
||||||
|
#....#......##.............#...
|
||||||
|
......#.....#...##..#.#....#..#
|
||||||
|
..###.#.###.#.##.#.##..#.....#.
|
||||||
|
#...#....#.#....#..##...#...#.#
|
||||||
|
...#....#...#.#......#......#..
|
||||||
|
#......#.....#.#..#........#...
|
||||||
|
...##...##...##..###...###.#...
|
||||||
|
#..#...#...#.....#..###...##...
|
||||||
|
.#.....#.......#....#....##....
|
||||||
|
......#......##.#.#......#.#...
|
||||||
|
..#....#.#..........#..#...#..#
|
||||||
|
###...#..............#.........
|
||||||
|
.###.##..#.#..#.....#.#.##....#
|
||||||
|
..#......#.##....##......#....#
|
||||||
|
.##....###.#..#.#.............#
|
||||||
|
..##..#..#.#.#....#..##.#..#..#
|
||||||
|
##.#.....##...#..#...#..#.#.#..
|
||||||
|
.#.#..............#.#...#......
|
||||||
|
#....##...#....#..#...#........
|
||||||
|
...#..#..#.#........#..#..#..##
|
||||||
|
...##.#.#.#....#.......#....#..
|
||||||
|
.##.#......#.##........#...##..
|
||||||
|
.#.##..#.....###..#.#......#..#
|
||||||
|
#....#..#......#....##...#..#.#
|
||||||
|
..##....#.##...#..#.##....##..#
|
||||||
|
#....#..#...#.......#...#......
|
||||||
|
#.#......#....#.#..............
|
||||||
|
..##..#..#.#.......#.#.#...##..
|
||||||
|
...##.##......#..#.##.#.......#
|
||||||
|
.##.........#............#.#...
|
||||||
|
........#...#.....#....#....#..
|
||||||
|
#....##...#........#......##...
|
||||||
|
.###....#..#.#......#....#.#...
|
||||||
|
#.#...........#...#....#..#.#.#
|
||||||
|
.#....##.###...#.##....##..#..#
|
||||||
|
........#.............#.#...#.#
|
||||||
|
#.##..#.##....##.......#.......
|
||||||
|
.#.....#..#.##..##.....#.......
|
||||||
|
....#.#......#.#.............#.
|
||||||
|
..#.#.......#...#......##..#...
|
||||||
|
......##..###....##.#.###..##.#
|
||||||
|
..#..#.##...#...#....#.##..#..#
|
||||||
|
#.##...##.##.#.#........#......
|
||||||
|
...#.#.......##....#.......#...
|
||||||
|
.#....#.##.#..#.......#.....##.
|
||||||
|
#..#...##.####..###.....#......
|
||||||
|
..#...##...#...#.#......#...#.#
|
||||||
|
.##.##.#...#.....#.##..##......
|
||||||
|
.#...#.#.##.###..#...#...#.....
|
||||||
|
.#..##..#....##.##....##....##.
|
||||||
|
..#...##....#..###........##...
|
||||||
|
.#..#..#.#....#.#...#.#......#.
|
||||||
|
.##.....#...#..#..#..#...###...
|
||||||
|
.#...#....#..#...........###...
|
||||||
|
.....#...........##.#......#...
|
||||||
|
.....#....##......##..#.#......
|
||||||
|
.#.#..#..#...#.#..#..##..#.#...
|
||||||
|
..#..#####.#..#.#.#.....#.#....
|
||||||
|
#......#.##.#......#.#......#..
|
||||||
|
.#...............#..#.#.......#
|
||||||
|
...##...##.....##.##......#..##
|
||||||
|
#.......##.#...........#....#..
|
||||||
|
#...##.#...#.#..#..###...##....
|
||||||
|
#..##..#..#......#.#...###..#.#
|
||||||
|
.#.#..###.##..##.....#.........
|
||||||
|
##.#..##.#..........#.......#..
|
||||||
|
.###..##....##..#..#...##......
|
||||||
|
........#..##.##....#....#.....
|
||||||
|
.....#.#.#........#...#....#.#.
|
||||||
|
..#..#.#.....#.##....##........
|
||||||
|
...#....................#....#.
|
||||||
|
..#....#..###.##......#..#.#.##
|
||||||
|
.....#.#....#......#...#......#
|
||||||
|
###...##.......#.#.#.....#....#
|
||||||
|
..#..###.##..#..#....##.......#
|
||||||
|
#...#.###..#...#.##..##........
|
||||||
|
..#..#....#...........##..#....
|
||||||
|
.#............##..#...##.#..#..
|
||||||
|
.#.......#.#.........##..#..#..
|
||||||
|
....#.###.#...##....#.#.##.....
|
||||||
|
#.......#........#..#.##......#
|
||||||
|
#.....###....#....#..#....#....
|
||||||
|
...........#...#........#.....#
|
||||||
|
..##...#...#.##...##.#.#..#...#
|
||||||
|
##.##..#.......##..........#..#
|
||||||
|
............#.....#...#..#....#
|
||||||
|
.....#.#......#...#..#.#...#..#
|
||||||
|
............##.##.....##...#..#
|
||||||
|
##.#..#..#.#......#......#..##.
|
||||||
|
..#..#.........#...#..#.#.#....
|
||||||
|
#..#........#.......###.#......
|
||||||
|
...#.#.#....#......#.#...#.....
|
||||||
|
#...............#...#......##..
|
||||||
|
###.#...#......##.....#..##.##.
|
||||||
|
#.##...##.......###.##.........
|
||||||
|
.#.#.........#..#.....#........
|
||||||
|
..##..#............#.....#...##
|
||||||
|
......###...#.#...#..#...##....
|
||||||
|
#.........#.#.##.........##....
|
||||||
|
.#....##....#....##....#.##....
|
||||||
|
.#...##.#...#.......#...#....##
|
||||||
|
#................#......##.....
|
||||||
|
##..#......#.#.........##...##.
|
||||||
|
...#.#.#...#..#..##..#....#.#..
|
||||||
|
.##........#.#......##...#..#..
|
||||||
|
...##....#.#.....##..#.........
|
||||||
|
........###.#.#....###.##.#....
|
||||||
|
.............#....###.#..#.#...
|
||||||
|
.#...........##....#...#.......
|
||||||
|
#..#.......#.....##..#.........
|
||||||
|
..#.#..#....##...##.#.......#.#
|
||||||
|
#.###.#.........#..#.........#.
|
||||||
|
.......#.........##....##.#..##
|
||||||
|
.##...###..........#....#.#..##
|
||||||
|
.#.....#......##..#...#........
|
||||||
|
##..#..###........#.......#....
|
||||||
|
........#...#.##...........#.#.
|
||||||
|
.....#..#..###.............#..#
|
||||||
|
...######.##.....#...#......#..
|
||||||
|
.#...#....###...###......#.##..
|
||||||
|
...##.####.........#...#...##..
|
||||||
|
..##....#.......#.....#..#.....
|
||||||
|
#.##....#.#........#.....##....
|
||||||
|
.....#.#.###...........#...##.#
|
||||||
|
.............###........#......
|
||||||
|
...#..#...##.#....#..##.#.....#
|
||||||
|
....#.#.....#...#......###..##.
|
||||||
|
........#.......#..#...........
|
||||||
|
....#.#...#......#.#.....###...
|
||||||
|
..#.............####.##.....#..
|
||||||
|
..........#...#.#..............
|
||||||
|
..#.#...........#.#..##...##..#
|
||||||
|
.......#...#........#..##....##
|
||||||
|
#...#.....#.#.##...#.#.#...#..#
|
||||||
|
.....#..#....#.###.#.....#.#..#
|
||||||
|
....#.#.#...#.................#
|
||||||
|
#..#........##.###....#....#...
|
||||||
|
..##...##..............##....#.
|
||||||
|
...#.#...#.#...##........#...#.
|
||||||
|
##..##.#..#.#.#..#.#...#.#.#.##
|
||||||
|
..#.#..#....#..#.###.........#.
|
||||||
|
..#.....#..#..#........#.......
|
||||||
|
...#...#......##...###.....##..
|
||||||
|
#....#.##.....#.##..##..#..#...
|
||||||
|
......##..#.#.#..#.###...#...#.
|
||||||
|
.##.....##............#.#......
|
||||||
|
..#.#........##....#..#.####.#.
|
||||||
|
.#....###..#.......#...........
|
||||||
|
##...........#..#...#.....#.#..
|
||||||
|
.#..#....#..#....#.#.........#.
|
||||||
|
.#.###....#.....##.....##......
|
||||||
|
.#.#.......#.......#.###.#...#.
|
||||||
|
...###..#..#....#..####.##....#
|
||||||
|
..........##...#...#...........
|
||||||
|
.#.....#.#..##..##...##..#.....
|
||||||
|
##.......#.#...#..###..#..##...
|
||||||
|
..#.##......###..#........#..##
|
||||||
|
....###...#..........#.#..#.#..
|
||||||
|
#..#.#..##.......##....#.#..##.
|
||||||
|
.#...#...#..#....#...###.......
|
||||||
|
.##.#.#.#.....#.....#.#.#.....#
|
||||||
|
...##.#.....#..#.#...#.####.#..
|
||||||
|
#...##.....####..#.###.##..#.##
|
||||||
|
..###..##....#####......##.....
|
||||||
|
###..............#.#..........#
|
||||||
|
#...##......##....#...#..##..#.
|
||||||
|
.#..#...#....##.##.....#....##.
|
||||||
|
...#.#...#..#..#.......#.##....
|
||||||
|
.#...#..#.......#.##.#..#...#.#
|
||||||
|
.#..#.##...#...#.............#.
|
||||||
|
.#.#.#....##..#.#.#.#.#......##
|
||||||
|
..#....#.#...##.##.#...#.#.#.#.
|
||||||
|
...#..#..##.........##..#.....#
|
||||||
|
....#..........#.#.......#.....
|
||||||
|
........#....#.#..#.....#.#.#..
|
||||||
|
.#...#.......#..#.##.........#.
|
||||||
|
##......#.....#...........#.#..
|
||||||
|
....#....##...#..#####.####...#
|
||||||
|
.....##....#....#..#.....#..##.
|
||||||
|
.#...#.#..###....#......#...#..
|
||||||
|
.#.#.#.#.....##..........#....#
|
||||||
|
...#.....#.....#..#............
|
||||||
|
...#.#..#.....#.............#..
|
||||||
|
......#....#.#.....#.##...#..#.
|
||||||
|
...#....#.#...##..#....###.....
|
||||||
|
...#..#............##...##.##..
|
||||||
|
..#....#..............#.....#..
|
||||||
|
.#..#.......#.#.##......#.###..
|
||||||
|
..#...#.........#..#.....#.....
|
||||||
|
#..........#.....##............
|
||||||
|
##.#.#.#....##......#..#....#.#
|
||||||
|
.#..#.....#.#..#.....#..##.....
|
||||||
|
...#.#.....#..#..#..#.##.###...
|
||||||
|
...##.#.....#.....#.......#....
|
||||||
|
.....................##.#...#..
|
||||||
|
...#.#...#...#...###..#..#.#...
|
||||||
|
#....##..###.#...##.#......#..#
|
||||||
|
.##...##..##...##......##.#....
|
||||||
|
............#.....#.##.#.##.#.#
|
||||||
|
.#...##.#..........###......#..
|
||||||
|
.....##.....##....#.#....##..#.
|
||||||
|
...#....#.....#....#.....#.#...
|
||||||
|
................##.#...#....##.
|
||||||
|
#..###.......#......###......#.
|
||||||
|
###..#.........#.#.#.....#....#
|
||||||
|
..#.#......#....#.#......##...#
|
||||||
|
#...#......#.#.#.#..#...#..###.
|
||||||
|
.#...#..#...##..#...##....###..
|
||||||
|
#.#.#.#..###................#.#
|
||||||
|
...#.####....##.#.....#..#.....
|
||||||
|
#.#...##..#.#...###.#..#...#...
|
||||||
|
#..####........#.#..#...##..##.
|
||||||
|
..#..###..#..........##.###...#
|
||||||
|
.....#..###.#.#....#....##....#
|
||||||
|
.###..#.#.#....#...##.......##.
|
||||||
|
#..#..........#...............#
|
||||||
|
.#.#...#.....#.###..##......##.
|
||||||
|
#...#...#...##...##.....##..#..
|
||||||
|
.....##..###...........#.......
|
||||||
|
........###..##........#..##..#
|
||||||
|
#....#...##..##..#.#.#.###...#.
|
||||||
|
.#..#......##.#..#...#.........
|
||||||
|
.#....#.##.....................
|
||||||
|
#.##.##...........#.####..#....
|
||||||
|
......##....#..#.....#.#....#..
|
||||||
|
....##.#........#.#.#.#.#..#..#
|
||||||
|
.#..##..##..#.....#...#.#.....#
|
||||||
|
...#..#.#.....#..#..##....##..#
|
||||||
|
..#....#.....#........#.....#..
|
||||||
|
#.#.#..#..#.#..#...###.#.#....#
|
28
Day 3/Two/main.py
Executable file
28
Day 3/Two/main.py
Executable file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/python
|
||||||
|
|
||||||
|
def calculate_slope(lines, slope_x, slope_y):
|
||||||
|
wrapping_point = len(lines[0].strip())
|
||||||
|
lines_len = len(lines)
|
||||||
|
trees = 0
|
||||||
|
for i in range(1, int(lines_len/slope_y)):
|
||||||
|
line = lines[i*slope_y].strip()
|
||||||
|
index = (i*slope_x) % wrapping_point
|
||||||
|
char = line[index]
|
||||||
|
if char == "#":
|
||||||
|
print(line[:index] + "X" + line[index+1:])
|
||||||
|
trees += 1
|
||||||
|
else:
|
||||||
|
print(line[:index] + "O" + line[index+1:])
|
||||||
|
|
||||||
|
return trees
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
with open("input", 'r') as input:
|
||||||
|
lines = input.readlines()
|
||||||
|
slopes = [(1,1),(3,1),(5,1), (7,1), (1,2)]
|
||||||
|
total = 1
|
||||||
|
for slope in slopes:
|
||||||
|
trees = calculate_slope(lines, slope[0], slope[1])
|
||||||
|
total *= trees
|
||||||
|
print(f"Total: {total}, Trees: {trees}")
|
1133
Day 4/One/input
Normal file
1133
Day 4/One/input
Normal file
File diff suppressed because it is too large
Load diff
25
Day 4/One/main.py
Executable file
25
Day 4/One/main.py
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/python
|
||||||
|
|
||||||
|
def print_passport(data):
|
||||||
|
print(f"byr: {data['byr']}, iyr: {data['iyr']}, eyr: {data['eyr']}, hgt: {data['hgt']}, hcl: {data['hcl']}, ecl: {data['ecl']}, pid: {data['pid']}")
|
||||||
|
|
||||||
|
with open("input", 'r') as input:
|
||||||
|
passport_data = {}
|
||||||
|
required_field_count = 7
|
||||||
|
valid = 0
|
||||||
|
for line in input:
|
||||||
|
if line == "\n":
|
||||||
|
if len(passport_data) == required_field_count:
|
||||||
|
valid += 1
|
||||||
|
passport_data = {}
|
||||||
|
else:
|
||||||
|
parts = line.strip().split(" ")
|
||||||
|
for part in parts:
|
||||||
|
part = part.split(":")
|
||||||
|
if not part[0] == "cid":
|
||||||
|
passport_data[part[0]] = part[1]
|
||||||
|
|
||||||
|
if len(passport_data) == required_field_count:
|
||||||
|
valid += 1
|
||||||
|
|
||||||
|
print(f"Valid: {valid}")
|
1133
Day 4/Two/input
Normal file
1133
Day 4/Two/input
Normal file
File diff suppressed because it is too large
Load diff
77
Day 4/Two/main.py
Executable file
77
Day 4/Two/main.py
Executable file
|
@ -0,0 +1,77 @@
|
||||||
|
#!/bin/python
|
||||||
|
|
||||||
|
EYE_COLORS = ["amb", "blu", "brn", "gry", "grn", "hzl", "oth"]
|
||||||
|
|
||||||
|
def print_passport(data):
|
||||||
|
print(f"byr: {data['byr']}, iyr: {data['iyr']}, eyr: {data['eyr']}, hgt: {data['hgt']}, hcl: {data['hcl']}, ecl: {data['ecl']}, pid: {data['pid']}")
|
||||||
|
|
||||||
|
def validate_passport(data):
|
||||||
|
try:
|
||||||
|
byr = int(data["byr"])
|
||||||
|
if byr < 1920 or byr > 2002:
|
||||||
|
return False
|
||||||
|
|
||||||
|
iyr = int(data["iyr"])
|
||||||
|
if iyr < 2010 or iyr > 2020:
|
||||||
|
return False
|
||||||
|
|
||||||
|
eyr = int(data["eyr"])
|
||||||
|
if eyr < 2020 or eyr > 2030:
|
||||||
|
return False
|
||||||
|
|
||||||
|
hgt = data["hgt"]
|
||||||
|
if hgt.endswith("cm"):
|
||||||
|
hgt = int(hgt[:-2])
|
||||||
|
if hgt < 150 or hgt > 193:
|
||||||
|
return False
|
||||||
|
elif hgt.endswith("in"):
|
||||||
|
hgt = int(hgt[:-2])
|
||||||
|
if hgt < 59 or hgt > 76:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
hcl = data["hcl"]
|
||||||
|
if hcl.startswith("#"):
|
||||||
|
int(hcl[1:], 16)
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
ecl = data["ecl"]
|
||||||
|
if ecl not in EYE_COLORS:
|
||||||
|
return False
|
||||||
|
|
||||||
|
pid = data["pid"]
|
||||||
|
if len(pid) == 9:
|
||||||
|
int(pid)
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
print_passport(data)
|
||||||
|
return True
|
||||||
|
except:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
with open("input", 'r') as input:
|
||||||
|
passport_data = {}
|
||||||
|
required_field_count = 7
|
||||||
|
valid = 0
|
||||||
|
for line in input:
|
||||||
|
if line == "\n":
|
||||||
|
if validate_passport(passport_data):
|
||||||
|
valid += 1
|
||||||
|
passport_data = {}
|
||||||
|
else:
|
||||||
|
parts = line.strip().split(" ")
|
||||||
|
for part in parts:
|
||||||
|
part = part.split(":")
|
||||||
|
if not part[0] == "cid":
|
||||||
|
passport_data[part[0]] = part[1]
|
||||||
|
|
||||||
|
if validate_passport(passport_data):
|
||||||
|
valid += 1
|
||||||
|
|
||||||
|
print(f"Valid: {valid}")
|
Loading…
Add table
Reference in a new issue