```python
def line_cost(price: int, quantity: int) -> int:
    """Calculate the cost of one line."""
    if price < 0 or quantity < 0:
        raise ValueError("Price and quantity must be non-negative.")
    return price * quantity

def basket_cost(lines: list, discount: int) -> int:
    """Calculate the total cost of a basket after applying a discount."""
    if discount < 0 or discount > 100:
        raise ValueError("Discount must be between 0 and 100.")
    
    total_cost = sum(line_cost(line['price'], line['quantity']) for line in lines)
    discounted_cost = total_cost * (1 - discount / 100)
    return int(discounted_cost)
```