import time
from contextlib import contextmanager

@contextmanager
def timing(label):
    start_time = time.time()
    yield
    elapsed = time.time() - start_time
    print('{} took {}ms'.format(label, elapsed * 1000))


def add(a, b):
    return (a[0] + b[0], a[1] + b[1])


def sub(a, b):
    return (a[0] - b[0], a[1] - b[1])


def dist(a, b):
    """ Returns the 'manhattan distance' between a and b """
    return abs(a[0] - b[0]) + abs(a[1] - b[1])


def neighbours(pos):
    # Inlined for performance:
    return [
        (pos[0], pos[1] + 1),
        (pos[0] + 1, pos[1]),
        (pos[0], pos[1] - 1),
        (pos[0] + -1, pos[1])
    ]

@@ -214,17 +214,16 @@
 1000))%0A%0A
-%0A
 def add(
@@ -264,25 +264,24 @@
 1%5D + b%5B1%5D)%0A%0A
-%0A
 def sub(a, b
@@ -275,32 +275,32 @@
 %0Adef sub(a, b):%0A
+
     return (a%5B0%5D
@@ -318,25 +318,24 @@
 1%5D - b%5B1%5D)%0A%0A
-%0A
 def dist(a, 
@@ -447,17 +447,16 @@
  b%5B1%5D)%0A%0A
-%0A
 def neig

remove spaces