QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#416971#1454. Um nik's AlgorithmqiuzxWA 488ms90512kbC++204.0kb2024-05-22 11:47:272024-05-22 11:47:27

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 2 4
1 1
2 1
3 1
3 2

output:

2
1
4

result:

ok answer: 2, maximum: 2

Test #2:

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

input:

20 20 20
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20

output:

20
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

result:

ok answer: 20, maximum: 20

Test #3:

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

input:

1000 1000 10000
988 405
844 805
40 354
416 591
520 704
697 24
315 386
122 390
991 213
506 14
309 298
26 829
329 63
787 91
971 703
805 699
624 645
121 181
841 741
473 84
258 116
490 753
725 603
265 302
869 71
611 507
59 292
11 532
117 61
192 600
650 342
204 580
687 675
670 407
637 622
569 236
728 476...

output:

1000
205
737
383
8889
137
819
776
2426
1620
233
28
1840
845
1534
1401
459
1077
70
454
1699
8784
1816
598
509
75
12
1332
83
41
5446
244
2718
1272
240
697
324
2027
195
759
3
7582
1520
215
838
279
2182
204
297
550
1182
2907
45
1645
4666
3959
105
7243
1022
27
187
234
5409
216
7092
1484
1829
157
153
957
...

result:

ok answer: 1000, maximum: 1000

Test #4:

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

input:

100 2 200
40 1
22 2
75 2
79 1
27 2
11 1
7 1
64 1
21 1
57 2
47 1
4 2
61 2
37 1
8 2
32 2
84 1
63 1
67 1
86 2
88 2
73 1
17 1
94 2
44 2
19 2
16 1
33 2
92 1
24 2
100 2
18 2
85 1
7 2
43 1
82 2
15 2
88 1
91 1
65 1
69 1
36 1
6 2
23 2
58 1
59 1
64 2
38 1
72 1
99 1
76 1
11 2
2 2
98 1
66 2
77 1
47 2
98 2
52 2
...

output:

2
96
155

result:

ok answer: 2, maximum: 2

Test #5:

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

input:

1000 1000 1000
411 789
753 186
495 203
417 324
490 424
195 480
314 23
663 218
12 747
124 390
134 38
218 536
291 840
174 908
474 767
313 167
575 9
857 427
313 27
959 935
258 70
472 957
747 228
205 939
293 303
626 802
712 283
658 346
208 383
889 204
99 640
801 966
828 742
534 11
259 734
226 129
843 35...

output:

540
384
183
146
133
674
274
96
242
490
642
735
97
806
995
372
464
848
443
186
199
610
188
137
105
207
403
737
91
222
342
597
38
701
434
201
318
725
401
393
774
42
269
446
408
827
122
500
59
410
335
959
257
628
190
932
492
771
624
61
258
108
233
244
374
49
307
689
846
862
212
847
898
31
66
911
564
50...

result:

ok answer: 540, maximum: 540

Test #6:

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

input:

1000 2000 3000
143 619
571 526
215 1074
6 1714
370 937
120 784
134 1671
722 1528
397 345
464 401
198 589
283 564
212 232
527 286
237 1649
413 1570
964 1731
194 645
639 735
182 656
641 1143
535 98
113 596
787 972
306 818
657 1202
321 1327
753 1088
122 1823
471 611
516 811
380 1548
872 973
509 1841
70...

output:

944
373
2715
451
43
380
4
620
731
193
1092
1541
192
1639
1502
1804
1146
350
2866
343
355
91
707
675
982
314
308
1293
625
376
1677
805
1906
2422
773
1929
1975
2762
733
213
188
2677
701
1596
553
1907
918
515
98
173
663
2301
908
1088
1898
2776
1908
484
2098
310
187
638
1043
604
128
526
2406
35
426
95
6...

result:

ok answer: 944, maximum: 944

Test #7:

score: 0
Accepted
time: 488ms
memory: 89612kb

input:

2000000 2000000 2000000
1203137 1030076
215220 238101
293102 491863
1260446 165178
1683989 1718181
1641329 1179380
708733 403707
1918936 574923
525651 11571
1169951 422281
1086376 303530
1286459 1692862
31854 394688
916288 273853
709758 1176923
1730408 1766172
1890708 588004
344339 283448
1676753 13...

output:

1082924
1
4
6
7
8
10
12
18
23
25
26
29
31
34
35
36
38
40
42
44
45
47
55
56
57
58
59
60
61
62
63
66
67
68
71
73
74
77
78
80
81
83
85
88
89
90
92
93
96
97
98
99
103
105
107
109
110
111
114
116
119
120
123
125
128
129
131
132
133
134
135
138
140
141
143
149
155
157
160
161
163
164
168
169
171
172
173
1...

result:

ok answer: 1082924, maximum: 1088264

Test #8:

score: 0
Accepted
time: 415ms
memory: 90152kb

input:

2000000 2000000 2000000
1286561 1611624
1028477 1867578
1642356 1162128
1032429 316462
618144 22363
1644873 1514932
508824 1230141
1889259 22840
30270 259129
1567969 462330
150124 1227115
393968 534541
1378415 770304
977805 1666010
1199878 1476793
1249634 243739
1232999 531436
1146447 1845344
478779...

output:

1082759
2
3
6
8
9
11
14
15
17
19
20
22
23
24
25
30
38
42
43
44
45
46
47
48
49
50
51
55
56
59
62
64
65
72
74
75
76
77
80
84
87
89
91
92
93
95
100
101
104
105
106
107
108
113
114
115
116
117
119
120
122
123
126
128
130
131
132
134
135
138
139
140
142
146
148
149
150
151
152
153
155
157
159
163
165
166...

result:

ok answer: 1082759, maximum: 1088048

Test #9:

score: 0
Accepted
time: 420ms
memory: 90512kb

input:

2000000 2000000 2000000
402689 127765
1065927 1753952
991609 1640904
1061308 533154
1552300 326545
1905312 1074675
1084722 1799678
51070 1470757
310696 763584
1965988 759275
246577 1374893
277285 408924
1692272 1856320
72026 1123575
1881487 1519767
1993052 1562521
575291 1507572
205452 248456
134621...

output:

1082545
1
2
5
7
12
14
15
19
24
31
32
33
34
38
39
40
41
44
47
49
50
51
56
58
61
66
67
71
74
76
79
80
81
83
84
85
87
88
91
93
95
96
99
100
103
105
106
107
109
111
115
116
117
118
119
120
124
125
126
127
128
130
134
136
137
140
142
143
146
148
149
150
152
153
154
155
156
157
158
161
164
165
169
170
171...

result:

ok answer: 1082545, maximum: 1087919

Test #10:

score: 0
Accepted
time: 402ms
memory: 89496kb

input:

2000000 2000000 2000000
486113 452417
846481 1383429
1116671 119681
1800588 1717142
294967 630728
1198456 1601715
884812 626111
1054097 142866
782611 1978438
1396710 1832027
534517 555375
417499 1250604
6129 166529
1166247 772627
371607 1819638
1512279 1072791
884878 1451005
1974857 843056
213647 10...

output:

1082638
1
2
4
8
9
11
12
13
16
18
19
20
21
24
26
28
31
36
37
39
41
42
45
47
48
49
51
56
58
60
61
62
63
64
66
69
71
75
76
77
79
80
81
82
85
90
91
93
95
96
97
102
103
104
105
106
107
108
111
112
113
114
117
118
119
121
122
123
124
125
127
131
132
133
134
138
139
140
142
143
144
145
148
150
152
157
158
...

result:

ok answer: 1082638, maximum: 1088039

Test #11:

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

input:

2000000 2000000 2000000
569537 968557
1851226 45611
465925 789946
605275 1868426
261827 934910
1458895 1161459
684902 1195648
1215908 623487
30333 482892
827432 1096268
1598266 1478961
1525008 349179
385394 476737
1227764 164784
85919 119508
255697 326166
1970273 1394437
1809670 1180760
1015672 2547...

output:

1082795
1
2
4
6
8
9
11
13
14
15
17
18
19
20
22
25
26
30
31
37
38
41
42
43
45
46
47
51
53
54
55
56
58
59
60
61
62
63
64
66
67
68
69
71
72
73
77
78
79
81
82
84
89
91
94
95
98
103
105
107
110
112
114
115
117
118
121
122
124
125
126
130
131
132
135
136
137
141
142
143
148
150
151
154
155
156
157
158
159...

result:

ok answer: 1082795, maximum: 1088084

Test #12:

score: 0
Accepted
time: 401ms
memory: 87808kb

input:

2000000 2000000 2000000
1685665 517402
664484 1675089
782474 1268723
1601450 85118
1195982 1239092
752039 721202
484993 1054786
218935 71404
310760 730450
1225450 1393213
662014 594034
632517 223562
699251 595457
321985 846541
576040 1386674
1774923 1836436
1312564 1337869
868675 808065
1107298 1517...

output:

1082035
1
8
14
15
17
20
21
22
24
27
30
32
33
36
38
39
41
42
44
46
47
48
51
54
56
57
58
60
62
63
64
66
70
74
75
76
77
81
87
89
90
93
94
95
98
99
100
103
107
109
110
111
113
115
116
118
119
123
135
138
142
145
147
150
151
153
154
155
159
160
161
162
165
172
173
175
176
178
179
180
183
184
185
187
189
...

result:

ok answer: 1082035, maximum: 1087210

Test #13:

score: 0
Accepted
time: 419ms
memory: 89748kb

input:

2000000 2000000 2000000
671367 438853
664485 1398539
742842 386640
982299 485454
546419 1461681
1152709 654964
1250048 1661588
622998 536507
189300 1149326
1931736 1799077
327683 1819025
1040667 1571337
868282 1226836
498815 773984
808618 988294
712394 173925
134058 436291
98285 443781
1609589 78910...

output:

1533396
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
27
28
30
32
33
34
35
36
37
38
39
41
42
44
46
47
49
50
51
52
53
54
55
56
57
59
60
61
63
65
66
68
69
71
72
73
74
75
77
79
80
81
82
83
84
85
86
87
88
89
90
92
93
95
96
97
98
99
100
104
105
106
107
109
110
111
112
113
114
115
116
118...

result:

ok answer: 1533396, maximum: 1535209

Test #14:

score: 0
Accepted
time: 410ms
memory: 90340kb

input:

2000000 2000000 2000000
138574 1342064
1643595 562587
1113082 1866381
1046781 69854
1995906 718620
1878456 1065477
1148129 1000230
128358 393159
1893827 365760
1922621 1583574
868735 553414
1400420 471921
147059 404788
1439120 680482
225083 1540271
1016807 1950769
1635754 371279
967724 1695575
13292...

output:

1801783
1
2
5
6
7
8
9
10
11
12
14
15
16
17
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
94
95
96
97
98
99
100
101
102
103
104
105...

result:

ok answer: 1801783, maximum: 1802113

Test #15:

score: 0
Accepted
time: 429ms
memory: 88420kb

input:

2000000 2000000 2000000
536222 1734576
23820 45248
833336 1030570
413414 1449610
1303634 31529
1081756 593258
988649 183711
216216 1083600
127109 1327665
1021151 187582
712397 68980
1201276 912972
579821 1496356
516811 165481
829561 433889
116397 1703535
41995 1565188
452103 1023063
124730 1958243
2...

output:

1900227
1
2
3
4
5
6
7
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
31
32
33
34
35
36
37
38
39
40
41
42
43
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok answer: 1900227, maximum: 1900296

Test #16:

score: 0
Accepted
time: 414ms
memory: 89360kb

input:

2000000 2000000 2000000
722296 810199
1104653 1326072
1384593 1991732
1359998 1074298
1745667 1702626
1958690 1040248
741056 1119935
123334 480039
941370 1134989
1340612 1877995
1628998 735318
1713870 573904
179004 731624
244572 1375222
1938456 934124
429528 1129329
655320 133186
1680525 1039251
180...

output:

1999999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
...

result:

ok answer: 1999999, maximum: 1999999

Test #17:

score: 0
Accepted
time: 326ms
memory: 71860kb

input:

2000000 2000000 2000000
1047606 1292677
12506 1323616
1342868 93241
104701 1762734
1092674 826296
832718 320225
1030367 1004288
1092277 1855541
1147594 1592403
344053 1265006
957034 1327349
1581922 1471180
1394689 1275806
347140 757111
1968638 1065864
1735165 801763
916090 1855541
1294013 117591
177...

output:

38
81802
244220
409632
479080
489800
594316
667845
688482
751549
759312
770189
807131
855458
927054
952671
1067016
1110160
1227073
1268455
1303100
1305156
1317880
1364334
1380439
1438365
1462613
1481259
1562628
1565514
1598525
1704395
1719268
1770564
1847486
1878205
1880025
1905662
1920325

result:

ok answer: 38, maximum: 38

Test #18:

score: 0
Accepted
time: 202ms
memory: 73536kb

input:

2000000 2000000 2000000
1873411 1383547
592374 1383547
837927 228335
880140 1383547
117684 1383547
873521 1383547
1659145 1383547
837927 1940103
684954 1383547
837927 649822
837927 553974
837927 263980
837927 1851187
645118 1383547
837927 536305
1931765 1383547
960556 1383547
837927 741946
837927 18...

output:

2
1110770
1659404

result:

ok answer: 2, maximum: 2

Test #19:

score: 0
Accepted
time: 228ms
memory: 75208kb

input:

2000000 2000000 2000000
679516 1758922
654113 491405
679516 903481
679516 1931142
1695416 491405
1087335 491405
679516 209225
991588 491405
679516 1423758
679516 1731533
815888 491405
84804 491405
679516 614525
532920 491405
679516 1583057
852179 491405
679516 641320
679516 158707
679516 883286
6795...

output:

2
226564
1110496

result:

ok answer: 2, maximum: 2

Test #20:

score: 0
Accepted
time: 342ms
memory: 74768kb

input:

2000000 2000000 2000000
950672 1358549
1019276 293
1341818 453182
517288 976497
1157473 567426
1601935 896019
1434229 1234860
1822883 1319667
1174043 794189
815886 186003
1433841 238760
599172 90292
1139073 538283
1651444 1723218
1890294 90292
749958 1255878
1584651 934604
31690 1957346
582723 18920...

output:

444
816
9193
9272
10656
24112
29409
34045
36903
39524
47611
48569
55940
60090
63734
66097
67387
81168
82636
82638
88757
93473
101281
101579
103495
106535
112643
115275
118230
134182
134611
137362
139708
142636
144042
148958
154228
156025
164044
170209
170453
173613
187097
190834
194788
196118
196694...

result:

ok answer: 444, maximum: 444

Test #21:

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

input:

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

output:

32
17
50
83
116
149
182
215
248
281
314
347
380
413
446
479
512
513
530
547
564
581
598
615
632
649
666
683
700
717
734
751
768

result:

ok answer: 32, maximum: 32

Test #22:

score: 0
Accepted
time: 104ms
memory: 63020kb

input:

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

output:

1632
954
2819
4730
6072
7976
9067
11264
12579
13958
15601
17775
19075
20703
22323
24279
25582
27200
28835
30781
32080
34030
35328
37275
38589
40210
42316
43788
45078
46706
48842
50286
52062
53212
55331
56785
58090
60040
61950
63292
65076
66218
68337
69795
71091
73045
74944
76302
77615
79241
81473
82...

result:

ok answer: 1632, maximum: 1632

Test #23:

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

input:

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

output:

189
64
191
318
445
572
699
826
953
1080
1207
1334
1461
1588
1715
1842
1969
2096
2223
2350
2477
2604
2731
2858
2985
3112
3239
3366
3493
3620
3747
3874
4001
4128
4255
4382
4509
4636
4763
4890
5017
5144
5271
5398
5525
5652
5779
5906
6033
6160
6287
6414
6541
6668
6795
6922
7049
7176
7303
7430
7557
7684
...

result:

ok answer: 189, maximum: 189

Test #24:

score: 0
Accepted
time: 112ms
memory: 59780kb

input:

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

output:

1896
1224
2120
3726
4865
5774
7141
8507
10081
11233
12134
13740
14878
15816
17604
18505
19871
21251
22160
23526
24891
26484
27195
28520
30298
31251
32800
33990
34905
36258
37637
38573
40368
41279
42871
43995
44919
46736
47649
48674
50380
51290
52658
54009
55555
56299
57665
59258
60055
61918
63113
64...

result:

ok answer: 1896, maximum: 1896

Test #25:

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

input:

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

output:

1896
1224
2134
3723
4864
5775
7141
8493
10083
11231
12145
13727
14878
15812
17608
18505
19884
21251
22161
23525
24889
26471
27197
28533
30295
31264
32833
33995
34892
36258
37636
39151
40367
41265
42870
44009
44906
46733
47646
48703
50380
51278
52658
54009
55592
56299
57651
59258
60055
61917
63113
64...

result:

ok answer: 1896, maximum: 1896

Test #26:

score: 0
Accepted
time: 147ms
memory: 77660kb

input:

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

output:

183937
1165
2075
3563
4729
5604
6637
8269
9146
10708
11801
12687
14237
15343
16229
17949
18885
20375
21110
22437
23976
25084
25969
27526
28219
29511
31072
32178
33056
34764
35720
36636
38353
39251
40259
41919
42806
43828
45460
46335
47668
49003
49885
51217
52546
53425
54757
56086
57578
58299
59628
6...

result:

ok answer: 183937, maximum: 183937

Test #27:

score: 0
Accepted
time: 188ms
memory: 77972kb

input:

2000000 2000000 2000000
513 1122
1458 523
325 794
1951215 1284660
33 326
361 381
967 990
554 329
1682 399
250 704
294 196
520 496
976 939
583 776
689 1048
163 262
884 889
1147 1673
1552 459
1097 1091
826436 1860
255 516
1640 446
1643 55
1028 1318
1307752 1431867
716 1405
264 671
1018 1511
1798 413
1...

output:

184175
4
21
26
39
55
56
57
64
74
77
91
108
131
135
136
139
154
198
209
231
245
269
278
317
325
331
334
335
365
379
396
412
418
426
428
431
440
444
451
460
461
462
473
483
485
498
509
528
529
535
536
574
580
602
605
608
620
635
646
662
664
698
706
707
734
736
781
802
809
820
821
826
838
856
874
879
9...

result:

ok answer: 184175, maximum: 184175

Test #28:

score: 0
Accepted
time: 169ms
memory: 78212kb

input:

2000000 2000000 2000000
318377 264230
318377 297294
318377 1168121
318377 1168378
318377 687841
318377 317579
318377 1045281
318377 193774
318377 1286449
318377 809491
318377 305478
318377 1431410
318377 173240
318377 1833841
318377 824344
318377 722522
318377 1887702
318377 1302344
318377 864333
31...

output:

183975
1131
2073
3549
4718
5604
6639
8260
9146
10695
11811
12698
14237
15343
16229
17950
18885
20374
21110
22427
23965
25084
25969
27528
28219
29511
31061
32168
33066
34612
35722
36635
38352
39251
40254
41916
42793
43830
45449
46335
47674
49003
49889
51217
52533
53425
54759
56086
57576
58288
59616
6...

result:

ok answer: 183975, maximum: 183975

Test #29:

score: 0
Accepted
time: 206ms
memory: 77740kb

input:

2000000 2000000 2000000
1625116 599613
539469 1308455
812983 176633
874289 461823
1824953 1589033
794027 1271010
178174 1700721
1161616 1322163
1277276 32631
1962706 1017199
282239 1158238
1206051 966351
1745846 987176
361370 985866
857047 470035
637002 976591
1362011 429199
1160438 673497
1007777 1...

output:

184156
14
22
23
32
45
60
63
71
73
101
107
110
140
161
182
202
206
211
218
228
241
266
278
282
297
302
310
324
329
332
350
361
362
370
386
399
401
408
409
420
425
426
439
450
456
469
510
517
520
564
572
577
579
587
601
611
614
621
625
631
637
645
653
656
670
690
730
737
743
759
762
777
783
786
794
80...

result:

ok answer: 184156, maximum: 184156

Test #30:

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

input:

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

output:

11043
1224
2134
3713
4865
5775
7137
8507
10029
11237
12148
13741
14864
15783
17607
18519
19567
21249
22158
23523
24878
26477
27168
28529
30112
30949
32780
33994
34902
36270
37623
38546
40351
41276
42857
44004
44917
46666
47649
48671
50380
51288
52643
54008
54929
56284
57661
59242
59954
61290
63066
6...

result:

ok answer: 11043, maximum: 11043

Test #31:

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

input:

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

output:

4770
1221
2135
3729
4855
5778
7142
8512
10101
11247
12156
13751
14890
15818
17612
18523
19900
21257
22168
23534
24901
26507
27219
28546
30316
31279
32826
34012
34934
36302
37657
38580
40404
41312
42908
44048
44960
46721
47690
48711
50424
51337
52690
54057
55591
56335
57716
59296
60093
61358
63168
64...

result:

ok answer: 4770, maximum: 4770

Test #32:

score: 0
Accepted
time: 175ms
memory: 73120kb

input:

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

output:

1505
766
1905
2908
3615
4550
5619
6901
7617
8760
9896
10903
11616
12543
13613
14540
15614
16756
17898
18890
19607
20753
21602
22538
23608
24743
25891
26885
27598
28532
29889
30527
31596
32746
33888
34887
35595
36738
37591
38975
39593
40733
41879
42972
43974
44518
45876
46522
47977
48735
49877
50976
...

result:

ok answer: 1505, maximum: 1505

Test #33:

score: 0
Accepted
time: 120ms
memory: 71252kb

input:

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

output:

1804
1089
1920
3556
4375
5965
6823
8063
9292
10725
11439
13171
14205
15569
16663
17737
18683
20316
21130
22358
23587
25172
26045
27284
28514
29935
30959
31809
33429
34247
35471
36693
38343
39151
40738
41608
43041
44073
45012
46534
47957
48606
50360
51449
52269
53903
54714
56358
57179
58407
59639
610...

result:

ok answer: 1804, maximum: 1804

Test #34:

score: 0
Accepted
time: 183ms
memory: 69984kb

input:

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

output:

1356
604
1523
2453
3356
4274
5205
6110
7026
7944
8861
9793
10697
11617
12416
13433
14351
15271
16190
17075
17908
18824
19740
20659
21412
22479
23365
24293
24897
25808
26571
27467
28396
29476
30173
31307
32009
33142
33834
34748
35666
36816
37515
38662
39178
40491
40968
41874
42781
44053
44613
45544
4...

result:

ok answer: 1356, maximum: 1356

Test #35:

score: 0
Accepted
time: 160ms
memory: 68384kb

input:

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

output:

1051
376
1206
2052
2610
3440
3867
4836
5396
5968
6663
7629
8188
8785
9487
10422
10982
11574
12585
13217
13772
14610
15072
16014
16774
17169
18178
18799
19358
19966
20665
21594
22365
22759
23758
24387
24943
25788
26550
27177
27944
28436
29348
29972
30529
31366
32189
32769
33321
34019
34980
35554
3612...

result:

ok answer: 1051, maximum: 1051

Test #36:

score: 0
Accepted
time: 148ms
memory: 75780kb

input:

2000000 2000000 2000000
1410388 834484
1410388 239410
1410388 1232286
1410388 207365
1410388 1395003
1410388 1968948
1410388 576378
1410388 76728
1410388 1644827
1410388 1278820
1410388 593448
1410388 904665
1410388 1931363
1410388 1889040
1410388 1147950
1410388 218013
1410388 1688590
1410388 13887...

output:

1651
920
2128
2995
4028
5064
6433
7650
8509
9547
10580
11960
13165
14020
15055
16089
17478
18682
19545
20580
21606
22985
24181
25064
25863
27123
28507
29669
30581
31370
32649
34019
35173
36098
36876
38157
39546
40236
41611
42387
43684
45061
45750
47122
47909
49191
50575
51268
52639
53355
54708
56087...

result:

ok answer: 1651, maximum: 1651

Test #37:

score: 0
Accepted
time: 279ms
memory: 75924kb

input:

2000000 2000000 2000000
1686157 1036655
905644 1257773
231391 1553076
1776476 17761
1718008 397514
1502594 1699978
1112572 590070
1128891 1730637
1547654 1908592
1182198 717510
645722 749840
1307572 1364844
1466826 1763992
373885 1613469
12498 321213
265420 1503625
574762 197883
654547 1390192
19624...

output:

1365
35579
73453
74328
92915
99585
104803
111734
129554
158054
165171
167765
170572
172563
173385
185581
186069
189634
191263
216435
217513
218806
219075
219928
220109
222944
223321
225552
225958
226137
226209
226342
226642
226670
226724
226832
226874
227053
227433
227935
228091
228109
228257
228338...

result:

ok answer: 1365, maximum: 1365

Test #38:

score: 0
Accepted
time: 169ms
memory: 72368kb

input:

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

output:

1515
756
1901
2893
3606
4534
5598
6873
7585
8730
9865
10968
11959
12514
13568
14506
15969
16697
17829
18967
19958
20674
21528
22666
23526
24663
25804
26934
27929
28641
29779
30633
31512
32632
33763
34907
35903
36613
37541
38889
39533
40593
41731
42877
43972
44974
45720
46567
47962
48566
49698
50844
...

result:

ok answer: 1515, maximum: 1515

Test #39:

score: 0
Accepted
time: 204ms
memory: 73524kb

input:

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

output:

2442
51563
52372
53188
53958
54788
55594
56386
57222
58000
58824
59590
60435
61246
62019
62819
67704
68506
69275
70073
70927
71733
87852
88655
89444
90250
91078
91869
92676
93478
94280
95098
95887
96717
97516
98296
99106
99944
100727
101482
102300
103077
103970
104778
105482
106392
107091
107984
108...

result:

ok answer: 2442, maximum: 2565

Test #40:

score: -100
Wrong Answer
time: 152ms
memory: 68912kb

input:

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

output:

2772
149994
150973
151995
152951
153961
154985
155996
156960
158000
158966
159994
160940
161938
162951
163963
164976
165987
166998
167999
168977
169929
170980
171997
172999
173959
174996
175955
176996
177967
178999
180000
180994
181955
182994
183944
184997
185950
186948
187999
188992
189973
190964
1...

result:

wrong answer found matching is too small: 2772, maximum: 2998