(Leetcode) Brick wall
There's a lot of repeated summing taking place in this part:

(sum(row[:i + 1]) for row in wall for i in range(len(row[:-1])))


So this is summing the first i+1 elements in the row, with an upper bound that steps through all values except the last. If the row was [1, 2, 3, 4, 5], these are the sums:


1
1+2 = 3
1+2+3 = 6
1+2+3+4 = 10


The sums differ, but only by the last term. It would therefore save effort to use a running sum instead, only adding that last term each time:


1
1+2 = 3
3+3 = 6
6+4 = 10


This can be done with itertools.accumulate:

(s for row in wall for s in itertools.accumulate(row[:-1]))


Another thing in your code that this approach solves is the i+1 summing. Instead of having this addition performed on every iteration, you could iterate through the correct values directly with for i in range(1, len(row)). But using accumulate, this is already taken care of.