We need to compute minimum number of days to collect all pebbles given constraints:
- Two pockets.
- Each pocket can hold at most k pebbles at same time.
- Cannot mix different types in same pocket; each pocket can hold pebbles of a single type (or be empty).
- On each day, she can collect pebbles from the park (once per day), presumably she can fill her pockets with some combination of pebbles. She can collect multiple types per day? The problem says: "she can collect pebbles from the park only once a day." And she has two pockets. She can put at most k pebbles in each pocket. She never mixes pebbles of different types in same pocket. However, she can put different kinds of pebbles in different pockets at the same time. So on each day, she can collect up to two types of pebbles, one per pocket, each up to k pebbles (but limited by remaining pebbles of that type). She cannot take more than k from a type in one day, because each pocket max capacity k. If she wants to collect more than k pebbles of a given type, she must do it over multiple days. Also, she could take two pockets of same type? No, because pockets cannot mix types; but they can hold same type? The condition: "she never mixes pebbles of different types in same pocket." That doesn't forbid putting same type in both pockets? If both pockets hold same type, that would be like mixing? Actually, it's not mixing because they are same type. But can she put pebbles of same type into both pockets? Usually, you can only hold one type per pocket, but you have two pockets; you could put same type in both pockets, effectively collecting up to 2k of that type in a day. However, is that allowed? The problem statement: "However, she can put different kinds of pebbles in different pockets at the same time." It specifically mentions different kinds. It does not say you can't put same kind in both pockets. Usually, in such problems (like Codeforces 789A, Anastasia and pebbles) the typical problem is: Two pockets, each holds at most k, cannot mix types in same pocket, but you can fill both pockets with same type. Yes, I recall a CF problem: "A. Anastasia and pebbles" which is exactly this: She collects pebbles. There are n types, each with w_i pebbles. She has two pockets, each can hold at most k pebbles. She cannot mix types in a pocket, but she can have different types in different pockets. She collects once per day. Compute min days. In that problem, you can put same type in both pockets. The solution is: For each type, compute number of pockets needed: ceil(w_i / k). Then you sum those and then divide by 2 (since 2 pockets per day) rounding up. Actually the typical solution: ans = sum over i of ceil(w_i / k) then ans = ceil(ans/2). That's because each day can handle at most two "pocket loads". But careful: If we treat each pocket load as a "unit" of capacity k, each type requires ceil(w_i/k) such loads. Since we have two pockets per day, the total number of days needed is ceil(total loads / 2). However, we need to ensure that a day cannot have both pocket loads from same type? Actually, it's allowed, so that's fine. So answer = sum of ( (w_i + k - 1) // k ) for all i, then (sum+1)//2.
Let's test sample 1: n=3, k=2; w=[2,3,4] => loads: 2/2=1, 3/2=2, 4/2=2 => sum=5 => days = ceil(5/2)=3. matches.
Sample 2: n=5,k=4; w=[3,1,8,9,7] => loads: ceil(3/4)=1, ceil(1/4)=1, ceil(8/4)=2, ceil(9/4)=3, ceil(7/4)=2 => sum=1+1+2+3+2=9 => days = ceil(9/2)=5. matches.
Thus answer is trivial.
But the problem statement: "She can put at most k pebbles in each pocket at the same time. ... However, she can put different kinds of pebbles in different pockets at the same time. Unfortunately, she can't spend all her time collecting pebbles, so she can collect pebbles from the park only once a day."
So indeed this is exactly the known problem.
Hence solution: read n, k; read array w; compute total = 0; for each w_i: total += (w_i + k - 1) // k; then ans = (total + 1) // 2; output ans.
Complexities: O(n), fits.
Let me confirm constraints: n up to 100k, k up to 1e9, w_i up to 1e4. The sum of loads may be up to n * ceil(1e4/k). If k=1, loads = sum(w_i) up to 1e5 * 1e4 = 1e9, fits in 64-bit. So use 64-bit.
Implementation straightforward.
Edge cases: n=0? Not possible (1 ≤ n). k >=1.
Thus final answer.
Write Python code:
def solve():
import sys
data = sys.stdin.read().strip().split()
if not data: return
it = iter(data)
n = int(next(it))
k = int(next(it))
loads = 0
for _ in range(n):
w = int(next(it))
loads += (w + k - 1) // k
days = (loads + 1) // 2
print(days)
If input may have extra spaces, fine.
That is it.
But the problem says "help her to find the minimum number of days ...". So yes.
Thus final.
I'll provide the solution in Python.
```python
import sys
def main() -> None:
data = sys.stdin.read().strip().split()
if not data:
return
it = iter(data)
n = int(next(it))
k = int(next(it))
total_loads = 0
for _ in range(n):
w = int(next(it))
# number of pocket loads needed for this type
total_loads += (w + k - 1) // k
# each day handles at most two loads
days = (total_loads + 1) // 2
print(days)
if name == "main":
main()