Unofficial Editorial Div 1 July lunchtime 2020

Found the issue.

From another discussion thread, place the following at the start of your code

#pragma GCC optimize "trapv"

and compile. This will instruct to fail whenever an integer overflow occurs.
Then running in GDB we find that it fails at line 31. This is because i is an integer and therefore too small to fit i*i, change to an long long an it will work.

3 Likes