Spreadsheet evaluator
Your task
Evaluate a tiny spreadsheet. You get cells, a list of [name, formula] pairs. A formula is either a plain integer literal (e.g. '5') or a sum expression of the form 'A+B+C' where each operand is either an integer or another cell name (operands joined by '+'). Resolve every cell to its integer value, handling dependencies in any order. If there is a cyclic dependency, return the string 'CYCLE'. Otherwise return a list of [name, value] sorted by name ascending. Cell names are non-empty alphanumeric strings; every referenced name is defined.
Examples
eval_sheet(cells: list[list]) -> objectExample 1
Input
eval_sheet([["A", "1"], ["B", "A+2"], ["C", "A+B"]])Output
[["A", 1], ["B", 3], ["C", 4]]