add old stuff

This commit is contained in:
Felix Pankratz 2022-12-01 21:13:55 +01:00
parent a9c7c09d2b
commit d54448ee44
27 changed files with 7093 additions and 0 deletions

200
2020/1/input Executable file
View File

@ -0,0 +1,200 @@
1891
1975
1987
1923
1928
1993
1946
1947
2005
1897
1971
1929
1875
1945
1680
811
1901
1396
1942
1282
1941
1978
1884
1879
1230
2010
1881
1979
1996
1904
1934
1865
2003
2006
1966
1860
1259
1959
1931
1963
1878
1880
151
1925
1663
1908
1863
1391
1922
1968
1998
1084
1982
1960
1938
1876
1937
1882
1873
1926
1986
1416
1864
1862
1969
1913
532
1866
1242
1933
1903
965
1927
1890
1991
1388
1992
1902
1907
1964
1394
2009
1920
630
1932
1854
1951
1852
1983
1314
1855
1954
1921
1989
1871
1995
1885
1974
1915
1872
1251
1899
1985
1889
1935
1912
946
1965
1739
1973
1911
1910
1917
1918
1900
1886
1477
2000
1916
1077
2004
1456
1867
1970
1999
1919
1726
706
1930
1994
1988
1997
1870
1953
652
1893
1898
1883
1957
1972
1874
1977
1955
2001
1906
1389
1848
1940
1877
1962
1948
1887
1924
1403
1408
1861
1892
1990
1222
677
1392
1113
1085
1894
1106
1939
1961
1944
1952
1643
1404
1895
1958
1976
1206
1905
1076
1888
1896
1943
1950
2008
1967
164
1981
1868
1914
1909
1956
341
1379
2007
1563
1980
1072
1949
1250
1258
1092
2002

10
2020/1/solve.py Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env python3
from itertools import permutations
with open('input', 'r') as f:
content = list(map(int, (map(str.strip, f.readlines()))))
perms = permutations(content, 2)
for perm in perms:
perm_sum = perm[0] + perm[1]
if perm_sum == 2020:
print('{} * {} = {}'.format(perm[0], perm[1], perm[0]*perm[1]))

1000
2020/2/input Executable file

File diff suppressed because it is too large Load Diff

17
2020/2/solve.py Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env python3
import re
pattern = re.compile('(\d+)-(\d+)\s(\w):\s(\w+)')
with open('input', 'r') as f:
content = list(map(str.strip, f.readlines()))
valid_pws = 0
for entry in content:
mini, maxi, char, pw = re.match(pattern, entry).groups(1)
mini = int(mini)
maxi = int(maxi)
char_count = pw.count(char)
if mini <= char_count <= maxi:
valid_pws += 1
print(valid_pws)

17
2020/2/solve2.py Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env python3
import re
pattern = re.compile('(\d+)-(\d+)\s(\w):\s(\w+)')
with open('input', 'r') as f:
content = list(map(str.strip, f.readlines()))
valid_pws = 0
for entry in content:
p1, p2, char, pw = re.match(pattern, entry).groups(1)
p1 = int(p1) - 1
p2 = int(p2) - 1
if pw[p1] == char and pw[p2] != char or pw[p1] != char and pw[p2] == char:
valid_pws += 1
print(valid_pws)

323
2020/3/input Executable file
View File

@ -0,0 +1,323 @@
....#...##.#.........#....#....
#.......#...#...#.#............
#..#..#.#.##....#.#........#...
........##...................#.
........#...##...#.#.###.......
##............#...#.....#.##...
...........#....###...#.....#..
.......#......#..##..#.....#...
..#.#..#....#.........#...#..#.
.........##......#.....##..##..
........#.....#....#..##......#
..#..#.......#..............#..
.....#.#.......................
.#.#....#.........#............
.......#.....#.###.............
......##......#...........#..#.
.#...............##...#........
.....#..##........###.........#
#...........#..#............#..
.........#....#..#.#......#....
.......#.........#..##.........
.##.....#..................#...
....#............#.#....#.....#
..#....#...##....#...#.#...#...
..........#................#.#.
#...#.#.#.####..#.#..........#.
..#...#.##......#...........#..
..#.....#...#.......#......#..#
..............#.......#........
.#..#..........#.....#...#..#.#
#........#...#......#.......#..
#..................#...........
..#...#........#...#..#........
..............#.....#.....#..#.
#.#.......#..............##.##.
....#.#.....##....#...........#
......#....#...#..#.......#....
....#..#.#.....#..##.....#....#
...........#.......#.#.#.......
#.......#..##........#..#......
.........#.##..#..............#
...........#............###.#..
..#.....#.....##...#.........#.
....##............##........#..
.....###..........#......##....
#...##..#..#..........#........
....#.....#.......#..#.#...##..
.#....#........#.#.........#.#.
##...#.#.....#......#..........
.....##.....#....#.....###.#..#
..............#..###..#...#..#.
....#...#....#.............#.#.
.#.........#.....#........#.##.
....#.........#..........#.....
.......#........#.#.#..........
#........##....#.........#.....
..##..........#....#.#...#....#
#...#.#......#..##..........#.#
.....#..#...#..#...............
#...#..............#...........
.#...#....#..##.....#....#.#...
.#...#.......#...#..#.##....#..
#....#........#....#...#.......
#..#......#.....#.....#..##....
......#.#....##....##..#...#...
..#....#.#.###..............#..
.#.##.......#.#.#..#...#..#....
..#..........#.#....#..#.#....#
..........#...#...#..........#.
..........#.....#.#..#..#....##
.#.#...##...#...........####...
........##..#.#..........#.##.#
#......###...........#...#.....
..#.#....##.........##....#....
#....#.##..##..#..#.....#.....#
.##.....##....##....#.......#..
#...#.....##....#..........#...
............#.#.##....#....#...
....#............#.....#......#
....................#..........
..#....................#..#....
....#.....#........#..##...#...
#.....#.#....................##
.#....#.#.#...#..........#....#
....#...#......#...#.....##...#
.....#.........................
.......#..#.#...#...#...#.....#
...#......#.##.#...#..#...##.#.
...........................#..#
..#.#.....#........##..........
....#...##........#.#.#..#...##
..##.....#..###.........##.##..
.#..#.....#...#.............#..
#..............##...#....##....
.##......#.#............#......
.............##...#.#.......#..
.........#..#..#...............
........##......#....##........
...#.........#.#.#.............
#..........#......#......#..#..
.............##.#.#..#.#.#...#.
.....#.........#...............
..##.#..#.....##..#........#.#.
.#..........#.#.......#......##
.#........................#....
#....#....#...#..#......#......
........#.......#......#.....#.
.....#....##..#...###...#....#.
....#.........#....#......#....
.............#...#....#.......#
.....#.........#..#.#..........
.........#..#........#.#.#.....
......#.##......#....#.#.##.#..
.#...#.#...#...#.#......#....##
.#................#......#.....
#.#.#...............#..........
.....#.#.......#...#........#..
#...#.#.#.##..#...........#..#.
.............###.........#....#
.#.....#.......##....##.......#
....#...#.......#.##.....#.....
...........##.........#...#....
..............#.#..#.....#..#..
#.#...#..#.#.........#......#.#
#.##.....##....#........#.#.#.#
##.#.###.........##.......#..#.
#.....#.....................#..
.........##........#...........
.###........##....#...#........
....#.#........##...........#..
..........#.....#..........#..#
......#..............#......#..
.....#...#......#...#...#......
..........#.#..#....#...#..###.
#..##........#................#
..#............................
.....#.........#.#.............
........#...#.....#...##......#
..#........#................#..
......#....#..#......#.........
...........##....#..#.#........
.....#.............###.........
#............#......#..#.......
..#..#.................#..#..##
.......#......#.....#........#.
....................#..#.##...#
.#..##...............##...#....
...#...#....#........#.........
.....##...#.....###............
.###.........#........#.....##.
.............#...#.............
...#.#...............#..##..#.#
...#...............#..#.....#..
....#.#..................#...#.
..........#...........#.#...###
#...#......#................#..
...#.#.......#...#......#.##...
......#..........#.............
##.......#.##.#...........#....
......#...#.#.....#............
.#.....#.....#.....#.........#.
..................#............
.#.#.#.....#......#.##.........
.......#..##.##......#..#....#.
...#.#.#......#...#........#...
..#............#......#.......#
..#......#........#.........#..
..#..#.#.#.....#.............#.
..#.#..##......#...#...##......
.##...#....##.#.#...........#..
..............#..#...#....#....
.......#.#........#............
.....##..###........#..........
......................#........
..##....#....#.................
.##.#.###.#........#.##..#...#.
##................#...........#
....#..##.....##...............
.#.....#..#............#.....#.
#.........#..............#.....
...##.#......#...#.............
................#..............
...#.....#....##...#..#....#...
..............##..#...#.##..#..
......................#..#....#
.......#....#..#.##.........#.#
#...#........##.......#........
...##...............#.....#....
.##...##...#...................
.........##.#...#.........#....
............#............#..#..
.............................#.
....#.#....#...................
......#......#...#..##.........
#........#.#.#.#.#......#....#.
.#.........#.#...#......#..#.#.
..............#....##.........#
.#.......#..#....#.#.#....#....
...###.#.#..#...#....#....#....
#........#....................#
......#...##.###..#..##...#....
.....#........#.......#........
#..#...........#.#.............
....##.#...#..##............##.
#.#..##..#...#...#.....#.......
..#.............#.##..#...#.##.
.#.....##.#..#...#...........#.
....#...#....................##
....##......#.###......#......#
...#...#.........#..#.##....#..
#......#..#....###.........#...
#...........##.............#.#.
#..............##....#......#..
.........#...#.#...#...#.......
....#....#............#.......#
........#...#....#......##.....
..........#.#..#.........#.....
#........#.##....##......#.....
...#.......#...................
###...#...#..#.##....#.....#...
........##..........#.##..#....
.....#......#..#.....#.....#.#.
...#..#..##..###.....##.#......
#..#......##...#............#..
#............#....#..#.........
#........#.......#......#..##.#
...#.#.........#.#.............
#..............#..............#
#.#......#..........##.........
#..##...........#..##...#......
.....#.#.....#......#.....#.#.#
.#.##...#...##...........#....#
#.............#........#.......
..##.............#...#.........
....#.#......###....#..........
...#..#.....#..##.#....#...#.#.
.............##................
#.#............#........#..#.#.
.#......#.....#...........#....
...#.........#...........#.##..
.....#...#.....#..#..........#.
........#.#...............#.#..
.......#..#..#.....#.......##..
.#...#...#..#...##...#.........
..........##....#..#.##..#.....
....#.................#...#....
.........#...#......#....#....#
.........#..#...#.##........##.
#.#....##.......#.#............
##.......##..................#.
......#...#......##............
##.#...#.#...........#..#......
.........#.........#..#.#...#..
.#...#.......#.#...###.........
................#.#.....#......
..#...#.....#........#.........
.........##.###.#.#.....#...#..
#..#..........#....#.#...#...##
##.#.#....#..##.............#.#
.###....#..#...............##..
............#......#.#.#....#..
........#...#..#...#...........
##.........#................#..
...###...#.#..#...#..........##
...#......#......##........#...
.......#............#..........
.....#.....##....#.....###.....
.#...#...#.....#..#..#....#..#.
#.#........#..#.......##...#.##
.....#.....##..#.##........#..#
.....#...#...........#.........
..#....#.#...#..#....##...#...#
...........#...##.........#....
..#....#....##........#.####...
#.............#.#.............#
...................#.....#.#..#
.#....#.#.............#.#......
#...........#............#.#...
..#.........#.#....#.......##..
#....####......#...#......#....
....##....#...................#
....#.##....#.............#....
.........##........#.....#..#..
............#...#..............
............#..##....#.....##.#
............#.....#......#.....
........#..#........##.#.......
...#.#........#..............#.
............#.........#..#.#...
................#.............#
..##..........##......#.#......
..#..#.##....#.........#...#...
...........##...#.#.#..........
.#.#.......#.#...#.........#...
.........#..#........#..#.#....
..........##..#.##....#....#...
....#...............#.......#..
##..........##.................
....#.#.#.....#..........##.#..
..............#.##..........##.
##...............#...#..#......
..#..#..........#......#.......
#...#..##.#.#..................
....#....##......##.#...#....##
.#...#.#....##.............#..#
................#......###.....
..#..#.............#.#.......#.
..#..................#.......#.
.....#.......#....#.##...#.##..
.....##.......#......#..#......
#..#.......#........#..........
..#...#..#....#.........#......
#..#..#......##..#.##....####..
......##.#.....#..#.......#....
.##...#.....#..#...#.#.........
#.....#........###....#...#..#.
.#....#.#..#......#............
.........#..#..#.....#........#
..#.......#..........#..#......
......#.......##.#....#.#.#....
.#............#.....#.......#..
...#..#...............#........
.....#.........................

44
2020/3/solve.py Executable file
View File

@ -0,0 +1,44 @@
#!/usr/bin/env python3
class cursor():
def __init__(self, game_map):
self.x, self.y = 0, 0
self.limit_x = len(game_map[1])
self.map = game_map
def setx(self, x):
self.x = x % self.limit_x
def sety(self, y):
self.y = y
def isTree(self):
line = self.map[y]
char = line[self.x]
return char == '#'
with open('input', 'r') as f:
game_map = list(map(str.strip, f.readlines()))
slopes = [(1, 1), (3, 1), (5, 1), (7, 1), (1, 2)]
cur = cursor(game_map)
tree_list = []
for slope in slopes:
print(slope)
x, y = 0, 0
cur.setx(x)
cur.sety(y)
try:
trees = 0
while True:
x += slope[0]
y += slope[1]
cur.setx(x)
cur.sety(y)
if cur.isTree():
trees += 1
except IndexError:
tree_list.append(trees)
result = 1
print(tree_list)
for res in tree_list:
result *= res
print(result)

16
2021/1/1.py Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env python3
content = open('input', 'r').readlines()
depthInc = 0
lastDepth = 9999
for line in content:
depth = int(line.strip())
if depth > lastDepth:
depthInc += 1
lastDepth = depth
print(depthInc)
if __name__ == "__main__":
main()

24
2021/1/2.py Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env python3
content = open('input', 'r').readlines()
depth_inc = 0
last_window = 9999
window = [] # queue for "search window"
window_size = 3
while len(window) < window_size:
window.append(int(content.pop(0).strip()))
# we now have our starting state
last_window = sum(window)
while(content):
# slide window 1 position
window.pop(0)
window.append(int(content.pop(0).strip()))
window_sum = sum(window)
if window_sum > last_window:
depth_inc += 1
last_window = window_sum
print(depth_inc)

2000
2021/1/input Executable file

File diff suppressed because it is too large Load Diff

8
2021/1/template.py Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env python3
content = open('content', 'r').read()
if __name__ == "__main__":
main()

24
2021/2/1.py Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env python3
import re
def main():
position = { 'x': 0, 'y': 0 }
content = open('input', 'r').readlines()
for line in content:
move = line.strip()
match = re.match('^(\w+) (\d+)$', move)
direction, amount = match.groups(1)
amount = int(amount)
#print(f'logged: {direction} {amount} ')
if direction == "forward":
position['x'] += amount
elif direction == "down":
position['y'] += amount
elif direction == "up":
position['y'] -= amount
print(position['x'] * position['y'])
if __name__ == "__main__":
main()

25
2021/2/2.py Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/env python3
import re
def main():
position = { 'distance': 0, 'depth': 0, 'aim': 0 }
content = open('input', 'r').readlines()
for line in content:
move = line.strip()
match = re.match('^(\w+) (\d+)$', move)
direction, amount = match.groups(1)
amount = int(amount)
#print(f'logged: {direction} {amount} ')
if direction == "forward":
position['distance'] += amount
position['depth'] += position['aim'] * amount
elif direction == "down":
position['aim'] += amount
elif direction == "up":
position['aim'] -= amount
print(position['distance'] * position['depth'])
if __name__ == "__main__":
main()

1000
2021/2/input Executable file

File diff suppressed because it is too large Load Diff

10
2021/2/template.py Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env python3
POSITION = { 'x': 0, 'y': 0 }
def main():
content = open('input', 'r').read()
if __name__ == "__main__":
main():

28
2021/3/1.py Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env python3
def main():
content = open('input', 'r').readlines()
input_length = len(content)
# init with first row
popcounts = [int(bit) for bit in content.pop(0).strip()]
#print(popcounts)
for line in content:
popcounts = list(map(int.__add__, popcounts, [int(bit) for bit in line.strip()]))
gamma_rate = ""
for val in popcounts:
if val >= (input_length/2):
gamma_rate += "1"
else:
gamma_rate += "0"
mask = (1 << len(popcounts)) - 1
gamma_rate = int(gamma_rate, 2)
epsilon_rate = gamma_rate ^ mask
print(f'gamma: {bin(gamma_rate)}')
print(f'epsil: {bin(epsilon_rate)}')
print(gamma_rate * epsilon_rate)
if __name__ == "__main__":
main()

64
2021/3/2.py Executable file
View File

@ -0,0 +1,64 @@
#!/usr/bin/env python3
def is_bit_set(integer, bit_index):
return bool(integer & (1 << bit_index))
def get_mcv(_input):
input_length = len(_input)
popcounts = [0 for bit in range(len(_input[0].strip()))]
#print(popcounts)
for line in _input:
popcounts = list(map(int.__add__, popcounts, [int(bit) for bit in line.strip()]))
mcv = []
for val in popcounts:
if val >= (input_length/2):
mcv.append(1)
else:
mcv.append(0)
return mcv
def main():
content = open('input', 'r').readlines()
#mcv = get_mcv(content)
# mask = (1 << len(popcounts)) - 1
# gamma_rate = int(gamma_rate, 2)
# epsilon_rate = gamma_rate ^ mask
# print(f'gamma: {bin(gamma_rate)}')
# print(f'epsil: {bin(epsilon_rate)}')
#print(f'mcv: {mcv}')
bit_length = len(content[0].strip())
oxy_input = content
while len(oxy_input) > 1:
offset = 0
while offset < bit_length:
mcv = get_mcv(oxy_input)
print(mcv)
print(f'length {len(oxy_input)} offset {offset} mcv {mcv[offset]} ')
oxy_input = [x for x in oxy_input if int(x[offset]) == mcv[offset]]
if len(oxy_input) == 1:
break
offset += 1
oxygen_value = int(oxy_input[0].strip(), 2)
co_input = content
while len(co_input) > 1:
offset = 0
while offset < bit_length:
print(f'length {len(co_input)} offset {offset} mcv {mcv[offset]} ')
mcv = get_mcv(co_input)
print(mcv)
co_input = [x for x in co_input if int(x[offset]) != mcv[offset]]
if len(co_input) == 1:
break
offset += 1
co_value = int(co_input[0].strip(), 2)
print(co_value * oxygen_value)
if __name__ == "__main__":
main()

1000
2021/3/input Executable file

File diff suppressed because it is too large Load Diff

7
2021/3/template.py Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env python3
def main():
content = open('input', 'r').read()
if __name__ == "__main__":
main():

BIN
2021/4/.1.py.swp Executable file

Binary file not shown.

66
2021/4/1.py Executable file
View File

@ -0,0 +1,66 @@
#!/usr/bin/env python3
class BingoBoard():
def __init__(self, board):
self._hits = [[False for x in range(5)] for x in range(5)]
self._board = board
self._remaining = 0
self.bingo = False
for line in board:
line = list(map(int, line))
self._remaining += sum(line)
def isBingo(self):
rowBingo = any(all(row) for row in self._hits)
colBingo = any(all(row[col] for row in self._hits) for col in range(len(self._board)))
if colBingo or rowBingo:
self.bingo = True
return self.bingo
def checkField(self, field):
for row_idx, row in enumerate(self._board):
try:
col_idx = row.index(field)
self._hits[row_idx][col_idx] = True
self._remaining -= int(field)
return True
except ValueError:
pass
return False
def getRemaining(self):
return self._remaining
def chunker(seq, size):
return (seq[pos:pos + size] for pos in range(0, len(seq), size))
def main():
content = open('input', 'r').readlines()
content = list(map(str.strip, content))
content = [line for line in content if line != ""]
draws = content.pop(0).split(',')
print(draws)
boards = []
for board in chunker(content, 5):
board = list(map(str.split, board))
boards.append(BingoBoard(board))
print(f'Loaded {len(boards)} boards, playing {len(draws)} moves')
boards_finished = 0
total_boards = len(boards)
for draw in draws:
print(f'New number drawn: {draw}')
boards_hit = 0
for board in boards:
if not board.bingo:
if board.checkField(draw):
boards_hit += 1
if board.isBingo():
print('WE HAVE A WINNER!')
print(board.getRemaining() * int(draw))
boards_finished += 1
#boards.remove(board)
#break
print(f'{boards_hit} hit this draw')
if __name__ == "__main__":
main()

601
2021/4/input Executable file
View File

@ -0,0 +1,601 @@
67,3,19,4,64,39,85,14,84,93,79,26,61,24,65,63,15,69,48,8,82,75,36,96,16,49,28,40,97,38,76,91,83,7,62,94,21,95,6,10,43,17,31,34,81,23,52,60,54,29,70,12,35,0,57,45,20,71,78,44,90,2,33,68,53,92,50,73,88,47,58,5,9,87,22,13,18,30,59,56,99,11,77,55,72,32,37,89,42,27,66,41,86,51,74,1,46,25,98,80
24 75 59 41 17
58 74 64 92 39
68 8 78 85 72
18 3 22 4 34
11 76 6 28 50
21 31 36 13 87
80 91 63 62 77
46 93 40 16 25
47 66 30 54 74
56 59 86 72 37
92 43 68 60 81
3 78 75 73 12
90 50 31 67 76
28 63 52 95 61
6 38 79 19 17
81 20 61 60 86
43 27 50 21 85
77 84 68 76 24
33 13 89 1 48
6 57 30 11 5
66 24 22 86 2
67 77 72 88 87
21 60 89 36 32
39 37 29 17 31
78 97 63 94 91
85 71 86 16 54
98 11 82 89 17
38 23 99 59 69
58 12 74 15 93
41 5 52 48 26
3 32 61 29 27
98 74 34 58 23
24 54 76 79 88
71 90 97 96 68
21 33 72 47 82
13 70 59 7 91
74 88 85 50 15
35 8 40 93 6
95 29 52 18 99
57 64 0 9 39
72 6 74 64 0
73 9 46 52 98
81 68 14 69 48
25 17 5 54 19
11 47 33 23 62
45 14 90 59 97
43 46 58 55 29
80 53 2 37 78
40 79 57 52 72
92 13 54 25 19
39 78 99 84 2
80 53 24 51 5
33 20 48 43 66
82 13 52 30 98
14 16 26 44 74
38 35 45 83 94
18 28 41 22 13
44 9 10 98 58
64 73 24 31 34
39 85 50 77 63
71 18 68 47 65
25 40 82 69 44
30 6 72 73 7
80 24 41 79 2
11 20 96 84 54
16 6 38 75 25
56 2 51 69 81
15 54 91 85 90
94 0 7 71 30
28 17 76 67 31
13 12 23 7 71
91 89 84 40 78
44 83 90 21 31
77 17 3 95 42
87 82 38 30 67
44 64 60 76 36
21 39 86 89 34
5 54 24 14 58
78 55 98 74 69
2 97 42 59 51
51 35 78 54 40
9 52 5 66 19
92 74 68 90 73
76 11 60 67 22
44 7 1 89 15
93 72 3 95 13
77 1 32 35 5
68 91 98 23 51
59 19 31 57 56
54 46 92 88 26
84 91 40 9 73
90 41 51 12 10
0 61 89 13 8
62 74 5 45 92
65 27 78 26 31
54 21 32 84 42
68 25 76 3 40
24 15 59 12 2
72 49 73 31 93
35 67 70 60 91
55 34 51 76 54
73 28 5 87 52
24 36 65 49 27
99 10 12 44 50
23 77 53 80 4
30 42 92 11 40
83 49 41 72 54
73 97 18 4 37
0 15 70 55 33
71 26 46 25 81
22 35 41 71 58
55 39 18 85 45
79 44 9 38 2
47 4 23 34 82
49 63 88 81 29
49 82 40 37 77
17 45 92 7 65
51 38 91 68 32
73 57 69 85 50
87 10 95 59 1
57 27 95 59 87
78 96 82 63 52
39 17 14 74 21
47 64 28 94 65
40 3 49 25 61
97 9 24 80 27
5 36 83 15 29
86 33 32 61 2
87 48 82 91 4
35 10 16 85 65
17 12 43 96 5
36 76 29 51 73
98 66 27 97 91
78 28 2 61 30
95 70 19 47 54
98 88 51 32 7
89 61 16 91 95
94 23 19 77 70
42 90 36 26 44
99 71 5 57 13
14 43 97 72 83
39 73 58 16 59
51 2 28 24 18
40 70 65 27 91
4 44 68 74 56
90 9 71 23 73
11 95 62 36 38
77 34 60 67 41
28 48 98 40 42
47 51 82 87 63
19 41 57 61 50
64 84 8 81 11
83 68 31 66 90
2 72 71 96 79
78 89 77 60 4
73 88 72 23 68
98 52 21 89 43
48 29 10 8 6
49 3 54 37 12
83 34 51 77 66
52 16 94 84 81
3 87 99 72 98
48 10 44 32 22
9 69 36 74 62
51 42 91 68 60
39 54 16 97 14
58 84 89 15 20
67 49 19 55 86
10 44 76 12 96
74 36 51 41 2
27 22 90 79 86
47 73 2 53 58
31 89 37 19 12
20 83 87 23 30
32 8 92 55 68
19 39 64 53 12
32 7 80 72 79
82 96 21 13 40
18 25 61 9 70
84 95 42 36 52
48 12 29 61 7
34 13 99 98 6
74 36 66 91 88
75 85 93 80 83
96 11 44 47 39
79 43 28 16 75
66 64 17 71 72
36 30 19 60 38
1 13 77 69 94
78 6 97 93 63
86 45 14 38 37
35 20 15 68 55
92 3 0 90 8
88 32 87 17 22
33 34 78 13 43
87 92 58 95 6
35 23 54 40 97
82 64 88 10 94
63 8 26 98 18
42 76 39 50 51
75 13 4 72 95
11 50 15 47 52
12 73 80 74 70
68 30 21 37 58
91 2 24 32 82
76 66 4 68 79
19 73 24 51 96
16 52 26 78 7
48 30 17 82 92
28 88 90 71 59
95 18 69 85 63
16 78 97 10 41
53 98 73 87 19
15 35 94 57 82
48 40 14 3 38
39 40 78 64 87
90 69 83 18 16
58 91 36 23 74
25 51 99 4 76
62 10 88 2 1
72 95 34 2 84
38 12 97 92 47
24 23 41 10 75
56 87 68 45 89
14 85 52 98 79
96 97 15 98 17
76 13 6 38 81
66 90 51 36 85
95 48 40 99 94
69 88 19 4 1
20 36 93 50 35
13 15 6 49 92
0 70 38 29 22
68 34 73 89 71
5 10 12 79 31
16 63 34 29 2
43 57 18 51 67
83 47 49 17 96
84 33 40 7 50
60 30 41 81 76
86 85 4 48 61
34 46 89 78 23
83 8 43 57 30
21 36 7 75 37
29 40 62 60 54
47 28 42 39 57
16 46 54 52 55
78 84 32 95 23
27 26 9 75 62
90 85 0 65 37
89 46 4 81 55
68 13 79 18 90
57 73 21 15 32
59 56 62 58 36
45 98 64 33 12
89 92 3 69 78
45 50 12 71 72
18 87 64 48 88
84 77 53 17 62
68 6 83 91 2
5 80 25 90 19
21 86 66 69 61
22 59 39 54 91
9 27 14 24 40
95 74 18 63 11
84 63 42 80 61
23 39 49 92 25
56 64 70 2 88
99 29 15 26 9
82 91 35 7 40
4 93 44 42 16
78 72 32 73 81
84 91 85 82 69
88 49 59 92 96
61 99 19 33 38
87 2 46 16 83
29 31 45 37 51
25 65 26 89 19
80 17 27 8 73
54 4 76 0 12
50 65 47 43 31
58 94 90 71 12
27 3 81 45 9
1 33 37 15 83
96 26 41 77 57
22 54 71 73 5
64 77 15 98 38
61 90 20 57 40
60 18 83 72 12
34 91 87 41 21
82 29 51 16 61
37 41 86 20 19
59 30 43 15 53
17 83 5 14 89
78 70 1 12 62
19 95 68 67 92
14 70 73 62 29
40 9 97 82 66
11 50 77 47 53
20 75 88 94 93
48 39 62 56 44
95 43 10 89 60
40 0 73 17 59
50 2 8 4 5
24 79 20 13 96
25 40 36 54 13
46 48 37 71 26
29 42 27 44 23
24 61 79 3 90
97 21 43 86 18
95 4 14 12 71
11 55 50 83 85
9 43 29 32 28
78 20 63 87 40
61 84 37 75 77
4 96 87 22 2
95 70 39 35 49
23 27 19 43 0
42 75 36 52 11
13 8 57 88 46
37 5 87 58 86
65 78 89 57 79
70 40 14 80 97
88 55 68 28 13
53 59 24 26 1
5 95 59 71 23
44 57 34 65 83
49 93 9 77 28
37 69 79 99 73
17 27 33 66 85
75 61 32 0 16
65 59 47 25 81
87 97 8 50 70
78 34 38 42 51
22 63 6 66 1
65 68 77 1 19
53 14 7 88 9
11 22 40 25 39
69 93 37 72 5
90 80 38 10 16
15 81 62 68 44
26 70 43 55 89
22 69 8 94 51
52 19 79 96 10
24 48 63 74 84
36 9 57 4 40
95 98 58 70 87
45 97 92 23 86
6 31 15 78 12
90 75 48 41 3
34 97 31 92 20
59 6 89 79 70
39 90 16 72 91
76 75 85 47 68
86 62 32 19 64
44 5 72 25 32
87 18 93 33 0
22 96 46 4 28
61 81 77 52 80
66 24 63 23 45
53 33 99 31 75
60 39 56 89 57
76 81 14 95 23
8 19 98 13 5
49 91 54 47 7
11 58 44 6 94
31 87 50 77 22
49 9 40 24 60
86 36 12 3 71
59 99 68 20 66
83 11 93 36 6
73 55 97 48 18
3 43 51 90 57
38 65 39 95 68
94 24 59 20 34
53 57 69 3 16
2 91 22 24 26
44 84 31 28 82
46 94 65 78 99
55 49 11 66 21
10 53 20 69 41
70 12 56 2 94
87 23 74 60 55
59 67 18 38 22
71 4 51 81 39
59 32 64 66 53
20 11 27 10 81
41 93 12 45 99
70 94 77 16 76
30 79 57 0 90
84 8 76 13 98
96 1 9 65 38
23 30 64 3 95
70 26 34 86 79
2 22 77 41 68
77 11 55 80 21
45 70 28 0 57
38 74 33 86 22
42 13 66 61 83
46 94 7 82 40
53 68 94 71 64
44 99 86 66 97
80 33 48 74 45
29 13 11 15 62
36 89 9 47 56
49 90 16 55 14
68 13 27 47 46
54 93 97 10 31
33 58 6 83 48
63 28 95 8 62
72 60 12 24 20
1 22 90 58 65
84 5 96 80 33
64 15 47 23 46
63 36 6 31 91
19 27 96 54 36
33 32 65 11 26
0 47 25 59 56
41 45 76 14 98
52 22 31 66 38
7 91 5 18 14
4 19 54 42 71
31 82 81 61 39
58 51 70 10 55
43 60 15 89 21
85 31 75 55 76
92 93 54 98 44
21 22 6 79 20
34 64 7 82 78
53 36 96 37 19
84 58 35 68 76
79 91 92 25 29
93 83 23 22 80
51 28 53 60 40
0 62 77 49 39
35 38 24 88 53
61 30 52 49 83
20 97 6 16 55
60 43 14 67 4
66 9 85 28 77
73 57 65 36 50
18 94 14 59 67
7 78 40 6 13
86 49 5 22 66
63 32 68 44 80
52 95 93 25 16
0 83 41 77 49
13 63 65 84 69
51 9 39 47 24
92 4 14 8 66
70 31 33 69 50
36 29 76 56 64
97 11 40 19 81
18 57 10 24 15
30 44 42 89 60
42 97 9 38 60
48 62 53 70 27
49 72 90 86 18
69 50 8 78 84
28 13 17 10 35
84 7 60 17 36
30 1 3 89 49
45 10 85 97 76
31 38 16 2 12
43 58 11 77 78
53 20 98 94 82
54 62 27 92 83
60 41 66 5 30
58 15 90 88 3
38 45 7 26 37
62 94 17 55 28
27 86 26 42 87
90 18 84 20 85
92 97 59 83 0
89 21 25 36 11
89 60 41 91 54
16 9 57 40 53
87 56 64 23 27
13 42 84 2 52
66 77 80 0 38
58 23 55 96 75
56 8 19 52 10
98 13 70 62 73
6 64 86 4 12
51 91 93 29 34
55 8 99 51 70
33 30 52 58 10
38 31 87 9 61
63 46 15 48 24
32 94 40 74 21
5 70 26 48 28
41 35 93 34 44
46 86 19 0 27
7 81 51 95 15
36 84 76 75 92
34 0 31 21 3
23 96 49 51 11
42 27 47 66 91
93 89 16 62 54
22 71 26 32 99

7
2021/4/template.py Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env python3
def main():
content = open('input', 'r').read()
if __name__ == "__main__":
main():

39
2021/5/1.py Executable file
View File

@ -0,0 +1,39 @@
#!/usr/bin/env python3
import re
def main():
board_size = 1000
content = open('input', 'r').readlines()
content = list(map(str.strip, content))
board = [[0 for _ in range(board_size)] for _ in range(board_size)]
for line in content:
m = re.match('^(\d+),(\d+) -> (\d+),(\d+)', line)
x1, y1, x2, y2 = tuple(map(int, m.groups(1)))
if x2 < x1:
x1, x2 = x2, x1
if y2 < y1:
y1, y2 = y2, y1
if x1 == x2: # move in y
assert(y1 < y2)
print(f'marking from {x1},{y1} to {x2},{y2}')
for y in range(y1, y2+1):
board[y][x1] += 1
elif y1 == y2: # move in x
print(f'marking from {x1},{y1} to {x2},{y2}')
assert(x1 < x2)
for x in range(x1, x2+1):
board[y1][x] += 1
else:
print(f'skipped: going from {x1},{y1} to {x2},{y2}')
hotspots = 0
for line in board:
for cell in line:
if cell > 1:
hotspots += 1
print(hotspots)
if __name__ == "__main__":
main()

50
2021/5/2.py Executable file
View File

@ -0,0 +1,50 @@
#!/usr/bin/env python3
import re
def main():
board_size = 1000
content = open('input', 'r').readlines()
content = list(map(str.strip, content))
board = [[0 for _ in range(board_size)] for _ in range(board_size)]
for line in content:
m = re.match('^(\d+),(\d+) -> (\d+),(\d+)', line)
x1, y1, x2, y2 = tuple(map(int, m.groups(1)))
if x1 == x2: # move in y
if y2 < y1:
y1, y2 = y2, y1
assert(y1 < y2)
print(f'marking from {x1},{y1} to {x2},{y2}')
for y in range(y1, y2+1):
board[y][x1] += 1
elif y1 == y2: # move in x
if x2 < x1:
x1, x2 = x2, x1
print(f'marking from {x1},{y1} to {x2},{y2}')
assert(x1 < x2)
for x in range(x1, x2+1):
board[y1][x] += 1
else: # move diagonal
#
offset_x = x2 - x1
offset_y = y2 - y1
if offset_x > 0: x_step = 1
else: x_step = -1
if offset_y > 0: y_step = 1
else: y_step = -1
for offset in range(abs(x2-x1)+1):
board[y1+(offset*y_step)][x1+(offset*x_step)] += 1
print(f'diagonal: going from {x1},{y1} to {x2},{y2} -> ')
hotspots = 0
for line in board:
for cell in line:
if cell > 1:
hotspots += 1
print(hotspots)
if __name__ == "__main__":
main()

500
2021/5/input Executable file
View File

@ -0,0 +1,500 @@
365,809 -> 365,271
899,814 -> 899,921
967,913 -> 434,913
971,362 -> 631,362
597,422 -> 597,575
722,82 -> 722,365
98,891 -> 972,17
361,534 -> 361,52
958,858 -> 958,612
261,683 -> 261,477
859,381 -> 850,372
773,305 -> 703,305
527,318 -> 281,72
29,119 -> 863,953
428,723 -> 428,971
582,787 -> 582,326
795,495 -> 795,525
920,548 -> 920,718
421,264 -> 714,557
635,310 -> 635,983
751,479 -> 534,696
121,768 -> 121,129
679,858 -> 737,858
499,549 -> 603,653
398,95 -> 398,537
459,626 -> 473,626
611,905 -> 854,662
139,124 -> 568,124
230,921 -> 960,191
550,258 -> 883,258
866,830 -> 681,645
501,840 -> 774,840
383,900 -> 383,536
635,690 -> 868,690
37,948 -> 954,31
785,598 -> 785,955
844,957 -> 130,243
395,307 -> 562,307
463,286 -> 374,286
798,351 -> 52,351
549,79 -> 549,300
153,847 -> 977,23
499,976 -> 499,576
687,281 -> 621,215
765,640 -> 794,640
776,287 -> 906,157
879,108 -> 333,108
340,565 -> 340,521
706,809 -> 159,262
725,896 -> 941,896
673,470 -> 792,470
446,562 -> 638,754
315,626 -> 189,500
816,637 -> 77,637
171,313 -> 171,82
941,19 -> 150,810
885,854 -> 513,854
864,177 -> 864,213
156,150 -> 544,538
810,20 -> 344,486
651,757 -> 623,729
567,475 -> 126,475
436,975 -> 707,975
948,977 -> 138,167
498,186 -> 601,289
532,900 -> 532,515
12,809 -> 60,761
561,344 -> 453,452
241,600 -> 780,61
600,574 -> 258,232
53,661 -> 224,490
735,134 -> 735,707
850,14 -> 398,14
472,489 -> 472,22
949,196 -> 492,196
220,30 -> 959,769
354,889 -> 632,889
779,537 -> 397,919
136,876 -> 896,116
12,983 -> 930,65
716,856 -> 716,516
595,604 -> 595,97
863,70 -> 946,70
13,988 -> 988,13
595,955 -> 978,955
138,300 -> 138,452
801,883 -> 830,854
189,13 -> 110,13
315,68 -> 147,68
594,977 -> 594,707
424,726 -> 836,314
596,790 -> 842,790
135,135 -> 823,823
257,639 -> 718,178
462,859 -> 965,859
935,29 -> 18,946
308,841 -> 676,473
372,607 -> 946,607
518,806 -> 201,489
620,689 -> 620,480
376,378 -> 376,900
86,675 -> 179,768
509,790 -> 509,501
778,143 -> 778,474
965,140 -> 194,911
621,458 -> 316,153
83,931 -> 959,55
533,647 -> 402,778
957,336 -> 397,336
929,788 -> 929,587
642,978 -> 647,978
429,275 -> 276,275
662,821 -> 120,279
137,208 -> 85,260
815,641 -> 763,589
222,510 -> 881,510
892,930 -> 845,930
288,268 -> 288,509
900,13 -> 79,13
438,764 -> 248,764
391,495 -> 391,771
868,713 -> 223,68
680,180 -> 680,553
911,389 -> 911,578
107,182 -> 107,555
944,787 -> 944,25
405,193 -> 569,193
341,182 -> 952,182
497,197 -> 820,197
204,224 -> 693,224
342,290 -> 342,479
881,281 -> 881,899
971,987 -> 11,27
389,729 -> 501,729
638,939 -> 316,617
923,799 -> 923,84
17,744 -> 17,47
305,163 -> 305,506
703,414 -> 74,414
572,537 -> 122,987
385,364 -> 385,403
667,825 -> 667,607
466,86 -> 842,86
591,209 -> 151,649
329,526 -> 329,772
756,769 -> 122,135
638,454 -> 380,454
316,98 -> 654,98
273,740 -> 627,386
88,982 -> 963,107
913,710 -> 913,157
530,410 -> 129,410
660,237 -> 256,641
865,149 -> 865,934
769,47 -> 76,740
520,876 -> 520,630
101,839 -> 394,546
422,874 -> 330,874
987,19 -> 20,986
398,771 -> 174,771
574,546 -> 582,546
896,52 -> 11,937
927,927 -> 927,923
111,822 -> 953,822
633,130 -> 76,130
193,74 -> 193,400
887,828 -> 887,160
284,313 -> 500,97
813,500 -> 839,500
312,534 -> 129,534
202,34 -> 202,196
740,597 -> 681,597
37,979 -> 892,124
494,235 -> 494,426
334,892 -> 334,788
679,728 -> 947,728
635,557 -> 242,950
301,713 -> 326,738
261,867 -> 986,867
959,344 -> 412,891
605,659 -> 647,701
806,931 -> 270,395
546,107 -> 150,107
836,793 -> 131,88
231,572 -> 99,572
257,580 -> 257,459
254,669 -> 254,52
105,26 -> 973,894
101,532 -> 339,770
854,695 -> 319,160
599,190 -> 227,562
783,816 -> 370,816
505,638 -> 889,638
742,615 -> 742,399
984,750 -> 984,662
295,736 -> 937,94
762,435 -> 239,958
876,89 -> 758,89
178,964 -> 651,964
385,389 -> 67,71
514,967 -> 462,915
819,758 -> 819,978
541,109 -> 767,109
137,262 -> 137,815
720,591 -> 934,805
56,79 -> 752,775
493,519 -> 493,278
202,718 -> 202,344
665,24 -> 446,24
426,845 -> 426,193
116,930 -> 982,64
625,587 -> 625,908
13,965 -> 919,59
124,466 -> 124,194
793,249 -> 480,562
20,174 -> 359,174
982,988 -> 25,31
71,416 -> 586,416
157,122 -> 363,122
31,453 -> 344,453
435,284 -> 387,284
389,446 -> 379,446
913,536 -> 32,536
505,952 -> 505,495
489,159 -> 222,426
267,118 -> 954,805
15,833 -> 15,323
77,197 -> 946,197
955,22 -> 955,798
620,707 -> 620,915
740,495 -> 740,334
770,735 -> 770,184
420,524 -> 420,108
382,982 -> 556,982
111,777 -> 867,21
280,105 -> 915,740
235,23 -> 863,651
679,402 -> 197,884
72,77 -> 829,834
858,486 -> 443,486
403,115 -> 403,342
489,547 -> 489,53
404,280 -> 950,826
680,458 -> 260,458
10,610 -> 315,915
386,630 -> 128,888
293,732 -> 293,861
204,378 -> 116,378
90,269 -> 90,173
893,869 -> 92,68
741,694 -> 741,136
620,449 -> 620,62
866,678 -> 441,253
885,212 -> 167,930
868,853 -> 868,852
392,926 -> 982,336
252,930 -> 829,930
758,606 -> 949,606
79,895 -> 798,176
394,688 -> 901,688
355,217 -> 355,732
43,23 -> 903,883
426,691 -> 695,422
970,416 -> 970,950
317,334 -> 957,974
198,160 -> 198,195
610,191 -> 852,191
388,569 -> 899,58
490,662 -> 517,689
691,627 -> 643,627
404,564 -> 539,564
946,623 -> 478,155
686,608 -> 686,213
573,508 -> 47,508
610,262 -> 610,905
782,602 -> 581,602
987,378 -> 987,391
443,243 -> 447,243
710,493 -> 54,493
564,179 -> 564,966
828,673 -> 828,691
761,869 -> 260,869
810,949 -> 192,331
674,263 -> 467,263
481,81 -> 940,540
779,301 -> 159,301
763,457 -> 574,646
794,770 -> 784,780
19,964 -> 973,10
809,720 -> 809,142
822,324 -> 822,112
120,980 -> 354,980
238,277 -> 636,675
747,647 -> 550,450
419,205 -> 419,494
34,968 -> 719,283
306,591 -> 401,496
648,673 -> 526,795
486,426 -> 44,426
441,642 -> 137,338
396,740 -> 585,740
741,227 -> 117,851
620,263 -> 319,263
421,321 -> 300,321
732,387 -> 732,784
445,59 -> 445,273
151,910 -> 220,841
836,599 -> 274,599
598,193 -> 95,193
718,765 -> 884,931
403,165 -> 591,165
241,441 -> 736,441
902,986 -> 190,274
190,671 -> 190,342
887,301 -> 887,216
878,747 -> 244,113
93,747 -> 814,26
764,604 -> 764,444
510,852 -> 175,852
50,718 -> 132,718
791,436 -> 95,436
751,122 -> 751,146
953,162 -> 953,168
113,546 -> 113,828
752,407 -> 482,407
398,412 -> 305,412
912,630 -> 830,630
699,155 -> 354,155
842,874 -> 451,483
18,83 -> 580,645
63,594 -> 945,594
557,286 -> 557,773
21,448 -> 21,11
955,724 -> 955,353
857,411 -> 857,41
605,932 -> 605,159
985,64 -> 216,833
34,673 -> 610,97
888,764 -> 888,415
574,801 -> 646,801
290,593 -> 290,694
151,72 -> 887,808
632,53 -> 632,98
346,686 -> 963,69
258,129 -> 582,453
189,205 -> 646,662
272,821 -> 946,147
409,531 -> 462,478
725,575 -> 894,575
885,888 -> 885,878
475,210 -> 763,210
42,963 -> 920,85
985,213 -> 271,213
538,842 -> 482,842
175,529 -> 662,529
853,670 -> 259,76
656,364 -> 373,647
114,134 -> 827,134
58,878 -> 58,569
45,340 -> 684,979
35,829 -> 611,829
625,166 -> 625,898
849,980 -> 143,980
720,92 -> 330,92
689,255 -> 689,389
842,526 -> 867,526
834,399 -> 395,838
325,212 -> 786,673
934,941 -> 31,38
211,640 -> 812,39
449,896 -> 82,896
795,757 -> 630,592
894,691 -> 894,11
639,839 -> 639,360
941,862 -> 676,862
480,757 -> 480,123
425,734 -> 425,332
391,704 -> 350,745
173,352 -> 131,352
814,703 -> 814,150
347,156 -> 609,156
427,520 -> 862,520
787,724 -> 206,724
313,587 -> 312,587
743,491 -> 743,580
277,964 -> 845,396
132,65 -> 864,797
227,619 -> 227,365
360,484 -> 299,484
717,790 -> 875,790
798,480 -> 413,95
643,518 -> 643,407
939,530 -> 440,31
241,44 -> 241,82
362,49 -> 316,49
160,98 -> 382,98
67,593 -> 508,593
363,456 -> 470,456
644,63 -> 273,63
341,696 -> 72,696
270,303 -> 270,60
716,391 -> 716,983
678,904 -> 756,826
480,487 -> 290,487
762,316 -> 762,969
380,735 -> 380,652
223,922 -> 436,709
690,733 -> 815,733
185,130 -> 555,130
10,931 -> 924,17
678,940 -> 891,940
702,112 -> 702,673
554,559 -> 812,301
406,758 -> 377,758
361,119 -> 96,384
787,356 -> 787,963
957,54 -> 23,988
636,650 -> 34,48
170,21 -> 170,541
955,103 -> 85,973
144,698 -> 381,698
85,55 -> 925,895
12,15 -> 978,981
32,954 -> 32,301
438,234 -> 195,477
121,438 -> 121,542
353,607 -> 919,607
978,646 -> 978,643
925,112 -> 925,646
447,120 -> 447,104
332,398 -> 568,162
399,841 -> 276,841
923,853 -> 923,820
890,202 -> 964,202
306,782 -> 871,217
547,558 -> 21,32
893,164 -> 508,549
485,76 -> 361,76
713,768 -> 570,768
314,18 -> 461,18
618,281 -> 715,281
374,787 -> 374,209
324,97 -> 405,97
890,729 -> 566,729
762,438 -> 762,978
274,49 -> 274,525
905,34 -> 905,741
799,384 -> 799,742
378,358 -> 378,17
805,131 -> 31,905
640,453 -> 640,800
563,305 -> 563,945
898,590 -> 57,590
513,187 -> 513,76
706,407 -> 500,407
235,69 -> 861,695
408,259 -> 624,43
327,308 -> 722,308
109,247 -> 183,247
487,493 -> 619,625
769,452 -> 899,452
727,765 -> 524,968
887,472 -> 801,472
157,100 -> 936,879
584,658 -> 584,582
557,488 -> 557,510
790,35 -> 28,797
458,920 -> 350,812
54,797 -> 790,61
59,387 -> 59,334
565,368 -> 268,368
70,146 -> 70,525
681,451 -> 242,890
869,831 -> 869,272
276,184 -> 276,517
984,922 -> 984,426
616,572 -> 307,881
323,806 -> 700,806
595,547 -> 595,651
731,638 -> 731,582
760,836 -> 31,107
768,377 -> 347,798
847,765 -> 431,765
777,95 -> 777,837
832,330 -> 460,330
423,213 -> 423,110
937,549 -> 937,882
529,735 -> 570,735
436,343 -> 771,343
965,833 -> 965,143
518,484 -> 65,31
940,989 -> 940,293
983,63 -> 63,983
237,733 -> 237,735
624,281 -> 624,330
473,719 -> 633,719
312,489 -> 872,489
369,520 -> 539,520
80,705 -> 133,652
659,289 -> 163,785

13
2021/5/template.py Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env python3
import re
def main():
content = open('input', 'r').readlines()
content = list(map(str.strip, content))
for line in content:
m = re.match('^(\d+),(\d+) -> (\d+),(\d+)')
x1, y1, x2, y2 = m.groups(1)
print(f'going from {x1},{y2} to {x2},{y2}')
if __name__ == "__main__":
main()