The problem
I tried writing a generator script but that didn't help.
Submission Link.
Code explanation: In the problem, we are given an array/list and we have to check if we can form 1 square and 1 rectangle with those elements(planks). Only possible values are 8, 6 6, 6 2, 4 4, 4 2 2. I tried to count the numbers of 2s, 4s, 6s and 8s. And with every query, their value is incremented or decremented. In the end, I check if the values form any of the possible values and print Yes or No according to it. If anything is greater than 8 then I count it as 8.
Edit: I was missing 6 4 in my possible values. Accepted Solution.