https://ide.codingblocks.com/#/s/14434
This code is giving correct answer in ide but showing errors while submitting it.
Doubt in marbles question-done using java
Your code gets 1 test case passed out of 5, and still it shows 0 points. Seems an error in hackerblocks
P.S. the code looks fine to me.