```python
def line_cost(price: int, quantity: int) -> int:
    """Returns the cost of a single line."""
    if price <= 0 or quantity <= 0:
        raise ValueError("Price and quantity must be positive integers.")
    return price * quantity

def basket_cost(lines: list, discount: int) -> int:
    """Returns the total cost of a basket after applying a discount."""
    if discount > 100:
        raise ValueError("Discount must be less than or equal to 100.")
    total_cost = sum(line_cost(price, quantity) for price, quantity in lines)
    discounted_cost = total_cost * (100 - discount) / 100
    return int(discounted_cost)
```