Encoding August'20

Chef Loves Cakes Problem Code: ECAUG201

can please someone figure out what is wrong with the code in the mentioned problem of contest Encoding August’20

https://www.codechef.com/submit/ECAUG201

dude, share the submission link

Your N * M will overflow for large values of N and M. Take long long.

https://www.codechef.com/viewsolution/37388109

https://www.codechef.com/viewsolution/37388109 i used long long yet its not working.

You are using int for n and m, so the expression n * m overflows, even though you store the final result in a long.

Consider the test input:

1
9999976 9999976
6 Likes

You have used int for n and m. Change it to long long.