@B.Wilson thought about it for a while, can't think of any other way to write the function... just a couple days left till we can freely discuss the challenges
I managed to get 0.5 sec and proved from complexity wise I cannot get further improvements. Just discover some redundancy but does not improve the running time much.
my approach is, uh, try everything and see what fits
also gotta say that one problem about pair flipping was made so much more annoying by the flips being on the last axis
unless i have a completely suboptimal solution it just makes it ugly, would have worked as tacit with first axis flip, but like this it becomes atop after atop after atop and it's just ugly