BENCHP-VARIATION

HERE is the question from April lunchtime. I have solved it for exactly W weights . My code is up for any hacking attempt. Please provide some test cases where my code will give WA. Here is my code.