### Task
You've just moved into a perfectly straight street with exactly ```n``` identical houses on either side of the road. Naturally, you would like to find out the house number of the people on the other side of the street. The street looks something like this:

--------------------
### Street
```
1|   |6
3|   |4
5|   |2
```

Evens increase on the right; odds decrease on the left. House numbers start at ```1``` and increase without gaps.
When ```n = 3```, ```1``` is opposite ```6```, ```3``` opposite ```4```, and ```5``` opposite ```2```. 

-----------------
### Example
Given your house number ```address``` and length of street ```n```, give the house number on the opposite side of the street.

```CoffeeScript
overTheRoad(address, n)
overTheRoad(1, 3) = 6
overTheRoad(3, 3) = 4
overTheRoad(2, 3) = 5
overTheRoad(3, 5) = 8
```

```python
over_the_road(address, n)
over_the_road(1, 3) = 6
over_the_road(3, 3) = 4
over_the_road(2, 3) = 5
over_the_road(3, 5) = 8
```


Both n and address could get upto 500 billion with over 200 random tests.

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Mathematics

Starter code: def over_the_road(address, n):
	

Solutions:
def over_the_road(address, n):
	return 2 * n + 1 - address


def over_the_road(a, n):
	return 2 * n + 1 - a if 0 < a <= 2 * n else -1


def over_the_road(address, n):
	l = range(1, n * 2, 2)
	r = range(n * 2, 0, -2)
	if address % 2:
		return r[l.index(address)]
	else:
		return l[r.index(address)]


def over_the_road(address, n):
	if address % 2 == 0:
		return int(n * 2 - 1 - (address / 2 - 1) * 2)
	else:
		return int(n * 2 - ((address + 1) / 2 - 1) * 2)


def over_the_road(a, n):
	return n * 2 - a + 1


def over_the_road(address, street):
	return 2 * street - address + 1


def over_the_road(a, n):
	return n * 2 - 2 * (a // 2) + (a % 2 == 0)


def over_the_road(address, n):
	return (n - address // 2) * 2 if address % 2 else (n - address // 2) * 2 + 1


def over_the_road(address, n):
	result = 0
	if address % 2 == 0:
		result = n * 2 - address + 1
	elif address % 2 == 1:
		result = n * 2 - (address - 1)
	return result


def over_the_road(address, n):
	if address % 2 != 0:
		position = (address + 1) / 2
		neighbor = (n - position + 1) * 2
	else:
		position = -(address / 2) + n + 1
		neighbor = position * 2 - 1
	return neighbor


def over_the_road(address, n):
	if address % 2:
		nth = (address - 1) // 2 + 1
		event_nth = n + 1 - nth
		print(2 + (event_nth - 1) * 2)
		return 2 + (event_nth - 1) * 2
	else:
		nth = (address - 2) // 2 + 1
		odd_nth = n + 1 - nth
		print(1 + (odd_nth - 1) * 2)
		return 1 + (odd_nth - 1) * 2


def over_the_road(address, n):
	dist = abs(1 - address)
	return n * 2 - dist


over_the_road = lambda add, n: n * 2 - (add - 1)


def over_the_road(address, n):
	if address % 2 == 0:
		p = (n * 2 - address) / 2
		return 1 + 2 * p
	else:
		p = (n * 2 - 1 - address) / 2
		return 2 + 2 * p


def over_the_road(n, l):
	return abs(n - (l * 2 + 1))


over_the_road = lambda a, n: 2 * n - 2 * (a // 2) + (1 + a) % 2


def over_the_road(address, n):
	nums = range(1, 2 * n + 1)
	if address <= n:
		return nums[-address]
	else:
		return nums[2 * n - address]


def over_the_road(add, n):
	return 2 * n - add + 1


def over_the_road(address, n):
	pass
	s = n * 2 + 1
	return s - address


def over_the_road(address, n):
	house = (address + 1) / 2
	opposite = int(n * 2 - (house - 1) * 2)
	return opposite


def over_the_road(address, n):
	x = 0
	if address in range(2 * n, 0, -2):
		x = range(2 * n, 0, -2).index(address)
		return range(1, 1 + 2 * n, 2)[x]
	elif address in range(1, 1 + 2 * n, 2):
		x = range(1, 1 + 2 * n, 2).index(address)
		return range(2 * n, 0, -2)[x]


def over_the_road(address, n):
	max_address = n * 2
	gap = max_address - address
	target = 1 + gap
	return target


def over_the_road(address, n):
	biggest_num = n * 2
	lowest_num = 1
	if address % 2 > 0:
		step = address - lowest_num
		result = biggest_num - step
		return result
	else:
		step = biggest_num - address
		result = lowest_num + step
		return result


def over_the_road(address, n):
	s = n * 2 + 1
	r = s - address
	return r


def over_the_road(address, n):
	house_index = (n * 2 - address) / 2 if address % 2 == 0 else (address - 1) / 2
	return house_index * 2 + 1 if address % 2 == 0 else n * 2 - house_index * 2


def over_the_road(address, n):
	if address % 2 == 0:
		evenpos = address / 2
		oddpos = n - evenpos
		op = oddpos * 2 + 1
		return op
	else:
		oddpos = (address - 1) / 2
		evenpos = n - oddpos
		op = evenpos * 2
		return op


def over_the_road(address, street_length):
	if address % 2 == 1:
		positionFromBottom = street_length - address // 2
		return 2 * positionFromBottom
	if address % 2 == 0:
		positionFromTop = street_length - address // 2 + 1
		return 2 * (positionFromTop - 1) + 1


def over_the_road(address, n):
	numHouse = n * 2
	if address % 2 == 0:
		p = int((numHouse - address) / 2 + 1)
		return int(p * 2 - 1)
	else:
		p = (address + 1) / 2
		return int(numHouse - 2 * (p - 1))


from math import floor

def over_the_road(address, n):
	return (n - floor((address - 1) / 2)) * 2 - (address + 1) % 2


def over_the_road(address, n):
	if address % 2 != 0:
		opp = n * 2 - (address - 1)
		return opp
	else:
		opp = n * 2 - address + 1
		return opp


def over_the_road(address, n):
	current = (n - address // 2) * 2
	if not address % 2:
		current += 1
	return current


def over_the_road(address, n):
	x = (n * 2 - address) / 2
	y = 1 + x * 2
	return y


def over_the_road(address, n):
	if address % 2 == 0:
		high_even = n * 2
		count = (high_even - address) / 2
		return count * 2 + 1
	else:
		high_odd = n * 2 - 1
		count = (high_odd - address) / 2
		return count * 2 + 2


def over_the_road(address, n):
	return (n - address // 2) * 2 + (not address % 2)


def over_the_road(adress, dlina):
	if adress % 2 == 0:
		z = adress // 2 - 1
		end = 2 * dlina - 1
	else:
		z = (adress - 1) // 2
		end = 2 * dlina
	return end - 2 * z


def over_the_road(ad, n):
	return 2 * n + 1 - ad


def over_the_road(address, n):
	answer = 0
	if address % 2 == 0:
		steps = n - address / 2
		answer = 1 + 2 * steps
	else:
		steps = n * 2 - address
		answer = steps + 1
	return answer


import math

def over_the_road(address, n):
	return 2 * n + 1 - address


def over_the_road(ad, n):
	od = list(range(1, n * 2, 2))
	ev = list(range(n * 2, 0, -2))
	return od[ev.index(ad)] if ad % 2 == 0 else ev[od.index(ad)]


def over_the_road(address, n):
	totale = 2 * n
	x = (totale - address) // 2
	y = (address - 1) // 2
	if address % 2 == 0:
		z = -totale + 1 + x * 4
		return address + z
	else:
		z = totale - 1 - y * 4
		return address + z


def over_the_road(address, n):
	if address % 2 == 1:
		x = n * 2 - (address + 1) + 2
	if address % 2 == 0:
		x = n * 2 - 1 - (address - 2)
	return x


def over_the_road(address, n):
	if address % 2 == 1:
		max = n * 2
		trunum = (address + 1) / 2
	else:
		max = n * 2 - 1
		trunum = address / 2
	trunum = int(trunum)
	max = max - (trunum - 1) * 2
	return max


def over_the_road(address, n):
	return 1 + n * 2 - address
print(over_the_road(7, 11))


def over_the_road(address, n):
	x = address - 1
	x1 = (n - x) * 2 + x
	return x1


def over_the_road(address, n):
	total = n * 2
	reultado = total - address + 1
	return reultado


def over_the_road(address, n):
	TotalHouseNumber = n * 2
	if address % 2 == 0:
		posl = (TotalHouseNumber - address) / 2
		oddnumber = (posl + 1) * 2 - 1
		return oddnumber
	else:
		posr = (TotalHouseNumber - (address + 1)) / 2
		evennumber = (posr + 1) * 2
		return evennumber