**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Elections
time_limit_ms: 2000
memory_limit_mb: 256
Description: Elections are taking place in Berland. There are $n$ candidates participating in the elections, numbered from $1$ to $n$. The $i$-th candidate has $a_i$ fans who will vote for him. Additionally, there are $c$ people who are undecided about their favorite candidate, let's call them undecided. Undecided people will vote for the candidate with the lowest number.

The candidate who receives the maximum number of votes wins the elections, and if multiple candidates receive the same maximum number of votes, the candidate with the lowest number among them wins.

You found these elections too boring and predictable, so you decided to exclude some candidates from them. If you do not allow candidate number $i$ to participate in the elections, all $a_i$ of his fans will become undecided, and will vote for the candidate with the lowest number.

You are curious to find, for each $i$ from $1$ to $n$, the minimum number of candidates that need to be excluded from the elections for candidate number $i$ to win the elections.

Input: Each test consists of multiple test cases. The first line contains a single integer $t$ ($1 \leq t \leq 2 \cdot 10^4$) — the number of test cases. The description of the test cases follows.

The first line of each test case contains two integers $n$ and $c$ ($1 \le n \le 2 \cdot 10^5$, $0 \le c \le 10^9$) — the number of candidates in the elections and the number of undecided people.

The second line of each test case contains $n$ integers $a_1, a_2, \ldots, a_n$ ($0 \le a_i \le 10^9$) — the number of fans for each candidate.

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

Output: For each test case, output $n$ integers, the $i$-th of which should be equal to the minimum number of candidates that need to be excluded from the elections for candidate number $i$ to win.

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

Note: In the first test case:

  * If all candidates are allowed, candidate number $1$ will receive $3$ votes ($1$ undecided person will vote for him), candidate number $2$ will receive $0$ votes, and candidate number $3$ will receive $3$ votes. Therefore, candidate number $1$ wins (he received the same number of votes as candidate $3$, but his number is lower), so the answer for him is $0$.   * If candidate number $1$ is not allowed, his $2$ fans will become undecided. Then candidate number $2$ will receive $3$ votes ($3$ undecided people will vote for him) and candidate number $3$ will receive $3$ votes. Therefore, candidate number $2$ wins (he received the same number of votes as candidate $3$, but his number is lower), so the answer for him is $1$.   * If candidates with numbers $1$ and $2$ are not allowed, candidate number $3$ wins, so the answer for him is $2$.

In the second test case, candidate number $1$ will win if candidate number $2$ is not allowed to participate.

Buggy Code:
#include <bits/stdc++.h>
using namespace std;
#define Paddi ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
const int N = 5e5 + 10;
const int LOG = 20;
int s[N];
int pre[N];
int mapre[N];
int masuf[N];
int n, c;
void init()
{
    for (int i = 0; i <= n + 5; i++)
        s[i] = 0, pre[i] = 0, mapre[i] = 0, masuf[i] = 0;
}
signed main()
{
    // Paddi;
    int T;
    cin >> T;
    while (T--)
    {
        cin >> n >> c;
        init();
        for (int i = 1; i <= n; i++)
            cin >> s[i];
        for (int i = 1; i <= n; i++)
            pre[i] = pre[i - 1] + s[i];
        for (int i = 1; i <= n; i++)
            mapre[i] = max(mapre[i - 1], s[i]);
        for (int i = n; i >= 1; i--)
            masuf[i] = max(masuf[i + 1], s[i]);
        vector<int> ans(n + 10);
        for (int i = 1; i <= n; i++)
        {
            int pre_max = mapre[i - 1];
            int suf_max = masuf[i + 1];
            int pre_sum = pre[i - 1];
            if (i == 1)
            {
                if (c + s[1] >= suf_max)
                    ans[1] = 0;
                else
                    ans[1] = 1;
            }
            else
            {
                if (pre_max < s[i])
                {
                    pre_max = max(pre_max, s[1] + c);
                    if (pre_max < s[i])
                    {
                        if (suf_max <= s[i])
                            ans[i] = 0;
                        else
                        {
                            int t = pre_sum + c + s[i];
                            if (t >= suf_max)
                                ans[i] = i - 1;
                            else
                                ans[i] = i;
                        }
                    }
                    else
                    {
                        int t = pre_sum + c + s[i];
                        if (t >= suf_max)
                            ans[i] = i - 1;
                        else
                            ans[i] = i;
                    }
                }
                else
                {
                    int t = pre_sum + c + s[i];
                    if (t >= suf_max)
                        ans[i] = i - 1;
                    else
                        ans[i] = i;
                }
            }
        }
        for (int i = 1; i <= n; i++)
            cout << ans[i] << " ";
        cout << endl;
    }
    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
5
3 0
1 1 1
2 0
0 1
5 0
1 1 1 1 1
4 0
1 1 1 1
6 0
1 1 1 1 1 1
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Elections
time_limit_ms: 2000
memory_limit_mb: 256
Description: Elections are taking place in Berland. There are $n$ candidates participating in the elections, numbered from $1$ to $n$. The $i$-th candidate has $a_i$ fans who will vote for him. Additionally, there are $c$ people who are undecided about their favorite candidate, let's call them undecided. Undecided people will vote for the candidate with the lowest number.

The candidate who receives the maximum number of votes wins the elections, and if multiple candidates receive the same maximum number of votes, the candidate with the lowest number among them wins.

You found these elections too boring and predictable, so you decided to exclude some candidates from them. If you do not allow candidate number $i$ to participate in the elections, all $a_i$ of his fans will become undecided, and will vote for the candidate with the lowest number.

You are curious to find, for each $i$ from $1$ to $n$, the minimum number of candidates that need to be excluded from the elections for candidate number $i$ to win the elections.

Input: Each test consists of multiple test cases. The first line contains a single integer $t$ ($1 \leq t \leq 2 \cdot 10^4$) — the number of test cases. The description of the test cases follows.

The first line of each test case contains two integers $n$ and $c$ ($1 \le n \le 2 \cdot 10^5$, $0 \le c \le 10^9$) — the number of candidates in the elections and the number of undecided people.

The second line of each test case contains $n$ integers $a_1, a_2, \ldots, a_n$ ($0 \le a_i \le 10^9$) — the number of fans for each candidate.

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

Output: For each test case, output $n$ integers, the $i$-th of which should be equal to the minimum number of candidates that need to be excluded from the elections for candidate number $i$ to win.

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

Note: In the first test case:

  * If all candidates are allowed, candidate number $1$ will receive $3$ votes ($1$ undecided person will vote for him), candidate number $2$ will receive $0$ votes, and candidate number $3$ will receive $3$ votes. Therefore, candidate number $1$ wins (he received the same number of votes as candidate $3$, but his number is lower), so the answer for him is $0$.   * If candidate number $1$ is not allowed, his $2$ fans will become undecided. Then candidate number $2$ will receive $3$ votes ($3$ undecided people will vote for him) and candidate number $3$ will receive $3$ votes. Therefore, candidate number $2$ wins (he received the same number of votes as candidate $3$, but his number is lower), so the answer for him is $1$.   * If candidates with numbers $1$ and $2$ are not allowed, candidate number $3$ wins, so the answer for him is $2$.

In the second test case, candidate number $1$ will win if candidate number $2$ is not allowed to participate.

Buggy Code:
#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;
typedef long long ll;
const int N = 3e5;
const int M = 25;
const int INF = 0x3f3f3f3f;

int n, m, ans ,_;
int w[N] ,f[N];
bool cmp ( int x ,int y){ return x>y;}
int main() {
    ios_base::sync_with_stdio(0),cin.tie(0);
    cin>>_;
    while(_--)
    {
        cin>>n>>m;
        memset(f,0,sizeof f);
        memset(w,0,sizeof w);
        w[1] = m;

        int mav = 0;
        for(int i=1;i<=n;i++)
        {
            int p;
            cin>>p;
            w[i] += p;
            if(mav <w[i]){
                mav = w[i];
            }
            f[i] += w[i] + f[i-1];
        }
        bool flag = true;
        for(int i=1;i<=n;i++)
        {
            if(w[i]==mav && flag){
                cout<<0<< " ";
                flag =false;
            }else{
                if(f[i] >= mav){
                    cout<<i-1<<" ";
                }else{
                    cout<<i<<" ";
                }
            }

        }
        cout<<endl;
    }
    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
5
3 0
1 2 3
2 0
1 1
4 0
1 2 2 3
3 10
0 10 20
5 5
1 2 3 4 5
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Balanced Problem
time_limit_ms: 3000
memory_limit_mb: 1024
Description: There is an array $a$ consisting of $n$ integers. Initially, all elements of $a$ are equal to $0$.

Kevin can perform several operations on the array. Each operation is one of the following two types:

  * Prefix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $1\le j\le x$, increases $a_j$ by $1$;    * Suffix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $x\le j\le n$, increases $a_j$ by $1$.

In the country of KDOI, people think that the integer $v$ is balanced. Thus, Iris gives Kevin an array $c$ consisting of $n$ integers and defines the beauty of the array $a$ as follows:

  * Initially, set $b=0$;    * For each $1\le i\le n$, if $a_i=v$, add $c_i$ to $b$;    * The beauty of $a$ is the final value of $b$.

Kevin wants to maximize the beauty of $a$ after all the operations. However, he had already performed $m$ operations when he was sleepy. Now, he can perform an arbitrary number (possibly zero) of new operations.

You have to help Kevin find the maximum possible beauty if he optimally performs the new operations.

However, to make sure that you are not just rolling the dice, Kevin gives you an integer $V$, and you need to solve the problem for each $1\le v\le V$.

Input: Each test contains multiple test cases. The first line of the input contains a single integer $t$ ($1\le t\le 1000$) — the number of test cases. The description of test cases follows.

The first line of each test case contains three integers $n$, $m$, and $V$ ($1\le n, m\le 2\cdot 10^5$, $1\le V\le 2000$) — the length of the array $a$, the number of initial operations, and the number that Kevin gives you.

The second line contains $n$ integers $c_1, c_2, \ldots, c_n$ ($1\le c_i\le 10^9$) — the elements in the array $c$.

Then $m$ lines follow, the $i$-th line containing a character $op$ and an integer $x$ ($op=\mathtt{L}$ or $\mathtt{R}$, $1\le x\le n$) — the type of the $i$-th operation and the selected index.

  * If $op=\mathtt{L}$, this operation is a prefix addition on index $x$;    * If $op=\mathtt{R}$, this operation is a suffix addition on index $x$.

It is guaranteed that:

  * the sum of $n$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $m$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $V^2$ over all test cases does not exceed $4\cdot 10^6$.

Output: For each test case, output $V$ integers in a single line, the $i$-th integer denoting the maximum possible beauty after Kevin performs some new operations when $v=i$.

Examples:
input:
5
3 3 2
1 2 4
L 3
R 3
L 1
3 3 2
5 1 4
L 3
R 3
L 1
5 4 5
1 1 1 1 1
L 3
R 2
L 5
L 4
10 12 9
10 9 8 7 6 5 4 3 2 1
L 2
L 4
R 4
R 4
L 6
R 8
L 3
L 2
R 1
R 10
L 8
L 1
1 1 4
1000000000
L 1
output:
2 6
1 9
0 1 3 5 5
0 0 0 6 25 32 35 44 51
1000000000 1000000000 1000000000 1000000000

Note: In the first test case, the array $a$ changes as follows for the initial operations: $[0, 0, 0] \xrightarrow{\mathtt{L}\ 3} [1, 1, 1] \xrightarrow{\mathtt{R}\ 3} [1, 1, 2] \xrightarrow{\mathtt{L}\ 1} [2, 1, 2]$.

  * For $v=1$, it is optimal to not perform any new operations, and the beauty is $b=c_2=2$;    * For $v=2$, it is optimal to perform a prefix addition operation on index $2$. After that, $a$ becomes $[3,2,2]$, and the beauty is $b=c_2+c_3=6$.

In the second test case, for both $v=1$ and $v=2$, it is optimal to not perform any new operations.

Buggy Code:
#include <cstdio>
#include <algorithm>
#include <initializer_list>
using ll=long long;
constexpr int N=200010,V=2010;
constexpr ll INF=0x3fffffffffffffff;
int T,Ch,n,m,Q,i,j,x,a[N];
ll c[N],f[V][V],ans[V];
char op;
template<typename T>
inline void r(T&x){
	while((Ch=getchar())<48);
	x=Ch&15;
	while((Ch=getchar())>47)x=(x<<1)+(x<<3)+(Ch&15);
}
inline void r(char&x){while((x=getchar())<33);}
template<typename...Ar>
inline void r(Ar&&...x){std::initializer_list<int>{(r(x),0)...};}
template<typename T>
inline void w(T x){
	static char stk[64],*top=stk;
	do{
		*++top=x%10;
		x/=10;
	}while(x);
	do putchar(*top--|48);while(top!=stk);
	putchar(32);
}
template<typename T,int N>
class BIT{
	T t[N];
	int n;
public:
	void init(const int&x){
		n=x;
		std::fill(t+1,t+n+1,-INF);
	}
	T query(int x)const{
		T ans=-INF;
		while(x){
			ans=std::max(ans,t[x]);
			x&=x-1;
		}
		return ans;
	}
	void modify(int x,const T&v){
		while(x<=n){
			t[x]=std::max(t[x],v);
			x+=x&-x;
		}
	}
};
BIT<ll,V>t1[V],t2[V];
int main(){
	r(T);
	while(T--){
		r(n,Q,m);
		for(i=1;i<=n;i++){
			r(c[i]);
			a[i]=0;
		}
		while(Q--){
			r(op,i);
			if(op=='L'){
				a[1]++;
				a[i+1]--;
			}
			else a[i]++;
		}
		for(i=1;i<=n;i++)a[i]+=a[i-1];
		x=0;
		for(i=1;i<=n;i++){
			if(a[i]>m)continue;
			if(a[i]==a[x])c[x]+=c[i];
			else{
				a[++x]=a[i];
				c[x]=c[i];
			}
		}
		n=x;
		for(i=0;i<=m;i++){
			t1[i].init(m+1);
			t1[i].modify(m+1,0);
			t2[i].init(m+1);
			t2[i].modify(1,0);
			ans[i]=0;
		}
		for(i=1;i<=n;i++){
			for(j=a[i];j<=m;j++){
				// for(int k=0;k<i;k++)
				// 	if(a[k]<a[i]){if(j-a[i]+a[k]>=0)f[i][j]=std::max(f[i][j],f[k][j-a[i]+a[k]]);}
				// 	else f[i][j]=std::max(f[i][j],f[k][j]);
				f[i][j]=std::max(t1[j].query(m-a[i]+1),t2[j-a[i]].query(a[i]+1))+c[i];
				ans[j]=std::max(ans[j],f[i][j]);
			}
			for(j=a[i];j<=m;j++){
				t1[j].modify(m-a[i]+1,f[i][j]);
				t2[j-a[i]].modify(a[i]+1,f[i][j]);
			}
		}
		for(i=1;i<=m;i++){
			ans[i]=std::max(ans[i],ans[i-1]);
			w(ans[i]);
		}
		putchar(10);
	}
	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
5
3 3 2
1 2 4
L 3
R 3
L 1
3 3 2
5 1 4
L 3
R 3
L 1
5 4 5
1 1 1 1 1
L 3
R 2
L 5
L 4
10 12 9
10 9 8 7 6 5 4 3 2 1
L 2
L 4
R 4
R 4
L 6
R 8
L 3
L 2
R 1
R 10
L 8
L 1
1 1 4
1000000000
L 1
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Balanced Problem
time_limit_ms: 3000
memory_limit_mb: 1024
Description: There is an array $a$ consisting of $n$ integers. Initially, all elements of $a$ are equal to $0$.

Kevin can perform several operations on the array. Each operation is one of the following two types:

  * Prefix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $1\le j\le x$, increases $a_j$ by $1$;    * Suffix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $x\le j\le n$, increases $a_j$ by $1$.

In the country of KDOI, people think that the integer $v$ is balanced. Thus, Iris gives Kevin an array $c$ consisting of $n$ integers and defines the beauty of the array $a$ as follows:

  * Initially, set $b=0$;    * For each $1\le i\le n$, if $a_i=v$, add $c_i$ to $b$;    * The beauty of $a$ is the final value of $b$.

Kevin wants to maximize the beauty of $a$ after all the operations. However, he had already performed $m$ operations when he was sleepy. Now, he can perform an arbitrary number (possibly zero) of new operations.

You have to help Kevin find the maximum possible beauty if he optimally performs the new operations.

However, to make sure that you are not just rolling the dice, Kevin gives you an integer $V$, and you need to solve the problem for each $1\le v\le V$.

Input: Each test contains multiple test cases. The first line of the input contains a single integer $t$ ($1\le t\le 1000$) — the number of test cases. The description of test cases follows.

The first line of each test case contains three integers $n$, $m$, and $V$ ($1\le n, m\le 2\cdot 10^5$, $1\le V\le 2000$) — the length of the array $a$, the number of initial operations, and the number that Kevin gives you.

The second line contains $n$ integers $c_1, c_2, \ldots, c_n$ ($1\le c_i\le 10^9$) — the elements in the array $c$.

Then $m$ lines follow, the $i$-th line containing a character $op$ and an integer $x$ ($op=\mathtt{L}$ or $\mathtt{R}$, $1\le x\le n$) — the type of the $i$-th operation and the selected index.

  * If $op=\mathtt{L}$, this operation is a prefix addition on index $x$;    * If $op=\mathtt{R}$, this operation is a suffix addition on index $x$.

It is guaranteed that:

  * the sum of $n$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $m$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $V^2$ over all test cases does not exceed $4\cdot 10^6$.

Output: For each test case, output $V$ integers in a single line, the $i$-th integer denoting the maximum possible beauty after Kevin performs some new operations when $v=i$.

Examples:
input:
5
3 3 2
1 2 4
L 3
R 3
L 1
3 3 2
5 1 4
L 3
R 3
L 1
5 4 5
1 1 1 1 1
L 3
R 2
L 5
L 4
10 12 9
10 9 8 7 6 5 4 3 2 1
L 2
L 4
R 4
R 4
L 6
R 8
L 3
L 2
R 1
R 10
L 8
L 1
1 1 4
1000000000
L 1
output:
2 6
1 9
0 1 3 5 5
0 0 0 6 25 32 35 44 51
1000000000 1000000000 1000000000 1000000000

Note: In the first test case, the array $a$ changes as follows for the initial operations: $[0, 0, 0] \xrightarrow{\mathtt{L}\ 3} [1, 1, 1] \xrightarrow{\mathtt{R}\ 3} [1, 1, 2] \xrightarrow{\mathtt{L}\ 1} [2, 1, 2]$.

  * For $v=1$, it is optimal to not perform any new operations, and the beauty is $b=c_2=2$;    * For $v=2$, it is optimal to perform a prefix addition operation on index $2$. After that, $a$ becomes $[3,2,2]$, and the beauty is $b=c_2+c_3=6$.

In the second test case, for both $v=1$ and $v=2$, it is optimal to not perform any new operations.

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

#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define make_unique(x) sort(all(x)), x.erase(unique(all(x)), x.end())

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 Rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int N = 2e3 + 200;
const int M = 2e5;
const int inf = 2e9 + 3;
const ll INF = 1e18;

int T;
int n, m, V;
int was[2][N], Was[2][N];
long long dp[2 * N][N], ans[N];
long long c[N], C[N];

void solve() {
    cin >> n >> m >> V;
    for (int i = 0; i <= n + 1; ++i) {
        was[0][i] = was[1][i] = 0;
    }
    for (int i = 1; i <= n; ++i) {
        cin >> c[i];
    }
    for (int i = 1; i <= m; ++i) {
        char c;
        int x;
        cin >> c >> x;
        was[c == 'R'][x]++;
    }
    for (int i = 1; i <= n; ++i) {
        was[1][i] += was[1][i - 1];
    }
    for (int i = n; i >= 1; --i) {
        was[0][i] += was[0][i + 1];
    }
    int sz = 0;
    long long sum = 0;
    for (int i = 1; i <= n; ++i) {
        if (was[0][i] + was[1][i] > V)
            continue;
        if (i == 1 || was[0][i] != was[0][i - 1] || was[1][i] != was[1][i - 1]) {
            ++sz;
            C[sz] = c[i];
            Was[0][sz] = was[0][i];
            Was[1][sz] = was[1][i];
        }
        else {
            C[sz] += c[i];
        }
    }
    n = sz;
    /* for (int i = 1; i <= n; ++i) { */
    /*     cout << C[i] << " " << Was[0][i] << " " << Was[1][i] << '\n'; */
    /* } */
    assert(n <= 2 * V);
    for (int i = 1; i <= n; ++i) {
        for (int k = 0; k <= V; ++k) {
            dp[i][k] = -INF;
        }
    }
    for (int i = 1; i <= V; ++i)
        ans[i] = 0;
    for (int i = 1; i <= n; ++i) {
        dp[i][Was[1][i]] = max(dp[i][Was[1][i]], C[i]);
        for (int k = 0; k <= V; ++k) {
            if (k + Was[0][i] <= V)
                ans[k + Was[0][i]] = max(ans[k + Was[0][i]], dp[i][k]);
            for (int j = i + 1; j <= n; ++j) {
                int nk = k + max(Was[0][i] - Was[0][j], Was[1][j] - Was[1][i]);
                if (nk <= V)
                    dp[j][nk] = max(dp[j][nk], dp[i][k] + C[j]);
            }
        }
    }
    for (int i = 1; i <= V; ++i) {
        ans[i] = max(ans[i], ans[i - 1]);
        cout << ans[i] << " \n"[i == V];
    }
}

int main() {
    cin.tie(0)->sync_with_stdio(0);
    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
3 3 2
1 2 4
L 3
R 3
L 1
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Balanced Problem
time_limit_ms: 3000
memory_limit_mb: 1024
Description: There is an array $a$ consisting of $n$ integers. Initially, all elements of $a$ are equal to $0$.

Kevin can perform several operations on the array. Each operation is one of the following two types:

  * Prefix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $1\le j\le x$, increases $a_j$ by $1$;    * Suffix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $x\le j\le n$, increases $a_j$ by $1$.

In the country of KDOI, people think that the integer $v$ is balanced. Thus, Iris gives Kevin an array $c$ consisting of $n$ integers and defines the beauty of the array $a$ as follows:

  * Initially, set $b=0$;    * For each $1\le i\le n$, if $a_i=v$, add $c_i$ to $b$;    * The beauty of $a$ is the final value of $b$.

Kevin wants to maximize the beauty of $a$ after all the operations. However, he had already performed $m$ operations when he was sleepy. Now, he can perform an arbitrary number (possibly zero) of new operations.

You have to help Kevin find the maximum possible beauty if he optimally performs the new operations.

However, to make sure that you are not just rolling the dice, Kevin gives you an integer $V$, and you need to solve the problem for each $1\le v\le V$.

Input: Each test contains multiple test cases. The first line of the input contains a single integer $t$ ($1\le t\le 1000$) — the number of test cases. The description of test cases follows.

The first line of each test case contains three integers $n$, $m$, and $V$ ($1\le n, m\le 2\cdot 10^5$, $1\le V\le 2000$) — the length of the array $a$, the number of initial operations, and the number that Kevin gives you.

The second line contains $n$ integers $c_1, c_2, \ldots, c_n$ ($1\le c_i\le 10^9$) — the elements in the array $c$.

Then $m$ lines follow, the $i$-th line containing a character $op$ and an integer $x$ ($op=\mathtt{L}$ or $\mathtt{R}$, $1\le x\le n$) — the type of the $i$-th operation and the selected index.

  * If $op=\mathtt{L}$, this operation is a prefix addition on index $x$;    * If $op=\mathtt{R}$, this operation is a suffix addition on index $x$.

It is guaranteed that:

  * the sum of $n$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $m$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $V^2$ over all test cases does not exceed $4\cdot 10^6$.

Output: For each test case, output $V$ integers in a single line, the $i$-th integer denoting the maximum possible beauty after Kevin performs some new operations when $v=i$.

Examples:
input:
5
3 3 2
1 2 4
L 3
R 3
L 1
3 3 2
5 1 4
L 3
R 3
L 1
5 4 5
1 1 1 1 1
L 3
R 2
L 5
L 4
10 12 9
10 9 8 7 6 5 4 3 2 1
L 2
L 4
R 4
R 4
L 6
R 8
L 3
L 2
R 1
R 10
L 8
L 1
1 1 4
1000000000
L 1
output:
2 6
1 9
0 1 3 5 5
0 0 0 6 25 32 35 44 51
1000000000 1000000000 1000000000 1000000000

Note: In the first test case, the array $a$ changes as follows for the initial operations: $[0, 0, 0] \xrightarrow{\mathtt{L}\ 3} [1, 1, 1] \xrightarrow{\mathtt{R}\ 3} [1, 1, 2] \xrightarrow{\mathtt{L}\ 1} [2, 1, 2]$.

  * For $v=1$, it is optimal to not perform any new operations, and the beauty is $b=c_2=2$;    * For $v=2$, it is optimal to perform a prefix addition operation on index $2$. After that, $a$ becomes $[3,2,2]$, and the beauty is $b=c_2+c_3=6$.

In the second test case, for both $v=1$ and $v=2$, it is optimal to not perform any new operations.

Buggy Code:
#include<bits/stdc++.h>
#define lowbit(x) (x&(-x))
using namespace std;
typedef long long ll;
const ll N = 2e5+10,M = 4010,INF = 1e18;
template<typename T>void tomin(T& x,T y){x = min(x,y);}
template<typename T>void tomax(T& x,T y){x = max(x,y);}
//
int T,n,m,V,c[N],a[N],L,R;

ll va[M],vc[M],cnt,ans[M];

ll dp[M][M];

struct BIT{
    ll t[M];
    void clear(){
        for(int i=1;i<=V;i++)t[i] = -INF;
    }
    void mdf(int x,ll v){
        for(;x<=V;x+=lowbit(x))tomax(t[x],v);
    }
    ll qry(ll x,ll S=-INF){
        for(;x;x-=lowbit(x))tomax(S,t[x]);
        return S;
    }
}t1[M],t2[M];

void solve(){
    cin>>n>>m>>V;
    for(int i=1;i<=n;i++)cin>>c[i]; fill(a+1,a+1+n,0);
    for(int i=1;i<=m;i++){
        char s; int x; cin>>s>>x;
        if(s=='L')a[1]++,a[x+1]--;
        else a[x]++;
    }
    for(int i=1;i<=n;i++)a[i] += a[i-1];
    L = 1,R = n;
    while(L<=n && a[L] > V)L++; while(R>=1 && a[R] > V)R--;
    if(L>R){
        for(int i=1;i<=V;i++)cout<<"0 "; cout<<"\n";
        return;
    }
    cnt = 0;
    for(int i=L,j;i<=R;i=j+1){
        j=i; while(j<R && a[j+1] == a[j])j++;
        va[++cnt] = a[j]; vc[cnt] = 0; for(int k=i;k<=j;k++)vc[cnt] += c[k];
    }
    //
    for(int v=1;v<=V;v++)ans[v] = 0;
    for(int v=1;v<=V;v++)t1[v].clear(); for(int v=0;v<=2*V;v++)t2[v].clear();
    for(int i=1;i<=cnt;i++)for(int j=0;j<=V;j++)dp[i][j] = -INF;
    for(int i=1;i<=cnt;i++){
        if(va[i] <= V)tomax(dp[i][va[i]],vc[i]);
        for(int j=1;j<=V;j++){
            ll mx = max(t1[j].qry(V-va[i]+1),t2[j-va[i]+V].qry(va[i]));
            tomax(dp[i][j],mx + vc[i]);
        }
        for(int j=1;j<=V;j++){
            tomax(ans[j],dp[i][j]);
            t1[j].mdf(V-va[i]+1,dp[i][j]);
            t2[j-va[i]+V].mdf(va[i],dp[i][j]);
        }
    }
    for(int v=1;v<=V;v++)tomax(ans[v],ans[v-1]);
    for(int v=1;v<=V;v++)cout<<ans[v]<<" "; cout<<"\n";
}

int main(){
    ios::sync_with_stdio(false); cin.tie(0);
    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
1
5 4 3
10 1 10 1 10
L 3
R 2
L 5
L 4
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Balanced Problem
time_limit_ms: 3000
memory_limit_mb: 1024
Description: There is an array $a$ consisting of $n$ integers. Initially, all elements of $a$ are equal to $0$.

Kevin can perform several operations on the array. Each operation is one of the following two types:

  * Prefix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $1\le j\le x$, increases $a_j$ by $1$;    * Suffix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $x\le j\le n$, increases $a_j$ by $1$.

In the country of KDOI, people think that the integer $v$ is balanced. Thus, Iris gives Kevin an array $c$ consisting of $n$ integers and defines the beauty of the array $a$ as follows:

  * Initially, set $b=0$;    * For each $1\le i\le n$, if $a_i=v$, add $c_i$ to $b$;    * The beauty of $a$ is the final value of $b$.

Kevin wants to maximize the beauty of $a$ after all the operations. However, he had already performed $m$ operations when he was sleepy. Now, he can perform an arbitrary number (possibly zero) of new operations.

You have to help Kevin find the maximum possible beauty if he optimally performs the new operations.

However, to make sure that you are not just rolling the dice, Kevin gives you an integer $V$, and you need to solve the problem for each $1\le v\le V$.

Input: Each test contains multiple test cases. The first line of the input contains a single integer $t$ ($1\le t\le 1000$) — the number of test cases. The description of test cases follows.

The first line of each test case contains three integers $n$, $m$, and $V$ ($1\le n, m\le 2\cdot 10^5$, $1\le V\le 2000$) — the length of the array $a$, the number of initial operations, and the number that Kevin gives you.

The second line contains $n$ integers $c_1, c_2, \ldots, c_n$ ($1\le c_i\le 10^9$) — the elements in the array $c$.

Then $m$ lines follow, the $i$-th line containing a character $op$ and an integer $x$ ($op=\mathtt{L}$ or $\mathtt{R}$, $1\le x\le n$) — the type of the $i$-th operation and the selected index.

  * If $op=\mathtt{L}$, this operation is a prefix addition on index $x$;    * If $op=\mathtt{R}$, this operation is a suffix addition on index $x$.

It is guaranteed that:

  * the sum of $n$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $m$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $V^2$ over all test cases does not exceed $4\cdot 10^6$.

Output: For each test case, output $V$ integers in a single line, the $i$-th integer denoting the maximum possible beauty after Kevin performs some new operations when $v=i$.

Examples:
input:
5
3 3 2
1 2 4
L 3
R 3
L 1
3 3 2
5 1 4
L 3
R 3
L 1
5 4 5
1 1 1 1 1
L 3
R 2
L 5
L 4
10 12 9
10 9 8 7 6 5 4 3 2 1
L 2
L 4
R 4
R 4
L 6
R 8
L 3
L 2
R 1
R 10
L 8
L 1
1 1 4
1000000000
L 1
output:
2 6
1 9
0 1 3 5 5
0 0 0 6 25 32 35 44 51
1000000000 1000000000 1000000000 1000000000

Note: In the first test case, the array $a$ changes as follows for the initial operations: $[0, 0, 0] \xrightarrow{\mathtt{L}\ 3} [1, 1, 1] \xrightarrow{\mathtt{R}\ 3} [1, 1, 2] \xrightarrow{\mathtt{L}\ 1} [2, 1, 2]$.

  * For $v=1$, it is optimal to not perform any new operations, and the beauty is $b=c_2=2$;    * For $v=2$, it is optimal to perform a prefix addition operation on index $2$. After that, $a$ becomes $[3,2,2]$, and the beauty is $b=c_2+c_3=6$.

In the second test case, for both $v=1$ and $v=2$, it is optimal to not perform any new operations.

Buggy Code:
N = int(2e5 + 2)
M = 4002

def upd(x, y, z, v):
    x += 1
    y += 1
    for i in range(x, v + 2):
        for j in range(y, v + 2):
            t[i][j] = max(t[i][j], z)

def qry(x, y, v):
    x += 1
    y += 1
    z = 0
    for i in range(x, 0, -1):
        for j in range(y, 0, -1):
            z = max(z, t[i][j])
    return z

T = int(input())
for _ in range(T):
    n, m, v = map(int, input().split())
    c = list(map(int, input().split()))
    s = [0] * (n + 1)

    for _ in range(m):
        op, x = input().split()
        x = int(x)
        if op == 'L':
            s[1] += 1
            if x + 1 <= n:
                s[x + 1] -= 1
        else:
            s[x] += 1

    for i in range(1, n + 1):
        s[i] += s[i - 1]

    g = []
    i = 1
    while i <= n:
        C = 0
        j = i
        while j <= n and s[j] == s[i]:
            C += c[j - 1]
            j += 1
        if s[i] <= v:
            g.append((s[i], C))
        i = j

    t = [[0] * (M) for _ in range(M)]
    f = [0] * (M)

    for x, val in g:
        for i in range(v + 1 - x):
            f[i] = qry(i, i + x, v)
        for i in range(v + 1 - x):
            upd(i, i + x, f[i] + val, v)

    for i in range(1, v + 1):
        print(qry(v, i, v), end=' ')
    print()

**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 5 3
1 2 3 4 5
L 1
R 5
L 3
R 3
L 5
10 10 5
1 1 1 1 1 1 1 1 1 1
L 1
R 10
L 5
R 5
L 10
R 1
L 1
R 10
L 5
R 5
1 1 3
1000000000
L 1
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Balanced Problem
time_limit_ms: 3000
memory_limit_mb: 1024
Description: There is an array $a$ consisting of $n$ integers. Initially, all elements of $a$ are equal to $0$.

Kevin can perform several operations on the array. Each operation is one of the following two types:

  * Prefix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $1\le j\le x$, increases $a_j$ by $1$;    * Suffix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $x\le j\le n$, increases $a_j$ by $1$.

In the country of KDOI, people think that the integer $v$ is balanced. Thus, Iris gives Kevin an array $c$ consisting of $n$ integers and defines the beauty of the array $a$ as follows:

  * Initially, set $b=0$;    * For each $1\le i\le n$, if $a_i=v$, add $c_i$ to $b$;    * The beauty of $a$ is the final value of $b$.

Kevin wants to maximize the beauty of $a$ after all the operations. However, he had already performed $m$ operations when he was sleepy. Now, he can perform an arbitrary number (possibly zero) of new operations.

You have to help Kevin find the maximum possible beauty if he optimally performs the new operations.

However, to make sure that you are not just rolling the dice, Kevin gives you an integer $V$, and you need to solve the problem for each $1\le v\le V$.

Input: Each test contains multiple test cases. The first line of the input contains a single integer $t$ ($1\le t\le 1000$) — the number of test cases. The description of test cases follows.

The first line of each test case contains three integers $n$, $m$, and $V$ ($1\le n, m\le 2\cdot 10^5$, $1\le V\le 2000$) — the length of the array $a$, the number of initial operations, and the number that Kevin gives you.

The second line contains $n$ integers $c_1, c_2, \ldots, c_n$ ($1\le c_i\le 10^9$) — the elements in the array $c$.

Then $m$ lines follow, the $i$-th line containing a character $op$ and an integer $x$ ($op=\mathtt{L}$ or $\mathtt{R}$, $1\le x\le n$) — the type of the $i$-th operation and the selected index.

  * If $op=\mathtt{L}$, this operation is a prefix addition on index $x$;    * If $op=\mathtt{R}$, this operation is a suffix addition on index $x$.

It is guaranteed that:

  * the sum of $n$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $m$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $V^2$ over all test cases does not exceed $4\cdot 10^6$.

Output: For each test case, output $V$ integers in a single line, the $i$-th integer denoting the maximum possible beauty after Kevin performs some new operations when $v=i$.

Examples:
input:
5
3 3 2
1 2 4
L 3
R 3
L 1
3 3 2
5 1 4
L 3
R 3
L 1
5 4 5
1 1 1 1 1
L 3
R 2
L 5
L 4
10 12 9
10 9 8 7 6 5 4 3 2 1
L 2
L 4
R 4
R 4
L 6
R 8
L 3
L 2
R 1
R 10
L 8
L 1
1 1 4
1000000000
L 1
output:
2 6
1 9
0 1 3 5 5
0 0 0 6 25 32 35 44 51
1000000000 1000000000 1000000000 1000000000

Note: In the first test case, the array $a$ changes as follows for the initial operations: $[0, 0, 0] \xrightarrow{\mathtt{L}\ 3} [1, 1, 1] \xrightarrow{\mathtt{R}\ 3} [1, 1, 2] \xrightarrow{\mathtt{L}\ 1} [2, 1, 2]$.

  * For $v=1$, it is optimal to not perform any new operations, and the beauty is $b=c_2=2$;    * For $v=2$, it is optimal to perform a prefix addition operation on index $2$. After that, $a$ becomes $[3,2,2]$, and the beauty is $b=c_2+c_3=6$.

In the second test case, for both $v=1$ and $v=2$, it is optimal to not perform any new operations.

Buggy Code:
N = int(2e5 + 2)
M = 4002

def upd(x, y, z):
    x += 1
    y += 1
    for i in range(x, v + 2):
        for j in range(y, v + 2):
            t[i][j] = max(t[i][j], z)

def qry(x, y):
    x += 1
    y += 1
    z = 0
    for i in range(x, 0, -1):
        for j in range(y, 0, -1):
            z = max(z, t[i][j])
    return z

T = int(input())
for _ in range(T):
    n, m, v = map(int, input().split())
    c = list(map(int, input().split()))
    s = [0] * (n + 1)

    for _ in range(m):
        op, x = input().split()
        x = int(x)
        if op == 'L':
            s[1] += 1
            if x + 1 <= n:
                s[x + 1] -= 1
        else:
            s[x] += 1

    for i in range(1, n + 1):
        s[i] += s[i - 1]

    g = []
    i = 1
    while i <= n:
        C = 0
        j = i
        while j <= n and s[j] == s[i]:
            C += c[j - 1]
            j += 1
        if s[i] <= v:
            g.append((s[i], C))
        i = j

    t = [[0] * (M) for _ in range(M)]
    f = [0] * (M)

    for x, val in g:
        for i in range(v + 1 - x):
            f[i] = qry(i, i + x)
        for i in range(v + 1 - x):
            upd(i, i + x, f[i] + val)

    for i in range(1, v + 1):
        print(qry(v, i), end=' ')
    print()

**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
2
3 1 3
1 2 3
L 1
3 1 3
1 2 3
R 1
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Balanced Problem
time_limit_ms: 3000
memory_limit_mb: 1024
Description: There is an array $a$ consisting of $n$ integers. Initially, all elements of $a$ are equal to $0$.

Kevin can perform several operations on the array. Each operation is one of the following two types:

  * Prefix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $1\le j\le x$, increases $a_j$ by $1$;    * Suffix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $x\le j\le n$, increases $a_j$ by $1$.

In the country of KDOI, people think that the integer $v$ is balanced. Thus, Iris gives Kevin an array $c$ consisting of $n$ integers and defines the beauty of the array $a$ as follows:

  * Initially, set $b=0$;    * For each $1\le i\le n$, if $a_i=v$, add $c_i$ to $b$;    * The beauty of $a$ is the final value of $b$.

Kevin wants to maximize the beauty of $a$ after all the operations. However, he had already performed $m$ operations when he was sleepy. Now, he can perform an arbitrary number (possibly zero) of new operations.

You have to help Kevin find the maximum possible beauty if he optimally performs the new operations.

However, to make sure that you are not just rolling the dice, Kevin gives you an integer $V$, and you need to solve the problem for each $1\le v\le V$.

Input: Each test contains multiple test cases. The first line of the input contains a single integer $t$ ($1\le t\le 1000$) — the number of test cases. The description of test cases follows.

The first line of each test case contains three integers $n$, $m$, and $V$ ($1\le n, m\le 2\cdot 10^5$, $1\le V\le 2000$) — the length of the array $a$, the number of initial operations, and the number that Kevin gives you.

The second line contains $n$ integers $c_1, c_2, \ldots, c_n$ ($1\le c_i\le 10^9$) — the elements in the array $c$.

Then $m$ lines follow, the $i$-th line containing a character $op$ and an integer $x$ ($op=\mathtt{L}$ or $\mathtt{R}$, $1\le x\le n$) — the type of the $i$-th operation and the selected index.

  * If $op=\mathtt{L}$, this operation is a prefix addition on index $x$;    * If $op=\mathtt{R}$, this operation is a suffix addition on index $x$.

It is guaranteed that:

  * the sum of $n$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $m$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $V^2$ over all test cases does not exceed $4\cdot 10^6$.

Output: For each test case, output $V$ integers in a single line, the $i$-th integer denoting the maximum possible beauty after Kevin performs some new operations when $v=i$.

Examples:
input:
5
3 3 2
1 2 4
L 3
R 3
L 1
3 3 2
5 1 4
L 3
R 3
L 1
5 4 5
1 1 1 1 1
L 3
R 2
L 5
L 4
10 12 9
10 9 8 7 6 5 4 3 2 1
L 2
L 4
R 4
R 4
L 6
R 8
L 3
L 2
R 1
R 10
L 8
L 1
1 1 4
1000000000
L 1
output:
2 6
1 9
0 1 3 5 5
0 0 0 6 25 32 35 44 51
1000000000 1000000000 1000000000 1000000000

Note: In the first test case, the array $a$ changes as follows for the initial operations: $[0, 0, 0] \xrightarrow{\mathtt{L}\ 3} [1, 1, 1] \xrightarrow{\mathtt{R}\ 3} [1, 1, 2] \xrightarrow{\mathtt{L}\ 1} [2, 1, 2]$.

  * For $v=1$, it is optimal to not perform any new operations, and the beauty is $b=c_2=2$;    * For $v=2$, it is optimal to perform a prefix addition operation on index $2$. After that, $a$ becomes $[3,2,2]$, and the beauty is $b=c_2+c_3=6$.

In the second test case, for both $v=1$ and $v=2$, it is optimal to not perform any new operations.

Buggy Code:
#include<bits/stdc++.h>
#define For(i,x,y) for (int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (int i=(x);i<(y);i++)
#define Dow(i,x,y) for (int i=(x);i>=(y);i--)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define fil(a,b) memset(a,b,sizeof a)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
	ll x=0,f=1;char c=getchar();
	while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
	if (c=='-') f=-1,c=getchar();
	while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return x*f;
}

const int N = 2e5+10, V = 2010;
int n,m,v,cnt,a[N],s[N],b[V<<1];
ll c[V<<1],f[V<<1][V],ans[V];

ll t[V<<1][V];
inline void Add(int k,int x,ll y){
	++x;
	for (;x<=v+1;x+=x&-x) t[k][x]=max(t[k][x],y);
}
inline ll Query(int k,ll x){
	++x;
	ll ret=0;
	for (;x;x-=x&-x) ret=max(ret,t[k][x]);
	return ret;
}

inline void solve(){
	n=read(),m=read(),v=read();
	For(i,1,n) a[i]=read();
	For(i,1,n) s[i]=0;
	For(i,1,m){
		char op[4];
		scanf("%s",op);
		int x=read();
		if (op[0]=='L'){
			s[1]++;
			s[x+1]--;
		} else {
			s[x]++;
			s[n+1]--;
		}
	}
	For(i,1,n) s[i]+=s[i-1];
	int cnt=0;
	for (int l=1,r=1;l<=n;l=++r){
		ll sa=a[r];
		while (r<n&&s[r+1]==s[r]) ++r,sa+=a[r];
		if (s[l]<=v){
			b[++cnt]=s[l];
			c[cnt]=sa;
		}
	}
	For(i,1,cnt) For(j,0,v) f[i][j]=0;
	For(i,1,v) ans[i]=0;
	For(i,0,v+1) For(j,0,v+1) t[i][j]=0;
	Dow(i,cnt,1){
		f[i][0]=max(f[i][0],c[i]);
		For(j,0,v){
			if (b[i]+j>v) break;
			f[i][j]=max(f[i][j],Query(j,b[i])+c[i]);
			if (j) f[i][j]=max(f[i][j],f[i][j-1]);
			ans[b[i]+j]=max(ans[b[i]+j],f[i][j]);
		}
		Dow(k,i-1,1) if (b[k]<=b[i]){
			For(j,0,v-(b[i]-b[k])) f[k][j+b[i]-b[k]]=max(f[k][j+b[i]-b[k]],f[i][j]+c[k]);
			break;
		}
		For(j,0,v){
			if (b[i]+j>v) break;
			Add(j,b[i],f[i][j]);
		}
	}
	For(i,1,v) printf("%lld ",ans[i]);
	puts("");
}

int main(){
	int T=read();
	while (T--) solve();
}
/*
1
3 3 2
5 1 4
L 3
R 3
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
1
5 4 5
1 1 1 1 1
L 1
R 5
L 3
R 2
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Balanced Problem
time_limit_ms: 3000
memory_limit_mb: 1024
Description: There is an array $a$ consisting of $n$ integers. Initially, all elements of $a$ are equal to $0$.

Kevin can perform several operations on the array. Each operation is one of the following two types:

  * Prefix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $1\le j\le x$, increases $a_j$ by $1$;    * Suffix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $x\le j\le n$, increases $a_j$ by $1$.

In the country of KDOI, people think that the integer $v$ is balanced. Thus, Iris gives Kevin an array $c$ consisting of $n$ integers and defines the beauty of the array $a$ as follows:

  * Initially, set $b=0$;    * For each $1\le i\le n$, if $a_i=v$, add $c_i$ to $b$;    * The beauty of $a$ is the final value of $b$.

Kevin wants to maximize the beauty of $a$ after all the operations. However, he had already performed $m$ operations when he was sleepy. Now, he can perform an arbitrary number (possibly zero) of new operations.

You have to help Kevin find the maximum possible beauty if he optimally performs the new operations.

However, to make sure that you are not just rolling the dice, Kevin gives you an integer $V$, and you need to solve the problem for each $1\le v\le V$.

Input: Each test contains multiple test cases. The first line of the input contains a single integer $t$ ($1\le t\le 1000$) — the number of test cases. The description of test cases follows.

The first line of each test case contains three integers $n$, $m$, and $V$ ($1\le n, m\le 2\cdot 10^5$, $1\le V\le 2000$) — the length of the array $a$, the number of initial operations, and the number that Kevin gives you.

The second line contains $n$ integers $c_1, c_2, \ldots, c_n$ ($1\le c_i\le 10^9$) — the elements in the array $c$.

Then $m$ lines follow, the $i$-th line containing a character $op$ and an integer $x$ ($op=\mathtt{L}$ or $\mathtt{R}$, $1\le x\le n$) — the type of the $i$-th operation and the selected index.

  * If $op=\mathtt{L}$, this operation is a prefix addition on index $x$;    * If $op=\mathtt{R}$, this operation is a suffix addition on index $x$.

It is guaranteed that:

  * the sum of $n$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $m$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $V^2$ over all test cases does not exceed $4\cdot 10^6$.

Output: For each test case, output $V$ integers in a single line, the $i$-th integer denoting the maximum possible beauty after Kevin performs some new operations when $v=i$.

Examples:
input:
5
3 3 2
1 2 4
L 3
R 3
L 1
3 3 2
5 1 4
L 3
R 3
L 1
5 4 5
1 1 1 1 1
L 3
R 2
L 5
L 4
10 12 9
10 9 8 7 6 5 4 3 2 1
L 2
L 4
R 4
R 4
L 6
R 8
L 3
L 2
R 1
R 10
L 8
L 1
1 1 4
1000000000
L 1
output:
2 6
1 9
0 1 3 5 5
0 0 0 6 25 32 35 44 51
1000000000 1000000000 1000000000 1000000000

Note: In the first test case, the array $a$ changes as follows for the initial operations: $[0, 0, 0] \xrightarrow{\mathtt{L}\ 3} [1, 1, 1] \xrightarrow{\mathtt{R}\ 3} [1, 1, 2] \xrightarrow{\mathtt{L}\ 1} [2, 1, 2]$.

  * For $v=1$, it is optimal to not perform any new operations, and the beauty is $b=c_2=2$;    * For $v=2$, it is optimal to perform a prefix addition operation on index $2$. After that, $a$ becomes $[3,2,2]$, and the beauty is $b=c_2+c_3=6$.

In the second test case, for both $v=1$ and $v=2$, it is optimal to not perform any new operations.

Buggy Code:
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define pb push_back
#define fr first
#define se second
#define ford(i,n) for(int i=n-1;i>=0;i--)
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) (int)(s.size())
#define all(s) s.begin(),s.end()
#define vii vector<pair<int,int> >
#define re return
#define mod 998244353
using namespace std;

ll q_p(ll x,ll y){
    ll res=1;
    x%=mod;
    while(y){
        if(y%2){
            res=res*x;
            res%=mod;
        }
        y/=2;
        x=x*x;
        x%=mod;
    }
    re res;
}
int dx[4]={0,-1,0,1},dy[4]={1,0,-1,0};
int n,m,v;
int a[200001],c[200001];
struct BIT{
    int lowbit(int x){
        re x&(-x);
    }
    int bit[2001];
    void init(){
        rep(i,v+1)
        bit[i]=0;
    }
    int qry(int x){
        int res=0;
        while(x){
            res=max(res,bit[x]);
            x-=lowbit(x);
        }
        re res;
    }
    void add(int x,int v){
        while(x<=n){
            bit[x]=max(bit[x],v);
            x+=lowbit(x);
        }
    }
}BIT[2001][2];
int ans[2001];
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin>>t;
    while(t--){
        cin>>n>>m>>v;
        rep(i,n)
        cin>>c[i];
        rep(j,v+1)
        rep(i,2)
        BIT[j][i].init();
        rep(i,n)
        a[i]=0;
        rep(i,m){
            char op;
            int x;
            cin>>op>>x;
            if(op=='L'){
                a[0]++;
                a[x]--;
            }
            if(op=='R'){
                a[x-1]++;
            }
        }
        forn(i,1,n)
        a[i]+=a[i-1];
        vii d;
        d.clear();
        int sumc=0,sa=-1;
        rep(i,n){
            if(a[i]!=sa&&sa!=-1){
                d.pb({sa,sumc});
                sa=-1;
                sumc=0;
            }
            if(a[i]>v)
            continue;
            if(a[i]==sa){
                sumc+=c[i];
            }else{
                sa=a[i];
                sumc=c[i];
            }
        }
        if(sa!=-1)
        d.pb({sa,sumc});
        // dp vi,j=max dp k<vi,j-vi+k   j'-k=j-vi
        // 1~V
        rep(i,v+1)
        ans[i]=0;
        for(pii p:d){
            int nv,w;
            nv=p.fr,w=p.se;
            forn(j,nv,v+1){
                int dpij=0;
                dpij=max(dpij,BIT[j-nv][0].qry(nv)+w);
                dpij=max(dpij,BIT[j][1].qry(v-nv+1)+w);
                BIT[j-nv][0].add(nv,dpij);
                BIT[j][1].add(v-nv+1,dpij);
                ans[j]=max(ans[j],dpij);
            }
        }
        forn(i,1,v+1)
        ans[i]=max(ans[i],ans[i-1]);
        if(t>50)
        cout<<sz(d)<<"\n";
        if(t<=50){
        forn(i,1,v+1)
        cout<<ans[i]<<" ";
        cout<<"\n";
        }

    }
    re 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:
To generate a challenging test input that exposes the bug in the given code, we need to consider edge cases and scenarios that can maximize the failure probability. Here are the steps to think through this:

1. **Edge Cases:**
   - Small values of \( n \) and \( m \) to test basic functionality.
   - Large values of \( n \) and \( m \) to test performance and correctness.
   - Specific values of \( V \) to test the range of possible values for \( v \).

2. **Scenarios:**
   - Test cases where the initial operations already bring some elements of \( a \) to a high value.
   - Test cases where the initial operations do not affect some elements of \( a \).
   - Test cases where the initial operations are mixed (both prefix and suffix additions).

3. **Challenging Input:**
   - A small-scale input with \( n = 5 \), \( m = 4 \), and \( V = 3 \).
   - Initial operations that create a mix of values in \( a \).
   - Values in \( c \) that are significantly different to highlight the impact on the beauty.

Here is the generated test input:

```plaintext
1
5 4 3
1 2 3 4 5
L 3
R 2
L 5
L 4
```

### Explanation:
- **Test Case:**
  - \( n = 5 \): The array \( a \) has 5 elements.
  - \( m = 4 \): 4 initial operations.
  - \( V = 3 \): We need to solve the problem for \( v = 1, 2, 3 \).

- **Array \( c \):**
  - \( c = [1, 2, 3, 4, 5] \): The elements in the array \( c \) are increasing, which can highlight the impact on the beauty.

- **Initial Operations:**
  - \( L 3 \): Prefix addition on index 3.
  - \( R 2 \): Suffix addition on index 2.
  - \( L 5 \): Prefix addition on index 5.
  - \( L 4 \): Prefix addition on index 4.

### Initial Array Changes:
- After \( L 3 \): \( a = [1, 1, 1, 0, 0] \)
- After \( R 2 \): \( a = [1, 2, 2, 1, 1] \)
- After \( L 5 \): \( a = [2, 3, 3, 2, 2] \)
- After \( L 4 \): \( a = [3, 4, 4, 3, 2] \)

### Expected Output:
- For \( v = 1 \): No new operations are needed.
- For \( v = 2 \): Perform a suffix addition on index 5 to make \( a = [3, 4, 4, 3, 3] \).
- For \( v = 3 \): Perform a prefix addition on index 1 to make \( a = [4, 5, 5, 4, 3] \).

The expected output is:
```plaintext
0 5 10
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Balanced Problem
time_limit_ms: 3000
memory_limit_mb: 1024
Description: There is an array $a$ consisting of $n$ integers. Initially, all elements of $a$ are equal to $0$.

Kevin can perform several operations on the array. Each operation is one of the following two types:

  * Prefix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $1\le j\le x$, increases $a_j$ by $1$;    * Suffix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $x\le j\le n$, increases $a_j$ by $1$.

In the country of KDOI, people think that the integer $v$ is balanced. Thus, Iris gives Kevin an array $c$ consisting of $n$ integers and defines the beauty of the array $a$ as follows:

  * Initially, set $b=0$;    * For each $1\le i\le n$, if $a_i=v$, add $c_i$ to $b$;    * The beauty of $a$ is the final value of $b$.

Kevin wants to maximize the beauty of $a$ after all the operations. However, he had already performed $m$ operations when he was sleepy. Now, he can perform an arbitrary number (possibly zero) of new operations.

You have to help Kevin find the maximum possible beauty if he optimally performs the new operations.

However, to make sure that you are not just rolling the dice, Kevin gives you an integer $V$, and you need to solve the problem for each $1\le v\le V$.

Input: Each test contains multiple test cases. The first line of the input contains a single integer $t$ ($1\le t\le 1000$) — the number of test cases. The description of test cases follows.

The first line of each test case contains three integers $n$, $m$, and $V$ ($1\le n, m\le 2\cdot 10^5$, $1\le V\le 2000$) — the length of the array $a$, the number of initial operations, and the number that Kevin gives you.

The second line contains $n$ integers $c_1, c_2, \ldots, c_n$ ($1\le c_i\le 10^9$) — the elements in the array $c$.

Then $m$ lines follow, the $i$-th line containing a character $op$ and an integer $x$ ($op=\mathtt{L}$ or $\mathtt{R}$, $1\le x\le n$) — the type of the $i$-th operation and the selected index.

  * If $op=\mathtt{L}$, this operation is a prefix addition on index $x$;    * If $op=\mathtt{R}$, this operation is a suffix addition on index $x$.

It is guaranteed that:

  * the sum of $n$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $m$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $V^2$ over all test cases does not exceed $4\cdot 10^6$.

Output: For each test case, output $V$ integers in a single line, the $i$-th integer denoting the maximum possible beauty after Kevin performs some new operations when $v=i$.

Examples:
input:
5
3 3 2
1 2 4
L 3
R 3
L 1
3 3 2
5 1 4
L 3
R 3
L 1
5 4 5
1 1 1 1 1
L 3
R 2
L 5
L 4
10 12 9
10 9 8 7 6 5 4 3 2 1
L 2
L 4
R 4
R 4
L 6
R 8
L 3
L 2
R 1
R 10
L 8
L 1
1 1 4
1000000000
L 1
output:
2 6
1 9
0 1 3 5 5
0 0 0 6 25 32 35 44 51
1000000000 1000000000 1000000000 1000000000

Note: In the first test case, the array $a$ changes as follows for the initial operations: $[0, 0, 0] \xrightarrow{\mathtt{L}\ 3} [1, 1, 1] \xrightarrow{\mathtt{R}\ 3} [1, 1, 2] \xrightarrow{\mathtt{L}\ 1} [2, 1, 2]$.

  * For $v=1$, it is optimal to not perform any new operations, and the beauty is $b=c_2=2$;    * For $v=2$, it is optimal to perform a prefix addition operation on index $2$. After that, $a$ becomes $[3,2,2]$, and the beauty is $b=c_2+c_3=6$.

In the second test case, for both $v=1$ and $v=2$, it is optimal to not perform any new operations.

Buggy Code:
//��_G
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double DB;
const int N = 222222;
const int V = 6666;
const LL inf = 1e18;
int n,m,v,a[N],b[N];
LL c[N],f[V][V],g[V][V],h[V][V],ans[V];
char ch[111];
void cmax(LL&x,LL y){
	if(x<y)
		x=y;
}
void modify(LL*t,int i,LL x){
	while(i<=v+1){
		cmax(t[i],x);
		i+=i&-i;
	}
}
LL query(LL*t,int i){
	LL x=-inf;
	while(i){
		cmax(x,t[i]);
		i-=i&-i;
	}
	return x;
}
int main(){
	int T,i,j,x;
	scanf("%d",&T);
	while(T--){
		scanf("%d%d%d",&n,&m,&v);
		for(i=1;i<=n;i++)
			scanf("%lld",c+i);
		for(i=0;i<=n+5;i++)
			a[i]=0,b[i]=0;
		for(i=1;i<=m;i++){
			scanf("%s%d",ch,&x);
			if(ch[0]=='L')
				a[x]++;
			else
				b[x]++;
		}
		for(i=n-1;i>=1;i--)
			a[i]+=a[i+1];
		for(i=2;i<=n;i++)
			b[i]+=b[i-1];
		for(i=1;i<=n;i++)
			a[i]+=b[i];
		j=0;
		for(i=1;i<=n;i++){
			if(a[i]<=v){
				if(j&&a[j]==a[i])
					c[j]+=c[i];
				else
					j++,a[j]=a[i],c[j]=c[i];
			}
		}
		for(i=j+1;i<=n;i++)
			a[i]=0,b[i]=0,c[i]=0;
		n=j;
		for(i=0;i<=v*3;i++)
			for(j=0;j<=v*3;j++)
				f[i][j]=-inf;
		for(i=0;i<=v*3;i++)
			for(j=0;j<=v*3;j++)
				g[i][j]=-inf,h[i][j]=-inf;
		for(i=0;i<=v*3;i++)
			ans[i]=0;
		for(i=1;i<=n;i++){
			cmax(f[i][a[i]],c[i]);
			for(j=0;j<=v*2;j++){
				cmax(f[i][j],c[i]+query(g[j-a[i]+v],1+a[i]));
				cmax(f[i][j],c[i]+query(h[j+a[i]],v+1-a[i]));
			}
			for(j=0;j<=v*2;j++)
				cmax(ans[(j+a[i]+1)/2],f[i][j]);
			for(j=0;j<=v*2;j++){
				modify(g[j-a[i]+v],1+a[i],f[i][j]);
				modify(h[j+a[i]],v+1-a[i],f[i][j]);
			}
			//for(j=0;j<=v*2;j++)
			//	if(f[i][j]>=0)
			//		cout<<i<<' '<<j<<' '<<f[i][j]<<endl;
		}
		for(i=2;i<=v;i++)
			ans[i]=max(ans[i],ans[i-1]);
		for(i=1;i<=v;i++)
			printf("%lld%c",ans[i]," \n"[i==v]);
	}
	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 4 5
1 1 1 1 1
L 3
R 2
L 5
L 4
10 12 9
10 9 8 7 6 5 4 3 2 1
L 2
L 4
R 4
R 4
L 6
R 8
L 3
L 2
R 1
R 10
L 8
L 1
1 1 4
1000000000
L 1
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Balanced Problem
time_limit_ms: 3000
memory_limit_mb: 1024
Description: There is an array $a$ consisting of $n$ integers. Initially, all elements of $a$ are equal to $0$.

Kevin can perform several operations on the array. Each operation is one of the following two types:

  * Prefix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $1\le j\le x$, increases $a_j$ by $1$;    * Suffix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $x\le j\le n$, increases $a_j$ by $1$.

In the country of KDOI, people think that the integer $v$ is balanced. Thus, Iris gives Kevin an array $c$ consisting of $n$ integers and defines the beauty of the array $a$ as follows:

  * Initially, set $b=0$;    * For each $1\le i\le n$, if $a_i=v$, add $c_i$ to $b$;    * The beauty of $a$ is the final value of $b$.

Kevin wants to maximize the beauty of $a$ after all the operations. However, he had already performed $m$ operations when he was sleepy. Now, he can perform an arbitrary number (possibly zero) of new operations.

You have to help Kevin find the maximum possible beauty if he optimally performs the new operations.

However, to make sure that you are not just rolling the dice, Kevin gives you an integer $V$, and you need to solve the problem for each $1\le v\le V$.

Input: Each test contains multiple test cases. The first line of the input contains a single integer $t$ ($1\le t\le 1000$) — the number of test cases. The description of test cases follows.

The first line of each test case contains three integers $n$, $m$, and $V$ ($1\le n, m\le 2\cdot 10^5$, $1\le V\le 2000$) — the length of the array $a$, the number of initial operations, and the number that Kevin gives you.

The second line contains $n$ integers $c_1, c_2, \ldots, c_n$ ($1\le c_i\le 10^9$) — the elements in the array $c$.

Then $m$ lines follow, the $i$-th line containing a character $op$ and an integer $x$ ($op=\mathtt{L}$ or $\mathtt{R}$, $1\le x\le n$) — the type of the $i$-th operation and the selected index.

  * If $op=\mathtt{L}$, this operation is a prefix addition on index $x$;    * If $op=\mathtt{R}$, this operation is a suffix addition on index $x$.

It is guaranteed that:

  * the sum of $n$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $m$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $V^2$ over all test cases does not exceed $4\cdot 10^6$.

Output: For each test case, output $V$ integers in a single line, the $i$-th integer denoting the maximum possible beauty after Kevin performs some new operations when $v=i$.

Examples:
input:
5
3 3 2
1 2 4
L 3
R 3
L 1
3 3 2
5 1 4
L 3
R 3
L 1
5 4 5
1 1 1 1 1
L 3
R 2
L 5
L 4
10 12 9
10 9 8 7 6 5 4 3 2 1
L 2
L 4
R 4
R 4
L 6
R 8
L 3
L 2
R 1
R 10
L 8
L 1
1 1 4
1000000000
L 1
output:
2 6
1 9
0 1 3 5 5
0 0 0 6 25 32 35 44 51
1000000000 1000000000 1000000000 1000000000

Note: In the first test case, the array $a$ changes as follows for the initial operations: $[0, 0, 0] \xrightarrow{\mathtt{L}\ 3} [1, 1, 1] \xrightarrow{\mathtt{R}\ 3} [1, 1, 2] \xrightarrow{\mathtt{L}\ 1} [2, 1, 2]$.

  * For $v=1$, it is optimal to not perform any new operations, and the beauty is $b=c_2=2$;    * For $v=2$, it is optimal to perform a prefix addition operation on index $2$. After that, $a$ becomes $[3,2,2]$, and the beauty is $b=c_2+c_3=6$.

In the second test case, for both $v=1$ and $v=2$, it is optimal to not perform any new operations.

Buggy Code:
#include <bits/stdc++.h>
#define f first
#define s second
#define int li

using namespace std;
using li = long long;
using ld = long double;
const int N = 4005;
const int INF = 1e18;

int t1[N][N], t2[N][N];

int get(int t[N][N], int j, int r)
{
    int ans = -INF;

    for(; r >= 0; r = (r & r + 1) - 1)
        ans = max(ans, t[j][r]);

    return ans;
}

void upd(int t[N][N], int j, int i, int x)
{
    for(; i < N; i |= i + 1)
        t[j][i] = max(t[j][i], x);
}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int t;
    cin >> t;

    while(t--)
    {
        int n, m, v;
        cin >> n >> m >> v;

        vector <int> c(n);

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

        vector <int> dif(n + 1);

        for(int i = 0; i < m; i++)
        {
            char c;
            int x;
            cin >> c >> x;
            x--;

            if(c == 'L')
            {
                dif[0]++;
                dif[x + 1]--;
            }
            else
            {
                dif[x]++;
            }
        }

        for(int i = 1; i < n; i++)
            dif[i] += dif[i - 1];

        vector <int> b, cb;

        for(int i = 0; i < n; i++)
            if(dif[i] <= v)
            {
                b.push_back(v - dif[i]);
                cb.push_back(c[i]);
            }

        vector <int> nb, ncb;
        nb.push_back(v);
        ncb.push_back(0);

//        for(int i = 0; i < b.size(); i++)
//        {
//            nb.push_back(b[i]);
//            ncb.push_back(cb[i]);
//        }

        int curc = 0;

        for(int i = 0; i < b.size(); i++)
        {
            if(i > 0 && b[i] != b[i - 1])
            {
                nb.push_back(b[i - 1]);
                ncb.push_back(curc);
                curc = cb[i];
            }
            else curc += cb[i];
        }

        if(b.size())
        {
            nb.push_back(b.back());
            ncb.push_back(curc);
        }

//        cout << "!!!!" << endl;
//
//        for(auto x:nb)
//            cout << x << ' ';
//
//        cout << endl;
//
//        for(auto x:ncb)
//            cout << x << ' ';
//
//        cout << endl;

        n = nb.size();
        b = nb;
        c = ncb;

        int dp[n][v + 1], dp2[n][v + 1];

        for(int i = 0; i < n; i++)
            for(int j = 0; j <= v; j++)
                dp[i][j] = dp2[i][j] = -INF;

        dp[0][0] = 0;

        vector <int> ans(v + 1);

        for(int i = 0; i <= v; i++)
            for(int j = 0; j <= 2 * v; j++)
                t1[i][j] = t2[i][j] = -INF;

        for(int i = 0; i < n; i++)
        {
            for(int j = 0; j <= v; j++)
            {
                dp[i][j] = max(dp[i][j], get(t1, j, b[i]) + c[i]);
                dp[i][j] = max(dp[i][j], get(t2, j + b[i], v - b[i]) + c[i]);
                upd(t1, j, b[i], dp[i][j]);
                upd(t2, j + b[i], v - b[i], dp[i][j]);

//                for(int ni = i + 1; ni < n; ni++)
//                {
//                    if(b[ni] >= b[i])
//                        dp[ni][j] = max(dp[ni][j], dp[i][j] + c[ni]);
//                    if(b[ni] < b[i] && j + b[i] - b[ni] <= v)
//                    {
//                        int nj = j + b[i] - b[ni];
//                        dp[ni][nj] = max(dp[ni][nj], dp[i][j] + c[ni]);
//                    }
//                }

                ans[j] = max(ans[j], dp[i][j]);
            }
        }

        for(int i = 1; i <= v; i++)
            ans[i] = max(ans[i], ans[i - 1]);

        for(int i = 1; i <= v; i++)
            cout << ans[i] << ' ';

        cout << "\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
1
5 4 5
1 2 3 4 5
L 1
R 5
L 3
R 2
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Balanced Problem
time_limit_ms: 3000
memory_limit_mb: 1024
Description: There is an array $a$ consisting of $n$ integers. Initially, all elements of $a$ are equal to $0$.

Kevin can perform several operations on the array. Each operation is one of the following two types:

  * Prefix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $1\le j\le x$, increases $a_j$ by $1$;    * Suffix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $x\le j\le n$, increases $a_j$ by $1$.

In the country of KDOI, people think that the integer $v$ is balanced. Thus, Iris gives Kevin an array $c$ consisting of $n$ integers and defines the beauty of the array $a$ as follows:

  * Initially, set $b=0$;    * For each $1\le i\le n$, if $a_i=v$, add $c_i$ to $b$;    * The beauty of $a$ is the final value of $b$.

Kevin wants to maximize the beauty of $a$ after all the operations. However, he had already performed $m$ operations when he was sleepy. Now, he can perform an arbitrary number (possibly zero) of new operations.

You have to help Kevin find the maximum possible beauty if he optimally performs the new operations.

However, to make sure that you are not just rolling the dice, Kevin gives you an integer $V$, and you need to solve the problem for each $1\le v\le V$.

Input: Each test contains multiple test cases. The first line of the input contains a single integer $t$ ($1\le t\le 1000$) — the number of test cases. The description of test cases follows.

The first line of each test case contains three integers $n$, $m$, and $V$ ($1\le n, m\le 2\cdot 10^5$, $1\le V\le 2000$) — the length of the array $a$, the number of initial operations, and the number that Kevin gives you.

The second line contains $n$ integers $c_1, c_2, \ldots, c_n$ ($1\le c_i\le 10^9$) — the elements in the array $c$.

Then $m$ lines follow, the $i$-th line containing a character $op$ and an integer $x$ ($op=\mathtt{L}$ or $\mathtt{R}$, $1\le x\le n$) — the type of the $i$-th operation and the selected index.

  * If $op=\mathtt{L}$, this operation is a prefix addition on index $x$;    * If $op=\mathtt{R}$, this operation is a suffix addition on index $x$.

It is guaranteed that:

  * the sum of $n$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $m$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $V^2$ over all test cases does not exceed $4\cdot 10^6$.

Output: For each test case, output $V$ integers in a single line, the $i$-th integer denoting the maximum possible beauty after Kevin performs some new operations when $v=i$.

Examples:
input:
5
3 3 2
1 2 4
L 3
R 3
L 1
3 3 2
5 1 4
L 3
R 3
L 1
5 4 5
1 1 1 1 1
L 3
R 2
L 5
L 4
10 12 9
10 9 8 7 6 5 4 3 2 1
L 2
L 4
R 4
R 4
L 6
R 8
L 3
L 2
R 1
R 10
L 8
L 1
1 1 4
1000000000
L 1
output:
2 6
1 9
0 1 3 5 5
0 0 0 6 25 32 35 44 51
1000000000 1000000000 1000000000 1000000000

Note: In the first test case, the array $a$ changes as follows for the initial operations: $[0, 0, 0] \xrightarrow{\mathtt{L}\ 3} [1, 1, 1] \xrightarrow{\mathtt{R}\ 3} [1, 1, 2] \xrightarrow{\mathtt{L}\ 1} [2, 1, 2]$.

  * For $v=1$, it is optimal to not perform any new operations, and the beauty is $b=c_2=2$;    * For $v=2$, it is optimal to perform a prefix addition operation on index $2$. After that, $a$ becomes $[3,2,2]$, and the beauty is $b=c_2+c_3=6$.

In the second test case, for both $v=1$ and $v=2$, it is optimal to not perform any new operations.

Buggy Code:
#include<bits/stdc++.h>
using std::cin;
using std::cout;
using std::string;
typedef long long lli;

const int N=2e5,M=5e3;
int n,m,V,rc[N+5];
int cf[N+5];

int va[N+5];lli vc[N+5];int vt;

struct FTree {
	lli mx[M+5];
	inline void ins(int x,lli z) {
		for(;x<=V;x+=x&-x)mx[x]=std::max(mx[x],z);
	}
	inline lli qry(int x) {
		lli z=0;
		for(;x;x-=x&-x)z=std::max(z,mx[x]);
		return z;
	}
	inline void clear() {
		std::fill(mx+1,mx+V+1,0);
	}
}ft1[M+5],ft2[M+5];
lli f[M+5][M+5];

inline void solve() {
	cin>>n>>m>>V;
	for(int i=1;i<=n;++i)cin>>rc[i];
	for(int i=1;i<=m;++i) {
		string o;int x;
		cin>>o>>x;
		if(o=="L")++cf[1],--cf[x+1];
		else ++cf[x];
	}

	for(int i=1,nv=0;i<=n;++i) {
		nv+=cf[i];
		if(nv<=V) {
			if(vt==0||nv!=va[vt])++vt,va[vt]=va[vt-1]+cf[i],vc[vt]=rc[i];
			else vc[vt]+=rc[i];
		}
	}
	for(int i=1;i<=vt;++i)++va[i];++V;

	for(int i=1;i<=vt;++i) {
		for(int j=1;j<=V;++j) {
			f[i][j]=ft1[j].qry(V+1-va[i])+vc[i];
			if(j>=va[i])f[i][j]=std::max(f[i][j],ft2[j-va[i]].qry(va[i])+vc[i]);
			f[i][j]=std::max(f[i][j],f[i][j-1]);
		}
		for(int j=va[i];j<=V;++j)
			ft1[j].ins(V+1-va[i],f[i][j]),ft2[j-va[i]].ins(va[i],f[i][j]);
	}

	lli a=0;
	for(int i=1;i<=V;++i) {
		a=std::max(a,ft1[i].qry(V));
		if(i>1)cout<<a<<' ';
	}
	cout<<'\n';
}
inline void clear() {
	for(int i=1;i<=vt;++i)std::fill(f[i]+1,f[i]+V+1,0);
	for(int i=0;i<=V;++i)ft1[i].clear(),ft2[i].clear();
	std::fill(cf+1,cf+n+2,0);
	vt=0;
}

int main() {
	std::ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);

	int t;
	cin>>t;
	while(t--) {
		if(t==900)return 0;
		solve();
		clear();
	}

	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
1
5 4 5
1 1 1 1 1
L 3
R 2
L 5
L 4
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Balanced Problem
time_limit_ms: 3000
memory_limit_mb: 1024
Description: There is an array $a$ consisting of $n$ integers. Initially, all elements of $a$ are equal to $0$.

Kevin can perform several operations on the array. Each operation is one of the following two types:

  * Prefix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $1\le j\le x$, increases $a_j$ by $1$;    * Suffix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $x\le j\le n$, increases $a_j$ by $1$.

In the country of KDOI, people think that the integer $v$ is balanced. Thus, Iris gives Kevin an array $c$ consisting of $n$ integers and defines the beauty of the array $a$ as follows:

  * Initially, set $b=0$;    * For each $1\le i\le n$, if $a_i=v$, add $c_i$ to $b$;    * The beauty of $a$ is the final value of $b$.

Kevin wants to maximize the beauty of $a$ after all the operations. However, he had already performed $m$ operations when he was sleepy. Now, he can perform an arbitrary number (possibly zero) of new operations.

You have to help Kevin find the maximum possible beauty if he optimally performs the new operations.

However, to make sure that you are not just rolling the dice, Kevin gives you an integer $V$, and you need to solve the problem for each $1\le v\le V$.

Input: Each test contains multiple test cases. The first line of the input contains a single integer $t$ ($1\le t\le 1000$) — the number of test cases. The description of test cases follows.

The first line of each test case contains three integers $n$, $m$, and $V$ ($1\le n, m\le 2\cdot 10^5$, $1\le V\le 2000$) — the length of the array $a$, the number of initial operations, and the number that Kevin gives you.

The second line contains $n$ integers $c_1, c_2, \ldots, c_n$ ($1\le c_i\le 10^9$) — the elements in the array $c$.

Then $m$ lines follow, the $i$-th line containing a character $op$ and an integer $x$ ($op=\mathtt{L}$ or $\mathtt{R}$, $1\le x\le n$) — the type of the $i$-th operation and the selected index.

  * If $op=\mathtt{L}$, this operation is a prefix addition on index $x$;    * If $op=\mathtt{R}$, this operation is a suffix addition on index $x$.

It is guaranteed that:

  * the sum of $n$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $m$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $V^2$ over all test cases does not exceed $4\cdot 10^6$.

Output: For each test case, output $V$ integers in a single line, the $i$-th integer denoting the maximum possible beauty after Kevin performs some new operations when $v=i$.

Examples:
input:
5
3 3 2
1 2 4
L 3
R 3
L 1
3 3 2
5 1 4
L 3
R 3
L 1
5 4 5
1 1 1 1 1
L 3
R 2
L 5
L 4
10 12 9
10 9 8 7 6 5 4 3 2 1
L 2
L 4
R 4
R 4
L 6
R 8
L 3
L 2
R 1
R 10
L 8
L 1
1 1 4
1000000000
L 1
output:
2 6
1 9
0 1 3 5 5
0 0 0 6 25 32 35 44 51
1000000000 1000000000 1000000000 1000000000

Note: In the first test case, the array $a$ changes as follows for the initial operations: $[0, 0, 0] \xrightarrow{\mathtt{L}\ 3} [1, 1, 1] \xrightarrow{\mathtt{R}\ 3} [1, 1, 2] \xrightarrow{\mathtt{L}\ 1} [2, 1, 2]$.

  * For $v=1$, it is optimal to not perform any new operations, and the beauty is $b=c_2=2$;    * For $v=2$, it is optimal to perform a prefix addition operation on index $2$. After that, $a$ becomes $[3,2,2]$, and the beauty is $b=c_2+c_3=6$.

In the second test case, for both $v=1$ and $v=2$, it is optimal to not perform any new operations.

Buggy Code:
import sys
from collections import defaultdict

input = sys.stdin.read
N = int(2e5 + 2)
M = 4002

def upd(x, y, z):
    x += 1
    y += 1
    for i in range(x, v + 2):
        for j in range(y, v + 2):
            t[i][j] = max(t[i][j], z)

def qry(x, y):
    x += 1
    y += 1
    z = 0
    for i in range(x, 0, -1):
        for j in range(y, 0, -1):
            z = max(z, t[i][j])
    return z

data = input().split()
index = 0
T = int(data[index])
index += 1

for _ in range(T):
    n = int(data[index])
    m = int(data[index + 1])
    v = int(data[index + 2])
    index += 3

    c = [0] * (n + 1)
    s = [0] * (n + 1)
    for i in range(1, n + 1):
        c[i] = int(data[index])
        s[i] = 0
        index += 1

    for _ in range(m):
        op = data[index]
        x = int(data[index + 1])
        index += 2
        if op == 'L':
            s[1] += 1
            if x + 1 <= n:
                s[x + 1] -= 1
        else:
            s[x] += 1

    for i in range(1, n + 1):
        s[i] += s[i - 1]

    g = []
    i = 1
    while i <= n:
        j = i
        C = 0
        while j <= n and s[j] == s[i]:
            C += c[j]
            j += 1
        if s[i] <= v:
            g.append((s[i], C))
        i = j

    t = [[0] * (M) for _ in range(M)]
    f = [0] * (M)

    for x, val in g:
        for i in range(0, v + 1 - x):
            f[i] = qry(i, i + x)
        for i in range(0, v + 1 - x):
            upd(i, i + x, f[i] + val)

    result = []
    for i in range(1, v + 1):
        result.append(qry(v, i))

    print(' '.join(map(str, 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
5 5 5
1 2 3 4 5
L 5
R 5
L 1
R 1
L 3
5 5 5
1 1 1 1 1
L 5
R 5
L 1
R 1
L 3
5 5 5
1 10 100 1000 10000
L 5
R 5
L 1
R 1
L 3
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Balanced Problem
time_limit_ms: 3000
memory_limit_mb: 1024
Description: There is an array $a$ consisting of $n$ integers. Initially, all elements of $a$ are equal to $0$.

Kevin can perform several operations on the array. Each operation is one of the following two types:

  * Prefix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $1\le j\le x$, increases $a_j$ by $1$;    * Suffix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $x\le j\le n$, increases $a_j$ by $1$.

In the country of KDOI, people think that the integer $v$ is balanced. Thus, Iris gives Kevin an array $c$ consisting of $n$ integers and defines the beauty of the array $a$ as follows:

  * Initially, set $b=0$;    * For each $1\le i\le n$, if $a_i=v$, add $c_i$ to $b$;    * The beauty of $a$ is the final value of $b$.

Kevin wants to maximize the beauty of $a$ after all the operations. However, he had already performed $m$ operations when he was sleepy. Now, he can perform an arbitrary number (possibly zero) of new operations.

You have to help Kevin find the maximum possible beauty if he optimally performs the new operations.

However, to make sure that you are not just rolling the dice, Kevin gives you an integer $V$, and you need to solve the problem for each $1\le v\le V$.

Input: Each test contains multiple test cases. The first line of the input contains a single integer $t$ ($1\le t\le 1000$) — the number of test cases. The description of test cases follows.

The first line of each test case contains three integers $n$, $m$, and $V$ ($1\le n, m\le 2\cdot 10^5$, $1\le V\le 2000$) — the length of the array $a$, the number of initial operations, and the number that Kevin gives you.

The second line contains $n$ integers $c_1, c_2, \ldots, c_n$ ($1\le c_i\le 10^9$) — the elements in the array $c$.

Then $m$ lines follow, the $i$-th line containing a character $op$ and an integer $x$ ($op=\mathtt{L}$ or $\mathtt{R}$, $1\le x\le n$) — the type of the $i$-th operation and the selected index.

  * If $op=\mathtt{L}$, this operation is a prefix addition on index $x$;    * If $op=\mathtt{R}$, this operation is a suffix addition on index $x$.

It is guaranteed that:

  * the sum of $n$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $m$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $V^2$ over all test cases does not exceed $4\cdot 10^6$.

Output: For each test case, output $V$ integers in a single line, the $i$-th integer denoting the maximum possible beauty after Kevin performs some new operations when $v=i$.

Examples:
input:
5
3 3 2
1 2 4
L 3
R 3
L 1
3 3 2
5 1 4
L 3
R 3
L 1
5 4 5
1 1 1 1 1
L 3
R 2
L 5
L 4
10 12 9
10 9 8 7 6 5 4 3 2 1
L 2
L 4
R 4
R 4
L 6
R 8
L 3
L 2
R 1
R 10
L 8
L 1
1 1 4
1000000000
L 1
output:
2 6
1 9
0 1 3 5 5
0 0 0 6 25 32 35 44 51
1000000000 1000000000 1000000000 1000000000

Note: In the first test case, the array $a$ changes as follows for the initial operations: $[0, 0, 0] \xrightarrow{\mathtt{L}\ 3} [1, 1, 1] \xrightarrow{\mathtt{R}\ 3} [1, 1, 2] \xrightarrow{\mathtt{L}\ 1} [2, 1, 2]$.

  * For $v=1$, it is optimal to not perform any new operations, and the beauty is $b=c_2=2$;    * For $v=2$, it is optimal to perform a prefix addition operation on index $2$. After that, $a$ becomes $[3,2,2]$, and the beauty is $b=c_2+c_3=6$.

In the second test case, for both $v=1$ and $v=2$, it is optimal to not perform any new operations.

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

#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define make_unique(x) sort(all(x)), x.erase(unique(all(x)), x.end())

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 Rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int N = 2e3 + 200;
const int M = 2e5;
const int inf = 2e9 + 3;
const ll INF = 1e18;

int T;
int n, m, V;
int was[2][N], Was[2][N];
long long dp[2 * N][N], ans[N];
long long c[N], C[N];

void solve() {
    cin >> n >> m >> V;
    for (int i = 0; i <= n + 1; ++i) {
        was[0][i] = was[1][i] = 0;
    }
    for (int i = 1; i <= n; ++i) {
        cin >> c[i];
    }
    for (int i = 1; i <= m; ++i) {
        char c;
        int x;
        cin >> c >> x;
        was[c == 'R'][x]++;
    }
    for (int i = 1; i <= n; ++i) {
        was[1][i] += was[1][i - 1];
    }
    for (int i = n; i >= 1; --i) {
        was[0][i] += was[0][i + 1];
    }
    int sz = 0;
    long long sum = 0;
    for (int i = 1; i <= n; ++i) {
        if (was[0][i] + was[1][i] > V)
            continue;
        if (i == 1 || was[0][i] != was[0][i - 1] || was[1][i] != was[1][i - 1]) {
            ++sz;
            C[sz] = c[i];
            Was[0][sz] = was[0][i];
            Was[1][sz] = was[1][i];
        }
        else {
            C[sz] += c[i];
        }
    }
    n = sz;
    /* for (int i = 1; i <= n; ++i) { */
    /*     cout << C[i] << " " << Was[0][i] << " " << Was[1][i] << '\n'; */
    /* } */
    assert(n <= 2 * V);
    for (int i = 1; i <= n; ++i) {
        for (int k = 0; k <= V; ++k) {
            dp[i][k] = -INF;
        }
    }
    for (int i = 1; i <= V; ++i)
        ans[i] = 0;
    for (int i = 1; i <= n; ++i) {
        dp[i][Was[1][i]] = max(dp[i][Was[1][i]], C[i]);
        for (int k = 0; k <= V; ++k) {
            if (k + Was[0][i] <= V)
                ans[k + Was[0][i]] = max(ans[k + Was[0][i]], dp[i][k]);
            for (int j = i + 1; j <= n; ++j) {
                int nk = k + max(Was[0][i] - Was[0][j], Was[1][j] - Was[1][i]);
                dp[j][nk] = max(dp[j][nk], dp[i][k] + C[j]);
            }
        }
    }
    for (int i = 1; i <= V; ++i) {
        ans[i] = max(ans[i], ans[i - 1]);
        cout << ans[i] << " \n"[i == V];
    }
}

int main() {
    cin.tie(0)->sync_with_stdio(0);
    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
5
3 2 3
1 2 3
L 2
R 2
4 3 4
10 20 30 40
L 3
R 2
L 4
2 1 2
1 1
R 1
5 2 5
1 1 1 1 1
L 1
R 5
1 1 1
1000000000
L 1
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Balanced Problem
time_limit_ms: 3000
memory_limit_mb: 1024
Description: There is an array $a$ consisting of $n$ integers. Initially, all elements of $a$ are equal to $0$.

Kevin can perform several operations on the array. Each operation is one of the following two types:

  * Prefix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $1\le j\le x$, increases $a_j$ by $1$;    * Suffix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $x\le j\le n$, increases $a_j$ by $1$.

In the country of KDOI, people think that the integer $v$ is balanced. Thus, Iris gives Kevin an array $c$ consisting of $n$ integers and defines the beauty of the array $a$ as follows:

  * Initially, set $b=0$;    * For each $1\le i\le n$, if $a_i=v$, add $c_i$ to $b$;    * The beauty of $a$ is the final value of $b$.

Kevin wants to maximize the beauty of $a$ after all the operations. However, he had already performed $m$ operations when he was sleepy. Now, he can perform an arbitrary number (possibly zero) of new operations.

You have to help Kevin find the maximum possible beauty if he optimally performs the new operations.

However, to make sure that you are not just rolling the dice, Kevin gives you an integer $V$, and you need to solve the problem for each $1\le v\le V$.

Input: Each test contains multiple test cases. The first line of the input contains a single integer $t$ ($1\le t\le 1000$) — the number of test cases. The description of test cases follows.

The first line of each test case contains three integers $n$, $m$, and $V$ ($1\le n, m\le 2\cdot 10^5$, $1\le V\le 2000$) — the length of the array $a$, the number of initial operations, and the number that Kevin gives you.

The second line contains $n$ integers $c_1, c_2, \ldots, c_n$ ($1\le c_i\le 10^9$) — the elements in the array $c$.

Then $m$ lines follow, the $i$-th line containing a character $op$ and an integer $x$ ($op=\mathtt{L}$ or $\mathtt{R}$, $1\le x\le n$) — the type of the $i$-th operation and the selected index.

  * If $op=\mathtt{L}$, this operation is a prefix addition on index $x$;    * If $op=\mathtt{R}$, this operation is a suffix addition on index $x$.

It is guaranteed that:

  * the sum of $n$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $m$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $V^2$ over all test cases does not exceed $4\cdot 10^6$.

Output: For each test case, output $V$ integers in a single line, the $i$-th integer denoting the maximum possible beauty after Kevin performs some new operations when $v=i$.

Examples:
input:
5
3 3 2
1 2 4
L 3
R 3
L 1
3 3 2
5 1 4
L 3
R 3
L 1
5 4 5
1 1 1 1 1
L 3
R 2
L 5
L 4
10 12 9
10 9 8 7 6 5 4 3 2 1
L 2
L 4
R 4
R 4
L 6
R 8
L 3
L 2
R 1
R 10
L 8
L 1
1 1 4
1000000000
L 1
output:
2 6
1 9
0 1 3 5 5
0 0 0 6 25 32 35 44 51
1000000000 1000000000 1000000000 1000000000

Note: In the first test case, the array $a$ changes as follows for the initial operations: $[0, 0, 0] \xrightarrow{\mathtt{L}\ 3} [1, 1, 1] \xrightarrow{\mathtt{R}\ 3} [1, 1, 2] \xrightarrow{\mathtt{L}\ 1} [2, 1, 2]$.

  * For $v=1$, it is optimal to not perform any new operations, and the beauty is $b=c_2=2$;    * For $v=2$, it is optimal to perform a prefix addition operation on index $2$. After that, $a$ becomes $[3,2,2]$, and the beauty is $b=c_2+c_3=6$.

In the second test case, for both $v=1$ and $v=2$, it is optimal to not perform any new operations.

Buggy Code:
//��_G
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double DB;
const int N = 222222;
const int V = 6666;
const LL inf = 1e18;
int n,m,v,a[N],b[N];
LL c[N],f[V][V],g[V][V],h[V][V],ans[V];
char ch[111];
void cmax(LL&x,LL y){
	if(x<y)
		x=y;
}
void modify(LL*t,int i,LL x){
	while(i<=v+1){
		cmax(t[i],x);
		i+=i&-i;
	}
}
LL query(LL*t,int i){
	LL x=-inf;
	while(i){
		cmax(x,t[i]);
		i-=i&-i;
	}
	return x;
}
int main(){
	int T,i,j,x;
	scanf("%d",&T);
	while(T--){
		scanf("%d%d%d",&n,&m,&v);
		for(i=1;i<=n;i++)
			scanf("%lld",c+i);
		for(i=1;i<=n;i++)
			a[i]=0,b[i]=0;
		for(i=1;i<=m;i++){
			scanf("%s%d",ch,&x);
			if(ch[0]=='L')
				a[x]++;
			else
				b[x]++;
		}
		for(i=n-1;i>=1;i--)
			a[i]+=a[i+1];
		for(i=2;i<=n;i++)
			b[i]+=b[i-1];
		for(i=1;i<=n;i++)
			a[i]+=b[i];
		j=0;
		for(i=1;i<=n;i++){
			if(a[i]<=v){
				if(j&&a[j]==a[i])
					c[j]+=c[i];
				else
					j++,a[j]=a[i],c[j]=c[i];
			}
		}
		n=j;
		for(i=1;i<=n;i++)
			for(j=0;j<=v*2;j++)
				f[i][j]=-inf;
		for(i=0;i<=v*3;i++)
			for(j=1;j<=v+1;j++)
				g[i][j]=-inf,h[i][j]=-inf;
		for(i=1;i<=v;i++)
			ans[i]=0;
		for(i=1;i<=n;i++){
			cmax(f[i][a[i]],c[i]);
			for(j=0;j<=v*2;j++){
				cmax(f[i][j],c[i]+query(g[j-a[i]+v],1+a[i]));
				cmax(f[i][j],c[i]+query(h[j+a[i]],v+1-a[i]));
			}
			for(j=0;j<=v*2;j++)
				cmax(ans[(j+a[i]+1)/2],f[i][j]);
			for(j=0;j<=v*2;j++){
				modify(g[j-a[i]+v],1+a[i],f[i][j]);
				modify(h[j+a[i]],v+1-a[i],f[i][j]);
			}
			//for(j=0;j<=v*2;j++)
			//	if(f[i][j]>=0)
			//		cout<<i<<' '<<j<<' '<<f[i][j]<<endl;
		}
		for(i=2;i<=v;i++)
			ans[i]=max(ans[i],ans[i-1]);
		for(i=1;i<=v;i++)
			printf("%lld%c",ans[i]," \n"[i==v]);
	}
	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
1
5 10 5
1 2 3 4 5
L 1
R 1
L 2
R 2
L 3
R 3
L 4
R 4
L 5
R 5
```


**Task:**
Generate a challenging test input that exposes the bug in the buggy code of the algorithm problem:
Algorithm Problem:
Title: Balanced Problem
time_limit_ms: 3000
memory_limit_mb: 1024
Description: There is an array $a$ consisting of $n$ integers. Initially, all elements of $a$ are equal to $0$.

Kevin can perform several operations on the array. Each operation is one of the following two types:

  * Prefix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $1\le j\le x$, increases $a_j$ by $1$;    * Suffix addition — Kevin first selects an index $x$ ($1\le x\le n$), and then for each $x\le j\le n$, increases $a_j$ by $1$.

In the country of KDOI, people think that the integer $v$ is balanced. Thus, Iris gives Kevin an array $c$ consisting of $n$ integers and defines the beauty of the array $a$ as follows:

  * Initially, set $b=0$;    * For each $1\le i\le n$, if $a_i=v$, add $c_i$ to $b$;    * The beauty of $a$ is the final value of $b$.

Kevin wants to maximize the beauty of $a$ after all the operations. However, he had already performed $m$ operations when he was sleepy. Now, he can perform an arbitrary number (possibly zero) of new operations.

You have to help Kevin find the maximum possible beauty if he optimally performs the new operations.

However, to make sure that you are not just rolling the dice, Kevin gives you an integer $V$, and you need to solve the problem for each $1\le v\le V$.

Input: Each test contains multiple test cases. The first line of the input contains a single integer $t$ ($1\le t\le 1000$) — the number of test cases. The description of test cases follows.

The first line of each test case contains three integers $n$, $m$, and $V$ ($1\le n, m\le 2\cdot 10^5$, $1\le V\le 2000$) — the length of the array $a$, the number of initial operations, and the number that Kevin gives you.

The second line contains $n$ integers $c_1, c_2, \ldots, c_n$ ($1\le c_i\le 10^9$) — the elements in the array $c$.

Then $m$ lines follow, the $i$-th line containing a character $op$ and an integer $x$ ($op=\mathtt{L}$ or $\mathtt{R}$, $1\le x\le n$) — the type of the $i$-th operation and the selected index.

  * If $op=\mathtt{L}$, this operation is a prefix addition on index $x$;    * If $op=\mathtt{R}$, this operation is a suffix addition on index $x$.

It is guaranteed that:

  * the sum of $n$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $m$ over all test cases does not exceed $2\cdot 10^5$;    * the sum of $V^2$ over all test cases does not exceed $4\cdot 10^6$.

Output: For each test case, output $V$ integers in a single line, the $i$-th integer denoting the maximum possible beauty after Kevin performs some new operations when $v=i$.

Examples:
input:
5
3 3 2
1 2 4
L 3
R 3
L 1
3 3 2
5 1 4
L 3
R 3
L 1
5 4 5
1 1 1 1 1
L 3
R 2
L 5
L 4
10 12 9
10 9 8 7 6 5 4 3 2 1
L 2
L 4
R 4
R 4
L 6
R 8
L 3
L 2
R 1
R 10
L 8
L 1
1 1 4
1000000000
L 1
output:
2 6
1 9
0 1 3 5 5
0 0 0 6 25 32 35 44 51
1000000000 1000000000 1000000000 1000000000

Note: In the first test case, the array $a$ changes as follows for the initial operations: $[0, 0, 0] \xrightarrow{\mathtt{L}\ 3} [1, 1, 1] \xrightarrow{\mathtt{R}\ 3} [1, 1, 2] \xrightarrow{\mathtt{L}\ 1} [2, 1, 2]$.

  * For $v=1$, it is optimal to not perform any new operations, and the beauty is $b=c_2=2$;    * For $v=2$, it is optimal to perform a prefix addition operation on index $2$. After that, $a$ becomes $[3,2,2]$, and the beauty is $b=c_2+c_3=6$.

In the second test case, for both $v=1$ and $v=2$, it is optimal to not perform any new operations.

Buggy Code:
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=200010,maxv=2010;
int i,j,k,n,m,v,a[maxn];
ll val[maxn],len[maxn];
int tmp[maxn],cnt;
int det[maxn];
ll dp[maxv*2][maxv],Max[maxv*2];
ll tMax[maxv][maxv],tS[maxv][2*maxv];
ll tree[2][maxv][maxv*2];
int lb(int x){return x&(-x);}
void change(int x,int id0,int id1,ll s){
    for(;x<=v+1;x+=lb(x))tree[id0][id1][x]=max(tree[id0][id1][x],s);
}
ll find(int x,int id0,int id1){
    ll s=0;for(;x;x-=lb(x))s=max(s,tree[id0][id1][x]);return s;
}
int main(){
    int T;cin>>T;
    int b=(T==1000);
    while(T--){
        scanf("%d%d%d",&n,&m,&v);
        for(int i=1;i<=n;i++)a[i]=len[i]=val[i]=tmp[i]=det[i]=0;
        for(int i=1;i<=n;i++)scanf("%lld",&val[i]);
        for(int i=1;i<=m;i++){
            char c;
            do c=getchar();
            while(c!='L' && c!='R');
            int x;scanf("%d",&x);
            if(c=='L')a[1]++,a[x+1]--;
            else a[x]++;
        }
        for(int i=1;i<=n;i++)a[i]+=a[i-1];
        cnt=0;
        for(int i=1;i<=n;i++){
            if(a[i]<=v){
                for(int j=i;j<=n;){
                    for(int k=j+1;k<=n+1;k++)
                        if(k==n+1 || a[k]!=a[j]){
                            if(a[j]<=v){
                                ++cnt;
                                tmp[cnt]=a[j];
                                for(int h=j;h<k;h++)len[cnt]+=val[h];
                            }
                            j=k;
                        }
                }
                break;
            }
        }
        for(int i=1;i<=cnt;i++)det[i]=tmp[i]-tmp[i-1];
        if(!b)
        for(int i=cnt;i>=1;i--){
            for(int j=0;j<=v;j++)dp[i][j]=len[i];
            for(int k=0;k<=v;k++){
                dp[i][k]=max(dp[i][k],find(v+1-tmp[i],1,k+tmp[i])+len[i]);
                dp[i][k]=max(dp[i][k],find(tmp[i],0,k)+len[i]);
            }
            for(int j=0;j<=v;j++){
                change(tmp[i],0,j,dp[i][j]);
            }
            for(int j=0;j<=v;j++){
                change(v+1-tmp[i],1,j+tmp[i],dp[i][j]);
            }
        }
        for(int i=0;i<=v+v;i++)
            for(int j=0;j<=v+1;j++)
                tree[0][i][j]=tree[1][i][j]=0;

        for(int r=1;r<=v;r++){
            ll ans=0;
            for(int i=1;i<=cnt;i++){
                int y=r-tmp[i];
                if(y>=0)ans=max(ans,dp[i][y]);
            }
            printf("%lld ",ans);
        }puts("");
    }
}

**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 4 5
1 1 1 1 1
L 3
R 2
L 5
L 4
```