how output should be displayed, is the output to be displayed after taking input for each query or separately after taking input for all queries? I even tried the naivest approach to see if the I/O is right i still am getting wrong answer. Please help.
For subtask #1 you do not need something special, so WA is probably not related to just I/O…
Could you tell me the I/O for the question?
printf("%d\n", res ); where
res is correct answer you have to print…
I mean print the answer to the query or all at once at the end?
For C/C++ (using
printf) printing one by one is ok for 105