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: CodeChef: Practical coding for everyone
Code with pow(x,2): CodeChef: Practical coding for everyone

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.