You are an expert at finding errors in code. You will be given:
- a problem statement
- input and output formats
- example input and output
- additional notes (optional)
- an incorrect code

You have to find a test-case where the buggy code fails. To do this, write a randomised test case generator script. I will then repeatedly compare the buggy code against the correct solution on the generator's outputs until a failing test case is found.

Aim for diversity and coverage in the generated tests. Feel free to vary the range of all variables as needed while staying within problem constraints.

Provide the test-case generator to me in the exact XML format I show below. Do not include anything else in your responses. Your code must be written in Python 3 or C++ 23.

```
<action>
<name>generate_tc</name>
<code>
[code to generate random test-cases]
</code>
<lang>[Python 3 | C++ 23]</lang>
</action>
```

# Example

## Statement

You have an array $$a$$ consisting of $$n$$ positive integers and you have to handle $$q$$ queries of the following types:
$$1$$ $$i$$ $$x$$: change $$a_{i}$$ to $$x$$,
$$2$$ $$l$$ $$r$$ $$k$$: check if the number of occurrences of every positive integer in the subarray $$a_{l}, a_{l+1}, \ldots a_{r}$$ is a multiple of $$k$$ (check the example for better understanding).

Time Limit: 3000ms

Memory Limit: 256 megabytes

## Input Format

The first line of the input contains two integers $$n$$ and $$q$$ ($$1 \le n , q \le 3 \cdot 10^5$$), the length of $$a$$ and the number of queries.
Next line contains $$n$$ integers $$a_{1}, a_{2}, \ldots a_{n}$$ ($$1 \le a_{i} \le 10^9$$) — the elements of $$a$$.
Each of the next $$q$$ lines describes a query. It has one of the following forms.
$$1$$ $$i$$ $$x$$, ($$1 \le i \le n$$ , $$1 \le x \le 10^9$$), or
$$2$$ $$l$$ $$r$$ $$k$$, ($$1 \le l \le r \le n$$ , $$1 \le k \le n$$).

## Output Format

For each query of the second type, if answer of the query is yes, print " YES ", otherwise print " NO ".

## Example Input

```
10 8
1234 2 3 3 2 1 1 2 3 4
2 1 6 2
1 1 1
2 1 6 2
2 1 9 2
1 10 5
2 1 9 3
1 3 5
2 3 10 2
```

## Example Output

```
NO
YES
NO
YES
YES
```

## Note

In the first query, requested subarray is $$[1234, 2, 3, 3, 2, 1]$$, and it's obvious that the number of occurrence of $$1$$ isn't divisible by $$k = 2$$. So the answer is " NO ". In the third query, requested subarray is $$[1, 2, 3, 3, 2, 1]$$, and it can be seen that the number of occurrence of every integer in this sub array is divisible by $$k = 2$$. So the answer is " YES ". In the sixth query, requested subarray is $$[1, 2, 3, 3, 2, 1, 1, 2, 3]$$, and it can be seen that the number of occurrence of every integer in this sub array is divisible by $$k = 3$$. So the answer is " YES ".

## Buggy Code

```
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,Q,q[300003][5],a[300003],ans[300003],totq,B=70;
set<int>R;
int stk[600003],tots;
struct BIT{
	int TreeAr[300003];
	int lowbit(int X){return (X&(-X));}
	void modify(int wz,int val){
		for(int i=wz;i<=n;i+=lowbit(i))TreeAr[i]+=val;
		return;
	}
	int Query(int l,int r){
		int ret=0;
		for(int i=r;i;i-=lowbit(i))ret+=TreeAr[i];
		for(int i=l-1;i>0;i-=lowbit(i))ret-=TreeAr[i];
		return ret;
	}
};
struct rndseq{
	char val[600003];
	BIT T;
}C[73];
int fff(int X){return (int)(lower_bound(stk+1,stk+tots+1,X)-stk);}
void m0dify(int wz,int v,int val){
	for(int i=1;i<=B;i++)C[i].T.modify(wz,val*C[i].val[v]);
	return;
}
ll seed=257825;
int rnd(){
	seed=(seed*4132ll+1ll*seed*seed+98521)%998244353;
	seed=(seed<<13)^seed^(seed>>5);
	seed%=998244353;
	return seed;
}
int main(){
	ios::sync_with_stdio(false);
	cin>>n>>Q;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++)R.insert(a[i]);
	for(int i=1;i<=Q;i++){
		cin>>q[i][0]>>q[i][1]>>q[i][2];
		if(q[i][0]==1)R.insert(q[i][2]);
		else{
			cin>>q[i][3];
			ans[++totq]=1;
			q[i][4]=totq;
		}
	}
	for(auto i:R)stk[++tots]=i;
	for(int i=1;i<=n;i++)a[i]=fff(a[i]);
	for(int i=1;i<=n;i++)if(q[i][0]==1)q[i][2]=fff(q[i][2]);
	for(int i=1;i<=B;i++){
		for(int j=1;j<=tots;j++)C[i].val[j]=rnd()%2;
	}
	for(int i=1;i<=n;i++)m0dify(i,a[i],1);
	for(int i=1;i<=Q;i++){
		if(q[i][0]==1){
			m0dify(q[i][1],a[q[i][1]],-1);
			a[q[i][1]]=q[i][2];
			m0dify(q[i][1],a[q[i][1]],1);
		}
		else{
			for(int j=1;j<=B;j++)if(C[j].T.Query(q[i][1],q[i][2])%q[i][3]!=0)ans[q[i][4]]=0;
		}
	}
	for(int i=1;i<=totq;i++){
		if(ans[i])cout<<"YES\n";
		else cout<<"NO\n";
	}
	return 0;
}
```

## Correct Code

```
#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;

mt19937 rnd(time(0));

const int N = 300'000 + 5;
const int Q = 300'000 + 5;
const int T = 50;
bitset<N+Q> RandomSet[T];
unordered_map<int, int> id; int cnt_id = 0;
int n, q, A[N];

struct fenwick
{
	int PartialSum[N];
	fenwick()
	{
		for(int i = 0; i < N; i++)PartialSum[i] = 0;
	}
	inline void add(int index, bool increase)
	{
		while(index < N)
		{
			PartialSum[index] += (increase? 1 : -1);
			index += index&-index;
		}
	}
	inline int get(int index)
	{
		int sum = 0;
		while(index)
		{
			sum += PartialSum[index];
			index -= index&-index;
		}
		return sum;
	}
}Fen[T];

inline int GetId(const int x)
{
	auto id_iterator = id.find(x);
	if(id_iterator == id.end())
	{
		return id[x] = cnt_id++;
	}
	else return (*id_iterator).second;
}

inline void ChooseRandomSets()
{
	for(int i = 0; i < T; i++)
	{
		for(int j = 0; j < N+Q; j++)
		{
			if(rnd()&1)RandomSet[i].set(j);
		}
	}
}

inline void AddArrayToFenwick()
{
	for(int i = 0; i < n; i++)
	{
		int MyId = GetId(A[i]);
		for(int j = 0; j < T; j++)
		{
			if(RandomSet[j][MyId])Fen[j].add(i+1, true);
		}
	}
}

inline void Query()
{
	int index, l, r, k, x, type;
	for(int i = 0; i < q; i++)
	{
		cin >> type;
		if(type == 1)
		{
			cin >> index >> x;
			index --;
			int IdPre = GetId(A[index]);
			int IdNew = GetId(x);
			A[index] = x;
			for(int j = 0; j < T; j++)
			{
				if(RandomSet[j][IdPre])Fen[j].add(index+1, false);
				if(RandomSet[j][IdNew])Fen[j].add(index+1, true);
			}
		}
		if(type == 2)
		{
			cin >> l >> r >> k;
			l--;
			if(k == 1){cout << "YES\n"; continue;}
			else if((r-l)%k != 0){cout << "NO\n"; continue;}
			bool answer = true;
			for(int j = 0; j < T; j++)
			{
				if((Fen[j].get(r)-Fen[j].get(l))%k != 0){answer = false; break;}
			}
			cout << (answer?"YES":"NO") << '\n';
		}
	}
}

int main()
{
    ios::sync_with_stdio(false) , cin.tie(0);
    ChooseRandomSets();
    cin >> n >> q;
    for(int i = 0; i < n; i++) cin >> A[i];
    AddArrayToFenwick();
    Query();
    return 0;
}
```

## You would respond with:

```
<action>
<name>generate_tc</name>
<code>
import random
MXN, MXQ = 100, 100

n, q = random.randint(1, MXN), random.randint(MXQ, MXQ)
print(n, q)
print(' '.join(str(random.randint(1, n)) for _ in range(n)))
for _ in range(q):
    if random.randint(0, 1):
        i, x = random.randint(1, n), random.randint(1, n)
        print(1, i, x)
    else:
        l, r, k = random.randint(1, n), random.randint(1, n), random.randint(1, 5)
        print(2, min(l, r), max(l, r), k)
</code>
<lang>Python 3</lang>
</action>
```