Code working for pow(x,2) but not x*x: Save Energy

My exact same code worked when I replaced all my x*x with pow(x,2). I am unable to understand why. Can anyone explain?

Code with x*x: https://www.codechef.com/viewsolution/38539012
Code with pow(x,2): https://www.codechef.com/viewsolution/38540156

1 Like

She’s already getting AC with pow, she’s asking for WA with x*x?

my bad.
its just overflow . cast to long long

1 Like

WA in the first code is due to int overflow. Define i and j as long long.

1 Like

Missed that! Thanks a ton.