Google hosts a bunch of coding contests every year, some of which are Code Jam, Kickstart and Hash Code. Google uses the same web IDE in each of its contests where you need to write your code and submit it. But if you’re using it for the first time ever, no matter which coding contest you’re participating in or practising for, there’s a high chance that the IDE will tell you that your program encountered a runtime error.
The error message simply says “Sample Failed: RE“. And even when you click on the eye button, it says “RE“, which means Runtime Error. It does not provide any further info regarding why the error occurred. And the most surprising thing is, in most cases, your code will run fine in any other IDE other than Google’s Coding Competition IDE.
I too came across this problem some time ago and even after visiting many forums, I didn’t find the answer. But then, the idea struck my mind and I finally solved the Runtime Error in my Google Kickstart Code. This solution to fix the runtime error will work in all Google Coding Competitions, e.g. Code Jam, Kickstart and Hash Code.
How To Fix The Runtime Error In Google Code Jam/Kickstart/Hash Code
Well, this problem is caused by nothing but your program’s class name.
Google follows a convention where you must always define the Main class of your program (the class that contains the main method) as “public class Solution“.
Thus, to fix the runtime error issue, all you gotta do is, rename your class declaration to “public class Solution”
This is a weird convention set by Google. The more annoying part is that it is nowhere mentioned about this convention and thus programmers like I and you spend hours looking for the reason why the compiler is throwing us a Runtime Error even though the other compilers are running it perfectly.
I hope this article helped you solve the Runtime Error issue. Do let me know in the comments section below if there’s any other problem that you’re facing with the Google Coding Contests IDE. I will try my best to help you out!
Do check out some other posts on my site for more cool stuff! Have a great day ahead!