# Story&Task
 The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all houses in the city were built in one row.

 Let's enumerate all the houses from left to right, starting with 0. A house is considered to be luxurious if the number of floors in it is strictly greater than in each house with larger number. In other words, a house is luxurious if the number of floors in it is strictly greater than in all houses, located to the right from it.

 The new architect is interested in n questions, the ith of them is the following: "how many floors should be added to the ith house to make it luxurious?" (For each i from 1 to n, inclusive). You need to help him cope with this task.

 Note that all these questions are independent from each other — the answer to the question for house i does not affect other answers (i.e., the floors to the houses are not actually added).

# Input/Output


 - `[input]` integer array `houses`

  Array of positive integers, representing the number of floors in each house.

  The ith element is the number of houses in the ith house.

  `1 ≤ houses.length ≤ 1000`


 - `[output]` an integer array

  An array has the same length as input array, the ith element represents the number of floors that should be added to the ith house to make it luxurious.
  
# Example

 For `houses = [1,2,3,1,2]`, the output should be `[3,2,0,2,0]`.
 ```
 For houses[0], 3 floors should be added, 
 then its floors is strictly greater than all houses of right side.
 
 For houses[1], 2 floors should be added.
 
 For houses[2], no need to add floor
 because it's already the luxurious.
 
 For houses[3], 2 floors need to added
 
 For houses[4], no house on the right, 
 so no need to add any floor.
 ```

Difficulty: introductory

Starter code:

def luxhouse(houses):
	

Solutions:
def luxhouse(houses):
    return [max(0, max(houses[i:]) - h + 1) for i, h in enumerate(houses[:-1], 1)] + [0]

from itertools import accumulate

def luxhouse(houses):
    return [max(0, y-x+1) for x,y in zip(houses[::-1], accumulate([0] + houses[:0:-1], max))][::-1]

def luxhouse(a):
    li = []
    for i, j in enumerate(a[:-1]):
        right = max(a[i + 1:])
        li.append(0 if j > right else right - j + 1 if right != j else 1)
    return li+[0] 

def luxhouse(houses):
    def f():
        m = 0
        for fl in reversed(houses):
            yield max(0, m - fl + 1)
            m = max(m, fl)
    return list(f())[::-1]

def luxhouse(houses):
    return [max(max(houses[i+1:])-j+1,0) for i,j in enumerate(houses[:-1])] +[0]

def luxhouse(houses):
    return [max(0, max(houses[h+1:])-houses[h]+1) for h in range(len(houses)-1)]+[0]

def luxhouse(houses):
    lux = 0
    """ \o/  https://www.youtube.com/watch?v=n0DscZs7SXo  \o/   ;-D """
    
    ans = [0] * len(houses)
    for n in range(len(houses)-1, -1, -1):
        if houses[n] > lux: lux = houses[n]
        else:               ans[n] = lux - houses[n] + 1
    return ans

def luxhouse(houses):
    return [(max(houses[i], max(houses[i+1:])+1)) - houses[i] for i in range(len(houses) - 1)] + [0]


def luxhouse(houses):
    maxh = [houses[i] for i in range(len(houses))]
    maxh[-1] = houses[-1]
    for i in range(len(houses)-2, -1, -1):
        maxh[i] = max(maxh[i], maxh[i+1])
    for i in range(len(houses)-1):
        if maxh[i] == maxh[i+1]:
            maxh[i] += 1
    return [maxh[i]-houses[i] for i in range(len(houses))]

def luxhouse(houses):
    return [0 if not houses[i + 1:] else max(max(houses[i + 1:]) + 1 - houses[i], 0) for i in range(len(houses))]