problem three unsolved issue

problem three unsolved issue , Algorithm too slow , need better solution