Rust, DP, concise.
Intuition\nThis is dynamic programming task. The only tricky part is to find subtask.\nThe subtask is to solve it for smaller number of piles (i left most piles
# Intuition\nThis is dynamic programming task. The only tricky part is to find subtask.\nThe subtask is to solve it for smaller number of piles (i left most piles) and for smaller k.\nOn each step we iterate over new pile for all numbers from `0` to `k` and search for best value of `l` coins from new pile and `k - l` from previous subtask.\n\n\n# Code\n```\nuse std::cmp::{min,max};\n\nimpl Solution {\n    pub fn max_value_of_coins(piles: Vec<Vec<i32>>, k: i32) -> i32 {\n        let k = k as usize;\n        let mut dp = vec![vec![0; k + 1]; piles.len() + 1];\n        for i in 1..dp.len() {\n            for j in 1..k + 1 {\n                let mut s = 0;\n                for l in 0..min(j + 1, piles[i - 1].len() + 1) {\n                    dp[i][j] = max(dp[i][j], s + dp[i - 1][j - l]);\n                    if l < piles[i - 1].len() {\n                        s += piles[i - 1][l];\n                    }\n                }\n            }\n        }\n\n        return dp[piles.len()][k];\n    }\n}\n```
['Rust']