getting input and output ?

Hi coders, I am new to CodeChef.

I am participating in May Challenge 2014. I am able to solve problem and getting correct answer in my pc. But codechef says it is wrong. I think my I/O is problem. Please help me.

I am coding like :

Input :
4 1
5 -1 7 0
Output :
2 8 0 7

int main()

//Then Read the Array
//After calculating print the result array

for(int i=1;i<=number;i++)

//Printing array[i] element


is this correct way?

the array starts form index 0 and not from 1; that might be one of the problems in your i/o
anyways, i too have a prob in this question! i coded it in C and in java, with all true algo, but dont know why, it always gives me a wrong answer!

No, you don’t need to do that. You dont need to store the answer in a separate array, you can just print it as soon as you calculate it. But Take care that the format of output is exactly same as specified in the problem statement. Beginners usually forget to add new line for each test case.

Note: My answer is general, its not specific to any particular problem.

Did you run for all corner cases and if the output is not in proper format it will not accept it.

Try checking for corner cases.!