I always thought that my old friend John was rather richer than he looked, but I never knew exactly how much money he actually had. One day (as I was plying him with questions) he said:

* "Imagine I have between `m` and `n` Zloty..." (or did he say Quetzal? I can't remember!)
* "If I were to buy **9** cars costing `c` each, I'd only have 1 Zloty (or was it Meticals?) left."
* "And if I were to buy **7** boats at `b` each, I'd only have 2 Ringglets (or was it Zloty?) left."

Could you tell me in each possible case:

1. how much money `f` he could possibly have ?
2. the cost `c` of a car?
3. the cost `b` of a boat?

So, I will have a better idea about his fortune. Note that if `m-n` is big enough, you might have a lot of possible answers. 

Each answer should be given as `["M: f", "B: b", "C: c"]` and all the answers as `[ ["M: f", "B: b", "C: c"], ... ]`. "M" stands for money, "B" for boats, "C" for cars.

**Note:** `m, n, f, b, c` are positive integers, where `0 <= m <= n` or `m >= n >= 0`. `m` and `n` are inclusive.


## Examples:
```
howmuch(1, 100)      => [["M: 37", "B: 5", "C: 4"], ["M: 100", "B: 14", "C: 11"]]
howmuch(1000, 1100)  => [["M: 1045", "B: 149", "C: 116"]]
howmuch(10000, 9950) => [["M: 9991", "B: 1427", "C: 1110"]]
howmuch(0, 200)      => [["M: 37", "B: 5", "C: 4"], ["M: 100", "B: 14", "C: 11"], ["M: 163", "B: 23", "C: 18"]]
```

Explanation of the results for `howmuch(1, 100)`:

* In the first answer his possible fortune is **37**:
 * so he can buy 7 boats each worth 5: `37 - 7 * 5 = 2`
 * or he can buy 9 cars worth 4 each: `37 - 9 * 4 = 1`
* The second possible answer is **100**:
 * he can buy 7 boats each worth 14: `100 - 7 * 14 = 2`
 * or he can buy 9 cars worth 11: `100 - 9 * 11 = 1`

# Note
See "Sample Tests" to know the format of the return.

Difficulty: introductory

Starter code:

def howmuch(m, n):
	

Solutions:
def howmuch(m, n):    
    return [['M: %d'%i, 'B: %d'%(i/7), 'C: %d'%(i/9)] for i in range(min(m,n), max(m,n)+1) if i%7 == 2 and i%9 == 1]
        
            
            


def howmuch(m, n):
    i = min(m, n)
    j = max(m, n)
    res = []
    while (i <= j):
        if ((i % 9 == 1) and (i %7 == 2)):
            res.append(["M: " + str(i), "B: " + str(i // 7), "C: " + str(i // 9)])
        i += 1
    return res

def howmuch(m, n):
    m, n = sorted([m, n])
    return [
        ['M: {}'.format(x), 'B: {}'.format(x // 7), 'C: {}'.format(x // 9)]
        for x in range(-((m - 37) // -63) * 63 + 37, n + 1, 63)]


from math import ceil

# All the solutions I saw were so slow, iterating the whole m -> n
# For M, the solutions are the 37 + 63k in [m, n]
# You can find that with chinese remainder theorem, or just by looking at the examples
# Then just calculate B and C for each
# No need to waste time doing useless loops
def howmuch(m, n):
    m, n = min(m, n), max(m, n)
    x = max(0, ceil((m-37)/63))
    return [[f"M: {y}", f"B: {(y-2)//7}", f"C: {(y-1)//9}"] for y in range(37 + 63*x, n+1, 63)]

howmuch=lambda m,n:[[f"M: {M}",f"B: {M//7}",f"C: {M//9}"]for M in range(min(m,n),max(m,n)+1)if M%7==2and M%9==1]

def howmuch(m, n):
    val = []
    if m > n:
        m,n = n,m
        
    for i in range(m,n+1):
        if (i-2)%7 == 0 and (i-1)%9 == 0:
            val.append(['M: {}'.format(i), 'B: {}'.format(int((i-2)/7)), 'C: {}'.format(int((i-1)/9))])
    return val

def howmuch(m, n):
    parameters = [m,n]
    parameters.sort()
    trueInstances = []
    for instance in range(parameters[0],parameters[1]+1):
        if (instance - 1) % 9 == 0 and (instance - 2) % 7 == 0:
            carPrice = int((instance - 1) / 9)
            boatPrice = int((instance - 2) / 7)
            statement = [f"M: {instance}",f"B: {boatPrice}",f"C: {carPrice}"]
            trueInstances.append(statement)
    return trueInstances
    # your code


def howmuch(m, n):
    arr = []
    for i in range(min(m, n), max(m, n)+1):
        if ((i-2)/7).is_integer() and ((i-1)/9).is_integer():
            x = int((i-2)/7)
            y = int((i-1)/9)
            arr.append(["M: {0}".format(i), "B: {0}".format(x), "C: {0}".format(y)])
    return arr

def howmuch(m, n):
    return [['M: {}'.format(i), 'B: {}'.format(int((i-2)/7)), 'C: {}'.format(int((i-1)/9))]  for i in [i for i in range(min(m,n), max(m+1,n+1)) if i%9 == 1 and i%7 == 2]]