apple pie's submission of Average Flex | CodeChef