All the puzzles here work the same. You're given a problem statement and the skeleton of a program intended to solve it. The skeleton will read the inputs from the server and gives a (wrong) answer in the correct format. Your task is to modify the skeleton so that the answer is correct.
Several test cases are provided for each puzzle, which allows you to run your program against different inputs to check the correctness of the program. When your program can pass all the test cases, you can submit it against the validators, which are more test cases that are similar but not the same as the practice cases. You get points based on how many of the validators you pass.
One common problem is that the user doesn't read the problem statement fully. It explains what needs to be done, what inputs will be given, and what the output is supposed to look like. It's not obvious on some puzzles (especially if you've messed with the sizes of the panels), but the problem statement is right below the graphics window and is scrollable. Make sure you read it all the way to the end.
CG is a great place for self-learning if you already know a bit about programming, but it's not really a good place to learn how to code from scratch; the barrier to entry is that you already know how to do basic things like string manipulation, arrays, conditionals (if..then), and loops.
Hope this helps.
P.S. with all that said, make sure you're outputting the index (1-8) of the mountain you want to shoot at and not its height.