getting rte(java) in LPATH.

problem link: LPATH Problem - CodeChef
why am i getting rte(nzec) in java? but i got ac when i submitted the same solution in cpp.
here is my java implementation: CodeChef: Practical coding for everyone
here is my cpp implementation: CodeChef: Practical coding for everyone