QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#263053#2716. Interval Collectionznstz22 3131ms417336kbC++203.4kb2023-11-24 14:42:102023-11-24 14:42:10

详细

Subtask #1:

score: 3
Accepted

Test #1:

score: 3
Accepted
time: 14ms
memory: 154112kb

input:

500
A 85614 618681
A 96881 534557
A 371656 884110
A 55265 991070
A 135033 917439
A 467668 648254
A 810282 995373
A 578086 947503
A 63927 975158
A 142141 348881
A 372691 541176
A 409911 918917
A 594071 750141
A 26557 936338
A 194871 545990
A 584676 799137
A 153204 901288
A 22939 601013
A 102411 75491...

output:

533067
437676
787229
787229
787229
551373
527705
527705
527705
506113
399035
399035
377450
377450
377450
377450
377450
377450
377450
377450
377450
377450
377450
377450
377450
377450
377450
266548
266548
266548
266548
266548
266548
266548
266548
266548
266548
266548
266548
266548
266548
266548
266548...

result:

ok 500 lines

Test #2:

score: 0
Accepted
time: 19ms
memory: 154056kb

input:

500
A 51501 770046
A 413690 883908
A 523395 969644
A 30211 456370
A 866 555010
A 589894 942832
A 128560 337749
A 50396 485899
A 889863 891076
A 375430 607391
A 568094 832070
A 7602 682176
A 647210 910003
A 81345 578690
A 386161 851662
A 191746 397694
A 577109 942335
A 390374 905222
A 51091 943116
A ...

output:

718545
832407
918143
939433
939433
912621
755348
755348
477386
477386
322982
322982
322982
322982
322982
322982
322982
322982
322982
322982
322982
322982
322982
322982
322982
322982
322982
322982
322982
322982
322982
234916
234916
174741
174741
174741
174741
174741
174741
174741
39596
39596
39596
39...

result:

ok 500 lines

Test #3:

score: 0
Accepted
time: 17ms
memory: 154256kb

input:

500
A 301221 443323
A 424434 472378
A 718791 867097
A 101078 891843
A 73298 585915
A 85760 984998
A 310227 786962
R 73298 585915
A 537303 711968
R 301221 443323
A 246428 354895
R 101078 891843
A 348967 787936
R 718791 867097
A 158840 444913
R 85760 984998
A 210951 809780
R 424434 472378
A 585016 795...

output:

142102
171157
442663
442663
442663
442663
442663
442663
287534
287534
225950
225950
225950
225950
225950
225950
225950
465540
465540
465540
465540
465540
465540
465540
465540
465540
465540
465540
465540
549514
549514
613933
613933
469389
568445
568445
350432
350432
350432
350432
350432
350432
350432...

result:

ok 500 lines

Test #4:

score: 0
Accepted
time: 19ms
memory: 154036kb

input:

500
A 204876 998161
A 167407 791048
R 204876 998161
A 53892 881810
R 167407 791048
A 362592 434167
R 362592 434167
A 283061 956671
R 53892 881810
A 318340 634885
R 283061 956671
A 124251 174781
R 318340 634885
A 10197 775954
R 10197 775954
A 167294 386842
R 167294 386842
A 492190 783109
R 492190 783...

output:

793285
830754
623641
623641
827918
71575
827918
902779
673610
316545
316545
510634
50530
50530
50530
262591
50530
658858
50530
765859
682309
684495
682309
682309
945388
983918
609833
108565
609833
864513
609833
171294
171294
171294
922587
328865
328865
328865
620920
670041
620920
22638
620920
106927...

result:

ok 500 lines

Test #5:

score: 0
Accepted
time: 20ms
memory: 154100kb

input:

500
A 123116 774435
A 10262 999509
A 58818 999109
A 424964 764731
A 21849 995409
A 605987 894936
A 256901 952030
A 195515 466530
A 385455 558603
A 327112 652258
A 313709 690228
A 562387 692001
A 72143 832906
A 392854 451324
A 297535 997005
A 656156 804986
A 541148 818852
A 113736 843636
A 3943 97342...

output:

651319
651319
651319
339767
339767
469972
469972
699421
509481
509481
509481
306546
306546
299147
299147
299147
299147
299147
299147
226466
226466
226466
226466
226466
226466
226466
226466
226466
226466
226466
226466
226466
226466
226466
226466
226466
226466
226466
226466
226466
226466
226466
226466...

result:

ok 500 lines

Test #6:

score: 0
Accepted
time: 19ms
memory: 154048kb

input:

500
A 14498 941877
A 465728 992111
A 163990 382952
A 346993 755132
A 251432 637371
A 484019 912817
A 358610 696623
A 383832 982209
A 127111 612625
A 361420 577068
A 85779 715610
A 146073 991298
A 42838 514167
A 6122 825634
A 110242 967873
A 103675 822037
A 683367 927853
A 186285 855247
A 438265 8053...

output:

927379
977613
828121
828121
828121
748827
748827
748827
748827
748827
748827
748827
748827
748827
748827
748827
566433
566433
566433
566433
566433
566433
566433
566433
566433
566433
415735
415735
415735
415735
415735
415735
415735
415735
415735
415735
415735
415735
415735
415735
415735
390451
390451...

result:

ok 500 lines

Test #7:

score: 0
Accepted
time: 11ms
memory: 153960kb

input:

500
A 470361 948150
A 48638 994850
A 9995 931845
A 134805 710464
A 136626 888447
A 36409 947319
A 669991 972286
R 48638 994850
A 211860 323301
A 94620 990418
R 211860 323301
R 470361 948150
A 694316 980527
R 94620 990418
A 252387 903879
A 56119 600119
R 134805 710464
R 136626 888447
A 345935 694111
...

output:

477789
477789
938155
813345
813345
813345
837481
837481
736290
736290
837481
837481
845722
845722
845722
916167
916167
916167
634592
634592
634592
634592
634592
634592
634592
634592
634592
634592
634592
634592
634592
634592
634592
634592
634592
634592
634592
840391
840391
840391
840391
840391
675863...

result:

ok 500 lines

Test #8:

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

input:

500
A 780818 881382
A 245422 767332
A 141555 965048
R 245422 767332
A 615038 698285
R 780818 881382
R 615038 698285
A 108678 944698
R 141555 965048
A 595940 967053
R 108678 944698
A 146561 250686
A 303022 829278
A 72755 602619
A 374686 721067
A 8506 980130
A 3695 994460
A 156694 861875
R 156694 8618...

output:

100564
635960
635960
100564
266344
83247
823493
856370
836020
858375
371113
820492
682717
682717
574506
574506
574506
574506
574506
541524
327155
327155
541524
541524
541524
541524
433936
541524
541524
682717
682717
104125
823976
823976
823976
823976
823976
823976
823976
823976
897782
897782
897782
...

result:

ok 500 lines

Test #9:

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

input:

500
A 420438 541497
A 86798 990642
A 235310 729230
A 197788 625590
A 79284 860784
A 346912 450878
A 773621 889839
A 5712 984607
A 11350 639351
A 181429 945167
A 600438 974037
A 555450 871681
A 593584 939508
A 111801 887010
A 98478 501202
A 681985 834199
A 503983 625918
A 473820 924948
A 172241 84496...

output:

121059
121059
121059
121059
121059
194585
469401
469401
469401
469401
469401
451243
451243
451243
451243
413761
279006
279006
279006
279006
279006
279006
279006
279006
279006
279006
279006
279006
279006
279006
279006
279006
279006
279006
279006
279006
279006
279006
279006
279006
279006
279006
279006...

result:

ok 500 lines

Test #10:

score: 0
Accepted
time: 23ms
memory: 154140kb

input:

500
A 231294 865302
A 8 999932
A 12438 979246
A 238533 788301
A 489466 694962
A 449857 936742
A 508862 838859
A 9106 368028
A 328347 578297
A 44361 997182
A 131817 462103
A 221223 700923
A 555704 987943
A 114241 978978
A 403584 802697
A 38125 324399
A 21828 947351
A 258684 853933
A 367336 694342
A 3...

output:

634008
634008
634008
549768
205496
205496
349393
685856
685856
685856
563145
563145
563145
563145
563145
540172
540172
540172
540172
540172
540172
540172
540172
540172
540172
540172
540172
446351
270004
270004
270004
270004
270004
270004
270004
270004
270004
270004
270004
270004
270004
270004
270004...

result:

ok 500 lines

Test #11:

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

input:

500
A 343721 615037
A 50898 491918
A 48426 990133
A 449206 907311
A 532116 720634
A 466385 563131
A 22661 502083
A 345660 709874
A 130224 270658
A 545301 807676
A 5041 952806
A 444622 693531
A 289899 888889
A 47379 986754
A 231133 737204
A 2253 996081
A 450332 787060
A 404494 556776
A 660496 786591
...

output:

271316
564139
564139
856413
669736
669736
669736
669736
432907
432907
432907
432907
432907
432907
432907
432907
432907
426552
320206
320206
320206
320206
320206
320206
320206
320206
320206
320206
275330
275330
275330
275330
275330
275330
275330
275330
275330
275330
275330
275330
275330
275330
275330...

result:

ok 500 lines

Test #12:

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

input:

500
A 32207 954706
A 576067 592786
A 117728 458806
A 165460 529246
R 576067 592786
A 315884 799850
A 230281 974894
A 510689 824833
A 342520 902709
A 158641 808483
A 700956 847418
A 100978 425877
A 76360 575288
A 6220 995293
A 63604 586202
A 230873 993670
A 41522 213462
A 246536 727475
A 449004 92977...

output:

922499
16719
475058
427326
411518
682122
682122
707105
707105
707105
681958
681958
681958
681958
681958
681958
681958
681958
681958
681958
624642
624642
624642
624642
651025
651025
651025
651025
651025
651025
651025
367873
367873
367873
367873
235167
235167
235167
235167
235167
181297
181297
181297
...

result:

ok 500 lines

Test #13:

score: 0
Accepted
time: 23ms
memory: 154224kb

input:

500
A 306104 754196
A 214171 681395
A 105972 984762
A 94905 948643
A 292540 957380
A 754843 867779
A 745416 794633
A 34902 860261
A 20222 972411
A 110059 523930
A 397455 638101
A 64515 210449
A 22262 660198
A 11235 985854
A 244678 769170
A 457658 941789
A 2134 968210
A 423816 840352
A 2191 52569
A 2...

output:

448092
540025
540025
540025
540025
561675
561675
561675
561675
561675
397178
397178
397178
397178
397178
397178
397178
397178
208258
208258
208258
208258
208258
208258
208258
208258
208258
208258
208258
208258
208258
208258
208258
208258
208258
208258
113063
113063
113063
113063
113063
113063
113063...

result:

ok 500 lines

Test #14:

score: 0
Accepted
time: 19ms
memory: 154496kb

input:

500
A 17773 585069
A 10805 798041
A 9292 989157
A 132806 984174
A 120949 281437
A 94058 844382
A 222028 418948
A 287046 932966
A 344232 537538
A 268486 805522
A 327779 808754
A 766430 885562
A 8475 490707
A 156538 748364
A 28797 764725
A 123931 918493
A 725432 981971
A 296376 916640
A 86879 595729
A...

output:

567296
567296
567296
966401
863225
863225
297999
812017
416589
416589
416589
416589
416589
416589
416589
416589
416589
416589
416589
416589
416589
416589
416589
416589
416589
416589
416589
234238
234238
234238
234238
234238
234238
234238
234238
234238
234238
234238
234238
234238
234238
234238
234238...

result:

ok 500 lines

Test #15:

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

input:

500
A 446496 782465
A 250128 368406
A 589440 922990
A 9581 900002
A 796765 895690
A 100535 681192
A 480770 491534
A 204193 443280
A 80823 872633
A 280203 381216
A 332871 679970
A 429360 877678
A 756295 965817
A 135291 947218
A 30963 976507
A 301365 334438
A 248566 334240
A 590075 919800
A 662294 925...

output:

335969
532337
532337
532337
449194
449194
241406
241406
241406
211331
211331
211331
211331
211331
211331
190169
190169
190169
190169
190169
190169
190169
190169
190169
190169
190169
190169
190169
190169
190169
190169
190169
190169
190169
190169
190169
190169
181094
181094
181094
181094
181094
181094...

result:

ok 500 lines

Test #16:

score: 0
Accepted
time: 25ms
memory: 154272kb

input:

500
A 745 987896
A 257131 979515
A 255749 989332
A 449624 695408
A 113085 993645
A 396763 602015
A 354738 920971
A 106694 959998
A 341605 371385
A 663214 771813
A 122 990639
A 3760 993237
A 133709 962263
A 368367 686437
A 329118 922429
A 136220 881144
A 136168 926806
A 49390 692317
A 223407 609457
A...

output:

987151
722384
722384
245784
245784
298645
298645
298645
260410
260410
260410
260410
260410
260410
260410
260410
260410
260410
260410
207681
207681
207681
207681
207681
207681
207681
136143
136143
136143
136143
136143
136143
136143
136143
136143
136143
136143
136143
136143
136143
136143
136143
136143...

result:

ok 500 lines

Test #17:

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

input:

500
A 11953 695942
A 35551 731979
A 13233 934644
A 8174 954394
A 4475 959711
A 37705 77406
A 44087 45729
A 727372 740080
A 978 987857
A 1923 203498
A 126556 335611
A 57616 726164
A 108636 181849
A 327729 907228
A 34031 45718
A 68049 399000
A 9275 956024
A 37527 647862
A 252883 742199
A 9430 857336
A...

output:

683989
720026
720026
720026
720026
39701
1642
695993
695993
695993
291524
291524
137762
137762
137762
137762
137762
137762
137762
137762
137762
137762
137762
137762
137762
137762
137762
137762
137762
137762
137762
137762
137762
137762
137762
137762
137762
137762
137762
137762
137762
137762
137762
13...

result:

ok 500 lines

Test #18:

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

input:

500
A 298007 888579
A 483714 603189
A 219523 976671
A 1646 991493
A 23869 985885
A 660671 926526
A 1516 993019
A 337971 929682
A 589482 957416
A 422476 695992
A 167078 239061
A 763279 792829
A 97931 722151
A 120681 132093
A 190287 394093
A 328901 335618
A 879810 928556
A 390183 830830
A 99017 719367...

output:

590572
119475
119475
119475
119475
442812
442812
442812
442812
442812
436111
309115
309115
118380
118380
118380
118380
118380
118380
118380
118380
118380
118380
118380
118380
118380
118380
118380
118380
118380
118380
118380
118380
66850
66850
66850
66850
66850
66850
66850
66850
66850
66850
66850
668...

result:

ok 500 lines

Test #19:

score: 0
Accepted
time: 19ms
memory: 154216kb

input:

500
A 588811 753498
A 25744 954698
A 21827 606205
A 45919 960197
A 11071 907495
A 18776 990396
A 9017 942595
R 18776 990396
A 229036 314027
R 25744 954698
A 27964 272394
R 229036 314027
A 369610 990304
R 27964 272394
A 414713 642052
R 45919 960197
A 178858 900447
R 178858 900447
A 494650 630549
R 90...

output:

164687
164687
731671
731671
731671
731671
731671
731671
524462
524462
524462
725534
725534
731671
731671
731671
731671
731671
731671
731671
693965
571016
571016
571016
571016
571016
571016
571016
571016
571016
571016
571016
571016
571016
323371
214957
497837
760011
760011
760011
188669
188669
188669...

result:

ok 500 lines

Test #20:

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

input:

500
A 106057 921927
A 303014 807667
R 303014 807667
A 423054 692630
R 106057 921927
A 187145 756778
R 187145 756778
A 64120 986049
R 423054 692630
A 166967 655998
R 64120 986049
A 318687 497532
R 166967 655998
A 304167 958195
R 318687 497532
A 106187 686625
R 106187 686625
A 973469 991522
R 304167 9...

output:

815870
504653
815870
269576
269576
269576
269576
269576
921929
489031
489031
178845
178845
178845
654028
852008
654028
687355
18053
858841
18053
816179
18053
855668
18053
814268
699990
730551
699990
850070
699990
699990
902415
164646
164646
810066
189358
784977
189358
758565
189358
576279
209831
340...

result:

ok 500 lines

Test #21:

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

input:

500
A 137766 477177
A 7564 860035
A 129588 989018
A 323 937154
A 41925 795040
A 9207 260372
A 120296 557819
A 1657 880038
A 8815 168680
A 56356 998169
A 53816 776405
A 4207 888989
A 26811 75718
A 48976 56850
A 8424 913386
A 1435 966270
A 279532 596973
A 698007 884380
A 86391 540254
A 1750 41798
A 24...

output:

339411
339411
339411
339411
339411
467970
467970
467970
468362
468362
468362
468362
450366
428201
428201
428201
428201
428201
428201
55100
55100
55100
55100
55100
55100
55100
55100
55100
55100
55100
50859
50859
50859
50859
50859
50859
50859
50859
50859
50859
50859
50859
50859
50859
50859
50859
50859...

result:

ok 500 lines

Test #22:

score: 0
Accepted
time: 19ms
memory: 154064kb

input:

500
A 275582 317840
A 47056 832191
A 287663 711028
A 16255 276633
A 480611 685852
A 128995 190159
A 36668 954591
A 218862 926429
A 268916 889801
A 317450 388722
A 71382 403894
A 93695 520175
A 62 742471
A 138106 941494
A 151897 327644
A 376089 411916
A 208579 689653
A 8800 325054
A 110069 876308
A 1...

output:

42258
42258
435446
694773
410270
188845
188845
188845
188845
188845
188845
188845
188845
188845
188845
136334
136334
136334
136334
136334
136334
136334
136334
136334
136334
136334
136334
136334
136334
136334
136334
136334
136334
136334
136334
136334
136334
110239
110239
110239
110239
110239
110239
1...

result:

ok 500 lines

Test #23:

score: 0
Accepted
time: 23ms
memory: 154000kb

input:

500
A 344488 665895
A 148041 751144
A 35243 707400
A 24325 925025
A 20169 938061
A 4736 983787
A 24697 913069
A 7876 69057
A 41241 999109
A 1533 673869
R 7876 69057
A 120253 639649
R 4736 983787
R 24697 913069
R 24325 925025
A 34350 855359
A 280369 957789
A 775495 998121
R 280369 957789
A 23337 9991...

output:

321407
321407
321407
321407
321407
321407
321407
658019
658019
658019
321407
545642
545642
545642
545642
545642
545642
653633
653633
653633
653633
653633
653633
557629
450040
450040
450040
450040
450040
450040
450040
450040
433439
268053
268053
268053
268053
268053
268053
268053
268053
268053
268053...

result:

ok 500 lines

Test #24:

score: 0
Accepted
time: 11ms
memory: 153964kb

input:

500
A 1448 974037
A 495065 673867
A 337787 867021
R 337787 867021
A 229625 584134
R 229625 584134
R 495065 673867
A 126424 634218
A 2415 869749
A 90946 820247
R 126424 634218
R 90946 820247
A 633806 937354
R 2415 869749
R 1448 974037
A 459089 484543
R 459089 484543
A 344368 830604
A 926675 946450
R ...

output:

972589
178802
178802
178802
444242
178802
972589
507794
507794
507794
729301
867334
934939
303548
303548
478265
303548
592986
602082
312644
19775
19775
19775
769857
19775
19775
724126
724126
724126
724126
85698
85698
689862
689862
689862
372305
372305
814501
372305
240101
240101
240101
240101
275449...

result:

ok 500 lines

Test #25:

score: 0
Accepted
time: 24ms
memory: 154220kb

input:

500
A 193911 938608
A 85030 816054
A 329835 564575
A 114343 645838
A 304252 308629
A 472139 861625
A 450383 511626
A 514921 708694
A 427332 910230
A 845878 886647
A 705629 763425
A 237842 614707
A 456279 695717
A 399118 631058
A 84572 710775
A 599128 912563
A 378035 574380
A 263244 896316
A 827864 8...

output:

744697
853578
234740
234740
260323
260323
207374
207374
207374
207374
181018
181018
181018
181018
181018
181018
181018
181018
176785
176785
176785
176785
176785
176785
176785
176785
176785
176785
176785
176785
176785
176785
176785
176785
176785
176785
176785
176785
176785
176785
176785
176785
176785...

result:

ok 500 lines

Test #26:

score: 0
Accepted
time: 11ms
memory: 154216kb

input:

500
A 54738 868077
A 588547 875633
A 16225 80984
A 59087 522101
A 602 906079
A 13799 833381
A 165065 775393
A 38303 916902
A 22256 114177
A 12475 917423
A 127398 996588
A 777408 862424
A 21541 952174
A 386493 859793
A 8113 886191
A 550084 950433
A 2906 988632
A 12980 933884
A 301140 981816
A 50031 5...

output:

813339
820895
859408
816546
816546
816546
759168
759168
753137
753137
753137
697359
697359
697359
697359
697359
697359
697359
697359
697359
697359
697359
256263
123031
123031
123031
123031
123031
123031
123031
123031
123031
88537
88537
88537
88537
88537
88537
88537
88537
88537
88537
88537
88537
8853...

result:

ok 500 lines

Test #27:

score: 0
Accepted
time: 8ms
memory: 154196kb

input:

500
A 303428 446771
A 543675 669996
A 418270 540614
A 483641 505919
A 326605 976348
A 317975 493304
A 185995 801094
A 31748 926561
A 500905 578852
A 156433 886800
A 360038 594253
A 441527 457739
A 123491 719674
A 28229 555206
R 28229 555206
A 3473 964833
A 372239 538589
A 230944 500159
A 667860 8314...

output:

143343
366568
251726
186355
186355
186355
186355
186355
186355
186355
186355
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
64392
6...

result:

ok 500 lines

Test #28:

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

input:

500
A 141812 907928
A 182434 884453
A 40789 952678
A 12695 954244
R 182434 884453
A 11349 986676
A 10652 955472
R 141812 907928
A 247328 698726
A 25356 964628
A 551841 860392
A 315885 587235
A 6132 996500
A 636141 871187
A 157688 792095
A 280677 380869
A 925571 942795
A 762682 969953
A 215267 720643...

output:

766116
702019
702019
702019
766116
766116
766116
911889
451398
451398
613064
544507
544507
555302
555302
555302
306654
306654
306654
306654
306654
306654
306654
306654
306654
306654
306654
306654
306654
306654
306654
306654
306654
306654
306654
306654
306654
306654
306654
272122
272122
272122
101539...

result:

ok 500 lines

Test #29:

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

input:

500
A 6832 307527
A 341466 970802
A 149322 998864
A 177594 997810
A 357851 379382
A 68200 427730
A 21297 998990
A 340810 784235
A 41766 999403
A 108762 998749
A 16092 999326
A 170999 998204
A 11916 999712
A 108899 889310
A 51516 999692
A 1903 966825
A 96814 105662
A 164034 371725
A 87615 105130
A 17...

output:

300695
963970
963970
963970
372550
372550
372550
372550
372550
372550
372550
372550
372550
372550
372550
372550
282568
274911
274911
274911
274911
274911
274911
274911
274911
274911
274911
274911
274911
274911
274911
274911
274911
274911
274911
274911
274911
274911
274911
274911
274911
274911
192305...

result:

ok 500 lines

Test #30:

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

input:

500
A 679677 906656
A 383398 997815
A 31005 911610
A 507320 948895
A 115394 999230
A 335238 603601
A 915439 953993
A 611605 808174
A 675359 821597
A 763056 937349
A 916 947783
A 204314 953734
A 259327 696595
A 12726 999834
A 36892 825783
A 203912 962211
A 30800 720510
A 855020 940327
A 66540 999342
...

output:

226979
226979
226979
226979
226979
571418
274316
274316
274316
274316
274316
274316
274316
274316
274316
274316
274316
264968
264968
264968
264968
264968
264968
244544
244544
244544
244544
244544
244544
244544
244544
244544
243744
243744
243744
243744
243744
243744
243744
243744
132748
132748
132748...

result:

ok 500 lines

Test #31:

score: 0
Accepted
time: 17ms
memory: 154308kb

input:

500
A 350410 829666
A 211207 616646
A 502648 682639
A 282364 437940
A 126420 729288
A 66617 770209
A 115386 992988
A 371171 782557
A 664742 852771
A 133450 586677
A 128134 549444
A 858659 977535
A 6166 775106
A 446721 859623
A 1522 943671
A 92567 932848
A 305551 545600
A 16070 791346
A 348392 786505...

output:

479256
618459
471432
400275
400275
400275
400275
400275
400275
400275
400275
312793
312793
312793
312793
312793
312793
312793
312793
312793
312793
312793
312793
312793
312793
312793
312793
312793
257693
257693
257693
257693
257693
257693
257693
257693
257693
257693
257693
257693
257693
257693
257693...

result:

ok 500 lines

Test #32:

score: 0
Accepted
time: 19ms
memory: 154188kb

input:

500
A 675292 805732
A 14438 995574
A 25026 170473
A 587672 801999
A 337 996331
A 17495 137363
A 335 996697
A 4927 152665
A 101687 492834
A 1981 962554
A 16337 553396
A 200730 861951
A 364391 877081
A 431303 971034
A 507934 697729
A 524542 940120
A 79615 792406
A 536396 790749
A 16803 843367
A 437129...

output:

130440
130440
780706
776973
776973
776973
776973
776973
700312
700312
700312
700312
700312
700312
596042
596042
596042
596042
596042
596042
596042
370776
370776
334554
334554
334554
334554
334554
334554
294418
294418
294418
294418
294418
294418
294418
294418
294418
294418
294418
294418
294418
294418...

result:

ok 500 lines

Test #33:

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

input:

500
A 73484 936804
A 16710 971890
R 73484 936804
A 480498 957585
R 16710 971890
A 49942 906409
R 480498 957585
A 146475 985092
R 49942 906409
A 832504 858487
R 832504 858487
A 117500 933778
R 117500 933778
A 81653 707240
R 81653 707240
A 356971 982487
R 146475 985092
A 144518 666786
R 356971 982487
...

output:

863320
863320
955180
477087
477087
907643
856467
935150
838617
25983
838617
867592
838617
903439
838617
625516
625516
837969
522268
661763
38512
711781
679567
111966
111966
111966
111966
650920
111966
513725
231614
231614
875058
884915
875058
919263
875058
940647
553686
473293
553686
742838
553686
1...

result:

ok 500 lines

Test #34:

score: 0
Accepted
time: 19ms
memory: 154016kb

input:

500
A 42398 476588
A 92359 868724
R 42398 476588
A 604991 988947
R 92359 868724
A 60564 219738
R 60564 219738
A 369 991707
R 604991 988947
A 301167 823990
R 301167 823990
A 228034 985407
R 228034 985407
A 21268 814379
R 369 991707
A 133028 822389
R 21268 814379
A 204073 783583
R 204073 783583
A 1220...

output:

434190
826326
776365
896588
383956
928383
383956
383956
991338
522823
991338
757373
991338
793111
793111
801121
689361
579510
689361
700301
689361
750337
350242
477635
472605
575853
472605
478454
285836
670497
651065
982264
651065
886597
809696
95275
95275
658499
95275
544574
95275
95275
551494
6568...

result:

ok 500 lines

Test #35:

score: 0
Accepted
time: 13ms
memory: 153972kb

input:

500
A 100638 295546
A 192743 974300
R 100638 295546
A 63576 680836
R 192743 974300
A 55088 922034
R 55088 922034
A 252912 799106
R 252912 799106
A 13863 414676
R 63576 680836
A 306573 468779
R 306573 468779
A 454391 907459
R 13863 414676
A 9801 967647
R 9801 967647
A 792121 879100
R 454391 907459
A ...

output:

194908
873662
781557
910724
617260
617260
617260
735530
617260
666973
400813
454916
400813
893596
453068
453068
453068
86979
86979
559632
86979
559866
86979
801499
86979
532614
86979
697092
86979
86979
876769
323077
876769
486991
876769
876769
995802
106097
995802
638646
995802
154672
995802
728166
...

result:

ok 500 lines

Test #36:

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

input:

500
A 114285 960375
A 471863 829118
R 471863 829118
A 7825 690648
R 114285 960375
A 192371 231654
R 7825 690648
A 648837 819085
R 192371 231654
A 4658 666174
R 648837 819085
A 251114 615091
R 251114 615091
A 402359 880204
R 4658 666174
A 92232 997516
R 402359 880204
A 243703 996523
R 92232 997516
A ...

output:

846090
357255
846090
952550
682823
39283
39283
626714
170248
814427
661516
363977
661516
875546
477845
477845
905284
752820
752820
287579
752820
310179
310179
310179
822736
857017
822736
881376
668903
22460
22460
842825
633538
764484
633538
633538
993031
62141
62141
654855
29268
544005
397025
454439...

result:

ok 500 lines

Test #37:

score: 0
Accepted
time: 19ms
memory: 154276kb

input:

500
A 21043 984093
A 248079 963775
R 248079 963775
A 93376 957210
A 10301 474603
A 331626 810525
A 70492 974701
A 281342 956814
A 56532 833223
A 736458 987063
A 64139 975386
R 736458 987063
A 420966 565261
R 93376 957210
R 420966 565261
A 443753 749663
R 281342 956814
R 70492 974701
R 21043 984093
A...

output:

963050
715696
963050
863834
946909
800224
800224
800224
800224
976762
976762
800224
554960
554960
800224
739362
739362
739362
739362
739362
512854
512854
512854
512854
512854
512854
512854
512854
512854
512854
512854
275300
275300
275300
275300
275300
275300
275300
275300
275300
275300
275300
275300...

result:

ok 500 lines

Test #38:

score: 0
Accepted
time: 19ms
memory: 153960kb

input:

500
A 609751 859750
A 760379 804266
R 609751 859750
A 12135 997598
A 132483 369255
R 760379 804266
R 132483 369255
A 103893 621687
R 103893 621687
A 66091 791226
R 66091 791226
A 226914 569109
R 226914 569109
A 91121 981647
R 91121 981647
A 264420 485641
R 264420 485641
A 9353 967990
R 12135 997598
...

output:

249999
43887
43887
43887
671783
236772
985463
517794
985463
725135
985463
342195
985463
890526
985463
221221
985463
988245
958637
172389
644121
172389
172389
107502
488294
488294
162808
162808
405305
405305
405305
405305
383354
383354
383354
383354
383354
383354
735534
735534
735534
735534
735534
69...

result:

ok 500 lines

Test #39:

score: 0
Accepted
time: 13ms
memory: 154044kb

input:

500
A 29475 158455
A 547408 799768
R 547408 799768
A 429410 962867
R 429410 962867
A 72773 753875
A 331070 959683
R 72773 753875
R 331070 959683
A 94102 340227
A 63543 126748
A 141419 917470
A 119012 690867
R 63543 126748
R 94102 340227
A 113849 908834
R 119012 690867
A 161950 722752
R 29475 158455
...

output:

128980
770293
128980
933392
128980
724400
930208
930208
128980
310752
276684
853927
853927
887995
887995
887995
887995
693277
560802
39502
39502
39502
253314
253314
253314
253314
490922
490922
490922
490922
933067
933067
933067
933067
895377
895377
895377
97217
97217
97217
97217
97217
97217
873948
5...

result:

ok 500 lines

Test #40:

score: 0
Accepted
time: 19ms
memory: 153976kb

input:

500
A 180236 960399
A 132851 960909
A 261211 438849
R 180236 960399
R 132851 960909
A 365268 810394
A 254754 694963
R 254754 694963
R 365268 810394
A 46244 309595
R 261211 438849
A 30669 922670
A 191831 900322
R 191831 900322
R 30669 922670
A 300931 969614
R 300931 969614
A 335810 920310
A 568538 72...

output:

780163
780163
177638
177638
177638
549183
549183
549183
177638
392605
263351
263351
854078
263351
263351
923370
263351
874066
674692
674692
152398
152398
390928
425539
210859
210859
210859
210859
210859
644619
644619
210859
909698
458119
484574
189750
189750
189750
189750
275280
275280
63392
63392
6...

result:

ok 500 lines

Test #41:

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

input:

500
A 529079 933460
A 165284 787941
A 309257 800948
R 309257 800948
A 777560 840933
R 165284 787941
A 13278 797671
A 860948 946604
A 840160 966456
A 13698 821053
A 103613 966144
A 214445 629645
A 67367 977522
R 13278 797671
A 350133 830034
A 59794 908567
A 95057 518987
A 728799 886367
A 361380 88589...

output:

404381
768176
768176
768176
675649
63373
827655
169044
169044
169044
169044
169044
169044
169044
169044
169044
169044
169044
169044
169044
169044
169044
169044
169044
169044
169044
556896
556896
556896
556896
556896
531103
531103
531103
531103
437819
189719
189719
189719
189719
189719
132250
132250
...

result:

ok 500 lines

Test #42:

score: 0
Accepted
time: 21ms
memory: 154284kb

input:

500
A 65176 993394
A 234698 752126
A 57673 993986
A 182470 788432
A 58838 951037
A 141893 998425
A 86207 938500
A 342026 783445
A 9648 814379
R 234698 752126
A 396294 807183
A 546832 835454
A 403272 914307
R 86207 938500
R 546832 835454
A 398157 502428
R 141893 998425
A 517744 902045
A 47073 925064
...

output:

928218
517428
517428
517428
517428
517428
517428
548747
548747
441419
465157
493428
493428
493428
572281
516150
516150
503888
503888
503888
503888
503888
503888
718491
718491
718491
482230
482230
482230
482230
482230
331946
331946
331946
331946
357672
357672
357672
357672
357672
357672
357672
357672...

result:

ok 500 lines

Test #43:

score: 0
Accepted
time: 23ms
memory: 154024kb

input:

500
A 5109 992068
A 125917 937538
A 92038 483867
A 84635 785359
A 8921 985714
A 55822 745312
A 94482 981807
A 552380 960550
R 8921 985714
R 125917 937538
R 552380 960550
R 55822 745312
R 5109 992068
R 84635 785359
R 92038 483867
A 933503 952083
R 94482 981807
A 101307 878864
R 933503 952083
A 7311 9...

output:

986959
811621
845500
845500
845500
845500
845500
868512
868512
868512
889769
889769
889769
889769
887325
18580
18580
850776
777557
777557
369183
526525
526525
437808
437808
437808
437808
437808
437808
214153
214153
214153
214153
539853
214879
214879
546645
546645
547016
466013
466013
466013
225391
2...

result:

ok 500 lines

Test #44:

score: 0
Accepted
time: 11ms
memory: 153952kb

input:

500
A 173190 811333
A 292206 679525
A 10269 741535
R 173190 811333
R 10269 741535
A 394280 675755
R 394280 675755
A 62657 301984
A 675204 847147
R 62657 301984
R 292206 679525
A 11087 821360
A 64136 959244
R 675204 847147
R 64136 959244
A 449607 871074
A 82253 176548
R 449607 871074
R 82253 176548
A...

output:

638143
387319
387319
387319
387319
281475
387319
616868
784490
554941
171943
836060
836060
948157
810273
859987
788821
94295
810273
957839
810273
936205
899833
851974
810273
819089
304690
76654
810273
978146
978146
982134
946887
460227
708645
369939
946887
656870
656870
656870
656870
565602
593372
5...

result:

ok 500 lines

Test #45:

score: 0
Accepted
time: 20ms
memory: 153960kb

input:

500
A 56729 238436
A 155786 954868
A 152804 631887
A 224341 828480
A 254069 470857
A 128763 251342
A 160974 777360
A 438176 984634
A 147924 542308
A 45311 982498
A 213964 303987
A 471798 899777
A 241387 892058
A 93526 155432
A 212897 615085
A 486418 508817
A 704130 750898
A 343186 927181
A 584170 86...

output:

181707
898139
898139
771751
414128
342094
342094
342094
342094
342094
342094
342094
342094
210461
210461
210461
210461
210461
210461
210461
210461
210461
210461
210461
210461
210461
210461
210461
210461
210461
210461
210461
210461
210461
210461
210461
210461
180174
180174
180174
180174
180174
180174...

result:

ok 500 lines

Test #46:

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

input:

500
A 15481 866099
A 414013 920063
A 641613 970444
A 482226 864739
A 27865 445840
A 342097 634056
A 26518 836711
A 147998 429521
A 300973 946757
A 179540 885384
A 32695 562824
A 262289 349375
A 70695 726084
A 381357 433816
A 195067 758510
A 190570 996649
A 386934 980951
A 526391 758538
A 107035 5117...

output:

850618
904582
954963
488218
836874
628347
628347
628347
628347
628347
628347
602450
602450
171527
171527
171527
171527
171527
171527
171527
171527
171527
171527
171527
171527
171527
171527
171527
171527
171527
171527
171527
171527
171527
171527
171527
171527
171527
164937
164937
164937
164937
164937...

result:

ok 500 lines

Test #47:

score: 0
Accepted
time: 23ms
memory: 154052kb

input:

500
A 250899 881077
A 286973 922754
A 446486 703171
A 170909 641892
A 506613 867702
A 653234 703633
A 29145 952976
A 269161 831495
R 170909 641892
R 269161 831495
R 506613 867702
R 653234 703633
R 29145 952976
R 286973 922754
R 250899 881077
A 557761 776831
A 32154 965826
A 207918 872888
A 85664 152...

output:

630178
671855
256685
532262
696793
532724
532724
532724
257147
257147
257147
256685
256685
256685
256685
330345
330345
330345
617507
617507
412650
412650
412650
617507
691167
691167
691167
691167
67001
611351
611351
611351
611351
611351
611351
611351
655766
655766
699602
936570
936570
936570
657199
...

result:

ok 500 lines

Test #48:

score: 0
Accepted
time: 19ms
memory: 153908kb

input:

500
A 585605 866967
A 553128 764608
A 271147 831226
R 553128 764608
R 271147 831226
A 18219 871897
A 397946 690882
R 397946 690882
R 585605 866967
A 105308 866522
A 131227 988598
R 105308 866522
R 18219 871897
A 744712 861619
A 49754 845749
R 131227 988598
R 49754 845749
A 276817 909285
A 169309 637...

output:

281362
313839
313839
595820
281362
281362
469021
281362
853678
761214
883290
970379
857371
116907
811865
811865
116907
116907
692310
692310
468247
407
407
407
545228
801483
684625
684625
545228
617473
617473
656198
545228
664125
757491
638594
372907
808785
707801
415994
315010
450331
450331
234908
2...

result:

ok 500 lines

Test #49:

score: 0
Accepted
time: 32ms
memory: 154064kb

input:

500
A 499504 499752
A 499506 499755
A 499508 499758
A 499510 499761
A 499512 499764
A 499514 499767
A 499516 499770
A 499518 499773
A 499520 499776
A 499522 499779
A 499524 499782
A 499526 499785
A 499528 499788
A 499530 499791
A 499532 499794
A 499534 499797
A 499536 499800
A 499538 499803
A 499540...

output:

248
251
254
257
260
263
266
269
272
275
278
281
284
287
290
293
296
299
302
305
308
311
314
317
320
323
326
329
332
335
338
341
344
347
350
353
356
359
362
365
368
371
374
377
380
383
386
389
392
395
398
401
404
407
410
413
416
419
422
425
428
431
434
437
440
443
446
449
452
455
458
461
464
467
470
...

result:

ok 500 lines

Test #50:

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

input:

500
A 499636 499950
A 499906 500355
A 499764 500142
A 499914 500367
A 499520 499776
A 499688 500028
A 499536 499800
A 499640 499956
A 499758 500133
A 499968 500448
A 499620 499926
A 499680 500016
A 499754 500127
A 499552 499824
A 499730 500091
A 499916 500370
A 499892 500334
A 499864 500292
A 499704...

output:

314
719
719
731
835
835
819
819
819
808
808
808
808
803
803
803
782
740
740
740
740
737
701
701
701
701
695
623
623
623
623
623
623
623
623
623
623
623
623
623
623
623
623
623
623
623
623
623
620
620
620
620
620
620
620
620
620
620
620
620
620
620
620
620
620
620
620
620
620
620
620
620
620
620
620
...

result:

ok 500 lines

Test #51:

score: 0
Accepted
time: 23ms
memory: 154128kb

input:

500
A 499504 499752
A 499506 499755
A 499508 499758
A 499510 499761
A 499512 499764
A 499514 499767
A 499516 499770
A 499518 499773
A 499520 499776
A 499522 499779
A 499524 499782
A 499526 499785
A 499528 499788
A 499530 499791
A 499532 499794
A 499534 499797
A 499536 499800
A 499538 499803
A 499540...

output:

248
251
254
257
260
263
266
269
272
275
278
281
284
287
290
293
296
299
302
305
308
311
314
317
320
323
326
329
332
335
338
341
344
347
350
353
356
359
362
365
368
371
374
377
380
383
386
389
392
395
398
401
404
407
410
413
416
419
422
425
428
431
434
437
440
443
446
449
452
455
458
461
464
467
470
...

result:

ok 500 lines

Test #52:

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

input:

500
A 499534 499797
A 499528 499788
A 499692 500034
A 499636 499950
A 499728 500088
A 499608 499908
A 499688 500028
A 499814 500217
A 499596 499890
A 499530 499791
A 499552 499824
A 499914 500367
A 499634 499947
A 499622 499929
A 499592 499884
A 499666 499995
A 499520 499776
A 499756 500130
A 499736...

output:

263
269
506
506
560
560
560
683
683
683
683
683
683
683
683
683
683
683
683
683
683
683
683
683
683
683
683
662
662
662
662
662
662
662
662
655
655
655
655
655
655
655
655
655
655
655
655
655
655
655
655
655
655
655
655
655
655
655
655
655
655
655
655
655
655
651
651
651
651
651
651
651
651
651
651
...

result:

ok 500 lines

Test #53:

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

input:

500
A 499504 499752
A 499506 499755
A 499508 499758
A 499510 499761
A 499512 499764
A 499514 499767
A 499516 499770
A 499518 499773
A 499520 499776
A 499522 499779
A 499524 499782
A 499526 499785
A 499528 499788
A 499530 499791
A 499532 499794
A 499534 499797
A 499536 499800
A 499538 499803
A 499540...

output:

248
251
254
257
260
263
266
269
272
275
278
281
284
287
290
293
296
299
302
305
308
311
314
317
320
323
326
329
332
335
338
341
344
347
350
353
356
359
362
365
368
371
374
377
380
383
386
389
392
395
398
401
404
407
410
413
416
419
422
425
428
431
434
437
440
443
446
449
452
455
458
461
464
467
470
...

result:

ok 500 lines

Test #54:

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

input:

500
A 499770 500151
A 499612 499914
A 499974 500457
A 499756 500130
A 499542 499809
A 499748 500118
A 499552 499824
A 499760 500136
A 499820 500226
A 499508 499758
A 499980 500466
A 499864 500292
A 499988 500478
A 499624 499932
A 499806 500205
A 499808 500208
A 499934 500397
A 499954 500427
A 499526...

output:

381
539
845
845
845
845
845
845
684
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
628
...

result:

ok 500 lines

Test #55:

score: 0
Accepted
time: 8ms
memory: 154320kb

input:

500
A 499504 499752
A 499506 499755
A 499508 499758
A 499510 499761
A 499512 499764
A 499514 499767
A 499516 499770
A 499518 499773
A 499520 499776
A 499522 499779
A 499524 499782
A 499526 499785
A 499528 499788
A 499530 499791
A 499532 499794
A 499534 499797
A 499536 499800
A 499538 499803
A 499540...

output:

248
251
254
257
260
263
266
269
272
275
278
281
284
287
290
293
296
299
302
305
308
311
314
317
320
323
326
329
332
335
338
341
344
347
350
353
356
359
362
365
368
371
374
377
380
383
386
389
392
395
398
401
404
407
410
413
416
419
422
425
428
431
434
437
440
443
446
449
452
455
458
461
464
467
470
...

result:

ok 500 lines

Test #56:

score: 0
Accepted
time: 11ms
memory: 154048kb

input:

500
A 499836 500250
A 499730 500091
A 499738 500103
A 499710 500061
A 499886 500325
A 499794 500187
A 499862 500289
A 499788 500178
A 499594 499887
A 499564 499842
A 499702 500049
A 499688 500028
A 499960 500436
A 499692 500034
A 499758 500133
A 499998 500493
A 499908 500358
A 499504 499752
A 499958...

output:

414
520
520
540
615
615
615
615
731
725
725
725
725
725
725
725
725
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
629
625
625
625
625
625
625
625
625
625
625
625
625
...

result:

ok 500 lines

Test #57:

score: 0
Accepted
time: 18ms
memory: 154064kb

input:

500
A 499504 499752
A 499506 499755
A 499508 499758
A 499510 499761
A 499512 499764
A 499514 499767
A 499516 499770
A 499518 499773
A 499520 499776
A 499522 499779
A 499524 499782
A 499526 499785
A 499528 499788
A 499530 499791
A 499532 499794
A 499534 499797
A 499536 499800
A 499538 499803
A 499540...

output:

248
251
254
257
260
263
266
269
272
275
278
281
284
287
290
293
296
299
302
305
308
311
314
317
320
323
326
329
332
335
338
341
344
347
350
353
356
359
362
365
368
371
374
377
380
383
386
389
392
395
398
401
404
407
410
413
416
419
422
425
428
431
434
437
440
443
446
449
452
455
458
461
464
467
470
...

result:

ok 500 lines

Test #58:

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

input:

500
A 499980 500466
A 499988 500478
A 499942 500409
A 499558 499833
A 499836 500250
A 499742 500109
A 499714 500067
A 499624 499932
A 499908 500358
A 499526 499785
A 499520 499776
A 499808 500208
A 499976 500460
A 499716 500070
A 499634 499947
A 499736 500100
A 499622 499929
A 499996 500490
A 499692...

output:

486
498
536
851
692
692
692
692
692
692
692
682
682
682
682
682
682
682
682
682
682
682
682
682
682
682
682
682
682
661
661
661
658
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
652
...

result:

ok 500 lines

Test #59:

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

input:

500
A 1 502
A 503 1003
A 1004 1503
A 1504 2002
A 2003 2500
A 2501 2997
A 2998 3493
A 3494 3988
A 3989 4482
A 4483 4975
A 4976 5467
A 5468 5958
A 5959 6448
A 6449 6937
A 6938 7425
A 7426 7912
A 7913 8398
A 8399 8883
A 8884 9367
A 9368 9850
A 9851 10332
A 10333 10813
A 10814 11293
A 11294 11772
A 1177...

output:

501
1002
1000
998
996
994
992
990
988
986
984
982
980
978
976
974
972
970
968
966
964
962
960
958
956
954
952
950
948
946
944
942
940
938
936
934
932
930
928
926
924
922
920
918
916
914
912
910
908
906
904
902
900
898
896
894
892
890
888
886
884
882
880
878
876
874
872
870
868
866
864
862
860
858
85...

result:

ok 500 lines

Test #60:

score: 0
Accepted
time: 19ms
memory: 154236kb

input:

500
A 126248 126250
A 126244 126247
A 126239 126243
A 126233 126238
A 126226 126232
A 126218 126225
A 126209 126217
A 126199 126208
A 126188 126198
A 126176 126187
A 126163 126175
A 126149 126162
A 126134 126148
A 126118 126133
A 126101 126117
A 126083 126100
A 126064 126082
A 126044 126063
A 126023...

output:

2
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
...

result:

ok 500 lines

Subtask #2:

score: 8
Accepted

Test #61:

score: 8
Accepted
time: 19ms
memory: 154224kb

input:

6
A 1 4
A 3 6
A 7 9
A 8 13
A 10 11
A 12 20

output:

3
5
6
6
4
4

result:

ok 6 lines

Test #62:

score: 0
Accepted
time: 18ms
memory: 154152kb

input:

3
A 1 9
A 6 15
A 5 10

output:

8
14
14

result:

ok 3 lines

Test #63:

score: 0
Accepted
time: 17ms
memory: 153884kb

input:

1
A 1 1000000

output:

999999

result:

ok single line: '999999'

Test #64:

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

input:

12000
A 174045 346671
A 58746 969907
A 52277 860980
A 51687 822337
A 320881 593470
A 22653 724673
A 347122 956041
A 514874 780251
A 155146 643918
A 116754 682718
A 374599 823274
A 373533 892185
A 63743 897550
A 224312 990829
A 423470 808028
A 212113 622665
A 263437 824930
A 416679 820773
A 515191 97...

output:

172626
172626
172626
172626
419425
419425
781996
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206
606206...

result:

ok 12000 lines

Test #65:

score: 0
Accepted
time: 52ms
memory: 155560kb

input:

12000
A 375053 948875
A 28782 831017
A 52211 937756
A 80144 303540
A 57568 955525
A 117481 966016
A 92106 774943
A 456401 788566
A 48304 887683
A 120272 532671
A 335039 490427
A 131773 461751
A 175340 859808
A 742792 956002
A 195683 690807
A 444964 948448
A 196618 213884
A 352567 814097
A 85197 7149...

output:

573822
920093
920093
868731
868731
868731
868731
708422
708422
708422
410283
410283
410283
410283
410283
410283
293809
293809
293809
293809
293809
293809
293809
293809
293809
293809
293809
293809
293809
293809
293809
293809
187217
187217
187217
187217
187217
187217
157635
157635
157635
157635
157635...

result:

ok 12000 lines

Test #66:

score: 0
Accepted
time: 40ms
memory: 155160kb

input:

12000
A 172707 791589
A 18321 972881
A 44693 902976
A 415826 678816
A 83141 342581
A 583854 704629
A 530249 872055
A 610833 923695
A 150732 828203
A 102712 316004
A 163501 823356
A 592883 741010
A 27109 968613
A 183246 463865
A 288597 951953
A 14861 822901
A 422932 959751
A 542217 751694
A 18241 875...

output:

618882
618882
618882
262990
595675
595675
595675
595675
595675
576104
576104
576104
576104
521383
521383
521383
521383
521383
521383
521383
377169
377169
377169
377169
377169
377169
377169
377169
377169
358016
358016
358016
358016
358016
358016
358016
358016
358016
358016
358016
358016
358016
358016...

result:

ok 12000 lines

Test #67:

score: 0
Accepted
time: 24ms
memory: 154352kb

input:

12000
A 35884 649685
A 764439 995061
R 35884 649685
A 473510 720163
R 473510 720163
A 1694 991467
R 1694 991467
A 2078 922894
R 764439 995061
A 67822 985273
R 67822 985273
A 188824 999642
R 2078 922894
A 176985 294251
R 188824 999642
A 31584 938679
R 31584 938679
A 206899 757444
R 206899 757444
A 38...

output:

613801
959177
230622
521551
230622
993367
230622
992983
920816
983195
920816
997564
810818
822657
117266
117266
117266
580459
117266
361632
117266
117266
117266
600615
117266
734456
721244
770936
569964
827436
337535
526807
217897
217897
648936
58239
648936
304115
648936
786882
740288
252119
252119
...

result:

ok 12000 lines

Test #68:

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

input:

12000
A 295818 322488
A 194486 958341
A 28813 921331
A 39689 732155
A 59934 947250
A 102263 994304
A 769281 889828
A 168891 836268
A 88251 777482
A 486833 853793
A 400373 650259
A 57459 937031
A 640586 847234
A 231543 640202
A 273952 769078
A 237156 734274
A 258521 775116
A 94729 522604
A 140392 321...

output:

26670
26670
26670
26670
26670
26670
594010
594010
594010
557975
354441
354441
354441
354441
354441
354441
354441
354441
354441
321340
321340
321340
258019
258019
258019
258019
258019
198469
198469
198469
195334
195334
195334
195334
195334
195334
195334
195334
195334
195334
195334
195334
195334
19533...

result:

ok 12000 lines

Test #69:

score: 0
Accepted
time: 48ms
memory: 155640kb

input:

12000
A 287096 678918
A 66955 750293
A 11278 980638
A 47754 128513
A 328262 804903
A 46563 992257
A 260778 483652
A 13155 811773
A 709373 756846
A 282832 503862
A 14936 999943
A 13245 668099
A 685672 706938
A 132960 959902
A 350293 984394
A 399165 989216
A 17675 990043
A 449275 934586
A 107269 48506...

output:

391822
391822
391822
631164
631164
631164
435898
435898
435898
435898
435898
435898
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
71174
...

result:

ok 12000 lines

Test #70:

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

input:

12000
A 511406 972117
A 54145 806456
A 557224 559501
A 354989 370456
A 360970 715349
A 131872 889549
A 165249 663678
A 117428 942597
A 658215 978498
A 45390 955058
A 319579 364695
A 507525 566328
A 109962 994362
A 26377 867674
A 35924 666899
A 261992 820039
A 600630 836275
A 348494 413336
A 483194 5...

output:

460711
917972
2277
204512
204512
204512
204512
204512
204512
204512
204512
204512
204512
204512
204512
204512
204512
204512
76307
76307
76307
76307
76307
76307
76307
76307
76307
76307
76307
76307
76307
76307
76307
76307
76307
76307
76307
76307
76307
76307
76307
76307
76307
76307
76307
76307
76307
76...

result:

ok 12000 lines

Test #71:

score: 0
Accepted
time: 36ms
memory: 154960kb

input:

12000
A 84821 966505
A 213856 800166
R 213856 800166
A 118271 264111
A 308831 338570
A 67502 740567
R 308831 338570
A 697562 795385
A 463548 539984
A 4098 999875
A 79386 276484
R 84821 966505
R 4098 999875
A 24058 794140
A 559517 754841
R 79386 276484
A 168780 896043
R 463548 539984
A 18528 998627
A...

output:

881684
586310
881684
145840
220299
220299
145840
677114
331837
331837
331837
331837
331837
331837
291293
291293
291293
636570
636570
636570
636570
636570
254720
429378
429378
429378
429378
429378
429378
429378
429378
429378
410588
410588
410588
413105
413105
413105
413105
413105
413105
413105
413105...

result:

ok 12000 lines

Test #72:

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

input:

12000
A 327107 436803
A 167900 546381
A 307096 729629
A 27695 952269
A 20819 676686
A 341723 663487
A 118055 736883
A 42260 483002
A 223683 336905
A 27372 940198
A 33569 998008
A 349542 691651
A 82787 416307
A 23984 996957
A 15846 947188
A 101140 637250
A 84540 885900
A 48640 644776
A 29084 684789
A...

output:

109696
109696
109696
109696
109696
336380
336380
336380
439804
439804
439804
439804
439804
439804
439804
439804
439804
439804
439804
439804
439804
233355
233355
233355
233355
233355
233355
233355
233355
233355
233355
233355
233355
233355
233355
233355
233355
233355
233355
233355
233355
233355
233355...

result:

ok 12000 lines

Test #73:

score: 0
Accepted
time: 61ms
memory: 158472kb

input:

12000
A 31547 506395
A 522405 820369
A 294324 765290
A 415425 728292
A 333904 550687
A 561272 936689
A 247259 976049
A 438840 946370
A 385980 821399
A 193555 952816
A 101980 801541
A 680920 798311
A 456842 604980
A 108390 564099
A 485889 527799
A 171953 865449
A 21010 242100
A 89229 706757
A 30793 8...

output:

474848
788822
788822
788822
788822
602785
602785
602785
602785
602785
602785
464407
341469
341469
312422
312422
312422
312422
312422
312422
312422
312422
312422
312422
312422
312422
222013
222013
222013
222013
222013
222013
222013
222013
222013
133495
133495
133495
133495
133495
133495
133495
133495...

result:

ok 12000 lines

Test #74:

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

input:

12000
A 53826 984276
A 78089 737362
A 190790 710651
A 294006 397508
A 387703 513977
A 338858 911552
A 12993 996963
A 213436 718078
A 77449 852586
A 524887 880783
A 350968 429208
A 273873 519293
A 287224 692331
A 165291 759372
A 526340 917388
A 335091 896523
A 416490 524775
A 51213 865691
A 178816 95...

output:

930450
659273
519861
103502
219971
219971
219971
219971
219971
493080
493080
493080
493080
493080
493080
493080
230769
230769
230769
230769
230769
230769
230769
230769
230769
230769
230769
230769
230769
230769
230769
230769
230769
230769
230769
230769
230769
230769
230769
230769
230769
230769
230769...

result:

ok 12000 lines

Test #75:

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

input:

12000
A 132250 871914
A 330101 439629
R 330101 439629
A 439344 532083
A 60680 898358
A 92849 943042
A 930760 943871
A 126039 615686
A 280371 838158
A 263600 577463
A 20353 976759
A 37747 483600
A 270990 885302
A 409252 684614
A 40953 484481
A 82202 857463
A 73298 866438
R 439344 532083
R 60680 89835...

output:

739664
109528
739664
92739
92739
92739
504527
504527
504527
504527
504527
504527
504527
504527
504527
504527
504527
534619
534619
534619
534619
534619
534619
534619
534619
510243
510243
510243
457361
457361
457361
457361
457361
457361
457361
457361
457361
208454
208454
208454
208454
208454
208454
20...

result:

ok 12000 lines

Test #76:

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

input:

12000
A 125929 969577
A 310085 843229
A 76411 838408
A 395049 938665
A 557951 984110
A 239208 739266
A 407782 517186
A 179001 424853
A 302605 887029
A 186874 673369
A 392387 943397
A 444969 582883
A 554060 818501
A 438377 684944
A 452923 561268
A 16491 636975
A 167240 199898
A 183608 869298
A 469 97...

output:

843648
533144
766818
862254
907699
744902
576328
576328
576328
576328
576328
403882
403882
403882
382267
382267
349946
349946
349946
349946
349946
349946
349946
301264
301264
301264
301264
301264
301264
301264
301264
301264
301264
301264
182707
182707
182707
182707
182707
182707
182707
182707
182707...

result:

ok 12000 lines

Test #77:

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

input:

12000
A 182232 391033
A 495249 947876
A 73990 884420
A 29817 961725
A 307755 323239
A 360922 914633
A 215957 427688
A 61225 402274
A 129 971203
A 380095 684616
A 412330 698462
A 5516 947120
A 865826 980929
A 132276 797126
A 289536 508448
A 123072 864897
A 63499 515886
A 236463 971954
A 868451 979317...

output:

208801
765644
765644
765644
640121
606878
606878
606878
606878
376861
376861
376861
376861
376861
376861
376861
376861
376861
376861
301796
301796
301796
301796
301796
301796
301796
194990
194990
194990
194990
194990
194990
194990
194990
194990
194990
194990
194990
103179
103179
103179
103179
103179...

result:

ok 12000 lines

Test #78:

score: 0
Accepted
time: 57ms
memory: 160012kb

input:

12000
A 154994 881073
A 242025 253971
A 524361 638249
A 82287 859946
A 220672 552143
A 6900 997410
A 28709 952760
A 150424 957122
A 110150 950830
A 721271 799654
A 13719 876131
A 77699 890998
A 2569 776957
A 135745 996063
A 28124 970440
A 131349 701228
A 235675 656080
A 316208 921617
A 632177 899123...

output:

726079
11946
396224
396224
396224
396224
396224
396224
396224
275293
275293
275293
275293
275293
275293
275293
275293
275293
275293
275293
275293
33436
33436
33436
33436
33436
33436
33436
33436
33436
33436
33436
33436
33436
33436
33436
33436
33436
33436
33436
33436
33436
33436
33436
33436
33436
3343...

result:

ok 12000 lines

Test #79:

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

input:

12000
A 687061 923991
A 5456 999492
A 30948 976932
A 56502 403315
A 147668 967118
A 95219 146470
A 337141 955361
A 232088 773973
A 34706 784980
A 172699 976314
A 122814 859526
A 22562 385153
A 549522 689309
A 741465 929285
A 330984 883193
A 142321 499788
A 189286 849238
A 91258 446570
A 703811 82361...

output:

236930
236930
236930
867489
867489
828772
828772
678754
678754
678754
678754
678754
594090
379763
379763
379763
379763
379763
274096
274096
274096
274096
274096
274096
213060
213060
213060
213060
213060
213060
213060
213060
213060
130916
130916
130916
130916
130916
130916
130916
130916
130916
129657...

result:

ok 12000 lines

Test #80:

score: 0
Accepted
time: 51ms
memory: 157780kb

input:

12000
A 26696 856212
A 525714 743039
A 16420 880730
A 702642 733555
A 700464 772553
A 23705 882949
A 3661 876974
A 716084 746782
A 689335 868266
A 634787 988442
A 284969 878070
A 595849 849112
A 590828 947374
A 217994 807260
A 1808 883012
A 14706 972256
A 95153 957718
A 60545 670170
A 477309 607302
...

output:

829516
217325
217325
30913
30913
30913
30913
44140
44140
44140
44140
44140
44140
44140
44140
44140
44140
673010
256246
256246
166952
166952
166952
166952
166952
166952
166952
166952
166952
166952
166952
166952
166952
166952
166952
166952
166952
166952
166952
166952
166952
166952
166952
97640
97640
9...

result:

ok 12000 lines

Test #81:

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

input:

12000
A 630526 825195
A 378584 486983
A 194553 734476
A 12455 938005
A 86240 976758
A 217834 876637
A 522903 581316
A 494691 972670
A 313905 462683
A 314374 957661
A 205143 470945
A 738391 818479
A 313219 333260
A 120201 951645
A 687207 783908
A 225423 672049
A 483717 970969
A 84714 700504
A 576116 ...

output:

194669
446611
446611
446611
446611
446611
202732
202732
202732
202732
202732
202732
173764
173764
173764
173764
173764
173764
173764
173764
173764
173764
173764
173764
173764
173764
173764
173764
173764
173764
173764
173764
146237
146237
146237
146237
146237
146237
101498
101498
101498
101498
101498...

result:

ok 12000 lines

Test #82:

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

input:

12000
A 333730 805214
A 546159 634422
A 470555 851776
A 141909 580197
A 239365 757179
A 31411 882337
A 585123 716218
A 27911 875731
A 133443 979036
A 588522 616116
A 29577 945705
A 82104 990248
A 318976 900444
A 667645 848054
A 651168 788012
A 95208 917551
A 564022 899982
A 204969 306482
A 37586 993...

output:

471484
88263
88263
492513
492513
492513
574309
574309
574309
474207
474207
474207
474207
259532
199490
199490
199490
199490
199490
199490
199490
164307
164307
164307
164307
164307
164307
148332
148332
148332
148332
148332
148332
148332
148332
148332
148332
86719
86719
86719
86719
86719
86719
86719
8...

result:

ok 12000 lines

Test #83:

score: 0
Accepted
time: 28ms
memory: 154348kb

input:

12000
A 148006 876685
A 27521 516894
R 27521 516894
A 438487 927371
R 148006 876685
A 576699 918619
R 576699 918619
A 693435 881079
R 438487 927371
A 20014 847086
R 693435 881079
A 120612 585067
R 20014 847086
A 17756 989107
R 17756 989107
A 876475 989099
R 876475 989099
A 175692 734378
R 120612 585...

output:

728679
849164
728679
779365
488884
341920
488884
187644
187644
861065
827072
464455
464455
464455
464455
868487
464455
613766
558686
5312
558686
730080
193634
468912
150340
150340
150340
150340
150340
632473
560877
170687
170687
645299
170687
377550
170687
723613
675391
938706
675391
888196
675391
9...

result:

ok 12000 lines

Test #84:

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

input:

12000
A 448805 734227
A 78776 901855
A 89410 606435
A 198699 492721
A 330242 684877
A 134160 874080
A 687790 821919
A 195998 224867
A 253313 987303
A 29513 656449
A 823387 865092
A 769696 844631
A 185715 863218
A 852298 888226
A 13304 118687
A 221976 744579
A 164788 621068
A 501035 747872
A 129876 9...

output:

285422
285422
644817
535528
535528
535528
491677
488879
488879
488879
177302
177302
177302
118530
118530
118530
118530
118530
118530
118530
118530
118530
118530
118530
118530
118530
118530
118530
118530
118530
118530
118530
118530
118530
118530
109570
109570
109570
109570
109570
109570
109570
109570...

result:

ok 12000 lines

Test #85:

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

input:

12000
A 7977 630142
A 212332 954894
A 402384 913661
A 12308 982569
A 339688 644250
A 101445 966759
A 23147 984167
A 64141 988218
A 182203 450793
A 4249 999600
A 98044 952751
A 508358 740634
A 408169 412247
A 384631 493779
A 438652 975839
A 542261 678392
A 28344 645695
A 551423 806565
A 195376 988227...

output:

622165
946917
905684
905684
905684
905684
905684
905684
731458
731458
731458
558431
332465
332465
332465
270223
270223
270223
270223
270223
270223
171429
171429
171429
171429
171429
171429
171429
171429
171429
171429
171429
171429
171429
171429
171429
171429
171429
171429
171429
171429
107578
107578...

result:

ok 12000 lines

Test #86:

score: 0
Accepted
time: 43ms
memory: 154964kb

input:

12000
A 201202 318805
A 420101 478576
A 223693 932858
A 65317 905338
A 65906 479962
A 135207 987089
A 342501 581458
A 76373 999127
A 31298 992232
A 75951 849907
A 177216 502207
A 428694 554101
A 105981 367159
A 441017 671943
A 279445 740078
A 21237 169573
A 466656 620914
A 26132 948737
A 20983 51528...

output:

117603
277374
277374
277374
277374
277374
277374
277374
277374
277374
277374
277374
277374
277374
277374
277374
277374
277374
277374
277374
277374
277374
277374
277374
277374
277374
277374
277374
277374
277374
135574
135574
135574
135574
135574
135574
135574
135574
135574
135574
135574
135574
135574...

result:

ok 12000 lines

Test #87:

score: 0
Accepted
time: 42ms
memory: 154784kb

input:

12000
A 423121 928444
A 140941 554432
A 117922 694625
A 86929 879168
R 140941 554432
R 117922 694625
R 86929 879168
A 517665 966453
R 517665 966453
A 270077 500951
A 334309 436394
A 328379 782000
R 334309 436394
A 387425 550047
A 403723 940278
R 328379 782000
R 403723 940278
R 387425 550047
A 4813 6...

output:

505323
787503
787503
787503
810522
841515
505323
543332
505323
658367
594135
594135
658367
658367
658367
658367
658367
658367
658367
230874
661168
663817
31323
31323
451620
451620
451620
31323
31323
31323
97487
353711
70117
399302
399302
399302
399302
399302
399302
399302
551848
551848
518591
518591...

result:

ok 12000 lines

Test #88:

score: 0
Accepted
time: 65ms
memory: 159152kb

input:

12000
A 542390 939246
A 473845 875507
A 109741 995915
A 99767 973264
A 688767 876814
A 49765 996939
A 642448 886663
A 410224 692871
A 39405 996303
A 374287 937725
A 22057 998146
A 54321 999899
A 199510 965189
A 94228 949726
A 147603 978189
A 133031 251809
A 10846 32892
A 59192 997845
A 503445 983972...

output:

396856
465401
465401
465401
402969
402969
402969
466590
466590
466590
466590
466590
466590
466590
466590
559840
240963
240963
240963
240963
240963
240963
240963
240963
240963
240963
240963
240963
240963
193218
193218
193218
193218
193218
193218
193218
193218
193218
193218
193218
193218
193218
193218...

result:

ok 12000 lines

Test #89:

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

input:

12000
A 32325 765924
A 608184 929329
A 188530 995601
A 816052 863613
A 233500 578250
A 817547 869339
A 21320 837558
A 14793 854467
A 769800 841552
A 238115 723124
A 589711 836338
A 203146 857514
A 7231 984085
A 252839 736595
A 166962 522844
A 644130 760023
A 174241 642279
A 5436 952191
A 366380 9832...

output:

733599
897004
897004
831288
630113
630113
630113
630113
608052
603437
602838
602838
602838
588713
588713
197422
197422
197422
197422
197422
197422
197422
197422
197422
156208
156208
75453
75453
75453
75453
75453
75453
75453
75453
75453
75453
75453
75453
75453
75453
75453
75453
75453
75453
75453
7545...

result:

ok 12000 lines

Test #90:

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

input:

12000
A 111645 727396
A 18354 983790
A 10827 993277
A 9623 682823
A 380311 877890
A 308031 959207
A 240592 326583
A 184754 986643
A 823428 866564
A 855263 956830
A 348946 568668
A 5695 993487
A 118096 396738
A 845216 987017
A 71107 720967
A 549154 988507
A 133447 826278
A 841928 870257
A 151433 9897...

output:

615751
615751
615751
717773
868267
868267
637298
637298
625972
625972
328076
328076
328076
328076
328076
328076
328076
328076
328076
328076
328076
328076
147546
147546
147546
147546
147546
147546
147546
147546
147546
147546
54086
54086
54086
54086
54086
54086
54086
54086
54086
54086
54086
54086
5408...

result:

ok 12000 lines

Test #91:

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

input:

12000
A 479603 842907
A 689079 690241
A 336751 629417
A 466317 634529
A 591155 678866
A 169300 906811
A 748975 853616
A 594519 944489
A 400508 966422
A 163401 807131
A 78860 984464
A 783960 949067
A 807284 881416
A 434367 487537
A 550932 683509
R 550932 683509
A 392135 662589
A 417248 873965
A 72778...

output:

363304
1162
353490
223924
99086
99086
99086
99086
99086
99086
99086
99086
99086
99086
99086
99086
99086
99086
99086
99086
99086
99086
99086
99086
99086
99086
99086
99086
99086
99086
99086
99086
99086
99086
99086
99086
56447
56447
56447
56447
56447
56447
56447
56447
56447
56447
56447
56447
56447
5644...

result:

ok 12000 lines

Test #92:

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

input:

12000
A 148457 819285
A 179123 389339
A 118816 922140
A 387333 711678
A 4662 962707
A 15895 854648
A 271735 636207
A 477219 715626
A 7060 956702
A 12676 969674
A 264371 499924
A 252690 773550
A 3724 995188
A 31477 865362
A 240108 338071
A 92563 963855
A 609005 914101
A 107486 964779
A 616479 781518
...

output:

670828
210216
210216
532555
532555
532555
532555
536503
536503
536503
536503
536503
536503
536503
471570
471570
471570
471570
471570
471570
471570
471570
417150
417150
417150
417150
417150
417150
417150
417150
417150
417150
417150
417150
417150
417150
417150
153691
153691
153691
153691
153691
153691...

result:

ok 12000 lines

Test #93:

score: 0
Accepted
time: 68ms
memory: 159864kb

input:

12000
A 896144 932125
A 90162 219862
A 80687 379223
A 92159 210401
A 816999 934083
A 145745 170834
A 6924 516755
A 100735 169898
A 448501 727620
A 307183 761173
A 810916 935733
A 97239 323577
A 19033 397030
A 904532 921563
A 119952 934812
A 723907 869370
A 4916 923914
A 352456 829834
A 24726 180120
...

output:

35981
841963
841963
839966
839966
786380
786380
786380
483624
483624
483624
483624
483624
473062
473062
197656
197656
197656
197656
197656
197656
197656
197656
197656
189264
189264
189264
42446
42446
42446
42446
42446
42446
42446
42446
42446
42446
42446
42446
42446
42446
42446
42446
42446
42446
4244...

result:

ok 12000 lines

Test #94:

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

input:

12000
A 6954 991785
A 875699 946870
A 5200 994194
A 1212 994804
A 738482 861183
A 556 998360
A 746355 819928
A 3506 995746
A 824114 834263
A 933583 946595
A 644117 851953
A 6829 999078
A 808418 878981
A 3848 996198
A 642414 923630
A 3474 997921
A 535523 880292
A 192136 996724
A 440920 938160
A 12211...

output:

984831
71171
71171
71171
208388
208388
200515
200515
87908
87908
87908
87908
87908
87908
87908
87908
87908
87908
87908
87908
87908
87908
87908
87908
87908
87908
87908
87908
87908
87908
87908
87908
87908
87908
87908
87908
87908
87908
87908
87908
65537
65537
65537
65537
65537
65537
65537
65537
65537
6...

result:

ok 12000 lines

Test #95:

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

input:

12000
A 525048 614581
A 493700 685892
A 223517 879233
A 47389 980056
A 608781 800073
A 200680 256698
A 107618 609243
A 48965 490643
A 21646 992765
A 184811 776879
A 417315 822259
A 547585 645183
A 36531 319247
A 272230 982897
A 42238 951881
A 135366 988780
A 6362 844353
A 46984 911393
A 30170 519447...

output:

89533
89533
89533
89533
275025
413901
413901
413901
413901
413901
413901
413901
413901
413901
413901
413901
413901
413901
413901
413901
383193
383193
188543
188543
188543
188543
188543
188543
188543
188543
188543
188543
188543
188543
188543
188543
188543
165377
165377
165377
165377
165377
165377
165...

result:

ok 12000 lines

Test #96:

score: 0
Accepted
time: 32ms
memory: 154328kb

input:

12000
A 191903 735129
A 197062 720550
R 197062 720550
A 428958 711816
R 191903 735129
A 413186 561372
R 413186 561372
A 229186 893484
R 428958 711816
A 473268 560122
R 473268 560122
A 138951 537032
R 229186 893484
A 320946 796127
R 320946 796127
A 6442 998591
R 6442 998591
A 55266 954887
R 138951 53...

output:

543226
523488
543226
282858
282858
298630
282858
282858
664298
86854
664298
754533
398081
657176
398081
398081
398081
398081
899621
899621
954721
841392
841392
449375
449375
69731
449375
449375
449375
96496
449375
424309
424309
470753
280907
280907
280907
280907
696410
85853
696410
696410
696410
696...

result:

ok 12000 lines

Test #97:

score: 0
Accepted
time: 24ms
memory: 154348kb

input:

12000
A 49190 929159
A 181753 560271
R 181753 560271
A 44605 744164
R 49190 929159
A 611228 813067
R 611228 813067
A 263284 994370
R 44605 744164
A 42203 975491
R 263284 994370
A 77530 222483
R 77530 222483
A 77702 999574
R 42203 975491
A 413611 498694
R 77702 999574
A 8204 965260
R 8204 965260
A 12...

output:

879969
378518
879969
884554
699559
768462
699559
949765
731086
952167
933288
144953
933288
957371
921872
85083
85083
85083
85083
85083
85083
574218
241261
793506
461675
600294
461675
469885
461675
611923
461675
720943
461675
461675
771146
63011
771146
756309
771146
89605
771146
827422
228792
237912
...

result:

ok 12000 lines

Test #98:

score: 0
Accepted
time: 23ms
memory: 154564kb

input:

12000
A 448799 801295
A 236740 494750
R 236740 494750
A 119526 549535
R 448799 801295
A 375422 830929
R 119526 549535
A 18620 592657
R 375422 830929
A 787898 801423
R 787898 801423
A 450170 713832
R 450170 713832
A 274694 546290
R 18620 592657
A 185366 806948
R 185366 806948
A 199681 691960
R 199681...

output:

352496
564555
352496
681769
430009
711403
455507
812309
574037
782803
574037
695212
574037
271596
271596
271596
271596
271596
271596
271596
943404
525825
943404
289416
943404
393005
393005
404398
393005
407182
364355
16121
364355
851841
380993
623345
380993
993814
380993
979922
380993
986050
380993
...

result:

ok 12000 lines

Test #99:

score: 0
Accepted
time: 23ms
memory: 154484kb

input:

12000
A 35160 943171
A 175675 923800
R 35160 943171
A 173494 969062
R 173494 969062
A 74031 768096
R 175675 923800
A 163532 581958
R 163532 581958
A 242743 951028
R 74031 768096
A 599826 717917
R 599826 717917
A 157736 954763
R 242743 951028
A 665200 983352
R 665200 983352
A 265204 767578
R 265204 7...

output:

908011
748125
748125
748125
748125
849769
694065
418426
694065
876997
708285
118091
708285
708285
797027
825616
797027
502374
797027
923211
860432
585571
860432
964729
860432
912449
860432
931860
912503
931053
791854
123477
791854
633412
633412
764125
68748
820134
75077
540598
102277
494744
102277
1...

result:

ok 12000 lines

Test #100:

score: 0
Accepted
time: 40ms
memory: 154724kb

input:

12000
A 392621 965203
A 124559 970819
R 392621 965203
A 711651 740131
A 148521 438512
A 139061 757217
R 148521 438512
R 124559 970819
R 711651 740131
A 298234 855393
A 351273 723880
A 79971 536450
A 188637 766656
A 340395 808820
A 91695 763614
A 167753 736988
A 612705 749106
A 118848 718517
R 298234...

output:

572582
572582
846260
28480
591610
591610
28480
28480
618156
716332
372607
643909
643909
643909
643909
643909
669135
669135
669135
669135
624919
624919
624919
624919
624919
624919
624919
624919
624919
624919
625179
625179
625179
625179
625179
625179
625179
625179
625179
625179
625179
625179
625179
62...

result:

ok 12000 lines

Test #101:

score: 0
Accepted
time: 39ms
memory: 154804kb

input:

12000
A 10089 919414
A 176296 942039
R 176296 942039
A 268427 713609
A 63531 949653
R 10089 919414
R 268427 713609
A 59662 900282
A 564760 860879
A 258373 510266
R 63531 949653
R 564760 860879
A 536714 553463
R 258373 510266
A 385191 994512
R 59662 900282
R 385191 994512
A 294469 341177
R 294469 341...

output:

909325
931950
909325
445182
445182
445182
886122
889991
296119
602506
602506
251893
295090
16749
16749
16749
16749
258994
16749
16749
16749
16749
104882
16749
545060
545060
545060
545060
398764
398764
398764
398764
388298
398764
265661
265661
398764
398764
398764
398764
398764
346401
346401
346401
3...

result:

ok 12000 lines

Test #102:

score: 0
Accepted
time: 37ms
memory: 154728kb

input:

12000
A 103215 906118
A 434306 827353
R 434306 827353
A 28575 520205
A 321522 783643
R 28575 520205
A 646787 899287
A 88426 683361
A 51756 151263
A 721760 927416
A 34095 584056
A 130124 364673
R 721760 927416
A 317287 877655
A 431160 606690
A 5662 618749
A 70714 687878
R 317287 877655
A 57805 937242...

output:

802903
393047
802903
877543
755068
462121
577765
810861
731887
731887
731887
731887
731887
731887
468127
468127
468127
468127
468127
468127
468127
468127
476566
476566
476566
476566
624732
624732
624732
624732
624732
624732
624732
624732
674820
674820
674820
674820
674820
323218
323218
323218
323218...

result:

ok 12000 lines

Test #103:

score: 0
Accepted
time: 24ms
memory: 154372kb

input:

12000
A 627286 792293
A 260629 565753
R 627286 792293
A 234638 904545
A 81721 917696
R 81721 917696
R 260629 565753
A 140444 864811
A 162119 928398
R 162119 928398
R 140444 864811
A 8927 885910
R 234638 904545
A 67341 779072
A 22295 942216
R 22295 942216
R 67341 779072
A 133425 610250
A 284341 71953...

output:

165007
531664
305124
305124
305124
305124
669907
764101
764101
764101
669907
895618
876983
711731
711731
711731
876983
476825
586113
586113
435197
435197
435197
435197
435197
689773
680766
680766
435197
435197
40518
40518
40518
40518
489061
556926
149158
149158
499856
517134
499856
785307
513308
513...

result:

ok 12000 lines

Test #104:

score: 0
Accepted
time: 53ms
memory: 157576kb

input:

12000
A 36705 663904
A 119007 579893
R 36705 663904
A 695059 991692
A 284201 632278
A 567834 684272
A 940240 959441
R 940240 959441
A 536653 772322
A 376882 681989
A 260820 281613
A 310278 456209
A 237446 962227
A 221106 816952
A 18871 989442
A 510606 771785
A 275320 892478
A 228069 564103
A 424803 ...

output:

627199
460886
460886
872685
707491
423858
391607
423858
423858
423858
371458
195389
195389
195389
195389
195389
195389
195389
195389
195389
195389
195389
195389
144842
195389
195389
195389
195389
195389
195389
195389
195389
195389
195389
195389
195389
195389
195389
195389
195389
195389
195389
195389...

result:

ok 12000 lines

Test #105:

score: 0
Accepted
time: 53ms
memory: 155380kb

input:

12000
A 616 992967
A 438079 818448
A 664111 936364
A 12808 933881
A 213535 730317
A 320596 700257
A 610251 941537
A 4849 975638
A 84902 414574
A 306635 745711
A 173235 998355
A 504501 677420
A 111989 980307
A 77586 784204
A 201146 853513
R 610251 941537
A 137157 448721
R 4849 975638
A 180074 463596
...

output:

992351
380369
498285
498285
722829
615768
615768
615768
733546
733546
733546
592518
592518
592518
592518
592518
540263
540263
497346
497346
497346
497346
497346
497346
497346
497346
497346
497346
497346
497346
497346
497346
497346
497346
497346
497346
497346
497346
497346
326466
326466
326466
326466...

result:

ok 12000 lines

Test #106:

score: 0
Accepted
time: 35ms
memory: 154692kb

input:

12000
A 10352 282995
A 681854 953454
R 681854 953454
A 78137 629392
A 156663 776210
R 156663 776210
A 16501 940837
A 113460 845573
A 625323 750319
R 113460 845573
R 10352 282995
A 16288 867517
R 78137 629392
A 109884 262057
A 333066 466259
R 333066 466259
A 207956 643974
A 793013 883103
A 117387 943...

output:

272643
943102
272643
619040
765858
619040
619040
835221
739967
739967
672182
672182
124996
640435
356375
640435
640435
257780
257780
257780
257780
232993
232993
232993
232993
232993
232993
232993
232993
232993
203485
203485
203485
203485
203485
203485
203485
203485
203485
203485
203485
203485
203485...

result:

ok 12000 lines

Test #107:

score: 0
Accepted
time: 26ms
memory: 154520kb

input:

12000
A 6462 993404
A 81013 880945
A 392938 731101
R 81013 880945
R 392938 731101
A 327380 971294
A 11539 645502
R 327380 971294
R 11539 645502
A 48810 630819
A 111555 924493
R 111555 924493
R 6462 993404
A 361477 415666
A 176254 798878
R 176254 798878
R 48810 630819
A 284744 957539
A 209097 859663
...

output:

986942
799932
338163
338163
986942
643914
959755
633963
986942
582009
875683
582009
582009
54189
54189
54189
54189
54189
54189
748442
672795
857604
240134
240134
240134
760608
760608
869002
469398
97434
825146
825146
647676
830216
46839
46839
46839
46839
46839
46839
46839
46839
46839
46839
46839
468...

result:

ok 12000 lines

Test #108:

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

input:

12000
A 326105 860158
A 18009 933706
A 554335 900499
A 486161 871727
A 460366 668441
A 28691 878786
A 639773 936706
A 208713 454755
A 113589 333752
A 66759 984793
A 294596 468056
A 270876 439030
A 456837 478737
A 173914 319712
A 72012 196877
A 46256 745466
A 140229 751831
A 360202 658760
A 701887 89...

output:

534053
534053
574394
574394
440133
440133
476340
459728
459728
459728
459728
397565
207861
207861
207861
207861
207861
207861
207861
207861
207861
207861
207861
207861
207861
207861
207861
207861
207861
207861
207861
207861
207861
207861
207861
207861
207861
187971
187971
187971
187971
187971
187971...

result:

ok 12000 lines

Test #109:

score: 0
Accepted
time: 52ms
memory: 155112kb

input:

12000
A 46351 945556
A 90285 925465
A 723551 955064
A 29476 975957
A 152925 242413
A 52157 969040
A 600882 887098
A 16660 997822
A 545921 790648
A 256041 620768
A 58388 947081
A 314406 902289
A 230750 525122
A 101265 983108
A 233585 713594
A 134043 824562
A 41891 902241
A 159675 424334
A 494869 6911...

output:

899205
835180
864779
864779
802139
802139
734173
734173
637723
467843
467843
467843
467843
467843
467843
467843
467843
467843
460195
460195
460195
460195
460195
460195
460195
460195
366111
245826
245826
245826
245826
245826
245826
245826
245826
245826
245826
245826
245826
245826
245826
245826
245826...

result:

ok 12000 lines

Test #110:

score: 0
Accepted
time: 46ms
memory: 154964kb

input:

12000
A 28076 271660
A 800504 894855
A 5822 888487
A 198 999915
A 254901 954821
A 312991 963411
A 172775 308432
A 616453 786138
A 242157 553169
A 94715 995217
A 199719 816357
A 392135 764369
A 46042 964877
A 845739 846453
A 218312 713621
A 177759 767680
A 31387 990084
A 841604 922365
A 422969 695043...

output:

243584
866779
866779
866779
866779
866779
722080
278402
278402
278402
278402
278402
278402
230000
230000
230000
230000
230000
230000
230000
230000
79971
79971
79971
79971
79971
79971
79971
79971
79971
79971
79971
79971
79971
79971
79971
79971
79971
79971
79971
79971
79971
79971
79971
79971
79971
799...

result:

ok 12000 lines

Test #111:

score: 0
Accepted
time: 24ms
memory: 154328kb

input:

12000
A 48867 991002
A 178511 504406
A 191052 714361
R 48867 991002
R 178511 504406
A 239756 950877
A 34710 951073
R 191052 714361
R 239756 950877
A 43788 871794
A 756117 853379
R 43788 871794
R 34710 951073
A 629298 759450
A 146457 905005
R 629298 759450
R 756117 853379
A 700081 709992
A 12216 9188...

output:

942135
325895
535850
535850
523309
759825
759825
711121
916363
828006
97262
97262
97262
224081
224081
97262
758548
9911
9911
9911
9911
235971
217182
447537
28999
28999
28999
234815
234815
338855
645033
645033
234815
363303
363303
624712
234815
234815
289656
196217
196217
574646
574646
196217
196217
...

result:

ok 12000 lines

Test #112:

score: 0
Accepted
time: 40ms
memory: 157200kb

input:

12000
A 488004 494002
A 488006 494005
A 488008 494008
A 488010 494011
A 488012 494014
A 488014 494017
A 488016 494020
A 488018 494023
A 488020 494026
A 488022 494029
A 488024 494032
A 488026 494035
A 488028 494038
A 488030 494041
A 488032 494044
A 488034 494047
A 488036 494050
A 488038 494053
A 4880...

output:

5998
6001
6004
6007
6010
6013
6016
6019
6022
6025
6028
6031
6034
6037
6040
6043
6046
6049
6052
6055
6058
6061
6064
6067
6070
6073
6076
6079
6082
6085
6088
6091
6094
6097
6100
6103
6106
6109
6112
6115
6118
6121
6124
6127
6130
6133
6136
6139
6142
6145
6148
6151
6154
6157
6160
6163
6166
6169
6172
6175
...

result:

ok 12000 lines

Test #113:

score: 0
Accepted
time: 31ms
memory: 156744kb

input:

12000
A 497540 508306
A 493472 502204
A 496194 506287
A 497130 507691
A 495424 505132
A 489552 496324
A 497704 508552
A 494608 503908
A 488782 495169
A 498768 510148
A 490976 498460
A 489560 496336
A 496732 507094
A 492856 501280
A 489032 495544
A 494454 503677
A 499500 511246
A 494884 504322
A 4903...

output:

10766
14834
14834
14834
14834
18139
18139
18139
16350
16350
16350
16350
16350
16350
16350
16350
16350
16350
16350
16350
16350
16350
16350
16350
16350
16350
16350
16350
16350
16350
16350
16350
16350
15572
15572
15572
15572
15572
15572
15572
15572
15572
15572
15572
15572
15572
15572
15349
15349
15349
...

result:

ok 12000 lines

Test #114:

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

input:

12000
A 488004 494002
A 488006 494005
A 488008 494008
A 488010 494011
A 488012 494014
A 488014 494017
A 488016 494020
A 488018 494023
A 488020 494026
A 488022 494029
A 488024 494032
A 488026 494035
A 488028 494038
A 488030 494041
A 488032 494044
A 488034 494047
A 488036 494050
A 488038 494053
A 4880...

output:

5998
6001
6004
6007
6010
6013
6016
6019
6022
6025
6028
6031
6034
6037
6040
6043
6046
6049
6052
6055
6058
6061
6064
6067
6070
6073
6076
6079
6082
6085
6088
6091
6094
6097
6100
6103
6106
6109
6112
6115
6118
6121
6124
6127
6130
6133
6136
6139
6142
6145
6148
6151
6154
6157
6160
6163
6166
6169
6172
6175
...

result:

ok 12000 lines

Test #115:

score: 0
Accepted
time: 42ms
memory: 156660kb

input:

12000
A 498596 509890
A 494940 504406
A 488346 494515
A 489286 495925
A 494598 503893
A 496362 506539
A 492426 500635
A 489432 496144
A 489324 495982
A 494088 503128
A 488192 494284
A 497262 507889
A 491560 499336
A 491908 499858
A 497776 508660
A 499402 511099
A 499914 511867
A 488960 495436
A 4924...

output:

11294
14950
16060
16060
15547
15547
15547
15547
15547
15547
15547
15547
15547
15547
15547
15547
15547
15547
15547
15547
15547
15547
15547
15547
15547
15547
15547
15547
15320
15320
15320
15320
15320
15320
15320
15320
15320
15320
15320
15320
15320
15320
15320
15320
15320
15320
15320
15320
15320
15320
...

result:

ok 12000 lines

Test #116:

score: 0
Accepted
time: 28ms
memory: 157268kb

input:

12000
A 488004 494002
A 488006 494005
A 488008 494008
A 488010 494011
A 488012 494014
A 488014 494017
A 488016 494020
A 488018 494023
A 488020 494026
A 488022 494029
A 488024 494032
A 488026 494035
A 488028 494038
A 488030 494041
A 488032 494044
A 488034 494047
A 488036 494050
A 488038 494053
A 4880...

output:

5998
6001
6004
6007
6010
6013
6016
6019
6022
6025
6028
6031
6034
6037
6040
6043
6046
6049
6052
6055
6058
6061
6064
6067
6070
6073
6076
6079
6082
6085
6088
6091
6094
6097
6100
6103
6106
6109
6112
6115
6118
6121
6124
6127
6130
6133
6136
6139
6142
6145
6148
6151
6154
6157
6160
6163
6166
6169
6172
6175
...

result:

ok 12000 lines

Test #117:

score: 0
Accepted
time: 39ms
memory: 156704kb

input:

12000
A 491026 498535
A 496968 507448
A 489474 496207
A 499072 510604
A 488102 494149
A 492114 500167
A 497068 507598
A 496470 506701
A 496696 507040
A 498840 510256
A 491424 499132
A 496110 506161
A 491184 498772
A 498074 509107
A 498340 509506
A 493808 502708
A 496344 506512
A 489826 496735
A 4890...

output:

7509
16422
17974
17974
17974
17974
17974
17227
17227
17227
17227
17227
17227
17227
17227
17227
17038
17038
17038
17038
17038
17038
16503
16503
16503
16503
16503
16503
16503
16503
16503
16503
16503
16503
16503
16503
16503
16503
16503
16503
16503
16503
16503
16503
16503
15191
15191
15191
15191
15191
1...

result:

ok 12000 lines

Test #118:

score: 0
Accepted
time: 39ms
memory: 157284kb

input:

12000
A 488004 494002
A 488006 494005
A 488008 494008
A 488010 494011
A 488012 494014
A 488014 494017
A 488016 494020
A 488018 494023
A 488020 494026
A 488022 494029
A 488024 494032
A 488026 494035
A 488028 494038
A 488030 494041
A 488032 494044
A 488034 494047
A 488036 494050
A 488038 494053
A 4880...

output:

5998
6001
6004
6007
6010
6013
6016
6019
6022
6025
6028
6031
6034
6037
6040
6043
6046
6049
6052
6055
6058
6061
6064
6067
6070
6073
6076
6079
6082
6085
6088
6091
6094
6097
6100
6103
6106
6109
6112
6115
6118
6121
6124
6127
6130
6133
6136
6139
6142
6145
6148
6151
6154
6157
6160
6163
6166
6169
6172
6175
...

result:

ok 12000 lines

Test #119:

score: 0
Accepted
time: 39ms
memory: 156920kb

input:

12000
A 490948 498418
A 495766 505645
A 492898 501343
A 490050 497071
A 497258 507883
A 491760 499636
A 489410 496111
A 498912 510364
A 491642 499459
A 490722 498079
A 496000 505996
A 492540 500806
A 490870 498301
A 498776 510160
A 489426 496135
A 499494 511237
A 498448 509668
A 494266 503395
A 4926...

output:

7470
14697
14697
15595
17833
17833
17833
17833
17833
17833
17833
17833
17833
17833
17833
17833
17833
17833
17833
17833
17833
17833
17107
17107
17107
17107
17014
17014
16991
16991
16991
16991
16986
16986
16986
16986
16986
16941
16941
16941
16941
16631
16214
16214
16214
16214
16214
16214
16214
16214
1...

result:

ok 12000 lines

Test #120:

score: 0
Accepted
time: 42ms
memory: 157284kb

input:

12000
A 488004 494002
A 488006 494005
A 488008 494008
A 488010 494011
A 488012 494014
A 488014 494017
A 488016 494020
A 488018 494023
A 488020 494026
A 488022 494029
A 488024 494032
A 488026 494035
A 488028 494038
A 488030 494041
A 488032 494044
A 488034 494047
A 488036 494050
A 488038 494053
A 4880...

output:

5998
6001
6004
6007
6010
6013
6016
6019
6022
6025
6028
6031
6034
6037
6040
6043
6046
6049
6052
6055
6058
6061
6064
6067
6070
6073
6076
6079
6082
6085
6088
6091
6094
6097
6100
6103
6106
6109
6112
6115
6118
6121
6124
6127
6130
6133
6136
6139
6142
6145
6148
6151
6154
6157
6160
6163
6166
6169
6172
6175
...

result:

ok 12000 lines

Test #121:

score: 0
Accepted
time: 38ms
memory: 156756kb

input:

12000
A 488840 495256
A 489936 496900
A 494452 503674
A 490804 498202
A 491168 498748
A 498686 510025
A 499958 511933
A 489358 496033
A 495056 504580
A 496116 506170
A 492772 501154
A 490868 498298
A 497316 507970
A 496586 506875
A 491628 499438
A 493710 502561
A 490730 498091
A 498400 509596
A 4971...

output:

6416
8060
14834
14834
14834
19221
19221
19221
19221
16812
16812
16812
16812
16812
16812
16812
16812
16812
16812
16812
16812
16812
16812
16812
16812
15622
15622
15486
15486
15486
15486
15486
15486
15486
15486
15486
15486
15483
15483
15483
15483
15483
15483
15483
15483
15483
15483
15483
15483
15483
15...

result:

ok 12000 lines

Test #122:

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

input:

12000
A 1 162
A 163 324
A 325 486
A 487 648
A 649 810
A 811 972
A 973 1134
A 1135 1296
A 1297 1458
A 1459 1620
A 1621 1782
A 1783 1944
A 1945 2106
A 2107 2268
A 2269 2430
A 2431 2592
A 2593 2754
A 2755 2916
A 2917 3078
A 3079 3240
A 3241 3402
A 3403 3564
A 3565 3726
A 3727 3888
A 3889 4050
A 4051 42...

output:

161
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
323
...

result:

ok 12000 lines

Test #123:

score: 0
Accepted
time: 46ms
memory: 160580kb

input:

12000
A 989998 990000
A 989995 989997
A 989992 989994
A 989989 989991
A 989986 989988
A 989983 989985
A 989980 989982
A 989977 989979
A 989974 989976
A 989971 989973
A 989968 989970
A 989965 989967
A 989962 989964
A 989959 989961
A 989956 989958
A 989953 989955
A 989950 989952
A 989947 989949
A 9899...

output:

2
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
...

result:

ok 12000 lines

Test #124:

score: 0
Accepted
time: 48ms
memory: 155772kb

input:

12000
A 40 470
A 680 1094
A 8 19
A 1415 2053
A 2 7
A 2194 2871
A 2071 2082
A 648 678
A 2887 3870
A 471 588
A 2875 2886
A 2061 2067
A 2872 2874
A 2068 2070
A 2085 2191
A 1101 1278
A 4393 4759
A 2192 2193
A 2054 2058
A 1382 1389
A 22 38
A 1095 1097
A 1391 1413
A 1098 1099
A 3983 4239
A 2083 2084
A 477...

output:

430
1054
462
462
17
17
17
17
17
17
17
17
14
9
9
9
9
9
9
9
9
9
9
4
4
4
4
4
4
4
4
4
4
4
6
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 12000 lines

Test #125:

score: 0
Accepted
time: 48ms
memory: 155196kb

input:

12000
A 2 15
A 18 30
A 33 39
A 31 32
A 40 45
A 47 51
A 58 65
A 71 78
A 54 57
A 79 88
A 16 17
A 69 70
A 52 53
R 31 32
A 89 103
A 31 32
R 18 30
A 105 115
A 124 128
A 66 68
A 20 28
A 130 143
A 18 19
A 149 153
A 158 167
A 154 157
A 168 182
A 116 123
A 193 197
A 202 205
A 29 30
A 206 219
A 144 146
A 184 ...

output:

13
28
21
8
8
8
8
8
8
8
8
8
5
5
5
5
5
5
5
4
4
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3...

result:

ok 12000 lines

Test #126:

score: 0
Accepted
time: 32ms
memory: 155052kb

input:

12000
A 3 8
A 12 15
A 19 20
A 21 28
A 9 11
A 29 35
A 39 42
A 16 17
A 36 38
A 48 50
A 54 57
A 51 52
A 43 46
A 58 64
A 65 67
A 68 75
R 68 75
A 68 75
A 79 83
A 84 91
A 77 78
R 3 8
R 48 50
A 48 49
A 3 8
A 95 96
A 93 94
R 21 28
R 48 49
A 49 50
R 29 35
A 26 28
R 54 57
A 23 24
A 47 48
A 102 104
A 21 22
A 1...

output:

5
12
8
8
6
6
6
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3...

result:

ok 12000 lines

Test #127:

score: 0
Accepted
time: 42ms
memory: 155992kb

input:

12000
A 219 707
A 1033 1166
A 1271 2051
A 1188 1190
A 762 954
A 1017 1021
A 970 979
A 64 170
A 40 47
A 48 63
A 1200 1262
A 2053 3033
A 27 36
A 1192 1193
A 1173 1187
A 21 23
A 1169 1170
A 729 750
A 37 39
A 10 17
A 24 26
A 987 991
A 955 964
A 751 758
A 997 1010
A 1265 1268
A 2 6
A 1269 1270
A 1263 126...

output:

488
947
947
157
157
149
51
51
51
23
23
23
20
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3...

result:

ok 12000 lines

Test #128:

score: 0
Accepted
time: 33ms
memory: 155408kb

input:

12000
A 5 7
A 8 21
A 3 4
A 28 32
A 22 24
A 35 38
A 41 45
A 25 26
A 39 40
A 46 49
A 50 52
A 56 67
A 70 77
A 54 55
A 81 87
A 89 99
A 33 34
A 101 112
A 68 69
R 28 32
A 28 30
R 41 45
A 41 44
A 78 80
A 113 127
R 81 87
A 31 32
R 39 40
R 78 80
A 83 84
A 129 132
A 39 40
A 86 88
A 80 82
A 133 147
A 150 162
A...

output:

2
16
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3...

result:

ok 12000 lines

Test #129:

score: 0
Accepted
time: 28ms
memory: 155104kb

input:

12000
A 2 7
A 9 12
A 13 17
A 18 22
A 25 27
A 28 29
A 32 37
A 30 31
A 23 24
R 30 31
A 40 44
A 38 39
A 30 31
A 49 52
A 54 57
A 58 63
A 46 47
R 23 24
R 28 29
A 23 24
A 64 69
A 28 29
R 18 22
A 20 21
A 18 19
A 70 77
R 54 57
A 80 83
A 84 88
R 30 31
A 92 93
A 78 79
A 54 57
A 94 101
A 30 31
R 28 29
A 106 10...

output:

5
10
8
8
8
4
4
3
3
4
4
4
3
3
3
3
3
3
6
4
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3...

result:

ok 12000 lines

Test #130:

score: 0
Accepted
time: 44ms
memory: 156432kb

input:

12000
A 600 741
A 754 1372
A 749 752
A 746 748
A 44 472
A 478 598
A 742 745
A 1784 2333
A 1378 1783
A 29 32
A 474 477
A 38 43
A 1373 1377
A 2335 3292
A 3429 4043
A 3342 3394
A 3398 3428
A 4092 4754
A 34 37
R 1373 1377
A 4950 5015
A 11 25
A 3395 3397
A 4069 4080
A 4760 4939
A 4082 4085
A 1373 1377
A ...

output:

141
772
152
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
3
3
6
6
6
6
6
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 12000 lines

Test #131:

score: 0
Accepted
time: 40ms
memory: 155068kb

input:

12000
A 6 12
A 16 23
A 2 5
A 13 15
A 26 38
A 42 50
A 39 40
A 24 25
A 51 53
A 64 67
A 55 62
A 73 80
A 68 71
A 82 86
A 91 101
A 88 89
A 103 107
A 111 122
R 16 23
A 108 109
A 17 22
A 125 136
A 147 151
A 161 165
A 170 180
A 157 160
A 138 140
A 123 124
A 168 169
R 13 15
A 155 156
A 152 154
A 144 145
A 14...

output:

6
17
10
9
9
9
9
9
9
9
9
9
7
7
7
7
7
7
7
6
6
6
6
6
6
6
6
6
6
6
5
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 12000 lines

Test #132:

score: 0
Accepted
time: 40ms
memory: 155024kb

input:

12000
A 4 6
A 7 8
A 11 15
A 16 23
A 9 10
A 24 29
A 32 34
A 30 31
A 2 3
A 38 40
A 43 47
A 50 55
A 36 37
A 56 63
A 48 49
A 64 69
A 72 73
A 76 81
R 7 8
A 74 75
A 70 71
A 41 42
A 84 86
R 70 71
A 82 83
A 7 8
A 70 71
R 82 83
A 89 90
A 82 83
A 87 88
A 95 98
R 56 63
A 56 63
A 99 106
R 32 34
A 32 35
A 91 92
...

output:

2
4
4
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 12000 lines

Subtask #3:

score: 7
Accepted

Test #133:

score: 7
Accepted
time: 213ms
memory: 169380kb

input:

50000
A 407618 981209
A 14832 978274
A 21496 974294
A 159141 441444
A 103094 770273
A 133173 804558
A 243940 901651
A 590784 872146
A 158069 795070
A 114024 817376
A 7306 972394
A 156995 964178
A 126045 964369
A 23896 862655
A 405378 416054
A 634234 672082
A 369490 983098
A 83772 519426
A 699410 854...

output:

573591
966377
959713
822068
822068
822068
822068
713005
713005
713005
713005
713005
713005
713005
466768
266704
266704
266704
220208
220208
220208
220208
220208
220208
220208
122952
122952
122952
122952
122952
122952
122952
122952
122952
122952
122952
122952
122952
122952
122952
122952
122952
122952...

result:

ok 50000 lines

Test #134:

score: 0
Accepted
time: 194ms
memory: 160912kb

input:

50000
A 127499 615320
A 101672 778406
A 16006 893213
A 190368 804628
A 88084 738969
A 131974 922476
A 31690 490333
A 63501 942205
A 528227 885055
A 112111 970309
A 250 329606
A 363269 801758
A 491948 606453
A 74251 986538
A 118275 441615
A 612858 931868
A 540713 953891
A 65472 643350
A 128407 985888...

output:

487821
487821
487821
677129
677129
677129
772938
772938
853365
853365
853365
801508
574763
574763
488178
439920
439920
439920
439920
439920
439920
439920
439920
361954
361954
361954
361954
361954
361954
361954
361954
301912
301912
301912
301912
301912
229183
229183
229183
229183
229183
229183
229183...

result:

ok 50000 lines

Test #135:

score: 0
Accepted
time: 157ms
memory: 158340kb

input:

50000
A 659539 805418
A 189141 385538
A 499628 737264
A 832193 989432
A 144182 900738
A 21221 42706
A 83275 954567
A 182730 952585
A 3119 974509
A 468925 480899
A 240301 552748
A 333643 953011
A 143592 151167
A 78711 862038
A 470342 847406
A 29297 772523
A 1247 997697
A 89354 730349
A 385838 759964
...

output:

145879
616277
548123
329893
329893
329893
329893
329893
329893
268339
268339
268339
129946
129946
129946
129946
129946
129946
129946
129946
129946
129946
125961
125961
125961
125961
125961
125961
125961
125961
125961
125961
125961
125961
125961
125961
125961
125961
125961
125961
125961
125961
125961...

result:

ok 50000 lines

Test #136:

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

input:

50000
A 430647 696600
A 122877 222787
A 147789 805461
A 71428 759579
A 6810 964816
R 71428 759579
A 40898 997196
R 122877 222787
A 472139 778234
R 6810 964816
A 709093 766865
R 147789 805461
A 503681 762430
R 709093 766865
A 35159 598264
R 35159 598264
A 595393 750298
R 40898 997196
A 366019 993106
...

output:

265953
573723
573723
573723
573723
573723
573723
265953
347587
347587
336218
336218
336218
331783
727271
331783
319651
319651
319651
331783
331783
331783
331783
331783
516898
331783
331783
331783
745829
745829
732755
732755
732755
745829
394034
745829
745829
745829
745829
629460
629460
660561
660561...

result:

ok 50000 lines

Test #137:

score: 0
Accepted
time: 227ms
memory: 169404kb

input:

50000
A 271965 979335
A 103987 492987
A 14711 930771
A 192122 839239
A 7927 974197
A 525559 927492
A 697376 772370
A 95487 995989
A 118273 272752
A 104948 716055
A 191965 694336
A 317132 512060
A 806042 872468
A 296012 793603
A 360888 930592
A 80671 370523
A 297800 837640
A 276995 917813
A 453533 66...

output:

707370
875348
875348
875348
875348
823505
668383
668383
654097
654097
580405
393787
175092
175092
175092
175092
175092
175092
175092
175092
175092
175092
175092
175092
175092
175092
175092
175092
175092
175092
175092
175092
175092
175092
175092
175092
175092
175092
175092
175092
175092
175092
175092...

result:

ok 50000 lines

Test #138:

score: 0
Accepted
time: 197ms
memory: 160912kb

input:

50000
A 475511 540561
A 313376 819103
A 122180 881090
A 327697 753880
A 470693 788951
A 307912 978661
A 563818 975662
A 31521 993353
A 233707 892865
A 134218 892950
A 159719 352136
A 13478 969353
A 450128 861810
A 57917 206806
A 11326 961865
A 263566 525794
A 3341 997102
A 86266 888477
A 421574 7768...

output:

65050
65050
65050
65050
65050
65050
500151
500151
500151
500151
380842
380842
380842
380842
380842
380842
380842
380842
380842
380842
380842
380842
380842
380842
255802
83290
83290
83290
83290
83290
83290
83290
83290
83290
83290
83290
83290
83290
83290
83290
83290
83290
83290
83290
83290
83290
83290...

result:

ok 50000 lines

Test #139:

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

input:

50000
A 2441 994482
A 105041 152380
A 4325 994463
A 430958 672203
A 56355 520837
A 371875 546572
A 721699 845461
A 97342 468984
A 606960 955236
A 909020 978466
A 405894 432352
A 40993 874607
A 170828 455827
A 113204 655598
A 112565 926590
A 4581 911945
A 145913 770732
A 200032 871790
A 207845 237192...

output:

992041
47339
47339
567162
567162
441531
414503
414503
414503
256767
256767
256767
256767
256767
256767
256767
256767
256767
132151
132151
132151
132151
132151
62638
62638
62638
62638
62638
62638
62638
62638
62638
62638
62638
62638
62638
62638
62638
62638
62638
62638
62638
62638
62638
62638
62638
626...

result:

ok 50000 lines

Test #140:

score: 0
Accepted
time: 130ms
memory: 157480kb

input:

50000
A 498643 712497
A 563191 768471
A 890810 917222
A 207314 894771
A 558239 845016
A 346597 603233
A 1274 937672
A 239530 612314
A 31910 989801
R 31910 989801
A 364768 971850
R 207314 894771
R 563191 768471
R 558239 845016
R 364768 971850
R 890810 917222
A 8282 573010
A 389562 612313
A 461543 828...

output:

213854
269828
354031
354031
354031
354031
354031
354031
354031
354031
354031
354031
358983
418579
418579
365900
704215
704215
704215
365900
322935
322935
322935
322935
552708
362649
362649
362649
362649
362649
362649
362649
362649
362649
362649
362649
362649
362649
362649
362649
362649
362649
362649...

result:

ok 50000 lines

Test #141:

score: 0
Accepted
time: 243ms
memory: 175072kb

input:

50000
A 598858 829446
A 283905 664353
A 164142 998692
A 800851 884665
A 208306 360412
A 185867 821746
A 111185 812813
A 31540 804591
A 594529 914594
A 9747 567536
A 26495 878470
A 627847 914747
A 199075 548599
A 146274 566739
A 94371 709048
A 178027 249817
A 44116 945965
A 190613 875425
A 14740 9902...

output:

230588
545541
545541
600760
600760
600760
600760
600760
600760
600760
600760
600760
600760
600760
600760
486326
486326
486326
486326
486326
476358
476358
476358
476358
476358
476358
476358
476358
476358
476358
476358
476358
353521
353521
353521
353521
88247
88247
88247
88247
88247
88247
88247
88247
...

result:

ok 50000 lines

Test #142:

score: 0
Accepted
time: 225ms
memory: 172164kb

input:

50000
A 787773 935849
A 162592 254536
A 615906 840378
A 35729 665611
A 871670 930070
A 210022 282085
A 6195 980773
A 115564 850761
A 451547 534696
A 702419 999383
A 157430 999947
A 173763 592175
A 177113 715666
A 50801 792412
A 514889 901645
A 429748 795421
A 643850 829515
A 3042 994287
A 34030 8561...

output:

148076
773257
677786
677786
314164
314164
314164
314164
314164
314164
314164
314164
314164
314164
314164
314164
286220
286220
286220
286220
286220
286220
286220
286220
286220
286220
286220
286220
286220
136310
136310
136310
136310
95178
95178
95178
95178
95178
95178
95178
95178
95178
95178
95178
951...

result:

ok 50000 lines

Test #143:

score: 0
Accepted
time: 217ms
memory: 171476kb

input:

50000
A 416384 878165
A 4956 995300
A 191205 698928
A 376926 706205
A 692438 928816
A 105526 123649
A 81867 691170
A 964585 979655
A 6186 809315
A 449128 928757
A 745151 833142
A 423638 443870
A 127793 997952
A 373460 640229
A 291180 865278
A 67197 949536
A 275853 744902
A 525949 947344
A 32955 8299...

output:

461781
461781
686960
686960
737611
593402
593402
287217
287217
287217
234504
234504
234504
234504
234504
234504
234504
234504
234504
234504
234504
234504
234504
234504
234504
234504
234504
234504
234504
234504
234504
234504
234504
168903
168903
168903
168903
168903
168903
168903
168903
168903
168903...

result:

ok 50000 lines

Test #144:

score: 0
Accepted
time: 218ms
memory: 171272kb

input:

50000
A 351 979322
A 97576 890526
A 803165 849434
A 114554 748910
A 227806 951278
A 97790 133399
A 344435 871425
A 50590 906636
A 85871 962035
A 157274 953529
R 227806 951278
A 808247 953058
A 185693 901772
A 2191 977555
A 527102 795075
A 379982 439522
A 369411 729312
R 351 979322
A 176566 897738
A ...

output:

978971
792950
46269
734880
734880
734880
734880
734880
734880
734880
734880
734880
734880
734880
322332
322332
322332
322332
322332
322332
322332
322332
322332
322332
258776
258776
258776
258776
258776
258776
258776
258776
258776
322332
322332
322332
322332
322332
322332
322332
322332
322332
322332
...

result:

ok 50000 lines

Test #145:

score: 0
Accepted
time: 242ms
memory: 178084kb

input:

50000
A 215465 593912
A 102044 843028
A 538742 855662
A 414454 951072
A 91061 581694
A 407006 991396
A 45429 976965
A 104517 474350
A 46209 889742
A 68096 997690
A 98683 432036
A 180252 998543
A 425588 668277
A 69020 905060
A 343440 441172
A 329880 981568
A 495040 972929
A 147654 859534
A 235890 914...

output:

378447
378447
640197
640197
764601
764601
764601
751145
751145
751145
751145
751145
751145
751145
512222
512222
512222
512222
512222
512222
512222
512222
393313
393313
393313
393313
393313
393313
321845
321845
321845
321845
321845
321845
286691
286691
286691
286691
286691
286691
286691
286691
286691...

result:

ok 50000 lines

Test #146:

score: 0
Accepted
time: 226ms
memory: 178568kb

input:

50000
A 315811 919111
A 45192 987531
A 235452 907141
A 114867 831168
A 112121 833940
A 504648 924451
A 335694 503928
A 685040 891977
A 280425 953279
A 638804 868772
A 425835 598971
A 30221 532756
A 61765 772371
A 34696 974481
A 345007 974009
A 121397 815167
A 9927 660783
A 70077 331103
A 155275 7094...

output:

603300
603300
683659
804244
804244
809584
588757
556283
556283
533078
442937
442937
442937
442937
442937
442937
442937
433851
433851
349754
310691
310691
310691
310691
310691
310691
310691
310691
310691
310691
310691
310691
310691
310691
310691
310691
310691
310691
310691
310691
221534
221534
221534...

result:

ok 50000 lines

Test #147:

score: 0
Accepted
time: 236ms
memory: 178260kb

input:

50000
A 8263 988857
A 615094 898366
A 37091 936728
A 21383 979381
A 268641 734451
A 120100 282308
A 477130 504132
A 116094 150393
A 11012 981556
A 769580 978372
A 116927 994120
A 60701 805277
A 83702 183026
A 448697 596936
A 145507 787505
A 164200 911638
A 446757 853408
A 29464 434707
A 35931 86682
...

output:

980594
283272
283272
283272
629725
778266
384032
384032
384032
384032
384032
384032
384032
384032
384032
384032
384032
384032
114462
114462
114462
114462
114462
114462
114462
114462
66114
66114
66114
66114
54159
54159
54159
54159
54159
54159
54159
54159
54159
54159
54159
54159
54159
54159
54159
5415...

result:

ok 50000 lines

Test #148:

score: 0
Accepted
time: 231ms
memory: 178336kb

input:

50000
A 146630 929664
A 1509 849456
A 473573 880379
A 372620 489346
A 787022 999344
A 265879 510027
A 35522 800055
A 3474 998526
A 617934 865904
A 457720 949912
A 101684 928864
A 306561 887486
A 239546 979881
A 8651 999111
A 523531 614905
A 390428 567130
A 30753 715588
A 383903 580796
A 232863 88763...

output:

783034
928155
878870
507759
626724
626724
626724
626724
493284
493284
493284
493284
493284
493284
242285
242285
242285
242285
242285
242285
242285
242285
242285
242285
242285
242285
242285
242285
242285
242285
242285
242285
242285
242285
242285
242285
242285
242285
242285
185623
185623
185623
185623...

result:

ok 50000 lines

Test #149:

score: 0
Accepted
time: 217ms
memory: 169388kb

input:

50000
A 78100 938852
A 9257 995879
A 6992 996805
A 672279 825711
A 26918 961336
A 16394 969743
A 567990 840257
A 694160 719308
A 990936 999841
A 691633 789474
A 6518 997676
A 325649 849179
A 885944 937378
A 14709 970797
A 5783 999512
A 150544 929959
A 13586 953273
A 18944 984342
A 5633 999072
A 7721...

output:

860752
860752
860752
153432
153432
153432
153432
25148
305681
305681
305681
305681
113897
113897
113897
113897
113897
113897
113897
113897
113897
113897
113897
113897
113897
89580
89580
89580
89580
89580
87059
87059
87059
87059
80456
52837
42815
42815
42815
42815
42815
42815
42815
42815
42815
42815
...

result:

ok 50000 lines

Test #150:

score: 0
Accepted
time: 177ms
memory: 160688kb

input:

50000
A 448247 585325
A 706652 717959
A 10005 857501
A 499686 941516
A 12975 576849
A 533491 665971
A 3368 634638
A 220356 691306
A 403492 677074
A 712161 758871
A 16849 84278
A 1973 676396
A 69516 880849
A 1946 709765
A 6901 667218
A 77149 655921
A 69867 909456
A 463 711318
A 33510 934777
A 1865 87...

output:

137078
269712
269712
269712
269712
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
184468
96670
96670
96670
96670
966...

result:

ok 50000 lines

Test #151:

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

input:

50000
A 178634 205525
A 615970 982113
A 199624 977195
A 120744 992400
A 13883 982327
A 155417 993800
A 188615 241780
A 89640 992659
A 10184 998257
A 49632 715088
A 216318 988669
A 139151 190783
A 56280 656009
A 46673 996678
A 70055 606797
A 156994 762744
A 86538 657562
A 9450 165499
A 103410 307279
...

output:

26891
803479
803479
803479
803479
803479
793498
793498
793498
793498
793498
793498
793498
793498
793498
793498
793498
196075
196075
196075
179259
179259
179259
84521
84521
84521
84521
84521
84521
84521
84521
84521
84521
84521
84521
84521
84521
84521
84521
38891
38891
38891
38891
38891
38891
38891
38...

result:

ok 50000 lines

Test #152:

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

input:

50000
A 53646 462886
A 158527 545598
A 75618 784430
A 368841 370763
A 325754 663499
R 75618 784430
A 356668 456154
R 158527 545598
A 27847 651350
R 368841 370763
A 322373 930586
R 27847 651350
A 184719 960564
R 322373 930586
A 17457 993493
R 325754 663499
A 377726 409507
R 377726 409507
A 248022 657...

output:

409240
491952
491952
1922
1922
1922
1922
1922
1922
99486
99486
99486
99486
99486
99486
99486
31781
99486
99486
99486
99486
99486
429155
429155
429155
429155
429155
429155
429155
429155
429155
429155
429155
248323
248323
99486
99486
687691
687691
687691
148787
148787
785992
148787
810416
18176
18176
...

result:

ok 50000 lines

Test #153:

score: 0
Accepted
time: 205ms
memory: 169572kb

input:

50000
A 300888 871483
A 589593 655665
A 619687 921940
A 611809 635101
A 689294 818247
A 614848 790330
A 473740 659374
A 197632 610586
A 58383 935866
A 341912 717783
A 24292 921890
A 332336 938408
A 694 953911
A 390823 648282
A 22836 963458
A 405918 993640
A 17106 993790
A 63300 957168
A 543498 86453...

output:

570595
66072
332347
310131
206438
206438
206438
206438
206438
206438
206438
206438
206438
206438
206438
206438
206438
206438
206438
206438
206438
206438
206438
191558
191558
191558
191558
191558
191558
191558
191558
191558
191558
191558
79155
79155
79155
79155
79155
79155
79155
79155
79155
79155
791...

result:

ok 50000 lines

Test #154:

score: 0
Accepted
time: 186ms
memory: 160696kb

input:

50000
A 410224 734026
A 373281 938232
A 497443 671494
A 113705 571703
A 351017 949271
A 186274 954048
A 541857 775181
A 200271 469031
A 304601 813709
A 294297 754311
A 508689 734195
A 692852 725994
A 600725 716964
A 478665 608538
A 46591 981331
A 80767 948718
A 410940 882562
A 177854 843815
A 55602 ...

output:

323802
323802
174051
557789
557789
557789
661476
471223
471223
471223
471223
228551
228551
228551
228551
228551
228551
228551
228551
228551
228551
228551
228551
228551
228551
228551
228551
228551
228551
228551
228551
228551
228551
228551
228551
228551
228551
228551
228551
228551
228551
211023
211023...

result:

ok 50000 lines

Test #155:

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

input:

50000
A 330216 979149
A 55424 437335
A 261136 290825
A 119052 427041
A 299428 878925
A 60423 471655
A 53405 719290
A 157784 880854
A 163170 751594
A 45656 750114
A 44115 565322
A 231528 286578
A 630242 973582
A 271442 765911
A 51660 910224
A 176721 988758
A 921274 924361
A 44983 675791
A 283720 9974...

output:

648933
923725
718013
718013
617789
617789
617789
617789
617789
617789
617789
617789
617789
617789
617789
617789
617789
617789
617789
248236
248236
248236
238967
238967
238967
238967
238967
233084
233084
191386
191386
52204
52204
52204
52204
52204
52204
52204
52204
52204
52204
52204
52204
52204
52204...

result:

ok 50000 lines

Test #156:

score: 0
Accepted
time: 126ms
memory: 157128kb

input:

50000
A 26316 835400
A 493623 590536
A 385898 649394
A 5089 851512
A 313588 765435
R 493623 590536
A 387134 449683
A 319942 655247
R 26316 835400
A 59498 482011
R 385898 649394
R 5089 851512
A 37887 602308
A 337768 680212
R 37887 602308
R 319942 655247
A 199158 830822
A 156635 916113
A 43903 877301
...

output:

809084
96913
96913
96913
96913
263496
62549
62549
62549
62549
62549
62549
62549
62549
62549
62549
62549
62549
62549
62549
342444
342444
342444
342444
342444
144016
414180
414180
414180
414180
414180
414180
69739
69739
69739
69739
69739
69739
69739
69739
69739
69739
69739
459837
459837
297072
297072
...

result:

ok 50000 lines

Test #157:

score: 0
Accepted
time: 229ms
memory: 175148kb

input:

50000
A 124916 247138
A 699768 757289
A 137054 232262
A 576848 815145
A 700956 711345
A 635818 902041
A 121352 706117
A 775296 947485
A 709011 878329
A 715978 829408
A 278097 985006
A 422774 950647
A 342203 658313
A 733295 894260
A 61727 725790
A 167671 863925
A 71238 189874
A 710313 926522
A 16211 ...

output:

122222
632373
620235
620235
574291
574291
574291
246529
246529
128452
128452
128452
128452
128452
128452
128452
128452
128452
128452
128452
128452
128452
128452
128452
128452
128452
128452
128452
128452
128452
122907
122907
122907
122907
122907
122907
122907
84042
84042
84042
84042
84042
84042
84042...

result:

ok 50000 lines

Test #158:

score: 0
Accepted
time: 218ms
memory: 172008kb

input:

50000
A 100095 506922
A 48889 200058
A 25659 630090
A 42607 221144
A 27203 788839
A 175627 220332
A 195945 218881
A 69300 189229
A 102161 180513
A 4229 652717
A 83246 739490
A 148589 952084
A 6549 783379
A 167219 371346
A 215377 708687
A 170442 855535
A 293748 680286
A 34465 59868
A 67533 453876
A 3...

output:

406827
458033
458033
458033
458033
171443
169992
149581
116720
116720
116720
116720
116720
116720
116720
116720
116720
116720
116720
116720
116720
116720
116720
116720
116720
98305
98305
98305
98305
98305
98305
98305
98305
98305
98305
98305
98305
98305
98305
98305
98305
98305
98305
98305
98305
98305...

result:

ok 50000 lines

Test #159:

score: 0
Accepted
time: 214ms
memory: 171132kb

input:

50000
A 844855 955893
A 604648 865112
A 230032 951002
A 916025 924708
A 53549 917406
A 111232 944359
A 34861 986848
A 39470 953138
A 408151 992926
A 112618 675531
A 204450 427514
A 536524 989279
A 921009 967460
A 64483 990246
A 655868 922804
A 168786 755065
A 69868 857180
A 85267 444931
A 302363 962...

output:

111038
351245
351245
320060
320060
320060
320060
320060
320060
320060
320060
320060
320060
320060
320060
320060
320060
320060
320060
137504
137504
137504
137504
137504
137504
137504
137504
137504
137504
137504
137504
137504
137504
137504
137504
137504
137504
137504
137504
137504
99714
99714
99714
99...

result:

ok 50000 lines

Test #160:

score: 0
Accepted
time: 213ms
memory: 170976kb

input:

50000
A 341009 979664
A 372046 963767
A 37826 989687
A 169294 654512
A 259959 874485
A 37862 926553
R 37862 926553
A 256642 957130
A 254025 999474
A 1637 995230
A 97269 968478
A 86523 889762
A 14377 990488
A 58526 995278
A 30950 995955
A 7274 997779
A 251502 984337
A 641566 647203
R 341009 979664
A ...

output:

638655
591721
591721
794473
794473
794473
794473
794473
794473
794473
794473
794473
794473
794473
794473
794473
794473
5637
5637
349060
329513
730667
273064
273064
273064
273064
273064
273064
273064
273064
273064
273064
273064
273064
273064
273064
273064
273064
273064
273064
273064
273064
273064
273...

result:

ok 50000 lines

Test #161:

score: 0
Accepted
time: 233ms
memory: 178312kb

input:

50000
A 174363 686513
A 786672 969314
A 826875 867994
A 468803 995948
A 24216 901426
A 550589 581001
A 304240 842959
A 554720 799475
A 501610 881379
A 558835 666632
A 110835 870343
A 163273 991521
A 278627 641712
A 112113 215455
A 98510 547350
A 888578 984272
A 564052 820700
A 390949 942042
A 41036 ...

output:

512150
794951
693631
693631
693631
317405
317405
313274
313274
309159
309159
309159
309159
309159
309159
157397
157397
157397
157397
157397
157397
157397
157397
157397
157397
157397
157397
157397
157397
157397
157397
157397
157397
157397
157397
157397
157397
157397
139181
139181
139181
139181
139181...

result:

ok 50000 lines

Test #162:

score: 0
Accepted
time: 227ms
memory: 178232kb

input:

50000
A 175933 670867
A 13780 633191
A 164173 673166
A 786 731682
A 64050 990294
A 4603 996796
A 609627 783551
A 2081 967218
A 339 838436
A 87247 901304
A 640388 801233
A 315632 492021
A 190701 803349
A 711937 852810
A 275882 489594
A 165926 550916
A 136666 318078
A 4247 999064
A 495668 855139
A 177...

output:

494934
657087
657087
657087
657087
657087
769771
769771
769771
769771
787453
467919
467919
467919
467919
467919
467919
467919
467919
467919
467919
467919
467919
311943
311943
311943
311943
311943
311943
311943
311943
311943
311943
311943
311943
311943
311943
311943
277220
277220
277220
277220
277220...

result:

ok 50000 lines

Test #163:

score: 0
Accepted
time: 235ms
memory: 178220kb

input:

50000
A 178150 417497
A 59982 402479
A 221390 286605
A 145232 691074
A 242948 425624
A 146787 559916
A 9474 603272
A 25143 619386
A 62134 807164
A 95114 844172
A 327510 616627
A 408554 535144
A 104210 226741
A 57797 246795
A 62304 398536
A 223420 355284
A 47399 869090
A 65793 186486
A 386673 550591
...

output:

239347
357515
65215
65215
204234
204234
204234
204234
204234
204234
395237
313754
313754
313754
313754
311724
311724
220812
220812
220812
220812
220812
218566
218566
218566
218566
218566
218566
218566
218566
162504
158944
158944
158944
158944
158944
54031
54031
54031
54031
54031
54031
54031
54031
54...

result:

ok 50000 lines

Test #164:

score: 0
Accepted
time: 227ms
memory: 178376kb

input:

50000
A 257687 893324
A 12901 59005
A 5241 416453
A 501298 685033
A 11321 483359
A 13694 743650
A 56927 80502
A 411123 821933
A 719211 748013
A 7087 812846
A 3021 847605
A 66374 921676
A 41328 60397
A 45244 993429
A 3039 262891
A 4368 744230
A 128819 688479
A 195609 924175
A 12357 447739
A 2634 2717...

output:

635637
880423
880423
672132
672132
672132
628106
628106
246715
246715
246715
246715
246715
246715
246715
246715
246715
246715
246715
246715
99598
99598
99598
99598
99598
99598
99598
99598
41673
41673
41673
41673
41673
41673
41673
41673
41673
41673
41673
41673
41673
41673
41673
41673
41673
41673
4167...

result:

ok 50000 lines

Test #165:

score: 0
Accepted
time: 52ms
memory: 155396kb

input:

50000
A 793654 913159
A 177672 223519
R 177672 223519
A 257123 911484
R 793654 913159
A 232116 429471
R 257123 911484
A 439285 528325
R 232116 429471
A 903 815389
R 439285 528325
A 463216 621868
R 463216 621868
A 5332 884276
R 903 815389
A 317870 961228
R 5332 884276
A 433818 569109
R 433818 569109
...

output:

119505
735487
119505
656036
654361
679368
197355
296209
89040
89040
814486
158652
814486
883373
878944
955896
643358
135291
643358
212296
212296
212296
619403
44057
619403
781747
355616
586452
355616
875903
442964
672468
101291
101291
101291
340464
101291
177374
155635
155635
155635
850672
336502
95...

result:

ok 50000 lines

Test #166:

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

input:

50000
A 78938 872907
A 116548 405609
R 116548 405609
A 175778 209383
R 175778 209383
A 342503 543127
R 78938 872907
A 310415 588040
R 310415 588040
A 4337 383425
R 342503 543127
A 279382 597300
R 4337 383425
A 350120 971071
R 279382 597300
A 49383 949990
R 49383 949990
A 857344 966793
R 857344 96679...

output:

793969
289061
793969
33605
793969
200624
200624
200624
200624
538790
379088
592963
317918
691689
620951
921688
620951
109449
620951
908890
620951
57945
620951
362998
362998
468086
362998
362998
362998
647086
385936
385936
385936
385936
385936
385936
715690
171953
715690
720601
358019
358019
358019
3...

result:

ok 50000 lines

Test #167:

score: 0
Accepted
time: 61ms
memory: 155364kb

input:

50000
A 15429 894921
A 120472 648727
R 15429 894921
A 93931 418189
R 93931 418189
A 397005 781632
R 397005 781632
A 150961 181992
R 150961 181992
A 155574 967780
R 120472 648727
A 124512 831006
R 155574 967780
A 129181 903485
R 124512 831006
A 367045 923813
R 129181 903485
A 39027 998868
R 367045 92...

output:

879492
528255
528255
554796
528255
661160
528255
31031
528255
847308
812206
843268
706494
778973
774304
794632
556768
556768
959841
868201
868201
335274
868201
27763
27763
27763
748104
785208
748104
170058
170058
298725
170058
170058
788510
928956
839865
957893
839865
642773
642773
732377
236702
336...

result:

ok 50000 lines

Test #168:

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

input:

50000
A 140003 728575
A 289007 906420
R 289007 906420
A 497008 762485
R 497008 762485
A 427329 850336
R 427329 850336
A 616967 633694
R 140003 728575
A 595878 832995
R 595878 832995
A 217461 859947
R 616967 633694
A 310484 384653
R 217461 859947
A 103316 987412
R 103316 987412
A 158053 804640
R 1580...

output:

588572
766417
588572
622482
588572
710333
588572
16727
16727
16727
16727
16727
642486
74169
74169
74169
74169
74169
74169
362964
74169
74169
829843
49373
829843
90893
829843
948610
947114
399389
947114
40104
40104
40104
949801
118687
118687
779571
129928
982571
129928
714036
495664
495664
495664
743...

result:

ok 50000 lines

Test #169:

score: 0
Accepted
time: 133ms
memory: 157428kb

input:

50000
A 269137 695321
A 57215 800359
A 486164 960952
A 55371 981048
A 424437 927394
R 55371 981048
A 104314 673571
R 486164 960952
A 428072 703996
A 384478 593331
R 57215 800359
A 329098 840135
A 341289 988216
R 104314 673571
R 341289 988216
R 384478 593331
A 49368 781750
A 118731 848798
R 118731 84...

output:

426184
426184
691815
691815
691815
691815
856638
823080
599682
319518
319518
319518
319518
319518
319518
434859
434859
434859
434859
498388
498388
498388
405907
405907
405907
405907
405907
405907
405907
405907
405907
405907
405907
405907
405907
405907
405907
405907
405907
405907
405907
405907
405907...

result:

ok 50000 lines

Test #170:

score: 0
Accepted
time: 114ms
memory: 157060kb

input:

50000
A 156379 738932
A 261229 849361
R 261229 849361
A 103987 866184
A 3562 914178
R 3562 914178
A 127732 933286
A 185168 573046
A 423049 886695
A 167995 955274
R 156379 738932
A 529005 890600
A 294482 692059
A 82344 612601
A 407615 992519
A 35582 422148
R 423049 886695
R 127732 933286
A 356760 872...

output:

582553
692982
582553
582553
582553
582553
582553
387878
701527
701527
701527
705432
705432
705432
705432
851113
855018
855018
855018
705432
705432
705432
705432
705432
705432
705432
731041
731041
731041
749276
749276
666889
666889
666889
666889
666889
666889
666889
666889
513731
543742
543742
543742...

result:

ok 50000 lines

Test #171:

score: 0
Accepted
time: 95ms
memory: 156492kb

input:

50000
A 454239 752429
A 123623 783288
R 454239 752429
A 155647 873054
R 123623 783288
A 215059 807512
R 155647 873054
A 67677 866649
R 215059 807512
A 306926 925670
R 67677 866649
A 110586 787584
R 110586 787584
A 541075 763724
A 9252 921780
A 222788 891496
A 968871 998937
R 9252 921780
A 413014 720...

output:

298190
298190
659665
749431
717407
592453
592453
592453
798972
857993
618744
815084
618744
222649
222649
222649
457862
457862
457862
457862
457862
457862
457862
457862
457862
457862
362836
539676
273632
222649
222649
222649
222649
222649
222649
222649
901044
613880
919604
919604
613880
613880
660307...

result:

ok 50000 lines

Test #172:

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

input:

50000
A 460985 893708
A 44991 976719
A 176409 908130
R 44991 976719
R 460985 893708
A 134094 808486
A 389456 943485
A 302964 966610
R 134094 808486
A 275210 935599
A 67443 970291
A 131322 996316
R 176409 908130
R 275210 935599
R 389456 943485
R 131322 996316
R 67443 970291
A 261624 985717
A 152644 9...

output:

432723
432723
432723
432723
731721
774036
809391
809391
767076
767076
767076
767076
668275
554029
663646
663646
663646
663646
813966
663646
901007
901007
663646
76444
76444
76444
497923
497923
76444
76444
76444
76444
76444
641133
76444
76444
405588
31310
405588
449063
30441
811791
718052
718052
7091...

result:

ok 50000 lines

Test #173:

score: 0
Accepted
time: 218ms
memory: 167016kb

input:

50000
A 770 957806
A 127821 862413
A 241781 804603
A 382230 493743
A 29694 961374
A 341233 726163
A 163946 767271
A 204417 743788
R 204417 743788
A 427546 863011
A 86093 963756
A 494286 506866
A 378260 877221
A 75198 948382
A 403150 803953
R 163946 767271
A 318160 825297
A 100667 814980
A 111044 552...

output:

957036
734592
562822
111513
111513
111513
111513
111513
111513
480781
480781
124636
124636
124636
124636
124636
124636
124636
124636
124636
124636
124636
124636
124636
124636
124636
124636
124636
124636
124636
124636
124636
124636
124636
124636
124636
124636
124636
124636
124636
124636
124636
124636...

result:

ok 50000 lines

Test #174:

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

input:

50000
A 29537 695116
A 372969 547318
A 181886 905895
A 9398 772089
A 70828 314162
A 216957 795876
A 521935 646986
A 650148 799938
R 9398 772089
A 567394 756687
A 13846 840067
A 863331 877493
R 29537 695116
A 383057 972251
A 3991 999292
A 520102 932366
A 121257 619276
A 167338 966391
A 110047 214074
...

output:

665579
174349
174349
174349
476490
476490
476490
278003
278003
278003
278003
227345
227345
227345
227345
227345
227345
227345
227345
310099
310099
310099
310099
310099
310099
383718
383718
383718
383718
389799
389799
389799
389799
326274
326274
326274
326274
326274
326274
326274
252795
252795
326274...

result:

ok 50000 lines

Test #175:

score: 0
Accepted
time: 140ms
memory: 157896kb

input:

50000
A 99810 867739
A 93791 688827
A 195191 977172
A 572814 615428
A 93552 917037
A 430232 872632
A 104481 509687
A 34013 176394
R 104481 509687
A 466137 887582
A 346521 432441
A 371975 587029
A 19575 944131
A 273187 492900
A 805507 907936
A 24425 809758
A 352203 718236
A 80888 948174
R 371975 5870...

output:

767929
773948
883381
42614
42614
42614
510947
510947
581415
581415
268907
268907
268907
268907
268907
268907
268907
268907
268907
268907
268907
268907
268907
268907
268907
268907
268907
268907
268907
268907
214895
189152
189152
189152
189152
214895
214895
161549
161549
161549
161549
161549
161549
16...

result:

ok 50000 lines

Test #176:

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

input:

50000
A 243565 505860
A 466367 949722
A 742024 991330
A 35298 980796
A 389370 871144
A 805686 978715
R 742024 991330
R 466367 949722
R 805686 978715
R 389370 871144
R 35298 980796
A 5145 974081
A 33719 262026
A 303400 466357
A 220472 552865
A 76404 779418
R 5145 974081
R 76404 779418
R 243565 505860...

output:

262295
706157
747765
747765
747765
735150
735150
735150
627579
262295
262295
262295
472141
432638
432638
432638
432638
432638
432638
519146
228307
855703
855703
707219
670626
670626
670626
855703
812938
812938
812938
855703
855703
733728
863647
892047
113966
113966
113966
607315
607315
607315
607315...

result:

ok 50000 lines

Test #177:

score: 0
Accepted
time: 218ms
memory: 163088kb

input:

50000
A 51640 733537
A 36167 632056
A 24875 68632
A 88429 942204
A 373530 628640
A 4611 711781
A 70996 993728
A 420632 869520
A 268221 799664
A 105464 691694
A 105373 480397
A 5794 823303
A 20146 989067
A 24480 999515
A 34301 437167
A 204733 230839
A 233244 897489
A 580276 627723
A 255602 990550
A 6...

output:

681897
697370
708662
917329
603765
603765
603765
603765
603765
603765
455522
455522
455522
455522
455522
205964
205964
205964
205964
205964
205964
205964
205964
205964
205964
205964
205964
205964
205964
205964
205964
205964
205964
205964
205964
205964
205964
205964
157552
157552
157552
157552
157552...

result:

ok 50000 lines

Test #178:

score: 0
Accepted
time: 176ms
memory: 159000kb

input:

50000
A 622754 916459
A 238131 534615
A 11079 997468
A 163631 844857
A 12111 988449
A 21279 840094
A 77696 454319
A 60964 957539
A 558904 585086
A 404431 979640
A 104439 225165
A 200254 994241
A 81245 772404
A 292498 971796
A 229745 928451
A 19439 477353
A 320582 501612
A 50906 997823
A 186704 97183...

output:

293705
678328
678328
678328
678328
678328
678328
678328
346955
346955
346955
346955
346955
346955
346955
346955
264504
264504
264504
264504
236074
236074
236074
236074
236074
94963
94963
94963
94963
94963
94963
94963
94963
94963
94963
94963
94963
94963
94963
94963
94963
94963
94963
94963
94963
94963...

result:

ok 50000 lines

Test #179:

score: 0
Accepted
time: 146ms
memory: 157572kb

input:

50000
A 184884 682982
A 460562 826239
A 13426 949137
A 714251 855944
A 461215 966852
A 51899 901510
A 266904 637850
A 416581 601048
A 293205 614234
A 216881 384530
A 935553 998753
A 361200 719680
A 65478 993770
A 288532 758201
A 9771 994816
A 120517 267822
A 393927 454034
A 11890 890469
A 134893 386...

output:

498098
641355
641355
671060
671060
671060
589040
439363
439363
384167
284502
284502
284502
284502
284502
284502
237153
237153
237153
237153
237153
237153
237153
237153
237153
143649
143649
143649
143649
143649
143649
143649
143649
143649
143649
143649
143649
143649
143649
143649
143649
143649
143649...

result:

ok 50000 lines

Test #180:

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

input:

50000
A 309874 798113
A 218576 398383
A 640640 901389
A 209057 353043
A 215921 986038
A 254147 279856
R 640640 901389
R 209057 353043
R 218576 398383
R 215921 986038
R 254147 279856
A 383299 430365
A 8158 990102
A 386759 834794
A 431258 776487
A 286314 834871
R 8158 990102
R 431258 776487
R 309874 7...

output:

488239
579537
682813
682813
682813
543966
543966
543966
543966
543966
488239
47066
47066
451495
393188
393188
393188
451495
451495
448035
548557
662533
662533
745307
745307
745307
745307
745307
745307
630764
630764
630764
759647
704129
704129
704129
704129
704129
704129
812096
522853
676549
676549
6...

result:

ok 50000 lines

Test #181:

score: 0
Accepted
time: 116ms
memory: 167640kb

input:

50000
A 450004 475002
A 450006 475005
A 450008 475008
A 450010 475011
A 450012 475014
A 450014 475017
A 450016 475020
A 450018 475023
A 450020 475026
A 450022 475029
A 450024 475032
A 450026 475035
A 450028 475038
A 450030 475041
A 450032 475044
A 450034 475047
A 450036 475050
A 450038 475053
A 4500...

output:

24998
25001
25004
25007
25010
25013
25016
25019
25022
25025
25028
25031
25034
25037
25040
25043
25046
25049
25052
25055
25058
25061
25064
25067
25070
25073
25076
25079
25082
25085
25088
25091
25094
25097
25100
25103
25106
25109
25112
25115
25118
25121
25124
25127
25130
25133
25136
25139
25142
25145
...

result:

ok 50000 lines

Test #182:

score: 0
Accepted
time: 124ms
memory: 166812kb

input:

50000
A 465610 498411
A 456328 484488
A 457940 486906
A 463408 495108
A 460228 490338
A 498920 548376
A 483628 525438
A 489262 533889
A 482276 523410
A 464404 496602
A 459312 488964
A 468750 503121
A 469404 504102
A 486294 529437
A 476754 515127
A 477266 515895
A 481584 522372
A 453352 480024
A 4887...

output:

32801
42083
42083
42083
42083
82766
82766
75949
75949
75949
74577
74577
74577
73109
73109
73109
73109
69020
69020
69020
69020
68054
68054
68054
68054
68054
68054
68054
68054
68054
68054
68054
68054
68054
68054
68054
68054
68054
68054
68054
68054
68054
66114
66114
66114
66114
66114
63899
63899
63899
...

result:

ok 50000 lines

Test #183:

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

input:

50000
A 450004 475002
A 450006 475005
A 450008 475008
A 450010 475011
A 450012 475014
A 450014 475017
A 450016 475020
A 450018 475023
A 450020 475026
A 450022 475029
A 450024 475032
A 450026 475035
A 450028 475038
A 450030 475041
A 450032 475044
A 450034 475047
A 450036 475050
A 450038 475053
A 4500...

output:

24998
25001
25004
25007
25010
25013
25016
25019
25022
25025
25028
25031
25034
25037
25040
25043
25046
25049
25052
25055
25058
25061
25064
25067
25070
25073
25076
25079
25082
25085
25088
25091
25094
25097
25100
25103
25106
25109
25112
25115
25118
25121
25124
25127
25130
25133
25136
25139
25142
25145
...

result:

ok 50000 lines

Test #184:

score: 0
Accepted
time: 131ms
memory: 166464kb

input:

50000
A 480878 521313
A 484344 526512
A 451300 476946
A 459518 489273
A 474464 511692
A 491866 537795
A 463468 495198
A 494538 541803
A 483824 525732
A 496076 544110
A 451976 477960
A 494772 542154
A 467682 501519
A 479418 519123
A 463318 494973
A 483280 524916
A 461944 492912
A 474092 511134
A 4753...

output:

40435
45634
70013
70013
70013
70013
70013
70013
70013
70013
69337
69337
69337
67147
67147
67147
67147
67147
67147
67147
67147
67147
65848
65848
65848
65848
65848
65848
65848
65848
65848
65848
65848
65848
65848
65848
65005
65005
65005
65005
65005
65005
65005
65005
65005
65005
65005
65005
65005
65005
...

result:

ok 50000 lines

Test #185:

score: 0
Accepted
time: 116ms
memory: 167548kb

input:

50000
A 450004 475002
A 450006 475005
A 450008 475008
A 450010 475011
A 450012 475014
A 450014 475017
A 450016 475020
A 450018 475023
A 450020 475026
A 450022 475029
A 450024 475032
A 450026 475035
A 450028 475038
A 450030 475041
A 450032 475044
A 450034 475047
A 450036 475050
A 450038 475053
A 4500...

output:

24998
25001
25004
25007
25010
25013
25016
25019
25022
25025
25028
25031
25034
25037
25040
25043
25046
25049
25052
25055
25058
25061
25064
25067
25070
25073
25076
25079
25082
25085
25088
25091
25094
25097
25100
25103
25106
25109
25112
25115
25118
25121
25124
25127
25130
25133
25136
25139
25142
25145
...

result:

ok 50000 lines

Test #186:

score: 0
Accepted
time: 125ms
memory: 166852kb

input:

50000
A 483216 524820
A 462000 492996
A 451808 477708
A 473876 510810
A 485092 527634
A 470028 505038
A 498998 548493
A 484076 526110
A 461286 491925
A 484272 526404
A 488404 532602
A 499620 549426
A 464594 496887
A 481370 522051
A 451614 477417
A 490990 536481
A 454368 481548
A 474676 512010
A 4960...

output:

41604
62820
73012
73012
73012
73012
73012
73012
73012
73012
73012
73012
73012
70243
70243
70243
70243
70243
70243
70243
70243
67931
67931
67931
67931
67931
67931
67931
67931
67931
67931
67931
67931
63463
63463
63463
63463
63463
63463
63463
63463
63463
63463
63463
63463
63463
63463
63463
63463
63463
...

result:

ok 50000 lines

Test #187:

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

input:

50000
A 450004 475002
A 450006 475005
A 450008 475008
A 450010 475011
A 450012 475014
A 450014 475017
A 450016 475020
A 450018 475023
A 450020 475026
A 450022 475029
A 450024 475032
A 450026 475035
A 450028 475038
A 450030 475041
A 450032 475044
A 450034 475047
A 450036 475050
A 450038 475053
A 4500...

output:

24998
25001
25004
25007
25010
25013
25016
25019
25022
25025
25028
25031
25034
25037
25040
25043
25046
25049
25052
25055
25058
25061
25064
25067
25070
25073
25076
25079
25082
25085
25088
25091
25094
25097
25100
25103
25106
25109
25112
25115
25118
25121
25124
25127
25130
25133
25136
25139
25142
25145
...

result:

ok 50000 lines

Test #188:

score: 0
Accepted
time: 119ms
memory: 166952kb

input:

50000
A 456390 484581
A 481522 522279
A 459514 489267
A 481650 522471
A 480390 520581
A 463656 495480
A 453542 480309
A 466464 499692
A 456690 485031
A 461468 492198
A 486642 529959
A 483566 525345
A 477786 516675
A 466352 499524
A 488746 533115
A 472582 508869
A 477984 516972
A 497822 546729
A 4954...

output:

28191
65889
65889
66081
66081
66081
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
67039
...

result:

ok 50000 lines

Test #189:

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

input:

50000
A 450004 475002
A 450006 475005
A 450008 475008
A 450010 475011
A 450012 475014
A 450014 475017
A 450016 475020
A 450018 475023
A 450020 475026
A 450022 475029
A 450024 475032
A 450026 475035
A 450028 475038
A 450030 475041
A 450032 475044
A 450034 475047
A 450036 475050
A 450038 475053
A 4500...

output:

24998
25001
25004
25007
25010
25013
25016
25019
25022
25025
25028
25031
25034
25037
25040
25043
25046
25049
25052
25055
25058
25061
25064
25067
25070
25073
25076
25079
25082
25085
25088
25091
25094
25097
25100
25103
25106
25109
25112
25115
25118
25121
25124
25127
25130
25133
25136
25139
25142
25145
...

result:

ok 50000 lines

Test #190:

score: 0
Accepted
time: 137ms
memory: 166720kb

input:

50000
A 462606 493905
A 478230 517341
A 493446 540165
A 488068 532098
A 452392 478584
A 461912 492864
A 478598 517893
A 465612 498414
A 472458 508683
A 485236 527850
A 493414 540117
A 450478 475713
A 462536 493800
A 463422 495129
A 463852 495774
A 452764 479142
A 455648 483468
A 494938 542403
A 4806...

output:

31299
54735
77559
77559
79706
78253
65501
65501
65501
65501
65501
65501
65501
65501
65501
65501
65501
65501
65501
65501
65501
65501
65501
65501
65501
65501
65501
63596
63596
63596
63596
63596
63596
63596
63596
63596
63596
63596
63596
63596
63596
63596
63596
63092
63092
63092
63092
63092
63092
63092
...

result:

ok 50000 lines

Test #191:

score: 0
Accepted
time: 198ms
memory: 181456kb

input:

50000
A 1 37
A 38 74
A 75 111
A 112 148
A 149 185
A 186 222
A 223 259
A 260 296
A 297 333
A 334 370
A 371 407
A 408 444
A 445 481
A 482 518
A 519 555
A 556 592
A 593 629
A 630 666
A 667 703
A 704 740
A 741 777
A 778 814
A 815 851
A 852 888
A 889 925
A 926 962
A 963 999
A 1000 1036
A 1037 1073
A 1074...

output:

36
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
73
...

result:

ok 50000 lines

Test #192:

score: 0
Accepted
time: 201ms
memory: 180356kb

input:

50000
A 975069 975070
A 975067 975068
A 975065 975066
A 975063 975064
A 975061 975062
A 975059 975060
A 975057 975058
A 975055 975056
A 975053 975054
A 975051 975052
A 975049 975050
A 975047 975048
A 975045 975046
A 975043 975044
A 975041 975042
A 975039 975040
A 975037 975038
A 975035 975036
A 9750...

output:

1
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 50000 lines

Subtask #4:

score: 4
Accepted

Test #193:

score: 4
Accepted
time: 798ms
memory: 263848kb

input:

200000
A 1 7
A 8 14
A 15 21
A 22 28
A 29 35
A 36 42
A 43 49
A 50 56
A 57 63
A 64 70
A 71 77
A 78 84
A 85 91
A 92 98
A 99 105
A 106 112
A 113 119
A 120 126
A 127 133
A 134 140
A 141 147
A 148 154
A 155 161
A 162 168
A 169 175
A 176 182
A 183 189
A 190 196
A 197 203
A 204 210
A 211 217
A 218 224
A 225...

output:

6
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
13
1...

result:

ok 200000 lines

Test #194:

score: 0
Accepted
time: 738ms
memory: 259784kb

input:

200000
A 900009 900010
A 900007 900008
A 900005 900006
A 900003 900004
A 900001 900002
A 899999 900000
A 899997 899998
A 899995 899996
A 899993 899994
A 899991 899992
A 899989 899990
A 899987 899988
A 899985 899986
A 899983 899984
A 899981 899982
A 899979 899980
A 899977 899978
A 899975 899976
A 899...

output:

1
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 200000 lines

Test #195:

score: 0
Accepted
time: 1507ms
memory: 375136kb

input:

400000
A 1 2
A 3 4
A 5 6
A 7 8
A 9 10
A 11 12
A 13 14
A 15 16
A 17 18
A 19 20
A 21 22
A 23 24
A 25 26
A 27 28
A 29 30
A 31 32
A 33 34
A 35 36
A 37 38
A 39 40
A 41 42
A 43 44
A 45 46
A 47 48
A 49 50
A 51 52
A 53 54
A 55 56
A 57 58
A 59 60
A 61 62
A 63 64
A 65 66
A 67 68
A 69 70
A 71 72
A 73 74
A 75 7...

output:

1
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 400000 lines

Test #196:

score: 0
Accepted
time: 1424ms
memory: 367496kb

input:

400000
A 799999 800000
A 799997 799998
A 799995 799996
A 799993 799994
A 799991 799992
A 799989 799990
A 799987 799988
A 799985 799986
A 799983 799984
A 799981 799982
A 799979 799980
A 799977 799978
A 799975 799976
A 799973 799974
A 799971 799972
A 799969 799970
A 799967 799968
A 799965 799966
A 799...

output:

1
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 400000 lines

Test #197:

score: 0
Accepted
time: 1927ms
memory: 417336kb

input:

499999
A 1 2
A 3 4
A 5 6
A 7 8
A 9 10
A 11 12
A 13 14
A 15 16
A 17 18
A 19 20
A 21 22
A 23 24
A 25 26
A 27 28
A 29 30
A 31 32
A 33 34
A 35 36
A 37 38
A 39 40
A 41 42
A 43 44
A 45 46
A 47 48
A 49 50
A 51 52
A 53 54
A 55 56
A 57 58
A 59 60
A 61 62
A 63 64
A 65 66
A 67 68
A 69 70
A 71 72
A 73 74
A 75 7...

output:

1
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 499999 lines

Test #198:

score: 0
Accepted
time: 1938ms
memory: 410100kb

input:

499999
A 999997 999998
A 999995 999996
A 999993 999994
A 999991 999992
A 999989 999990
A 999987 999988
A 999985 999986
A 999983 999984
A 999981 999982
A 999979 999980
A 999977 999978
A 999975 999976
A 999973 999974
A 999971 999972
A 999969 999970
A 999967 999968
A 999965 999966
A 999963 999964
A 999...

output:

1
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 499999 lines

Test #199:

score: 0
Accepted
time: 1677ms
memory: 205652kb

input:

500000
A 50 911
A 990 1785
A 1860 2691
A 7 29
A 34 44
A 45 46
A 2865 3234
A 1803 1842
A 47 48
A 1846 1856
A 1787 1802
A 1857 1859
A 931 982
A 1844 1845
A 2719 2824
A 30 33
A 2 4
A 2849 2855
A 2862 2864
A 5 6
A 920 925
A 983 988
A 2693 2718
A 927 930
A 915 916
A 918 919
A 912 914
A 2856 2859
A 2828 2...

output:

861
1735
1701
904
37
12
12
12
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 500000 lines

Test #200:

score: 0
Accepted
time: 1236ms
memory: 198644kb

input:

500000
A 4 16
A 2 3
A 23 29
A 34 41
A 18 22
A 31 33
A 42 56
R 42 56
R 2 3
A 47 54
A 45 46
A 2 3
R 23 29
A 24 29
A 42 44
A 57 66
A 67 81
R 67 81
R 31 33
A 55 56
R 24 29
A 73 75
A 77 89
A 97 104
A 90 94
A 114 118
A 121 128
A 67 70
A 71 72
A 107 108
A 30 33
A 130 133
A 119 120
A 95 96
A 144 146
A 138 1...

output:

12
14
14
14
11
10
10
10
10
10
9
9
9
9
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 500000 lines

Test #201:

score: 0
Accepted
time: 1181ms
memory: 197124kb

input:

500000
A 8 9
A 14 16
A 2 7
A 19 23
A 10 12
A 25 29
A 30 37
A 17 18
R 8 9
A 8 9
A 38 39
A 40 42
A 46 50
A 51 53
A 44 45
A 55 59
A 60 67
R 51 53
A 52 53
R 25 29
A 68 73
R 8 9
R 55 59
A 8 9
A 76 80
A 74 75
A 24 29
A 54 59
A 82 83
A 87 90
R 60 67
A 60 67
A 85 86
R 30 37
A 91 95
A 102 103
R 8 9
A 104 109...

output:

1
8
7
7
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
3
3
3
3
4
4
4
4
4
4
4
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 500000 lines

Test #202:

score: 0
Accepted
time: 1745ms
memory: 213464kb

input:

500000
A 34 953
A 8 33
A 1098 1791
A 3 5
A 2355 2766
A 954 1093
A 3352 3687
A 1094 1097
A 2073 2233
A 2261 2321
A 6 7
A 2890 3049
A 3054 3331
A 2836 2876
A 2886 2888
A 3340 3345
A 3782 4574
A 4741 5342
A 2339 2349
A 1845 2023
A 4617 4707
A 4580 4597
A 2235 2246
A 4602 4604
A 3346 3348
A 2350 2352
A ...

output:

919
945
945
30
30
30
30
30
30
30
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3...

result:

ok 500000 lines

Test #203:

score: 0
Accepted
time: 1248ms
memory: 198384kb

input:

500000
A 2 12
A 13 18
A 20 33
A 35 36
A 47 48
A 55 60
A 49 54
A 42 46
A 70 73
A 76 88
A 40 41
A 65 66
A 67 69
A 74 75
A 38 39
A 94 98
A 99 100
A 89 91
R 65 66
A 104 105
A 92 93
A 62 64
R 13 18
A 13 19
A 101 103
A 65 66
R 49 54
A 49 50
R 74 75
A 53 54
A 107 109
A 110 112
A 51 52
A 74 75
A 117 127
A 1...

output:

10
16
16
16
13
13
7
6
6
6
6
6
4
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 500000 lines

Test #204:

score: 0
Accepted
time: 1163ms
memory: 197044kb

input:

500000
A 2 9
A 11 14
A 17 19
A 15 16
A 21 27
A 29 30
A 31 36
A 38 39
A 40 43
A 45 47
A 51 55
A 56 58
A 59 65
A 49 50
R 59 65
R 11 14
A 10 14
A 59 66
A 68 74
A 77 81
A 86 87
A 75 76
R 68 74
A 67 68
A 82 85
R 21 27
A 20 25
A 88 95
A 26 28
A 102 103
A 106 108
A 111 116
A 118 124
A 104 105
A 96 100
A 10...

output:

7
12
8
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3...

result:

ok 500000 lines

Test #205:

score: 0
Accepted
time: 1813ms
memory: 217484kb

input:

500000
A 15 316
A 756 986
A 3 8
A 10 14
A 339 668
A 318 323
A 1300 1724
A 1928 2004
A 2208 2663
A 2743 3604
A 1119 1238
A 3625 4526
A 3609 3624
A 1868 1897
A 4997 5311
A 713 725
A 676 693
A 1056 1108
A 1905 1922
A 737 752
A 1736 1867
A 2060 2203
A 2022 2026
A 754 755
A 324 333
A 727 735
A 1731 1734
...

output:

301
971
313
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
8
8
8
8
4
4
4
4
4
4
4
4
4
4
4
4
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 500000 lines

Test #206:

score: 0
Accepted
time: 1230ms
memory: 198420kb

input:

500000
A 2 16
A 22 26
A 18 21
A 35 37
A 39 48
A 50 58
A 63 72
A 76 82
A 86 87
A 90 102
A 27 32
A 104 115
A 120 124
A 84 85
A 125 130
A 73 75
A 88 89
A 33 34
R 125 130
A 59 62
R 18 21
A 129 138
A 117 119
A 127 128
R 120 124
A 17 18
A 121 124
A 142 149
A 125 126
A 155 157
R 76 82
A 19 21
A 150 152
A 1...

output:

14
24
8
8
8
8
8
8
8
8
8
8
8
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 500000 lines

Test #207:

score: 0
Accepted
time: 1152ms
memory: 197076kb

input:

500000
A 2 8
A 11 14
A 16 18
A 19 25
A 9 10
A 26 31
R 16 18
A 15 17
A 33 37
A 42 43
A 44 47
A 49 53
A 38 40
R 38 40
A 38 39
A 40 41
R 9 10
R 40 41
A 54 56
A 40 41
A 9 10
A 57 64
R 11 14
A 65 70
A 12 13
R 57 64
R 38 39
A 72 77
A 80 82
R 80 82
A 78 82
A 38 39
A 57 64
A 84 89
R 72 77
A 71 75
A 90 97
R ...

output:

6
12
7
7
5
5
5
5
5
5
5
5
5
5
5
3
3
5
5
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3...

result:

ok 500000 lines

Test #208:

score: 0
Accepted
time: 749ms
memory: 179024kb

input:

499999
A 1 2
A 101 102
A 201 202
A 301 302
A 401 402
A 501 502
A 601 602
A 701 702
A 801 802
A 901 902
A 1001 1002
A 1101 1102
A 1201 1202
A 1301 1302
A 1401 1402
A 1501 1502
A 1601 1602
A 1701 1702
A 1801 1802
A 1901 1902
A 2001 2002
A 2101 2102
A 2201 2202
A 2301 2302
A 2401 2402
A 2501 2502
A 260...

output:

1
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
10...

result:

ok 499999 lines

Test #209:

score: 0
Accepted
time: 744ms
memory: 178828kb

input:

499994
A 1 2
A 101 102
A 201 202
A 301 302
A 401 402
A 501 502
A 601 602
A 701 702
A 801 802
A 901 902
A 1001 1002
A 1101 1102
A 1201 1202
A 1301 1302
A 1401 1402
A 1501 1502
A 1601 1602
A 1701 1702
A 1801 1802
A 1901 1902
A 2001 2002
A 2101 2102
A 2201 2202
A 2301 2302
A 2401 2402
A 2501 2502
A 260...

output:

1
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
10...

result:

ok 499994 lines

Test #210:

score: 0
Accepted
time: 755ms
memory: 178972kb

input:

500000
A 1 2
A 101 102
A 201 202
A 301 302
A 401 402
A 501 502
A 601 602
A 701 702
A 801 802
A 901 902
A 1001 1002
A 1101 1102
A 1201 1202
A 1301 1302
A 1401 1402
A 1501 1502
A 1601 1602
A 1701 1702
A 1801 1802
A 1901 1902
A 2001 2002
A 2101 2102
A 2201 2202
A 2301 2302
A 2401 2402
A 2501 2502
A 260...

output:

1
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
10...

result:

ok 500000 lines

Test #211:

score: 0
Accepted
time: 762ms
memory: 179504kb

input:

499995
A 1 2
A 101 102
A 201 202
A 301 302
A 401 402
A 501 502
A 601 602
A 701 702
A 801 802
A 901 902
A 1001 1002
A 1101 1102
A 1201 1202
A 1301 1302
A 1401 1402
A 1501 1502
A 1601 1602
A 1701 1702
A 1801 1802
A 1901 1902
A 2001 2002
A 2101 2102
A 2201 2202
A 2301 2302
A 2401 2402
A 2501 2502
A 260...

output:

1
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
10...

result:

ok 499995 lines

Test #212:

score: 0
Accepted
time: 753ms
memory: 179064kb

input:

499991
A 1 2
A 101 102
A 201 202
A 301 302
A 401 402
A 501 502
A 601 602
A 701 702
A 801 802
A 901 902
A 1001 1002
A 1101 1102
A 1201 1202
A 1301 1302
A 1401 1402
A 1501 1502
A 1601 1602
A 1701 1702
A 1801 1802
A 1901 1902
A 2001 2002
A 2101 2102
A 2201 2202
A 2301 2302
A 2401 2402
A 2501 2502
A 260...

output:

1
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
101
10...

result:

ok 499991 lines

Subtask #5:

score: 0
Time Limit Exceeded

Test #213:

score: 3
Accepted
time: 2752ms
memory: 304472kb

input:

500000
A 177873 500336
A 457824 814681
A 841342 988692
A 419772 679383
A 932 397613
A 112565 840517
A 21558 993484
A 388360 943423
A 51953 706434
A 444776 874634
A 672973 719874
A 324528 972601
A 711851 858636
A 219651 966235
A 89897 472254
A 40578 919362
A 340868 944392
A 163582 585658
A 637082 954...

output:

322463
636808
530868
530868
530868
530868
530868
530868
530868
530868
315719
315719
315719
315719
315719
315719
315719
315719
315719
315719
315719
315719
315719
131305
131305
131305
131305
131305
131305
131305
131305
131305
131305
131305
131305
131305
131305
131305
131305
131305
131305
131305
131305...

result:

ok 500000 lines

Test #214:

score: 0
Accepted
time: 2184ms
memory: 220948kb

input:

500000
A 19984 450284
A 96761 997086
A 316867 923102
A 593966 846630
A 324820 370426
A 737058 767339
A 609035 732288
A 27614 753125
A 47817 778799
A 511932 911251
A 325127 545889
A 194006 849501
A 397366 989935
A 384642 644398
A 151785 160335
A 435217 791912
A 75861 637008
A 109997 799477
A 7242 712...

output:

430300
977102
903118
826646
521810
442519
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304
158304...

result:

ok 500000 lines

Test #215:

score: 0
Accepted
time: 1799ms
memory: 200152kb

input:

500000
A 111685 968715
A 186277 709985
A 565791 833397
A 357566 476482
A 504529 910778
A 262851 710970
A 666814 962461
A 112848 930053
A 5291 687264
A 298473 648758
A 163948 762721
A 455591 904212
A 418733 558691
A 581238 893994
A 144080 870515
A 364468 730718
A 192074 596046
A 555574 646266
A 16634...

output:

857030
523708
647120
475831
475831
475831
475831
475831
475831
475831
475831
475831
414664
414664
414664
414664
414664
288700
288700
288700
288700
288700
288700
288700
288700
288700
288700
288700
288700
288700
288700
208576
208576
208576
208576
208576
208576
197774
197774
197774
197774
197774
197774...

result:

ok 500000 lines

Test #216:

score: 0
Accepted
time: 917ms
memory: 182788kb

input:

500000
A 558637 801931
A 294450 833269
A 153742 489961
A 127456 979454
A 55544 888378
A 440730 950479
A 12565 984056
A 528996 783709
A 213138 746144
A 91639 628875
A 553285 988400
A 576669 855051
A 192059 333695
A 141236 394580
A 382106 947539
A 64124 924508
A 778749 794755
A 755863 801496
A 55077 9...

output:

243294
243294
648189
648189
648189
648189
648189
629967
629967
629967
629967
629967
591650
591650
591650
591650
581617
581617
581617
533230
519972
519972
161687
161687
154641
154641
154641
154641
154641
154641
154641
154641
56045
56045
56045
56045
56045
56045
56045
56045
56045
56045
56045
56045
5604...

result:

ok 500000 lines

Test #217:

score: 0
Accepted
time: 2765ms
memory: 304416kb

input:

500000
A 234784 454240
A 35927 726034
A 199864 893674
A 6300 902052
A 148927 934045
A 23175 971487
A 52447 944060
A 50151 838211
A 332025 983793
A 116592 543243
A 815802 969568
A 52697 869847
A 593709 821107
A 34236 599602
A 480157 773402
A 426387 711687
A 347586 912882
A 545320 564548
A 42056 30615...

output:

219456
219456
219456
219456
219456
219456
219456
219456
749009
749009
734784
734784
586323
586323
489411
489411
489411
275787
275787
250464
249627
249627
249627
249627
249627
249627
249627
249627
249627
249627
249627
249627
249627
249627
249627
249627
249627
249627
249627
249627
249627
249627
249627...

result:

ok 500000 lines

Test #218:

score: 0
Accepted
time: 2247ms
memory: 223452kb

input:

500000
A 91891 520662
A 5187 978665
A 99454 891385
A 35838 872092
A 53837 949377
A 23616 973780
A 11141 277417
A 410530 594540
A 850906 953742
A 515721 562539
A 489271 786737
A 37722 989662
A 16782 437353
A 103419 143994
A 73520 216011
A 163841 986159
A 261819 751405
A 73415 735715
A 444223 722381
A...

output:

428771
428771
799494
799494
799494
799494
880244
583399
543212
438021
438021
438021
438021
438021
438021
438021
438021
438021
438021
438021
438021
438021
435711
435711
435711
364021
364021
364021
364021
364021
364021
364021
364021
364021
364021
364021
364021
47277
47277
47277
47277
47277
47277
47277...

result:

ok 500000 lines

Test #219:

score: 0
Accepted
time: 1849ms
memory: 202312kb

input:

500000
A 79554 998452
A 287810 904792
A 7358 984285
A 606383 881616
A 455647 768589
A 288291 872899
A 647089 988605
A 69198 510397
A 204517 270990
A 682065 993391
A 227123 967079
A 98582 316356
A 163050 704572
A 52462 983538
A 282057 897258
A 114061 844401
A 81354 994629
A 56846 119721
A 202909 9663...

output:

918898
616982
616982
275233
425969
425969
532958
812418
564072
564072
564072
564072
564072
564072
564072
564072
564072
214144
214144
214144
214144
214144
214144
214144
214144
214144
214144
214144
214144
214144
214144
214144
91326
91326
91326
91326
91326
91326
91326
91326
91326
91326
91326
91326
9132...

result:

ok 500000 lines

Test #220:

score: 0
Accepted
time: 1180ms
memory: 187280kb

input:

500000
A 105065 809599
A 113878 549691
A 216112 913990
A 543570 970438
A 243198 740583
A 18650 916836
A 259253 415061
A 403053 520635
A 226220 992223
A 244697 779219
A 44176 476084
A 208793 557996
A 561167 871879
A 138238 500605
A 446625 866884
A 224511 995783
A 123648 510126
A 461453 468858
A 52587...

output:

704534
435813
800112
856560
856560
856560
711185
567385
567385
567385
567385
567385
468826
468826
468826
468826
468826
209605
209605
209605
209605
209605
209605
209605
209605
209605
209605
209605
209605
209605
209605
209605
209605
209605
209605
209605
209605
209605
209605
209605
209605
209605
209605...

result:

ok 500000 lines

Test #221:

score: 0
Accepted
time: 2995ms
memory: 357324kb

input:

500000
A 68695 761692
A 231489 697852
A 90751 897782
A 146149 861457
A 90504 962118
A 49244 989540
A 290616 971184
A 143883 660336
A 140502 557853
A 448056 603571
A 207431 995670
A 26868 768883
A 158519 431142
A 856814 963662
A 109568 970724
A 92564 994447
A 25021 508969
A 42303 985457
A 178549 4740...

output:

692997
466363
466363
466363
466363
466363
739695
827301
830682
463069
463069
463069
445052
445052
445052
445052
445052
445052
445052
445052
445052
381946
235766
235766
235766
235766
235766
207716
207716
207716
207716
207716
207716
207716
207716
207716
207716
207716
135533
135533
135533
135533
135533...

result:

ok 500000 lines

Test #222:

score: 0
Accepted
time: 2896ms
memory: 328900kb

input:

500000
A 770819 787261
A 5195 998530
A 254291 964712
A 453593 726544
A 190568 307988
A 156549 376704
A 85843 914300
A 329515 393709
A 620310 860323
A 1379 938059
A 174204 756820
A 881485 896990
A 246318 949988
A 39035 994849
A 639302 862810
A 277813 882069
A 124906 940457
A 41974 812721
A 724128 795...

output:

16442
16442
16442
333668
333668
333668
333668
203141
203141
203141
203141
126171
126171
126171
126171
126171
126171
126171
126171
126171
126171
126171
126171
126171
126171
126171
126171
126171
126171
126171
126171
126171
126171
126171
126171
126171
126171
126171
126171
126171
126171
126171
126171
12...

result:

ok 500000 lines

Test #223:

score: 0
Accepted
time: 2844ms
memory: 320420kb

input:

500000
A 710616 712540
A 2040 233649
A 20433 498966
A 5550 548935
A 713780 795274
A 4630 990551
A 34962 846350
A 487935 702498
A 76351 566813
A 38072 895264
A 246008 700517
A 40331 692231
A 230960 935398
A 434424 958223
A 852487 968358
A 90391 895767
A 181321 286500
A 551707 782843
A 400202 630501
A...

output:

1924
710500
692107
692107
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
84658
8465...

result:

ok 500000 lines

Test #224:

score: 0
Accepted
time: 2825ms
memory: 320028kb

input:

500000
A 283982 695145
A 49092 986855
A 153508 620007
A 50326 618823
A 387753 704694
A 25597 974235
A 33130 245374
A 46614 981559
A 145898 640294
A 53999 297286
A 827271 959634
A 2497 986173
A 277133 484301
A 192814 571996
A 23341 949037
A 441938 752712
A 483272 550787
A 11067 944758
A 378318 795786...

output:

411163
411163
541637
644819
654368
654368
662015
662015
662015
650695
571881
571881
451171
451171
451171
451171
451171
451171
451171
451171
444334
444334
444334
444334
444334
444334
444334
444334
444334
444334
444334
444334
444334
444334
444334
444334
444334
444334
444334
196002
196002
196002
196002...

result:

ok 500000 lines

Test #225:

score: 0
Accepted
time: 3059ms
memory: 383692kb

input:

500000
A 112333 215292
A 198247 296263
A 82201 644457
A 207716 471297
A 141889 998945
A 488919 970172
A 218948 963749
A 237901 416339
A 125400 967510
A 27776 975105
A 99542 868414
A 76616 693704
A 279230 568538
A 268003 865014
A 93854 579028
A 365734 934121
A 48461 670932
A 47095 988387
A 37101 7606...

output:

102959
183930
183930
358964
358964
762456
762456
304006
304006
304006
304006
304006
304006
304006
304006
304006
304006
304006
304006
304006
294215
294215
294215
294215
294215
294215
294215
294215
294215
294215
294215
268233
268233
187041
187041
91116
91116
91116
91116
91116
91116
91116
91116
91116
9...

result:

ok 500000 lines

Test #226:

score: 0
Accepted
time: 3028ms
memory: 383660kb

input:

500000
A 392248 898366
A 652024 654558
A 338941 989341
A 303671 319786
A 5456 911729
A 207478 986056
A 808551 905818
A 4193 997597
A 9165 893380
A 341848 473385
A 108987 392149
A 180572 548315
A 166161 809516
A 429284 746522
A 664084 932640
A 376240 445523
A 294028 590758
A 211973 515928
A 91068 648...

output:

506118
2534
2534
350887
350887
350887
253794
253794
253794
169714
169714
169714
169714
169714
169714
141852
141852
141852
141852
141852
141852
141852
141852
141852
141852
141852
141852
141852
141852
141852
141852
141852
141852
141852
141852
141852
141852
141852
141852
141852
141852
141852
141852
141...

result:

ok 500000 lines

Test #227:

score: 0
Accepted
time: 3061ms
memory: 383852kb

input:

500000
A 85050 499753
A 277494 978684
A 173020 349614
A 122631 942803
A 244146 575946
A 247912 770910
A 9741 768934
A 397912 931207
A 60899 959399
A 264008 793949
A 158318 353960
A 355569 971885
A 461012 937405
A 17224 853551
A 41538 946158
A 650620 997713
A 29650 630636
A 30133 419975
A 537387 9890...

output:

414703
893634
805664
805664
805664
805664
805664
758187
758187
758187
758187
758187
758187
758187
758187
753567
753567
753567
753567
729772
729772
729772
729772
303308
303308
303308
303308
303308
303308
303308
303308
303308
303308
303308
141495
141495
141495
118099
118099
118099
118099
118099
118099...

result:

ok 500000 lines

Test #228:

score: 0
Accepted
time: 3054ms
memory: 383408kb

input:

500000
A 32624 835082
A 243135 590860
A 772616 842359
A 696404 991717
A 146676 983480
A 53943 988023
A 27891 781092
A 397 991940
A 25529 145866
A 121982 846846
A 71798 995975
A 34276 998585
A 752663 899357
A 15334 439611
A 242298 601340
A 356 999601
A 160194 829759
A 718950 783530
A 548239 963845
A ...

output:

802458
347725
599224
599224
599224
599224
599224
599224
565331
565331
565331
565331
565331
565331
565331
565331
565331
540395
540395
540395
540395
267351
267351
267351
267351
267351
267351
267351
267351
267351
267351
267351
267351
267351
267351
267351
267351
267351
258813
258813
258813
258813
258813...

result:

ok 500000 lines

Test #229:

score: 0
Accepted
time: 2761ms
memory: 302372kb

input:

500000
A 80813 601431
A 25450 795554
A 490672 541909
A 298236 903882
A 10206 891586
A 56745 818006
A 230949 459579
A 268265 817754
A 19147 531110
A 277844 366217
A 743546 793987
A 163764 440517
A 172019 953448
A 394895 958169
A 33859 59493
A 7139 582511
A 4545 182910
A 266602 524668
A 28715 802238
A...

output:

520618
520618
51237
51237
51237
51237
310960
310960
310960
264065
264065
264065
264065
264065
264065
264065
264065
264065
264065
264065
264065
264065
264065
264065
264065
264065
264065
264065
264065
264065
264065
264065
264065
230361
230361
230361
230361
230361
230361
230361
230361
230361
53167
5316...

result:

ok 500000 lines

Test #230:

score: 0
Accepted
time: 2147ms
memory: 220540kb

input:

500000
A 149997 443522
A 121631 699028
A 100227 868915
A 97863 952770
A 43573 995765
A 535398 686034
A 6934 998103
A 577364 663033
A 577926 731165
A 21622 738723
A 26056 517779
A 154706 629935
A 37189 999495
A 374712 984546
A 105156 730051
A 3226 998761
A 581349 724667
A 33164 999661
A 127371 150787...

output:

293525
293525
293525
293525
293525
536037
536037
513036
513036
513036
513036
513036
513036
513036
513036
513036
513036
513036
502564
502564
342004
340512
340512
340512
340512
145300
145300
145300
145300
145300
145300
145300
145300
145300
145300
145300
145300
145300
145300
145300
145300
145300
145300...

result:

ok 500000 lines

Test #231:

score: 0
Accepted
time: 1779ms
memory: 200148kb

input:

500000
A 457824 573607
A 51148 569627
A 572467 851825
A 10427 935460
A 230939 367918
A 132217 342976
A 16289 389672
A 21361 87860
A 546860 743637
A 128190 915220
A 91922 774463
A 325283 972399
A 282914 341044
A 76276 897959
A 32957 674320
A 66648 780667
A 18903 929454
A 13726 731624
A 309364 996636
...

output:

115783
522459
800677
800677
342668
342668
342668
321615
321615
321615
321615
321615
290693
290693
290693
290693
290693
290693
290693
267542
267542
267542
267542
267542
267542
267542
267542
267542
267542
267542
267542
267542
140240
140240
140240
140240
140240
140240
140240
140240
140240
140240
140240...

result:

ok 500000 lines

Test #232:

score: 0
Accepted
time: 894ms
memory: 182492kb

input:

500000
A 520961 673676
A 201458 938433
A 124984 994103
A 456005 758150
A 612075 726301
A 565003 926290
A 48017 994915
A 226979 235211
A 246047 895215
A 383157 499755
A 207236 874881
A 240208 980312
A 57441 227552
A 635948 930537
A 12392 663162
A 289674 619702
A 156160 949206
A 43899 994411
A 273677 ...

output:

152715
152715
152715
152715
205340
205340
205340
446697
446697
272776
272776
272776
272776
272776
272776
272776
272776
272776
272776
210917
210917
210917
210917
210917
210917
210917
210917
210917
210917
210917
148736
148736
148736
71732
71732
71732
71732
71732
71732
71732
71732
71732
71732
71732
717...

result:

ok 500000 lines

Test #233:

score: 0
Accepted
time: 2743ms
memory: 304804kb

input:

500000
A 100786 626405
A 190822 388237
A 42331 801157
A 704715 800701
A 63541 877378
A 794978 888416
A 813438 966953
A 561812 627424
A 13519 830749
A 385743 678141
A 402084 973970
A 796668 957209
A 104625 201165
A 11127 819495
A 142624 165691
A 235220 891862
A 376592 668566
A 438305 737471
A 57019 8...

output:

525619
197415
197415
609879
609879
609879
262238
238889
238889
238889
238889
238889
238889
238889
238889
238889
238889
238889
238889
214183
214183
214183
214183
214183
214183
214183
214183
214183
214183
214183
214183
214183
214183
214183
214183
162762
162762
162762
162762
162762
162762
162762
162762...

result:

ok 500000 lines

Test #234:

score: 0
Accepted
time: 2374ms
memory: 223192kb

input:

500000
A 107869 734796
A 60909 447635
A 93048 906822
A 301577 388211
A 10100 882010
A 371199 376325
A 95868 751290
A 176946 789933
A 205653 537339
A 77741 115424
A 23502 996158
A 32668 866020
A 68547 803616
A 202225 287067
A 441522 638780
A 44063 959134
A 9466 389759
A 229279 511386
A 364937 921608
...

output:

626927
673887
673887
86634
86634
5126
5126
5126
5126
298584
298584
298584
298584
174100
174100
174100
174100
174100
174100
174100
174100
174100
174100
174100
174100
174100
174100
174100
174100
174100
174100
174100
150885
150885
150885
150885
150885
148565
148565
148565
148565
148565
148565
148565
14...

result:

ok 500000 lines

Test #235:

score: 0
Accepted
time: 1884ms
memory: 202600kb

input:

500000
A 253262 999340
A 675006 997470
A 81455 999485
A 846084 938824
A 170360 996324
A 235616 829436
A 8201 998684
A 7035 998885
A 777835 974862
A 90062 859996
A 564754 999610
A 10449 999526
A 867559 948166
A 228794 859058
A 517339 866815
A 632496 671186
A 2144 999519
A 29546 952477
A 31293 980404
...

output:

746078
322464
322464
92740
92740
703208
703208
703208
703208
703208
703208
703208
703208
703208
430827
306328
306328
306328
306328
299585
131468
131468
131468
131468
131468
131468
131468
131468
131468
131468
131468
131468
131468
131468
131468
131468
131468
131468
131468
131468
131468
131468
131468
1...

result:

ok 500000 lines

Test #236:

score: 0
Accepted
time: 1238ms
memory: 188448kb

input:

500000
A 608895 934276
A 152953 894929
A 211186 953143
A 789627 878913
A 593873 822973
A 619230 727544
A 121716 816660
A 267215 801098
A 357365 844822
A 102612 919378
A 83341 974666
A 446829 774917
A 884174 975014
A 752544 844439
A 74764 993568
A 795295 952386
A 760662 945662
A 88314 830513
A 181097...

output:

325381
781323
781323
89286
285040
259683
259683
259683
259683
259683
259683
259683
185387
185387
185387
185387
185387
185387
185387
164716
164716
164716
164716
164716
164716
158107
158107
158107
158107
158107
154343
133856
104231
104231
104231
104231
104231
104231
104231
72456
72456
72456
41809
4180...

result:

ok 500000 lines

Test #237:

score: 0
Accepted
time: 3043ms
memory: 355200kb

input:

500000
A 133 999293
A 32573 977834
A 354626 659555
A 11 999392
A 131350 580020
A 30614 607915
A 445287 598586
A 1643 981708
A 164925 769304
A 125035 726538
A 2656 985905
A 230205 457333
A 178450 384977
A 24646 977866
A 93372 967720
A 112875 668898
A 1485 999098
A 369288 723292
A 196221 521389
A 1929...

output:

999160
945261
304929
304929
528205
528205
467236
467236
467236
467236
467236
368381
420136
420136
420136
420136
420136
420136
420136
420136
420136
420136
420136
388555
388555
388555
388555
388555
388555
388555
388555
381920
183095
183095
183095
183095
183095
183095
183095
183095
183095
183095
183095...

result:

ok 500000 lines

Test #238:

score: 0
Accepted
time: 2857ms
memory: 326728kb

input:

500000
A 107418 257563
A 140374 546957
A 96537 700278
A 128246 614257
A 396753 436314
A 15205 431998
A 417603 637528
A 125788 750140
A 308597 356901
A 317437 482091
A 344687 821622
A 101647 591573
A 425019 616466
A 401044 507348
A 530634 652758
A 546406 681270
A 165359 751938
A 368756 412605
A 91317...

output:

150145
439539
439539
439539
328896
328896
328896
328896
127717
127717
127717
127717
127717
127717
127717
127717
127717
104008
104008
104008
104008
104008
104008
104008
104008
104008
104008
104008
104008
104008
104008
104008
104008
104008
104008
104008
104008
104008
104008
84213
84213
84213
84213
842...

result:

ok 500000 lines

Test #239:

score: 0
Accepted
time: 2853ms
memory: 320232kb

input:

500000
A 38300 903448
A 68264 976944
A 452807 513697
A 167183 794267
A 28848 737343
A 23754 921046
A 4673 747682
A 11524 983286
A 9835 923393
A 177999 654247
A 287344 397359
A 101255 721664
A 5424 993076
A 460173 465220
A 44707 953862
A 6255 999083
A 332047 888710
A 211744 277624
A 35414 764151
A 42...

output:

865148
938644
60890
60890
60890
60890
60890
60890
60890
60890
226353
226353
226353
177876
177876
177876
177876
177876
177876
177876
177876
177876
177876
177876
177876
177876
177876
177876
177876
177876
177876
177876
177876
177876
177876
177876
177876
177876
177876
177876
101030
101030
101030
101030
...

result:

ok 500000 lines

Test #240:

score: 0
Accepted
time: 2948ms
memory: 318992kb

input:

500000
A 171089 267553
A 615755 831273
A 101676 684944
A 768122 920228
A 780586 938677
A 196926 208258
A 304750 962033
A 454452 857362
A 617974 630520
A 159947 966969
A 301489 876544
A 300332 477816
A 413793 670263
A 281886 683167
A 3306 526471
A 419547 426801
A 52233 973188
A 29292 659312
A 15839 6...

output:

96464
660184
660184
660184
660184
634347
634347
634347
302254
302254
302254
280890
280890
280890
280890
210973
210973
210973
210973
210973
210973
210973
210973
210973
210973
210973
210973
210973
210973
210973
210973
78899
78899
78899
78899
78899
78899
78899
78899
78899
78899
78899
78899
78899
78899
...

result:

ok 500000 lines

Test #241:

score: 0
Accepted
time: 3131ms
memory: 382388kb

input:

500000
A 79742 241925
A 329513 698170
A 92230 748270
A 150665 154593
A 184471 313521
A 92222 123535
A 41377 912690
A 32983 527604
A 28202 901873
A 162886 813157
A 291138 682379
A 75993 154153
A 509522 863390
A 60019 379076
A 493947 702684
A 133352 963943
A 97112 876256
A 14287 606763
A 99667 472262
...

output:

162183
618428
618428
547505
162856
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
62371
6...

result:

ok 500000 lines

Test #242:

score: 0
Accepted
time: 3091ms
memory: 382540kb

input:

500000
A 14465 819111
A 240057 693080
A 604646 862002
A 259681 631722
A 7104 879356
A 808978 854919
A 255990 826310
A 705211 904338
A 473258 477905
A 178822 959100
A 191837 258842
A 75171 822341
A 61854 200708
A 579147 774122
A 576477 867188
A 315696 893238
A 353272 476990
A 67867 992072
A 757445 83...

output:

804646
453023
621945
602321
602321
595238
595238
595238
381661
381661
286068
286068
286068
275772
275772
275772
275772
275772
275772
275772
275772
275772
275772
275772
275772
275772
275772
275772
275772
275772
275772
275772
275772
275772
275772
275772
206965
206965
206965
206965
164975
164975
164975...

result:

ok 500000 lines

Test #243:

score: 0
Accepted
time: 3066ms
memory: 382068kb

input:

500000
A 146154 694560
A 880355 994793
A 93028 147222
A 439132 801438
A 247687 969366
A 982334 987445
A 85343 992143
A 666572 833489
A 18343 673974
A 808128 999961
A 74287 340741
A 162569 749564
A 2931 856989
A 620253 891018
A 368584 863239
A 951927 998926
A 312621 620530
A 11729 697812
A 64380 9999...

output:

548406
848639
848639
555661
555661
548313
548313
320873
320873
320873
320873
320873
320873
320873
320873
320873
320873
320873
320873
320873
189891
189891
189891
189891
99963
99963
99963
99963
99963
99963
99963
99963
99963
99963
99963
99963
99963
99963
99963
99963
99963
99963
99963
99963
99963
99963
...

result:

ok 500000 lines

Test #244:

score: 0
Accepted
time: 3101ms
memory: 382180kb

input:

500000
A 174452 264072
A 23421 430370
A 16123 898561
A 200437 309249
A 158223 500668
A 76303 210908
A 239623 255073
A 94901 615458
A 3433 264534
A 15499 974778
A 45224 755994
A 239342 344543
A 5165 684811
A 408376 663299
A 53114 100300
A 111300 689829
A 131360 426454
A 1076 11524
A 201768 265714
A 2...

output:

89620
89620
89620
134797
134797
232946
178770
178770
178770
178770
178770
178770
178770
178770
178770
178770
178770
99224
99224
99224
99224
99224
99224
99224
99224
99224
99224
99224
99224
99224
99224
99224
99224
99224
99224
99224
99224
99224
99224
89313
89313
89313
89313
89313
89313
80580
80580
8058...

result:

ok 500000 lines

Test #245:

score: 0
Accepted
time: 397ms
memory: 167548kb

input:

500000
A 280521 934842
A 525724 709077
R 280521 934842
A 546921 709787
R 525724 709077
A 383633 608222
R 546921 709787
A 2632 931075
R 383633 608222
A 263344 970605
R 2632 931075
A 61622 421783
R 61622 421783
A 539085 999815
R 539085 999815
A 108109 420386
R 108109 420386
A 364062 391409
R 263344 97...

output:

654321
183353
183353
184063
162866
326154
224589
224589
928443
967973
707261
908983
707261
736471
707261
862496
707261
27347
27347
27347
27347
27347
375776
748830
294630
294630
740367
762393
373793
823589
373793
907351
373793
320141
320141
320141
790020
843959
396328
836866
396328
555093
329024
3290...

result:

ok 500000 lines

Test #246:

score: 0
Accepted
time: 397ms
memory: 167468kb

input:

500000
A 706409 827114
A 431630 742918
R 706409 827114
A 443955 947053
R 443955 947053
A 64486 850127
R 431630 742918
A 266003 631802
R 64486 850127
A 540266 740133
R 266003 631802
A 355718 501055
R 355718 501055
A 19372 914551
R 540266 740133
A 92448 315733
R 19372 914551
A 174330 613506
R 174330 6...

output:

120705
395484
311288
515423
311288
311288
785641
365799
365799
474130
199867
384415
199867
199867
895179
223285
223285
521058
223285
223285
223285
830921
825126
505951
825126
481195
825126
182670
182670
337900
182670
558612
278867
394734
278867
401632
319573
319573
837371
7106
7106
7106
7106
7106
46...

result:

ok 500000 lines

Test #247:

score: 0
Accepted
time: 404ms
memory: 167488kb

input:

500000
A 516259 890793
A 127596 705300
R 516259 890793
A 236754 720092
R 127596 705300
A 17 974105
R 17 974105
A 175024 807542
R 175024 807542
A 321155 754165
R 236754 720092
A 125368 961501
R 125368 961501
A 207696 596680
R 207696 596680
A 22581 994341
R 321155 754165
A 79012 869340
R 79012 869340
...

output:

374534
763197
577704
592496
483338
483338
483338
483338
483338
517411
433010
433010
433010
546469
433010
433010
971760
790328
971760
875258
971760
269021
971760
286494
971760
739164
971760
732763
732763
732763
921848
703896
703896
799061
703896
733489
703896
880143
703896
703896
720013
256470
720013...

result:

ok 500000 lines

Test #248:

score: 0
Accepted
time: 397ms
memory: 167684kb

input:

500000
A 177508 182826
A 117113 987791
R 177508 182826
A 926824 974251
R 117113 987791
A 81190 925671
R 926824 974251
A 437118 924597
R 81190 925671
A 145983 447407
R 437118 924597
A 28955 386828
R 28955 386828
A 452261 696582
R 145983 447407
A 271345 981314
R 271345 981314
A 589413 982301
R 589413 ...

output:

5318
5318
870678
47427
47427
893061
844481
487479
487479
778614
301424
418452
301424
550599
244321
244321
244321
530040
244321
406344
169735
169735
169735
169735
645559
882183
124872
842978
124872
916919
124872
886609
764528
841980
645215
834662
645215
668053
645215
645215
966738
57316
966738
539114...

result:

ok 500000 lines

Test #249:

score: 0
Accepted
time: 1110ms
memory: 185432kb

input:

500000
A 69507 872880
A 109112 785425
A 375170 537353
A 268714 471589
R 375170 537353
R 109112 785425
A 300143 432184
R 300143 432184
A 2807 999957
R 2807 999957
A 118461 980169
A 37970 912813
A 43063 531176
A 69429 982394
R 268714 471589
A 624919 642649
R 69429 982394
A 14742 661903
A 311074 633103...

output:

803373
676313
162183
268639
202875
202875
132041
202875
202875
202875
202875
202875
202875
202875
937106
599586
599586
599586
599586
599586
599586
590040
590040
529218
529218
529218
227751
227751
227751
227751
227751
500343
500343
520889
555052
555052
555052
555052
450331
450331
450331
450331
450331...

result:

ok 500000 lines

Test #250:

score: 0
Accepted
time: 1189ms
memory: 186824kb

input:

500000
A 101701 898375
A 125482 925455
A 184328 415141
R 125482 925455
A 62694 537904
R 62694 537904
A 315669 395073
A 618328 942549
R 618328 942549
R 184328 415141
A 6821 881440
A 4861 996936
A 285807 500263
A 45464 377488
A 19886 919566
A 23568 310827
R 285807 500263
A 275737 914788
R 6821 881440
...

output:

796674
823754
230813
230813
230813
230813
79404
626880
79404
79404
79404
79404
79404
349609
349609
371505
371505
371505
371505
371505
371505
349609
349609
349609
79404
445289
209086
350890
350890
591493
815602
660489
660489
28921
524290
826512
660489
715987
714022
768747
580738
580738
580738
580738
...

result:

ok 500000 lines

Test #251:

score: 0
Accepted
time: 1276ms
memory: 187832kb

input:

500000
A 250096 859398
A 37 999572
R 37 999572
A 411376 900999
R 250096 859398
A 55751 395720
R 55751 395720
A 902308 983795
R 902308 983795
A 105670 217544
R 411376 900999
A 204304 883510
A 216125 735673
R 216125 735673
R 204304 883510
A 103369 991648
R 105670 217544
A 232029 890473
A 102487 236722...

output:

609302
609302
609302
650903
489623
845248
489623
572419
489623
795329
111874
777840
630003
777840
111874
111874
888279
658444
787986
719775
571563
262787
270118
262787
262787
531238
531238
636098
636098
636098
636098
636098
65323
740800
678679
678679
678679
678679
678679
678679
746856
805924
805924
...

result:

ok 500000 lines

Test #252:

score: 0
Accepted
time: 810ms
memory: 176392kb

input:

500000
A 251375 290466
A 552623 629172
R 251375 290466
A 12551 923216
A 194285 712895
R 552623 629172
A 433867 971144
R 433867 971144
R 194285 712895
A 155440 641738
R 12551 923216
A 39856 617925
A 11847 479095
A 403238 792152
R 11847 479095
A 180878 788606
A 439252 838478
A 26797 978529
R 439252 83...

output:

39091
377797
76549
76549
76549
518610
776859
518610
910665
486298
486298
601882
629891
780305
752296
752296
798622
798622
752296
686973
588628
588628
588628
588628
588628
588628
588628
584442
646219
646219
646219
646219
513683
513683
513683
513683
513683
513383
513383
513383
513383
513383
513383
513...

result:

ok 500000 lines

Test #253:

score: -3
Time Limit Exceeded

input:

500000
A 481481 786805
A 62162 514731
A 486657 880948
A 115135 368462
R 115135 368462
A 689283 762542
A 21190 995474
A 564869 656065
R 481481 786805
A 10634 991919
R 62162 514731
A 386664 858137
A 6190 993299
R 6190 993299
A 437985 809108
A 34528 797972
A 350169 783734
A 385188 639636
A 72034 140270...

output:

305324
724643
818786
671670
818786
700380
700380
197673
197673
197673
197673
197673
197673
197673
197673
197673
197673
197673
197673
197673
197673
197673
197673
197673
197673
197673
197673
197673
197673
164938
164938
164938
164938
164938
164938
164938
150478
150478
150478
150478
150478
150478
150478...

result: