import math


def strategy_expensive(cookies, cps, history, time_left, build_info):
    """
    Always buy the most expensive item you can afford in the time left.
    """
    max_cost = -999999999999.0
    max_item = None
    for item in build_info.build_items():
        cost = build_info.get_cost(item)
        if cost > cookies and math.ceil((cost - cookies) / cps) > time_left:
            continue
        if cost > max_cost:
            max_cost = cost
            max_item = item
    return max_item