QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#121929#1148. GameQwerty1232#42 562ms3984kbC++171.3kb2023-07-09 00:45:342024-07-04 00:33:01

Judging History

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

  • [2024-07-04 00:33:01]
  • 评测
  • 测评结果:42
  • 用时:562ms
  • 内存:3984kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-09 00:45:34]
  • 提交

answer

#pragma GCC target("avx512vl,avx512bw,avx512bitalg,avx512dq")
#pragma GCC optimize("O3")
#include "game.h"

#include <bits/stdc++.h>

constexpr int N = 1501;
// std::vector<std::vector<int>> gr;
std::array<std::bitset<N>, N> gr;
int n;
std::mt19937 rnd;

void initialize(int n) {
    // while (clock() * 1.0 / CLOCKS_PER_SEC < 0.95) {
    //     ;
    // }
    // exit(0);
    ::n = n;
    for (int i = 0; i < n; i++) {
        gr[i].reset();
        gr[i] = ~gr[i];
        gr[i][i] = 0;
    }
}

int hasEdge(int u, int v) {
    gr[u][v] = gr[v][u] = 0;
    if (rnd() % 2) {
        std::swap(u, v);
    }

    std::bitset<N> used;
    used.reset();
    used = ~used;
    int ans = -1;
    auto dfs = [&](auto dfs, int i) -> void {
        if (i == v) {
            ans = 0;
            return;
        }
        if (ans != -1) {
            return;
        }
        int t = (used & gr[i])._Find_first();
        used[i] = 0;
        while (t < n) {
            dfs(dfs, t);
            if (ans != -1) {
                return;
            }
            t = (used & gr[i])._Find_next(t);
        }
    };
    dfs(dfs, u);
    if (ans == 0 || used._Find_first() == n) {
        return 0;
    }
    gr[u][v] = gr[v][u] = 1;
    return 1;
}

詳細信息

Subtask #1:

score: 15
Accepted

Test #1:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #2:

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

input:

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

output:

0
0
1
0
1
1

result:

ok correct

Test #3:

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

input:

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

output:

0
0
1
0
1
1

result:

ok correct

Test #4:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #5:

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

input:

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

output:

0
0
1
0
1
1

result:

ok correct

Test #6:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #7:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #8:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #9:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #10:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #11:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #12:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #13:

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

input:

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

output:

0
0
1
0
1
1

result:

ok correct

Test #14:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #15:

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

input:

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

output:

0
0
1
0
1
1

result:

ok correct

Test #16:

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

input:

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

output:

0
0
1
0
1
1

result:

ok correct

Test #17:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #18:

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

input:

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

output:

0
0
1
0
1
1

result:

ok correct

Test #19:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #20:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #21:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #22:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #23:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #24:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Subtask #2:

score: 27
Accepted

Test #25:

score: 27
Accepted
time: 0ms
memory: 3692kb

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #26:

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

input:

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

output:

0
0
1
0
1
1

result:

ok correct

Test #27:

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

input:

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

output:

0
0
1
0
1
1

result:

ok correct

Test #28:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #29:

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

input:

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

output:

0
0
1
0
1
1

result:

ok correct

Test #30:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #31:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #32:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #33:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #34:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #35:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #36:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #37:

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

input:

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

output:

0
0
1
0
1
1

result:

ok correct

Test #38:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #39:

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

input:

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

output:

0
0
1
0
1
1

result:

ok correct

Test #40:

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

input:

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

output:

0
0
1
0
1
1

result:

ok correct

Test #41:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #42:

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

input:

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

output:

0
0
1
0
1
1

result:

ok correct

Test #43:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #44:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #45:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #46:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #47:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #48:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #49:

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

input:

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

output:

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

result:

ok correct

Test #50:

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

input:

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

output:

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

result:

ok correct

Test #51:

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

input:

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

output:

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

result:

ok correct

Test #52:

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

input:

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

output:

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

result:

ok correct

Test #53:

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

input:

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

output:

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

result:

ok correct

Test #54:

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

input:

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

output:

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

result:

ok correct

Test #55:

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

input:

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

output:

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

result:

ok correct

Test #56:

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

input:

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

output:

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

result:

ok correct

Test #57:

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

input:

33
31 0
31 23
31 18
14 17
22 4
19 9
6 13
13 23
12 27
23 9
31 7
24 25
1 0
9 14
24 10
23 1
26 29
16 6
30 31
16 20
20 10
1 17
22 24
30 1
32 10
25 16
31 25
12 32
29 30
31 5
2 31
12 14
16 3
0 27
29 28
16 10
11 29
30 23
6 14
32 19
6 20
16 5
1 2
10 13
14 19
32 11
20 5
5 7
1 12
0 15
12 6
9 30
30 17
16 32
9 ...

output:

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

result:

ok correct

Test #58:

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

input:

80
77 16
16 63
9 36
68 73
61 40
16 6
9 41
53 62
10 2
50 40
24 17
14 29
56 4
24 54
26 33
75 30
47 20
67 16
48 8
60 64
23 35
51 53
5 41
38 58
58 16
30 78
73 75
38 25
36 13
62 74
48 78
12 43
7 19
78 36
78 70
37 1
44 8
19 18
78 64
50 3
67 0
77 8
73 76
24 29
28 78
77 72
1 29
64 10
24 30
40 3
17 79
18 61
...

output:

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

result:

ok correct

Test #59:

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

input:

80
24 7
17 55
38 10
45 34
35 11
1 0
33 5
57 78
33 30
65 59
14 79
2 79
54 7
35 79
30 10
76 11
77 79
73 16
24 61
73 36
59 73
30 79
72 5
52 23
46 58
3 42
44 17
29 41
24 40
74 48
38 58
69 23
53 70
43 27
47 75
63 14
55 18
19 77
27 72
61 75
0 26
32 75
47 25
74 77
15 50
20 56
5 37
11 58
11 26
15 18
74 57
6...

output:

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

result:

ok correct

Test #60:

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

input:

80
13 20
13 45
60 44
66 15
69 25
25 15
48 11
47 27
57 0
53 47
70 35
54 38
27 21
27 58
39 23
35 32
45 29
43 75
37 15
67 8
69 63
25 71
18 24
50 66
28 13
16 29
10 78
26 38
50 11
0 54
67 44
28 25
61 62
43 54
22 38
31 27
31 24
5 7
53 61
21 11
78 6
0 73
79 14
63 39
52 58
25 20
16 25
46 59
30 47
24 11
33 5...

output:

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

result:

ok correct

Test #61:

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

input:

80
13 33
50 68
36 7
44 10
41 44
62 1
64 16
8 77
76 39
58 70
62 72
57 16
63 45
36 64
17 47
50 11
72 36
39 45
66 14
65 78
62 66
22 14
45 7
30 3
79 25
25 27
53 13
10 19
74 12
50 33
52 11
14 52
2 57
27 63
9 75
11 8
37 68
23 64
52 34
50 59
44 53
34 55
78 53
46 70
32 71
7 14
0 76
54 21
28 5
9 1
56 49
55 3...

output:

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

result:

ok correct

Test #62:

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

input:

80
39 45
57 14
48 65
61 77
35 3
16 54
71 25
47 16
36 50
22 29
54 70
60 74
26 46
37 5
53 0
64 19
24 45
8 74
3 1
62 5
39 6
58 79
30 16
36 77
27 28
55 32
71 3
59 64
61 38
15 41
12 66
51 46
66 27
29 76
69 72
9 23
50 75
56 71
20 61
77 12
29 4
31 43
0 50
64 62
54 34
39 2
12 78
79 25
19 0
21 38
2 12
63 5
7...

output:

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

result:

ok correct

Test #63:

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

input:

80
71 0
46 57
0 28
60 48
67 55
26 66
41 66
24 18
57 62
72 19
34 7
21 69
7 14
67 51
27 79
17 58
31 34
36 2
29 18
3 74
43 23
34 71
67 37
49 42
46 50
33 2
0 64
75 72
65 18
23 56
66 49
33 42
21 49
49 5
12 66
13 6
52 54
75 44
71 47
45 76
16 38
73 35
63 18
16 52
15 76
71 6
60 27
37 47
2 4
1 41
54 42
15 39...

output:

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

result:

ok correct

Test #64:

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

input:

80
71 21
46 38
22 40
47 64
1 71
5 62
53 15
71 53
52 28
32 16
14 4
73 27
0 57
43 63
60 15
54 44
0 68
72 19
79 65
65 26
52 30
45 26
71 50
69 13
67 26
57 37
79 53
61 17
79 78
6 74
66 2
11 72
11 70
61 41
6 27
30 62
35 15
69 59
68 32
44 2
27 17
71 7
52 64
11 76
18 35
32 48
66 31
44 48
58 47
78 33
15 8
4 ...

output:

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

result:

ok correct

Test #65:

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

input:

80
19 72
39 26
33 59
14 4
22 54
0 72
45 15
44 61
50 23
38 40
5 53
23 10
77 54
3 20
78 15
64 9
42 11
16 64
37 66
21 17
76 15
23 18
12 54
74 29
21 20
10 29
77 24
25 44
79 55
76 71
1 37
26 1
40 16
33 44
42 21
49 15
40 61
20 11
60 61
0 23
77 32
70 34
39 44
55 26
6 28
42 25
13 23
18 32
49 50
44 54
6 46
1...

output:

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

result:

ok correct

Test #66:

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

input:

80
54 59
47 66
0 75
23 0
33 17
13 68
29 38
31 6
9 59
71 78
54 51
22 6
60 69
58 24
50 72
19 77
12 64
11 22
54 55
47 5
33 52
51 24
37 42
26 8
65 49
66 12
46 31
47 50
26 68
51 50
71 37
59 20
47 36
52 58
42 50
61 7
65 16
33 75
17 18
71 45
57 7
42 73
44 3
49 14
12 72
78 61
0 36
58 55
14 59
75 26
10 62
40...

output:

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

result:

ok correct

Test #67:

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

input:

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

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #68:

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

input:

80
79 78
77 79
78 77
79 76
78 76
77 76
79 75
75 78
77 75
76 75
74 79
74 78
77 74
74 76
75 74
79 73
73 78
77 73
73 76
75 73
73 74
72 79
78 72
77 72
72 76
72 75
74 72
72 73
71 79
78 71
71 77
76 71
71 75
74 71
71 73
72 71
79 70
70 78
70 77
70 76
70 75
70 74
73 70
70 72
70 71
69 79
69 78
69 77
69 76
69 ...

output:

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

result:

ok correct

Test #69:

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

input:

80
59 52
23 59
37 31
7 72
69 54
23 27
37 46
61 57
9 23
59 31
59 73
6 54
42 17
0 3
52 58
67 39
21 72
59 30
73 35
37 75
78 31
75 77
24 3
34 19
59 14
10 3
42 33
72 48
49 44
70 60
21 17
1 47
33 22
34 29
29 70
1 8
35 66
63 29
22 10
15 26
60 4
36 52
48 53
2 49
45 11
14 72
64 5
1 40
45 19
15 7
63 26
42 65
...

output:

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

result:

ok correct

Test #70:

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

input:

80
29 59
7 20
36 43
27 1
39 6
51 50
11 53
15 69
25 22
54 44
54 28
64 23
51 66
11 55
65 37
2 57
76 45
73 45
5 11
34 75
28 41
54 19
31 73
70 32
45 55
43 68
76 29
5 52
12 56
18 70
14 15
50 5
77 11
54 25
20 26
70 68
59 56
76 19
29 26
41 79
12 8
49 39
15 1
38 14
14 46
72 70
59 50
46 13
44 67
65 36
45 33
...

output:

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

result:

ok correct

Test #71:

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

input:

80
74 35
75 43
6 17
21 64
17 52
70 31
63 3
57 42
67 31
48 9
37 44
79 72
54 53
32 58
9 13
59 54
58 51
38 10
52 44
79 64
45 52
41 39
59 73
36 20
72 33
42 66
69 55
8 79
15 27
1 3
22 37
38 23
52 16
60 40
69 28
16 67
58 72
39 12
50 13
50 62
69 32
77 37
45 37
51 62
31 20
42 75
35 11
0 68
49 16
53 37
67 33...

output:

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

result:

ok correct

Test #72:

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

input:

80
26 54
22 24
26 9
7 34
39 57
46 32
8 21
9 40
57 56
27 11
69 22
15 64
7 68
4 35
57 11
2 0
32 40
24 31
37 52
36 38
48 6
29 71
50 32
52 49
79 31
53 68
78 56
22 43
55 75
53 20
64 32
22 48
66 77
31 17
11 58
11 69
35 14
18 79
67 55
19 44
61 10
33 74
63 0
70 29
1 77
22 4
10 3
47 68
55 41
59 4
44 28
18 62...

output:

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

result:

ok correct

Test #73:

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

input:

80
61 51
46 16
29 43
67 77
25 53
62 46
77 58
25 71
69 22
68 65
70 61
0 65
14 9
9 37
52 30
19 17
70 53
76 68
76 9
23 71
43 64
77 7
10 77
4 42
40 55
28 10
14 16
4 32
1 49
14 79
23 24
69 2
57 31
7 2
38 54
76 33
20 74
53 11
68 57
50 64
42 47
61 40
24 58
31 69
35 46
7 31
11 50
7 47
22 26
15 64
9 36
76 78...

output:

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

result:

ok correct

Test #74:

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

input:

80
10 34
47 33
72 68
8 27
63 62
59 8
74 8
47 36
37 24
53 49
34 77
41 49
54 18
4 5
12 65
27 77
68 15
53 78
28 70
74 36
65 55
12 78
57 33
36 65
54 27
5 39
63 45
78 62
28 33
77 36
4 54
40 57
34 63
65 47
55 37
34 17
70 17
27 74
24 39
9 47
27 0
12 72
77 45
65 28
12 45
38 10
34 4
77 37
53 8
45 36
74 39
27...

output:

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

result:

ok correct

Test #75:

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

input:

80
15 35
37 41
35 8
14 67
55 66
36 66
57 40
15 59
14 30
40 23
58 43
43 18
54 18
59 77
15 3
79 23
49 37
66 16
37 58
57 30
30 66
19 40
55 63
27 6
41 49
15 51
27 54
3 54
15 63
63 49
8 33
63 19
51 66
8 15
49 56
45 8
23 30
23 57
48 35
49 54
49 10
33 57
16 19
19 48
8 27
63 3
66 46
71 18
36 30
51 8
33 59
2...

output:

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

result:

ok correct

Test #76:

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

input:

80
40 75
40 39
35 16
26 78
25 34
26 15
21 25
17 53
47 38
68 33
15 40
31 74
33 56
56 65
29 34
74 52
59 74
36 53
70 0
58 25
33 39
57 56
41 4
68 22
16 17
39 53
47 30
64 31
17 8
64 57
47 57
27 19
41 38
27 51
68 51
38 57
57 27
33 27
23 78
70 23
30 35
69 64
65 68
30 37
68 48
56 58
70 69
0 78
22 21
36 35
3...

output:

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

result:

ok correct

Test #77:

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

input:

80
66 60
74 16
7 43
11 60
55 75
78 61
78 11
6 75
77 73
36 41
11 44
16 40
15 27
2 64
75 74
36 78
74 46
41 46
44 23
75 79
45 75
13 27
5 62
64 60
55 16
7 36
6 27
44 32
43 5
8 41
2 6
5 36
73 45
40 2
60 27
15 13
75 8
44 64
40 46
44 79
11 62
41 15
11 30
2 27
32 73
11 36
7 77
6 32
43 77
8 30
2 45
23 64
5 3...

output:

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

result:

ok correct

Test #78:

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

input:

80
26 38
71 47
15 52
70 44
72 66
25 23
31 9
44 71
6 79
59 49
6 38
71 38
71 25
25 52
73 60
26 44
25 26
57 15
26 2
57 59
73 5
5 72
70 77
54 26
49 57
71 57
5 41
2 6
27 6
31 63
60 3
25 45
41 27
32 59
23 52
79 9
77 38
41 14
26 72
2 52
56 15
23 27
72 9
70 32
32 73
6 25
14 77
27 70
25 54
77 30
2 45
60 6
70...

output:

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

result:

ok correct

Subtask #3:

score: 0
Time Limit Exceeded

Test #79:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #80:

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

input:

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

output:

0
0
1
0
1
1

result:

ok correct

Test #81:

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

input:

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

output:

0
0
1
0
1
1

result:

ok correct

Test #82:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #83:

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

input:

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

output:

0
0
1
0
1
1

result:

ok correct

Test #84:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #85:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #86:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #87:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #88:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #89:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #90:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #91:

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

input:

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

output:

0
0
1
0
1
1

result:

ok correct

Test #92:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #93:

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

input:

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

output:

0
0
1
0
1
1

result:

ok correct

Test #94:

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

input:

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

output:

0
0
1
0
1
1

result:

ok correct

Test #95:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #96:

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

input:

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

output:

0
0
1
0
1
1

result:

ok correct

Test #97:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #98:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #99:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #100:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #101:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #102:

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

input:

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

output:

0
0
0
1
1
1

result:

ok correct

Test #103:

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

input:

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

output:

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

result:

ok correct

Test #104:

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

input:

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

output:

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

result:

ok correct

Test #105:

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

input:

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

output:

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

result:

ok correct

Test #106:

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

input:

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

output:

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

result:

ok correct

Test #107:

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

input:

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

output:

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

result:

ok correct

Test #108:

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

input:

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

output:

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

result:

ok correct

Test #109:

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

input:

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

output:

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

result:

ok correct

Test #110:

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

input:

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

output:

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

result:

ok correct

Test #111:

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

input:

33
31 0
31 23
31 18
14 17
22 4
19 9
6 13
13 23
12 27
23 9
31 7
24 25
1 0
9 14
24 10
23 1
26 29
16 6
30 31
16 20
20 10
1 17
22 24
30 1
32 10
25 16
31 25
12 32
29 30
31 5
2 31
12 14
16 3
0 27
29 28
16 10
11 29
30 23
6 14
32 19
6 20
16 5
1 2
10 13
14 19
32 11
20 5
5 7
1 12
0 15
12 6
9 30
30 17
16 32
9 ...

output:

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

result:

ok correct

Test #112:

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

input:

80
77 16
16 63
9 36
68 73
61 40
16 6
9 41
53 62
10 2
50 40
24 17
14 29
56 4
24 54
26 33
75 30
47 20
67 16
48 8
60 64
23 35
51 53
5 41
38 58
58 16
30 78
73 75
38 25
36 13
62 74
48 78
12 43
7 19
78 36
78 70
37 1
44 8
19 18
78 64
50 3
67 0
77 8
73 76
24 29
28 78
77 72
1 29
64 10
24 30
40 3
17 79
18 61
...

output:

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

result:

ok correct

Test #113:

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

input:

80
24 7
17 55
38 10
45 34
35 11
1 0
33 5
57 78
33 30
65 59
14 79
2 79
54 7
35 79
30 10
76 11
77 79
73 16
24 61
73 36
59 73
30 79
72 5
52 23
46 58
3 42
44 17
29 41
24 40
74 48
38 58
69 23
53 70
43 27
47 75
63 14
55 18
19 77
27 72
61 75
0 26
32 75
47 25
74 77
15 50
20 56
5 37
11 58
11 26
15 18
74 57
6...

output:

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

result:

ok correct

Test #114:

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

input:

80
13 20
13 45
60 44
66 15
69 25
25 15
48 11
47 27
57 0
53 47
70 35
54 38
27 21
27 58
39 23
35 32
45 29
43 75
37 15
67 8
69 63
25 71
18 24
50 66
28 13
16 29
10 78
26 38
50 11
0 54
67 44
28 25
61 62
43 54
22 38
31 27
31 24
5 7
53 61
21 11
78 6
0 73
79 14
63 39
52 58
25 20
16 25
46 59
30 47
24 11
33 5...

output:

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

result:

ok correct

Test #115:

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

input:

80
13 33
50 68
36 7
44 10
41 44
62 1
64 16
8 77
76 39
58 70
62 72
57 16
63 45
36 64
17 47
50 11
72 36
39 45
66 14
65 78
62 66
22 14
45 7
30 3
79 25
25 27
53 13
10 19
74 12
50 33
52 11
14 52
2 57
27 63
9 75
11 8
37 68
23 64
52 34
50 59
44 53
34 55
78 53
46 70
32 71
7 14
0 76
54 21
28 5
9 1
56 49
55 3...

output:

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

result:

ok correct

Test #116:

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

input:

80
39 45
57 14
48 65
61 77
35 3
16 54
71 25
47 16
36 50
22 29
54 70
60 74
26 46
37 5
53 0
64 19
24 45
8 74
3 1
62 5
39 6
58 79
30 16
36 77
27 28
55 32
71 3
59 64
61 38
15 41
12 66
51 46
66 27
29 76
69 72
9 23
50 75
56 71
20 61
77 12
29 4
31 43
0 50
64 62
54 34
39 2
12 78
79 25
19 0
21 38
2 12
63 5
7...

output:

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

result:

ok correct

Test #117:

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

input:

80
71 0
46 57
0 28
60 48
67 55
26 66
41 66
24 18
57 62
72 19
34 7
21 69
7 14
67 51
27 79
17 58
31 34
36 2
29 18
3 74
43 23
34 71
67 37
49 42
46 50
33 2
0 64
75 72
65 18
23 56
66 49
33 42
21 49
49 5
12 66
13 6
52 54
75 44
71 47
45 76
16 38
73 35
63 18
16 52
15 76
71 6
60 27
37 47
2 4
1 41
54 42
15 39...

output:

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

result:

ok correct

Test #118:

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

input:

80
71 21
46 38
22 40
47 64
1 71
5 62
53 15
71 53
52 28
32 16
14 4
73 27
0 57
43 63
60 15
54 44
0 68
72 19
79 65
65 26
52 30
45 26
71 50
69 13
67 26
57 37
79 53
61 17
79 78
6 74
66 2
11 72
11 70
61 41
6 27
30 62
35 15
69 59
68 32
44 2
27 17
71 7
52 64
11 76
18 35
32 48
66 31
44 48
58 47
78 33
15 8
4 ...

output:

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

result:

ok correct

Test #119:

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

input:

80
19 72
39 26
33 59
14 4
22 54
0 72
45 15
44 61
50 23
38 40
5 53
23 10
77 54
3 20
78 15
64 9
42 11
16 64
37 66
21 17
76 15
23 18
12 54
74 29
21 20
10 29
77 24
25 44
79 55
76 71
1 37
26 1
40 16
33 44
42 21
49 15
40 61
20 11
60 61
0 23
77 32
70 34
39 44
55 26
6 28
42 25
13 23
18 32
49 50
44 54
6 46
1...

output:

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

result:

ok correct

Test #120:

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

input:

80
54 59
47 66
0 75
23 0
33 17
13 68
29 38
31 6
9 59
71 78
54 51
22 6
60 69
58 24
50 72
19 77
12 64
11 22
54 55
47 5
33 52
51 24
37 42
26 8
65 49
66 12
46 31
47 50
26 68
51 50
71 37
59 20
47 36
52 58
42 50
61 7
65 16
33 75
17 18
71 45
57 7
42 73
44 3
49 14
12 72
78 61
0 36
58 55
14 59
75 26
10 62
40...

output:

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

result:

ok correct

Test #121:

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

input:

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

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok correct

Test #122:

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

input:

80
79 78
77 79
78 77
79 76
78 76
77 76
79 75
75 78
77 75
76 75
74 79
74 78
77 74
74 76
75 74
79 73
73 78
77 73
73 76
75 73
73 74
72 79
78 72
77 72
72 76
72 75
74 72
72 73
71 79
78 71
71 77
76 71
71 75
74 71
71 73
72 71
79 70
70 78
70 77
70 76
70 75
70 74
73 70
70 72
70 71
69 79
69 78
69 77
69 76
69 ...

output:

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

result:

ok correct

Test #123:

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

input:

80
59 52
23 59
37 31
7 72
69 54
23 27
37 46
61 57
9 23
59 31
59 73
6 54
42 17
0 3
52 58
67 39
21 72
59 30
73 35
37 75
78 31
75 77
24 3
34 19
59 14
10 3
42 33
72 48
49 44
70 60
21 17
1 47
33 22
34 29
29 70
1 8
35 66
63 29
22 10
15 26
60 4
36 52
48 53
2 49
45 11
14 72
64 5
1 40
45 19
15 7
63 26
42 65
...

output:

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

result:

ok correct

Test #124:

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

input:

80
29 59
7 20
36 43
27 1
39 6
51 50
11 53
15 69
25 22
54 44
54 28
64 23
51 66
11 55
65 37
2 57
76 45
73 45
5 11
34 75
28 41
54 19
31 73
70 32
45 55
43 68
76 29
5 52
12 56
18 70
14 15
50 5
77 11
54 25
20 26
70 68
59 56
76 19
29 26
41 79
12 8
49 39
15 1
38 14
14 46
72 70
59 50
46 13
44 67
65 36
45 33
...

output:

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

result:

ok correct

Test #125:

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

input:

80
74 35
75 43
6 17
21 64
17 52
70 31
63 3
57 42
67 31
48 9
37 44
79 72
54 53
32 58
9 13
59 54
58 51
38 10
52 44
79 64
45 52
41 39
59 73
36 20
72 33
42 66
69 55
8 79
15 27
1 3
22 37
38 23
52 16
60 40
69 28
16 67
58 72
39 12
50 13
50 62
69 32
77 37
45 37
51 62
31 20
42 75
35 11
0 68
49 16
53 37
67 33...

output:

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

result:

ok correct

Test #126:

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

input:

80
26 54
22 24
26 9
7 34
39 57
46 32
8 21
9 40
57 56
27 11
69 22
15 64
7 68
4 35
57 11
2 0
32 40
24 31
37 52
36 38
48 6
29 71
50 32
52 49
79 31
53 68
78 56
22 43
55 75
53 20
64 32
22 48
66 77
31 17
11 58
11 69
35 14
18 79
67 55
19 44
61 10
33 74
63 0
70 29
1 77
22 4
10 3
47 68
55 41
59 4
44 28
18 62...

output:

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

result:

ok correct

Test #127:

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

input:

80
61 51
46 16
29 43
67 77
25 53
62 46
77 58
25 71
69 22
68 65
70 61
0 65
14 9
9 37
52 30
19 17
70 53
76 68
76 9
23 71
43 64
77 7
10 77
4 42
40 55
28 10
14 16
4 32
1 49
14 79
23 24
69 2
57 31
7 2
38 54
76 33
20 74
53 11
68 57
50 64
42 47
61 40
24 58
31 69
35 46
7 31
11 50
7 47
22 26
15 64
9 36
76 78...

output:

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

result:

ok correct

Test #128:

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

input:

80
10 34
47 33
72 68
8 27
63 62
59 8
74 8
47 36
37 24
53 49
34 77
41 49
54 18
4 5
12 65
27 77
68 15
53 78
28 70
74 36
65 55
12 78
57 33
36 65
54 27
5 39
63 45
78 62
28 33
77 36
4 54
40 57
34 63
65 47
55 37
34 17
70 17
27 74
24 39
9 47
27 0
12 72
77 45
65 28
12 45
38 10
34 4
77 37
53 8
45 36
74 39
27...

output:

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

result:

ok correct

Test #129:

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

input:

80
15 35
37 41
35 8
14 67
55 66
36 66
57 40
15 59
14 30
40 23
58 43
43 18
54 18
59 77
15 3
79 23
49 37
66 16
37 58
57 30
30 66
19 40
55 63
27 6
41 49
15 51
27 54
3 54
15 63
63 49
8 33
63 19
51 66
8 15
49 56
45 8
23 30
23 57
48 35
49 54
49 10
33 57
16 19
19 48
8 27
63 3
66 46
71 18
36 30
51 8
33 59
2...

output:

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

result:

ok correct

Test #130:

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

input:

80
40 75
40 39
35 16
26 78
25 34
26 15
21 25
17 53
47 38
68 33
15 40
31 74
33 56
56 65
29 34
74 52
59 74
36 53
70 0
58 25
33 39
57 56
41 4
68 22
16 17
39 53
47 30
64 31
17 8
64 57
47 57
27 19
41 38
27 51
68 51
38 57
57 27
33 27
23 78
70 23
30 35
69 64
65 68
30 37
68 48
56 58
70 69
0 78
22 21
36 35
3...

output:

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

result:

ok correct

Test #131:

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

input:

80
66 60
74 16
7 43
11 60
55 75
78 61
78 11
6 75
77 73
36 41
11 44
16 40
15 27
2 64
75 74
36 78
74 46
41 46
44 23
75 79
45 75
13 27
5 62
64 60
55 16
7 36
6 27
44 32
43 5
8 41
2 6
5 36
73 45
40 2
60 27
15 13
75 8
44 64
40 46
44 79
11 62
41 15
11 30
2 27
32 73
11 36
7 77
6 32
43 77
8 30
2 45
23 64
5 3...

output:

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

result:

ok correct

Test #132:

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

input:

80
26 38
71 47
15 52
70 44
72 66
25 23
31 9
44 71
6 79
59 49
6 38
71 38
71 25
25 52
73 60
26 44
25 26
57 15
26 2
57 59
73 5
5 72
70 77
54 26
49 57
71 57
5 41
2 6
27 6
31 63
60 3
25 45
41 27
32 59
23 52
79 9
77 38
41 14
26 72
2 52
56 15
23 27
72 9
70 32
32 73
6 25
14 77
27 70
25 54
77 30
2 45
60 6
70...

output:

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

result:

ok correct

Test #133:

score: 0
Accepted
time: 512ms
memory: 3980kb

input:

514
401 94
52 422
361 428
224 345
410 259
280 109
37 171
381 442
441 55
110 68
395 106
108 248
362 0
201 349
261 393
452 159
503 402
389 340
311 294
32 495
172 242
14 312
48 248
4 277
441 379
272 296
309 322
264 44
355 104
72 512
349 382
114 487
66 366
214 4
233 181
109 7
337 280
426 393
504 5
377 3...

output:

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

result:

ok correct

Test #134:

score: 0
Accepted
time: 510ms
memory: 3920kb

input:

514
89 166
227 81
274 479
435 388
224 385
115 350
269 303
486 445
175 369
249 11
34 368
484 347
429 373
265 178
338 184
459 287
291 26
475 361
499 58
100 292
261 256
77 184
447 509
13 81
304 262
307 391
241 261
233 95
199 30
512 50
83 98
400 32
138 162
402 153
492 505
292 497
146 427
362 284
26 126
...

output:

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

result:

ok correct

Test #135:

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

input:

514
276 477
105 384
184 260
179 334
69 427
0 9
232 159
79 317
377 226
108 183
294 410
87 219
136 197
303 407
500 443
187 45
292 28
10 127
235 244
481 407
267 350
183 165
319 179
375 438
391 52
322 432
468 245
65 374
85 348
435 424
303 191
414 350
299 34
375 378
475 94
204 473
84 268
26 273
134 224
4...

output:

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

result:

ok correct

Test #136:

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

input:

514
368 424
236 247
405 492
203 309
222 174
141 77
348 284
260 130
300 54
365 137
242 17
46 296
242 19
223 334
107 319
21 116
458 242
432 41
158 362
310 169
420 94
499 449
74 423
123 429
334 176
93 152
231 193
437 114
73 395
314 78
204 359
87 370
174 5
372 427
193 447
509 283
358 287
266 328
466 247...

output:

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

result:

ok correct

Test #137:

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

input:

514
13 325
275 329
253 201
328 507
369 177
400 451
114 173
112 425
67 414
219 333
420 328
18 207
470 250
66 117
13 468
395 453
104 101
277 39
311 126
357 444
420 38
440 92
395 194
208 429
307 27
251 366
78 470
231 87
414 413
413 232
127 218
275 214
347 244
437 188
85 495
64 372
85 488
139 93
222 187...

output:

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

result:

ok correct

Test #138:

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

input:

514
212 186
264 171
442 238
469 466
380 322
287 158
199 276
160 465
425 226
101 491
200 153
95 375
395 247
279 423
53 165
224 457
75 279
164 129
161 462
437 46
203 253
57 239
145 252
192 356
159 414
217 299
46 302
88 100
54 508
149 88
185 106
79 93
245 290
227 401
215 39
39 15
472 229
59 444
204 48
...

output:

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

result:

ok correct

Test #139:

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

input:

514
259 222
118 89
113 168
293 429
298 419
29 72
435 167
371 115
416 67
186 469
235 488
96 362
311 23
177 268
496 202
285 127
205 15
218 229
184 208
31 147
450 284
476 211
430 48
247 239
93 115
185 234
6 383
163 508
401 41
160 30
96 441
54 491
5 422
304 260
251 378
297 244
116 27
265 150
470 274
133...

output:

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

result:

ok correct

Test #140:

score: 0
Accepted
time: 514ms
memory: 3900kb

input:

514
442 162
127 482
26 10
255 213
335 34
458 13
504 64
15 227
461 210
465 373
144 423
100 438
455 10
43 369
124 162
349 398
139 322
239 273
138 346
315 33
157 372
478 487
106 148
458 492
264 337
133 214
151 65
475 513
170 130
513 11
355 434
74 254
251 390
511 410
262 339
42 179
433 248
331 425
45 41...

output:

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

result:

ok correct

Test #141:

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

input:

514
65 218
458 451
171 92
185 76
156 258
329 300
387 480
43 477
421 229
351 280
331 257
192 85
335 31
347 124
3 443
50 295
331 492
84 417
78 157
249 259
159 360
353 101
374 211
484 7
88 403
419 85
434 223
177 275
302 260
20 208
279 237
351 495
119 65
409 476
430 462
501 503
421 116
87 343
198 157
50...

output:

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

result:

ok correct

Test #142:

score: 0
Accepted
time: 332ms
memory: 3832kb

input:

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

output:

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

result:

ok correct

Test #143:

score: 0
Accepted
time: 562ms
memory: 3932kb

input:

514
512 513
513 511
511 512
513 510
510 512
510 511
509 513
512 509
509 511
510 509
508 513
512 508
511 508
510 508
509 508
513 507
512 507
511 507
510 507
507 509
508 507
506 513
506 512
506 511
510 506
506 509
506 508
507 506
513 505
512 505
505 511
510 505
505 509
508 505
505 507
505 506
504 513
...

output:

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

result:

ok correct

Test #144:

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

input:

514
86 351
197 452
426 69
232 2
362 366
456 392
173 152
407 512
165 204
244 14
288 384
390 84
4 220
85 232
318 203
222 245
214 223
414 69
163 69
125 137
219 241
55 501
482 186
48 17
259 390
396 15
476 487
176 339
380 104
285 261
258 54
284 407
238 280
440 16
420 284
33 214
483 367
390 512
24 501
176...

output:

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

result:

ok correct

Test #145:

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

input:

514
307 97
35 108
293 439
152 467
210 221
109 464
301 258
58 48
78 414
93 1
427 14
506 333
0 78
54 158
46 35
387 209
109 482
167 340
196 137
217 263
390 294
185 361
462 376
295 331
128 141
368 430
139 426
420 231
33 49
321 117
113 311
267 163
451 236
493 7
326 175
107 320
274 159
80 309
309 496
419 ...

output:

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

result:

ok correct

Test #146:

score: 0
Accepted
time: 406ms
memory: 3980kb

input:

514
355 43
499 5
46 165
29 183
26 205
291 307
218 240
53 36
131 485
503 236
373 398
67 306
421 188
143 92
146 391
500 508
327 508
288 388
19 206
161 313
314 448
324 300
395 245
249 122
296 476
331 223
264 29
455 287
182 481
164 155
505 60
183 86
505 259
173 421
391 200
443 54
415 509
419 179
501 178...

output:

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

result:

ok correct

Test #147:

score: 0
Accepted
time: 456ms
memory: 3900kb

input:

514
502 44
352 11
382 155
154 12
236 419
216 402
126 66
253 451
225 480
435 222
115 209
240 403
455 319
45 499
26 388
221 245
315 372
385 176
5 354
171 472
28 48
244 150
110 305
5 452
96 290
90 285
172 371
90 352
358 410
250 446
19 339
156 503
461 247
92 471
380 239
349 60
73 209
73 137
458 290
111 ...

output:

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

result:

ok correct

Test #148:

score: 0
Accepted
time: 406ms
memory: 3980kb

input:

514
210 389
204 459
309 292
442 261
488 445
434 149
513 482
424 71
97 228
142 9
167 98
287 452
510 391
331 411
276 143
154 78
6 377
94 474
322 286
45 439
325 176
106 57
155 249
320 419
449 371
259 140
437 459
383 265
316 208
97 112
438 53
96 80
34 437
285 437
274 424
275 55
348 364
139 65
266 256
23...

output:

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

result:

ok correct

Test #149:

score: 0
Accepted
time: 508ms
memory: 3980kb

input:

514
365 108
443 145
45 176
434 486
447 422
450 384
213 384
412 474
178 453
509 15
179 101
500 458
18 54
489 28
276 451
205 511
476 18
253 34
398 45
364 186
506 202
234 15
431 80
77 145
76 329
57 131
118 164
414 210
448 441
397 34
229 202
416 448
255 503
144 90
381 297
35 177
442 466
422 401
163 98
4...

output:

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

result:

ok correct

Test #150:

score: 0
Accepted
time: 495ms
memory: 3980kb

input:

514
218 78
291 9
508 235
151 104
267 214
173 440
90 355
42 274
216 136
212 149
244 264
76 0
501 432
237 146
400 456
218 333
465 188
35 219
377 457
290 336
405 314
154 212
119 171
230 335
322 84
166 74
381 207
465 230
54 352
501 149
268 153
118 309
307 255
446 505
267 137
212 256
145 456
51 201
99 22...

output:

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

result:

ok correct

Test #151:

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

input:

514
218 316
249 272
46 425
76 24
409 221
224 356
221 77
83 278
340 418
114 407
368 299
40 414
169 55
169 270
119 454
368 276
394 488
53 106
442 265
344 457
294 91
327 464
29 21
105 370
198 1
162 348
109 296
378 53
511 301
445 485
54 169
168 409
184 356
465 14
377 115
501 337
6 219
91 263
103 265
78 ...

output:

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

result:

ok correct

Test #152:

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

input:

514
149 101
303 353
378 19
359 299
182 8
363 233
219 83
314 215
170 388
356 244
251 96
330 80
162 358
234 300
22 184
278 244
5 109
90 338
338 318
246 282
277 435
454 437
379 3
237 493
271 423
129 502
30 126
168 211
125 49
271 193
91 26
300 298
394 170
336 305
459 388
75 251
365 468
383 472
508 472
1...

output:

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

result:

ok correct

Test #153:

score: 0
Accepted
time: 510ms
memory: 3772kb

input:

514
70 441
240 364
212 317
53 51
202 108
468 97
379 267
411 495
174 157
380 502
133 314
129 298
92 82
124 14
45 22
509 505
241 248
27 282
268 154
208 426
418 222
357 345
82 314
360 130
296 248
256 199
97 30
27 326
508 15
513 384
180 370
391 344
96 174
26 359
67 346
365 28
197 428
180 198
312 498
257...

output:

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

result:

ok correct

Test #154:

score: -58
Time Limit Exceeded

input:

777
144 59
33 673
174 481
347 756
757 221
488 67
425 511
179 330
586 35
463 270
97 66
457 577
635 496
236 363
141 690
747 414
619 501
667 168
199 154
213 615
101 375
290 690
31 136
202 215
738 268
533 707
564 714
772 250
663 64
549 562
171 354
533 571
42 324
707 2
700 105
578 4
585 426
618 509
719 2...

output:

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

result: