CHEFRECP,Getting Wrong answer

My code :-
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:

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.