Update 1:Solved segmentation fault error

So there was that segmentation fault error cause of much recursive functions
But I found a better way than recursive functions and now it's fixed
although somehow slower like 5 seconds for hard puzzles