We are asked: Given an array a of length n, find the smallest index i (1-indexed) such that sum_{j=1}^i a_j >= total_sum/2 (half or more of all the problems). Actually note the wording: "half or more of all the problems". So condition: prefix sum S_i >= ceil(total/2)? Or "half or more" meaning >= half. For integer values, half could be a fraction. Typically if total is odd, half is not integer, so "half or more" means S_i >= total/2 (could be exact fraction). Since S_i is integer, condition is S_i >= total/2. For total=7, half is 3.5, so S_i >= 4? Actually "half or more" means at least half. If half is 3.5, then 4 is >= 3.5, 3 is not. So condition S_i >= total/2. Since S_i integer, it's equivalent to S_i > floor(total/2) if total odd? Let's examine: total=7, half=3.5, need S_i>=3.5 => S_i>=4 (since integer). So indeed S_i > floor(total/2) i.e., S_i >= ceil(total/2)? For total=7, ceil(7/2)=4. So condition = S_i >= ceil(total/2). But careful: if total is even, say total=12, half=6, need S_i >=6. Ceil(12/2)=6. So condition is S_i >= ceil(total/2). That's correct: S_i >= ceil(total/2). But more precisely, condition S_i * 2 >= total. Because we can avoid floating. So we need smallest i such that 2 * prefix_sum_i >= total_sum.
So simple: compute total sum, iterate i from 1 to n accumulating prefix sum, break when 2*prefix >= total. Then output i.
Constraints: n up to 200k, a_i up to 10000, straightforward O(n). Use long if needed (total up to 2e9, fits in 32-bit signed? 200k * 10000 = 2e9, fits in 32-bit signed? 2e9 is borderline, signed int max ~2.147e9, so might overflow if exactly 2e9? Actually 200k*10000 = 2,000,000,000 which is 2e9, that's < 2.147e9, so fits in 32-bit int. But to be safe use 64-bit long long.
Implementation: read n, array, compute total sum (maybe as long long). Then iterate.
Edge cases: n=1 => total = a1, need prefix >= total/2 => always true? For a1, prefix = a1, total = a1, condition 2*a1 >= a1 -> true, so answer 1. So correct.
Examples: 4: a=[1,3,2,1] total=7, prefix after day1=1, 2<7; day2:4, 8>=7 -> i=2. output 2. Second example: total=12, prefix: day1=2 (4<12), day2=4 (8<12), day3=6 (12>=12) -> i=3.
So solution trivial.
But wait: The note says: "up to this day (inclusive) he will solve 4 out of 7 scheduled problems on four days of the training." That's 4 >= 3.5. So indeed.
Thus answer.
We must output the index.
Implementation details: read n, read list, compute sum, then loop.
Potential pitfalls: need to break at first occurrence. All good.
Time complexity O(n). Memory O(1) extra.
Now generate final answer in Python or C++? Usually here we can provide solution. But the problem statement is from Codeforces? Usually they accept C++ or Python.
I'll produce a Python solution:
def solve():
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
total = sum(a)
pref = 0
for i, val in enumerate(a, start=1):
pref += val
if pref * 2 >= total:
print(i)
break
That's it.
But the problem might be trick: The "equator" celebration is on the evening after that day? But output index of day. So fine.
I'll output code.
Thus final answer. ```python
import sys
def main() -> None:
input_data = sys.stdin.read().strip().split()
if not input_data:
return
it = iter(input_data)
n = int(next(it))
a = [int(next(it)) for _ in range(n)]
total = sum(a)
prefix = 0
for i, val in enumerate(a, start=1):
prefix += val
if 2 * prefix >= total:
print(i)
break
if name == "main":
main()