QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#135917#1139. Stationsbashkort#36.316741 58ms4104kbC++201.3kb2023-08-06 15:33:112024-07-04 01:19:44

Judging History

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

  • [2024-07-04 01:19:44]
  • 评测
  • 测评结果:36.316741
  • 用时:58ms
  • 内存:4104kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-06 15:33:11]
  • 提交

stations

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

using namespace std;

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
    vector<vector<int>> adj(n);
    for (int i = 0; i + 1 < n; ++i) {
        adj[u[i]].push_back(v[i]);
        adj[v[i]].push_back(u[i]);
    }
	std::vector<int> labels(n);
    int T = 0;
    auto dfs = [&](auto self, int v, int par) -> void {
        labels[v] += T++;
        for (int to : adj[v]) {
            if (to != par) {
                self(self, to, v);
            }
        }
        labels[v] += T * 1000;
    };
    dfs(dfs, 0, -1);
	return labels;
}

bool isp(int a, int b, int c, int d) {
    return a <= c && b >= d;
}

int find_next_station(int s, int t, std::vector<int> c) {
    int tins = s % 1000, touts = s / 1000, tint = t % 1000, toutt = t / 1000;
    if (isp(tins, touts, tint, toutt)) {
        for (int to : c) {
            if (!isp(to % 1000, to / 1000, tins, touts) && isp(to % 1000, to / 1000, tint, toutt)) {
                return to;
            }
        }
    } else {
        for (int to : c) {
            if (isp(to % 1000, to / 1000, tins, touts)) {
                return to;
            }
        }
    }
    assert(false);
	return -1;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3972kb

input:

0
10
10 1000
4 5
9 0
2 6
5 2
8 3
1 4
8 1
6 0
3 7
3 1000
0 1
1 2
998 1000
166 178
393 452
389 179
622 429
892 866
872 18
899 227
835 637
587 769
504 386
369 577
65 441
523 17
803 221
878 321
637 892
696 473
16 146
840 322
495 986
353 275
330 585
831 402
719 810
704 830
780 940
53 901
894 911
394 482
...

output:

10
10000
10006
10003
10008
10005
10004
10002
10009
10007
2001
3
3000
3001
3002
998
998000
998223
219053
219207
998508
998816
998365
998369
219086
219104
998329
998529
219138
998787
998608
219152
998447
998270
998680
998519
998863
998579
998434
998687
998402
998709
998718
998962
998818
998320
219011
...

input:

1
-1
0

output:


result:

FAIL Unexpected end of file - int32 expected (/opt/uoj/judger/uoj_judger/work/channel_2_answer.txt)

Subtask #2:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 0ms
memory: 3604kb

input:

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

output:

996
996000
512001
996512
257002
512257
768513
996768
130003
257130
385258
512385
641514
768641
896769
996896
67004
130067
194131
257194
322259
385322
449386
512449
578515
641578
705642
768705
833770
896833
960897
996960
36005
67036
99068
130099
163132
194163
226195
257226
291260
322291
354323
385354...

input:

1
-1
0

output:


result:

FAIL Unexpected end of file - int32 expected (/opt/uoj/judger/uoj_judger/work/channel_2_answer.txt)

Subtask #3:

score: 0
Wrong Answer

Test #17:

score: 0
Wrong Answer
time: 0ms
memory: 3608kb

input:

0
10
2 1000000
1 0
997 1000000
830 513
223 672
727 200
763 415
581 440
34 42
267 325
912 693
753 59
401 289
198 641
982 214
41 49
453 107
940 806
905 732
153 482
248 405
102 79
480 837
534 620
564 856
679 178
278 247
899 206
333 672
297 308
407 863
26 752
272 178
204 603
208 10
715 562
785 285
184 5...

output:

2
2000
2001
997
997000
864251
864427
864578
864071
864300
864525
864291
864380
864036
864659
864114
997886
864630
864484
864456
997936
997880
864045
997947
864161
864485
864182
864437
864172
997970
864670
864788
864620
864399
997891
864022
864075
864340
864605
864375
864396
864226
864082
864706
9979...

input:

1
-1
0

output:


result:

FAIL Unexpected end of file - int32 expected (/opt/uoj/judger/uoj_judger/work/channel_2_answer.txt)

Subtask #4:

score: 10
Accepted

Test #34:

score: 10
Accepted
time: 58ms
memory: 3836kb

input:

0
10
2 1000000000
0 1
2 1000000000
0 1
2 1000000000
1 0
2 1000000000
1 0
2 1000000000
0 1
2 1000000000
1 0
2 1000000000
1 0
2 1000000000
0 1
2 1000000000
0 1
2 1000000000
0 1

output:

2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001

input:

1
100000
2001 2000 1
2000
2000 2001 1
2001
2000 2001 1
2001
2001 2000 1
2000
2000 2001 1
2001
2001 2000 1
2000
2001 2000 1
2000
2001 2000 1
2000
2001 2000 1
2000
2001 2000 1
2000
2000 2001 1
2001
2001 2000 1
2000
2000 2001 1
2001
2001 2000 1
2000
2000 2001 1
2001
2000 2001 1
2001
2000 2001 1
2001
20...

output:

2000
2001
2001
2000
2001
2000
2000
2000
2000
2000
2001
2000
2001
2000
2001
2001
2001
2000
2000
2001
2000
2001
2001
2000
2000
2001
2001
2000
2001
2001
2000
2000
2000
2000
2000
2001
2000
2001
2000
2000
2000
2001
2001
2000
2001
2001
2001
2001
2000
2000
2001
2001
2000
2000
2000
2001
2001
2000
2001
2001
...

result:

ok 

Test #35:

score: 10
Accepted
time: 44ms
memory: 3884kb

input:

0
10
3 1000000000
2 1
2 0
3 1000000000
1 0
2 0
3 1000000000
2 0
0 1
3 1000000000
0 2
1 2
3 1000000000
1 2
1 0
3 1000000000
1 0
2 1
3 1000000000
0 2
1 2
3 1000000000
1 2
1 0
3 1000000000
0 2
1 0
3 1000000000
2 0
1 2

output:

3
3000
3002
3001
3
3000
2001
3002
3
3000
3002
2001
3
3000
3002
3001
3
3000
3001
3002
3
3000
3001
3002
3
3000
3002
3001
3
3000
3001
3002
3
3000
3002
2001
3
3000
3002
3001

input:

1
75069
3001 3002 2
3000
3002
3000 2001 2
2001
3002
3000 3002 1
3001
3000 3002 1
3001
2001 3000 1
3000
3000 3002 1
3001
3002 3001 1
3001
3001 3000 2
3000
3002
2001 3002 1
3000
3001 3002 2
3000
3002
3001 3002 2
3000
3002
3002 3000 1
3001
3001 3002 2
3000
3002
3001 3002 2
3000
3002
3002 3000 1
3001
30...

output:

3002
2001
3001
3001
3000
3001
3001
3000
3000
3002
3002
3001
3002
3002
3001
3001
3000
2001
3001
3001
3002
3002
3000
3001
3001
3001
3001
3000
3001
3000
3002
2001
3000
3001
3000
3001
3000
2001
3001
3000
3001
3001
3000
3001
3000
3000
3002
3001
3000
3000
3001
3002
3000
3001
3002
3002
3001
3001
3000
3001
...

result:

ok 

Test #36:

score: 10
Accepted
time: 34ms
memory: 3792kb

input:

0
10
4 1000000000
3 1
2 0
1 0
4 1000000000
0 3
1 2
3 1
4 1000000000
3 1
0 2
0 1
4 1000000000
2 1
2 3
1 0
4 1000000000
3 1
0 1
2 3
4 1000000000
0 1
3 0
2 3
4 1000000000
2 0
3 0
1 2
4 1000000000
0 2
2 3
1 3
4 1000000000
3 2
2 1
3 0
4 1000000000
2 3
3 0
0 1

output:

4
4000
4002
2001
4003
4
4000
4002
4003
4001
4
4000
4002
2001
4003
4
4000
4001
4002
4003
4
4000
4001
4003
4002
4
4000
2001
4003
4002
4
4000
3002
3001
4003
4
4000
4003
4001
4002
4
4000
4003
4002
4001
4
4000
4003
3002
3001

input:

1
66804
4000 3002 2
3001
4003
4000 3002 2
3001
4003
4002 4000 2
4000
4003
4000 4001 1
4001
4000 4003 2
2001
4002
4002 4003 2
4000
4003
4002 4003 2
4001
4003
4001 4002 2
4000
4002
4000 4002 1
4001
3001 4003 2
3002
4000
4000 4002 2
2001
4002
4002 4000 2
4000
4003
4002 4001 2
4001
4003
2001 4000 1
4000...

output:

3001
3001
4000
4001
4002
4003
4003
4002
4001
4000
4002
4000
4001
4000
4000
4000
4000
4003
4001
4002
4003
4000
4001
4002
4002
4000
4000
4002
4002
2001
4003
4002
4002
4000
4001
4002
4001
4002
4002
2001
4000
4002
4001
4002
4001
4000
4002
4002
4001
4002
3001
3001
2001
3001
3001
4002
4002
4002
4003
4000
...

result:

ok 

Test #37:

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

input:

0
10
4 1000000000
0 1
1 2
2 3
4 1000000000
0 1
1 3
3 2
4 1000000000
0 2
2 1
1 3
4 1000000000
0 2
2 3
3 1
4 1000000000
0 3
3 1
1 2
4 1000000000
0 3
3 2
2 1
4 1000000000
1 0
0 2
2 3
4 1000000000
1 0
0 3
3 2
4 1000000000
1 2
2 0
0 3
4 1000000000
1 3
3 0
0 2

output:

4
4000
4001
4002
4003
4
4000
4001
4003
4002
4
4000
4002
4001
4003
4
4000
4003
4001
4002
4
4000
4002
4003
4001
4
4000
4003
4002
4001
4
4000
2001
4002
4003
4
4000
2001
4003
4002
4
4000
3002
3001
4003
4
4000
3002
4003
3001

input:

1
120
4002 4001 2
4001
4003
3002 3001 1
3001
4003 4002 1
4002
4000 4003 1
4001
2001 4003 1
4000
4001 4002 2
4000
4002
4003 3002 1
4000
4000 4002 1
4001
4000 4001 1
4001
4003 4001 1
4002
4002 4000 2
4001
4003
4003 4002 1
4002
4000 4002 2
2001
4002
4002 4003 2
4001
4003
4001 4000 2
4000
4002
3002 4003...

output:

4001
3001
4002
4001
4000
4002
4000
4001
4001
4002
4001
4002
4002
4003
4000
3001
4001
4000
4002
4000
4002
4003
4002
4002
4000
3001
4002
4000
3001
4002
4001
4002
4002
4001
4001
4000
4001
4001
4001
4001
4002
3002
4003
4002
4002
4003
4002
4003
4002
4002
4002
4001
4000
4000
3001
4000
4001
4001
4002
4002
...

result:

ok 

Test #38:

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

input:

0
10
6 1000000000
0 1
1 2
2 3
3 4
4 5
6 1000000000
0 1
1 2
2 3
3 5
5 4
6 1000000000
0 1
1 2
2 4
4 3
3 5
6 1000000000
0 1
1 2
2 4
4 5
5 3
6 1000000000
0 1
1 2
2 5
5 3
3 4
6 1000000000
0 1
1 2
2 5
5 4
4 3
6 1000000000
0 1
1 3
3 2
2 4
4 5
6 1000000000
0 1
1 3
3 2
2 5
5 4
6 1000000000
0 1
1 3
3 4
4 2
2 ...

output:

6
6000
6001
6002
6003
6004
6005
6
6000
6001
6002
6003
6005
6004
6
6000
6001
6002
6004
6003
6005
6
6000
6001
6002
6005
6003
6004
6
6000
6001
6002
6004
6005
6003
6
6000
6001
6002
6005
6004
6003
6
6000
6001
6003
6002
6004
6005
6
6000
6001
6003
6002
6005
6004
6
6000
6001
6004
6002
6003
6005
6
6000
6001
...

input:

1
300
6000 6005 1
6001
6001 6005 2
6000
6002
6002 6001 2
6001
6003
6004 6005 2
6003
6005
6003 6000 2
6002
6004
6000 6001 1
6001
6001 6000 2
6000
6002
6000 6001 1
6001
6000 6001 1
6001
6001 6003 2
6000
6002
6003 6004 2
6002
6004
6000 6004 1
6001
6005 6002 1
6004
6003 6005 2
6002
6004
6000 6001 1
6001...

output:

6001
6002
6001
6005
6002
6001
6000
6001
6001
6002
6004
6001
6004
6004
6001
6003
6001
6003
6001
6004
6003
6002
6003
6002
6004
6002
6003
6001
6001
6002
6001
6003
6000
6004
6000
6004
6000
6002
6004
6002
6002
6002
6001
6002
6005
6001
6004
6003
6003
6004
6001
6001
6003
6004
6003
6003
6001
6002
6001
6003
...

result:

ok 

Test #39:

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

input:

0
3
3 1000000000
0 1
1 2
3 1000000000
0 2
2 1
3 1000000000
1 0
0 2

output:

3
3000
3001
3002
3
3000
3002
3001
3
3000
2001
3002

input:

1
18
3001 3002 2
3000
3002
3001 3000 2
3000
3002
3001 3000 2
3000
3002
3002 3000 1
3001
3002 3000 1
3000
2001 3000 1
3000
3002 3001 1
3001
3002 2001 1
3000
3001 3002 2
3000
3002
3000 2001 2
2001
3002
2001 3002 1
3000
3000 3002 1
3001
3000 3002 1
3001
3000 3001 1
3001
3002 3001 1
3001
3002 3000 1
300...

output:

3002
3000
3000
3001
3000
3000
3001
3000
3002
2001
3000
3001
3001
3001
3001
3001
3001
3002

result:

ok 

Test #40:

score: 10
Accepted
time: 40ms
memory: 3836kb

input:

0
10
4 1000000000
1 3
1 2
0 1
4 1000000000
2 3
3 0
1 3
4 1000000000
2 0
1 3
0 1
4 1000000000
1 2
3 1
1 0
4 1000000000
3 1
0 2
3 2
4 1000000000
2 0
2 1
2 3
4 1000000000
1 2
1 3
2 0
4 1000000000
0 2
2 3
2 1
4 1000000000
2 1
2 0
3 0
4 1000000000
3 0
3 2
1 0

output:

4
4000
4001
4003
3002
4
4000
4003
3002
4001
4
4000
4002
2001
4003
4
4000
4001
3002
4003
4
4000
4003
4001
4002
4
4000
3002
4001
4003
4
4000
4002
4001
4003
4
4000
4003
4001
3002
4
4000
3002
3001
4003
4
4000
4003
3002
3001

input:

1
66674
3002 3001 1
3001
3002 4003 1
4001
4001 3002 3
3002
4000
4003
3002 4003 1
4001
4001 4003 2
4000
4002
4001 3002 3
3002
4000
4003
4000 2001 2
2001
4002
4001 4000 3
3002
4000
4003
4001 3002 3
3002
4000
4003
4001 4002 2
4000
4002
4003 4002 1
4002
4002 2001 2
4000
4003
4000 4003 1
4001
4003 4000 1...

output:

3001
4001
3002
4001
4002
3002
2001
4000
3002
4002
4002
4000
4001
4001
4000
4000
4001
4000
4001
4001
4001
4001
4000
4001
4000
4003
4001
4001
4001
4003
3001
3001
4001
3001
4000
4001
4000
4001
4001
4001
4001
4001
4002
4002
4001
3001
4001
4001
4001
3001
4000
4000
4003
4001
4000
4001
4000
4001
4003
4001
...

result:

ok 

Test #41:

score: 10
Accepted
time: 56ms
memory: 4092kb

input:

0
10
2 1000000000
1 0
2 1000000000
0 1
2 1000000000
1 0
2 1000000000
1 0
2 1000000000
1 0
2 1000000000
0 1
2 1000000000
1 0
2 1000000000
1 0
2 1000000000
1 0
2 1000000000
0 1

output:

2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001

input:

1
100000
2001 2000 1
2000
2001 2000 1
2000
2000 2001 1
2001
2001 2000 1
2000
2000 2001 1
2001
2000 2001 1
2001
2000 2001 1
2001
2001 2000 1
2000
2000 2001 1
2001
2001 2000 1
2000
2001 2000 1
2000
2000 2001 1
2001
2000 2001 1
2001
2001 2000 1
2000
2001 2000 1
2000
2000 2001 1
2001
2000 2001 1
2001
20...

output:

2000
2000
2001
2000
2001
2001
2001
2000
2001
2000
2000
2001
2001
2000
2000
2001
2001
2001
2001
2000
2000
2000
2000
2001
2000
2001
2001
2000
2000
2001
2001
2001
2001
2001
2000
2000
2000
2000
2000
2000
2001
2000
2001
2001
2000
2001
2000
2001
2000
2001
2001
2001
2000
2000
2000
2000
2001
2000
2000
2000
...

result:

ok 

Test #42:

score: 10
Accepted
time: 46ms
memory: 3800kb

input:

0
10
3 1000000000
0 1
0 2
3 1000000000
0 1
0 2
3 1000000000
1 0
2 0
3 1000000000
1 0
0 2
3 1000000000
1 0
2 0
3 1000000000
1 0
2 0
3 1000000000
1 0
0 2
3 1000000000
1 0
2 0
3 1000000000
1 0
0 2
3 1000000000
0 1
0 2

output:

3
3000
2001
3002
3
3000
2001
3002
3
3000
2001
3002
3
3000
2001
3002
3
3000
2001
3002
3
3000
2001
3002
3
3000
2001
3002
3
3000
2001
3002
3
3000
2001
3002
3
3000
2001
3002

input:

1
75040
3002 2001 1
3000
3002 3000 1
3000
2001 3000 1
3000
3000 3002 2
2001
3002
2001 3002 1
3000
2001 3000 1
3000
3000 3002 2
2001
3002
3002 3000 1
3000
2001 3002 1
3000
3000 3002 2
2001
3002
2001 3002 1
3000
3000 2001 2
2001
3002
3000 3002 2
2001
3002
3000 3002 2
2001
3002
3000 2001 2
2001
3002
20...

output:

3000
3000
3000
3002
3000
3000
3002
3000
3000
3002
3000
2001
3002
3002
2001
3000
3000
3002
3000
3000
3000
3002
3002
3000
2001
3000
3000
3000
3000
3000
3000
3002
3000
3000
3000
3000
3002
2001
3000
2001
3000
3000
2001
3000
3000
2001
3002
3000
3000
2001
2001
3000
3000
2001
3000
2001
2001
3002
3000
3000
...

result:

ok 

Test #43:

score: 10
Accepted
time: 42ms
memory: 4092kb

input:

0
10
4 1000000000
0 1
2 0
1 3
4 1000000000
0 1
0 2
3 1
4 1000000000
0 1
0 2
3 1
4 1000000000
0 1
0 2
1 3
4 1000000000
0 1
0 2
3 1
4 1000000000
0 1
0 2
1 3
4 1000000000
0 1
0 2
3 1
4 1000000000
0 1
0 2
3 1
4 1000000000
1 0
0 2
1 3
4 1000000000
0 1
2 0
3 1

output:

4
4000
3001
4003
3002
4
4000
3001
4003
3002
4
4000
3001
4003
3002
4
4000
3001
4003
3002
4
4000
3001
4003
3002
4
4000
3001
4003
3002
4
4000
3001
4003
3002
4
4000
3001
4003
3002
4
4000
3001
4003
3002
4
4000
3001
4003
3002

input:

1
66554
3001 3002 2
3002
4000
4000 3002 2
3001
4003
4003 3001 1
4000
3002 3001 1
3001
4003 3002 1
4000
4000 4003 2
3001
4003
3002 3001 1
3001
3001 3002 2
3002
4000
4003 4000 1
4000
4003 3001 1
4000
3002 3001 1
3001
3002 3001 1
3001
3001 4000 2
3002
4000
3001 4000 2
3002
4000
3001 4003 2
3002
4000
40...

output:

3002
3001
4000
3001
4000
4003
3001
3002
4000
4000
3001
3001
4000
4000
4000
4000
4000
4000
4000
4003
3001
4000
4000
3002
4000
3001
4000
3001
4003
3001
3001
4000
4000
4000
3001
3002
3001
3002
4000
4000
4000
3001
4000
3001
4000
3001
3001
3001
4000
4003
3001
4000
4003
3001
4000
4003
3002
3001
3001
4000
...

result:

ok 

Test #44:

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

input:

0
10
7 1000000000
5 3
6 3
0 3
4 3
1 3
2 3
7 1000000000
3 0
4 0
5 0
1 0
2 0
6 0
7 1000000000
4 0
2 0
3 0
6 0
1 0
5 4
7 1000000000
4 1
0 1
5 1
3 1
2 1
6 4
7 1000000000
3 1
2 1
5 1
4 1
6 1
0 3
7 1000000000
6 3
1 3
0 3
2 3
4 6
5 6
7 1000000000
5 0
4 0
3 0
2 0
6 5
1 5
7 1000000000
0 1
6 1
5 1
3 1
4 0
2 0...

output:

7
7000
6005
7006
7001
5004
3002
4003
7
7000
5004
6005
2001
3002
4003
7006
7
7000
7006
4003
5004
3001
3002
6005
7
7000
7001
7006
6005
4002
5004
4003
7
7000
7002
4003
7001
6005
5004
7006
7
7000
6005
7006
7001
4003
5004
5002
7
7000
4003
7006
6005
5004
4001
3002
7
7000
5001
7006
5004
6005
4003
3002
7
70...

input:

1
420
5002 7006 3
4003
5004
7001
7006 4002 1
7001
3001 5004 2
3002
7000
6005 7000 1
7001
5004 7006 1
7000
3002 7006 1
4001
4003 5004 1
5001
5004 7001 1
5002
5004 6005 1
7001
7002 7006 5
4003
5004
6005
7001
7006
5004 7000 1
7001
7000 7001 1
7001
7001 7000 5
4002
5004
6005
7000
7006
3002 6005 1
3001
3...

output:

7001
7001
7000
7001
7000
4001
5001
5002
7001
7006
7001
7001
7000
3001
5001
7001
7001
7002
7000
5001
7000
7002
7000
3001
7000
7002
7001
7001
7000
7001
7000
5001
7001
7000
7002
7000
5003
7000
4003
4002
7001
6005
7002
3001
5001
7000
5002
7000
5001
7000
7002
7002
5003
7000
7000
7000
3002
7000
7000
7002
...

result:

ok 

Test #45:

score: 10
Accepted
time: 2ms
memory: 4092kb

input:

0
10
7 1000000000
5 6
3 6
1 6
0 6
4 5
2 4
7 1000000000
1 0
2 0
6 0
4 0
5 1
3 5
7 1000000000
1 6
4 6
3 6
2 1
5 1
0 4
7 1000000000
6 5
0 5
3 5
4 6
1 6
2 0
7 1000000000
3 1
0 1
5 1
4 3
2 3
6 0
7 1000000000
3 0
1 0
2 0
5 3
4 3
6 1
7 1000000000
4 0
3 0
2 0
1 4
5 3
6 2
7 1000000000
2 0
5 0
1 0
6 2
3 5
4 6...

output:

7
7000
7006
5004
6005
5003
5002
7001
7
7000
4001
5004
4003
7006
4002
6005
7
7000
6003
5004
7006
7001
6005
7002
7
7000
5004
7006
6005
4003
6001
5002
7
7000
6001
5004
5002
4003
6005
7006
7
7000
6004
7006
4001
4003
3002
6005
7
7000
3002
7005
5003
3001
5004
7006
7
7000
7006
4001
6005
4003
6004
4002
7
70...

input:

1
420
4001 3002 3
3002
4003
7000
5004 5002 1
5002
6003 7006 3
5004
6005
7002
6004 7006 2
6005
7000
7006 6005 1
7002
5004 3002 1
5003
7006 4002 1
7000
6005 7000 1
6004
7000 5003 1
7001
6001 5004 3
5002
6005
7000
6005 7000 1
6001
7000 6001 2
6001
7006
6001 7000 3
5002
6005
7000
6005 7006 1
6004
6004 7...

output:

3002
5002
7002
7000
7002
5003
7000
6004
7001
5002
6001
6001
7000
6004
7000
5003
5002
5002
7000
4001
6003
7003
6003
7001
7000
6001
7001
7000
7002
7000
4002
7000
5002
7000
5004
7006
7001
3002
7000
5002
7001
7006
7003
6004
6005
4002
6004
7000
7000
3001
7003
7003
7001
7002
7000
7003
6004
7000
6003
6001
...

result:

ok 

Test #46:

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

input:

0
10
7 1000000000
0 4
1 4
5 4
3 0
6 3
2 6
7 1000000000
1 4
3 4
0 4
5 1
6 5
2 6
7 1000000000
6 4
1 4
5 6
0 1
3 5
2 0
6 1000000000
3 4
5 4
1 4
0 4
2 4
6 1000000000
3 4
0 4
2 4
1 4
5 4
6 1000000000
2 0
5 0
3 0
4 0
1 2
6 1000000000
4 0
1 0
5 0
3 0
2 4
6 1000000000
2 1
4 1
5 1
3 1
0 2
6 1000000000
5 4
0 ...

output:

7
7000
3002
7006
7004
4001
4003
7005
7
7000
6002
6005
7006
7001
6003
6004
7
7000
6001
7006
6005
6002
6004
6003
6
6000
5004
6005
3002
6001
4003
6
6000
5004
4003
3002
6001
6005
6
6000
3002
3001
5004
6005
4003
6
6000
4003
3002
6005
3001
5004
6
6000
6002
6001
6005
4003
5004
6
6000
6005
5004
4003
6001
50...

input:

1
336
6000 6005 4
3001
4003
5004
6005
6001 6000 5
3002
4003
5004
6000
6005
6003 6004 2
6002
6004
3001 6005 2
3002
6000
6004 6005 2
6003
6005
6000 6001 1
6001
6001 5004 2
6000
6002
6002 6001 4
4003
5004
6001
6005
7004 7005 2
7000
7005
4003 3002 1
6001
6000 6001 1
6001
4003 5004 1
6001
6001 4003 5
300...

output:

6005
6000
6004
6000
6005
6001
6002
6001
7005
6001
6001
6001
4003
6002
6005
7004
7004
6000
7001
6002
6001
6000
6004
6001
6003
3001
7000
6000
6002
6001
5003
5002
7004
6001
6001
3001
6001
6002
6002
3002
7004
7004
6001
6000
5003
6004
6002
6002
6002
5002
7001
7001
6002
6002
7000
5004
6001
6002
6004
4003
...

result:

ok 

Test #47:

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

input:

0
10
6 1000000000
4 0
1 0
3 0
5 4
2 1
6 1000000000
0 3
4 3
1 3
5 0
2 5
6 1000000000
4 2
3 2
1 2
0 4
5 0
6 1000000000
2 1
5 1
0 2
3 5
4 0
5 1000000000
0 4
2 4
3 4
1 4
5 1000000000
4 2
3 2
1 2
0 2
5 1000000000
0 2
4 2
1 2
3 0
5 1000000000
4 2
3 2
1 2
0 4
5 1000000000
3 4
1 4
0 4
2 3
5 1000000000
2 1
4...

output:

6
6000
5003
5004
6005
3001
3002
6
6000
4003
6005
4001
3002
6004
6
6000
5004
5002
4003
5001
6005
6
6000
5002
5001
5004
6005
5003
5
5000
5004
3002
4003
5001
5
5000
5004
5001
4003
3002
5
5000
4003
4001
5004
3002
5
5000
5004
5002
4003
5001
5
5000
5004
4003
4002
5001
5
5000
5002
5003
5004
5001

input:

1
240
4003 5000 1
4002
5000 3002 1
5001
5002 6000 2
5001
5003
5003 5002 2
5002
5004
6000 5001 2
5001
6005
5000 5004 1
5001
4001 5004 3
3002
4003
5000
4003 3002 1
5001
5004 6005 1
5003
4003 4001 1
4001
3002 5004 1
5001
5004 3002 1
5001
5000 5004 1
5001
5001 5003 2
5002
6000
6005 5004 1
6000
5003 3001...

output:

4002
5001
5001
5002
5001
5001
5000
5001
5003
4001
5001
5001
5001
5002
6000
6000
4003
5002
6005
5003
5003
5001
6000
6000
6000
5002
5003
5001
5003
4001
5001
4001
6000
5002
5000
5001
4001
6000
4003
5001
6000
6000
3002
5000
6004
5001
5001
6000
6000
5002
4001
5001
6000
5001
5002
3001
6000
5002
6000
5000
...

result:

ok 

Test #48:

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

input:

0
6
4 1000000000
3 2
1 2
0 2
4 1000000000
1 0
2 0
3 0
4 1000000000
2 3
1 3
0 2
3 1000000000
2 1
0 1
3 1000000000
1 0
2 0
2 1000000000
0 1

output:

4
4000
4003
4001
3002
4
4000
2001
3002
4003
4
4000
4003
4001
4002
3
3000
3001
3002
3
3000
2001
3002
2
2000
2001

input:

1
50
4003 4000 1
4000
2001 3002 1
3000
4003 4002 1
4002
2001 3000 1
3000
4000 3002 1
4001
3000 3002 2
2001
3002
3002 2001 1
3000
3002 4003 1
4001
4001 4003 2
4000
4002
3000 2001 2
2001
3002
4001 4000 3
3002
4000
4003
2001 4000 1
4000
4003 4001 1
4001
3002 4001 1
4001
3002 4000 1
4000
4000 4003 1
400...

output:

4000
3000
4002
3000
4001
3002
3000
4001
4002
2001
4000
4000
4001
4001
4000
4001
4002
3002
2000
4002
4000
4003
2001
3000
3001
4003
4001
4001
2001
4001
3002
4000
4001
4001
4000
4000
4001
4000
4000
4000
4001
4001
3001
3002
4002
4001
3001
3001
4003
3000

result:

ok 

Test #49:

score: 10
Accepted
time: 38ms
memory: 3884kb

input:

0
10
8 1000000000
5 6
4 7
5 1
7 2
0 3
2 1
6 0
8 1000000000
7 6
4 7
7 2
3 7
7 5
1 3
7 0
8 1000000000
0 1
2 0
1 3
4 1
5 2
6 2
7 3
8 1000000000
4 2
6 0
0 1
4 7
1 4
4 3
4 5
8 1000000000
6 0
6 2
6 5
7 6
6 3
6 4
6 1
8 1000000000
7 2
5 7
7 6
1 7
4 7
7 3
7 0
8 1000000000
6 5
7 3
1 2
2 7
0 1
5 3
4 5
8 100000...

output:

8
8000
8004
8005
2001
8007
8003
8002
8006
8
8000
7006
5004
7005
4003
8007
3002
8001
8
8000
5001
8005
4002
5004
7006
8007
4003
8
8000
8002
5004
7006
8003
8007
2001
6005
8
8000
8007
3002
6005
7006
4003
8001
5004
8
8000
6005
3002
8007
7006
4003
5004
8001
8
8000
8001
8002
8004
8007
8005
7006
8003
8
8000...

input:

1
57240
8007 8003 1
8003
8001 8007 2
8000
8002
8002 8005 2
8000
8003
8007 8002 1
8006
8007 7006 1
8003
7006 8007 1
8001
7006 6005 1
7001
7006 8003 1
8003
8007 8000 1
8006
5004 3002 1
8001
8007 8001 1
8001
8000 8001 1
8001
8005 8001 3
7006
8004
8007
8000 7006 1
8001
8003 8004 2
8002
8004
3002 7006 1
...

output:

8003
8002
8003
8006
8003
8001
7001
8003
8006
8001
8001
8001
8004
8001
8004
8001
5001
8005
8005
8001
8001
8003
8001
6005
8004
6002
8003
8003
6002
8006
8004
8004
8001
8003
8001
8005
8003
8007
8001
8005
8001
8001
8001
8004
8001
8001
8002
8001
8001
8001
8004
8000
6005
8005
8002
8003
8001
8004
8001
8001
...

result:

ok 

Test #50:

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

input:

0
10
8 1000000000
1 3
4 1
0 1
6 1
1 2
1 7
5 1
8 1000000000
4 0
2 0
5 4
3 5
7 2
1 6
0 1
8 1000000000
0 5
6 2
0 6
3 6
4 5
1 4
4 7
8 1000000000
5 1
5 7
3 0
2 3
3 1
7 4
3 6
8 1000000000
2 4
0 1
5 3
1 2
7 0
4 3
5 6
8 1000000000
6 5
1 2
0 3
6 1
2 4
3 4
7 0
8 1000000000
3 6
5 0
4 0
0 6
7 0
1 3
2 0
8 100000...

output:

8
8000
8001
6005
3002
4003
8007
5004
7006
8
8000
8006
6004
4003
4001
4002
8007
6005
8
8000
4003
7006
8007
5002
5001
8005
5004
8
8000
7003
3002
8001
7006
7004
8007
7005
8
8000
7001
7002
7004
7003
7005
7006
8007
8
8000
7004
7003
7001
7002
7006
7005
8007
8
8000
6005
8007
6004
3002
2001
6003
7006
8
8000...

input:

1
56820
8007 6004 1
8006
5004 3002 1
8001
8007 7002 1
8000
8002 7006 6
4003
5004
6005
7006
8001
8007
8005 8007 3
7006
8000
8007
8000 7005 1
8001
5002 5004 3
4003
5001
5004
7004 7002 2
7003
7005
6005 8000 1
8001
8007 4003 1
8005
6005 6004 1
6004
5004 3002 1
8001
7006 7003 1
7005
7006 5004 1
8001
6005...

output:

8006
8001
8000
7006
8007
8001
5004
7003
8001
8005
6004
8001
7005
8001
8002
7001
5002
8005
8000
8001
8001
7004
8001
8001
7002
5001
8001
8001
5004
7006
5001
6004
7002
8001
6004
5004
8000
7003
7004
8002
8001
8001
8001
5001
7001
8005
8000
8001
8000
8001
7001
8001
8005
8001
7005
8001
8001
3001
8001
8006
...

result:

ok 

Test #51:

score: 10
Accepted
time: 38ms
memory: 3804kb

input:

0
10
8 1000000000
2 7
4 2
5 3
1 6
0 1
1 4
3 7
8 1000000000
4 2
0 4
4 5
4 1
4 6
4 7
4 3
8 1000000000
0 7
5 3
5 1
2 3
1 4
0 6
6 4
8 1000000000
6 4
5 4
4 0
4 1
2 0
7 4
4 3
8 1000000000
0 6
4 0
1 7
5 7
7 2
6 3
4 2
8 1000000000
3 1
3 6
5 0
4 7
2 4
2 5
1 0
8 1000000000
4 7
6 5
7 5
5 3
0 7
1 5
2 7
8 100000...

output:

8
8000
8001
8004
8006
8003
8007
3002
8005
8
8000
5004
3002
8007
8001
4003
6005
7006
8
8000
8004
8007
8006
8003
8005
8002
2001
8
8000
5004
8007
7006
7001
4003
3002
6005
8
8000
7006
8004
3002
8003
8007
3001
8005
8
8000
8005
5002
8006
5003
5001
8007
5004
8
8000
7006
8007
6005
3002
7003
5004
8001
8
8000...

input:

1
57000
7006 6002 1
8001
8000 8006 2
5001
8005
6005 5004 1
6002
5002 8000 2
5001
5003
8007 4003 1
8001
7006 6005 1
8001
8001 3002 3
3002
8000
8003
8001 8007 4
6002
7006
8000
8007
8005 8004 3
7006
8004
8007
3001 8007 2
3002
8000
3002 8004 1
8001
3001 8007 2
3002
8000
4003 5004 1
7001
8000 4003 1
8001...

output:

8001
8005
6002
5001
8001
8001
3002
8007
8004
8000
8001
8000
7001
8001
7001
8000
8004
8005
8000
7001
8001
8003
5003
8001
8005
5001
8001
8000
8007
8000
8000
4002
3002
8001
8001
8001
8005
8007
8001
8000
8001
4002
8004
5003
4002
5001
8001
8001
5002
6002
4001
8001
7001
8005
5003
8001
6002
7001
8001
8004
...

result:

ok 

Test #52:

score: 10
Accepted
time: 36ms
memory: 4060kb

input:

0
10
8 1000000000
2 7
4 2
5 3
1 6
0 1
1 4
3 7
8 1000000000
4 2
0 4
4 5
4 1
4 6
4 7
4 3
8 1000000000
0 7
5 3
5 1
2 3
1 4
0 6
6 4
8 1000000000
6 4
5 4
4 0
4 1
2 0
7 4
4 3
8 1000000000
0 6
4 0
1 7
5 7
7 2
6 3
4 2
8 1000000000
3 1
3 6
5 0
4 7
2 4
2 5
1 0
8 1000000000
4 7
6 5
7 5
5 3
0 7
1 5
2 7
8 100000...

output:

8
8000
8001
8004
8006
8003
8007
3002
8005
8
8000
5004
3002
8007
8001
4003
6005
7006
8
8000
8004
8007
8006
8003
8005
8002
2001
8
8000
5004
8007
7006
7001
4003
3002
6005
8
8000
7006
8004
3002
8003
8007
3001
8005
8
8000
8005
5002
8006
5003
5001
8007
5004
8
8000
7006
8007
6005
3002
7003
5004
8001
8
8000...

input:

1
57000
7006 6002 1
8001
8000 8006 2
5001
8005
6005 5004 1
6002
5002 8000 2
5001
5003
8007 4003 1
8001
7006 6005 1
8001
8001 3002 3
3002
8000
8003
8001 8007 4
6002
7006
8000
8007
8005 8004 3
7006
8004
8007
3001 8007 2
3002
8000
3002 8004 1
8001
3001 8007 2
3002
8000
4003 5004 1
7001
8000 4003 1
8001...

output:

8001
8005
6002
5001
8001
8001
3002
8007
8004
8000
8001
8000
7001
8001
7001
8000
8004
8005
8000
7001
8001
8003
5003
8001
8005
5001
8001
8000
8007
8000
8000
4002
3002
8001
8001
8001
8005
8007
8001
8000
8001
4002
8004
5003
4002
5001
8001
8001
5002
6002
4001
8001
7001
8005
5003
8001
6002
7001
8001
8004
...

result:

ok 

Test #53:

score: 10
Accepted
time: 30ms
memory: 3736kb

input:

0
10
8 1000000000
2 7
4 2
5 3
1 6
0 1
1 4
3 7
8 1000000000
4 2
0 4
4 5
4 1
4 6
4 7
4 3
8 1000000000
0 7
5 3
5 1
2 3
1 4
0 6
6 4
8 1000000000
6 4
5 4
4 0
4 1
2 0
7 4
4 3
8 1000000000
0 6
4 0
1 7
5 7
7 2
6 3
4 2
8 1000000000
3 1
3 6
5 0
4 7
2 4
2 5
1 0
8 1000000000
4 7
6 5
7 5
5 3
0 7
1 5
2 7
8 100000...

output:

8
8000
8001
8004
8006
8003
8007
3002
8005
8
8000
5004
3002
8007
8001
4003
6005
7006
8
8000
8004
8007
8006
8003
8005
8002
2001
8
8000
5004
8007
7006
7001
4003
3002
6005
8
8000
7006
8004
3002
8003
8007
3001
8005
8
8000
8005
5002
8006
5003
5001
8007
5004
8
8000
7006
8007
6005
3002
7003
5004
8001
8
8000...

input:

1
57000
7006 6002 1
8001
8000 8006 2
5001
8005
6005 5004 1
6002
5002 8000 2
5001
5003
8007 4003 1
8001
7006 6005 1
8001
8001 3002 3
3002
8000
8003
8001 8007 4
6002
7006
8000
8007
8005 8004 3
7006
8004
8007
3001 8007 2
3002
8000
3002 8004 1
8001
3001 8007 2
3002
8000
4003 5004 1
7001
8000 4003 1
8001...

output:

8001
8005
6002
5001
8001
8001
3002
8007
8004
8000
8001
8000
7001
8001
7001
8000
8004
8005
8000
7001
8001
8003
5003
8001
8005
5001
8001
8000
8007
8000
8000
4002
3002
8001
8001
8001
8005
8007
8001
8000
8001
4002
8004
5003
4002
5001
8001
8001
5002
6002
4001
8001
7001
8005
5003
8001
6002
7001
8001
8004
...

result:

ok 

Subtask #5:

score: 26.3167
Acceptable Answer

Test #54:

score: 26.3167
Acceptable Answer
time: 42ms
memory: 3780kb

input:

0
10
3 1000000000
1 0
2 1
998 1000000000
928 443
90 795
55 379
957 417
759 300
960 136
309 858
833 370
228 827
876 955
619 365
15 108
243 388
54 925
141 894
272 634
0 989
600 346
380 277
350 113
326 613
975 946
660 98
34 538
220 864
9 585
185 860
458 424
509 14
22 275
109 872
153 233
76 834
972 736
...

output:

3
3000
3001
3002
998
998000
998335
998316
998714
998920
204140
998630
998933
998216
998527
204182
998685
998236
998715
998631
998880
204174
204128
998921
204052
998385
204089
998748
998560
998574
204062
204185
998948
998364
998634
998258
998946
998620
998816
998537
998257
998439
998719
998796
998282...

input:

1
59797
4002 4003 2
4001
4003
760532 760626 2
760531
760533
2001 2000 1
2000
100084 100051 2
100083
100085
488214 999920 2
488213
488215
4001 4000 2
4000
4002
4001 4003 2
4000
4002
998321 998617 2
998320
998322
999944 999542 2
999943
999945
997575 997725 2
997574
997576
2000 2001 1
2001
760503 76051...

output:

4003
760533
2000
100083
488213
4000
4002
998322
999943
997576
2001
760504
760396
998251
3000
997330
1000516
100026
10009
1000176
1000941
2000
4001
999561
204189
1000905
999832
1000948
998652
2001
3000
1000214
997230
3001
760017
100031
204094
1000987
100068
2000
3001
2001
999741
997275
2000
760647
10...

result:

points 0.43142198430 max label = 1000999

Test #55:

score: 26.3167
Acceptable Answer
time: 36ms
memory: 3800kb

input:

0
10
997 1000000000
210 799
337 790
66 160
541 810
854 650
948 726
189 923
593 566
649 647
907 215
598 271
78 173
820 920
364 470
435 553
634 846
276 104
203 761
874 954
20 983
946 834
365 933
37 641
811 497
970 551
42 389
59 52
747 45
35 291
534 616
284 677
215 83
741 600
549 680
58 500
495 489
664...

output:

997
997000
266246
266245
997327
997857
997406
997918
997323
266058
997354
997972
266112
266242
997824
997562
997596
266006
997400
997756
997876
997688
266061
266186
997683
997655
997813
997906
997332
997926
997358
997527
997605
997856
997339
997567
997754
997953
997872
997366
266106
997878
997388
99...

input:

1
50045
778435 991793 2
778434
778436
755634 755670 2
755633
755635
998568 998927 2
998567
998569
992535 992259 2
992534
992536
997776 997348 2
997775
997777
755379 755596 2
755378
755380
755475 755682 2
755474
755476
1000576 1000492 2
1000575
1000577
592345 999732 2
592344
592346
604260 995868 2
60...

output:

778434
755635
998569
992534
997775
755380
755476
1000575
592344
604259
998701
755345
992834
1000734
992758
999776
999874
998621
1000448
778752
998804
998276
996796
995987
997847
232193
755552
778301
755286
1000585
579514
1000278
266252
565490
565067
266120
119085
604104
604485
565371
579073
997000
9...

result:

points 0.43142198430 max label = 1000999

Test #56:

score: 49.9981
Acceptable Answer
time: 54ms
memory: 3804kb

input:

0
10
2 1000000000
0 1
2 1000000000
0 1
2 1000000000
0 1
2 1000000000
0 1
2 1000000000
1 0
2 1000000000
0 1
2 1000000000
0 1
2 1000000000
1 0
2 1000000000
1 0
2 1000000000
1 0

output:

2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001

input:

1
100000
2000 2001 1
2001
2000 2001 1
2001
2000 2001 1
2001
2001 2000 1
2000
2000 2001 1
2001
2000 2001 1
2001
2000 2001 1
2001
2000 2001 1
2001
2000 2001 1
2001
2000 2001 1
2001
2001 2000 1
2000
2000 2001 1
2001
2001 2000 1
2000
2000 2001 1
2001
2001 2000 1
2000
2001 2000 1
2000
2000 2001 1
2001
20...

output:

2001
2001
2001
2000
2001
2001
2001
2001
2001
2001
2000
2001
2000
2001
2000
2000
2001
2001
2000
2001
2001
2001
2000
2000
2000
2000
2000
2000
2001
2001
2000
2001
2001
2001
2001
2000
2001
2000
2001
2001
2000
2001
2000
2001
2000
2001
2001
2001
2001
2001
2000
2001
2000
2000
2001
2001
2000
2001
2000
2001
...

result:

points 0.81964090710 max label = 2001

Test #57:

score: 48.4525
Acceptable Answer
time: 44ms
memory: 3836kb

input:

0
10
3 1000000000
0 2
1 0
3 1000000000
1 0
2 1
3 1000000000
2 1
0 1
3 1000000000
2 0
0 1
3 1000000000
0 1
2 1
3 1000000000
1 2
0 2
3 1000000000
0 2
2 1
3 1000000000
1 0
2 1
3 1000000000
0 2
0 1
3 1000000000
2 0
1 0

output:

3
3000
3002
2001
3
3000
3001
3002
3
3000
3001
3002
3
3000
3002
2001
3
3000
3001
3002
3
3000
3002
3001
3
3000
3002
3001
3
3000
3001
3002
3
3000
3002
2001
3
3000
3002
2001

input:

1
74928
3000 3002 1
3001
3000 3002 1
3001
3001 3000 2
3000
3002
3002 3001 1
3001
3002 3000 1
3001
3002 3000 1
3001
2001 3002 1
3000
3002 3001 1
3001
3000 3002 2
2001
3002
3002 3000 1
3000
3002 2001 1
3000
3000 3001 1
3001
3002 3000 1
3001
3001 3002 2
3000
3002
3002 2001 1
3000
3002 3000 1
3001
3000 ...

output:

3001
3001
3000
3001
3001
3001
3000
3001
3002
3000
3000
3001
3001
3002
3000
3001
3001
3002
3000
3000
3001
3002
3002
3001
3000
3001
3001
3001
3002
3001
2001
3001
3001
3001
3000
3000
3001
3001
3002
2001
3001
3001
3000
3001
3002
3001
3002
3000
3001
3001
3001
3000
3001
3002
3000
3000
3002
3001
3000
3001
...

result:

points 0.79430362810 max label = 3002

Test #58:

score: 47.3561
Acceptable Answer
time: 42ms
memory: 3804kb

input:

0
10
4 1000000000
1 2
0 2
1 3
4 1000000000
3 0
1 2
0 1
4 1000000000
2 3
3 0
0 1
4 1000000000
2 3
1 2
0 3
4 1000000000
1 3
0 3
2 0
4 1000000000
3 0
3 2
1 0
4 1000000000
3 1
0 1
2 3
4 1000000000
1 0
3 0
1 2
4 1000000000
3 1
2 3
1 0
4 1000000000
0 1
3 0
1 2

output:

4
4000
4002
4001
4003
4
4000
4002
4003
2001
4
4000
4003
3002
3001
4
4000
4003
4002
4001
4
4000
3002
4003
3001
4
4000
4003
3002
3001
4
4000
4001
4003
4002
4
4000
3001
3002
4003
4
4000
4001
4003
4002
4
4000
3001
3002
4003

input:

1
66734
3002 4000 1
3001
4002 4001 2
4001
4003
3001 3002 2
3002
4000
4002 4000 2
4000
4003
3001 3002 2
3002
4000
4002 4000 2
4001
4003
3001 4000 2
3002
4000
4002 4001 2
4001
4003
4000 3002 2
3001
4003
3002 4003 1
3001
3002 4000 1
3001
4000 3001 2
3001
4003
3002 3001 1
3001
4000 3002 2
3001
4003
4002...

output:

3001
4001
3002
4000
3002
4001
4000
4001
3001
3001
3001
3001
3001
3001
4000
4000
4002
4002
4001
4002
4000
3001
3001
4000
4002
3001
4000
4001
4003
4000
4002
4000
4001
4001
4000
4002
4002
3001
4000
4000
4000
3001
4000
4002
4002
4000
4000
4000
4003
4000
3001
4003
4000
4002
4002
4000
4001
4000
2001
4000
...

result:

points 0.77632872310 max label = 4003

Test #59:

score: 26.3167
Acceptable Answer
time: 30ms
memory: 3808kb

input:

0
10
1000 1000000000
313 401
316 54
721 11
679 942
681 467
84 472
977 306
285 19
891 45
654 702
294 627
927 124
583 515
700 300
401 460
521 643
911 738
818 7
895 746
370 781
405 64
904 359
22 187
609 408
363 713
768 965
345 943
512 10
149 608
438 998
642 108
680 783
648 653
592 351
79 477
759 16
430...

output:

1000
1000000
1000719
504388
1000683
1000553
1000509
1000889
504448
504122
504386
1000954
1000634
504056
504464
504145
1000813
1000505
1000682
1000959
504411
1000678
504479
1000994
504271
1000533
504294
504272
1000896
1000626
1000838
504378
504104
1000921
1000932
504232
1000603
504366
1000513
504471
...

input:

1
50038
1000618 1000631 2
1000617
1000619
1000678 1000709 2
1000677
1000679
954083 954516 2
954082
954084
1000918 1000799 2
1000917
1000919
954334 1000977 2
954333
954335
954719 954786 2
954718
954720
1000952 1000690 2
1000951
1000953
1000529 1000242 2
1000528
1000530
1000391 1000345 2
1000390
10003...

output:

1000619
1000679
954084
1000917
954333
954720
1000951
1000528
1000390
1000609
1000538
1000610
1000966
1000314
253027
371024
954270
1000927
1000828
1000685
1000668
1000517
380356
504304
954611
371219
1000160
1000377
1000046
1000919
504232
1000715
371239
1000313
1000972
1000409
1000810
1000809
1000283
...

result:

points 0.43142198430 max label = 1000999

Test #60:

score: 26.3167
Acceptable Answer
time: 40ms
memory: 4040kb

input:

0
1
1000 1000000000
165 608
217 371
579 924
67 365
865 568
258 7
999 657
669 881
268 354
140 308
76 139
428 750
616 661
178 737
179 1
705 411
437 759
119 472
353 50
549 581
327 276
319 864
662 404
619 776
651 890
153 938
580 396
501 193
560 607
786 871
291 760
898 722
511 542
743 74
742 918
431 774
...

output:

1000
1000000
558053
558159
558058
1000981
558376
558398
558017
1000881
1000580
1000987
558253
558243
558350
558200
1000598
1000749
1000649
558067
558417
558209
1000858
558250
558105
558452
558161
1000776
558370
1000835
558330
558314
558010
1000971
558290
558493
1000923
558266
558316
558262
1000901
1...

input:

1
50048
558015 558070 2
558014
558016
1000780 558507 2
1000779
1000781
558335 1000596 2
558334
558336
558397 558025 2
558396
558398
1000565 558476 2
1000564
1000566
558423 558485 2
558422
558424
1000739 558059 2
1000738
1000740
558040 1000852 2
558039
558041
558004 558543 2
558003
558005
1000667 100...

output:

558016
1000779
558334
558396
1000564
558424
1000738
558039
558005
1000668
558184
558398
1000708
558200
558526
558367
558163
558396
1000686
1000880
558444
558228
1000926
1000685
558002
558492
558076
558413
1000977
558513
558440
1000688
1000710
558115
1000859
558548
558223
558191
1000955
1000762
10009...

result:

points 0.43142198430 max label = 1000999

Test #61:

score: 47.3561
Acceptable Answer
time: 0ms
memory: 3776kb

input:

0
10
4 1000000000
0 1
1 2
2 3
4 1000000000
0 1
1 3
3 2
4 1000000000
0 2
2 1
1 3
4 1000000000
0 2
2 3
3 1
4 1000000000
0 3
3 1
1 2
4 1000000000
0 3
3 2
2 1
4 1000000000
1 0
0 2
2 3
4 1000000000
1 0
0 3
3 2
4 1000000000
1 2
2 0
0 3
4 1000000000
1 3
3 0
0 2

output:

4
4000
4001
4002
4003
4
4000
4001
4003
4002
4
4000
4002
4001
4003
4
4000
4003
4001
4002
4
4000
4002
4003
4001
4
4000
4003
4002
4001
4
4000
2001
4002
4003
4
4000
2001
4003
4002
4
4000
3002
3001
4003
4
4000
3002
4003
3001

input:

1
120
4003 2001 1
4002
4001 4003 2
4000
4002
4003 4001 1
4002
4000 4002 1
4001
4003 4001 1
4002
4000 4003 2
3001
4003
4001 4002 2
4000
4002
3001 3002 2
3002
4000
2001 4000 1
4000
4003 4000 1
4002
4000 4003 1
4001
4002 4001 2
4001
4003
4001 4002 2
4000
4002
4002 2001 2
4000
4003
4000 4001 1
4001
4001...

output:

4002
4002
4002
4001
4002
4003
4002
3002
4000
4002
4001
4001
4002
4000
4001
4000
4001
4001
4000
4001
3001
4000
4001
4001
4000
3001
4000
4000
4003
2001
4002
4002
4000
4003
3001
4001
3002
4002
4002
4001
4001
4002
4000
4002
4000
4002
4002
4003
4002
4001
4001
4000
4001
3001
4003
4000
4002
4000
4002
3001
...

result:

points 0.77632872310 max label = 4003

Test #62:

score: 45.8108
Acceptable Answer
time: 0ms
memory: 3804kb

input:

0
10
6 1000000000
0 1
1 2
2 3
3 4
4 5
6 1000000000
0 1
1 2
2 3
3 5
5 4
6 1000000000
0 1
1 2
2 4
4 3
3 5
6 1000000000
0 1
1 2
2 4
4 5
5 3
6 1000000000
0 1
1 2
2 5
5 3
3 4
6 1000000000
0 1
1 2
2 5
5 4
4 3
6 1000000000
0 1
1 3
3 2
2 4
4 5
6 1000000000
0 1
1 3
3 2
2 5
5 4
6 1000000000
0 1
1 3
3 4
4 2
2 ...

output:

6
6000
6001
6002
6003
6004
6005
6
6000
6001
6002
6003
6005
6004
6
6000
6001
6002
6004
6003
6005
6
6000
6001
6002
6005
6003
6004
6
6000
6001
6002
6004
6005
6003
6
6000
6001
6002
6005
6004
6003
6
6000
6001
6003
6002
6004
6005
6
6000
6001
6003
6002
6005
6004
6
6000
6001
6004
6002
6003
6005
6
6000
6001
...

input:

1
300
6000 6003 1
6001
6004 6001 2
6003
6005
6001 6003 2
6000
6002
6002 6000 2
6001
6003
6000 6005 1
6001
6005 6002 1
6004
6004 6002 2
6003
6005
6001 6003 2
6000
6002
6005 6003 1
6004
6004 6000 2
6003
6005
6000 6002 1
6001
6004 6000 2
6003
6005
6004 6000 2
6003
6005
6001 6004 2
6000
6002
6002 6004 2...

output:

6001
6003
6002
6001
6001
6004
6003
6002
6004
6003
6001
6003
6003
6002
6003
6003
6004
6005
6001
6001
6003
6004
6001
6001
6001
6002
6001
6004
6001
6003
6004
6003
6002
6001
6003
6004
6003
6004
6001
6001
6003
6004
6001
6004
6004
6000
6002
6004
6000
6003
6001
6001
6002
6001
6003
6002
6002
6004
6002
6002
...

result:

points 0.75099664750 max label = 6005

Test #63:

score: 48.4525
Acceptable Answer
time: 0ms
memory: 3836kb

input:

0
3
3 1000000000
0 1
1 2
3 1000000000
0 2
2 1
3 1000000000
1 0
0 2

output:

3
3000
3001
3002
3
3000
3002
3001
3
3000
2001
3002

input:

1
18
3001 3000 2
3000
3002
2001 3000 1
3000
3001 3002 2
3000
3002
3000 3001 1
3001
3002 3000 1
3001
3000 3001 1
3001
3000 2001 2
2001
3002
3001 3000 2
3000
3002
3002 3001 1
3001
3002 3000 1
3000
3001 3002 2
3000
3002
2001 3002 1
3000
3000 3002 1
3001
3000 3002 1
3001
3002 3001 1
3001
3000 3002 2
200...

output:

3000
3000
3002
3001
3001
3001
2001
3000
3001
3000
3002
3000
3001
3001
3001
3002
3001
3000

result:

points 0.79430362810 max label = 3002

Test #64:

score: 26.3167
Acceptable Answer
time: 38ms
memory: 4104kb

input:

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

output:

997
997000
512001
997512
257002
512257
768513
997768
130003
257130
385258
512385
641514
768641
896769
997896
67004
130067
194131
257194
322259
385322
449386
512449
578515
641578
705642
768705
833770
896833
960897
997960
36005
67036
99068
130099
163132
194163
226195
257226
291260
322291
354323
385354...

input:

1
49888
722707 395394 3
715708
722715
737706
184183 378375 1
184181
776775 208207 1
777774
752751 403396 1
753750
478475 694693 3
477476
478477
481474
481450 801800 3
466451
481466
512449
225224 822821 1
226223
975962 571564 3
970963
975970
982961
950949 287286 1
950947
547544 938935 3
546545
547540...

output:

737706
184181
777774
753750
481474
512449
226223
982961
950947
547540
497490
588581
896893
896769
649646
865862
487484
36005
459452
26023
509506
418387
984981
945942
322307
753750
768705
929914
575572
960897
172165
982978
276269
67036
960957
242235
456453
896889
768513
242235
466463
802787
194187
68...

result:

points 0.43142198430 max label = 1000999

Test #65:

score: 26.3167
Acceptable Answer
time: 44ms
memory: 4096kb

input:

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

output:

512
512000
257001
512257
130002
257130
385258
512385
67003
130067
194131
257194
322259
385322
449386
512449
36004
67036
99068
130099
163132
194163
226195
257226
291260
322291
354323
385354
418387
449418
481450
512481
21005
36021
52037
67052
84069
99084
115100
130115
148133
163148
179164
194179
21119...

input:

1
59652
10009 25022 1
10007
249248 418411 1
250247
3002 4003 1
3001
2000 2001 1
2001
94093 27020 1
94091
3001 3002 2
3002
4000
2000 2001 1
2001
2001 2000 1
2000
2000 2001 1
2001
496481 234227 3
489482
496489
511480
304301 474473 3
303302
304303
307300
34002 81080 3
19003
34019
65001
3002 3000 1
3000...

output:

10007
250247
3001
2001
94091
3002
2001
2000
2001
511480
307300
65001
3000
641578
96093
9006
2001
39036
128065
130127
104101
3001
3000
396389
9002
194131
25018
31028
17014
2001
299292
3000
2001
3002
256241
4000
2001
17010
148141
3000
129126
65062
22019
667660
410407
3001
4000
67060
2001
3002
3001
740...

result:

points 0.43142198430 max label = 1000999

Test #66:

score: 49.9981
Acceptable Answer
time: 54ms
memory: 3820kb

input:

0
10
2 1000000000
0 1
2 1000000000
1 0
2 1000000000
0 1
2 1000000000
1 0
2 1000000000
0 1
2 1000000000
1 0
2 1000000000
1 0
2 1000000000
1 0
2 1000000000
0 1
2 1000000000
1 0

output:

2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001
2
2000
2001

input:

1
100000
2001 2000 1
2000
2001 2000 1
2000
2000 2001 1
2001
2000 2001 1
2001
2000 2001 1
2001
2000 2001 1
2001
2000 2001 1
2001
2000 2001 1
2001
2001 2000 1
2000
2001 2000 1
2000
2000 2001 1
2001
2000 2001 1
2001
2000 2001 1
2001
2000 2001 1
2001
2000 2001 1
2001
2000 2001 1
2001
2001 2000 1
2000
20...

output:

2000
2000
2001
2001
2001
2001
2001
2001
2000
2000
2001
2001
2001
2001
2001
2001
2000
2000
2001
2000
2000
2001
2000
2000
2001
2000
2001
2001
2000
2001
2000
2000
2000
2001
2000
2000
2000
2001
2001
2000
2000
2001
2000
2001
2000
2000
2000
2000
2001
2001
2000
2001
2001
2001
2000
2000
2001
2000
2001
2000
...

result:

points 0.81964090710 max label = 2001

Test #67:

score: 48.4525
Acceptable Answer
time: 44ms
memory: 3804kb

input:

0
10
3 1000000000
1 0
2 0
3 1000000000
0 1
2 0
3 1000000000
1 0
0 2
3 1000000000
1 0
2 0
3 1000000000
1 0
0 2
3 1000000000
0 1
2 0
3 1000000000
1 0
0 2
3 1000000000
1 0
2 0
3 1000000000
0 1
0 2
3 1000000000
1 0
0 2

output:

3
3000
2001
3002
3
3000
2001
3002
3
3000
2001
3002
3
3000
2001
3002
3
3000
2001
3002
3
3000
2001
3002
3
3000
2001
3002
3
3000
2001
3002
3
3000
2001
3002
3
3000
2001
3002

input:

1
74942
2001 3000 1
3000
2001 3000 1
3000
3000 3002 2
2001
3002
3000 3002 2
2001
3002
2001 3000 1
3000
2001 3000 1
3000
3002 3000 1
3000
2001 3000 1
3000
2001 3000 1
3000
2001 3002 1
3000
2001 3000 1
3000
2001 3002 1
3000
3002 3000 1
3000
3000 2001 2
2001
3002
3000 2001 2
2001
3002
3002 3000 1
3000
...

output:

3000
3000
3002
3002
3000
3000
3000
3000
3000
3000
3000
3000
3000
2001
2001
3000
2001
3002
3000
2001
3000
3000
3000
3000
3000
3002
3002
3000
3000
3000
3000
3000
3000
3000
2001
3000
3000
3002
3000
2001
2001
3000
2001
3000
3002
3000
3000
3002
3002
3000
3000
3000
3000
2001
3002
3000
3000
2001
2001
2001
...

result:

points 0.79430362810 max label = 3002

Test #68:

score: 47.3561
Acceptable Answer
time: 42ms
memory: 3800kb

input:

0
10
4 1000000000
1 0
2 0
3 1
4 1000000000
0 1
0 2
1 3
4 1000000000
0 1
2 0
3 1
4 1000000000
0 1
2 0
3 1
4 1000000000
0 1
0 2
3 1
4 1000000000
1 0
2 0
1 3
4 1000000000
1 0
0 2
1 3
4 1000000000
0 1
0 2
3 1
4 1000000000
1 0
0 2
3 1
4 1000000000
1 0
2 0
3 1

output:

4
4000
3001
4003
3002
4
4000
3001
4003
3002
4
4000
3001
4003
3002
4
4000
3001
4003
3002
4
4000
3001
4003
3002
4
4000
3001
4003
3002
4
4000
3001
4003
3002
4
4000
3001
4003
3002
4
4000
3001
4003
3002
4
4000
3001
4003
3002

input:

1
66795
4000 3001 2
3001
4003
4003 4000 1
4000
3001 4000 2
3002
4000
4000 3001 2
3001
4003
3001 4003 2
3002
4000
4003 3001 1
4000
4000 4003 2
3001
4003
4000 3001 2
3001
4003
4000 4003 2
3001
4003
4000 3002 2
3001
4003
3002 4003 1
3001
4000 3002 2
3001
4003
3002 4000 1
3001
3001 4003 2
3002
4000
4003...

output:

3001
4000
4000
3001
4000
4000
4003
3001
4003
3001
3001
3001
3001
4000
4000
3001
3001
3001
4000
3001
4000
3001
4000
3001
3001
3002
3002
3001
4000
4000
4000
4000
3002
3001
3001
3001
3001
3001
4003
4000
3002
3001
3002
3001
4000
3001
4003
4000
4000
4000
4000
3001
3001
3001
4003
3001
4000
4000
4003
3001
...

result:

points 0.77632872310 max label = 4003

Test #69:

score: 26.3167
Acceptable Answer
time: 38ms
memory: 4092kb

input:

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

output:

1000
1000000
512001
1000512
257002
512257
768513
1000768
130003
257130
385258
512385
641514
768641
896769
1000896
67004
130067
194131
257194
322259
385322
449386
512449
578515
641578
705642
768705
833770
896833
960897
1000960
36005
67036
99068
130099
163132
194163
226195
257226
291260
322291
354323
...

input:

1
50098
737722 431428 3
730723
737706
737730
546545 840839 1
547544
757756 281280 1
758755
193192 765764 1
194191
172171 742741 1
172169
977974 714713 3
976975
977970
977976
571570 913912 1
571568
807806 362361 1
808805
77076 269268 1
77074
67004 606605 3
36005
67036
130003
577576 370369 1
578575
43...

output:

737706
547544
758755
194191
172169
977970
571568
808805
77074
130003
578575
431428
247244
768513
865850
138135
466451
67060
512505
26023
247244
478475
850835
112109
734731
746743
1000997
950947
626619
563556
719716
336333
768513
737722
641626
45038
211204
291276
439436
291260
148133
652645
276273
64...

result:

points 0.43142198430 max label = 1000999

Test #70:

score: 47.3561
Acceptable Answer
time: 40ms
memory: 3748kb

input:

0
10
4 1000000000
1 0
0 3
0 2
4 1000000000
2 0
3 1
3 2
4 1000000000
1 2
2 3
2 0
4 1000000000
2 3
0 3
1 2
4 1000000000
2 0
1 2
3 2
4 1000000000
1 0
2 3
0 3
4 1000000000
3 2
2 1
3 0
4 1000000000
2 3
1 3
0 3
4 1000000000
0 2
0 1
3 2
4 1000000000
0 2
1 2
3 2

output:

4
4000
2001
4003
3002
4
4000
4003
4001
4002
4
4000
3002
4001
4003
4
4000
4003
4002
4001
4
4000
3002
4001
4003
4
4000
2001
4003
4002
4
4000
4003
4002
4001
4
4000
4003
3002
4001
4
4000
4003
3001
3002
4
4000
3002
4001
4003

input:

1
66444
4002 4001 2
4001
4003
4001 4003 2
4000
4002
4003 2001 1
4002
4000 4003 1
4001
4001 4000 3
3002
4000
4003
4002 4003 2
4001
4003
4003 4001 1
4001
4003 4000 1
4002
4003 4002 1
4002
4001 3002 3
3002
4000
4003
4000 4002 1
4001
4000 4003 2
3001
4003
3002 2001 1
4000
4003 4002 1
4002
3002 2001 1
40...

output:

4001
4002
4002
4001
4000
4003
4001
4002
4002
3002
4001
4003
4000
4002
4000
3002
4000
4001
3002
4001
2001
4001
4001
3002
4001
4001
4001
4002
4000
4001
4001
4000
4001
4000
4003
4000
3002
3002
4002
4001
4003
4001
4002
4000
4001
4000
4001
4001
4001
4000
4001
4001
4002
3001
4002
4002
4001
4001
4000
4001
...

result:

points 0.77632872310 max label = 4003

Test #71:

score: 26.3167
Acceptable Answer
time: 32ms
memory: 3804kb

input:

0
10
1000 1000000000
496 136
370 247
359 252
743 278
85 499
522 547
6 780
330 416
815 429
942 361
275 290
113 753
471 15
720 896
514 482
631 513
981 760
525 601
600 637
263 572
292 229
556 489
46 504
199 953
354 801
91 181
742 119
495 647
940 396
272 230
291 130
763 639
467 709
945 171
96 610
726 96...

output:

1000
1000000
1000424
1000553
329181
1000542
1000462
1000441
329314
329008
1000455
1000584
329103
329243
1000464
1000753
329080
1000655
1000433
1000521
1000543
329019
1000896
329317
1000809
329200
1000960
1000374
1000880
1000831
329147
329276
998993
1000491
1000548
1000484
1000418
1000415
1000427
100...

input:

1
50431
1000830 329228 2
1000829
1000831
372351 487474 2
372350
372352
951950 576575 1
1000037
329129 1000970 2
329128
329130
652651 960930 1
988101
1000885 1000853 2
1000884
1000886
816805 756739 2
816804
816806
427002 1000918 2
427001
427003
624616 194181 2
624615
624617
988977 251237 2
988976
988...

output:

1000829
372350
1000037
329128
988101
1000884
816804
427001
624615
988976
406047
1000985
1000812
1000582
988101
988101
599594
999983
1000958
527363
193144
988101
291285
988101
1000817
386333
307297
770668
453417
1000669
856850
1000479
488477
1000900
1000933
1000556
2001
453428
1000511
1000774
646633
...

result:

points 0.43142198430 max label = 1000999

Test #72:

score: 26.3167
Acceptable Answer
time: 32ms
memory: 3788kb

input:

0
10
1000 1000000000
812 935
596 175
369 401
625 709
470 249
715 901
665 497
296 591
732 817
698 374
352 216
787 19
831 844
896 420
700 895
533 363
872 36
58 930
48 897
321 154
391 351
993 950
392 990
585 323
565 739
818 926
103 89
912 432
706 259
359 608
218 33
146 201
16 769
230 885
945 377
41 131...

output:

1000
1000000
1000289
196048
648492
648364
648616
196041
196022
648443
648568
1000723
196188
648459
1000985
648642
1000861
196151
1000259
648431
1000838
1000315
196124
648375
1000321
1000306
1000669
1000747
1000311
648507
648605
1000857
1000808
1000864
648365
1000900
648580
1000324
1000893
196165
648...

input:

1
51725
1000931 704525 2
1000930
1000932
1000403 73023 2
1000402
1000404
721710 721683 2
721709
721711
857856 721676 1
857855
16015 297296 1
1000001
704394 704126 2
704393
704395
307304 882881 2
307303
307305
509381 509399 2
509380
509382
614597 300279 2
614596
614598
775754 28026 2
775753
775755
13...

output:

1000930
1000402
721709
857855
1000001
704393
307303
509382
614596
775753
1000001
1000891
704585
1000001
1000745
846796
704393
1000998
704391
720692
560555
979977
627005
1000001
1000001
724719
627564
1000591
1000001
627300
56048
566562
775763
910895
362359
648500
721214
721539
614587
999995
1000577
7...

result:

points 0.43142198430 max label = 1000999

Test #73:

score: 26.3167
Acceptable Answer
time: 36ms
memory: 3884kb

input:

0
1
1000 1000000000
584 325
759 912
536 411
310 503
386 643
125 683
587 211
331 908
866 671
790 38
346 846
813 567
297 574
42 196
443 23
467 767
797 820
134 746
465 907
815 88
161 453
467 788
793 875
656 320
847 290
725 194
372 594
909 185
120 5
845 895
292 421
56 804
634 565
41 22
144 402
616 552
1...

output:

1000
1000000
174164
657651
379366
379372
318292
244214
350346
510502
510491
318284
244228
350335
379378
155142
875868
960937
116112
755728
116092
689662
960920
689665
42034
510492
555551
555544
987013
379367
419406
155143
280244
728727
555526
318296
875872
350340
419408
451421
350343
783757
689664
3...

input:

1
49651
913907 657630 2
913906
913908
875874 451431 1
875873
280268 451421 2
280267
280269
451450 689677 1
451449
818817 318297 1
818816
657655 587583 2
657654
657656
451441 960919 2
451440
451442
280258 987962 2
280257
280259
116102 318317 2
116101
116103
489479 81077 2
489478
489480
419385 379364 ...

output:

913906
875873
280267
451449
818816
657654
451440
280257
116101
489478
419384
42038
555534
318286
155151
657646
987981
852827
728708
987018
913887
689673
155130
510494
987018
960917
913902
280264
350341
489484
202194
350325
174164
81064
318298
419386
852826
960936
689658
657630
818784
987018
419405
4...

result:

points 0.43142198430 max label = 1000999

Test #74:

score: 35.2458
Acceptable Answer
time: 14ms
memory: 3800kb

input:

0
10
96 1000000000
95 4
95 32
13 95
49 95
76 95
95 73
95 10
95 42
63 95
17 95
95 52
95 84
95 11
95 2
95 14
95 85
91 95
57 95
24 95
46 95
95 23
77 95
54 95
95 40
33 95
34 95
95 26
95 51
95 89
59 95
82 95
95 28
95 25
95 81
3 95
95 45
95 29
71 95
95 94
95 21
95 22
8 95
92 95
15 95
95 55
56 95
6 95
95 7...

output:

96
96000
77076
16015
37036
3002
93092
49048
80079
44043
69068
9008
15014
63062
5004
17016
46045
91090
12011
84083
68067
73072
42041
43042
23022
21020
35034
29028
78077
34033
39038
94093
64063
4003
27026
28027
51050
83082
54053
57056
72071
26025
87086
10009
90089
67066
38037
22021
96095
76075
6005
59...

input:

1
4308
5004 55054 1
96001
49048 91090 1
96001
96001 50049 95
3002
4003
5004
6005
7006
8007
9008
10009
11010
12011
13012
14013
15014
16015
17016
18017
19018
20019
21020
22021
23022
24023
25024
26025
27026
28027
29028
30029
31030
32031
33032
34033
35034
36035
37036
38037
39038
40039
41040
42041
43042
...

output:

96001
96001
50049
96000
96001
39038
96001
96001
96000
96001
96001
96001
96001
96001
96001
30029
96000
96001
96000
96001
96001
96000
96001
96001
96001
96001
96000
96001
96000
96001
96001
96001
96000
96001
96001
96001
96001
96001
96001
96001
91090
96001
96001
96000
51050
96001
96001
96001
96001
96001
...

result:

points 0.57780058530 max label = 96095

Test #75:

score: 28.6575
Acceptable Answer
time: 14ms
memory: 3888kb

input:

0
10
541 1000000000
0 527
0 72
0 176
0 246
0 323
190 0
74 0
0 110
518 0
259 0
0 293
0 51
0 59
149 0
0 232
327 0
0 136
0 503
0 142
0 248
64 0
0 398
379 0
0 156
0 265
406 0
84 0
0 49
522 0
0 413
0 513
429 0
170 0
163 0
319 0
233 0
490 0
0 187
0 270
273 0
0 17
471 0
437 0
0 154
276 0
63 0
378 0
0 38
42...

output:

541
541000
491490
251250
55054
63062
313312
322321
370369
64063
58057
238237
388387
252251
500499
423422
367366
382381
42041
467466
273272
99098
485484
84083
143142
204203
76075
477476
170169
125124
510509
250249
537536
162161
330329
436435
236235
386385
213212
49048
183182
362361
79078
286285
18418...

input:

1
6214
486485 472471 1
541000
436435 219218 1
541001
60059 505504 1
541001
310309 334333 1
541001
487486 303302 1
541000
312311 484483 1
541000
46045 66065 1
541000
355354 94093 1
541000
161160 31030 1
541000
422421 141140 1
541000
113112 213212 1
541000
174173 402401 1
541001
385384 354353 1
541000...

output:

541000
541001
541001
541001
541000
541000
541000
541000
541000
541000
541000
541001
541000
541000
541000
541000
541001
541000
541001
541001
541000
541001
541000
541001
541000
541001
541000
355354
541000
541000
541000
541000
541000
541001
541000
541000
541001
541001
541001
541000
541000
541000
541000...

result:

points 0.46979577250 max label = 541540

Test #76:

score: 26.3167
Acceptable Answer
time: 16ms
memory: 3872kb

input:

0
10
1000 1000000000
999 444
999 412
999 312
999 906
999 990
999 616
999 554
718 999
999 228
494 999
999 726
999 728
55 999
370 999
190 999
999 230
999 64
944 999
358 999
999 189
65 999
500 999
457 999
480 999
414 999
999 820
999 29
331 999
999 693
239 999
132 999
999 918
527 999
999 534
145 999
999...

output:

1000
1000000
817816
158157
391390
67066
444443
684683
958957
898897
99098
440439
116115
545544
95094
959958
233232
360359
814813
645644
51050
365364
493492
698697
771770
633632
469468
936935
207206
410409
29028
877876
482481
126125
320319
172171
671670
664663
253252
946945
907906
46045
268267
475474...

input:

1
10180
19018 802801 1
1000000
5004 426425 1
1000000
619618 22021 1
1000000
205204 288287 1
1000001
472471 863862 1
1000000
533532 784783 1
1000000
135134 910909 1
1000001
214213 610609 1
1000000
969968 872871 1
1000000
553552 574573 1
1000000
980979 749748 1
1000001
861860 357356 1
1000001
670669 6...

output:

1000000
1000000
1000000
1000001
1000000
1000000
1000001
1000000
1000000
1000000
1000001
1000001
1000001
1000000
1000001
1000000
1000000
1000001
1000000
1000000
1000000
1000000
1000000
1000001
1000000
1000001
1000000
1000001
1000000
1000001
1000000
1000001
1000000
1000001
1000000
1000001
1000001
1000...

result:

points 0.43142198430 max label = 1000999

Test #77:

score: 45.2233
Acceptable Answer
time: 0ms
memory: 3800kb

input:

0
10
7 1000000000
1 6
0 6
3 6
5 6
4 6
2 6
7 1000000000
5 3
0 3
6 3
4 3
1 3
2 3
7 1000000000
1 5
2 5
4 5
3 5
0 5
6 1
7 1000000000
2 5
4 5
1 5
0 5
6 5
3 2
7 1000000000
0 4
1 4
6 4
2 4
5 4
3 0
7 1000000000
5 0
4 0
6 0
3 0
1 5
2 5
7 1000000000
1 5
4 5
6 5
3 5
2 1
0 1
7 1000000000
5 1
3 1
6 1
0 1
4 5
2 5...

output:

7
7000
3002
7006
4003
6005
5004
7001
7
7000
6005
7006
7001
5004
3002
4003
7
7000
4002
5004
7006
6005
7001
4003
7
7000
6005
4002
4003
5004
7001
7006
7
7000
3002
5004
7006
6001
6005
4003
7
7000
3002
4003
7006
5004
4001
6005
7
7000
7001
7006
6005
4003
6002
5004
7
7000
7001
5004
6005
4003
5002
7006
7
70...

input:

1
420
4001 7006 3
3002
4003
7000
7006 4002 1
7001
4002 6005 2
4003
7001
5004 6005 1
7000
6005 7000 1
7001
7006 6005 1
7001
7006 7000 1
7001
4003 7000 1
4001
5004 6005 1
7001
6001 6005 5
3002
4003
5004
6005
7000
6005 5004 1
7001
5004 7001 1
7001
7001 5004 5
4002
5004
6005
7000
7006
4003 5004 1
4002
6...

output:

7000
7001
7001
7000
7001
7001
7001
4001
7001
6005
7001
7001
5004
4002
7001
7001
7001
6001
7001
7001
7001
7002
7001
4002
7001
6001
7001
7000
7001
7000
5002
7001
7001
6002
6001
6005
7001
6002
7000
4002
7001
6005
7002
4002
7001
7001
4001
7001
7001
6002
7002
7002
7000
7001
7001
6001
6005
7001
7001
6001
...

result:

points 0.74136633070 max label = 7006

Test #78:

score: 45.2233
Acceptable Answer
time: 2ms
memory: 4092kb

input:

0
10
7 1000000000
3 6
1 6
0 6
5 6
2 3
4 2
7 1000000000
4 6
0 6
5 6
3 6
1 4
2 1
7 1000000000
5 1
4 1
6 1
2 5
0 5
3 4
7 1000000000
0 5
6 5
2 5
1 0
4 0
3 6
7 1000000000
2 4
0 4
3 4
1 2
5 2
6 0
7 1000000000
2 5
4 5
3 5
0 2
1 2
6 4
7 1000000000
1 5
4 5
6 5
0 1
3 4
2 6
7 1000000000
3 0
4 0
2 0
5 3
6 4
1 5...

output:

7
7000
6005
5003
5002
5004
7006
7001
7
7000
5003
5004
7006
5002
6005
7001
7
7000
6002
7006
5004
5003
7001
6005
7
7000
6005
5004
4003
7006
5001
4002
7
7000
4003
5002
6005
6001
5004
7006
7
7000
7006
7001
6005
5003
6002
5004
7
7000
7001
7006
5004
5003
7002
7005
7
7000
4003
7006
4001
6004
4002
6005
7
70...

input:

1
420
7001 7000 3
6002
7000
7006
7006 7000 1
7000
7001 6005 3
6002
7000
7006
5003 6005 2
5004
6002
6005 7000 1
6002
5004 7000 1
5003
7006 4002 1
7000
5004 6002 1
5003
7006 5003 1
7001
6001 5004 3
5002
6005
7000
5004 4002 1
5001
4002 5001 2
4003
5001
5001 4002 3
4002
5004
7000
6005 7006 1
6004
6004 7...

output:

7000
7000
6002
6002
6002
5003
7000
5003
7001
5002
5001
5001
4002
6004
7000
5003
5002
5002
7001
4001
7001
7002
7001
5003
7001
6001
7001
7000
6002
7000
4002
7000
5002
7002
5004
6005
6004
7000
7002
7000
7001
7006
7002
6004
6005
5003
5003
7001
7000
7001
7002
7002
7001
6002
5004
7003
6004
7001
7001
6001
...

result:

points 0.74136633070 max label = 7006

Test #79:

score: 45.2233
Acceptable Answer
time: 0ms
memory: 3796kb

input:

0
10
7 1000000000
2 5
0 5
1 5
6 2
3 6
4 3
7 1000000000
6 3
4 3
5 3
1 6
0 1
2 0
7 1000000000
0 4
1 4
3 0
6 1
5 3
2 6
6 1000000000
3 0
1 0
2 0
4 0
5 0
6 1000000000
4 1
0 1
3 1
2 1
5 1
6 1000000000
0 5
1 5
3 5
2 5
4 0
6 1000000000
0 1
5 1
3 1
2 1
4 0
6 1000000000
5 1
0 1
4 1
3 1
2 5
6 1000000000
3 1
2 ...

output:

7
7000
7006
6002
6004
6005
7001
6003
7
7000
6001
7006
6003
5004
6005
6002
7
7000
5002
5004
7005
5001
7006
5003
6
6000
3002
4003
2001
5004
6005
6
6000
6001
5004
4003
3002
6005
6
6000
3002
5004
4003
6005
5001
6
6000
5001
5004
4003
6005
3002
6
6000
6001
4003
6005
5004
4002
6
6000
5002
4003
6001
6005
50...

input:

1
336
5001 5004 4
3002
4003
5004
6000
6001 6000 5
3002
4003
5004
6000
6005
7000 7005 2
5001
7005
6000 5004 2
5001
6005
7005 7006 2
7000
7006
4003 5002 1
5002
3001 5004 2
3002
6000
6001 4002 4
4002
5004
6000
6005
6003 6004 2
6002
6004
4003 3002 1
6001
5004 6000 1
6000
3002 4003 1
6000
6000 3002 5
200...

output:

5004
6000
7005
5001
7006
5002
6000
4002
6004
6001
6000
6000
3002
5001
6005
6003
6003
5001
6003
6000
5002
5001
7005
5002
6001
6000
6002
5001
5001
6001
5003
6001
6003
4002
6001
6000
6001
6001
6001
2001
6003
6003
5002
5001
5003
7000
6001
6002
6000
6001
6003
6003
6000
5001
5003
5004
5002
6002
7005
3002
...

result:

points 0.74136633070 max label = 7006

Test #80:

score: 45.8108
Acceptable Answer
time: 0ms
memory: 4100kb

input:

0
10
6 1000000000
5 0
4 0
1 0
3 5
2 4
6 1000000000
1 4
3 4
5 4
0 1
2 0
6 1000000000
2 3
4 3
1 3
0 2
5 0
6 1000000000
1 2
4 2
0 1
3 4
5 0
5 1000000000
1 0
3 0
4 0
2 0
5 1000000000
0 3
4 3
2 3
1 3
5 1000000000
1 2
0 2
4 2
3 1
5 1000000000
1 3
2 3
4 3
0 1
5 1000000000
2 3
4 3
1 3
0 2
5 1000000000
4 1
0...

output:

6
6000
6005
5004
3002
5003
3001
6
6000
5001
6005
4003
5002
5004
6
6000
5004
5001
5002
4003
6005
6
6000
5001
5002
5004
5003
6005
5
5000
2001
5004
3002
4003
5
5000
5004
4003
5001
3002
5
5000
4002
5001
4003
5004
5
5000
5001
4003
5002
5004
5
5000
5004
5001
5002
4003
5
5000
4001
4003
5004
4002

input:

1
240
5000 5004 1
5001
5004 5000 1
5001
5002 6000 2
5001
5003
4002 4001 2
4001
4003
6000 5001 2
5001
6005
5004 4003 1
5000
5001 4003 3
4002
5000
5004
4003 3002 1
5000
5004 6005 1
5003
5004 5001 1
5001
5000 4003 1
5001
5004 3002 1
5000
2001 5004 1
5000
5001 5003 2
5002
6000
6005 5004 1
6000
5003 3001...

output:

5001
5001
5001
4001
5001
5000
4002
5000
5003
5001
5001
5000
5000
5002
6000
6000
5004
5002
6005
5003
5003
5000
6000
6000
5001
5002
5003
5002
5003
5001
5001
5001
5001
4001
4002
5002
5001
6000
3002
5000
6000
5001
5000
5004
6000
5001
5001
6000
6000
5002
5002
5001
6000
5001
5002
3001
6000
5002
6000
5000
...

result:

points 0.75099664750 max label = 6005

Test #81:

score: 47.3561
Acceptable Answer
time: 0ms
memory: 3816kb

input:

0
6
4 1000000000
2 3
0 3
1 3
4 1000000000
0 3
2 3
1 3
4 1000000000
2 0
1 0
3 2
3 1000000000
0 2
1 2
3 1000000000
1 0
2 0
2 1000000000
1 0

output:

4
4000
4003
3002
4001
4
4000
4003
3002
4001
4
4000
4003
3001
3002
3
3000
3002
3001
3
3000
2001
3002
2
2000
2001

input:

1
50
4003 4001 1
4001
2001 3002 1
3000
4003 4000 1
4000
2001 3000 1
3000
4003 3002 1
4001
3000 3002 2
2001
3002
3002 2001 1
3000
3002 4000 1
4001
3001 4003 2
3002
4000
3000 2001 2
2001
3002
4001 4003 3
3002
4000
4003
4000 4001 1
4001
4000 4001 1
4001
3002 4001 1
4001
3002 4001 1
4001
4003 4000 1
400...

output:

4001
3000
4000
3000
4001
3002
3000
4001
4000
2001
4003
4001
4001
4001
4001
4001
4000
3000
2001
4000
4001
4003
2000
3000
3001
4000
3001
4001
4000
4001
3002
3002
3001
3001
4001
4001
4001
4001
4001
4001
4001
3001
3001
3002
4000
3001
3001
3001
4003
3002

result:

points 0.77632872310 max label = 4003

Test #82:

score: 44.7145
Acceptable Answer
time: 38ms
memory: 3804kb

input:

0
10
8 1000000000
2 1
4 7
6 0
7 3
1 5
6 5
4 0
8 1000000000
3 2
3 4
4 5
7 6
5 6
0 1
2 1
8 1000000000
0 6
4 7
3 6
3 1
2 5
5 1
4 0
8 1000000000
0 1
2 0
1 3
1 4
2 5
2 6
3 7
8 1000000000
5 1
5 0
6 5
5 7
3 5
5 2
4 5
8 1000000000
0 6
0 3
0 4
7 0
2 0
1 0
5 0
8 1000000000
7 0
1 2
1 5
6 0
4 3
6 3
5 7
8 100000...

output:

8
8000
5003
5004
8007
8005
5002
5001
8006
8
8000
8001
8002
8003
8004
8005
8006
8007
8
8000
6003
6005
6002
8006
6004
6001
8007
8
8000
5001
8005
4002
5004
7006
8007
4003
8
8000
3002
7006
6005
8007
8001
4003
5004
8
8000
7006
6005
3002
4003
8007
2001
5004
8
8000
5003
5004
8006
8007
5002
8005
5001
8
8000...

input:

1
57266
5004 4002 1
5001
8003 8005 2
8002
8004
5004 3002 1
5003
4003 6005 1
8001
7006 8000 1
8005
5002 5003 2
5001
5003
8000 5004 2
5001
8005
8007 5004 1
8005
8000 8003 1
8001
6003 8000 2
6002
6004
8006 6005 2
8000
8007
8005 4002 3
7006
8000
8007
8007 5004 1
8006
8005 4003 3
7006
8000
8007
6002 8000...

output:

5001
8004
5003
8001
8005
5003
5001
8005
8001
6002
8000
8000
8006
8000
6001
6003
8001
8005
8005
6003
8000
6001
8001
5003
7001
8005
8006
8000
8000
8000
8001
4003
8000
8000
8000
8000
7001
8000
8000
8000
7001
8006
5003
5002
6003
3002
8000
8000
6003
7001
5003
6004
8000
5003
8005
8000
8000
8002
6002
6004
...

result:

points 0.73302434370 max label = 8007

Test #83:

score: 44.7145
Acceptable Answer
time: 40ms
memory: 3836kb

input:

0
10
8 1000000000
4 0
3 4
4 6
6 2
1 4
4 5
7 4
8 1000000000
1 3
3 5
3 7
2 3
0 3
3 6
4 2
8 1000000000
0 4
3 2
2 5
7 2
0 2
2 6
3 1
8 1000000000
0 6
6 1
3 1
7 3
7 4
4 2
0 5
8 1000000000
0 4
3 4
6 5
0 2
7 0
5 1
6 2
8 1000000000
2 4
5 2
4 0
6 1
7 6
5 3
0 1
8 1000000000
5 3
0 1
0 5
2 0
7 6
6 5
4 2
8 100000...

output:

8
8000
6005
5004
3002
8001
7006
5003
8007
8
8000
3002
7005
8001
7006
4003
8007
5004
8
8000
5004
8002
5003
2001
6005
8007
7006
8
8000
7002
7006
7003
7005
8007
7001
7004
8
8000
7006
7003
3002
3001
7005
7004
8007
8
8000
8005
5002
5004
5001
5003
8006
8007
8
8000
2001
8006
4003
8007
6002
6004
6005
8
8000...

input:

1
57297
3002 4003 1
8001
7006 8001 1
8001
8005 4001 2
8004
8006
8006 8000 2
8005
8007
8000 6004 3
2001
6002
8006
8006 8005 2
8005
8007
3002 8000 1
8001
8005 4001 2
8004
8006
7004 3001 2
7003
7005
5002 8005 2
5001
5003
6005 8007 1
8001
4003 6002 1
6002
4001 8007 2
4002
8000
8000 8007 3
3001
7003
8007...

output:

8001
8001
8004
8005
6002
8005
8001
8004
7003
5001
8001
6002
8000
8007
8001
8001
8005
7004
8001
8000
7005
6002
8002
8001
8004
6002
7004
8001
8005
8000
8001
8001
3002
8001
8001
4001
8000
7005
7003
2001
8000
7005
8001
8000
8002
4002
7001
8002
8001
6002
5001
8006
8002
8001
7002
8001
8002
8001
7004
8001
...

result:

points 0.73302434370 max label = 8007

Test #84:

score: 44.7145
Acceptable Answer
time: 30ms
memory: 3800kb

input:

0
10
8 1000000000
3 7
0 3
3 6
3 2
4 3
3 5
3 1
8 1000000000
2 1
6 3
3 0
0 2
1 4
5 7
3 5
8 1000000000
6 2
6 7
1 6
0 7
0 4
5 6
1 3
8 1000000000
5 3
6 1
0 2
0 4
7 3
6 4
2 5
8 1000000000
2 0
4 0
4 7
3 6
3 5
1 6
3 2
8 1000000000
3 2
2 6
3 5
1 3
3 4
1 0
7 3
8 1000000000
4 1
2 1
0 6
7 4
3 7
6 3
2 5
8 100000...

output:

8
8000
8007
5004
8001
6005
7006
4003
3002
8
8000
8006
8005
5001
8007
5003
3002
5004
8
8000
6004
4003
6005
8007
7006
7002
7001
8
8000
8007
5001
5003
8005
5002
8006
5004
8
8000
5004
6001
6002
8006
6005
5003
8007
8
8000
8001
5003
8002
7006
6005
5004
8007
8
8000
8005
8006
8002
8004
8007
8001
8003
8
8000...

input:

1
57195
4003 8007 1
8001
8000 8005 1
8001
7002 4003 4
4003
6004
7001
7006
8000 8005 1
8001
8007 4003 1
8001
3002 8000 1
8001
8000 7006 1
8001
5004 6002 1
5003
6004 7002 2
6005
7002
8000 8001 1
8001
8007 4003 1
8001
6005 8007 1
8001
6005 8006 1
6002
3002 6005 1
8001
4003 3002 1
8001
7006 7002 1
7003
...

output:

8001
8001
4003
8001
8001
8001
8001
5003
7002
8001
8001
8001
6002
8001
8001
7003
8005
5003
8001
5001
5004
8001
8002
8002
5003
5001
8006
6004
6002
5003
6002
8002
5003
8003
8002
7002
5002
7002
5002
5001
6002
8002
6004
5003
8004
4003
4002
8000
8005
4002
5003
8001
8002
8002
5003
7001
8005
8001
8004
8005
...

result:

points 0.73302434370 max label = 8007

Test #85:

score: 44.7145
Acceptable Answer
time: 38ms
memory: 3784kb

input:

0
10
8 1000000000
3 7
0 3
3 6
3 2
4 3
3 5
3 1
8 1000000000
2 1
6 3
3 0
0 2
1 4
5 7
3 5
8 1000000000
6 2
6 7
1 6
0 7
0 4
5 6
1 3
8 1000000000
5 3
6 1
0 2
0 4
7 3
6 4
2 5
8 1000000000
2 0
4 0
4 7
3 6
3 5
1 6
3 2
8 1000000000
3 2
2 6
3 5
1 3
3 4
1 0
7 3
8 1000000000
4 1
2 1
0 6
7 4
3 7
6 3
2 5
8 100000...

output:

8
8000
8007
5004
8001
6005
7006
4003
3002
8
8000
8006
8005
5001
8007
5003
3002
5004
8
8000
6004
4003
6005
8007
7006
7002
7001
8
8000
8007
5001
5003
8005
5002
8006
5004
8
8000
5004
6001
6002
8006
6005
5003
8007
8
8000
8001
5003
8002
7006
6005
5004
8007
8
8000
8005
8006
8002
8004
8007
8001
8003
8
8000...

input:

1
57195
4003 8007 1
8001
8000 8005 1
8001
7002 4003 4
4003
6004
7001
7006
8000 8005 1
8001
8007 4003 1
8001
3002 8000 1
8001
8000 7006 1
8001
5004 6002 1
5003
6004 7002 2
6005
7002
8000 8001 1
8001
8007 4003 1
8001
6005 8007 1
8001
6005 8006 1
6002
3002 6005 1
8001
4003 3002 1
8001
7006 7002 1
7003
...

output:

8001
8001
4003
8001
8001
8001
8001
5003
7002
8001
8001
8001
6002
8001
8001
7003
8005
5003
8001
5001
5004
8001
8002
8002
5003
5001
8006
6004
6002
5003
6002
8002
5003
8003
8002
7002
5002
7002
5002
5001
6002
8002
6004
5003
8004
4003
4002
8000
8005
4002
5003
8001
8002
8002
5003
7001
8005
8001
8004
8005
...

result:

points 0.73302434370 max label = 8007

Test #86:

score: 44.7145
Acceptable Answer
time: 38ms
memory: 3772kb

input:

0
10
8 1000000000
3 7
0 3
3 6
3 2
4 3
3 5
3 1
8 1000000000
2 1
6 3
3 0
0 2
1 4
5 7
3 5
8 1000000000
6 2
6 7
1 6
0 7
0 4
5 6
1 3
8 1000000000
5 3
6 1
0 2
0 4
7 3
6 4
2 5
8 1000000000
2 0
4 0
4 7
3 6
3 5
1 6
3 2
8 1000000000
3 2
2 6
3 5
1 3
3 4
1 0
7 3
8 1000000000
4 1
2 1
0 6
7 4
3 7
6 3
2 5
8 100000...

output:

8
8000
8007
5004
8001
6005
7006
4003
3002
8
8000
8006
8005
5001
8007
5003
3002
5004
8
8000
6004
4003
6005
8007
7006
7002
7001
8
8000
8007
5001
5003
8005
5002
8006
5004
8
8000
5004
6001
6002
8006
6005
5003
8007
8
8000
8001
5003
8002
7006
6005
5004
8007
8
8000
8005
8006
8002
8004
8007
8001
8003
8
8000...

input:

1
57195
4003 8007 1
8001
8000 8005 1
8001
7002 4003 4
4003
6004
7001
7006
8000 8005 1
8001
8007 4003 1
8001
3002 8000 1
8001
8000 7006 1
8001
5004 6002 1
5003
6004 7002 2
6005
7002
8000 8001 1
8001
8007 4003 1
8001
6005 8007 1
8001
6005 8006 1
6002
3002 6005 1
8001
4003 3002 1
8001
7006 7002 1
7003
...

output:

8001
8001
4003
8001
8001
8001
8001
5003
7002
8001
8001
8001
6002
8001
8001
7003
8005
5003
8001
5001
5004
8001
8002
8002
5003
5001
8006
6004
6002
5003
6002
8002
5003
8003
8002
7002
5002
7002
5002
5001
6002
8002
6004
5003
8004
4003
4002
8000
8005
4002
5003
8001
8002
8002
5003
7001
8005
8001
8004
8005
...

result:

points 0.73302434370 max label = 8007

Test #87:

score: 26.332
Acceptable Answer
time: 26ms
memory: 3804kb

input:

0
10
978 1000000000
201 44
44 320
320 907
907 278
278 477
477 755
755 461
461 235
235 83
83 919
919 38
38 443
443 629
629 42
42 13
13 208
208 898
898 205
205 924
924 887
887 170
170 326
326 255
255 684
684 301
301 909
909 161
161 621
621 130
130 587
587 530
530 334
334 700
700 771
771 722
722 712
71...

output:

978
978000
631527
520166
631589
520145
631543
631093
520370
520385
978689
520351
978785
520233
978851
520127
520338
520495
978655
631600
631029
520380
520352
978891
520498
978657
631622
520171
520436
520129
978954
631059
520330
978910
520371
520464
631073
978794
631046
978855
520359
631558
978756
97...

input:

1
35090
520303 520201 2
520302
520304
973797 625520 2
973796
973798
964960 964696 2
964959
964961
989267 989151 2
989266
989268
183061 556404 2
183060
183062
834630 834570 2
834629
834631
157041 632285 2
157040
157042
675645 995443 2
675644
675646
503398 386277 2
503397
503399
834577 951838 2
834576...

output:

520302
973796
964959
989266
183060
834629
157040
675644
503397
834576
978931
556352
951449
958203
520341
680002
680604
520350
995253
503138
958930
503024
978811
964923
951093
978970
415366
558457
951501
995888
558396
386329
426416
951860
978738
386270
558501
625048
625073
751611
680596
183031
995360...

result:

points 0.43167234060 max label = 996995

Test #88:

score: 26.3167
Acceptable Answer
time: 38ms
memory: 3788kb

input:

0
10
1000 1000000000
897 448
897 517
583 297
897 748
84 650
402 690
131 583
583 601
464 897
336 674
189 897
897 246
843 421
432 742
529 877
812 209
103 109
842 931
795 84
289 103
103 579
84 603
926 897
70 897
183 901
448 647
111 513
646 689
84 949
191 485
745 12
124 578
133 689
423 755
767 124
897 8...

output:

1000
1000000
844843
878877
544543
557556
865864
828827
407406
42041
703702
398396
166165
127083
615614
610609
475474
897896
900899
343342
820819
336335
186185
801800
148147
833832
673672
66065
353352
481480
250249
718717
902901
420407
540539
241240
998997
499498
656655
797795
274273
97096
539538
916...

input:

1
47617
790788 687661 2
790787
790789
826819 269268 3
823820
826823
833818
716715 943941 1
716712
49046 276261 3
48047
49048
52045
17016 933894 1
935015
413412 424423 1
413411
1000610 567284 2
1000609
1000611
544542 352351 2
544541
544543
257094 1000553 2
257093
257095
641630 793790 6
632631
633632
...

output:

790787
833818
716712
52045
935015
413411
1000609
544541
257093
646629
546501
567126
1000001
658651
77070
1000001
257008
190188
1000001
819808
1000851
1000450
1000001
990004
1000569
954951
1000386
191188
257005
698548
567437
449418
1000729
793718
825821
990987
1000637
1000122
567360
257251
1000993
10...

result:

points 0.43142198430 max label = 1000999

Test #89:

score: 26.3206
Acceptable Answer
time: 30ms
memory: 3816kb

input:

0
10
991 1000000000
454 800
702 960
660 644
108 499
445 776
921 520
184 252
730 588
97 163
465 448
361 58
227 250
577 112
191 405
394 157
830 296
589 428
814 830
531 947
161 797
490 127
145 911
858 49
935 552
600 543
138 501
850 916
602 242
114 606
516 650
573 988
121 41
617 723
680 173
619 709
620 ...

output:

991
991000
991967
831538
831574
831557
831500
831772
991950
831095
831071
831788
831585
831237
831531
831741
831097
831087
831711
831275
831136
831464
831586
991891
831159
831139
991947
831780
831343
831047
831762
831173
831216
991889
831742
831073
831449
831361
991920
991847
991899
831276
831269
99...

input:

1
49922
826824 532234 2
826823
826825
706705 65030 1
713693
681671 290055 2
681670
681672
990733 661362 2
990732
990734
681491 992932 2
681490
681492
697661 826825 2
697660
697662
993292 993337 2
993291
993293
408404 942941 3
406405
408401
408406
661577 990851 2
661576
661578
993980 181094 2
993979
...

output:

826823
713693
681670
990732
681490
697660
993293
408401
661576
993979
737728
137111
993240
684682
65030
831421
661509
991842
681582
993219
990742
681605
532409
992877
831241
142137
661636
181006
820817
358348
831691
290286
992775
295233
258179
992508
990812
528499
993304
570568
295233
661586
645643
...

result:

points 0.43148447940 max label = 999998

Test #90:

score: 26.3167
Acceptable Answer
time: 40ms
memory: 3844kb

input:

0
10
993 1000000000
659 162
695 292
133 492
301 424
380 243
646 631
297 394
653 704
220 522
825 939
861 883
602 802
939 903
875 50
576 279
343 778
734 393
665 687
340 125
189 579
672 873
201 476
715 325
846 119
682 482
362 218
694 968
463 785
402 585
985 957
207 215
887 618
859 317
871 214
655 459
3...

output:

993
993000
532525
95094
249248
254252
653652
980962
804796
651646
795793
577542
131130
879865
368366
276267
952950
662654
319290
559558
89086
735734
540539
832827
940937
641635
335334
689687
489488
362361
394014
109108
735726
498496
607606
955945
739738
650649
319289
993992
894890
288287
207206
1231...

input:

1
50698
430426 447442 3
428427
430424
430428
26025 790789 1
27020
960959 68067 1
1000001
923667 81080 3
675668
923666
923675
221218 63061 2
221216
221219
768767 135134 1
768766
621620 614613 1
621619
564563 360359 1
947126
284256 456455 3
283257
284283
288255
366040 492490 2
366038
366041
919918 719...

output:

430424
27020
1000001
923666
221216
768766
621619
947126
288255
366038
1000001
712703
621619
173153
995005
759749
693690
717713
780768
32024
99092
883048
979974
976266
239211
933890
894860
436428
169161
213164
88086
424418
271269
493383
514505
831789
883048
832827
943615
246245
63061
907905
629627
88...

result:

points 0.43142198430 max label = 1000999

Test #91:

score: 26.3167
Acceptable Answer
time: 30ms
memory: 3796kb

input:

0
10
993 1000000000
659 162
695 292
133 492
301 424
380 243
646 631
297 394
653 704
220 522
825 939
861 883
602 802
939 903
875 50
576 279
343 778
734 393
665 687
340 125
189 579
672 873
201 476
715 325
846 119
682 482
362 218
694 968
463 785
402 585
985 957
207 215
887 618
859 317
871 214
655 459
3...

output:

993
993000
532525
95094
249248
254252
653652
980962
804796
651646
795793
577542
131130
879865
368366
276267
952950
662654
319290
559558
89086
735734
540539
832827
940937
641635
335334
689687
489488
362361
394014
109108
735726
498496
607606
955945
739738
650649
319289
993992
894890
288287
207206
1231...

input:

1
50698
430426 447442 3
428427
430424
430428
26025 790789 1
27020
960959 68067 1
1000001
923667 81080 3
675668
923666
923675
221218 63061 2
221216
221219
768767 135134 1
768766
621620 614613 1
621619
564563 360359 1
947126
284256 456455 3
283257
284283
288255
366040 492490 2
366038
366041
919918 719...

output:

430424
27020
1000001
923666
221216
768766
621619
947126
288255
366038
1000001
712703
621619
173153
995005
759749
693690
717713
780768
32024
99092
883048
979974
976266
239211
933890
894860
436428
169161
213164
88086
424418
271269
493383
514505
831789
883048
832827
943615
246245
63061
907905
629627
88...

result:

points 0.43142198430 max label = 1000999

Test #92:

score: 26.3206
Acceptable Answer
time: 38ms
memory: 3880kb

input:

0
10
992 1000000000
274 302
761 266
243 116
753 556
69 885
191 771
127 476
904 335
735 660
798 382
116 771
973 331
753 437
318 813
250 127
64 904
929 494
127 885
318 538
135 116
822 415
894 258
187 322
874 759
574 890
379 812
988 653
332 331
572 244
215 346
825 401
510 519
517 777
958 897
911 176
40...

output:

992
992000
6005
19018
765764
990989
706702
426425
721720
729723
116106
571557
666664
879878
740739
395394
157156
625624
867866
786777
952951
584579
686685
567566
454453
953952
344343
336335
186185
178177
670669
287285
63060
363360
64063
757756
389388
989988
74073
714713
27026
151150
505504
590588
29...

input:

1
49569
778777 645644 1
778776
607605 611314 2
607606
608602
150149 322312 1
150148
54052 994002 2
54051
54053
638281 246245 3
637282
638280
638637
973972 355354 1
986936
911907 271267 4
909908
910909
911874
911910
872871 370367 1
872870
596535 26019 3
595536
596595
597534
101100 27024 1
101098
9299...

output:

778776
608602
150148
54051
638280
986936
911874
872870
597534
101098
929923
392390
498496
448351
142011
227210
910893
952051
938936
467462
909698
891885
898892
338332
637629
376352
990001
698208
28013
454385
870848
558417
682647
242230
386367
277270
202146
781044
182180
43041
714155
405401
704688
34...

result:

points 0.43148447940 max label = 999998

Test #93:

score: 26.3206
Acceptable Answer
time: 38ms
memory: 3812kb

input:

0
10
992 1000000000
274 302
761 266
243 116
753 556
69 885
191 771
127 476
904 335
735 660
798 382
116 771
973 331
753 437
318 813
250 127
64 904
929 494
127 885
318 538
135 116
822 415
894 258
187 322
874 759
574 890
379 812
988 653
332 331
572 244
215 346
825 401
510 519
517 777
958 897
911 176
40...

output:

992
992000
6005
19018
765764
990989
706702
426425
721720
729723
116106
571557
666664
879878
740739
395394
157156
625624
867866
786777
952951
584579
686685
567566
454453
953952
344343
336335
186185
178177
670669
287285
63060
363360
64063
757756
389388
989988
74073
714713
27026
151150
505504
590588
29...

input:

1
49569
778777 645644 1
778776
607605 611314 2
607606
608602
150149 322312 1
150148
54052 994002 2
54051
54053
638281 246245 3
637282
638280
638637
973972 355354 1
986936
911907 271267 4
909908
910909
911874
911910
872871 370367 1
872870
596535 26019 3
595536
596595
597534
101100 27024 1
101098
9299...

output:

778776
608602
150148
54051
638280
986936
911874
872870
597534
101098
929923
392390
498496
448351
142011
227210
910893
952051
938936
467462
909698
891885
898892
338332
637629
376352
990001
698208
28013
454385
870848
558417
682647
242230
386367
277270
202146
781044
182180
43041
714155
405401
704688
34...

result:

points 0.43148447940 max label = 999998

Test #94:

score: 26.3167
Acceptable Answer
time: 38ms
memory: 3828kb

input:

0
10
1000 1000000000
880 197
507 738
947 24
750 375
785 686
514 578
885 51
988 286
813 807
384 826
436 909
304 273
322 772
368 921
802 592
951 168
937 494
937 450
667 703
62 981
618 350
800 460
668 12
126 532
723 262
525 741
950 567
220 587
477 326
212 582
160 788
772 225
754 196
553 741
471 31
332 ...

output:

1000
1000000
245241
454453
135134
766763
728727
259258
717716
852849
838837
759745
961954
259255
680656
323321
982981
761760
843836
582580
562544
274273
409407
820819
680678
644630
784783
268267
643642
540539
485484
611610
538448
892891
688687
885884
957955
105104
218217
202201
307306
209208
52050
8...

input:

1
50684
421420 969968 1
421402
164163 880879 1
164162
18003 787786 2
18004
949002
603602 76075 1
605599
695694 375319 1
977693
543542 62061 1
549541
778777 414207 1
781776
935931 899898 3
933932
935933
944930
219217 939938 2
219218
272205
688687 552551 1
707649
439437 406396 2
439438
460435
72056 26...

output:

421402
164162
949002
605599
977693
549541
781776
944930
272205
707649
460435
264034
472144
899171
877851
1000002
1000002
146071
283280
499443
879176
474466
937030
644642
611605
691658
419411
146132
885882
778753
992654
36027
575571
470284
383271
641638
1000002
310286
369365
463374
953123
97020
93091...

result:

points 0.43142198430 max label = 1000999

Test #95:

score: 27.5107
Acceptable Answer
time: 14ms
memory: 4092kb

input:

0
10
731 1000000000
730 284
530 730
304 730
730 104
730 252
48 730
615 730
472 730
730 414
730 441
64 730
150 730
351 730
86 730
730 542
730 207
416 730
730 145
45 730
730 159
409 730
603 730
730 353
690 730
71 730
730 579
730 684
730 93
730 88
38 730
730 419
22 730
595 730
730 675
730 633
730 183
4...

output:

731
731000
525524
216215
694693
96095
42041
421420
365364
456455
604603
468467
332331
182181
78077
95094
704703
209208
138137
526525
377376
619618
124123
34033
559558
700699
624623
580579
113112
48047
322321
375374
212211
586585
189188
242241
294293
675674
690689
32031
277276
691690
144143
233232
39...

input:

1
5230
212211 202201 1
731000
251250 342341 1
731000
271270 539538 1
731001
260259 604603 1
731000
50049 610609 1
731001
560559 236235 1
731000
674673 605604 1
731001
248247 10009 1
731000
580579 617616 1
731000
299298 689688 1
731000
578577 656655 1
731001
96095 407406 1
731000
578577 381380 1
7310...

output:

731000
731000
731001
731000
731001
731000
731001
731000
731000
731000
731001
731000
731001
731000
731001
731000
731001
731000
731000
731001
731001
731001
731001
731000
731000
731000
731001
731001
731000
731000
66065
731000
731000
731000
731000
731001
731000
731001
731000
731001
731000
731000
720719
...

result:

points 0.45099451490 max label = 731730

Test #96:

score: 26.3167
Acceptable Answer
time: 16ms
memory: 4064kb

input:

0
10
1000 1000000000
999 515
999 808
389 999
137 999
936 999
887 999
287 999
999 299
999 704
14 999
999 937
387 999
841 999
78 999
894 999
757 999
691 999
71 999
779 999
999 676
838 999
999 524
999 359
999 19
29 999
405 999
192 999
17 999
136 999
31 999
999 952
999 735
696 999
942 999
999 223
530 99...

output:

1000
1000000
795794
264263
170169
279278
455454
589588
889888
431430
338337
999998
493492
613612
724723
12011
652651
520519
30029
669668
26025
450449
721720
285284
907906
62061
941940
92091
314313
175174
27026
588587
32031
966965
192191
886885
530529
61060
914913
151150
385384
485484
797796
556555
9...

input:

1
10180
701700 390389 1
1000000
1000000 279278 1
1000001
718717 179178 1
1000000
721720 137136 1
1000001
126125 244243 1
1000001
634633 121120 1
1000000
642641 260259 1
1000001
592591 344343 1
1000000
646645 292291 1
1000000
761760 826825 1
1000000
567566 31030 1
1000001
425424 254253 1
1000000
7367...

output:

1000000
1000001
1000000
1000001
1000001
1000000
1000001
1000000
1000000
1000000
1000001
1000000
1000000
1000000
1000000
1000000
1000001
1000001
1000001
1000000
1000000
1000001
1000000
1000001
1000000
1000001
1000000
1000001
1000001
1000001
1000000
1000001
1000001
1000001
1000001
1000001
1000000
1000...

result:

points 0.43142198430 max label = 1000999

Test #97:

score: 26.7522
Acceptable Answer
time: 20ms
memory: 3804kb

input:

0
10
892 1000000000
606 640
172 727
509 98
109 640
296 474
23 332
782 57
427 887
57 179
720 206
766 218
884 395
110 412
188 813
801 345
131 824
359 689
686 789
274 346
167 842
429 845
249 550
273 798
588 61
631 364
120 266
296 213
819 110
10 420
401 438
286 261
813 61
454 67
824 59
174 859
252 271
3...

output:

892
892000
796795
377376
787786
551550
278267
504503
464463
805804
215214
402401
543542
159158
187186
41040
616615
288287
631630
465464
176175
277276
566565
667666
744733
248247
398397
456455
585584
227226
833822
649648
364363
875874
200189
195194
170169
567566
148147
847846
196195
743742
281280
165...

input:

1
13208
883875 367366 8
877876
878877
879878
880879
881880
882881
883882
891007
562551 54053 11
553552
554553
555554
556555
557556
558557
559558
560559
561560
562561
606495
884874 313312 10
876875
877876
878877
879878
880879
881880
882881
883882
884002
884883
93083 226225 10
85084
86085
87086
88087
...

output:

891007
606495
884002
103012
887005
96005
226215
414073
199142
115030
526483
840819
134091
729672
585564
698065
813728
558217
786729
91048
812721
223202
595552
812721
439396
175154
888003
115030
813006
812721
888107
807553
794783
622601
794783
448357
686665
462371
883002
437416
580559
175154
325304
6...

result:

points 0.43856092150 max label = 892891

Test #98:

score: 26.3167
Acceptable Answer
time: 16ms
memory: 3772kb

input:

0
10
1000 1000000000
180 624
132 59
664 556
950 732
810 7
7 911
627 313
332 648
703 375
220 710
922 375
812 676
664 387
725 759
223 711
329 138
536 671
316 235
182 116
65 893
948 116
521 965
728 495
502 950
521 460
103 682
574 331
89 865
490 979
530 125
980 65
176 190
308 702
308 597
309 107
523 566...

output:

1000
1000000
93092
146145
345344
406405
868867
974973
105048
338337
819811
324323
45044
313312
68067
190189
451450
973972
23015
876819
444443
581580
110109
906905
335334
477476
860852
518510
273272
169168
314306
95094
65064
504503
162161
204203
142141
214213
558557
956955
94093
534533
62061
311310
6...

input:

1
16365
422413 939938 9
415414
416415
417416
418417
419418
420419
421420
422421
431358
232224 801800 8
226225
227226
228227
229228
230229
231230
232231
248191
933876 122121 8
885877
893885
901893
909901
917909
925917
933925
990047
983056 626625 9
130057
203130
276203
325276
398325
837398
910837
9839...

output:

431358
248191
990047
837398
546539
487430
894738
545472
20005
587547
943886
163156
475468
614583
544501
276203
513498
360347
999010
413400
925894
302262
420363
472399
50019
989020
191134
857789
319304
185170
544487
752717
920913
817810
248191
762705
203130
978857
458415
789678
133105
683676
285212
8...

result:

points 0.43142198430 max label = 1000999

Test #99:

score: 27.611
Acceptable Answer
time: 28ms
memory: 3800kb

input:

0
10
712 1000000000
165 500
293 270
484 552
3 324
308 190
621 104
561 389
581 286
154 188
251 457
223 99
633 660
446 540
160 610
150 323
93 265
273 380
268 297
38 376
670 568
653 209
253 291
384 187
434 193
422 131
96 418
625 325
72 325
299 590
645 552
486 384
28 153
37 246
309 566
91 686
468 464
57...

output:

712
712000
703693
630120
709669
621147
639087
588587
567566
626130
526442
615171
530434
614174
212211
587586
562561
336335
567327
550380
616168
524452
680679
540398
595235
76075
665664
404403
600226
17016
550549
608607
658657
597233
579281
706678
602601
511501
706676
582270
580278
631113
652651
6176...

input:

1
33400
664296 609489 3
298297
664298
665295
366166 691487 3
168167
366164
366168
612184 4003 3
611185
612611
613183
125049 605465 3
51050
125051
126048
573071 557135 3
572072
573069
573572
626438 601507 3
625439
626625
627437
408048 400064 3
407049
408046
408407
385113 368367 3
384114
385384
386112...

output:

664298
366164
613183
126048
572072
625439
407049
384114
611441
492340
580556
624534
608340
212090
680520
616464
652204
479401
610484
532222
100042
650208
692084
639353
109108
551379
528440
575437
658290
642244
686240
627405
685635
440274
689497
345241
502080
621299
500096
579431
608324
628398
701587...

result:

points 0.45263953450 max label = 712711

Test #100:

score: 26.3167
Acceptable Answer
time: 30ms
memory: 4100kb

input:

0
10
1000 1000000000
339 519
436 552
9 671
650 693
652 769
640 509
384 65
726 126
261 226
444 449
419 177
123 140
813 825
4 483
859 484
506 423
273 852
939 263
891 108
985 3
299 95
490 816
846 130
963 551
714 667
771 311
856 316
515 601
647 905
2 877
612 372
163 540
642 602
717 169
699 632
854 124
5...

output:

1000
1000000
725589
114113
825271
968967
855199
786785
720598
850214
816306
888887
821820
906905
727585
993959
789381
659658
263262
558557
754516
785405
932010
504503
854206
783413
926925
707706
765469
876148
800799
879141
793792
208207
756506
440439
828268
711631
300299
916048
611610
806805
456455
...

input:

1
33377
914590 214213 3
913591
914913
915589
837327 312311 3
329328
837325
837329
758490 923035 3
492491
758488
758492
844300 820378 3
843301
844298
844843
828076 994880 3
78077
828078
829075
483205 527526 3
207206
483207
484204
924338 396395 3
340339
924340
925337
950504 887651 3
949505
950949
9515...

output:

915589
837325
758488
843301
829075
484204
924340
949505
533051
842716
179057
906080
722378
708672
1000554
694444
898144
517105
835325
969439
934310
809323
978630
657537
988144
861251
809125
198008
984160
809685
763517
739595
809129
835361
482208
862250
894158
465289
289153
892162
818432
732334
51211...

result:

points 0.43142198430 max label = 1000999

Test #101:

score: 26.6971
Acceptable Answer
time: 16ms
memory: 3784kb

input:

0
10
905 1000000000
149 541
744 692
648 655
441 692
692 263
648 156
754 161
20 648
538 541
285 648
843 541
720 541
692 791
648 167
357 648
533 648
196 541
626 754
692 511
754 485
56 754
893 541
796 541
19 692
541 110
471 541
833 541
754 508
541 593
406 692
355 754
541 777
618 648
648 760
754 121
294...

output:

905
905000
738737
506505
273272
494493
619618
529528
628627
683682
394393
50049
857856
828827
331330
711710
128127
163162
20019
743742
8007
439438
404403
834833
631630
198197
291290
870869
654653
108107
310309
152151
810809
690689
373372
817816
842841
536535
786785
893892
710709
601600
83082
319318
...

input:

1
4502
377335 896895 42
337336
338337
339338
340339
341340
342341
343342
344343
345344
346345
347346
348347
349348
350349
351350
352351
353352
354353
355354
356355
357356
358357
359358
360359
361360
362361
363362
364363
365364
366365
367366
368367
369368
370369
371370
372371
373372
374373
375374
376...

output:

407318
871421
668574
683136
479427
224161
412104
416267
692092
428113
905001
776684
376125
639435
367010
871421
905001
674618
905001
355203
54015
173124
807132
312233
832074
854091
412104
683136
905001
534232
702050
376125
397286
627534
905001
633553
414112
884018
412104
798111
880693
871421
905001
...

result:

points 0.43765714410 max label = 905904

Test #102:

score: 26.3167
Acceptable Answer
time: 14ms
memory: 3836kb

input:

0
10
1000 1000000000
864 948
95 883
976 573
252 601
415 95
95 514
601 388
573 857
666 136
535 95
751 666
605 541
666 971
289 541
69 501
601 321
370 573
438 601
681 515
541 795
948 668
948 827
515 14
515 94
478 601
319 95
69 342
461 186
573 704
69 706
573 301
573 16
772 601
788 666
948 537
666 530
51...

output:

1000
1000000
669668
872871
582581
403402
554553
670669
6005
430429
574573
399398
511510
933932
52051
219218
216215
779778
619618
322321
956955
747746
254253
891890
962961
427426
420419
854853
849848
591590
732731
67066
974973
437436
366365
534533
709708
35034
455454
905904
873872
675674
211210
60960...

input:

1
4293
245244 233232 1
544216
547546 426425 1
957511
779778 796795 1
967742
361360 4003 1
392100
243199 167166 44
201200
202201
203202
204203
205204
206205
207206
208207
209208
210209
211210
212211
213212
214213
215214
216215
217216
218217
219218
220219
221220
222221
223222
224223
225224
226225
2272...

output:

544216
957511
967742
392100
384099
858774
350161
964812
390263
884129
892012
773422
858774
813304
773549
917519
1000001
1000001
884129
836781
1000001
957511
892012
871713
917519
773422
437223
978059
851445
635441
892012
390263
418336
892012
669566
19018
400318
813304
451370
890696
443290
867061
9575...

result:

points 0.43142198430 max label = 1000999