This was a fun problem, but I think lookup table solutions are possible given the way the way the test suite is configured. Maybe you could add a string parser to see if the test suite correct solutions are included in the answer code?
@alfonso Consider the problem statement as the Diophantine equations X+Y=S & X*Y=P ⇔ x^2-S*X+P = 0; (X,Y)∈ℤ. In some of the test cases the list of tuples degenerates to 2, I have noticed for these scenarios both of the tuples satisfy these Diophantine equations, yet the correct solutions is thrown as true when the sum of each tuple is unique and the product of the tuples is equal, and false when the product of the tuples is unique and the sum of each tuple is equal. Is this consistent with your problem statement/explanation above?
@Alfonso. Thanks for the hint, that got me toward a working solution. This one was a lot easier in non-Cody environment with py.networkx library running in MATLAB.
For i.e. test case 5, maze(10) = 01111 and should be a bottom wall of the first page of the maze. If its a bottom wall, shouldn't that mean that the first digit should be 1 instead of zero, since I shouldn't be able to step outside the maze? In the 2d Cody problem of yours, this is implicit, is that not the case here or am I botching the binary encoding.
For anyone needing a gentle refresher (like I did) on nested anonymous functions:
https://www.mathworks.com/matlabcentral/cody/problems/24-function-iterator