Facing horrible runtime errors with ZCO13003

This is my first post here, so I apologize in advance if I am breaking any rules.

Can you guys please help me find out whats wrong with my logic?

Here is what am trying to do …

given an array, first I sort it.

following sort - lets say the array looks like this:

[1,2,3,3,4,5,5,9,11] and the upper limit k is 9.

So I start with first element 1 and use the upperbound position to find the element e such that (e+arr[0]) > k.

My logic looks good to me on paper and yet I get runtime errors. Kindly help!
https://www.codechef.com/viewsolution/25357795

You have declared a variable as unsigned long long int, and at the end in printf statement, using %d, instead of %llu. This can cause problem.

Thank you for the guidance. I’ve noted this down to prevent such issues in the future.

I corrected as you said, but it still did not fix the errors!