We need to find earliest day d (1-indexed) such that a_d is smaller than all a_j for j in [d-x, d-1] (if those indices exist) and also smaller than all a_j for j in [d+1, d+y] (if exist). Since x,y ≤7, we can just check each day and compare with at most x+y neighbors. But careful: we only consider days within 1..n. So for each d, check j from max(1, d-x) to d-1 (excluding d) and d+1 to min(n, d+y). However, note the problem says "each of x days before day d and each of y days after day d". That means exactly x days before if they exist? Actually: "he says that a day d is not-so-rainy if a_d is smaller than rain amounts at each of x days before day d and each of y days after day d. In other words, a_d < a_j should hold for all d - x ≤ j < d and d < j ≤ d + y. Citizens only watch the weather during summer, so we only consider such j that 1 ≤ j ≤ n."
Interpretation: The condition applies only to those j within the range and within [1,n]. So if there are fewer than x days before (i.e., d-x <1), then we only consider j from 1 to d-1? The phrasing "each of x days before day d" suggests that we must have at least x days before? But they clarify: "we only consider such j that 1 ≤ j ≤ n". So if some of those indices are out of range, they are simply ignored. But then the condition must hold for all j that satisfy both (d-x ≤ j < d) and (1 ≤ j ≤ n). So effectively we need a_d to be less than all a_j for j in [max(1, d-x), d-1] and for j in [d+1, min(n, d+y)]. No requirement that there are exactly x days before or y days after; we just consider the ones that exist. So it's fine.
Thus for each d, we can just check up to x elements before and y after. Since x,y ≤7, O(n*(x+y)) is fine. However, n up to 100k, so that's fine.
But we need earliest index (lowest d) that satisfies. So iterate d from 1 to n, check condition. As soon as we find one, output and break.
Let's verify examples.
Example1: n=10,x=2,y=2. a=[10,9,6,7,8,3,2,1,4,5]. Check d=1: before none; after j=2,3? Actually y=2 so j=2,3. a1=10, a2=9, a3=6 -> 10<9? no. So fails. d=2: before j=1; after j=3,4. a2=9, a1=10 ok (9<10), a3=6 9<6? no. fails. d=3: before j=1,2; a3=6 < a1=10 yes, < a2=9 yes; after j=4,5; a4=7, a5=8, 6<7 and 6<8 yes. So d=3 works. earliest is 3. matches.
Example2: x=2,y=3. d=3: after j=4,5,6 (since y=3). a3=6, a6=3 -> 6<3? no, fails. So we go to d=8: before j=6,7; a8=1, a6=3 (1<3), a7=2 (1<2). after j=9,10 (since y=3 but only up to 10). a9=4 (1<4), a10=5 (1<5). So works. earliest is 8. matches.
Example3: n=5,x=5,y=5; a=[100000,10000,1000,100,10]; d=1: before none; after all others. a1=100000 not < 10000, fails. d=2: before j=1; a2=10000<100000 yes; after j=3,4,5: a3=1000, a4=100, a5=10; 10000<1000? no. fails. d=3: before j=1,2; a3=1000<100000, <10000? yes; after j=4,5; 1000<100? no. fails. d=4: before j=1,2,3; a4=100<100000,10000,1000 yes; after j=5; a4=100<10? no. fails. d=5: before j=1..4; a5=10<all those yes; after none. So works. output 5. matches.
Thus simple.
But there is nuance: we need to consider j in d-x ≤ j < d and d < j ≤ d+y exactly as described. For d near boundaries, we might have no neighbors in one direction, then condition vacuously true for that side. So it's fine.
Edge cases: x or y zero. For x=0, no days before to check; for y=0, no days after. Works.
Implementation: loop d from 1 to n, set bool ok=true. For j from max(1, d-x) to d-1: if a[d] >= a[j] then ok=false break. For j from d+1 to min(n, d+y): if a[d] >= a[j] then ok=false break. If ok, print d and exit.
That's it.
But is there any catch about "earliest not-so-rainy day"? The answer always exists. Because there must be at least one day that is minimum among all? But note condition requires it to be lower than x days before and y days after, not necessarily the global minimum. But with x,y ≤7, maybe existence is guaranteed? The problem says we can show answer always exists. For our simple approach, we just find one.
But we must be careful: Since all a_i distinct, at least one day will be local minimum in the sense of a window of length x+y+1? But maybe boundaries always satisfy? For the first day: there is no before, only after y days. It could be that a1 is not less than all after y days. But eventually the smallest element overall will satisfy (since for any day, all neighbors have larger numbers? Actually the global minimum day will have no neighbor smaller because it's the smallest. But condition requires it to be smaller than all x before and y after; as long as those neighbors exist, they will have larger values because it's the global minimum. So the global minimum day always satisfies condition regardless of boundaries? If it's near boundaries, maybe missing some neighbors, still condition holds for the existing ones. So answer exists. Good.
Thus straightforward.
But hold on: The constraints: x,y ≤7, but also n up to 100k. So O(n*(x+y)) is trivial.
We need to read input, store array (1-indexed). Then iterate.
I'll code in Python.
But wait: There's potential for a more efficient solution but not needed.
Double-check the interpretation: "a_d is smaller than rain amounts at each of x days before day d and each of y days after day d." This could be interpreted as exactly x days before, i.e., there must be at least x days before; if there are fewer, the condition cannot be satisfied? However, they say "Citizens only watch the weather during summer, so we only consider such j that 1 ≤ j ≤ n." So it's clear: we only consider those j that exist. So condition only applies to existing days. So boundaries fine.
Test boundary: n=1, x=0,y=0. Then d=1: no neighbors, condition vacuously true. So answer 1. If x=1,y=0, then d=1: before j from max(1, 0) to 0? Actually d-x=0, so max(1,0)=1? But j < d, so j from 1 to 0? empty. So condition holds. So answer 1. That's consistent.
If x=1,y=1 and n=1: d=1: before none, after none => holds. So answer 1.
All good.
Implementation in C++? But we are using Python. So fine.
Now: The input format: The first line contains three integers n,x,y. The second line contains n distinct integers. So we parse.
We'll output the answer.
I'll test with sample.
Now, consider the problem statement: "For years, the Day of city N was held in the most rainy day of summer." That is irrelevant.
Thus the solution is trivial.
But the constraints say x,y ≤ 7; maybe there is nuance: they are small, but n is large. So the trivial approach is expected.
However, I should ensure that we use 0-index or 1-index correctly. Since Python lists are 0-index, we can store a[0..n-1] and then for day d (1-index) we use index d-1. Then for j in range(max(0, d-1-x), d-1) (since d-1 is index of day d) but careful: The j indices are day numbers, not array indices. Let's map: day number i corresponds to a[i-1]. For checking before: we need j from max(1, d-x) to d-1 inclusive. That's day numbers. In Python indexing: we can loop j in range(max(1, d-x), d): That gives day numbers from start to d-1 inclusive. Then compare a[d-1] with a[j-1].
Similarly for after: j in range(d+1, min(n, d+y)+1): then compare.
Simpler: Use array a 0-index. d0 = d-1. before_start = max(0, d0 - x). Then for j in range(before_start, d0): if a[d0] >= a[j]: fail. after_end = min(n, d0 + y + 1) (since d0 + y +1 exclusive). For j in range(d0+1, after_end): if a[d0] >= a[j]: fail.
Because x days before: the x days before day d are days d-1, d-2, ..., d-x. In 0-index, those indices are d0-1, d0-2, ... d0-x. So we want to consider indices from d0-x to d0-1 inclusive, but limited to 0..n-1. So start = max(0, d0 - x), end = d0 (exclusive). That's good.
For after: days d+1 to d+y inclusive: indices d0+1 to d0+y inclusive. So after_start = d0+1, after_end = min(n, d0+y+1). Loop j in that range.
Thus we can implement simply.
Edge: when x=0, d0 - x = d0, but start max(0,d0) could be d0, but then range(start, d0) is empty because start = d0. So works.
Implementation:
def solve():
import sys
data = sys.stdin.read().strip().split()
if not data: return
it = iter(data)
n = int(next(it))
x = int(next(it))
y = int(next(it))
a = [int(next(it)) for _ in range(n)]
for i in range(n):
# day index i (0-index) corresponds to day i+1
val = a[i]
# check previous up to x days
start = max(0, i - x)
for j in range(start, i):
if val >= a[j]:
break
else:
# if no break, then proceed to check next
# check next up to y days
end = min(n, i + y + 1)
for j in range(i+1, end):
if val >= a[j]:
break
else:
# found
print(i+1)
return
That's fine.
But note: The inner loops break and we need to detect if break occurred. Using for-else works. Or use flag.
Complexities: O(n * (x+y)) which is at most 100k * 14 = 1.4M, fine.
Potential pitfall: Need to handle large a_i up to 1e9, but integer comparisons fine.
Thus solution is done.
But the problem might have been from a contest where participants think of more complex solution due to misreading? But it's straightforward.
I'll craft final answer accordingly.
I should double-check with another test: n=5, x=0, y=3; a=[5,4,3,2,1] -> d=1: no before, after 2,3,4: 5<4? no. d=2: after 3,4,5: 4<3? no. d=3: after 4,5: 3<2? no. d=4: after 5: 2<1? no. d=5: after none -> success? But after none, before none? Actually x=0, so no before. Condition holds because no neighbors to compare? But there are after days? d=5 has no after days (since y=3 but n=5, after days would be 6,7,8 out of range). So yes, condition vacuously true, answer 5. But is 5 the earliest? Check d=1..4 all fail, so answer 5. That seems correct.
If x=1,y=0 and a descending: [5,4,3,2,1] -> d=1: before none, after none? Actually y=0 so no after; before none because d=1 no x before? So holds? But there is no condition: d=1 has no before (since d-x=0, which is <1) and no after. So condition vacuously true. So answer 1. Check: before none, after none, condition satisfied. That makes sense because citizen only watch x days before and y days after; if there are none, they don't watch anything, so any day qualifies? Possibly yes.
But is that correct per problem? The phrase: "he says that a day d is not-so-rainy if a_d is smaller than rain amounts at each of x days before day d and each of y days after day d." If x=1, but there is no day before (d=1), then what does "each of x days before" mean? Typically, if there are fewer than x days, it's impossible to satisfy the condition? But the clarification says: "Citizens only watch the weather during summer, so we only consider such j that 1 ≤ j ≤ n." That implies we only consider the days that exist. So if there are no days before, then there is no j to compare, so condition holds vacuously. So day 1 would be not-so-rainy. That seems consistent with the sample? No sample for boundary.
But is it plausible that the answer always exists? If x>0 and d=1, there are no days before, so condition reduces to only after days. So possible. So answer could be 1 if a1 is smallest among the next y days. But if not, maybe later.
Thus logic holds.
Thus final answer is correct.
Now I'll produce final output with code.
But the prompt: "Help mayor find the earliest not-so-rainy day of summer." So we output a single integer.
So the solution is simple.
I think that's it.
But just in case, check another corner: n=1, x=5,y=5; a=[100]. No neighbors, condition vacuously true, answer 1. Our code: for i=0: start = max(0, 0-5)=0; range(0,0) empty; after: end = min(1,0+5+1=6) =1; range(1,1) empty. So for-else both executed, print 1. Good.
Thus answer.
I will produce final response with explanation and code.
Now I'll write final answer. ```python
import sys
def solve() -> None:
data = sys.stdin.read().strip().split()
if not data:
return
it = iter(data)
n = int(next(it))
x = int(next(it))
y = int(next(it))
a = [int(next(it)) for _ in range(n)]
for i in range(n):
val = a[i]
ok = True
# check the x days before (if they exist)
start = max(0, i - x)
for j in range(start, i):
if val >= a[j]:
ok = False
break
if not ok:
continue
# check the y days after (if they exist)
end = min(n, i + y + 1)
for j in range(i + 1, end):
if val >= a[j]:
ok = False
break
if ok:
print(i + 1) # day numbers are 1-indexed
return
if name == "main":
solve()