I know you guys hate the dreaded look at my code question

But bear with me

*Approach 1*

I tried to approach the problem by first decomposing n into 4a+5b , 4a+6b , 4a+7b 5a+6b , 5a+7b , 6a+7b and breaking it down to solving individually for 4 , 5, 6 , 7

Four :

1 1 2 3

1 2 3 4

1 1 2 4

1 1 3 4

Five :

1 1 2 4

1 1 2 5

1 1 3 5

1 2 3 4

1 3 4 5

Six :

1 1 2 4

1 1 2 5

1 3 4 5

1 3 5 6

1 4 2 6

1 1 3 6

Seven :

1 1 2 3

1 1 2 4

1 3 4 5

1 3 4 6

1 5 6 7

1 2 6 7

1 1 5 7

And applying a set of appropriate xors to find the value .

*Issue*

It was a huge code , gave wa , got dejected

Now since n is always 4a,4a+5,4a+6,4a+7

Made my code much smaller and then submitted , I got -1 indicating that I have used more than n queries when that isn’t the case?

*Doubts*

- Is there a neat mathematical proof that n is always of 4a,4a+5,4a+6,4a+7
- Please enlighten me on why my code fails .
- I kind of figured all these combinations to solve for 4 , 5 , 6 , 7 by hand . Is there a pattern or simpler way ?

*My (noobish )Code*

```
(https://www.codechef.com/viewsolution/22000554)
I've been stuck at 3 star since forever and want to up my game so I thought I'd upsolve all problems from the first long challenge . Is anyone interested ?
```