I just started looking at the problem BUYING SWEET my hunch tells me that correct condition/logic to solve the above problem is this …

(sum % total_sweet) if find any note else then remainder then the customer is not an adequate customer. Work properly on the all the Test case found

**Test case 1**

```
4 7
10 4 8 5
```

Answer

```
[10,4,8 ,5].sum
## sum is 27
rem = 27 % 7 6
#### rem = 6
i = 0;
adequate = true
for i < a.length:
if a[i] < 6
adequate = false
break
```

Customer is not adequate

**Test Case 2**

```
1 10
12
```

Answer

```
[12].sum
rem = 12%10
## rem is 2
No number less them 2 hence customer is adequate.
```

**Test Case 3**

```
2 10
20 50
```

Answer

```
[20, 50].sum
## 70
rem = 70 % 10
## 0
No number less then 0
```

Customer is adequate.

But with Limited Test case I’m not sure if the above logic is correct can some please provide some **more** TEST case so that I can verify them.

EDITED:

I just wrote the initial implementation Getting **WRONG ANSWER** but the editorial https://discuss.codechef.com/questions/3250/buying2-editorial matched with my belief.

Here the Code I submitted https://www.codechef.com/viewsolution/15221523