Giving WA(-1.0000)

I have submitted my code in java for the question INTXOR in december challenge. It is giving me AC for some tasks and WA(-1.0000) for others. If i submit the same code again, it is giving me different results.
And also if submit the same code in C++, it is giving me correct answer.

Then why is it giving me different results in java?

It is also possible that you are violating some conditions in your program and hence receiving -1 as Input by the grader. Hence you are getting WA(-1.000) for some tasks. Try terminating your program on receiving -1.

I did that too. But the result was same.

I guess you are taking an extra input. I came across the same error in DEC18 problem.You might be taking input where it actually doesnt require you to ask for a input

//