**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Complex Segments (Easy Version)
time_limit_ms: 6000
memory_limit_mb: 256
Description: [Ken Arai - COMPLEX](https://soundcloud.com/diatomichail2/complex)

This is the easy version of the problem. In this version, the constraints on $n$ and the time limit are lower. You can make hacks only if both versions of the problem are solved.

A set of (closed) segments is complex if it can be partitioned into some subsets such that

  * all the subsets have the same size; and    * a pair of segments intersects if and only if the two segments are in the same subset.

You are given $n$ segments $[l_1, r_1], [l_2, r_2], \ldots, [l_n, r_n]$. Find the maximum size of a complex subset of these segments.

Input: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^3$). The description of the test cases follows.

The first line of each test case contains a single integer $n$ ($1 \le n \le 2 \cdot 10^4$) — the number of segments.

The second line of each test case contains $n$ integers $l_1, l_2, \ldots, l_n$ ($1 \le l_i \le 2n$) — the left endpoints of the segments.

The third line of each test case contains $n$ integers $r_1, r_2, \ldots, r_n$ ($l_i \leq r_i \le 2n$) — the right endpoints of the segments.

It is guaranteed that the sum of $n$ over all test cases does not exceed $2 \cdot 10^4$.

Output: For each test case, output a single integer: the maximum size of a complex subset of the given segments.

Examples:
input:
3
3
1 2 3
5 4 6
5
1 2 3 6 8
5 4 7 9 10
5
3 1 4 1 5
7 2 6 5 10
output:
3
4
4

Note: In the first test case, all pairs of segments intersect, therefore it is optimal to form a single group containing all of the three segments.

In the second test case, there is no valid partition for all of the five segments. A valid partition with four segments is the following: $\\{\\{ [1, 5], [2, 4] \\}, \\{ [6, 9], [8, 10] \\}\\}$.

In the third test case, it is optimal to make a single group containing all the segments except the second.

Buggy Code:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#ifndef LOCAL
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse4,popcnt,abm,mmx,tune=native")
#endif

#define pb push_back
#define ff first
#define ss second

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MOD = 1e9 + 7;

template<class K> using sset =  tree<K, null_type, less<K>, rb_tree_tag, tree_order_statistics_node_update>;

inline ll ceil0(ll a, ll b) {
    return a / b + ((a ^ b) > 0 && a % b);
}

void setIO() {
    ios_base::sync_with_stdio(0); cin.tie(0);
}

int seg[160005], tag[160005];
int n;

void build(int l = 1, int r = 2*n, int cur = 0){
    seg[cur] = 0;
    tag[cur] = 0;
    if(l == r) return;
    int mid = (l + r)/2;
    build(l, mid, cur*2 + 1);
    build(mid + 1, r, cur*2 + 2);
}

void push_down(int cur){
    tag[cur*2 + 1] += tag[cur];
    tag[cur*2 + 2] += tag[cur];
    seg[cur*2 + 1] += tag[cur];
    seg[cur*2 + 2] += tag[cur];
    tag[cur] = 0;
}

void upd(int l, int r, int ul = 1, int ur = 2*n, int cur = 0){
    if(l <= ul && ur <= r){
        seg[cur]++;
        tag[cur]++;
        return;
    }
    push_down(cur);
    int mid = (ul + ur)/2;
    if(l <= mid) upd(l, r, ul, mid, cur*2 + 1);
    if(r > mid) upd(l, r, mid + 1, ur, cur*2 + 2);
    seg[cur] = max(seg[cur*2 + 1], seg[cur*2 + 2]);
}

int que(int x, int ul = 1, int ur = 2*n, int cur = 0){
    if(x <= ul) return seg[cur];
    push_down(cur);
    int mid = (ul + ur)/2;
    if(x <= mid) return max(que(x, ul, mid, cur*2 + 1), seg[cur*2 + 2]);
    return que(x, mid + 1, ur, cur*2 + 2);
}

int main(){
    setIO();
    int T;
    cin >> T;
    for(int tt = 1; tt <= T; tt++){
        cin >> n;
        vector<pii> arr(n);
        for(int i = 0; i < n; i++) cin >> arr[i].ss;
        for(int i = 0; i < n; i++) cin >> arr[i].ff;
        sort(arr.begin(), arr.end());
        build();
        for(pii j : arr){
            bool found = false;
            upd(j.ss, j.ff);
        }
        int ans = seg[0];
        if(n > 5e3){
            for(int i = 1; i*i <= n; i++){ // subset size
                int tot = 0;
                int mx = 0;
                build();
                for(pii j : arr){
                    if(j.ss <= mx) continue;
                    bool found = false;
                    upd(j.ss, j.ff);
                    if(que(mx + 1) == i){
                        tot += i;
                        mx = j.ff;
                    }
                }
                ans = max(ans, tot);
            }
            for(int i = n/3; i <= n/2; i++){ // subset size
                int tot = 0;
                int mx = 0;
                build();
                for(pii j : arr){
                    if(j.ss <= mx) continue;
                    bool found = false;
                    upd(j.ss, j.ff);
                    if(que(mx + 1) == i){
                        tot += i;
                        mx = j.ff;
                    }
                }
                ans = max(ans, tot);
            }
            cout << ans << endl;
        } else {
            for(int i = 1; i <= n/2; i++){ // subset size
                int tot = 0;
                int mx = 0;
                build();
                for(pii j : arr){
                    if(j.ss <= mx) continue;
                    bool found = false;
                    upd(j.ss, j.ff);
                    if(que(mx + 1) == i){
                        tot += i;
                        mx = j.ff;
                    }
                }
                ans = max(ans, tot);
            }
            cout << ans << endl;
        }
    }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
3
3
1 2 3
5 4 6
5
1 2 3 6 8
5 4 7 9 10
5
3 1 4 1 5
7 2 6 5 10
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Alice's Adventures in Cutting Cake
time_limit_ms: 2000
memory_limit_mb: 256
Description: Alice is at the Mad Hatter's tea party! There is a long sheet cake made up of $n$ sections with tastiness values $a_1, a_2, \ldots, a_n$. There are $m$ creatures at the tea party, excluding Alice.

Alice will cut the cake into $m + 1$ pieces. Formally, she will partition the cake into $m + 1$ subarrays, where each subarray consists of some number of adjacent sections. The tastiness of a piece is the sum of tastiness of its sections. Afterwards, she will divvy these $m + 1$ pieces up among the $m$ creatures and herself (her piece can be empty). However, each of the $m$ creatures will only be happy when the tastiness of its piece is $v$ or more.

Alice wants to make sure every creature is happy. Limited by this condition, she also wants to maximize the tastiness of her own piece. Can you help Alice find the maximum tastiness her piece can have? If there is no way to make sure every creature is happy, output $-1$.

Input: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

The first line of each test case contains three integers $n, m, v$ ($1\le m\le n\le 2\cdot 10^5$; $1\le v\le 10^9$) — the number of sections, the number of creatures, and the creatures' minimum requirement for tastiness, respectively.

The next line contains $n$ space separated integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^9$) — the tastinesses of the sections.

The sum of $n$ over all test cases does not exceed $2\cdot 10^5$.

Output: For each test case, output the maximum tastiness Alice can achieve for her piece, or $-1$ if there is no way to make sure every creature is happy.

Examples:
input:
7
6 2 1
1 1 10 1 1 10
6 2 2
1 1 10 1 1 10
6 2 3
1 1 10 1 1 10
6 2 10
1 1 10 1 1 10
6 2 11
1 1 10 1 1 10
6 2 12
1 1 10 1 1 10
6 2 12
1 1 1 1 10 10
output:
22
12
2
2
2
0
-1

Note: For the first test case, Alice can give the first and second section as their own pieces, and then take the remaining $10 + 1 + 1 + 10 = 22$ tastiness for herself. We can show that she cannot do any better.

For the second test case, Alice could give the first and second section as one piece, and the sixth section as one piece. She can then take the remaining $10 + 1 + 1 = 12$ tastiness for herself. We can show that she cannot do any better.

For the seventh test case, Alice cannot give each creature a piece of at least $12$ tastiness.

Buggy Code:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define endl '\n'
#define INF 0x3f3f3f3f
#define LL long long
#define int long long
const int MAXN = 1e5 + 5;
const double EPS = 1e-9;

int n, m, v;
int a[210000];
int b[210000];
void solve()
{
    cin >> n >> m >> v;
    int sum = 0;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        b[i] = a[i];
        sum += a[i];
    }

    // int num = 0;
    // for (int i = 1; i <= n; i++) {
    //     if (b[i] >= v) {
    //         num++;
    //     } else {
    //         b[i + 1] += b[i];
    //     }
    // }
    // if (num < m) {
    //     cout << -1 << endl;
    //     return;
    // }
    int l = 1, r = n;
    int suml = a[l], sumr = a[r];
    int t = 0;
    while (l <= r && t < m) {
        while (suml < v) {
            l++;
            suml += a[l];
        }
        while (sumr < v) {
            r--;
            sumr += a[r];
        }
        if (suml < sumr) {
            sum -= suml;
            t++;
            l++;
            suml = a[l];
        } else {
            sum -= sumr;
            t++;
            r--;
            sumr = a[r];
        }
        // cout << "sum:" << sum << " l:" << l << " r:" << r << "  t:" << t << endl;
    }
    if (t < m) {
        cout << -1 << endl;
        return;
    }
    cout << sum << endl;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
6 3 10
10 9 1 1 1 10
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Alice's Adventures in Cutting Cake
time_limit_ms: 2000
memory_limit_mb: 256
Description: Alice is at the Mad Hatter's tea party! There is a long sheet cake made up of $n$ sections with tastiness values $a_1, a_2, \ldots, a_n$. There are $m$ creatures at the tea party, excluding Alice.

Alice will cut the cake into $m + 1$ pieces. Formally, she will partition the cake into $m + 1$ subarrays, where each subarray consists of some number of adjacent sections. The tastiness of a piece is the sum of tastiness of its sections. Afterwards, she will divvy these $m + 1$ pieces up among the $m$ creatures and herself (her piece can be empty). However, each of the $m$ creatures will only be happy when the tastiness of its piece is $v$ or more.

Alice wants to make sure every creature is happy. Limited by this condition, she also wants to maximize the tastiness of her own piece. Can you help Alice find the maximum tastiness her piece can have? If there is no way to make sure every creature is happy, output $-1$.

Input: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

The first line of each test case contains three integers $n, m, v$ ($1\le m\le n\le 2\cdot 10^5$; $1\le v\le 10^9$) — the number of sections, the number of creatures, and the creatures' minimum requirement for tastiness, respectively.

The next line contains $n$ space separated integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^9$) — the tastinesses of the sections.

The sum of $n$ over all test cases does not exceed $2\cdot 10^5$.

Output: For each test case, output the maximum tastiness Alice can achieve for her piece, or $-1$ if there is no way to make sure every creature is happy.

Examples:
input:
7
6 2 1
1 1 10 1 1 10
6 2 2
1 1 10 1 1 10
6 2 3
1 1 10 1 1 10
6 2 10
1 1 10 1 1 10
6 2 11
1 1 10 1 1 10
6 2 12
1 1 10 1 1 10
6 2 12
1 1 1 1 10 10
output:
22
12
2
2
2
0
-1

Note: For the first test case, Alice can give the first and second section as their own pieces, and then take the remaining $10 + 1 + 1 + 10 = 22$ tastiness for herself. We can show that she cannot do any better.

For the second test case, Alice could give the first and second section as one piece, and the sixth section as one piece. She can then take the remaining $10 + 1 + 1 = 12$ tastiness for herself. We can show that she cannot do any better.

For the seventh test case, Alice cannot give each creature a piece of at least $12$ tastiness.

Buggy Code:
// **Ganesh**
#include<bits/stdc++.h>
using namespace std;

void solve(){
    int n , m , v;
    cin >> n >> m >> v;
    vector<int> a(n);
    for(int i = 0; i < n; i ++){
        cin >> a[i];
    }
    vector<vector<int> > parts;
    vector<int> temp;
    vector<int> sums;
    int sum = 0;
    for(int i = 0; i < n; i ++){
        if(sum >= v && parts.size() < m){
            parts.push_back(temp);
            temp.clear();
            sums.push_back(sum);
            sum = 0;
        }
        temp.push_back(a[i]);
        sum += a[i];
    }
    if(temp.size()){
        if(parts.size() < m && sum >= v){
            parts.push_back(temp);
            sums.push_back(sum);
        }
        else if(parts.size() == m){
            parts.push_back(temp);
            sums.push_back(sum);
        }
    }

    if(parts.size() < m){
        cout << "-1\n";
        return;
    }

    // for(auto part: parts){
    //     for(auto x: part){
    //         cout << x << ' ';
    //     }
    //     cout << '\n';
    // }

    if(parts.size() > m){
        int last = sums[m];
        if(last >= v){
            cout << *max_element(sums.begin(),sums.end()) << '\n';
        }
        else{
            cout << last << '\n';
        }
        return;
    }

    int i = 0;
    int ans = 0;
    for(auto part: parts){
        int temp = 0;
        for(auto x: part){
            if(sums[i] - x >= v){
                temp += x;
            }
            else{
                ans = max(ans,temp);
                break;
            }
        }
        i ++;
    }
    cout << ans << endl;
}

int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int t = 1;
    cin >> t;
    while(t--){
        solve();
    }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
3
5 2 10
1 1 10 1 1
6 2 10
1 1 10 1 1 10
6 3 10
1 1 10 1 1 10
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Alice's Adventures in Cutting Cake
time_limit_ms: 2000
memory_limit_mb: 256
Description: Alice is at the Mad Hatter's tea party! There is a long sheet cake made up of $n$ sections with tastiness values $a_1, a_2, \ldots, a_n$. There are $m$ creatures at the tea party, excluding Alice.

Alice will cut the cake into $m + 1$ pieces. Formally, she will partition the cake into $m + 1$ subarrays, where each subarray consists of some number of adjacent sections. The tastiness of a piece is the sum of tastiness of its sections. Afterwards, she will divvy these $m + 1$ pieces up among the $m$ creatures and herself (her piece can be empty). However, each of the $m$ creatures will only be happy when the tastiness of its piece is $v$ or more.

Alice wants to make sure every creature is happy. Limited by this condition, she also wants to maximize the tastiness of her own piece. Can you help Alice find the maximum tastiness her piece can have? If there is no way to make sure every creature is happy, output $-1$.

Input: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

The first line of each test case contains three integers $n, m, v$ ($1\le m\le n\le 2\cdot 10^5$; $1\le v\le 10^9$) — the number of sections, the number of creatures, and the creatures' minimum requirement for tastiness, respectively.

The next line contains $n$ space separated integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^9$) — the tastinesses of the sections.

The sum of $n$ over all test cases does not exceed $2\cdot 10^5$.

Output: For each test case, output the maximum tastiness Alice can achieve for her piece, or $-1$ if there is no way to make sure every creature is happy.

Examples:
input:
7
6 2 1
1 1 10 1 1 10
6 2 2
1 1 10 1 1 10
6 2 3
1 1 10 1 1 10
6 2 10
1 1 10 1 1 10
6 2 11
1 1 10 1 1 10
6 2 12
1 1 10 1 1 10
6 2 12
1 1 1 1 10 10
output:
22
12
2
2
2
0
-1

Note: For the first test case, Alice can give the first and second section as their own pieces, and then take the remaining $10 + 1 + 1 + 10 = 22$ tastiness for herself. We can show that she cannot do any better.

For the second test case, Alice could give the first and second section as one piece, and the sixth section as one piece. She can then take the remaining $10 + 1 + 1 = 12$ tastiness for herself. We can show that she cannot do any better.

For the seventh test case, Alice cannot give each creature a piece of at least $12$ tastiness.

Buggy Code:
#include <bits/stdc++.h>
#define ll long long
#define rep(i,m,n) for(int i=(m); i<=(n); i++)
#define REB(i,m,n) for(int i=(m); i>=(n); i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MP make_pair
#define fs first
#define se second
#define bit(msk, i) ((msk >> i) & 1)
#define iter(id, v) for(auto id : v)
#define pb push_back
#define SZ(v) (ll)v.size()
#define ALL(v) v.begin(),v.end()

using namespace std;

mt19937_64 rd(chrono :: steady_clock :: now ().time_since_epoch().count());
ll Rand (ll l, ll r) { return uniform_int_distribution<ll> (l, r) (rd); }

const int N = 2e5 + 7;
const int Mod = 1e9 + 7;///lon
const ll INF = 1e18 + 7;
const int BASE = 137;
const int szBL = 350;

int n, m, V;
int a[N];
ll P[N], S[N];
ll pre[N];

void process () {
    cin >> n >> m >> V;
    rep (i, 1, n) cin >> a[i];
    rep (i, 1, n) pre[i] = pre[i - 1] + a[i];

    pre[n + 1] = 0;
    int ptr = 1;
    P[0] = 0;
    rep (i, 1, n) {
        while (ptr < i && pre[i] - pre[ptr] >= V) ++ptr;
        if (pre[i] - pre[ptr - 1] >= V) P[i] = max(1LL, P[ptr - 1] + 1);
        else P[i] = -INF;
    }

    ptr = n;
    S[n + 1] = 0;
    REB (i, n, 1) {
        while (ptr > i && pre[ptr - 1] - pre[i - 1] >= V) --ptr;
        if (pre[ptr] - pre[i - 1] >= V) S[i] = max(1LL, S[ptr + 1] + 1);
        else S[i] = -INF;
    }
//    cout << P[n] <<"\n";
    if (P[n] < m) {
        cout << -1 <<"\n";
        return;
    }
    ll res = 0;
    ll L = 1, R = pre[n];
    auto check = [&] (ll X) {
        int ptr = 1;
        rep (i, 1, n) {
            while (ptr < i && pre[i] - pre[ptr] >= X) ++ptr;
            if (pre[i] - pre[ptr - 1] >= X && P[ptr - 1] + S[i + 1] >= m) return 1;
        }
        return 0;
    };
    while (L < R) {
        ll mid = L + R + 1 >> 1;
        if (check(mid)) {
            res = mid;
            L = mid;
        }
        else R = mid - 1;
    }
    cout << res <<"\n";

}

#define file(name) if(fopen(name".inp","r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); }
main () {
//    file("c");
    ios_base :: sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int num_Test = 1;
    cin >> num_Test;
    while (num_Test--) {
        process();
    }
}
/*
onepunch +25

chắt lọc thông tin để mô hình
cận trên dưới
*/

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
6 3 5
5 5 5 5 5 5
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Alice's Adventures in Cutting Cake
time_limit_ms: 2000
memory_limit_mb: 256
Description: Alice is at the Mad Hatter's tea party! There is a long sheet cake made up of $n$ sections with tastiness values $a_1, a_2, \ldots, a_n$. There are $m$ creatures at the tea party, excluding Alice.

Alice will cut the cake into $m + 1$ pieces. Formally, she will partition the cake into $m + 1$ subarrays, where each subarray consists of some number of adjacent sections. The tastiness of a piece is the sum of tastiness of its sections. Afterwards, she will divvy these $m + 1$ pieces up among the $m$ creatures and herself (her piece can be empty). However, each of the $m$ creatures will only be happy when the tastiness of its piece is $v$ or more.

Alice wants to make sure every creature is happy. Limited by this condition, she also wants to maximize the tastiness of her own piece. Can you help Alice find the maximum tastiness her piece can have? If there is no way to make sure every creature is happy, output $-1$.

Input: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

The first line of each test case contains three integers $n, m, v$ ($1\le m\le n\le 2\cdot 10^5$; $1\le v\le 10^9$) — the number of sections, the number of creatures, and the creatures' minimum requirement for tastiness, respectively.

The next line contains $n$ space separated integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^9$) — the tastinesses of the sections.

The sum of $n$ over all test cases does not exceed $2\cdot 10^5$.

Output: For each test case, output the maximum tastiness Alice can achieve for her piece, or $-1$ if there is no way to make sure every creature is happy.

Examples:
input:
7
6 2 1
1 1 10 1 1 10
6 2 2
1 1 10 1 1 10
6 2 3
1 1 10 1 1 10
6 2 10
1 1 10 1 1 10
6 2 11
1 1 10 1 1 10
6 2 12
1 1 10 1 1 10
6 2 12
1 1 1 1 10 10
output:
22
12
2
2
2
0
-1

Note: For the first test case, Alice can give the first and second section as their own pieces, and then take the remaining $10 + 1 + 1 + 10 = 22$ tastiness for herself. We can show that she cannot do any better.

For the second test case, Alice could give the first and second section as one piece, and the sixth section as one piece. She can then take the remaining $10 + 1 + 1 = 12$ tastiness for herself. We can show that she cannot do any better.

For the seventh test case, Alice cannot give each creature a piece of at least $12$ tastiness.

Buggy Code:
t=int(input())
for _ in range(t):
    n,m,v=map(int,input().split())
    l=list(map(int,input().split()))
    prefix_sum=[0 for i in range(n+1)]
    for i in range(1,n+1):
        prefix_sum[i]=prefix_sum[i-1]+l[i-1]
    # print("prefix_sum",prefix_sum)
    pre_satisfy = [0]
    post_satisfy = [0]

    count=l[0]
    for i in range(1,n):
        if count>=v:
            pre_satisfy.append(pre_satisfy[-1]+1)
            count=0
        else:
            pre_satisfy.append(pre_satisfy[-1])

        count+=l[i]

    # print("pre_satisfy",pre_satisfy)

    count=l[-1]
    for i in range(n-2,-1,-1):
        if count>=v:
            post_satisfy.append(post_satisfy[-1]+1)
            count=0
        else:
            post_satisfy.append(post_satisfy[-1])

        count+=l[i]
    post_satisfy=post_satisfy[::-1]
    # print("post_satisfy",post_satisfy)

    dp1=[-1 for i in range(n+1)]
    for i in range(n):
        dp1[post_satisfy[i]]=i
    ans=0
    flag=0
    for i in range(1,n+1):
        h = pre_satisfy[i-1]
        req = m - h
        if req<0:
            continue
        idx=dp1[req]
        if idx==-1:
            continue
        # print("i",i,"idx",idx)
        if idx+1>=i-1:
            flag=1
            ans = max (ans, prefix_sum[idx+1]-prefix_sum[i-1])

    if flag==0:
        print(-1)
    else:
        print(ans)

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
3
5 2 10
10 1 1 10 1
5 2 10
10 1 1 10 10
5 2 15
10 1 1 10 10
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Alice's Adventures in Cutting Cake
time_limit_ms: 2000
memory_limit_mb: 256
Description: Alice is at the Mad Hatter's tea party! There is a long sheet cake made up of $n$ sections with tastiness values $a_1, a_2, \ldots, a_n$. There are $m$ creatures at the tea party, excluding Alice.

Alice will cut the cake into $m + 1$ pieces. Formally, she will partition the cake into $m + 1$ subarrays, where each subarray consists of some number of adjacent sections. The tastiness of a piece is the sum of tastiness of its sections. Afterwards, she will divvy these $m + 1$ pieces up among the $m$ creatures and herself (her piece can be empty). However, each of the $m$ creatures will only be happy when the tastiness of its piece is $v$ or more.

Alice wants to make sure every creature is happy. Limited by this condition, she also wants to maximize the tastiness of her own piece. Can you help Alice find the maximum tastiness her piece can have? If there is no way to make sure every creature is happy, output $-1$.

Input: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

The first line of each test case contains three integers $n, m, v$ ($1\le m\le n\le 2\cdot 10^5$; $1\le v\le 10^9$) — the number of sections, the number of creatures, and the creatures' minimum requirement for tastiness, respectively.

The next line contains $n$ space separated integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^9$) — the tastinesses of the sections.

The sum of $n$ over all test cases does not exceed $2\cdot 10^5$.

Output: For each test case, output the maximum tastiness Alice can achieve for her piece, or $-1$ if there is no way to make sure every creature is happy.

Examples:
input:
7
6 2 1
1 1 10 1 1 10
6 2 2
1 1 10 1 1 10
6 2 3
1 1 10 1 1 10
6 2 10
1 1 10 1 1 10
6 2 11
1 1 10 1 1 10
6 2 12
1 1 10 1 1 10
6 2 12
1 1 1 1 10 10
output:
22
12
2
2
2
0
-1

Note: For the first test case, Alice can give the first and second section as their own pieces, and then take the remaining $10 + 1 + 1 + 10 = 22$ tastiness for herself. We can show that she cannot do any better.

For the second test case, Alice could give the first and second section as one piece, and the sixth section as one piece. She can then take the remaining $10 + 1 + 1 = 12$ tastiness for herself. We can show that she cannot do any better.

For the seventh test case, Alice cannot give each creature a piece of at least $12$ tastiness.

Buggy Code:
import sys
import math
# Fast input
input = sys.stdin.readline
# Fast output
def print(*args, **kwargs):
    sep = kwargs.get('sep', ' ')
    end = kwargs.get('end', '\n')
    file = kwargs.get('file', sys.stdout)
    flush = kwargs.get('flush', False)
    output = sep.join(map(str, args)) + end
    file.write(output)
    if flush:
        file.flush()

from types import GeneratorType
def bootstrap(f, stack=[]):
    def wrappedfunc(*args, **kwargs):
        if stack:
            return f(*args, **kwargs)
        else:
            to = f(*args, **kwargs)
            while True:
                if type(to) is GeneratorType:
                    stack.append(to)
                    to = next(to)
                else:
                    stack.pop()
                    if not stack:
                        break
                    to = stack[-1].send(to)
            return to
    return wrappedfunc
# @bootstrap
# def dfs(node, parent, x):
#     sx = 1
#     for i in graph[node]:
#         if i==parent:
#             continue
#         sx += yield dfs(i, node, x)
#     if sx >= x:
#         ans[0] += 1
#         sx = 0
#     yield sx

from collections import Counter, deque, defaultdict
from itertools import accumulate, product, groupby, combinations
import operator
import math
import bisect
import heapq

def readIntLine():
    return [int(char) for char in input().split()]

def readCharLine():
    return [char for char in input().split()]

def modmul(a, b, mod):
    a %= mod
    b %= mod
    return (a * b) % mod

def modadd(a, b, mod):
    a %= mod
    b %= mod
    return (a+b)%mod

def modsub(a, b, mod):
    a %= mod
    b %= mod
    return (a - b + mod)%mod

def modInverse(A, M):
    for X in range(1, M):
        if (((A % M) * (X % M)) % M == 1):
            return X
    return -1

def gcd(a,b):
    if b== 0:
        return a
    return gcd(b, a%b)

def is_coprime(a,b):
    return gcd(a,b)==1

def expo(a, n, mod):
    res = 1
    while n:
        if n&1:
            res = modmul(res,a,mod)
            n -= 1
        else:
            a = modmul(a,a,mod)
            n >>= 1
    return res

def get_mex(arr, N):
    arr = sorted(arr)
    mex = 0
    for idx in range(N):
        if arr[idx] == mex:
            mex += 1
    return mex

def primeFactors(n):
    res = Counter()
    while n % 2 == 0:
        res[2] += 1
        n = n / 2
    for i in range(3,int(math.sqrt(n))+1,2):
        while n % i== 0:
            res[i] += 1
            n //= i
    if n > 2:
        res[n] += 1
    return res

def printDivisors(n) :
    i = 1
    divs = []
    while i <= math.sqrt(n):
        if (n % i == 0) :
            if (n / i == i) :
                divs.append(i)
            else :
                divs.append(i)
                divs.append(n//i)
        i = i + 1
    return sorted(divs)

def LcmOfArray(arr, idx):
    # lcm(a,b) = (a*b/gcd(a,b))
    if (idx == len(arr)-1):
        return arr[idx]
    a = arr[idx]
    b = LcmOfArray(arr, idx+1)
    return int(a*b/math.gcd(a,b)) # __gcd(a,b) is inbuilt library function

# UF = {}
# def find(x):
#     if x not in UF:
#         UF[x] = x
#     if UF[x] != x:
#         UF[x] = find(UF[x])
#     return UF[x]
# def union(x, y):
#     rX, rY = find(x), find(y)
#     if rX < rY:
#         UF[rY] = rX
#     else:
#         UF[rX] = rY

# ==========================
# N choose R
# factorials = [1]
# currMul = 1
# MOD = 10**9 + 7
# for i in range(1, (2 * 10**5) + 2):
#     currMul *= i
#     currMul %= MOD
#     factorials.append(currMul)

# def nCr(n, r):
#     if r > n:
#         return 0
#     numerator = factorials[n]
#     denominator = (factorials[r] * factorials[n - r]) % MOD
#     return (numerator * pow(denominator, MOD - 2, MOD)) % MOD
# ==========================

def solve(idx):
    # n = int(input())
    n, m, v = (map(int,input().split()))
    # w = int(input())
    arr =  list(map(int,input().split()))
    # S = input().rstrip('\n')

    ans = [22, 12, 2, 2, 2, 0, -1]
    if idx < len(ans):
        print(ans[idx])
        return
    if idx == 153:
        print(n, m, v)
        print(arr)
    return

    to_right = [-1]*(n+1)
    to_left = [-1]*(n+1)

    cur, cnt = 0, 1
    for i, a in enumerate(arr):
        cur += a
        if cur >= v:
            to_right[cnt] = i
            cnt += 1
            cur = 0

    cur, cnt = 0, 1
    for i in range(n-1,-1,-1):
        cur += arr[i]
        if cur >= v:
            to_left[cnt] = i
            cnt += 1
            cur = 0

    # print(to_right, to_left)

    ans = -1
    for left in range(m+1):
        right = m-left
        i, j = to_right[left], to_left[right]
        if i == j:
            continue
        # print("left, right ", left, right)
        # print("i, j ", i, j)
        if j == -1:
            j = n
        # print("i, j ", i, j)
        if i<j:
            res = sum(arr[i+1:j])
            # print(res)
            ans = max(ans, res)

    print(ans)

# solve(0)
for i in range(int(input())):
    solve(i)

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To generate a challenging test input that exposes the bug in the provided buggy code, we need to focus on edge cases and scenarios that can cause the algorithm to fail. Here are some steps to consider:

1. **Edge Cases**:
   - Test with the minimum possible values for \( n \) and \( m \).
   - Test with the maximum possible values for \( n \) and \( m \).
   - Test with \( v \) set to a value that makes it impossible to satisfy the condition for some or all creatures.

2. **Critical Scenarios**:
   - Test with a cake that has a single section.
   - Test with a cake where the sum of all sections is just enough to meet the minimum requirement for all creatures.
   - Test with a cake where the sum of all sections is less than the minimum requirement for all creatures.
   - Test with a cake where the sections are distributed in such a way that it is difficult to partition the cake to meet the requirements.

3. **Validation**:
   - Ensure the test input is complete and valid according to the problem constraints.

Based on these considerations, here is a challenging test input:

```plaintext
4
1 1 1
1
3 2 2
1 1 1
5 2 10
1 1 1 1 1
5 2 10
10 10 1 1 1
```

Explanation of the test cases:
1. **Test Case 1**:
   - \( n = 1 \), \( m = 1 \), \( v = 1 \)
   - Cake: [1]
   - Expected Output: -1 (since there is no way to cut the cake to meet the requirement for the creature)

2. **Test Case 2**:
   - \( n = 3 \), \( m = 2 \), \( v = 2 \)
   - Cake: [1, 1, 1]
   - Expected Output: -1 (since the sum of all sections is less than the minimum requirement for both creatures)

3. **Test Case 3**:
   - \( n = 5 \), \( m = 2 \), \( v = 10 \)
   - Cake: [1, 1, 1, 1, 1]
   - Expected Output: -1 (since the sum of all sections is less than the minimum requirement for both creatures)

4. **Test Case 4**:
   - \( n = 5 \), \( m = 2 \), \( v = 10 \)
   - Cake: [10, 10, 1, 1, 1]
   - Expected Output: 11 (since Alice can give one piece of 10 to each creature and take the remaining 11 for herself)

This test input should help expose any bugs in the provided code, particularly in handling edge cases and critical scenarios.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Alice's Adventures in Cutting Cake
time_limit_ms: 2000
memory_limit_mb: 256
Description: Alice is at the Mad Hatter's tea party! There is a long sheet cake made up of $n$ sections with tastiness values $a_1, a_2, \ldots, a_n$. There are $m$ creatures at the tea party, excluding Alice.

Alice will cut the cake into $m + 1$ pieces. Formally, she will partition the cake into $m + 1$ subarrays, where each subarray consists of some number of adjacent sections. The tastiness of a piece is the sum of tastiness of its sections. Afterwards, she will divvy these $m + 1$ pieces up among the $m$ creatures and herself (her piece can be empty). However, each of the $m$ creatures will only be happy when the tastiness of its piece is $v$ or more.

Alice wants to make sure every creature is happy. Limited by this condition, she also wants to maximize the tastiness of her own piece. Can you help Alice find the maximum tastiness her piece can have? If there is no way to make sure every creature is happy, output $-1$.

Input: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

The first line of each test case contains three integers $n, m, v$ ($1\le m\le n\le 2\cdot 10^5$; $1\le v\le 10^9$) — the number of sections, the number of creatures, and the creatures' minimum requirement for tastiness, respectively.

The next line contains $n$ space separated integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^9$) — the tastinesses of the sections.

The sum of $n$ over all test cases does not exceed $2\cdot 10^5$.

Output: For each test case, output the maximum tastiness Alice can achieve for her piece, or $-1$ if there is no way to make sure every creature is happy.

Examples:
input:
7
6 2 1
1 1 10 1 1 10
6 2 2
1 1 10 1 1 10
6 2 3
1 1 10 1 1 10
6 2 10
1 1 10 1 1 10
6 2 11
1 1 10 1 1 10
6 2 12
1 1 10 1 1 10
6 2 12
1 1 1 1 10 10
output:
22
12
2
2
2
0
-1

Note: For the first test case, Alice can give the first and second section as their own pieces, and then take the remaining $10 + 1 + 1 + 10 = 22$ tastiness for herself. We can show that she cannot do any better.

For the second test case, Alice could give the first and second section as one piece, and the sixth section as one piece. She can then take the remaining $10 + 1 + 1 = 12$ tastiness for herself. We can show that she cannot do any better.

For the seventh test case, Alice cannot give each creature a piece of at least $12$ tastiness.

Buggy Code:
from bisect import bisect_left

for _ in range(int(input())):
    n, m, v = map(int, input().split())
    a = list(map(int, input().split()))
    pre = [0] * (n + 1)
    for i in range(len(a)):
        pre[i + 1] = pre[i] + a[i]
    l, r = 1, n
    num = 0
    while num < m:
        el = bisect_left(pre, pre[l - 1] + v)
        br = bisect_left(pre, pre[r] - v + 1)
        # print(f"el, vl, br, vr = {el}, {vl}, {br}, {vr}")
        if el > r or br < l:
            break

        vl = pre[el] - pre[l - 1]
        vr = pre[r] - pre[br - 1]
        if vl <= vr:
            l = el + 1
        else:
            r = br - 1
        num += 1
    # print(f"l, r = {l}, {r}")
    if num < m:
        print(-1)
    else:
        print(pre[r] - pre[l - 1])

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
3
5 3 10
1 1 1 1 1
5 3 10
10 1 1 10 1
5 2 15
10 5 10 5 10
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Alice's Adventures in Cutting Cake
time_limit_ms: 2000
memory_limit_mb: 256
Description: Alice is at the Mad Hatter's tea party! There is a long sheet cake made up of $n$ sections with tastiness values $a_1, a_2, \ldots, a_n$. There are $m$ creatures at the tea party, excluding Alice.

Alice will cut the cake into $m + 1$ pieces. Formally, she will partition the cake into $m + 1$ subarrays, where each subarray consists of some number of adjacent sections. The tastiness of a piece is the sum of tastiness of its sections. Afterwards, she will divvy these $m + 1$ pieces up among the $m$ creatures and herself (her piece can be empty). However, each of the $m$ creatures will only be happy when the tastiness of its piece is $v$ or more.

Alice wants to make sure every creature is happy. Limited by this condition, she also wants to maximize the tastiness of her own piece. Can you help Alice find the maximum tastiness her piece can have? If there is no way to make sure every creature is happy, output $-1$.

Input: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

The first line of each test case contains three integers $n, m, v$ ($1\le m\le n\le 2\cdot 10^5$; $1\le v\le 10^9$) — the number of sections, the number of creatures, and the creatures' minimum requirement for tastiness, respectively.

The next line contains $n$ space separated integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^9$) — the tastinesses of the sections.

The sum of $n$ over all test cases does not exceed $2\cdot 10^5$.

Output: For each test case, output the maximum tastiness Alice can achieve for her piece, or $-1$ if there is no way to make sure every creature is happy.

Examples:
input:
7
6 2 1
1 1 10 1 1 10
6 2 2
1 1 10 1 1 10
6 2 3
1 1 10 1 1 10
6 2 10
1 1 10 1 1 10
6 2 11
1 1 10 1 1 10
6 2 12
1 1 10 1 1 10
6 2 12
1 1 1 1 10 10
output:
22
12
2
2
2
0
-1

Note: For the first test case, Alice can give the first and second section as their own pieces, and then take the remaining $10 + 1 + 1 + 10 = 22$ tastiness for herself. We can show that she cannot do any better.

For the second test case, Alice could give the first and second section as one piece, and the sixth section as one piece. She can then take the remaining $10 + 1 + 1 = 12$ tastiness for herself. We can show that she cannot do any better.

For the seventh test case, Alice cannot give each creature a piece of at least $12$ tastiness.

Buggy Code:
import java.io.*;
import java.util.*;

public class Main {
	public static long binexp(long a, long b, long MOD){
		long mult = 1;
		while(b >= 1){
			if(b%2 == 1){
				mult = (mult * a)%MOD;
			}
			b /= 2;
			a = (a * a)%MOD;

		}
		return mult;
	}
	public static long modinv(long num, long MOD){
		return binexp(num,MOD-2,MOD);
	}
	public static long gcd(long a, long b){
		return (a < b) ? gcd(b,a) : (a%b == 0 ? b : gcd(a%b,b));
	}
	public static long lcm(long a, long b){
		return a/gcd(a,b) * b;
	}
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int T = Integer.parseInt(br.readLine());
		while(T-- > 0){
			String[] s = br.readLine().split(" ");
			int N = Integer.parseInt(s[0]);
			int M = Integer.parseInt(s[1]);
			long V = Long.parseLong(s[2]);
			s = br.readLine().split(" ");
			long[] a = new long[N];
			long total = 0;
			for(int i = 0; i < s.length; i++){
				a[i] = Long.parseLong(s[i]);
				total += a[i];
			}
			int L = 0;
			int R = N-1;
			long countL = 0;
			long countR = 0;
			int creatures = 0;
			int ct = 0;
			while(L <= R){
				countL = 0;
				countR = 0;
				//System.out.println(L + " " + R);
				int prevL = L;
				int prevR = R;
				while(L < N && countL < V){
					countL += a[L];
					L++;
				}
				while(R >= 0 && countR < V){
					countR += a[R];
					R--;
				}
				//L--;
				//R++;
				if(countL < V || countR < V) break;
				if(countL < countR){
					R = prevR;
					total -= countL;
					//System.out.println("Taking " + countL + " from left");
				}
				else{
					L = prevL;
					total -= countR;
					//System.out.println("Taking " + countR + " from right");
				}

				creatures++;
				if(creatures == M) break;
			}
			System.out.println((creatures < M) ? -1 : total);
		}

	}
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
3
6 2 1
1 1 10 1 1 10
6 2 11
1 1 10 1 1 10
6 2 12
1 1 1 1 10 10
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Alice's Adventures in Cutting Cake
time_limit_ms: 2000
memory_limit_mb: 256
Description: Alice is at the Mad Hatter's tea party! There is a long sheet cake made up of $n$ sections with tastiness values $a_1, a_2, \ldots, a_n$. There are $m$ creatures at the tea party, excluding Alice.

Alice will cut the cake into $m + 1$ pieces. Formally, she will partition the cake into $m + 1$ subarrays, where each subarray consists of some number of adjacent sections. The tastiness of a piece is the sum of tastiness of its sections. Afterwards, she will divvy these $m + 1$ pieces up among the $m$ creatures and herself (her piece can be empty). However, each of the $m$ creatures will only be happy when the tastiness of its piece is $v$ or more.

Alice wants to make sure every creature is happy. Limited by this condition, she also wants to maximize the tastiness of her own piece. Can you help Alice find the maximum tastiness her piece can have? If there is no way to make sure every creature is happy, output $-1$.

Input: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

The first line of each test case contains three integers $n, m, v$ ($1\le m\le n\le 2\cdot 10^5$; $1\le v\le 10^9$) — the number of sections, the number of creatures, and the creatures' minimum requirement for tastiness, respectively.

The next line contains $n$ space separated integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^9$) — the tastinesses of the sections.

The sum of $n$ over all test cases does not exceed $2\cdot 10^5$.

Output: For each test case, output the maximum tastiness Alice can achieve for her piece, or $-1$ if there is no way to make sure every creature is happy.

Examples:
input:
7
6 2 1
1 1 10 1 1 10
6 2 2
1 1 10 1 1 10
6 2 3
1 1 10 1 1 10
6 2 10
1 1 10 1 1 10
6 2 11
1 1 10 1 1 10
6 2 12
1 1 10 1 1 10
6 2 12
1 1 1 1 10 10
output:
22
12
2
2
2
0
-1

Note: For the first test case, Alice can give the first and second section as their own pieces, and then take the remaining $10 + 1 + 1 + 10 = 22$ tastiness for herself. We can show that she cannot do any better.

For the second test case, Alice could give the first and second section as one piece, and the sixth section as one piece. She can then take the remaining $10 + 1 + 1 = 12$ tastiness for herself. We can show that she cannot do any better.

For the seventh test case, Alice cannot give each creature a piece of at least $12$ tastiness.

Buggy Code:
import java.util.*;
import java.io.*;
import java.math.*;

// map.merge(key,newV,(oldV,newV)->oldV+newV); = if x is absent x will be inserted with newV.
// map.computeIfAbsent(key, k -> v); // Only adds a value if the key is absent.
// map.computeIfPresent(k, (k,oldV) -> newV); it will modify if k is present.
// map.getOrDefault(k, v); If the key is absent, value will hold v, but this does not modify the map.

public class Task{
        //  ..............code begins here..............

static int mod=(int)1e9+7;
static int timer = 0;
static int n,m,v;
//static long l,r,k;
static int[][] dp,pre;

static long countSetBits(int k, long N) {
    //out.write(((N+1)/(1l<<(k+1)))*(1l<<k) +", "+ Math.max(0,((N+1)%(1l<<(k+1))) - (1l<<k))+"\n");
    return ((N+1)/(1l<<(k+1)))*(1l<<k) + Math.max(0,((N+1)%(1l<<(k+1))) - (1l<<k));
}
static void solve() throws IOException {
    int[] a1=int_arr();
    n=a1[0];m=a1[1];v=a1[2];
    int[] a = int_arr();
    long[] b = new long[n];
    b[0]=a[0];
    for(int i=1;i<n;i++)b[i]=b[i-1]+a[i];
    int i=0,c=0;
    long tmp=0;
    int[] pre = new int[n];
    int[] rpre = new int[n];
    while(i<n){
        tmp+=a[i];
        if(tmp>=v){
            c++;tmp=0;
            pre[i]=1;
        }
        i++;
    }
    if(c<m){
        out.write("-1\n");
        return;
    }
    for(int j=1;j<n;j++) pre[j]+=pre[j-1];
    i=n-1;tmp=0;
    while(i>=0){
        tmp+=a[i];
        if(tmp>=v){
            rpre[i]=1;tmp=0;
        }
        i--;
    }
    for(int j=n-2;j>=0;j--)rpre[j]+=rpre[j+1];
    long max=0;
    for(int j=0;j<n;j++){
        // assume [j..] is for Alice
        int left = j==0?0:pre[j-1],need=m-left;
        int l=j+1,r=n-1;
        if(l<n&&rpre[l]<need){
            break;
        }
        if(need==0){
            long tmp1=0;
            if(j==0){
                tmp1=b[n-1];
            }else{
                tmp1=b[n-1]-b[j-1];
            }
            max=Math.max(max,tmp1);
            break;
        }
        while(l<r){
            int m=(l+r+1)/2;
            if(rpre[m]<need){
                r=m-1;
            }else{
                l=m;
            }
        }
        long tmp1=0;
        if(j==0){
            tmp1=b[l-1];
        }else{
            tmp1=b[l-1]-b[j-1];
        }
        max=Math.max(max,tmp1);
    }

    out.write(max+"\n");
}

public static void main(String[] args) throws  IOException{
                assign();
                int t=int_v(read());
                while(t--!=0) solve();
                 out.flush();
}

// taking inputs

static BufferedReader s1;
static BufferedWriter out;
static String read() throws IOException{String line="";while(line.length()==0){line=s1.readLine();continue;}return line;}
static int int_v (String s1){return Integer.parseInt(s1);}
static long long_v(String s1){return Long.parseLong(s1);}
static void sort(int[] a){List<Integer> l=new ArrayList<>();for(int x:a){l.add(x);}Collections.sort(l);for(int i=0;i<a.length;i++){a[i]=l.get(i);}}
static int[] int_arr() throws IOException{String[] a=read().split(" ");int[] b=new int[a.length];for(int i=1;i<=a.length;i++){b[i-1]=int_v(a[i-1]);}return b;}
static long[] long_arr() throws IOException{String[] a=read().split(" ");long[] b=new long[a.length];for(int i=1;i<=a.length;i++){b[i-1]=long_v(a[i-1]);}return b;}
static void assign(){s1=new BufferedReader(new InputStreamReader(System.in));out=new BufferedWriter(new OutputStreamWriter(System.out));}
//static String setpreciosion(double d,int k){BigDecimal d1 = new BigDecimal(Double.toString(d));return d1.setScale(k,RoundingMode.HALF_UP).toString();}//UP DOWN HALF_UP
static long Modpow(long a,long p,long m){long res=1;while(p>0){if((p&1)!=0){res=(res*a)%m;}p >>=1;a=(a*a)%m;}return res%m;}
static long Modmul(long a,long b,long m){return ((a%m)*(b%m))%m;}
static long ModInv(long a,long m){return Modpow(a,m-2,m);}
//static long nck(int n,int r,long m){if(r>n){return 0l;}return Modmul(f[n],ModInv(Modmul(f[n-r],f[r],m),m),m);}
//static long[] f;
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
5 3 15
10 10 10 10 10
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Alice's Adventures in Cutting Cake
time_limit_ms: 2000
memory_limit_mb: 256
Description: Alice is at the Mad Hatter's tea party! There is a long sheet cake made up of $n$ sections with tastiness values $a_1, a_2, \ldots, a_n$. There are $m$ creatures at the tea party, excluding Alice.

Alice will cut the cake into $m + 1$ pieces. Formally, she will partition the cake into $m + 1$ subarrays, where each subarray consists of some number of adjacent sections. The tastiness of a piece is the sum of tastiness of its sections. Afterwards, she will divvy these $m + 1$ pieces up among the $m$ creatures and herself (her piece can be empty). However, each of the $m$ creatures will only be happy when the tastiness of its piece is $v$ or more.

Alice wants to make sure every creature is happy. Limited by this condition, she also wants to maximize the tastiness of her own piece. Can you help Alice find the maximum tastiness her piece can have? If there is no way to make sure every creature is happy, output $-1$.

Input: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

The first line of each test case contains three integers $n, m, v$ ($1\le m\le n\le 2\cdot 10^5$; $1\le v\le 10^9$) — the number of sections, the number of creatures, and the creatures' minimum requirement for tastiness, respectively.

The next line contains $n$ space separated integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^9$) — the tastinesses of the sections.

The sum of $n$ over all test cases does not exceed $2\cdot 10^5$.

Output: For each test case, output the maximum tastiness Alice can achieve for her piece, or $-1$ if there is no way to make sure every creature is happy.

Examples:
input:
7
6 2 1
1 1 10 1 1 10
6 2 2
1 1 10 1 1 10
6 2 3
1 1 10 1 1 10
6 2 10
1 1 10 1 1 10
6 2 11
1 1 10 1 1 10
6 2 12
1 1 10 1 1 10
6 2 12
1 1 1 1 10 10
output:
22
12
2
2
2
0
-1

Note: For the first test case, Alice can give the first and second section as their own pieces, and then take the remaining $10 + 1 + 1 + 10 = 22$ tastiness for herself. We can show that she cannot do any better.

For the second test case, Alice could give the first and second section as one piece, and the sixth section as one piece. She can then take the remaining $10 + 1 + 1 = 12$ tastiness for herself. We can show that she cannot do any better.

For the seventh test case, Alice cannot give each creature a piece of at least $12$ tastiness.

Buggy Code:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define repL(i, a, b) for (long long i = a; i <= b; i++)
typedef vector<ll> viL;

void solve()
{
  ll n, m, v;
  cin >> n >> m >> v;
  viL a(n), pre(n + 1, 0), check(m + 1, -1);
  repL(i, 0, n - 1)
  {
    cin >> a[i];
    pre[i + 1] = pre[i] + a[i];
  }
  ll i = 0, sum = 0;
  check[0] = n;
  for (ll j = n - 1; j >= 0; j--)
  {
    sum += a[j];
    if (sum >= v)
    {
      check[i + 1] = j;
      i++;
      sum = 0;
    }
    if (i == m)
      break;
  }

  if (check[m] == -1)
  {
    cout << -1 << endl;
    return;
  }
  i = 0;
  ll ans = -1, left_sum = 0;

  if (check[m] != -1)
    ans = pre[check[m]];

  repL(j, 0, m - 1)
  {
    left_sum += a[j];
    if (left_sum >= v)
    {
      left_sum = 0;
      i++;
      ll ind = check[m - i];
      if (ind != -1 && ind - j > 1)
      {
        ans = max(ans, pre[ind] - pre[j + 1]);
      }
    }
  }

  cout << ans << endl;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);

  int tests = 1;
  cin >> tests;
  while (tests--)
  {
    solve();
  }
  return 0;
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
3
5 2 10
1 9 9 1 9
5 2 10
9 1 9 1 9
5 2 10
1 9 1 9 1
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Alice's Adventures in Cutting Cake
time_limit_ms: 2000
memory_limit_mb: 256
Description: Alice is at the Mad Hatter's tea party! There is a long sheet cake made up of $n$ sections with tastiness values $a_1, a_2, \ldots, a_n$. There are $m$ creatures at the tea party, excluding Alice.

Alice will cut the cake into $m + 1$ pieces. Formally, she will partition the cake into $m + 1$ subarrays, where each subarray consists of some number of adjacent sections. The tastiness of a piece is the sum of tastiness of its sections. Afterwards, she will divvy these $m + 1$ pieces up among the $m$ creatures and herself (her piece can be empty). However, each of the $m$ creatures will only be happy when the tastiness of its piece is $v$ or more.

Alice wants to make sure every creature is happy. Limited by this condition, she also wants to maximize the tastiness of her own piece. Can you help Alice find the maximum tastiness her piece can have? If there is no way to make sure every creature is happy, output $-1$.

Input: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

The first line of each test case contains three integers $n, m, v$ ($1\le m\le n\le 2\cdot 10^5$; $1\le v\le 10^9$) — the number of sections, the number of creatures, and the creatures' minimum requirement for tastiness, respectively.

The next line contains $n$ space separated integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^9$) — the tastinesses of the sections.

The sum of $n$ over all test cases does not exceed $2\cdot 10^5$.

Output: For each test case, output the maximum tastiness Alice can achieve for her piece, or $-1$ if there is no way to make sure every creature is happy.

Examples:
input:
7
6 2 1
1 1 10 1 1 10
6 2 2
1 1 10 1 1 10
6 2 3
1 1 10 1 1 10
6 2 10
1 1 10 1 1 10
6 2 11
1 1 10 1 1 10
6 2 12
1 1 10 1 1 10
6 2 12
1 1 1 1 10 10
output:
22
12
2
2
2
0
-1

Note: For the first test case, Alice can give the first and second section as their own pieces, and then take the remaining $10 + 1 + 1 + 10 = 22$ tastiness for herself. We can show that she cannot do any better.

For the second test case, Alice could give the first and second section as one piece, and the sixth section as one piece. She can then take the remaining $10 + 1 + 1 = 12$ tastiness for herself. We can show that she cannot do any better.

For the seventh test case, Alice cannot give each creature a piece of at least $12$ tastiness.

Buggy Code:
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define int long long int

// // const int mod = 1000000007;

// // long long binpow(long long a, long long b) {
// //     if (b == 0)
// //         return 1ll;
// //     long long res = (binpow(a, b / 2) % mod) ;
// //     if (b % 2)
// //         return ((res%mod * res%mod)%mod * a%mod) % mod;
// //     else
// //         return (res%mod * res%mod) % mod;
// // }

// // int log_a_to_base_b(int a, int b)
// // {
// //     return log2(a) / log2(b);
// // }

// // int mod_mul(int a, int b, int m) {a = a % m; b = b % m; return (((a * b) % m) + m) % m;}
// // int mod_add(int a, int b, int m) {a = a % m; b = b % m; return (((a + b) % m) + m) % m;}

// // const int mod2 = 998244353;

// int query(int l,int r){
//     cout<<"? "<<l<<" "<<r<<endl;
//     int res;
//     cin>>res;

//     return res;
// }

// void b(int z){
//     for(int i=0;i<30;i++){
//         if(z & 1<<i) cout<<1;
//         else cout<<0;
//     }
//     cout<<endl;
// }

void solve(){

    int n,m,v;
    cin>>n>>m>>v;

    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];

    int ans = -1;
    int k = m;
    int sum = 0;

    vector<int> l(n,m);

    for(int i=0;i<n;i++){
        sum+=a[i];
        if(sum>=v){
            sum=0;
            k--;
        }
        l[i] = m-k;
        if(k==0){
            int cur = 0;
            i++;
            while(i<n){
                cur+=a[i];
                i++;
            }
            ans=max(ans,cur);
        }
    }

    k = m;
    sum = 0;

    // for(int i=0;i<n;i++) cout<<l[i]<<" ";
    //     cout<<endl;

    vector<int> b = a;
    for(int i=1;i<n;i++){
        b[i]+=b[i-1];
        // cout<<b[i]<<" ";
    }

    for(int i=n-1;i>=0;i--){
        sum+=a[i];
        if(sum>=v){
            sum=0;
            k--;
        }
        int z = k;
        int e = (lower_bound(all(l),z))-l.begin();
        // cout<<z<<" "<<e<<endl;
        if(z!=0 && e+1<i-1) ans = max(ans,b[i-1]-b[e]);

        if(k==0){
            int cur = 0;
            int j = i-1;
            while(j>=0){
                cur+=a[j];
                j--;
            }
            ans=max(ans,cur);
        }
    }

    // k=m;
    // sum=0;

    // for(int i=0;i<n;i++){
    //     sum+=a[i];
    //     if(sum>=v){
    //         sum=0;
    //         k--;
    //     }
    //     int z = m-k;
    //     int e = (*(lower_bound(all(r),z)));
    //     cout<<e<<endl;
    //     if(i<e) ans = max(ans,b[e]-b[i-1]);
    // }

    cout<<ans<<endl;

}

signed main() {

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif

    int t=1;
    cin>>t;

    while(t--){
        solve();
    }
    // return 0;

}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
3
5 2 10
10 5 10 5 10
5 2 15
10 5 10 5 10
5 2 20
10 5 10 5 10
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Alice's Adventures in Cutting Cake
time_limit_ms: 2000
memory_limit_mb: 256
Description: Alice is at the Mad Hatter's tea party! There is a long sheet cake made up of $n$ sections with tastiness values $a_1, a_2, \ldots, a_n$. There are $m$ creatures at the tea party, excluding Alice.

Alice will cut the cake into $m + 1$ pieces. Formally, she will partition the cake into $m + 1$ subarrays, where each subarray consists of some number of adjacent sections. The tastiness of a piece is the sum of tastiness of its sections. Afterwards, she will divvy these $m + 1$ pieces up among the $m$ creatures and herself (her piece can be empty). However, each of the $m$ creatures will only be happy when the tastiness of its piece is $v$ or more.

Alice wants to make sure every creature is happy. Limited by this condition, she also wants to maximize the tastiness of her own piece. Can you help Alice find the maximum tastiness her piece can have? If there is no way to make sure every creature is happy, output $-1$.

Input: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

The first line of each test case contains three integers $n, m, v$ ($1\le m\le n\le 2\cdot 10^5$; $1\le v\le 10^9$) — the number of sections, the number of creatures, and the creatures' minimum requirement for tastiness, respectively.

The next line contains $n$ space separated integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^9$) — the tastinesses of the sections.

The sum of $n$ over all test cases does not exceed $2\cdot 10^5$.

Output: For each test case, output the maximum tastiness Alice can achieve for her piece, or $-1$ if there is no way to make sure every creature is happy.

Examples:
input:
7
6 2 1
1 1 10 1 1 10
6 2 2
1 1 10 1 1 10
6 2 3
1 1 10 1 1 10
6 2 10
1 1 10 1 1 10
6 2 11
1 1 10 1 1 10
6 2 12
1 1 10 1 1 10
6 2 12
1 1 1 1 10 10
output:
22
12
2
2
2
0
-1

Note: For the first test case, Alice can give the first and second section as their own pieces, and then take the remaining $10 + 1 + 1 + 10 = 22$ tastiness for herself. We can show that she cannot do any better.

For the second test case, Alice could give the first and second section as one piece, and the sixth section as one piece. She can then take the remaining $10 + 1 + 1 = 12$ tastiness for herself. We can show that she cannot do any better.

For the seventh test case, Alice cannot give each creature a piece of at least $12$ tastiness.

Buggy Code:
def index(sorted_array,n, target):
    left, right = 0, n - 1
    if sorted_array[right]<target:
        return len(sorted_array)

    ans = len(sorted_array)

    while left <= right:
        mid = (left + right) // 2

        if sorted_array[mid] == target:
            ans = mid  # Target found
            right = mid-1

        elif sorted_array[mid] < target:
            left = mid + 1  # Search in the right half
        else:
            right = mid - 1  # Search in the left half

    return ans

def ss(a,m,v):
    n = len(a)
    lst = [a[0]]
    for i in range(1,n):
        lst.append(lst[-1]+a[i])

    l = [0]
    x = 0
    for i in range(n):
        if x+a[i]>=v:
            l.append(l[-1]+1)
            x = 0
        else:
            x+=a[i]
            l.append(l[-1])
    r = [0]
    x = 0
    for i in range(n-1,-1,-1):
        if x+a[i]>=v:
            r.append(r[-1]+1)
            x = 0
        else:
            x+=a[i]
            r.append(r[-1])
    r = r[::-1]

    l.pop(0)
    lst.append(0)

    ans = -1
    for i in range(n,-1,-1):
        people = m-r[i]
        if people<=0:
            ans = max(ans, lst[i-1])

            continue
        ind = index(l,i-1,people)

        if ind==len(l):
            pass
        else:
            ans = max(lst[i-1]-lst[ind], ans)

    return ans

for _ in range(int(input())):
    n,m,v = map(int,input().split())
    a = list(map(int,input().split()))
    ans = ss(a,m,v)
    print(ans)

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
1
5 2 15
10 10 10 10 10
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Alice's Adventures in Cutting Cake
time_limit_ms: 2000
memory_limit_mb: 256
Description: Alice is at the Mad Hatter's tea party! There is a long sheet cake made up of $n$ sections with tastiness values $a_1, a_2, \ldots, a_n$. There are $m$ creatures at the tea party, excluding Alice.

Alice will cut the cake into $m + 1$ pieces. Formally, she will partition the cake into $m + 1$ subarrays, where each subarray consists of some number of adjacent sections. The tastiness of a piece is the sum of tastiness of its sections. Afterwards, she will divvy these $m + 1$ pieces up among the $m$ creatures and herself (her piece can be empty). However, each of the $m$ creatures will only be happy when the tastiness of its piece is $v$ or more.

Alice wants to make sure every creature is happy. Limited by this condition, she also wants to maximize the tastiness of her own piece. Can you help Alice find the maximum tastiness her piece can have? If there is no way to make sure every creature is happy, output $-1$.

Input: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

The first line of each test case contains three integers $n, m, v$ ($1\le m\le n\le 2\cdot 10^5$; $1\le v\le 10^9$) — the number of sections, the number of creatures, and the creatures' minimum requirement for tastiness, respectively.

The next line contains $n$ space separated integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^9$) — the tastinesses of the sections.

The sum of $n$ over all test cases does not exceed $2\cdot 10^5$.

Output: For each test case, output the maximum tastiness Alice can achieve for her piece, or $-1$ if there is no way to make sure every creature is happy.

Examples:
input:
7
6 2 1
1 1 10 1 1 10
6 2 2
1 1 10 1 1 10
6 2 3
1 1 10 1 1 10
6 2 10
1 1 10 1 1 10
6 2 11
1 1 10 1 1 10
6 2 12
1 1 10 1 1 10
6 2 12
1 1 1 1 10 10
output:
22
12
2
2
2
0
-1

Note: For the first test case, Alice can give the first and second section as their own pieces, and then take the remaining $10 + 1 + 1 + 10 = 22$ tastiness for herself. We can show that she cannot do any better.

For the second test case, Alice could give the first and second section as one piece, and the sixth section as one piece. She can then take the remaining $10 + 1 + 1 = 12$ tastiness for herself. We can show that she cannot do any better.

For the seventh test case, Alice cannot give each creature a piece of at least $12$ tastiness.

Buggy Code:
def func(n, m, v, a):
    total_sum=sum(a)
    if total_sum<m*v:
        return -1
    left=0
    current_sum=0
    cuts=0
    final=[]
    for right in range(n):
        current_sum += a[right]
        temp=[]
        if current_sum>=v:
            cuts+=1
            while left<right and current_sum-a[left]>=v:
                temp.append(a[left])
                left+=1
            current_sum = 0
            left = right + 1
            final.append(temp)
            if cuts == m:
                final.append(a[left:])
                break
    if cuts!=m:
        return -1
    return final
def func2(l1):
    a=0
    for i in l1:
        a=max(a,sum(i))
    return a

tc=int(input())
for i in range(tc):
    n,m,v=map(int,input().split())
    l1=list(map(int,input().split()))
    aa=func(n, m, v,l1)
    if aa==-1:
        print(-1)
    else:
        print(func2(aa))

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
3
5 2 15
10 5 10 5 10
5 2 16
10 5 10 5 10
5 2 20
10 5 10 5 10
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Alice's Adventures in Cutting Cake
time_limit_ms: 2000
memory_limit_mb: 256
Description: Alice is at the Mad Hatter's tea party! There is a long sheet cake made up of $n$ sections with tastiness values $a_1, a_2, \ldots, a_n$. There are $m$ creatures at the tea party, excluding Alice.

Alice will cut the cake into $m + 1$ pieces. Formally, she will partition the cake into $m + 1$ subarrays, where each subarray consists of some number of adjacent sections. The tastiness of a piece is the sum of tastiness of its sections. Afterwards, she will divvy these $m + 1$ pieces up among the $m$ creatures and herself (her piece can be empty). However, each of the $m$ creatures will only be happy when the tastiness of its piece is $v$ or more.

Alice wants to make sure every creature is happy. Limited by this condition, she also wants to maximize the tastiness of her own piece. Can you help Alice find the maximum tastiness her piece can have? If there is no way to make sure every creature is happy, output $-1$.

Input: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

The first line of each test case contains three integers $n, m, v$ ($1\le m\le n\le 2\cdot 10^5$; $1\le v\le 10^9$) — the number of sections, the number of creatures, and the creatures' minimum requirement for tastiness, respectively.

The next line contains $n$ space separated integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^9$) — the tastinesses of the sections.

The sum of $n$ over all test cases does not exceed $2\cdot 10^5$.

Output: For each test case, output the maximum tastiness Alice can achieve for her piece, or $-1$ if there is no way to make sure every creature is happy.

Examples:
input:
7
6 2 1
1 1 10 1 1 10
6 2 2
1 1 10 1 1 10
6 2 3
1 1 10 1 1 10
6 2 10
1 1 10 1 1 10
6 2 11
1 1 10 1 1 10
6 2 12
1 1 10 1 1 10
6 2 12
1 1 1 1 10 10
output:
22
12
2
2
2
0
-1

Note: For the first test case, Alice can give the first and second section as their own pieces, and then take the remaining $10 + 1 + 1 + 10 = 22$ tastiness for herself. We can show that she cannot do any better.

For the second test case, Alice could give the first and second section as one piece, and the sixth section as one piece. She can then take the remaining $10 + 1 + 1 = 12$ tastiness for herself. We can show that she cannot do any better.

For the seventh test case, Alice cannot give each creature a piece of at least $12$ tastiness.

Buggy Code:
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class C {
  static int HAS_TESTCASES = 1;
  static String INPUT = "1";
  void solve(int t) {
    int n = ni();
    int m = ni();
    int v = ni();
    long[] a = nla(n);

    if (t > 10 && t != 197) {
      return;
    }

    if (t == 197) {
      System.out.printf("t = %d \n", t);
      System.out.printf("n = %d \n", n);
      System.out.printf("m = %d \n", m);
      System.out.printf("v = %d \n", v);
      for (int i = 0; i < n; i++) {
        System.out.printf("%d ", a[i]);
      }
      System.out.println();
      return;
    }

    long[] prefix = new long[n];
    prefix[0]=a[0];
    for (int i = 1; i<n; i++) {
      prefix[i]+=prefix[i-1]+a[i];
    }
    int[] left = new int[m];
    int[] right = new int[m];
    int indl = 0;
    int indr = 0;
    long sum = 0;
    for (int i = 0; i<n; i++) {
      sum+=a[i];
      if (sum>=v) {
        left[indl++]=i;
        sum=0;
      }
      if (indl==m) {
        break;
      }
    }
    if (indl<m) {
      out.println(-1);
      return;
    }
    sum=0;
    for (int i = n-1; i>=0; i--) {
      sum+=a[i];
      if (sum>=v) {
        right[indr++]=i;
        sum=0;
      }
      if (indr==m) {
        break;
      }
    }
    long ans = 0;
    if (left[m-1]<n-1) {
      ans=prefix[n-1]-prefix[left[m-1]];
    }
    if (right[m-1]>0) {
      ans=Math.max(ans, prefix[right[m-1]-1]);
    }
    for (int i = 0; i<=m-1; i++) {
      int l_ind = left[i];
      int r_ind = right[m-1-i];
      if (r_ind<=l_ind)
        continue;
      long ans2 = prefix[r_ind-1]-prefix[l_ind];
      ans=Math.max(ans, ans2);
    }
    out.println(ans);
  }
  static int ni() {
    return Integer.parseInt(ns());
  }
  static long nl() {
    return Long.parseLong(ns());
  }
  static long[] nla(int n) {
    long[] a = new long[n];
    for (int i = 0; i<n; i++) {
      a[i]=nl();
    }
    return a;
  }
  static String ns() {
    t();
    return st.nextToken();
  }
  static void t() {
    while (!st.hasMoreTokens()) {
      try {
        st=new StringTokenizer(br.readLine());
      } catch (Exception e) {
        throw new RuntimeException("out of tokens!");
      }
    }
  }
  static BufferedReader br;
  static StringTokenizer st = new StringTokenizer("");
  static PrintWriter out = new PrintWriter(System.out);
  public static void main(String[] a) {
    if (System.getProperty("ONLINE_JUDGE")==null) {
      System.setIn(new ByteArrayInputStream(INPUT.getBytes()));
    }
    br=new BufferedReader(new InputStreamReader(System.in));
    int t = HAS_TESTCASES>0 ? ni() : 1;
    for (int i = 1; i<=t; i++) {
      new C().solve(i);
    }
    out.flush();
  }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To generate a challenging test input that exposes the bug in the provided buggy code, we need to focus on edge cases and scenarios that can maximize the failure probability. Here are the steps to consider:

1. **Edge Cases for Minimum Requirements**:
   - Test cases where the minimum tastiness requirement `v` is very high, making it impossible to satisfy the creatures' requirements.
   - Test cases where the minimum tastiness requirement `v` is very low, making it easy to satisfy but challenging to maximize Alice's piece.

2. **Distribution of Tastiness**:
   - Test cases with a uniform distribution of tastiness values.
   - Test cases with a few very high tastiness values and many low tastiness values.

3. **Special Cases**:
   - Test cases where the number of sections `n` is equal to the number of creatures `m`.
   - Test cases where the number of sections `n` is just slightly greater than the number of creatures `m`.

4. **Boundary Conditions**:
   - Test cases with the minimum and maximum possible values for `n`, `m`, and `v`.

Based on these considerations, here is a small-scale test input that should expose the bug in the buggy code:

```plaintext
5
6 2 10
1 1 10 1 1 10
6 2 11
1 1 10 1 1 10
6 2 12
1 1 10 1 1 10
6 3 5
1 2 3 4 5 6
10 4 15
1 2 3 4 5 6 7 8 9 10
```

### Explanation of Test Cases:

1. **Test Case 1**:
   - `n = 6`, `m = 2`, `v = 10`
   - `a = [1, 1, 10, 1, 1, 10]`
   - Alice can give the first and second sections as one piece and the sixth section as another piece. The remaining sections (10, 1, 1, 10) sum to 22, which Alice can take.

2. **Test Case 2**:
   - `n = 6`, `m = 2`, `v = 11`
   - `a = [1, 1, 10, 1, 1, 10]`
   - It is impossible to satisfy the creatures' requirements as no two subarrays can sum to 11 or more.

3. **Test Case 3**:
   - `n = 6`, `m = 2`, `v = 12`
   - `a = [1, 1, 10, 1, 1, 10]`
   - It is impossible to satisfy the creatures' requirements as no two subarrays can sum to 12 or more.

4. **Test Case 4**:
   - `n = 6`, `m = 3`, `v = 5`
   - `a = [1, 2, 3, 4, 5, 6]`
   - Alice can give the first three sections as one piece (sum = 6), the next two sections as another piece (sum = 7), and the last section as the third piece (sum = 6). The remaining section (5) can be taken by Alice.

5. **Test Case 5**:
   - `n = 10`, `m = 4`, `v = 15`
   - `a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]`
   - Alice can give the first five sections as one piece (sum = 15), the next three sections as another piece (sum = 18), the next section as the third piece (sum = 9), and the last section as the fourth piece (sum = 10). The remaining sections (6, 7, 8) sum to 21, which Alice can take.

This test input should help in identifying the issues in the provided buggy code.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Alice's Adventures in Cutting Cake
time_limit_ms: 2000
memory_limit_mb: 256
Description: Alice is at the Mad Hatter's tea party! There is a long sheet cake made up of $n$ sections with tastiness values $a_1, a_2, \ldots, a_n$. There are $m$ creatures at the tea party, excluding Alice.

Alice will cut the cake into $m + 1$ pieces. Formally, she will partition the cake into $m + 1$ subarrays, where each subarray consists of some number of adjacent sections. The tastiness of a piece is the sum of tastiness of its sections. Afterwards, she will divvy these $m + 1$ pieces up among the $m$ creatures and herself (her piece can be empty). However, each of the $m$ creatures will only be happy when the tastiness of its piece is $v$ or more.

Alice wants to make sure every creature is happy. Limited by this condition, she also wants to maximize the tastiness of her own piece. Can you help Alice find the maximum tastiness her piece can have? If there is no way to make sure every creature is happy, output $-1$.

Input: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

The first line of each test case contains three integers $n, m, v$ ($1\le m\le n\le 2\cdot 10^5$; $1\le v\le 10^9$) — the number of sections, the number of creatures, and the creatures' minimum requirement for tastiness, respectively.

The next line contains $n$ space separated integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^9$) — the tastinesses of the sections.

The sum of $n$ over all test cases does not exceed $2\cdot 10^5$.

Output: For each test case, output the maximum tastiness Alice can achieve for her piece, or $-1$ if there is no way to make sure every creature is happy.

Examples:
input:
7
6 2 1
1 1 10 1 1 10
6 2 2
1 1 10 1 1 10
6 2 3
1 1 10 1 1 10
6 2 10
1 1 10 1 1 10
6 2 11
1 1 10 1 1 10
6 2 12
1 1 10 1 1 10
6 2 12
1 1 1 1 10 10
output:
22
12
2
2
2
0
-1

Note: For the first test case, Alice can give the first and second section as their own pieces, and then take the remaining $10 + 1 + 1 + 10 = 22$ tastiness for herself. We can show that she cannot do any better.

For the second test case, Alice could give the first and second section as one piece, and the sixth section as one piece. She can then take the remaining $10 + 1 + 1 = 12$ tastiness for herself. We can show that she cannot do any better.

For the seventh test case, Alice cannot give each creature a piece of at least $12$ tastiness.

Buggy Code:
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class C {
  static int HAS_TESTCASES = 1;
  static String INPUT = "1";
  void solve() {
    int n = ni();
    int m = ni();
    int v = ni();
    long[] a = nla(n);
    long[] prefix = new long[n];
    prefix[0]=a[0];
    for (int i = 1; i<n; i++) {
      prefix[i]+=prefix[i-1]+a[i];
    }
    int[] left = new int[m];
    int[] right = new int[m];
    int indl = 0;
    long sum = 0;
    for (int i = 0; i<n; i++) {
      sum+=a[i];
      if (sum>=v) {
        left[indl++]=i;
        sum=0;
      }
      if (indl==m) {
        break;
      }
    }
    if (indl<m) {
      out.println(-1);
      return;
    }
    int indr = m-1;
    sum=0;
    for (int i = n-1; i>=0; i--) {
      sum+=a[i];
      if (sum>=v) {
        right[indr--]=i;
        sum=0;
      }
      if (indr==-1) {
        break;
      }
    }
    long ans = 0;
    if (left[m-1]<n-1) {
      ans=prefix[n-1]-prefix[left[m-1]];
    }
    if (right[0]>0) {
      ans=Math.max(ans, prefix[right[0]-1]);
    }
    for (int i = 0; i<m-2; i++) {
      int l_ind = left[i];
      int r_ind = right[m-i-2];
      if (r_ind<=l_ind)
        continue;
      long ans2 = prefix[r_ind-1]-prefix[l_ind];
      ans=Math.max(ans, ans2);
    }
    out.println(ans);
  }
  static int ni() {
    return Integer.parseInt(ns());
  }
  static long nl() {
    return Long.parseLong(ns());
  }
  static long[] nla(int n) {
    long[] a = new long[n];
    for (int i = 0; i<n; i++) {
      a[i]=nl();
    }
    return a;
  }
  static String ns() {
    t();
    return st.nextToken();
  }
  static void t() {
    while (!st.hasMoreTokens()) {
      try {
        st=new StringTokenizer(br.readLine());
      } catch (Exception e) {
        throw new RuntimeException("out of tokens!");
      }
    }
  }
  static BufferedReader br;
  static StringTokenizer st = new StringTokenizer("");
  static PrintWriter out = new PrintWriter(System.out);
  public static void main(String[] a) {
    if (System.getProperty("ONLINE_JUDGE")==null) {
      System.setIn(new ByteArrayInputStream(INPUT.getBytes()));
    }
    br=new BufferedReader(new InputStreamReader(System.in));
    int t = HAS_TESTCASES>0 ? ni() : 1;
    for (int i = 1; i<=t; i++) {
      new C().solve();
    }
    out.flush();
  }
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
To generate a challenging test input that exposes the bug in the provided buggy code, we need to focus on edge cases and scenarios that are likely to cause issues. Here are the steps to think through the problem:

1. **Check the Prefix Sum Calculation:**
   - Ensure the prefix sum array is correctly calculated. This is crucial for the subsequent steps.

2. **Check the Left and Right Boundaries:**
   - The left and right boundaries should correctly identify the segments that meet the minimum tastiness requirement `v`.

3. **Check the Overlap and Gap Conditions:**
   - Ensure that the segments do not overlap and that there are no gaps that would cause the algorithm to fail.

4. **Edge Cases:**
   - Test with small values of `n` and `m` to ensure the algorithm handles them correctly.
   - Test with large values of `v` to ensure the algorithm can handle cases where it's impossible to satisfy the creatures.
   - Test with uniform and non-uniform tastiness values to ensure the algorithm can handle different distributions.

Based on these considerations, here is a small-scale test input that is complete and valid:

```plaintext
5
5 2 10
10 10 10 10 10
5 2 11
10 10 10 10 10
5 2 15
10 10 10 10 10
5 2 20
10 10 10 10 10
5 2 21
10 10 10 10 10
```

This test input includes:
- A case where each segment meets the minimum requirement exactly.
- A case where the minimum requirement is slightly higher than the segment values.
- A case where the minimum requirement is significantly higher than the segment values.
- A case where it is impossible to satisfy the creatures.

These scenarios should help expose any bugs in the algorithm, particularly in the boundary conditions and the handling of overlapping and gap conditions.


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Alice's Adventures in Cutting Cake
time_limit_ms: 2000
memory_limit_mb: 256
Description: Alice is at the Mad Hatter's tea party! There is a long sheet cake made up of $n$ sections with tastiness values $a_1, a_2, \ldots, a_n$. There are $m$ creatures at the tea party, excluding Alice.

Alice will cut the cake into $m + 1$ pieces. Formally, she will partition the cake into $m + 1$ subarrays, where each subarray consists of some number of adjacent sections. The tastiness of a piece is the sum of tastiness of its sections. Afterwards, she will divvy these $m + 1$ pieces up among the $m$ creatures and herself (her piece can be empty). However, each of the $m$ creatures will only be happy when the tastiness of its piece is $v$ or more.

Alice wants to make sure every creature is happy. Limited by this condition, she also wants to maximize the tastiness of her own piece. Can you help Alice find the maximum tastiness her piece can have? If there is no way to make sure every creature is happy, output $-1$.

Input: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

The first line of each test case contains three integers $n, m, v$ ($1\le m\le n\le 2\cdot 10^5$; $1\le v\le 10^9$) — the number of sections, the number of creatures, and the creatures' minimum requirement for tastiness, respectively.

The next line contains $n$ space separated integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^9$) — the tastinesses of the sections.

The sum of $n$ over all test cases does not exceed $2\cdot 10^5$.

Output: For each test case, output the maximum tastiness Alice can achieve for her piece, or $-1$ if there is no way to make sure every creature is happy.

Examples:
input:
7
6 2 1
1 1 10 1 1 10
6 2 2
1 1 10 1 1 10
6 2 3
1 1 10 1 1 10
6 2 10
1 1 10 1 1 10
6 2 11
1 1 10 1 1 10
6 2 12
1 1 10 1 1 10
6 2 12
1 1 1 1 10 10
output:
22
12
2
2
2
0
-1

Note: For the first test case, Alice can give the first and second section as their own pieces, and then take the remaining $10 + 1 + 1 + 10 = 22$ tastiness for herself. We can show that she cannot do any better.

For the second test case, Alice could give the first and second section as one piece, and the sixth section as one piece. She can then take the remaining $10 + 1 + 1 = 12$ tastiness for herself. We can show that she cannot do any better.

For the seventh test case, Alice cannot give each creature a piece of at least $12$ tastiness.

Buggy Code:
from bisect import bisect_right
import sys
input = sys.stdin.readline

for _ in range(int(input())):
    n,m,v = map(int,input().split())
    l = list(map(int,input().split()))
    o,p,s = [],[],[]
    som,prev = 0,0
    c = 0
    for i in l:
        prev += i
        som += i
        o.append(prev)
        if som >= v:
            som = 0
            c += 1

        p.append(c)

    if p[-1] < m:
        print(-1)
        continue

    i = n-1
    prev,c = 0,0
    while i > -1:
        x = l[i]
        som += x
        if som >= v:
            som = 0
            c += 1

        s.append(c)
        i -= 1

    s = s[::-1]
    # print(o,p,s)
    low, high = 0,o[-1]
    ans = 0
    while low <= high:
        mid = (low+high)//2
        flag = 0
        for i in range(n):
            x = o[i]
            cnt = 0
            psom = 0
            if i-1 > -1:
                cnt = p[i-1]
                psom = o[i-1]

            ind = bisect_right(o, x + mid, i, n)
            gind = ind-1
            if ind < n:
                if ind == i and ind+1 < n:
                    cnt += s[ind+1]

                else:
                    cnt += s[ind]

            if cnt >= m and o[gind]-psom >= mid:
                # if mid == 24:
                #     print(ind,cnt,i)
                flag = 1
                break

        if flag:
            ans = mid
            low = mid+1

        else:
            high = mid-1

    sys.stdout.write(str(ans)+'\n')

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
3
5 2 15
10 5 10 5 10
5 2 20
10 5 10 5 10
5 3 15
10 5 10 5 10
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Alice's Adventures in Cutting Cake
time_limit_ms: 2000
memory_limit_mb: 256
Description: Alice is at the Mad Hatter's tea party! There is a long sheet cake made up of $n$ sections with tastiness values $a_1, a_2, \ldots, a_n$. There are $m$ creatures at the tea party, excluding Alice.

Alice will cut the cake into $m + 1$ pieces. Formally, she will partition the cake into $m + 1$ subarrays, where each subarray consists of some number of adjacent sections. The tastiness of a piece is the sum of tastiness of its sections. Afterwards, she will divvy these $m + 1$ pieces up among the $m$ creatures and herself (her piece can be empty). However, each of the $m$ creatures will only be happy when the tastiness of its piece is $v$ or more.

Alice wants to make sure every creature is happy. Limited by this condition, she also wants to maximize the tastiness of her own piece. Can you help Alice find the maximum tastiness her piece can have? If there is no way to make sure every creature is happy, output $-1$.

Input: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

The first line of each test case contains three integers $n, m, v$ ($1\le m\le n\le 2\cdot 10^5$; $1\le v\le 10^9$) — the number of sections, the number of creatures, and the creatures' minimum requirement for tastiness, respectively.

The next line contains $n$ space separated integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^9$) — the tastinesses of the sections.

The sum of $n$ over all test cases does not exceed $2\cdot 10^5$.

Output: For each test case, output the maximum tastiness Alice can achieve for her piece, or $-1$ if there is no way to make sure every creature is happy.

Examples:
input:
7
6 2 1
1 1 10 1 1 10
6 2 2
1 1 10 1 1 10
6 2 3
1 1 10 1 1 10
6 2 10
1 1 10 1 1 10
6 2 11
1 1 10 1 1 10
6 2 12
1 1 10 1 1 10
6 2 12
1 1 1 1 10 10
output:
22
12
2
2
2
0
-1

Note: For the first test case, Alice can give the first and second section as their own pieces, and then take the remaining $10 + 1 + 1 + 10 = 22$ tastiness for herself. We can show that she cannot do any better.

For the second test case, Alice could give the first and second section as one piece, and the sixth section as one piece. She can then take the remaining $10 + 1 + 1 = 12$ tastiness for herself. We can show that she cannot do any better.

For the seventh test case, Alice cannot give each creature a piece of at least $12$ tastiness.

Buggy Code:
t = int(input())
for _ in range(t):
    n, m, v = map(int, input().split())
    a = list(map(int, input().split()))
    total = sum(a)
    sum_left = 0
    count_left = 0
    last_left = -1
    for i in range(n):
        sum_left += a[i]
        if sum_left >= v:
            count_left += 1
            sum_left = 0
            last_left = i + 1
            if count_left == m:
                break
    if count_left == m:
        alice_left = sum(a[last_left:])
    else:
        alice_left = -1
    sum_right = 0
    count_right = 0
    last_right = n
    for i in range(n-1, -1, -1):
        sum_right += a[i]
        if sum_right >= v:
            count_right += 1
            sum_right = 0
            last_right = i
            if count_right == m:
                break
    if count_right == m:
        alice_right = sum(a[:last_right])
    else:
        alice_right = -1
    result = max(alice_left, alice_right)
    print(result)

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
3
4 2 5
1 4 4 1
5 2 10
1 9 1 9 1
6 3 15
10 10 10 10 10 10
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Alice's Adventures in Cutting Cake
time_limit_ms: 2000
memory_limit_mb: 256
Description: Alice is at the Mad Hatter's tea party! There is a long sheet cake made up of $n$ sections with tastiness values $a_1, a_2, \ldots, a_n$. There are $m$ creatures at the tea party, excluding Alice.

Alice will cut the cake into $m + 1$ pieces. Formally, she will partition the cake into $m + 1$ subarrays, where each subarray consists of some number of adjacent sections. The tastiness of a piece is the sum of tastiness of its sections. Afterwards, she will divvy these $m + 1$ pieces up among the $m$ creatures and herself (her piece can be empty). However, each of the $m$ creatures will only be happy when the tastiness of its piece is $v$ or more.

Alice wants to make sure every creature is happy. Limited by this condition, she also wants to maximize the tastiness of her own piece. Can you help Alice find the maximum tastiness her piece can have? If there is no way to make sure every creature is happy, output $-1$.

Input: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

The first line of each test case contains three integers $n, m, v$ ($1\le m\le n\le 2\cdot 10^5$; $1\le v\le 10^9$) — the number of sections, the number of creatures, and the creatures' minimum requirement for tastiness, respectively.

The next line contains $n$ space separated integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^9$) — the tastinesses of the sections.

The sum of $n$ over all test cases does not exceed $2\cdot 10^5$.

Output: For each test case, output the maximum tastiness Alice can achieve for her piece, or $-1$ if there is no way to make sure every creature is happy.

Examples:
input:
7
6 2 1
1 1 10 1 1 10
6 2 2
1 1 10 1 1 10
6 2 3
1 1 10 1 1 10
6 2 10
1 1 10 1 1 10
6 2 11
1 1 10 1 1 10
6 2 12
1 1 10 1 1 10
6 2 12
1 1 1 1 10 10
output:
22
12
2
2
2
0
-1

Note: For the first test case, Alice can give the first and second section as their own pieces, and then take the remaining $10 + 1 + 1 + 10 = 22$ tastiness for herself. We can show that she cannot do any better.

For the second test case, Alice could give the first and second section as one piece, and the sixth section as one piece. She can then take the remaining $10 + 1 + 1 = 12$ tastiness for herself. We can show that she cannot do any better.

For the seventh test case, Alice cannot give each creature a piece of at least $12$ tastiness.

Buggy Code:
#include <bits/stdc++.h>
using namespace std;
// #define int long long
#define ll long long
#define endl '\n'
#define all(a) a.begin(), a.end()
#define pb push_back
#define x first
#define y second
#define debug(_x) cout << #_x << '=' << _x << endl
typedef pair<char, int> PII;
using i64 = long long;
const int mod = 1e9 + 7;
const int N = 2e5 + 10, inf = 1e9;

int sum[N], a[N];

void solve()
{
    int n, m, v;
    cin >> n >> m >> v;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        sum[i] = sum[i - 1] + a[i];
    }
    vector<int> pre, suf;
    pre.pb(0), suf.pb(n + 1);
    int s = 0;
    for (int i = 1; i <= n; i++)
    {
        s += a[i];
        if (s >= v)
            s = 0, pre.pb(i);
    }
    s = 0;
    for (int i = n; i >= 1; i--)
    {
        s += a[i];
        if (s >= v)
            s = 0, suf.pb(i);
    }
    if (pre.size() < m + 1)
    {
        cout << -1 << endl;
        return;
    }
    int ans = 0;
    for (int i = 0; i <= m; i++)
    {
        ans = max(ans, sum[suf[m - i] - 1] - sum[pre[i]]);
    }
    cout << ans << endl;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int _ = 1;
    cin >> _;
    while (_--)
        solve();

    return 0;
}

**Instructions:**
- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.
- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.
- Output the test input directly, not code to generate it.

**Output format:**
```plaintext
{test input}
```

Think step by step.

Response:
```plaintext
3
10 3 15
5 5 5 5 5 5 5 5 5 5
10 3 16
5 5 5 5 5 5 5 5 5 5
10 3 10
10 10 10 10 10 10 10 10 10 10
```