Why output is correct but testcases failed?