QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#143060#4565. Rarest Insectsbashkort#65.19 30ms4176kbC++172.4kb2023-08-20 14:36:202024-07-04 01:50:09

Judging History

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

  • [2024-07-04 01:50:09]
  • 评测
  • 测评结果:65.19
  • 用时:30ms
  • 内存:4176kb
  • [2023-08-20 14:36:20]
  • 提交

answer

#include "insects.h"
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

int min_cardinality(int N) {
    vector<int> a(N);
    iota(a.begin(), a.end(), 0);
    shuffle(a.begin(), a.end(), rnd);
    
    vector<int> leaders, inside(N);
    int maxSize = 0, T = 0, lastQueryT = 0;
    int queriesCnt[3]{};

    auto insert = [&](int x) -> void {
        if (inside[x]) {
            return;
        }
        move_inside(x);
        T += 1;
        queriesCnt[0] += 1;
        inside[x] = true;
    };

    auto erase = [&](int x) -> void {
        if (!inside[x]) {
            return;
        }
        move_outside(x);
        T += 1;
        queriesCnt[1] += 1;
        inside[x] = false;
    };

    auto query = [&]() -> int {
        if (T == lastQueryT) {
            return maxSize;
        }
        lastQueryT = T;
        queriesCnt[2] += 1;
        return maxSize = press_button();
    };

    vector<int> others;

    for (int x : a) {
        insert(x);
        if (query() == 1) {
            leaders.push_back(x);
        } else {
            others.push_back(x);
            erase(x);
        }
    };

    int ans = N;

    auto dfs = [&](auto dfs, vector<int> lead, vector<int> oth, int isFull) -> void {
        if (ans == 1) {
            return;
        }
        if (size(lead) == 1) {
            ans = min<int>(ans, 1 + size(oth));
            return;
        }
        if (size(lead) > size(oth)) {
            ans = 1;
            return;
        }
        int mid = size(lead) / 2;
        vector<int> leadLeft(lead.begin(), lead.begin() + mid);
        vector<int> leadRight(lead.begin() + mid, lead.end());
        vector<int> nxt[2];
        if (isFull) {
            for (int x : leadRight) {
                erase(x);
            }
        } else {
            for (int x : leadLeft) {
                insert(x);
            }
        }
        for (int x : oth) {
            insert(x);
            if (query() == 1) {
                nxt[1].push_back(x);
            } else {
                nxt[0].push_back(x);
            }
            erase(x);
        }
        dfs(dfs, leadLeft, nxt[0], true);
        dfs(dfs, leadRight, nxt[1], false);
    };

    dfs(dfs, leaders, others, true);

    return ans;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

6
1
1
2
2
1
2
1
1
1

output:

8
0 1
8
2
8
0 4
8
2
8
0 5
8
2
8
1 5
8
0 2
8
2
8
1 2
8
0 0
8
2
8
0 3
8
2
8
1 3
8
1 4
8
1 0
8
0 5
8
2
8
1 5
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
3 1

result:

ok 

Test #2:

score: 0
Accepted
time: 1ms
memory: 4096kb

input:

2
1
2

output:

8
0 0
8
2
8
0 1
8
2
8
1 1
8
3 2

result:

ok 

Test #3:

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

input:

2
1
1

output:

8
0 0
8
2
8
0 1
8
2
8
3 1

result:

ok 

Test #4:

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

input:

3
1
1
2

output:

8
0 0
8
2
8
0 2
8
2
8
0 1
8
2
8
1 1
8
3 1

result:

ok 

Test #5:

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

input:

5
1
2
2
1
2
2
2
1

output:

8
0 3
8
2
8
0 0
8
2
8
1 0
8
0 4
8
2
8
1 4
8
0 1
8
2
8
0 2
8
2
8
1 2
8
1 1
8
0 0
8
2
8
1 0
8
0 4
8
2
8
1 4
8
0 2
8
2
8
1 2
8
3 2

result:

ok 

Test #6:

score: 0
Accepted
time: 1ms
memory: 3892kb

input:

8
1
1
2
2
2
1
2
2
1
1
1
1
1

output:

8
0 7
8
2
8
0 3
8
2
8
0 4
8
2
8
1 4
8
0 5
8
2
8
1 5
8
0 2
8
2
8
1 2
8
0 0
8
2
8
0 1
8
2
8
1 1
8
0 6
8
2
8
1 6
8
1 3
8
1 0
8
0 4
8
2
8
1 4
8
0 5
8
2
8
1 5
8
0 2
8
2
8
1 2
8
0 1
8
2
8
1 1
8
0 6
8
2
8
1 6
8
3 1

result:

ok 

Test #7:

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

input:

199
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 195
8
2
8
0 8
8
2
8
1 8
8
0 173
8
2
8
1 173
8
0 143
8
2
8
1 143
8
0 67
8
2
8
1 67
8
0 91
8
2
8
1 91
8
0 25
8
2
8
1 25
8
0 121
8
2
8
1 121
8
0 197
8
2
8
1 197
8
0 182
8
2
8
1 182
8
0 4
8
2
8
1 4
8
0 7
8
2
8
1 7
8
0 28
8
2
8
1 28
8
0 15
8
2
8
1 15
8
0 156
8
2
8
1 156
8
0 139
8
2
8
1 139
8
0 84
8
2...

result:

ok 

Test #8:

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

input:

200
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

8
0 118
8
2
8
0 106
8
2
8
0 125
8
2
8
0 80
8
2
8
0 116
8
2
8
0 61
8
2
8
0 115
8
2
8
0 149
8
2
8
0 185
8
2
8
0 136
8
2
8
0 82
8
2
8
0 183
8
2
8
0 46
8
2
8
0 94
8
2
8
0 190
8
2
8
0 9
8
2
8
0 70
8
2
8
0 86
8
2
8
0 39
8
2
8
0 30
8
2
8
0 35
8
2
8
0 59
8
2
8
0 179
8
2
8
0 31
8
2
8
0 16
8
2
8
0 101
8
2
8
0...

result:

ok 

Test #9:

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

input:

200
1
1
1
1
1
1
1
1
2
2
2
1
2
2
2
2
1
2
2
2
2
1
2
1
2
2
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 128
8
2
8
0 176
8
2
8
0 122
8
2
8
0 18
8
2
8
0 87
8
2
8
0 74
8
2
8
0 134
8
2
8
0 97
8
2
8
0 50
8
2
8
1 50
8
0 39
8
2
8
1 39
8
0 5
8
2
8
1 5
8
0 2
8
2
8
0 160
8
2
8
1 160
8
0 126
8
2
8
1 126
8
0 57
8
2
8
1 57
8
0 61
8
2
8
1 61
8
0 88
8
2
8
0 195
8
2
8
1 195
8
0 138
8
2
8
1 138
8
0 113
8
2
8
1 113...

result:

ok 

Test #10:

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

input:

198
1
1
1
1
1
1
1
1
2
2
1
1
2
2
2
2
2
1
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 192
8
2
8
0 167
8
2
8
0 122
8
2
8
0 177
8
2
8
0 124
8
2
8
0 118
8
2
8
0 112
8
2
8
0 169
8
2
8
0 180
8
2
8
1 180
8
0 120
8
2
8
1 120
8
0 67
8
2
8
0 64
8
2
8
0 40
8
2
8
1 40
8
0 104
8
2
8
1 104
8
0 168
8
2
8
1 168
8
0 1
8
2
8
1 1
8
0 44
8
2
8
1 44
8
0 7
8
2
8
0 42
8
2
8
0 151
8
2
8
1 151
8
0 76
8
...

result:

ok 

Test #11:

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

input:

199
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 85
8
2
8
0 166
8
2
8
1 166
8
0 81
8
2
8
1 81
8
0 10
8
2
8
1 10
8
0 150
8
2
8
1 150
8
0 117
8
2
8
1 117
8
0 131
8
2
8
1 131
8
0 15
8
2
8
1 15
8
0 31
8
2
8
1 31
8
0 186
8
2
8
1 186
8
0 176
8
2
8
1 176
8
0 55
8
2
8
1 55
8
0 50
8
2
8
1 50
8
0 107
8
2
8
1 107
8
0 20
8
2
8
1 20
8
0 27
8
2
8
1 27
8
0 9...

result:

ok 

Test #12:

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

input:

197
1
1
2
1
1
2
2
2
1
1
1
2
2
1
1
2
1
2
1
1
1
2
1
2
1
2
2
2
1
2
1
2
2
1
1
2
1
1
2
1
1
2
2
2
1
1
1
2
2
1
2
2
2
2
2
1
1
1
1
1
2
2
1
2
1
2
1
1
1
1
2
2
1
1
2
2
1
2
2
1
1
2
2
2
2
1
1
1
1
1
2
1
1
1
2
2
2
2
1
2
1
2
1
1
2
2
1
1
2
2
1
1
2
2
1
2
2
1
2
1
1
2
1
2
1
1
1
1
1
2
2
2
2
1
1
2
1
1
1
2
1
2
1
2
2
1
1
2
...

output:

8
0 167
8
2
8
0 132
8
2
8
0 145
8
2
8
1 145
8
0 134
8
2
8
0 105
8
2
8
0 2
8
2
8
1 2
8
0 12
8
2
8
1 12
8
0 20
8
2
8
1 20
8
0 186
8
2
8
0 133
8
2
8
0 117
8
2
8
0 163
8
2
8
1 163
8
0 26
8
2
8
1 26
8
0 79
8
2
8
0 71
8
2
8
0 184
8
2
8
1 184
8
0 196
8
2
8
0 68
8
2
8
1 68
8
0 88
8
2
8
0 185
8
2
8
0 30
8
2
...

result:

ok 

Test #13:

score: 0
Accepted
time: 4ms
memory: 3768kb

input:

197
1
2
1
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 3
8
2
8
0 160
8
2
8
1 160
8
0 16
8
2
8
0 188
8
2
8
0 30
8
2
8
1 30
8
0 136
8
2
8
1 136
8
0 177
8
2
8
0 118
8
2
8
1 118
8
0 48
8
2
8
1 48
8
0 165
8
2
8
1 165
8
0 51
8
2
8
1 51
8
0 152
8
2
8
1 152
8
0 106
8
2
8
1 106
8
0 142
8
2
8
1 142
8
0 101
8
2
8
1 101
8
0 58
8
2
8
1 58
8
0 94
8
2
8
1 94
8
0 0...

result:

ok 

Test #14:

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

input:

198
1
1
1
1
2
1
1
1
2
2
2
2
1
2
2
2
1
1
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 48
8
2
8
0 70
8
2
8
0 25
8
2
8
0 106
8
2
8
0 17
8
2
8
1 17
8
0 0
8
2
8
0 54
8
2
8
0 44
8
2
8
0 180
8
2
8
1 180
8
0 80
8
2
8
1 80
8
0 16
8
2
8
1 16
8
0 123
8
2
8
1 123
8
0 87
8
2
8
0 159
8
2
8
1 159
8
0 56
8
2
8
1 56
8
0 43
8
2
8
1 43
8
0 95
8
2
8
0 118
8
2
8
0 168
8
2
8
1 168
8
0 89
8
2
8
0 135
...

result:

ok 

Test #15:

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

input:

200
1
1
1
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 144
8
2
8
0 174
8
2
8
0 108
8
2
8
0 74
8
2
8
0 184
8
2
8
1 184
8
0 197
8
2
8
1 197
8
0 70
8
2
8
0 40
8
2
8
1 40
8
0 128
8
2
8
1 128
8
0 137
8
2
8
1 137
8
0 48
8
2
8
1 48
8
0 115
8
2
8
1 115
8
0 10
8
2
8
1 10
8
0 24
8
2
8
1 24
8
0 136
8
2
8
1 136
8
0 122
8
2
8
1 122
8
0 171
8
2
8
1 171
8
0 154
8
...

result:

ok 

Test #16:

score: 0
Accepted
time: 4ms
memory: 3960kb

input:

196
1
1
1
1
1
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 19
8
2
8
0 182
8
2
8
0 91
8
2
8
0 75
8
2
8
0 104
8
2
8
0 193
8
2
8
1 193
8
0 172
8
2
8
1 172
8
0 67
8
2
8
0 96
8
2
8
1 96
8
0 191
8
2
8
1 191
8
0 39
8
2
8
1 39
8
0 85
8
2
8
1 85
8
0 98
8
2
8
0 60
8
2
8
1 60
8
0 116
8
2
8
1 116
8
0 186
8
2
8
1 186
8
0 62
8
2
8
1 62
8
0 145
8
2
8
1 145
8
0 174
8
2...

result:

ok 

Test #17:

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

input:

199
1
1
1
1
1
2
1
2
2
1
1
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 17
8
2
8
0 90
8
2
8
0 127
8
2
8
0 11
8
2
8
0 89
8
2
8
0 190
8
2
8
1 190
8
0 77
8
2
8
0 160
8
2
8
1 160
8
0 14
8
2
8
1 14
8
0 30
8
2
8
0 194
8
2
8
0 158
8
2
8
0 40
8
2
8
1 40
8
0 170
8
2
8
0 53
8
2
8
1 53
8
0 29
8
2
8
1 29
8
0 71
8
2
8
1 71
8
0 130
8
2
8
1 130
8
0 57
8
2
8
1 57
8
0 177
8
2
8
1 17...

result:

ok 

Test #18:

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

input:

196
1
2
1
1
2
2
1
2
1
2
2
1
1
1
2
1
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 10
8
2
8
0 42
8
2
8
1 42
8
0 45
8
2
8
0 63
8
2
8
0 165
8
2
8
1 165
8
0 176
8
2
8
1 176
8
0 16
8
2
8
0 98
8
2
8
1 98
8
0 53
8
2
8
0 55
8
2
8
1 55
8
0 88
8
2
8
1 88
8
0 122
8
2
8
0 162
8
2
8
0 133
8
2
8
0 28
8
2
8
1 28
8
0 40
8
2
8
0 70
8
2
8
0 35
8
2
8
1 35
8
0 52
8
2
8
1 52
8
0 168
8
2
8
1 168
8...

result:

ok 

Test #19:

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

input:

196
1
1
1
2
1
1
1
1
2
2
2
1
1
1
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 39
8
2
8
0 160
8
2
8
0 31
8
2
8
0 43
8
2
8
1 43
8
0 74
8
2
8
0 170
8
2
8
0 85
8
2
8
0 49
8
2
8
0 91
8
2
8
1 91
8
0 14
8
2
8
1 14
8
0 167
8
2
8
1 167
8
0 81
8
2
8
0 132
8
2
8
0 105
8
2
8
0 47
8
2
8
0 179
8
2
8
1 179
8
0 59
8
2
8
1 59
8
0 65
8
2
8
1 65
8
0 7
8
2
8
1 7
8
0 139
8
2
8
1 139
8
0 35
8
...

result:

ok 

Test #20:

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

input:

196
1
1
1
2
1
2
1
1
1
2
2
2
1
2
2
1
2
1
1
2
2
2
2
1
1
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
1
2
1
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 169
8
2
8
0 38
8
2
8
0 93
8
2
8
0 147
8
2
8
1 147
8
0 188
8
2
8
0 142
8
2
8
1 142
8
0 103
8
2
8
0 81
8
2
8
0 163
8
2
8
0 42
8
2
8
1 42
8
0 153
8
2
8
1 153
8
0 194
8
2
8
1 194
8
0 12
8
2
8
0 4
8
2
8
1 4
8
0 118
8
2
8
1 118
8
0 76
8
2
8
0 144
8
2
8
1 144
8
0 140
8
2
8
0 9
8
2
8
0 165
8
2
8
1 165
8...

result:

ok 

Test #21:

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

input:

200
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
2
1
2
1
1
1
2
2
1
1
1
1
1
1
1
2
2
2
2
2
1
1
2
1
2
1
2
1
2
1
1
2
2
2
2
2
2
1
2
1
1
1
2
2
2
2
2
2
2
2
2
2
1
1
2
2
2
2
1
2
2
2
2
2
1
2
1
2
2
2
2
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
1
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 64
8
2
8
0 116
8
2
8
0 196
8
2
8
0 14
8
2
8
0 97
8
2
8
0 173
8
2
8
0 21
8
2
8
0 84
8
2
8
0 19
8
2
8
0 60
8
2
8
1 60
8
0 132
8
2
8
0 91
8
2
8
0 137
8
2
8
0 50
8
2
8
0 154
8
2
8
0 82
8
2
8
1 82
8
0 70
8
2
8
0 156
8
2
8
1 156
8
0 66
8
2
8
0 159
8
2
8
0 144
8
2
8
0 164
8
2
8
1 164
8
0 79
8
2
8
1 79
...

result:

ok 

Test #22:

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

input:

199
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
2
1
2
1
2
1
2
2
1
1
1
1
2
1
2
1
1
2
1
1
2
2
2
2
2
1
1
2
1
2
2
1
1
1
2
1
1
1
2
1
2
1
2
2
2
1
1
2
2
2
1
1
2
2
1
2
1
2
2
2
1
2
2
1
1
2
1
1
2
2
2
1
1
2
2
1
1
1
2
2
2
1
1
1
2
2
1
2
2
2
2
1
1
1
2
1
2
2
2
1
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
1
...

output:

8
0 196
8
2
8
0 192
8
2
8
0 15
8
2
8
0 125
8
2
8
0 131
8
2
8
0 120
8
2
8
0 193
8
2
8
0 23
8
2
8
0 103
8
2
8
0 6
8
2
8
0 43
8
2
8
0 129
8
2
8
0 0
8
2
8
0 198
8
2
8
0 69
8
2
8
0 132
8
2
8
0 75
8
2
8
0 190
8
2
8
0 90
8
2
8
0 42
8
2
8
0 197
8
2
8
0 20
8
2
8
0 50
8
2
8
0 9
8
2
8
0 86
8
2
8
0 113
8
2
8
1 ...

result:

ok 

Test #23:

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

input:

198
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
2
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
2
1
1
2
1
1
1
1
2
2
1
1
1
1
1
2
1
1
1
1
2
1
1
1
1
2
1
1
1
2
1
2
1
2
1
1
1
1
2
1
1
1
2
2
2
1
1
2
1
1
1
1
1
1
1
2
1
1
1
1
1
2
2
1
1
1
2
1
2
2
2
1
1
1
1
2
2
2
1
1
2
1
1
2
1
1
1
1
1
1
2
1
1
2
2
2
2
1
1
1
2
1
1
2
...

output:

8
0 49
8
2
8
0 74
8
2
8
0 93
8
2
8
0 157
8
2
8
0 186
8
2
8
0 100
8
2
8
0 96
8
2
8
0 11
8
2
8
0 137
8
2
8
0 180
8
2
8
0 135
8
2
8
0 126
8
2
8
0 67
8
2
8
0 191
8
2
8
0 98
8
2
8
0 5
8
2
8
0 129
8
2
8
1 129
8
0 75
8
2
8
0 177
8
2
8
0 103
8
2
8
1 103
8
0 134
8
2
8
0 173
8
2
8
0 195
8
2
8
0 33
8
2
8
0 0
8...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

score: 15
Accepted
time: 3ms
memory: 3896kb

input:

1000
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 869
8
2
8
0 58
8
2
8
1 58
8
0 104
8
2
8
1 104
8
0 146
8
2
8
1 146
8
0 698
8
2
8
1 698
8
0 393
8
2
8
1 393
8
0 676
8
2
8
1 676
8
0 659
8
2
8
1 659
8
0 454
8
2
8
1 454
8
0 750
8
2
8
1 750
8
0 523
8
2
8
1 523
8
0 842
8
2
8
1 842
8
0 418
8
2
8
1 418
8
0 532
8
2
8
1 532
8
0 944
8
2
8
1 944
8
0 179
8
...

result:

ok 

Test #25:

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

input:

1000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

8
0 674
8
2
8
0 954
8
2
8
0 239
8
2
8
0 148
8
2
8
0 458
8
2
8
0 276
8
2
8
0 150
8
2
8
0 238
8
2
8
0 627
8
2
8
0 400
8
2
8
0 563
8
2
8
0 977
8
2
8
0 515
8
2
8
0 889
8
2
8
0 63
8
2
8
0 351
8
2
8
0 26
8
2
8
0 776
8
2
8
0 257
8
2
8
0 199
8
2
8
0 299
8
2
8
0 58
8
2
8
0 178
8
2
8
0 949
8
2
8
0 243
8
2
8
0...

result:

ok 

Test #26:

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

input:

999
1
1
1
1
1
1
2
1
1
1
1
2
2
2
2
2
1
2
1
1
1
2
1
2
1
1
1
2
1
2
2
1
2
2
1
2
2
2
2
1
1
2
2
1
2
2
1
2
2
2
2
2
1
1
2
2
2
2
2
2
1
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 13
8
2
8
0 111
8
2
8
0 23
8
2
8
0 632
8
2
8
0 20
8
2
8
0 383
8
2
8
0 303
8
2
8
1 303
8
0 268
8
2
8
0 296
8
2
8
0 595
8
2
8
0 86
8
2
8
0 117
8
2
8
1 117
8
0 470
8
2
8
1 470
8
0 437
8
2
8
1 437
8
0 747
8
2
8
1 747
8
0 563
8
2
8
1 563
8
0 333
8
2
8
0 698
8
2
8
1 698
8
0 389
8
2
8
0 180
8
2
8
0 185
...

result:

ok 

Test #27:

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

input:

999
1
1
1
1
2
1
1
1
1
1
2
2
2
2
1
1
1
2
1
2
2
1
1
2
2
1
2
2
2
1
2
2
1
2
1
1
1
2
2
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
1
2
1
2
1
2
2
2
2
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 216
8
2
8
0 480
8
2
8
0 20
8
2
8
0 304
8
2
8
0 238
8
2
8
1 238
8
0 522
8
2
8
0 166
8
2
8
0 870
8
2
8
0 605
8
2
8
0 847
8
2
8
0 611
8
2
8
1 611
8
0 700
8
2
8
1 700
8
0 694
8
2
8
1 694
8
0 453
8
2
8
1 453
8
0 371
8
2
8
0 627
8
2
8
0 921
8
2
8
0 916
8
2
8
1 916
8
0 115
8
2
8
0 262
8
2
8
1 262
8
0 5...

result:

ok 

Test #28:

score: 0
Accepted
time: 4ms
memory: 3908kb

input:

996
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 25
8
2
8
0 37
8
2
8
1 37
8
0 273
8
2
8
1 273
8
0 402
8
2
8
1 402
8
0 491
8
2
8
1 491
8
0 770
8
2
8
1 770
8
0 637
8
2
8
1 637
8
0 73
8
2
8
1 73
8
0 156
8
2
8
1 156
8
0 963
8
2
8
1 963
8
0 461
8
2
8
1 461
8
0 878
8
2
8
1 878
8
0 630
8
2
8
1 630
8
0 988
8
2
8
1 988
8
0 804
8
2
8
1 804
8
0 553
8
2
8...

result:

ok 

Test #29:

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

input:

995
1
1
2
2
1
2
2
2
1
2
2
1
1
1
2
2
1
1
2
2
2
1
2
2
2
2
1
1
1
1
1
1
1
2
1
2
2
1
2
1
1
2
1
1
1
1
1
1
1
2
2
1
2
1
2
1
2
1
2
1
2
1
2
2
1
2
2
1
1
2
2
1
1
2
1
1
1
1
1
2
2
2
1
2
2
1
2
1
2
1
1
1
2
1
2
1
1
2
2
1
2
2
2
2
2
2
1
2
2
2
1
2
2
2
1
1
2
1
2
1
2
1
2
2
2
1
2
2
1
1
2
1
1
1
2
2
2
2
2
2
2
2
1
2
2
1
1
2
...

output:

8
0 173
8
2
8
0 206
8
2
8
0 944
8
2
8
1 944
8
0 459
8
2
8
1 459
8
0 47
8
2
8
0 239
8
2
8
1 239
8
0 808
8
2
8
1 808
8
0 53
8
2
8
1 53
8
0 783
8
2
8
0 305
8
2
8
1 305
8
0 929
8
2
8
1 929
8
0 357
8
2
8
0 714
8
2
8
0 738
8
2
8
0 276
8
2
8
1 276
8
0 652
8
2
8
1 652
8
0 901
8
2
8
0 960
8
2
8
0 647
8
2
8
1...

result:

ok 

Test #30:

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

input:

998
1
1
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 90
8
2
8
0 847
8
2
8
0 470
8
2
8
0 233
8
2
8
1 233
8
0 664
8
2
8
1 664
8
0 819
8
2
8
1 819
8
0 760
8
2
8
1 760
8
0 895
8
2
8
1 895
8
0 280
8
2
8
1 280
8
0 484
8
2
8
0 947
8
2
8
1 947
8
0 153
8
2
8
1 153
8
0 728
8
2
8
1 728
8
0 647
8
2
8
1 647
8
0 962
8
2
8
1 962
8
0 202
8
2
8
1 202
8
0 764
8
2
8...

result:

ok 

Test #31:

score: 0
Accepted
time: 16ms
memory: 4132kb

input:

998
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
2
1
2
2
1
1
2
2
1
1
1
2
1
2
2
2
1
2
2
2
2
2
1
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 226
8
2
8
0 370
8
2
8
0 486
8
2
8
0 254
8
2
8
0 553
8
2
8
0 740
8
2
8
0 756
8
2
8
0 867
8
2
8
0 973
8
2
8
1 973
8
0 826
8
2
8
0 933
8
2
8
0 895
8
2
8
0 188
8
2
8
0 289
8
2
8
0 570
8
2
8
0 424
8
2
8
0 56
8
2
8
1 56
8
0 137
8
2
8
0 321
8
2
8
1 321
8
0 611
8
2
8
0 657
8
2
8
1 657
8
0 720
8
2
8
1 72...

result:

ok 

Test #32:

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

input:

1000
1
1
2
1
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 325
8
2
8
0 260
8
2
8
0 132
8
2
8
1 132
8
0 877
8
2
8
0 995
8
2
8
1 995
8
0 885
8
2
8
1 885
8
0 125
8
2
8
1 125
8
0 956
8
2
8
0 513
8
2
8
1 513
8
0 647
8
2
8
0 433
8
2
8
1 433
8
0 106
8
2
8
1 106
8
0 297
8
2
8
1 297
8
0 793
8
2
8
1 793
8
0 480
8
2
8
1 480
8
0 198
8
2
8
1 198
8
0 412
8
2
8
1 412
...

result:

ok 

Test #33:

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

input:

996
1
1
1
2
2
1
2
1
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 941
8
2
8
0 322
8
2
8
0 734
8
2
8
0 462
8
2
8
1 462
8
0 617
8
2
8
1 617
8
0 330
8
2
8
0 794
8
2
8
1 794
8
0 770
8
2
8
0 149
8
2
8
0 769
8
2
8
1 769
8
0 496
8
2
8
1 496
8
0 620
8
2
8
1 620
8
0 814
8
2
8
1 814
8
0 308
8
2
8
1 308
8
0 178
8
2
8
1 178
8
0 465
8
2
8
1 465
8
0 881
8
2
8
1 881
8
0 631
...

result:

ok 

Test #34:

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

input:

1000
1
1
2
1
1
2
2
1
2
1
1
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 330
8
2
8
0 496
8
2
8
0 968
8
2
8
1 968
8
0 906
8
2
8
0 1
8
2
8
0 811
8
2
8
1 811
8
0 801
8
2
8
1 801
8
0 641
8
2
8
0 57
8
2
8
1 57
8
0 36
8
2
8
0 967
8
2
8
0 711
8
2
8
1 711
8
0 19
8
2
8
1 19
8
0 771
8
2
8
0 273
8
2
8
1 273
8
0 191
8
2
8
0 209
8
2
8
1 209
8
0 963
8
2
8
1 963
8
0 26
8
2
8
1 26
8...

result:

ok 

Test #35:

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

input:

1000
1
1
1
1
1
2
1
2
2
1
2
1
2
2
1
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 334
8
2
8
0 821
8
2
8
0 652
8
2
8
0 197
8
2
8
0 253
8
2
8
0 658
8
2
8
1 658
8
0 970
8
2
8
0 956
8
2
8
1 956
8
0 547
8
2
8
1 547
8
0 134
8
2
8
0 904
8
2
8
1 904
8
0 133
8
2
8
0 893
8
2
8
1 893
8
0 556
8
2
8
1 556
8
0 606
8
2
8
0 927
8
2
8
1 927
8
0 677
8
2
8
1 677
8
0 544
8
2
8
0 195
8
2
8
1 195
...

result:

ok 

Test #36:

score: 0
Accepted
time: 12ms
memory: 3908kb

input:

997
1
1
1
1
2
2
1
2
2
2
1
1
2
2
2
1
1
1
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 163
8
2
8
0 159
8
2
8
0 451
8
2
8
0 309
8
2
8
0 486
8
2
8
1 486
8
0 549
8
2
8
1 549
8
0 585
8
2
8
0 670
8
2
8
1 670
8
0 647
8
2
8
1 647
8
0 873
8
2
8
1 873
8
0 697
8
2
8
0 905
8
2
8
0 316
8
2
8
1 316
8
0 54
8
2
8
1 54
8
0 308
8
2
8
1 308
8
0 523
8
2
8
0 229
8
2
8
0 323
8
2
8
0 266
8
2
8
1 266
8
...

result:

ok 

Test #37:

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

input:

995
1
1
1
1
1
1
1
1
1
1
1
2
2
1
2
2
1
2
1
2
2
2
1
2
1
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 574
8
2
8
0 337
8
2
8
0 748
8
2
8
0 290
8
2
8
0 902
8
2
8
0 376
8
2
8
0 559
8
2
8
0 267
8
2
8
0 253
8
2
8
0 938
8
2
8
0 109
8
2
8
0 862
8
2
8
1 862
8
0 784
8
2
8
1 784
8
0 858
8
2
8
0 341
8
2
8
1 341
8
0 487
8
2
8
1 487
8
0 321
8
2
8
0 770
8
2
8
1 770
8
0 682
8
2
8
0 530
8
2
8
1 530
8
0 26
8
2
8...

result:

ok 

Test #38:

score: 0
Accepted
time: 9ms
memory: 3848kb

input:

997
1
1
1
1
1
1
1
1
2
1
1
1
2
1
1
1
1
2
1
2
1
2
1
1
1
1
2
1
1
1
2
2
1
1
2
2
1
2
2
2
1
1
1
1
1
2
2
2
2
2
2
1
2
2
2
2
1
2
1
1
1
1
2
2
2
1
2
1
2
2
1
2
2
2
1
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 740
8
2
8
0 310
8
2
8
0 670
8
2
8
0 638
8
2
8
0 81
8
2
8
0 546
8
2
8
0 815
8
2
8
0 896
8
2
8
0 937
8
2
8
1 937
8
0 421
8
2
8
0 326
8
2
8
0 36
8
2
8
0 285
8
2
8
1 285
8
0 249
8
2
8
0 610
8
2
8
0 10
8
2
8
0 434
8
2
8
0 576
8
2
8
1 576
8
0 838
8
2
8
0 609
8
2
8
1 609
8
0 40
8
2
8
0 211
8
2
8
1 211
...

result:

ok 

Test #39:

score: 0
Accepted
time: 12ms
memory: 3904kb

input:

997
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
2
1
1
1
1
2
2
2
2
1
2
1
2
1
2
1
1
1
1
1
1
1
2
2
1
1
2
1
1
2
1
2
2
2
1
2
1
1
2
1
1
1
1
1
2
1
2
2
1
1
1
2
1
2
1
2
1
1
1
1
2
1
1
2
2
1
2
2
1
2
2
2
2
1
2
2
1
2
2
2
2
1
2
2
1
2
2
2
1
2
1
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
...

output:

8
0 852
8
2
8
0 928
8
2
8
0 176
8
2
8
0 142
8
2
8
0 33
8
2
8
0 354
8
2
8
0 23
8
2
8
0 179
8
2
8
0 72
8
2
8
0 938
8
2
8
0 116
8
2
8
0 703
8
2
8
0 738
8
2
8
1 738
8
0 68
8
2
8
1 68
8
0 764
8
2
8
0 64
8
2
8
0 403
8
2
8
0 699
8
2
8
0 237
8
2
8
0 620
8
2
8
0 834
8
2
8
0 65
8
2
8
0 400
8
2
8
0 742
8
2
8
1...

result:

ok 

Test #40:

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

input:

996
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
1
1
1
1
2
1
1
1
1
2
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
2
1
2
1
2
2
1
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
2
2
1
1
1
1
1
1
2
1
1
1
1
2
2
1
1
1
1
2
1
1
2
1
2
2
2
1
2
1
2
1
2
1
1
2
2
1
1
1
2
2
1
2
1
2
1
1
1
2
2
2
1
2
1
1
2
1
1
1
1
2
2
1
2
2
1
1
2
2
1
1
2
2
...

output:

8
0 428
8
2
8
0 646
8
2
8
0 576
8
2
8
0 508
8
2
8
0 938
8
2
8
0 361
8
2
8
0 727
8
2
8
0 85
8
2
8
0 326
8
2
8
0 275
8
2
8
0 25
8
2
8
0 587
8
2
8
0 845
8
2
8
0 641
8
2
8
0 417
8
2
8
1 417
8
0 982
8
2
8
1 982
8
0 883
8
2
8
0 93
8
2
8
0 5
8
2
8
0 289
8
2
8
0 344
8
2
8
0 534
8
2
8
1 534
8
0 835
8
2
8
0 1...

result:

ok 

Test #41:

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

input:

995
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
2
1
1
1
1
1
2
2
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
2
1
1
2
1
1
1
1
1
1
1
1
1
1
2
1
1
1
2
1
1
1
1
2
2
1
1
2
1
1
1
2
1
1
1
1
1
1
1
1
2
1
2
1
1
1
1
1
...

output:

8
0 159
8
2
8
0 459
8
2
8
0 68
8
2
8
0 248
8
2
8
0 95
8
2
8
0 143
8
2
8
0 279
8
2
8
0 792
8
2
8
0 777
8
2
8
0 340
8
2
8
0 781
8
2
8
0 122
8
2
8
0 400
8
2
8
0 877
8
2
8
0 528
8
2
8
0 724
8
2
8
0 883
8
2
8
0 632
8
2
8
0 149
8
2
8
1 149
8
0 32
8
2
8
0 864
8
2
8
0 585
8
2
8
0 596
8
2
8
0 196
8
2
8
0 387...

result:

ok 

Test #42:

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

input:

995
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
2
1
1
1
1
2
1
1
2
1
...

output:

8
0 665
8
2
8
0 636
8
2
8
0 38
8
2
8
0 263
8
2
8
0 209
8
2
8
0 133
8
2
8
0 272
8
2
8
0 375
8
2
8
1 375
8
0 691
8
2
8
0 655
8
2
8
0 281
8
2
8
0 50
8
2
8
0 88
8
2
8
0 346
8
2
8
0 987
8
2
8
0 876
8
2
8
0 287
8
2
8
0 862
8
2
8
0 122
8
2
8
0 677
8
2
8
0 607
8
2
8
0 21
8
2
8
0 388
8
2
8
0 481
8
2
8
0 235
...

result:

ok 

Subtask #3:

score: 40.19
Acceptable Answer

Test #43:

score: 75
Accepted
time: 1ms
memory: 3872kb

input:

2
1
2

output:

8
0 0
8
2
8
0 1
8
2
8
1 1
8
3 2

result:

ok 

Test #44:

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

input:

2
1
1

output:

8
0 1
8
2
8
0 0
8
2
8
3 1

result:

ok 

Test #45:

score: 75
Accepted
time: 0ms
memory: 4108kb

input:

3
1
1
2

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
1 2
8
3 1

result:

ok 

Test #46:

score: 75
Accepted
time: 1ms
memory: 3892kb

input:

6
1
1
2
2
2
2
2
2
2
2

output:

8
0 3
8
2
8
0 2
8
2
8
0 4
8
2
8
1 4
8
0 1
8
2
8
1 1
8
0 0
8
2
8
1 0
8
0 5
8
2
8
1 5
8
1 2
8
0 4
8
2
8
1 4
8
0 1
8
2
8
1 1
8
0 0
8
2
8
1 0
8
0 5
8
2
8
1 5
8
3 1

result:

ok 

Test #47:

score: 75
Accepted
time: 1ms
memory: 3888kb

input:

10
1
1
2
2
2
2
2
2
2
2
2
2
1
1
2
1
1
1

output:

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

result:

ok 

Test #48:

score: 75
Accepted
time: 3ms
memory: 4140kb

input:

2000
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1168
8
2
8
0 1461
8
2
8
1 1461
8
0 826
8
2
8
1 826
8
0 1562
8
2
8
1 1562
8
0 1080
8
2
8
1 1080
8
0 1857
8
2
8
1 1857
8
0 1005
8
2
8
1 1005
8
0 1907
8
2
8
1 1907
8
0 1292
8
2
8
1 1292
8
0 341
8
2
8
1 341
8
0 507
8
2
8
1 507
8
0 1348
8
2
8
1 1348
8
0 1322
8
2
8
1 1322
8
0 303
8
2
8
1 303
8
0 136
8...

result:

ok 

Test #49:

score: 75
Accepted
time: 13ms
memory: 3852kb

input:

2000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

8
0 1020
8
2
8
0 1837
8
2
8
0 410
8
2
8
0 1977
8
2
8
0 1717
8
2
8
0 1005
8
2
8
0 1128
8
2
8
0 1172
8
2
8
0 1820
8
2
8
0 1039
8
2
8
0 535
8
2
8
0 1363
8
2
8
0 315
8
2
8
0 1117
8
2
8
0 624
8
2
8
0 1369
8
2
8
0 1403
8
2
8
0 165
8
2
8
0 614
8
2
8
0 248
8
2
8
0 1007
8
2
8
0 334
8
2
8
0 1091
8
2
8
0 876
8...

result:

ok 

Test #50:

score: 50.57
Acceptable Answer
time: 26ms
memory: 3884kb

input:

2000
1
1
1
1
1
1
1
1
1
1
2
2
2
1
1
1
1
2
2
1
1
2
1
1
2
1
1
1
1
2
1
1
1
1
2
2
2
2
2
1
1
2
1
1
1
2
1
2
1
2
2
2
2
2
1
2
2
1
2
2
2
1
1
2
2
2
2
2
2
2
1
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2...

output:

8
0 1512
8
2
8
0 750
8
2
8
0 897
8
2
8
0 629
8
2
8
0 835
8
2
8
0 548
8
2
8
0 1803
8
2
8
0 1227
8
2
8
0 604
8
2
8
0 504
8
2
8
0 982
8
2
8
1 982
8
0 568
8
2
8
1 568
8
0 1044
8
2
8
1 1044
8
0 275
8
2
8
0 1807
8
2
8
0 648
8
2
8
0 1144
8
2
8
0 963
8
2
8
1 963
8
0 512
8
2
8
1 512
8
0 442
8
2
8
0 1967
8
2
...

result:

points 0.67426666670 points  0.67426666670

Test #51:

score: 50.41
Acceptable Answer
time: 23ms
memory: 3944kb

input:

2000
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
1
1
2
2
1
2
1
1
1
1
2
1
1
2
2
1
2
2
2
1
2
1
2
1
1
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
1
1
1
2
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
1
2
1
2
2
2
2
1
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
1...

output:

8
0 175
8
2
8
0 550
8
2
8
0 160
8
2
8
0 456
8
2
8
0 1637
8
2
8
0 570
8
2
8
0 822
8
2
8
0 59
8
2
8
0 1651
8
2
8
0 1948
8
2
8
0 359
8
2
8
0 497
8
2
8
0 1679
8
2
8
1 1679
8
0 1790
8
2
8
1 1790
8
0 1874
8
2
8
0 447
8
2
8
0 1660
8
2
8
0 1282
8
2
8
1 1282
8
0 939
8
2
8
1 939
8
0 1433
8
2
8
0 316
8
2
8
1 3...

result:

points 0.67213333330 points  0.67213333330

Test #52:

score: 75
Accepted
time: 0ms
memory: 3952kb

input:

2000
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1541
8
2
8
0 1887
8
2
8
1 1887
8
0 1695
8
2
8
1 1695
8
0 1940
8
2
8
1 1940
8
0 1771
8
2
8
1 1771
8
0 592
8
2
8
1 592
8
0 1932
8
2
8
1 1932
8
0 1305
8
2
8
1 1305
8
0 15
8
2
8
1 15
8
0 37
8
2
8
1 37
8
0 1648
8
2
8
1 1648
8
0 856
8
2
8
1 856
8
0 262
8
2
8
1 262
8
0 1688
8
2
8
1 1688
8
0 1690
8
2
8
...

result:

ok 

Test #53:

score: 60.83
Acceptable Answer
time: 16ms
memory: 3992kb

input:

2000
1
1
2
2
2
1
2
2
2
2
1
1
1
1
2
2
1
1
1
2
2
1
1
2
2
1
1
1
1
1
1
2
2
1
2
2
2
1
2
1
2
2
1
1
2
1
1
2
2
2
1
1
2
1
1
2
1
2
1
1
2
1
1
2
1
2
1
2
2
1
1
1
1
1
2
2
1
1
2
2
1
1
2
2
2
1
1
2
1
2
1
2
2
2
2
1
2
2
2
2
1
1
2
2
2
2
2
1
2
2
1
2
1
2
1
2
1
2
2
1
2
2
2
2
2
2
1
2
1
2
2
1
2
1
2
1
1
2
2
1
2
2
2
1
1
1
1
2...

output:

8
0 655
8
2
8
0 262
8
2
8
0 1647
8
2
8
1 1647
8
0 1753
8
2
8
1 1753
8
0 749
8
2
8
1 749
8
0 1729
8
2
8
0 730
8
2
8
1 730
8
0 19
8
2
8
1 19
8
0 10
8
2
8
1 10
8
0 1179
8
2
8
1 1179
8
0 1969
8
2
8
0 183
8
2
8
0 1392
8
2
8
0 1712
8
2
8
0 725
8
2
8
1 725
8
0 442
8
2
8
1 442
8
0 638
8
2
8
0 711
8
2
8
0 11...

result:

points 0.81106666670 points  0.81106666670

Test #54:

score: 73.98
Acceptable Answer
time: 14ms
memory: 4124kb

input:

2000
1
2
1
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 750
8
2
8
0 70
8
2
8
1 70
8
0 1942
8
2
8
0 1377
8
2
8
0 378
8
2
8
1 378
8
0 329
8
2
8
0 858
8
2
8
1 858
8
0 310
8
2
8
1 310
8
0 886
8
2
8
1 886
8
0 1619
8
2
8
1 1619
8
0 1815
8
2
8
1 1815
8
0 1161
8
2
8
1 1161
8
0 1363
8
2
8
1 1363
8
0 1142
8
2
8
1 1142
8
0 204
8
2
8
1 204
8
0 1912
8
2
8
1 1912
...

result:

points 0.98640 points  0.98640

Test #55:

score: 50.68
Acceptable Answer
time: 25ms
memory: 3936kb

input:

2000
1
1
1
1
1
1
1
2
1
1
1
1
1
2
1
1
1
1
2
2
1
1
2
2
2
2
2
1
1
1
1
2
1
1
1
1
1
2
2
2
2
2
2
2
2
2
1
2
2
2
1
2
1
1
1
2
2
1
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1407
8
2
8
0 624
8
2
8
0 1607
8
2
8
0 1231
8
2
8
0 578
8
2
8
0 293
8
2
8
0 109
8
2
8
0 1821
8
2
8
1 1821
8
0 782
8
2
8
0 591
8
2
8
0 1853
8
2
8
0 1730
8
2
8
0 319
8
2
8
0 136
8
2
8
1 136
8
0 1113
8
2
8
0 1606
8
2
8
0 61
8
2
8
0 1523
8
2
8
0 1929
8
2
8
1 1929
8
0 98
8
2
8
1 98
8
0 847
8
2
8
0 822...

result:

points 0.67573333330 points  0.67573333330

Test #56:

score: 73.28
Acceptable Answer
time: 4ms
memory: 3880kb

input:

1998
1
2
1
1
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1385
8
2
8
0 1420
8
2
8
1 1420
8
0 965
8
2
8
0 525
8
2
8
0 1251
8
2
8
1 1251
8
0 1845
8
2
8
0 1308
8
2
8
1 1308
8
0 1523
8
2
8
1 1523
8
0 1000
8
2
8
1 1000
8
0 1842
8
2
8
1 1842
8
0 1011
8
2
8
1 1011
8
0 1192
8
2
8
0 570
8
2
8
1 570
8
0 1712
8
2
8
1 1712
8
0 345
8
2
8
1 345
8
0 1329
8
2
8
1 1329...

result:

points 0.97706666670 points  0.97706666670

Test #57:

score: 70.39
Acceptable Answer
time: 11ms
memory: 3932kb

input:

1999
1
1
2
1
1
1
2
2
2
1
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1707
8
2
8
0 1952
8
2
8
0 4
8
2
8
1 4
8
0 1700
8
2
8
0 413
8
2
8
0 1042
8
2
8
0 1045
8
2
8
1 1045
8
0 1144
8
2
8
1 1144
8
0 386
8
2
8
1 386
8
0 1529
8
2
8
0 264
8
2
8
0 192
8
2
8
1 192
8
0 1944
8
2
8
0 1950
8
2
8
1 1950
8
0 1964
8
2
8
1 1964
8
0 350
8
2
8
1 350
8
0 1094
8
2
8
1 1094
8
0 564
8
2
...

result:

points 0.93853333330 points  0.93853333330

Test #58:

score: 68.15
Acceptable Answer
time: 8ms
memory: 3940kb

input:

1997
1
1
2
1
1
1
1
1
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 521
8
2
8
0 461
8
2
8
0 1736
8
2
8
1 1736
8
0 1021
8
2
8
0 1199
8
2
8
0 11
8
2
8
0 1647
8
2
8
0 1270
8
2
8
0 1681
8
2
8
1 1681
8
0 1111
8
2
8
0 195
8
2
8
1 195
8
0 440
8
2
8
1 440
8
0 1098
8
2
8
1 1098
8
0 1478
8
2
8
1 1478
8
0 1066
8
2
8
1 1066
8
0 1554
8
2
8
1 1554
8
0 62
8
2
8
1 62
8
0 1786
8...

result:

points 0.90866666670 points  0.90866666670

Test #59:

score: 66.66
Acceptable Answer
time: 12ms
memory: 4176kb

input:

1998
1
1
2
1
2
2
1
1
1
1
1
2
2
1
2
2
1
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1953
8
2
8
0 216
8
2
8
0 1190
8
2
8
1 1190
8
0 1272
8
2
8
0 608
8
2
8
1 608
8
0 822
8
2
8
1 822
8
0 894
8
2
8
0 771
8
2
8
0 513
8
2
8
0 496
8
2
8
0 995
8
2
8
0 1857
8
2
8
1 1857
8
0 345
8
2
8
1 345
8
0 1521
8
2
8
0 841
8
2
8
1 841
8
0 16
8
2
8
1 16
8
0 1210
8
2
8
0 1351
8
2
8
1 1351
8
0 1906
8
2...

result:

points 0.88880 points  0.88880

Test #60:

score: 64.97
Acceptable Answer
time: 5ms
memory: 3880kb

input:

1996
1
1
2
1
2
1
1
1
2
2
2
1
2
1
1
1
2
2
1
2
2
1
2
2
2
2
1
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1013
8
2
8
0 1513
8
2
8
0 1676
8
2
8
1 1676
8
0 500
8
2
8
0 669
8
2
8
1 669
8
0 882
8
2
8
0 1860
8
2
8
0 733
8
2
8
0 1440
8
2
8
1 1440
8
0 609
8
2
8
1 609
8
0 1669
8
2
8
1 1669
8
0 1886
8
2
8
0 930
8
2
8
1 930
8
0 1298
8
2
8
0 872
8
2
8
0 364
8
2
8
0 1674
8
2
8
1 1674
8
0 1224
8
2
8
1 1224
8
0 6...

result:

points 0.86626666670 points  0.86626666670

Test #61:

score: 61.8
Acceptable Answer
time: 30ms
memory: 3836kb

input:

2000
1
1
2
1
1
1
2
2
2
1
1
1
2
1
1
1
1
2
2
2
2
2
2
1
2
1
2
2
2
2
1
1
2
2
2
1
2
2
2
1
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1543
8
2
8
0 1961
8
2
8
0 1286
8
2
8
1 1286
8
0 1587
8
2
8
0 719
8
2
8
0 1222
8
2
8
0 83
8
2
8
1 83
8
0 1650
8
2
8
1 1650
8
0 1952
8
2
8
1 1952
8
0 958
8
2
8
0 415
8
2
8
0 1474
8
2
8
0 960
8
2
8
1 960
8
0 1733
8
2
8
0 431
8
2
8
0 142
8
2
8
0 1031
8
2
8
0 456
8
2
8
1 456
8
0 1563
8
2
8
1 1563
8
0...

result:

points 0.8240 points  0.8240

Test #62:

score: 49.05
Acceptable Answer
time: 14ms
memory: 3876kb

input:

1998
1
1
1
1
1
1
1
1
1
1
2
1
1
1
2
1
1
1
1
1
2
1
2
1
2
2
2
1
1
2
1
2
2
1
2
2
2
1
2
1
1
1
2
2
1
2
2
2
2
2
2
2
2
1
2
2
2
1
2
2
1
2
2
2
2
2
1
2
2
1
2
1
2
2
2
1
2
2
2
2
2
2
1
2
2
2
2
1
1
2
2
2
1
2
1
1
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 39
8
2
8
0 529
8
2
8
0 809
8
2
8
0 1316
8
2
8
0 1507
8
2
8
0 1505
8
2
8
0 1828
8
2
8
0 913
8
2
8
0 569
8
2
8
0 1543
8
2
8
0 1204
8
2
8
1 1204
8
0 1220
8
2
8
0 1475
8
2
8
0 1616
8
2
8
0 1317
8
2
8
1 1317
8
0 1163
8
2
8
0 481
8
2
8
0 670
8
2
8
0 752
8
2
8
0 1068
8
2
8
0 915
8
2
8
1 915
8
0 369
8
2...

result:

points 0.6540 points  0.6540

Test #63:

score: 41.26
Acceptable Answer
time: 19ms
memory: 4144kb

input:

2000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
2
2
2
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
1
1
1
2
2
1
2
2
2
1
1
1
1
2
1
1
2
1
1
1
1
2
1
2
1
1
1
2
1
2
2
2
1
1
1
1
2
2
2
2
2
2
2
2
1
2
2
1
1
2
2
2
2
2
1
1
2
2
2
1
2
1
1
2
2
1
1
2
2
2
1
2
2
2
2
2
2
2
2
1
1
2
2
2
2
2
2
2
2
1
1
2
2
2
1
2
2
2
2
2
2
2
2
2...

output:

8
0 897
8
2
8
0 100
8
2
8
0 1597
8
2
8
0 747
8
2
8
0 420
8
2
8
0 279
8
2
8
0 1734
8
2
8
0 1479
8
2
8
0 1422
8
2
8
0 635
8
2
8
0 1381
8
2
8
0 169
8
2
8
0 464
8
2
8
0 558
8
2
8
0 1398
8
2
8
0 857
8
2
8
0 1466
8
2
8
0 1528
8
2
8
1 1528
8
0 1382
8
2
8
0 77
8
2
8
1 77
8
0 511
8
2
8
1 511
8
0 578
8
2
8
1 ...

result:

points 0.55013333330 points  0.55013333330

Test #64:

score: 46.13
Acceptable Answer
time: 21ms
memory: 4024kb

input:

1995
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
2
1
1
2
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
2
1
1
2
1
1
1
1
1
2
2
1
1
1
1
1
2
1
1
1
2
1
1
1
2
2
2
1
2
2
2
1
1
1
1
2
1
2
2
2
1
1
1
2
1
1
2
1
2
2
1
2
1
2
2
1
1
2
2
1
1
2
1
1
1
1
2
2
1
1
1
1
1
2
2
2
1
2
1
1
1...

output:

8
0 113
8
2
8
0 384
8
2
8
0 1823
8
2
8
0 1119
8
2
8
0 1
8
2
8
0 175
8
2
8
0 1477
8
2
8
0 939
8
2
8
0 1405
8
2
8
0 454
8
2
8
0 1660
8
2
8
0 767
8
2
8
0 1898
8
2
8
0 4
8
2
8
0 754
8
2
8
0 1573
8
2
8
0 1677
8
2
8
0 101
8
2
8
0 1788
8
2
8
0 512
8
2
8
0 1268
8
2
8
1 1268
8
0 381
8
2
8
0 1375
8
2
8
0 1954...

result:

points 0.61506666670 points  0.61506666670

Test #65:

score: 75
Accepted
time: 5ms
memory: 4176kb

input:

1999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
2
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
2
2
1
2
1
1
1
2
2
2
2
1
1
2
1
1
1
1
1
1
1
1
1
1
1
2
2
1
1
1
1
1
2
1
1
1
1
2
1
1
2
2
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
1
1...

output:

8
0 1536
8
2
8
0 377
8
2
8
0 69
8
2
8
0 580
8
2
8
0 727
8
2
8
0 922
8
2
8
0 628
8
2
8
0 1583
8
2
8
0 545
8
2
8
0 1714
8
2
8
0 589
8
2
8
0 1252
8
2
8
0 1545
8
2
8
0 307
8
2
8
0 1044
8
2
8
0 1322
8
2
8
0 251
8
2
8
0 1240
8
2
8
0 1509
8
2
8
0 714
8
2
8
0 1940
8
2
8
0 35
8
2
8
0 1496
8
2
8
0 493
8
2
8
0...

result:

ok 

Test #66:

score: 75
Accepted
time: 8ms
memory: 4168kb

input:

1998
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1...

output:

8
0 685
8
2
8
0 862
8
2
8
0 473
8
2
8
0 455
8
2
8
0 1200
8
2
8
0 1607
8
2
8
0 1394
8
2
8
0 186
8
2
8
0 1301
8
2
8
0 1950
8
2
8
0 846
8
2
8
0 854
8
2
8
0 591
8
2
8
0 243
8
2
8
0 1837
8
2
8
0 1613
8
2
8
0 62
8
2
8
0 157
8
2
8
0 1647
8
2
8
0 342
8
2
8
0 1392
8
2
8
0 43
8
2
8
0 1678
8
2
8
0 948
8
2
8
0 ...

result:

ok 

Test #67:

score: 75
Accepted
time: 0ms
memory: 3852kb

input:

1999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
2
1
1
1...

output:

8
0 111
8
2
8
0 1990
8
2
8
0 465
8
2
8
0 613
8
2
8
0 1089
8
2
8
0 1888
8
2
8
0 233
8
2
8
0 979
8
2
8
0 1896
8
2
8
0 1140
8
2
8
0 551
8
2
8
0 620
8
2
8
0 961
8
2
8
0 1502
8
2
8
0 1743
8
2
8
0 1061
8
2
8
0 55
8
2
8
0 224
8
2
8
0 1107
8
2
8
0 1440
8
2
8
0 1936
8
2
8
0 1138
8
2
8
0 1526
8
2
8
0 1884
8
2...

result:

ok 

Test #68:

score: 46.95
Acceptable Answer
time: 23ms
memory: 3948kb

input:

1979
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
2
1
2
1
2
2
1
1
2
1
1
2
2
2
1
1
2
1
2
1
1
1
1
2
1
1
1
1
1
1
2
1
2
2
1
2
2
2
2
1
2
1
2
2
1
2
2
2
2
1
2
1
1
1
2
2
2
2
2
1
1
1
2
2
2
2
2
1
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1892
8
2
8
0 663
8
2
8
0 584
8
2
8
0 195
8
2
8
0 745
8
2
8
0 1566
8
2
8
0 282
8
2
8
0 616
8
2
8
0 1246
8
2
8
0 1690
8
2
8
0 1033
8
2
8
0 1071
8
2
8
0 840
8
2
8
1 840
8
0 1129
8
2
8
0 404
8
2
8
0 246
8
2
8
0 1488
8
2
8
0 1863
8
2
8
0 1080
8
2
8
1 1080
8
0 685
8
2
8
0 249
8
2
8
1 249
8
0 1082
8
2
...

result:

points 0.6260 points  0.6260

Test #69:

score: 46.95
Acceptable Answer
time: 12ms
memory: 3924kb

input:

1979
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
2
2
1
1
1
1
1
1
2
2
1
2
1
1
2
1
2
1
1
1
1
2
2
2
2
2
1
2
1
2
2
2
1
1
2
2
1
2
2
2
2
1
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
1
1
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2...

output:

8
0 1726
8
2
8
0 1044
8
2
8
0 1073
8
2
8
0 496
8
2
8
0 1375
8
2
8
0 920
8
2
8
0 951
8
2
8
0 261
8
2
8
0 226
8
2
8
0 990
8
2
8
0 571
8
2
8
0 418
8
2
8
0 1174
8
2
8
0 1079
8
2
8
0 1197
8
2
8
1 1197
8
0 1489
8
2
8
0 676
8
2
8
0 1719
8
2
8
0 1359
8
2
8
0 414
8
2
8
0 986
8
2
8
0 1584
8
2
8
0 1782
8
2
8
0...

result:

points 0.6260 points  0.6260

Test #70:

score: 58
Acceptable Answer
time: 16ms
memory: 3884kb

input:

1979
1
1
1
1
1
1
1
1
1
2
2
1
1
1
2
1
1
2
2
2
2
1
2
1
1
2
2
2
1
2
2
2
2
2
2
1
2
2
1
2
2
2
1
2
2
1
2
2
2
2
1
2
2
2
2
2
2
1
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1148
8
2
8
0 330
8
2
8
0 1230
8
2
8
0 614
8
2
8
0 1924
8
2
8
0 231
8
2
8
0 828
8
2
8
0 729
8
2
8
0 435
8
2
8
0 585
8
2
8
1 585
8
0 1143
8
2
8
1 1143
8
0 140
8
2
8
0 129
8
2
8
0 820
8
2
8
0 1113
8
2
8
1 1113
8
0 641
8
2
8
0 424
8
2
8
0 952
8
2
8
1 952
8
0 216
8
2
8
1 216
8
0 1642
8
2
8
1 1642
8
0...

result:

points 0.77333333330 points  0.77333333330

Test #71:

score: 58
Acceptable Answer
time: 4ms
memory: 4164kb

input:

1979
1
1
1
2
1
1
1
1
1
1
2
1
1
2
1
1
1
2
1
2
1
1
1
2
2
1
1
2
1
2
2
1
1
2
1
2
2
1
2
2
1
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1381
8
2
8
0 239
8
2
8
0 861
8
2
8
0 1903
8
2
8
1 1903
8
0 1571
8
2
8
0 1978
8
2
8
0 1385
8
2
8
0 1419
8
2
8
0 1096
8
2
8
0 1780
8
2
8
0 504
8
2
8
1 504
8
0 468
8
2
8
0 1447
8
2
8
0 1613
8
2
8
1 1613
8
0 270
8
2
8
0 712
8
2
8
0 238
8
2
8
0 1831
8
2
8
1 1831
8
0 54
8
2
8
0 326
8
2
8
1 326
8
0 137...

result:

points 0.77333333330 points  0.77333333330

Test #72:

score: 46.95
Acceptable Answer
time: 27ms
memory: 3872kb

input:

1981
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
2
1
2
1
1
1
2
1
1
1
2
1
2
2
1
2
1
2
1
1
2
2
2
2
2
2
1
1
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
1
1
2
1
2
1
2
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
1
2
2
1
2
2
2
2
1
2
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2...

output:

8
0 1607
8
2
8
0 532
8
2
8
0 232
8
2
8
0 1669
8
2
8
0 1709
8
2
8
0 981
8
2
8
0 1322
8
2
8
0 1867
8
2
8
0 622
8
2
8
0 1741
8
2
8
0 86
8
2
8
0 361
8
2
8
0 141
8
2
8
0 46
8
2
8
0 335
8
2
8
0 402
8
2
8
0 1304
8
2
8
0 870
8
2
8
0 1973
8
2
8
0 1962
8
2
8
0 616
8
2
8
0 1064
8
2
8
0 340
8
2
8
0 1348
8
2
8
0...

result:

points 0.6260 points  0.6260

Test #73:

score: 46.95
Acceptable Answer
time: 9ms
memory: 3912kb

input:

1981
1
1
1
1
1
1
1
1
1
1
1
1
2
1
2
2
1
2
1
2
1
1
1
1
2
1
1
1
1
2
2
2
1
2
1
2
1
1
2
1
2
1
2
2
1
2
1
1
1
1
1
2
2
1
1
2
1
2
2
1
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
1
2
2
2
2
2
1
1
2
2
2
2
1
2
1
2
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2...

output:

8
0 1135
8
2
8
0 1411
8
2
8
0 802
8
2
8
0 528
8
2
8
0 763
8
2
8
0 530
8
2
8
0 1888
8
2
8
0 1066
8
2
8
0 1041
8
2
8
0 1143
8
2
8
0 1114
8
2
8
0 944
8
2
8
0 1634
8
2
8
1 1634
8
0 185
8
2
8
0 253
8
2
8
1 253
8
0 572
8
2
8
1 572
8
0 1804
8
2
8
0 338
8
2
8
1 338
8
0 957
8
2
8
0 1493
8
2
8
1 1493
8
0 768
...

result:

points 0.6260 points  0.6260

Test #74:

score: 40.26
Acceptable Answer
time: 16ms
memory: 3840kb

input:

1989
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
2
1
1
2
1
1
1
1
1
1
1
1
1
1
2
2
1
1
1
1
1
2
2
1
2
2
2
2
2
1
2
2
1
1
1
2
2
1
2
2
2
2
2
1
1
1
2
1
1
1
1
2
1
1
1
1
1
1
1
2
2
2
1
2
2
1
1
2
2
2
2
2
2
1
2
2
2
1
2
1
1
1
1
2
2
2
1
1
2
2
2
1
2
1
1
2
1
1
2
1
2
1
2
1
1
1
2
2
2
1
2
2
2
2
2
2
1
1
2
2
2
1
2...

output:

8
0 626
8
2
8
0 1915
8
2
8
0 535
8
2
8
0 1482
8
2
8
0 518
8
2
8
0 764
8
2
8
0 975
8
2
8
0 1984
8
2
8
0 991
8
2
8
0 321
8
2
8
0 1189
8
2
8
0 1874
8
2
8
0 113
8
2
8
0 652
8
2
8
0 1232
8
2
8
1 1232
8
0 565
8
2
8
0 660
8
2
8
0 984
8
2
8
0 164
8
2
8
0 329
8
2
8
0 1952
8
2
8
0 1718
8
2
8
0 1326
8
2
8
0 50...

result:

points 0.53680 points  0.53680

Test #75:

score: 40.26
Acceptable Answer
time: 15ms
memory: 4160kb

input:

1989
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
1
1
1
1
1
1
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
2
1
1
1
1
1
1
2
1
1
1
1
2
1
1
1
1
2
1
2
1
1
1
1
1
2
1
1
1
2
2
1
1
2
1
2
2
2
2
1
1
1
2
2
2
2
1
2
1
2
2
2
2
1
1
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
1
2
1
1
1
2
2
2
2
2
2
2
1
2
1
2
2
1
1
2
2
1...

output:

8
0 64
8
2
8
0 1635
8
2
8
0 1915
8
2
8
0 1833
8
2
8
0 91
8
2
8
0 340
8
2
8
0 893
8
2
8
0 215
8
2
8
0 425
8
2
8
0 161
8
2
8
0 421
8
2
8
0 1018
8
2
8
0 1905
8
2
8
0 376
8
2
8
0 563
8
2
8
1 563
8
0 1616
8
2
8
1 1616
8
0 861
8
2
8
1 861
8
0 1301
8
2
8
0 139
8
2
8
0 190
8
2
8
0 712
8
2
8
0 212
8
2
8
0 15...

result:

points 0.53680 points  0.53680

Test #76:

score: 47.25
Acceptable Answer
time: 10ms
memory: 3936kb

input:

1970
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
2
1
1
1
2
1
2
2
1
1
1
2
2
2
1
2
1
2
2
2
2
2
1
1
1
1
2
1
1
1
1
2
1
1
1
2
1
2
2
2
2
2
2
2
2
2
1
2
2
1
2
1
1
2
2
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
1
2
2
2
2
2
1
2
1
2
1
2
1
2
2
2
2
2
2
1
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2...

output:

8
0 861
8
2
8
0 1104
8
2
8
0 453
8
2
8
0 1279
8
2
8
0 1841
8
2
8
0 989
8
2
8
0 1374
8
2
8
1 1374
8
0 1489
8
2
8
0 1097
8
2
8
0 365
8
2
8
0 1470
8
2
8
0 801
8
2
8
0 851
8
2
8
0 415
8
2
8
0 443
8
2
8
0 8
8
2
8
0 1013
8
2
8
1 1013
8
0 946
8
2
8
0 1297
8
2
8
0 1880
8
2
8
0 416
8
2
8
1 416
8
0 1430
8
2
8...

result:

points 0.630 points  0.630

Test #77:

score: 47.26
Acceptable Answer
time: 17ms
memory: 3848kb

input:

1970
1
1
1
1
1
1
2
1
1
1
1
2
1
2
2
1
1
1
1
2
2
1
1
2
1
1
1
1
1
2
2
1
1
1
1
2
1
2
1
1
1
1
1
1
2
2
1
2
2
2
2
1
1
2
1
1
2
1
2
2
1
2
1
1
2
2
2
2
2
2
1
1
1
2
2
1
1
1
2
2
2
1
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
1
2
1
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1...

output:

8
0 1367
8
2
8
0 27
8
2
8
0 106
8
2
8
0 1168
8
2
8
0 1546
8
2
8
0 458
8
2
8
0 1955
8
2
8
1 1955
8
0 836
8
2
8
0 845
8
2
8
0 1852
8
2
8
0 1745
8
2
8
0 966
8
2
8
1 966
8
0 1750
8
2
8
0 643
8
2
8
1 643
8
0 833
8
2
8
1 833
8
0 705
8
2
8
0 1694
8
2
8
0 391
8
2
8
0 1284
8
2
8
0 267
8
2
8
1 267
8
0 431
8
2...

result:

points 0.63013333330 points  0.63013333330

Test #78:

score: 46.95
Acceptable Answer
time: 16ms
memory: 4172kb

input:

1980
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
2
1
1
2
1
2
2
2
1
1
2
2
1
1
2
2
1
2
1
2
2
1
2
2
1
2
1
2
1
2
1
2
1
1
2
2
2
1
2
1
2
2
1
1
2
1
2
1
2
2
2
2
2
1
2
2
1
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
1
2
1
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2...

output:

8
0 428
8
2
8
0 941
8
2
8
0 1156
8
2
8
0 1160
8
2
8
0 1646
8
2
8
0 1390
8
2
8
0 78
8
2
8
0 390
8
2
8
0 1440
8
2
8
0 1530
8
2
8
0 1194
8
2
8
0 1063
8
2
8
0 23
8
2
8
0 1880
8
2
8
0 1007
8
2
8
0 970
8
2
8
0 72
8
2
8
0 60
8
2
8
1 60
8
0 1335
8
2
8
0 705
8
2
8
1 705
8
0 17
8
2
8
0 1402
8
2
8
0 1020
8
2
8...

result:

points 0.6260 points  0.6260

Test #79:

score: 46.96
Acceptable Answer
time: 28ms
memory: 3956kb

input:

1980
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
2
1
2
1
1
1
1
1
2
1
1
1
2
1
2
2
1
2
2
1
1
2
1
1
2
2
2
1
1
1
2
1
1
1
2
1
1
1
2
2
2
1
2
2
1
2
1
2
2
2
2
2
2
2
1
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
1
1
1
2
2
2
2
1
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
1
2
1
2
2
1
1
2
2
2
2
2
2
1
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2...

output:

8
0 309
8
2
8
0 274
8
2
8
0 1276
8
2
8
0 1442
8
2
8
0 1307
8
2
8
0 988
8
2
8
0 1425
8
2
8
1 1425
8
0 602
8
2
8
0 718
8
2
8
0 759
8
2
8
0 100
8
2
8
0 1798
8
2
8
0 1913
8
2
8
0 1152
8
2
8
0 916
8
2
8
1 916
8
0 1898
8
2
8
1 1898
8
0 549
8
2
8
0 559
8
2
8
1 559
8
0 1942
8
2
8
0 820
8
2
8
0 1682
8
2
8
0 ...

result:

points 0.62613333330 points  0.62613333330

Test #80:

score: 40.2
Acceptable Answer
time: 19ms
memory: 3828kb

input:

2000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
2
1
1
1
1
1
2
1
1
1
2
1
1
2
1
1
1
1
2
2
1
2
2
2
2
1
1
1
1
2
1
1
1
2
2
1
1
1
1
2
1
1
1
1
1
2
1
1
2
1
2
1
1
2
1
1
1
1
2
1
2
1
1
2
1
2
2
2
1
2
2
2
1
2
1
1
2
2
2
1
1
2
1
2
2
2
1
2
1
2
2
1
2
1
1
2
1
2
1
2
1
2
2
2
1
2
2
2
2
2
1
2
1
2
2
2
2
2
2
1
2
1
2
2
2
1...

output:

8
0 1786
8
2
8
0 1553
8
2
8
0 1934
8
2
8
0 270
8
2
8
0 1788
8
2
8
0 238
8
2
8
0 210
8
2
8
0 1844
8
2
8
0 1300
8
2
8
0 1247
8
2
8
0 749
8
2
8
0 362
8
2
8
0 1090
8
2
8
0 1990
8
2
8
0 1609
8
2
8
0 1779
8
2
8
0 80
8
2
8
0 1806
8
2
8
0 596
8
2
8
1 596
8
0 1198
8
2
8
0 1234
8
2
8
0 1108
8
2
8
0 1436
8
2
8...

result:

points 0.5360 points  0.5360

Test #81:

score: 40.19
Acceptable Answer
time: 20ms
memory: 4164kb

input:

2000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
1
2
1
2
1
2
2
1
2
2
1
1
2
1
1
1
2
1
2
1
1
1
1
1
2
1
2
1
2
1
1
1
1
2
1
2
1
1
1
1
1
1
1
1
1
2
1
2
1
1
2
2
1
1
1
2
1
1
1
2
1
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
1
1
1
2
1
2
2
1
2
1
1
2
2
2
2
2
2
2
2
1
1
2
2
2
2
1
2
2
2
2
1
1
2
2
2
2
1
2
2
2
2
2
2
2
2...

output:

8
0 1062
8
2
8
0 416
8
2
8
0 1207
8
2
8
0 276
8
2
8
0 168
8
2
8
0 10
8
2
8
0 1330
8
2
8
0 1181
8
2
8
0 1927
8
2
8
0 1613
8
2
8
0 1434
8
2
8
0 905
8
2
8
0 204
8
2
8
0 747
8
2
8
0 202
8
2
8
0 206
8
2
8
0 90
8
2
8
0 1903
8
2
8
0 227
8
2
8
0 1478
8
2
8
0 859
8
2
8
0 941
8
2
8
0 477
8
2
8
1 477
8
0 1946
...

result:

points 0.53586666670 points  0.53586666670

Test #82:

score: 47.09
Acceptable Answer
time: 10ms
memory: 3876kb

input:

2000
1
1
1
1
1
1
1
2
1
1
2
1
1
1
1
2
1
2
1
2
2
1
1
1
2
2
2
1
1
2
1
1
2
1
1
1
1
1
2
2
1
1
2
2
2
2
1
1
2
2
2
2
2
2
2
1
2
1
2
2
2
1
2
2
1
2
1
2
2
2
1
2
2
1
2
1
2
1
2
1
1
2
1
2
2
1
2
2
2
2
1
1
2
2
2
2
1
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1085
8
2
8
0 1965
8
2
8
0 1071
8
2
8
0 1172
8
2
8
0 785
8
2
8
0 19
8
2
8
0 1340
8
2
8
0 828
8
2
8
1 828
8
0 1263
8
2
8
0 261
8
2
8
0 1917
8
2
8
1 1917
8
0 374
8
2
8
0 1504
8
2
8
0 1484
8
2
8
0 680
8
2
8
0 128
8
2
8
1 128
8
0 390
8
2
8
0 713
8
2
8
1 713
8
0 756
8
2
8
0 839
8
2
8
1 839
8
0 651
8
2...

result:

points 0.62786666670 points  0.62786666670

Test #83:

score: 47.09
Acceptable Answer
time: 10ms
memory: 3908kb

input:

2000
1
1
1
1
1
1
1
1
1
2
1
2
1
1
1
1
2
1
1
1
1
2
1
1
1
1
2
1
2
1
1
1
2
2
1
1
1
2
1
1
1
1
2
2
1
2
1
2
1
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
1
1
2
2
2
2
1
2
1
2
1
1
2
2
1
1
1
2
1
2
2
2
1
2
1
1
2
2
1
1
1
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 858
8
2
8
0 757
8
2
8
0 1515
8
2
8
0 1587
8
2
8
0 616
8
2
8
0 1493
8
2
8
0 74
8
2
8
0 1136
8
2
8
0 778
8
2
8
0 964
8
2
8
1 964
8
0 1530
8
2
8
0 312
8
2
8
1 312
8
0 1165
8
2
8
0 673
8
2
8
0 55
8
2
8
0 1701
8
2
8
0 181
8
2
8
1 181
8
0 1375
8
2
8
0 6
8
2
8
0 955
8
2
8
0 402
8
2
8
0 1527
8
2
8
1 152...

result:

points 0.62786666670 points  0.62786666670

Test #84:

score: 74.33
Acceptable Answer
time: 5ms
memory: 3836kb

input:

540
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 346
8
2
8
0 108
8
2
8
1 108
8
0 280
8
2
8
1 280
8
0 176
8
2
8
1 176
8
0 92
8
2
8
0 366
8
2
8
1 366
8
0 232
8
2
8
1 232
8
0 166
8
2
8
1 166
8
0 390
8
2
8
1 390
8
0 84
8
2
8
1 84
8
0 29
8
2
8
1 29
8
0 342
8
2
8
1 342
8
0 124
8
2
8
1 124
8
0 271
8
2
8
1 271
8
0 31
8
2
8
1 31
8
0 56
8
2
8
1 56
8
0 1...

result:

points 0.99106666670 points  0.99106666670

Test #85:

score: 74.28
Acceptable Answer
time: 7ms
memory: 4136kb

input:

1834
1
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1332
8
2
8
0 328
8
2
8
0 1580
8
2
8
1 1580
8
0 505
8
2
8
0 674
8
2
8
1 674
8
0 743
8
2
8
1 743
8
0 1436
8
2
8
1 1436
8
0 628
8
2
8
1 628
8
0 310
8
2
8
1 310
8
0 1666
8
2
8
1 1666
8
0 523
8
2
8
1 523
8
0 1493
8
2
8
1 1493
8
0 1450
8
2
8
1 1450
8
0 846
8
2
8
1 846
8
0 77
8
2
8
1 77
8
0 1605
8
2
8
...

result:

points 0.99040 points  0.99040

Test #86:

score: 75
Accepted
time: 16ms
memory: 3868kb

input:

2000
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 644
8
2
8
0 1919
8
2
8
0 905
8
2
8
1 905
8
0 637
8
2
8
1 637
8
0 1287
8
2
8
1 1287
8
0 1883
8
2
8
1 1883
8
0 667
8
2
8
1 667
8
0 1227
8
2
8
1 1227
8
0 487
8
2
8
1 487
8
0 1503
8
2
8
1 1503
8
0 1272
8
2
8
1 1272
8
0 1054
8
2
8
1 1054
8
0 984
8
2
8
1 984
8
0 1628
8
2
8
1 1628
8
0 1668
8
2
8
1 1668...

result:

ok 

Test #87:

score: 60.83
Acceptable Answer
time: 14ms
memory: 4080kb

input:

2000
1
1
2
1
2
1
1
1
1
1
2
2
2
1
2
2
2
1
2
1
2
2
1
1
2
1
2
2
2
1
2
2
1
1
2
2
1
1
2
1
2
2
1
2
2
2
2
1
2
1
2
2
1
1
1
2
2
2
1
1
1
2
1
1
1
1
2
1
1
1
1
1
2
2
1
2
1
2
2
1
1
1
2
2
1
2
2
2
1
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
1
1
2
1
2
2
1
1
1
2
2
2
2
1
2
2
1
2
1
2
1
1
2
1
2
2
1
1
1
2
2
1
2
1
1
1
1
2
2
1
2...

output:

8
0 637
8
2
8
0 1611
8
2
8
0 247
8
2
8
1 247
8
0 1305
8
2
8
0 423
8
2
8
1 423
8
0 1225
8
2
8
0 1523
8
2
8
0 1855
8
2
8
0 1008
8
2
8
0 1240
8
2
8
0 278
8
2
8
1 278
8
0 981
8
2
8
1 981
8
0 236
8
2
8
1 236
8
0 1920
8
2
8
0 58
8
2
8
1 58
8
0 876
8
2
8
1 876
8
0 841
8
2
8
1 841
8
0 1596
8
2
8
0 279
8
2
8...

result:

points 0.81106666670 points  0.81106666670

Test #88:

score: 60.83
Acceptable Answer
time: 12ms
memory: 4072kb

input:

2000
1
1
2
2
1
2
2
2
1
1
2
2
2
2
2
1
1
2
1
2
2
1
2
2
2
1
2
2
1
2
1
2
2
2
1
1
1
1
1
2
2
1
1
1
1
2
2
2
1
2
1
1
2
2
1
2
1
2
2
1
1
2
1
1
1
2
1
1
2
2
1
2
1
1
1
2
2
1
1
1
1
1
1
2
2
2
2
2
1
1
2
2
1
1
1
1
1
2
2
2
1
1
1
2
2
2
1
2
1
2
1
2
1
2
2
2
2
1
1
2
2
1
2
1
1
1
1
2
1
1
1
1
1
1
2
2
2
2
1
2
2
1
1
2
1
2
1
1...

output:

8
0 201
8
2
8
0 1551
8
2
8
0 1476
8
2
8
1 1476
8
0 1157
8
2
8
1 1157
8
0 725
8
2
8
0 1664
8
2
8
1 1664
8
0 1799
8
2
8
1 1799
8
0 1430
8
2
8
1 1430
8
0 25
8
2
8
0 899
8
2
8
0 1119
8
2
8
1 1119
8
0 1313
8
2
8
1 1313
8
0 1165
8
2
8
1 1165
8
0 1298
8
2
8
1 1298
8
0 1520
8
2
8
1 1520
8
0 312
8
2
8
0 663
...

result:

points 0.81106666670 points  0.81106666670

Test #89:

score: 60.83
Acceptable Answer
time: 10ms
memory: 3992kb

input:

2000
1
2
2
1
2
2
2
2
1
2
2
1
2
1
1
1
2
1
2
1
2
2
2
1
2
1
1
2
1
1
2
1
1
1
2
1
1
2
2
2
1
1
2
1
1
1
1
1
2
1
1
2
1
1
1
1
1
1
1
2
1
2
1
2
1
2
1
1
1
2
2
1
2
2
2
2
1
1
2
1
2
1
1
1
2
2
1
1
2
2
2
1
1
1
2
1
1
2
1
2
2
1
1
2
2
1
1
1
1
2
1
1
1
1
1
2
2
1
1
2
2
2
1
1
2
1
2
1
2
2
2
1
1
1
2
2
1
2
2
1
1
2
1
2
1
2
2
1...

output:

8
0 43
8
2
8
0 1938
8
2
8
1 1938
8
0 1884
8
2
8
1 1884
8
0 835
8
2
8
0 1873
8
2
8
1 1873
8
0 307
8
2
8
1 307
8
0 1950
8
2
8
1 1950
8
0 1557
8
2
8
1 1557
8
0 729
8
2
8
0 1960
8
2
8
1 1960
8
0 121
8
2
8
1 121
8
0 1028
8
2
8
0 1828
8
2
8
1 1828
8
0 874
8
2
8
0 766
8
2
8
0 951
8
2
8
0 305
8
2
8
1 305
8
...

result:

points 0.81106666670 points  0.81106666670