Failing test cases

my code is giving correct output for sample test case but is failing all of the test cases.i also runned it for some other cases it’s working fine.also i saw some other solution they are also almost same.can you please tell what i am missing

link- https://www.codepile.net/pile/4L72V1l8

just add a new line for every test case