WA on Training - INOI 2017?

Why am I getting WA on subtask 2 and 3 for Training - INOI 2017 ?
Solution - CodeChef: Practical coding for everyone