Runtime Error in CHAPD problem

I am not able to understand why my code is getting accepted for some subtask and showing runtime error(NZEC)fo some.Pls…help
[Here is the link to my code][https://www.codechef.com/viewsolution/8947340]

To parse long you need Long, not Integer class.

@kr0oze: Thanks for out my mistake.(It was very silly ;)…)