In Facebook hacker cup I submitted a code in the first problem "leapfrog ch.1 " and after the contest I got WA , then I submitted the same code in the same problem on gym https://codeforces.net/gym/102249/attachments?mobile=false and I got AC so what is the wrong in my code ? And if it is correct why I got WA in facebook hacker cup ?
My code : https://ideone.com/6R8ChG