QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#517017#325. AB-StringsBalintR#100 ✓33ms7280kbC++203.5kb2024-08-13 02:57:542024-08-13 02:57:54

Judging History

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

  • [2024-08-13 02:57:54]
  • 评测
  • 测评结果:100
  • 用时:33ms
  • 内存:7280kb
  • [2024-08-13 02:57:54]
  • 提交

answer

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

typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef complex<double> cpx;
template <typename T> using minPq = priority_queue<T, vector<T>, greater<T>>;
#define ms(a, x) memset(a, x, sizeof(a))
#define pb push_back
#define fs first
#define sn second
#define ALL(v) begin(v), end(v)
#define SZ(v) ((int) (v).size())
#define lbv(v, x) (lower_bound(ALL(v), x) - (v).begin())
#define ubv(v, x) (upper_bound(ALL(v), x) - (v).begin())
template <typename T> inline void UNIQUE(vector<T> &v){sort(ALL(v)); v.resize(unique(ALL(v)) - v.begin());}
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
#define FR(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define dbg(x) {cerr << #x << ' ' << x << endl;}
#define dbgArr(arr, n) {cerr << #arr; FR(_i, n) cerr << ' ' << (arr)[_i]; cerr << endl;}
template <typename T, typename U>
ostream& operator<<(ostream &os, pair<T, U> p){return os << "(" << p.fs << ", " << p.sn << ")";}

struct Str {
    vi cuts;
    bool init;
};

void swap(Str &a, int ai, Str &b, int bi){
    assert(ai > 0 || bi > 0);

    vi vec1e, vec2e;
    FOR(i, ai, SZ(a.cuts)-1) vec1e.pb(a.cuts[i+1] - a.cuts[i]);
    FOR(i, bi, SZ(b.cuts)-1) vec2e.pb(b.cuts[i+1] - b.cuts[i]);
    int aLst = a.cuts[ai] - a.cuts[max(0, ai-1)];
    int bLst = b.cuts[bi] - b.cuts[max(0, bi-1)];
    a.cuts.resize(ai);
    b.cuts.resize(bi);

    if(!ai) a.cuts.pb(0);
    else if(vec2e.empty()) vec2e.pb(aLst);
    else vec2e[0] += aLst;

    if(!bi) b.cuts.pb(0);
    else if(vec1e.empty()) vec1e.pb(bLst);
    else vec1e[0] += bLst;

    for(int s : vec2e) a.cuts.pb(a.cuts.back() + s);
    for(int s : vec1e) b.cuts.pb(b.cuts.back() + s);

    if(!ai) a.init = b.init, b.init ^= bi & 1;
    if(!bi) b.init = a.init, a.init ^= ai & 1;

    swap(a.cuts, b.cuts);
}

Str toBlk(const string &s){
    Str res = {{0}, s[0] == 'b'};
    FOR(i, 1, SZ(s)) if(s[i] != s[i-1]) res.cuts.pb(i);
    res.cuts.pb(SZ(s));
    return res;
}

vpii ans;
Str a, b;

void proc(){
    if(SZ(a.cuts) < SZ(b.cuts)){
        swap(a, b);
        proc();
        swap(a, b);
        swap(ans.back().fs, ans.back().sn);
        return;
    }
    assert(SZ(a.cuts) >= 2);
    assert(SZ(b.cuts) >= 2);

    int ai, bi;

    if(SZ(b.cuts) == 2){
        ai = SZ(a.cuts)/2;
        bi = 1;
        // dbg(ai);
        // dbg(bi);
        // dbg(a.init);
        // dbg(b.init);
        if((a.init ^ b.init) == ((ai^bi) & 1)) bi--;
    }
    else {
        bi = SZ(b.cuts)-2;
        ai = SZ(a.cuts)-2;
        if((a.init ^ b.init) == ((ai^bi) & 1)) ai--;

        loopStart:;
        // cerr << ai << ' ' << bi << endl;
        int asz = ai;
        int bsz = bi + (SZ(a.cuts)-2-ai);
        if(asz > bsz+1){ai -= 2; goto loopStart;}
    }

    assert(ai >= 0);
    assert(bi >= 0);
    ans.pb({a.cuts[ai], b.cuts[bi]});
    swap(a, ai, b, bi);
}

int main(){
    cin.sync_with_stdio(0); cin.tie(0);
    string s1, s2;
    cin >> s1 >> s2;

    a = toBlk(s1), b = toBlk(s2);
    while(true){
        if(SZ(a.cuts) == 2 && SZ(b.cuts) == 2) break;
        proc();
    }

    cout << SZ(ans) << '\n';
    for(auto [x, y] : ans) cout << x << ' ' << y << '\n';
}

详细

Subtask #1:

score: 5
Accepted

Test #1:

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

input:

a
b

output:

0

result:

ok Operations: 0

Test #2:

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

input:

b
a

output:

0

result:

ok Operations: 0

Test #3:

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

input:

a
bb

output:

0

result:

ok Operations: 0

Test #4:

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

input:

b
ab

output:

1
1 1

result:

ok Operations: 1

Test #5:

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

input:

b
ba

output:

1
0 1

result:

ok Operations: 1

Test #6:

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

input:

ab
bb

output:

1
1 2

result:

ok Operations: 1

Test #7:

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

input:

ba
bb

output:

1
1 0

result:

ok Operations: 1

Test #8:

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

input:

bab
bbb

output:

2
2 3
0 1

result:

ok Operations: 2

Test #9:

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

input:

abb
bbb

output:

1
1 3

result:

ok Operations: 1

Test #10:

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

input:

a
bbbb

output:

0

result:

ok Operations: 0

Test #11:

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

input:

abbb
b

output:

1
1 1

result:

ok Operations: 1

Test #12:

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

input:

b
bbba

output:

1
0 3

result:

ok Operations: 1

Test #13:

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

input:

bbb
abbbb

output:

1
3 1

result:

ok Operations: 1

Test #14:

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

input:

bbbbba
bbbb

output:

1
5 0

result:

ok Operations: 1

Test #15:

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

input:

abbbbb
bbbbbb

output:

1
1 6

result:

ok Operations: 1

Test #16:

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

input:

bbbbba
bbbbbb

output:

1
5 0

result:

ok Operations: 1

Test #17:

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

input:

bbbbbb
bbbbba

output:

1
0 5

result:

ok Operations: 1

Test #18:

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

input:

bbabbb
bbbbbb

output:

2
3 6
0 2

result:

ok Operations: 2

Test #19:

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

input:

bbbbbb
bbbabb

output:

2
6 4
3 0

result:

ok Operations: 2

Subtask #2:

score: 10
Accepted

Dependency #1:

100%
Accepted

Test #20:

score: 10
Accepted
time: 0ms
memory: 3604kb

input:

aaaaaa
bbbbbb

output:

0

result:

ok Operations: 0

Test #21:

score: 10
Accepted
time: 0ms
memory: 3744kb

input:

aaaaaa
aaaabb

output:

1
0 4

result:

ok Operations: 1

Test #22:

score: 10
Accepted
time: 0ms
memory: 3816kb

input:

aaaaba
aaaaaa

output:

2
5 6
0 4

result:

ok Operations: 2

Test #23:

score: 10
Accepted
time: 0ms
memory: 3528kb

input:

bbabba
bbbbbb

output:

3
3 6
0 2
10 1

result:

ok Operations: 3

Test #24:

score: 10
Accepted
time: 0ms
memory: 3592kb

input:

bbabab
bbbbbb

output:

3
4 0
1 2
3 2

result:

ok Operations: 3

Test #25:

score: 10
Accepted
time: 0ms
memory: 3528kb

input:

bbbbbb
bababa

output:

3
0 3
2 2
1 1

result:

ok Operations: 3

Test #26:

score: 10
Accepted
time: 0ms
memory: 3524kb

input:

bbbbba
bbbba

output:

2
0 4
9 1

result:

ok Operations: 2

Test #27:

score: 10
Accepted
time: 0ms
memory: 3612kb

input:

aaaaba
aaabbb

output:

2
5 3
0 4

result:

ok Operations: 2

Test #28:

score: 10
Accepted
time: 0ms
memory: 3464kb

input:

bbbbba
baaaba

output:

3
5 4
0 6
7 1

result:

ok Operations: 3

Test #29:

score: 10
Accepted
time: 0ms
memory: 3620kb

input:

baabab
bbbbaa

output:

3
3 4
6 1
0 5

result:

ok Operations: 3

Test #30:

score: 10
Accepted
time: 0ms
memory: 3780kb

input:

bababa
bbbaaa

output:

4
2 3
5 1
0 4
6 5

result:

ok Operations: 4

Test #31:

score: 10
Accepted
time: 0ms
memory: 3840kb

input:

abbbba
aaaaba

output:

3
1 5
9 2
0 4

result:

ok Operations: 3

Test #32:

score: 10
Accepted
time: 0ms
memory: 3548kb

input:

abbaa
abbabb

output:

3
3 4
3 1
0 1

result:

ok Operations: 3

Test #33:

score: 10
Accepted
time: 0ms
memory: 3544kb

input:

baabab
bbbabb

output:

4
4 4
3 3
5 6
0 1

result:

ok Operations: 4

Test #34:

score: 10
Accepted
time: 0ms
memory: 3596kb

input:

bababa
bbbabb

output:

4
3 4
6 2
1 5
3 0

result:

ok Operations: 4

Test #35:

score: 10
Accepted
time: 0ms
memory: 3612kb

input:

baabaa
baabaa

output:

4
3 4
3 1
0 1
4 6

result:

ok Operations: 4

Test #36:

score: 10
Accepted
time: 0ms
memory: 3476kb

input:

bbbaba
bababb

output:

4
5 4
3 4
3 2
1 0

result:

ok Operations: 4

Test #37:

score: 10
Accepted
time: 0ms
memory: 3528kb

input:

bababa
bbabaa

output:

5
4 4
3 3
2 2
0 1
6 5

result:

ok Operations: 5

Test #38:

score: 10
Accepted
time: 0ms
memory: 3540kb

input:

babaab
bbabab

output:

5
3 5
4 2
1 3
7 4
0 2

result:

ok Operations: 5

Test #39:

score: 10
Accepted
time: 0ms
memory: 3620kb

input:

bbabab
bababa

output:

5
5 5
4 4
3 3
2 2
0 1

result:

ok Operations: 5

Test #40:

score: 10
Accepted
time: 0ms
memory: 3776kb

input:

bababa
bababa

output:

6
4 5
4 3
2 3
2 1
0 1
6 5

result:

ok Operations: 6

Test #41:

score: 10
Accepted
time: 0ms
memory: 3524kb

input:

bbbbba
aaaaaa

output:

1
5 6

result:

ok Operations: 1

Test #42:

score: 10
Accepted
time: 0ms
memory: 3604kb

input:

aabaaa
bbbbbb

output:

2
3 0
0 2

result:

ok Operations: 2

Test #43:

score: 10
Accepted
time: 0ms
memory: 3592kb

input:

bbabba
aaaaaa

output:

3
3 0
0 2
4 7

result:

ok Operations: 3

Test #44:

score: 10
Accepted
time: 0ms
memory: 3532kb

input:

abbaba
bbbbbb

output:

3
4 6
7 1
2 9

result:

ok Operations: 3

Test #45:

score: 10
Accepted
time: 0ms
memory: 3616kb

input:

bbbbbb
ababab

output:

3
6 3
2 8
7 1

result:

ok Operations: 3

Test #46:

score: 10
Accepted
time: 0ms
memory: 3588kb

input:

bbbaa
aaaabb

output:

1
3 4

result:

ok Operations: 1

Test #47:

score: 10
Accepted
time: 0ms
memory: 3528kb

input:

bbbbba
aabaaa

output:

2
5 2
3 6

result:

ok Operations: 2

Test #48:

score: 10
Accepted
time: 0ms
memory: 3544kb

input:

bbaaaa
aababb

output:

3
2 2
0 4
3 0

result:

ok Operations: 3

Test #49:

score: 10
Accepted
time: 0ms
memory: 3748kb

input:

bbbbaa
abbaba

output:

3
4 4
1 5
7 2

result:

ok Operations: 3

Test #50:

score: 10
Accepted
time: 0ms
memory: 3824kb

input:

bababa
aaaabb

output:

3
3 4
6 2
1 5

result:

ok Operations: 3

Test #51:

score: 10
Accepted
time: 0ms
memory: 3528kb

input:

bbaaab
abaaaa

output:

2
5 2
1 2

result:

ok Operations: 2

Test #52:

score: 10
Accepted
time: 0ms
memory: 3568kb

input:

baabaa
aabba

output:

3
3 4
2 1
4 5

result:

ok Operations: 3

Test #53:

score: 10
Accepted
time: 0ms
memory: 3748kb

input:

babbab
abbbaa

output:

4
2 4
1 1
7 0
0 6

result:

ok Operations: 4

Test #54:

score: 10
Accepted
time: 0ms
memory: 3480kb

input:

aaabba
bababa

output:

4
5 4
2 6
3 1
5 5

result:

ok Operations: 4

Test #55:

score: 10
Accepted
time: 0ms
memory: 3536kb

input:

aabbab
baaaba

output:

3
5 5
4 4
2 1

result:

ok Operations: 3

Test #56:

score: 10
Accepted
time: 0ms
memory: 3620kb

input:

baabab
aabbab

output:

4
4 5
4 3
1 2
6 5

result:

ok Operations: 4

Test #57:

score: 10
Accepted
time: 0ms
memory: 3752kb

input:

bbabba
ababab

output:

5
5 3
2 3
2 1
0 7
6 0

result:

ok Operations: 5

Test #58:

score: 10
Accepted
time: 0ms
memory: 3524kb

input:

aababa
baabab

output:

4
5 5
4 4
3 3
1 2

result:

ok Operations: 4

Test #59:

score: 10
Accepted
time: 0ms
memory: 3592kb

input:

babaab
ababab

output:

5
5 4
3 3
2 2
1 1
5 6

result:

ok Operations: 5

Test #60:

score: 10
Accepted
time: 0ms
memory: 3480kb

input:

ababab
bababa

output:

5
5 5
4 4
3 3
2 2
1 1

result:

ok Operations: 5

Subtask #3:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #61:

score: 20
Accepted
time: 0ms
memory: 3620kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

output:

0

result:

ok Operations: 0

Test #62:

score: 20
Accepted
time: 0ms
memory: 3748kb

input:

bababababababababababababababababababababababababa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb

output:

25
25 0
24 24
23 23
22 22
21 21
20 20
19 19
18 18
17 17
16 16
15 15
14 14
13 13
12 12
11 11
10 10
9 9
8 8
7 7
6 6
5 5
4 4
3 3
2 2
1 1

result:

ok Operations: 25

Test #63:

score: 20
Accepted
time: 0ms
memory: 3612kb

input:

aaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
ababababababababababababababababababababababababab

output:

26
19 24
23 43
41 24
22 40
39 21
20 38
37 19
18 36
35 17
16 34
33 15
14 32
31 13
12 30
29 11
10 28
27 9
8 26
25 7
6 24
23 5
4 22
21 3
2 20
0 1
44 23

result:

ok Operations: 26

Test #64:

score: 20
Accepted
time: 0ms
memory: 3780kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbaabbbbbbbbbbbbbbbbbbbb
bababababababababababababababababababababababababa

output:

26
30 25
24 54
53 23
22 52
51 21
20 50
49 19
18 48
47 17
16 46
45 15
14 44
43 13
12 42
41 11
10 40
39 9
8 38
37 7
6 36
35 5
4 34
33 3
2 32
31 1
0 28

result:

ok Operations: 26

Test #65:

score: 20
Accepted
time: 0ms
memory: 3812kb

input:

bababababababababababababababababababababababababa
bbbbbbbbbbbbbbbbbbbaaaaaaaaabbbbbbbbbbbbbbbbbbbbaa

output:

27
26 48
70 25
24 69
68 23
22 67
66 21
20 65
64 19
18 63
62 17
16 61
60 15
14 59
58 13
12 57
56 11
10 55
54 9
8 53
52 7
6 51
50 5
4 49
28 3
2 19
0 1
64 35

result:

ok Operations: 27

Test #66:

score: 20
Accepted
time: 0ms
memory: 3608kb

input:

ababababababababababababababababababababababababa
aabbbabbbbabbbaabbbabbaabaaaaabaaabaabaababbaaba

output:

37
35 47
59 34
33 58
57 32
31 56
55 30
29 54
53 28
27 52
51 26
25 50
49 24
23 48
46 22
21 44
42 20
19 41
40 18
17 38
37 16
15 35
34 14
13 31
30 12
11 25
24 10
9 22
20 8
7 19
16 6
5 14
11 4
3 10
6 2
1 5
49 47
0 2

result:

ok Operations: 37

Test #67:

score: 20
Accepted
time: 0ms
memory: 3788kb

input:

bababababababababababababababababababababababababa
bababababababababababababababababababababababababa

output:

50
48 49
48 47
46 47
46 45
44 45
44 43
42 43
42 41
40 41
40 39
38 39
38 37
36 37
36 35
34 35
34 33
32 33
32 31
30 31
30 29
28 29
28 27
26 27
26 25
24 25
24 23
22 23
22 21
20 21
20 19
18 19
18 17
16 17
16 15
14 15
14 13
12 13
12 11
10 11
10 9
8 9
8 7
6 7
6 5
4 5
4 3
2 3
2 1
0 1
50 49

result:

ok Operations: 50

Test #68:

score: 20
Accepted
time: 0ms
memory: 3540kb

input:

ababababababababababababababababababababababababab
ababababababababababababababababababababababaababa

output:

49
49 49
48 48
47 47
46 46
45 44
43 44
43 42
41 42
41 40
39 40
39 38
37 38
37 36
35 36
35 34
33 34
33 32
31 32
31 30
29 30
29 28
27 28
27 26
25 26
25 24
23 24
23 22
21 22
21 20
19 20
19 18
17 18
17 16
15 16
15 14
13 14
13 12
11 12
11 10
9 10
9 8
7 8
7 6
5 6
5 4
3 4
3 2
1 2
1 0

result:

ok Operations: 49

Test #69:

score: 20
Accepted
time: 0ms
memory: 3524kb

input:

ababababababababababababababbababababababababababa
abababababababababababababababababaabababababababa

output:

49
48 49
48 47
46 47
46 45
44 45
44 43
42 43
42 41
40 41
40 39
38 39
38 37
36 37
36 35
34 34
33 33
32 32
31 31
30 30
29 29
27 28
27 26
25 26
25 24
23 24
23 22
21 22
21 20
19 20
19 18
17 18
17 16
15 16
15 14
13 14
13 12
11 12
11 10
9 10
9 8
7 8
7 6
5 6
5 4
3 4
3 2
1 2
50 49
0 1

result:

ok Operations: 49

Test #70:

score: 20
Accepted
time: 0ms
memory: 3616kb

input:

abababababababababababababaabababababababbabababab
ababababababababababababababababababababababababab

output:

49
49 48
46 50
48 45
44 47
46 43
42 45
44 41
40 43
42 39
38 40
39 37
36 38
37 35
34 36
35 33
32 34
33 31
30 32
31 29
28 30
29 27
26 28
26 25
24 25
24 23
22 23
22 21
20 21
20 19
18 19
18 17
16 17
16 15
14 15
14 13
12 13
12 11
10 11
10 9
8 9
8 7
6 7
6 5
4 5
4 3
2 3
2 1
0 1
50 48

result:

ok Operations: 49

Test #71:

score: 20
Accepted
time: 0ms
memory: 3616kb

input:

bababababababababababababababababababababababababa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

output:

25
25 49
73 24
23 72
71 22
21 70
69 20
19 68
67 18
17 66
65 16
15 64
63 14
13 62
61 12
11 60
59 10
9 58
57 8
7 56
55 6
5 54
53 4
3 52
51 2
1 50

result:

ok Operations: 25

Test #72:

score: 20
Accepted
time: 0ms
memory: 3520kb

input:

bababababababababababababababababababababababababa
aaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb

output:

25
25 14
38 24
23 37
36 22
21 35
34 20
19 33
32 18
17 31
30 16
15 29
28 14
13 27
26 12
11 25
24 10
9 23
22 8
7 21
20 6
5 19
18 4
3 17
16 2
1 15

result:

ok Operations: 25

Test #73:

score: 20
Accepted
time: 0ms
memory: 3596kb

input:

bbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbb
ababababababababababababababababababababababababab

output:

26
35 26
24 58
57 23
22 56
55 21
20 54
53 19
18 52
51 17
16 50
49 15
14 48
47 13
12 46
45 11
10 44
43 9
8 42
41 7
6 40
39 5
4 38
37 3
2 36
14 1
46 38

result:

ok Operations: 26

Test #74:

score: 20
Accepted
time: 0ms
memory: 3540kb

input:

bababababababababababababababababababababababababa
aaabbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaabbbbb

output:

27
25 45
67 24
23 66
65 22
21 64
63 20
19 62
61 18
17 60
59 16
15 58
57 14
13 56
55 12
11 54
53 10
9 52
51 8
7 50
49 6
5 48
47 4
3 46
30 2
1 3
43 0
0 42

result:

ok Operations: 27

Test #75:

score: 20
Accepted
time: 0ms
memory: 3612kb

input:

ababababababababababababababababababababababababa
babbaaaabbbbabbaaabbaabbaaababbaaaabaababaabaaab

output:

36
36 47
59 35
34 58
57 33
32 56
55 31
30 54
53 29
28 52
51 27
26 50
49 25
24 48
44 23
22 43
41 21
20 40
39 19
18 38
36 17
16 35
31 15
14 29
28 13
12 27
24 11
10 22
20 9
8 18
15 7
6 13
12 5
4 8
4 3
2 2
1 1

result:

ok Operations: 36

Test #76:

score: 20
Accepted
time: 0ms
memory: 3828kb

input:

ababababababababababababababababababababababababab
bababababababababababababababababababababababababa

output:

49
49 49
48 48
47 47
46 46
45 45
44 44
43 43
42 42
41 41
40 40
39 39
38 38
37 37
36 36
35 35
34 34
33 33
32 32
31 31
30 30
29 29
28 28
27 27
26 26
25 25
24 24
23 23
22 22
21 21
20 20
19 19
18 18
17 17
16 16
15 15
14 14
13 13
12 12
11 11
10 10
9 9
8 8
7 7
6 6
5 5
4 4
3 3
2 2
1 1

result:

ok Operations: 49

Test #77:

score: 20
Accepted
time: 0ms
memory: 3612kb

input:

ababababababababababababababababababababababababab
babababababababaababababababababababababababababab

output:

49
48 49
48 47
46 47
46 45
44 45
44 43
42 43
42 41
40 41
40 39
38 39
38 37
36 37
36 35
34 35
34 33
32 33
32 31
30 31
30 29
28 29
28 27
26 27
26 25
24 25
24 23
22 23
22 21
20 21
20 19
18 19
18 17
16 17
15 15
14 14
13 13
12 12
11 11
10 10
9 9
8 8
7 7
6 6
5 5
4 4
3 3
2 2
1 1
50 49

result:

ok Operations: 49

Test #78:

score: 20
Accepted
time: 0ms
memory: 3608kb

input:

bababbabababababababababababababababababababababab
abababababababababababbabababababababababababababa

output:

48
49 49
48 48
47 47
46 46
45 45
44 44
43 43
42 42
41 41
40 40
39 39
38 38
37 37
36 36
35 35
34 34
33 33
32 32
31 31
30 30
29 29
28 28
27 27
26 26
25 25
24 24
23 23
21 22
21 20
19 20
19 18
17 18
17 16
15 16
15 14
13 14
13 12
11 12
11 10
9 10
9 8
7 8
7 6
5 6
4 4
3 3
2 2
1 1

result:

ok Operations: 48

Test #79:

score: 20
Accepted
time: 0ms
memory: 3616kb

input:

bababababababababababababababababababababababababa
aabababababababababababababababababababababababaab

output:

49
47 49
47 46
45 46
45 44
43 44
43 42
41 42
41 40
39 40
39 38
37 38
37 36
35 36
35 34
33 34
33 32
31 32
31 30
29 30
29 28
27 28
27 26
25 26
25 24
23 24
23 22
21 22
21 20
19 20
19 18
17 18
17 16
15 16
15 14
13 14
13 12
11 12
11 10
9 10
9 8
7 8
7 6
5 6
5 4
3 4
3 2
1 2
51 0
0 50

result:

ok Operations: 49

Subtask #4:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #80:

score: 20
Accepted
time: 0ms
memory: 3524kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

0

result:

ok Operations: 0

Test #81:

score: 20
Accepted
time: 0ms
memory: 3596kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
babababababababababababababababababababababababab...

output:

125
0 125
124 124
123 123
122 122
121 121
120 120
119 119
118 118
117 117
116 116
115 115
114 114
113 113
112 112
111 111
110 110
109 109
108 108
107 107
106 106
105 105
104 104
103 103
102 102
101 101
100 100
99 99
98 98
97 97
96 96
95 95
94 94
93 93
92 92
91 91
90 90
89 89
88 88
87 87
86 86
85 85
...

result:

ok Operations: 125

Test #82:

score: 20
Accepted
time: 0ms
memory: 3544kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbb
ababababababababababababababababababababababababa...

output:

126
247 124
123 371
369 124
122 368
367 121
120 366
365 119
118 364
363 117
116 362
361 115
114 360
359 113
112 358
357 111
110 356
355 109
108 354
353 107
106 352
351 105
104 350
349 103
102 348
347 101
100 346
345 99
98 344
343 97
96 342
341 95
94 340
339 93
92 338
337 91
90 336
335 89
88 334
333 ...

result:

ok Operations: 126

Test #83:

score: 20
Accepted
time: 0ms
memory: 3536kb

input:

ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

126
125 199
323 124
123 322
321 122
121 320
319 120
119 318
317 118
117 316
315 116
115 314
313 114
113 312
311 112
111 310
309 110
109 308
307 108
107 306
305 106
105 304
303 104
103 302
301 102
101 300
299 100
99 298
297 98
97 296
295 96
95 294
293 94
93 292
291 92
91 290
289 90
89 288
287 88
87 2...

result:

ok Operations: 126

Test #84:

score: 20
Accepted
time: 0ms
memory: 3592kb

input:

bababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa
bbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

127
126 199
321 125
124 320
319 123
122 318
317 121
120 316
315 119
118 314
313 117
116 312
311 115
114 310
309 113
112 308
307 111
110 306
305 109
108 304
303 107
106 302
301 105
104 300
299 103
102 298
297 101
100 296
295 99
98 294
293 97
96 292
291 95
94 290
289 93
92 288
287 91
90 286
285 89
88 ...

result:

ok Operations: 127

Test #85:

score: 20
Accepted
time: 0ms
memory: 3528kb

input:

ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab
ababababababababababababababababababababababababa...

output:

250
248 249
248 247
246 247
246 245
244 245
244 243
242 243
242 241
240 241
240 239
238 239
238 237
236 237
236 235
234 235
234 233
232 233
232 231
230 231
230 229
228 229
228 227
226 227
226 225
224 225
224 223
222 223
222 221
220 221
220 219
218 219
218 217
216 217
216 215
214 215
214 213
212 213
...

result:

ok Operations: 250

Test #86:

score: 20
Accepted
time: 0ms
memory: 3532kb

input:

ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab
ababababababababababababababababababaabababababab...

output:

249
249 249
248 248
247 247
246 246
245 245
244 244
243 243
242 242
241 241
240 240
239 239
238 238
237 237
236 236
235 235
234 234
233 233
232 232
231 231
230 230
229 229
228 228
227 227
226 226
225 225
224 224
223 223
222 222
221 221
220 220
219 219
218 218
217 217
216 216
215 215
214 214
213 213
...

result:

ok Operations: 249

Test #87:

score: 20
Accepted
time: 0ms
memory: 3488kb

input:

abababababababababababababababababababababababababababababababababababababababababaabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa
ababababababababababababababababababababababababa...

output:

249
248 249
248 247
246 247
246 245
244 245
244 243
242 243
242 241
240 241
240 239
238 239
238 237
236 237
236 235
234 235
233 233
232 232
231 231
230 230
229 229
228 228
227 227
226 226
225 225
224 224
223 223
222 222
221 221
220 220
219 219
218 218
217 217
216 216
215 215
214 214
213 213
212 212
...

result:

ok Operations: 249

Test #88:

score: 20
Accepted
time: 0ms
memory: 3616kb

input:

bababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababaabababababababababababababababababababababababababa
bababaabaaaaabababbaababbbbbbabbabbabbbbbabbaaabba...

output:

199
199 246
294 197
196 293
292 195
194 291
290 193
192 289
288 191
190 287
286 189
188 285
284 187
186 283
282 185
184 281
280 183
182 279
278 181
180 277
276 179
178 275
274 177
176 273
272 175
174 271
270 173
172 269
268 171
170 267
266 169
168 265
264 167
166 263
262 165
164 261
260 163
162 259
...

result:

ok Operations: 199

Test #89:

score: 20
Accepted
time: 0ms
memory: 3828kb

input:

abababababaabbaaabababababababbbaaababaaabbaababaababaabababaabaababbabababaababaabababababaabbabaabaabbabababbabbaaabaabababababababaababbaabaababbbabababaaabaabaabbababababbabaabaababbabbaababababaabbababaaabbaababaabaababababababbaabaabababbababba
aaaaaaaaaaaabbbaaabaaaaabbbbbbbbbbbaaaaaaaaaaabbb...

output:

111
141 237
343 139
137 342
341 136
135 340
338 133
132 337
336 131
130 335
334 129
128 332
331 127
126 329
327 125
124 326
325 123
122 324
323 121
120 322
321 118
117 320
319 114
112 318
317 111
109 315
314 108
107 312
311 106
105 310
309 104
102 307
305 100
99 302
301 97
96 300
299 95
93 298
296 9...

result:

ok Operations: 111

Test #90:

score: 20
Accepted
time: 0ms
memory: 3484kb

input:

ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

125
125 250
374 124
123 373
372 122
121 371
370 120
119 369
368 118
117 367
366 116
115 365
364 114
113 363
362 112
111 361
360 110
109 359
358 108
107 357
356 106
105 355
354 104
103 353
352 102
101 351
350 100
99 349
348 98
97 347
346 96
95 345
344 94
93 343
342 92
91 341
340 90
89 339
338 88
87 3...

result:

ok Operations: 125

Test #91:

score: 20
Accepted
time: 0ms
memory: 3624kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
babababababababababababababababababababababababab...

output:

125
205 125
124 329
328 123
122 327
326 121
120 325
324 119
118 323
322 117
116 321
320 115
114 319
318 113
112 317
316 111
110 315
314 109
108 313
312 107
106 311
310 105
104 309
308 103
102 307
306 101
100 305
304 99
98 303
302 97
96 301
300 95
94 299
298 93
92 297
296 91
90 295
294 89
88 293
292 ...

result:

ok Operations: 125

Test #92:

score: 20
Accepted
time: 0ms
memory: 3752kb

input:

aaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
babababababababababababababababababababababababab...

output:

126
148 126
124 271
270 123
122 269
268 121
120 267
266 119
118 265
264 117
116 263
262 115
114 261
260 113
112 259
258 111
110 257
256 109
108 255
254 107
106 253
252 105
104 251
250 103
102 249
248 101
100 247
246 99
98 245
244 97
96 243
242 95
94 241
240 93
92 239
238 91
90 237
236 89
88 235
234 ...

result:

ok Operations: 126

Test #93:

score: 20
Accepted
time: 0ms
memory: 3484kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ababababababababababababababababababababababababa...

output:

127
196 125
124 318
317 123
122 316
315 121
120 314
313 119
118 312
311 117
116 310
309 115
114 308
307 113
112 306
305 111
110 304
303 109
108 302
301 107
106 300
299 105
104 298
297 103
102 296
295 101
100 294
293 99
98 292
291 97
96 290
289 95
94 288
287 93
92 286
285 91
90 284
283 89
88 282
281 ...

result:

ok Operations: 127

Test #94:

score: 20
Accepted
time: 0ms
memory: 3612kb

input:

bababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa
ababababababababababababababababababababababababa...

output:

249
249 249
248 248
247 247
246 246
245 245
244 244
243 243
242 242
241 241
240 240
239 239
238 238
237 237
236 236
235 235
234 234
233 233
232 232
231 231
230 230
229 229
228 228
227 227
226 226
225 225
224 224
223 223
222 222
221 221
220 220
219 219
218 218
217 217
216 216
215 215
214 214
213 213
...

result:

ok Operations: 249

Test #95:

score: 20
Accepted
time: 0ms
memory: 3484kb

input:

ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab
babababababababababababababababababababababababab...

output:

249
248 249
248 247
246 247
246 245
244 245
244 243
242 243
242 241
240 241
240 239
238 239
238 237
236 237
236 235
234 235
234 233
232 233
232 231
230 231
230 229
228 229
228 227
226 227
226 225
224 225
224 223
222 223
222 221
220 221
220 219
218 219
218 217
216 217
216 215
214 215
214 213
212 213
...

result:

ok Operations: 249

Test #96:

score: 20
Accepted
time: 0ms
memory: 3596kb

input:

bababababababababababababababababababababababababababababababababaabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab
ababababababababababbabababababababababababababab...

output:

248
249 249
248 248
247 247
246 246
245 245
244 244
243 243
242 242
241 241
240 240
239 239
238 238
237 237
236 236
235 235
234 234
233 233
232 232
231 231
230 230
229 229
228 228
227 227
226 226
225 225
224 224
223 223
222 222
221 221
220 220
219 219
218 218
217 217
216 216
215 215
214 214
213 213
...

result:

ok Operations: 248

Test #97:

score: 20
Accepted
time: 0ms
memory: 3620kb

input:

ababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababbabababababababab
bababbaababbbababababaabaabbbbabbaaaababbbababaaab...

output:

199
197 248
297 196
195 296
295 194
193 294
293 192
191 292
291 190
189 290
289 188
187 288
287 186
185 286
285 184
183 284
282 182
181 281
280 180
179 279
278 178
177 277
276 176
175 275
274 174
173 273
272 172
171 271
270 170
169 269
268 168
167 267
266 166
165 265
264 164
163 263
262 162
161 261
...

result:

ok Operations: 199

Test #98:

score: 20
Accepted
time: 0ms
memory: 3588kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbaaaaaaaaabbbbbaabbbbbbbbbbbaaaabbbaaaabbbbbbbbabbbaaaaaaaaaabbbbbaaaaaaaaaaaabbbbbbbbbaaabbbbbbbbbbbbbbbaaaaaaaaaaaaaaaabaaaaaaaaaaabbbbbbbbbbbbbbbbbaaaaaabbbbbbbbaaaaabbbbbbbbbbbbaaaaaaaabbbbbbbbbbbbbaaabaaa
baababababaabababbabababababbababababababababaaaba...

output:

110
246 144
142 351
350 141
140 349
348 139
135 347
346 134
133 345
344 130
128 343
342 127
126 341
340 125
124 339
338 123
122 336
335 120
119 332
331 117
116 329
328 115
114 326
325 113
111 323
322 109
108 321
320 107
105 319
318 104
103 317
315 102
101 314
313 96
95 310
308 94
93 307
306 92
90 30...

result:

ok Operations: 110

Subtask #5:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #99:

score: 20
Accepted
time: 0ms
memory: 3536kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

0

result:

ok Operations: 0

Test #100:

score: 20
Accepted
time: 0ms
memory: 3632kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

1001
2000 1000
998 2999
2998 997
996 2997
2996 995
994 2995
2994 993
992 2993
2992 991
990 2991
2990 989
988 2989
2988 987
986 2987
2986 985
984 2985
2984 983
982 2983
2982 981
980 2981
2980 979
978 2979
2978 977
976 2977
2976 975
974 2975
2974 973
972 2973
2972 971
970 2971
2970 969
968 2969
2968 9...

result:

ok Operations: 1001

Test #101:

score: 20
Accepted
time: 1ms
memory: 3652kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

1001
1000 1927
2925 999
998 2924
2923 997
996 2922
2921 995
994 2920
2919 993
992 2918
2917 991
990 2916
2915 989
988 2914
2913 987
986 2912
2911 985
984 2910
2909 983
982 2908
2907 981
980 2906
2905 979
978 2904
2903 977
976 2902
2901 975
974 2900
2899 973
972 2898
2897 971
970 2896
2895 969
968 28...

result:

ok Operations: 1001

Test #102:

score: 20
Accepted
time: 0ms
memory: 3596kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

1001
1791 1001
1000 2789
2788 999
998 2787
2786 997
996 2785
2784 995
994 2783
2782 993
992 2781
2780 991
990 2779
2778 989
988 2777
2776 987
986 2775
2774 985
984 2773
2772 983
982 2771
2770 981
980 2769
2768 979
978 2767
2766 977
976 2765
2764 975
974 2763
2762 973
972 2761
2760 971
970 2759
2758 ...

result:

ok Operations: 1001

Test #103:

score: 20
Accepted
time: 0ms
memory: 3820kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

1002
1679 1000
999 2677
2675 1000
998 2674
2673 997
996 2672
2671 995
994 2670
2669 993
992 2668
2667 991
990 2666
2665 989
988 2664
2663 987
986 2662
2661 985
984 2660
2659 983
982 2658
2657 981
980 2656
2655 979
978 2654
2653 977
976 2652
2651 975
974 2650
2649 973
972 2648
2647 971
970 2646
2645 ...

result:

ok Operations: 1002

Test #104:

score: 20
Accepted
time: 1ms
memory: 3684kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

2000
1998 1999
1998 1997
1996 1997
1996 1995
1994 1995
1994 1993
1992 1993
1992 1991
1990 1991
1990 1989
1988 1989
1988 1987
1986 1987
1986 1985
1984 1985
1984 1983
1982 1983
1982 1981
1980 1981
1980 1979
1978 1979
1978 1977
1976 1977
1976 1975
1974 1975
1974 1973
1972 1973
1972 1971
1970 1971
1970 ...

result:

ok Operations: 2000

Test #105:

score: 20
Accepted
time: 1ms
memory: 3656kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

1999
1999 1998
1997 1998
1997 1996
1995 1996
1995 1994
1993 1994
1993 1992
1991 1992
1991 1990
1989 1990
1989 1988
1987 1988
1987 1986
1985 1986
1985 1984
1983 1984
1983 1982
1981 1982
1981 1980
1979 1980
1979 1978
1977 1978
1977 1976
1975 1976
1975 1974
1973 1974
1973 1972
1971 1972
1971 1970
1969 ...

result:

ok Operations: 1999

Test #106:

score: 20
Accepted
time: 1ms
memory: 3616kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

1999
1998 1999
1998 1997
1996 1997
1996 1995
1994 1995
1994 1993
1992 1993
1992 1991
1990 1991
1990 1989
1988 1989
1988 1987
1986 1987
1986 1985
1984 1985
1984 1983
1982 1983
1982 1981
1980 1981
1980 1979
1978 1979
1978 1977
1976 1977
1976 1975
1974 1975
1974 1973
1972 1973
1972 1971
1970 1971
1970 ...

result:

ok Operations: 1999

Test #107:

score: 20
Accepted
time: 1ms
memory: 3876kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

1998
1999 1998
1997 1998
1997 1996
1995 1996
1995 1994
1993 1994
1993 1992
1991 1992
1991 1990
1989 1990
1989 1988
1987 1988
1987 1986
1985 1986
1985 1984
1983 1984
1983 1982
1981 1982
1981 1980
1979 1980
1979 1978
1977 1978
1977 1976
1975 1976
1975 1974
1973 1974
1973 1972
1971 1972
1971 1970
1969 ...

result:

ok Operations: 1998

Test #108:

score: 20
Accepted
time: 1ms
memory: 3652kb

input:

aaaaaaaaabbbbaaaaaabbbbbbaaaaabbbbbbbbbbbbbbbbbbbbbbaaabbbbaaaabaabbabbaaaabbbaaaaaaaaaabbbbbbaaaabbbbbbbbbbbbbabbbbbbbaaaabbbbbbbaaaaaabbbbbbbbbbbabbbaaababbaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbaaaaaabbbbbbbbbbbbaaabbbbbbbbaaaaaaabbaaaaaaaaabbbbbbbaabaaaaaaaaaaaaaaaaabbbbbbbbb...

output:

1114
1987 1166
1165 2820
2819 1164
1163 2818
2817 1162
1161 2816
2815 1160
1159 2814
2813 1158
1157 2812
2811 1156
1155 2810
2808 1154
1153 2807
2806 1152
1151 2805
2804 1150
1149 2803
2802 1148
1147 2801
2800 1146
1145 2799
2798 1144
1143 2797
2796 1142
1141 2795
2794 1140
1139 2793
2792 1138
1137 ...

result:

ok Operations: 1114

Test #109:

score: 20
Accepted
time: 1ms
memory: 3636kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

1001
1000 0
998 999
998 997
996 997
996 995
994 995
994 993
992 993
992 991
990 991
990 989
988 989
988 987
986 987
986 985
984 985
984 983
982 983
982 981
980 981
980 979
978 979
978 977
976 977
976 975
974 975
974 973
972 973
972 971
970 971
970 969
968 969
968 967
966 967
966 965
964 965
964 963
...

result:

ok Operations: 1001

Test #110:

score: 20
Accepted
time: 1ms
memory: 3584kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

1001
999 1890
2888 998
997 2887
2886 996
995 2885
2884 994
993 2883
2882 992
991 2881
2880 990
989 2879
2878 988
987 2877
2876 986
985 2875
2874 984
983 2873
2872 982
981 2871
2870 980
979 2869
2868 978
977 2867
2866 976
975 2865
2864 974
973 2863
2862 972
971 2861
2860 970
969 2859
2858 968
967 285...

result:

ok Operations: 1001

Test #111:

score: 20
Accepted
time: 1ms
memory: 3572kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

1001
1000 1986
2984 999
998 2983
2982 997
996 2981
2980 995
994 2979
2978 993
992 2977
2976 991
990 2975
2974 989
988 2973
2972 987
986 2971
2970 985
984 2969
2968 983
982 2967
2966 981
980 2965
2964 979
978 2963
2962 977
976 2961
2960 975
974 2959
2958 973
972 2957
2956 971
970 2955
2954 969
968 29...

result:

ok Operations: 1001

Test #112:

score: 20
Accepted
time: 1ms
memory: 3860kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

1001
1419 1001
1000 2417
2416 999
998 2415
2414 997
996 2413
2412 995
994 2411
2410 993
992 2409
2408 991
990 2407
2406 989
988 2405
2404 987
986 2403
2402 985
984 2401
2400 983
982 2399
2398 981
980 2397
2396 979
978 2395
2394 977
976 2393
2392 975
974 2391
2390 973
972 2389
2388 971
970 2387
2386 ...

result:

ok Operations: 1001

Test #113:

score: 20
Accepted
time: 1ms
memory: 3660kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

1999
1999 1999
1998 1998
1997 1997
1996 1996
1995 1995
1994 1994
1993 1993
1992 1992
1991 1991
1990 1990
1989 1989
1988 1988
1987 1987
1986 1986
1985 1985
1984 1984
1983 1983
1982 1982
1981 1981
1980 1980
1979 1979
1978 1978
1977 1977
1976 1976
1975 1975
1974 1974
1973 1973
1972 1972
1971 1971
1970 ...

result:

ok Operations: 1999

Test #114:

score: 20
Accepted
time: 1ms
memory: 3592kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

1999
1998 1998
1997 1997
1996 1996
1995 1995
1994 1994
1993 1993
1992 1992
1991 1991
1990 1990
1989 1989
1988 1988
1987 1987
1986 1986
1985 1985
1984 1984
1983 1983
1982 1982
1981 1981
1980 1980
1979 1979
1978 1978
1977 1977
1976 1976
1975 1975
1974 1974
1973 1973
1972 1972
1971 1971
1970 1970
1969 ...

result:

ok Operations: 1999

Test #115:

score: 20
Accepted
time: 1ms
memory: 3676kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

1998
1999 1999
1998 1998
1997 1997
1996 1996
1995 1995
1994 1994
1993 1993
1992 1992
1991 1991
1990 1990
1989 1989
1988 1988
1987 1987
1986 1986
1985 1985
1984 1984
1983 1983
1982 1982
1981 1981
1980 1980
1979 1979
1978 1978
1977 1977
1976 1976
1975 1975
1974 1974
1973 1973
1972 1972
1971 1971
1970 ...

result:

ok Operations: 1998

Test #116:

score: 20
Accepted
time: 0ms
memory: 3540kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

1998
1999 1997
1996 1998
1997 1995
1994 1996
1995 1993
1992 1994
1993 1991
1990 1992
1991 1989
1988 1990
1989 1987
1986 1988
1987 1985
1984 1986
1985 1983
1982 1984
1983 1981
1980 1982
1981 1979
1978 1980
1979 1977
1976 1978
1977 1975
1974 1976
1975 1973
1972 1974
1973 1971
1970 1972
1971 1969
1968 ...

result:

ok Operations: 1998

Test #117:

score: 20
Accepted
time: 1ms
memory: 3600kb

input:

abababababababababababababaababaabababababababababababababababababababaababababababababababababababababababababababababababababababababababaabababababababababababababababababababababababababababbabababababababaababababababababababababababababababababababababaabababbabababababababababababababbabababa...

output:

1114
1152 1997
2843 1151
1150 2842
2841 1149
1148 2840
2839 1147
1146 2838
2837 1145
1144 2836
2835 1143
1142 2834
2833 1141
1140 2832
2831 1139
1138 2830
2829 1137
1136 2828
2827 1134
1133 2826
2825 1131
1130 2824
2823 1129
1128 2822
2821 1127
1126 2819
2818 1125
1124 2817
2816 1123
1122 2815
2814 ...

result:

ok Operations: 1114

Subtask #6:

score: 25
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #118:

score: 25
Accepted
time: 1ms
memory: 3940kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

0

result:

ok Operations: 0

Test #119:

score: 25
Accepted
time: 16ms
memory: 6416kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

100001
200000 100000
99998 299999
299998 99997
99996 299997
299996 99995
99994 299995
299994 99993
99992 299993
299992 99991
99990 299991
299990 99989
99988 299989
299988 99987
99986 299987
299986 99985
99984 299985
299984 99983
99982 299983
299982 99981
99980 299981
299980 99979
99978 299979
299978...

result:

ok Operations: 100001

Test #120:

score: 25
Accepted
time: 16ms
memory: 6600kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

100001
100000 103540
203538 99999
99998 203537
203536 99997
99996 203535
203534 99995
99994 203533
203532 99993
99992 203531
203530 99991
99990 203529
203528 99989
99988 203527
203526 99987
99986 203525
203524 99985
99984 203523
203522 99983
99982 203521
203520 99981
99980 203519
203518 99979
99978 ...

result:

ok Operations: 100001

Test #121:

score: 25
Accepted
time: 9ms
memory: 6444kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

100001
184371 100001
100000 284369
284368 99999
99998 284367
284366 99997
99996 284365
284364 99995
99994 284363
284362 99993
99992 284361
284360 99991
99990 284359
284358 99989
99988 284357
284356 99987
99986 284355
284354 99985
99984 284353
284352 99983
99982 284351
284350 99981
99980 284349
28434...

result:

ok Operations: 100001

Test #122:

score: 25
Accepted
time: 12ms
memory: 6488kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

100002
100000 189531
289529 99999
99998 289528
289527 99997
99996 289526
289525 99995
99994 289524
289523 99993
99992 289522
289521 99991
99990 289520
289519 99989
99988 289518
289517 99987
99986 289516
289515 99985
99984 289514
289513 99983
99982 289512
289511 99981
99980 289510
289509 99979
99978 ...

result:

ok Operations: 100002

Test #123:

score: 25
Accepted
time: 11ms
memory: 6476kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

100002
100001 191280
291278 100000
99999 291277
291276 99998
99997 291275
291274 99996
99995 291273
291272 99994
99993 291271
291270 99992
99991 291269
291268 99990
99989 291267
291266 99988
99987 291265
291264 99986
99985 291263
291262 99984
99983 291261
291260 99982
99981 291259
291258 99980
99979...

result:

ok Operations: 100002

Test #124:

score: 25
Accepted
time: 16ms
memory: 6908kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

150000
149999 100002
150002 149998
149997 150001
150000 149996
149995 149999
149998 149994
149993 149997
149996 149992
149991 149995
149994 149990
149989 149993
149992 149988
149987 149991
149990 149986
149985 149989
149988 149984
149983 149987
149986 149982
149981 149985
149984 149980
149979 149983...

result:

ok Operations: 150000

Test #125:

score: 25
Accepted
time: 25ms
memory: 7120kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

200000
199998 199999
199998 199997
199996 199997
199996 199995
199994 199995
199994 199993
199992 199993
199992 199991
199990 199991
199990 199989
199988 199989
199988 199987
199986 199987
199986 199985
199984 199985
199984 199983
199982 199983
199982 199981
199980 199981
199980 199979
199978 199979...

result:

ok Operations: 200000

Test #126:

score: 25
Accepted
time: 25ms
memory: 7124kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199999
199998 199998
199997 199997
199996 199996
199995 199995
199994 199994
199993 199993
199992 199992
199991 199991
199990 199990
199989 199989
199988 199988
199987 199987
199986 199986
199985 199985
199984 199984
199983 199983
199982 199982
199981 199981
199980 199980
199979 199979
199978 199978...

result:

ok Operations: 199999

Test #127:

score: 25
Accepted
time: 18ms
memory: 7204kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

199999
199999 199999
199998 199998
199997 199997
199996 199996
199995 199995
199994 199994
199993 199993
199992 199992
199991 199991
199990 199990
199989 199989
199988 199988
199987 199987
199986 199986
199985 199985
199984 199984
199983 199983
199982 199982
199981 199981
199980 199980
199979 199979...

result:

ok Operations: 199999

Test #128:

score: 25
Accepted
time: 26ms
memory: 7204kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199999
199998 199999
199998 199997
199996 199997
199996 199995
199994 199995
199994 199993
199992 199993
199992 199991
199990 199991
199990 199989
199988 199989
199988 199987
199986 199987
199986 199985
199984 199985
199984 199983
199982 199983
199982 199981
199980 199981
199980 199979
199978 199979...

result:

ok Operations: 199999

Test #129:

score: 25
Accepted
time: 26ms
memory: 7116kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199998
199999 199997
199996 200001
200000 199995
199994 199998
199997 199993
199992 199996
199995 199991
199990 199994
199993 199989
199988 199992
199991 199987
199986 199990
199989 199985
199984 199988
199987 199983
199982 199986
199985 199981
199980 199984
199983 199979
199978 199982
199981 199977...

result:

ok Operations: 199998

Test #130:

score: 25
Accepted
time: 25ms
memory: 7164kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199998
199996 199999
200001 199995
199994 200000
199998 199993
199992 199997
199996 199991
199990 199995
199994 199989
199988 199993
199992 199987
199986 199991
199990 199985
199984 199989
199988 199983
199982 199987
199986 199981
199980 199985
199984 199979
199978 199983
199982 199977
199976 199981...

result:

ok Operations: 199998

Test #131:

score: 25
Accepted
time: 13ms
memory: 5360kb

input:

aaababbaabbbbaababababababbbabbaaaababbabababbabaabbbabbabbbbabaaabbbaaabbababbaabbbaabbbababbaabbabaababbbaaaabbbababbbabbabaaaabbbababababaababaababbaabbbbbbabbaaabbbaaaababababaaabbbabbbaabaabbabaabababaaabaaabaaabababaabababbbaaababaaabaabbbbababaababbababbabaabbbaababababbbababaabbababbbabbbbaa...

output:

101948
167613 199999
232384 167609
167608 232381
232380 167607
167606 232377
232373 167605
167603 232372
232371 167600
167599 232370
232369 167598
167596 232368
232367 167595
167594 232366
232365 167592
167591 232364
232363 167589
167587 232360
232357 167586
167585 232356
232354 167584
167581 232353...

result:

ok Operations: 101948

Test #132:

score: 25
Accepted
time: 16ms
memory: 6612kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

100001
0 100000
99998 99999
99998 99997
99996 99997
99996 99995
99994 99995
99994 99993
99992 99993
99992 99991
99990 99991
99990 99989
99988 99989
99988 99987
99986 99987
99986 99985
99984 99985
99984 99983
99982 99983
99982 99981
99980 99981
99980 99979
99978 99979
99978 99977
99976 99977
99976 99...

result:

ok Operations: 100001

Test #133:

score: 25
Accepted
time: 14ms
memory: 6528kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

100001
99999 121207
221205 99998
99997 221204
221203 99996
99995 221202
221201 99994
99993 221200
221199 99992
99991 221198
221197 99990
99989 221196
221195 99988
99987 221194
221193 99986
99985 221192
221191 99984
99983 221190
221189 99982
99981 221188
221187 99980
99979 221186
221185 99978
99977 2...

result:

ok Operations: 100001

Test #134:

score: 25
Accepted
time: 16ms
memory: 6456kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

100001
106314 100000
99999 206312
206311 99998
99997 206310
206309 99996
99995 206308
206307 99994
99993 206306
206305 99992
99991 206304
206303 99990
99989 206302
206301 99988
99987 206300
206299 99986
99985 206298
206297 99984
99983 206296
206295 99982
99981 206294
206293 99980
99979 206292
206291...

result:

ok Operations: 100001

Test #135:

score: 25
Accepted
time: 14ms
memory: 6652kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

100001
100001 112308
212306 100000
99999 212305
212304 99998
99997 212303
212302 99996
99995 212301
212300 99994
99993 212299
212298 99992
99991 212297
212296 99990
99989 212295
212294 99988
99987 212293
212292 99986
99985 212291
212290 99984
99983 212289
212288 99982
99981 212287
212286 99980
99979...

result:

ok Operations: 100001

Test #136:

score: 25
Accepted
time: 13ms
memory: 6652kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

100002
100002 125783
225780 100000
99999 225779
225778 99998
99997 225777
225776 99996
99995 225775
225774 99994
99993 225773
225772 99992
99991 225771
225770 99990
99989 225769
225768 99988
99987 225767
225766 99986
99985 225765
225764 99984
99983 225763
225762 99982
99981 225761
225760 99980
99979...

result:

ok Operations: 100002

Test #137:

score: 25
Accepted
time: 23ms
memory: 7108kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

150000
100002 150000
149998 150001
150000 149997
149996 149999
149998 149995
149994 149997
149996 149993
149992 149995
149994 149991
149990 149993
149992 149989
149988 149991
149990 149987
149986 149989
149988 149985
149984 149987
149986 149983
149982 149985
149984 149981
149980 149983
149982 149979...

result:

ok Operations: 150000

Test #138:

score: 25
Accepted
time: 22ms
memory: 7132kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199999
199999 199999
199998 199998
199997 199997
199996 199996
199995 199995
199994 199994
199993 199993
199992 199992
199991 199991
199990 199990
199989 199989
199988 199988
199987 199987
199986 199986
199985 199985
199984 199984
199983 199983
199982 199982
199981 199981
199980 199980
199979 199979...

result:

ok Operations: 199999

Test #139:

score: 25
Accepted
time: 22ms
memory: 7144kb

input:

babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa...

output:

199998
199998 199999
199998 199997
199996 199997
199996 199995
199994 199995
199994 199993
199992 199993
199992 199991
199990 199991
199990 199989
199988 199989
199988 199987
199986 199987
199986 199985
199984 199985
199984 199983
199982 199983
199982 199981
199980 199981
199980 199979
199978 199979...

result:

ok Operations: 199998

Test #140:

score: 25
Accepted
time: 22ms
memory: 7280kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199999
199998 199999
199998 199997
199996 199997
199996 199995
199994 199995
199994 199993
199992 199993
199992 199991
199990 199991
199990 199989
199988 199989
199988 199987
199986 199987
199986 199985
199984 199985
199984 199983
199982 199983
199982 199981
199980 199981
199980 199979
199978 199979...

result:

ok Operations: 199999

Test #141:

score: 25
Accepted
time: 33ms
memory: 7280kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199999
199997 199999
199998 199996
199995 199997
199996 199994
199993 199995
199994 199992
199991 199993
199992 199990
199989 199991
199990 199988
199987 199989
199988 199986
199985 199987
199986 199984
199983 199985
199984 199982
199981 199983
199982 199980
199979 199981
199980 199978
199977 199979...

result:

ok Operations: 199999

Test #142:

score: 25
Accepted
time: 21ms
memory: 7160kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199998
199999 199998
199996 200000
199998 199995
199994 199997
199996 199993
199992 199995
199994 199991
199990 199993
199992 199989
199988 199991
199990 199987
199986 199989
199988 199985
199984 199987
199986 199983
199982 199985
199984 199981
199980 199983
199982 199979
199978 199981
199980 199977...

result:

ok Operations: 199998

Test #143:

score: 25
Accepted
time: 21ms
memory: 7120kb

input:

abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab...

output:

199997
199997 199999
200001 199996
199995 200000
199998 199994
199993 199997
199996 199992
199991 199995
199994 199990
199989 199993
199992 199988
199987 199991
199990 199986
199985 199989
199988 199984
199983 199987
199986 199982
199981 199985
199984 199980
199979 199983
199982 199978
199977 199981...

result:

ok Operations: 199997

Test #144:

score: 25
Accepted
time: 19ms
memory: 5436kb

input:

aaabaaaababababbaabababbabaaaaaabbaabababbaabbbabaabaaaabbaabbbabbaaababbbaabbbbaabaabaaabaabaabaabababaaaabaaabaabbbbabbababbbabbaababababbabbaabbbbabaaababbbabbabaaaabbabaabaaaabbbababaaaabaababababbaabbbbababababaaabaabbbbabaaababbbababababbaaabaaaabaabbaababbaababbabbabbababababbababbbabbbbaaaaa...

output:

101948
167833 199996
232160 167832
167831 232158
232156 167830
167828 232155
232154 167827
167822 232153
232150 167821
167820 232149
232148 167818
167815 232146
232144 167814
167813 232140
232139 167811
167810 232138
232137 167809
167808 232135
232134 167806
167805 232131
232130 167803
167801 232129...

result:

ok Operations: 101948

Extra Test:

score: 0
Extra Test Passed