can there be an integer(long long int in c) over flow for (10^9+6)*(10^9+6)

When I checked the above product in my PC,it gave me a correct result,but when I submit the original problem(this multiplication is a sub problem of that,I am thinking of this possible product may occur in test cases) it says wrong answer(I am sure that rest of the part is perfectly fine).Is there a chance of over flow ?,I have used (long long int) data type.

I know this is not the place to ask this question, but i’m stuck on it and is looking over the net for a long time and haven’t got anything clear cut… if they are available they are not explained well…
so the question is
what are the methods to increase the speed of i/o operation like getchar unlocked fread unlocked i just know there name don’t know how to use them.
any kind of guidance will be very much help full :slight_smile:
links to resources(tutorials) will do the work.
grv.

NO. There will be no overflow in this calculation if you use long long. Error will be in some other step.

1 Like