CHEFRECP,Getting Wrong answer

probelm:- https://www.codechef.com/COOK118B/problems/CHEFRECP
My code :- https://www.codechef.com/viewsolution/33326878
Please can you tell me which test cases am I failing .

As per the constraints, no. of As is in long long int range but in your question, number of elements can’t be greater than 1000. So any test case with large n will fail. Hope it helps.
My submission: https://www.codechef.com/viewsolution/33308542

Thank you.
But sorry I didn’t understand as per the question the told N is >=1 and <=1000. Then why isn’t “int” enough. I’ve updated my code for the following changes you mentioned.Still it’s failing some testcases.Please can you tell me where did I go wrong?

please someone reply.