You need to implement a Python function that finds the minimum distance from a given position to an affordable house in a list. The function should return the calculated distance based on specific criteria.
m (int): The current position (1-indexed) from which to measure distance.
k (int): The maximum price for a house to be considered affordable.
a (List[int]): A list of integers representing the prices of the houses.
The function should calculate the minimum distance, where:
Only houses with a price greater than 0 and less than or equal to k are considered affordable.
The distance to each house is calculated as abs(m - i) * 10, where i is the house's position in the list (1-indexed).
The function should return the minimum distance as an integer.
Input/Output Requirements
Input:
An integer n (1 ≤ n ≤ 10^5)
An integer m (1 ≤ m ≤ n)
An integer k (0 ≤ k ≤ 10^9)
A list a containing n integers (0 ≤ a[i] ≤ 10^9)
Output:
An integer representing the minimum distance to an affordable house. If there are no affordable houses, handle the case appropriately (e.g., return -1 or another error code).
Implementation
Your solution must be written in a file called /app/solution.py.
Ensure to include appropriate error handling and edge case considerations within your implementation.