QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#73576#5008. Zero AAMP CurrentsKocyteAC ✓115ms14144kbC++14932b2023-01-26 07:00:272023-01-26 07:00:28

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-26 07:00:28]
  • 评测
  • 测评结果:AC
  • 用时:115ms
  • 内存:14144kb
  • [2023-01-26 07:00:27]
  • 提交

answer

#include <iostream>
#include <set>
#include <vector>

using namespace std;

const int MAX = 200200;

int main(int argc, char *argv[]) {
	vector<int> g[MAX], color;
	pair<int, int> E[MAX];

	int n, m;
	scanf("%d%d", &n, &m);

	for (int i = 0; i < m; i++) {
		int x, y;
		scanf("%d%d", &x, &y);
		x--;
		y--;

		g[x].push_back(y);
		g[y].push_back(x);
		E[i] = { x, y };
	}

	color.assign(n, -2000);

	for (int i = 0; i < n; i++) {
		set<int> s;
		for (int j = 0; j < g[i].size(); j++) {
			int to = g[i][j];
			if (color[to] == -2000)
				continue;
			s.insert(color[to]);
		}

		for (int j = -1000; j <= 1000; j++)
			if (s.count(j) == 0) {
				color[i] = j;
				break;
			}
	}

	for (int i = 0; i < m; i++) {
		int x = E[i].first;
		int y = E[i].second;

		int res = color[x] - color[y];
		printf("%d\n", res);
	}
//	for (int i = 0; i < n; i++)
//		std::cout << C[i] << " ";
}

详细

Test #1:

score: 100
Accepted
time: 7ms
memory: 9880kb

input:

4 7
1 2
2 3
3 1
1 4
2 4
1 4
3 2

output:

-1
-1
2
-2
-1
-2
1

result:

ok good one

Test #2:

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

input:

2 2
1 2
2 1

output:

-1
1

result:

ok good one

Test #3:

score: 0
Accepted
time: 69ms
memory: 12616kb

input:

13758 193861
8665 5619
9734 11588
936 1302
2748 2317
3141 5818
8849 11418
248 943
9907 3274
8337 359
13597 8368
7809 3431
11374 13189
5135 4551
11688 1841
4071 4437
796 364
8000 4384
12954 7759
3399 3585
1918 5592
7368 7392
8872 7186
217 9202
11502 9587
13399 10630
947 3691
1486 8804
8226 7143
2734 ...

output:

-5
-7
2
-1
-3
-7
-1
5
4
8
1
8
-1
7
-1
1
2
2
2
-1
-1
1
-7
7
3
-4
-5
3
2
7
-1
9
5
6
3
-4
-1
-4
-1
5
-4
1
1
-10
-5
-2
-2
-5
-2
7
-5
2
-7
2
5
4
5
-1
-1
-8
-1
6
-1
-6
13
-4
2
-4
2
7
-2
-1
-3
4
1
-2
1
-3
-1
-6
7
3
5
-7
-2
-9
-5
6
4
-3
-3
-4
-1
-6
10
2
-3
-6
-2
2
2
-6
2
4
-1
-1
3
1
9
1
9
-5
-2
7
-6
-7
-6
5...

result:

ok good one

Test #4:

score: 0
Accepted
time: 56ms
memory: 12780kb

input:

2576 198513
2126 2537
2007 428
1155 1644
1657 1832
1459 1922
2240 1132
230 1696
1376 704
971 597
109 533
310 2328
692 1335
757 443
1964 2388
136 263
2139 2546
1451 1917
2048 1636
2502 137
757 2575
647 2480
2004 618
256 1715
2433 2085
79 1933
83 2549
1659 2016
1936 786
1816 2512
1359 953
1747 2366
19...

output:

11
13
-12
-3
-6
18
-13
23
-2
-7
-4
-3
8
-6
-3
12
-20
17
36
8
-24
20
-22
6
-34
-25
-6
4
-16
3
7
-7
30
12
3
3
21
19
-34
-18
1
-1
-8
6
4
-9
14
2
5
1
24
-18
6
28
14
33
-22
1
-14
3
5
9
12
-21
1
-26
-6
18
-16
16
8
13
6
4
-2
1
22
-30
-4
-28
3
-16
-15
25
33
-4
-8
-5
34
8
-7
23
-21
-6
6
-11
-16
-12
-15
-6
15...

result:

ok good one

Test #5:

score: 0
Accepted
time: 88ms
memory: 13712kb

input:

82644 198952
7250 60424
14369 31861
37573 68142
518 73568
74639 26836
50082 46206
25507 52142
59920 68131
55089 52689
53869 67254
32548 11363
57133 35487
69810 22267
51959 3483
69787 67700
26981 50678
30328 1083
18162 39761
49695 23254
54278 33751
2529 28612
13175 38044
27929 60984
11278 39952
46896...

output:

-2
-1
-2
-2
-2
-1
-1
-2
2
-3
1
-1
1
1
-2
-2
1
-2
1
2
-1
-2
-2
-1
-2
-3
-1
1
1
3
-2
1
-1
-1
-2
1
-1
-1
2
2
-1
-4
-1
-4
2
1
3
2
2
-3
2
-1
-3
2
-4
-1
-2
2
1
2
1
-2
2
-1
-2
2
1
1
1
2
2
-1
-2
-3
-4
-1
1
-1
-2
-2
2
2
1
-1
-2
2
1
2
1
-1
3
1
-2
2
3
-3
1
-2
-1
1
1
3
1
1
-1
-1
-2
1
-1
1
-2
-2
-1
-2
-2
2
3
2
1...

result:

ok good one

Test #6:

score: 0
Accepted
time: 55ms
memory: 12308kb

input:

3066 190306
1154 186
1738 2367
2880 2483
1819 148
743 909
2190 878
1769 470
426 638
649 1065
2171 399
1935 1067
465 1763
1188 1773
1024 2198
2128 2238
175 1150
1497 1309
161 449
616 259
1573 1742
2607 2505
2412 2073
1221 1928
1803 1556
2390 1153
2595 3022
2171 2756
991 2114
1250 289
1212 2488
886 24...

output:

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

result:

ok good one

Test #7:

score: 0
Accepted
time: 82ms
memory: 13348kb

input:

62947 193186
22551 46152
47519 19425
11727 62118
1314 39189
12100 58408
1939 22952
27035 2101
8727 11566
31352 16360
6087 34237
55265 53249
11568 56162
45145 17492
25851 58165
20558 49212
54825 3353
61284 39686
8357 8978
12265 10697
3789 41042
14696 54530
34033 18793
44036 1524
10967 28191
34241 333...

output:

-1
3
-4
-2
-1
-2
2
-1
1
-1
2
-3
2
-1
-4
4
2
1
1
-2
-2
1
1
-2
-1
-2
-1
2
1
1
-3
-3
1
1
-1
-1
-2
-1
3
1
-1
1
-1
-1
3
-1
-4
-3
-1
-2
1
1
2
3
-2
1
1
-1
1
1
2
1
3
-1
1
2
3
3
-2
-1
-2
-1
-1
2
1
-2
1
-2
-2
-1
-1
-1
-4
1
-1
2
1
4
1
-4
1
3
1
1
-1
-1
1
-1
-1
-2
3
2
-2
2
3
-2
-3
1
-2
-2
2
1
1
2
1
1
1
1
1
-3
2
...

result:

ok good one

Test #8:

score: 0
Accepted
time: 70ms
memory: 13084kb

input:

43480 191239
2764 9693
11155 3878
35008 22467
15585 19079
18258 36650
22436 8886
40098 31323
29864 15570
28429 18175
32157 17602
28377 39275
34373 38165
35860 30680
15971 17678
28142 21403
36344 28834
4823 35491
42548 9942
8734 26474
333 25614
8695 6193
28083 42472
20275 32280
10644 13870
39269 3238...

output:

-2
-1
-2
-2
-1
-1
1
1
-4
-2
3
-2
-4
1
-2
-1
-1
-2
-1
-2
1
3
1
-1
1
-4
4
4
4
-3
-1
1
1
2
-4
-1
-1
1
-1
1
-2
2
2
1
-4
-2
2
2
2
-1
4
-1
-3
2
-3
-3
3
2
-5
1
-3
1
4
3
-1
6
-3
4
-1
1
-2
-1
3
1
1
1
2
-4
3
-2
-1
-2
1
1
1
1
-3
-1
-4
1
-1
1
-2
-1
1
1
2
-2
2
2
3
1
1
2
-3
2
-3
1
-1
4
-3
-4
4
1
2
-3
-3
-1
1
-1
1...

result:

ok good one

Test #9:

score: 0
Accepted
time: 78ms
memory: 13164kb

input:

44894 196108
4806 34877
9136 30358
10866 17290
15667 13264
17961 12496
32755 29806
2921 42651
13853 5805
13222 34459
13583 19243
43448 3758
12773 19121
3092 25400
27927 43493
43466 16023
17001 40852
12530 4439
27639 6554
3858 34705
42998 21472
293 25255
38745 20928
23393 27405
20963 5755
8850 33548
...

output:

-5
-1
-1
1
-2
1
1
2
-3
-2
3
-3
-3
2
3
-2
2
1
-1
4
-4
4
3
1
-4
1
-2
5
2
2
-4
2
2
-2
-3
3
-1
1
1
-2
-3
-3
-4
1
1
2
3
1
-2
-2
2
-7
5
2
-2
3
-2
2
-2
2
-3
3
4
6
1
1
-1
2
2
-1
-2
-2
-1
2
3
3
3
1
1
1
2
-1
-2
3
3
-1
5
-5
1
1
-1
-2
1
4
1
-1
-1
1
1
2
-2
1
1
1
3
-1
-1
-3
4
-4
-3
1
3
1
-2
1
2
-4
1
-2
2
-2
-3
-4...

result:

ok good one

Test #10:

score: 0
Accepted
time: 90ms
memory: 13780kb

input:

88238 193852
46448 59478
77052 49817
26135 8158
489 74346
73637 53130
86918 84923
32946 55226
7645 65340
55271 18234
76520 5302
18306 64706
39035 21340
61079 82551
79787 76260
82351 4804
59136 25995
18730 43376
34068 20258
8703 20152
18577 86217
2681 42652
31028 46158
57629 2012
11382 2744
55829 724...

output:

-4
-2
2
-2
1
-1
-1
-2
3
2
-1
2
-2
1
1
3
2
1
-1
-2
-2
-1
1
1
1
-3
-2
-1
1
3
1
-2
1
-1
2
-1
-1
1
-2
-3
-2
-1
3
4
-2
1
1
-2
1
-2
3
1
-1
1
1
-2
-1
3
1
-1
1
2
-1
3
4
2
-2
2
1
-1
3
2
-3
1
2
2
-2
-1
1
-1
-1
-4
-1
-2
2
2
3
-2
2
3
-3
-1
1
-1
1
1
2
-2
1
1
-1
5
-2
2
2
-1
-4
-1
1
1
2
1
-1
2
2
3
1
-3
-1
-1
1
3
-...

result:

ok good one

Test #11:

score: 0
Accepted
time: 93ms
memory: 13276kb

input:

57117 191812
53629 33354
8343 12030
25097 45053
10232 43485
41581 27734
6982 26296
11675 9015
54025 817
5712 1030
51794 1681
5041 35170
36971 17853
41180 26869
2695 34545
12630 24160
28687 9970
5945 48619
10552 31410
39963 49269
29651 39405
55892 52341
52613 53900
21986 16435
36002 12820
55903 38326...

output:

3
-2
-2
-1
1
1
1
3
1
3
-1
-1
-3
-3
-1
3
-4
-1
-3
-3
4
-4
1
-3
4
1
4
3
-3
1
2
2
-3
1
-1
-3
1
-3
3
-3
-2
3
-3
2
3
3
3
-2
3
-1
-3
2
1
1
-1
2
-3
3
3
2
2
2
2
-2
2
-1
-2
2
-2
-2
-2
-1
-1
2
-2
-1
3
-2
2
-3
2
-2
-2
-1
3
-1
-1
-2
2
-1
-3
1
1
2
-2
-1
-2
2
-2
3
-5
2
-5
-2
2
-4
3
-2
2
1
2
-2
2
-2
1
1
3
-5
3
1
-...

result:

ok good one

Test #12:

score: 0
Accepted
time: 76ms
memory: 12892kb

input:

30067 190595
10345 14018
13995 4745
1600 20148
252 15031
12820 20909
17958 27642
5724 6189
27053 22793
1144 28863
8622 3153
28637 22765
29959 20058
27027 2115
3100 548
7156 14515
7765 8073
14728 19693
26144 29357
20672 10328
17818 28830
15070 21837
13240 8941
19948 8167
10401 49
12118 8658
26577 286...

output:

3
1
-2
1
1
-2
3
1
-1
-1
4
2
4
1
-2
1
-3
-3
3
3
-1
3
2
2
2
-7
1
-6
-3
-1
-3
2
-1
-1
3
1
1
-4
-2
-4
-1
1
-2
-1
4
-1
1
-4
5
-1
3
-3
1
1
-1
1
2
-2
2
-1
2
1
-5
1
-5
5
4
-4
6
-2
-3
-2
-1
-2
-2
-2
-4
-2
-1
-1
-2
1
5
-4
-5
-1
-3
-3
1
-3
1
-2
2
-1
2
2
-1
1
-3
4
1
1
-1
-1
2
-5
2
-5
3
3
-1
-4
1
-2
-3
-4
5
-4
-...

result:

ok good one

Test #13:

score: 0
Accepted
time: 71ms
memory: 13296kb

input:

60185 194321
48556 16368
33074 37628
16897 6151
53328 35423
24938 28966
4446 20680
10805 34656
55104 21351
4794 1562
16489 1003
42454 40020
27828 30159
53382 27263
2136 39772
5791 10977
46156 56376
41674 43756
50684 35300
3446 43407
52540 59392
22999 50053
21235 42574
21676 40382
27243 43401
7693 34...

output:

3
-2
1
2
3
-1
-1
3
-1
2
2
1
-2
-1
-1
-1
1
-2
-1
-1
-2
-2
-1
-3
-4
1
-5
-2
3
1
1
1
-3
-1
-2
-1
-1
-3
-2
-1
1
1
3
-1
-1
4
3
-5
2
1
-1
1
1
2
-1
2
2
1
-2
-1
-2
-1
-3
-3
-1
1
-2
-1
2
-2
-1
5
-4
-1
2
1
1
1
2
1
1
3
1
-1
-2
1
2
-1
-2
-1
1
-3
-2
1
1
-3
2
-1
-1
-2
1
2
1
2
-2
1
-1
2
-1
-2
-2
2
-5
2
3
2
-4
2
2
...

result:

ok good one

Test #14:

score: 0
Accepted
time: 82ms
memory: 12964kb

input:

30986 192197
7315 4118
2366 20107
17954 12256
7269 23827
14233 23892
725 14826
16798 21774
21071 14124
17811 17311
13247 30296
4559 8167
30370 26915
19016 29256
4741 23129
3198 20086
27821 8224
4020 7717
653 22091
29067 5775
20783 29559
13780 10504
14648 24300
18455 25243
27325 13419
144 10962
3944 ...

output:

1
1
1
-1
-3
-3
-5
-3
-2
-2
-3
-2
-4
-3
-3
3
-2
-5
3
-2
-1
-2
-3
-1
-3
-2
1
-2
3
4
-4
-3
4
1
4
3
-6
2
5
1
-2
-1
-2
-5
3
-2
-1
-1
5
-3
-1
-5
-2
-1
1
-2
-6
6
-1
3
1
-5
-2
3
2
2
-1
-1
-6
-1
2
1
-1
2
-3
6
-5
-1
-3
-2
-2
-2
-4
-3
-2
-2
1
4
3
1
2
-1
-3
-3
1
3
-2
1
3
1
4
-1
-3
3
-1
5
4
1
1
-1
4
-1
5
-1
1
2
...

result:

ok good one

Test #15:

score: 0
Accepted
time: 73ms
memory: 13208kb

input:

39822 198848
31937 20331
33697 34785
1717 17646
1987 16747
14936 31909
29747 19519
29449 19291
25943 1566
25902 33889
33198 38326
351 2905
32397 10664
22512 7042
33766 3167
16398 26018
33906 29987
2809 30135
8202 16503
31051 32967
29085 14715
12287 20834
27030 15322
21704 12413
37524 25073
25343 168...

output:

4
-3
-2
-1
-1
3
4
2
-1
-1
-2
5
3
1
-2
3
-3
-1
-1
3
-1
2
2
3
-1
-2
-1
-3
-2
1
3
-1
-1
-3
3
-2
4
3
-1
1
-2
1
-1
1
4
3
-1
1
-1
-5
-2
-2
3
-2
5
-1
-1
-1
1
-1
-5
-2
1
-1
1
-1
3
1
3
2
-3
3
1
2
1
4
-1
-1
-2
1
4
-3
1
-1
-4
3
3
2
1
1
2
5
1
1
3
-2
-1
-3
1
-1
1
-4
-4
2
-2
-1
-1
-1
4
-2
-1
-4
-1
1
2
-4
-3
1
1
1...

result:

ok good one

Test #16:

score: 0
Accepted
time: 77ms
memory: 13960kb

input:

91910 197832
10305 11965
19190 39378
3223 2745
353 10263
88073 74784
1517 73626
43781 33872
81744 12703
25242 6863
90804 27937
55800 37501
32343 55209
44395 90499
46918 1622
42613 30682
50382 28083
46856 20870
59072 31005
54528 60124
51736 90761
46972 46468
31309 49895
38016 37238
39352 48876
30424 ...

output:

1
-1
1
-1
2
-2
2
2
1
3
1
-4
-2
1
3
1
-1
3
-2
-1
2
1
-2
-1
1
1
1
-2
-1
-2
-1
-3
-1
-2
3
1
-1
1
-2
-2
1
-3
-2
2
-1
2
1
-1
-1
2
2
1
2
-1
4
-2
2
1
1
1
-2
-3
1
1
3
1
2
-3
-1
1
1
-1
2
1
-1
-2
1
1
3
-3
-3
3
1
-4
1
3
-1
-1
-1
-1
-1
-1
1
-1
4
3
-1
-1
1
1
-3
1
2
1
2
-2
-1
-2
1
-1
-3
-1
-1
1
-2
-1
1
-1
1
1
-1
...

result:

ok good one

Test #17:

score: 0
Accepted
time: 93ms
memory: 13760kb

input:

80690 198571
21961 51934
52078 46795
78135 5442
3250 27750
68754 16151
36458 22844
45270 13966
61722 10500
50375 54405
48741 54238
685 30072
53054 31282
22548 2253
18272 903
15040 71394
955 42852
7085 68179
29934 27110
71470 9399
37754 43073
56895 21800
35571 15658
7845 46050
10177 76606
40711 73305...

output:

1
-2
3
-2
-1
2
2
-1
-1
-2
-2
3
2
1
-2
-1
-1
1
4
1
1
1
-2
-2
2
3
4
1
-2
-1
-3
-1
1
-1
-1
2
2
-2
2
-2
-3
-3
3
-1
2
4
-2
1
3
2
-2
-1
-3
1
1
2
-1
1
-1
-2
1
-1
1
1
-1
-4
1
3
-1
1
-1
1
-2
-4
-1
1
2
1
1
2
1
-1
-1
-2
-2
-3
-3
-1
1
4
1
-3
-1
2
-2
1
-3
-3
-2
2
2
2
-3
1
-3
-3
-2
1
2
-1
1
-1
-2
-1
-3
-2
-1
2
1
...

result:

ok good one

Test #18:

score: 0
Accepted
time: 72ms
memory: 12964kb

input:

37473 192482
13440 21528
23924 4048
24987 29389
34848 5471
15690 31834
12663 33414
2795 11287
10611 21751
35400 1942
12452 27183
3392 236
16140 13876
37230 13080
37012 24456
1399 8715
977 12031
23282 2457
12896 14765
36890 5722
19335 36150
25549 31540
8901 33529
18235 4416
970 18218
6403 4569
17319 ...

output:

-1
1
1
3
-4
-3
-3
-2
1
1
1
1
5
-3
-1
-3
3
2
2
-3
-1
1
3
-4
2
-1
3
1
-1
-4
-1
2
-1
-1
2
2
1
-1
-2
-2
-5
-5
-2
2
3
-1
4
5
1
2
4
-3
-6
2
-2
1
-2
2
-2
-4
-2
4
-1
-2
-2
-1
2
-3
4
-2
1
2
-4
-1
-2
2
-1
1
1
3
1
2
2
5
3
2
1
1
1
-1
-3
1
-2
1
1
-1
1
-3
1
1
3
-1
-3
-1
-1
-7
2
-3
-4
3
-5
2
3
-1
-1
-2
2
1
-2
-2
2...

result:

ok good one

Test #19:

score: 0
Accepted
time: 85ms
memory: 14052kb

input:

100000 200000
95846 76140
70125 3369
91264 90314
8492 46342
11760 94433
91249 1250
81517 63944
72014 37341
3303 9722
243 77717
26751 99494
95347 17205
15724 15677
85675 26653
28830 90255
36019 36997
10488 79704
54538 36274
57304 23167
39393 56311
71726 69930
51786 17224
46624 76446
2999 48250
62722 ...

output:

1
-1
-3
-1
-2
1
1
1
-1
-2
1
-1
-1
1
-2
-1
-1
-1
1
-2
1
-1
1
-1
1
1
1
1
-1
-1
-3
2
1
-1
1
2
1
1
-1
-1
1
-1
-1
1
-1
1
-1
3
1
-1
1
2
-2
-2
4
3
-1
1
-1
1
-1
2
-1
-1
-1
-1
2
1
-3
-1
2
-2
-3
1
-1
1
1
-1
-2
1
1
-1
-1
1
-1
1
1
1
-3
-1
-2
-1
1
3
-2
1
-1
1
-1
-1
1
2
-1
2
1
-1
1
-1
2
-3
1
1
2
1
1
1
1
-1
-1
1
-...

result:

ok good one

Test #20:

score: 0
Accepted
time: 86ms
memory: 14000kb

input:

100000 200000
83849 21488
52302 37545
82359 71980
95443 81516
65961 93512
77251 57522
59200 92396
48566 83664
7040 14688
14427 87861
49501 57013
47974 74312
16452 3911
1221 73835
63180 20884
88776 40807
95947 42562
31067 73821
53920 43172
74694 39481
15429 84143
3399 87168
71412 46522
97152 11683
47...

output:

2
1
2
-1
-1
2
-2
-2
-1
-1
-1
-1
1
-2
1
1
-1
-1
-1
3
-2
-1
-1
3
-2
-1
1
-2
1
3
-3
-1
-1
-1
-1
2
1
-1
1
-3
-1
-1
-1
-2
2
2
1
2
-2
1
-2
2
1
1
1
-2
1
1
1
-1
1
2
-1
2
-1
3
1
1
-3
-1
-1
-3
-2
1
-1
-1
2
-3
-2
-1
-2
-3
1
-1
-1
-1
3
-1
-1
2
1
1
1
2
1
2
1
-2
1
-1
1
-2
1
2
2
-1
1
1
3
3
1
1
2
-1
-1
-1
-1
-1
-1
...

result:

ok good one

Test #21:

score: 0
Accepted
time: 83ms
memory: 14144kb

input:

100000 200000
58987 61049
71738 53668
26361 2281
87841 73526
77982 66740
49515 22092
84826 7690
1387 72150
49976 615
63841 44885
17357 60030
83752 60207
52473 96219
93778 10715
92695 55171
36451 99872
1405 99234
60020 87483
80774 25801
46063 37442
30974 8875
4697 13596
34335 72872
41817 25484
49698 ...

output:

-2
-1
1
1
3
2
2
-3
2
-2
-1
1
-2
3
2
1
-3
-3
1
1
1
-1
-1
1
3
-1
1
-1
-3
-1
2
-1
1
-1
1
1
1
-2
-1
-1
-1
3
4
1
2
-1
-1
-3
-2
2
-1
-2
2
2
1
1
3
1
-2
-1
-1
-2
-1
-1
-1
2
1
-1
-1
3
3
2
2
2
1
1
-2
3
-1
1
-1
-1
-1
-1
-2
-1
-1
1
1
-3
-1
-2
-1
2
2
-2
2
-2
1
2
-4
1
1
2
1
-1
-1
-1
1
3
-1
-1
2
-1
-1
-2
2
-1
-1
-...

result:

ok good one

Test #22:

score: 0
Accepted
time: 109ms
memory: 14104kb

input:

100000 200000
61531 39695
44632 20774
47490 63977
11320 87977
22483 84362
97339 83997
66856 45614
58751 92088
50968 22234
15401 55813
24179 58381
50919 52415
27723 14965
73732 26913
97080 22998
29750 89034
94983 76318
11015 96185
65987 90703
93206 85215
35593 10642
26499 55355
58488 60609
84201 5522...

output:

1
2
-1
-2
-1
-1
3
-1
3
-1
-1
-1
-1
-1
-2
-3
1
1
-3
-1
1
-1
1
-1
-1
-2
1
2
1
2
1
1
2
-3
-2
2
-1
2
-2
1
1
3
-2
2
3
-1
-2
1
1
2
-4
1
2
1
-3
-1
-1
2
-1
-1
1
-1
-1
1
1
2
2
2
1
1
1
1
1
2
2
-1
-2
-1
1
1
-3
2
1
1
2
-3
-1
-2
2
-1
-2
1
-2
-1
-2
-2
2
-1
-1
3
-1
1
-2
-2
-3
-3
2
-2
-1
2
2
-3
2
-1
1
-1
-2
2
-2
1
...

result:

ok good one

Test #23:

score: 0
Accepted
time: 96ms
memory: 14080kb

input:

100000 200000
53412 96815
66768 25886
52007 38071
3793 84234
10089 78405
19880 70751
49212 11313
88319 94289
48424 43501
56528 43410
81110 4648
76913 8860
8685 3118
35692 55330
784 15167
92405 37975
25886 10675
53631 64986
23498 68235
84426 8010
76287 62434
84435 23848
16561 91183
53030 23483
76417 ...

output:

-1
2
1
-1
-1
-1
-1
2
-1
2
2
2
1
-1
-1
1
-1
-1
-2
1
1
1
-2
1
1
2
-1
2
1
-1
3
-1
-3
1
1
-2
1
1
3
-1
-2
-2
2
-1
-2
2
1
1
1
-1
3
1
1
-2
2
-3
-3
1
1
-3
-2
2
1
-1
-1
1
1
-1
2
-2
-2
-3
-3
-1
1
-2
-1
-1
-1
1
1
-2
-1
-1
-1
2
1
1
-2
-1
-1
-1
1
-1
-1
-1
-4
1
2
-1
-2
-2
-1
-1
-2
-1
2
-3
2
-2
-1
2
-2
-2
-1
1
-2
...

result:

ok good one

Test #24:

score: 0
Accepted
time: 111ms
memory: 14000kb

input:

100000 200000
5131 78762
42404 93493
52235 71438
85648 7787
81905 66559
29178 27650
48236 74286
64218 35483
65744 50690
589 46895
3077 56002
89577 32355
49453 92405
78780 61760
79011 68198
80862 39323
64144 31834
84503 52051
40908 65062
19814 87794
66213 97894
23455 88113
96323 12512
42435 46880
976...

output:

-2
-3
-3
2
2
2
-1
1
2
-1
-1
3
-1
1
1
-1
1
-2
-1
-1
1
-2
2
1
1
-1
-1
-1
3
2
1
2
2
-1
-1
-1
2
-1
1
-2
-1
2
-1
2
3
1
-2
1
1
-1
2
1
2
-2
2
3
-1
1
-3
-2
1
2
-2
1
1
3
-1
2
-3
2
-1
-1
-1
3
3
-1
-2
-1
1
-1
1
-1
-3
1
-2
-2
1
-3
1
-1
-3
-1
-4
-1
1
1
-1
3
-1
1
-1
-1
-3
-2
-1
1
1
1
-1
-1
-3
-1
-1
2
-2
-2
1
1
-1...

result:

ok good one

Test #25:

score: 0
Accepted
time: 115ms
memory: 14000kb

input:

100000 200000
41616 13893
25722 75287
53284 35348
59288 22280
32989 4762
22159 16632
96009 60218
57263 89931
36667 34473
78984 32519
70597 73841
32896 43752
29709 74369
94444 27128
75931 80679
74452 42941
83117 42464
57606 93177
99417 88728
41366 1361
37980 61662
75105 82403
43353 50922
46255 3399
7...

output:

1
-1
1
3
1
2
-1
-1
1
1
-1
-1
-2
2
2
2
1
-1
-2
1
2
-2
-1
1
-1
-1
-1
1
2
-1
-1
-1
-1
-2
2
2
2
1
-2
-1
-1
2
-4
1
2
1
-1
3
-1
1
1
-3
-1
-1
-1
-2
-2
-1
2
2
-2
1
1
-1
-2
-1
-2
1
-2
1
-1
-1
-2
-1
1
-1
1
-1
1
-2
-1
1
-2
1
2
-2
-1
-1
-2
-1
1
1
-1
1
2
1
-1
1
1
-2
-1
-3
1
1
2
-1
1
-1
1
-1
-1
-1
-1
-1
1
-1
3
3
...

result:

ok good one

Test #26:

score: 0
Accepted
time: 91ms
memory: 14044kb

input:

100000 200000
50724 36149
50482 85130
62118 23067
7817 74516
60553 82912
57489 63150
49494 15229
85938 55220
70603 91964
77101 22606
37898 18718
25168 39454
21603 86140
25491 25615
14343 2590
50233 15978
67796 7141
76406 5654
48616 15580
43403 31818
44891 42339
96839 31754
36102 44574
41231 2546
971...

output:

1
-2
2
-2
-1
-3
1
2
1
3
1
-1
-4
-2
1
-1
2
1
1
1
1
2
-1
1
1
-1
2
-1
-1
1
-1
1
1
-3
1
-1
1
-1
-1
-2
1
-1
-1
1
-1
-1
1
2
-1
3
2
2
1
-3
-1
2
-2
1
-1
1
1
3
-1
1
-1
1
-3
1
-2
-3
-1
-2
1
-1
-1
-1
1
-1
2
2
-1
-2
3
-1
-2
1
-1
1
1
-2
-1
-1
1
2
-2
1
-1
-1
1
1
-3
4
1
-1
-1
1
1
1
-2
-3
-2
1
-1
1
3
-1
-2
1
2
2
1
...

result:

ok good one

Test #27:

score: 0
Accepted
time: 103ms
memory: 14064kb

input:

100000 200000
56671 48189
34975 48598
30103 97369
93468 73079
62494 17602
2359 36405
78972 73193
86427 39506
33465 16790
5372 24962
98974 59261
82529 8093
59407 32284
23001 16363
43385 27646
84703 46571
11229 45529
9261 85651
45367 56089
2786 72313
6788 1068
91398 96916
91655 24664
30858 28977
21593...

output:

2
-1
1
-2
2
-1
2
1
1
-2
3
2
1
-1
1
1
1
-3
-1
-2
1
-2
-1
2
1
1
1
4
1
-1
1
1
-1
2
3
-1
-2
1
1
-1
-3
-2
1
1
2
1
-1
1
-1
-1
-1
1
2
-1
1
1
-1
3
2
2
-1
1
-2
-3
-1
-1
-4
-2
2
1
2
-1
-3
1
-4
2
-1
-1
1
1
2
1
-1
-1
-2
-1
-2
1
2
1
2
1
1
-1
-1
4
1
-2
1
-1
-3
-1
1
2
-1
3
-2
-2
2
-1
4
1
-1
1
-1
1
-3
1
2
2
1
2
-1
...

result:

ok good one

Test #28:

score: 0
Accepted
time: 64ms
memory: 12616kb

input:

13758 193861
9734 10314
10314 10872
10872 1602
1602 7202
7202 13249
13249 11073
11073 6133
6133 6517
6517 1371
1371 6674
6674 5085
5085 11683
11683 6382
6382 13011
13011 5390
5390 4879
4879 8256
8256 11007
11007 9724
9724 10240
10240 8101
8101 5891
5891 4738
4738 10854
10854 11567
11567 8155
8155 49...

output:

-1
-1
6
-6
4
-6
7
-1
4
-6
3
-6
1
1
6
-1
-4
3
-5
3
-2
2
1
-6
8
1
-2
-1
1
-2
-3
4
-1
3
1
-6
4
3
-4
-3
7
-10
10
-1
-3
-6
10
-1
-8
1
4
-2
6
-4
4
-5
5
-5
1
2
-4
-5
10
-4
-2
4
1
2
-4
3
1
-5
5
-3
-2
5
-7
-2
4
5
-3
-1
-1
5
-3
-5
5
-7
5
-4
2
1
1
-3
5
-3
-4
7
-9
10
2
-5
-5
-1
5
6
-11
3
-1
6
-3
-1
6
-2
-1
-1
3...

result:

ok good one

Test #29:

score: 0
Accepted
time: 60ms
memory: 12812kb

input:

2576 198513
2007 2105
2105 1045
1045 2544
2544 1693
1693 142
142 1041
1041 809
809 2136
2136 1863
1863 2322
2322 849
849 2112
2112 857
857 1083
1083 638
638 1661
1661 226
226 548
548 2365
2365 56
56 1846
1846 811
811 742
742 1964
1964 1227
1227 1776
1776 916
916 907
907 195
195 1021
1021 1901
1901 4...

output:

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

result:

ok good one

Test #30:

score: 0
Accepted
time: 101ms
memory: 13996kb

input:

82644 198952
14369 38166
38166 8025
8025 74259
74259 20862
20862 21855
21855 23561
23561 33654
33654 19654
19654 65205
65205 50573
50573 28578
28578 9376
9376 48693
48693 45281
45281 15921
15921 78701
78701 30418
30418 46756
46756 45707
45707 70841
70841 22881
22881 57706
57706 32178
32178 69215
692...

output:

2
-1
1
-2
2
-1
-1
1
-1
1
-1
2
-3
1
2
-3
2
-2
3
-1
1
-2
2
-3
3
-1
1
-2
1
-1
2
-2
2
-3
3
-1
1
-3
3
-1
-2
1
2
-1
-3
4
-1
-1
1
1
-1
1
-2
1
1
-1
1
-2
2
-3
1
2
-1
-1
1
-1
2
-3
1
2
-1
-2
3
-2
1
1
-1
1
-1
-1
-2
4
-2
1
-1
2
-1
1
-1
1
-2
2
-4
4
-2
1
1
-3
3
-1
-2
1
1
1
-2
1
1
-1
1
-2
2
-1
-3
3
1
-1
1
-1
1
-2
2...

result:

ok good one

Test #31:

score: 0
Accepted
time: 59ms
memory: 12352kb

input:

3066 190306
1738 2537
2537 1704
1704 1292
1292 1261
1261 1156
1156 2399
2399 2358
2358 1474
1474 560
560 415
415 2863
2863 1902
1902 1805
1805 369
369 1926
1926 379
379 1298
1298 39
39 2896
2896 2623
2623 2960
2960 1972
1972 372
372 346
346 1206
1206 790
790 66
66 231
231 2401
2401 1551
1551 720
720...

output:

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

result:

ok good one

Test #32:

score: 0
Accepted
time: 98ms
memory: 13520kb

input:

62947 193186
47519 44243
44243 11193
11193 10826
10826 8728
8728 6887
6887 10776
10776 59071
59071 42377
42377 51605
51605 3133
3133 52665
52665 62934
62934 9355
9355 21865
21865 25494
25494 31300
31300 32398
32398 18242
18242 45820
45820 47445
47445 26114
26114 31067
31067 21478
21478 19558
19558 5...

output:

-3
3
1
-1
1
-1
-1
1
-3
4
-1
-3
4
-1
1
-2
1
1
-2
1
1
-2
1
-1
-2
4
-2
2
-3
1
1
-2
1
1
-2
1
2
-1
1
-5
3
1
-1
-2
3
-1
2
-4
3
-2
-1
3
1
-2
2
-3
2
1
-1
-1
2
-2
2
-2
-3
4
1
-1
-2
3
-2
1
1
-1
-1
-2
4
-1
1
-2
2
-1
-1
2
-1
1
-1
-2
1
1
1
-2
1
1
-3
-1
3
1
-3
2
1
-2
2
-1
-1
-1
3
-1
-2
2
-3
3
1
-2
2
-2
2
-1
1
-2
...

result:

ok good one

Test #33:

score: 0
Accepted
time: 80ms
memory: 13104kb

input:

43480 191239
11155 10225
10225 43244
43244 1713
1713 14645
14645 27359
27359 23140
23140 18479
18479 6396
6396 28179
28179 19088
19088 42538
42538 36224
36224 27054
27054 19997
19997 23865
23865 29197
29197 25035
25035 32937
32937 32337
32337 14753
14753 14105
14105 33516
33516 36557
36557 24963
249...

output:

1
-1
1
-1
-2
2
-2
2
-1
-2
-2
2
-1
3
-1
-1
1
1
-3
5
-3
1
-4
5
-1
1
-3
4
-3
2
1
-4
3
-3
4
-1
1
-3
2
1
-2
-1
3
-2
-1
3
-2
-1
3
-1
-3
2
2
-1
-2
3
-2
2
-4
2
-1
2
1
-2
-3
5
-1
-3
2
2
-2
1
-1
2
-3
-1
2
-1
3
-1
1
-4
4
-5
1
3
-3
3
-2
3
-1
-1
1
-3
1
2
-1
1
-2
3
-1
-4
4
-4
5
-1
-1
1
1
-4
2
-2
3
-1
-1
2
-2
1
1
...

result:

ok good one

Test #34:

score: 0
Accepted
time: 96ms
memory: 13164kb

input:

44894 196108
9136 34157
34157 14616
14616 13372
13372 30799
30799 25932
25932 12847
12847 9656
9656 12309
12309 14718
14718 26967
26967 35141
35141 7851
7851 25591
25591 9544
9544 28866
28866 21085
21085 41045
41045 36348
36348 21752
21752 23669
23669 839
839 7252
7252 28433
28433 16461
16461 36184
...

output:

-2
2
2
-4
4
-1
-1
1
-1
2
-1
1
-2
1
-2
1
2
-5
5
-5
5
-2
2
-3
3
-3
2
1
-3
3
-1
1
-2
-2
-1
4
-2
3
-1
-1
-2
1
3
-4
4
-1
-4
2
2
1
-1
-1
2
-2
2
-1
1
-2
-1
3
-3
-1
2
-2
1
2
-3
3
-1
-1
3
-2
1
-3
4
-3
1
1
-2
2
-2
-2
1
2
2
-3
-1
4
-3
1
2
-1
-1
-3
4
-2
3
-3
2
1
-4
4
-1
-1
-3
2
3
-3
3
-1
1
-2
1
-1
-4
3
3
-2
2
-...

result:

ok good one

Test #35:

score: 0
Accepted
time: 94ms
memory: 13832kb

input:

88238 193852
77052 68192
68192 77813
77813 39146
39146 45801
45801 665
665 76961
76961 85198
85198 78074
78074 67590
67590 52330
52330 5738
5738 48259
48259 87814
87814 28365
28365 77083
77083 67906
67906 38325
38325 53288
53288 7728
7728 74011
74011 80072
80072 29963
29963 28230
28230 9749
9749 139...

output:

-1
-2
4
-1
1
-1
-1
2
-2
1
1
-1
1
-1
-2
1
1
1
-1
-1
1
1
-1
1
-1
1
-2
1
1
-1
1
-1
1
-2
-1
2
-2
2
1
-1
-1
2
-1
1
-1
1
-2
1
1
-2
1
1
-1
-1
-1
2
-1
1
-2
1
2
-3
2
-1
2
-1
1
-3
3
-2
1
1
-2
2
-2
1
-1
2
-2
-1
1
2
-1
-2
2
1
-1
1
-1
1
-1
1
-1
-3
4
-1
1
-2
2
-2
2
-1
-1
2
-2
2
-2
1
-1
2
-2
2
-2
-1
2
1
-1
1
-1
1
...

result:

ok good one

Test #36:

score: 0
Accepted
time: 84ms
memory: 13356kb

input:

57117 191812
8343 12597
12597 45223
45223 2159
2159 52976
52976 48490
48490 25963
25963 32595
32595 30306
30306 5149
5149 26914
26914 9456
9456 15655
15655 45190
45190 26814
26814 45052
45052 24030
24030 5561
5561 52213
52213 55549
55549 39706
39706 36036
36036 48171
48171 45129
45129 8329
8329 4025...

output:

1
-1
2
-1
-1
1
-2
1
2
-1
1
-1
-2
2
-2
2
1
-3
-1
4
-1
1
-1
1
-2
1
-1
1
-1
2
-1
1
-2
1
1
-1
1
-1
-1
1
-2
3
-1
1
-3
1
1
-1
1
1
-2
2
-2
1
1
-1
1
-1
1
-1
-1
2
-1
-4
5
-1
1
-3
-1
2
-1
-1
3
-2
3
-2
1
-1
1
1
-3
2
-2
-1
2
-2
2
1
-3
4
-5
4
1
-1
1
-2
-1
1
1
-1
-1
1
2
-3
-1
2
2
-3
3
-2
-2
4
-2
-3
4
-1
-2
2
1
-1...

result:

ok good one

Test #37:

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

input:

13758 193861
9734 10314
10314 9734
11967 6004
6004 7514
7514 12027
12027 10332
10332 9106
9106 3200
3200 10217
10217 8950
8950 10230
10230 10093
10093 2789
2789 2654
2654 13389
13389 11967
8288 9693
9693 5244
5244 2265
2265 1367
1367 139
139 8284
8284 3570
3570 7382
7382 729
729 2726
2726 8689
8689 ...

output:

-2
2
10
-8
-3
4
3
1
-2
-1
3
-6
7
1
-5
-4
1
7
1
-1
1
-2
2
-2
1
-3
-2
-1
2
-1
4
-2
3
-7
-1
2
-3
-2
6
-11
9
-2
4
-5
-1
4
-3
5
-7
1
-1
-4
2
3
1
-3
7
-2
-1
-6
10
-5
2
-3
-3
9
-3
-2
-4
3
2
-5
-2
8
4
-8
4
4
-2
-2
8
-8
-4
4
-3
4
-3
-5
9
-5
3
-6
3
2
-6
-1
3
-2
4
-5
7
-2
-3
2
-1
-6
9
-4
-3
4
1
3
1
-5
4
-6
1
3...

result:

ok good one

Test #38:

score: 0
Accepted
time: 71ms
memory: 12800kb

input:

2576 198513
2007 2105
2105 2007
975 2090
2090 2444
2444 1776
1776 434
434 2148
2148 975
2457 1125
1125 1723
1723 1826
1826 1202
1202 2457
1383 2283
2283 1473
1473 980
980 295
295 64
64 1344
1344 1383
1785 1066
1066 930
930 1785
1127 2395
2395 449
449 1127
33 1227
1227 1853
1853 1567
1567 33
841 1727...

output:

18
-18
-22
11
-4
16
-10
9
12
2
-5
12
-21
6
-7
6
14
4
-18
-5
12
3
-15
-16
32
-16
-18
-1
17
2
-14
27
-13
-14
14
-9
17
-32
12
27
-15
-3
31
3
-31
-21
16
5
-3
3
-22
12
-2
12
-15
2
13
-16
16
16
-25
6
2
1
8
-7
-25
16
11
-13
-15
30
4
-9
-31
31
20
-3
-2
9
-5
-4
-16
18
-1
5
-21
-27
1
25
1
-9
5
-29
36
-10
7
-4...

result:

ok good one

Test #39:

score: 0
Accepted
time: 87ms
memory: 13928kb

input:

82644 198952
14369 38166
38166 8025
8025 74259
74259 20862
20862 21855
21855 23561
23561 33654
33654 19654
19654 65205
65205 50573
50573 28578
28578 9376
9376 48693
48693 45281
45281 15921
15921 14369
11082 11038
11038 67780
67780 13760
13760 47917
47917 48309
48309 73163
73163 76268
76268 14098
140...

output:

-1
2
1
-2
2
-1
1
-1
-1
-1
1
2
-2
1
1
-2
1
-3
3
-1
1
-1
-1
1
-1
2
-3
2
1
-1
-1
2
-1
1
-1
1
-1
1
-1
-1
1
1
-1
1
-1
-1
2
-2
1
1
-1
1
-1
1
-1
1
-1
1
-1
-1
2
-3
2
1
-2
2
-1
-4
1
3
-1
1
1
-2
1
-1
2
-1
-2
2
1
-2
2
-1
1
-3
1
2
-2
1
1
-2
2
-1
-2
3
-1
1
-2
2
-1
1
-1
1
-1
-3
3
1
-1
-2
1
2
-1
1
-1
1
-2
1
1
-3
3...

result:

ok good one

Test #40:

score: 0
Accepted
time: 55ms
memory: 12396kb

input:

3066 190306
1738 2537
2537 1704
1704 1292
1292 1261
1261 1156
1156 2399
2399 1738
2973 1661
1661 2973
1925 2711
2711 2285
2285 1206
1206 1925
1838 2490
2490 181
181 689
689 138
138 1679
1679 2966
2966 1838
1492 2064
2064 2991
2991 2187
2187 2184
2184 1647
1647 1492
2270 1821
1821 2707
2707 1693
1693...

output:

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

result:

ok good one

Test #41:

score: 0
Accepted
time: 86ms
memory: 13444kb

input:

62947 193186
47519 44243
44243 11193
11193 10826
10826 8728
8728 6887
6887 10776
10776 59071
59071 42377
42377 51605
51605 3133
3133 52665
52665 62934
62934 47519
32298 17226
17226 35886
35886 31557
31557 57077
57077 12663
12663 59540
59540 26613
26613 28901
28901 22708
22708 16122
16122 40484
40484...

output:

-1
2
1
-1
1
-1
-2
2
-2
3
-3
-1
2
-1
-2
3
-4
2
2
-2
1
-2
3
-1
1
-4
1
3
-2
2
-1
1
-1
1
-2
-1
3
-4
1
3
-1
1
-2
2
-1
-2
3
-2
2
-1
-1
2
-1
-2
3
-1
1
-4
2
-2
1
3
-3
-1
3
1
-1
-2
-1
1
2
1
-2
-1
3
-2
-1
-1
4
-1
1
-1
-2
2
-1
-1
3
-1
-2
1
-1
2
1
1
2
-3
1
1
1
-3
-1
2
1
-3
3
-2
2
-1
1
-3
2
-1
2
-2
-3
4
1
-1
-3
...

result:

ok good one

Test #42:

score: 0
Accepted
time: 73ms
memory: 13196kb

input:

43480 191239
11155 10225
10225 43244
43244 1713
1713 14645
14645 27359
27359 23140
23140 18479
18479 6396
6396 28179
28179 19088
19088 42538
42538 36224
36224 27054
27054 19997
19997 23865
23865 29197
29197 25035
25035 32937
32937 32337
32337 14753
14753 14105
14105 33516
33516 36557
36557 24963
249...

output:

1
-1
1
-1
-1
1
-2
2
-2
1
-4
2
2
-1
1
-3
2
1
1
1
-3
2
-3
2
2
-1
-1
2
-1
-1
1
-3
3
-3
4
-1
1
-3
2
1
-1
-1
2
-2
-1
3
-2
-1
3
-3
-1
2
2
-1
-1
2
-4
4
-5
3
1
-3
2
1
-4
5
-1
-3
3
-1
-3
2
1
-3
1
3
1
-5
3
-1
1
2
-5
5
-1
1
-1
-3
2
-2
3
-2
3
-2
2
-4
1
3
-4
3
1
-1
-1
2
-1
-1
-2
4
-1
-2
3
-2
2
-3
2
-2
1
2
-1
-1
...

result:

ok good one

Test #43:

score: 0
Accepted
time: 78ms
memory: 12632kb

input:

13758 193861
9734 10314
10314 10872
10872 1602
1602 7202
7202 13249
13249 11073
11073 6133
6133 6517
6517 1371
1371 6674
6674 5085
5085 11683
11683 6382
6382 13011
13011 5390
5390 4879
4879 8256
8256 11007
11007 9724
9724 10240
10240 8101
8101 5891
5891 4738
4738 10854
10854 11567
11567 8155
8155 49...

output:

-5
-1
5
-3
1
2
-1
-1
4
-6
3
-7
4
3
2
-1
-4
3
-2
-5
4
3
-4
-2
6
3
-5
-2
4
-6
-1
6
-1
2
2
-6
4
3
-9
5
4
-5
5
-7
-1
2
6
-1
-6
-1
2
-2
8
-4
4
-5
5
-8
4
2
-5
4
2
-4
-1
3
1
2
-4
3
1
-4
4
-3
-1
4
-8
-1
4
3
-7
5
-2
6
-3
1
-1
-7
4
-3
2
2
1
-1
-3
1
-3
-2
-1
4
9
-5
2
-6
4
5
-11
1
2
5
-4
-2
8
-2
-1
-1
3
2
-6
-5...

result:

ok good one

Test #44:

score: 0
Accepted
time: 63ms
memory: 12820kb

input:

2576 198513
2007 2105
2105 1045
1045 2544
2544 1693
1693 142
142 1041
1041 809
809 2136
2136 1863
1863 2322
2322 849
849 2112
2112 857
857 1083
1083 638
638 1661
1661 226
226 548
548 2365
2365 56
56 1846
1846 811
811 742
742 1964
1964 1227
1227 1776
1776 916
916 907
907 195
195 1021
1021 1901
1901 4...

output:

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

result:

ok good one

Test #45:

score: 0
Accepted
time: 80ms
memory: 13916kb

input:

82644 198952
14369 38166
38166 8025
8025 74259
74259 20862
20862 21855
21855 23561
23561 33654
33654 19654
19654 65205
65205 50573
50573 28578
28578 9376
9376 48693
48693 45281
45281 15921
15921 78701
78701 30418
30418 46756
46756 45707
45707 70841
70841 22881
22881 57706
57706 32178
32178 69215
692...

output:

-2
1
1
-2
2
-1
-1
1
-1
1
-1
2
-3
1
2
-2
1
-2
3
-1
1
-2
2
-4
1
2
1
-2
1
-1
2
-2
2
-3
3
-1
1
-3
3
-1
-2
1
2
-1
-3
4
-4
2
1
1
-1
1
-2
1
1
-1
1
-2
2
-3
1
2
-1
-1
1
-1
2
-1
-1
2
-2
-1
2
-1
1
1
-1
-1
2
-1
1
-1
-1
1
-1
2
-1
1
-1
1
-2
2
-4
4
-2
1
1
-2
2
-1
-2
1
1
1
-2
1
1
-1
1
-2
2
-1
-3
3
1
-1
1
-1
1
-2
2
...

result:

ok good one

Test #46:

score: 0
Accepted
time: 47ms
memory: 12356kb

input:

3066 190306
1738 2537
2537 1704
1704 1292
1292 1261
1261 1156
1156 2399
2399 2358
2358 1474
1474 560
560 415
415 2863
2863 1902
1902 1805
1805 369
369 1926
1926 379
379 1298
1298 39
39 2896
2896 2623
2623 2960
2960 1972
1972 372
372 346
346 1206
1206 790
790 66
66 231
231 2401
2401 1551
1551 720
720...

output:

-15
6
8
6
2
-16
-1
2
9
2
-18
7
9
2
-11
13
-12
18
-31
22
-7
-6
14
7
-7
4
3
-5
-21
14
5
-10
3
-15
11
3
13
-22
-3
23
2
-1
-16
3
-14
2
17
4
4
-25
10
-10
13
10
4
-18
-1
-3
16
-1
-22
12
12
-10
14
-8
-12
-9
18
9
-4
-1
1
-17
18
-15
8
-1
6
-15
24
-5
-16
-6
4
-8
31
-2
-4
-18
23
-6
3
-22
3
9
13
-7
-3
-5
-13
18...

result:

ok good one

Test #47:

score: 0
Accepted
time: 67ms
memory: 13416kb

input:

62947 193186
47519 44243
44243 11193
11193 10826
10826 8728
8728 6887
6887 10776
10776 59071
59071 42377
42377 51605
51605 3133
3133 52665
52665 62934
62934 9355
9355 21865
21865 25494
25494 31300
31300 32398
32398 18242
18242 45820
45820 47445
47445 26114
26114 31067
31067 21478
21478 19558
19558 5...

output:

-3
3
1
-1
1
-1
-3
3
-3
4
-1
-3
4
-1
1
-2
1
1
-2
1
1
-2
1
-1
-2
4
-2
2
-3
1
1
-2
1
1
-2
1
2
-1
1
-3
1
1
-1
-2
3
-1
2
-4
3
-2
-2
4
1
-2
2
-2
1
1
-1
-2
3
-4
4
-2
-3
4
1
-1
-2
3
-2
1
1
-1
-1
1
1
-1
1
-2
2
-1
-1
2
-1
1
-1
-2
1
1
1
-2
1
1
-3
-1
3
1
-3
2
1
-2
2
-1
-1
-1
3
-1
-2
2
-3
3
1
-2
2
-1
1
-1
1
-3
2...

result:

ok good one

Test #48:

score: 0
Accepted
time: 81ms
memory: 13208kb

input:

43480 191239
11155 10225
10225 43244
43244 1713
1713 14645
14645 27359
27359 23140
23140 18479
18479 6396
6396 28179
28179 19088
19088 42538
42538 36224
36224 27054
27054 19997
19997 23865
23865 29197
29197 25035
25035 32937
32937 32337
32337 14753
14753 14105
14105 33516
33516 36557
36557 24963
249...

output:

1
-1
1
-1
-3
2
-1
2
-1
-1
1
-2
2
-1
1
-1
1
-1
-2
5
-2
-2
-1
4
-1
1
-4
5
-3
1
2
-4
3
-1
2
-1
1
-3
2
1
-2
-1
3
-2
-1
3
-3
1
2
-1
1
-2
-1
2
-2
3
-2
2
-5
3
1
-1
-2
2
-3
5
-1
-2
2
1
-2
1
-1
2
-1
-2
1
1
1
-1
1
-4
3
-4
1
3
-3
4
-4
4
-1
-3
-1
-1
1
1
2
1
-2
3
-3
-1
4
-5
5
-4
2
-1
-1
1
1
-2
4
-1
1
-1
-2
1
2
-...

result:

ok good one

Test #49:

score: 0
Accepted
time: 74ms
memory: 13252kb

input:

44894 196108
9136 34157
34157 14616
14616 13372
13372 30799
30799 25932
25932 12847
12847 9656
9656 12309
12309 14718
14718 26967
26967 35141
35141 7851
7851 25591
25591 9544
9544 28866
28866 21085
21085 41045
41045 36348
36348 21752
21752 23669
23669 839
839 7252
7252 28433
28433 16461
16461 36184
...

output:

-4
4
-1
-4
5
-3
1
1
-1
-2
-1
5
-1
1
-5
2
3
-4
4
-4
4
-2
2
-3
3
-4
3
1
-1
1
-4
4
-1
-5
1
4
-1
2
-2
2
-1
-2
3
-5
5
-1
-2
-3
5
1
-3
2
1
-3
3
-2
1
-4
2
3
-5
4
-1
2
-2
-1
-2
3
-1
2
1
-2
2
-3
2
-3
1
-3
1
4
-1
-2
1
1
1
-2
-3
6
-3
-2
3
1
-1
-2
4
-2
2
-2
1
1
-2
2
-1
-1
-2
1
3
-4
4
-4
3
1
-1
-2
-1
3
1
-3
3
-1...

result:

ok good one

Test #50:

score: 0
Accepted
time: 100ms
memory: 13900kb

input:

88238 193852
77052 68192
68192 77813
77813 39146
39146 45801
45801 665
665 76961
76961 85198
85198 78074
78074 67590
67590 52330
52330 5738
5738 48259
48259 87814
87814 28365
28365 77083
77083 67906
67906 38325
38325 53288
53288 7728
7728 74011
74011 80072
80072 29963
29963 28230
28230 9749
9749 139...

output:

-1
-2
3
-1
1
-1
-2
2
1
-1
1
-1
-1
1
-2
1
1
1
-1
-1
1
1
-1
1
-1
1
-2
1
1
-1
1
-1
1
-2
-1
3
-2
1
1
-2
2
-1
1
-2
1
1
-2
1
1
-2
1
1
-1
-1
1
-1
1
1
-2
-1
3
-3
2
-1
2
-1
1
-3
3
-1
-1
2
-2
2
-2
1
-1
2
-2
1
1
-1
1
-2
1
1
-1
1
-1
1
-1
1
-1
-1
2
-1
1
-2
2
-2
2
-1
-1
2
-1
1
-2
1
-1
2
-2
2
-1
-2
2
1
-1
1
-1
1
-...

result:

ok good one

Test #51:

score: 0
Accepted
time: 94ms
memory: 13380kb

input:

57117 191812
8343 12597
12597 45223
45223 2159
2159 52976
52976 48490
48490 25963
25963 32595
32595 30306
30306 5149
5149 26914
26914 9456
9456 15655
15655 45190
45190 26814
26814 45052
45052 24030
24030 5561
5561 52213
52213 55549
55549 39706
39706 36036
36036 48171
48171 45129
45129 8329
8329 4025...

output:

-1
-2
4
-1
-1
2
-1
-1
2
-2
2
-1
-1
1
-1
1
1
-1
-2
3
-1
1
-1
1
-1
-2
1
-1
1
2
-1
1
-2
2
-1
-3
4
-1
-1
1
-2
3
-1
1
-3
-2
4
1
-1
1
-3
3
-2
1
1
-2
2
-1
1
-1
-1
2
-1
-2
3
-1
1
-2
-2
2
-1
1
1
-2
3
-2
1
-1
1
1
-2
1
-1
-2
2
-2
2
1
-3
4
-5
4
1
-1
1
-2
-1
1
1
-2
1
-1
3
-3
2
-1
2
-1
1
-2
-2
4
-2
1
-4
2
-1
2
1
...

result:

ok good one

Test #52:

score: 0
Accepted
time: 66ms
memory: 12572kb

input:

13758 193861
9734 10314
10314 10872
10872 1602
1602 7202
7202 13249
13249 11073
11073 6133
6133 6517
6517 1371
1371 6674
6674 9734
159 2254
2254 7254
7254 5821
5821 11128
11128 6031
6031 3478
3478 5563
5563 7930
7930 2631
2631 11373
11373 12517
12517 4714
4714 7234
7234 11563
11563 4160
4160 460
460...

output:

1
-3
9
-4
-1
-1
2
1
5
-7
-2
-3
-3
-1
5
-4
2
-1
2
1
2
-9
9
-1
-8
3
5
-10
9
-3
1
4
-8
4
1
-1
3
1
-2
-3
5
-12
6
1
5
-2
1
-7
6
-5
7
-5
-1
3
-3
4
-3
5
-6
-1
5
-3
1
2
2
-6
3
1
-7
-1
2
3
4
1
-3
1
-1
-3
-1
4
2
-2
2
-4
1
-2
4
-7
4
-4
6
-3
1
-3
4
3
-5
3
-1
3
-6
3
-4
5
3
-1
-9
3
1
5
-7
2
-3
9
-8
-2
2
-2
3
3
1
...

result:

ok good one

Test #53:

score: 0
Accepted
time: 49ms
memory: 12756kb

input:

2576 198513
2007 2105
2105 1045
1045 2007
138 159
159 864
864 1461
1461 471
471 2279
2279 373
373 730
730 2510
2510 1397
1397 2387
2387 1405
1405 1129
1129 2343
2343 138
2198 431
431 1468
1468 1549
1549 828
828 1567
1567 1536
1536 1690
1690 214
214 1921
1921 2021
2021 1632
1632 1368
1368 1301
1301 1...

output:

2
13
-15
-3
2
2
-9
-21
26
-8
-23
29
-1
-14
15
-21
26
19
-16
-1
8
-5
-7
11
14
-13
15
-22
-2
1
1
9
-12
14
-11
8
7
-4
-26
27
10
-15
4
3
-17
-6
15
-32
22
-21
4
-10
2
26
-7
-9
13
1
6
-13
-13
6
12
9
2
-6
6
-14
-15
6
2
11
-4
-1
8
2
1
-10
14
-7
-5
-16
10
-13
8
-4
-4
22
-4
-32
38
-9
-21
5
15
-4
-21
10
6
12
-...

result:

ok good one

Test #54:

score: 0
Accepted
time: 86ms
memory: 13908kb

input:

82644 198952
14369 38166
38166 8025
8025 74259
74259 20862
20862 21855
21855 23561
23561 33654
33654 19654
19654 65205
65205 50573
50573 28578
28578 9376
9376 48693
48693 45281
45281 15921
15921 78701
78701 30418
30418 46756
46756 45707
45707 70841
70841 22881
22881 57706
57706 32178
32178 69215
692...

output:

-1
2
1
-1
1
-2
2
-1
-1
1
-2
3
-3
2
1
-3
2
-2
3
-1
1
-2
2
-1
-1
1
1
-2
1
-2
3
-2
1
-1
2
-1
1
-3
3
-1
-1
1
1
-1
-1
2
-3
1
1
1
-2
1
-1
1
1
-2
2
-3
3
-2
2
-1
1
-1
-1
1
1
-1
-1
2
-2
-1
2
-1
1
1
-1
-1
2
-1
-1
1
-1
1
-1
2
-2
1
-1
2
-2
2
-3
3
-2
1
1
-2
2
-1
-2
1
1
1
-2
1
1
-1
1
-2
2
-2
-1
3
-1
1
-3
2
-3
2
2...

result:

ok good one

Test #55:

score: 0
Accepted
time: 50ms
memory: 12352kb

input:

3066 190306
1738 2537
2537 1704
1704 1292
1292 1261
1261 1156
1156 2399
2399 2358
2358 1474
1474 560
560 415
415 2863
2863 1902
1902 1805
1805 369
369 1926
1926 379
379 1298
1298 39
39 2896
2896 2623
2623 2960
2960 1972
1972 372
372 346
346 1206
1206 790
790 66
66 231
231 2401
2401 1551
1551 720
720...

output:

-5
6
14
-6
-3
-8
24
-20
11
1
-5
2
-7
12
-14
12
-7
15
-29
-2
-2
24
1
7
-14
5
9
-5
-20
21
-7
-7
3
-7
15
-9
14
-23
11
10
2
-30
16
6
3
-21
18
3
4
-26
9
-1
6
-6
8
4
-5
-7
-3
-5
15
-17
-2
15
-17
9
-1
15
-12
-9
-10
9
3
17
-20
16
-10
7
-16
-4
26
-26
27
1
-13
-10
18
-7
-9
8
-9
6
17
-1
-4
-1
1
-12
-4
16
-5
1
...

result:

ok good one

Test #56:

score: 0
Accepted
time: 73ms
memory: 13540kb

input:

62947 193186
47519 44243
44243 11193
11193 10826
10826 8728
8728 6887
6887 10776
10776 59071
59071 42377
42377 51605
51605 3133
3133 52665
52665 62934
62934 9355
9355 21865
21865 25494
25494 31300
31300 32398
32398 18242
18242 45820
45820 47445
47445 26114
26114 31067
31067 21478
21478 19558
19558 5...

output:

-1
3
-1
1
1
-1
-3
3
-2
3
-3
-1
4
-1
1
-2
1
1
-2
1
1
-1
-1
1
-2
3
-2
1
-1
-1
3
-2
-2
2
-1
2
1
-1
1
-4
2
2
-2
-2
3
-1
2
-3
1
1
-3
2
2
-3
1
-1
2
1
-2
-3
5
-1
1
-2
-2
2
2
-1
-1
2
-2
2
-1
1
-2
-1
3
-1
-1
2
-1
-2
1
1
1
-2
-1
3
-3
1
1
-2
3
-1
-1
-1
2
1
-2
1
1
-2
2
-1
-1
-2
4
-1
-3
2
1
-1
-1
1
2
-2
-1
-1
-1...

result:

ok good one

Test #57:

score: 0
Accepted
time: 102ms
memory: 13280kb

input:

43480 191239
11155 10225
10225 43244
43244 1713
1713 14645
14645 27359
27359 23140
23140 18479
18479 6396
6396 28179
28179 19088
19088 42538
42538 36224
36224 27054
27054 19997
19997 23865
23865 29197
29197 25035
25035 32937
32937 32337
32337 14753
14753 14105
14105 33516
33516 36557
36557 24963
249...

output:

1
-1
1
-1
-2
2
-2
2
-1
1
-2
1
-3
3
-1
3
-2
-3
4
-2
3
-2
-2
3
1
-1
-1
2
-3
2
-2
-1
2
-2
4
-3
2
-1
1
1
-1
-2
3
-2
1
1
-2
-2
4
-2
1
-1
2
-1
-2
3
-1
1
-5
4
-1
-2
2
1
-2
3
-1
-3
2
-1
1
1
-2
3
-3
3
-4
1
1
-1
3
-1
1
-2
2
-1
-2
3
-2
2
-1
-2
1
-4
2
1
1
1
-2
3
-2
-1
2
-4
5
-2
1
-2
1
-1
1
-1
2
-2
2
-2
1
-1
3
-...

result:

ok good one

Test #58:

score: 0
Accepted
time: 72ms
memory: 13208kb

input:

44894 196108
9136 34157
34157 14616
14616 13372
13372 30799
30799 25932
25932 12847
12847 9656
9656 12309
12309 14718
14718 26967
26967 35141
35141 7851
7851 25591
25591 9544
9544 28866
28866 21085
21085 41045
41045 36348
36348 21752
21752 23669
23669 839
839 7252
7252 28433
28433 16461
16461 36184
...

output:

-6
4
2
-5
4
1
-2
1
-1
2
-3
3
-2
1
-3
1
-1
1
3
-5
5
-1
1
-3
-1
1
1
2
-3
3
-3
3
-1
-5
2
3
-3
4
-1
-1
1
-1
2
-4
4
-1
-2
-2
4
1
-2
1
1
-1
1
-1
1
-5
3
2
-2
-1
1
-1
1
-1
2
-2
3
-1
1
-1
-1
-2
4
-4
2
-3
4
-1
1
-4
1
2
2
-3
2
1
-3
-1
2
1
-2
-2
4
-2
3
-2
1
1
-3
-1
3
-1
-3
1
4
-3
3
-3
3
-3
2
-2
-2
4
1
-2
2
-2
-...

result:

ok good one

Test #59:

score: 0
Accepted
time: 85ms
memory: 13900kb

input:

88238 193852
77052 68192
68192 77813
77813 39146
39146 45801
45801 665
665 76961
76961 85198
85198 78074
78074 67590
67590 52330
52330 5738
5738 48259
48259 87814
87814 28365
28365 77083
77083 67906
67906 38325
38325 53288
53288 7728
7728 74011
74011 80072
80072 29963
29963 28230
28230 9749
9749 139...

output:

1
-2
3
-1
1
-2
-1
3
-2
1
1
-1
-2
2
-1
2
-1
1
-1
-1
-1
3
-1
1
-1
1
-2
1
1
-1
1
-1
1
-1
-2
3
-3
1
2
-2
2
-1
1
-2
-1
3
-2
1
1
-2
1
1
-1
-3
1
2
-1
2
-3
2
1
-3
2
-1
2
-1
-1
-2
4
-2
1
1
-1
1
-2
1
-1
2
-4
1
3
-1
1
-3
2
1
-1
1
-2
2
-1
1
-1
-2
3
-1
1
-2
2
-1
1
-1
-1
2
-1
1
-2
1
-1
2
-2
1
-1
-1
2
1
-1
1
-1
1
...

result:

ok good one

Test #60:

score: 0
Accepted
time: 82ms
memory: 13372kb

input:

57117 191812
8343 12597
12597 45223
45223 2159
2159 52976
52976 48490
48490 25963
25963 32595
32595 30306
30306 5149
5149 26914
26914 9456
9456 15655
15655 45190
45190 26814
26814 45052
45052 24030
24030 5561
5561 52213
52213 55549
55549 39706
39706 36036
36036 48171
48171 45129
45129 8329
8329 4025...

output:

2
-2
2
-2
1
1
-3
1
2
-1
1
-1
-2
2
-3
3
1
-1
-2
3
-2
2
-1
-1
1
1
-1
1
-3
3
-3
2
-3
4
-1
-3
4
-1
-1
1
-1
2
-1
1
-3
2
1
-1
-1
2
-3
3
-2
1
1
-2
2
-1
1
-1
-2
3
-1
-2
3
-1
1
-3
-1
2
2
-3
2
-1
2
-1
1
-2
-1
3
-2
1
-2
2
-1
-1
3
-1
-1
2
-3
2
1
-1
1
-1
-2
1
1
-2
1
1
1
-3
1
1
1
-3
3
-2
-2
4
-1
1
-3
1
-1
2
1
-1
...

result:

ok good one