QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#460036#8731. SegregacijaLarunatrecy100 ✓607ms110892kbC++143.3kb2024-06-30 20:13:412024-06-30 20:13:42

Judging History

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

  • [2024-06-30 20:13:42]
  • 评测
  • 测评结果:100
  • 用时:607ms
  • 内存:110892kb
  • [2024-06-30 20:13:41]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
template <typename T>inline void read(T &x)
{
    x=0;char c=getchar();bool f=0;
    for(;c<'0'||c>'9';c=getchar())f|=(c=='-');
    for(;c>='0'&&c<='9';c=getchar())x=(x<<1)+(x<<3)+(c-'0');
    x=(f?-x:x);
}
const int N = 2e6+7;
int n,m,C=0;
char s[N];
int a[2][N];
typedef long long LL;
LL Sum=0;
LL tag[N*4],mx[N*4],d1[N],d2[N];
void build(int k,int l,int r)
{
    if(l==r)
    {
        if(l)d1[l]+=d1[l-1];
        if(l)d2[l]+=d2[l-1];
        LL x=C-l;
        mx[k]=-1ll*l*(l+1)/2-1ll*x*(x+1)/2+d1[l]+d2[l]*l-l;
        //cout<<mx[k]<<' '<<l<<endl;
        return;
    }
    int mid=(l+r)>>1;
    build(k<<1,l,mid);
    build(k<<1|1,mid+1,r);
    mx[k]=min(mx[k<<1],mx[k<<1|1]);
}
void pushtag(int k,LL v)
{
    tag[k]+=v;
    mx[k]+=v;
}
void pushdown(int k)
{
    if(tag[k])
    {
        pushtag(k<<1,tag[k]);
        pushtag(k<<1|1,tag[k]);
        tag[k]=0;
    }
}
void modify(int k,int l,int r,int L,int R,LL v)
{
    if(L>R)return;
    if(L<=l&&r<=R)
    {
        pushtag(k,v);
        return;
    }
    pushdown(k);
    int mid=(l+r)>>1;
    if(L<=mid)modify(k<<1,l,mid,L,R,v);
    if(R>mid)modify(k<<1|1,mid+1,r,L,R,v);
    mx[k]=min(mx[k<<1],mx[k<<1|1]);
}
LL qry(int k,int l,int r,int L,int R)
{
    //if(k==1)cout<<L<<' '<<R<<endl;
    if(L<=l&&r<=R)return mx[k];
    pushdown(k);
    LL res=1e18;
    int mid=(l+r)>>1;
    if(L<=mid)res=min(res,qry(k<<1,l,mid,L,R));
    if(R>mid)res=min(res,qry(k<<1|1,mid+1,r,L,R));
    return res;
}
LL pre[N],cur=0;
void calc()
{
    //cout<<Sum<<endl;
    LL ans=qry(1,0,C,max(0,C-n),min(C/2ll,cur));
    printf("%lld\n",ans+cur+Sum);
}
int main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.ans","w",stdout);
    //freopen("ex_b4.in","r",stdin);
    read(n);read(m);
    for(int c=0;c<=1;c++)
    {
        scanf("%s",s+1);
        for(int i=1;i<=n;i++)
        {
            a[c][i]=(s[i]=='P'),C+=a[c][i];
            pre[i]+=a[c][i];
            Sum+=a[c][i]*i;
            if(c==1)cur+=a[c][i];
        }
    }
    //cout<<Sum<<endl;
    for(int i=1;i<n;i++)
    {
        pre[i]+=pre[i-1];
        LL v=pre[i]-i;
        LL l=0,r=min(v,(LL)C);
        if(l<=r)
        {
            //cout<<l<<' '<<r<<endl;
            d1[l]+=2ll*v;
            d1[r+1]-=2ll*v;
            d2[l]-=2;
            d2[r+1]+=2;
        }
    }
    build(1,0,C);
    calc();
    while(m--)
    {
        int op,x,y;
        read(op);read(x);read(y);
        x--;
        if(op==1)
        {
            if(a[x][y]==a[x][y+1]);
            else
            {
                if(a[x][y]==1)
                {
                    pre[y]--;
                    modify(1,0,C,0,pre[y]-y,-2);
                    Sum++;
                }
                else
                {
                    modify(1,0,C,0,pre[y]-y,2);
                    pre[y]++;
                    Sum--;
                }
                swap(a[x][y],a[x][y+1]);
            }
        }
        else
        {
            if(a[x][y]==a[x+1][y]);
            else
            {
                if(a[x+1][y]==1)cur--;
                else cur++;
            }
            swap(a[x][y],a[x+1][y]);
        }
        calc();
    }
    return 0;
}

詳細信息

Subtask #1:

score: 7
Accepted

Test #1:

score: 7
Accepted
time: 77ms
memory: 9896kb

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: 7
Accepted
time: 80ms
memory: 9908kb

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: 7
Accepted
time: 80ms
memory: 9880kb

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: 7
Accepted
time: 83ms
memory: 9872kb

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: 7
Accepted
time: 83ms
memory: 9928kb

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: 7
Accepted
time: 80ms
memory: 9908kb

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: 7
Accepted
time: 77ms
memory: 9912kb

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: 7
Accepted
time: 72ms
memory: 9988kb

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: 7
Accepted
time: 73ms
memory: 9904kb

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: 7
Accepted
time: 63ms
memory: 9900kb

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: 7
Accepted
time: 79ms
memory: 9836kb

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: 7
Accepted
time: 77ms
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: 7
Accepted
time: 74ms
memory: 9908kb

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: 7
Accepted
time: 74ms
memory: 9908kb

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: 7
Accepted
time: 80ms
memory: 7864kb

input:

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

output:

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

result:

ok 1000001 lines

Subtask #2:

score: 11
Accepted

Test #16:

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

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: 11
Accepted
time: 87ms
memory: 9868kb

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: 11
Accepted
time: 94ms
memory: 9912kb

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: 11
Accepted
time: 95ms
memory: 11972kb

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: 11
Accepted
time: 94ms
memory: 9884kb

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: 11
Accepted
time: 289ms
memory: 92128kb

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: 11
Accepted
time: 295ms
memory: 99484kb

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: 11
Accepted
time: 341ms
memory: 98816kb

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: 11
Accepted
time: 343ms
memory: 102844kb

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: 11
Accepted
time: 334ms
memory: 101920kb

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: 11
Accepted
time: 349ms
memory: 106532kb

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: 11
Accepted
time: 364ms
memory: 103364kb

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: 11
Accepted
time: 339ms
memory: 104808kb

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: 11
Accepted
time: 341ms
memory: 103644kb

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: 11
Accepted
time: 341ms
memory: 97756kb

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: 11
Accepted
time: 79ms
memory: 9844kb

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: 11
Accepted
time: 76ms
memory: 9904kb

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: 11
Accepted
time: 88ms
memory: 9836kb

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: 11
Accepted
time: 94ms
memory: 9992kb

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: 11
Accepted
time: 90ms
memory: 9832kb

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: 11
Accepted
time: 100ms
memory: 9928kb

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

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: 17
Accepted
time: 2ms
memory: 9872kb

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: 17
Accepted
time: 2ms
memory: 9952kb

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: 17
Accepted
time: 0ms
memory: 10044kb

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: 17
Accepted
time: 0ms
memory: 9904kb

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: 17
Accepted
time: 0ms
memory: 9904kb

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: 17
Accepted
time: 2ms
memory: 9984kb

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: 17
Accepted
time: 1ms
memory: 9848kb

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: 17
Accepted
time: 1ms
memory: 7864kb

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: 17
Accepted
time: 0ms
memory: 9992kb

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: 17
Accepted
time: 1ms
memory: 7836kb

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: 17
Accepted
time: 2ms
memory: 9924kb

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: 17
Accepted
time: 2ms
memory: 9864kb

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: 17
Accepted
time: 2ms
memory: 9924kb

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: 17
Accepted
time: 2ms
memory: 9924kb

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: 17
Accepted
time: 0ms
memory: 9856kb

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: 17
Accepted
time: 0ms
memory: 9928kb

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: 17
Accepted
time: 1ms
memory: 9908kb

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: 17
Accepted
time: 0ms
memory: 9916kb

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: 17
Accepted
time: 2ms
memory: 10004kb

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: 17
Accepted
time: 0ms
memory: 9924kb

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: 17
Accepted
time: 1ms
memory: 9844kb

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: 17
Accepted
time: 0ms
memory: 9956kb

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

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: 17
Accepted
time: 0ms
memory: 10012kb

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: 17
Accepted
time: 2ms
memory: 9796kb

input:

500 500
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC...

output:

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

result:

ok 501 lines

Subtask #4:

score: 10
Accepted

Dependency #3:

100%
Accepted

Test #63:

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

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: 10
Accepted
time: 0ms
memory: 10336kb

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: 10
Accepted
time: 2ms
memory: 9964kb

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: 10
Accepted
time: 3ms
memory: 10168kb

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: 10
Accepted
time: 3ms
memory: 10196kb

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: 10
Accepted
time: 3ms
memory: 10120kb

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: 10
Accepted
time: 3ms
memory: 10156kb

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: 10
Accepted
time: 2ms
memory: 10160kb

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: 10
Accepted
time: 0ms
memory: 10072kb

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: 10
Accepted
time: 0ms
memory: 12324kb

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: 10
Accepted
time: 2ms
memory: 9936kb

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: 10
Accepted
time: 2ms
memory: 10084kb

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: 10
Accepted
time: 2ms
memory: 10084kb

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: 10
Accepted
time: 0ms
memory: 10068kb

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: 10
Accepted
time: 2ms
memory: 10052kb

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: 10
Accepted
time: 3ms
memory: 10040kb

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: 10
Accepted
time: 0ms
memory: 12148kb

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: 10
Accepted
time: 3ms
memory: 12340kb

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: 10
Accepted
time: 2ms
memory: 9972kb

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: 10
Accepted
time: 0ms
memory: 10084kb

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: 10
Accepted
time: 2ms
memory: 7956kb

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: 10
Accepted
time: 2ms
memory: 8060kb

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: 10
Accepted
time: 2ms
memory: 9992kb

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: 10
Accepted
time: 0ms
memory: 10100kb

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: 10
Accepted
time: 3ms
memory: 10052kb

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: 10
Accepted
time: 2ms
memory: 10048kb

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

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: 13
Accepted
time: 3ms
memory: 20960kb

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: 13
Accepted
time: 4ms
memory: 13292kb

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: 13
Accepted
time: 6ms
memory: 20960kb

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: 13
Accepted
time: 6ms
memory: 17808kb

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: 13
Accepted
time: 0ms
memory: 19792kb

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: 13
Accepted
time: 0ms
memory: 19828kb

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: 13
Accepted
time: 6ms
memory: 20856kb

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: 13
Accepted
time: 5ms
memory: 14652kb

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: 13
Accepted
time: 3ms
memory: 21580kb

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: 13
Accepted
time: 0ms
memory: 11164kb

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: 13
Accepted
time: 0ms
memory: 16672kb

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: 13
Accepted
time: 0ms
memory: 14680kb

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: 13
Accepted
time: 3ms
memory: 18920kb

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: 13
Accepted
time: 6ms
memory: 16672kb

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: 13
Accepted
time: 0ms
memory: 14720kb

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: 13
Accepted
time: 0ms
memory: 14716kb

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: 13
Accepted
time: 0ms
memory: 18968kb

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: 13
Accepted
time: 0ms
memory: 14868kb

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: 13
Accepted
time: 0ms
memory: 13876kb

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: 13
Accepted
time: 4ms
memory: 13948kb

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: 13
Accepted
time: 4ms
memory: 11960kb

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: 13
Accepted
time: 0ms
memory: 13944kb

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: 13
Accepted
time: 2ms
memory: 15872kb

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: 13
Accepted
time: 0ms
memory: 21200kb

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: 13
Accepted
time: 3ms
memory: 11068kb

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: 325ms
memory: 92000kb

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: 15
Accepted
time: 306ms
memory: 89796kb

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: 15
Accepted
time: 347ms
memory: 86656kb

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: 15
Accepted
time: 420ms
memory: 87048kb

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: 15
Accepted
time: 379ms
memory: 86024kb

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: 15
Accepted
time: 442ms
memory: 84868kb

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: 15
Accepted
time: 423ms
memory: 81468kb

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: 15
Accepted
time: 432ms
memory: 80844kb

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: 15
Accepted
time: 395ms
memory: 79780kb

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: 15
Accepted
time: 336ms
memory: 77632kb

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: 15
Accepted
time: 261ms
memory: 58092kb

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: 15
Accepted
time: 199ms
memory: 58792kb

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: 15
Accepted
time: 248ms
memory: 54948kb

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: 15
Accepted
time: 320ms
memory: 55544kb

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: 15
Accepted
time: 318ms
memory: 51832kb

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: 15
Accepted
time: 300ms
memory: 51940kb

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: 15
Accepted
time: 318ms
memory: 40484kb

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: 15
Accepted
time: 293ms
memory: 40600kb

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: 15
Accepted
time: 244ms
memory: 35396kb

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: 15
Accepted
time: 290ms
memory: 33376kb

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: 15
Accepted
time: 187ms
memory: 26864kb

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: 15
Accepted
time: 176ms
memory: 25956kb

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: 15
Accepted
time: 382ms
memory: 58444kb

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: 15
Accepted
time: 403ms
memory: 58060kb

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: 15
Accepted
time: 426ms
memory: 58628kb

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: 452ms
memory: 60344kb

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: 27
Accepted
time: 389ms
memory: 110892kb

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: 27
Accepted
time: 206ms
memory: 29740kb

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: 27
Accepted
time: 607ms
memory: 94752kb

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: 27
Accepted
time: 586ms
memory: 96920kb

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: 27
Accepted
time: 411ms
memory: 96036kb

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: 27
Accepted
time: 391ms
memory: 94772kb

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: 27
Accepted
time: 380ms
memory: 84304kb

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: 27
Accepted
time: 241ms
memory: 62160kb

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: 27
Accepted
time: 426ms
memory: 106684kb

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: 27
Accepted
time: 281ms
memory: 30004kb

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: 27
Accepted
time: 447ms
memory: 60632kb

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: 27
Accepted
time: 391ms
memory: 60168kb

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: 27
Accepted
time: 406ms
memory: 62324kb

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: 27
Accepted
time: 359ms
memory: 62660kb

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: 27
Accepted
time: 247ms
memory: 60200kb

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: 27
Accepted
time: 388ms
memory: 60824kb

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: 27
Accepted
time: 412ms
memory: 107120kb

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: 27
Accepted
time: 186ms
memory: 30124kb

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: 27
Accepted
time: 232ms
memory: 44188kb

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: 27
Accepted
time: 212ms
memory: 42696kb

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: 27
Accepted
time: 218ms
memory: 42156kb

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: 27
Accepted
time: 274ms
memory: 42316kb

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: 27
Accepted
time: 213ms
memory: 44176kb

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: 27
Accepted
time: 298ms
memory: 89812kb

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: 27
Accepted
time: 170ms
memory: 26696kb

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