Why all test cases not passed?

Why all test cases not passed?

consider a test case like
3
5 5 4
3
7 7 8
the answer should be 1, 3, 3, 2, END
correct this