Java src code written for olympiad questions