QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#459889#8731. Segregacijagrass8cow100 ✓261ms33788kbC++173.0kb2024-06-30 16:19:012024-06-30 16:19:03

Judging History

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

  • [2024-06-30 16:19:03]
  • 评测
  • 测评结果:100
  • 用时:261ms
  • 内存:33788kb
  • [2024-06-30 16:19:01]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n;
char c[2][1000100];
struct BIT{
    int tr[1000010];
    inline void ad(int x,int z){
        for(;x<=n;x+=(x&-x))tr[x]+=z;
    }
    inline int ask(int x){
        int s=0;
        for(;x;x-=(x&-x))s+=tr[x];return s;
    }
}T;
int L,R,t1,t2;
#define ll long long
ll mi[2010000],tg[2010000],cc[1001000];
void sc(int p){mi[p]=min(mi[p<<1],mi[p<<1|1]);}
void build(int p=1,int l=L,int r=R){
    if(l==r){mi[p]=cc[l];return;}
    int mi=(l+r)>>1;
    build(p<<1,l,mi),build(p<<1|1,mi+1,r),sc(p);
}
void ad(int p,ll z){if(z)mi[p]+=z,tg[p]+=z;}
void pd(int p){if(tg[p])ad(p<<1,tg[p]),ad(p<<1|1,tg[p]),tg[p]=0;}
void up(int x,int y,int z,int p=1,int l=L,int r=R){
    if(x<=l&&r<=y)return ad(p,z);
    pd(p);int mi=(l+r)>>1;
    if(x<=mi)up(x,y,z,p<<1,l,mi);
    if(y>mi)up(x,y,z,p<<1|1,mi+1,r);
    sc(p);
}
void za(int i,int x,int z){
    if(x>=i)up(L,R,z);
    else if(x<i-i/2)up(L,R,-z);
    else{
        if(i-x<=R)up(max(L,i-x),R,z);
        if(L<i-x)up(L,min(R,i-x-1),-z);
        //i-x开始:+1 前面:-1
    }
    //b_i的变化:e<=i/2时:i-e 否则:i-i/2
}
void ag(int x,int z){
    if(L<=x)up(L,min(x,R),z);
    if(x<R)up(max(x+1,L),R,-z);
}
void wrt(ll x){
    if(x<10){putchar(x+'0');return;}
    wrt(x/10),putchar((x%10)+'0');
}
void rd(int &x){
	x=0;char c=getchar();
	while(c<'0'||c>'9')c=getchar();
	while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();
} 
int main(){
    int q;
    rd(n),rd(q);
    for(int o=0;o<2;o++)for(int i=1;i<=n;i++){
    	char e=getchar();
    	while(e<'A'||e>'Z')e=getchar();
    	c[o][i]=e;
	}
    ll p0=0;
    for(int i=1;i<=n;i++)for(int o=0;o<2;o++)if(c[o][i]=='P'){
        t2+=o,t1++,T.ad(i,1);int h=t1/2;
        if(i>=t1){p0+=i-t1;cc[1]++,cc[h+1]--;}
        else if(i<=t1-h){p0+=t1-i;cc[1]--,cc[h+1]++;}
        else{
            int x=t1-i;
            p0+=x;
            cc[1]--,cc[x+1]++;
            cc[x+1]++,cc[h+1]--;
        }
    }
    for(int i=1;i<=n;i++)cc[i]+=cc[i-1];
    cc[0]+=p0;
    for(int i=1;i<=n;i++)cc[i]+=cc[i-1];
    L=max(0,t1-n),R=t1/2;
    for(int i=L;i<=R;i++)cc[i]+=abs(i-t2);
    build();
    wrt(mi[1]),putchar('\n');
    for(int ii=0,op,x,y;ii<q;ii++){
        rd(op),rd(x),rd(y);x--;
        if(op==1){
            if(c[x][y]!=c[x][y+1]){
                swap(c[x][y],c[x][y+1]);
                if(c[x][y]=='P'){
                    T.ad(y+1,-1),T.ad(y,1);
                    int o=T.ask(y);
                    za(o,y,-1);
                }
                else{
                    T.ad(y,-1),T.ad(y+1,1);
                    int o=T.ask(y)+1;
                    za(o,y,1);
                }
            }
        }
        else{
            if(c[x][y]!=c[x+1][y]){
                swap(c[x][y],c[x+1][y]);
                if(c[x][y]=='P')
                    t2--,ag(t2,-1);
                else ag(t2,1),t2++;
            }
        }
        wrt(mi[1]),putchar('\n');
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 7
Accepted

Test #1:

score: 7
Accepted
time: 27ms
memory: 7652kb

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: 42ms
memory: 7796kb

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: 41ms
memory: 7740kb

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: 51ms
memory: 9780kb

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: 53ms
memory: 7808kb

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: 45ms
memory: 9856kb

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: 54ms
memory: 9656kb

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: 42ms
memory: 7652kb

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: 38ms
memory: 7812kb

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: 34ms
memory: 9768kb

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: 27ms
memory: 9788kb

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: 46ms
memory: 9832kb

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: 39ms
memory: 9772kb

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: 50ms
memory: 7792kb

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: 44ms
memory: 7596kb

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: 27ms
memory: 7664kb

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: 41ms
memory: 9856kb

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: 42ms
memory: 7668kb

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: 48ms
memory: 9656kb

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: 49ms
memory: 7660kb

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: 110ms
memory: 19232kb

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: 119ms
memory: 19364kb

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: 136ms
memory: 19232kb

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: 137ms
memory: 19340kb

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: 137ms
memory: 19284kb

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: 127ms
memory: 19416kb

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: 140ms
memory: 19228kb

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: 125ms
memory: 19352kb

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: 124ms
memory: 19416kb

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: 126ms
memory: 19272kb

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: 47ms
memory: 7724kb

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: 57ms
memory: 9680kb

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: 52ms
memory: 9700kb

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: 52ms
memory: 9772kb

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: 52ms
memory: 9772kb

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: 51ms
memory: 9704kb

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: 9772kb

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: 9784kb

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: 1ms
memory: 7816kb

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: 9712kb

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: 2ms
memory: 9680kb

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: 2ms
memory: 9848kb

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: 1ms
memory: 7820kb

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: 9844kb

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: 1ms
memory: 9664kb

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: 0ms
memory: 9776kb

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: 1ms
memory: 9708kb

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: 1ms
memory: 7728kb

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: 1ms
memory: 7668kb

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: 0ms
memory: 9656kb

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: 1ms
memory: 9776kb

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: 1ms
memory: 5696kb

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: 1ms
memory: 9656kb

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: 9780kb

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: 1ms
memory: 9868kb

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: 9784kb

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: 2ms
memory: 9800kb

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: 0ms
memory: 7748kb

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: 9784kb

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: 7676kb

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: 1ms
memory: 7724kb

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: 1ms
memory: 7612kb

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: 2ms
memory: 9720kb

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: 0ms
memory: 9828kb

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: 7864kb

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: 2ms
memory: 9840kb

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: 2ms
memory: 9828kb

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: 2ms
memory: 9824kb

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: 2ms
memory: 9836kb

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: 2ms
memory: 9844kb

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: 2ms
memory: 7744kb

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: 7856kb

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: 0ms
memory: 9836kb

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: 2ms
memory: 9772kb

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: 2ms
memory: 9836kb

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: 9848kb

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: 2ms
memory: 9712kb

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: 2ms
memory: 11804kb

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: 9772kb

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: 2ms
memory: 9832kb

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: 2ms
memory: 9840kb

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: 2ms
memory: 9896kb

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: 11852kb

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: 2ms
memory: 9912kb

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: 1ms
memory: 9880kb

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: 1ms
memory: 9896kb

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: 1ms
memory: 7776kb

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: 1ms
memory: 7852kb

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: 5ms
memory: 13072kb

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: 2ms
memory: 12884kb

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: 4ms
memory: 12996kb

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: 5ms
memory: 13088kb

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: 0ms
memory: 12988kb

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: 5ms
memory: 11124kb

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: 5ms
memory: 10960kb

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: 3ms
memory: 12956kb

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: 6ms
memory: 10980kb

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: 9088kb

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: 0ms
memory: 11032kb

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: 6ms
memory: 12992kb

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: 5ms
memory: 6000kb

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: 0ms
memory: 6144kb

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: 0ms
memory: 5996kb

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: 5ms
memory: 6040kb

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: 5ms
memory: 6004kb

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: 4ms
memory: 5084kb

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: 2ms
memory: 5128kb

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: 3ms
memory: 5520kb

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: 0ms
memory: 5616kb

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: 5644kb

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: 5520kb

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: 3ms
memory: 5476kb

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: 4ms
memory: 5008kb

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: 2ms
memory: 4608kb

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: 82ms
memory: 17308kb

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: 81ms
memory: 17252kb

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: 131ms
memory: 19292kb

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: 154ms
memory: 19336kb

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: 129ms
memory: 21340kb

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: 167ms
memory: 21396kb

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: 218ms
memory: 25576kb

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: 204ms
memory: 33676kb

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: 144ms
memory: 33720kb

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: 122ms
memory: 33728kb

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: 200ms
memory: 33780kb

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: 120ms
memory: 31680kb

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: 163ms
memory: 33728kb

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: 216ms
memory: 31620kb

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: 207ms
memory: 31572kb

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: 195ms
memory: 31760kb

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: 170ms
memory: 27468kb

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: 159ms
memory: 21344kb

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: 107ms
memory: 23468kb

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: 121ms
memory: 23556kb

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: 53ms
memory: 15840kb

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: 54ms
memory: 15560kb

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: 150ms
memory: 33732kb

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: 195ms
memory: 33696kb

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: 254ms
memory: 33784kb

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: 218ms
memory: 33724kb

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: 122ms
memory: 23328kb

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: 100ms
memory: 21316kb

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: 137ms
memory: 23528kb

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: 172ms
memory: 29588kb

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: 143ms
memory: 27588kb

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: 128ms
memory: 27656kb

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: 161ms
memory: 27632kb

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: 145ms
memory: 33636kb

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: 122ms
memory: 21332kb

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: 105ms
memory: 21500kb

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: 153ms
memory: 31684kb

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: 261ms
memory: 33788kb

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: 142ms
memory: 33724kb

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: 232ms
memory: 33720kb

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: 154ms
memory: 33708kb

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: 153ms
memory: 31668kb

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: 121ms
memory: 21364kb

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: 86ms
memory: 21492kb

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: 136ms
memory: 23380kb

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: 124ms
memory: 23372kb

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: 121ms
memory: 27512kb

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: 182ms
memory: 25556kb

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: 125ms
memory: 27644kb

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: 70ms
memory: 19428kb

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: 49ms
memory: 15780kb

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