Problem link — https://mirror.codeforces.com/problemset/problem/1355/D
I was able to prove that if S>=2*n, then Petya can always win (same logic which is given in the tutorial). But I am not able to prove that if S<2*n then Petya will always lose. How to prove that?