@memo table exceeds memory budget
a @memo whose table does not fit in memory at the input bounds
domain A = 0..100_000
domain B = 0..100_000
@memo
fn dp(a: A, b: B) -> Int: a.to_idx + b.to_idx
print(dp(A.first, B.first))domain A = 0..100
domain B = 0..100
@memo
fn dp(a: A, b: B) -> Int: a.to_idx + b.to_idx
print(dp(A.first!, B.first!))Why
The product of the parameter domain sizes of a @memo function exceeds the flat-table memory budget, which can trigger TLE or MLE on contest judges. Narrow the state space or switch to iterative DP.
The practice it serves
Code that is wrong or almost certainly a bug. Denied by cpl lint. Family: S.dp: DP optimizations and memoization.
Not flagged
A near miss: close to the pattern, but not it.
domain A = 0..100
domain B = 0..100
@memo
fn dp(a: A, b: B) -> Int: Int(a) + Int(b)
print(dp(A.first!, B.first!))Turn it off
For one block, wrap it in with lint(memo_key_space: allow):. For a project, add memo_key_space = "allow" under [lints] in cp.toml.
Generated from spec/lints/memo_key_space, the same record the linter is built from.