No, I am not asking for the specific question’s answer. I am asking for ways to learn how to crack such problems. I know, it’s a deal of practice but the real question is where? Where do I attain algorithmic thinking?
The question is simple, and three fold:

Where can I learn how to take fast inputs?

Where do I get practice questions such as these?

Why are my solutions getting WA while other solutions implementing same logic pass through?
I know it’s a generic question but it really irritates me when implementation supersedes logic in answering a question.
Thanks in advance.
Sorry if anyone is offended.