### 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.

Difficulty: introductory

Starter code:

def over_the_road(address, n):
	

Solutions:
def over_the_road(address, n):
    '''
    Input: address (int, your house number), n (int, length of road in houses) 
    Returns: int, number of the house across from your house. 
    '''
    # this is as much a math problem as a coding one 
    # if your house is [even/odd], the opposite house will be [odd/even] 
    # highest number on street is 2n 
    # Left side houses are [1, 3, ... 2n-3, 2n-1] 
    # Right side houses are [2n, 2n-2, ... 4, 2] 
    # Sum of opposite house numbers will always be 2n+1 
    return (2*n + 1 - address) 

def over_the_road(address, n):
    return n * 2 + 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):
    return n*2-address+1

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

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):
    return (n - address // 2) * 2 + (1 - address % 2)

def over_the_road(address, n):
    #two opposite addresses add to 2n+1
    return ((n*2) + 1)-address

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



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

def over_the_road(address, n):
    if address % 2 == 0: #Rechts
        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, n):
    return n * 2 - (address - 1)

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

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

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

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

def over_the_road(a, n):
    
    if a%2!=0:
        return (2*n-int(a/2)*2)
    else:
        return 2*n-int(a/2)*2+1
        
        
    
    #return st[a]


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):
    if address % 2 == 1:
        return 2*(n - address//2)
    return 1 + 2*(n - address//2)

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):
    return 2*n-address+1
                

# a n o 10(3*n+1)                
# 1 3 6
# 2 3 5
# 3 3 4
# 4 3 3
# 5 3 2
# 6 3 1

# a = 2*(n-1)
# 16
# a n    16=o+n+a o=3n+1-n-a 2*n-a+1
# 1 5 10
# 3 5 8
# 5 5 6
# 7 5 4
# 9 5 2


def over_the_road(address, n):
    # calculate address position and neighbor if address is odd 
    if address % 2 != 0:
        position = (address + 1) / 2
        neighbor = (n - position + 1) * 2
    # calculate address position and neighbor if address is even 
    else:
        position = - (address / 2) + n + 1
        neighbor = (position * 2) - 1
    return neighbor

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:return 2*(n-(address/2-1)-1)+1
    else:return 2*(n-(address-1)/2)

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(address, n):
    return 1 + (n * 2 - address) if address % 2 == 0 else n * 2 - (address - 1)

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):
    opposite_neighbour=2*n-address+1
    return opposite_neighbour

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(a, n):
    return -(a-2*n-1)

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]
    else:
        if 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):
    return 2*n - (address//2)*2 + ((address+1)%2)

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

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

    #2n -1 + 1 


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):
    return 2 * (n - address // 2) if address % 2 else 2 * (n - address // 2) + 1

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

def over_the_road(address, n):
    '''
    Input: address (int, your house number), n (int, length of road in houses) 
    Returns: int, number of the house across from your house. 
    '''

    return (2*n + 1 - address) 

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):
    n = n*2
    address = (n-address)+1
    return address

def over_the_road(address, n):
    if address % 2 == 0:
        return 1 + 2 * (n - (address / 2))
    else:
        return 2 * (n - (address // 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(a, n):
    if a%2==0:
        return 1+2*(n-a*0.5)
    else:
        return 2*(n-(a//2))


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

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

def over_the_road(address, n):
    # Loops, dictionaries and maps didn't meet performance requirements. Now trying pure math
    return (n * 2) - address + 1

    #all_addr = {index: value for index, value in enumerate(range((n*2)+1,-1,-1))}
    #rev_all_addr = {}
    #count = n * 2
    
    # return [value for index, value in enumerate(range((n*2)+1,-1,-1)) if index == address][0]
    # even_addr = n * 2
    
    # map opposite addresses
#     for odd_addr in range(1, even_addr):
#         if odd_addr % 2 > 0:
#             all_addr[odd_addr] = even_addr
#             even_addr -= 2
#     for i in range(1, count):
#         all_addr[i] = count
#         count -= 1
    
    # invert address
    # rev_all_addr = {even_addr: odd_addr for odd_addr, even_addr in all_addr.items()}
    #return all_addr[address]


#     if address % 2 > 0:
#         return all_addr[address]
#     else:
#         return rev_all_addr[address]
        #return [odd_addr for odd_addr, even_addr in all_addr.items() if even_addr == address][0]


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):
    return (2 * (n - (address - 1) / 2))

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


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


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


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

def over_the_road(address, n):
    return 2*n - address + 1
    #     oe = address%2
#     list1 = [2*(n-2) + oe - 4*i for i in range(n)]
#     return address+list1[(address-oe)/2]

#     my_street = [1 + i*2 for i in range(n)]
#     op_street = [my_street[-1]+1 - i*2 for i in range(n)]
#     if address % 2 == 0:
#         return my_street[op_street.index(address)]
#     else:
#         return op_street[my_street.index(address)]


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):
    if address % 2 != 0:
        return (n*2 - (address-1))
    else:
        return (2*n - address) + 1

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):
    if address % 2 > 0:
        return (n * 2) - (address // 2) * 2
    else:
        return ((n * 2 - address) // 2) * 2 + 1






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

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

def over_the_road(address, n):
#     the sum of the right side of the node is[1,3,5,.....,2n-1]
#     the sum of the left side of the node is [2n,2n-2,...,2]
    return (2*n+1 - address)
    pass

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

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


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

def over_the_road(address, n):
#     odd, even = [], []
#     for i in range(1, n*2+1):
#         if i % 2 == 0:
#             even += [i]
#         if i % 2 != 0:
#           odd += [i]
#     even = even[::-1]

#     return even[odd.index(address)] if address in odd else odd[even.index(address)]
    return n*2+1 - address

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

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(address, n):
    ans = n*2+1 - address
    return ans

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

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

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

def over_the_road(address, n):
    
    # Even Number Address
    if address % 2 == 0:
        x = n - address / 2
        return int(1 + 2 * x)
    
    # Odd Number Address
    else:
        x = n - (address + 1) / 2
        return int(2 + 2 * x)


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)]
# Flez


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)) # and etc...

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

def over_the_road(address, n):
    # By calculating pos of address in sequence of house nums
    # address of house in other sequence can be calculated
    
    if address//2 == 0:
        # address = 2(n + 1 - pos)
        return 2 * ((address - (2 * n) - 2) / -2) - 1
    else:
        # address = 2n - 1
        return 2 * (n + 1 - ((address + 1)/2))

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

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

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

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

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

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