Others have said that SO is not a debugging service. It might not be obvious why debugging requests aren't very welcome on SO; I'll try to elucidate.
A good question on SO is one that inspires good answers - answers that not only help the OP solve their current problem but will also be valuable to future readers. (See Optimizing For Pearls, Not Sand). Generally, debugging requests are highly specific, and the buggy code presented often has multiple problems. A future reader may have one or two of those problems with their code, but it's unlikely that they'll have all of them.
So merely dumping some code and saying "it doesn't work" is unlikely to be well-received. If your code has multiple problems, try to break it up so you can isolate each problem into its own MCVE. And if you state the problem with your code clearly and carefully, and supply all the information that potential answerers need to tackle the problem (the MCVE code itself, typical input, current output, and expected output, all properly formatted), then it may be beneficial to others with a similar problem.
Quite often in the process of creating one or more MCVEs you will discover for yourself what's causing the problem, or at least give you some clues as to what's going wrong. Putting the information that you've discovered in this process into your question can help readers to understand the problem; it also lets them know what you've already done in your attempt to fix the problem yourself. And questions where it's clear that the OP has done some research on their problem are always better received than those that show no research effort.
it has flaws
is a rather unclear problem statement