optimized the graph generation, but still need improvement
limitation of python, a quicksort in finding minimum vertical could be better
surrounded_regions TLE, no idea