QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#459864#8731. SegregacijaCrysfly100 ✓347ms65968kbC++173.5kb2024-06-30 15:27:102024-06-30 15:27:10

Judging History

你现在查看的是最新测评结果

  • [2024-06-30 15:27:10]
  • 评测
  • 测评结果:100
  • 用时:347ms
  • 内存:65968kb
  • [2024-06-30 15:27:10]
  • 提交

answer

// what is matter? never mind. 
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2") 
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
#define int long long
#define ull unsigned long long
#define SZ(x) ((int)((x).size()))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
inline int read()
{
	char c=getchar();int x=0;bool f=0;
	for(;!isdigit(c);c=getchar())f^=!(c^45);
	for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
	if(f)x=-x;return x;
}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;

#define maxn 2000045
#define inf 0x3f3f3f3f3f3f3f3f

int n,q,all,L,R;
int a[maxn][3];
char s[maxn];
int sum,c1,c2,b[maxn];

int C2(int x){
	return x*(x+1)/2;
}

int w[maxn];

int mn[maxn<<2],tag[maxn<<2];
void pt(int p,int v){
	tag[p]+=v,mn[p]+=v;
}
void down(int p){
	if(tag[p]) pt(p<<1,tag[p]),pt(p<<1|1,tag[p]),tag[p]=0;
}
void up(int p){
	mn[p]=min(mn[p<<1],mn[p<<1|1]);
}
void build(int p,int l,int r){
	if(l==r)return mn[p]=w[l],void();
	int mid=l+r>>1;
	build(p<<1,l,mid);
	build(p<<1|1,mid+1,r);
	up(p);
}
void add(int p,int l,int r,int nl,int nr,int v){
	if(nl>nr)return;
	if(l>=nl&&r<=nr)return pt(p,v);
	int mid=l+r>>1; down(p);
	if(nl<=mid)add(p<<1,l,mid,nl,nr,v);
	if(nr>mid)add(p<<1|1,mid+1,r,nl,nr,v); up(p);
}
int ask(int p,int l,int r,int ql,int qr){
	if(l>=ql&&r<=qr)return mn[p];
	int mid=l+r>>1; down(p);
	int res=1e18;
	if(ql<=mid)res=min(res,ask(p<<1,l,mid,ql,qr));
	if(qr>mid)res=min(res,ask(p<<1|1,mid+1,r,ql,qr));
	return res;
}

void swp(int x,int y,int xx,int yy){
	if(a[x][y]==a[xx][yy]) return;
	sum-=a[x][y]*x+a[xx][yy]*xx;
	c1-=(a[x][y] && y==1),c1-=(a[xx][yy] && yy==1);
	swap(a[x][y],a[xx][yy]);
	sum+=a[x][y]*x+a[xx][yy]*xx;
	c1+=(a[x][y] && y==1),c1+=(a[xx][yy] && yy==1);
	c2=all-c1;
	if(x==xx) return;
	if(x>xx) swap(x,xx);
	int lstb=b[x];
	b[x]=b[x-1]+a[x][1]+a[x][2]-1;
	if(b[x]>lstb){
		add(1,L,R,L,b[x]-1,2);
	}
	if(b[x]<lstb){
		add(1,L,R,L,b[x],-2);
	}
}

void prework()
{
//	For(j,1,n)cout<<b[j]<<" "; cout<<" b\n";
//	For(i,1,n) b[i]=b[i-1]+a[i][1]+a[i][2]-1;
	For(i,L,R){
		w[i]=(all-i)-C2(i)-C2(all-i);
		// \sum max(2*(b_i-i),0ll)
	//	For(j,1,n) w[i]+=max(0ll,2*(b[j]-i));
	}
	vi B;
	For(j,1,n) B.pb(b[j]);
	sort(ALL(B));
	int now=0,cnt=0;
	Rep(i,R,L){
		now+=cnt*2;
		while(B.size() && B.back()>=i)
			now+=(B.back()-i)*2,++cnt,B.pop_back();
		w[i]+=now;
	}
	build(1,L,R);
//	For(i,0,L) cout<<w[i]<<" "; cout<<"\n";
}

int getans(){
//	prework();
//	cout<<"sum,c1 "<<sum<<" "<<c1<<"\n";
	int res=inf; //ask(1,0,L,0,min(L,c2));
	res=ask(1,L,R,L,min(R,c2));
//	For(i,L,min(R,c2)) res=min(res,w[i]);
//	cout<<"res "<<res<<"\n";
	res+=sum-c1;
	return res;
}

signed main()
{
//	freopen("b21.in","r",stdin);
//	freopen("my.out","w",stdout);
	n=read(),q=read();
	For(j,1,2){
		scanf("%s",s+1);
		For(i,1,n) a[i][j]=(s[i]=='P'),all+=a[i][j],sum+=a[i][j]*i;
	}
	For(i,1,n)c1+=a[i][1],c2+=a[i][2];
	L=max(0ll,all-n);
	R=(all-(all+1)/2);
	For(i,1,n) b[i]=b[i-1]+a[i][1]+a[i][2]-1;
	prework();
	printf("%lld\n",getans());
	For(i,1,q){
		int op=read(),y=read(),x=read();
		if(op==1) swp(x,y,x+1,y);
		else swp(x,y,x,y+1);
		printf("%lld\n",getans());
	}
	return 0;
}
/*
5 2
CPCPC
PCCPC
1 1 4
1 1 2

10 7
CCPPPCCPCP
PPPCCCPCCC
1 2 7
2 1 4
2 1 8
1 1 9
2 1 1
1 2 7
1 1 4
*/

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 7
Accepted

Test #1:

score: 7
Accepted
time: 59ms
memory: 11984kb

input:

10 1000000
PPPPPPPPPP
PPPPPPPPPP
2 1 7
1 1 3
2 1 4
2 1 10
2 1 3
1 2 3
2 1 10
2 1 5
2 1 4
2 1 2
2 1 9
2 1 2
1 1 6
2 1 9
2 1 2
2 1 7
2 1 5
1 1 8
1 2 8
2 1 9
2 1 10
1 1 7
2 1 7
2 1 9
2 1 8
1 1 1
2 1 5
2 1 2
2 1 4
2 1 10
1 2 5
1 2 1
2 1 2
1 2 6
2 1 7
1 2 2
2 1 1
1 1 5
1 2 4
2 1 10
1 1 6
2 1 1
1 1 8
1 1 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1000001 lines

Test #2:

score: 0
Accepted
time: 70ms
memory: 12072kb

input:

10 1000000
PPPPPPPPPP
PPPPPPCPCC
1 1 1
1 2 5
1 1 6
2 1 7
2 1 4
2 1 6
1 2 8
1 1 4
1 2 4
1 2 6
2 1 7
1 2 1
1 2 1
2 1 3
2 1 5
1 1 1
2 1 7
2 1 2
1 2 5
1 2 2
2 1 8
2 1 3
2 1 10
1 2 3
2 1 3
2 1 2
1 1 7
1 1 1
2 1 7
1 2 8
1 2 4
2 1 5
1 2 5
2 1 10
1 1 7
2 1 5
2 1 7
1 1 1
1 1 1
2 1 4
1 1 3
1 1 9
2 1 7
2 1 1
2...

output:

1
1
1
1
2
2
2
3
3
3
3
2
2
2
2
2
2
3
3
3
3
4
4
5
5
5
5
5
5
4
4
4
4
4
3
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
6
6
6
6
6
6
6
6
6
7
6
6
6
7
7
7
6
6
6
6
6
7
7
7
6
6
6
7
8
8
8
8
8
8
8
8
8
8
8
8
7
8
8
7
7
7
7
7
7
7
6
6
6
6
6
6
6
6
6
6
6
7
7
8
8
9
9
9
9
9
9
9
9
9
8
7
7
...

result:

ok 1000001 lines

Test #3:

score: 0
Accepted
time: 61ms
memory: 11988kb

input:

10 1000000
PPPPPPPPPP
PCPCCPPCPP
2 1 8
2 1 4
1 1 8
2 1 8
2 1 2
2 1 9
1 1 5
1 1 4
1 2 1
2 1 6
2 1 4
1 2 5
1 1 4
2 1 9
1 1 4
2 1 4
2 1 7
2 1 6
1 2 9
2 1 8
1 2 7
2 1 7
1 1 3
2 1 2
1 1 4
1 1 8
2 1 9
2 1 10
2 1 2
1 1 8
1 2 1
2 1 7
1 2 8
2 1 10
2 1 8
1 2 1
1 1 7
1 1 7
1 2 5
2 1 2
2 1 7
1 2 5
1 2 4
2 1 1
1...

output:

15
16
17
16
16
17
16
16
15
15
15
15
14
15
16
15
15
15
16
16
16
16
16
16
15
16
17
17
17
18
17
17
17
17
17
17
17
17
17
17
16
16
16
16
16
16
17
17
17
17
17
17
17
17
18
17
17
17
16
15
16
15
15
15
15
15
16
15
15
15
16
16
16
16
16
16
16
16
16
16
16
16
16
16
17
17
18
18
19
19
18
18
19
18
19
19
18
17
17
18
...

result:

ok 1000001 lines

Test #4:

score: 0
Accepted
time: 68ms
memory: 12064kb

input:

10 1000000
PCPPCPCCCP
CPPPPPPPPC
1 2 5
2 1 8
1 2 2
2 1 9
1 1 6
2 1 8
2 1 1
2 1 4
1 2 6
2 1 8
2 1 10
1 2 2
1 2 5
1 2 8
1 1 8
1 2 4
2 1 4
1 2 3
1 1 7
1 1 5
1 2 2
1 2 3
2 1 10
2 1 3
1 1 2
2 1 2
2 1 7
1 1 1
1 2 6
1 1 6
2 1 6
1 2 2
2 1 1
1 2 3
1 1 7
1 2 1
1 2 8
2 1 4
2 1 9
2 1 7
2 1 6
2 1 1
1 2 3
2 1 9
2...

output:

12
12
11
11
10
11
12
13
13
13
12
13
13
13
13
13
13
13
13
13
13
13
13
12
12
11
11
11
10
10
9
9
9
9
9
10
10
10
10
11
11
11
11
11
10
9
9
8
9
9
9
9
10
10
11
11
11
10
10
11
12
11
11
11
10
9
10
10
10
10
10
10
10
10
9
10
10
10
9
9
9
9
9
8
9
9
9
8
8
9
9
9
8
7
7
8
9
9
9
9
10
9
10
11
11
11
12
11
10
9
9
9
8
9
...

result:

ok 1000001 lines

Test #5:

score: 0
Accepted
time: 77ms
memory: 9944kb

input:

10 1000000
PPPPPPPPPP
CCCCPPCCCC
1 1 3
1 1 9
1 2 9
1 1 1
2 1 5
2 1 3
2 1 8
2 1 4
2 1 4
1 2 6
2 1 9
1 2 9
1 2 2
1 2 1
1 2 8
2 1 3
1 2 6
2 1 6
2 1 5
2 1 4
2 1 4
1 1 3
2 1 6
1 2 4
2 1 2
1 1 9
2 1 4
1 2 6
2 1 9
1 1 8
2 1 7
1 1 1
2 1 3
2 1 10
1 1 9
2 1 5
2 1 7
2 1 2
2 1 3
1 1 6
2 1 8
2 1 10
1 1 4
1 1 5
1...

output:

8
8
8
8
8
8
9
10
11
10
11
12
13
12
11
12
12
11
11
11
12
11
10
10
9
10
9
8
9
9
8
8
9
10
9
10
11
11
11
10
10
11
11
12
12
12
13
13
12
12
11
11
11
12
11
11
12
12
12
12
12
13
12
12
11
12
12
13
12
13
14
15
14
13
12
12
11
10
9
8
8
7
7
7
8
7
7
7
6
7
6
6
6
5
6
6
6
6
6
7
6
6
6
7
7
8
7
7
7
7
6
6
5
5
6
5
4
5
6
...

result:

ok 1000001 lines

Test #6:

score: 0
Accepted
time: 73ms
memory: 12280kb

input:

10 1000000
PPCCCCCPCP
CCPPCCPPCP
2 1 9
2 1 9
2 1 4
2 1 5
2 1 4
1 2 8
1 2 7
1 1 4
1 1 9
1 2 1
1 2 5
1 2 5
1 1 8
1 2 4
1 1 8
1 2 8
1 2 2
2 1 6
2 1 10
2 1 9
1 1 2
2 1 6
2 1 3
1 1 8
1 2 2
1 1 2
2 1 8
2 1 8
2 1 8
1 2 5
1 1 5
1 1 8
2 1 8
2 1 3
1 1 4
1 2 9
1 2 2
1 2 7
1 2 8
2 1 6
1 1 9
1 1 8
2 1 3
1 1 5
2 ...

output:

13
13
13
12
12
13
14
15
15
14
14
14
14
14
15
15
15
16
16
15
15
14
14
15
15
15
15
15
15
15
16
16
16
16
15
15
16
17
16
16
15
15
15
15
14
15
16
17
16
15
16
16
15
14
15
14
13
13
13
12
12
12
11
10
10
10
10
11
11
10
11
10
10
10
11
12
11
12
13
14
13
12
11
11
11
12
11
11
11
11
11
11
10
11
11
10
10
10
10
9
8...

result:

ok 1000001 lines

Test #7:

score: 0
Accepted
time: 78ms
memory: 12276kb

input:

10 1000000
PCPCPCPCPP
CCCCPCCPCC
1 1 1
1 1 7
2 1 2
2 1 6
2 1 5
1 2 5
1 2 5
2 1 9
1 2 6
2 1 2
2 1 3
1 2 6
2 1 9
1 2 3
1 2 1
1 1 2
1 2 9
1 2 6
2 1 5
2 1 8
1 2 2
2 1 5
2 1 10
2 1 10
2 1 5
2 1 3
1 1 4
1 2 3
1 2 2
2 1 2
1 1 6
2 1 4
1 1 6
2 1 7
2 1 2
2 1 2
2 1 8
1 1 7
1 2 2
1 1 9
1 1 3
2 1 6
1 1 8
2 1 9
2...

output:

14
15
16
17
17
17
18
17
18
18
17
18
18
17
18
18
19
19
19
19
19
19
19
20
19
19
20
19
19
18
17
17
17
17
17
18
17
17
16
16
16
15
15
14
14
14
15
15
15
15
15
14
14
15
15
15
16
15
14
14
14
13
14
13
13
14
13
13
14
14
15
14
13
13
12
12
13
13
13
13
13
12
12
13
13
14
14
13
14
14
13
14
13
13
12
12
12
12
13
14
...

result:

ok 1000001 lines

Test #8:

score: 0
Accepted
time: 77ms
memory: 11980kb

input:

10 1000000
PCCCCCCCCC
CPPCCPPCCC
1 1 8
1 1 5
2 1 5
1 2 1
1 1 8
1 2 5
2 1 9
1 2 3
2 1 5
2 1 3
2 1 3
1 2 7
1 2 9
2 1 7
1 2 7
1 2 3
1 2 1
1 2 3
2 1 9
1 1 9
1 2 2
2 1 1
2 1 4
1 1 6
1 1 1
2 1 6
2 1 8
2 1 7
1 2 4
2 1 6
2 1 6
2 1 6
2 1 7
2 1 9
2 1 5
2 1 5
1 1 6
2 1 10
2 1 3
2 1 4
2 1 2
2 1 4
2 1 3
1 2 6
2 ...

output:

8
8
8
8
9
9
8
8
9
8
8
8
9
9
9
8
7
6
7
7
7
8
9
8
8
8
8
8
7
7
7
7
7
8
8
9
8
8
8
7
8
8
7
8
7
7
7
6
6
6
7
7
7
7
7
6
7
8
8
7
7
7
8
9
9
9
9
10
10
10
10
10
10
9
8
8
8
7
7
7
7
7
6
7
7
7
7
7
7
7
7
7
7
8
8
8
8
8
8
8
8
8
9
9
9
9
9
8
7
7
8
7
6
6
6
6
7
8
7
7
7
6
5
5
5
5
5
4
4
4
4
4
5
5
5
4
4
4
5
5
5
5
5
5
5
6
7
...

result:

ok 1000001 lines

Test #9:

score: 0
Accepted
time: 65ms
memory: 11932kb

input:

10 1000000
CCPCCCCCCP
CPPCCCCCCC
2 1 2
1 2 1
1 1 2
1 1 9
1 1 3
1 1 8
2 1 10
1 2 3
2 1 3
2 1 8
2 1 4
2 1 8
2 1 5
2 1 9
1 1 8
1 1 9
2 1 3
2 1 6
2 1 10
1 1 3
1 1 1
2 1 7
1 1 1
1 2 8
2 1 10
2 1 10
1 2 2
2 1 5
2 1 9
1 1 1
1 1 2
2 1 10
1 2 9
2 1 1
2 1 4
2 1 1
1 2 6
2 1 3
1 1 4
2 1 3
2 1 1
1 2 7
2 1 4
2 1 ...

output:

10
9
9
9
8
9
8
8
9
9
10
10
9
9
9
10
11
11
11
12
11
10
10
11
11
10
11
11
11
11
10
9
8
8
9
8
7
7
7
8
8
9
9
9
9
9
9
10
11
12
12
11
11
11
11
11
11
11
12
12
12
11
12
12
12
11
11
11
11
10
9
9
9
8
8
8
7
7
8
9
9
8
8
8
9
9
8
8
8
8
8
7
8
9
9
9
9
9
9
9
9
10
10
10
11
11
11
10
11
11
12
12
12
12
12
13
13
13
13
13...

result:

ok 1000001 lines

Test #10:

score: 0
Accepted
time: 61ms
memory: 12016kb

input:

10 1000000
CCCCCCCCCC
CCPCCCCCCC
1 2 1
1 2 6
1 2 2
1 2 3
1 2 2
1 1 3
1 1 7
1 1 2
2 1 5
1 2 3
1 1 2
1 1 8
1 1 9
1 1 2
2 1 7
2 1 4
1 2 4
2 1 6
2 1 1
1 2 6
1 1 3
2 1 8
2 1 9
1 1 4
2 1 10
1 2 7
1 1 5
1 2 3
2 1 6
1 2 5
1 2 3
2 1 2
1 2 2
1 2 9
2 1 7
1 1 3
1 2 2
1 1 1
1 2 5
1 2 6
1 2 5
2 1 3
2 1 10
1 2 4
2...

output:

3
3
3
2
2
3
3
3
3
3
4
4
4
4
4
4
3
3
3
3
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
4
4
4
4
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
4
4
4
4
3
3
4
4
4
4
4
4
4
5
5
5
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
4
4
4
4
...

result:

ok 1000001 lines

Test #11:

score: 0
Accepted
time: 62ms
memory: 9932kb

input:

10 1000000
PPPPPPPPPP
PPPPCPPPPP
2 1 2
2 1 9
1 2 6
2 1 8
2 1 5
2 1 7
1 2 2
1 1 5
1 1 6
1 1 5
2 1 2
2 1 9
2 1 3
2 1 2
2 1 5
1 1 8
1 1 8
1 2 5
2 1 2
1 1 4
1 2 8
2 1 4
2 1 9
2 1 2
2 1 4
1 1 1
1 1 4
1 1 4
1 2 3
1 2 9
1 2 5
1 1 6
1 2 2
1 1 5
2 1 9
2 1 2
1 2 5
2 1 8
1 1 9
2 1 5
2 1 3
2 1 3
2 1 5
1 1 2
1 2...

output:

5
5
5
5
5
6
6
6
5
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
5
5
6
6
6
6
6
6
5
5
5
6
6
6
6
6
6
6
6
7
7
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
7
7
7
7
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
5
5
5
5
5
5
5
5
5
5
5
5
6
...

result:

ok 1000001 lines

Test #12:

score: 0
Accepted
time: 73ms
memory: 11988kb

input:

10 1000000
PCCPCPCCPC
CCCCCCCPCP
1 2 6
1 2 8
1 1 8
1 1 6
1 1 5
1 1 5
1 2 6
1 1 2
1 1 8
1 1 5
1 2 1
1 2 2
1 1 9
1 1 8
1 2 9
1 1 1
1 2 4
1 1 4
1 2 1
1 2 4
1 1 5
1 2 5
1 1 3
1 1 4
1 2 5
1 2 1
1 1 6
1 1 1
1 1 2
1 1 9
1 1 5
1 1 5
1 2 3
1 1 2
1 1 3
1 1 2
1 2 9
1 1 8
1 1 5
1 1 9
1 1 4
1 1 6
1 1 7
1 2 2
1 1...

output:

19
19
20
19
20
20
20
20
20
21
21
21
21
22
22
22
23
23
24
24
24
25
25
25
25
25
25
25
24
24
23
22
23
23
23
23
23
23
22
21
21
20
19
18
18
19
19
19
18
18
19
18
17
17
16
16
15
16
15
16
16
16
17
17
17
17
17
17
18
18
18
17
17
17
17
17
17
17
17
17
17
17
17
17
17
18
17
17
16
15
14
14
15
15
15
14
13
12
12
11
...

result:

ok 1000001 lines

Test #13:

score: 0
Accepted
time: 59ms
memory: 11988kb

input:

10 1000000
CCPCPCPCCC
CPPPPPCPCC
2 1 2
2 1 10
2 1 2
2 1 1
2 1 10
2 1 1
2 1 5
2 1 5
2 1 9
2 1 9
2 1 7
2 1 10
2 1 4
2 1 10
2 1 6
2 1 8
2 1 8
2 1 6
2 1 4
2 1 4
2 1 7
2 1 4
2 1 4
2 1 4
2 1 10
2 1 9
2 1 5
2 1 8
2 1 9
2 1 3
2 1 1
2 1 10
2 1 7
2 1 5
2 1 5
2 1 1
2 1 1
2 1 6
2 1 3
2 1 10
2 1 3
2 1 1
2 1 1
2 ...

output:

11
10
10
11
11
11
11
11
11
11
11
12
12
11
11
10
9
10
11
12
11
10
11
10
11
11
11
11
10
10
10
10
10
11
11
11
11
11
10
10
10
10
10
10
11
11
10
10
9
9
8
8
9
10
10
10
11
10
10
10
10
11
11
11
11
11
11
11
11
10
10
10
10
11
11
12
12
12
12
11
11
11
10
10
10
9
9
10
9
9
9
9
8
9
9
8
8
9
9
10
11
10
10
10
10
10
1...

result:

ok 1000001 lines

Test #14:

score: 0
Accepted
time: 70ms
memory: 12248kb

input:

10 1000000
PPPCCCCCCC
PPPCCCPPCC
1 2 5
1 1 9
1 2 4
1 2 5
1 1 1
1 2 9
1 1 3
1 1 8
1 2 1
1 1 5
1 1 5
1 1 1
1 2 3
1 1 5
1 1 1
1 1 2
1 2 1
1 2 1
1 1 1
1 2 6
1 1 1
1 2 8
1 1 3
1 2 3
1 1 8
1 2 8
1 2 7
1 2 7
1 1 3
1 2 5
1 2 3
1 2 5
1 1 9
1 1 7
1 1 8
1 1 5
1 1 3
1 2 3
1 1 7
1 1 5
1 2 2
1 1 7
1 2 6
1 2 6
1 1...

output:

8
8
8
8
8
8
8
7
7
7
7
7
7
8
8
8
7
7
7
8
7
6
7
7
8
8
7
6
7
7
6
7
6
6
6
6
6
6
7
7
7
7
7
8
7
7
7
7
7
6
6
6
7
7
6
7
7
7
6
7
7
7
8
8
7
8
9
9
8
9
8
8
7
7
8
8
9
10
11
11
10
9
8
9
9
9
8
7
7
7
7
7
7
7
8
9
8
8
8
8
8
7
8
8
8
7
7
8
9
9
9
8
8
8
7
8
8
9
8
9
9
9
9
10
9
10
11
12
12
12
12
12
11
12
11
11
12
13
14
15
...

result:

ok 1000001 lines

Test #15:

score: 0
Accepted
time: 68ms
memory: 12008kb

input:

10 1000000
CCPPPPPPCP
PPPPCCCPCC
2 1 6
2 1 6
2 1 3
2 1 7
2 1 7
2 1 3
2 1 8
2 1 2
2 1 2
2 1 3
2 1 3
2 1 7
2 1 7
2 1 7
2 1 9
2 1 6
2 1 3
2 1 10
2 1 10
2 1 1
2 1 8
2 1 8
2 1 3
2 1 3
2 1 1
2 1 5
2 1 10
2 1 3
2 1 9
2 1 6
2 1 1
2 1 9
2 1 9
2 1 9
2 1 7
2 1 8
2 1 10
2 1 6
2 1 5
2 1 8
2 1 3
2 1 3
2 1 1
2 1 2...

output:

8
9
8
8
9
8
8
8
7
8
8
8
9
8
9
9
10
10
11
10
9
9
9
9
9
10
11
12
12
12
11
10
10
10
10
9
9
8
9
8
8
8
8
9
8
8
8
7
6
6
7
7
7
6
7
8
9
8
9
8
7
6
6
7
7
7
6
7
8
7
7
7
8
8
8
9
8
9
9
8
8
9
10
10
9
10
10
10
11
11
12
11
11
11
10
9
10
10
10
10
9
8
8
9
10
10
9
8
9
8
9
10
10
10
9
10
9
10
10
10
10
10
9
10
9
10
10
9
...

result:

ok 1000001 lines

Subtask #2:

score: 11
Accepted

Test #16:

score: 11
Accepted
time: 64ms
memory: 12016kb

input:

5 1000000
CCCCC
CCCCC
1 2 4
2 1 1
1 1 2
2 1 1
2 1 1
1 2 4
2 1 3
2 1 3
1 2 4
2 1 4
2 1 3
2 1 4
1 1 1
1 2 2
2 1 5
1 2 1
2 1 4
1 2 3
1 2 1
2 1 2
2 1 5
2 1 4
2 1 4
2 1 3
2 1 2
1 1 2
2 1 5
2 1 3
1 1 2
1 1 2
2 1 2
2 1 4
1 1 4
2 1 2
2 1 3
2 1 4
1 2 3
1 1 1
1 1 4
2 1 4
1 1 1
1 1 3
1 1 3
2 1 5
1 2 2
2 1 5
2 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1000001 lines

Test #17:

score: 0
Accepted
time: 68ms
memory: 11984kb

input:

200 1000000
PPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPCPPCPPPPPCPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPCPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

899
899
899
899
899
899
899
899
899
899
899
899
899
899
899
899
899
899
899
899
898
898
898
898
898
898
899
899
899
899
899
899
899
899
899
899
899
899
899
899
899
899
899
899
900
900
900
900
900
900
900
900
900
900
900
900
900
900
900
900
900
900
900
900
900
900
900
900
900
900
900
900
900
900
900
...

result:

ok 1000001 lines

Test #18:

score: 0
Accepted
time: 72ms
memory: 11932kb

input:

200 1000000
PPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPP
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

488
488
488
488
488
488
488
488
488
488
488
488
488
488
488
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
489
490
490
490
490
490
490
490
491
...

result:

ok 1000001 lines

Test #19:

score: 0
Accepted
time: 67ms
memory: 11960kb

input:

200 1000000
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPCPPPPPPPCPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPCP
PPPCPPPPPPPPPPPPPPPPPPPPCPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPP...

output:

919
919
919
919
919
919
919
919
919
919
919
919
919
919
919
919
919
919
919
919
919
919
919
919
919
919
919
919
919
919
919
919
919
919
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
918
...

result:

ok 1000001 lines

Test #20:

score: 0
Accepted
time: 70ms
memory: 12244kb

input:

200 1000000
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
PPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1080
1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1079
1080
1080
1080
1080
1080
1080
1080
1080
1080
1080
1080
1080
1080
1080
1080
1080
...

result:

ok 1000001 lines

Test #21:

score: 0
Accepted
time: 101ms
memory: 52052kb

input:

1000000 1000000
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

83240
83239
83240
83239
83238
83239
83240
83239
83238
83239
83238
83237
83238
83237
83238
83239
83238
83239
83240
83239
83240
83241
83242
83243
83242
83241
83240
83241
83240
83239
83240
83239
83240
83239
83240
83239
83240
83239
83238
83239
83238
83237
83236
83235
83234
83235
83234
83235
83234
83235
...

result:

ok 1000001 lines

Test #22:

score: 0
Accepted
time: 104ms
memory: 51124kb

input:

1000000 1000000
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

1400075
1400074
1400073
1400074
1400075
1400076
1400075
1400076
1400077
1400076
1400077
1400076
1400075
1400076
1400075
1400074
1400073
1400072
1400071
1400072
1400073
1400074
1400073
1400072
1400073
1400072
1400071
1400070
1400071
1400072
1400071
1400070
1400071
1400072
1400071
1400072
1400071
1400...

result:

ok 1000001 lines

Test #23:

score: 0
Accepted
time: 120ms
memory: 50204kb

input:

1000000 1000000
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

3197689
3197690
3197689
3197688
3197687
3197688
3197687
3197686
3197685
3197684
3197683
3197684
3197683
3197682
3197681
3197680
3197679
3197680
3197679
3197678
3197677
3197676
3197675
3197676
3197677
3197678
3197677
3197678
3197679
3197678
3197679
3197680
3197681
3197682
3197683
3197682
3197683
3197...

result:

ok 1000001 lines

Test #24:

score: 0
Accepted
time: 115ms
memory: 51192kb

input:

1000000 1000000
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

3967636
3967637
3967638
3967637
3967638
3967637
3967638
3967639
3967638
3967639
3967640
3967639
3967640
3967639
3967638
3967637
3967638
3967639
3967638
3967639
3967638
3967637
3967638
3967637
3967638
3967639
3967638
3967637
3967636
3967635
3967634
3967635
3967634
3967635
3967636
3967635
3967636
3967...

result:

ok 1000001 lines

Test #25:

score: 0
Accepted
time: 115ms
memory: 51692kb

input:

1000000 1000000
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

6456264
6456265
6456266
6456267
6456266
6456265
6456264
6456265
6456264
6456263
6456264
6456265
6456266
6456267
6456268
6456269
6456270
6456269
6456270
6456271
6456270
6456269
6456270
6456269
6456270
6456271
6456272
6456271
6456270
6456269
6456270
6456269
6456270
6456271
6456270
6456269
6456268
6456...

result:

ok 1000001 lines

Test #26:

score: 0
Accepted
time: 119ms
memory: 51944kb

input:

1000000 1000000
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

5106167
5106166
5106165
5106164
5106163
5106164
5106163
5106162
5106163
5106162
5106161
5106162
5106161
5106160
5106161
5106162
5106163
5106162
5106163
5106162
5106163
5106164
5106163
5106164
5106165
5106166
5106165
5106164
5106163
5106162
5106163
5106164
5106165
5106164
5106165
5106166
5106165
5106...

result:

ok 1000001 lines

Test #27:

score: 0
Accepted
time: 111ms
memory: 50736kb

input:

1000000 1000000
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

3955961
3955960
3955959
3955958
3955957
3955956
3955955
3955956
3955955
3955956
3955957
3955958
3955957
3955956
3955955
3955954
3955953
3955952
3955953
3955954
3955955
3955954
3955955
3955956
3955957
3955958
3955959
3955960
3955961
3955962
3955961
3955960
3955959
3955958
3955959
3955958
3955957
3955...

result:

ok 1000001 lines

Test #28:

score: 0
Accepted
time: 118ms
memory: 51880kb

input:

1000000 1000000
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

5990174
5990175
5990174
5990173
5990174
5990175
5990174
5990175
5990176
5990175
5990176
5990177
5990178
5990179
5990180
5990181
5990180
5990181
5990180
5990181
5990180
5990179
5990178
5990179
5990180
5990179
5990178
5990177
5990176
5990175
5990176
5990175
5990174
5990175
5990176
5990177
5990178
5990...

result:

ok 1000001 lines

Test #29:

score: 0
Accepted
time: 103ms
memory: 53772kb

input:

1000000 1000000
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

5036404
5036403
5036404
5036403
5036402
5036401
5036400
5036399
5036400
5036399
5036400
5036401
5036402
5036401
5036402
5036401
5036400
5036399
5036400
5036401
5036402
5036403
5036402
5036401
5036402
5036403
5036402
5036401
5036402
5036403
5036402
5036403
5036402
5036403
5036404
5036405
5036406
5036...

result:

ok 1000001 lines

Test #30:

score: 0
Accepted
time: 113ms
memory: 53764kb

input:

1000000 1000000
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

6321745
6321746
6321747
6321748
6321747
6321748
6321747
6321748
6321749
6321750
6321751
6321752
6321751
6321752
6321751
6321752
6321753
6321752
6321751
6321752
6321753
6321752
6321751
6321752
6321753
6321752
6321753
6321752
6321753
6321754
6321755
6321756
6321755
6321754
6321753
6321752
6321753
6321...

result:

ok 1000001 lines

Test #31:

score: 0
Accepted
time: 72ms
memory: 12020kb

input:

8 1000000
PCPCPPCP
CCPCCCCC
2 1 1
1 1 2
1 2 1
2 1 2
2 1 4
2 1 1
1 1 3
2 1 7
1 1 3
1 2 1
2 1 8
2 1 6
2 1 6
1 1 5
2 1 4
2 1 7
2 1 2
2 1 1
2 1 6
2 1 2
1 2 4
1 2 7
1 1 4
2 1 2
2 1 2
2 1 7
2 1 8
2 1 2
1 1 4
2 1 8
2 1 2
2 1 7
2 1 1
2 1 1
2 1 7
2 1 4
1 1 5
2 1 7
2 1 3
2 1 8
1 1 1
1 1 5
2 1 7
1 2 3
2 1 2
2 ...

output:

6
7
6
7
7
7
7
7
7
7
6
7
8
7
7
7
7
8
7
8
7
7
6
5
6
5
4
4
5
6
6
5
6
7
6
5
5
6
7
6
6
6
5
4
4
5
5
6
6
7
6
5
6
7
6
7
8
8
9
9
9
9
9
9
8
9
10
9
8
9
8
7
8
8
9
10
11
12
12
12
13
12
12
13
13
14
15
14
15
14
13
14
14
15
14
14
14
13
14
14
14
15
15
14
14
14
15
14
13
13
14
14
14
13
12
12
13
14
14
14
15
15
15
16
16...

result:

ok 1000001 lines

Test #32:

score: 0
Accepted
time: 81ms
memory: 11960kb

input:

10 1000000
PCPPPPPPPP
CCCPCCCCCC
1 1 7
1 2 9
1 2 4
1 2 8
2 1 2
1 1 7
1 1 1
2 1 8
1 1 1
1 1 5
1 1 2
2 1 7
1 2 3
2 1 3
1 2 1
2 1 4
1 2 5
2 1 10
2 1 10
2 1 3
2 1 3
1 2 1
1 2 2
2 1 1
1 2 4
2 1 7
1 2 3
2 1 6
2 1 4
1 2 1
2 1 4
2 1 2
1 1 1
2 1 9
2 1 9
1 2 1
2 1 2
2 1 2
2 1 10
2 1 10
2 1 5
1 2 8
2 1 6
1 1 6...

output:

3
3
3
4
4
4
4
5
6
5
5
4
5
5
5
5
6
7
8
7
7
7
7
7
8
9
8
8
8
8
9
9
9
8
9
8
9
9
9
10
9
9
10
10
10
10
11
11
11
10
10
10
10
10
10
10
10
9
9
8
8
8
8
8
9
10
10
11
11
10
10
10
10
10
10
10
11
11
11
12
11
10
10
10
10
10
10
10
10
11
11
10
10
9
8
9
10
11
10
10
11
10
10
10
10
10
9
9
9
10
10
11
11
11
10
11
10
9
9
...

result:

ok 1000001 lines

Test #33:

score: 0
Accepted
time: 72ms
memory: 12052kb

input:

12 1000000
PCPPPPPPPPPP
CCCCPPPCCCCC
1 2 7
1 1 6
1 2 4
1 2 7
1 2 6
2 1 1
1 2 4
2 1 12
1 2 8
2 1 3
2 1 9
1 2 4
1 2 9
2 1 10
1 1 2
1 2 7
2 1 12
2 1 6
1 1 6
2 1 9
1 2 6
2 1 7
2 1 6
2 1 5
2 1 4
2 1 8
1 1 6
2 1 12
2 1 1
2 1 12
1 1 6
2 1 5
1 2 4
2 1 4
1 2 7
1 1 1
2 1 5
1 2 4
1 2 7
2 1 7
2 1 2
2 1 12
2 1 4...

output:

14
15
15
14
13
13
14
15
16
16
17
18
17
18
18
18
19
18
18
18
18
19
19
20
21
21
21
20
21
20
19
20
19
20
21
21
22
22
22
22
22
23
24
23
23
23
23
22
23
24
23
23
22
23
23
23
23
24
25
25
25
26
27
26
27
26
26
25
24
24
24
24
23
24
24
24
25
24
23
22
21
21
21
21
21
22
21
20
21
21
21
22
22
21
21
21
22
22
22
21
...

result:

ok 1000001 lines

Test #34:

score: 0
Accepted
time: 77ms
memory: 12068kb

input:

14 1000000
PPPPCPPPPPPPPP
CPCCPCCCPPCCCP
1 1 4
2 1 11
2 1 3
1 1 3
2 1 3
2 1 5
1 1 11
1 2 5
2 1 5
2 1 3
1 1 2
1 1 6
1 2 6
1 1 4
1 1 10
2 1 8
2 1 3
2 1 8
1 2 8
2 1 7
2 1 12
2 1 14
2 1 14
1 2 6
2 1 14
1 1 7
2 1 12
1 2 10
2 1 3
1 1 12
2 1 11
1 2 2
2 1 12
2 1 9
2 1 8
2 1 4
2 1 13
2 1 4
2 1 2
1 1 11
2 1 1...

output:

26
27
28
29
29
28
28
27
28
29
30
31
31
32
32
32
33
33
32
31
31
31
31
31
30
30
30
30
30
30
29
29
29
30
31
31
31
31
31
30
31
31
31
30
30
31
31
30
29
28
28
29
30
30
31
31
32
32
31
31
32
31
31
30
31
31
30
30
29
28
27
28
28
29
28
28
29
29
30
29
30
31
30
31
31
31
31
31
31
30
30
30
30
31
32
33
33
32
32
31
...

result:

ok 1000001 lines

Test #35:

score: 0
Accepted
time: 72ms
memory: 12284kb

input:

16 1000000
CPCCCPCPCPCCPCCP
PPPPPPPPPPPPPPPP
2 1 6
1 1 13
1 2 3
2 1 16
2 1 3
1 1 14
1 1 5
1 2 13
1 1 12
1 2 9
2 1 10
1 1 1
2 1 13
2 1 11
1 1 7
2 1 7
1 1 4
2 1 16
2 1 6
1 1 13
1 1 10
2 1 8
1 1 11
2 1 10
2 1 10
2 1 16
1 2 13
2 1 10
2 1 10
1 2 14
2 1 5
2 1 10
2 1 3
2 1 14
2 1 2
1 2 4
1 1 12
2 1 9
1 1 4...

output:

44
44
45
45
45
44
45
44
44
44
44
44
43
42
41
40
40
39
39
38
39
39
38
39
39
39
39
38
38
38
37
36
36
37
37
36
37
38
37
37
36
36
37
37
36
36
35
36
36
35
35
35
35
35
35
36
36
36
36
36
35
36
37
38
38
39
40
39
39
39
39
39
38
38
37
37
38
38
39
39
39
39
40
39
39
40
40
40
41
40
40
39
38
38
39
40
41
41
41
41
...

result:

ok 1000001 lines

Test #36:

score: 0
Accepted
time: 73ms
memory: 12276kb

input:

18 1000000
PPCCPPPCPPPCPPCPPC
CPCPPPPPPPPCPPPPPC
1 1 16
1 2 16
2 1 16
1 2 2
2 1 1
1 2 15
1 1 1
2 1 5
1 2 3
1 2 12
2 1 9
2 1 14
1 1 17
2 1 10
1 1 3
2 1 14
1 1 7
1 1 3
2 1 9
1 1 16
1 1 7
1 2 3
2 1 10
1 2 7
1 1 16
1 1 4
2 1 10
2 1 17
1 1 17
2 1 4
2 1 7
2 1 8
2 1 2
2 1 1
1 1 15
1 2 5
2 1 1
1 1 8
1 2 2
2...

output:

49
49
49
49
50
51
51
50
50
50
49
49
49
48
48
48
48
49
49
49
50
49
49
49
49
48
47
47
46
46
46
46
45
45
45
44
44
44
44
43
44
43
44
44
44
44
43
43
43
43
44
44
44
44
44
43
43
42
43
44
44
44
44
44
44
44
44
44
43
43
43
43
42
43
43
42
41
41
42
42
43
43
44
45
45
46
47
47
48
48
49
48
48
48
49
49
48
48
48
48
...

result:

ok 1000001 lines

Subtask #3:

score: 17
Accepted

Test #37:

score: 17
Accepted
time: 0ms
memory: 12056kb

input:

500 500
CPPPCCCCCCPCCCPPPCPCCPCCPPCPCPCCCPPPPPCCCPCPCPCCCPCPPCPPCCCPPPPPPCCCPPPCCCPPCPPCCCPPPCCPCCCCCPCPCCPCPPPCCCCPPCPCPCCCPPCPCPCCPPPPCPPPCCCCPCPPPCCPPPPCPCPCPPPPCCCCPCPPPPPPPCCPCCPCPCCPPPPCPCPCPPCPCCPPCPPCPPCCPCCPCPCCCCCCPCCCCCCCCPPPPCCCPCCPPCCPPCCCPPPPPCPCPPPCPPCPCCPPPPPCCCCCPCPPPCCCCPPCCPPCCPCC...

output:

3870
3871
3871
3871
3872
3871
3872
3872
3872
3871
3871
3871
3871
3872
3872
3871
3872
3872
3872
3871
3871
3871
3872
3871
3872
3872
3873
3874
3874
3875
3874
3873
3873
3874
3875
3874
3873
3873
3874
3874
3874
3873
3873
3873
3873
3873
3872
3871
3870
3870
3870
3871
3871
3872
3873
3872
3872
3871
3871
3872
...

result:

ok 501 lines

Test #38:

score: 0
Accepted
time: 2ms
memory: 11992kb

input:

500 500
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPCPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPCPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPCPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCCPPPPPPCPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPCPPPCPPPPPPPPCPPPPPPPPCPPPPCPPPPPPPP...

output:

13126
13126
13127
13127
13128
13128
13128
13128
13128
13129
13129
13129
13129
13129
13129
13128
13128
13128
13128
13128
13128
13128
13127
13128
13128
13128
13128
13128
13128
13128
13128
13128
13128
13129
13129
13130
13130
13130
13130
13130
13130
13130
13130
13130
13129
13129
13129
13129
13129
13129
...

result:

ok 501 lines

Test #39:

score: 0
Accepted
time: 0ms
memory: 12216kb

input:

500 500
PCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCPCCCCPCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCPCCCCCPCCCCCCCPCCCCCCCCCCCCPPCCCCCCCCCCCCPCCCCCCCCCCCCCCCPCCCCCCCCPCCCCCCCCCCCPCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCPCCPCCCCPCCCCCCCCCC...

output:

12167
12167
12166
12166
12166
12166
12166
12166
12166
12166
12166
12166
12166
12167
12167
12167
12167
12167
12167
12167
12167
12167
12167
12168
12168
12169
12169
12168
12168
12168
12169
12169
12168
12169
12169
12169
12168
12169
12170
12171
12171
12171
12171
12172
12172
12172
12173
12173
12173
12173
...

result:

ok 501 lines

Test #40:

score: 0
Accepted
time: 0ms
memory: 11992kb

input:

500 500
PPPCPPPPPPPCPPPPPPPPPPPPCPPPPCCPPPPPPPPPPPPPPPPCCPPPPPPCPPPPPPPPPCPPPPPCPPPPCPPPCPPPPPPPPPPPPPPCPPPPCPCCPCPPPCPCPPPPPCPPPCCCCPPPPCPPPPPCPCCPPPCPPCPPPPPPPPCPPPPPPPCCPPPPPCPPPCPPPPPPPCPCCPPPPPPCPPPCPPPPCCPPPPPCPPPCPPPCPPPPPPPPPPPPPPCPPCPCPPCPPPCCPPPCCCPCPPPPCCPPPPPPPPPCPCPPPPCPPCPCCPPCPCPPPCPC...

output:

31154
31154
31153
31152
31152
31153
31153
31153
31153
31153
31154
31154
31154
31154
31154
31155
31155
31155
31155
31155
31155
31155
31155
31156
31157
31157
31157
31157
31157
31157
31157
31157
31158
31158
31159
31159
31159
31159
31159
31159
31159
31159
31160
31159
31159
31159
31159
31159
31159
31159
...

result:

ok 501 lines

Test #41:

score: 0
Accepted
time: 0ms
memory: 12248kb

input:

500 500
PPPCPPPPPPPPPPPPCPPPPPPPCPPCPPPCPCPPPPPPPPPPPPPCPPPCPPPPPPPCPPPCPCCCCPPPCPCPPPPPPPPPPPPPCCPPPPPPPPPPPPPPPPPPPPPPCCPCCCPCPPPCPPPPPCCCPPPPPPPPPPCCPPPPPCPPPCPCPPCPPPPCPPPPPPCPPPPPPPPPPPPPCPPPPPPCPCPPPPPPPPPCPCPPPPPPPPPCPCCPPPPCCPCCPPPPPCPPPPCPPPPPCPPPPPPPPPCCPPPPPPPPCPPPPCPPPCCCPCPPCPPCPPPCPPPP...

output:

30155
30154
30154
30154
30154
30154
30154
30154
30154
30154
30153
30153
30154
30154
30153
30153
30152
30152
30152
30152
30151
30152
30152
30152
30152
30153
30153
30153
30153
30153
30153
30153
30154
30153
30153
30153
30153
30153
30154
30154
30155
30155
30155
30155
30154
30153
30154
30154
30154
30154
...

result:

ok 501 lines

Test #42:

score: 0
Accepted
time: 0ms
memory: 9892kb

input:

500 500
PCPPPPCCCPPPCPPPPPPCCPCCPPCCPPPPCCPPPPPCPPCPPPCCPPPCPPPCPCPCPPPPPPPCPCCPPPPPCPCPCPPCCPPPCCPPCPPPPPPCPPPPCPCPPPCPPPPPPPPPCPPPPPPPCCPPPCPPCCPCCPPPPCCPPPPPPCPPPPPPCCPPCCPPCPPPCPCPPPPPCPPPPPPCCCCPPPCCPPPCCCPCCPPPPPPPPPPPPPPPPPCPPPCPPPCPPPPPPCCPPCPPPCPCPPCPPPPPPPPPPPPPPCPPPPPPPPCPPCPPPPPCPPPCPPPP...

output:

33785
33786
33786
33786
33786
33786
33786
33786
33785
33785
33786
33786
33786
33785
33785
33785
33785
33785
33785
33785
33785
33785
33786
33785
33785
33785
33785
33785
33785
33785
33786
33786
33786
33787
33788
33787
33787
33787
33787
33787
33788
33787
33787
33788
33787
33787
33786
33786
33786
33787
...

result:

ok 501 lines

Test #43:

score: 0
Accepted
time: 0ms
memory: 12284kb

input:

500 500
PCPCPPCCPPCPCPCCPPPPCCCPCPPPCPPCPPCCPPPPPCPPPPPPPPPCPPPPCPPPPPCPCPPPPCPCPPPPCPCPPCPPPPCCPPPPPPPPPPPPPPCPPPPPCPCPPPPCPPPPPPPPPPCPPPPCPPPPPCPPPPPCCPPPPPPCPPPPPPPPPPPPPPCPPPPPPPPPCPPPCCPCCPPPPPPPPPPPPPCCPCCPPPPPPPPPCPCCPPPCCPPPPPPPPPPPPPCPPPPPPPCCPPPPPCPCPPCCPPPCCCPPCCPPPPCPCPPPCPPPPPPPPPPPCPPC...

output:

33064
33064
33064
33065
33064
33065
33065
33065
33065
33065
33064
33065
33065
33064
33065
33065
33065
33065
33066
33066
33067
33066
33066
33066
33065
33065
33064
33064
33064
33065
33065
33065
33065
33064
33063
33062
33062
33062
33063
33062
33062
33062
33062
33062
33063
33063
33063
33063
33063
33063
...

result:

ok 501 lines

Test #44:

score: 0
Accepted
time: 2ms
memory: 11992kb

input:

500 500
PPPPPCPPPPPPPPPCPCPCPPPPCPCCPPCPPPCCPCPPCPPPPPPPPPPCPPPPPPPPPPCCCCPPCPPPCPCPPPPPPPPPCPPPPPPPPPPCCPPPPPCPPCPCPPPPPPPPCCPPPPPPCPCCPPPPCPPPPCCPPCPPPPPPPPPPPPPPPPCPPPPPPPPPCPPPPPPPCCPCPPPCCPPPPPCPPPPPPPPPCPCPCPPPCCPPCPPPPCPPPCPCCPPPPCPCPPCCPCPPCCPPPCPPPPCPPPCPPPPCPPPPPPPCPPPPCPPPCCPPPPCPPPCCPPPP...

output:

31321
31321
31320
31320
31319
31319
31319
31319
31319
31318
31319
31320
31321
31320
31320
31320
31319
31319
31319
31319
31319
31319
31318
31319
31318
31318
31318
31318
31318
31318
31318
31318
31318
31319
31319
31319
31319
31319
31319
31318
31318
31318
31318
31318
31319
31320
31321
31321
31321
31321
...

result:

ok 501 lines

Test #45:

score: 0
Accepted
time: 0ms
memory: 11988kb

input:

500 500
CCPCPPPCPCCCPPPCPCPCPPPCCCCPCCPCPCPPCCPCPCCCPPCPPCPCPPPCCPPCCCCCCPCPCCPPCPPPPCPCPCPCCCPCCPPCPPCPPCPPPPCCPPCCCPCCCPCPCPCCPPCCPCPCCPCPCPPCCCCPCPPPPPPCCCPCPCCCCCCPCCCCCCCCPPCCPCCCCPCPPCCCPCPPCCCPPPPPPCPPCPCPCCCPCPCPCPPPPPCCPCPPCCPPCCPPPPPPPPPPCPCPPCPPPCCCPPPPPPPCCCCCPPPCPCCPCCPCCPPCPPPPCCCCPPPC...

output:

3515
3515
3514
3513
3513
3513
3513
3513
3512
3511
3511
3511
3511
3511
3510
3510
3511
3510
3510
3510
3511
3510
3509
3509
3509
3508
3507
3508
3507
3508
3509
3510
3510
3510
3510
3510
3509
3509
3509
3509
3509
3510
3510
3511
3510
3509
3509
3510
3511
3511
3511
3511
3512
3512
3512
3511
3511
3512
3512
3511
...

result:

ok 501 lines

Test #46:

score: 0
Accepted
time: 2ms
memory: 11968kb

input:

500 500
PPPPPPPPPPCPCPPPPPPPPPPPCPPPPPPPPCPCPPPPPPPPPPPPPPPPCPPPPPPPPPPPCPPPPPPPPPPPPCPPPCPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPCPPPPPPPPPPPPPPCCPPPPPPPPPCPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPCPPP...

output:

11567
11567
11567
11567
11567
11566
11566
11566
11566
11566
11566
11567
11567
11566
11566
11566
11566
11565
11565
11565
11565
11565
11564
11564
11564
11564
11564
11564
11564
11564
11564
11564
11564
11565
11565
11565
11565
11565
11565
11565
11565
11565
11565
11565
11565
11565
11565
11565
11565
11565
...

result:

ok 501 lines

Test #47:

score: 0
Accepted
time: 0ms
memory: 11940kb

input:

500 500
CCCPPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCPCPCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCPCPCCPCCCCCCCCCCCCCCCCPCCCCCCCPCCPCCCCCCPCCCCCCCCCPPCCCCCCCCCCCCCCCCCCCCPCCCCCCCCPCCCPCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

11534
11534
11534
11534
11534
11534
11534
11534
11534
11534
11534
11534
11534
11534
11534
11534
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
11535
...

result:

ok 501 lines

Test #48:

score: 0
Accepted
time: 2ms
memory: 12248kb

input:

500 500
CPPCPCCPPPPCPPCCPPPPPPPCPCCCCCPPCCCPPCPPPPPCCPCPPPPCCCPCCPPPCCPCCPCPPPPCPPCCPPCPPCCCCPPCPCCPPPCCPCPPPCPPPPCCPCCPPCPCPCPCCPPPCPPCPCCPPPCPCPCCCPCCPPCCCPPPCCCCPCCCCPCCPPCCPPCPPPPPPCCPPCCPCCCCCCPPPCCPCCCCCCCPPCCCCCPPCCCPCPCCCPPCPPPPCPPCCCPPCPPPPPPCCPPPPCCPPPCCCCCCCPCCPPPCPPPCCCPCCPCPPPPPPPCPCPPP...

output:

1491
1491
1491
1491
1491
1490
1491
1490
1490
1489
1490
1490
1490
1491
1491
1491
1491
1491
1490
1490
1490
1490
1490
1490
1491
1490
1490
1490
1491
1490
1489
1489
1488
1487
1487
1486
1487
1488
1488
1489
1489
1489
1489
1489
1488
1487
1487
1487
1486
1485
1485
1484
1483
1483
1483
1482
1481
1480
1480
1480
...

result:

ok 501 lines

Test #49:

score: 0
Accepted
time: 0ms
memory: 12000kb

input:

500 500
CCCCCPCPPCCCCPCCPCCPPCCCPPPCCPCCPCCPPCPPPPPPPCCPCCCPPPPPPCCCPCCCPCCCCCCCCCPPPPCPPPCPPCPPCPCCPCPPPCPPPCPPPCCPPPPPPCPCCPPCPCCPPPPPCPPCPPCPPPPCPPPPCPCCPCPCCCCCPPCCPPCCPPCCPPPCPCPPPCPCPPPCCCCPPPPPCPPCCCCCPPCPCCCPPCPCPPPPPPPPPCPPCCCCPPCPCCCPCCCPCPPPCPPCPPCCCPPCCCCCCPCCCCCCCPCPPCPCPPCCCCCPPCPCPPPP...

output:

6580
6580
6580
6580
6581
6582
6582
6582
6581
6582
6582
6581
6581
6580
6580
6579
6578
6578
6578
6578
6579
6580
6579
6579
6579
6580
6579
6580
6579
6579
6578
6577
6578
6579
6580
6580
6580
6579
6579
6578
6577
6577
6577
6576
6576
6575
6575
6575
6575
6576
6577
6577
6578
6578
6579
6578
6578
6579
6579
6579
...

result:

ok 501 lines

Test #50:

score: 0
Accepted
time: 2ms
memory: 11992kb

input:

500 500
CPCCCPCCPPCCCCPPCCCCPPCPPPCPPPCPCPCPPPPCPCCCCCCCPPCPPCCPCCPPPPPPPCPPPPCCCPPCCPCPPCPPPPPPCPPCPPCPPPPCCPCCPCPCPCPPCPPPCPCPCPPCCCCCCCPCPCCPPCPPCCPCCPPCCCCPPPCCCCCCCPCPPPCCCCPCPPCPCPPCCPPCCPPCPCPCPCCCPPPPCCPPCCCCCCPCPCPPPPPPCPPPPPCPPCCPPCPPCPPPPPCPCPCCCCPCCCCCCCCPCCPPCPCPCCPCCPCCCPPCCCCPCCCPCPCC...

output:

2117
2117
2117
2118
2118
2118
2118
2117
2117
2117
2118
2117
2117
2118
2119
2119
2119
2119
2119
2120
2121
2120
2120
2121
2121
2121
2122
2122
2123
2123
2123
2122
2121
2122
2122
2121
2122
2123
2123
2123
2122
2122
2123
2122
2123
2123
2123
2123
2123
2124
2123
2124
2124
2125
2126
2126
2126
2126
2125
2124
...

result:

ok 501 lines

Test #51:

score: 0
Accepted
time: 0ms
memory: 11988kb

input:

500 500
PPPCPPPCPCCCCPPCPCCPPCCPPPCCCPPCPPCCPCCPPPCCCCPCPCCCPPPPPCPCPPPCCPCPPPPCCCCCCPPCCCPPPPPCPCPCCPPPPCCPPPCCCCCCCCCPCPCCCPCPCPCPCCPPPCPCCPPPPCPCCCPPPPCCCPCCPCCPCCPCCCPPPCPCCPCCCPCCCCPCPPPPCPPCCCCPCCPPPPPPPCPPCPPCCCPPCCPCCPCCPPCCPCPCCCCPPCPCPPCCPPPPCPCCPPCPPCPCPPPCCCCPCCPPPPCCCPPPCCPPPPPCPPPCCPPC...

output:

3532
3532
3532
3532
3533
3534
3533
3533
3532
3532
3532
3532
3532
3533
3533
3532
3532
3532
3533
3534
3534
3534
3535
3535
3536
3535
3535
3535
3535
3535
3536
3535
3534
3533
3534
3534
3534
3534
3534
3533
3534
3533
3533
3532
3533
3533
3532
3532
3531
3531
3530
3530
3530
3530
3531
3531
3531
3531
3530
3530
...

result:

ok 501 lines

Test #52:

score: 0
Accepted
time: 2ms
memory: 11992kb

input:

500 500
PPCPPCPCPPCPPPPCPPPPCPCCCPCPPCCCPPPPCCPPPPCCPCCPCPPCCCCPPPPCPPPPPCPPPCPPPCCCCCCPPPPPPCCPPCPCCCPCPPCCCPCCCCCPPCPCPCPCPCPPPPPPCPPCPCPCPCCCPPCPCCCCCCCPCPCCPCPPPPPPCCCCCCCCCPCCCCCCPPPPPPPCPCCPPPCCCCCCPPCCPPPPPCCCCCCPPPPPPCCPCCCPCCCCCCPPCCCPPPPPPCPCCPCPPPCCPCCPPPCPCCPCPCCCCCCCCPCCCCCCPCPPCCPPCCCC...

output:

3945
3944
3945
3945
3945
3944
3945
3945
3945
3945
3946
3946
3946
3945
3945
3944
3943
3943
3943
3944
3944
3944
3944
3944
3943
3943
3943
3943
3943
3943
3942
3942
3942
3942
3941
3941
3942
3941
3941
3941
3941
3940
3939
3939
3938
3939
3939
3939
3940
3939
3939
3939
3938
3937
3936
3937
3938
3938
3938
3938
...

result:

ok 501 lines

Test #53:

score: 0
Accepted
time: 0ms
memory: 11988kb

input:

500 500
PPPPPPPPCCPPPCPCPPCCCCCCPCCPPCCPCCPPCPCPPPPPCCCPPPPPCPPCPCPPCCPPCCPCCPPPCCPCCCCCPPPCPCCPCCPCCPCCCCPCPPCCCPCPPCPPPPCPCPCCPCCCCCPCPCPPCCCCPCCPCPCCCCPPPPPPCPPPCPPPCPPPPCCCPCPPPPCCCCPPCCCPPCPPPCPPPPPPPPPCPPPCCPCPPCPCPCCPPCPCPCPCPCCCCCPCPCPPCPPCCCCCCCPPPPPCPCCPPPPCPCPPPPPPPCPPCPCPCCCCCPCCCCPPPCPC...

output:

2178
2177
2177
2178
2178
2177
2178
2177
2177
2176
2176
2175
2175
2175
2176
2176
2175
2174
2174
2175
2175
2176
2175
2175
2176
2176
2176
2176
2177
2177
2178
2179
2179
2179
2178
2178
2178
2177
2177
2176
2176
2176
2177
2177
2177
2177
2177
2176
2176
2176
2177
2178
2177
2178
2178
2177
2176
2177
2177
2178
...

result:

ok 501 lines

Test #54:

score: 0
Accepted
time: 2ms
memory: 12080kb

input:

500 500
PPPPPPPPPCPPPPPPPPCPPPPPPPPPPPPPPPCPPPPPPPPPPPPPCPPPPPPPPCPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPCPPPPPCPPPCPPPPCPPPPPPPPPPCPPPCPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPCPPCCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPCP...

output:

12046
12046
12046
12046
12046
12046
12046
12046
12046
12046
12047
12047
12047
12047
12047
12048
12049
12049
12049
12049
12048
12048
12047
12046
12046
12046
12046
12046
12046
12046
12046
12046
12045
12045
12045
12045
12045
12045
12045
12045
12045
12045
12045
12045
12045
12045
12045
12045
12045
12046
...

result:

ok 501 lines

Test #55:

score: 0
Accepted
time: 0ms
memory: 11968kb

input:

500 500
CCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCPCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCPCCCCCCCCCCCCCPCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

8190
8190
8190
8190
8190
8190
8190
8190
8190
8190
8190
8190
8190
8190
8190
8190
8190
8190
8190
8190
8190
8190
8191
8191
8191
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
8192
...

result:

ok 501 lines

Test #56:

score: 0
Accepted
time: 2ms
memory: 12220kb

input:

500 500
CCPCCCPCCCCCCCPCCCCPPCCPCPCCCCCPCCCCPCPPCCCCCCCCCCCCCCPCCPCPCCPCPCPPCCCPCPPCCCCCCPPCCCCCCPCCCPPPCCPCCPPCCCCPCPCPCCCCCPCCPCCCCCCPPCCCCPCCCCCCCPCCCCCPPCCCCCCCCCCCCCCCPCCCCPCCCCPPPCCCCPPCCCCCPCCCCCCCCCPCCCPCCPCPCCCCCCPCPCCCCCPCCCCCPCCCCPCPPCCCCPCCPCCCPPCPPCCCPCPCCPCCCCCCCCPCPCCCPCCPCCPCCPPPPCPP...

output:

36242
36242
36242
36242
36242
36242
36241
36241
36241
36242
36241
36241
36241
36241
36240
36240
36241
36240
36239
36240
36241
36240
36239
36239
36239
36238
36238
36239
36238
36237
36237
36237
36236
36235
36235
36235
36235
36235
36236
36236
36235
36235
36235
36235
36235
36235
36236
36235
36235
36236
...

result:

ok 501 lines

Test #57:

score: 0
Accepted
time: 0ms
memory: 12072kb

input:

500 500
PCPCCCCCCCCCCCCCCPCCCCCCPCCCCCCPPCCCCCCCCPCCCCCCPPCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCPCCPCCCCCCPCPCPCPCPCCCPCCCCCCCPCPCPCCCCCCCCCPCPCCPCPCCPPCPCCCCCCCPCCCCPCCCCCCCPPCCCPCCCPCPPCCCPCCCCCCCCCCCCPCCCCCCCCPPCCPCCCPCCCCCCCCCCCCCPCCCPPPPCCCPPCCCCPCCPPPCCCCCCCCCPCCCCPCCCCCPPCPCCCCCCCCCCCCCCCCCCPCCCCPCC...

output:

32313
32313
32312
32312
32312
32312
32312
32312
32312
32312
32312
32312
32312
32311
32311
32311
32311
32310
32310
32311
32312
32311
32311
32311
32312
32312
32311
32311
32311
32311
32311
32310
32310
32310
32310
32310
32310
32310
32310
32310
32309
32309
32310
32310
32310
32309
32309
32309
32309
32309
...

result:

ok 501 lines

Test #58:

score: 0
Accepted
time: 2ms
memory: 12252kb

input:

500 500
CPCCCCCPCCCCCCCPCCPCCPCCCCPCPCCPPCPCPCCCPCCPCCCCCCCCCCCPCCCCCCCCCCCCPCCCCCCPCPCCCPCCCCCCPCCCPCCCCCCCPCPPCCCCCCCCPCCCCCCPCCPCCCCCCCCCCCCPCCCPCCPCCCCPCCPPCPCPCCCCCCCCCCCPCCPPCPCPPCPCPCCPPCCCCPPCCCCPCCPCCPCCCPCPPCCPCCCCPCPCCCCCPCCCCPCCCCPPCCCCCCCCCCCCPPPCCCPCPCCCCPCCPCPCCCPCCCCCCPCPCPCCPCCCCCCP...

output:

32437
32438
32439
32439
32440
32440
32440
32440
32441
32441
32442
32442
32442
32442
32442
32441
32441
32441
32440
32441
32441
32442
32443
32443
32443
32444
32445
32446
32447
32447
32447
32447
32447
32447
32446
32446
32445
32444
32445
32445
32445
32444
32444
32444
32444
32444
32445
32444
32444
32445
...

result:

ok 501 lines

Test #59:

score: 0
Accepted
time: 2ms
memory: 11992kb

input:

500 500
CCCCCCCCCCPCCCPCPPCPCCCCCCPCPCCPPCCCPCCPCCCCPCCCCCCPCPCCCPCCPCCCCCCCPCCPCPCCPCCCCCPCCCCCPCPCCCCCCCCCCCCPCCCPCCCCCCCPCCCPCCPPPCPPCCCCCCCCCCPCCCCCCCCCCCCCCPPCCCPCCCCCCCCCCCPPCPCCCCCPCCPCPCCCCCCCPPCPCCCCCCCCCCCCCCCCPCCCCCPCCCPPCPPCCCPPCCCCCCCCCCPPCCCCCPCCCPCCCPCCCCPCCCCCCCCCCCCCPPCCCCPPCCPCCCCC...

output:

31153
31153
31153
31154
31154
31154
31153
31153
31153
31154
31155
31155
31154
31155
31154
31155
31154
31154
31154
31153
31154
31153
31153
31152
31152
31152
31152
31152
31153
31153
31153
31152
31151
31151
31152
31152
31151
31152
31151
31151
31151
31151
31150
31150
31151
31152
31153
31152
31153
31153
...

result:

ok 501 lines

Test #60:

score: 0
Accepted
time: 0ms
memory: 9912kb

input:

500 500
PCCCCCCCCPPPPCPCCCPCCPCCCPCCCPCCCPPCCCCCCCCPPPCPCCCCCCCCCPCCCPCPCCPCPPCCCPCCCCCCCCCPPCCCCCCPPCCCPPCCCCCCCPCCCPPCPPPCPCCPCPCPCPPCCPCPCCCPCCCPCPCCPCCCCCCPPCCPPCCCCCCCPCCCPPPCPPCPCCCCPCPCCCPCPPCCCCCPCCCCCPCCCCCCCCPCCCCPPCCCCCCCPPPCCCCPPPCCCCCPPCCCCPCCCPPCCCCPCPCCCCCPCCCPCCCCCCCCPCCPCCCCCCCPCPCP...

output:

29687
29688
29688
29688
29688
29688
29689
29689
29690
29691
29692
29692
29692
29692
29693
29692
29692
29692
29692
29692
29693
29692
29692
29692
29692
29691
29692
29692
29693
29694
29694
29693
29693
29693
29694
29695
29696
29697
29698
29698
29698
29699
29699
29700
29700
29701
29701
29702
29702
29702
...

result:

ok 501 lines

Test #61:

score: 0
Accepted
time: 2ms
memory: 12224kb

input:

500 500
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 501 lines

Test #62:

score: 0
Accepted
time: 0ms
memory: 12224kb

input:

500 500
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 501 lines

Subtask #4:

score: 10
Accepted

Dependency #3:

100%
Accepted

Test #63:

score: 10
Accepted
time: 3ms
memory: 12440kb

input:

5000 5000
CPPCPCPPCCCCCCPCCCPPPCCCCCPCPPPCCCCCPPCPPCCPPCPCCCPCCCCCPPCPCCPCPCCPCPCPPCPPCPCPPCPCCCCPPPCPCPPCPCPPCPCCPCCPPPPPCCPPCCPCCCCCPPPPPPPPPCPCPPCPCCCCPCPPCCCCPPPPCCCCPCPPCCPCCCCCCPCCPCCCCCPCPPCPPCPPCCCCPPCCPCPPCCCCCCPPCCCCCPPPPCPCCPPPPCPCCPPPPCCCPCPCCCPPPCPCPPCPPCCPCCPPCPCPPCCCCPCCCCPPCCPPPPCPCC...

output:

137551
137552
137552
137553
137552
137553
137553
137554
137553
137552
137551
137552
137552
137553
137554
137554
137554
137555
137554
137554
137555
137555
137556
137556
137556
137557
137558
137559
137559
137559
137559
137559
137559
137559
137558
137559
137560
137560
137559
137558
137559
137559
137559...

result:

ok 5001 lines

Test #64:

score: 0
Accepted
time: 3ms
memory: 12116kb

input:

5000 5000
PPPPPPCPPPPPPPPPPPPPPPPPPPPPCPPPPCPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPCPPPPPPPPPPPPPPPPPCCPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCCPPPPPCPPPPCPPPPPPPPPPPPPPPPPPPPPPPCPPPPCPPPPCPCPPPPPPCPPPPPPPPPPPPPCPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPCCPPPPPP...

output:

1176476
1176476
1176476
1176477
1176477
1176478
1176478
1176478
1176478
1176479
1176479
1176479
1176479
1176479
1176479
1176479
1176479
1176479
1176479
1176479
1176479
1176479
1176479
1176479
1176479
1176479
1176479
1176479
1176479
1176479
1176479
1176479
1176479
1176479
1176479
1176479
1176479
1176...

result:

ok 5001 lines

Test #65:

score: 0
Accepted
time: 2ms
memory: 12116kb

input:

5000 5000
CCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCPCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPPCCCCPCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCPCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPC...

output:

1072041
1072041
1072041
1072041
1072041
1072041
1072041
1072041
1072041
1072041
1072041
1072041
1072040
1072040
1072040
1072040
1072040
1072040
1072040
1072040
1072040
1072040
1072040
1072040
1072040
1072040
1072040
1072040
1072040
1072040
1072040
1072040
1072040
1072040
1072040
1072040
1072039
1072...

result:

ok 5001 lines

Test #66:

score: 0
Accepted
time: 0ms
memory: 12124kb

input:

5000 5000
CPPCCCCPCPPPCCPPPPPPPPPPPPCPPPCPPPPCPPCCPCCPCPCPCPPPCPCPPCCCPPPPPPCPPPPPCPPCPPPPPPPPCPPPCPPCPPPCPPPPPPPCPPCCCPPCPPPPCPPPPPPPCCPPPPCPPPCPCPPPCCPPPPCCPCCPCPPPCPPPPPCCPCCCCPPCPPPPPPPPPPPCPPCPPCPPCPCPCCPPCCCPCPPPPPCPPPCCCPCCPPPPPCCPPPCPPPPCCCPPPCPPPCPCPPPPPPPCCCPPPPPPPPPPPPPPCPCPPPPPCPCCPPPCPP...

output:

3199441
3199441
3199442
3199443
3199443
3199443
3199443
3199443
3199443
3199443
3199442
3199442
3199443
3199444
3199444
3199443
3199443
3199443
3199443
3199442
3199442
3199441
3199440
3199440
3199439
3199439
3199439
3199440
3199440
3199440
3199441
3199440
3199440
3199441
3199441
3199441
3199441
3199...

result:

ok 5001 lines

Test #67:

score: 0
Accepted
time: 3ms
memory: 12120kb

input:

5000 5000
PPPPCCPPCPPPPPPPPPPCCPCPPCPPPCCPPPPPPPPPPPPPCPCPPPPPCCPPPPPPPPPCPPPCPPPPCPCPPCPCPPPPPCPPPCPPPPPPPPPPPCPPPCPPPPPPPPPCPCPPPCPPPPPPPPPPPCPPCPPPPPPPPPPPCPPPPPPCPPPPPPPPCPPPPPPPPPCPPPCPPPPPPPPPCPPPPCPPCPCCPCPCPPPPPCPCPPPPCPCPPCCPPCCPPCPPPPPPPPCPPCPPPPCPPPCPPCCPCCPCPPCPPPPCPPPPCPPCCCPCCPPPPCPCCP...

output:

3133969
3133969
3133969
3133970
3133971
3133970
3133970
3133970
3133970
3133970
3133970
3133971
3133971
3133971
3133970
3133970
3133970
3133970
3133971
3133971
3133971
3133970
3133970
3133970
3133971
3133971
3133972
3133971
3133971
3133970
3133970
3133970
3133969
3133969
3133969
3133969
3133970
3133...

result:

ok 5001 lines

Test #68:

score: 0
Accepted
time: 3ms
memory: 12424kb

input:

5000 5000
PPPPPPPCPPPPCCPPPPPPPCCCCCPPPPPCPPCCPPPCPPPCPPPPPCPCPPPPPCPPCCPPCPPPPPPPCPCPPCCPPCPPPPPPPPPPPPCCPPPPPPPPPCPPCPPCPPPPPCCCPPPPPPCPPPPCPPPCPPPPPPPPPPPPPPPPPPPPPPCPPPPPCPCPPPCPCPCPCPCCCCPCCPPCPPPCPPPPPPPPPPPPPPPPCPPPCPPPCPPCCPPPPPPCPPPPPCPPPPPPPCPPPPCPPPPPPCPPCCCPCPPPPCPPPPPPCCCPPPCCPPCPPCPPPP...

output:

3108626
3108627
3108626
3108626
3108626
3108627
3108627
3108627
3108627
3108628
3108629
3108628
3108629
3108629
3108629
3108628
3108628
3108627
3108627
3108627
3108627
3108628
3108627
3108627
3108628
3108629
3108629
3108629
3108629
3108628
3108629
3108629
3108629
3108628
3108629
3108629
3108628
3108...

result:

ok 5001 lines

Test #69:

score: 0
Accepted
time: 0ms
memory: 12072kb

input:

5000 5000
PCPPPPPPPPPPPCPCPPPCPPCCCCCPPPPPPPPCPCPPPPPCPPPPPPPPCPCPPPPPPPPPPCCPPCCPPPCCPPPPPCPPCPPCPPPCPPPPPPPPPPPPPPPPPPPPPPPPPCPCPPPPPPPCPCPPPPPPPPCPPPPPPCPPPPCPPCPPCPPPCCPPPPPPPPPPPPCPCPPPPPPPPPPPPPCPPCPPPCPPPPPPCPCPPPCPPPPPPPCPPPPPPPCPPPCPCPPPPPPPCCPCCPPPPPPPCPCPPCPPPPPCPPPPPPPPPCPCCCPPPPPPCCPPCP...

output:

3047481
3047481
3047482
3047483
3047483
3047483
3047484
3047484
3047484
3047484
3047484
3047485
3047485
3047485
3047486
3047486
3047485
3047486
3047486
3047485
3047485
3047485
3047484
3047484
3047485
3047485
3047484
3047485
3047485
3047485
3047485
3047485
3047485
3047486
3047486
3047486
3047486
3047...

result:

ok 5001 lines

Test #70:

score: 0
Accepted
time: 3ms
memory: 12160kb

input:

5000 5000
PCPPCPPPPPPCPPPPPPCPPPPPPPCPPCPPPCPPCPPPCPPCPPPPPPCPPCPPCCPCPPCPPPPPPPPCPPPPCPPPPCPPPPPPPPPPCPCPPPPPPPPPPCPPPPCCPPPPPCCPCCCPCPCCPPCPPPPPPPPCPCCCCCPPPCPPCCPPPCPPCPPPPPPPCPPPPPPPPCPPPPPCPPPPPPPPPPPCPPPCCPCPPCCPCPPPPPPCPPCPPCPPPPPPPPCPPPPCPPPPCCPPCPPPPPPPCPCPCPPPPPPPPCPPPPPCPPCPPPPPCPPPCCPCPP...

output:

3059253
3059252
3059252
3059252
3059252
3059252
3059252
3059253
3059253
3059253
3059253
3059254
3059253
3059253
3059253
3059253
3059253
3059253
3059253
3059253
3059252
3059252
3059252
3059252
3059253
3059254
3059254
3059254
3059255
3059255
3059256
3059256
3059256
3059256
3059255
3059256
3059256
3059...

result:

ok 5001 lines

Test #71:

score: 0
Accepted
time: 3ms
memory: 12136kb

input:

5000 5000
PCCCPPPCPPPPPPPCPCPCPPPPPCCPPCPCCCCPPCCPPCCCPCCPCCPCCPPCPCPPPCCCPCCCCCPCPPPPCCPPPCPPCCCPCPCCPCCPCCCPCPPCPCCCCCCPPPCPCCPPCPCCPPPCPCCCPCPCCCCCPPPPCPPPPCCCCCCPPCCPPPCCCCCPCCCCCPCCCCCPCCCPCPPCCPPPPPPPPCPCCCCPPCPCCPCCCPPPPPCPCCPCCPPCCCPPCCPPCPCCCCPPCCPPCPCCCPCPPPCPPCPCCPCPCCPPPPCPPPPPPPPCPPCCPC...

output:

75131
75131
75132
75132
75132
75132
75131
75130
75129
75129
75129
75129
75129
75130
75130
75130
75129
75129
75129
75129
75130
75130
75129
75130
75130
75130
75130
75131
75130
75129
75129
75129
75129
75128
75128
75127
75126
75126
75127
75127
75128
75128
75127
75126
75126
75125
75125
75126
75126
75126
...

result:

ok 5001 lines

Test #72:

score: 0
Accepted
time: 0ms
memory: 12096kb

input:

5000 5000
PPPPPPPPCPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPCPCPPPPPPPPPPPPPPPPPPPPPPCPPCPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPCPPPPCPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPCP...

output:

1155180
1155180
1155180
1155180
1155179
1155179
1155179
1155179
1155179
1155179
1155179
1155179
1155179
1155179
1155179
1155179
1155179
1155179
1155179
1155179
1155180
1155180
1155180
1155181
1155180
1155180
1155180
1155180
1155180
1155180
1155180
1155180
1155180
1155180
1155180
1155180
1155180
1155...

result:

ok 5001 lines

Test #73:

score: 0
Accepted
time: 3ms
memory: 12116kb

input:

5000 5000
CCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCPPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCP...

output:

1119869
1119869
1119869
1119869
1119869
1119870
1119870
1119870
1119870
1119870
1119870
1119870
1119870
1119870
1119869
1119869
1119869
1119869
1119869
1119869
1119869
1119869
1119869
1119869
1119869
1119869
1119869
1119869
1119869
1119869
1119869
1119868
1119868
1119869
1119869
1119869
1119869
1119...

result:

ok 5001 lines

Test #74:

score: 0
Accepted
time: 0ms
memory: 12128kb

input:

5000 5000
PCCPCPCCPPCCCCPCCCCCPPCPCCCCCPCPPPCCCPPCPCPCPCPCPPCPPCPCPCCCCPCPCCPPPCCCCCPCCPCPPPPCPPPCPCCPCPPCPPPPPCCPPPPCCCPPPCPCPCCCPCCPCPPCCPCCPPCCCPPCPPCCCPCCCCPPPPPPPCPPCPPCPCPPCPCCPCPPCCPPCPPCPPCPCCCPPPCCPPCPCPPCCCPCPCPCCCPPCPCCPPPPPCCCPPCPCCCCCPPPCCPPPPPCPCCCPCPCPCCPCPCCCCPCCCPCPPPCCPPPPPPPPCCPCP...

output:

173393
173394
173395
173395
173395
173396
173396
173395
173395
173396
173397
173397
173396
173395
173394
173395
173396
173397
173398
173397
173396
173395
173396
173396
173396
173395
173395
173395
173394
173393
173393
173393
173393
173392
173393
173393
173393
173393
173394
173394
173394
173394
173395...

result:

ok 5001 lines

Test #75:

score: 0
Accepted
time: 3ms
memory: 12088kb

input:

5000 5000
PPCCPCCPCPPCPPCCPCCPCCCCPPPCCPPCCCCCCCCCPCCPCCCCPPPPCCCPPCCCPCCCPPCPPCPPPCCPPCCPPCPPPCCPPCCCCPCPPPPCCCPPPPCCPPPCPCPPPCPPCCCPCCCPPCCCPPCCPCPCCCCPCPCCPCCPCPPPPCCCPPCCPCPPPPPCCCPCPPPCCCPPPCCPPCCCPCCCCPPPPPPCCPPPCPPCPPPPPCPPPPCCPCCCCPCCPPCPPCPPCCCPPCPPPPCCCPPCCCPCPPPCPPPPPCCCCPCPPCCPCCPCCPPPPP...

output:

109238
109238
109237
109236
109236
109236
109236
109237
109236
109236
109237
109237
109236
109236
109236
109235
109236
109235
109236
109235
109236
109236
109235
109235
109234
109234
109234
109233
109233
109233
109233
109233
109233
109232
109232
109232
109232
109233
109233
109233
109233
109233
109233...

result:

ok 5001 lines

Test #76:

score: 0
Accepted
time: 0ms
memory: 12128kb

input:

5000 5000
CPPPCCCPCCCCCCPPCPCPPCPCPPCCCCCPCPPCCCCCPPPCPCPCCPPPPCCPCPCPPCPPPPPPCPCCPPCPPPCCCPPCCPPPPCCCPPPCPCCPCPCPPCPPPCCCCCCPPCCPPPCCCCPCCPPPCPCPPPCPCCCCPCPPPPCCCCCPCPPCPCCPPCCPPCCCCCPPCPPPCCCCCCCCPCCCPPCPPCCCPPPPPPPPPPPCCPPCPCCPPPCPCPCPCCPPCCCPPPCCCPCPCCPPPPPCCPPCCPPCCCCCPPCPCCCCPCCPPCCPCPCPCPCCCP...

output:

336208
336208
336207
336206
336206
336207
336207
336208
336208
336208
336207
336206
336206
336206
336206
336205
336204
336204
336204
336204
336205
336204
336204
336203
336203
336202
336203
336204
336204
336205
336205
336205
336206
336205
336205
336205
336206
336205
336205
336205
336205
336206
336206...

result:

ok 5001 lines

Test #77:

score: 0
Accepted
time: 3ms
memory: 12132kb

input:

5000 5000
PCPCCCPPCPPCPCCCPPCPPCCPPPCPCCPPPCPPCCCCPPPCPPPPCCPPPPCCCPPCPCPCPCCCCCPCCPCPPCCCPCPPPCCPCPPCCCPCPCCPCPPPCPPPPCCCCCCCCPCCPCPPCPCPPCCCCCPCCPPPCPPCPCCPCCPPCPCCPPPCCPCPCPCCCCCCPPPPCCPPPCPCPCCCCPCCPPPPCCCCCCCCCCPCPCCPPCCPCCPCPPCCCCCPPCPCPCPCCPPCPPCPCPPPCCPCCCCPCPPCPCPPCPPPCCCCCCPPPCPPPCCPCPPCCP...

output:

134834
134833
134833
134833
134833
134834
134835
134835
134836
134836
134835
134834
134835
134836
134835
134834
134834
134834
134835
134834
134834
134835
134835
134835
134834
134834
134834
134835
134835
134835
134836
134836
134835
134835
134834
134835
134836
134837
134836
134836
134835
134835
134834...

result:

ok 5001 lines

Test #78:

score: 0
Accepted
time: 3ms
memory: 12408kb

input:

5000 5000
CCCPPCPCPPCPCPCPPPPPPCPCPPPPCPCPPPCPCCCPCPPPCPCCCPCPPPPPCPCCCPPPCPCCCCPCPCPCCPCCPPCPCCPCCCPCCPPPCPPPCPPCCPPCCPPPPPPCCPPPPCCCPCPCPCPCPPCPCPPPCCCPPPCPCCPPCCPCCCPPPCCCCCPPPPCCPPCPPCCPCPPCPPCCCPPPCPCCPPCCCCCCPCPCPPCCCPCCPPCCPCCCCCPCCCCPPPPCCPCPCPCPCCCCPCCCCCCPCCPCPPPPCCCCPCPCCCCPPCCPCPCPPPCCCP...

output:

60332
60332
60332
60331
60332
60332
60332
60331
60331
60331
60332
60332
60333
60332
60331
60331
60330
60329
60330
60330
60329
60329
60328
60328
60328
60328
60328
60327
60327
60326
60326
60327
60327
60327
60327
60326
60326
60326
60327
60328
60328
60328
60328
60329
60328
60328
60329
60330
60330
60331
...

result:

ok 5001 lines

Test #79:

score: 0
Accepted
time: 0ms
memory: 12364kb

input:

5000 5000
PCPCCCPPCPPCPPCPCPPPPCPCCPPCPPPCPCPCPCPPCCPPPPCPPPCPPCPPPCCCPCCPCPPCPCPPPPCPCCPPCPCCCCPCPPPPCPCCPCPPCPPPCPCCPPPPPPPPPPCPPCCCCPCPCCPPPPPPPPPPCPPCCPCCCPCPCCCPPCPPCCPCPCPCCPCPPCPPCCCPPCCCPCCPCCCCPPPCCPCPCCPPCCPPPPCCPPCPCPPCPPCCCPCPCPCCCCPCCPPPPCPPPPPCPPCCPCCCCCPCCCPCPPPPPPCCCCCCPCPPPPCCPCCCPC...

output:

71855
71855
71856
71856
71857
71857
71857
71858
71858
71858
71858
71857
71858
71857
71856
71856
71856
71857
71858
71859
71859
71860
71860
71860
71860
71860
71859
71859
71859
71859
71859
71859
71858
71858
71857
71857
71856
71855
71854
71853
71853
71853
71853
71853
71853
71853
71853
71854
71855
71856
...

result:

ok 5001 lines

Test #80:

score: 0
Accepted
time: 3ms
memory: 12200kb

input:

5000 5000
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCCCPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPCPPPCPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPCPPPPCPPPPPPPPPPPPPPPPPPPCPPPPPPPCPPPPPPCPPPPPPPPPPPPPPPPPPCPCPPPPPPPPPPPPCPPPPPPPCPPPPPPPPPCCPPPPP...

output:

1277045
1277045
1277045
1277045
1277045
1277045
1277045
1277045
1277046
1277046
1277046
1277046
1277046
1277046
1277046
1277046
1277046
1277047
1277047
1277047
1277047
1277047
1277047
1277047
1277047
1277047
1277047
1277047
1277047
1277047
1277047
1277047
1277047
1277047
1277047
1277047
1277047
1277...

result:

ok 5001 lines

Test #81:

score: 0
Accepted
time: 0ms
memory: 12412kb

input:

5000 5000
CCPCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCPCCCCCCCCCCCCCPCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCPCCCCCCCCCCPCCCCPCCCCCCCCPCCCCCCCCCCCCCC...

output:

1082871
1082871
1082871
1082871
1082871
1082871
1082871
1082872
1082871
1082871
1082871
1082871
1082871
1082871
1082871
1082871
1082871
1082871
1082871
1082871
1082871
1082871
1082871
1082871
1082871
1082871
1082871
1082871
1082871
1082871
1082871
1082871
1082870
1082870
1082870
1082870
1082870
1082...

result:

ok 5001 lines

Test #82:

score: 0
Accepted
time: 3ms
memory: 12096kb

input:

5000 5000
CCCCCCCPPCCCCCPCCPCCPCCPCCCCCCCPCCPPPCCPCCCCCCCCCCCCCCPCCCCCCCCCCCCPPCCCPCPCCCCPCCPCCCCPCCCPCCCCCCCCPCPCCCCCCCCCCCCCCCPCPCCCPCCPCCCCPCCPCCPCCPPPCPCPPCCCCCCCPPPCCCPCCCPCCCCCCPCCCCCCPCCPPCCPCPCCCCPPCCCCCCCCCCCCCCPCPCCPCCCCPCPCCCPPCCCPPCCCPCCCPPCCCCCCCPPCCPCCPCPCCPCCCCCCPCCCCPPCPCCCCCPCPCCPCC...

output:

3093222
3093222
3093221
3093221
3093222
3093222
3093222
3093223
3093223
3093222
3093223
3093223
3093223
3093223
3093223
3093223
3093224
3093224
3093224
3093223
3093222
3093222
3093222
3093223
3093224
3093224
3093225
3093224
3093224
3093224
3093224
3093224
3093224
3093224
3093225
3093225
3093224
3093...

result:

ok 5001 lines

Test #83:

score: 0
Accepted
time: 0ms
memory: 12120kb

input:

5000 5000
CCCCCPCPCCCCCCCCCCCCCPCCPCCPCPCCCCCCCCPCPPCCPCCCCPCCCCCPPPCCPCCCCCCCPCPPCCCPPCCCPCPCCCCCPCCCCCCPCCCCCCCPCCCCCCCPCCPCCCCCCPPCPCPCPCPCCPCCCCCCCCCCCCCCPCPCPCCCCCCCPCCCPCPCCCCCCCPCCCCPCCCCCCPCCPCCCPCCCCCCPCPCCCCCCCPPCPCPPCCCPCCCCPCCCCPCPPPCCCCCCCCCCCCCCCPCCCPCCCCPCPCCCCCCCCCCCCCCCCPCCCPPCCPCCC...

output:

3162331
3162331
3162331
3162331
3162332
3162331
3162331
3162331
3162331
3162331
3162330
3162329
3162329
3162329
3162330
3162330
3162330
3162330
3162330
3162330
3162330
3162329
3162328
3162327
3162327
3162326
3162326
3162326
3162327
3162326
3162327
3162326
3162326
3162326
3162325
3162324
3162324
3162...

result:

ok 5001 lines

Test #84:

score: 0
Accepted
time: 0ms
memory: 14152kb

input:

5000 5000
CCCCCCCPCCCCCCPCCCCCCCCCCCCCCCCPCCCCCCPCPCPCCCPCCPPCCCPCCCCCCPCPCCCCCCPPCPCCCPCCPPPCPCCCCPCCCPCCCCCCCCCPCCCCCCCCCPCCCPCCCCCCPPCPCPPCCPCPCCPPCCPCPCPCCCCCCCCCCCCCPCPPCCCCCPCPCCCCCCCCCPCCCCPCCCCCCCCCCCCCCCCCPCPPPPCCCPCCCCCCCCCCCCPCCPCCCCPPCCPCCPCCPPCCCCCCPCPCPPCPCPCCCCPCPCPCPPCCPPCPCCCCCCPCPC...

output:

3045631
3045631
3045632
3045631
3045631
3045631
3045631
3045631
3045631
3045630
3045630
3045631
3045631
3045631
3045632
3045633
3045634
3045634
3045634
3045634
3045634
3045635
3045634
3045635
3045634
3045634
3045634
3045634
3045633
3045633
3045633
3045634
3045634
3045634
3045634
3045634
3045633
3045...

result:

ok 5001 lines

Test #85:

score: 0
Accepted
time: 0ms
memory: 12424kb

input:

5000 5000
CCPPCPPCCCPCCCCCPCPPCCCCCCPCCCCCCPCCCCCCCCCPCCCCPPCCCCCCCCPCCCCPCCCCCCCCCCCPCCCCPPCCCCPCCPCCCPPCCCCPCCCCCCPCCCCPPCPPCPCCCCPPCCPCCCCPCCCCCCCCCCCCPPCPCCCCCCCCCCPCCCCPCCCCCCCCCCCCPPPCCCCCCCCPCCCCCCCCCCCCCPCCCCCCCCCCCPPCCCCCCCCCCPCCCCCCCCCCCPCCPPCPCCCCPCCCCPCPPCPCCCCCCCCCPCCCCCCPCPCPCPCCCPCCPC...

output:

3197600
3197600
3197600
3197599
3197599
3197599
3197599
3197599
3197600
3197600
3197599
3197599
3197598
3197598
3197597
3197596
3197597
3197597
3197598
3197598
3197598
3197599
3197599
3197599
3197599
3197599
3197599
3197600
3197600
3197599
3197599
3197598
3197597
3197597
3197597
3197596
3197596
3197...

result:

ok 5001 lines

Test #86:

score: 0
Accepted
time: 3ms
memory: 12108kb

input:

5000 5000
CCCPCCCPPCCPPCCPPPCCCCCPCPCPCCCCCPPCCCCCCCCPCCPCCCCCPPCPCCCPCPCPCPCCPPCCCCPCCCPPCCCCCPCCCCCPCCCCCCCCPPCCCCCPCCPCCCCCPCCPCCCCCCCCCPCCCCCCCCCCCCPPCCPCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCPCCCPCPCCPCCCCCCCCCCPCPCPCCCPPCCCCCCCPCCCPPCCCCPCCCPCPCCCCCPPPPCCPCPPCCCPCCCCCCCCPCCCPCCCCCCCPPCCCCPCPCCCCPPC...

output:

3178522
3178521
3178521
3178520
3178521
3178522
3178521
3178521
3178521
3178522
3178522
3178522
3178522
3178522
3178523
3178523
3178522
3178522
3178522
3178522
3178522
3178522
3178522
3178522
3178521
3178522
3178522
3178522
3178522
3178522
3178522
3178522
3178522
3178523
3178523
3178523
3178523
3178...

result:

ok 5001 lines

Test #87:

score: 0
Accepted
time: 0ms
memory: 12124kb

input:

5000 5000
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 5001 lines

Test #88:

score: 0
Accepted
time: 2ms
memory: 12140kb

input:

5000 5000
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 5001 lines

Subtask #5:

score: 13
Accepted

Test #89:

score: 13
Accepted
time: 0ms
memory: 18668kb

input:

100000 100
PCPCCPPCCPPCPPPPCPPPPPCPPPCCCPCCPCCCPCPCPPPPPPPPPPPPCPPPCCPCCPCCCPPCPCCPPPCPCCCPCCCPPCPCPPPCPCPPCCPPCPPCPPCPPCPPPPCCCCCCPCCCCPCCCPPPCCPCPPCCCCPPPPPCPPPPPPCCPCCCCPPPCPPPCPPPCCPCCCCPCPCPCPPCPPCPCPCCCCCCCPCCCPCPCCPCCCCCPPPCPCPCCPCPCCPCPCCPPCCPCPCCPCCCPCCCPPCCCCPCCCCCPPCPCPCCCPPCCCPCPCCPCCCCP...

output:

22869510
22869509
22869509
22869509
22869510
22869511
22869510
22869511
22869512
22869512
22869512
22869512
22869513
22869512
22869511
22869511
22869510
22869511
22869511
22869510
22869509
22869509
22869510
22869509
22869508
22869507
22869507
22869506
22869506
22869507
22869507
22869508
22869509
228...

result:

ok 101 lines

Test #90:

score: 0
Accepted
time: 3ms
memory: 17456kb

input:

100000 100
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPCPPPCPPPPPPCPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPCPPPPPP...

output:

442997990
442997990
442997989
442997989
442997989
442997989
442997990
442997990
442997991
442997991
442997990
442997990
442997990
442997990
442997989
442997989
442997989
442997989
442997989
442997989
442997989
442997989
442997989
442997990
442997990
442997990
442997990
442997990
442997990
442997991
...

result:

ok 101 lines

Test #91:

score: 0
Accepted
time: 0ms
memory: 17008kb

input:

100000 100
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCPCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCPCCCCPCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCPCCCCCCCCCCPCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

449794765
449794764
449794764
449794764
449794764
449794764
449794764
449794764
449794764
449794764
449794764
449794764
449794764
449794764
449794764
449794764
449794764
449794764
449794764
449794764
449794764
449794764
449794763
449794763
449794763
449794763
449794763
449794763
449794763
449794763
...

result:

ok 101 lines

Test #92:

score: 0
Accepted
time: 0ms
memory: 15292kb

input:

100000 100
PPPPPPCPPPPCPPPCCPPPPPPPPCPPPCPPPPPPPPPPPPPCPPCPPPPPPCPPPPPPPCPPPPPPPPCPCPPCCPPCPPPPCPPCPPCPPPPPPPPPPPPPPPPPPPCPPPCPCPPPPPCPCCCPPPPPPPPPCCPPPCPCPCPCCPPPPPPPPPPPPPPPPPPPCCCPPPPPPPPPPPPPPPPPPPPCPCPPPPPCPPCPPCPCPPPPCPPCPPPPPCPCPPCPPPPPCCPPPPPCPPPPCPPPCPPPPCPPPPPCPPPPPPPCPPPCPCCPCPPPCPCCPPPPC...

output:

1257306487
1257306487
1257306486
1257306485
1257306484
1257306484
1257306485
1257306485
1257306485
1257306485
1257306485
1257306485
1257306485
1257306486
1257306487
1257306487
1257306488
1257306487
1257306488
1257306488
1257306488
1257306488
1257306487
1257306487
1257306487
1257306487
1257306488
125...

result:

ok 101 lines

Test #93:

score: 0
Accepted
time: 3ms
memory: 17168kb

input:

100000 100
PPPPPPPCPCPCCPPCPPPCCPPPPCPPPCPPPPPPPPCPPPCCCPPPPPPPCPPPPCPCPPPPPPCPCCPPPCPCCPPPCPPPCPPPPPPPCPPCPCCCPPPPPPPPPPPCPPPPPPCPPPPPCPPPPPPCPPPPCPCCPPPPCPPCCPCPPPPPPPCCPPCCPPCPPPPPPPPPPPPPPPPPPPPPPPPCPPCPPCPPPCPPPPCPPCCCPPPCPPPPPCPCPPCPPPPPPPPPCPCPPPCPPPCPPCPPPPPPPPPPPPCCPCCPPPPPPPPCCPPCPPPPPPPCP...

output:

1242782449
1242782449
1242782449
1242782448
1242782449
1242782449
1242782449
1242782448
1242782448
1242782448
1242782448
1242782449
1242782448
1242782448
1242782448
1242782449
1242782449
1242782449
1242782448
1242782448
1242782448
1242782448
1242782449
1242782449
1242782449
1242782449
1242782449
124...

result:

ok 101 lines

Test #94:

score: 0
Accepted
time: 3ms
memory: 17192kb

input:

100000 100
CPPPPCCPPCPPCPPCPPPPPPPPPPPPPPPPPPPCPPPPPCPPPPPPPCPCCPPPPPCPPPPCCPCPPCPCPPPPCCCPCPPCPPPCPCPPPCPCPPPPCPCCPCPPPCPPPCCCPCPCPPPCPPPCCPPCPPCPPPPPPPPPPCPCPPPPPPPPPPPCCPPCPPCPPPPPCCPPPCPPPPPPPPCPPCPPCPPPPPPPPPPPPPCPPPCPPPPPPCCPCCPPPPPPCPPCPPPPPPPCPPCCPPCCCPPCPPPPPPCCPPPPPPPCPPPPPPPPPPPPCPCPCPPPP...

output:

1247726733
1247726733
1247726732
1247726731
1247726732
1247726732
1247726732
1247726732
1247726732
1247726732
1247726732
1247726733
1247726732
1247726731
1247726732
1247726731
1247726730
1247726729
1247726728
1247726728
1247726727
1247726727
1247726727
1247726727
1247726727
1247726727
1247726727
124...

result:

ok 101 lines

Test #95:

score: 0
Accepted
time: 7ms
memory: 18692kb

input:

100000 100
CPPCPPCPPCPCPCPCPPPCPPPPCCPCPCPPPCPPPPPPPCPPCCPCPCPPPPCPPPPPCCPPPCCPPPCCPCPPPPPPCPPPPPPPPPCCPCPCPPCPPCPPPCCPPPPPCPPPCPCCPPPPPCPPPPPCCCCPPPPPPCPCCPPPPCCCCPCPPPPCPCPPPPCPPPPCPCCPPPPPPPPPCPPPPPPPPPPCPPPPPCPCPPPPPPPCPCPPPPPCPCPPPPPPCPPCCCCCPCPPPCPPCCPPCPPPPPPPPPPCPPCPPCCPCCPPPCPPPPPPPCPPCPPPP...

output:

1248295372
1248295371
1248295371
1248295371
1248295371
1248295371
1248295371
1248295372
1248295373
1248295373
1248295372
1248295373
1248295373
1248295373
1248295373
1248295373
1248295373
1248295372
1248295373
1248295373
1248295373
1248295372
1248295373
1248295372
1248295372
1248295372
1248295373
124...

result:

ok 101 lines

Test #96:

score: 0
Accepted
time: 0ms
memory: 15196kb

input:

100000 100
PPPPCPPPPPCCCPPPPPCCCPPPPCCPCPCPPCCCPPPPPCCPPPPPPCPPPPCCCPPPPCPPCPPCPPPPPPPPCPPCPPPPPPCPPPCPCPPPPPPPPPPPCPPPPCCCPPPPCPCCPPPCPCPPCPPCPPPCPPCPPPPPPCPPPPPCCPPPPPPPPCPCPPPPCPCPPCPPCCPPPPPPPPPPPCPPPPPPPPPPPPPPPPPCCPCPCPCPPPPPPCPPPCPCPPCPPCPPPCPPPPCCCPCCPPPCPCPPCPPPPCPPPPCPPPCPPCPCPPPPPPPCCPCCP...

output:

1247068563
1247068563
1247068564
1247068563
1247068563
1247068563
1247068562
1247068562
1247068562
1247068562
1247068562
1247068561
1247068561
1247068560
1247068561
1247068561
1247068561
1247068560
1247068559
1247068559
1247068558
1247068558
1247068558
1247068558
1247068558
1247068557
1247068557
124...

result:

ok 101 lines

Test #97:

score: 0
Accepted
time: 3ms
memory: 17348kb

input:

100000 100
CCPPPPPCCPPPCPCPCCCPCCCPPPCPCPCCPCPCCCCPPPCCPCCPCCPPCCPCCPPCCCCPPPCCCCPPCPPPCCPCCCCPPCPPPPPCCPCPPPCPPCPCPCCPPCCCCPCCCPPCPPPPCPCPCCPPPCCPCCCPPPPPCCCPCCPPCPPCPCCPPPPCCCPCCPCCPCCCCPCPCPPPCCCCPPCPPCCPCPPCCCPPCPCCCCPCCPPPPCCPCPCCCCPPPPPPPCCCCPCCCCPPPCPCCPPCCCPCCCCCCPCPPPCCCCCPPPCCPCCPCCCPPPPPC...

output:

19039542
19039542
19039541
19039542
19039542
19039543
19039542
19039543
19039543
19039543
19039544
19039544
19039544
19039544
19039544
19039543
19039544
19039543
19039544
19039544
19039545
19039544
19039544
19039544
19039543
19039542
19039542
19039543
19039542
19039542
19039542
19039542
19039543
190...

result:

ok 101 lines

Test #98:

score: 0
Accepted
time: 0ms
memory: 15356kb

input:

100000 100
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPCPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

450597422
450597422
450597422
450597422
450597422
450597421
450597421
450597421
450597420
450597420
450597419
450597419
450597419
450597419
450597419
450597419
450597419
450597419
450597418
450597418
450597418
450597418
450597418
450597418
450597418
450597418
450597418
450597418
450597418
450597418
...

result:

ok 101 lines

Test #99:

score: 0
Accepted
time: 5ms
memory: 16968kb

input:

100000 100
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCPCCCPCCCCCCCCCCCCCCCCCCCCPCPCPCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCPCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCPCCCCCCCCCCCCPCCCCCCCCCCCPPCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCPC...

output:

449439192
449439192
449439192
449439192
449439192
449439192
449439191
449439190
449439190
449439190
449439190
449439190
449439190
449439190
449439190
449439190
449439190
449439190
449439190
449439190
449439190
449439190
449439190
449439190
449439190
449439190
449439190
449439190
449439190
449439190
...

result:

ok 101 lines

Test #100:

score: 0
Accepted
time: 0ms
memory: 17416kb

input:

100000 100
PCCPCCCCPCCPCPPPPCCPPPPCCPCPPCCCCPPPCPCPPCCPCCCCPCPCPPCCPCPCCPCCCCPCPCPPPPCCPCCCCPCPPPCCPCPPCCPCCPCPCPPCCCCPCPCPCCCCPCCCPPPPCPCPCPPPPCPCPCPCPPCCPCPPCPCPCPCCPCPCPCPCCPPCCPPPPCPCCPCPCPPPCPCPPCCCCCPPPCPCCCCPPPCCCCCCPCPCPCPPPPCPPCCPPPCPCCPPPPPPPPPCPPCPPCPPCPPCCPCCPPPCPPPPCCPPPPPPPPCCCCCPCCPCC...

output:

12878226
12878226
12878227
12878226
12878227
12878226
12878225
12878225
12878224
12878223
12878222
12878222
12878222
12878223
12878223
12878223
12878222
12878223
12878224
12878224
12878223
12878224
12878225
12878225
12878224
12878225
12878226
12878226
12878225
12878225
12878225
12878226
12878226
128...

result:

ok 101 lines

Test #101:

score: 0
Accepted
time: 3ms
memory: 17408kb

input:

100000 100
PPPPCPPCPPCCCCCCPPCCPPCCCCPPPCCCPCCCPCPPPPPCPCPPCPCCCCCPCPCCPPPPCCPPCCCPPCCPPCPPCCCPCPPCPPPPCCPCCCCCPPPPCCCCPCCCPCCPCCCCCPPCPCPPPCCPPPPCCCPPCPCCPCCCCCPPCCCCPCPCPCPPPCCPCPPPCPPPPPCCPPCPPPCCCPCCCPCPPCPCCCCCCPPPPPPPPPCPPPCPPCCCCPPCCCCPPPCCCCCPCPCCPCCCPCCCCCPCCPPPPCCPCCPCCCCCPPCPCPCCCCPPPPPCP...

output:

15435093
15435093
15435094
15435093
15435093
15435093
15435092
15435092
15435093
15435094
15435093
15435094
15435093
15435092
15435092
15435093
15435092
15435093
15435092
15435093
15435092
15435092
15435093
15435094
15435093
15435093
15435092
15435091
15435092
15435091
15435092
15435092
15435092
154...

result:

ok 101 lines

Test #102:

score: 0
Accepted
time: 3ms
memory: 17228kb

input:

100000 100
CPCCPPPCCCPPCCPCCCCCPCPCPCCCPPPPPCPPPCCCPPPCCCPCPPPPPCPCPCPPPPCPPCPPCPCCCPCCPCPCCPPPCPPPCPPPPCPCPPCCPPPPCCCPCPPCPCPPPCPCPPCPCCCCPCPPPPCPPCPPCPCCCCCPCCPCCCCCCCPCPCPCPPPCCPPPCPCPCCPCPCPPPPPPCCCPCPPPPPCCPCCPPCCPCCPPPCPPCCPCPPPCCCCPPCPPCPPPCPCCPCPPCCCCPPCPPCCCCCPPPPPCCPCPCPPCCPCPPCPPCPPPPCCPC...

output:

7008230
7008230
7008230
7008231
7008231
7008231
7008232
7008232
7008233
7008233
7008234
7008234
7008234
7008234
7008235
7008234
7008233
7008233
7008232
7008232
7008231
7008230
7008229
7008230
7008230
7008230
7008229
7008228
7008229
7008228
7008228
7008229
7008230
7008229
7008229
7008229
7008228
7008...

result:

ok 101 lines

Test #103:

score: 0
Accepted
time: 7ms
memory: 17248kb

input:

100000 100
PCCCPCPPPCPCPCCPCPPPCPCCCCCCCPPCCPCCCCCCCCCPPCCPCPPPPPCCCCPCPPPPPPCCCCPCCPCPPCPCPPPCCCCPCCPCCPCPCPCCPCCCPPPPPCPCPPPCPCCPCCCPCPPPPCPPCPCCCCCCCCPCPPPCPCPCCPCCPCCPCPCPPPCPPPCPCPPPCCPCPCPPCPPPCPCPCCPPCCPPPPCPPCPCCPPCPCCCPCCPPCCPPCCPPCPPPPPCCCCPCPCCCCPCCPPCPPCPCPPPCPCPCCCCPPPCPPCCPCCCCPPPPPPPC...

output:

10168430
10168430
10168430
10168431
10168430
10168429
10168428
10168428
10168429
10168429
10168428
10168427
10168426
10168425
10168425
10168424
10168425
10168425
10168425
10168426
10168427
10168426
10168427
10168426
10168426
10168427
10168427
10168426
10168425
10168425
10168424
10168424
10168423
101...

result:

ok 101 lines

Test #104:

score: 0
Accepted
time: 3ms
memory: 17312kb

input:

100000 100
PCCPCCCPCPCCCCPPPPPCPCCPPCCCCPCCPCCPPCPPPPCPCPCCCCPCPCPCPPPCCCPPCCPCPPPCCPPCCCPCPPPCCCPPCPPCCPPPCPCPCPCCCCPCCCPCCCPPCPPPPCPCPPCPCCCCCPPCPPCPPPCPPCPCCPCCPCPPPPPPCPCCCPCCCPCPPCCCCCCCCPPPCCPCCPCCPPCPCCPCPPCPPPCCCPCPPCPPPPPCCPPCPPPCPCPCPPCCPPPCPCPCCCCPPCPCCCCPCCCPPCPPPCPPCPCPCCCPPCCCPPCCCPPPC...

output:

9390318
9390319
9390318
9390319
9390318
9390318
9390317
9390318
9390319
9390320
9390320
9390319
9390318
9390318
9390318
9390318
9390319
9390320
9390321
9390322
9390323
9390324
9390325
9390324
9390325
9390325
9390326
9390326
9390327
9390327
9390328
9390328
9390329
9390330
9390331
9390331
9390330
9390...

result:

ok 101 lines

Test #105:

score: 0
Accepted
time: 3ms
memory: 17292kb

input:

100000 100
PCCCCCCPPCCCPPCCPCPPPPPPPCCPPPCCCPCCPPPPCCPCCCCCPCPCCCCCPPPPPCCCCPPPPPCPPCCPCPCPPCPCCCPPCCCCPPPCCCCCPPPCPCCCCCCCCPPPCPCCCPPCCPCPCPCPCPPCPPPCCPCCPCCPPCCCPPCCCCPCPCPPPCCPCCPCCPCCCPPPCPCCPPCCPCCCCCCCCPCPCPCPPPPCPCPCCPPCCPCCCCCPPPCCCCPCPCCPPPCCCCPPCPCPPCPCPPPCPPCPPPPCPPCPPPPPCPPPPPPPPCPPCPCPP...

output:

4476769
4476770
4476770
4476769
4476768
4476768
4476767
4476766
4476765
4476765
4476764
4476763
4476762
4476762
4476761
4476761
4476761
4476762
4476761
4476760
4476759
4476759
4476758
4476757
4476757
4476758
4476758
4476758
4476757
4476757
4476757
4476757
4476757
4476757
4476757
4476757
4476758
4476...

result:

ok 101 lines

Test #106:

score: 0
Accepted
time: 0ms
memory: 16776kb

input:

100000 100
PPCPPPPPPPPPPCPPPPCPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPP...

output:

447026387
447026387
447026387
447026387
447026387
447026387
447026387
447026387
447026387
447026387
447026387
447026387
447026387
447026387
447026386
447026386
447026386
447026386
447026386
447026386
447026386
447026386
447026386
447026386
447026386
447026386
447026386
447026387
447026386
447026386
...

result:

ok 101 lines

Test #107:

score: 0
Accepted
time: 0ms
memory: 17320kb

input:

100000 100
CCCCCPCCCCCCCCCPCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCPCPCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCPCCCPCPCCCCCCCCCCCCCCCCCCCCCCCCCCPCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCPCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

450801537
450801537
450801537
450801537
450801537
450801537
450801537
450801537
450801537
450801537
450801537
450801537
450801537
450801537
450801537
450801537
450801537
450801537
450801538
450801538
450801538
450801538
450801538
450801538
450801539
450801539
450801538
450801538
450801538
450801538
...

result:

ok 101 lines

Test #108:

score: 0
Accepted
time: 0ms
memory: 17280kb

input:

100000 100
CCCPCCCCCCCPPCCCCCCPCCCCPCPCCCCCCPCCCCPPCCCCPPPCCCCCCCCCCCCCCCPPCCCCCCCCCCCPCCPPCCCCPCPCCCCCPCCCPCCCPCPCCCCPCCPCCCCCPCPCCCCCCPCPCCPPCCCCCPCCCCCPCCCPCCCPCCCCCPPPCCPCCCCCCPCCCCCCCCPCCPPCCCPCCCPCCCCCPPCPCPCPPCCPPPCCCPCCCPCCCPCCCPPCCCCCCCCCPCPPPCCCPCCCCCCCCCCPCCCCCCPCPCPCCCCCPCCCCCCPPPCCCPCCC...

output:

1253531343
1253531343
1253531343
1253531343
1253531343
1253531344
1253531343
1253531343
1253531343
1253531343
1253531342
1253531342
1253531342
1253531343
1253531344
1253531344
1253531344
1253531344
1253531343
1253531343
1253531343
1253531343
1253531343
1253531344
1253531343
1253531344
1253531344
125...

result:

ok 101 lines

Test #109:

score: 0
Accepted
time: 3ms
memory: 17472kb

input:

100000 100
CCCPCPCPCCCPCCCCCCCCCCCCCCPCPPCCPCCCCCCCCCCCCCCCCCPCCCCPPPPCCPCCCCCCCCCPCCPCCCCCCPCCCPCCCCPCCCCCCCCPCCPCPCCCCCCCCPCPCPPCCPCCCCCCCPCPCCCCCCCCCCPCCCPCCCCCCCCPCCCPCCCCCCCCPCCPCCPPPPCCCPCCCCCCCCPCCCPCCPCCCCPPPPCCCPCCCCCCCCCCCCPCPPPPCCCCCCCCCCCPCPPCCPCPCCCPCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

1258509401
1258509401
1258509401
1258509400
1258509401
1258509401
1258509401
1258509400
1258509399
1258509398
1258509399
1258509399
1258509399
1258509399
1258509399
1258509399
1258509399
1258509399
1258509399
1258509399
1258509400
1258509400
1258509401
1258509401
1258509402
1258509402
1258509403
125...

result:

ok 101 lines

Test #110:

score: 0
Accepted
time: 0ms
memory: 16908kb

input:

100000 100
CCCPCCCCPCCCCCPCCCCPCCPPCCCCCCPCCCCCCCCCCCCCCPCPCCCCCCPCPPPCCCCCPCCCCCCCCPCCCCPCCCPCCCCCCPCCCCCCCCCPPCPCPPCCPPPPPCCCCCCCCCPCCCCCPPCPCPCCCCCPCCCCCCCPCCPCPCCCCCCCCCPCCCPCCCPCCCCCCCCCPPCCCCCCPCCCCCPPPCCCCPCCPCPCPPCPCCCCCCCCCCCCCCCCCCCCPCPPCCPPCCCCCCCCCCCPPCPPCCCCCCCCPCCCCCCCPCPCCCCCCCCCCCCPC...

output:

1243258708
1243258709
1243258710
1243258710
1243258710
1243258710
1243258710
1243258709
1243258709
1243258709
1243258708
1243258707
1243258706
1243258707
1243258707
1243258707
1243258708
1243258708
1243258708
1243258709
1243258709
1243258709
1243258710
1243258711
1243258711
1243258711
1243258712
124...

result:

ok 101 lines

Test #111:

score: 0
Accepted
time: 3ms
memory: 15184kb

input:

100000 100
CCPPPCCCCCCCCCCCCPCCCCPCCPCCCPPPCCCPPPCPCCCPCCCPCCCCCCCPCPCCCCCCCCCCPCCCPCCCCCPPCPCCCCCPCPCCPPCPPCPCCCCCCCPCCPCPPCCCCCPPCCCCPCCCPCPPPPCCCPCCCCPCCCCCCPCCPPPPCCPCCCPCCCCCCCCCCCCPPCCPCCCPCPCPCCCCPCCCPCCPCCCPCPCPPPCCPCCCCCPPCCCCCCCCCCCPPCCCCCCCPCCCCCCPCCPCCCPCCCPCCCPCPCPPPCPCCPCCCCCCCPCCCPPCC...

output:

1247803219
1247803220
1247803220
1247803221
1247803222
1247803223
1247803222
1247803223
1247803223
1247803223
1247803223
1247803223
1247803223
1247803223
1247803223
1247803223
1247803223
1247803223
1247803223
1247803222
1247803223
1247803222
1247803222
1247803222
1247803223
1247803223
1247803222
124...

result:

ok 101 lines

Test #112:

score: 0
Accepted
time: 0ms
memory: 17232kb

input:

100000 100
CCPPPCPCCCCCCCCCPPCCCCCCCCPPPPCCCCCCCCCPCCCCPCCCPCCCPCCCCPCCCCPPCPCCCCCCCCCPCCCCCCCCPPCPCCPCCCCCCCPCCPCPCCCCCCPPPCCCCCPCCCPPCCCPCCCPCPCCCPPPCCCCCCCCPCPPCPPCCCPCCCCPPCCCCCCCCCCCPCCCCCCCCCCPPPCCPPPCCCCPCCCCCCPPCCCCCCPCCCCPCCCCCCCCCCCCCPPCCPCPCPCPCPPCCCCCCCCPCPCCCCCCCCCPCCCPCCCCCCCCPCPCCCCCP...

output:

1248554800
1248554800
1248554799
1248554798
1248554797
1248554797
1248554797
1248554797
1248554797
1248554798
1248554798
1248554799
1248554799
1248554798
1248554798
1248554799
1248554798
1248554798
1248554798
1248554797
1248554798
1248554798
1248554797
1248554796
1248554796
1248554796
1248554797
124...

result:

ok 101 lines

Test #113:

score: 0
Accepted
time: 6ms
memory: 17380kb

input:

100000 100
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 101 lines

Test #114:

score: 0
Accepted
time: 0ms
memory: 15216kb

input:

100000 100
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 101 lines

Subtask #6:

score: 15
Accepted

Test #115:

score: 15
Accepted
time: 174ms
memory: 51872kb

input:

1000000 1000000
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1000001 lines

Test #116:

score: 0
Accepted
time: 183ms
memory: 51116kb

input:

1000000 1000000
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1000001 lines

Test #117:

score: 0
Accepted
time: 211ms
memory: 53268kb

input:

1000000 1000000
PPPPCPPPPPPPPCPPPPPPPPPPPPPPCPCPPPPPPPPPPPPPPPPCCPCPPPPPPPPPPPPPPPPPPPCPPPPPPPCPCPPPPPPPCPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPCPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPCPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

80138730781
80138730781
80138730781
80138730781
80138730781
80138730781
80138730781
80138730781
80138730780
80138730780
80138730780
80138730780
80138730780
80138730781
80138730781
80138730781
80138730781
80138730780
80138730780
80138730780
80138730780
80138730780
80138730780
80138730780
80138730780
...

result:

ok 1000001 lines

Test #118:

score: 0
Accepted
time: 241ms
memory: 54208kb

input:

1000000 1000000
PPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPCPPCPPPPPPPCPPPPPPPPPCPCPPPPPCCCPPPPPPPPPCPPCPPPPPPPPCCPCPCPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPCPCCPPCPPPPPPPPPPPPPCPPPCPPPPPPPPPPPCCPPPCPPPPPPCPPPPPPPPPPPPPPCPPPCPPPPPPPPPPCPPPPCPPPPPCPPPPPPPPPPPPPCPPPPCPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPC...

output:

80044043054
80044043054
80044043054
80044043053
80044043053
80044043052
80044043052
80044043052
80044043052
80044043052
80044043052
80044043052
80044043052
80044043052
80044043052
80044043052
80044043052
80044043052
80044043052
80044043052
80044043052
80044043052
80044043052
80044043052
80044043052
...

result:

ok 1000001 lines

Test #119:

score: 0
Accepted
time: 202ms
memory: 58396kb

input:

1000000 1000000
PCPPCPPPCCPCPPPPPPCPPPPPCPPPPPCPPPPPCPPPPPPPPPPCPPPPPPPPPPPCCPPCCPPPPPPCCCPPPCPPPCPPPPPCCPCCPPPPPPPPCPPPPPPPCPPPPPPPPPPPPPPPPPCCPPPCPCPPCCPPPPPPCPPPCCPPPPPPPPPPPPPPPPCPPCPCPPPCCCCCPCCPCPPCPPCPPPPCPPPPCPCCPCPPPCPPPPPPPPPPCPCPPPPPPPPPPCPPCPPPCPCPPPPPCPCPPPPPPPPPPCPPPCPPCCCPPPPPPPPPPPPP...

output:

120174980473
120174980473
120174980473
120174980473
120174980473
120174980473
120174980472
120174980472
120174980472
120174980472
120174980472
120174980472
120174980471
120174980471
120174980470
120174980470
120174980469
120174980470
120174980471
120174980470
120174980470
120174980470
120174980469
1...

result:

ok 1000001 lines

Test #120:

score: 0
Accepted
time: 245ms
memory: 55052kb

input:

1000000 1000000
PPPPCPCPPCPCPPCPPPCPCCPPCPPPPPCPCPCPPPPCPPPPCPCPPCPPCPPPPPCPPPPPPCPPCPCPPPCPPPPPCPPPCPCCCCCPPPCPPPPPPCPCPPPPPPPPPPPPPCPCPPPPPPPPPPPPCCPPCPPPPPCPCPPPPPPCPPPPCPPPPPCCPPPCPPPPPPPPPPPPPCPPCPPPPPPCPPPPPPPPPCPPPPPPPPPPPPPPPPPCPPCCPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCCPCPPCPCPPPPCPCCPPCPPPPCPCPP...

output:

119872645223
119872645224
119872645224
119872645224
119872645224
119872645224
119872645224
119872645224
119872645225
119872645225
119872645226
119872645226
119872645226
119872645226
119872645226
119872645226
119872645226
119872645227
119872645228
119872645228
119872645228
119872645228
119872645227
1...

result:

ok 1000001 lines

Test #121:

score: 0
Accepted
time: 278ms
memory: 64228kb

input:

1000000 1000000
CPCPCCPCPPPPCPCPPPCPPPPPPCCPPCPPPPPCPPPCCCPPPPPPPCPPCCPPPPPPPPPPPPPPCPPCPCPCCPCCPCCCPCPPPPPCPCPCPPPPPPPCPCCPPPCPCPPPCPCPPCPPCPPPPCPPPCPPCPPCPCPPPCPPPPPPPPPPCPPCCCCPCCCCPPPPPPPPPCPCPCPCCCCPPPPCPPPPPPPPPPPPPPCPPCPCPPPPPPPPPPPPPPCPCPPPPCCCPPCCPCPPCPPPPCPPPPPCPCPPPPCPPPPPCCCPPPPPPCPPPCPP...

output:

120200021038
120200021039
120200021039
120200021039
120200021039
120200021040
120200021040
120200021039
120200021039
120200021040
120200021040
120200021040
120200021041
120200021041
120200021042
120200021042
120200021043
120200021043
120200021043
120200021043
120200021043
120200021042
120200021043
1...

result:

ok 1000001 lines

Test #122:

score: 0
Accepted
time: 287ms
memory: 60964kb

input:

1000000 1000000
PPPPPPPPCPPCCCPCPPPCCPPPPPCPCPCCCPPPCPPPPPPCPPPPPPPCPCPPCPPPPPPCPPPPPPCPPPPCPPPPPPPPPPCPPPCPCCPPPPPPCCPPCPPCPPPPPPPPCCPPPPPPCPCPCPCPPCPCPCCPPCPCPPCPPCCPPPPPPPCPCPPPPPPPPPPPPPPCCPPCPCPPPCPPPPPPCPPPPPPPPCPCPPPCCPPCPPPPPCPCPPPPPCPPCPPCPCPCCCPPPCPPPPPPPPPCCCCPPPPCPPPPCPCPCCCCPPPPCPPPCPPC...

output:

120237628170
120237628169
120237628168
120237628169
120237628168
120237628168
120237628168
120237628167
120237628167
120237628168
120237628168
120237628167
120237628167
120237628168
120237628167
120237628168
120237628168
120237628168
120237628168
120237628169
120237628169
120237628168
120237628169
1...

result:

ok 1000001 lines

Test #123:

score: 0
Accepted
time: 246ms
memory: 62196kb

input:

1000000 1000000
CPCPPCCPPCPCPPPPPCPCCCPPCPCCPPPPPPCPCCCCPPCCCPCCPPCPPPPPCPCPPPPPPCPPPPPPCPPPPPPPPCPCPPPPCPPCCPCPCCPPCCCCPPPPPPCCCCPPCPPPPCPPPPCPPPCPPCPPPPPPPPPPPPPCPPCCCCPPPPPPPCPCPPPPPCPCCCPPPPPCPPCPPPPCCPPPPCPPPPCPPPCCPCPCPPCCPPPCPCCPPCPCPPCCCCPPCCCCPPPCPCPPPPPCCCCCPPCCCCCPCCCPPPPPPPPCPPCPCPCCPPCP...

output:

79907840992
79907840993
79907840993
79907840993
79907840993
79907840992
79907840992
79907840993
79907840993
79907840993
79907840992
79907840993
79907840993
79907840993
79907840994
79907840994
79907840993
79907840993
79907840994
79907840993
79907840992
79907840992
79907840992
79907840992
79907840992
...

result:

ok 1000001 lines

Test #124:

score: 0
Accepted
time: 225ms
memory: 60244kb

input:

1000000 1000000
PPPPPCCPPCPCCPCCPPPPPPPPPPPPPPPPPPPCCCCPCPPCPPCPCPCCPPCPPCCPCPCPCCPPPPCPPCPCPCPPPPPPPCPPPPPPPCCCPPPCPPPPCPPCCPPPPPPCPPCCCPCPCPPPCPCCPCPPCCPCPCCPPPPPCCPPCCCPCCCPPCPPPPCCPCPPPPCPPCCPPPPPPPCCCCCPPCCCPPPPPPPPCPCCPPCCPPPPCPPPPPPCPPPPPCPPCCPCCCPPCPPPPCCPPPPCPCCCPPCPPPPCCPCPCPPPPPPPCPPCPCPP...

output:

80026607037
80026607037
80026607037
80026607036
80026607036
80026607035
80026607034
80026607033
80026607033
80026607033
80026607034
80026607034
80026607033
80026607032
80026607032
80026607033
80026607033
80026607034
80026607033
80026607034
80026607034
80026607035
80026607034
80026607035
80026607034
...

result:

ok 1000001 lines

Test #125:

score: 0
Accepted
time: 247ms
memory: 65908kb

input:

1000000 1000000
CPPCCPCCCPCCPCCCCCCPPCPPPCCCPCCCPCPCPCPPPCPPPPPPPPPPPPPPPPPCPPCPPPCCPCCCPCCPPCPPCCCPCPCPPCPPCPPPCPCPPCCPCCPPCPCPPCCCPCCCPCPPCPPCPPCPCCPCCCCCCPCCCPPPCPPCCPPPCCCCCPPCCPCPPCPPCCPPCPCCPPCPPPCPPCPPCCPPPCCPPPPCCCPCPPCPCPPCCPCCPPCPPPPPCCCCCPPPPPPCPPPCCCCCPCCPPPPPPCPCPCCCCCCCCCPPCPCCPCCPPPPP...

output:

929435116
929435116
929435117
929435117
929435117
929435117
929435116
929435116
929435117
929435117
929435118
929435118
929435118
929435119
929435118
929435117
929435117
929435117
929435118
929435117
929435118
929435118
929435117
929435117
929435118
929435117
929435118
929435117
929435118
929435117
...

result:

ok 1000001 lines

Test #126:

score: 0
Accepted
time: 194ms
memory: 64628kb

input:

1000000 1000000
PPPPPCPCCCPCPPPPCCPCCPCCPCPCCPCPCPPCCCCCPPCPCPPPPCCCPCPPPCPPCCPPCCCPPPPCPPCPCCPPCCPPCCPPPPPCCCCPPCCPPCCPCPCPPPCPCPCCPCCCCCPCCPCCPPPCCCPPCPCPCCCCPCCCCPPCPCPCCCCCPCPPCPCPCPCCPPPPCCPPCPCPCPCCPCPCPPCCPPCPPPPPCCCCPPPCPPCPCPCPPCPPPPCPPPCCPPCCCPPPPPPPPPCCPCCCCCPCPCPCPPPCCCCCPPPCCPCCPCPCPPCP...

output:

630448700
630448700
630448699
630448698
630448698
630448698
630448698
630448697
630448697
630448696
630448696
630448695
630448695
630448694
630448694
630448693
630448693
630448694
630448695
630448695
630448694
630448694
630448694
630448694
630448695
630448695
630448695
630448695
630448694
630448695
...

result:

ok 1000001 lines

Test #127:

score: 0
Accepted
time: 228ms
memory: 65968kb

input:

1000000 1000000
CPCCCCCCCCCCPCCPCCCPCCPCCPPPPCPCCCPCPPCCPPCCCCCCCCCPCPCPPCPCCCCPCPCPPPPPCPPCPCCCPPPPCCCPPCPCPCCPPCPCCPPCPPCPCCCCPPCPPCCCCCCCPPPPCCCCPCPPPCCPCCPCPCCCCPCPCCCPPPPCCPPCPCCCPCPPCCCCCPCPPPPCCCPCPPPCCPPPCCPPPCCPCCPCPCPCCPCCPPCPPPPCCCCCCCPPCCCPCPCCCPCCCCCPPPCPPCCCCCPPPPPPCPCCCCCPPCCPPCPCPCCC...

output:

79678774637
79678774638
79678774638
79678774638
79678774638
79678774638
79678774639
79678774639
79678774639
79678774639
79678774638
79678774638
79678774638
79678774638
79678774638
79678774638
79678774637
79678774636
79678774635
79678774635
79678774636
79678774636
79678774636
79678774636
79678774636
...

result:

ok 1000001 lines

Test #128:

score: 0
Accepted
time: 266ms
memory: 60716kb

input:

1000000 1000000
CPCCCPCPCCCCPPCPPPPPPPPCPCPCPPPCCPCCPPCCPCCCCCCPPCPCPPPCPPCPCCPCCCCCPPPCPCPPPCCCPCPPPPCCPPCPCPCCPPCPPPCCCCPCCCCPPCCCCCCPPCCCCCPCPPPPCPCCPCCPPCPCCPPPCCPCCCCCPPPPCCCPCCCPPCCPPPCPPPPCCPPCPCCPCCCPPCCPCPCPPPCCCPCPCCPPPPCPPPPPPCPCCPPCPPCCPPPCPCPPPCCCCPCCPPCCPCCPCPCCCCPCPCPCPPCCCPCCCPPCCPPC...

output:

80328877482
80328877482
80328877482
80328877481
80328877480
80328877480
80328877479
80328877479
80328877478
80328877478
80328877478
80328877478
80328877478
80328877478
80328877477
80328877478
80328877477
80328877477
80328877476
80328877475
80328877476
80328877476
80328877476
80328877476
80328877476
...

result:

ok 1000001 lines

Test #129:

score: 0
Accepted
time: 274ms
memory: 61712kb

input:

1000000 1000000
CPCCPPCCCCCCCCCCCCCPCCCCCPPCCPPPCPCCCPCCCPCPCPCPPPCCCCPPCCCCCCCCCCCPCCCCPPCCCCPCPPCCCCCCCCPPPCPCCPPPCCPPCCCCCPCPPCCCCCCPPCCPCCCCCPPCCCCCCCCPPPPPPCPCCCPPCCCCCCCCPPPCPCCPCCCCCCPPPCPPCPCCCCCCCCCPCPCPCPCPCCPCPPCCPCPPCPCPCPPPCCPCPPCCPPCCPPPPCPPCCCPCCCCCPCPPCPCCCPCCCPCPCPCCCCCCPCCCPCPCCCCC...

output:

119839757570
119839757570
119839757570
119839757569
119839757570
119839757570
119839757570
119839757570
119839757569
119839757568
119839757569
119839757569
119839757568
119839757568
119839757567
119839757567
119839757567
119839757566
119839757567
119839757567
119839757568
119839757569
119839757568
1...

result:

ok 1000001 lines

Test #130:

score: 0
Accepted
time: 254ms
memory: 60556kb

input:

1000000 1000000
CPPCPCCCCCCCCPPCCCCCCCPPCCCCCCPPPCCCPPCCPCCCCCCCPCCPCCPCCCPCCPCCCPCPCPPCCCCCPCCCPCPCCPCCCPPPPPPCCPCCCPCCPCCCPCCCCCCCPPPCCPCCPPPCCPPCCPPCCCCCPCCPPPCCCPCCCCCPCCCCPCPCCCCCCCCPPCCCPPCCCCCPCCCPCCCCCPCPCCCPCCCPCCCCPPPPCCCPCCCCPCCCCCCCPCPPCCCCCCCCCCPPCCCCCPPCCPCCCCCCPCPPPCPCCCPPCCCCPPCPPCCC...

output:

119939633079
119939633078
119939633079
119939633079
119939633080
119939633079
119939633079
119939633080
119939633080
119939633080
119939633081
119939633082
119939633082
119939633082
119939633082
119939633082
119939633082
119939633082
119939633081
119939633081
119939633080
119939633079
119939633079
1...

result:

ok 1000001 lines

Test #131:

score: 0
Accepted
time: 241ms
memory: 56420kb

input:

1000000 1000000
CCCCCPCCPPCCCPCCCPCCPCPCCCCCPPCCCCCCCCPCCCCCCCCCCCCCCPCCCCCPCPCCPCCPCCCCPCCPCCCCCCPCCPCCPPCPCPCCCCPCCPCCCCCCPCPPPCCCCPCPCPPCCCCCCCCCCCPCCCCCCCCPCCCPCCPPCCCCPPCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCPCCCCCPCCCCCPCPCCCCCCCPCCPCCCCCPCCCPCCPCCCCCCPCCCPPCCCCCCCPCCCCCCCCCCPPCCCCCC...

output:

120159445205
120159445205
120159445206
120159445206
120159445206
120159445207
120159445206
120159445207
120159445207
120159445207
120159445207
120159445206
120159445206
120159445205
120159445205
120159445205
120159445206
120159445206
120159445205
120159445205
120159445206
120159445206
120159445206
1...

result:

ok 1000001 lines

Test #132:

score: 0
Accepted
time: 234ms
memory: 59852kb

input:

1000000 1000000
CCCPCPPCCPCCCPCCCPCCCCCCCPCCCCPCPCCPPCCCCCCPPPCCCCCCPCCCCPCCCCCCCCPPPCCCCPCCPCPCCCCCCPCCCCCCCCCPCCCCCCCCCCCCCCCCPPCCPCCPPPCCCCCCCPPCPCCCCPPPCPCCCCCPCCCCCPCCPCPCPCPCCCCCPCCPPPCCCCCCCCCCCCPCCCCCCCPPPCCCCPCPCCCCCCPCPCCCCCCCCCPPCPCCPCCCCCCPPCCPPPCPCCCCPPCPPCCCCCCPCCCCCCCCPCCPCCCPCPCCCPCC...

output:

119719626392
119719626391
119719626391
119719626391
119719626391
119719626391
119719626390
119719626390
119719626390
119719626390
119719626390
119719626391
119719626392
119719626392
119719626392
119719626392
119719626392
119719626392
119719626392
119719626392
119719626392
119719626391
119719626391
1...

result:

ok 1000001 lines

Test #133:

score: 0
Accepted
time: 214ms
memory: 52312kb

input:

1000000 1000000
PCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCPCCPCCCCCCCCPCCCCCCPCCCCCCPPCCCCCCCCPCCCCPPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCPPCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCPCPCCCCCCCCCCCCCCCCCCPCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCPPCCCCCCC...

output:

80018300475
80018300475
80018300475
80018300475
80018300475
80018300475
80018300475
80018300475
80018300475
80018300475
80018300475
80018300475
80018300475
80018300476
80018300476
80018300476
80018300475
80018300475
80018300475
80018300475
80018300475
80018300475
80018300475
80018300475
80018300475
...

result:

ok 1000001 lines

Test #134:

score: 0
Accepted
time: 202ms
memory: 52628kb

input:

1000000 1000000
CCCPCCCCCCCPCCCCPCCCCPCCCCCCCCPCCCPPCCCCCPCPCCPCCPCPCCCCCCCCCCCCPCCCCCCCPPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCPCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCPCPCCCCCCCCCPCCCCCCCCCCPCCPCPCCCCCCCCPCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCPCPC...

output:

80303796997
80303796997
80303796997
80303796998
80303796998
80303796998
80303796998
80303796998
80303796998
80303796998
80303796998
80303796998
80303796997
80303796996
80303796996
80303796996
80303796996
80303796996
80303796996
80303796996
80303796996
80303796997
80303796997
80303796997
80303796996
...

result:

ok 1000001 lines

Test #135:

score: 0
Accepted
time: 139ms
memory: 51984kb

input:

1000000 1000000
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1000001 lines

Test #136:

score: 0
Accepted
time: 142ms
memory: 51296kb

input:

1000000 1000000
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1000001 lines

Test #137:

score: 0
Accepted
time: 212ms
memory: 64316kb

input:

1000000 1000000
CCCPCCPCCCPCPPPPCPCCPCCCPCPPCPCCPCCCCCCPCPPCCCPPCCCCCPCCPPCCCCCPPPPPPCPPPPCPPCCCPPPPPCCPPCPCCCPPPPPCPCCPPPCCPPPPCPCPCPPPPPPPCCCPCCPCPPCPPCCCPPPPPPCCCPPPCPCPCCPPPPPPCCPPPPCPCCCPCCCPPCPCPCCCCPCCPPCCPCPCCPPCCCPPCPPCCPCCCPCCCCCPCPCPPCCPPCPCCPCCCCPPPPPPCCCPPCCPCPPCPCPPCPCCPPCPPPPCPPPCCPPP...

output:

184086846
184086845
184086845
184086845
184086845
184086844
184086844
184086843
184086844
184086843
184086844
184086843
184086843
184086842
184086843
184086843
184086843
184086843
184086844
184086843
184086842
184086841
184086840
184086839
184086839
184086840
184086839
184086840
184086840
184086840
...

result:

ok 1000001 lines

Test #138:

score: 0
Accepted
time: 260ms
memory: 62408kb

input:

1000000 1000000
CPPCCPPCPPCPCPCPCCPPCPPPCPCCPPCPPPPCPCPPPPCPCCCPCPCPCCCPCPCPPCPCPCPCPPCPCPCPPCCPPCPCCPCCCCCPCPPCCCCCPCPCCCPPCCCCCCPPCCPPPCCPPPCPCCCPPCPPCPPPCCPCPPCCCPCPCPPPPCPPCCCPCPPCPPPPCCPCPCPCPPPCCCCPPPPPCCPCPPPPCCPPCPPPPCPCPPCCCCCCCPPPPCPCPPPCCCCPPCCCPCPCCPPPCPCPPCPPCPPPCPCPCPCPCPCPCPPCCPPPCPCP...

output:

303916482
303916482
303916482
303916482
303916483
303916482
303916481
303916481
303916480
303916479
303916479
303916478
303916478
303916478
303916478
303916478
303916478
303916478
303916478
303916478
303916478
303916478
303916478
303916479
303916479
303916480
303916480
303916481
303916481
303916482
...

result:

ok 1000001 lines

Test #139:

score: 0
Accepted
time: 281ms
memory: 65964kb

input:

1000000 1000000
CPCPPCPPCPPPCPCPPCPCPPPCPPCPCPCPCCCPPPPCPCCCCPCPPPPPCPCPCPPPCPCPCCCPCPCPCPCCCCCCPPCPPPCPPPPPPPPCPPCCPCCCPCCPPCPPPCPPPCPCPPCPPCCCCCPCPCPCPPCCCPPCPPPCPPPCCPCCPPCCPCPPPPPPPPPPPPPPCCPPCCPPCCCPCPPCCPPCPCCPPCPCCPCPPCPCCPCCPCPCPCPPPCCPCCCPPCCPCPPPCPCPCPCPPCCPCPCPCPPCCCPPPPCCPPPPPCCPPCPPPPPP...

output:

732302116
732302117
732302116
732302115
732302116
732302116
732302115
732302114
732302114
732302114
732302114
732302114
732302113
732302113
732302113
732302112
732302112
732302113
732302114
732302113
732302113
732302112
732302111
732302112
732302112
732302111
732302111
732302111
732302112
732302111
...

result:

ok 1000001 lines

Subtask #7:

score: 27
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Test #140:

score: 27
Accepted
time: 274ms
memory: 64640kb

input:

1000000 1000000
PCCCCCPCCCCPPCPCPCPCCPPCPPCPPCCPPPPPCCCPPCPPPPPCPPPPCPPCPPPCPPPCPPPPCPPCCCCCCCPCPCPPPPPCPPCPPPPPPPPPPCCCPPPPPCCPPPCPCCCPPPPCCPCCCPPPPCPCPCPCPPCCCCPCPPPPPCCPCPPPCPCCPCPCPPPCCPPCCCCCCPCPCPCPPPPPCCPPPCPCCPPPCPCCCCPPPPCCCCPCPCPCPPPCCPCCCPPCCCCPCCCPCCCCPCCCCCCCCPPCCPPCCPPCPPCCCPPCCCPPPCPP...

output:

146755179
146755179
146755179
146755179
146755178
146755177
146755177
146755177
146755177
146755177
146755177
146755177
146755178
146755178
146755177
146755177
146755178
146755178
146755178
146755178
146755179
146755179
146755178
146755178
146755178
146755178
146755178
146755179
146755179
146755179
...

result:

ok 1000001 lines

Test #141:

score: 0
Accepted
time: 185ms
memory: 51332kb

input:

1000000 1000000
PPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPCPPPPCPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPCCPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPCPPPPPCCP...

output:

45085759098
45085759098
45085759099
45085759099
45085759100
45085759100
45085759099
45085759099
45085759099
45085759099
45085759099
45085759099
45085759099
45085759099
45085759099
45085759099
45085759099
45085759099
45085759099
45085759099
45085759099
45085759099
45085759099
45085759099
45085759099
...

result:

ok 1000001 lines

Test #142:

score: 0
Accepted
time: 201ms
memory: 54032kb

input:

1000000 1000000
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCPCCCCCCCCCPPCCCCCCCCCCCCCCCCCCCCPCPCCCPCCCCPCPCCCCCCCCCCCCCCCCCCCCCCCCCCCPCPCCPCCCCCCCCCCCCCCCCCCPCCCCCC...

output:

44938131490
44938131490
44938131490
44938131490
44938131491
44938131491
44938131491
44938131492
44938131492
44938131492
44938131492
44938131492
44938131492
44938131492
44938131492
44938131492
44938131492
44938131492
44938131492
44938131492
44938131492
44938131492
44938131492
44938131492
44938131492
...

result:

ok 1000001 lines

Test #143:

score: 0
Accepted
time: 257ms
memory: 57880kb

input:

1000000 1000000
CCPPPCPPPPPPPCPPPPPPPPPPPPPCPPCPPPCPPPPPCCPCPCCPPPPPPPPPPPPPCPPCPPPPPPPPCCPPCCPPCPCPPCCPPPCPCPCPPPPPPPPPCCPPCCPPPCCPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPCPPCPPPPCPPPPPCPPCPPPCPPPPCCPCPPPPCCPPPPPPPPPCPCPPPPPPPPCCPCCPCPCPCPCPPPPPPPPPPPPCPPPCCPCPCPPCCCPPCPCCPPPPPPPPPPCCPCCPPPPPPPPPPPCPPPPCPP...

output:

124920609434
124920609434
124920609434
124920609433
124920609432
124920609432
124920609432
124920609431
124920609430
124920609430
124920609431
124920609430
124920609430
124920609431
124920609430
124920609430
124920609431
124920609430
124920609430
124920609430
124920609430
124920609431
124920609431
1...

result:

ok 1000001 lines

Test #144:

score: 0
Accepted
time: 282ms
memory: 59584kb

input:

1000000 1000000
PPPPPCPCCCPCPCPPCPPCPPCPPCPPPPPPCPCCCCPPPPPPCCPPPCPCPCPCPPPCPCPCPCPCPPPPPCCCPPPPCPPPPPPPPCCPPCPPPPPCPCPCPCPCPPPPPPPPPPPCCPPPPCCPPPPPPPPPPCPPPPPPPPPPPCCPPPPPPCPPPCPPCPPPPPPPCPCPCPPPPPCCPPPPPPPPPPCPPPPPPPPPCPPPPCCPPPPPCPPCPCPPPPCCCPPPPCCPPPCPPPPPCPPPPPPCCPPCPPPPPPPPPPPPCPPPCPCPPCPPPPPC...

output:

124961545527
124961545527
124961545527
124961545526
124961545526
124961545526
124961545525
124961545525
124961545525
124961545525
124961545524
124961545523
124961545523
124961545523
124961545522
124961545521
124961545521
124961545521
124961545521
124961545520
124961545519
124961545519
124961545519
1...

result:

ok 1000001 lines

Test #145:

score: 0
Accepted
time: 216ms
memory: 56996kb

input:

1000000 1000000
PPCPPCPPPPPPPPCPPPPPPPPCPPPPPPPPPPPPPPCCPPPCPPPCPPCPPPPPCPCPPPCPPCPCCCPCPPPPCCCPPCPCPCCPPPPPPCPPPPPPCPPCPPPCPPPCPCCCPPPCCPPCCPPPPPPPPPPPCPCPCCPPPPPPPPPCPPPPCCPPPPPPPPPPPPPCPPPCPPPPCPCPPPPPPPPPPPCCPPPPPCCPCPPCPPPPCPPPPCPCCCPPCCPPCPPPCCPPPPCPPPPPPCPPPPPPPPPPPPCPCPPPPPPPPCCPPPPCPPPPCPPP...

output:

124960361775
124960361775
124960361774
124960361773
124960361773
124960361774
124960361774
124960361774
124960361774
124960361775
124960361774
124960361774
124960361773
124960361773
124960361774
124960361775
124960361775
124960361775
124960361774
124960361773
124960361773
124960361773
124960361774
1...

result:

ok 1000001 lines

Test #146:

score: 0
Accepted
time: 204ms
memory: 59552kb

input:

1000000 1000000
CCPCCPPPPPPPPCPPPCCPPCPCPCPPPPPCPPPPPPPCPPPPPPPPCPCPPPCCCPCPPPPPPPPCCPPPPPPCPPPPPPPPPPCPPCPPPPPCPCCPPCCPCPPPPPPCPPPCPPPPPPPPPPPPPCPPPCCPCPCCPPCPPPCCPPPCPCPPCCPPPPPPPPPCPPCPPPPPCCPPPPCPPCPCCPCCCPPCPPPCCCPCPPPPPPCPPCPCCPCPCPPCPCPPCPPCPPPPPPCPPPPCPCCPPPPCPPPPCCPPPPPPPPPPPPPPPPCPPPPPPPCP...

output:

125024800480
125024800479
125024800479
125024800479
125024800479
125024800479
125024800479
125024800479
125024800478
125024800478
125024800478
125024800478
125024800477
125024800477
125024800476
125024800476
125024800476
125024800476
125024800476
125024800476
125024800476
125024800475
125024800476
1...

result:

ok 1000001 lines

Test #147:

score: 0
Accepted
time: 207ms
memory: 56880kb

input:

1000000 1000000
PCPPPPPPPCPPPPCCPPPPCPPCCPCCPPPPPPPPPPCPPPPPCPPPCPPPPCPPCPPCPPCPPCPPPCPPPPPCCPPCPPPPCPCPPPPPPPCPPCPPPCCPPPPPPCCPPPCCPPCPPPPPPPPCPPPPPPPPPPCPPPCPCCPCPPPPCPPPPPPPPPPPCPPPPPCPPPPCCPPPPPCPPPPPPPPPPPCCPPPPPPPCPPPPPPPPPCPPPCPCCCPPCPCPPPPCPCPPPCCPPPPPPCCCCPPCPPCPCCPPPPPPPCCPPPPPCPPPPPCPPPPP...

output:

124851534221
124851534222
124851534222
124851534222
124851534222
124851534223
124851534224
124851534223
124851534222
124851534223
124851534223
124851534223
124851534224
124851534224
124851534224
124851534224
124851534224
124851534225
124851534226
124851534225
124851534226
124851534225
124851534224
1...

result:

ok 1000001 lines

Test #148:

score: 0
Accepted
time: 224ms
memory: 65760kb

input:

1000000 1000000
CCPCCPCCCCPPPPPCPPCPCCPPCPPCPCPCCPCPCCPPPPPPPCCCCPCCCPPPCCPCPCCPPCPPCCPCCCCCPPPPPPPCCCPCPCCPPPCPCPCPPPCPPPPPCPPPCCPCPPPPPCCCPCPCCPCPCPCCPCCPPCPCPPCCPPPCPPPCPCPPCCPCPPPPPPCPPPCCCCPPCCPCPCCPPPPPPPCCCCPPCCPCPPCPCCCPCCCPPPPCCPCCCCCPPPPPCPCCCCPCPPPPCCCCPCCPPCCPPCPCCCPCPCPPCCPPCCPCPPPCCPCP...

output:

621614510
621614510
621614510
621614509
621614509
621614509
621614508
621614508
621614508
621614508
621614508
621614508
621614509
621614509
621614509
621614510
621614510
621614509
621614509
621614508
621614508
621614509
621614510
621614510
621614510
621614510
621614509
621614510
621614509
621614508
...

result:

ok 1000001 lines

Test #149:

score: 0
Accepted
time: 212ms
memory: 53300kb

input:

1000000 1000000
PPPPPPPPPPPPPCPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPCPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPCPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPCPPCPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

44834446790
44834446790
44834446790
44834446790
44834446790
44834446790
44834446790
44834446790
44834446790
44834446790
44834446790
44834446790
44834446790
44834446790
44834446790
44834446791
44834446791
44834446791
44834446791
44834446791
44834446790
44834446790
44834446790
44834446790
44834446790
...

result:

ok 1000001 lines

Test #150:

score: 0
Accepted
time: 222ms
memory: 53028kb

input:

1000000 1000000
PCCCCCCCPCCCCPCCCPCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCPCCCCCCCCCCCCCCCCCPCCCPCPCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCC...

output:

45001081948
45001081948
45001081948
45001081948
45001081948
45001081948
45001081948
45001081948
45001081948
45001081948
45001081948
45001081948
45001081948
45001081948
45001081948
45001081948
45001081948
45001081948
45001081948
45001081949
45001081950
45001081951
45001081951
45001081951
45001081951
...

result:

ok 1000001 lines

Test #151:

score: 0
Accepted
time: 225ms
memory: 62972kb

input:

1000000 1000000
CPCPCCPPCCPCCPCPCCPCCPCPCCPPCCCCPCPPPPCCCCPPPCCCCCCCPPCPPPCPPCPPCCPPPCCCCPPPPPCCPPCPCCPPPPCCPCPPCCCPCPPPCCPPPCPPCPPPPPPPPCPPPPCCCPPPCPPCPPCCPCPCCPPCCPPPPPCCPCCPCPCPCCCCPCPPPCPCCPPCCCPCCPCPCPPCCPCPPPPCPPCPPCPCCPPPCCPCPPPPCPCCCCPPCCCPPPPPCCCCCCCCPPPCPCPPPCPPCCCPCCCCCCPCPPPCPPPPPPCCPCPP...

output:

330692824
330692824
330692825
330692825
330692825
330692825
330692825
330692826
330692827
330692828
330692829
330692829
330692828
330692829
330692829
330692828
330692828
330692828
330692828
330692828
330692827
330692827
330692826
330692827
330692827
330692827
330692827
330692827
330692828
330692827
...

result:

ok 1000001 lines

Test #152:

score: 0
Accepted
time: 347ms
memory: 65676kb

input:

1000000 1000000
CCPPCPCCCPCPPPCCCPCPPCCCCPPCPPCCPPCCPPPCPPPCPCPCCCPPPCPCPCPCPCCCPCCCPCPPCPCCPPCPCCCPCCCCPCCPCCPPCCCCPCPCCPCCPCPPCPPCCCPPCCCCCPCPPCPCPCCPCCCPCPPCPCCCCCCPCPCCCCCPPCPCCCPCPPPCCPCCPPPPPPPPCCCPPCPPPCPCCPCCCCPPPPPCCCPPPCPPPPCCPCCPPPCPCCCPCPPCCCPPPPPPPCPPPCCPPPPCCPPCPCPCPPPCCPCCPPCCCPPCCCCC...

output:

244051985
244051986
244051985
244051985
244051985
244051986
244051986
244051986
244051985
244051985
244051985
244051985
244051984
244051984
244051985
244051985
244051985
244051986
244051987
244051986
244051986
244051985
244051986
244051985
244051985
244051986
244051986
244051987
244051987
244051987
...

result:

ok 1000001 lines

Test #153:

score: 0
Accepted
time: 208ms
memory: 61008kb

input:

1000000 1000000
CCPPCPPCPPCCCPCCPPCCPPPCPCCPPCCCPCCCCCPCCCCPPPPPPPCCPPPPPCPCCPPCCPPCCPCPPPPPPCPPCCPPCPCCCCPCPPCCPCCCPPCCCPPPPCCCCPCCCCPPPCPCCPPCCPCCCPCCCPCPCPPPCCCPCCCPPPPCPPPPPCCCCCCPPCPCCPPPCPCPPPCCPCCCPPPPCPCCPCCPCCCPCPCPPPCCCCPCPCPPCPCCPCCPCCPCPCCCPCPCPCCPCPPPCPPCCPPPCCPCCPCPCCCCPPCPCPPPCCCPPPPC...

output:

345404662
345404663
345404662
345404662
345404662
345404663
345404663
345404664
345404664
345404665
345404665
345404664
345404663
345404664
345404663
345404662
345404663
345404663
345404664
345404664
345404664
345404664
345404664
345404664
345404665
345404665
345404665
345404664
345404664
345404663
...

result:

ok 1000001 lines

Test #154:

score: 0
Accepted
time: 287ms
memory: 63124kb

input:

1000000 1000000
PCPPCCCPPPPPCPPPPPPPCCCPCCPCPPCCPPPPCPPPPPPCPCCCPCPPCPPCPCPPPCPCPCPPPCPCPPPCPCCPPCPPCPCPPPCPPCCPCPPPCPPPPPPCCCPPPCCCPCCPCCPPPPCCCPPCCPPCCPPCPCCCPPCPPCCPCCCCPCPPPPCPPCPPPPCPPPPPPPPCCPPCCPPCPCPPPPCPCPCCPPPPPCPPCPCPCCPPPPPCPPPCPCPCPCPCPPCPCPCCPCCCCPCCPCCPCCCPCCCCPCPPCPPCPCCCCCPPPPPCCPCC...

output:

298198044
298198044
298198043
298198043
298198043
298198042
298198043
298198043
298198044
298198044
298198045
298198046
298198047
298198048
298198048
298198049
298198049
298198050
298198050
298198050
298198049
298198050
298198050
298198051
298198052
298198052
298198052
298198052
298198052
298198052
...

result:

ok 1000001 lines

Test #155:

score: 0
Accepted
time: 216ms
memory: 63992kb

input:

1000000 1000000
CPCPPCPPCPCCCPPPPCCPCCCCPPPPPPCPPPPPPPPPCCCCPCPCPPCPCCCPCCCPPCCCCPPPPPPPCCCCCCCPPPPCCCCPCCPCPPCCPCCPCPCCCCCCPCPCPPCCCPPCPCCPPCPCCCPPPPPCPPCCCCCCCPCCCPCCCCPPCPPCCPPCCPPCPCPPPCPCCCCCCPPPPCPCCPCPCCCPPCPPPPPCPCPCCCPCCCCCCCPCPPPCPCCCCPPCCCCCPPPCPCPCPCCCCCPCPCCCPCPPCCCPCPCPPPCPPPPPPPPPPCCP...

output:

89933648
89933647
89933648
89933649
89933648
89933649
89933649
89933649
89933650
89933649
89933649
89933649
89933650
89933651
89933650
89933651
89933652
89933652
89933653
89933652
89933652
89933651
89933652
89933652
89933652
89933651
89933650
89933651
89933651
89933651
89933651
89933650
89933649
899...

result:

ok 1000001 lines

Test #156:

score: 0
Accepted
time: 195ms
memory: 63052kb

input:

1000000 1000000
PCPPPPCPPPCCPCPPPCCCPCCCCPCCCPPPCPCPCPPPPCCPCPPPCPPPPCCPCPPPCCCPPPPCCPCCCPCCPPCPCCPPPPPCPCPPCPPPCPCCPCCPPPCPCCPCCPCCCCCPPCPPCCPPPPPCCCPPCPPCPCCPCPCPPPCCCPPPCPPCPCPPCCPCCPCCPPCCPPPCPCPPPCPPPCCPPPCCCPPCCCPCPPCCPCPCPCPCPPPPCCCPCPPPPPCCPPCCCCCPPPPPPPPPCCCCPCCPPCPPCCPPPPPCPCPPCPCPCCPCCCCP...

output:

326669017
326669018
326669019
326669018
326669017
326669017
326669017
326669017
326669018
326669017
326669016
326669016
326669016
326669016
326669017
326669017
326669018
326669018
326669018
326669019
326669019
326669018
326669019
326669019
326669019
326669019
326669019
326669019
326669019
326669019
...

result:

ok 1000001 lines

Test #157:

score: 0
Accepted
time: 188ms
memory: 53500kb

input:

1000000 1000000
PPPPPPPPPPPPPPPPPPPPCPPPPPPPPPCPPPPPCPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPCCPPPPPCCPPPPPPPPPPPPPPPPPPPPPPCPPPPPPPPPPPPPPPPPPPPPPPPPCPPPPCPCPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPCPPPCPP...

output:

45065866158
45065866158
45065866158
45065866158
45065866158
45065866158
45065866159
45065866159
45065866159
45065866159
45065866159
45065866159
45065866160
45065866160
45065866160
45065866160
45065866160
45065866160
45065866160
45065866160
45065866160
45065866160
45065866160
45065866160
45065866160
...

result:

ok 1000001 lines

Test #158:

score: 0
Accepted
time: 181ms
memory: 53472kb

input:

1000000 1000000
CCCCCCCPCCCCCPCCCCCCCCCCCCCCCCCCPCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCPCCCCCCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCPCCCCCCCCCCCPCPCCCCCCCCCCCPCCCCCCCCCCCCCCCCPCCCCCCCCCPCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

45206153957
45206153957
45206153957
45206153957
45206153957
45206153957
45206153957
45206153956
45206153956
45206153955
45206153955
45206153955
45206153955
45206153955
45206153955
45206153955
45206153955
45206153955
45206153955
45206153955
45206153955
45206153954
45206153954
45206153954
45206153954
...

result:

ok 1000001 lines

Test #159:

score: 0
Accepted
time: 198ms
memory: 59684kb

input:

1000000 1000000
PCCCCCPPCCPCPCCCCCPPCCCPPPPPCCCCPCCCCCCCCCCPCCCCCCPCCCCCCCCCCPPCCCCCCPCCCPCCCPCPCPPCCCCCCCCCCCPPCPCCCPCCCCCCCCCCCCPCCCPCPCPCPCCPCCCCCPPPPCCCCCPCCCCCCCCCCCPCCCCCCCCCCCCCCPCPPCPCCCCCPCCCPCCCCCCCCPCCCPCCCPCCCCCCCCCCCCPCCCCPCCCCCCCPPCCCCCCPCCCCCCCPPCCPPCPCCCCPCCPCCCCCCPPPCCCCCCPCCCCCPPCC...

output:

124886899758
124886899758
124886899759
124886899760
124886899761
124886899761
124886899761
124886899761
124886899760
124886899761
124886899761
124886899760
124886899761
124886899761
124886899761
124886899761
124886899761
124886899760
124886899760
124886899759
124886899759
124886899759
124886899758
1...

result:

ok 1000001 lines

Test #160:

score: 0
Accepted
time: 196ms
memory: 56576kb

input:

1000000 1000000
CCCCCCCCCCCCCPCPCCCCCCCCCCCCCCCCCCCCPCCPPCCCCCPCCCCCCCCPPCCCCCPCPPPCCCCPCCPCCPPPCCCPCCCCCPCPCCCCCCCCPCCPCCCPPCCPCPCCCCPCCCCCPCCCCCCCPPCCPCPCCCCPCCCCCCCCCPCCPCCPCCPPCCPCCPPPCCCPCCPCCCCCPPCPCCCCCCCCCCCCCCPPCCCPCCCPCCCCCPPCCCCCCCCCCPPCCCCCCCCPCCCCCCCCCPPCCCPCCCPCCPCCCCCPCCCCCCCPCCCPPPCC...

output:

125117407848
125117407848
125117407848
125117407849
125117407850
125117407850
125117407851
125117407850
125117407849
125117407849
125117407850
125117407849
125117407849
125117407849
125117407848
125117407849
125117407850
125117407850
125117407850
125117407850
125117407851
125117407851
125117407851
1...

result:

ok 1000001 lines

Test #161:

score: 0
Accepted
time: 203ms
memory: 57360kb

input:

1000000 1000000
CCPPCCCCCCCPCCCCPCCCPCCPCCCCCPCCCCPCCCPCCPPCCCCCCCCCPCPCCPCCCPCCCCCCCCCCCCCCPCCCCCCCCCPCCCCCCPCCCPCPPCCCCCPCCCPCCCCPCPCCCPCPPCCPCCPCCCCCCCPCPPCCPCPCPCPCCCCPCCPCCCCPPCPCPCCCPCCCCCPCCCCCCCCCCCPCPPCCCCCCCCPCCCCPCPCCCCCCCCCCCCPCPPCCPCPCCPPCCPPCPPPPCPCCPCPPCPCPPCCPCCCCCCCCCCCCPCCCCPCCCPCC...

output:

125065502899
125065502898
125065502898
125065502898
125065502898
125065502898
125065502899
125065502899
125065502899
125065502899
125065502899
125065502899
125065502900
125065502900
125065502900
125065502901
125065502901
125065502900
125065502900
125065502900
125065502900
125065502900
125065502899
1...

result:

ok 1000001 lines

Test #162:

score: 0
Accepted
time: 230ms
memory: 57288kb

input:

1000000 1000000
CCPCPCCCCCCCCCCCCCPCCCCCCPCPPPCCCCPCCCPPCCCCCCPCPPCCCCCCCPCCCCPPCCCCCCCPPCPCCCCPCCPCCPCCCCPPCCCCCCPCCCCPCPPPCPCCPCCPCCCPCCPCCCCCPCCCCCPCCCPCCCCCCPPCCCCCPPCPCPPCCCCCPPPCCCCCPPCCCPCCCCCCPPCCPCCCPCCCCCPCCPCCCCCPCCCCPCPCPPCCCCPCPCPCCPCCCCCCPCCCCCCPCCCPCPCCCPCPCCCCCCCCCPCCCCCCPCCCCCCCCCCC...

output:

124853849662
124853849661
124853849662
124853849662
124853849662
124853849662
124853849662
124853849662
124853849662
124853849662
124853849661
124853849662
124853849662
124853849662
124853849663
124853849664
124853849665
124853849664
124853849664
124853849663
124853849663
124853849663
124853849663
1...

result:

ok 1000001 lines

Test #163:

score: 0
Accepted
time: 180ms
memory: 57160kb

input:

1000000 1000000
PCCCCPCCPCPPCPCPCPCCCCPCCCCCCCCCCCCCCCCCCCCPCCCPPCCCCPPCCPCCCCCPCCCCCCPPCCPPPCCCCCCCCCCCCPCPCPCCCCCCCCCPCCPCCPCCPCCCCCCPCCCCCCPCCPCCPCCCCCCCCPCCCCPCCPCCCCCCPCPCPCCCPCCCCCPCPCCCPCCCCCCCCCPCCCCCPPCCCPCCPCCCCCPCCPCCPCCCCCCCCPCCCPCCCCCCCPPCCCCPCCCCCCCCCCCCCCCCCCCPCCCPCCPPCCCCPCCCCCPCPCCP...

output:

125060903580
125060903581
125060903581
125060903582
125060903583
125060903583
125060903583
125060903583
125060903584
125060903584
125060903584
125060903584
125060903584
125060903584
125060903584
125060903584
125060903583
125060903583
125060903583
125060903583
125060903584
125060903584
125060903584
1...

result:

ok 1000001 lines

Test #164:

score: 0
Accepted
time: 144ms
memory: 50480kb

input:

1000000 1000000
PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1000001 lines

Test #165:

score: 0
Accepted
time: 157ms
memory: 50640kb

input:

1000000 1000000
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1000001 lines

Extra Test:

score: 0
Extra Test Passed