Java code for competitions