It's often that way - small inputs can be solved with a relatively
easy idea (sometimes by simple brute-force), but large inputs require
an optimal algorithm.
If you believe your algorithm is fast (something smaller than O(K^2)),
then tell what language you used, and try to describe your algorithm
The second is right.
The questions are always the same.
Inputs and outputs are not different for C and C++.
You can always choose the language you use. For example you can solve
a part of the question with C and another part with Javascript.
You only have to submit the output, and the code you use