```python
from typing import List

def fill_order(sources: List[List[int]], needed: int) -> dict:
    if not isinstance(needed, int) or needed <= 0:
        raise ValueError("Needed must be a positive integer")
    if not all(isinstance(source, list) and len(source) == 2 for source in sources):
        raise ValueError("Sources must be a list of pairs of positive integers")
    if sum(stock for _, stock in sources) < needed:
        raise ValueError("Not enough stock to cover the order")
    
    sources.sort(key=lambda source: source[0])
    taken = [0] * len(sources)
    cost = 0
    remaining = needed
    for index in range(len(sources)):
        if remaining <= 0:
            break
        unit_cost, stock = sources[index]
        taken[index] = min(stock, remaining)
        cost += stock * unit_cost
        remaining -= stock
    leftover = []
    for index in range(len(sources)):
        leftover.append(sources[index][1] - taken[index])
    return {"cost": cost, "taken": taken, "leftover": leftover}
```